-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2e517c2
commit 5e05fec
Showing
7 changed files
with
23 additions
and
67 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
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
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
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,53 +1,18 @@ | ||
'use client'; | ||
import { connectorsForWallets } from '@rainbow-me/rainbowkit'; | ||
import { | ||
coinbaseWallet, | ||
metaMaskWallet, | ||
rainbowWallet, | ||
} from '@rainbow-me/rainbowkit/wallets'; | ||
import { useMemo } from 'react'; | ||
import { http, createConfig } from 'wagmi'; | ||
import { base, baseSepolia } from 'wagmi/chains'; | ||
import { NEXT_PUBLIC_WC_PROJECT_ID } from './config'; | ||
|
||
export function useWamigConfig() { | ||
const projectId = NEXT_PUBLIC_WC_PROJECT_ID ?? ''; | ||
if (!projectId) { | ||
const providerErrMessage = | ||
'To connect to all Wallets you need to provide a NEXT_PUBLIC_WC_PROJECT_ID env variable'; | ||
throw new Error(providerErrMessage); | ||
} | ||
|
||
return useMemo(() => { | ||
const connectors = connectorsForWallets( | ||
[ | ||
{ | ||
groupName: 'Recommended Wallet', | ||
wallets: [coinbaseWallet], | ||
}, | ||
{ | ||
groupName: 'Other Wallets', | ||
wallets: [rainbowWallet, metaMaskWallet], | ||
}, | ||
], | ||
{ | ||
appName: 'onchainkit', | ||
projectId, | ||
}, | ||
); | ||
|
||
const wagmiConfig = createConfig({ | ||
chains: [base, baseSepolia], | ||
// turn off injected provider discovery | ||
multiInjectedProviderDiscovery: false, | ||
connectors, | ||
ssr: true, | ||
transports: { | ||
[base.id]: http(), | ||
[baseSepolia.id]: http(), | ||
}, | ||
}); | ||
import { http, createConfig } from 'wagmi'; | ||
import { base } from 'wagmi/chains'; | ||
import { coinbaseWallet } from 'wagmi/connectors'; | ||
|
||
return wagmiConfig; | ||
}, [projectId]); | ||
} | ||
export const wagmiConfig = createConfig({ | ||
chains: [base], | ||
connectors: [ | ||
coinbaseWallet({ | ||
appName: 'onchain-commerce-template', | ||
}), | ||
], | ||
ssr: true, | ||
transports: { | ||
[base.id]: http(), | ||
}, | ||
}); |