@xchainjs/xchain-thorchain 3.0.14 → 3.0.16

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 CHANGED
@@ -63,13 +63,13 @@ In order for this library to de/serialize proto3 structures, you can use the fol
63
63
 
64
64
  Alternatively, you can run the convenience script: `genMsgs.sh`, which will overwrite the proto/js files in types/proto. This should only be done and checked in if changes were made to the upstream Msg in the THORNode repo.
65
65
 
66
- ### Setting Headers for Nine Realms endpoints
66
+ ### Setting Headers for public endpoints
67
67
 
68
- If you plan on using the publically accessible endpoints provided by Nine Realms(listed below), ensure that you add a valid 'x-client-id' to all requests
68
+ If you plan on using the publicly accessible endpoints listed below, ensure that you add a valid 'x-client-id' to all requests
69
69
 
70
- - https://midgard.ninerealms.com
71
- - https://haskoin.ninerealms.com (BTC/BCH/LTC)
72
- - https://thornode.ninerealms.com
70
+ - https://gateway.liquify.com/chain/thorchain_midgard
71
+ - https://api.haskoin.com (BTC/BCH/LTC)
72
+ - https://gateway.liquify.com/chain/thorchain_api
73
73
 
74
74
  Example
75
75
 
package/lib/index.esm.js CHANGED
@@ -2,7 +2,7 @@ import { EnglishMnemonic, Bip39, Slip10, Slip10Curve, Secp256k1 } from '@cosmjs/
2
2
  import { toBase64, fromBase64 } from '@cosmjs/encoding';
3
3
  import { decodeTxRaw, DirectSecp256k1HdWallet, encodePubkey, makeAuthInfoBytes } from '@cosmjs/proto-signing';
4
4
  import { SigningStargateClient, AminoTypes } from '@cosmjs/stargate';
5
- import { Client as Client$1, bech32ToBase64, MsgTypes, makeClientPath, base64ToBech32 } from '@xchainjs/xchain-cosmos-sdk';
5
+ import { Client as Client$1, MsgTypes, bech32ToBase64, makeClientPath, base64ToBech32 } from '@xchainjs/xchain-cosmos-sdk';
6
6
  import { getSeed } from '@xchainjs/xchain-crypto';
7
7
  import { bech32 } from '@scure/base';
8
8
  import BigNumber from 'bignumber.js';
@@ -10,7 +10,7 @@ import { HDKey } from '@scure/bip32';
10
10
  import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx.js';
11
11
  import { createHash } from 'crypto';
12
12
  import * as secp from '@bitcoin-js/tiny-secp256k1-asmjs';
13
- import { assetToString, isSynthAsset, isSecuredAsset, AssetType, assetToBase, assetAmount, eqAsset, assetFromString, assetFromStringEx } from '@xchainjs/xchain-util';
13
+ import { isSynthAsset, assetToString, isSecuredAsset, AssetType, assetToBase, assetAmount, eqAsset, assetFromString, assetFromStringEx } from '@xchainjs/xchain-util';
14
14
  import { Network } from '@xchainjs/xchain-client';
15
15
  import * as minimal from 'protobufjs/minimal.js';
16
16
  import { Uint53 } from '@cosmjs/math';
@@ -3041,8 +3041,8 @@ var types = /*@__PURE__*/getDefaultExportFromCjs(MsgCompiledExports);
3041
3041
  const getDefaultClientUrls = () => {
3042
3042
  return {
3043
3043
  [Network.Testnet]: ['deprecated'],
3044
- [Network.Stagenet]: ['https://stagenet-rpc.ninerealms.com'],
3045
- [Network.Mainnet]: ['https://rpc.ninerealms.com'],
3044
+ [Network.Stagenet]: [],
3045
+ [Network.Mainnet]: ['https://gateway.liquify.com/chain/thorchain_rpc'],
3046
3046
  };
3047
3047
  };
3048
3048
  /**
@@ -3564,21 +3564,23 @@ class ClientKeystore extends Client {
3564
3564
  }
3565
3565
  transfer(params) {
3566
3566
  return __awaiter(this, void 0, void 0, function* () {
3567
- const sender = yield this.getAddressAsync(params.walletIndex || 0);
3568
- const { rawUnsignedTx } = yield this.prepareTx({
3569
- sender,
3570
- recipient: params.recipient,
3571
- asset: params.asset,
3572
- amount: params.amount,
3573
- memo: params.memo,
3574
- });
3575
- const unsignedTx = decodeTxRaw(fromBase64(rawUnsignedTx));
3576
- const signer = yield DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3577
- prefix: this.prefix,
3578
- hdPaths: [makeClientPath(this.getFullDerivationPath(params.walletIndex || 0))],
3579
- });
3580
- const tx = yield this.roundRobinSignAndBroadcastTx(sender, unsignedTx, signer);
3581
- return tx.transactionHash;
3567
+ return this.withTxLock(() => __awaiter(this, void 0, void 0, function* () {
3568
+ const sender = yield this.getAddressAsync(params.walletIndex || 0);
3569
+ const { rawUnsignedTx } = yield this.prepareTx({
3570
+ sender,
3571
+ recipient: params.recipient,
3572
+ asset: params.asset,
3573
+ amount: params.amount,
3574
+ memo: params.memo,
3575
+ });
3576
+ const unsignedTx = decodeTxRaw(fromBase64(rawUnsignedTx));
3577
+ const signer = yield DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3578
+ prefix: this.prefix,
3579
+ hdPaths: [makeClientPath(this.getFullDerivationPath(params.walletIndex || 0))],
3580
+ });
3581
+ const tx = yield this.roundRobinSignAndBroadcastTx(sender, unsignedTx, signer);
3582
+ return tx.transactionHash;
3583
+ }));
3582
3584
  });
3583
3585
  }
3584
3586
  /**
@@ -3596,15 +3598,17 @@ class ClientKeystore extends Client {
3596
3598
  */
3597
3599
  deposit(_a) {
3598
3600
  return __awaiter(this, arguments, void 0, function* ({ walletIndex = 0, asset = AssetRuneNative, amount, memo, gasLimit = new BigNumber(DEPOSIT_GAS_LIMIT_VALUE), }) {
3599
- // Get sender address
3600
- const sender = yield this.getAddressAsync(walletIndex);
3601
- // Create signer
3602
- const signer = yield DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3603
- prefix: this.prefix,
3604
- hdPaths: [makeClientPath(this.getFullDerivationPath(walletIndex || 0))],
3605
- });
3606
- const tx = yield this.roundRobinSignAndBroadcastDeposit(sender, signer, gasLimit, amount, memo, asset);
3607
- return tx.transactionHash;
3601
+ return this.withTxLock(() => __awaiter(this, void 0, void 0, function* () {
3602
+ // Get sender address
3603
+ const sender = yield this.getAddressAsync(walletIndex);
3604
+ // Create signer
3605
+ const signer = yield DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3606
+ prefix: this.prefix,
3607
+ hdPaths: [makeClientPath(this.getFullDerivationPath(walletIndex || 0))],
3608
+ });
3609
+ const tx = yield this.roundRobinSignAndBroadcastDeposit(sender, signer, gasLimit, amount, memo, asset);
3610
+ return tx.transactionHash;
3611
+ }));
3608
3612
  });
3609
3613
  }
3610
3614
  /**
package/lib/index.js CHANGED
@@ -3069,8 +3069,8 @@ var types = /*@__PURE__*/getDefaultExportFromCjs(MsgCompiledExports);
3069
3069
  const getDefaultClientUrls = () => {
3070
3070
  return {
3071
3071
  [xchainClient.Network.Testnet]: ['deprecated'],
3072
- [xchainClient.Network.Stagenet]: ['https://stagenet-rpc.ninerealms.com'],
3073
- [xchainClient.Network.Mainnet]: ['https://rpc.ninerealms.com'],
3072
+ [xchainClient.Network.Stagenet]: [],
3073
+ [xchainClient.Network.Mainnet]: ['https://gateway.liquify.com/chain/thorchain_rpc'],
3074
3074
  };
3075
3075
  };
3076
3076
  /**
@@ -3592,21 +3592,23 @@ class ClientKeystore extends Client {
3592
3592
  }
3593
3593
  transfer(params) {
3594
3594
  return __awaiter(this, void 0, void 0, function* () {
3595
- const sender = yield this.getAddressAsync(params.walletIndex || 0);
3596
- const { rawUnsignedTx } = yield this.prepareTx({
3597
- sender,
3598
- recipient: params.recipient,
3599
- asset: params.asset,
3600
- amount: params.amount,
3601
- memo: params.memo,
3602
- });
3603
- const unsignedTx = protoSigning.decodeTxRaw(encoding.fromBase64(rawUnsignedTx));
3604
- const signer = yield protoSigning.DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3605
- prefix: this.prefix,
3606
- hdPaths: [xchainCosmosSdk.makeClientPath(this.getFullDerivationPath(params.walletIndex || 0))],
3607
- });
3608
- const tx = yield this.roundRobinSignAndBroadcastTx(sender, unsignedTx, signer);
3609
- return tx.transactionHash;
3595
+ return this.withTxLock(() => __awaiter(this, void 0, void 0, function* () {
3596
+ const sender = yield this.getAddressAsync(params.walletIndex || 0);
3597
+ const { rawUnsignedTx } = yield this.prepareTx({
3598
+ sender,
3599
+ recipient: params.recipient,
3600
+ asset: params.asset,
3601
+ amount: params.amount,
3602
+ memo: params.memo,
3603
+ });
3604
+ const unsignedTx = protoSigning.decodeTxRaw(encoding.fromBase64(rawUnsignedTx));
3605
+ const signer = yield protoSigning.DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3606
+ prefix: this.prefix,
3607
+ hdPaths: [xchainCosmosSdk.makeClientPath(this.getFullDerivationPath(params.walletIndex || 0))],
3608
+ });
3609
+ const tx = yield this.roundRobinSignAndBroadcastTx(sender, unsignedTx, signer);
3610
+ return tx.transactionHash;
3611
+ }));
3610
3612
  });
3611
3613
  }
3612
3614
  /**
@@ -3624,15 +3626,17 @@ class ClientKeystore extends Client {
3624
3626
  */
3625
3627
  deposit(_a) {
3626
3628
  return __awaiter(this, arguments, void 0, function* ({ walletIndex = 0, asset = AssetRuneNative, amount, memo, gasLimit = new BigNumber__default.default(DEPOSIT_GAS_LIMIT_VALUE), }) {
3627
- // Get sender address
3628
- const sender = yield this.getAddressAsync(walletIndex);
3629
- // Create signer
3630
- const signer = yield protoSigning.DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3631
- prefix: this.prefix,
3632
- hdPaths: [xchainCosmosSdk.makeClientPath(this.getFullDerivationPath(walletIndex || 0))],
3633
- });
3634
- const tx = yield this.roundRobinSignAndBroadcastDeposit(sender, signer, gasLimit, amount, memo, asset);
3635
- return tx.transactionHash;
3629
+ return this.withTxLock(() => __awaiter(this, void 0, void 0, function* () {
3630
+ // Get sender address
3631
+ const sender = yield this.getAddressAsync(walletIndex);
3632
+ // Create signer
3633
+ const signer = yield protoSigning.DirectSecp256k1HdWallet.fromMnemonic(this.phrase, {
3634
+ prefix: this.prefix,
3635
+ hdPaths: [xchainCosmosSdk.makeClientPath(this.getFullDerivationPath(walletIndex || 0))],
3636
+ });
3637
+ const tx = yield this.roundRobinSignAndBroadcastDeposit(sender, signer, gasLimit, amount, memo, asset);
3638
+ return tx.transactionHash;
3639
+ }));
3636
3640
  });
3637
3641
  }
3638
3642
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xchainjs/xchain-thorchain",
3
- "version": "3.0.14",
3
+ "version": "3.0.16",
4
4
  "description": "Custom Thorchain client and utilities used by XChainJS clients",
5
5
  "keywords": [
6
6
  "THORChain",
@@ -45,12 +45,12 @@
45
45
  "@scure/base": "^1.2.6",
46
46
  "@scure/bip32": "^1.7.0",
47
47
  "@xchainjs/ledger-thorchain": "^0.3.1",
48
- "@xchainjs/xchain-client": "2.0.10",
49
- "@xchainjs/xchain-cosmos-sdk": "2.0.10",
48
+ "@xchainjs/xchain-client": "2.0.12",
49
+ "@xchainjs/xchain-cosmos-sdk": "2.0.12",
50
50
  "@xchainjs/xchain-crypto": "1.0.6",
51
- "@xchainjs/xchain-util": "2.0.5",
52
- "axios": "1.13.5",
53
- "bignumber.js": "^9.1.2",
51
+ "@xchainjs/xchain-util": "2.0.7",
52
+ "axios": "1.15.0",
53
+ "bignumber.js": "^11.0.0",
54
54
  "cosmjs-types": "0.9.0",
55
55
  "protobufjs": "6.11.4"
56
56
  },