Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: lifi swapper simplify status detection #8569

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Changes from 2 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
11 changes: 9 additions & 2 deletions packages/swapper/src/swappers/LifiSwapper/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,17 @@ export const lifiApi: SwapperApi = {

const statusResponse = await response.json()

// We have an out Tx hash (either same or cross-chain) for this step, so we consider the Tx (effectively, the step) confirmed
if ((statusResponse.receiving as ExtendedTransactionInfo)?.txHash) {
return {
status: TxStatus.Confirmed,
buyTxHash: (statusResponse.receiving as ExtendedTransactionInfo).txHash,
message: statusResponse.substatusMessage,
}
}

const status = (() => {
switch (statusResponse.status) {
case 'DONE':
return TxStatus.Confirmed
case 'PENDING':
return TxStatus.Pending
case 'FAILED':
Expand Down