Support for passing a custom provider that is *not* a signer
Closed this issue · 1 comments
Currently, if the client passes a Provider into the DelegateCash
constructor, it is assumed that this provider can also be used as a signer.
Specifically, these lines in the DelegateCash
construtor:
if (provider) {
this.provider = provider;
this.signer = this.provider.getSigner();
}
In my use-case, I have a custom provider (spefically, an Alchemy node provider), which I want to use because it is not subject to rate limiting etc., but it is not valid for use as a signer.
Therefore, for me, during the DelegateCash
instantiation, this line throws:
this.signer = this.provider.getSigner();
with an error like:
Error: API provider does not support signing (operation=\"getSigner\", code=UNSUPPORTED_OPERATION, version=providers/5.7.2)
I'm only instantiating this object to call getDelegationsByDelegate
, which doesn't use this.signer
. So I want some way for me to pass this custom provider without the library trying to turn it into a signer, as I won't be using any of the signer
functionality.
Thanks for the explanation! Originally, the only allowed type JsonRpcProvider
or a Web3Provider.
These work with Alchemy, etc but can see how it would be beneficial to allow any type so I made that adjustment in 0.4.5 to allow for providers with no signer.