@@ -30,61 +30,62 @@ npm i @node-real/walletkit@^2 wagmi@^2 viem@^2 @tanstack/react-query@^5
3030``` tsx
3131import ' @node-real/walletkit/styles.css' ;
3232
33- import { trustWallet , metaMask , walletConnect } from ' @node-real/walletkit/wallets' ;
33+ import { binanceWallet , trustWallet , metaMask , walletConnect } from ' @node-real/walletkit/wallets' ;
3434import { QueryClient , QueryClientProvider } from ' @tanstack/react-query' ;
3535import {
36- defaultWagmiConfig ,
37- SwitchNetworkModal ,
38- WalletKitButton ,
39- WalletKitOptions ,
36+ ConnectModal ,
37+ WalletKitConfig ,
4038 WalletKitProvider ,
39+ ConnectButton ,
40+ SwitchNetworkModal ,
4141 ProfileModal ,
42- ConnectModal ,
4342} from ' @node-real/walletkit' ;
4443import { WagmiProvider } from ' wagmi' ;
4544import { AppProps } from ' next/app' ;
46- import { chains } from ' . /chains' ;
45+ import { bsc , mainnet } from ' wagmi /chains' ;
4746
4847const queryClient = new QueryClient ();
4948
50- const config = defaultWagmiConfig ({
51- appName: ' [Your app name]' , // Your app name
52- chains ,
53- connectors: [trustWallet (), metaMask (), walletConnect ()],
54-
55- // WalletConnect 2.0 requires a projectId which you can create quickly
56- // and easily for free over at WalletConnect Cloud https://cloud.walletconnect.com/sign-in
57- walletConnectProjectId: ' xxx' ,
58- });
59-
60- const options: WalletKitOptions = {
61- initialChainId: 1 ,
49+ const config: WalletKitConfig = {
50+ options: {
51+ closeModalOnEsc: false ,
52+ },
53+ evmConfig: defaultEvmConfig ({
54+ autoConnect: true ,
55+ initialChainId: 1 ,
56+
57+ // WalletConnect 2.0 requires a projectId which you can create quickly
58+ // and easily for free over at WalletConnect Cloud https://cloud.walletconnect.com/sign-in
59+ walletConnectProjectId: ' xxx' ,
60+
61+ wallets: [binanceWallet (), metaMask (), trustWallet (), walletConnect ()],
62+ chains: [mainnet , bsc ],
63+ }),
6264};
6365
66+
6467export default function App({ Component , pageProps }: AppProps ) {
6568 return (
66- <WagmiProvider config = { config } reconnectOnMount = { true } >
67- <QueryClientProvider client = { queryClient } >
68- <WalletKitProvider options = { options } mode = " light" >
69- <Component { ... pageProps } />
70-
71- <WalletKitButton />
72- <ConnectModal />
73-
74- { /*
75- Profile modal shows some basic information about the current account,
76- if you don't need this modal, you can remove it.
77- */ }
78- <ProfileModal />
79-
80- { /* 👇 Here's the SwitchNetworkModal
81- If the user switches to a network that is not supported by our dApp,
82- this modal will be displayed to remind the user to switch to our supported networks.
83- */ }
84- <SwitchNetworkModal />
85- </WalletKitProvider >
86- </QueryClientProvider >
87- </WagmiProvider >
69+ <QueryClientProvider client = { queryClient } >
70+ <WalletKitProvider config = { config } debugMode = { true } mode = " auto" >
71+ <Component { ... pageProps } />
72+
73+ <ConnectButton />
74+ <ConnectModal />
75+
76+ { /*
77+ Profile modal shows some basic information about the current account,
78+ if you don't need this modal, you can remove it.
79+ */ }
80+ <ProfileModal />
81+
82+ { /* 👇 Here's the SwitchNetworkModal
83+ If the user switches to a network that is not supported by our dApp,
84+ this modal will be displayed to remind the user to switch to our supported networks.
85+ */ }
86+ <SwitchNetworkModal />
87+ </WalletKitProvider >
88+ </QueryClientProvider >
8889 );
8990}
9091```
@@ -93,6 +94,7 @@ export default function App({ Component, pageProps }: AppProps) {
9394
9495Please follow our [ WalletKit Contribution Guide] ( ./CONTRIBUTING.md ) .
9596
97+
9698## License
9799
98100See [ LICENSE] ( ./LICENSE ) for more information.
0 commit comments