UNPKG

@jmcanterafonseca-iota/anchoring-channels

Version:

Powered by IOTA Streams, Anchor Channels is an easy to be used library that allows to anchor messages to the Tangle.

84 lines (83 loc) 2.08 kB
import { IAnchoringResult } from "./models/IAnchoringResult"; import { IFetchResult } from "./models/IFetchResult"; export declare class IotaAnchoringChannel { private _channelID; private readonly _node; private readonly _seed; private _channelAddress; private _announceMsgID; private _subscriber; private constructor(); /** * Creates a new Anchoring Channel * * @param node The node * @param seed The seed * * @returns The anchoring channel */ static create(node: string, seed?: string): IotaAnchoringChannel; /** * Binds to an existing channel or creates a new binding * * @param channelID in the form of 'channel_address:announce_msg_id' * * @returns reference to the channel * */ bind(channelID?: string): Promise<IotaAnchoringChannel>; /** * Returns the channelID ('channelAddress:announce_msg_id') * * @returns channel ID * */ get channelID(): string; /** * Returns the channel's address * * @returns channel address * */ get channelAddr(): string; /** * Returns the channel's first anchorage ID * * @returns anchorageID * */ get firstAnchorageID(): string; /** * Returns the channel's node * * @returns node * */ get node(): string; /** * Returns the channel's seed * * @returns seed * */ get seed(): string; /** * Anchors a message to the anchoring channel * * @param anchorageID The anchorage * @param message Message to be anchored * * @returns The result of the operation * */ anchor(anchorageID: string, message: string): Promise<IAnchoringResult>; /** * Fetches a previously anchored message * * @param anchorageID The anchorage point * @param messageID The ID of the message * * @returns The fetch result */ fetch(anchorageID: string, messageID: string): Promise<IFetchResult>; }