@hiero-ledger/sdk 2.71.0-beta.0 → 2.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd.js +142 -40
- package/dist/umd.min.js +2 -2
- package/lib/LedgerId.cjs +4 -4
- package/lib/LedgerId.js +1 -1
- package/lib/LedgerId.js.map +1 -1
- package/lib/channel/NativeChannel.cjs +3 -2
- package/lib/channel/NativeChannel.js +1 -1
- package/lib/channel/NativeChannel.js.map +1 -1
- package/lib/channel/NodeMirrorChannel.cjs +0 -2
- package/lib/channel/NodeMirrorChannel.js +1 -1
- package/lib/channel/NodeMirrorChannel.js.map +1 -1
- package/lib/client/Client.cjs +3 -2
- package/lib/client/Client.d.ts +2 -2
- package/lib/client/Client.js +1 -1
- package/lib/client/Client.js.map +1 -1
- package/lib/client/NativeClient.cjs +141 -44
- package/lib/client/NativeClient.d.ts +48 -16
- package/lib/client/NativeClient.js +1 -1
- package/lib/client/NativeClient.js.map +1 -1
- package/lib/client/NodeClient.cjs +63 -2
- package/lib/client/NodeClient.d.ts +42 -0
- package/lib/client/NodeClient.js +1 -1
- package/lib/client/NodeClient.js.map +1 -1
- package/lib/client/WebClient.cjs +64 -34
- package/lib/client/WebClient.d.ts +35 -15
- package/lib/client/WebClient.js +1 -1
- package/lib/client/WebClient.js.map +1 -1
- package/lib/constants/ClientConstants.cjs +22 -7
- package/lib/constants/ClientConstants.d.ts +12 -6
- package/lib/constants/ClientConstants.js +1 -1
- package/lib/constants/ClientConstants.js.map +1 -1
- package/lib/contract/ContractCreateTransaction.cjs +5 -0
- package/lib/contract/ContractCreateTransaction.js +1 -1
- package/lib/contract/ContractCreateTransaction.js.map +1 -1
- package/lib/contract/ContractDeleteTransaction.cjs +35 -2
- package/lib/contract/ContractDeleteTransaction.d.ts +18 -0
- package/lib/contract/ContractDeleteTransaction.js +1 -1
- package/lib/contract/ContractDeleteTransaction.js.map +1 -1
- package/lib/contract/ContractUpdateTransaction.cjs +2 -1
- package/lib/contract/ContractUpdateTransaction.js +1 -1
- package/lib/contract/ContractUpdateTransaction.js.map +1 -1
- package/lib/encoding/hex.cjs +11 -0
- package/lib/encoding/hex.js +1 -1
- package/lib/encoding/hex.js.map +1 -1
- package/lib/native.cjs +2 -2
- package/lib/native.d.ts +1 -1
- package/lib/native.js +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -2
- package/src/LedgerId.js +4 -4
- package/src/channel/NativeChannel.js +9 -1
- package/src/channel/NodeMirrorChannel.js +0 -2
- package/src/client/Client.js +4 -2
- package/src/client/NativeClient.js +151 -47
- package/src/client/NodeClient.js +56 -3
- package/src/client/WebClient.js +63 -44
- package/src/constants/ClientConstants.js +26 -8
- package/src/contract/ContractCreateTransaction.js +5 -3
- package/src/contract/ContractDeleteTransaction.js +34 -0
- package/src/contract/ContractUpdateTransaction.js +4 -1
- package/src/encoding/hex.js +20 -0
- package/src/native.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeClient.js","sources":["../../src/client/NodeClient.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport fs from \"fs\";\nimport util from \"util\";\nimport Client from \"./Client.js\";\nimport NodeChannel from \"../channel/NodeChannel.js\";\nimport NodeMirrorChannel from \"../channel/NodeMirrorChannel.js\";\nimport LedgerId from \"../LedgerId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport NodeAddressBook from \"../address_book/NodeAddressBook.js\";\nimport * as mainnet from \"./addressbooks/mainnet.js\";\nimport * as testnet from \"./addressbooks/testnet.js\";\nimport * as previewnet from \"./addressbooks/previewnet.js\";\nimport * as hex from \"../encoding/hex.js\";\nimport { MirrorNetwork } from \"../constants/ClientConstants.js\";\n\nconst readFileAsync = util.promisify(fs.readFile);\n\n/**\n * @typedef {import(\"./Client.js\").ClientConfiguration} ClientConfiguration\n */\n\nexport const Network = {\n LOCAL_NODE: {\n \"127.0.0.1:50211\": new AccountId(3),\n },\n};\n\n/**\n * @augments {Client<NodeChannel, NodeMirrorChannel>}\n * Client for interacting with the Hedera network using Node.js.\n * Extends the base Client class with Node.js specific implementations.\n */\nexport default class NodeClient extends Client {\n /**\n * @param {ClientConfiguration} [props]\n */\n constructor(props) {\n super(props);\n\n /** @private */\n this._maxExecutionTime = 10000;\n\n if (props != null) {\n if (typeof props.network === \"string\") {\n this._setNetworkFromName(props.network);\n } else if (props.network != null) {\n Client._validateNetworkConsistency(props.network);\n\n const { shard, realm } = Client._extractShardRealm(\n props.network,\n );\n\n // Shard and realm are inferred from the network, so we need to set them here\n // to ensure that the client is properly configured.\n this._shard = shard;\n this._realm = realm;\n\n this.setNetwork(props.network);\n }\n\n if (typeof props.mirrorNetwork === \"string\") {\n switch (props.mirrorNetwork) {\n case \"mainnet\":\n this.setMirrorNetwork(MirrorNetwork.MAINNET);\n break;\n\n case \"testnet\":\n this.setMirrorNetwork(MirrorNetwork.TESTNET);\n break;\n\n case \"previewnet\":\n this.setMirrorNetwork(MirrorNetwork.PREVIEWNET);\n break;\n\n default:\n this.setMirrorNetwork([props.mirrorNetwork]);\n break;\n }\n } else if (props.mirrorNetwork != null) {\n this.setMirrorNetwork(props.mirrorNetwork);\n }\n }\n }\n\n /**\n * @param {string | ClientConfiguration} data\n * @returns {NodeClient}\n */\n static fromConfig(data) {\n return new NodeClient(\n typeof data === \"string\"\n ? /** @type {ClientConfiguration | undefined} */ (\n JSON.parse(data)\n )\n : data,\n );\n }\n\n /**\n * @param {string} filename\n * @returns {Promise<NodeClient>}\n */\n static async fromConfigFile(filename) {\n return NodeClient.fromConfig(await readFileAsync(filename, \"utf8\"));\n }\n\n /**\n * Construct a client for a specific network.\n *\n * It is the responsibility of the caller to ensure that all nodes in the map are part of the\n * same Hedera network. Failure to do so will result in undefined behavior.\n *\n * The client will load balance all requests to Hedera using a simple round-robin scheme to\n * chose nodes to send transactions to. For one transaction, at most 1/3 of the nodes will be\n * tried.\n *\n * @param {{[key: string]: (string | AccountId)}} network\n * @param {ClientConfiguration} [props]\n * @returns {NodeClient}\n */\n static forNetwork(network, props) {\n return new NodeClient({\n network,\n ...props,\n });\n }\n\n /**\n * @param {string} network\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forName(network, props = {}) {\n return new NodeClient({ network, ...props });\n }\n\n /**\n * Construct a Hedera client pre-configured for Mainnet access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forMainnet(props = {}) {\n return new NodeClient({ network: \"mainnet\", ...props });\n }\n\n /**\n * Construct a Hedera client pre-configured for Testnet access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forTestnet(props = {}) {\n return new NodeClient({ network: \"testnet\", ...props });\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @param {number} [shard]\n * @param {number} [realm]\n * @returns {Promise<NodeClient>}\n */\n static async forMirrorNetwork(mirrorNetwork, shard, realm) {\n const INITIAL_UPDATE_PERIOD = 10_000;\n\n const client = new NodeClient({\n mirrorNetwork,\n shard,\n realm,\n }).setNetworkUpdatePeriod(INITIAL_UPDATE_PERIOD);\n\n await client.updateNetwork();\n\n return client;\n }\n\n /**\n * Construct a Hedera client pre-configured for Previewnet access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forPreviewnet(props = {}) {\n return new NodeClient({ network: \"previewnet\", ...props });\n }\n\n /**\n * Construct a Hedera client pre-configured for local-node access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forLocalNode(props = { scheduleNetworkUpdate: false }) {\n return new NodeClient({\n network: \"local-node\",\n ...props,\n });\n }\n\n /**\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {void}\n */\n setNetwork(network) {\n if (typeof network === \"string\") {\n this._setNetworkFromName(network);\n } else {\n this._network.setNetwork(network);\n }\n }\n\n /**\n * Available only for NodeClient\n *\n * @param {number} maxExecutionTime\n * @returns {this}\n */\n setMaxExecutionTime(maxExecutionTime) {\n this._maxExecutionTime = maxExecutionTime;\n return this;\n }\n\n /**\n * @private\n * @param {string} name\n * @returns {this}\n */\n _setNetworkFromName(name) {\n switch (name) {\n case \"mainnet\":\n this.setNetworkFromAddressBook(\n NodeAddressBook.fromBytes(hex.decode(mainnet.addressBook)),\n );\n this.setMirrorNetwork(MirrorNetwork.MAINNET);\n this.setLedgerId(LedgerId.MAINNET);\n break;\n\n case \"testnet\":\n this.setNetworkFromAddressBook(\n NodeAddressBook.fromBytes(hex.decode(testnet.addressBook)),\n );\n this.setMirrorNetwork(MirrorNetwork.TESTNET);\n this.setLedgerId(LedgerId.TESTNET);\n break;\n\n case \"previewnet\":\n this.setNetworkFromAddressBook(\n NodeAddressBook.fromBytes(\n hex.decode(previewnet.addressBook),\n ),\n );\n this.setMirrorNetwork(MirrorNetwork.PREVIEWNET);\n this.setLedgerId(LedgerId.PREVIEWNET);\n break;\n\n case \"local-node\":\n this.setNetwork(Network.LOCAL_NODE);\n this.setMirrorNetwork(MirrorNetwork.LOCAL_NODE);\n this.setLedgerId(LedgerId.LOCAL_NODE);\n break;\n\n default:\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `unknown network: ${name}`,\n );\n }\n return this;\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @returns {this}\n */\n setMirrorNetwork(mirrorNetwork) {\n if (typeof mirrorNetwork === \"string\") {\n switch (mirrorNetwork) {\n case \"local-node\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.LOCAL_NODE);\n break;\n case \"previewnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.PREVIEWNET);\n break;\n case \"testnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.TESTNET);\n break;\n case \"mainnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.MAINNET);\n break;\n default:\n this._mirrorNetwork.setNetwork([mirrorNetwork]);\n }\n } else {\n this._mirrorNetwork.setNetwork(mirrorNetwork);\n }\n\n return this;\n }\n\n /**\n * @override\n * @returns {(address: string, cert?: string) => NodeChannel}\n */\n _createNetworkChannel() {\n return (address) => new NodeChannel(address, this._maxExecutionTime);\n }\n\n /**\n * @override\n * @returns {(address: string) => NodeMirrorChannel}\n */\n _createMirrorNetworkChannel() {\n return (address) => new NodeMirrorChannel(address);\n }\n}\n"],"names":["readFileAsync","util","promisify","fs","readFile","Network","LOCAL_NODE","AccountId","NodeClient","Client","constructor","props","super","this","_maxExecutionTime","network","_setNetworkFromName","_validateNetworkConsistency","shard","realm","_extractShardRealm","_shard","_realm","setNetwork","mirrorNetwork","setMirrorNetwork","MirrorNetwork","MAINNET","TESTNET","PREVIEWNET","fromConfig","data","JSON","parse","fromConfigFile","filename","forNetwork","forName","forMainnet","forTestnet","forMirrorNetwork","client","setNetworkUpdatePeriod","updateNetwork","forPreviewnet","forLocalNode","scheduleNetworkUpdate","_network","setMaxExecutionTime","maxExecutionTime","name","setNetworkFromAddressBook","NodeAddressBook","fromBytes","hex.decode","mainnet.addressBook","setLedgerId","LedgerId","testnet.addressBook","previewnet.addressBook","Error","_mirrorNetwork","_createNetworkChannel","address","NodeChannel","_createMirrorNetworkChannel","NodeMirrorChannel"],"mappings":"uiBAgBA,MAAMA,EAAgBC,EAAKC,UAAUC,EAAGC,UAM3BC,EAAU,CACnBC,WAAY,CACR,kBAAmB,IAAIC,EAAU,KAS1B,MAAMC,UAAmBC,EAIpC,WAAAC,CAAYC,GAMR,GALAC,MAAMD,GAGNE,KAAKC,kBAAoB,IAEZ,MAATH,EAAe,CACf,GAA6B,iBAAlBA,EAAMI,QACbF,KAAKG,oBAAoBL,EAAMI,cAC5B,GAAqB,MAAjBJ,EAAMI,QAAiB,CAC9BN,EAAOQ,4BAA4BN,EAAMI,SAEzC,MAAMG,MAAEA,EAAKC,MAAEA,GAAUV,EAAOW,mBAC5BT,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kBH,EAClD"}
|
|
1
|
+
{"version":3,"file":"NodeClient.js","sources":["../../src/client/NodeClient.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport fs from \"fs\";\nimport util from \"util\";\nimport Client from \"./Client.js\";\nimport NodeChannel from \"../channel/NodeChannel.js\";\nimport NodeMirrorChannel from \"../channel/NodeMirrorChannel.js\";\nimport LedgerId from \"../LedgerId.js\";\nimport AccountId from \"../account/AccountId.js\";\nimport NodeAddressBook from \"../address_book/NodeAddressBook.js\";\nimport * as mainnet from \"./addressbooks/mainnet.js\";\nimport * as testnet from \"./addressbooks/testnet.js\";\nimport * as previewnet from \"./addressbooks/previewnet.js\";\nimport * as hex from \"../encoding/hex.js\";\nimport { MirrorNetwork } from \"../constants/ClientConstants.js\";\n\nconst readFileAsync = util.promisify(fs.readFile);\n\n/**\n * @typedef {import(\"./Client.js\").ClientConfiguration} ClientConfiguration\n */\n\nexport const Network = {\n LOCAL_NODE: {\n \"127.0.0.1:50211\": new AccountId(3),\n },\n};\n\n/**\n * @augments {Client<NodeChannel, NodeMirrorChannel>}\n * Client for interacting with the Hedera network using Node.js.\n * Extends the base Client class with Node.js specific implementations.\n */\nexport default class NodeClient extends Client {\n /**\n * @param {ClientConfiguration} [props]\n */\n constructor(props) {\n super(props);\n\n /** @private */\n this._maxExecutionTime = 10000;\n\n if (props != null) {\n if (typeof props.network === \"string\") {\n this._setNetworkFromName(props.network);\n } else if (props.network != null) {\n Client._validateNetworkConsistency(props.network);\n\n const { shard, realm } = Client._extractShardRealm(\n props.network,\n );\n\n // Shard and realm are inferred from the network, so we need to set them here\n // to ensure that the client is properly configured.\n this._shard = shard;\n this._realm = realm;\n\n this.setNetwork(props.network);\n }\n\n if (typeof props.mirrorNetwork === \"string\") {\n switch (props.mirrorNetwork) {\n case \"mainnet\":\n this.setMirrorNetwork(MirrorNetwork.MAINNET);\n break;\n\n case \"testnet\":\n this.setMirrorNetwork(MirrorNetwork.TESTNET);\n break;\n\n case \"previewnet\":\n this.setMirrorNetwork(MirrorNetwork.PREVIEWNET);\n break;\n\n default:\n this.setMirrorNetwork([props.mirrorNetwork]);\n break;\n }\n } else if (props.mirrorNetwork != null) {\n this.setMirrorNetwork(props.mirrorNetwork);\n }\n }\n }\n\n /**\n * @param {string | ClientConfiguration} data\n * @returns {NodeClient}\n */\n static fromConfig(data) {\n return new NodeClient(\n typeof data === \"string\"\n ? /** @type {ClientConfiguration | undefined} */ (\n JSON.parse(data)\n )\n : data,\n );\n }\n\n /**\n * @param {string} filename\n * @returns {Promise<NodeClient>}\n */\n static async fromConfigFile(filename) {\n return NodeClient.fromConfig(await readFileAsync(filename, \"utf8\"));\n }\n\n /**\n * Construct a client for a specific network.\n *\n * It is the responsibility of the caller to ensure that all nodes in the map are part of the\n * same Hedera network. Failure to do so will result in undefined behavior.\n *\n * The client will load balance all requests to Hedera using a simple round-robin scheme to\n * chose nodes to send transactions to. For one transaction, at most 1/3 of the nodes will be\n * tried.\n *\n * @param {{[key: string]: (string | AccountId)}} network\n * @param {ClientConfiguration} [props]\n * @returns {NodeClient}\n */\n static forNetwork(network, props) {\n return new NodeClient({\n network,\n ...props,\n });\n }\n\n /**\n * @param {string} network\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forName(network, props = {}) {\n return new NodeClient({ network, ...props });\n }\n\n /**\n * Construct a Hedera client pre-configured for Mainnet access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forMainnet(props = {}) {\n return new NodeClient({ network: \"mainnet\", ...props });\n }\n\n /**\n * Construct a Hedera client pre-configured for Testnet access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forTestnet(props = {}) {\n return new NodeClient({ network: \"testnet\", ...props });\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @param {number} [shard]\n * @param {number} [realm]\n * @returns {Promise<NodeClient>}\n */\n static async forMirrorNetwork(mirrorNetwork, shard, realm) {\n const client = new NodeClient({\n mirrorNetwork,\n shard,\n realm,\n });\n\n await client.updateNetwork();\n\n return client;\n }\n\n /**\n * Construct a Hedera client pre-configured for Previewnet access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forPreviewnet(props = {}) {\n return new NodeClient({ network: \"previewnet\", ...props });\n }\n\n /**\n * Construct a Hedera client pre-configured for local-node access.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {NodeClient}\n */\n static forLocalNode(props = { scheduleNetworkUpdate: false }) {\n return new NodeClient({\n network: \"local-node\",\n ...props,\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Mainnet access with network update.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {Promise<NodeClient>}\n */\n static async forMainnetAsync(props = {}) {\n return new NodeClient({ network: \"mainnet\", ...props }).updateNetwork();\n }\n\n /**\n * Construct a Hedera client pre-configured for Testnet access with network update.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {Promise<NodeClient>}\n */\n static async forTestnetAsync(props = {}) {\n return new NodeClient({ network: \"testnet\", ...props }).updateNetwork();\n }\n\n /**\n * Construct a Hedera client pre-configured for Previewnet access with network update.\n *\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {Promise<NodeClient>}\n */\n static async forPreviewnetAsync(props = {}) {\n return new NodeClient({\n network: \"previewnet\",\n ...props,\n }).updateNetwork();\n }\n\n /**\n * Construct a client for a specific network with optional network update.\n * Updates network only if the network is not \"local-node\".\n *\n * @param {string} network\n * @param {object} [props]\n * @param {boolean} [props.scheduleNetworkUpdate]\n * @returns {Promise<NodeClient>}\n */\n static async forNameAsync(network, props = {}) {\n const client = new NodeClient({ network, ...props });\n\n if (network !== \"local-node\") {\n await client.updateNetwork();\n }\n\n return client;\n }\n\n /**\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {void}\n */\n setNetwork(network) {\n if (typeof network === \"string\") {\n this._setNetworkFromName(network);\n } else {\n this._network.setNetwork(network);\n }\n }\n\n /**\n * Available only for NodeClient\n *\n * @param {number} maxExecutionTime\n * @returns {this}\n */\n setMaxExecutionTime(maxExecutionTime) {\n this._maxExecutionTime = maxExecutionTime;\n return this;\n }\n\n /**\n * @private\n * @param {string} name\n * @returns {this}\n */\n _setNetworkFromName(name) {\n switch (name) {\n case \"mainnet\":\n this.setNetworkFromAddressBook(\n NodeAddressBook.fromBytes(hex.decode(mainnet.addressBook)),\n );\n this.setMirrorNetwork(MirrorNetwork.MAINNET);\n this.setLedgerId(LedgerId.MAINNET);\n break;\n\n case \"testnet\":\n this.setNetworkFromAddressBook(\n NodeAddressBook.fromBytes(hex.decode(testnet.addressBook)),\n );\n this.setMirrorNetwork(MirrorNetwork.TESTNET);\n this.setLedgerId(LedgerId.TESTNET);\n break;\n\n case \"previewnet\":\n this.setNetworkFromAddressBook(\n NodeAddressBook.fromBytes(\n hex.decode(previewnet.addressBook),\n ),\n );\n this.setMirrorNetwork(MirrorNetwork.PREVIEWNET);\n this.setLedgerId(LedgerId.PREVIEWNET);\n break;\n\n case \"local-node\":\n this.setNetwork(Network.LOCAL_NODE);\n this.setMirrorNetwork(MirrorNetwork.LOCAL_NODE);\n this.setLedgerId(LedgerId.LOCAL_NODE);\n break;\n\n default:\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `unknown network: ${name}`,\n );\n }\n return this;\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @returns {this}\n */\n setMirrorNetwork(mirrorNetwork) {\n if (typeof mirrorNetwork === \"string\") {\n switch (mirrorNetwork) {\n case \"local-node\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.LOCAL_NODE);\n break;\n case \"previewnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.PREVIEWNET);\n break;\n case \"testnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.TESTNET);\n break;\n case \"mainnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.MAINNET);\n break;\n default:\n this._mirrorNetwork.setNetwork([mirrorNetwork]);\n }\n } else {\n this._mirrorNetwork.setNetwork(mirrorNetwork);\n }\n\n return this;\n }\n\n /**\n * @override\n * @returns {(address: string, cert?: string) => NodeChannel}\n */\n _createNetworkChannel() {\n return (address) => new NodeChannel(address, this._maxExecutionTime);\n }\n\n /**\n * @override\n * @returns {(address: string) => NodeMirrorChannel}\n */\n _createMirrorNetworkChannel() {\n return (address) => new NodeMirrorChannel(address);\n }\n}\n"],"names":["readFileAsync","util","promisify","fs","readFile","Network","LOCAL_NODE","AccountId","NodeClient","Client","constructor","props","super","this","_maxExecutionTime","network","_setNetworkFromName","_validateNetworkConsistency","shard","realm","_extractShardRealm","_shard","_realm","setNetwork","mirrorNetwork","setMirrorNetwork","MirrorNetwork","MAINNET","TESTNET","PREVIEWNET","fromConfig","data","JSON","parse","fromConfigFile","filename","forNetwork","forName","forMainnet","forTestnet","forMirrorNetwork","client","updateNetwork","forPreviewnet","forLocalNode","scheduleNetworkUpdate","forMainnetAsync","forTestnetAsync","forPreviewnetAsync","forNameAsync","_network","setMaxExecutionTime","maxExecutionTime","name","setNetworkFromAddressBook","NodeAddressBook","fromBytes","hex.decode","mainnet.addressBook","setLedgerId","LedgerId","testnet.addressBook","previewnet.addressBook","Error","_mirrorNetwork","_createNetworkChannel","address","NodeChannel","_createMirrorNetworkChannel","NodeMirrorChannel"],"mappings":"uiBAgBA,MAAMA,EAAgBC,EAAKC,UAAUC,EAAGC,UAM3BC,EAAU,CACnBC,WAAY,CACR,kBAAmB,IAAIC,EAAU,KAS1B,MAAMC,UAAmBC,EAIpC,WAAAC,CAAYC,GAMR,GALAC,MAAMD,GAGNE,KAAKC,kBAAoB,IAEZ,MAATH,EAAe,CACf,GAA6B,iBAAlBA,EAAMI,QACbF,KAAKG,oBAA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ACI,MAAM,IAAIyD,MAEN,oBAAoBV,KAGhC,OAAOxC,IACf,CAMI,gBAAAY,CAAiBD,GACb,GAA6B,iBAAlBA,EACP,OAAQA,GACJ,IAAK,aACDX,KAAKmD,eAAezC,WAAWG,EAAcpB,YAC7C,MACJ,IAAK,aACDO,KAAKmD,eAAezC,WAAWG,EAAcG,YAC7C,MACJ,IAAK,UACDhB,KAAKmD,eAAezC,WAAWG,EAAcE,SAC7C,MACJ,IAAK,UACDf,KAAKmD,eAAezC,WAAWG,EAAcC,SAC7C,MACJ,QACId,KAAKmD,eAAezC,WAAW,CAACC,SAGxCX,KAAKmD,eAAezC,WAAWC,GAGnC,OAAOX,IACf,CAMI,qBAAAoD,GACI,OAAQC,GAAY,IAAIC,EAAYD,EAASrD,KAAKC,kBAC1D,CAMI,2BAAAsD,GACI,OAAQF,GAAY,IAAIG,EAAkBH,EAClD"}
|
package/lib/client/WebClient.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default =
|
|
6
|
+
exports.default = void 0;
|
|
7
7
|
var _Client = _interopRequireDefault(require("./Client.cjs"));
|
|
8
8
|
var _WebChannel = _interopRequireDefault(require("../channel/WebChannel.cjs"));
|
|
9
9
|
var _LedgerId = _interopRequireDefault(require("../LedgerId.cjs"));
|
|
@@ -18,28 +18,6 @@ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e
|
|
|
18
18
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
const Network = exports.Network = {
|
|
22
|
-
/**
|
|
23
|
-
* @param {string} name
|
|
24
|
-
* @returns {{[key: string]: (string | AccountId)}}
|
|
25
|
-
*/
|
|
26
|
-
fromName(name) {
|
|
27
|
-
switch (name) {
|
|
28
|
-
case "mainnet":
|
|
29
|
-
return Network.MAINNET;
|
|
30
|
-
case "testnet":
|
|
31
|
-
return Network.TESTNET;
|
|
32
|
-
case "previewnet":
|
|
33
|
-
return Network.PREVIEWNET;
|
|
34
|
-
default:
|
|
35
|
-
throw new Error(`unknown network name: ${name}`);
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
MAINNET: _ClientConstants.MAINNET,
|
|
39
|
-
TESTNET: _ClientConstants.WEB_TESTNET,
|
|
40
|
-
PREVIEWNET: _ClientConstants.WEB_PREVIEWNET
|
|
41
|
-
};
|
|
42
|
-
|
|
43
21
|
/**
|
|
44
22
|
* Represents a client for interacting with the Hedera network over the web.
|
|
45
23
|
* The `WebClient` class extends the base `Client` class and provides methods
|
|
@@ -58,17 +36,17 @@ class WebClient extends _Client.default {
|
|
|
58
36
|
if (typeof props.network === "string") {
|
|
59
37
|
switch (props.network) {
|
|
60
38
|
case "mainnet":
|
|
61
|
-
this.setNetwork(
|
|
62
|
-
this.setMirrorNetwork(_ClientConstants.MirrorNetwork.MAINNET);
|
|
39
|
+
this.setNetwork(_ClientConstants.WebNetwork.MAINNET);
|
|
63
40
|
this.setLedgerId(_LedgerId.default.MAINNET);
|
|
41
|
+
this.setMirrorNetwork(_ClientConstants.MirrorNetwork.MAINNET);
|
|
64
42
|
break;
|
|
65
43
|
case "testnet":
|
|
66
|
-
this.setNetwork(
|
|
44
|
+
this.setNetwork(_ClientConstants.WebNetwork.TESTNET);
|
|
67
45
|
this.setLedgerId(_LedgerId.default.TESTNET);
|
|
68
46
|
this.setMirrorNetwork(_ClientConstants.MirrorNetwork.TESTNET);
|
|
69
47
|
break;
|
|
70
48
|
case "previewnet":
|
|
71
|
-
this.setNetwork(
|
|
49
|
+
this.setNetwork(_ClientConstants.WebNetwork.PREVIEWNET);
|
|
72
50
|
this.setLedgerId(_LedgerId.default.PREVIEWNET);
|
|
73
51
|
this.setMirrorNetwork(_ClientConstants.MirrorNetwork.PREVIEWNET);
|
|
74
52
|
break;
|
|
@@ -164,6 +142,56 @@ class WebClient extends _Client.default {
|
|
|
164
142
|
});
|
|
165
143
|
}
|
|
166
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Construct a Hedera client pre-configured for Mainnet access with network update.
|
|
147
|
+
*
|
|
148
|
+
* @returns {Promise<WebClient>}
|
|
149
|
+
*/
|
|
150
|
+
static async forMainnetAsync() {
|
|
151
|
+
return new WebClient({
|
|
152
|
+
network: "mainnet"
|
|
153
|
+
}).updateNetwork();
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Construct a Hedera client pre-configured for Testnet access with network update.
|
|
158
|
+
*
|
|
159
|
+
* @returns {Promise<WebClient>}
|
|
160
|
+
*/
|
|
161
|
+
static async forTestnetAsync() {
|
|
162
|
+
return new WebClient({
|
|
163
|
+
network: "testnet"
|
|
164
|
+
}).updateNetwork();
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Construct a Hedera client pre-configured for Previewnet access with network update.
|
|
169
|
+
*
|
|
170
|
+
* @returns {Promise<WebClient>}
|
|
171
|
+
*/
|
|
172
|
+
static async forPreviewnetAsync() {
|
|
173
|
+
return new WebClient({
|
|
174
|
+
network: "previewnet"
|
|
175
|
+
}).updateNetwork();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Construct a client for a specific network with optional network update.
|
|
180
|
+
* Updates network only if the network is not "local-node".
|
|
181
|
+
*
|
|
182
|
+
* @param {string} network
|
|
183
|
+
* @returns {Promise<WebClient>}
|
|
184
|
+
*/
|
|
185
|
+
static async forNameAsync(network) {
|
|
186
|
+
const client = new WebClient({
|
|
187
|
+
network
|
|
188
|
+
});
|
|
189
|
+
if (network !== "local-node") {
|
|
190
|
+
await client.updateNetwork();
|
|
191
|
+
}
|
|
192
|
+
return client;
|
|
193
|
+
}
|
|
194
|
+
|
|
167
195
|
/**
|
|
168
196
|
* Construct a client configured to use mirror nodes.
|
|
169
197
|
* This will query the address book to get the network nodes.
|
|
@@ -172,8 +200,9 @@ class WebClient extends _Client.default {
|
|
|
172
200
|
* @returns {Promise<WebClient>}
|
|
173
201
|
*/
|
|
174
202
|
static async forMirrorNetwork(mirrorNetwork) {
|
|
175
|
-
const client = new WebClient(
|
|
176
|
-
|
|
203
|
+
const client = new WebClient({
|
|
204
|
+
mirrorNetwork: mirrorNetwork
|
|
205
|
+
});
|
|
177
206
|
await client.updateNetwork();
|
|
178
207
|
return client;
|
|
179
208
|
}
|
|
@@ -186,13 +215,13 @@ class WebClient extends _Client.default {
|
|
|
186
215
|
if (typeof network === "string") {
|
|
187
216
|
switch (network) {
|
|
188
217
|
case "previewnet":
|
|
189
|
-
this._network.setNetwork(
|
|
218
|
+
this._network.setNetwork(_ClientConstants.WebNetwork.PREVIEWNET);
|
|
190
219
|
break;
|
|
191
220
|
case "testnet":
|
|
192
|
-
this._network.setNetwork(
|
|
221
|
+
this._network.setNetwork(_ClientConstants.WebNetwork.TESTNET);
|
|
193
222
|
break;
|
|
194
223
|
case "mainnet":
|
|
195
|
-
this._network.setNetwork(
|
|
224
|
+
this._network.setNetwork(_ClientConstants.WebNetwork.MAINNET);
|
|
196
225
|
}
|
|
197
226
|
} else {
|
|
198
227
|
this._network.setNetwork(network);
|
|
@@ -229,11 +258,11 @@ class WebClient extends _Client.default {
|
|
|
229
258
|
|
|
230
259
|
/**
|
|
231
260
|
* @override
|
|
232
|
-
* @returns {Promise<
|
|
261
|
+
* @returns {Promise<this>}
|
|
233
262
|
*/
|
|
234
263
|
async updateNetwork() {
|
|
235
264
|
if (this._isUpdatingNetwork) {
|
|
236
|
-
return;
|
|
265
|
+
return this;
|
|
237
266
|
}
|
|
238
267
|
this._isUpdatingNetwork = true;
|
|
239
268
|
try {
|
|
@@ -257,6 +286,7 @@ class WebClient extends _Client.default {
|
|
|
257
286
|
} finally {
|
|
258
287
|
this._isUpdatingNetwork = false;
|
|
259
288
|
}
|
|
289
|
+
return this;
|
|
260
290
|
}
|
|
261
291
|
|
|
262
292
|
/**
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export function fromName(name: string): {
|
|
7
|
-
[key: string]: (string | AccountId);
|
|
8
|
-
};
|
|
9
|
-
export { MAINNET };
|
|
10
|
-
export { WEB_TESTNET as TESTNET };
|
|
11
|
-
export { WEB_PREVIEWNET as PREVIEWNET };
|
|
12
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {import("./Client.js").ClientConfiguration} ClientConfiguration
|
|
3
|
+
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
4
|
+
*/
|
|
13
5
|
/**
|
|
14
6
|
* Represents a client for interacting with the Hedera network over the web.
|
|
15
7
|
* The `WebClient` class extends the base `Client` class and provides methods
|
|
@@ -63,6 +55,32 @@ export default class WebClient extends Client<WebChannel, any> {
|
|
|
63
55
|
* @returns {WebClient}
|
|
64
56
|
*/
|
|
65
57
|
static forPreviewnet(): WebClient;
|
|
58
|
+
/**
|
|
59
|
+
* Construct a Hedera client pre-configured for Mainnet access with network update.
|
|
60
|
+
*
|
|
61
|
+
* @returns {Promise<WebClient>}
|
|
62
|
+
*/
|
|
63
|
+
static forMainnetAsync(): Promise<WebClient>;
|
|
64
|
+
/**
|
|
65
|
+
* Construct a Hedera client pre-configured for Testnet access with network update.
|
|
66
|
+
*
|
|
67
|
+
* @returns {Promise<WebClient>}
|
|
68
|
+
*/
|
|
69
|
+
static forTestnetAsync(): Promise<WebClient>;
|
|
70
|
+
/**
|
|
71
|
+
* Construct a Hedera client pre-configured for Previewnet access with network update.
|
|
72
|
+
*
|
|
73
|
+
* @returns {Promise<WebClient>}
|
|
74
|
+
*/
|
|
75
|
+
static forPreviewnetAsync(): Promise<WebClient>;
|
|
76
|
+
/**
|
|
77
|
+
* Construct a client for a specific network with optional network update.
|
|
78
|
+
* Updates network only if the network is not "local-node".
|
|
79
|
+
*
|
|
80
|
+
* @param {string} network
|
|
81
|
+
* @returns {Promise<WebClient>}
|
|
82
|
+
*/
|
|
83
|
+
static forNameAsync(network: string): Promise<WebClient>;
|
|
66
84
|
/**
|
|
67
85
|
* Construct a client configured to use mirror nodes.
|
|
68
86
|
* This will query the address book to get the network nodes.
|
|
@@ -80,11 +98,13 @@ export default class WebClient extends Client<WebChannel, any> {
|
|
|
80
98
|
* @returns {this}
|
|
81
99
|
*/
|
|
82
100
|
setMirrorNetwork(mirrorNetwork: string[] | string): this;
|
|
101
|
+
/**
|
|
102
|
+
* @override
|
|
103
|
+
* @returns {Promise<this>}
|
|
104
|
+
*/
|
|
105
|
+
override updateNetwork(): Promise<this>;
|
|
83
106
|
}
|
|
84
107
|
export type ClientConfiguration = import("./Client.js").ClientConfiguration;
|
|
85
108
|
export type AccountId = import("../account/AccountId.js").default;
|
|
86
|
-
import { MAINNET } from "../constants/ClientConstants.js";
|
|
87
|
-
import { WEB_TESTNET } from "../constants/ClientConstants.js";
|
|
88
|
-
import { WEB_PREVIEWNET } from "../constants/ClientConstants.js";
|
|
89
109
|
import WebChannel from "../channel/WebChannel.js";
|
|
90
110
|
import Client from "./Client.js";
|
package/lib/client/WebClient.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"./Client.js";import e from"../channel/WebChannel.js";import r from"../LedgerId.js";import{
|
|
1
|
+
import t from"./Client.js";import e from"../channel/WebChannel.js";import r from"../LedgerId.js";import{WebNetwork as s,MirrorNetwork as o}from"../constants/ClientConstants.js";import n from"../network/AddressBookQueryWeb.js";import i from"../file/FileId.js";class a extends t{constructor(e){if(super(e),null!=e)if("string"==typeof e.network)switch(e.network){case"mainnet":this.setNetwork(s.MAINNET),this.setLedgerId(r.MAINNET),this.setMirrorNetwork(o.MAINNET);break;case"testnet":this.setNetwork(s.TESTNET),this.setLedgerId(r.TESTNET),this.setMirrorNetwork(o.TESTNET);break;case"previewnet":this.setNetwork(s.PREVIEWNET),this.setLedgerId(r.PREVIEWNET),this.setMirrorNetwork(o.PREVIEWNET);break;default:throw new Error(`unknown network: ${e.network}`)}else if(null!=e.network){t._validateNetworkConsistency(e.network);const{shard:r,realm:s}=t._extractShardRealm(e.network);this._shard=r,this._realm=s,this.setNetwork(e.network)}}static fromConfig(t){return new a("string"==typeof t?JSON.parse(t):t)}static forNetwork(t){return new a({network:t})}static forName(t){return new a({network:t})}static forMainnet(){return new a({network:"mainnet"})}static forTestnet(){return new a({network:"testnet"})}static forPreviewnet(){return new a({network:"previewnet"})}static async forMainnetAsync(){return new a({network:"mainnet"}).updateNetwork()}static async forTestnetAsync(){return new a({network:"testnet"}).updateNetwork()}static async forPreviewnetAsync(){return new a({network:"previewnet"}).updateNetwork()}static async forNameAsync(t){const e=new a({network:t});return"local-node"!==t&&await e.updateNetwork(),e}static async forMirrorNetwork(t){const e=new a({mirrorNetwork:t});return await e.updateNetwork(),e}setNetwork(t){if("string"==typeof t)switch(t){case"previewnet":this._network.setNetwork(s.PREVIEWNET);break;case"testnet":this._network.setNetwork(s.TESTNET);break;case"mainnet":this._network.setNetwork(s.MAINNET)}else this._network.setNetwork(t)}setMirrorNetwork(t){if("string"==typeof t)switch(t){case"local-node":this._mirrorNetwork.setNetwork(o.LOCAL_NODE);break;case"previewnet":this._mirrorNetwork.setNetwork(o.PREVIEWNET);break;case"testnet":this._mirrorNetwork.setNetwork(o.TESTNET);break;case"mainnet":this._mirrorNetwork.setNetwork(o.MAINNET);break;default:this._mirrorNetwork.setNetwork([t])}else this._mirrorNetwork.setNetwork(t);return this}async updateNetwork(){if(this._isUpdatingNetwork)return this;this._isUpdatingNetwork=!0;try{const t=await(new n).setFileId(i.getAddressBookFileIdFor(this.shard,this.realm)).execute(this),e={};for(const r of t.nodeAddresses)for(const t of r.addresses)null!=r.accountId&&(e[t.toString()]=r.accountId);this.setNetwork(e)}catch(t){if(this._logger){const e=t instanceof Error?t.message:String(t);this._logger.trace(`failed to update client address book: ${e}`)}}finally{this._isUpdatingNetwork=!1}return this}_createNetworkChannel(){return t=>new e(t)}_createMirrorNetworkChannel(){return()=>{throw new Error("mirror support is not supported in browsers")}}}export{a as default};
|
|
2
2
|
//# sourceMappingURL=WebClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebClient.js","sources":["../../src/client/WebClient.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Client from \"./Client.js\";\nimport WebChannel from \"../channel/WebChannel.js\";\nimport LedgerId from \"../LedgerId.js\";\nimport {\n MAINNET,\n WEB_TESTNET,\n WEB_PREVIEWNET,\n MirrorNetwork,\n} from \"../constants/ClientConstants.js\";\nimport AddressBookQuery from \"../network/AddressBookQueryWeb.js\";\nimport FileId from \"../file/FileId.js\";\n\n/**\n * @typedef {import(\"./Client.js\").ClientConfiguration} ClientConfiguration\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\nexport const Network = {\n /**\n * @param {string} name\n * @returns {{[key: string]: (string | AccountId)}}\n */\n fromName(name) {\n switch (name) {\n case \"mainnet\":\n return Network.MAINNET;\n\n case \"testnet\":\n return Network.TESTNET;\n\n case \"previewnet\":\n return Network.PREVIEWNET;\n\n default:\n throw new Error(`unknown network name: ${name}`);\n }\n },\n\n MAINNET: MAINNET,\n TESTNET: WEB_TESTNET,\n PREVIEWNET: WEB_PREVIEWNET,\n};\n\n/**\n * Represents a client for interacting with the Hedera network over the web.\n * The `WebClient` class extends the base `Client` class and provides methods\n * for configuring and managing connections to the Hedera network, including\n * setting the network type (mainnet, testnet, previewnet) and handling\n * transactions and queries.\n * @augments {Client<WebChannel, *>}\n */\nexport default class WebClient extends Client {\n /**\n * @param {ClientConfiguration} [props]\n */\n constructor(props) {\n super(props);\n if (props != null) {\n if (typeof props.network === \"string\") {\n switch (props.network) {\n case \"mainnet\":\n this.setNetwork(Network.MAINNET);\n this.setMirrorNetwork(MirrorNetwork.MAINNET);\n this.setLedgerId(LedgerId.MAINNET);\n break;\n\n case \"testnet\":\n this.setNetwork(Network.TESTNET);\n this.setLedgerId(LedgerId.TESTNET);\n this.setMirrorNetwork(MirrorNetwork.TESTNET);\n break;\n\n case \"previewnet\":\n this.setNetwork(Network.PREVIEWNET);\n this.setLedgerId(LedgerId.PREVIEWNET);\n this.setMirrorNetwork(MirrorNetwork.PREVIEWNET);\n break;\n\n default:\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `unknown network: ${props.network}`,\n );\n }\n } else if (props.network != null) {\n Client._validateNetworkConsistency(props.network);\n\n const { shard, realm } = Client._extractShardRealm(\n props.network,\n );\n\n // Shard and realm are inferred from the network, so we need to set them here\n // to ensure that the client is properly configured.\n this._shard = shard;\n this._realm = realm;\n\n this.setNetwork(props.network);\n }\n }\n }\n\n /**\n * @param {string | ClientConfiguration} data\n * @returns {WebClient}\n */\n static fromConfig(data) {\n return new WebClient(\n typeof data === \"string\"\n ? /** @type {ClientConfiguration | undefined} */ (\n JSON.parse(data)\n )\n : data,\n );\n }\n\n /**\n * Construct a client for a specific network.\n *\n * It is the responsibility of the caller to ensure that all nodes in the map are part of the\n * same Hedera network. Failure to do so will result in undefined behavior.\n *\n * The client will load balance all requests to Hedera using a simple round-robin scheme to\n * chose nodes to send transactions to. For one transaction, at most 1/3 of the nodes will be\n * tried.\n *\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {WebClient}\n */\n static forNetwork(network) {\n return new WebClient({ network });\n }\n\n /**\n * @param {string} network\n * @returns {WebClient}\n */\n static forName(network) {\n return new WebClient({ network });\n }\n\n /**\n * Construct a Hedera client pre-configured for Mainnet access.\n *\n * @returns {WebClient}\n */\n static forMainnet() {\n return new WebClient({\n network: \"mainnet\",\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Testnet access.\n *\n * @returns {WebClient}\n */\n static forTestnet() {\n return new WebClient({\n network: \"testnet\",\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Previewnet access.\n *\n * @returns {WebClient}\n */\n static forPreviewnet() {\n return new WebClient({\n network: \"previewnet\",\n });\n }\n\n /**\n * Construct a client configured to use mirror nodes.\n * This will query the address book to get the network nodes.\n *\n * @param {string[] | string} mirrorNetwork\n * @returns {Promise<WebClient>}\n */\n static async forMirrorNetwork(mirrorNetwork) {\n const client = new WebClient();\n\n client.setMirrorNetwork(mirrorNetwork);\n\n await client.updateNetwork();\n\n return client;\n }\n\n /**\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {void}\n */\n setNetwork(network) {\n if (typeof network === \"string\") {\n switch (network) {\n case \"previewnet\":\n this._network.setNetwork(Network.PREVIEWNET);\n break;\n case \"testnet\":\n this._network.setNetwork(Network.TESTNET);\n break;\n case \"mainnet\":\n this._network.setNetwork(Network.MAINNET);\n }\n } else {\n this._network.setNetwork(network);\n }\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @returns {this}\n */\n setMirrorNetwork(mirrorNetwork) {\n if (typeof mirrorNetwork === \"string\") {\n switch (mirrorNetwork) {\n case \"local-node\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.LOCAL_NODE);\n break;\n case \"previewnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.PREVIEWNET);\n break;\n case \"testnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.TESTNET);\n break;\n case \"mainnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.MAINNET);\n break;\n default:\n this._mirrorNetwork.setNetwork([mirrorNetwork]);\n }\n } else {\n this._mirrorNetwork.setNetwork(mirrorNetwork);\n }\n\n return this;\n }\n\n /**\n * @override\n * @returns {Promise<void>}\n */\n async updateNetwork() {\n if (this._isUpdatingNetwork) {\n return;\n }\n\n this._isUpdatingNetwork = true;\n\n try {\n const addressBook = await new AddressBookQuery()\n .setFileId(\n FileId.getAddressBookFileIdFor(this.shard, this.realm),\n )\n .execute(this);\n\n /** @type {Record<string, AccountId>} */\n const network = {};\n for (const nodeAddress of addressBook.nodeAddresses) {\n for (const endpoint of nodeAddress.addresses) {\n if (nodeAddress.accountId != null) {\n network[endpoint.toString()] = nodeAddress.accountId;\n }\n }\n }\n\n this.setNetwork(network);\n } catch (/** @type {unknown} */ error) {\n if (this._logger) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this._logger.trace(\n `failed to update client address book: ${errorMessage}`,\n );\n }\n } finally {\n this._isUpdatingNetwork = false;\n }\n }\n\n /**\n * @override\n * @returns {(address: string) => WebChannel}\n */\n _createNetworkChannel() {\n return (address) => new WebChannel(address);\n }\n\n /**\n * @override\n * @returns {(address: string) => *}\n */\n _createMirrorNetworkChannel() {\n return () => {\n throw new Error(\"mirror support is not supported in browsers\");\n };\n }\n}\n"],"names":["Network","MAINNET","TESTNET","WEB_TESTNET","PREVIEWNET","WEB_PREVIEWNET","WebClient","Client","constructor","props","super","network","this","setNetwork","setMirrorNetwork","MirrorNetwork","setLedgerId","LedgerId","Error","_validateNetworkConsistency","shard","realm","_extractShardRealm","_shard","_realm","fromConfig","data","JSON","parse","forNetwork","forName","forMainnet","forTestnet","forPreviewnet","forMirrorNetwork","mirrorNetwork","client","updateNetwork","_network","_mirrorNetwork","LOCAL_NODE","_isUpdatingNetwork","addressBook","AddressBookQuery","setFileId","FileId","getAddressBookFileIdFor","execute","nodeAddress","nodeAddresses","endpoint","addresses","accountId","toString","error","_logger","errorMessage","message","String","trace","_createNetworkChannel","address","WebChannel","_createMirrorNetworkChannel"],"mappings":"qSAmBY,MAACA,EAAU,CAqBnBC,QAASA,EACTC,QAASC,EACTC,WAAYC,GAWD,MAAMC,UAAkBC,EAInC,WAAAC,CAAYC,GAER,GADAC,MAAMD,GACO,MAATA,EACA,GAA6B,iBAAlBA,EAAME,QACb,OAAQF,EAAME,SACV,IAAK,UACDC,KAAKC,WAAWb,EAAQC,SACxBW,KAAKE,iBAAiBC,EAAcd,SACpCW,KAAKI,YAAYC,EAAShB,SAC1B,MAEJ,IAAK,UACDW,KAAKC,WAAWb,EAAQE,SACxBU,KAAKI,YAAYC,EAASf,SAC1BU,KAAKE,iBAAiBC,EAAcb,SACpC,MAEJ,IAAK,aACDU,KAAKC,WAAWb,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AK2B,eAAe1B,WAAWE,EAAcX,YAC7C,MACJ,IAAK,UACDQ,KAAK2B,eAAe1B,WAAWE,EAAcb,SAC7C,MACJ,IAAK,UACDU,KAAK2B,eAAe1B,WAAWE,EAAcd,SAC7C,MACJ,QACIW,KAAK2B,eAAe1B,WAAW,CAACsB,SAGxCvB,KAAK2B,eAAe1B,WAAWsB,GAGnC,OAAOvB,IACf,CAMI,mBAAMyB,GACF,IAAIzB,KAAK6B,mBAAT,CAIA7B,KAAK6B,oBAAqB,EAE1B,IACI,MAAMC,QAAoB,IAAIC,GACzBC,UACGC,EAAOC,wBAAwBlC,KAAKQ,MAAOR,KAAKS,QAEnD0B,QAAQnC,MAGPD,EAAU,CAAE,EAClB,IAAK,MAAMqC,KAAeN,EAAYO,cAClC,IAAK,MAAMC,KAAYF,EAAYG,UACF,MAAzBH,EAAYI,YACZzC,EAAQuC,EAASG,YAAcL,EAAYI,WAKvDxC,KAAKC,WAAWF,EACnB,CAAC,MAA8B2C,GAC5B,GAAI1C,KAAK2C,QAAS,CACd,MAAMC,EACFF,aAAiBpC,MAAQoC,EAAMG,QAAUC,OAAOJ,GACpD1C,KAAK2C,QAAQI,MACT,yCAAyCH,IAE7D,CACA,CAAkB,QACN5C,KAAK6B,oBAAqB,CACtC,CAhCA,CAiCA,CAMI,qBAAAmB,GACI,OAAQC,GAAY,IAAIC,EAAWD,EAC3C,CAMI,2BAAAE,GACI,MAAO,KACH,MAAM,IAAI7C,MAAM,8CAA8C,CAE1E"}
|
|
1
|
+
{"version":3,"file":"WebClient.js","sources":["../../src/client/WebClient.js"],"sourcesContent":["// SPDX-License-Identifier: Apache-2.0\n\nimport Client from \"./Client.js\";\nimport WebChannel from \"../channel/WebChannel.js\";\nimport LedgerId from \"../LedgerId.js\";\nimport { WebNetwork, MirrorNetwork } from \"../constants/ClientConstants.js\";\nimport AddressBookQuery from \"../network/AddressBookQueryWeb.js\";\nimport FileId from \"../file/FileId.js\";\n\n/**\n * @typedef {import(\"./Client.js\").ClientConfiguration} ClientConfiguration\n * @typedef {import(\"../account/AccountId.js\").default} AccountId\n */\n\n/**\n * Represents a client for interacting with the Hedera network over the web.\n * The `WebClient` class extends the base `Client` class and provides methods\n * for configuring and managing connections to the Hedera network, including\n * setting the network type (mainnet, testnet, previewnet) and handling\n * transactions and queries.\n * @augments {Client<WebChannel, *>}\n */\nexport default class WebClient extends Client {\n /**\n * @param {ClientConfiguration} [props]\n */\n constructor(props) {\n super(props);\n if (props != null) {\n if (typeof props.network === \"string\") {\n switch (props.network) {\n case \"mainnet\":\n this.setNetwork(WebNetwork.MAINNET);\n this.setLedgerId(LedgerId.MAINNET);\n this.setMirrorNetwork(MirrorNetwork.MAINNET);\n break;\n\n case \"testnet\":\n this.setNetwork(WebNetwork.TESTNET);\n this.setLedgerId(LedgerId.TESTNET);\n this.setMirrorNetwork(MirrorNetwork.TESTNET);\n break;\n\n case \"previewnet\":\n this.setNetwork(WebNetwork.PREVIEWNET);\n this.setLedgerId(LedgerId.PREVIEWNET);\n this.setMirrorNetwork(MirrorNetwork.PREVIEWNET);\n break;\n\n default:\n throw new Error(\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n `unknown network: ${props.network}`,\n );\n }\n } else if (props.network != null) {\n Client._validateNetworkConsistency(props.network);\n\n const { shard, realm } = Client._extractShardRealm(\n props.network,\n );\n\n // Shard and realm are inferred from the network, so we need to set them here\n // to ensure that the client is properly configured.\n this._shard = shard;\n this._realm = realm;\n\n this.setNetwork(props.network);\n }\n }\n }\n\n /**\n * @param {string | ClientConfiguration} data\n * @returns {WebClient}\n */\n static fromConfig(data) {\n return new WebClient(\n typeof data === \"string\"\n ? /** @type {ClientConfiguration | undefined} */ (\n JSON.parse(data)\n )\n : data,\n );\n }\n\n /**\n * Construct a client for a specific network.\n *\n * It is the responsibility of the caller to ensure that all nodes in the map are part of the\n * same Hedera network. Failure to do so will result in undefined behavior.\n *\n * The client will load balance all requests to Hedera using a simple round-robin scheme to\n * chose nodes to send transactions to. For one transaction, at most 1/3 of the nodes will be\n * tried.\n *\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {WebClient}\n */\n static forNetwork(network) {\n return new WebClient({ network });\n }\n\n /**\n * @param {string} network\n * @returns {WebClient}\n */\n static forName(network) {\n return new WebClient({ network });\n }\n\n /**\n * Construct a Hedera client pre-configured for Mainnet access.\n *\n * @returns {WebClient}\n */\n static forMainnet() {\n return new WebClient({\n network: \"mainnet\",\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Testnet access.\n *\n * @returns {WebClient}\n */\n static forTestnet() {\n return new WebClient({\n network: \"testnet\",\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Previewnet access.\n *\n * @returns {WebClient}\n */\n static forPreviewnet() {\n return new WebClient({\n network: \"previewnet\",\n });\n }\n\n /**\n * Construct a Hedera client pre-configured for Mainnet access with network update.\n *\n * @returns {Promise<WebClient>}\n */\n static async forMainnetAsync() {\n return new WebClient({\n network: \"mainnet\",\n }).updateNetwork();\n }\n\n /**\n * Construct a Hedera client pre-configured for Testnet access with network update.\n *\n * @returns {Promise<WebClient>}\n */\n static async forTestnetAsync() {\n return new WebClient({\n network: \"testnet\",\n }).updateNetwork();\n }\n\n /**\n * Construct a Hedera client pre-configured for Previewnet access with network update.\n *\n * @returns {Promise<WebClient>}\n */\n static async forPreviewnetAsync() {\n return new WebClient({\n network: \"previewnet\",\n }).updateNetwork();\n }\n\n /**\n * Construct a client for a specific network with optional network update.\n * Updates network only if the network is not \"local-node\".\n *\n * @param {string} network\n * @returns {Promise<WebClient>}\n */\n static async forNameAsync(network) {\n const client = new WebClient({ network });\n\n if (network !== \"local-node\") {\n await client.updateNetwork();\n }\n\n return client;\n }\n\n /**\n * Construct a client configured to use mirror nodes.\n * This will query the address book to get the network nodes.\n *\n * @param {string[] | string} mirrorNetwork\n * @returns {Promise<WebClient>}\n */\n static async forMirrorNetwork(mirrorNetwork) {\n const client = new WebClient({ mirrorNetwork: mirrorNetwork });\n\n await client.updateNetwork();\n\n return client;\n }\n\n /**\n * @param {{[key: string]: (string | AccountId)} | string} network\n * @returns {void}\n */\n setNetwork(network) {\n if (typeof network === \"string\") {\n switch (network) {\n case \"previewnet\":\n this._network.setNetwork(WebNetwork.PREVIEWNET);\n break;\n case \"testnet\":\n this._network.setNetwork(WebNetwork.TESTNET);\n break;\n case \"mainnet\":\n this._network.setNetwork(WebNetwork.MAINNET);\n }\n } else {\n this._network.setNetwork(network);\n }\n }\n\n /**\n * @param {string[] | string} mirrorNetwork\n * @returns {this}\n */\n setMirrorNetwork(mirrorNetwork) {\n if (typeof mirrorNetwork === \"string\") {\n switch (mirrorNetwork) {\n case \"local-node\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.LOCAL_NODE);\n break;\n case \"previewnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.PREVIEWNET);\n break;\n case \"testnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.TESTNET);\n break;\n case \"mainnet\":\n this._mirrorNetwork.setNetwork(MirrorNetwork.MAINNET);\n break;\n default:\n this._mirrorNetwork.setNetwork([mirrorNetwork]);\n }\n } else {\n this._mirrorNetwork.setNetwork(mirrorNetwork);\n }\n\n return this;\n }\n\n /**\n * @override\n * @returns {Promise<this>}\n */\n async updateNetwork() {\n if (this._isUpdatingNetwork) {\n return this;\n }\n\n this._isUpdatingNetwork = true;\n\n try {\n const addressBook = await new AddressBookQuery()\n .setFileId(\n FileId.getAddressBookFileIdFor(this.shard, this.realm),\n )\n .execute(this);\n\n /** @type {Record<string, AccountId>} */\n const network = {};\n for (const nodeAddress of addressBook.nodeAddresses) {\n for (const endpoint of nodeAddress.addresses) {\n if (nodeAddress.accountId != null) {\n network[endpoint.toString()] = nodeAddress.accountId;\n }\n }\n }\n\n this.setNetwork(network);\n } catch (/** @type {unknown} */ error) {\n if (this._logger) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this._logger.trace(\n `failed to update client address book: ${errorMessage}`,\n );\n }\n } finally {\n this._isUpdatingNetwork = false;\n }\n\n return this;\n }\n\n /**\n * @override\n * @returns {(address: string) => WebChannel}\n */\n _createNetworkChannel() {\n return (address) => new WebChannel(address);\n }\n\n /**\n * @override\n * @returns {(address: string) => *}\n */\n _createMirrorNetworkChannel() {\n return () => {\n throw new Error(\"mirror support is not supported in browsers\");\n };\n }\n}\n"],"names":["WebClient","Client","constructor","props","super","network","this","setNetwork","WebNetwork","MAINNET","setLedgerId","LedgerId","setMirrorNetwork","MirrorNetwork","TESTNET","PREVIEWNET","Error","_validateNetworkConsistency","shard","realm","_extractShardRealm","_shard","_realm","fromConfig","data","JSON","parse","forNetwork","forName","forMainnet","forTestnet","forPreviewnet","forMainnetAsync","updateNetwork","forTestnetAsync","forPreviewnetAsync","forNameAsync","client","forMirrorNetwork","mirrorNetwork","_network","_mirrorNetwork","LOCAL_NODE","_isUpdatingNetwork","addressBook","AddressBookQuery","setFileId","FileId","getAddressBookFileIdFor","execute","nodeAddress","nodeAddresses","endpoint","addresses","accountId","toString","error","_logger","errorMessage","message","String","trace","_createNetworkChannel","address","WebChannel","_createMirrorNetworkChannel"],"mappings":"mQAsBe,MAAMA,UAAkBC,EAInC,WAAAC,CAAYC,GAER,GADAC,MAAMD,GACO,MAATA,EACA,GAA6B,iBAAlBA,EAAME,QACb,OAAQF,EAAME,SACV,IAAK,UACDC,KAAKC,WAAWC,EAAWC,SAC3BH,KAAKI,YAAYC,EAASF,SAC1BH,KAAKM,iBAAiBC,EAAcJ,SACpC,MAEJ,IAAK,UACDH,KAAKC,WAAWC,EAAWM,SAC3BR,KAAKI,YAAYC,EAASG,SAC1BR,KAAKM,iBAAiBC,EAAcC,SACpC,MAEJ,IAAK,aACDR,KAAKC,WAAWC,EAAWO,YAC3BT,KAAKI,YAAYC,EAASI,YAC1BT,KAAKM,iBAAiBC,EAAcE,YACpC,MAEJ,QACI,MAAM,IAAIC,MAEN,oBAAoBb,EAAME,gBAGnC,GAAqB,MAAjBF,EAAME,QAAiB,CAC9BJ,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WEB_PREVIEWNET = exports.MirrorNetwork = exports.MAINNET = exports.ALL_WEB_NETWORK_NODES = exports.ALL_NETWORK_IPS = void 0;
|
|
7
7
|
var _AccountId = _interopRequireDefault(require("../account/AccountId.cjs"));
|
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
9
9
|
/* NOSONAR */
|
|
@@ -57,12 +57,6 @@ const WEB_PREVIEWNET = exports.WEB_PREVIEWNET = {
|
|
|
57
57
|
"previewnet-node05-00-grpc.hedera.com:443": new _AccountId.default(8),
|
|
58
58
|
"previewnet-node06-00-grpc.hedera.com:443": new _AccountId.default(9)
|
|
59
59
|
};
|
|
60
|
-
const NATIVE_TESTNET = exports.NATIVE_TESTNET = {
|
|
61
|
-
"testnet-node00-00-grpc.hedera.com:443": new _AccountId.default(3)
|
|
62
|
-
};
|
|
63
|
-
const NATIVE_PREVIEWNET = exports.NATIVE_PREVIEWNET = {
|
|
64
|
-
"previewnet-node00-00-grpc.hedera.com:443": new _AccountId.default(3)
|
|
65
|
-
};
|
|
66
60
|
|
|
67
61
|
/**
|
|
68
62
|
* @type {Record<string, AccountId>}
|
|
@@ -198,4 +192,25 @@ const MirrorNetwork = exports.MirrorNetwork = {
|
|
|
198
192
|
TESTNET: ["testnet.mirrornode.hedera.com:443"],
|
|
199
193
|
PREVIEWNET: ["previewnet.mirrornode.hedera.com:443"],
|
|
200
194
|
LOCAL_NODE: ["127.0.0.1:5600"]
|
|
195
|
+
};
|
|
196
|
+
const WebNetwork = exports.WebNetwork = {
|
|
197
|
+
/**
|
|
198
|
+
* @param {string} name
|
|
199
|
+
* @returns {{[key: string]: (string | AccountId)}}
|
|
200
|
+
*/
|
|
201
|
+
fromName(name) {
|
|
202
|
+
switch (name) {
|
|
203
|
+
case "mainnet":
|
|
204
|
+
return WebNetwork.MAINNET;
|
|
205
|
+
case "testnet":
|
|
206
|
+
return WebNetwork.TESTNET;
|
|
207
|
+
case "previewnet":
|
|
208
|
+
return WebNetwork.PREVIEWNET;
|
|
209
|
+
default:
|
|
210
|
+
throw new Error(`unknown network name: ${name}`);
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
MAINNET: MAINNET,
|
|
214
|
+
TESTNET: WEB_TESTNET,
|
|
215
|
+
PREVIEWNET: WEB_PREVIEWNET
|
|
201
216
|
};
|
|
@@ -46,12 +46,6 @@ export const WEB_PREVIEWNET: {
|
|
|
46
46
|
"previewnet-node05-00-grpc.hedera.com:443": AccountId;
|
|
47
47
|
"previewnet-node06-00-grpc.hedera.com:443": AccountId;
|
|
48
48
|
};
|
|
49
|
-
export const NATIVE_TESTNET: {
|
|
50
|
-
"testnet-node00-00-grpc.hedera.com:443": AccountId;
|
|
51
|
-
};
|
|
52
|
-
export const NATIVE_PREVIEWNET: {
|
|
53
|
-
"previewnet-node00-00-grpc.hedera.com:443": AccountId;
|
|
54
|
-
};
|
|
55
49
|
/**
|
|
56
50
|
* @type {Record<string, AccountId>}
|
|
57
51
|
*/
|
|
@@ -71,4 +65,16 @@ export namespace MirrorNetwork {
|
|
|
71
65
|
let PREVIEWNET: string[];
|
|
72
66
|
let LOCAL_NODE: string[];
|
|
73
67
|
}
|
|
68
|
+
export namespace WebNetwork {
|
|
69
|
+
/**
|
|
70
|
+
* @param {string} name
|
|
71
|
+
* @returns {{[key: string]: (string | AccountId)}}
|
|
72
|
+
*/
|
|
73
|
+
export function fromName(name: string): {
|
|
74
|
+
[key: string]: (string | AccountId);
|
|
75
|
+
};
|
|
76
|
+
export { MAINNET };
|
|
77
|
+
export { WEB_TESTNET as TESTNET };
|
|
78
|
+
export { WEB_PREVIEWNET as PREVIEWNET };
|
|
79
|
+
}
|
|
74
80
|
import AccountId from "../account/AccountId.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import e from"../account/AccountId.js";const n={"node00.swirldslabs.com:443":new e(3),"node01-00-grpc.swirlds.com:443":new e(4),"node03.swirldslabs.com:443":new e(6),"node04.swirldslabs.com:443":new e(7),"node05.swirldslabs.com:443":new e(8),"node06.swirldslabs.com:443":new e(9),"node07.swirldslabs.com:443":new e(10),"node09.swirldslabs.com:443":new e(12),"node10.swirldslabs.com:443":new e(13),"node11.swirldslabs.com:443":new e(14),"node12.swirldslabs.com:443":new e(15),"node14.swirldslabs.com:443":new e(17),"node15.swirldslabs.com:443":new e(18),"node16.swirldslabs.com:443":new e(19),"node17.swirldslabs.com:443":new e(20),"node18.swirldslabs.com:443":new e(21),"node19.swirldslabs.com:443":new e(22),"node20.swirldslabs.com:443":new e(23),"node21.swirldslabs.com:443":new e(24),"node22.swirldslabs.com:443":new e(25),"node24.swirldslabs.com:443":new e(27),"node25.swirldslabs.com:443":new e(28),"node26.swirldslabs.com:443":new e(29),"node27.swirldslabs.com:443":new e(30),"node28.swirldslabs.com:443":new e(31),"node29.swirldslabs.com:443":new e(32),"node30.swirldslabs.com:443":new e(33),"node31.swirldslabs.com:443":new e(34)},o={"testnet-node00-00-grpc.hedera.com:443":new e(3),"testnet-node01-00-grpc.hedera.com:443":new e(4),"testnet-node02-00-grpc.hedera.com:443":new e(5),"testnet-node03-00-grpc.hedera.com:443":new e(6),"testnet-node04-00-grpc.hedera.com:443":new e(7),"testnet-node05-00-grpc.hedera.com:443":new e(8),"testnet-node06-00-grpc.hedera.com:443":new e(9)},s={"previewnet-node00-00-grpc.hedera.com:443":new e(3),"previewnet-node01-00-grpc.hedera.com:443":new e(4),"previewnet-node02-00-grpc.hedera.com:443":new e(5),"previewnet-node03-00-grpc.hedera.com:443":new e(6),"previewnet-node04-00-grpc.hedera.com:443":new e(7),"previewnet-node05-00-grpc.hedera.com:443":new e(8),"previewnet-node06-00-grpc.hedera.com:443":new e(9)}
|
|
1
|
+
import e from"../account/AccountId.js";const n={"node00.swirldslabs.com:443":new e(3),"node01-00-grpc.swirlds.com:443":new e(4),"node03.swirldslabs.com:443":new e(6),"node04.swirldslabs.com:443":new e(7),"node05.swirldslabs.com:443":new e(8),"node06.swirldslabs.com:443":new e(9),"node07.swirldslabs.com:443":new e(10),"node09.swirldslabs.com:443":new e(12),"node10.swirldslabs.com:443":new e(13),"node11.swirldslabs.com:443":new e(14),"node12.swirldslabs.com:443":new e(15),"node14.swirldslabs.com:443":new e(17),"node15.swirldslabs.com:443":new e(18),"node16.swirldslabs.com:443":new e(19),"node17.swirldslabs.com:443":new e(20),"node18.swirldslabs.com:443":new e(21),"node19.swirldslabs.com:443":new e(22),"node20.swirldslabs.com:443":new e(23),"node21.swirldslabs.com:443":new e(24),"node22.swirldslabs.com:443":new e(25),"node24.swirldslabs.com:443":new e(27),"node25.swirldslabs.com:443":new e(28),"node26.swirldslabs.com:443":new e(29),"node27.swirldslabs.com:443":new e(30),"node28.swirldslabs.com:443":new e(31),"node29.swirldslabs.com:443":new e(32),"node30.swirldslabs.com:443":new e(33),"node31.swirldslabs.com:443":new e(34)},o={"testnet-node00-00-grpc.hedera.com:443":new e(3),"testnet-node01-00-grpc.hedera.com:443":new e(4),"testnet-node02-00-grpc.hedera.com:443":new e(5),"testnet-node03-00-grpc.hedera.com:443":new e(6),"testnet-node04-00-grpc.hedera.com:443":new e(7),"testnet-node05-00-grpc.hedera.com:443":new e(8),"testnet-node06-00-grpc.hedera.com:443":new e(9)},s={"previewnet-node00-00-grpc.hedera.com:443":new e(3),"previewnet-node01-00-grpc.hedera.com:443":new e(4),"previewnet-node02-00-grpc.hedera.com:443":new e(5),"previewnet-node03-00-grpc.hedera.com:443":new e(6),"previewnet-node04-00-grpc.hedera.com:443":new e(7),"previewnet-node05-00-grpc.hedera.com:443":new e(8),"previewnet-node06-00-grpc.hedera.com:443":new e(9)},d={...n,...o,...s},r={"34.239.82.6:":"0.0.3","35.237.200.180:":"0.0.3","3.130.52.236:":"0.0.4","35.186.191.247:":"0.0.4","3.18.18.254:":"0.0.5","35.192.2.25:":"0.0.5","74.50.117.35:":"0.0.5","23.111.186.250:":"0.0.5","107.155.64.98:":"0.0.5","13.52.108.243:":"0.0.6","35.199.161.108:":"0.0.6","3.114.54.4:":"0.0.7","35.203.82.240:":"0.0.7","35.236.5.219:":"0.0.8","35.183.66.150:":"0.0.8","35.181.158.250:":"0.0.9","35.197.192.225:":"0.0.9","177.154.62.234:":"0.0.10","3.248.27.48:":"0.0.10","35.242.233.154:":"0.0.10","35.204.86.32:":"0.0.12","35.177.162.180:":"0.0.12","34.215.192.104:":"0.0.13","35.234.132.107:":"0.0.13","52.8.21.141:":"0.0.14","35.236.2.27:":"0.0.14","35.228.11.53:":"0.0.15","3.121.238.26:":"0.0.15","34.86.212.247:":"0.0.17","18.232.251.19:":"0.0.17","141.94.175.187:":"0.0.18","34.89.87.138:":"0.0.19","18.168.4.59:":"0.0.19","34.82.78.255:":"0.0.20","52.39.162.216:":"0.0.20","34.76.140.109:":"0.0.21","13.36.123.209:":"0.0.21","52.78.202.34:":"0.0.22","34.64.141.166:":"0.0.22","3.18.91.176:":"0.0.23","35.232.244.145:":"0.0.23","69.167.169.208:":"0.0.23","34.89.103.38:":"0.0.24","18.135.7.211:":"0.0.24","34.93.112.7:":"0.0.25","13.232.240.207:":"0.0.25","13.56.4.96:":"0.0.27","34.125.200.96:":"0.0.27","35.198.220.75:":"0.0.28","18.139.47.5:":"0.0.28","54.74.60.120:":"0.0.29","34.142.71.129:":"0.0.29","80.85.70.197:":"0.0.29","35.234.249.150:":"0.0.30","34.201.177.212:":"0.0.30","217.76.57.165:":"0.0.31","3.77.94.254:":"0.0.31","34.107.78.179:":"0.0.31","34.86.186.151:":"0.0.32","3.20.81.230:":"0.0.32","18.136.65.22:":"0.0.33","34.142.172.228:":"0.0.33","34.16.139.248:":"0.0.34","35.155.212.90:":"0.0.34","34.94.106.61:":"0.0.3","50.18.132.211:":"0.0.3","3.212.6.13:":"0.0.4","35.237.119.55:":"0.0.4","35.245.27.193:":"0.0.5","52.20.18.86:":"0.0.5","34.83.112.116:":"0.0.6","54.70.192.33:":"0.0.6","34.94.160.4:":"0.0.7","54.176.199.109:":"0.0.7","35.155.49.147:":"0.0.8","34.106.102.218:":"0.0.8","34.133.197.230:":"0.0.9","52.14.252.207:":"0.0.9","127.0.0.1:":"0.0.3","3.211.248.172:":"0.0.3","35.231.208.148:":"0.0.3","35.199.15.177:":"0.0.4","3.133.213.146:":"0.0.4","35.225.201.195:":"0.0.5","52.15.105.130:":"0.0.5","54.241.38.1:":"0.0.6","35.247.109.135:":"0.0.6","54.177.51.127:":"0.0.7","35.235.65.51:":"0.0.7","34.106.247.65:":"0.0.8","35.83.89.171:":"0.0.8","50.18.17.93:":"0.0.9","34.125.23.49:":"0.0.9"},w={MAINNET:["mainnet-public.mirrornode.hedera.com:443"],TESTNET:["testnet.mirrornode.hedera.com:443"],PREVIEWNET:["previewnet.mirrornode.hedera.com:443"],LOCAL_NODE:["127.0.0.1:5600"]},c={MAINNET:n,TESTNET:o,PREVIEWNET:s};export{r as ALL_NETWORK_IPS,d as ALL_WEB_NETWORK_NODES,n as MAINNET,w as MirrorNetwork,s as WEB_PREVIEWNET,o as WEB_TESTNET,c as WebNetwork};
|
|
2
2
|
//# sourceMappingURL=ClientConstants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientConstants.js","sources":["../../src/constants/ClientConstants.js"],"sourcesContent":["/* NOSONAR */\nimport AccountId from \"../account/AccountId.js\";\n\n// MAINNET node proxies are the same for both 'WebClient' and 'NativeClient'\nexport const MAINNET = {\n \"node00.swirldslabs.com:443\": new AccountId(3),\n \"node01-00-grpc.swirlds.com:443\": new AccountId(4),\n \"node03.swirldslabs.com:443\": new AccountId(6),\n \"node04.swirldslabs.com:443\": new AccountId(7),\n \"node05.swirldslabs.com:443\": new AccountId(8),\n \"node06.swirldslabs.com:443\": new AccountId(9),\n \"node07.swirldslabs.com:443\": new AccountId(10),\n \"node09.swirldslabs.com:443\": new AccountId(12),\n \"node10.swirldslabs.com:443\": new AccountId(13),\n \"node11.swirldslabs.com:443\": new AccountId(14),\n \"node12.swirldslabs.com:443\": new AccountId(15),\n \"node14.swirldslabs.com:443\": new AccountId(17),\n \"node15.swirldslabs.com:443\": new AccountId(18),\n \"node16.swirldslabs.com:443\": new AccountId(19),\n \"node17.swirldslabs.com:443\": new AccountId(20),\n \"node18.swirldslabs.com:443\": new AccountId(21),\n \"node19.swirldslabs.com:443\": new AccountId(22),\n \"node20.swirldslabs.com:443\": new AccountId(23),\n \"node21.swirldslabs.com:443\": new AccountId(24),\n \"node22.swirldslabs.com:443\": new AccountId(25),\n \"node24.swirldslabs.com:443\": new AccountId(27),\n \"node25.swirldslabs.com:443\": new AccountId(28),\n \"node26.swirldslabs.com:443\": new AccountId(29),\n \"node27.swirldslabs.com:443\": new AccountId(30),\n \"node28.swirldslabs.com:443\": new AccountId(31),\n \"node29.swirldslabs.com:443\": new AccountId(32),\n \"node30.swirldslabs.com:443\": new AccountId(33),\n \"node31.swirldslabs.com:443\": new AccountId(34),\n};\n\nexport const WEB_TESTNET = {\n \"testnet-node00-00-grpc.hedera.com:443\": new AccountId(3),\n \"testnet-node01-00-grpc.hedera.com:443\": new AccountId(4),\n \"testnet-node02-00-grpc.hedera.com:443\": new AccountId(5),\n \"testnet-node03-00-grpc.hedera.com:443\": new AccountId(6),\n \"testnet-node04-00-grpc.hedera.com:443\": new AccountId(7),\n \"testnet-node05-00-grpc.hedera.com:443\": new AccountId(8),\n \"testnet-node06-00-grpc.hedera.com:443\": new AccountId(9),\n};\n\nexport const WEB_PREVIEWNET = {\n \"previewnet-node00-00-grpc.hedera.com:443\": new AccountId(3),\n \"previewnet-node01-00-grpc.hedera.com:443\": new AccountId(4),\n \"previewnet-node02-00-grpc.hedera.com:443\": new AccountId(5),\n \"previewnet-node03-00-grpc.hedera.com:443\": new AccountId(6),\n \"previewnet-node04-00-grpc.hedera.com:443\": new AccountId(7),\n \"previewnet-node05-00-grpc.hedera.com:443\": new AccountId(8),\n \"previewnet-node06-00-grpc.hedera.com:443\": new AccountId(9),\n};\n\nexport const NATIVE_TESTNET = {\n \"testnet-node00-00-grpc.hedera.com:443\": new AccountId(3),\n};\n\nexport const NATIVE_PREVIEWNET = {\n \"previewnet-node00-00-grpc.hedera.com:443\": new AccountId(3),\n};\n\n/**\n * @type {Record<string, AccountId>}\n */\nexport const ALL_WEB_NETWORK_NODES = {\n ...MAINNET,\n ...WEB_TESTNET,\n ...WEB_PREVIEWNET,\n};\n\n/**\n * @type {Record<string, string>}\n */\nexport const ALL_NETWORK_IPS = {\n // MAINNET\n \"34.239.82.6:\": \"0.0.3\",\n \"35.237.200.180:\": \"0.0.3\",\n \"3.130.52.236:\": \"0.0.4\",\n \"35.186.191.247:\": \"0.0.4\",\n \"3.18.18.254:\": \"0.0.5\",\n \"35.192.2.25:\": \"0.0.5\",\n \"74.50.117.35:\": \"0.0.5\",\n \"23.111.186.250:\": \"0.0.5\",\n \"107.155.64.98:\": \"0.0.5\",\n \"13.52.108.243:\": \"0.0.6\",\n \"35.199.161.108:\": \"0.0.6\",\n \"3.114.54.4:\": \"0.0.7\",\n \"35.203.82.240:\": \"0.0.7\",\n \"35.236.5.219:\": \"0.0.8\",\n \"35.183.66.150:\": \"0.0.8\",\n \"35.181.158.250:\": \"0.0.9\",\n \"35.197.192.225:\": \"0.0.9\",\n \"177.154.62.234:\": \"0.0.10\",\n \"3.248.27.48:\": \"0.0.10\",\n \"35.242.233.154:\": \"0.0.10\",\n \"35.204.86.32:\": \"0.0.12\",\n \"35.177.162.180:\": \"0.0.12\",\n \"34.215.192.104:\": \"0.0.13\",\n \"35.234.132.107:\": \"0.0.13\",\n \"52.8.21.141:\": \"0.0.14\",\n \"35.236.2.27:\": \"0.0.14\",\n \"35.228.11.53:\": \"0.0.15\",\n \"3.121.238.26:\": \"0.0.15\",\n \"34.86.212.247:\": \"0.0.17\",\n \"18.232.251.19:\": \"0.0.17\",\n \"141.94.175.187:\": \"0.0.18\",\n \"34.89.87.138:\": \"0.0.19\",\n \"18.168.4.59:\": \"0.0.19\",\n \"34.82.78.255:\": \"0.0.20\",\n \"52.39.162.216:\": \"0.0.20\",\n \"34.76.140.109:\": \"0.0.21\",\n \"13.36.123.209:\": \"0.0.21\",\n \"52.78.202.34:\": \"0.0.22\",\n \"34.64.141.166:\": \"0.0.22\",\n \"3.18.91.176:\": \"0.0.23\",\n \"35.232.244.145:\": \"0.0.23\",\n \"69.167.169.208:\": \"0.0.23\",\n \"34.89.103.38:\": \"0.0.24\",\n \"18.135.7.211:\": \"0.0.24\",\n \"34.93.112.7:\": \"0.0.25\",\n \"13.232.240.207:\": \"0.0.25\",\n \"13.56.4.96:\": \"0.0.27\",\n \"34.125.200.96:\": \"0.0.27\",\n \"35.198.220.75:\": \"0.0.28\",\n \"18.139.47.5:\": \"0.0.28\",\n \"54.74.60.120:\": \"0.0.29\",\n \"34.142.71.129:\": \"0.0.29\",\n \"80.85.70.197:\": \"0.0.29\",\n \"35.234.249.150:\": \"0.0.30\",\n \"34.201.177.212:\": \"0.0.30\",\n \"217.76.57.165:\": \"0.0.31\",\n \"3.77.94.254:\": \"0.0.31\",\n \"34.107.78.179:\": \"0.0.31\",\n \"34.86.186.151:\": \"0.0.32\",\n \"3.20.81.230:\": \"0.0.32\",\n \"18.136.65.22:\": \"0.0.33\",\n \"34.142.172.228:\": \"0.0.33\",\n \"34.16.139.248:\": \"0.0.34\",\n \"35.155.212.90:\": \"0.0.34\",\n // TESTNET\n \"34.94.106.61:\": \"0.0.3\",\n \"50.18.132.211:\": \"0.0.3\",\n \"3.212.6.13:\": \"0.0.4\",\n \"35.237.119.55:\": \"0.0.4\",\n \"35.245.27.193:\": \"0.0.5\",\n \"52.20.18.86:\": \"0.0.5\",\n \"34.83.112.116:\": \"0.0.6\",\n \"54.70.192.33:\": \"0.0.6\",\n \"34.94.160.4:\": \"0.0.7\",\n \"54.176.199.109:\": \"0.0.7\",\n \"35.155.49.147:\": \"0.0.8\",\n \"34.106.102.218:\": \"0.0.8\",\n \"34.133.197.230:\": \"0.0.9\",\n \"52.14.252.207:\": \"0.0.9\",\n // LOCAL NODE\n \"127.0.0.1:\": \"0.0.3\",\n // PREVIEW NET\n \"3.211.248.172:\": \"0.0.3\",\n \"35.231.208.148:\": \"0.0.3\",\n \"35.199.15.177:\": \"0.0.4\",\n \"3.133.213.146:\": \"0.0.4\",\n \"35.225.201.195:\": \"0.0.5\",\n \"52.15.105.130:\": \"0.0.5\",\n \"54.241.38.1:\": \"0.0.6\",\n \"35.247.109.135:\": \"0.0.6\",\n \"54.177.51.127:\": \"0.0.7\",\n \"35.235.65.51:\": \"0.0.7\",\n \"34.106.247.65:\": \"0.0.8\",\n \"35.83.89.171:\": \"0.0.8\",\n \"50.18.17.93:\": \"0.0.9\",\n \"34.125.23.49:\": \"0.0.9\",\n};\n\nexport const MirrorNetwork = {\n /**\n * @param {string} name\n * @returns {string[]}\n */\n fromName(name) {\n switch (name) {\n case \"mainnet\":\n return MirrorNetwork.MAINNET;\n\n case \"testnet\":\n return MirrorNetwork.TESTNET;\n\n case \"previewnet\":\n return MirrorNetwork.PREVIEWNET;\n\n case \"local-node\":\n return MirrorNetwork.LOCAL_NODE;\n\n default:\n throw new Error(`unknown network name: ${name}`);\n }\n },\n\n MAINNET: [\"mainnet-public.mirrornode.hedera.com:443\"],\n TESTNET: [\"testnet.mirrornode.hedera.com:443\"],\n PREVIEWNET: [\"previewnet.mirrornode.hedera.com:443\"],\n LOCAL_NODE: [\"127.0.0.1:5600\"],\n};\n"],"names":["MAINNET","AccountId","WEB_TESTNET","WEB_PREVIEWNET","ALL_WEB_NETWORK_NODES","ALL_NETWORK_IPS","MirrorNetwork","TESTNET","PREVIEWNET","LOCAL_NODE"],"mappings":"uCAIY,MAACA,EAAU,CACnB,6BAA8B,IAAIC,EAAU,GAC5C,iCAAkC,IAAIA,EAAU,GAChD,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IA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,wCACbC,WAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"ClientConstants.js","sources":["../../src/constants/ClientConstants.js"],"sourcesContent":["/* NOSONAR */\nimport AccountId from \"../account/AccountId.js\";\n\n// MAINNET node proxies are the same for both 'WebClient' and 'NativeClient'\nexport const MAINNET = {\n \"node00.swirldslabs.com:443\": new AccountId(3),\n \"node01-00-grpc.swirlds.com:443\": new AccountId(4),\n \"node03.swirldslabs.com:443\": new AccountId(6),\n \"node04.swirldslabs.com:443\": new AccountId(7),\n \"node05.swirldslabs.com:443\": new AccountId(8),\n \"node06.swirldslabs.com:443\": new AccountId(9),\n \"node07.swirldslabs.com:443\": new AccountId(10),\n \"node09.swirldslabs.com:443\": new AccountId(12),\n \"node10.swirldslabs.com:443\": new AccountId(13),\n \"node11.swirldslabs.com:443\": new AccountId(14),\n \"node12.swirldslabs.com:443\": new AccountId(15),\n \"node14.swirldslabs.com:443\": new AccountId(17),\n \"node15.swirldslabs.com:443\": new AccountId(18),\n \"node16.swirldslabs.com:443\": new AccountId(19),\n \"node17.swirldslabs.com:443\": new AccountId(20),\n \"node18.swirldslabs.com:443\": new AccountId(21),\n \"node19.swirldslabs.com:443\": new AccountId(22),\n \"node20.swirldslabs.com:443\": new AccountId(23),\n \"node21.swirldslabs.com:443\": new AccountId(24),\n \"node22.swirldslabs.com:443\": new AccountId(25),\n \"node24.swirldslabs.com:443\": new AccountId(27),\n \"node25.swirldslabs.com:443\": new AccountId(28),\n \"node26.swirldslabs.com:443\": new AccountId(29),\n \"node27.swirldslabs.com:443\": new AccountId(30),\n \"node28.swirldslabs.com:443\": new AccountId(31),\n \"node29.swirldslabs.com:443\": new AccountId(32),\n \"node30.swirldslabs.com:443\": new AccountId(33),\n \"node31.swirldslabs.com:443\": new AccountId(34),\n};\n\nexport const WEB_TESTNET = {\n \"testnet-node00-00-grpc.hedera.com:443\": new AccountId(3),\n \"testnet-node01-00-grpc.hedera.com:443\": new AccountId(4),\n \"testnet-node02-00-grpc.hedera.com:443\": new AccountId(5),\n \"testnet-node03-00-grpc.hedera.com:443\": new AccountId(6),\n \"testnet-node04-00-grpc.hedera.com:443\": new AccountId(7),\n \"testnet-node05-00-grpc.hedera.com:443\": new AccountId(8),\n \"testnet-node06-00-grpc.hedera.com:443\": new AccountId(9),\n};\n\nexport const WEB_PREVIEWNET = {\n \"previewnet-node00-00-grpc.hedera.com:443\": new AccountId(3),\n \"previewnet-node01-00-grpc.hedera.com:443\": new AccountId(4),\n \"previewnet-node02-00-grpc.hedera.com:443\": new AccountId(5),\n \"previewnet-node03-00-grpc.hedera.com:443\": new AccountId(6),\n \"previewnet-node04-00-grpc.hedera.com:443\": new AccountId(7),\n \"previewnet-node05-00-grpc.hedera.com:443\": new AccountId(8),\n \"previewnet-node06-00-grpc.hedera.com:443\": new AccountId(9),\n};\n\n/**\n * @type {Record<string, AccountId>}\n */\nexport const ALL_WEB_NETWORK_NODES = {\n ...MAINNET,\n ...WEB_TESTNET,\n ...WEB_PREVIEWNET,\n};\n\n/**\n * @type {Record<string, string>}\n */\nexport const ALL_NETWORK_IPS = {\n // MAINNET\n \"34.239.82.6:\": \"0.0.3\",\n \"35.237.200.180:\": \"0.0.3\",\n \"3.130.52.236:\": \"0.0.4\",\n \"35.186.191.247:\": \"0.0.4\",\n \"3.18.18.254:\": \"0.0.5\",\n \"35.192.2.25:\": \"0.0.5\",\n \"74.50.117.35:\": \"0.0.5\",\n \"23.111.186.250:\": \"0.0.5\",\n \"107.155.64.98:\": \"0.0.5\",\n \"13.52.108.243:\": \"0.0.6\",\n \"35.199.161.108:\": \"0.0.6\",\n \"3.114.54.4:\": \"0.0.7\",\n \"35.203.82.240:\": \"0.0.7\",\n \"35.236.5.219:\": \"0.0.8\",\n \"35.183.66.150:\": \"0.0.8\",\n \"35.181.158.250:\": \"0.0.9\",\n \"35.197.192.225:\": \"0.0.9\",\n \"177.154.62.234:\": \"0.0.10\",\n \"3.248.27.48:\": \"0.0.10\",\n \"35.242.233.154:\": \"0.0.10\",\n \"35.204.86.32:\": \"0.0.12\",\n \"35.177.162.180:\": \"0.0.12\",\n \"34.215.192.104:\": \"0.0.13\",\n \"35.234.132.107:\": \"0.0.13\",\n \"52.8.21.141:\": \"0.0.14\",\n \"35.236.2.27:\": \"0.0.14\",\n \"35.228.11.53:\": \"0.0.15\",\n \"3.121.238.26:\": \"0.0.15\",\n \"34.86.212.247:\": \"0.0.17\",\n \"18.232.251.19:\": \"0.0.17\",\n \"141.94.175.187:\": \"0.0.18\",\n \"34.89.87.138:\": \"0.0.19\",\n \"18.168.4.59:\": \"0.0.19\",\n \"34.82.78.255:\": \"0.0.20\",\n \"52.39.162.216:\": \"0.0.20\",\n \"34.76.140.109:\": \"0.0.21\",\n \"13.36.123.209:\": \"0.0.21\",\n \"52.78.202.34:\": \"0.0.22\",\n \"34.64.141.166:\": \"0.0.22\",\n \"3.18.91.176:\": \"0.0.23\",\n \"35.232.244.145:\": \"0.0.23\",\n \"69.167.169.208:\": \"0.0.23\",\n \"34.89.103.38:\": \"0.0.24\",\n \"18.135.7.211:\": \"0.0.24\",\n \"34.93.112.7:\": \"0.0.25\",\n \"13.232.240.207:\": \"0.0.25\",\n \"13.56.4.96:\": \"0.0.27\",\n \"34.125.200.96:\": \"0.0.27\",\n \"35.198.220.75:\": \"0.0.28\",\n \"18.139.47.5:\": \"0.0.28\",\n \"54.74.60.120:\": \"0.0.29\",\n \"34.142.71.129:\": \"0.0.29\",\n \"80.85.70.197:\": \"0.0.29\",\n \"35.234.249.150:\": \"0.0.30\",\n \"34.201.177.212:\": \"0.0.30\",\n \"217.76.57.165:\": \"0.0.31\",\n \"3.77.94.254:\": \"0.0.31\",\n \"34.107.78.179:\": \"0.0.31\",\n \"34.86.186.151:\": \"0.0.32\",\n \"3.20.81.230:\": \"0.0.32\",\n \"18.136.65.22:\": \"0.0.33\",\n \"34.142.172.228:\": \"0.0.33\",\n \"34.16.139.248:\": \"0.0.34\",\n \"35.155.212.90:\": \"0.0.34\",\n // TESTNET\n \"34.94.106.61:\": \"0.0.3\",\n \"50.18.132.211:\": \"0.0.3\",\n \"3.212.6.13:\": \"0.0.4\",\n \"35.237.119.55:\": \"0.0.4\",\n \"35.245.27.193:\": \"0.0.5\",\n \"52.20.18.86:\": \"0.0.5\",\n \"34.83.112.116:\": \"0.0.6\",\n \"54.70.192.33:\": \"0.0.6\",\n \"34.94.160.4:\": \"0.0.7\",\n \"54.176.199.109:\": \"0.0.7\",\n \"35.155.49.147:\": \"0.0.8\",\n \"34.106.102.218:\": \"0.0.8\",\n \"34.133.197.230:\": \"0.0.9\",\n \"52.14.252.207:\": \"0.0.9\",\n // LOCAL NODE\n \"127.0.0.1:\": \"0.0.3\",\n // PREVIEW NET\n \"3.211.248.172:\": \"0.0.3\",\n \"35.231.208.148:\": \"0.0.3\",\n \"35.199.15.177:\": \"0.0.4\",\n \"3.133.213.146:\": \"0.0.4\",\n \"35.225.201.195:\": \"0.0.5\",\n \"52.15.105.130:\": \"0.0.5\",\n \"54.241.38.1:\": \"0.0.6\",\n \"35.247.109.135:\": \"0.0.6\",\n \"54.177.51.127:\": \"0.0.7\",\n \"35.235.65.51:\": \"0.0.7\",\n \"34.106.247.65:\": \"0.0.8\",\n \"35.83.89.171:\": \"0.0.8\",\n \"50.18.17.93:\": \"0.0.9\",\n \"34.125.23.49:\": \"0.0.9\",\n};\n\nexport const MirrorNetwork = {\n /**\n * @param {string} name\n * @returns {string[]}\n */\n fromName(name) {\n switch (name) {\n case \"mainnet\":\n return MirrorNetwork.MAINNET;\n\n case \"testnet\":\n return MirrorNetwork.TESTNET;\n\n case \"previewnet\":\n return MirrorNetwork.PREVIEWNET;\n\n case \"local-node\":\n return MirrorNetwork.LOCAL_NODE;\n\n default:\n throw new Error(`unknown network name: ${name}`);\n }\n },\n\n MAINNET: [\"mainnet-public.mirrornode.hedera.com:443\"],\n TESTNET: [\"testnet.mirrornode.hedera.com:443\"],\n PREVIEWNET: [\"previewnet.mirrornode.hedera.com:443\"],\n LOCAL_NODE: [\"127.0.0.1:5600\"],\n};\n\nexport const WebNetwork = {\n /**\n * @param {string} name\n * @returns {{[key: string]: (string | AccountId)}}\n */\n fromName(name) {\n switch (name) {\n case \"mainnet\":\n return WebNetwork.MAINNET;\n\n case \"testnet\":\n return WebNetwork.TESTNET;\n\n case \"previewnet\":\n return WebNetwork.PREVIEWNET;\n\n default:\n throw new Error(`unknown network name: ${name}`);\n }\n },\n\n MAINNET: MAINNET,\n TESTNET: WEB_TESTNET,\n PREVIEWNET: WEB_PREVIEWNET,\n};\n"],"names":["MAINNET","AccountId","WEB_TESTNET","WEB_PREVIEWNET","ALL_WEB_NETWORK_NODES","ALL_NETWORK_IPS","MirrorNetwork","TESTNET","PREVIEWNET","LOCAL_NODE","WebNetwork"],"mappings":"uCAIY,MAACA,EAAU,CACnB,6BAA8B,IAAIC,EAAU,GAC5C,iCAAkC,IAAIA,EAAU,GAChD,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,GAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,IAAIA,EAAU,IAC5C,6BAA8B,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AkB,SAClB,eAAgB,SAChB,gBAAiB,SACjB,iBAAkB,SAClB,gBAAiB,SACjB,kBAAmB,SACnB,kBAAmB,SACnB,iBAAkB,SAClB,eAAgB,SAChB,iBAAkB,SAClB,iBAAkB,SAClB,eAAgB,SAChB,gBAAiB,SACjB,kBAAmB,SACnB,iBAAkB,SAClB,iBAAkB,SAElB,gBAAiB,QACjB,iBAAkB,QAClB,cAAe,QACf,iBAAkB,QAClB,iBAAkB,QAClB,eAAgB,QAChB,iBAAkB,QAClB,gBAAiB,QACjB,eAAgB,QAChB,kBAAmB,QACnB,iBAAkB,QAClB,kBAAmB,QACnB,kBAAmB,QACnB,iBAAkB,QAElB,aAAc,QAEd,iBAAkB,QAClB,kBAAmB,QACnB,iBAAkB,QAClB,iBAAkB,QAClB,kBAAmB,QACnB,iBAAkB,QAClB,eAAgB,QAChB,kBAAmB,QACnB,iBAAkB,QAClB,gBAAiB,QACjB,iBAAkB,QAClB,gBAAiB,QACjB,eAAgB,QAChB,gBAAiB,SAGRC,EAAgB,CAwBzBN,QAAS,CAAC,4CACVO,QAAS,CAAC,qCACVC,WAAY,CAAC,wCACbC,WAAY,CAAC,mBAGJC,EAAa,CAqBtBV,QAASA,EACTO,QAASL,EACTM,WAAYL"}
|
|
@@ -305,6 +305,9 @@ class ContractCreateTransaction extends _Transaction.default {
|
|
|
305
305
|
setGas(gas) {
|
|
306
306
|
this._requireNotFrozen();
|
|
307
307
|
this._gas = gas instanceof _long.default ? gas : _long.default.fromValue(gas);
|
|
308
|
+
if (this._gas.lessThan(0)) {
|
|
309
|
+
throw new Error("Gas cannot be negative number");
|
|
310
|
+
}
|
|
308
311
|
return this;
|
|
309
312
|
}
|
|
310
313
|
|
|
@@ -431,6 +434,7 @@ class ContractCreateTransaction extends _Transaction.default {
|
|
|
431
434
|
setStakedAccountId(stakedAccountId) {
|
|
432
435
|
this._requireNotFrozen();
|
|
433
436
|
this._stakedAccountId = typeof stakedAccountId === "string" ? _AccountId.default.fromString(stakedAccountId) : stakedAccountId;
|
|
437
|
+
this._stakedNodeId = null;
|
|
434
438
|
return this;
|
|
435
439
|
}
|
|
436
440
|
|
|
@@ -448,6 +452,7 @@ class ContractCreateTransaction extends _Transaction.default {
|
|
|
448
452
|
setStakedNodeId(stakedNodeId) {
|
|
449
453
|
this._requireNotFrozen();
|
|
450
454
|
this._stakedNodeId = _long.default.fromValue(stakedNodeId);
|
|
455
|
+
this._stakedAccountId = null;
|
|
451
456
|
return this;
|
|
452
457
|
}
|
|
453
458
|
|