@xchainjs/xchain-thorchain 0.22.0 → 0.23.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/CHANGELOG.md CHANGED
@@ -1,3 +1,31 @@
1
+ # v0.23.0 (2022-03-08)
2
+
3
+ ## Add
4
+
5
+ - Helpers `getChainId` + `getChainIds`
6
+
7
+ ## Breaking change
8
+
9
+ - `chainIds: ChainIds` is required to initialize `Client`
10
+
11
+ ## Fix
12
+
13
+ - Request fees from THORChain and use `defaultFees` in case of server errors only
14
+ - Fix `defaultFees` to be 0.02 RUNE
15
+
16
+ # v0.22.2 (2022-02-17)
17
+
18
+ ## Fix
19
+
20
+ - Request fees from THORChain and use `defaultFees` in case of server errors only
21
+ - Fix `defaultFees` to be 0.02 RUNE
22
+
23
+ # v0.22.1 (2022-02-16)
24
+
25
+ ## Fix
26
+
27
+ - Increase limit for `DEFAULT_GAS_VALUE` from 2000000 to 3000000 to accommodate recent increases in gas used that go above the old limit
28
+
1
29
  # v0.22.0 (2022-02-06)
2
30
 
3
31
  ## Add
package/README.md CHANGED
@@ -44,7 +44,9 @@ Rate limits: No
44
44
  import { Client } from '@xchainjs/xchain-thorchain'
45
45
 
46
46
  // Create a `Client`
47
- const client = new Client({ network: Network.Testnet, phrase: 'my secret phrase' })
47
+ // Note: `chainIds` are required
48
+ const chainIds = getChainIds(getDefaultClientUrl()) // instead of `getDefaultClientUrl` you can pass custom API endpoints
49
+ const client = new Client({ network: Network.Testnet, phrase: 'my secret phrase', chainIds })
48
50
 
49
51
  // get address
50
52
  const address = client.getAddress()
package/lib/client.d.ts CHANGED
@@ -232,7 +232,7 @@ declare class Client implements ThorchainClient, XChainClient {
232
232
  */
233
233
  transferOffline({ walletIndex, asset, amount, recipient, memo, from_rune_balance, from_asset_balance, from_account_number, from_sequence, }: TxOfflineParams): Promise<StdTx>;
234
234
  /**
235
- * Get the fees.
235
+ * Gets fees from Node
236
236
  *
237
237
  * @returns {Fees}
238
238
  */
package/lib/index.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Network, TxType, singleFee, FeeType } from '@xchainjs/xchain-client';
2
2
  import { CosmosSDKClient } from '@xchainjs/xchain-cosmos';
3
3
  import { validatePhrase } from '@xchainjs/xchain-crypto';
4
- import { assetToString, AssetRuneNative, isSynthAsset, assetFromString, baseAmount } from '@xchainjs/xchain-util';
4
+ import { assetToString, AssetRuneNative, isSynthAsset, assetFromString, baseAmount, assetToBase, assetAmount } from '@xchainjs/xchain-util';
5
5
  import axios from 'axios';
6
6
  import { AccAddress, Msg, codec } from 'cosmos-client';
7
7
  import { StdTx } from 'cosmos-client/x/auth';
@@ -115,7 +115,7 @@ var msgNativeTxFromJson = function (value) {
115
115
  };
116
116
 
117
117
  var DECIMAL = 8;
118
- var DEFAULT_GAS_VALUE = '2000000';
118
+ var DEFAULT_GAS_VALUE = '3000000';
119
119
  var DEPOSIT_GAS_VALUE = '500000000';
120
120
  var MAX_TX_COUNT = 100;
121
121
  /**
@@ -259,7 +259,7 @@ var getDepositTxDataFromLogs = function (logs, address) {
259
259
  * @returns {Fees} The default fee.
260
260
  */
261
261
  var getDefaultFees = function () {
262
- var fee = baseAmount(DEFAULT_GAS_VALUE, DECIMAL);
262
+ var fee = assetToBase(assetAmount(0.02 /* 0.02 RUNE */, DECIMAL));
263
263
  return singleFee(FeeType.FlatFee, fee);
264
264
  };
265
265
  /**
@@ -272,6 +272,42 @@ var getDefaultFees = function () {
272
272
  var getTxType = function (txData, encoding) {
273
273
  return Buffer.from(txData, encoding).toString().slice(4);
274
274
  };
275
+ /**
276
+ * Helper to get THORChain's chain id
277
+ * @param {string} nodeUrl THORNode url
278
+ */
279
+ var getChainId = function (nodeUrl) { return __awaiter(void 0, void 0, void 0, function () {
280
+ var data;
281
+ var _a;
282
+ return __generator(this, function (_b) {
283
+ switch (_b.label) {
284
+ case 0: return [4 /*yield*/, axios.get(nodeUrl + "/cosmos/base/tendermint/v1beta1/node_info")];
285
+ case 1:
286
+ data = (_b.sent()).data;
287
+ return [2 /*return*/, ((_a = data === null || data === void 0 ? void 0 : data.default_node_info) === null || _a === void 0 ? void 0 : _a.network) || Promise.reject('Could not parse chain id')];
288
+ }
289
+ });
290
+ }); };
291
+ /**
292
+ * Helper to get all THORChain's chain id
293
+ * @param {ClientUrl} client urls (use `getDefaultClientUrl()` if you don't need to use custom urls)
294
+ */
295
+ var getChainIds = function (client) { return __awaiter(void 0, void 0, void 0, function () {
296
+ return __generator(this, function (_a) {
297
+ return [2 /*return*/, Promise.all([
298
+ getChainId(client[Network.Testnet].node),
299
+ getChainId(client[Network.Stagenet].node),
300
+ getChainId(client[Network.Mainnet].node),
301
+ ]).then(function (_a) {
302
+ var testnetId = _a[0], stagenetId = _a[1], mainnetId = _a[2];
303
+ return ({
304
+ testnet: testnetId,
305
+ stagenet: stagenetId,
306
+ mainnet: mainnetId,
307
+ });
308
+ })];
309
+ });
310
+ }); };
275
311
  /**
276
312
  * Structure StdTx from MsgNativeTx.
277
313
  *
@@ -286,14 +322,13 @@ var getTxType = function (txData, encoding) {
286
322
  var buildDepositTx = function (_a) {
287
323
  var msgNativeTx = _a.msgNativeTx, nodeUrl = _a.nodeUrl, chainId = _a.chainId;
288
324
  return __awaiter(void 0, void 0, void 0, function () {
289
- var data, networkChainId, response, fee, unsignedStdTx;
325
+ var networkChainId, response, fee, unsignedStdTx;
290
326
  var _b, _c;
291
327
  return __generator(this, function (_d) {
292
328
  switch (_d.label) {
293
- case 0: return [4 /*yield*/, axios.get(nodeUrl + "/cosmos/base/tendermint/v1beta1/node_info")];
329
+ case 0: return [4 /*yield*/, getChainId(nodeUrl)];
294
330
  case 1:
295
- data = (_d.sent()).data;
296
- networkChainId = data.default_node_info.network;
331
+ networkChainId = _d.sent();
297
332
  if (!networkChainId || chainId !== networkChainId)
298
333
  throw new Error("Invalid network (asked: " + chainId + " / returned: " + networkChainId);
299
334
  return [4 /*yield*/, axios.post(nodeUrl + "/thorchain/deposit", {
@@ -469,17 +504,13 @@ var Client = /** @class */ (function () {
469
504
  * @throws {"Invalid phrase"} Thrown if the given phase is invalid.
470
505
  */
471
506
  function Client(_a) {
472
- var _b, _c;
507
+ var _b;
473
508
  var _this = this;
474
- var _d = _a.network, network = _d === void 0 ? Network.Testnet : _d, phrase = _a.phrase, clientUrl = _a.clientUrl, explorerUrls = _a.explorerUrls, _e = _a.rootDerivationPaths, rootDerivationPaths = _e === void 0 ? (_b = {},
509
+ var _c = _a.network, network = _c === void 0 ? Network.Testnet : _c, phrase = _a.phrase, clientUrl = _a.clientUrl, explorerUrls = _a.explorerUrls, _d = _a.rootDerivationPaths, rootDerivationPaths = _d === void 0 ? (_b = {},
475
510
  _b[Network.Mainnet] = "44'/931'/0'/0/",
476
511
  _b[Network.Stagenet] = "44'/931'/0'/0/",
477
512
  _b[Network.Testnet] = "44'/931'/0'/0/",
478
- _b) : _e, _f = _a.chainIds, chainIds = _f === void 0 ? (_c = {},
479
- _c[Network.Mainnet] = 'thorchain',
480
- _c[Network.Stagenet] = 'thorchain-stagenet',
481
- _c[Network.Testnet] = 'thorchain-v1',
482
- _c) : _f;
513
+ _b) : _d, chainIds = _a.chainIds;
483
514
  this.phrase = '';
484
515
  /**
485
516
  * Get transaction history of a given address with pagination options.
@@ -864,7 +895,9 @@ var Client = /** @class */ (function () {
864
895
  var assetInList = _a.asset;
865
896
  return assetToString(assetInList) === assetToString(asset);
866
897
  })[0]) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : baseAmount(0, DECIMAL);
867
- fee = baseAmount(DEFAULT_GAS_VALUE, DECIMAL);
898
+ return [4 /*yield*/, this.getFees()];
899
+ case 2:
900
+ fee = (_k.sent()).average;
868
901
  if (isAssetRuneNative(asset)) {
869
902
  // amount + fee < runeBalance
870
903
  if (runeBalance.lt(amount.plus(fee))) {
@@ -893,12 +926,12 @@ var Client = /** @class */ (function () {
893
926
  nodeUrl: this.getClientUrl().node,
894
927
  chainId: this.getChainId(),
895
928
  })];
896
- case 2:
929
+ case 3:
897
930
  unsignedStdTx = _k.sent();
898
931
  privateKey = this.getPrivKey(walletIndex);
899
932
  accAddress = AccAddress.fromBech32(signer);
900
933
  return [4 /*yield*/, this.cosmosClient.signAndBroadcast(unsignedStdTx, privateKey, accAddress)];
901
- case 3: return [2 /*return*/, (_g = (_f = (_k.sent())) === null || _f === void 0 ? void 0 : _f.txhash) !== null && _g !== void 0 ? _g : ''];
934
+ case 4: return [2 /*return*/, (_g = (_f = (_k.sent())) === null || _f === void 0 ? void 0 : _f.txhash) !== null && _g !== void 0 ? _g : ''];
902
935
  }
903
936
  });
904
937
  });
@@ -1017,18 +1050,35 @@ var Client = /** @class */ (function () {
1017
1050
  });
1018
1051
  };
1019
1052
  /**
1020
- * Get the fees.
1053
+ * Gets fees from Node
1021
1054
  *
1022
1055
  * @returns {Fees}
1023
1056
  */
1024
1057
  Client.prototype.getFees = function () {
1025
1058
  return __awaiter(this, void 0, void 0, function () {
1026
- return __generator(this, function (_a) {
1027
- return [2 /*return*/, getDefaultFees()];
1059
+ var fee, _a;
1060
+ return __generator(this, function (_b) {
1061
+ switch (_b.label) {
1062
+ case 0:
1063
+ _b.trys.push([0, 2, , 3]);
1064
+ return [4 /*yield*/, axios.get(this.getClientUrl().node + "/thorchain/constants")
1065
+ // validate data
1066
+ ];
1067
+ case 1:
1068
+ fee = (_b.sent()).data.int_64_values.NativeTransactionFee;
1069
+ // validate data
1070
+ if (!fee || isNaN(fee) || fee < 0)
1071
+ throw Error("Invalid fee: " + fee.toString());
1072
+ return [2 /*return*/, singleFee(FeeType.FlatFee, baseAmount(fee))];
1073
+ case 2:
1074
+ _a = _b.sent();
1075
+ return [2 /*return*/, getDefaultFees()];
1076
+ case 3: return [2 /*return*/];
1077
+ }
1028
1078
  });
1029
1079
  });
1030
1080
  };
1031
1081
  return Client;
1032
1082
  }());
1033
1083
 
1034
- export { Client, DECIMAL, DEFAULT_GAS_VALUE, DEPOSIT_GAS_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, getBalance, getDefaultClientUrl, getDefaultExplorerUrls, getDefaultFees, getDenom, getDepositTxDataFromLogs, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getTxType, isAssetRuneNative, isBroadcastSuccess, isMsgMultiSend, isMsgSend, msgNativeTxFromJson, registerCodecs };
1084
+ export { Client, DECIMAL, DEFAULT_GAS_VALUE, DEPOSIT_GAS_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, getBalance, getChainId, getChainIds, getDefaultClientUrl, getDefaultExplorerUrls, getDefaultFees, getDenom, getDepositTxDataFromLogs, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getTxType, isAssetRuneNative, isBroadcastSuccess, isMsgMultiSend, isMsgSend, msgNativeTxFromJson, registerCodecs };
package/lib/index.js CHANGED
@@ -123,7 +123,7 @@ var msgNativeTxFromJson = function (value) {
123
123
  };
124
124
 
125
125
  var DECIMAL = 8;
126
- var DEFAULT_GAS_VALUE = '2000000';
126
+ var DEFAULT_GAS_VALUE = '3000000';
127
127
  var DEPOSIT_GAS_VALUE = '500000000';
128
128
  var MAX_TX_COUNT = 100;
129
129
  /**
@@ -267,7 +267,7 @@ var getDepositTxDataFromLogs = function (logs, address) {
267
267
  * @returns {Fees} The default fee.
268
268
  */
269
269
  var getDefaultFees = function () {
270
- var fee = xchainUtil.baseAmount(DEFAULT_GAS_VALUE, DECIMAL);
270
+ var fee = xchainUtil.assetToBase(xchainUtil.assetAmount(0.02 /* 0.02 RUNE */, DECIMAL));
271
271
  return xchainClient.singleFee(xchainClient.FeeType.FlatFee, fee);
272
272
  };
273
273
  /**
@@ -280,6 +280,42 @@ var getDefaultFees = function () {
280
280
  var getTxType = function (txData, encoding) {
281
281
  return Buffer.from(txData, encoding).toString().slice(4);
282
282
  };
283
+ /**
284
+ * Helper to get THORChain's chain id
285
+ * @param {string} nodeUrl THORNode url
286
+ */
287
+ var getChainId = function (nodeUrl) { return __awaiter(void 0, void 0, void 0, function () {
288
+ var data;
289
+ var _a;
290
+ return __generator(this, function (_b) {
291
+ switch (_b.label) {
292
+ case 0: return [4 /*yield*/, axios__default['default'].get(nodeUrl + "/cosmos/base/tendermint/v1beta1/node_info")];
293
+ case 1:
294
+ data = (_b.sent()).data;
295
+ return [2 /*return*/, ((_a = data === null || data === void 0 ? void 0 : data.default_node_info) === null || _a === void 0 ? void 0 : _a.network) || Promise.reject('Could not parse chain id')];
296
+ }
297
+ });
298
+ }); };
299
+ /**
300
+ * Helper to get all THORChain's chain id
301
+ * @param {ClientUrl} client urls (use `getDefaultClientUrl()` if you don't need to use custom urls)
302
+ */
303
+ var getChainIds = function (client) { return __awaiter(void 0, void 0, void 0, function () {
304
+ return __generator(this, function (_a) {
305
+ return [2 /*return*/, Promise.all([
306
+ getChainId(client[xchainClient.Network.Testnet].node),
307
+ getChainId(client[xchainClient.Network.Stagenet].node),
308
+ getChainId(client[xchainClient.Network.Mainnet].node),
309
+ ]).then(function (_a) {
310
+ var testnetId = _a[0], stagenetId = _a[1], mainnetId = _a[2];
311
+ return ({
312
+ testnet: testnetId,
313
+ stagenet: stagenetId,
314
+ mainnet: mainnetId,
315
+ });
316
+ })];
317
+ });
318
+ }); };
283
319
  /**
284
320
  * Structure StdTx from MsgNativeTx.
285
321
  *
@@ -294,14 +330,13 @@ var getTxType = function (txData, encoding) {
294
330
  var buildDepositTx = function (_a) {
295
331
  var msgNativeTx = _a.msgNativeTx, nodeUrl = _a.nodeUrl, chainId = _a.chainId;
296
332
  return __awaiter(void 0, void 0, void 0, function () {
297
- var data, networkChainId, response, fee, unsignedStdTx;
333
+ var networkChainId, response, fee, unsignedStdTx;
298
334
  var _b, _c;
299
335
  return __generator(this, function (_d) {
300
336
  switch (_d.label) {
301
- case 0: return [4 /*yield*/, axios__default['default'].get(nodeUrl + "/cosmos/base/tendermint/v1beta1/node_info")];
337
+ case 0: return [4 /*yield*/, getChainId(nodeUrl)];
302
338
  case 1:
303
- data = (_d.sent()).data;
304
- networkChainId = data.default_node_info.network;
339
+ networkChainId = _d.sent();
305
340
  if (!networkChainId || chainId !== networkChainId)
306
341
  throw new Error("Invalid network (asked: " + chainId + " / returned: " + networkChainId);
307
342
  return [4 /*yield*/, axios__default['default'].post(nodeUrl + "/thorchain/deposit", {
@@ -477,17 +512,13 @@ var Client = /** @class */ (function () {
477
512
  * @throws {"Invalid phrase"} Thrown if the given phase is invalid.
478
513
  */
479
514
  function Client(_a) {
480
- var _b, _c;
515
+ var _b;
481
516
  var _this = this;
482
- var _d = _a.network, network = _d === void 0 ? xchainClient.Network.Testnet : _d, phrase = _a.phrase, clientUrl = _a.clientUrl, explorerUrls = _a.explorerUrls, _e = _a.rootDerivationPaths, rootDerivationPaths = _e === void 0 ? (_b = {},
517
+ var _c = _a.network, network = _c === void 0 ? xchainClient.Network.Testnet : _c, phrase = _a.phrase, clientUrl = _a.clientUrl, explorerUrls = _a.explorerUrls, _d = _a.rootDerivationPaths, rootDerivationPaths = _d === void 0 ? (_b = {},
483
518
  _b[xchainClient.Network.Mainnet] = "44'/931'/0'/0/",
484
519
  _b[xchainClient.Network.Stagenet] = "44'/931'/0'/0/",
485
520
  _b[xchainClient.Network.Testnet] = "44'/931'/0'/0/",
486
- _b) : _e, _f = _a.chainIds, chainIds = _f === void 0 ? (_c = {},
487
- _c[xchainClient.Network.Mainnet] = 'thorchain',
488
- _c[xchainClient.Network.Stagenet] = 'thorchain-stagenet',
489
- _c[xchainClient.Network.Testnet] = 'thorchain-v1',
490
- _c) : _f;
521
+ _b) : _d, chainIds = _a.chainIds;
491
522
  this.phrase = '';
492
523
  /**
493
524
  * Get transaction history of a given address with pagination options.
@@ -872,7 +903,9 @@ var Client = /** @class */ (function () {
872
903
  var assetInList = _a.asset;
873
904
  return xchainUtil.assetToString(assetInList) === xchainUtil.assetToString(asset);
874
905
  })[0]) === null || _d === void 0 ? void 0 : _d.amount) !== null && _e !== void 0 ? _e : xchainUtil.baseAmount(0, DECIMAL);
875
- fee = xchainUtil.baseAmount(DEFAULT_GAS_VALUE, DECIMAL);
906
+ return [4 /*yield*/, this.getFees()];
907
+ case 2:
908
+ fee = (_k.sent()).average;
876
909
  if (isAssetRuneNative(asset)) {
877
910
  // amount + fee < runeBalance
878
911
  if (runeBalance.lt(amount.plus(fee))) {
@@ -901,12 +934,12 @@ var Client = /** @class */ (function () {
901
934
  nodeUrl: this.getClientUrl().node,
902
935
  chainId: this.getChainId(),
903
936
  })];
904
- case 2:
937
+ case 3:
905
938
  unsignedStdTx = _k.sent();
906
939
  privateKey = this.getPrivKey(walletIndex);
907
940
  accAddress = cosmosClient.AccAddress.fromBech32(signer);
908
941
  return [4 /*yield*/, this.cosmosClient.signAndBroadcast(unsignedStdTx, privateKey, accAddress)];
909
- case 3: return [2 /*return*/, (_g = (_f = (_k.sent())) === null || _f === void 0 ? void 0 : _f.txhash) !== null && _g !== void 0 ? _g : ''];
942
+ case 4: return [2 /*return*/, (_g = (_f = (_k.sent())) === null || _f === void 0 ? void 0 : _f.txhash) !== null && _g !== void 0 ? _g : ''];
910
943
  }
911
944
  });
912
945
  });
@@ -1025,14 +1058,31 @@ var Client = /** @class */ (function () {
1025
1058
  });
1026
1059
  };
1027
1060
  /**
1028
- * Get the fees.
1061
+ * Gets fees from Node
1029
1062
  *
1030
1063
  * @returns {Fees}
1031
1064
  */
1032
1065
  Client.prototype.getFees = function () {
1033
1066
  return __awaiter(this, void 0, void 0, function () {
1034
- return __generator(this, function (_a) {
1035
- return [2 /*return*/, getDefaultFees()];
1067
+ var fee, _a;
1068
+ return __generator(this, function (_b) {
1069
+ switch (_b.label) {
1070
+ case 0:
1071
+ _b.trys.push([0, 2, , 3]);
1072
+ return [4 /*yield*/, axios__default['default'].get(this.getClientUrl().node + "/thorchain/constants")
1073
+ // validate data
1074
+ ];
1075
+ case 1:
1076
+ fee = (_b.sent()).data.int_64_values.NativeTransactionFee;
1077
+ // validate data
1078
+ if (!fee || isNaN(fee) || fee < 0)
1079
+ throw Error("Invalid fee: " + fee.toString());
1080
+ return [2 /*return*/, xchainClient.singleFee(xchainClient.FeeType.FlatFee, xchainUtil.baseAmount(fee))];
1081
+ case 2:
1082
+ _a = _b.sent();
1083
+ return [2 /*return*/, getDefaultFees()];
1084
+ case 3: return [2 /*return*/];
1085
+ }
1036
1086
  });
1037
1087
  });
1038
1088
  };
@@ -1048,6 +1098,8 @@ exports.MsgNativeTx = MsgNativeTx;
1048
1098
  exports.assetFromDenom = assetFromDenom;
1049
1099
  exports.buildDepositTx = buildDepositTx;
1050
1100
  exports.getBalance = getBalance;
1101
+ exports.getChainId = getChainId;
1102
+ exports.getChainIds = getChainIds;
1051
1103
  exports.getDefaultClientUrl = getDefaultClientUrl;
1052
1104
  exports.getDefaultExplorerUrls = getDefaultExplorerUrls;
1053
1105
  exports.getDefaultFees = getDefaultFees;
@@ -16,7 +16,7 @@ export declare type ChainIds = Record<Network, ChainId>;
16
16
  export declare type ThorchainClientParams = {
17
17
  clientUrl?: ClientUrl;
18
18
  explorerUrls?: ExplorerUrls;
19
- chainIds?: ChainIds;
19
+ chainIds: ChainIds;
20
20
  };
21
21
  export declare type DepositParam = {
22
22
  walletIndex?: number;
@@ -38,3 +38,20 @@ export declare type TxOfflineParams = TxParams & {
38
38
  from_account_number: string;
39
39
  from_sequence: string;
40
40
  };
41
+ /**
42
+ * Response from `thorchain/constants` endpoint
43
+ */
44
+ export declare type ThorchainConstantsResponse = {
45
+ int_64_values: {
46
+ NativeTransactionFee: number;
47
+ };
48
+ };
49
+ /**
50
+ * Response of `/cosmos/base/tendermint/v1beta1/node_info`
51
+ * Note: We are interested in `network` (aka chain id) only
52
+ */
53
+ export declare type NodeInfoResponse = {
54
+ default_node_info: {
55
+ network: string;
56
+ };
57
+ };
package/lib/util.d.ts CHANGED
@@ -4,10 +4,10 @@ import { Asset } from '@xchainjs/xchain-util';
4
4
  import { Msg } from 'cosmos-client';
5
5
  import { StdTx } from 'cosmos-client/x/auth';
6
6
  import { MsgMultiSend, MsgSend } from 'cosmos-client/x/bank';
7
- import { ChainId, ClientUrl, ExplorerUrls, TxData } from './types';
7
+ import { ChainId, ChainIds, ClientUrl, ExplorerUrls, TxData } from './types';
8
8
  import { MsgNativeTx } from './types/messages';
9
9
  export declare const DECIMAL = 8;
10
- export declare const DEFAULT_GAS_VALUE = "2000000";
10
+ export declare const DEFAULT_GAS_VALUE = "3000000";
11
11
  export declare const DEPOSIT_GAS_VALUE = "500000000";
12
12
  export declare const MAX_TX_COUNT = 100;
13
13
  /**
@@ -88,6 +88,16 @@ export declare const getDefaultFees: () => Fees;
88
88
  * @returns {string} the transaction type.
89
89
  */
90
90
  export declare const getTxType: (txData: string, encoding: 'base64' | 'hex') => string;
91
+ /**
92
+ * Helper to get THORChain's chain id
93
+ * @param {string} nodeUrl THORNode url
94
+ */
95
+ export declare const getChainId: (nodeUrl: string) => Promise<ChainId>;
96
+ /**
97
+ * Helper to get all THORChain's chain id
98
+ * @param {ClientUrl} client urls (use `getDefaultClientUrl()` if you don't need to use custom urls)
99
+ */
100
+ export declare const getChainIds: (client: ClientUrl) => Promise<ChainIds>;
91
101
  /**
92
102
  * Structure StdTx from MsgNativeTx.
93
103
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "Custom Thorchain client and utilities used by XChainJS clients",
5
5
  "keywords": [
6
6
  "THORChain",