GithubHelp home page GithubHelp logo

Comments (7)

zaeguerra avatar zaeguerra commented on May 22, 2024

Same thought.

from coinbase-wallet-sdk.

petejkim avatar petejkim commented on May 22, 2024

Does initializing ethers with WalletLinkProvider not work for you?

from coinbase-wallet-sdk.

Benjythebee avatar Benjythebee commented on May 22, 2024

Does initializing ethers with WalletLinkProvider not work for you?

What do you mean? WalletLinkProvider is not an option as a provider? Did I miss something

However I got it to half-work using

let walletlink = walletLink.makeWeb3Provider(ETH_JSONRPC_URL, CHAIN_ID)
accounts = await walletlink.request({ method: 'eth_requestAccounts' })
// successfully gets accounts
this.provider = new ethers.providers.Web3Provider(walletlink , 'any')
// creates a provider that's half-broken

It successfully creates a provider. and I can obtain accounts.
BUUUUT, that provider is super broken.
For example, If I decide to check the chainId I'm currently connected to :

// (using metamask)
this.provider.network //returns {name: "homestead", chainId: 1, ensAddress: ".....", _defaultProvider: ƒ}
await this.provider.getNetwork() //returns {name: "homestead", chainId: 1, ensAddress: ".....", _defaultProvider: ƒ}

this.provider = new ethers.providers.Web3Provider(walletlink , 'any')
// using wallellink
this.provider.network //returns undefined
await this.provider.getNetwork() // (apparently doesn't exist) => Error: could not detect network (chainId="[object Object]",

ethers also has the app.provider._networkPromise function which I guess is used internally and running that function returns the following (in the console for walletlink):

Promise { <state>: "rejected", <reason>: Error }
​
<state>: "rejected"
<reason>: Error: ​could not detect network (chainId="[object Object]", event="invalidNetwork", serverError="Error: invalid BigNumber value (argument=\"value\", value=\"[object Object]\", code=INVALID_ARGUMENT, version=bignumber/5.3.0)", code=NETWORK_ERROR, version=providers/5.3.1

from coinbase-wallet-sdk.

Benjythebee avatar Benjythebee commented on May 22, 2024

Ok, I think I was at fault here. When doing

this.provider = new ethers.providers.Web3Provider(walletlink , 'any')

walletlink was somehow badly instanciated. It seems to work nicely now
image
The w in this photo is the ethers Web3provider made with walletlink

from coinbase-wallet-sdk.

dwcoen123 avatar dwcoen123 commented on May 22, 2024

from coinbase-wallet-sdk.

dwcoen123 avatar dwcoen123 commented on May 22, 2024

from coinbase-wallet-sdk.

dddd8888z avatar dddd8888z commented on May 22, 2024

What is this? Daniel Wayne coen

from coinbase-wallet-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.