From 377c1914502e4d71f3e4a6f857fd84581ddaaf5c Mon Sep 17 00:00:00 2001 From: Doug <4741454+douglance@users.noreply.github.com> Date: Mon, 19 Aug 2024 13:39:29 -0400 Subject: [PATCH] chore: rename transaction history helpers (#1821) Co-authored-by: Fionna Chan <13184582+fionnachan@users.noreply.github.com> --- .../components/TransactionHistory/helpers.ts | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts b/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts index d0daa4cb13..b5007f77a7 100644 --- a/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts +++ b/packages/arb-token-bridge-ui/src/components/TransactionHistory/helpers.ts @@ -280,7 +280,7 @@ export async function getUpdatedEthDeposit( return tx } - const { parentToChildMsg: l1ToL2Msg } = + const { parentToChildMsg } = await getParentToChildMessageDataFromParentTxHash({ depositTxId: tx.txId, isEthDeposit: true, @@ -288,7 +288,7 @@ export async function getUpdatedEthDeposit( childProvider: getProviderForChainId(tx.childChainId) }) - if (!l1ToL2Msg) { + if (!parentToChildMsg) { const receipt = await getTxReceipt(tx) if (!receipt || receipt.status !== 0) { @@ -300,7 +300,7 @@ export async function getUpdatedEthDeposit( return { ...tx, status: 'failure', depositStatus: DepositStatus.L1_FAILURE } } - const status = await l1ToL2Msg?.status() + const status = await parentToChildMsg?.status() const isDeposited = status === EthDepositMessageStatus.DEPOSITED const newDeposit: MergedTransaction = { @@ -312,10 +312,11 @@ export async function getUpdatedEthDeposit( status: isDeposited ? ParentToChildMessageStatus.FUNDS_DEPOSITED_ON_CHILD : ParentToChildMessageStatus.NOT_YET_CREATED, - retryableCreationTxID: (l1ToL2Msg as EthDepositMessage).childTxHash, + retryableCreationTxID: (parentToChildMsg as EthDepositMessage) + .childTxHash, // Only show `childTxId` after the deposit is confirmed childTxId: isDeposited - ? (l1ToL2Msg as EthDepositMessage).childTxHash + ? (parentToChildMsg as EthDepositMessage).childTxHash : undefined } } @@ -338,16 +339,15 @@ export async function getUpdatedTokenDeposit( return tx } - const { parentToChildMsg: l1ToL2Msg } = + const { parentToChildMsg } = await getParentToChildMessageDataFromParentTxHash({ depositTxId: tx.txId, isEthDeposit: false, parentProvider: getProviderForChainId(tx.parentChainId), childProvider: getProviderForChainId(tx.childChainId) }) - const _l1ToL2Msg = l1ToL2Msg as ParentToChildMessageReader - if (!l1ToL2Msg) { + if (!parentToChildMsg) { const receipt = await getTxReceipt(tx) if (!receipt || receipt.status !== 0) { @@ -359,7 +359,8 @@ export async function getUpdatedTokenDeposit( return { ...tx, status: 'failure', depositStatus: DepositStatus.L1_FAILURE } } - const res = await _l1ToL2Msg.getSuccessfulRedeem() + const _parentToChildMsg = parentToChildMsg as ParentToChildMessageReader + const res = await _parentToChildMsg.getSuccessfulRedeem() const childTxId = (() => { if (res.status === ParentToChildMessageStatus.REDEEMED) { @@ -371,7 +372,7 @@ export async function getUpdatedTokenDeposit( const newDeposit: MergedTransaction = { ...tx, - status: _l1ToL2Msg.retryableCreationId ? 'success' : tx.status, + status: _parentToChildMsg.retryableCreationId ? 'success' : tx.status, resolvedAt: res.status === ParentToChildMessageStatus.REDEEMED ? dayjs().valueOf() @@ -380,7 +381,7 @@ export async function getUpdatedTokenDeposit( status: res.status, childTxId, fetchingUpdate: false, - retryableCreationTxID: _l1ToL2Msg.retryableCreationId + retryableCreationTxID: _parentToChildMsg.retryableCreationId } }