Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ export function TransferPanel() {
return
}

case 'end': {
setTransferring(false)
clearAmountInput()
return
}
case 'dialog': {
return confirmDialog(step.payload)
}
Expand Down Expand Up @@ -491,7 +496,7 @@ export function TransferPanel() {
destinationChainProvider
})

const returnEarly = await drive(stepGeneratorForCctp, stepExecutor, {
await drive(stepGeneratorForCctp, stepExecutor, {
amount,
amountBigNumber,
isDepositMode,
Expand All @@ -505,21 +510,8 @@ export function TransferPanel() {
childChain,
parentChain
})

// this is only necessary while we are migrating to the ui driver
// so we can know when to stop the execution of the rest of the function
//
// after we are done, we can change the return type of `drive` to `void`
if (returnEarly) {
return
}

setTransferring(false)
clearAmountInput()
clearRoute()
} catch (e) {
} finally {
setTransferring(false)
// todo: double-check error handling
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/arb-token-bridge-ui/src/ui-driver/UiDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ export type UiDriverContext = {
}

export type UiDriverStep =
| { type: 'start' } //
| { type: 'start' }
| { type: 'return' }
| { type: 'end' }
| { type: 'dialog'; payload: Dialog }
| { type: 'scw_tooltip' }
| {
Expand Down Expand Up @@ -79,6 +80,8 @@ export type UiDriverStepResultFor<TStepType extends UiDriverStepType> =
? void
: TStepType extends 'return'
? void
: TStepType extends 'end'
? void
: TStepType extends 'dialog'
? boolean
: TStepType extends 'scw_tooltip'
Expand Down
2 changes: 2 additions & 0 deletions packages/arb-token-bridge-ui/src/ui-driver/UiDriverCctp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export const stepGeneratorForCctp: UiDriverStepGenerator = async function* (
type: 'tx_history_add',
payload: createMergedTransaction(context, receipt.transactionHash)
}

yield* step({ type: 'end' })
}

function createMergedTransaction(
Expand Down