From eda0333e34098684b19bc37305b90772e2bf8787 Mon Sep 17 00:00:00 2001 From: Francisco Ramos Date: Tue, 4 Jul 2023 12:07:27 +0200 Subject: [PATCH] fix(bridge-ui): migrate to wallet connect 2.0 (#14094) --- packages/bridge-ui/README.md | 2 + packages/bridge-ui/package.json | 5 +- packages/bridge-ui/src/chain/chains.ts | 12 +- .../src/components/AddressDropdown.svelte | 3 +- .../BridgeForm/AddCustomERC20.svelte | 2 +- .../components/BridgeForm/BridgeForm.svelte | 3 +- .../components/BridgeForm/SelectChain.svelte | 2 +- .../components/BridgeForm/SelectToken.svelte | 2 +- .../src/components/ChainDropdown.svelte | 2 +- .../src/components/ConnectWallet.svelte | 6 +- .../src/components/Faucet/Faucet.svelte | 2 +- .../src/components/NoticeModal.svelte | 2 +- .../bridge-ui/src/components/Router.svelte | 2 +- .../bridge-ui/src/components/Tabs/Tab.svelte | 2 +- .../bridge-ui/src/components/Tabs/Tabs.svelte | 4 +- .../Transactions/Transaction.svelte | 2 +- .../src/constants/__mocks__/envVars.ts | 2 + packages/bridge-ui/src/constants/envVars.ts | 5 +- packages/bridge-ui/src/domain/chain.ts | 2 +- packages/bridge-ui/src/domain/relayerApi.ts | 2 +- packages/bridge-ui/src/domain/token.ts | 2 +- .../src/relayer-api/RelayerAPIService.spec.ts | 2 +- .../src/relayer-api/RelayerAPIService.ts | 2 +- packages/bridge-ui/src/signer/subscriber.ts | 2 +- .../bridge-ui/src/storage/StorageService.ts | 2 +- .../bridge-ui/src/store/transaction.spec.ts | 2 +- .../bridge-ui/src/utils/getAddressForToken.ts | 2 +- .../bridge-ui/src/utils/switchNetwork.spec.ts | 4 +- packages/bridge-ui/src/utils/switchNetwork.ts | 2 +- packages/bridge-ui/src/vault/tokenVaults.ts | 2 +- packages/bridge-ui/src/vite-env.d.ts | 1 + packages/bridge-ui/src/wagmi/client.ts | 41 +- packages/bridge-ui/src/wagmi/watcher.ts | 2 +- pnpm-lock.yaml | 1807 +++++++++++++++-- 34 files changed, 1690 insertions(+), 247 deletions(-) diff --git a/packages/bridge-ui/README.md b/packages/bridge-ui/README.md index 5b93c61f82d..b8f77a640a4 100644 --- a/packages/bridge-ui/README.md +++ b/packages/bridge-ui/README.md @@ -50,4 +50,6 @@ VITE_L2_SIGNAL_SERVICE_ADDRESS=0x1000777700000000000000000000000000000007 VITE_L3_SIGNAL_SERVICE_ADDRESS=0x1000777700000000000000000000000000000007 VITE_TEST_ERC20=[{"address": "0x9A676e781A523b5d0C0e43731313A708CB607508", "symbol": "BLL", "name": "Bull Token"}, {"address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", "symbol": "HORSE", "name": "Horse Token"}] + +VITE_WALLETCONNECT_PROJECT_ID=1234567890 ``` diff --git a/packages/bridge-ui/package.json b/packages/bridge-ui/package.json index 69d86c3f4d5..4a56cda0053 100644 --- a/packages/bridge-ui/package.json +++ b/packages/bridge-ui/package.json @@ -73,14 +73,13 @@ "@lottiefiles/svelte-lottie-player": "^0.2.0", "@sentry/svelte": "^7.54.0", "@sveltestack/svelte-query": "^1.6.0", - "@wagmi/connectors": "^0.1.1", - "@wagmi/core": "^0.8.0", "axios": "^1.2.0", "buffer": "^6.0.3", "debug": "^4.3.4", "ethers": "^5.7.1", "identicon.js": "^2.3.3", "svelte-i18n": "^3.5.1", - "svelte-spa-router": "^3.2.0" + "svelte-spa-router": "^3.2.0", + "wagmi": "^0.12.16" } } diff --git a/packages/bridge-ui/src/chain/chains.ts b/packages/bridge-ui/src/chain/chains.ts index 5b01c0adba7..ff3f98d1f48 100644 --- a/packages/bridge-ui/src/chain/chains.ts +++ b/packages/bridge-ui/src/chain/chains.ts @@ -1,4 +1,4 @@ -import type { Chain as WagmiChain } from '@wagmi/core'; +import type { Chain as WagmiChain } from 'wagmi'; import Eth from '../components/icons/ETH.svelte'; import Taiko from '../components/icons/TKO.svelte'; @@ -56,9 +56,8 @@ export const mainnetWagmiChain: WagmiChain = { network: '', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { - default: { - http: [L1_RPC], - }, + default: { http: [L1_RPC] }, + public: { http: [L1_RPC] }, }, blockExplorers: { default: { @@ -75,9 +74,8 @@ export const taikoWagmiChain: WagmiChain = { network: '', nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, rpcUrls: { - default: { - http: [L2_RPC], - }, + default: { http: [L2_RPC] }, + public: { http: [L2_RPC] }, }, blockExplorers: { default: { diff --git a/packages/bridge-ui/src/components/AddressDropdown.svelte b/packages/bridge-ui/src/components/AddressDropdown.svelte index 70018e845b8..9689aa433a9 100644 --- a/packages/bridge-ui/src/components/AddressDropdown.svelte +++ b/packages/bridge-ui/src/components/AddressDropdown.svelte @@ -1,12 +1,13 @@