#
Pushing simple operation
If your case is to perform simple actions on your transaction or create a new transaction, you can use initialization with the wax base interface.
However it is recommended to use chain initialization due to automatic TaPos data fetching (and so we do in the example code below).
Below is an example of fully building a simple transaction using the basic Transaction
interface.
Test it yourself: src/typescript/transaction/working-with-transaction/pushing-simple-operation/simple-operation.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 builtTx = tx.transaction;
console.log(builtTx.operations);
[
{
vote: {
voter: 'voter',
author: 'test-author',
permlink: 'test-permlink',
weight: 2200
}
}
]