Interface: IClient
Client interface definition for API communication.
Implemented by
Table of contents
Methods
- health
- routes
- info
- tips
- block
- blockMetadata
- blockRaw
- blockSubmit
- blockSubmitRaw
- transactionIncludedBlock
- transactionIncludedBlockRaw
- output
- outputMetadata
- outputRaw
- milestoneByIndex
- milestoneByIndexRaw
- milestoneUtxoChangesByIndex
- milestoneById
- milestoneByIdRaw
- milestoneUtxoChangesById
- treasury
- receipts
- peers
- peerAdd
- peerDelete
- peer
- protocolInfo
- pluginFetch
Methods
health
▸ health(): Promise
<boolean
>
Get the health of the node.
Returns
Promise
<boolean
>
True if the node is healthy.
routes
▸ routes(): Promise
<IRoutesResponse
>
Get the routes the node exposes.
Returns
Promise
<IRoutesResponse
>
The routes.
info
▸ info(): Promise
<INodeInfo
>
Get the info about the node.
Returns
Promise
<INodeInfo
>
The node information.
tips
▸ tips(): Promise
<ITipsResponse
>
Get the tips from the node.
Returns
Promise
<ITipsResponse
>
The tips.
block
▸ block(blockId
): Promise
<IBlock
>
Get the block data by id.
Parameters
Name | Type | Description |
---|---|---|
blockId | string | The block to get the data for. |
Returns
Promise
<IBlock
>
The block data.
blockMetadata
▸ blockMetadata(blockId
): Promise
<IBlockMetadata
>
Get the block metadata by id.
Parameters
Name | Type | Description |
---|---|---|
blockId | string | The block to get the metadata for. |
Returns
Promise
<IBlockMetadata
>
The block metadata.
blockRaw
▸ blockRaw(blockId
): Promise
<Uint8Array
>
Get the block raw data by id.
Parameters
Name | Type | Description |
---|---|---|
blockId | string | The block to get the data for. |
Returns
Promise
<Uint8Array
>
The block raw data.
blockSubmit
▸ blockSubmit(blockPartial
): Promise
<string
>
Submit block.
Parameters
Name | Type | Description |
---|---|---|
blockPartial | Object | The block to submit (possibly contains only partial block data). |
Returns
Promise
<string
>
The blockId.
blockSubmitRaw
▸ blockSubmitRaw(block
): Promise
<string
>
Submit block in raw format.
Parameters
Name | Type | Description |
---|---|---|
block | Uint8Array | The block to submit. |
Returns
Promise
<string
>
The blockId.
transactionIncludedBlock
▸ transactionIncludedBlock(transactionId
): Promise
<IBlock
>
Get the block that was included in the ledger for a transaction.
Parameters
Name | Type | Description |
---|---|---|
transactionId | string | The id of the transaction to get the included block for. |
Returns
Promise
<IBlock
>
The block.
transactionIncludedBlockRaw
▸ transactionIncludedBlockRaw(transactionId
): Promise
<Uint8Array
>
Get raw block that was included in the ledger for a transaction.
Parameters
Name | Type | Description |
---|---|---|
transactionId | string | The id of the transaction to get the included block for. |
Returns
Promise
<Uint8Array
>
The block.
output
▸ output(outputId
): Promise
<IOutputResponse
>
Get an output by its identifier.
Parameters
Name | Type | Description |
---|---|---|
outputId | string | The id of the output to get. |
Returns
Promise
<IOutputResponse
>
The output details.
outputMetadata
▸ outputMetadata(outputId
): Promise
<IOutputMetadataResponse
>
Get an outputs metadata by its identifier.
Parameters
Name | Type | Description |
---|---|---|
outputId | string | The id of the output to get the metadata for. |
Returns
Promise
<IOutputMetadataResponse
>
The output metadata.
outputRaw
▸ outputRaw(outputId
): Promise
<Uint8Array
>
Get an outputs raw data.
Parameters
Name | Type | Description |
---|---|---|
outputId | string | The id of the output to get the raw data for. |
Returns
Promise
<Uint8Array
>
The output metadata.
milestoneByIndex
▸ milestoneByIndex(index
): Promise
<IMilestonePayload
>
Get the requested milestone.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the milestone to look up. |
Returns
Promise
<IMilestonePayload
>
The milestone payload.
milestoneByIndexRaw
▸ milestoneByIndexRaw(index
): Promise
<Uint8Array
>
Get the requested milestone raw.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the milestone to look up. |
Returns
Promise
<Uint8Array
>
The milestone payload raw.
milestoneUtxoChangesByIndex
▸ milestoneUtxoChangesByIndex(index
): Promise
<IMilestoneUtxoChangesResponse
>
Get the requested milestone utxo changes.
Parameters
Name | Type | Description |
---|---|---|
index | number | The index of the milestone to request the changes for. |
Returns
Promise
<IMilestoneUtxoChangesResponse
>
The milestone utxo changes details.
milestoneById
▸ milestoneById(milestoneId
): Promise
<IMilestonePayload
>
Get the requested milestone.
Parameters
Name | Type | Description |
---|---|---|
milestoneId | string | The id of the milestone to look up. |
Returns
Promise
<IMilestonePayload
>
The milestone payload.
milestoneByIdRaw
▸ milestoneByIdRaw(milestoneId
): Promise
<Uint8Array
>
Get the requested milestone raw.
Parameters
Name | Type | Description |
---|---|---|
milestoneId | string | The id of the milestone to look up. |
Returns
Promise
<Uint8Array
>
The milestone payload raw.
milestoneUtxoChangesById
▸ milestoneUtxoChangesById(milestoneId
): Promise
<IMilestoneUtxoChangesResponse
>
Get the requested milestone utxo changes.
Parameters
Name | Type | Description |
---|---|---|
milestoneId | string | The id of the milestone to request the changes for. |
Returns
Promise
<IMilestoneUtxoChangesResponse
>
The milestone utxo changes details.
treasury
▸ treasury(): Promise
<ITreasury
>
Get the current treasury output.
Returns
Promise
<ITreasury
>
The details for the treasury.
receipts
▸ receipts(migratedAt?
): Promise
<IReceiptsResponse
>
Get all the stored receipts or those for a given migrated at index.
Parameters
Name | Type | Description |
---|---|---|
migratedAt? | number | The index the receipts were migrated at, if not supplied returns all stored receipts. |
Returns
Promise
<IReceiptsResponse
>
The stored receipts.
peers
▸ peers(): Promise
<IPeer
[]>
Get the list of peers.
Returns
Promise
<IPeer
[]>
The list of peers.
peerAdd
▸ peerAdd(multiAddress
, alias?
): Promise
<IPeer
>
Add a new peer.
Parameters
Name | Type | Description |
---|---|---|
multiAddress | string | The address of the peer to add. |
alias? | string | An optional alias for the peer. |
Returns
Promise
<IPeer
>
The details for the created peer.
peerDelete
▸ peerDelete(peerId
): Promise
<void
>
Delete a peer.
Parameters
Name | Type | Description |
---|---|---|
peerId | string | The peer to delete. |
Returns
Promise
<void
>
Nothing.
peer
▸ peer(peerId
): Promise
<IPeer
>
Get a peer.
Parameters
Name | Type | Description |
---|---|---|
peerId | string | The peer to delete. |
Returns
Promise
<IPeer
>
The details for the created peer.
protocolInfo
▸ protocolInfo(): Promise
<{ networkName
: string
; networkId
: string
; bech32Hrp
: string
; minPowScore
: number
}>
Get the protocol info from the node.
Returns
Promise
<{ networkName
: string
; networkId
: string
; bech32Hrp
: string
; minPowScore
: number
}>
The protocol info.
pluginFetch
▸ pluginFetch<T
, S
>(basePluginPath
, method
, methodPath
, queryParams?
, request?
): Promise
<S
>
Extension method which provides request methods for plugins.
Type parameters
Name |
---|
T |
S |
Parameters
Name | Type | Description |
---|---|---|
basePluginPath | string | The base path for the plugin eg indexer/v1/ . |
method | "get" | "post" | "delete" | The http method. |
methodPath | string | The path for the plugin request. |
queryParams? | string [] | Additional query params for the request. |
request? | T | The request object. |
Returns
Promise
<S
>
The response object.