Chain
@aeternity/aepp-sdk/es/chain
Chain module
Example
import Chain from '@aeternity/aepp-sdk/es/chain'
- @aeternity/aepp-sdk/es/chain
- instance
- async
- .sendTransaction(tx, [options]) ⇒
Object
|String
- .height() ⇒
Number
- .awaitHeight([options]) ⇒
Number
- .poll([options]) ⇒
Object
- .balance(address, [options]) ⇒
Object
- .tx(hash, info) ⇒
Object
- .getTxInfo(hash) ⇒
Object
- .mempool() ⇒
Array.<Object>
- .getCurrentGeneration() ⇒
Object
- .getGeneration(hashOrHeight) ⇒
Object
- .waitForTxConfirm(txHash, [options]) ⇒
Promise.<Number>
- .getMicroBlockTransactions() ⇒
Array.<Object>
- .getKeyBlock() ⇒
Object
- .getMicroBlockHeader() ⇒
Object
- .getAccount(address, [options]) ⇒
Object
- .txDryRun(txs, accounts, hashOrHeight) ⇒
Object
- .getInfo() ⇒
Object
- .sendTransaction(tx, [options]) ⇒
- async
- static
- .waitMined(bool) ⇒
Stamp
- .waitMined(bool) ⇒
- instance
@aeternity/aepp-sdk/es/chain.sendTransaction(tx, [options]) ⇒ Object
| String
Submit a signed transaction for mining
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
| String
- Transaction or transaction hash
Category: async
rtype: (tx: String, options?: Object) => tx: Promise[Object]|txHash: Promise[String]
Param | Type | Default | Description |
---|---|---|---|
tx | String |
Transaction to submit | |
[options] | String |
{} |
Options to pass to the implementation |
[options.verify] | String |
false |
Verify transaction before broadcast. |
@aeternity/aepp-sdk/es/chain.height() ⇒ Number
Obtain current height of the chain
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Number
- Current chain height
Category: async
rtype: () => height: Number
@aeternity/aepp-sdk/es/chain.awaitHeight([options]) ⇒ Number
Wait for the chain to reach a specific height
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Number
- Current chain height
Category: async
rtype: (height: Number, options?: Object) => height: Number
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
{} |
Options |
options.interval | Number |
Interval (in ms) at which to poll the chain | |
options.attempts | Number |
Number of polling attempts after which to fail |
@aeternity/aepp-sdk/es/chain.poll([options]) ⇒ Object
Wait for a transaction to be mined
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- The transaction as it was mined
Category: async
rtype: (th: String, options?: Object) => tx: Object
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
{} |
Options |
options.interval | Number |
Interval (in ms) at which to poll the chain | |
options.blocks | Number |
Number of blocks mined after which to fail |
@aeternity/aepp-sdk/es/chain.balance(address, [options]) ⇒ Object
Request the balance of specified account
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- The transaction as it was mined
Category: async
rtype: (address: String, options?: Object) => balance: Number
Param | Type | Default | Description |
---|---|---|---|
address | String |
The public account address to obtain the balance for | |
[options] | Object |
{} |
Options |
options.height | Number |
The chain height at which to obtain the balance for (default: top of chain) | |
options.hash | String |
The block hash on which to obtain the balance for (default: top of chain) |
@aeternity/aepp-sdk/es/chain.tx(hash, info) ⇒ Object
Obtain a transaction based on its hash
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Transaction
Category: async
rtype: (hash: String, info = false) => tx: Object
Param | Type | Description |
---|---|---|
hash | String |
Transaction hash |
info | Boolean |
Retrieve additional transaction date. Works only for (ContractCreate and ContractCall transaction's) |
@aeternity/aepp-sdk/es/chain.getTxInfo(hash) ⇒ Object
Obtain a transaction info based on its hash
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Transaction
Category: async
rtype: (hash: String) => tx: Object
Param | Type | Description |
---|---|---|
hash | String |
Transaction hash |
@aeternity/aepp-sdk/es/chain.mempool() ⇒ Array.<Object>
Obtain transaction's from mempool
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Array.<Object>
- Transactions
Category: async
rtype: () => txs: [...Object]
@aeternity/aepp-sdk/es/chain.getCurrentGeneration() ⇒ Object
Obtain current generation
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Current Generation
Category: async
rtype: () => generation: Object
@aeternity/aepp-sdk/es/chain.getGeneration(hashOrHeight) ⇒ Object
Get generation by hash or height
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Generation
Category: async
rtype: (hashOrHeight) => generation: Object
Param | Type | Description |
---|---|---|
hashOrHeight | String | Number |
Generation hash or height |
@aeternity/aepp-sdk/es/chain.waitForTxConfirm(txHash, [options]) ⇒ Promise.<Number>
Wait for transaction confirmation
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Promise.<Number>
- Current Height
Category: async
rtype: (txHash: String, { confirm: Number | Boolean } = { confirm: 3 }) => Promise<Number>
Param | Type | Default | Description |
---|---|---|---|
txHash | String |
Generation hash or height | |
[options] | String |
{} |
options |
[options.confirm] | String |
3 |
Block confirmation count |
@aeternity/aepp-sdk/es/chain.getMicroBlockTransactions() ⇒ Array.<Object>
Get micro block transactions
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Array.<Object>
- Transactions
Category: async
rtype: (hash) => txs: [...Object]
@aeternity/aepp-sdk/es/chain.getKeyBlock() ⇒ Object
Get key block
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Key Block
Category: async
rtype: (hashOrHeight) => keyBlock: Object
@aeternity/aepp-sdk/es/chain.getMicroBlockHeader() ⇒ Object
Get micro block header
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Micro block header
Category: async
rtype: (hash) => header: Object
@aeternity/aepp-sdk/es/chain.getAccount(address, [options]) ⇒ Object
Get account by account public key
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Account
Category: async
rtype: (address, { hash, height }) => account: Object
Param | Type | Default | Description |
---|---|---|---|
address | String |
Account public key | |
[options] | Object |
{} |
Options |
[options.height] | Number |
Get account on specific block by block height | |
[options.hash] | String |
Get account on specific block by block hash |
@aeternity/aepp-sdk/es/chain.txDryRun(txs, accounts, hashOrHeight) ⇒ Object
Transaction dry-run
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Result
Category: async
rtype: (txs, accounts, hashOrHeight) => result: Object
Param | Type | Description |
---|---|---|
txs | Array |
Array of transaction's |
accounts | Array |
Array of account's |
hashOrHeight | String | Number |
hash or height of block on which to make dry-run |
@aeternity/aepp-sdk/es/chain.getInfo() ⇒ Object
Get Node Info
Kind: instance abstract method of @aeternity/aepp-sdk/es/chain
Returns: Object
- Result
Category: async
rtype: () => result: Object
@aeternity/aepp-sdk/es/chain.waitMined(bool) ⇒ Stamp
Reconfigure Stamp to (not) wait until transactions are mined
Kind: static method of @aeternity/aepp-sdk/es/chain
Returns: Stamp
- Reconfigured Chain Stamp
rtype: (bool: Boolean) => Stamp
Param | Type | Description |
---|---|---|
bool | boolean |
Whether to wait for transactions |