-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:
TxStatus
const for StatusManager
states
- Loading branch information
1 parent
3b799b8
commit 1376020
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* Status values for FastUSDC. | ||
* | ||
* @enum {(typeof TxStatus)[keyof typeof TxStatus]} | ||
*/ | ||
export const TxStatus = /** @type {const} */ ({ | ||
/** tx was observed but not advanced */ | ||
Observed: 'OBSERVED', | ||
/** IBC transfer is initiated */ | ||
Advanced: 'ADVANCED', | ||
/** settlement for matching advance received and funds dispersed */ | ||
Settled: 'SETTLED', | ||
}); | ||
harden(TxStatus); | ||
|
||
/** | ||
* Status values for the StatusManager. | ||
* | ||
* @enum {(typeof PendingTxStatus)[keyof typeof PendingTxStatus]} | ||
*/ | ||
export const PendingTxStatus = /** @type {const} */ ({ | ||
/** tx was observed but not advanced */ | ||
Observed: 'OBSERVED', | ||
/** IBC transfer is initiated */ | ||
Advanced: 'ADVANCED', | ||
}); | ||
harden(PendingTxStatus); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { test } from '@agoric/zoe/tools/prepare-test-env-ava.js'; | ||
import { TxStatus, PendingTxStatus } from '../src/constants.js'; | ||
|
||
const { values } = Object; | ||
|
||
test('PendingTxStatus is a subset of TxStatus', t => { | ||
const txStatuses = values(TxStatus); | ||
const difference = values(PendingTxStatus).filter( | ||
status => !txStatuses.includes(status), | ||
); | ||
t.deepEqual(difference, [], 'PendingTxStatus value(s) not in TxStatus'); | ||
}); |