@hashgraph/sdk
Version:
318 lines (317 loc) • 11.7 kB
TypeScript
/**
* @typedef {import("../token/TokenId.js").default} TokenId
* @typedef {import("../token/TokenTransfer.js").TokenTransferJSON} TokenTransferJSON
* @typedef {import("../account/HbarAllowance.js").default} HbarAllowance
* @typedef {import("../account/TokenAllowance.js").default} TokenAllowance
* @typedef {import("../account/TokenNftAllowance.js").default} TokenNftAllowance
* @typedef {import("./TransactionReceipt.js").TransactionReceiptJSON} TransactionReceiptJSON
* @typedef {import("../Transfer.js").TransferJSON} TransferJSON
*/
/**
* @typedef {object} TransactionRecordJSON
* @property {TransactionReceiptJSON} receipt
* @property {?string} transactionHash
* @property {Date} consensusTimestamp
* @property {string} transactionId
* @property {string} transactionMemo
* @property {string} transactionFee
* @property {TransferJSON[]} transfers
* @property {TokenTransferMap} tokenTransfers
* @property {TokenTransferJSON[]} tokenTransfersList
* @property {?string} scheduleRef
* @property {AssessedCustomFee[]} assessedCustomFees
* @property {TokenNftTransferMap} nftTransfers
* @property {TokenAssocation[]} automaticTokenAssociations
* @property {Date | null} parentConsensusTimestamp
* @property {?string} aliasKey
* @property {TransactionRecord[]} duplicates
* @property {TransactionRecord[]} children
* @property {?string} ethereumHash
* @property {Transfer[]} paidStakingRewards
* @property {?string} prngBytes
* @property {?number} prngNumber
* @property {?string} evmAddress
*/
/**
* Either the record of processing the first consensus transaction with the given id whose
* status was neither <tt>INVALID_NODE_ACCOUNT</tt> nor <tt>INVALID_PAYER_SIGNATURE</tt>;
* <b>or</b>, if no such record exists, the record of processing the first transaction to reach
* consensus with the given transaction id.
*/
export default class TransactionRecord {
/**
* @internal
* @param {HieroProto.proto.ITransactionGetRecordResponse} response
* @returns {TransactionRecord}
*/
static _fromProtobuf(response: HieroProto.proto.ITransactionGetRecordResponse): TransactionRecord;
/**
* @param {Uint8Array} bytes
* @returns {TransactionRecord}
*/
static fromBytes(bytes: Uint8Array): TransactionRecord;
/**
* @private
* @param {object} props
* @param {ContractFunctionResult} [props.contractFunctionResult]
* @param {TransactionReceipt} props.receipt
* @param {Uint8Array} props.transactionHash
* @param {Timestamp} props.consensusTimestamp
* @param {TransactionId} props.transactionId
* @param {string} props.transactionMemo
* @param {Hbar} props.transactionFee
* @param {Transfer[]} props.transfers
* @param {TokenTransferMap} props.tokenTransfers
* @param {TokenTransfer[]} props.tokenTransfersList
* @param {?ScheduleId} props.scheduleRef
* @param {AssessedCustomFee[]} props.assessedCustomFees
* @param {TokenNftTransferMap} props.nftTransfers
* @param {TokenAssocation[]} props.automaticTokenAssociations
* @param {Timestamp | null} props.parentConsensusTimestamp
* @param {PublicKey | null} props.aliasKey
* @param {TransactionRecord[]} props.duplicates
* @param {TransactionRecord[]} props.children
* @param {HbarAllowance[]} props.hbarAllowanceAdjustments
* @param {TokenAllowance[]} props.tokenAllowanceAdjustments
* @param {TokenNftAllowance[]} props.nftAllowanceAdjustments
* @param {?Uint8Array} props.ethereumHash
* @param {Transfer[]} props.paidStakingRewards
* @param {?Uint8Array} props.prngBytes
* @param {?number} props.prngNumber
* @param {?EvmAddress} props.evmAddress
* @param {PendingAirdropRecord[]} props.newPendingAirdrops
*/
private constructor();
/**
* The status (reach consensus, or failed, or is unknown) and the ID of
* any new account/file/instance created.
*
* @readonly
*/
readonly receipt: TransactionReceipt;
/**
* The hash of the Transaction that executed (not the hash of any Transaction that failed
* for having a duplicate TransactionID).
*
* @readonly
*/
readonly transactionHash: Uint8Array<ArrayBufferLike>;
/**
* The consensus timestamp (or null if didn't reach consensus yet).
*
* @readonly
*/
readonly consensusTimestamp: Timestamp;
/**
* The ID of the transaction this record represents.
*
* @readonly
*/
readonly transactionId: TransactionId;
/**
* The memo that was submitted as part of the transaction (max 100 bytes).
*
* @readonly
*/
readonly transactionMemo: string;
/**
* The actual transaction fee charged,
* not the original transactionFee value from TransactionBody.
*
* @readonly
*/
readonly transactionFee: Hbar;
/**
* All hbar transfers as a result of this transaction, such as fees, or transfers performed
* by the transaction, or by a smart contract it calls, or by the creation of threshold
* records that it triggers.
*
* @readonly
*/
readonly transfers: Transfer[];
/**
* Record of the value returned by the smart contract function or constructor.
*
* @readonly
*/
readonly contractFunctionResult: ContractFunctionResult | null;
/**
* All the token transfers from this account
*
* @readonly
*/
readonly tokenTransfers: TokenTransferMap;
/**
* All the token transfers from this account
*
* @readonly
*/
readonly tokenTransfersList: TokenTransfer[];
/**
* Reference to the scheduled transaction ID that this transaction record represent
*
* @readonly
*/
readonly scheduleRef: ScheduleId | null;
/**
* All custom fees that were assessed during a CryptoTransfer, and must be paid if the
* transaction status resolved to SUCCESS
*
* @readonly
*/
readonly assessedCustomFees: AssessedCustomFee[];
/** @readonly */
readonly nftTransfers: TokenNftTransferMap;
/**
* All token associations implicitly created while handling this transaction
*
* @readonly
*/
readonly automaticTokenAssociations: TokenAssocation[];
/**
* In the record of an internal transaction, the consensus timestamp of the user
* transaction that spawned it.
*
* @readonly
*/
readonly parentConsensusTimestamp: Timestamp | null;
/**
* In the record of an internal CryptoCreate transaction triggered by a user
* transaction with a (previously unused) alias, the new account's alias.
*
* @readonly
*/
readonly aliasKey: PublicKey | null;
/**
* The records of processing all consensus transaction with the same id as the distinguished
* record above, in chronological order.
*
* @readonly
*/
readonly duplicates: TransactionRecord[];
/**
* The records of processing all child transaction spawned by the transaction with the given
* top-level id, in consensus order. Always empty if the top-level status is UNKNOWN.
*
* @readonly
*/
readonly children: TransactionRecord[];
/**
* @deprecated
* @readonly
*/
readonly hbarAllowanceAdjustments: import("../account/HbarAllowance.js").default[];
/**
* @deprecated
* @readonly
*/
readonly tokenAllowanceAdjustments: import("../account/TokenAllowance.js").default[];
/**
* @deprecated
* @readonly
*/
readonly nftAllowanceAdjustments: import("../account/TokenNftAllowance.js").default[];
/**
* The keccak256 hash of the ethereumData. This field will only be populated for
* EthereumTransaction.
*
* @readonly
*/
readonly ethereumHash: Uint8Array<ArrayBufferLike> | null;
/**
* List of accounts with the corresponding staking rewards paid as a result of a transaction.
*
* @readonly
*/
readonly paidStakingRewards: Transfer[];
/**
* In the record of a PRNG transaction with no output range, a pseudorandom 384-bit string.
*
* @readonly
*/
readonly prngBytes: Uint8Array<ArrayBufferLike> | null;
/**
* In the record of a PRNG transaction with an output range, the output of a PRNG whose input was a 384-bit string.
*
* @readonly
*/
readonly prngNumber: number | null;
/**
* The new default EVM address of the account created by this transaction.
* This field is populated only when the EVM address is not specified in the related transaction body.
*
* @readonly
*/
readonly evmAddress: EvmAddress | null;
/**
* The new default EVM address of the account created by this transaction.
* This field is populated only when the EVM address is not specified in the related transaction body.
*
* @readonly
*/
readonly newPendingAirdrops: PendingAirdropRecord[];
/**
* @internal
* @returns {HieroProto.proto.ITransactionGetRecordResponse}
*/
_toProtobuf(): HieroProto.proto.ITransactionGetRecordResponse;
/**
* @returns {Uint8Array}
*/
toBytes(): Uint8Array;
/**
* @returns {TransactionRecordJSON}
*/
toJSON(): TransactionRecordJSON;
/**
* @returns {string}
*/
toString(): string;
}
export type TokenId = import("../token/TokenId.js").default;
export type TokenTransferJSON = import("../token/TokenTransfer.js").TokenTransferJSON;
export type HbarAllowance = import("../account/HbarAllowance.js").default;
export type TokenAllowance = import("../account/TokenAllowance.js").default;
export type TokenNftAllowance = import("../account/TokenNftAllowance.js").default;
export type TransactionReceiptJSON = import("./TransactionReceipt.js").TransactionReceiptJSON;
export type TransferJSON = import("../Transfer.js").TransferJSON;
export type TransactionRecordJSON = {
receipt: TransactionReceiptJSON;
transactionHash: string | null;
consensusTimestamp: Date;
transactionId: string;
transactionMemo: string;
transactionFee: string;
transfers: TransferJSON[];
tokenTransfers: TokenTransferMap;
tokenTransfersList: TokenTransferJSON[];
scheduleRef: string | null;
assessedCustomFees: AssessedCustomFee[];
nftTransfers: TokenNftTransferMap;
automaticTokenAssociations: TokenAssocation[];
parentConsensusTimestamp: Date | null;
aliasKey: string | null;
duplicates: TransactionRecord[];
children: TransactionRecord[];
ethereumHash: string | null;
paidStakingRewards: Transfer[];
prngBytes: string | null;
prngNumber: number | null;
evmAddress: string | null;
};
import TransactionReceipt from "./TransactionReceipt.js";
import Timestamp from "../Timestamp.js";
import TransactionId from "./TransactionId.js";
import Hbar from "../Hbar.js";
import Transfer from "../Transfer.js";
import ContractFunctionResult from "../contract/ContractFunctionResult.js";
import TokenTransferMap from "../account/TokenTransferMap.js";
import TokenTransfer from "../token/TokenTransfer.js";
import ScheduleId from "../schedule/ScheduleId.js";
import AssessedCustomFee from "../token/AssessedCustomFee.js";
import TokenNftTransferMap from "../account/TokenNftTransferMap.js";
import TokenAssocation from "../token/TokenAssociation.js";
import PublicKey from "../PublicKey.js";
import EvmAddress from "../EvmAddress.js";
import PendingAirdropRecord from "../token/PendingAirdropRecord.js";
import * as HieroProto from "@hashgraph/proto";