hive-tx v7
GitHub npm

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

MemberType
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>
transactionTransactionType | undefined
expirationmilliseconds, 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_options
  • transfer, transfer_to_vesting, withdraw_vesting
  • custom_json, custom
  • delegate_vesting_shares, claim_reward_balance
  • account_update, account_update2, account_create
  • account_witness_vote, account_witness_proxy
  • recurrent_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.