Add tx info which is only available in requests (#1962)

* Add Response Only info
This commit is contained in:
Jackson Mills
2022-04-18 15:50:37 -07:00
committed by GitHub
parent 587a3bbfa2
commit 2f252ace14
5 changed files with 34 additions and 18 deletions

View File

@@ -66,6 +66,26 @@ export interface SignerEntry {
}
}
/**
* This information is added to Transactions in request responses, but is not part
* of the canonical Transaction information on ledger. These fields are denoted with
* lowercase letters to indicate this in the rippled responses.
*/
export interface ResponseOnlyTxInfo {
/**
* The date/time when this transaction was included in a validated ledger.
*/
date?: number
/**
* An identifying hash value unique to this transaction, as a hex string.
*/
hash?: string
/**
* The sequence number of the ledger that included this transaction.
*/
ledger_index?: number
}
/**
* One offer that might be returned from either an {@link NFTBuyOffersRequest}
* or an {@link NFTSellOffersRequest}.

View File

@@ -1,4 +1,4 @@
import { LedgerIndex } from '../common'
import { LedgerIndex, ResponseOnlyTxInfo } from '../common'
import { Transaction, TransactionMetadata } from '../transactions'
import { BaseRequest, BaseResponse } from './baseMethod'
@@ -62,7 +62,7 @@ interface AccountTransaction {
*/
meta: string | TransactionMetadata
/** JSON object defining the transaction. */
tx?: Transaction
tx?: Transaction & ResponseOnlyTxInfo
/** Unique hashed String representing the transaction. */
tx_blob?: string
/**

View File

@@ -1,4 +1,4 @@
import { LedgerIndex } from '../common'
import { LedgerIndex, ResponseOnlyTxInfo } from '../common'
import { Transaction } from '../transactions'
import { BaseRequest, BaseResponse } from './baseMethod'
@@ -77,6 +77,6 @@ export interface NoRippleCheckResponse extends BaseResponse {
* the problems array, and each entry is intended to fix the problem
* described at the same index into that array.
*/
transactions: Transaction[]
transactions: Array<Transaction & ResponseOnlyTxInfo>
}
}

View File

@@ -1,4 +1,10 @@
import type { Amount, Currency, Path, StreamType } from '../common'
import type {
Amount,
Currency,
Path,
StreamType,
ResponseOnlyTxInfo,
} from '../common'
import { Offer } from '../ledger'
import { OfferCreate, Transaction } from '../transactions'
import { TransactionMetadata } from '../transactions/metadata'
@@ -268,17 +274,7 @@ export interface TransactionStream extends BaseStream {
*/
meta?: TransactionMetadata
/** The definition of the transaction in JSON format. */
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
}
transaction: Transaction & ResponseOnlyTxInfo
/**
* If true, this transaction is included in a validated ledger and its
* outcome is final. Responses from the transaction stream should always be

View File

@@ -1,4 +1,4 @@
import { LedgerIndex } from '../common'
import { LedgerIndex, ResponseOnlyTxInfo } from '../common'
import { Transaction, TransactionMetadata } from '../transactions'
import { BaseRequest, BaseResponse } from './baseMethod'
@@ -46,6 +46,6 @@ export interface TransactionEntryResponse extends BaseResponse {
*/
metadata: TransactionMetadata
/** JSON representation of the Transaction object. */
tx_json: Transaction
tx_json: Transaction & ResponseOnlyTxInfo
}
}