Skip to main content

Overview

The hive-tx library provides TypeScript type definitions for all Hive blockchain operations. These types ensure type safety when constructing transactions and operations.

Operation Type

The Operation type is a union of all available operation types, structured as tuples of [operationName, operationBody].

Helper Types

string
Extract the operation name from the Operation union type.
generic
Extract the operation body type for a specific operation name.

Content Operations

VoteOperation

Upvote or downvote content on the blockchain.
string
required
The account name casting the vote
string
required
The author of the content being voted on
The permlink of the content being voted on
number
required
Vote weight from -10000 to 10000 (100% to -100%)

CommentOperation

Create a post or comment on the blockchain.
string
required
Author of the parent post (empty string for top-level posts)
Permlink of the parent post (category for top-level posts)
string
required
Author of the comment or post
Unique permlink for the post or comment
string
required
Title of the post (empty for comments)
string
required
Content body in Markdown format
string
required
JSON string containing metadata (tags, app info, etc.)

DeleteCommentOperation

string
required
Author of the comment to delete
Permlink of the comment to delete

CommentOptionsOperation

string
required
Author of the comment
Permlink of the comment
Asset | string
required
Maximum payout accepted (e.g., “1000.000 HBD”)
number
required
Percentage of payout in HBD (0-10000)
boolean
required
Whether to allow votes on this content
boolean
required
Whether to allow curation rewards
Array<Array<Beneficiary>>
required
Array of beneficiaries for reward sharing

Transfer Operations

TransferOperation

Transfer HIVE or HBD between accounts.
string
required
Sender account name
string
required
Recipient account name
Asset | string
required
Amount to transfer (e.g., “10.000 HIVE” or “5.000 HBD”)
string
required
Transfer memo (can be encrypted or plain text)

RecurrentTransferOperation

string
required
Sender account name
string
required
Recipient account name
Asset | string
required
Amount to transfer per execution
string
required
Transfer memo
number
required
Hours between executions
number
required
Number of executions (2-730)
Array<{ type: number; value: { pair_id: number } }>
required
Extensions for pairing transfers

TransferToVestingOperation

string
required
Account sending HIVE
string
required
Account receiving VESTS (can be same as from)
Asset | string
required
Amount of HIVE to power up

WithdrawVestingOperation

string
required
Account powering down
Asset | string
required
Amount of VESTS to power down

DelegateVestingSharesOperation

string
required
Account delegating VESTS
string
required
Account receiving delegation
Asset | string
required
Amount of VESTS to delegate (0 to remove)

TransferToSavingsOperation

string
required
Account sending to savings
string
required
Account receiving in savings
Asset | string
required
Amount to transfer to savings
string
required
Transfer memo

TransferFromSavingsOperation

string
required
Account withdrawing from savings
number
required
Unique request ID
string
required
Destination account
Asset | string
required
Amount to withdraw
string
required
Withdrawal memo

CancelTransferFromSavingsOperation

string
required
Account canceling withdrawal
number
required
Request ID to cancel

Account Operations

AccountCreateOperation

Asset | string
required
Account creation fee
string
required
Account creating the new account
string
required
Name of the new account
Authority
required
Owner authority
Authority
required
Active authority
Authority
required
Posting authority
string | PublicKey
required
Memo public key
string
required
Account metadata

AccountCreateWithDelegationOperation

Extends AccountCreateOperation with delegation.
Asset | string
required
Amount of VESTS to delegate
[]
required
Extensions array

ClaimAccountOperation

string
required
Account claiming the account creation token
Asset | string
required
Fee (can be 0 HIVE if using RC)
[]
required
Extensions array

CreateClaimedAccountOperation

string
required
Account using the claimed token
string
required
Name of the new account
Authority
required
Owner authority
Authority
required
Active authority
Authority
required
Posting authority
string | PublicKey
required
Memo public key
string
required
Account metadata
[]
required
Extensions array

AccountUpdateOperation

string
required
Account to update
Authority
New owner authority (optional)
Authority
New active authority (optional)
Authority
New posting authority (optional)
string | PublicKey
required
New memo key
string
required
Updated metadata

AccountUpdate2Operation

string
required
Account to update
Authority
New owner authority (optional)
Authority
New active authority (optional)
Authority
New posting authority (optional)
string | PublicKey
New memo key (optional)
string
required
Updated metadata
string
required
Updated posting metadata
[]
required
Extensions array

Witness Operations

AccountWitnessVoteOperation

string
required
Account voting for witness
string
required
Witness account name
boolean
required
true to vote, false to unvote

AccountWitnessProxyOperation

string
required
Account setting proxy
string
required
Proxy account (empty to clear)

WitnessUpdateOperation

string
required
Witness account name
string
required
Witness announcement URL
string | PublicKey
required
Block signing public key
ChainProperties
required
Proposed chain properties
Asset | string
required
Operation fee

WitnessSetPropertiesOperation

string
required
Witness account name
Array<[string, string]>
required
Array of property key-value pairs
[]
required
Extensions array

Conversion Operations

ConvertOperation

string
required
Account initiating conversion
number
required
Unique request ID
Asset | string
required
Amount to convert (HBD to HIVE)

CollateralizedConvertOperation

string
required
Account initiating conversion
number
required
Unique request ID
Asset | string
required
Amount to convert (HIVE to HBD)

Market Operations

LimitOrderCreateOperation

string
required
Account creating the order
number
required
Unique order ID for this account
Asset | string
required
Amount being sold
Asset | string
required
Minimum amount to receive
boolean
required
Fill completely or cancel
string | Date
required
Order expiration time

LimitOrderCreate2Operation

string
required
Account creating the order
number
required
Unique order ID
Asset | string
required
Amount being sold
boolean
required
Fill completely or cancel
Price
required
Exchange rate as Price object
string | Date
required
Order expiration time

LimitOrderCancelOperation

string
required
Account canceling the order
number
required
Order ID to cancel

FeedPublishOperation

string
required
Witness publishing the price feed
Price
required
HBD/HIVE exchange rate

Reward Operations

ClaimRewardBalanceOperation

string
required
Account claiming rewards
Asset | string
required
Amount of HIVE to claim
Asset | string
required
Amount of HBD to claim
Asset | string
required
Amount of VESTS to claim

SetWithdrawVestingRouteOperation

string
required
Account setting the route
string
required
Destination account
number
required
Percentage to route (0-10000)
boolean
required
Auto power up the received amount

Proposal Operations

CreateProposalOperation

string
required
Proposal creator
string
required
Funding receiver
string | Date
required
Funding start date
string | Date
required
Funding end date
Asset | string
required
Daily payment amount
string
required
Proposal subject
Proposal permlink
[]
required
Extensions array

UpdateProposalOperation

number
required
Proposal ID to update
string
required
Proposal creator
Asset | string
required
Updated daily payment
string
required
Updated subject
Updated permlink
Array<Array<{ end_date: string | Date }>>
required
Extensions with optional end_date

UpdateProposalVotesOperation

string
required
Account voting on proposals
number[]
required
Array of proposal IDs
boolean
required
true to approve, false to remove vote
[]
required
Extensions array

RemoveProposalOperation

string
required
Proposal owner
number[]
required
Array of proposal IDs to remove
[]
required
Extensions array

Custom Operations

CustomOperation

string[]
required
Accounts whose active authority is required
number
required
Custom operation ID
Uint8Array | string
required
Operation data

CustomJsonOperation

string[]
required
Accounts whose active authority is required
string[]
required
Accounts whose posting authority is required
string
required
Custom JSON identifier
string
required
JSON string payload

Account Recovery Operations

RecoverAccountOperation

string
required
Account being recovered
Authority
required
New owner authority
Authority
required
Recent owner authority for verification
[]
required
Extensions array

RequestAccountRecoveryOperation

string
required
Recovery account
string
required
Account to recover
Authority
required
New owner authority
[]
required
Extensions array

ChangeRecoveryAccountOperation

string
required
Account changing recovery account
string
required
New recovery account
[]
required
Extensions array

ResetAccountOperation

string
required
Account performing the reset
string
required
Account being reset
Authority
required
New owner authority

SetResetAccountOperation

string
required
Account setting reset account
string
required
Current reset account
string
required
New reset account

DeclineVotingRightsOperation

string
required
Account declining voting rights
boolean
required
true to decline, false to re-enable

Escrow Operations

EscrowTransferOperation

string
required
Sender account
string
required
Recipient account
Asset | string
required
HBD amount in escrow
Asset | string
required
HIVE amount in escrow
number
required
Unique escrow ID
string
required
Escrow agent account
Asset | string
required
Agent fee
string
required
JSON metadata
string | Date
required
Deadline for ratification
string | Date
required
Escrow expiration time

EscrowDisputeOperation

string
required
Sender account
string
required
Recipient account
string
required
Escrow agent
string
required
Account raising dispute
number
required
Escrow ID

EscrowReleaseOperation

string
required
Sender account
string
required
Recipient account
string
required
Escrow agent
string
required
Account releasing funds
string
required
Account receiving funds
number
required
Escrow ID
Asset | string
required
HBD amount to release
Asset | string
required
HIVE amount to release

EscrowApproveOperation

string
required
Sender account
string
required
Recipient account
string
required
Escrow agent
string
required
Account approving
number
required
Escrow ID
boolean
required
true to approve, false to reject

Type Safety Examples

Type-Safe Operation Construction

Using OperationBody Helper

Type-Safe Transaction Building