-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Upgrade wagmi & view to v2 (#163)
* feat: Upgrade wagmi * refactor: Optimize code * feat: Update examples * feat: Add customized life cycle for `injected` * feat: Update docs * docs: Add changelog * chore: update versions (alpha) (#162) Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
27d412c
commit 83c5001
Showing
129 changed files
with
10,785 additions
and
7,328 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@node-real/walletkit': patch | ||
--- | ||
|
||
feat: Upgrade wagmi & viem to 2.x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"mode": "pre", | ||
"tag": "alpha", | ||
"initialVersions": { | ||
"example-nextjs": "0.0.1", | ||
"example-vite": "0.0.1", | ||
"@node-real/walletkit": "2.0.0", | ||
"website": "0.0.1" | ||
}, | ||
"changesets": [ | ||
"dirty-panthers-enjoy" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,62 @@ | ||
import '@node-real/walletkit/styles.css'; | ||
import '@/styles/globals.css'; | ||
import type { AppProps } from 'next/app'; | ||
import { chains } from './chains'; | ||
import { WagmiConfig, createConfig } from 'wagmi'; | ||
import { bsc, mainnet, opBNB } from 'wagmi/chains'; | ||
|
||
import { trustWallet, metaMask, walletConnect } from '@node-real/walletkit/wallets'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { | ||
defaultWagmiConfig, | ||
SwitchNetworkModal, | ||
WalletKitButton, | ||
WalletKitOptions, | ||
WalletKitProvider, | ||
getDefaultConfig, | ||
ProfileModal, | ||
ConnectModal, | ||
} from '@node-real/walletkit'; | ||
import { trustWallet, metaMask, walletConnect } from '@node-real/walletkit/wallets'; | ||
import { WagmiProvider } from 'wagmi'; | ||
import { AppProps } from 'next/app'; | ||
|
||
const config = createConfig( | ||
getDefaultConfig({ | ||
autoConnect: true, | ||
appName: 'WalletKit', | ||
const queryClient = new QueryClient(); | ||
|
||
// WalletConnect 2.0 requires a projectId which you can create quickly | ||
// and easily for free over at WalletConnect Cloud https://cloud.walletconnect.com/sign-in | ||
walletConnectProjectId: 'e68a1816d39726c2afabf05661a32767', | ||
const config = defaultWagmiConfig({ | ||
appName: 'WalletKit', | ||
chains: [bsc, mainnet, opBNB], | ||
connectors: [trustWallet(), metaMask(), walletConnect()], | ||
|
||
chains, | ||
connectors: [trustWallet(), metaMask(), walletConnect()], | ||
}), | ||
); | ||
// WalletConnect 2.0 requires a projectId which you can create quickly | ||
// and easily for free over at WalletConnect Cloud https://cloud.walletconnect.com/sign-in | ||
walletConnectProjectId: 'e68a1816d39726c2afabf05661a32767', | ||
}); | ||
|
||
const options: WalletKitOptions = { | ||
initialChainId: 1, | ||
}; | ||
|
||
export default function App({ Component, pageProps }: AppProps) { | ||
return ( | ||
<WagmiConfig config={config}> | ||
<WalletKitProvider options={options} mode="light"> | ||
<WalletKitButton /> | ||
<Component {...pageProps} /> | ||
<SwitchNetworkModal /> | ||
</WalletKitProvider> | ||
</WagmiConfig> | ||
<WagmiProvider config={config} reconnectOnMount={true}> | ||
<QueryClientProvider client={queryClient}> | ||
<WalletKitProvider options={options} mode="light"> | ||
<Component {...pageProps} /> | ||
|
||
<WalletKitButton /> | ||
|
||
<ConnectModal /> | ||
|
||
{/* | ||
Profile modal shows some basic information about the current account, | ||
If you don't need this modal, you can remove it. | ||
*/} | ||
<ProfileModal /> | ||
|
||
{/* | ||
👇 Here's the SwitchNetworkModal | ||
If the user switches to a network that is not supported by our dApp, | ||
this modal will be displayed to remind the user to switch to our supported networks. | ||
*/} | ||
<SwitchNetworkModal /> | ||
</WalletKitProvider> | ||
</QueryClientProvider> | ||
</WagmiProvider> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,47 @@ | ||
import '@node-real/walletkit/styles.css'; | ||
import { WagmiConfig, createConfig } from 'wagmi'; | ||
import { chains } from './chains'; | ||
import './global.css'; | ||
import { bsc, mainnet, opBNB } from 'wagmi/chains'; | ||
|
||
import { trustWallet, metaMask, walletConnect } from '@node-real/walletkit/wallets'; | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; | ||
import { | ||
ConnectModal, | ||
defaultWagmiConfig, | ||
ProfileModal, | ||
SwitchNetworkModal, | ||
WalletKitButton, | ||
WalletKitProvider, | ||
getDefaultConfig, | ||
WalletKitOptions, | ||
SwitchNetworkModal, | ||
WalletKitProvider, | ||
} from '@node-real/walletkit'; | ||
import { trustWallet, metaMask, walletConnect } from '@node-real/walletkit/wallets'; | ||
import { WagmiProvider } from 'wagmi'; | ||
|
||
const config = createConfig( | ||
getDefaultConfig({ | ||
autoConnect: true, | ||
appName: 'WalletKit', | ||
const queryClient = new QueryClient(); | ||
|
||
// WalletConnect 2.0 requires a projectId which you can create quickly | ||
// and easily for free over at WalletConnect Cloud https://cloud.walletconnect.com/sign-in | ||
walletConnectProjectId: 'e68a1816d39726c2afabf05661a32767', | ||
const config = defaultWagmiConfig({ | ||
appName: 'WalletKit', | ||
chains: [mainnet, bsc, opBNB], | ||
connectors: [trustWallet(), metaMask(), walletConnect()], | ||
|
||
chains, | ||
connectors: [trustWallet(), metaMask(), walletConnect()], | ||
}), | ||
); | ||
// WalletConnect 2.0 requires a projectId which you can create quickly | ||
// and easily for free over at WalletConnect Cloud https://cloud.walletconnect.com/sign-in | ||
walletConnectProjectId: 'e68a1816d39726c2afabf05661a32767', | ||
}); | ||
|
||
const options: WalletKitOptions = { | ||
initialChainId: 1, | ||
}; | ||
|
||
export default function App() { | ||
return ( | ||
<WagmiConfig config={config}> | ||
<WalletKitProvider options={options} mode="light"> | ||
<WalletKitButton /> | ||
{/* | ||
👇 Here's the SwitchNetworkModal | ||
If the user switches to a network that is not supported by our dApp, | ||
this modal will be displayed to remind the user to switch to our supported networks. | ||
*/} | ||
<SwitchNetworkModal /> | ||
</WalletKitProvider> | ||
</WagmiConfig> | ||
<WagmiProvider config={config} reconnectOnMount={false}> | ||
<QueryClientProvider client={queryClient}> | ||
<WalletKitProvider options={options} mode="light"> | ||
<WalletKitButton /> | ||
<ConnectModal /> | ||
<ProfileModal /> | ||
<SwitchNetworkModal /> | ||
</WalletKitProvider> | ||
</QueryClientProvider> | ||
</WagmiProvider> | ||
); | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.