Skip to content

Commit

Permalink
refactor: delete unused code and rename hook file (#2123)
Browse files Browse the repository at this point in the history
  • Loading branch information
fionnachan authored Dec 10, 2024
1 parent 456ca48 commit 90f3aa4
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { ExternalLink } from '../common/ExternalLink'
import { TransferCountdown } from '../common/TransferCountdown'
import { isDepositReadyToRedeem } from '../../state/app/utils'
import { Address } from '../../util/AddressUtils'
import { isTeleportTx } from '../../hooks/useTransactions'
import { isTeleportTx } from '../../types/Transactions'
import {
firstRetryableLegRequiresRedeem,
secondRetryableLegForTeleportRequiresRedeem
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { isDepositReadyToRedeem } from '../../state/app/utils'
import { useRedeemRetryable } from '../../hooks/useRedeemRetryable'
import { TransferCountdown } from '../common/TransferCountdown'
import { getChainIdForRedeemingRetryable } from '../../util/RetryableUtils'
import { isTeleportTx } from '../../hooks/useTransactions'
import { isTeleportTx } from '../../types/Transactions'
import { useRedeemTeleporter } from '../../hooks/useRedeemTeleporter'
import { sanitizeTokenSymbol } from '../../util/TokenUtils'
import { formatAmount } from '../../util/NumberUtils'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { getAttestationHashAndMessageFromReceipt } from '../../util/cctp/getAtte
import { getOutgoingMessageState } from '../../util/withdrawals/helpers'
import { getUniqueIdOrHashFromEvent } from '../../hooks/useArbTokenBridge'
import { getProviderForChainId } from '../../token-bridge-sdk/utils'
import { isTeleportTx } from '../../hooks/useTransactions'
import { isTeleportTx } from '../../types/Transactions'

const PARENT_CHAIN_TX_DETAILS_OF_CLAIM_TX =
'arbitrum:bridge:claim:parent:tx:details'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
useTransferDuration
} from '../../hooks/useTransferDuration'
import { isNetwork } from '../../util/networks'
import { isTeleportTx } from '../../hooks/useTransactions'
import { isTeleportTx } from '../../types/Transactions'

/**
* Displays a transfer countdown for a deposit, withdrawal, or cctp.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { isUserRejectedError } from '../util/isUserRejectedError'
import { errorToast } from '../components/common/atoms/Toast'
import { useTransactionHistory } from './useTransactionHistory'
import { Address } from '../util/AddressUtils'
import { isTeleportTx, L2ToL3MessageData } from './useTransactions'
import { isTeleportTx, L2ToL3MessageData } from '../types/Transactions'
import { UseRedeemRetryableResult } from './useRedeemRetryable'
import { getUpdatedTeleportTransfer } from '../components/TransactionHistory/helpers'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
L2ToL1EventResultPlus,
WithdrawalInitiated
} from './arbTokenBridge.types'
import { isTeleportTx, Transaction } from './useTransactions'
import { isTeleportTx, Transaction } from '../types/Transactions'
import { MergedTransaction } from '../state/app/state'
import {
isCustomDestinationAddressTx,
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/state/app/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
ChildToParentMessageData,
L2ToL3MessageData,
TxnType
} from '../../hooks/useTransactions'
} from '../../types/Transactions'
import { ConnectionState } from '../../util'
import { CCTPSupportedChainId } from '../cctpState'
import { Address } from '../../util/AddressUtils'
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/state/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
isTeleportTx,
TeleporterTransaction,
Transaction
} from '../../hooks/useTransactions'
} from '../../types/Transactions'
import { getUniqueIdOrHashFromEvent } from '../../hooks/useArbTokenBridge'
import {
firstRetryableLegRequiresRedeem,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { AssetType } from './arbTokenBridge.types'
import { BigNumber } from 'ethers'
import { ParentToChildMessageStatus } from '@arbitrum/sdk'

import { AssetType } from '../hooks/arbTokenBridge.types'
import {
MergedTransaction,
TeleporterMergedTransaction
Expand All @@ -24,22 +25,6 @@ export type TxnType =
| 'deposit-l2-ticket-created' // unused; keeping for cache backwrads compatability
| 'approve-l2'

export const txnTypeToLayer = (txnType: TxnType): 1 | 2 => {
switch (txnType) {
case 'deposit':
case 'deposit-l1':
case 'outbox':
case 'approve':
return 1
case 'deposit-l2':
case 'withdraw':
case 'deposit-l2-auto-redeem':
case 'deposit-l2-ticket-created':
case 'approve-l2':
return 2
}
}

export interface ParentToChildMessageData {
status: ParentToChildMessageStatus
retryableCreationTxID: string
Expand Down Expand Up @@ -93,20 +78,6 @@ export interface TeleporterTransaction extends Transaction {
l2ToL3MsgData: L2ToL3MessageData
}

export interface NewTransaction extends TransactionBase {
status: 'pending'
}

export interface FailedTransaction extends TransactionBase {
status: 'failure'
}

// TODO: enforce this type restriction
export interface DepositTransaction extends Transaction {
parentToChildMsgData: ParentToChildMessageData
type: 'deposit' | 'deposit-l1'
}

export function isTeleportTx(
tx: Transaction | MergedTransaction
): tx is TeleporterTransaction | TeleporterMergedTransaction {
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/util/RetryableUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TeleporterMergedTransaction
} from '../state/app/state'
import { normalizeTimestamp } from '../state/app/utils'
import { isTeleportTx } from '../hooks/useTransactions'
import { isTeleportTx } from '../types/Transactions'

type GetRetryableTicketParams = {
parentChainTxHash: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
FetchDepositsFromSubgraphResult
} from './fetchDepositsFromSubgraph'
import { AssetType } from '../../hooks/arbTokenBridge.types'
import { Transaction } from '../../hooks/useTransactions'
import { Transaction } from '../../types/Transactions'
import { defaultErc20Decimals } from '../../defaults'
import { fetchNativeCurrency } from '../../hooks/useNativeCurrency'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/util/deposits/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
Transaction,
TxnStatus,
TeleporterTransaction
} from '../../hooks/useTransactions'
} from '../../types/Transactions'
import { fetchErc20Data } from '../TokenUtils'
import {
getL2ConfigForTeleport,
Expand Down
2 changes: 1 addition & 1 deletion packages/arb-token-bridge-ui/src/util/teleports/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { MergedTransaction } from '../../state/app/state'
import { FetchEthTeleportsFromSubgraphResult } from './fetchEthTeleportsFromSubgraph'
import { TeleportFromSubgraph } from './fetchTeleports'
import { AssetType } from '../../hooks/arbTokenBridge.types'
import { Transaction } from '../../hooks/useTransactions'
import { Transaction } from '../../types/Transactions'
import { transformDeposit } from '../../state/app/utils'
import { updateAdditionalDepositData } from '../deposits/helpers'
import { fetchErc20Data } from '../TokenUtils'
Expand Down

0 comments on commit 90f3aa4

Please sign in to comment.