Reference
API reference
This page lists public exports. TypeScript files in dist give full types.
Exports
import {
Transaction,
PrivateKey,
PublicKey,
Signature,
Memo,
callRPC,
callREST,
callWithQuorum,
config,
utils
} from 'hive-tx'
Transaction
| Member | Type |
|---|---|
constructor(options?) | { transaction?, expiration? } |
addOperation(name, body) | Promise<void> |
sign(keys) | PrivateKey | PrivateKey[] → TransactionType |
broadcast(checkStatus?) | Promise<BroadcastResult> |
digest() | { digest: Uint8Array, txId: string } |
addSignature(hex) | 130-character hex string |
checkStatus() | Promise<TransactionStatus> |
transaction | TransactionType | undefined |
expiration | milliseconds, default 60000 |
BroadcastResult
{
tx_id: string
status: 'unknown' | 'within_irreversible_block' | 'expired_irreversible' | 'too_old'
}
callRPC
callRPC(method, params?, timeout?, retry?): Promise<T>
callWithQuorum
callWithQuorum(method, params?, quorum?): Promise<T>
callREST
callREST(api, endpoint, params?, timeout?, retry?): Promise<...>
Memo
Memo.encode(privateKey, publicKey, memo): string
Memo.decode(privateKey, memo): string
Operation names
TypeScript accepts Hive operation names as the first argument of addOperation. The body type matches the name. Common names:
vote,comment,delete_comment,comment_optionstransfer,transfer_to_vesting,withdraw_vestingcustom_json,customdelegate_vesting_shares,claim_reward_balanceaccount_update,account_update2,account_createaccount_witness_vote,account_witness_proxyrecurrent_transfer,witness_update,witness_set_properties
The full list is in src/types.ts.
Support
Use the Hive Discord server. The channel is #dev-chat.