#
Reading transaction properites
The Transaction
interface also allows you to read your transaction properties like sig_digest
, id
, etc.
Test it yourself: src/typescript/transaction/working-with-transaction/reading-transaction-properties/reading-properties.ts
import { createHiveChain } from '@hiveio/wax';
// Initialize hive chain interface
const chain = await createHiveChain();
// Initialize a transaction object
const tx = await chain.createTransaction();
// Declare example operation
const operation = {
vote: {
voter: "voter",
author: "test-author",
permlink: "test-permlink",
weight: 2200
}
};
// Push operation into the transction
tx.pushOperation(operation);
// Get a transaction object holding all operations and transaction TAPOS & expiration data, but transaction is **not signed yet**
const builtTransaction = tx.transaction;
// Most transaction properties should be read from the transaction before building it.
console.log(`id: ${tx.id}`);
console.log(`sigDigest: ${tx.sigDigest}`);
// Some transaction properties should be read from the transaction after building it.
console.log(`expiration: ${builtTransaction.expiration}`);
console.log(`ref_block_num: ${builtTransaction.ref_block_num}`);
id: 8b61be0b5b857f2a9be8a65ac5d8461d2b091e30
sigDigest: d552081de1d55636a97633a3dc75a85854e83a574bcbbcffd69dcd7fcb4dcc58
expiration: 2024-09-06T12:33:58
ref_block_num: 1960