use-wallet
use-wallet copied to clipboard
bsc example not working
HI, there
I downloaded this repo but no working.
Please check
same question, the bsc configuration is not seen in connectors
<UseWalletProvider
connectors={{
bsc: () => ({
web3ReactConnector() {
return bscConnector
},
handleActivationError(err: any) {
if (err instanceof UserRejectedRequestError) {
return new ConnectionRejectedError()
}
},
}),
}}
>
{children}
</UseWalletProvider>
Use it like this
same question, the bsc configuration is not seen in connectors
same issue
ConnectorUnsupportedError: Unsupported connector: bsc.
Hey all, thanks for reporting this.
We'll be having a look at why the example is not working.
Also noted that in version <=0.8.1 bsc example works, but starting 0.9.0 it throws error above. If it will help.
wen custom EVM not only eth/polygon
Hey guys! Someone found a solution for this?
Hey guys! I found a solution:
connectors={{
bsc: () => {
return {
web3ReactConnector: () => {
return new BscConnector({ supportedChainIds: [config.chainId] });
},
handleActivationError: (err: any) => {
if (err instanceof UserRejectedRequestError) {
return new ConnectionRejectedError();
}
return null;
},
};
},
}}
@jbc-deve @voroncv are correct.
from connectors.ts, we should configure the connector as a function if it is a new customized connector,
for (const [id, initOrConfig] of Object.entries(initsOrConfigs)) {
// If initOrConfig is a function, it is an initializer.
if (typeof initOrConfig === 'function') {
connectors[id] = [initOrConfig as ConnectorInit, null]
continue
}
// Otherwise it is a config
if (connectors[id]) {
connectors[id][1] = initOrConfig as ConnectorConfig
}