diff --git a/packages/bridge-ui/.default.env b/packages/bridge-ui/.default.env index 17535bdac75..5213b703d01 100644 --- a/packages/bridge-ui/.default.env +++ b/packages/bridge-ui/.default.env @@ -7,3 +7,11 @@ VITE_TEST_ERC20_ADDRESS_MAINNET="" VITE_MAINNET_TOKEN_VAULT_ADDRESS="" VITE_TAIKO_TOKEN_VAULT_ADDRESS="" VITE_TEST_ERC20_ADDRESS_MAINNET="" +VITE_MAINNET_CHAIN_ID= +VITE_TAIKO_CHAIN_ID= +VITE_MAINNET_CHAIN_NAME= +VITE_TAIKO_CHAIN_NAME= +VITE_TAIKO_HEADER_SYNC_ADDRESS= +VITE_MAINNET_HEADER_SYNC_ADDRESS= +VITE_MAINNET_BRIDGE_ADDRESS= +VITE_TAIKO_BRIDGE_ADDRESS= \ No newline at end of file diff --git a/packages/bridge-ui/src/App.svelte b/packages/bridge-ui/src/App.svelte index b8e9a6d8c61..e391fc8b33e 100644 --- a/packages/bridge-ui/src/App.svelte +++ b/packages/bridge-ui/src/App.svelte @@ -33,6 +33,8 @@ setupI18n({ withLocale: "en" }); import { chains, + CHAIN_ID_MAINNET, + CHAIN_ID_TAIKO, CHAIN_MAINNET, CHAIN_TKO, mainnet, @@ -53,12 +55,17 @@ number, ethers.providers.JsonRpcProvider >(); + + const p = new ethers.providers.JsonRpcProvider( + import.meta.env.VITE_L1_RPC_URL + ); + providerMap.set( - CHAIN_MAINNET.id, + CHAIN_ID_MAINNET, new ethers.providers.JsonRpcProvider(import.meta.env.VITE_L1_RPC_URL) ); providerMap.set( - CHAIN_TKO.id, + CHAIN_ID_TAIKO, new ethers.providers.JsonRpcProvider(import.meta.env.VITE_L2_RPC_URL) ); providers.set(providerMap); @@ -122,8 +129,6 @@ return store; }); - // const relayerURL = import.meta.env.VITE_RELAYER_URL; - const storageTransactioner: Transactioner = new StorageService( window.localStorage, providerMap diff --git a/packages/bridge-ui/src/domain/chain.ts b/packages/bridge-ui/src/domain/chain.ts index 46332a7a82e..8bb9f14f8e9 100644 --- a/packages/bridge-ui/src/domain/chain.ts +++ b/packages/bridge-ui/src/domain/chain.ts @@ -4,6 +4,14 @@ import type { ComponentType } from "svelte"; import Eth from "../components/icons/ETH.svelte"; import Taiko from "../components/icons/TKO.svelte"; +export const CHAIN_ID_MAINNET = import.meta.env + ? import.meta.env.VITE_MAINNET_CHAIN_ID + : 31336; + +export const CHAIN_ID_TAIKO = import.meta.env + ? import.meta.env.VITE_TAIKO_CHAIN_ID + : 167001; + export type Chain = { id: number; name: string; @@ -16,34 +24,44 @@ export type Chain = { }; export const CHAIN_MAINNET = { - id: 31336, - name: "Ethereum A1", + id: CHAIN_ID_MAINNET, + name: import.meta.env + ? import.meta.env.VITE_MAINNET_CHAIN_NAME + : "Ethereum A1", rpc: "https://l1rpc.a1.taiko.xyz", enabled: true, icon: Eth, - bridgeAddress: "0x0237443359aB0b11EcDC41A7aF1C90226a88c70f", - headerSyncAddress: "0xa7dF1d30f6456Dc72cE18fE011896105651a1f86", + bridgeAddress: import.meta.env + ? import.meta.env.VITE_MAINNET_BRIDGE_ADDRESS + : "0x3612E284D763f42f5E4CB72B1602b23DAEC3cA60", + headerSyncAddress: import.meta.env + ? import.meta.env.VITE_MAINNET_HEADER_SYNC_ADDRESS + : "0x7B3AF414448ba906f02a1CA307C56c4ADFF27ce7", explorerUrl: "https://l1explorer.a1.taiko.xyz", }; export const CHAIN_TKO = { - id: 167001, - name: "Taiko A1", + id: CHAIN_ID_TAIKO, + name: import.meta.env ? import.meta.env.VITE_TAIKO_CHAIN_NAME : "Taiko A1", rpc: "https://l2rpc.a1.taiko.xyz", enabled: true, icon: Taiko, - bridgeAddress: "0x0000777700000000000000000000000000000004", - headerSyncAddress: "0x0000777700000000000000000000000000000001", + bridgeAddress: import.meta.env + ? import.meta.env.VITE_TAIKO_BRIDGE_ADDRESS + : "0x0000777700000000000000000000000000000004", + headerSyncAddress: import.meta.env + ? import.meta.env.VITE_TAIKO_HEADER_SYNC_ADDRESS + : "0x0000777700000000000000000000000000000001", explorerUrl: "https://l2explorer.a1.taiko.xyz", }; export const chains: Record = { - 31336: CHAIN_MAINNET, - 167001: CHAIN_TKO, + CHAIN_ID_MAINNET: CHAIN_MAINNET, + CHAIN_ID_TAIKO: CHAIN_TKO, }; export const mainnet: WagmiChain = { - id: 31336, + id: CHAIN_ID_MAINNET, name: "Ethereum A1", network: "", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, @@ -64,7 +82,7 @@ export const mainnet: WagmiChain = { }; export const taiko: WagmiChain = { - id: 167001, + id: CHAIN_ID_TAIKO, name: "Taiko A1", network: "", nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, diff --git a/packages/bridge-ui/src/erc20/bridge.ts b/packages/bridge-ui/src/erc20/bridge.ts index 86aaada459f..696429ced0a 100644 --- a/packages/bridge-ui/src/erc20/bridge.ts +++ b/packages/bridge-ui/src/erc20/bridge.ts @@ -151,13 +151,9 @@ class ERC20Bridge implements Bridge { chains[opts.message.destChainId.toNumber()].headerSyncAddress, }); - return await contract.processMessage(opts.message, proof, { - gasLimit: 3500000, - }); + return await contract.processMessage(opts.message, proof); } else { - return await contract.retryMessage(opts.message, false, { - gasLimit: 3500000, - }); + return await contract.retryMessage(opts.message, false); } } } diff --git a/packages/bridge-ui/src/eth/bridge.ts b/packages/bridge-ui/src/eth/bridge.ts index e72dd6fb1c5..5d5032b9db8 100644 --- a/packages/bridge-ui/src/eth/bridge.ts +++ b/packages/bridge-ui/src/eth/bridge.ts @@ -103,13 +103,9 @@ class ETHBridge implements BridgeInterface { const proof = await this.prover.GenerateProof(proofOpts); - return await contract.processMessage(opts.message, proof, { - gasLimit: opts.message.gasLimit.add(1000000), - }); + return await contract.processMessage(opts.message, proof); } else { - return await contract.retryMessage(opts.message, { - gasLimit: opts.message.gasLimit.add(1000000), - }); + return await contract.retryMessage(opts.message); } } }