-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathProviderExample.tsx
38 lines (34 loc) · 1.59 KB
/
ProviderExample.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { CoinbaseWallet } from '@web3-react/coinbase-wallet'
import { useWeb3React, Web3ReactHooks, Web3ReactProvider } from '@web3-react/core'
import type { MetaMask } from '@web3-react/metamask'
import type { Network } from '@web3-react/network'
import type { WalletConnect } from '@web3-react/walletconnect'
import type { WalletConnect as WalletConnectV2 } from '@web3-react/walletconnect-v2'
import type { TrustWallet } from '../../packages/trust/dist/index'
import { coinbaseWallet, hooks as coinbaseWalletHooks } from '../connectors/coinbaseWallet'
import { hooks as metaMaskHooks, metaMask } from '../connectors/metaMask'
import { hooks as networkHooks, network } from '../connectors/network'
import { hooks as walletConnectHooks, walletConnect } from '../connectors/walletConnect'
import { hooks as walletConnectV2Hooks, walletConnectV2 } from '../connectors/walletConnectV2'
import { hooks as trustHooks, trustWallet } from '../connectors/trustWallet'
import { getName } from '../utils'
const connectors: [MetaMask | WalletConnect | WalletConnectV2 | CoinbaseWallet | Network | TrustWallet , Web3ReactHooks][] = [
[metaMask, metaMaskHooks],
[walletConnect, walletConnectHooks],
[walletConnectV2, walletConnectV2Hooks],
[coinbaseWallet, coinbaseWalletHooks],
[network, networkHooks],
[trustWallet, trustHooks],
]
function Child() {
const { connector } = useWeb3React()
console.log(`Priority Connector is: ${getName(connector)}`)
return null
}
export default function ProviderExample() {
return (
<Web3ReactProvider connectors={connectors}>
<Child />
</Web3ReactProvider>
)
}