hive-tx v7
GitHub npm

Reference

Migration from v6

Version 7 is a TypeScript rewrite. Some names and units changed.

v6v7
tx.create([[name, body]])await tx.addOperation(name, body)
call()callRPC() returns the result and throws RPCError
broadcast(timeout, retry)broadcast(checkStatus)
Timeout in secondsTimeout in milliseconds
new Transaction(tx)new Transaction({ transaction, expiration })
Transaction.signedTransactionTransaction.transaction
config.node stringconfig.nodes array
config.healthcheckIntervalRemoved

Create a transaction

// v6
const tx = new Transaction()
await tx.create([['vote', { voter: 'alice', author: 'bob', permlink: 'post', weight: 10000 }]])

// v7
const tx = new Transaction()
await tx.addOperation('vote', {
  voter: 'alice',
  author: 'bob',
  permlink: 'post',
  weight: 10000
})

API call

// v6
const result = await call('condenser_api.get_accounts', [['alice']])
const accounts = result.result

// v7
const accounts = await callRPC('condenser_api.get_accounts', [['alice']])

Configuration

// v6
config.node = 'https://api.hive.blog'
config.timeout = 10

// v7
config.nodes = ['https://api.hive.blog', 'https://api.deathwing.me']
config.timeout = 10_000