Skip to main content

Interface: IMqttClient

Client interface definition for API communication.

Implemented by

Table of contents

Methods

Methods

milestonesLatest

milestonesLatest(callback): string

Subscribe to the latest milestone updates.

Parameters

NameTypeDescription
callback(topic: string, data: IMqttMilestoneResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


milestonesConfirmed

milestonesConfirmed(callback): string

Subscribe to the latest confirmed milestone updates.

Parameters

NameTypeDescription
callback(topic: string, data: IMqttMilestoneResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksRaw

blocksRaw(callback): string

Subscribe to get all blocks in binary form.

Parameters

NameTypeDescription
callback(topic: string, data: Uint8Array) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocks

blocks(callback): string

Subscribe to get all blocks in object form.

Parameters

NameTypeDescription
callback(topic: string, data: IBlock) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksReferenced

blocksReferenced(callback): string

Subscribe to get the metadata for all the blocks.

Parameters

NameTypeDescription
callback(topic: string, data: IBlockMetadata) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksTransactionRaw

blocksTransactionRaw(callback): string

Subscribe to all transaction blocks in their raw form.

Parameters

NameTypeDescription
callback(topic: string, data: Uint8Array) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksTransaction

blocksTransaction(callback): string

Subscribe to all transaction blocks.

Parameters

NameTypeDescription
callback(topic: string, data: IBlock) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksTransactionTaggedDataRaw

blocksTransactionTaggedDataRaw(tag, callback): string

Subscribe to transaction blocks with tagged data in their raw form.

Parameters

NameTypeDescription
tagundefined | string | Uint8ArrayThe tag to look for, or all tagged transactions if undefined.
callback(topic: string, data: Uint8Array) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksTransactionTaggedData

blocksTransactionTaggedData(tag, callback): string

Subscribe to all transaction blocks with tagged data.

Parameters

NameTypeDescription
tagundefined | string | Uint8ArrayThe tag to look for, or all tagged transactions if undefined.
callback(topic: string, data: IBlock) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


milestoneRaw

milestoneRaw(callback): string

Subscribe to all milestone payloads in their raw form.

Parameters

NameTypeDescription
callback(topic: string, data: Uint8Array) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


milestone

milestone(callback): string

Subscribe to all milestone payloads.

Parameters

NameTypeDescription
callback(topic: string, data: IMilestonePayload) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksTaggedRaw

blocksTaggedRaw(tag, callback): string

Subscribe to get all blocks for the specified tag in binary form.

Parameters

NameTypeDescription
tagundefined | string | Uint8ArrayThe tag to monitor as bytes or in hex, undefined for all blocks.
callback(topic: string, data: Uint8Array) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksTagged

blocksTagged(tag, callback): string

Subscribe to get all blocks for the specified tag in object form.

Parameters

NameTypeDescription
tagundefined | string | Uint8ArrayThe tag to monitor as bytes or in hex, undefined for all blocks.
callback(topic: string, data: IBlock) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


blocksMetadata

blocksMetadata(blockId, callback): string

Subscribe to metadata updates for a specific block.

Parameters

NameTypeDescription
blockIdstringThe block to monitor.
callback(topic: string, data: IBlockMetadata) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


transactionIncludedBlockRaw

transactionIncludedBlockRaw(transactionId, callback): string

Subscribe to block updates for a specific transactionId.

Parameters

NameTypeDescription
transactionIdstringThe block to monitor.
callback(topic: string, data: Uint8Array) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


transactionIncludedBlock

transactionIncludedBlock(transactionId, callback): string

Subscribe to block updates for a specific transactionId.

Parameters

NameTypeDescription
transactionIdstringThe block to monitor.
callback(topic: string, data: IBlock) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


output

output(outputId, callback): string

Subscribe to updates for a specific output.

Parameters

NameTypeDescription
outputIdstringThe output to monitor.
callback(topic: string, data: IOutputResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


nft

nft(nftId, callback): string

Subscribe to updates for an nft output.

Parameters

NameTypeDescription
nftIdstringThe Nft output to monitor.
callback(topic: string, data: IOutputResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


alias

alias(aliasId, callback): string

Subscribe to updates for an alias output.

Parameters

NameTypeDescription
aliasIdstringThe alias output to monitor.
callback(topic: string, data: IOutputResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


foundry

foundry(foundryId, callback): string

Subscribe to updates for a foundry output.

Parameters

NameTypeDescription
foundryIdstringThe foundry output to monitor.
callback(topic: string, data: IOutputResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


outputByConditionAndAddress

outputByConditionAndAddress(condition, addressBech32, callback): string

Subscribe to the output with specific unlock condition and address.

Parameters

NameTypeDescription
conditionstringThe condition to monitor.
addressBech32stringThe address to monitor.
callback(topic: string, data: IOutputResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


outputSpentByConditionAndAddress

outputSpentByConditionAndAddress(condition, addressBech32, callback): string

Subscribe to the spent outputs with specific unlock condition and address.

Parameters

NameTypeDescription
conditionstringThe condition to monitor.
addressBech32stringThe address to monitor.
callback(topic: string, data: IOutputResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


receipts

receipts(callback): string

Subscribe to the receive all receipts.

Parameters

NameTypeDescription
callback(topic: string, data: IReceiptsResponse) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


subscribeRaw

subscribeRaw(customTopic, callback): string

Subscribe to another type of block as raw data.

Parameters

NameTypeDescription
customTopicstringThe topic to subscribe to.
callback(topic: string, data: Uint8Array) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


subscribeJson

subscribeJson<T>(customTopic, callback): string

Subscribe to another type of block as json.

Type parameters

Name
T

Parameters

NameTypeDescription
customTopicstringThe topic to subscribe to.
callback(topic: string, data: T) => voidThe callback which is called when new data arrives.

Returns

string

A subscription Id which can be used to unsubscribe.


unsubscribe

unsubscribe(subscriptionId): void

Remove a subscription.

Parameters

NameTypeDescription
subscriptionIdstringThe subscription to remove.

Returns

void


statusChanged

statusChanged(callback): string

Subscribe to changes in the client state.

Parameters

NameTypeDescription
callback(status: IMqttStatus) => voidCallback called when the state has changed.

Returns

string

A subscription Id which can be used to unsubscribe.