Skip to content

Commit

Permalink
feat(types): TransactionRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Dec 17, 2024
1 parent 7e62d8f commit ccb9e28
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/boot/test/fast-usdc/fast-usdc.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ test.serial('makes usdc advance', async t => {
const doc = {
node: `fastUsdc.txns`,
owner: `the Ethereum transactions upon which Fast USDC is acting`,
showValue: defaultSerializer.parse,
};
await documentStorageSchema(t, storage, doc);
});
Expand Down
4 changes: 3 additions & 1 deletion packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ Generated by [AVA](https://avajs.dev).
[
[
'published.fastUsdc.txns.0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702',
'{"body":"#{\\"status\\":\\"ADVANCING\\"}","slots":[]}',
{
status: 'ADVANCING',
},
],
]
Binary file modified packages/boot/test/fast-usdc/snapshots/fast-usdc.test.ts.snap
Binary file not shown.
5 changes: 2 additions & 3 deletions packages/fast-usdc/src/exos/status-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { PendingTxStatus, TerminalTxStatus, TxStatus } from '../constants.js';
/**
* @import {MapStore, SetStore} from '@agoric/store';
* @import {Zone} from '@agoric/zone';
* @import {CctpTxEvidence, NobleAddress, PendingTx, EvmHash, LogFn} from '../types.js';
* @import {CopyRecord} from '@endo/pass-style';
* @import {CctpTxEvidence, NobleAddress, PendingTx, EvmHash, LogFn, TransactionRecord} from '../types.js';
*/

/**
Expand Down Expand Up @@ -102,7 +101,7 @@ export const prepareStatusManager = (

/**
* @param {EvmHash} txId
* @param {CopyRecord} record
* @param {TransactionRecord} record
*/
const publishTxnRecord = (txId, record) => {
const txNode = E(txnsNode).makeChildNode(txId, {
Expand Down
11 changes: 10 additions & 1 deletion packages/fast-usdc/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type {
import type { IBCChannelID } from '@agoric/vats';
import type { Amount } from '@agoric/ertp';
import type { CopyRecord, Passable } from '@endo/pass-style';
import type { PendingTxStatus } from './constants.js';
import type { PendingTxStatus, TxStatus } from './constants.js';
import type { FastUsdcTerms } from './fast-usdc.contract.js';

export type EvmHash = `0x${string}`;
Expand All @@ -34,6 +34,15 @@ export interface CctpTxEvidence {
txHash: EvmHash;
}

/**
* 'evidence' only available when it's first observed and not in subsequent
* updates.
*/
export interface TransactionRecord extends CopyRecord {
evidence?: CctpTxEvidence;
status: TxStatus;
}

export type LogFn = (...args: unknown[]) => void;

export interface PendingTx extends CctpTxEvidence {
Expand Down

0 comments on commit ccb9e28

Please sign in to comment.