Models

Account

class Account(key, data)

exported from models/account

Extends:
  • models/record.Record
Arguments:
  • key (string) – database key of record
  • data (models/account.AccountData) – data of record
Account.address

type: Address

Account.balance

type: Amount

Account.nonce

type: number

class AccountSpec()

interface, exported from models/account

Unique identifier of an account. ChainId is optional. Managers use default chainId if undefined.

AccountSpec.address

type: string|Address

AccountSpec.chainId

type: undefined|string

Key

class Key(key, data)

exported from models/key

Extends:
  • models/record.Record
Arguments:
  • key (string) – database key of record
  • data (models/key.KeyData) – data of record
Key.keyPair

type: any

Key.fromRecord(record)
Arguments:
  • record (models/record.Record<any>) –
Returns:

models/key.Key

Key.signMessage(message, enc)
Arguments:
  • message (Buffer) –
  • enc (models/key.Encoding) –
Returns:

Promise<string>

Key.signTransaction(tx)
Arguments:
  • tx (models/transaction.Transaction) –
Returns:

Promise<models/transaction.SignedTransaction>

Key.unlock(passphrase)
Arguments:
  • passphrase (undefined|string) –

Transaction

class Transaction(key, data, txBody)

exported from models/transaction

Extends:
  • models/record.Record
Arguments:
  • key (string) –
  • data (models/transaction.TransactionData) –
  • txBody (models/transaction.CompleteTxBody) –
Transaction.amount

type: Amount

Transaction.txBody

type: models/transaction.CompleteTxBody

Transaction.unsignedHash

type: string

Transaction.getUnsignedHash()

Calculate the hash excluding any signature

Returns:string
Transaction.Status

type: models/transaction.Status

class SignedTransaction(key, data, txBody, signature)

exported from models/transaction

Extends:
  • models/transaction.Transaction()
Arguments:
  • key (string) –
  • data (models/transaction.TransactionData) –
  • txBody (models/transaction.CompleteTxBody) –
  • signature (string) –
SignedTransaction.hash

type: string

SignedTransaction.isConfirmed

type: boolean

SignedTransaction.isPending

type: boolean

SignedTransaction.signature

type: string

SignedTransaction.status

type: string

SignedTransaction.txBody

type: models/transaction.CompleteTxBody

SignedTransaction.fromTxBody(txBody, chainId)
Arguments:
  • txBody (models/transaction.CompleteTxBody) –
  • chainId (string) –
Returns:

models/transaction.SignedTransaction

SignedTransaction.getHash()

Calculate the hash, including all present body

Returns:Promise<string>
class TxBody()

interface, exported from models/transaction

TxBody.amount

type: string|number|Amount

TxBody.chainIdHash

type: string|Uint8Array

TxBody.from

type: string|Address

TxBody.hash

type: undefined|string

TxBody.limit

type: undefined|number

TxBody.nonce

type: undefined|number

TxBody.payload

type: string|Uint8Array

TxBody.price

type: string|Amount

TxBody.sign

type: undefined|string

TxBody.to

type: string|Address|null

TxBody.type

type: undefined|number