Skip to content

Extend transaction builder

Mateusz Tyszczak requested to merge tm-extend-transaction-builder into develop

Assumptions

Examples

Use hive TransactionBuilder interface with custom follow hive apps operations

import { createWaxFoundation, FollowOperationBuilder } from '@hiveio/wax';

const wax = await createWaxFoundation();

const tx = new wax.TransactionBuilder('04c507a8c7fe5be96be64ce7c86855e1806cbde3', '2023-11-09T21:51:27');

tx.push(new FollowOperationBuilder().followBlog("initminer", "gtg").authorize("intiminer").build());

console.info(tx.toApi()); // Print the transaction in the API form

Use hive TransactionBuilder interface to delegate resource credits

import { createWaxFoundation, ResourceCreditsOperationBuilder } from '@hiveio/wax';

const wax = await createWaxFoundation();

const tx = new wax.TransactionBuilder('04c507a8c7fe5be96be64ce7c86855e1806cbde3', '2023-11-09T21:51:27');

tx.push(new ResourceCreditsOperationBuilder().delegate("initminer", 3000, "gtg").authorize("intiminer").build());

console.info(tx.toApi()); // Print the transaction in the API form

Use hive CommunityOperationBuilder interface to subscribe to given community

import { createWaxFoundation, CommunityOperationBuilder } from '@hiveio/wax';

const wax = await createWaxFoundation();

const tx = new wax.TransactionBuilder('04c507a8c7fe5be96be64ce7c86855e1806cbde3', '2023-11-09T21:51:27');

tx.push(new CommunityOperationBuilder().subscribe("mycomm").authorize("intiminer").build());

console.info(tx.toApi()); // Print the transaction in the API form
Edited by Mateusz Tyszczak

Merge request reports

Loading