@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 +5 -5
- package/lib/index.esm.js +32 -28
- package/lib/index.js +30 -26
- package/package.json +6 -6
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
|
|
66
|
+
### Setting Headers for public endpoints
|
|
67
67
|
|
|
68
|
-
If you plan on using the
|
|
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://
|
|
71
|
-
- https://haskoin.
|
|
72
|
-
- https://
|
|
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,
|
|
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 {
|
|
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]: [
|
|
3045
|
-
[Network.Mainnet]: ['https://
|
|
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
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
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
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
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]: [
|
|
3073
|
-
[xchainClient.Network.Mainnet]: ['https://
|
|
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
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
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
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
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.
|
|
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.
|
|
49
|
-
"@xchainjs/xchain-cosmos-sdk": "2.0.
|
|
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.
|
|
52
|
-
"axios": "1.
|
|
53
|
-
"bignumber.js": "^
|
|
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
|
},
|