1.0.6 • Published 2 years ago
react-wallet-connector v1.0.6
react-wallet-connector
Made with create-react-library
Install
yarn add react-wallet-connector
Usage
Requrirements
- Install the
@web3-react
connectors you want as options. See here. - An Infura key.
Pass the connection options in an object as seen on WalletConnectionsByName
.
enum Network {
Main = 1,
Ropsten = 3,
Rinkeby = 4,
Goerli = 5,
Kovan = 42
}
const CURRENT_NETWORK = Network.Rinkeby
const INFURA_URLS = {
1: 'https://mainnet.infura.io/v3/<INFURA KEY>',
4: 'https://rinkeby.infura.io/v3/<INFURA KEY>'
}
const WalletConnectorsByName = {
MetaMask: {
connector: new InjectedConnector({
supportedChainIds: [1, 3, 4, 5, 42]
})
},
WalletConnect: {
connector: new WalletConnectConnector({
rpc: INFURA_URLS,
bridge: 'https://bridge.walletconnect.org',
qrcode: true
})
},
Coinbase: {
connector: new WalletLinkConnector({
url: INFURA_URLS[CURRENT_NETWORK],
supportedChainIds: [Network.Main, Network.Rinkeby],
appName: 'web3-react example'
})
},
Ledger: {
connector: new LedgerConnector({
chainId: 1,
url: INFURA_URLS[CURRENT_NETWORK],
pollingInterval: 8000
})
},
Trezor: {
connector: new TrezorConnector({
chainId: 1,
url: INFURA_URLS[CURRENT_NETWORK],
pollingInterval: 8000,
manifestEmail: 'dummy@abc.xyz',
manifestAppUrl: 'https://8rg3h.csb.app/'
})
},
Fortmatic: {
connector: new FortmaticConnector({
apiKey: '<API KEY>',
chainId: 1
})
},
Authereum: {
connector: new AuthereumConnector({
chainId: CURRENT_NETWORK
})
}
}
<ConnectWallet
connectors={WalletConnectorsByName}
infuraUrls={INFURA_URLS}
/>
License
MIT © howitworks18