From 96a21829cfc45d3eeb33e69635228e01a2a1ecca Mon Sep 17 00:00:00 2001 From: Ruben Marcus Date: Tue, 8 Oct 2024 17:29:44 +0100 Subject: [PATCH] Revert "Add ETH-wallets to react lib (#544)" This reverts commit c7c788f9d30173da68d8651e901fc1e26cb2c9af. --- packages/react/package.json | 20 ++---- packages/react/src/wallet/bitte-wallet.ts | 4 -- packages/react/src/wallet/wallet.ts | 5 +- packages/react/src/wallet/web3-modal.ts | 77 ----------------------- 4 files changed, 7 insertions(+), 99 deletions(-) delete mode 100644 packages/react/src/wallet/web3-modal.ts diff --git a/packages/react/package.json b/packages/react/package.json index bca9a4c9..30e725bd 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -24,20 +24,12 @@ "dependencies": { "@mintbase-js/data": "0.6.2", "@mintbase-js/wallet": "0.6.2", - "@near-wallet-selector/core": "8.9.13", - "@near-wallet-selector/ethereum-wallets": "8.9.13", - "@near-wallet-selector/here-wallet": "8.9.13", - "@near-wallet-selector/meteor-wallet": "8.9.13", - "@near-wallet-selector/modal-ui": "8.9.13", - "@near-wallet-selector/my-near-wallet": "8.9.13", - "@tanstack/react-query": "5.24.8", - "@wagmi/connectors": "5.0.10", - "@wagmi/core": "2.10.5", - "@web3modal/wagmi": "5.0.6", - "near-api-js": "^5.0.0", + "@near-wallet-selector/core": "8.9.12", + "@near-wallet-selector/here-wallet": "8.9.12", + "@near-wallet-selector/meteor-wallet": "8.9.12", + "@near-wallet-selector/modal-ui": "8.9.12", + "@near-wallet-selector/my-near-wallet": "8.9.12", "react": "^18.2.0", - "react-dom": "^18.2.0", - "viem": "2.16.2", - "wagmi": "2.10.5" + "react-dom": "^18.2.0" } } diff --git a/packages/react/src/wallet/bitte-wallet.ts b/packages/react/src/wallet/bitte-wallet.ts index 9001925d..4073ccda 100644 --- a/packages/react/src/wallet/bitte-wallet.ts +++ b/packages/react/src/wallet/bitte-wallet.ts @@ -26,8 +26,6 @@ import { ConnectionTimeoutError } from './wallet'; import { setupMeteorWallet } from '@near-wallet-selector/meteor-wallet'; import { setupHereWallet } from '@near-wallet-selector/here-wallet'; import { setupMyNearWallet } from '@near-wallet-selector/my-near-wallet'; -import { wagmiConfig, web3Modal } from './web3-modal'; -import { setupEthereumWallets } from "@near-wallet-selector/ethereum-wallets"; const SUPPORT = '- further help available on our telegram channel: https://t.me/mintdev'; @@ -36,12 +34,10 @@ export const ERROR_MESSAGES = { WALLET_CONNECTION_NOT_FOUND: `Wallet connection not received after ${WALLET_CONNECTION_TIMEOUT}ms - ${SUPPORT}`, }; -const alwaysOnboardDuringSignIn = true; export const SUPPORTED_NEAR_WALLETS: Array =[ setupMeteorWallet(), setupMyNearWallet(), setupHereWallet(), - setupEthereumWallets({ wagmiConfig, web3Modal, alwaysOnboardDuringSignIn }), ]; export type WalletSelectorComponents = { diff --git a/packages/react/src/wallet/wallet.ts b/packages/react/src/wallet/wallet.ts index 1d99a9d9..d3be749d 100644 --- a/packages/react/src/wallet/wallet.ts +++ b/packages/react/src/wallet/wallet.ts @@ -15,8 +15,7 @@ import { import { setupHereWallet } from '@near-wallet-selector/here-wallet'; import { setupMeteorWallet } from '@near-wallet-selector/meteor-wallet'; import { setupMyNearWallet } from '@near-wallet-selector/my-near-wallet'; -import { wagmiConfig, web3Modal } from './web3-modal'; -import { setupEthereumWallets } from "@near-wallet-selector/ethereum-wallets"; + import { setupBitteWallet, setupMintbaseWallet } from '@mintbase-js/wallet'; import type { @@ -34,12 +33,10 @@ export const ERROR_MESSAGES = { WALLET_CONNECTION_NOT_FOUND: `Wallet connection not received after ${WALLET_CONNECTION_TIMEOUT}ms - ${SUPPORT}`, }; -const alwaysOnboardDuringSignIn = true; export const SUPPORTED_NEAR_WALLETS: Array =[ setupMeteorWallet(), setupMyNearWallet(), setupHereWallet(), - setupEthereumWallets({ wagmiConfig, web3Modal, alwaysOnboardDuringSignIn }), ]; // mintbase SDK wallet functionality wraps diff --git a/packages/react/src/wallet/web3-modal.ts b/packages/react/src/wallet/web3-modal.ts deleted file mode 100644 index 6cdc5970..00000000 --- a/packages/react/src/wallet/web3-modal.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { reconnect, http, createConfig } from "@wagmi/core"; -import { walletConnect, injected } from "wagmi/connectors"; -import { createWeb3Modal } from "@web3modal/wagmi"; - -const evmWalletChains = { - testnet: { - nearEnv: "testnet", - chainId: 398, - walletExplorerUrl: "https://eth-explorer-testnet.near.org", - explorerUrl: "https://testnet.nearblocks.io", - ethRpcForNear: "https://eth-rpc.testnet.near.org", - nearNativeRpc: "https://rpc.testnet.near.org" - }, - mainnet: { - chainId: 397, - nearEnv: "mainnet", - walletExplorerUrl: "https://eth-explorer.near.org", - explorerUrl: "https://nearblocks.io", - ethRpcForNear: "https://eth-rpc.mainnet.near.org", - nearNativeRpc: "https://rpc.mainnet.near.org" - } -}; - -const EVMWalletChain = evmWalletChains.mainnet; - -// see more here: https://docs.reown.com/appkit/react/core/installation#cloud-configuration -// please replace it with your own one -const reownProjectId = 'b6facfc0dfb00812382fe1b7bcc07069'; - -const onMainnet = true; // you need to put smth like NetworkId == "mainnet"; here -const nearChain = { - id: EVMWalletChain.chainId, - name: `NEAR Protocol${ onMainnet ? "" : " Testnet"}`, - nativeCurrency: { - decimals: 18, - name: "NEAR", - symbol: "NEAR", - }, - rpcUrls: { - default: { http: [EVMWalletChain.ethRpcForNear] }, - public: { http: [EVMWalletChain.ethRpcForNear] }, - }, - blockExplorers: { - default: { - name: "NEAR Explorer", - url: EVMWalletChain.walletExplorerUrl, - }, - }, - testnet: !onMainnet, -}; - -const metadata = { - name: "Bitte Wallet", - description: "Near Wallet Connect to EVM", - url: "wallet.bitte.ai", - icons: [], -}; - -export const wagmiConfig = createConfig({ - chains: [nearChain], - transports: { - [nearChain.id]: http(), - }, - connectors: [ - walletConnect({ projectId: reownProjectId, metadata, showQrModal: false }), - injected({ shimDisconnect: true }), - ], -}); - -// Needed to be called to preserve the login state if your will reload the page -reconnect(wagmiConfig); - -export const web3Modal : any = createWeb3Modal({ - wagmiConfig: wagmiConfig, - // Get a project ID at https://cloud.walletconnect.com - projectId: reownProjectId, -});