Class: Account

Represents a single HD node relative to a root seed.

Note

Account initialization should generally be handled through the parent Wallet generatePlugAccount method, addPlugAccount method, generateEthAccount method, or addEthAccount method.

Properties

account.address

string

The public address with respect to the underlying ledger class of the account.

account.assets

Assets

Dictionary of assets, keyed by asset name - see Assets.

account.keys

Object

Key set corresponding to the derived account node.

account.delegationContext

Object

Information relating to the delegatd authority represented by this account

delegationContext.isDelegated

string

Whether this account is externally owned

delegationContext.isPermittedToTransfer

boolean

Whether this delegated account has permissions to send

account.path

string

Relative path of the account node from the provided root seed.

Methods

account.createProof(challenge)

Generates a proof of account ownership over the provided challenge.

Returns:Object Signed proof of address ownership for this account.
Arguments
Name Type Required Description
challenge string Yes The challenge to sign as proof of ownership
account.fetchBalance()

Fetches and returns the account balance with respect to the underlying asset infrastructure.

Returns:Promise<number> resolves with an updated account balance result
account.fetchTransferHistory()

Fetches historical transfers from the underlying ledger.

Returns:Promise<Array<Transfer>> Promise that resolves with the updated transfers history.
account.getFullyQualifiedAddress()

Constructs and returns the globally unique fully-qualified address of the account.

Returns:string the fully qualified address
account.send(transferArgs)

Sends a balance transfer on the underlying ledger infrastructure.

Returns:Promise<Transfer> Promise that resolves with the submitted Transfer instance.
Arguments
Name Type Required Description
transferArgs.to string Yes The recievers address
transferArgs.amount number Yes The amount to send in the lowest denomination available
transferArgs.data string No Extra data to be added to the transaction where applicable

Examples

Transfer balance from an account

1
2
3
4
5
6
// Send 1 Ether to an adderss from an initialized ethereum account
const transfer = myEthAccount.send({
   to: '0xb82685abc18dffdeeb6da9d0dda1d6b1c946f26f',
   amount: 1e18,
   data: "Student loan repayment #372"
})