diff --git a/frontend/package.json b/frontend/package.json index 2be29ae..4f1b130 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,28 +12,27 @@ "lint": "next lint" }, "dependencies": { - "@near-js/providers": "^1.0.1", - "@near-wallet-selector/bitte-wallet": "9.0.0", - "@near-wallet-selector/core": "9.0.0", - "@near-wallet-selector/ethereum-wallets": "9.0.0", - "@near-wallet-selector/here-wallet": "9.0.0", - "@near-wallet-selector/hot-wallet": "9.0.0", - "@near-wallet-selector/ledger": "9.0.0", - "@near-wallet-selector/meteor-wallet": "9.0.0", - "@near-wallet-selector/meteor-wallet-app": "9.0.0", - "@near-wallet-selector/modal-ui": "9.0.0", - "@near-wallet-selector/my-near-wallet": "9.0.0", - "@near-wallet-selector/near-mobile-wallet": "9.0.0", - "@near-wallet-selector/nightly": "9.0.0", - "@near-wallet-selector/react-hook": "9.0.0", - "@near-wallet-selector/sender": "9.0.0", - "@near-wallet-selector/welldone-wallet": "9.0.0", - "@reown/appkit": "^1.7.3", - "@reown/appkit-adapter-wagmi": "^1.7.3", + "@near-wallet-selector/bitte-wallet": "^9.0.1", + "@near-wallet-selector/core": "^9.0.1", + "@near-wallet-selector/ethereum-wallets": "^9.0.1", + "@near-wallet-selector/here-wallet": "^9.0.1", + "@near-wallet-selector/hot-wallet": "^9.0.1", + "@near-wallet-selector/ledger": "^9.0.1", + "@near-wallet-selector/meteor-wallet": "^9.0.1", + "@near-wallet-selector/meteor-wallet-app": "^9.0.1", + "@near-wallet-selector/modal-ui": "^9.0.1", + "@near-wallet-selector/my-near-wallet": "^9.0.1", + "@near-wallet-selector/near-mobile-wallet": "^9.0.1", + "@near-wallet-selector/react-hook": "^9.0.1", + "@near-wallet-selector/sender": "^9.0.1", + "@near-wallet-selector/welldone-wallet": "^9.0.1", + "@reown/appkit": "^1.7.4", + "@reown/appkit-adapter-wagmi": "^1.7.4", + "@wagmi/core": "^2.17.1", "bootstrap": "^5", "bootstrap-icons": "^1.11.3", - "near-api-js": "^5.0.1", - "next": "15.2.1", + "near-api-js": "^5.0.0", + "next": "^15", "react": "^18", "react-dom": "^18" }, diff --git a/frontend/src/wallets/web3modal.js b/frontend/src/wallets/web3modal.js index 3f819b2..b28c5c9 100644 --- a/frontend/src/wallets/web3modal.js +++ b/frontend/src/wallets/web3modal.js @@ -1,4 +1,3 @@ -import { injected,walletConnect } from '@wagmi/connectors'; import { createAppKit } from "@reown/appkit/react"; import { reconnect } from "@wagmi/core"; import { nearTestnet } from "@reown/appkit/networks"; @@ -6,33 +5,17 @@ import { WagmiAdapter } from "@reown/appkit-adapter-wagmi"; // Get your projectId at https://cloud.reown.com const projectId = '5bb0fe33763b3bea40b8d69e4269b4ae'; -const connectors = [ - walletConnect({ - projectId, - metadata: { - name: "Guest-Book-Examples", - description: "Examples demonstrating integrations with NEAR blockchain", - url: "https://near.github.io/wallet-selector", - icons: ["https://near.github.io/wallet-selector/favicon.ico"], - }, - showQrModal: false, // showQrModal must be false - }), - injected({ shimDisconnect: true }), -]; export const wagmiAdapter = new WagmiAdapter({ projectId, - connectors, networks: [nearTestnet], }); -reconnect(wagmiAdapter.wagmiConfig); export const web3Modal = createAppKit({ adapters: [wagmiAdapter], projectId, networks: [nearTestnet], - defaultNetwork: nearTestnet, enableWalletConnect: true, features: { analytics: true, @@ -42,4 +25,12 @@ export const web3Modal = createAppKit({ socials: false, // Smart accounts (Safe contract) not available on NEAR Protocol, only EOA. }, coinbasePreference: "eoaOnly", // Smart accounts (Safe contract) not available on NEAR Protocol, only EOA. -}); \ No newline at end of file + allWallets: "SHOW", +}); + +// force reconnecting if the user has already signed in with an ethereum wallet +// this is a workaround until `ethereum-wallets` supports the `reconnect` method +if (typeof window !== "undefined") { + const recentWallets = localStorage.getItem("near-wallet-selector:recentlySignedInWallets"); + recentWallets && recentWallets.includes("ethereum-wallets") && reconnect(wagmiAdapter.wagmiConfig) +} \ No newline at end of file