UNPKG

@hiero-ledger/sdk

Version:
130 lines (129 loc) 4.31 kB
export namespace Network { let LOCAL_NODE: { "127.0.0.1:50211": AccountId; }; } /** * @augments {Client<NodeChannel, NodeMirrorChannel>} * Client for interacting with the Hedera network using Node.js. * Extends the base Client class with Node.js specific implementations. */ export default class NodeClient extends Client<NodeChannel, NodeMirrorChannel> { /** * @param {string | ClientConfiguration} data * @returns {NodeClient} */ static fromConfig(data: string | ClientConfiguration): NodeClient; /** * @param {string} filename * @returns {Promise<NodeClient>} */ static fromConfigFile(filename: string): Promise<NodeClient>; /** * Construct a client for a specific network. * * It is the responsibility of the caller to ensure that all nodes in the map are part of the * same Hedera network. Failure to do so will result in undefined behavior. * * The client will load balance all requests to Hedera using a simple round-robin scheme to * chose nodes to send transactions to. For one transaction, at most 1/3 of the nodes will be * tried. * * @param {{[key: string]: (string | AccountId)}} network * @param {ClientConfiguration} [props] * @returns {NodeClient} */ static forNetwork(network: { [key: string]: (string | AccountId); }, props?: ClientConfiguration): NodeClient; /** * @param {string} network * @param {object} [props] * @param {boolean} [props.scheduleNetworkUpdate] * @returns {NodeClient} */ static forName(network: string, props?: { scheduleNetworkUpdate?: boolean | undefined; }): NodeClient; /** * Construct a Hedera client pre-configured for Mainnet access. * * @param {object} [props] * @param {boolean} [props.scheduleNetworkUpdate] * @returns {NodeClient} */ static forMainnet(props?: { scheduleNetworkUpdate?: boolean | undefined; }): NodeClient; /** * Construct a Hedera client pre-configured for Testnet access. * * @param {object} [props] * @param {boolean} [props.scheduleNetworkUpdate] * @returns {NodeClient} */ static forTestnet(props?: { scheduleNetworkUpdate?: boolean | undefined; }): NodeClient; /** * @param {string[] | string} mirrorNetwork * @param {number} [shard] * @param {number} [realm] * @returns {Promise<NodeClient>} */ static forMirrorNetwork(mirrorNetwork: string[] | string, shard?: number, realm?: number): Promise<NodeClient>; /** * Construct a Hedera client pre-configured for Previewnet access. * * @param {object} [props] * @param {boolean} [props.scheduleNetworkUpdate] * @returns {NodeClient} */ static forPreviewnet(props?: { scheduleNetworkUpdate?: boolean | undefined; }): NodeClient; /** * Construct a Hedera client pre-configured for local-node access. * * @param {object} [props] * @param {boolean} [props.scheduleNetworkUpdate] * @returns {NodeClient} */ static forLocalNode(props?: { scheduleNetworkUpdate?: boolean | undefined; }): NodeClient; /** * @param {ClientConfiguration} [props] */ constructor(props?: ClientConfiguration); /** @private */ private _maxExecutionTime; /** * Available only for NodeClient * * @param {number} maxExecutionTime * @returns {this} */ setMaxExecutionTime(maxExecutionTime: number): this; /** * @private * @param {string} name * @returns {this} */ private _setNetworkFromName; /** * @param {string[] | string} mirrorNetwork * @returns {this} */ setMirrorNetwork(mirrorNetwork: string[] | string): this; /** * @override * @returns {(address: string, cert?: string) => NodeChannel} */ override _createNetworkChannel(): (address: string, cert?: string) => NodeChannel; } export type ClientConfiguration = import("./Client.js").ClientConfiguration; import AccountId from "../account/AccountId.js"; import NodeChannel from "../channel/NodeChannel.js"; import NodeMirrorChannel from "../channel/NodeMirrorChannel.js"; import Client from "./Client.js";