Reference
Migration from v6
Version 7 is a TypeScript rewrite. Some names and units changed.
| v6 | v7 |
|---|---|
tx.create([[name, body]]) | await tx.addOperation(name, body) |
call() | callRPC() returns the result and throws RPCError |
broadcast(timeout, retry) | broadcast(checkStatus) |
| Timeout in seconds | Timeout in milliseconds |
new Transaction(tx) | new Transaction({ transaction, expiration }) |
Transaction.signedTransaction | Transaction.transaction |
config.node string | config.nodes array |
config.healthcheckInterval | Removed |
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