@hiero-ledger/sdk 2.70.0 → 2.71.0
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/README.md +4 -4
- package/dist/umd.js +158 -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/client/addressbooks/mainnet.cjs +1 -1
- package/lib/client/addressbooks/mainnet.d.ts +1 -1
- package/lib/client/addressbooks/mainnet.js +1 -1
- package/lib/client/addressbooks/mainnet.js.map +1 -1
- package/lib/client/addressbooks/previewnet.cjs +1 -1
- package/lib/client/addressbooks/previewnet.d.ts +1 -1
- package/lib/client/addressbooks/previewnet.js +1 -1
- package/lib/client/addressbooks/previewnet.js.map +1 -1
- package/lib/client/addressbooks/testnet.cjs +1 -1
- package/lib/client/addressbooks/testnet.d.ts +1 -1
- package/lib/client/addressbooks/testnet.js +1 -1
- package/lib/client/addressbooks/testnet.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/ContractInfo.cjs +11 -2
- package/lib/contract/ContractInfo.d.ts +6 -0
- package/lib/contract/ContractInfo.js +1 -1
- package/lib/contract/ContractInfo.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/client/addressbooks/mainnet.js +1 -1
- package/src/client/addressbooks/previewnet.js +1 -1
- package/src/client/addressbooks/testnet.js +1 -1
- package/src/constants/ClientConstants.js +26 -8
- package/src/contract/ContractCreateTransaction.js +5 -3
- package/src/contract/ContractDeleteTransaction.js +34 -0
- package/src/contract/ContractInfo.js +16 -0
- package/src/contract/ContractUpdateTransaction.js +4 -1
- package/src/encoding/hex.js +20 -0
- package/src/native.js +1 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## Install
|
|
18
18
|
|
|
19
|
-
**NOTE**: v1 of the SDK is deprecated and support will be discontinued after October 2021. Please install the latest version 2.x or migrate from v1 to the latest 2.x version. You can reference the [migration documentation](
|
|
19
|
+
**NOTE**: v1 of the SDK is deprecated and support will be discontinued after October 2021. Please install the latest version 2.x or migrate from v1 to the latest 2.x version. You can reference the [migration documentation](./manual//MIGRATING_V1.md).
|
|
20
20
|
|
|
21
21
|
```
|
|
22
22
|
# with NPM
|
|
@@ -103,7 +103,7 @@ Then, rebuild the iOS project.
|
|
|
103
103
|
⚠️ ✅ Hiero Javascript SDK Version 2.59 and Below
|
|
104
104
|
For projects using SDK version 2.59 and below, Expo SDK Version 49 and below is supported, keep in mind that the SDK uses some functionalities provided from ethers/ethersproject and there is an issue using parts of ethers.js in this environment. A [shims](https://www.npmjs.com/package/@ethersproject/shims) package has to be installed and imported before importing the SDK in your project.
|
|
105
105
|
|
|
106
|
-
-
|
|
106
|
+
- Useful information: [here](https://github.com/ethers-io/ethers.js/discussions/3652) and [here](https://docs.ethers.org/v5/cookbook/react-native/)
|
|
107
107
|
|
|
108
108
|
```bash
|
|
109
109
|
npm install @ethersproject/shims
|
|
@@ -124,7 +124,7 @@ import {
|
|
|
124
124
|
|
|
125
125
|
The Hiero JavaScript SDK does not currently support the following:
|
|
126
126
|
|
|
127
|
-
-
|
|
127
|
+
- React Native Bare
|
|
128
128
|
|
|
129
129
|
## Usage
|
|
130
130
|
|
|
@@ -139,7 +139,7 @@ Every example can be executed using the following command from the root director
|
|
|
139
139
|
|
|
140
140
|
## Configuration
|
|
141
141
|
|
|
142
|
-
For detailed information on configuring the SDK, including environment variables and client settings, please refer to the [CONFIGURATION.md](CONFIGURATION.md) file.
|
|
142
|
+
For detailed information on configuring the SDK, including environment variables and client settings, please refer to the [CONFIGURATION.md](./manual/CONFIGURATION.md) file.
|
|
143
143
|
|
|
144
144
|
## Start tests
|
|
145
145
|
|
package/dist/umd.js
CHANGED
|
@@ -36822,6 +36822,26 @@
|
|
|
36822
36822
|
*/
|
|
36823
36823
|
function decode$2(text) {
|
|
36824
36824
|
const str = text.startsWith("0x") ? text.substring(2) : text;
|
|
36825
|
+
|
|
36826
|
+
if (str.length % 2 !== 0) {
|
|
36827
|
+
throw new Error(
|
|
36828
|
+
"Invalid hex string: Must have an even number of characters.",
|
|
36829
|
+
);
|
|
36830
|
+
}
|
|
36831
|
+
|
|
36832
|
+
if (/[^0-9a-fA-F]/.test(str)) {
|
|
36833
|
+
throw new Error(
|
|
36834
|
+
"Invalid hex string: Contains non-hexadecimal characters.",
|
|
36835
|
+
);
|
|
36836
|
+
}
|
|
36837
|
+
|
|
36838
|
+
const bytes = new Uint8Array(str.length / 2);
|
|
36839
|
+
|
|
36840
|
+
for (let i = 0; i < str.length; i += 2) {
|
|
36841
|
+
const byte = parseInt(str.substring(i, i + 2), 16);
|
|
36842
|
+
bytes[i / 2] = byte;
|
|
36843
|
+
}
|
|
36844
|
+
|
|
36825
36845
|
return Buffer.from(str, "hex");
|
|
36826
36846
|
}
|
|
36827
36847
|
|
|
@@ -64059,11 +64079,11 @@
|
|
|
64059
64079
|
case "3":
|
|
64060
64080
|
return LedgerId.LOCAL_NODE;
|
|
64061
64081
|
default: {
|
|
64062
|
-
|
|
64063
|
-
|
|
64064
|
-
throw new Error("Default reached for fromString");
|
|
64065
|
-
} else {
|
|
64082
|
+
try {
|
|
64083
|
+
let ledgerIdDecoded = decode$8(ledgerId);
|
|
64066
64084
|
return new LedgerId(ledgerIdDecoded);
|
|
64085
|
+
} catch (error) {
|
|
64086
|
+
throw new Error("Default reached for fromString");
|
|
64067
64087
|
}
|
|
64068
64088
|
}
|
|
64069
64089
|
}
|
|
@@ -71937,7 +71957,9 @@
|
|
|
71937
71957
|
setGas(gas) {
|
|
71938
71958
|
this._requireNotFrozen();
|
|
71939
71959
|
this._gas = gas instanceof Long ? gas : Long.fromValue(gas);
|
|
71940
|
-
|
|
71960
|
+
if (this._gas.lessThan(0)) {
|
|
71961
|
+
throw new Error("Gas cannot be negative number");
|
|
71962
|
+
}
|
|
71941
71963
|
return this;
|
|
71942
71964
|
}
|
|
71943
71965
|
|
|
@@ -72085,7 +72107,7 @@
|
|
|
72085
72107
|
typeof stakedAccountId === "string"
|
|
72086
72108
|
? AccountId.fromString(stakedAccountId)
|
|
72087
72109
|
: stakedAccountId;
|
|
72088
|
-
|
|
72110
|
+
this._stakedNodeId = null;
|
|
72089
72111
|
return this;
|
|
72090
72112
|
}
|
|
72091
72113
|
|
|
@@ -72103,7 +72125,7 @@
|
|
|
72103
72125
|
setStakedNodeId(stakedNodeId) {
|
|
72104
72126
|
this._requireNotFrozen();
|
|
72105
72127
|
this._stakedNodeId = Long.fromValue(stakedNodeId);
|
|
72106
|
-
|
|
72128
|
+
this._stakedAccountId = null;
|
|
72107
72129
|
return this;
|
|
72108
72130
|
}
|
|
72109
72131
|
|
|
@@ -72832,6 +72854,7 @@
|
|
|
72832
72854
|
* @param {ContractId | string} [props.contractId]
|
|
72833
72855
|
* @param {ContractId | string} [props.transferContractId]
|
|
72834
72856
|
* @param {AccountId | string} [props.transferAccountId]
|
|
72857
|
+
* @param {boolean} [props.permanentRemoval]
|
|
72835
72858
|
*/
|
|
72836
72859
|
constructor(props = {}) {
|
|
72837
72860
|
super();
|
|
@@ -72854,6 +72877,12 @@
|
|
|
72854
72877
|
*/
|
|
72855
72878
|
this._transferContractId = null;
|
|
72856
72879
|
|
|
72880
|
+
/**
|
|
72881
|
+
* @private
|
|
72882
|
+
* @type {boolean}
|
|
72883
|
+
*/
|
|
72884
|
+
this._permanentRemoval = false;
|
|
72885
|
+
|
|
72857
72886
|
if (props.contractId != null) {
|
|
72858
72887
|
this.setContractId(props.contractId);
|
|
72859
72888
|
}
|
|
@@ -72865,6 +72894,10 @@
|
|
|
72865
72894
|
if (props.transferContractId != null) {
|
|
72866
72895
|
this.setTransferContractId(props.transferContractId);
|
|
72867
72896
|
}
|
|
72897
|
+
|
|
72898
|
+
if (props.permanentRemoval != null) {
|
|
72899
|
+
this.setPermanentRemoval(props.permanentRemoval);
|
|
72900
|
+
}
|
|
72868
72901
|
}
|
|
72869
72902
|
|
|
72870
72903
|
/**
|
|
@@ -72915,6 +72948,7 @@
|
|
|
72915
72948
|
),
|
|
72916
72949
|
)
|
|
72917
72950
|
: undefined,
|
|
72951
|
+
permanentRemoval: contractDelete.permanentRemoval ?? false,
|
|
72918
72952
|
}),
|
|
72919
72953
|
transactions,
|
|
72920
72954
|
signedTransactions,
|
|
@@ -72966,6 +73000,7 @@
|
|
|
72966
73000
|
transferContractId instanceof ContractId
|
|
72967
73001
|
? transferContractId
|
|
72968
73002
|
: ContractId.fromString(transferContractId);
|
|
73003
|
+
this._transferAccountId = null;
|
|
72969
73004
|
|
|
72970
73005
|
return this;
|
|
72971
73006
|
}
|
|
@@ -72989,7 +73024,27 @@
|
|
|
72989
73024
|
transferAccountId instanceof AccountId
|
|
72990
73025
|
? transferAccountId
|
|
72991
73026
|
: AccountId.fromString(transferAccountId);
|
|
73027
|
+
this._transferContractId = null;
|
|
73028
|
+
|
|
73029
|
+
return this;
|
|
73030
|
+
}
|
|
73031
|
+
|
|
73032
|
+
/**
|
|
73033
|
+
* @returns {boolean}
|
|
73034
|
+
*/
|
|
73035
|
+
get permanentRemoval() {
|
|
73036
|
+
return this._permanentRemoval;
|
|
73037
|
+
}
|
|
72992
73038
|
|
|
73039
|
+
/**
|
|
73040
|
+
* Sets the permanent removal flag.
|
|
73041
|
+
*
|
|
73042
|
+
* @param {boolean} permanentRemoval
|
|
73043
|
+
* @returns {ContractDeleteTransaction}
|
|
73044
|
+
*/
|
|
73045
|
+
setPermanentRemoval(permanentRemoval) {
|
|
73046
|
+
this._requireNotFrozen();
|
|
73047
|
+
this._permanentRemoval = permanentRemoval;
|
|
72993
73048
|
return this;
|
|
72994
73049
|
}
|
|
72995
73050
|
|
|
@@ -73048,6 +73103,7 @@
|
|
|
73048
73103
|
this._transferContractId != null
|
|
73049
73104
|
? this._transferContractId._toProtobuf()
|
|
73050
73105
|
: null,
|
|
73106
|
+
permanentRemoval: this._permanentRemoval,
|
|
73051
73107
|
};
|
|
73052
73108
|
}
|
|
73053
73109
|
|
|
@@ -73404,6 +73460,7 @@
|
|
|
73404
73460
|
* @param {TokenRelationshipMap} props.tokenRelationships
|
|
73405
73461
|
* @param {LedgerId|null} props.ledgerId
|
|
73406
73462
|
* @param {?StakingInfo} props.stakingInfo
|
|
73463
|
+
* @param {Long} props.maxAutomaticTokenAssociations
|
|
73407
73464
|
*/
|
|
73408
73465
|
constructor(props) {
|
|
73409
73466
|
/**
|
|
@@ -73502,6 +73559,13 @@
|
|
|
73502
73559
|
*/
|
|
73503
73560
|
this.tokenRelationships = props.tokenRelationships;
|
|
73504
73561
|
|
|
73562
|
+
/**
|
|
73563
|
+
* The maximum number of automatic token associations allowed for this contract.
|
|
73564
|
+
* @readonly
|
|
73565
|
+
*/
|
|
73566
|
+
this.maxAutomaticTokenAssociations =
|
|
73567
|
+
props.maxAutomaticTokenAssociations;
|
|
73568
|
+
|
|
73505
73569
|
/**
|
|
73506
73570
|
* The ledger ID the response was returned from; please see <a href="https://github.com/hashgraph/hedera-improvement-proposal/blob/master/HIP/hip-198.md">HIP-198</a> for the network-specific IDs.
|
|
73507
73571
|
*/
|
|
@@ -73569,6 +73633,12 @@
|
|
|
73569
73633
|
info.stakingInfo != null
|
|
73570
73634
|
? StakingInfo._fromProtobuf(info.stakingInfo)
|
|
73571
73635
|
: null,
|
|
73636
|
+
maxAutomaticTokenAssociations:
|
|
73637
|
+
info.maxAutomaticTokenAssociations != null
|
|
73638
|
+
? Long.isLong(info.maxAutomaticTokenAssociations)
|
|
73639
|
+
? info.maxAutomaticTokenAssociations
|
|
73640
|
+
: Long.fromValue(info.maxAutomaticTokenAssociations)
|
|
73641
|
+
: Long.ZERO,
|
|
73572
73642
|
});
|
|
73573
73643
|
}
|
|
73574
73644
|
|
|
@@ -73605,6 +73675,8 @@
|
|
|
73605
73675
|
this.stakingInfo != null
|
|
73606
73676
|
? this.stakingInfo._toProtobuf()
|
|
73607
73677
|
: null,
|
|
73678
|
+
maxAutomaticTokenAssociations:
|
|
73679
|
+
this.maxAutomaticTokenAssociations.toNumber(),
|
|
73608
73680
|
};
|
|
73609
73681
|
}
|
|
73610
73682
|
|
|
@@ -74448,7 +74520,9 @@
|
|
|
74448
74520
|
: null,
|
|
74449
74521
|
autoRenewAccountId:
|
|
74450
74522
|
this._autoRenewAccountId != null
|
|
74451
|
-
? this._autoRenewAccountId.
|
|
74523
|
+
? this._autoRenewAccountId.toString() == "0.0.0"
|
|
74524
|
+
? libExports.proto.AccountID.create()
|
|
74525
|
+
: this._autoRenewAccountId._toProtobuf()
|
|
74452
74526
|
: null,
|
|
74453
74527
|
};
|
|
74454
74528
|
}
|
|
@@ -96134,7 +96208,7 @@
|
|
|
96134
96208
|
/**
|
|
96135
96209
|
* @augments {ManagedNetwork<Channel, Node, AccountId>}
|
|
96136
96210
|
*/
|
|
96137
|
-
|
|
96211
|
+
class Network extends ManagedNetwork {
|
|
96138
96212
|
/**
|
|
96139
96213
|
* @param {(address: string) => Channel} createNetworkChannel
|
|
96140
96214
|
*/
|
|
@@ -96418,7 +96492,7 @@
|
|
|
96418
96492
|
this.getNumberOfNodesForTransaction(),
|
|
96419
96493
|
).map((node) => node.accountId);
|
|
96420
96494
|
}
|
|
96421
|
-
}
|
|
96495
|
+
}
|
|
96422
96496
|
|
|
96423
96497
|
// SPDX-License-Identifier: Apache-2.0
|
|
96424
96498
|
|
|
@@ -96601,14 +96675,6 @@
|
|
|
96601
96675
|
"previewnet-node06-00-grpc.hedera.com:443": new AccountId(9),
|
|
96602
96676
|
};
|
|
96603
96677
|
|
|
96604
|
-
({
|
|
96605
|
-
"testnet-node00-00-grpc.hedera.com:443": new AccountId(3),
|
|
96606
|
-
});
|
|
96607
|
-
|
|
96608
|
-
({
|
|
96609
|
-
"previewnet-node00-00-grpc.hedera.com:443": new AccountId(3),
|
|
96610
|
-
});
|
|
96611
|
-
|
|
96612
96678
|
/**
|
|
96613
96679
|
* @type {Record<string, AccountId>}
|
|
96614
96680
|
*/
|
|
@@ -96625,6 +96691,12 @@
|
|
|
96625
96691
|
LOCAL_NODE: ["127.0.0.1:5600"],
|
|
96626
96692
|
};
|
|
96627
96693
|
|
|
96694
|
+
const WebNetwork = {
|
|
96695
|
+
MAINNET: MAINNET,
|
|
96696
|
+
TESTNET: WEB_TESTNET,
|
|
96697
|
+
PREVIEWNET: WEB_PREVIEWNET,
|
|
96698
|
+
};
|
|
96699
|
+
|
|
96628
96700
|
// SPDX-License-Identifier: Apache-2.0
|
|
96629
96701
|
|
|
96630
96702
|
|
|
@@ -97073,7 +97145,7 @@
|
|
|
97073
97145
|
* @internal
|
|
97074
97146
|
* @type {Network}
|
|
97075
97147
|
*/
|
|
97076
|
-
this._network = new Network
|
|
97148
|
+
this._network = new Network(this._createNetworkChannel());
|
|
97077
97149
|
|
|
97078
97150
|
/**
|
|
97079
97151
|
* @internal
|
|
@@ -97725,11 +97797,11 @@
|
|
|
97725
97797
|
|
|
97726
97798
|
/**
|
|
97727
97799
|
* Update the network address book.
|
|
97728
|
-
* @returns {Promise<
|
|
97800
|
+
* @returns {Promise<this>}
|
|
97729
97801
|
*/
|
|
97730
97802
|
async updateNetwork() {
|
|
97731
97803
|
if (this._isUpdatingNetwork) {
|
|
97732
|
-
return;
|
|
97804
|
+
return this;
|
|
97733
97805
|
}
|
|
97734
97806
|
|
|
97735
97807
|
this._isUpdatingNetwork = true;
|
|
@@ -97752,6 +97824,8 @@
|
|
|
97752
97824
|
} finally {
|
|
97753
97825
|
this._isUpdatingNetwork = false;
|
|
97754
97826
|
}
|
|
97827
|
+
|
|
97828
|
+
return this;
|
|
97755
97829
|
}
|
|
97756
97830
|
|
|
97757
97831
|
/**
|
|
@@ -97866,7 +97940,7 @@
|
|
|
97866
97940
|
|
|
97867
97941
|
const SDK_NAME = "hiero-sdk-js";
|
|
97868
97942
|
const SDK_VERSION =
|
|
97869
|
-
"2.
|
|
97943
|
+
"2.71.0" ;
|
|
97870
97944
|
|
|
97871
97945
|
// SPDX-License-Identifier: Apache-2.0
|
|
97872
97946
|
|
|
@@ -98309,12 +98383,6 @@
|
|
|
98309
98383
|
* @typedef {import("../account/AccountId.js").default} AccountId
|
|
98310
98384
|
*/
|
|
98311
98385
|
|
|
98312
|
-
const Network = {
|
|
98313
|
-
MAINNET: MAINNET,
|
|
98314
|
-
TESTNET: WEB_TESTNET,
|
|
98315
|
-
PREVIEWNET: WEB_PREVIEWNET,
|
|
98316
|
-
};
|
|
98317
|
-
|
|
98318
98386
|
/**
|
|
98319
98387
|
* Represents a client for interacting with the Hedera network over the web.
|
|
98320
98388
|
* The `WebClient` class extends the base `Client` class and provides methods
|
|
@@ -98333,19 +98401,19 @@
|
|
|
98333
98401
|
if (typeof props.network === "string") {
|
|
98334
98402
|
switch (props.network) {
|
|
98335
98403
|
case "mainnet":
|
|
98336
|
-
this.setNetwork(
|
|
98337
|
-
this.setMirrorNetwork(MirrorNetwork.MAINNET);
|
|
98404
|
+
this.setNetwork(WebNetwork.MAINNET);
|
|
98338
98405
|
this.setLedgerId(LedgerId.MAINNET);
|
|
98406
|
+
this.setMirrorNetwork(MirrorNetwork.MAINNET);
|
|
98339
98407
|
break;
|
|
98340
98408
|
|
|
98341
98409
|
case "testnet":
|
|
98342
|
-
this.setNetwork(
|
|
98410
|
+
this.setNetwork(WebNetwork.TESTNET);
|
|
98343
98411
|
this.setLedgerId(LedgerId.TESTNET);
|
|
98344
98412
|
this.setMirrorNetwork(MirrorNetwork.TESTNET);
|
|
98345
98413
|
break;
|
|
98346
98414
|
|
|
98347
98415
|
case "previewnet":
|
|
98348
|
-
this.setNetwork(
|
|
98416
|
+
this.setNetwork(WebNetwork.PREVIEWNET);
|
|
98349
98417
|
this.setLedgerId(LedgerId.PREVIEWNET);
|
|
98350
98418
|
this.setMirrorNetwork(MirrorNetwork.PREVIEWNET);
|
|
98351
98419
|
break;
|
|
@@ -98445,6 +98513,56 @@
|
|
|
98445
98513
|
});
|
|
98446
98514
|
}
|
|
98447
98515
|
|
|
98516
|
+
/**
|
|
98517
|
+
* Construct a Hedera client pre-configured for Mainnet access with network update.
|
|
98518
|
+
*
|
|
98519
|
+
* @returns {Promise<WebClient>}
|
|
98520
|
+
*/
|
|
98521
|
+
static async forMainnetAsync() {
|
|
98522
|
+
return new WebClient({
|
|
98523
|
+
network: "mainnet",
|
|
98524
|
+
}).updateNetwork();
|
|
98525
|
+
}
|
|
98526
|
+
|
|
98527
|
+
/**
|
|
98528
|
+
* Construct a Hedera client pre-configured for Testnet access with network update.
|
|
98529
|
+
*
|
|
98530
|
+
* @returns {Promise<WebClient>}
|
|
98531
|
+
*/
|
|
98532
|
+
static async forTestnetAsync() {
|
|
98533
|
+
return new WebClient({
|
|
98534
|
+
network: "testnet",
|
|
98535
|
+
}).updateNetwork();
|
|
98536
|
+
}
|
|
98537
|
+
|
|
98538
|
+
/**
|
|
98539
|
+
* Construct a Hedera client pre-configured for Previewnet access with network update.
|
|
98540
|
+
*
|
|
98541
|
+
* @returns {Promise<WebClient>}
|
|
98542
|
+
*/
|
|
98543
|
+
static async forPreviewnetAsync() {
|
|
98544
|
+
return new WebClient({
|
|
98545
|
+
network: "previewnet",
|
|
98546
|
+
}).updateNetwork();
|
|
98547
|
+
}
|
|
98548
|
+
|
|
98549
|
+
/**
|
|
98550
|
+
* Construct a client for a specific network with optional network update.
|
|
98551
|
+
* Updates network only if the network is not "local-node".
|
|
98552
|
+
*
|
|
98553
|
+
* @param {string} network
|
|
98554
|
+
* @returns {Promise<WebClient>}
|
|
98555
|
+
*/
|
|
98556
|
+
static async forNameAsync(network) {
|
|
98557
|
+
const client = new WebClient({ network });
|
|
98558
|
+
|
|
98559
|
+
if (network !== "local-node") {
|
|
98560
|
+
await client.updateNetwork();
|
|
98561
|
+
}
|
|
98562
|
+
|
|
98563
|
+
return client;
|
|
98564
|
+
}
|
|
98565
|
+
|
|
98448
98566
|
/**
|
|
98449
98567
|
* Construct a client configured to use mirror nodes.
|
|
98450
98568
|
* This will query the address book to get the network nodes.
|
|
@@ -98453,9 +98571,7 @@
|
|
|
98453
98571
|
* @returns {Promise<WebClient>}
|
|
98454
98572
|
*/
|
|
98455
98573
|
static async forMirrorNetwork(mirrorNetwork) {
|
|
98456
|
-
const client = new WebClient();
|
|
98457
|
-
|
|
98458
|
-
client.setMirrorNetwork(mirrorNetwork);
|
|
98574
|
+
const client = new WebClient({ mirrorNetwork: mirrorNetwork });
|
|
98459
98575
|
|
|
98460
98576
|
await client.updateNetwork();
|
|
98461
98577
|
|
|
@@ -98470,13 +98586,13 @@
|
|
|
98470
98586
|
if (typeof network === "string") {
|
|
98471
98587
|
switch (network) {
|
|
98472
98588
|
case "previewnet":
|
|
98473
|
-
this._network.setNetwork(
|
|
98589
|
+
this._network.setNetwork(WebNetwork.PREVIEWNET);
|
|
98474
98590
|
break;
|
|
98475
98591
|
case "testnet":
|
|
98476
|
-
this._network.setNetwork(
|
|
98592
|
+
this._network.setNetwork(WebNetwork.TESTNET);
|
|
98477
98593
|
break;
|
|
98478
98594
|
case "mainnet":
|
|
98479
|
-
this._network.setNetwork(
|
|
98595
|
+
this._network.setNetwork(WebNetwork.MAINNET);
|
|
98480
98596
|
}
|
|
98481
98597
|
} else {
|
|
98482
98598
|
this._network.setNetwork(network);
|
|
@@ -98514,11 +98630,11 @@
|
|
|
98514
98630
|
|
|
98515
98631
|
/**
|
|
98516
98632
|
* @override
|
|
98517
|
-
* @returns {Promise<
|
|
98633
|
+
* @returns {Promise<this>}
|
|
98518
98634
|
*/
|
|
98519
98635
|
async updateNetwork() {
|
|
98520
98636
|
if (this._isUpdatingNetwork) {
|
|
98521
|
-
return;
|
|
98637
|
+
return this;
|
|
98522
98638
|
}
|
|
98523
98639
|
|
|
98524
98640
|
this._isUpdatingNetwork = true;
|
|
@@ -98552,6 +98668,8 @@
|
|
|
98552
98668
|
} finally {
|
|
98553
98669
|
this._isUpdatingNetwork = false;
|
|
98554
98670
|
}
|
|
98671
|
+
|
|
98672
|
+
return this;
|
|
98555
98673
|
}
|
|
98556
98674
|
|
|
98557
98675
|
/**
|