You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using this library to connect to metamask wallet. And I'd like to connect to a contract from Ethereum network. I found this library only focus on wallet and react but not smart contract. So I am using web3.js library for contract interaction. But the question is how I can get the provider information like URL from web3-react.
the above code is to open Metamask from browser. Now I need to create a Contract instance:
import { Contract } from 'web3-eth-contract';
const abi = [{...}];
const address = '0x...';
const contract = new Contract(abi, address { provider: 'http://127.0.0.1:8545' });
I need to provider some parameters for Contract constructor function. I am able to get abi, address, but how can I get the provider url from web3-react provider? I'd like to get the URL from the connected wallet rather than setting up an env var for that.
The text was updated successfully, but these errors were encountered:
I am using this library to connect to metamask wallet. And I'd like to connect to a contract from Ethereum network. I found this library only focus on wallet and react but not smart contract. So I am using
web3.js
library for contract interaction. But the question is how I can get the provider information like URL fromweb3-react
.the above code is to open Metamask from browser. Now I need to create a
Contract
instance:I need to provider some parameters for
Contract
constructor function. I am able to getabi
,address
, but how can I get the provider url fromweb3-react
provider? I'd like to get the URL from the connected wallet rather than setting up an env var for that.The text was updated successfully, but these errors were encountered: