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