Interface: IMqttClient
Client interface definition for API communication.
Implemented by
Table of contents
Methods
- milestonesLatest
- milestonesConfirmed
- blocksRaw
- blocks
- blocksReferenced
- blocksTransactionRaw
- blocksTransaction
- blocksTransactionTaggedDataRaw
- blocksTransactionTaggedData
- milestoneRaw
- milestone
- blocksTaggedRaw
- blocksTagged
- blocksMetadata
- transactionIncludedBlockRaw
- transactionIncludedBlock
- output
- nft
- alias
- foundry
- outputByConditionAndAddress
- outputSpentByConditionAndAddress
- receipts
- subscribeRaw
- subscribeJson
- unsubscribe
- statusChanged
Methods
milestonesLatest
▸ milestonesLatest(callback
): string
Subscribe to the latest milestone updates.
Parameters
Name | Type | Description |
---|---|---|
callback | (topic : string , data : IMqttMilestoneResponse ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : IMqttMilestoneResponse ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : Uint8Array ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : IBlock ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : IBlockMetadata ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : Uint8Array ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : IBlock ) => void | The 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
Name | Type | Description |
---|---|---|
tag | undefined | string | Uint8Array | The tag to look for, or all tagged transactions if undefined. |
callback | (topic : string , data : Uint8Array ) => void | The 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
Name | Type | Description |
---|---|---|
tag | undefined | string | Uint8Array | The tag to look for, or all tagged transactions if undefined. |
callback | (topic : string , data : IBlock ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : Uint8Array ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : IMilestonePayload ) => void | The 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
Name | Type | Description |
---|---|---|
tag | undefined | string | Uint8Array | The tag to monitor as bytes or in hex, undefined for all blocks. |
callback | (topic : string , data : Uint8Array ) => void | The 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
Name | Type | Description |
---|---|---|
tag | undefined | string | Uint8Array | The tag to monitor as bytes or in hex, undefined for all blocks. |
callback | (topic : string , data : IBlock ) => void | The 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
Name | Type | Description |
---|---|---|
blockId | string | The block to monitor. |
callback | (topic : string , data : IBlockMetadata ) => void | The 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
Name | Type | Description |
---|---|---|
transactionId | string | The block to monitor. |
callback | (topic : string , data : Uint8Array ) => void | The 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
Name | Type | Description |
---|---|---|
transactionId | string | The block to monitor. |
callback | (topic : string , data : IBlock ) => void | The 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
Name | Type | Description |
---|---|---|
outputId | string | The output to monitor. |
callback | (topic : string , data : IOutputResponse ) => void | The 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
Name | Type | Description |
---|---|---|
nftId | string | The Nft output to monitor. |
callback | (topic : string , data : IOutputResponse ) => void | The 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
Name | Type | Description |
---|---|---|
aliasId | string | The alias output to monitor. |
callback | (topic : string , data : IOutputResponse ) => void | The 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
Name | Type | Description |
---|---|---|
foundryId | string | The foundry output to monitor. |
callback | (topic : string , data : IOutputResponse ) => void | The 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
Name | Type | Description |
---|---|---|
condition | string | The condition to monitor. |
addressBech32 | string | The address to monitor. |
callback | (topic : string , data : IOutputResponse ) => void | The 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
Name | Type | Description |
---|---|---|
condition | string | The condition to monitor. |
addressBech32 | string | The address to monitor. |
callback | (topic : string , data : IOutputResponse ) => void | The 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
Name | Type | Description |
---|---|---|
callback | (topic : string , data : IReceiptsResponse ) => void | The 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
Name | Type | Description |
---|---|---|
customTopic | string | The topic to subscribe to. |
callback | (topic : string , data : Uint8Array ) => void | The 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
Name | Type | Description |
---|---|---|
customTopic | string | The topic to subscribe to. |
callback | (topic : string , data : T ) => void | The 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
Name | Type | Description |
---|---|---|
subscriptionId | string | The subscription to remove. |
Returns
void
statusChanged
▸ statusChanged(callback
): string
Subscribe to changes in the client state.
Parameters
Name | Type | Description |
---|---|---|
callback | (status : IMqttStatus ) => void | Callback called when the state has changed. |
Returns
string
A subscription Id which can be used to unsubscribe.