Skip to content

update ws-9.0.1 #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
27 changes: 9 additions & 18 deletions frontend/src/wallets/web3modal.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
import { injected,walletConnect } from '@wagmi/connectors';
import { createAppKit } from "@reown/appkit/react";
import { reconnect } from "@wagmi/core";
import { nearTestnet } from "@reown/appkit/networks";
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,
Expand All @@ -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.
});
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)
}