Skip to main content

Interface: IClient

Client interface definition for API communication.

Implemented by

Table of contents

Methods

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

NameTypeDescription
blockIdstringThe block to get the data for.

Returns

Promise<IBlock>

The block data.


blockMetadata

blockMetadata(blockId): Promise<IBlockMetadata>

Get the block metadata by id.

Parameters

NameTypeDescription
blockIdstringThe 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

NameTypeDescription
blockIdstringThe block to get the data for.

Returns

Promise<Uint8Array>

The block raw data.


blockSubmit

blockSubmit(blockPartial): Promise<string>

Submit block.

Parameters

NameTypeDescription
blockPartialObjectThe 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

NameTypeDescription
blockUint8ArrayThe 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

NameTypeDescription
transactionIdstringThe 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

NameTypeDescription
transactionIdstringThe 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

NameTypeDescription
outputIdstringThe 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

NameTypeDescription
outputIdstringThe 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

NameTypeDescription
outputIdstringThe 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

NameTypeDescription
indexnumberThe index of the milestone to look up.

Returns

Promise<IMilestonePayload>

The milestone payload.


milestoneByIndexRaw

milestoneByIndexRaw(index): Promise<Uint8Array>

Get the requested milestone raw.

Parameters

NameTypeDescription
indexnumberThe 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

NameTypeDescription
indexnumberThe 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

NameTypeDescription
milestoneIdstringThe id of the milestone to look up.

Returns

Promise<IMilestonePayload>

The milestone payload.


milestoneByIdRaw

milestoneByIdRaw(milestoneId): Promise<Uint8Array>

Get the requested milestone raw.

Parameters

NameTypeDescription
milestoneIdstringThe 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

NameTypeDescription
milestoneIdstringThe 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

NameTypeDescription
migratedAt?numberThe 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

NameTypeDescription
multiAddressstringThe address of the peer to add.
alias?stringAn optional alias for the peer.

Returns

Promise<IPeer>

The details for the created peer.


peerDelete

peerDelete(peerId): Promise<void>

Delete a peer.

Parameters

NameTypeDescription
peerIdstringThe peer to delete.

Returns

Promise<void>

Nothing.


peer

peer(peerId): Promise<IPeer>

Get a peer.

Parameters

NameTypeDescription
peerIdstringThe 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

NameTypeDescription
basePluginPathstringThe base path for the plugin eg indexer/v1/ .
method"get" | "post" | "delete"The http method.
methodPathstringThe path for the plugin request.
queryParams?string[]Additional query params for the request.
request?TThe request object.

Returns

Promise<S>

The response object.