From 803ea6d2cbcd438267a9bf0d5bb61f428054117a Mon Sep 17 00:00:00 2001 From: Jackson Mills Date: Fri, 7 Jan 2022 10:50:26 -0800 Subject: [PATCH] Add missing fields to TxSubscription and Tx requests (#1893) * Update: Add hash and date type to TxSubscription and Tx responses. The base transaction interface has been updated to include a hash type. * Every signed transaction has a unique "hash" that identifies it. * The transaction hash can be used as a "proof of payment" to verify the final status. Co-authored-by: interc0der <86900618+interc0der@users.noreply.github.com> Co-authored-by: Elliot Lee --- packages/xrpl/src/models/methods/subscribe.ts | 24 +++++++++++++++++-- packages/xrpl/src/models/methods/tx.ts | 4 ++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/packages/xrpl/src/models/methods/subscribe.ts b/packages/xrpl/src/models/methods/subscribe.ts index 52aed0d2..1cb7f667 100644 --- a/packages/xrpl/src/models/methods/subscribe.ts +++ b/packages/xrpl/src/models/methods/subscribe.ts @@ -268,7 +268,17 @@ export interface TransactionStream extends BaseStream { */ meta?: TransactionMetadata /** The definition of the transaction in JSON format. */ - transaction: Transaction + transaction: Transaction & { + /** + * This number measures the number of seconds since the "Ripple Epoch" of January 1, 2000 (00:00 UTC) + */ + date?: number + /** + * Every signed transaction has a unique "hash" that identifies it. + * The transaction hash can be used to look up its final status, which may serve as a "proof of payment" + */ + hash?: string + } /** * If true, this transaction is included in a validated ledger and its * outcome is final. Responses from the transaction stream should always be @@ -336,7 +346,17 @@ export interface OrderBookStream extends BaseStream { ledger_hash?: string ledger_index?: number meta: TransactionMetadata - transaction: Transaction | ModifiedOfferCreateTransaction + transaction: (Transaction | ModifiedOfferCreateTransaction) & { + /** + * This number measures the number of seconds since the "Ripple Epoch" of January 1, 2000 (00:00 UTC) + */ + date?: number + /** + * Every signed transaction has a unique "hash" that identifies it. + * The transaction hash can be used to look up its final status, which may serve as a "proof of payment" + */ + hash?: string + } validated: boolean } diff --git a/packages/xrpl/src/models/methods/tx.ts b/packages/xrpl/src/models/methods/tx.ts index e971be72..3ef586a6 100644 --- a/packages/xrpl/src/models/methods/tx.ts +++ b/packages/xrpl/src/models/methods/tx.ts @@ -51,6 +51,10 @@ export interface TxResponse extends BaseResponse { * Set to false, this data is not final. */ validated?: boolean + /** + * This number measures the number of seconds since the "Ripple Epoch" of January 1, 2000 (00:00 UTC) + */ + date?: number } & Transaction /** * If true, the server was able to search all of the specified ledger