Skip to content

Commit

Permalink
adds default testnet time
Browse files Browse the repository at this point in the history
  • Loading branch information
douglance committed Oct 14, 2024
1 parent ab840af commit 3cefb00
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/arb-token-bridge-ui/src/util/WithdrawalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { GasEstimates } from '../hooks/arbTokenBridge.types'
import { Address } from './AddressUtils'
import { captureSentryErrorWithExtraData } from './SentryUtils'
import { getBridgeUiConfigForChain } from './bridgeUiConfig'
import { isNetwork } from './networks'

export async function withdrawInitTxEstimateGas({
amount,
Expand Down Expand Up @@ -112,6 +113,7 @@ const SECONDS_IN_HOUR = 3600
const SECONDS_IN_DAY = 86400
const DEFAULT_CONFIRMATION_TIME = 7 * SECONDS_IN_DAY
const DEFAULT_FAST_WITHDRAWAL_TIME = SECONDS_IN_DAY
const DEFAULT_TESTNET_CONFIRMATION_TIME = SECONDS_IN_HOUR

function formatDuration(seconds: number): string {
if (seconds < SECONDS_IN_MINUTE) return `${seconds} seconds`
Expand All @@ -129,6 +131,7 @@ function formatDuration(seconds: number): string {
export function getConfirmationTime(chainId: number) {
const { fastWithdrawalTime, fastWithdrawalActive } =
getBridgeUiConfigForChain(chainId)
const isTestnet = isNetwork(chainId).isTestnet

const isDefaultConfirmationTime = !fastWithdrawalActive
const isDefaultFastWithdrawal = fastWithdrawalActive && !fastWithdrawalTime
Expand All @@ -141,7 +144,9 @@ export function getConfirmationTime(chainId: number) {
} else if (isCustomFastWithdrawal) {
confirmationTimeInSeconds = fastWithdrawalTime / 1000
} else {
confirmationTimeInSeconds = DEFAULT_CONFIRMATION_TIME
confirmationTimeInSeconds = isTestnet
? DEFAULT_TESTNET_CONFIRMATION_TIME
: DEFAULT_CONFIRMATION_TIME
}

const confirmationTimeInReadableFormat = formatDuration(
Expand Down

0 comments on commit 3cefb00

Please sign in to comment.