Skip to content

How to Sub-class Signer? #1295

Answered by ricmoo
tomarsachin2271 asked this question in Q&A
Feb 15, 2021 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

You probably want to sub-class Signer, not Provider.

The ethers library handles Signers and Providers as completely separate things; it sounds like you are coming from Web3.js.

If you sub-class Signer I think everything will just work for you. You only need to provide implementations for the 4 abstract methods and you should be good to go. You also probably want your Signer to take a provider in and expose it as the .provider property.

The VoidSigner is also a great starting point for a minimal Signer. Just drop in your implementation. :)

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@TedMurphy
Comment options

Answer selected by tomarsachin2271
Comment options

You must be logged in to vote
1 reply
@TedMurphy
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #1294 on February 16, 2021 07:25.