use-wallet icon indicating copy to clipboard operation
use-wallet copied to clipboard

bsc example not working

Open bulldogswap opened this issue 4 years ago • 9 comments

HI, there

I downloaded this repo but no working.

Please check

bulldogswap avatar Jun 28 '21 05:06 bulldogswap

same question, the bsc configuration is not seen in connectors

myxtype avatar Jul 01 '21 02:07 myxtype

<UseWalletProvider
        connectors={{
          bsc: () => ({
            web3ReactConnector() {
              return bscConnector
            },
            handleActivationError(err: any) {
              if (err instanceof UserRejectedRequestError) {
                return new ConnectionRejectedError()
              }
            },
          }),
        }}
      >
        {children}
      </UseWalletProvider>

Use it like this

jbc-deve avatar Sep 14 '21 14:09 jbc-deve

same question, the bsc configuration is not seen in connectors

same issue

ConnectorUnsupportedError: Unsupported connector: bsc.

madnomad420 avatar Oct 15 '21 12:10 madnomad420

Hey all, thanks for reporting this.

We'll be having a look at why the example is not working.

WissenIstNacht avatar Oct 15 '21 13:10 WissenIstNacht

Also noted that in version <=0.8.1 bsc example works, but starting 0.9.0 it throws error above. If it will help.

madnomad420 avatar Oct 15 '21 14:10 madnomad420

wen custom EVM not only eth/polygon

sascha1337 avatar Oct 21 '21 06:10 sascha1337

Hey guys! Someone found a solution for this?

LucasCodr avatar Nov 22 '21 22:11 LucasCodr

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;
      },
    };
  },
}}

voroncv avatar Jan 16 '22 09:01 voroncv

@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
    }
  

linxux avatar Nov 24 '22 15:11 linxux