Skip to content

Commit

Permalink
enable web3modal dark mode + Coinbase, Binance, Torus support
Browse files Browse the repository at this point in the history
  • Loading branch information
trkaplan committed May 16, 2022
1 parent ed7ba25 commit f229a82
Show file tree
Hide file tree
Showing 3 changed files with 542 additions and 41 deletions.
21 changes: 19 additions & 2 deletions hooks/useWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import { Provider } from '@ethersproject/abstract-provider';
import { JsonRpcProvider } from '@ethersproject/providers';
import WalletConnectProvider from '@walletconnect/web3-provider';
import CoinbaseWalletSDK from '@coinbase/wallet-sdk';
import Torus from '@toruslabs/torus-embed';
import { providers } from 'ethers';
import { useCallback, useEffect } from 'react';
import Web3Modal from 'web3modal';
Expand All @@ -12,16 +14,31 @@ const INFURA_ID = process.env.NEXT_PUBLIC_INFURA_ID;

const providerOptions = {
walletconnect: {
package: WalletConnectProvider, // required
package: WalletConnectProvider,
options: {
infuraId: INFURA_ID, // required
infuraId: INFURA_ID,
},
},
coinbasewallet: {
package: CoinbaseWalletSDK,
options: {
appName: 'CityDAO Parcel-0',
infuraId: INFURA_ID,
darkMode: true,
},
},
torus: {
package: Torus,
},
binancechainwallet: {
package: true,
},
};

let web3Modal: any;
if (typeof window !== 'undefined') {
web3Modal = new Web3Modal({
theme: 'dark',
network: 'mainnet', // optional
cacheProvider: true,
providerOptions, // required
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
},
"dependencies": {
"@citydao/parcel-contracts": "^0.0.4",
"@coinbase/wallet-sdk": "^3.1.0",
"@toruslabs/torus-embed": "^1.22.6",
"@types/react-modal": "^3.13.1",
"@walletconnect/web3-provider": "^1.7.8",
"ethers": "^5.5.1",
Expand Down
Loading

0 comments on commit f229a82

Please sign in to comment.