Skip to content

Commit

Permalink
fix: restore web3modal in vite template
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasbenary committed Feb 24, 2025
1 parent a8672d4 commit aab4021
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 228 deletions.
228 changes: 0 additions & 228 deletions templates/frontend/vite-react/src/wallets/near.js

This file was deleted.

42 changes: 42 additions & 0 deletions templates/frontend/vite-react/src/wallets/web3modal.js
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 });

0 comments on commit aab4021

Please sign in to comment.