near / wallet-selector

This is a wallet selector modal that allows users to interact with NEAR dApps with a selection of available wallets.
https://near.github.io/wallet-selector/
Apache License 2.0
151 stars 153 forks source link

fix FailoverRpcProvider import #1182

Open kdonthi opened 2 months ago

kdonthi commented 2 months ago

Thanks for taking the time to submit a pull request!

If you haven't already, be sure to take a look at the CONTRIBUTING documentation to get up to speed with the practices in this repository.

When you're ready, switch to the "Preview" tab to select an applicable template:

andy-haynes commented 2 months ago

What problem does this address? That class is just re-exported from near-api-js, so this change should be a no-op.

Importing it like this only adds a dependency reference without adding it to package.json.

kdonthi commented 2 months ago

What problem does this address? That class is just re-exported from near-api-js, so this change should be a no-op.

Importing it like this only adds a dependency reference without adding it to package.json.

I keep getting this error in the console whenever I start the multichain example and I end up just having to manually make that change in the node_modules

TypeError: nearAPI.providers.FailoverRpcProvider is not a constructor at new Provider (index.js:41:21) at index.js:3054:15 at Generator.next (<anonymous>) at fulfilled (index.js:27:58)

Maybe am I doing something wrong to begin with? 😅

andy-haynes commented 2 months ago

My guess is this happens because nearAPI is referencing an older version of near-api-js (one which doesn't export FailoverRpcProvider) but somehow there is a more recent version of @near-js/providers installed as a secondary dependency. So it's important to determine where the issue originates because a fix like this, while convenient, further compounds the dependency issue.

Is there a GitHub issue you could link to this PR where you describe the problem in more detail? Would you mind please creating one if it does not exist and link it to this PR? I'm not sure how to reproduce this from your description.