@xchainjs/xchain-thorchain 3.0.14 → 3.0.15
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/lib/index.esm.js +30 -26
- package/lib/index.js +28 -24
- package/package.json +5 -5
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';
|
|
@@ -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
|
@@ -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.15",
|
|
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.11",
|
|
49
|
+
"@xchainjs/xchain-cosmos-sdk": "2.0.11",
|
|
50
50
|
"@xchainjs/xchain-crypto": "1.0.6",
|
|
51
|
-
"@xchainjs/xchain-util": "2.0.
|
|
51
|
+
"@xchainjs/xchain-util": "2.0.6",
|
|
52
52
|
"axios": "1.13.5",
|
|
53
|
-
"bignumber.js": "^
|
|
53
|
+
"bignumber.js": "^10.0.1",
|
|
54
54
|
"cosmjs-types": "0.9.0",
|
|
55
55
|
"protobufjs": "6.11.4"
|
|
56
56
|
},
|