-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): add ethereum wallet into near wallet selector
- Loading branch information
Showing
10 changed files
with
1,976 additions
and
80 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { injected, walletConnect } from '@wagmi/connectors'; | ||
import { createConfig, http, reconnect } from '@wagmi/core'; | ||
import { createWeb3Modal } from '@web3modal/wagmi'; | ||
import { EVMWalletChain, networkId } from './config'; | ||
import { env } from 'next-runtime-env'; | ||
|
||
// 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', | ||
}; | ||
|
||
const projectId = env('NEXT_PUBLIC_REOWN_PROJECT_ID') || ''; | ||
|
||
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, { connectors: [injected({ shimDisconnect: true })] }); | ||
|
||
// Modal for login | ||
export const web3Modal = createWeb3Modal({ wagmiConfig, projectId }); |
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
Oops, something went wrong.