Skip to content

Commit

Permalink
Add 'failed' variant to EdgeTransaction confirmations API
Browse files Browse the repository at this point in the history
  • Loading branch information
samholmes committed Mar 21, 2024
1 parent d6051d4 commit 91c9d91
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- added: New `'failed'` value to confirmations field on `EdgeTransactions`

## 2.2.1 (2024-02-21)

- fixed: Correctly save `enabledTokenIds` when creating a new wallet.
Expand Down
10 changes: 7 additions & 3 deletions src/core/currency/wallet/currency-wallet-callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,13 @@ export function watchCurrencyWallet(input: CurrencyWalletInput): void {
const shouldCoreDetermineConfirmations = (
confirmations: EdgeTransaction['confirmations']
): boolean => {
// Return true as long as neither of the "hardened" confirmation states are
// present in the transaction object
return confirmations !== 'confirmed' && confirmations !== 'dropped'
// Return true as long as neither of the "hardened" confirmation values
// are given.
return (
confirmations !== 'confirmed' &&
confirmations !== 'dropped' &&
confirmations !== 'failed'
)
}

export const determineConfirmations = (
Expand Down
3 changes: 3 additions & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,9 @@ export type EdgeConfirmationState =
| 'confirmed'
// Dropped from the network without confirmations:
| 'dropped'
// Confirmed, but failed on-chain execution (exceeded gas limit,
// smart-contract failure, etc):
| 'failed'
// We don't know the chain height yet:
| 'syncing'
// No confirmations yet:
Expand Down

0 comments on commit 91c9d91

Please sign in to comment.