import type { IMilestoneUtxoChangesResponse } from "../models/api/IMilestoneUtxoChangesResponse"; import type { IOutputMetadataResponse } from "../models/api/IOutputMetadataResponse"; import type { IOutputResponse } from "../models/api/IOutputResponse"; import type { IReceiptsResponse } from "../models/api/IReceiptsResponse"; import type { ITipsResponse } from "../models/api/ITipsResponse"; import type { HexEncodedString } from "../models/hexEncodedTypes"; import { IBlock } from "../models/IBlock"; import type { IBlockMetadata } from "../models/IBlockMetadata"; import type { IClient } from "../models/IClient"; import type { INodeInfo } from "../models/info/INodeInfo"; import type { INodeInfoProtocol } from "../models/info/INodeInfoProtocol"; import type { IRoutesResponse } from "../models/info/IRoutesResponse"; import type { IPeer } from "../models/IPeer"; import type { ITreasury } from "../models/ITreasury"; import type { IMilestonePayload } from "../models/payloads/IMilestonePayload"; import type { SingleNodeClientOptions } from "./singleNodeClientOptions"; /** * Client for API communication. */ export declare class SingleNodeClient implements IClient { /** * A zero nonce. * @internal */ private static readonly NONCE_ZERO; /** * The endpoint for the API. * @internal */ private readonly _endpoint; /** * The base path for the API. * @internal */ private readonly _basePath; /** * The base path for the core API. * @internal */ private readonly _coreApiPath; /** * Optional PoW provider to be used for blocks with nonce=0/undefined. * @internal */ private readonly _powProvider?; /** * The Api request timeout. * @internal */ private readonly _timeout?; /** * Username for the endpoint. * @internal */ private readonly _userName?; /** * Password for the endpoint. * @internal */ private readonly _password?; /** * Additional headers to include in the requests. * @internal */ private readonly _headers?; /** * The protocol version for blocks. * @internal */ private readonly _protocolVersion; /** * Create a new instance of client. * @param endpoint The endpoint. * @param options Options for the client. */ constructor(endpoint: string, options?: SingleNodeClientOptions); /** * 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). * @param blockPartial.protocolVersion The protocol version under which this block operates. * @param blockPartial.parents The parent block ids. * @param blockPartial.payload The payload contents. * @param blockPartial.nonce The nonce for the block. * @param powInterval The time in seconds that pow should work before aborting. * @param maxPowAttempts The number of times the pow should be attempted. * @param validate Should the block be validated. * @returns The blockId. */ blockSubmit(blockPartial: { protocolVersion?: number; parents?: HexEncodedString[]; payload?: IBlock["payload"]; nonce?: string; }, powInterval?: number, maxPowAttempts?: number, validate?: boolean): Promise; /** * Submit block in raw format. * @param block The block to submit. * @param powInterval The time in seconds that pow should work before aborting. * @param maxPowAttempts The number of times the pow should be attempted. * @param validate Should the block be validated. * @returns The blockId. */ blockSubmitRaw(block: Uint8Array, powInterval?: number, maxPowAttempts?: number, validate?: boolean): 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 raw bytes. */ outputRaw(outputId: string): 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: string): 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: string): 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; /** * Perform a request and just return the status. * @param route The route of the request. * @returns The response. * @internal */ private fetchStatus; /** * Perform a request in json format. * @param basePath The base path for the request. * @param method The http method. * @param route The route of the request. * @param requestData Request to send to the endpoint. * @returns The response. * @internal */ private fetchJson; /** * Perform a request for binary data. * @param basePath The base path for the request. * @param method The http method. * @param route The route of the request. * @param requestData Request to send to the endpoint. * @returns The response. * @internal */ private fetchBinary; /** * Perform a fetch request. * @param method The http method. * @param route The route of the request. * @param headers The headers for the request. * @param body The request body. * @returns The response. * @internal */ private fetchWithTimeout; /** * Combine the query params. * @param queryParams The quer params to combine. * @returns The combined query params. */ private combineQueryParams; }