Skip to content

Commit

Permalink
refactor: pass chain id instead of provider into function (#2171)
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan authored Jan 10, 2025
1 parent f855d56 commit 592cdac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,7 @@ async function transformTransaction(tx: Transfer): Promise<MergedTransaction> {
}

if (isDeposit(tx)) {
return transformDeposit(
await updateAdditionalDepositData({
depositTx: tx,
parentProvider,
childProvider
})
)
return transformDeposit(await updateAdditionalDepositData(tx))
}

let withdrawal: L2ToL1EventResultPlus | undefined
Expand Down
13 changes: 5 additions & 8 deletions packages/arb-token-bridge-ui/src/util/deposits/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ import {
normalizeTimestamp
} from '../../state/app/utils'

export const updateAdditionalDepositData = async ({
depositTx,
parentProvider,
childProvider
}: {
export const updateAdditionalDepositData = async (
depositTx: Transaction
parentProvider: Provider
childProvider: Provider
}): Promise<Transaction | TeleporterTransaction> => {
): Promise<Transaction | TeleporterTransaction> => {
const parentProvider = getProviderForChainId(depositTx.parentChainId)
const childProvider = getProviderForChainId(depositTx.childChainId)

// 1. for all the fetched txns, fetch the transaction receipts and update their exact status
// 2. on the basis of those, finally calculate the status of the transaction

Expand Down
18 changes: 2 additions & 16 deletions packages/arb-token-bridge-ui/src/util/teleports/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ export async function transformTeleportFromSubgraph(
childChainId: Number(tx.childChainId)
} as Transaction

const childProvider = getProviderForChainId(Number(tx.childChainId))
return transformDeposit(
await updateAdditionalDepositData({
depositTx,
parentProvider,
childProvider
})
)
return transformDeposit(await updateAdditionalDepositData(depositTx))
}

// Erc20 transfers
Expand Down Expand Up @@ -112,12 +105,5 @@ export async function transformTeleportFromSubgraph(
childChainId: l3ChainId
} as Transaction

const childProvider = getProviderForChainId(l3ChainId)
return transformDeposit(
await updateAdditionalDepositData({
depositTx,
parentProvider,
childProvider
})
)
return transformDeposit(await updateAdditionalDepositData(depositTx))
}

0 comments on commit 592cdac

Please sign in to comment.