From 8cd59162af3df59e9bb6117138c537fa8bbdc2dd Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Wed, 5 Apr 2023 17:09:57 -0700 Subject: [PATCH 1/3] fix relayer --- packages/bridge-ui/src/domain/relayerApi.ts | 8 ++++---- .../bridge-ui/src/relayer-api/RelayerAPIService.ts | 12 ++++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/packages/bridge-ui/src/domain/relayerApi.ts b/packages/bridge-ui/src/domain/relayerApi.ts index a7e64c35f00..8aa59975dc5 100644 --- a/packages/bridge-ui/src/domain/relayerApi.ts +++ b/packages/bridge-ui/src/domain/relayerApi.ts @@ -19,10 +19,10 @@ export type TransactionData = { Memo: string; Owner: Address; Sender: Address; - GasLimit: number; - CallValue: number; - DepositValue: number; - ProcessingFee: number; + GasLimit: string; + CallValue: string; + DepositValue: string; + ProcessingFee: string; RefundAddress: Address; Data: string; }; diff --git a/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts b/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts index 0acbe50135c..65863f33e5e 100644 --- a/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts +++ b/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts @@ -93,12 +93,16 @@ export class RelayerAPIService implements RelayerAPI { memo: tx.data.Message.Memo, owner: tx.data.Message.Owner, sender: tx.data.Message.Sender, - gasLimit: BigNumber.from(tx.data.Message.GasLimit), - callValue: BigNumber.from(tx.data.Message.CallValue), + gasLimit: BigNumber.from(tx.data.Message.GasLimit.toString()), + callValue: BigNumber.from(tx.data.Message.CallValue.toString()), srcChainId: tx.data.Message.SrcChainId, destChainId: tx.data.Message.DestChainId, - depositValue: BigNumber.from(`${tx.data.Message.DepositValue}`), - processingFee: BigNumber.from(`${tx.data.Message.ProcessingFee}`), + depositValue: BigNumber.from( + `${tx.data.Message.DepositValue.toString()}`, + ), + processingFee: BigNumber.from( + `${tx.data.Message.ProcessingFee.toString()}`, + ), refundAddress: tx.data.Message.RefundAddress, }, }; From 18841510e60c9f0c4d94777a08b6cfb8e5978143 Mon Sep 17 00:00:00 2001 From: jeff <113397187+cyberhorsey@users.noreply.github.com> Date: Wed, 5 Apr 2023 17:42:56 -0700 Subject: [PATCH 2/3] fix(bridge-ui): Network change fix (#13549) --- packages/bridge-ui/src/components/ChainDropdown.svelte | 2 +- packages/bridge-ui/src/components/form/SelectChain.svelte | 5 ++++- packages/bridge-ui/src/utils/switchChainAndSetSigner.ts | 5 ++++- packages/starter-dapp/src/components/ChainDropdown.svelte | 8 ++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/bridge-ui/src/components/ChainDropdown.svelte b/packages/bridge-ui/src/components/ChainDropdown.svelte index 453e62a6421..0dc68cbaa35 100644 --- a/packages/bridge-ui/src/components/ChainDropdown.svelte +++ b/packages/bridge-ui/src/components/ChainDropdown.svelte @@ -11,7 +11,7 @@ await switchNetwork({ chainId: chain.id, }); - const provider = new ethers.providers.Web3Provider(window.ethereum); + const provider = new ethers.providers.Web3Provider(window.ethereum, 'any'); await provider.send('eth_requestAccounts', []); fromChain.set(chain); diff --git a/packages/bridge-ui/src/components/form/SelectChain.svelte b/packages/bridge-ui/src/components/form/SelectChain.svelte index bb6457ed690..ac7e45648b9 100644 --- a/packages/bridge-ui/src/components/form/SelectChain.svelte +++ b/packages/bridge-ui/src/components/form/SelectChain.svelte @@ -13,7 +13,10 @@ await switchNetwork({ chainId: chain.id, }); - const provider = new ethers.providers.Web3Provider(window.ethereum); + const provider = new ethers.providers.Web3Provider( + window.ethereum, + 'any', + ); await provider.send('eth_requestAccounts', []); fromChain.set(chain); diff --git a/packages/bridge-ui/src/utils/switchChainAndSetSigner.ts b/packages/bridge-ui/src/utils/switchChainAndSetSigner.ts index 11ec1490706..09d87cdc5b7 100644 --- a/packages/bridge-ui/src/utils/switchChainAndSetSigner.ts +++ b/packages/bridge-ui/src/utils/switchChainAndSetSigner.ts @@ -10,7 +10,10 @@ export async function switchChainAndSetSigner(chain: Chain) { await switchNetwork({ chainId }); - const provider = new ethers.providers.Web3Provider(globalThis.ethereum); + const provider = new ethers.providers.Web3Provider( + globalThis.ethereum, + 'any', + ); await provider.send('eth_requestAccounts', []); fromChain.set(chain); diff --git a/packages/starter-dapp/src/components/ChainDropdown.svelte b/packages/starter-dapp/src/components/ChainDropdown.svelte index ec6430e01f2..74219d1345b 100644 --- a/packages/starter-dapp/src/components/ChainDropdown.svelte +++ b/packages/starter-dapp/src/components/ChainDropdown.svelte @@ -11,7 +11,7 @@ await switchNetwork({ chainId: chain.id, }); - const provider = new ethers.providers.Web3Provider(window.ethereum); + const provider = new ethers.providers.Web3Provider(window.ethereum, "any"); await provider.send("eth_requestAccounts", []); fromChain.set(chain); @@ -31,13 +31,13 @@ {:else} - - + + {/if} - +
    Date: Wed, 5 Apr 2023 17:48:48 -0700 Subject: [PATCH 3/3] fix(bridge-ui): duplicates (#13550) --- packages/bridge-ui/src/App.svelte | 9 +-------- .../src/components/Transactions/Transactions.svelte | 2 +- .../bridge-ui/src/relayer-api/RelayerAPIService.ts | 11 +++++++++++ 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/bridge-ui/src/App.svelte b/packages/bridge-ui/src/App.svelte index cfa1d1e26cd..c09373440af 100644 --- a/packages/bridge-ui/src/App.svelte +++ b/packages/bridge-ui/src/App.svelte @@ -96,6 +96,7 @@ const apiTxs = await $relayerApi.getAllBridgeTransactionByAddress( userAddress, ); + const blockInfoMap = await $relayerApi.getBlockInfo(); relayerBlockInfoMap.set(blockInfoMap); @@ -110,14 +111,6 @@ return !hashToApiTxsMap.has(tx.hash.toLowerCase()); }); - // const updatedStorageTxs: BridgeTransaction[] = txs.filter((tx) => { - // const blockInfo = blockInfoMap.get(tx.fromChainId); - // if (blockInfo?.latestProcessedBlock >= tx.receipt?.blockNumber) { - // return false; - // } - // return true; - // }); - $transactioner.updateStorageByAddress(userAddress, updatedStorageTxs); transactions.set([...updatedStorageTxs, ...apiTxs]); diff --git a/packages/bridge-ui/src/components/Transactions/Transactions.svelte b/packages/bridge-ui/src/components/Transactions/Transactions.svelte index f25e4d8d5aa..730c1d2b236 100644 --- a/packages/bridge-ui/src/components/Transactions/Transactions.svelte +++ b/packages/bridge-ui/src/components/Transactions/Transactions.svelte @@ -26,7 +26,7 @@ - {#each $transactions as transaction} + {#each $transactions as transaction (transaction.hash)} noticeModal.open(detail)} on:tooltipStatus={() => (showMessageStatusTooltip = true)} diff --git a/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts b/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts index 65863f33e5e..e09811633dd 100644 --- a/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts +++ b/packages/bridge-ui/src/relayer-api/RelayerAPIService.ts @@ -64,6 +64,17 @@ export class RelayerAPIService implements RelayerAPI { return []; } + apiTxs.items.map((t, i) => { + apiTxs.items.map((tx, j) => { + if ( + tx.data.Raw.transactionHash === t.data.Raw.transactionHash && + i !== j + ) { + apiTxs.items = apiTxs.items.filter((_, index) => index !== j); + } + }); + }); + const txs = apiTxs.items.map((tx: APIResponseTransaction) => { let data = tx.data.Message.Data; if (data === '') {