@xchainjs/xchain-thorchain 3.0.11 → 3.0.13
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 +8 -2
- package/lib/index.esm.js +6 -6
- package/lib/index.js +15 -15
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -4,13 +4,19 @@ Thorchain Module for XChainJS Clients
|
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
|
-
```
|
|
7
|
+
```sh
|
|
8
8
|
yarn add @xchainjs/xchain-thorchain
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
or
|
|
12
12
|
|
|
13
|
+
```sh
|
|
14
|
+
npm install @xchainjs/xchain-thorchain
|
|
13
15
|
```
|
|
16
|
+
|
|
17
|
+
Following peer dependencies have to be installed into your project. These are not included in `@xchainjs/xchain-thorchain`.
|
|
18
|
+
|
|
19
|
+
```sh
|
|
14
20
|
yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util @xchainjs/xchain-cosmos axios @cosmos-client/core bech32-buffer
|
|
15
21
|
```
|
|
16
22
|
|
package/lib/index.esm.js
CHANGED
|
@@ -7,16 +7,16 @@ import { getSeed } from '@xchainjs/xchain-crypto';
|
|
|
7
7
|
import { bech32 } from '@scure/base';
|
|
8
8
|
import BigNumber from 'bignumber.js';
|
|
9
9
|
import { HDKey } from '@scure/bip32';
|
|
10
|
-
import { TxRaw } from 'cosmjs-types/cosmos/tx/v1beta1/tx';
|
|
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
13
|
import { assetToString, isSynthAsset, isSecuredAsset, AssetType, assetToBase, assetAmount, eqAsset, assetFromString, assetFromStringEx } from '@xchainjs/xchain-util';
|
|
14
14
|
import { Network } from '@xchainjs/xchain-client';
|
|
15
|
-
import * as minimal from 'protobufjs/minimal';
|
|
15
|
+
import * as minimal from 'protobufjs/minimal.js';
|
|
16
16
|
import { Uint53 } from '@cosmjs/math';
|
|
17
17
|
import axios from 'axios';
|
|
18
18
|
import THORChainApp, { extractSignatureFromTLV } from '@xchainjs/ledger-thorchain';
|
|
19
|
-
import { SignMode } from 'cosmjs-types/cosmos/tx/signing/v1beta1/signing';
|
|
19
|
+
import { SignMode } from 'cosmjs-types/cosmos/tx/signing/v1beta1/signing.js';
|
|
20
20
|
|
|
21
21
|
/******************************************************************************
|
|
22
22
|
Copyright (c) Microsoft Corporation.
|
|
@@ -3646,7 +3646,7 @@ class ClientKeystore extends Client {
|
|
|
3646
3646
|
try {
|
|
3647
3647
|
return createHash('rmd160').update(sha256Hash).digest();
|
|
3648
3648
|
}
|
|
3649
|
-
catch (
|
|
3649
|
+
catch (_err) {
|
|
3650
3650
|
return createHash('ripemd160').update(sha256Hash).digest();
|
|
3651
3651
|
}
|
|
3652
3652
|
}
|
|
@@ -3852,7 +3852,7 @@ class ClientLedger extends Client {
|
|
|
3852
3852
|
throw Error(`Can not sign deposit transaction. Return code ${returnCode}. Error: ${errorMessage}`);
|
|
3853
3853
|
const aminoTypes = this.getProtocolAminoMessages();
|
|
3854
3854
|
const rawTx = TxRaw.fromPartial({
|
|
3855
|
-
bodyBytes:
|
|
3855
|
+
bodyBytes: this.registry.encodeTxBody({
|
|
3856
3856
|
memo,
|
|
3857
3857
|
messages: msgs.map((msg) => aminoTypes.fromAmino(msg)),
|
|
3858
3858
|
}),
|
|
@@ -3919,7 +3919,7 @@ class ClientLedger extends Client {
|
|
|
3919
3919
|
throw Error(`Can not sign transfer transaction. Return code ${returnCode}. Error: ${errorMessage}`);
|
|
3920
3920
|
const aminoTypes = this.getProtocolAminoMessages();
|
|
3921
3921
|
const rawTx = TxRaw.fromPartial({
|
|
3922
|
-
bodyBytes:
|
|
3922
|
+
bodyBytes: this.registry.encodeTxBody({
|
|
3923
3923
|
messages: msgs.map((msg) => aminoTypes.fromAmino(msg)),
|
|
3924
3924
|
memo: params.memo,
|
|
3925
3925
|
}),
|
package/lib/index.js
CHANGED
|
@@ -9,16 +9,16 @@ var xchainCrypto = require('@xchainjs/xchain-crypto');
|
|
|
9
9
|
var base = require('@scure/base');
|
|
10
10
|
var BigNumber = require('bignumber.js');
|
|
11
11
|
var bip32 = require('@scure/bip32');
|
|
12
|
-
var
|
|
12
|
+
var tx_js = require('cosmjs-types/cosmos/tx/v1beta1/tx.js');
|
|
13
13
|
var crypto = require('crypto');
|
|
14
14
|
var secp = require('@bitcoin-js/tiny-secp256k1-asmjs');
|
|
15
15
|
var xchainUtil = require('@xchainjs/xchain-util');
|
|
16
16
|
var xchainClient = require('@xchainjs/xchain-client');
|
|
17
|
-
var minimal = require('protobufjs/minimal');
|
|
17
|
+
var minimal = require('protobufjs/minimal.js');
|
|
18
18
|
var math = require('@cosmjs/math');
|
|
19
19
|
var axios = require('axios');
|
|
20
20
|
var THORChainApp = require('@xchainjs/ledger-thorchain');
|
|
21
|
-
var
|
|
21
|
+
var signing_js = require('cosmjs-types/cosmos/tx/signing/v1beta1/signing.js');
|
|
22
22
|
|
|
23
23
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
24
24
|
|
|
@@ -3472,11 +3472,11 @@ class Client extends xchainCosmosSdk.Client {
|
|
|
3472
3472
|
},
|
|
3473
3473
|
};
|
|
3474
3474
|
// Encode transaction body
|
|
3475
|
-
const rawTx =
|
|
3475
|
+
const rawTx = tx_js.TxRaw.fromPartial({
|
|
3476
3476
|
bodyBytes: this.registry.encode(txBody),
|
|
3477
3477
|
});
|
|
3478
3478
|
// Return raw unsigned transaction
|
|
3479
|
-
return { rawUnsignedTx: encoding.toBase64(
|
|
3479
|
+
return { rawUnsignedTx: encoding.toBase64(tx_js.TxRaw.encode(rawTx).finish()) };
|
|
3480
3480
|
});
|
|
3481
3481
|
}
|
|
3482
3482
|
/**
|
|
@@ -3661,7 +3661,7 @@ class ClientKeystore extends Client {
|
|
|
3661
3661
|
});
|
|
3662
3662
|
const rawTx = yield this.roundRobinSign(sender, unsignedTx, signer, gasLimit);
|
|
3663
3663
|
// Return encoded signed transaction
|
|
3664
|
-
return encoding.toBase64(
|
|
3664
|
+
return encoding.toBase64(tx_js.TxRaw.encode(rawTx).finish());
|
|
3665
3665
|
});
|
|
3666
3666
|
}
|
|
3667
3667
|
/**
|
|
@@ -3674,7 +3674,7 @@ class ClientKeystore extends Client {
|
|
|
3674
3674
|
try {
|
|
3675
3675
|
return crypto.createHash('rmd160').update(sha256Hash).digest();
|
|
3676
3676
|
}
|
|
3677
|
-
catch (
|
|
3677
|
+
catch (_err) {
|
|
3678
3678
|
return crypto.createHash('ripemd160').update(sha256Hash).digest();
|
|
3679
3679
|
}
|
|
3680
3680
|
}
|
|
@@ -3879,8 +3879,8 @@ class ClientLedger extends Client {
|
|
|
3879
3879
|
if (!signature)
|
|
3880
3880
|
throw Error(`Can not sign deposit transaction. Return code ${returnCode}. Error: ${errorMessage}`);
|
|
3881
3881
|
const aminoTypes = this.getProtocolAminoMessages();
|
|
3882
|
-
const rawTx =
|
|
3883
|
-
bodyBytes:
|
|
3882
|
+
const rawTx = tx_js.TxRaw.fromPartial({
|
|
3883
|
+
bodyBytes: this.registry.encodeTxBody({
|
|
3884
3884
|
memo,
|
|
3885
3885
|
messages: msgs.map((msg) => aminoTypes.fromAmino(msg)),
|
|
3886
3886
|
}),
|
|
@@ -3889,10 +3889,10 @@ class ClientLedger extends Client {
|
|
|
3889
3889
|
pubkey,
|
|
3890
3890
|
sequence: account.sequence,
|
|
3891
3891
|
},
|
|
3892
|
-
], fee.amount, Number.parseInt(fee.gas), undefined, undefined,
|
|
3892
|
+
], fee.amount, Number.parseInt(fee.gas), undefined, undefined, signing_js.SignMode.SIGN_MODE_LEGACY_AMINO_JSON),
|
|
3893
3893
|
signatures: [THORChainApp.extractSignatureFromTLV(signature)],
|
|
3894
3894
|
});
|
|
3895
|
-
return this.broadcastTx(encoding.toBase64(
|
|
3895
|
+
return this.broadcastTx(encoding.toBase64(tx_js.TxRaw.encode(rawTx).finish()));
|
|
3896
3896
|
});
|
|
3897
3897
|
}
|
|
3898
3898
|
/**
|
|
@@ -3946,8 +3946,8 @@ class ClientLedger extends Client {
|
|
|
3946
3946
|
if (!signature)
|
|
3947
3947
|
throw Error(`Can not sign transfer transaction. Return code ${returnCode}. Error: ${errorMessage}`);
|
|
3948
3948
|
const aminoTypes = this.getProtocolAminoMessages();
|
|
3949
|
-
const rawTx =
|
|
3950
|
-
bodyBytes:
|
|
3949
|
+
const rawTx = tx_js.TxRaw.fromPartial({
|
|
3950
|
+
bodyBytes: this.registry.encodeTxBody({
|
|
3951
3951
|
messages: msgs.map((msg) => aminoTypes.fromAmino(msg)),
|
|
3952
3952
|
memo: params.memo,
|
|
3953
3953
|
}),
|
|
@@ -3956,10 +3956,10 @@ class ClientLedger extends Client {
|
|
|
3956
3956
|
pubkey,
|
|
3957
3957
|
sequence: account.sequence,
|
|
3958
3958
|
},
|
|
3959
|
-
], fee.amount, Number.parseInt(fee.gas), undefined, undefined,
|
|
3959
|
+
], fee.amount, Number.parseInt(fee.gas), undefined, undefined, signing_js.SignMode.SIGN_MODE_LEGACY_AMINO_JSON),
|
|
3960
3960
|
signatures: [THORChainApp.extractSignatureFromTLV(signature)],
|
|
3961
3961
|
});
|
|
3962
|
-
return encoding.toBase64(
|
|
3962
|
+
return encoding.toBase64(tx_js.TxRaw.encode(rawTx).finish());
|
|
3963
3963
|
});
|
|
3964
3964
|
}
|
|
3965
3965
|
getProtocolAminoMessages() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.13",
|
|
4
4
|
"description": "Custom Thorchain client and utilities used by XChainJS clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -29,28 +29,28 @@
|
|
|
29
29
|
"build:release": "yarn exec rm -rf release && yarn pack && yarn exec \"mkdir release && tar zxvf package.tgz --directory release && rm package.tgz\"",
|
|
30
30
|
"test": "jest",
|
|
31
31
|
"e2e": "jest --config jest.config.e2e.mjs",
|
|
32
|
-
"lint": "eslint \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
|
|
32
|
+
"lint": "eslint --config ../../eslint.config.mjs \"{src,__tests__}/**/*.ts\" --fix --max-warnings 0",
|
|
33
33
|
"start:example": "ts-node example/index.ts",
|
|
34
34
|
"generate:ThorchainMsgs": "./genMsgs.sh"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@bitcoin-js/tiny-secp256k1-asmjs": "^2.2.3",
|
|
38
|
-
"@cosmjs/amino": "0.
|
|
39
|
-
"@cosmjs/crypto": "0.
|
|
40
|
-
"@cosmjs/encoding": "0.
|
|
41
|
-
"@cosmjs/math": "0.
|
|
42
|
-
"@cosmjs/proto-signing": "0.
|
|
43
|
-
"@cosmjs/stargate": "0.
|
|
38
|
+
"@cosmjs/amino": "0.34.0",
|
|
39
|
+
"@cosmjs/crypto": "0.34.0",
|
|
40
|
+
"@cosmjs/encoding": "0.34.0",
|
|
41
|
+
"@cosmjs/math": "0.34.0",
|
|
42
|
+
"@cosmjs/proto-signing": "0.34.0",
|
|
43
|
+
"@cosmjs/stargate": "0.34.0",
|
|
44
44
|
"@ledgerhq/hw-transport": "^6.31.6",
|
|
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.
|
|
50
|
-
"@xchainjs/xchain-crypto": "1.0.
|
|
51
|
-
"@xchainjs/xchain-util": "2.0.
|
|
52
|
-
"axios": "1.
|
|
53
|
-
"bignumber.js": "^9.
|
|
48
|
+
"@xchainjs/xchain-client": "2.0.9",
|
|
49
|
+
"@xchainjs/xchain-cosmos-sdk": "2.0.9",
|
|
50
|
+
"@xchainjs/xchain-crypto": "1.0.6",
|
|
51
|
+
"@xchainjs/xchain-util": "2.0.5",
|
|
52
|
+
"axios": "1.12.1",
|
|
53
|
+
"bignumber.js": "^9.1.2",
|
|
54
54
|
"cosmjs-types": "0.9.0",
|
|
55
55
|
"protobufjs": "6.11.4"
|
|
56
56
|
},
|