-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: restore web3modal in vite template
- Loading branch information
1 parent
a8672d4
commit aab4021
Showing
2 changed files
with
42 additions
and
228 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { injected,walletConnect } from '@wagmi/connectors'; | ||
import { createConfig,http, reconnect } from '@wagmi/core'; | ||
import { createWeb3Modal } from '@web3modal/wagmi'; | ||
|
||
import { EVMWalletChain,NetworkId } from '@/config'; | ||
|
||
// Config | ||
const near = { | ||
id: EVMWalletChain.chainId, | ||
name: EVMWalletChain.name, | ||
nativeCurrency: { | ||
decimals: 18, | ||
name: 'NEAR', | ||
symbol: 'NEAR', | ||
}, | ||
rpcUrls: { | ||
default: { http: [EVMWalletChain.rpc] }, | ||
public: { http: [EVMWalletChain.rpc] }, | ||
}, | ||
blockExplorers: { | ||
default: { | ||
name: 'NEAR Explorer', | ||
url: EVMWalletChain.explorer, | ||
}, | ||
}, | ||
testnet: NetworkId === 'testnet', | ||
}; | ||
|
||
// Get your projectId at https://cloud.reown.com | ||
const projectId = '5bb0fe33763b3bea40b8d69e4269b4ae'; | ||
|
||
export const wagmiConfig = createConfig({ | ||
chains: [near], | ||
transports: { [near.id]: http() }, | ||
connectors: [walletConnect({ projectId, showQrModal: false }), injected({ shimDisconnect: true })], | ||
}); | ||
|
||
// Preserve login state on page reload | ||
reconnect(wagmiConfig); | ||
|
||
// Modal for login | ||
export const web3Modal = createWeb3Modal({ wagmiConfig, projectId }); |