@hashgraph/sdk
Version:
91 lines (90 loc) • 3.2 kB
TypeScript
export namespace Network {
/**
* @param {string} name
* @returns {{[key: string]: (string | AccountId)}}
*/
export function fromName(name: string): {
[key: string]: (string | AccountId);
};
export { MAINNET };
export { WEB_TESTNET as TESTNET };
export { WEB_PREVIEWNET as PREVIEWNET };
}
/**
* Represents a client for interacting with the Hedera network over the web.
* The `WebClient` class extends the base `Client` class and provides methods
* for configuring and managing connections to the Hedera network, including
* setting the network type (mainnet, testnet, previewnet) and handling
* transactions and queries.
* @augments {Client<WebChannel, *>}
*/
export default class WebClient extends Client<WebChannel, any> {
/**
* @param {string | ClientConfiguration} data
* @returns {WebClient}
*/
static fromConfig(data: string | ClientConfiguration): WebClient;
/**
* 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)} | string} network
* @returns {WebClient}
*/
static forNetwork(network: {
[key: string]: (string | AccountId);
} | string): WebClient;
/**
* @param {string} network
* @returns {WebClient}
*/
static forName(network: string): WebClient;
/**
* Construct a Hedera client pre-configured for Mainnet access.
*
* @returns {WebClient}
*/
static forMainnet(): WebClient;
/**
* Construct a Hedera client pre-configured for Testnet access.
*
* @returns {WebClient}
*/
static forTestnet(): WebClient;
/**
* Construct a Hedera client pre-configured for Previewnet access.
*
* @returns {WebClient}
*/
static forPreviewnet(): WebClient;
/**
* Construct a client configured to use mirror nodes.
* This will query the address book to get the network nodes.
*
* @param {string[] | string} mirrorNetwork
* @returns {Promise<WebClient>}
*/
static forMirrorNetwork(mirrorNetwork: string[] | string): Promise<WebClient>;
/**
* @param {ClientConfiguration} [props]
*/
constructor(props?: ClientConfiguration);
/**
* @param {string[] | string} mirrorNetwork
* @returns {this}
*/
setMirrorNetwork(mirrorNetwork: string[] | string): this;
}
export type ClientConfiguration = import("./Client.js").ClientConfiguration;
export type AccountId = import("../account/AccountId.js").default;
import { MAINNET } from "../constants/ClientConstants.js";
import { WEB_TESTNET } from "../constants/ClientConstants.js";
import { WEB_PREVIEWNET } from "../constants/ClientConstants.js";
import WebChannel from "../channel/WebChannel.js";
import Client from "./Client.js";