@xchainjs/xchain-thorchain 0.27.5 → 0.27.6
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 +22 -3
- package/lib/client.d.ts +3 -3
- package/lib/index.esm.js +8 -12
- package/lib/index.js +22 -25
- package/lib/types/messages.d.ts +2 -2
- package/lib/util.d.ts +8 -8
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -16,14 +16,13 @@ yarn add @xchainjs/xchain-client @xchainjs/xchain-crypto @xchainjs/xchain-util @
|
|
|
16
16
|
|
|
17
17
|
Important note: Make sure to install same version of `@cosmos-client/core` as `xchain-thorchain` is using (currently `@cosmos-client/core@0.45.1` ). In other case things might break.
|
|
18
18
|
|
|
19
|
-
|
|
20
19
|
## Documentation
|
|
21
20
|
|
|
22
21
|
### [`xchain thorchain`](http://docs.xchainjs.org/xchain-client/xchain-thorchain/)
|
|
22
|
+
|
|
23
23
|
[`How xchain-thorchain works`](http://docs.xchainjs.org/xchain-client/xchain-thorchain/how-it-works.html)\
|
|
24
24
|
[`How to use xchain-thorchain`](http://docs.xchainjs.org/xchain-client/xchain-thorchain/how-to-use.html)
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
For more examples check out tests in `./__tests__/client.test.ts`
|
|
28
27
|
|
|
29
28
|
## Service Providers
|
|
@@ -56,5 +55,25 @@ In order for this library to de/serialize proto3 structures, you can use the fol
|
|
|
56
55
|
yarn run pbts src/types/proto/MsgCompiled.js -o src/types/proto/MsgCompiled.d.ts
|
|
57
56
|
```
|
|
58
57
|
|
|
59
|
-
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.
|
|
58
|
+
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.
|
|
59
|
+
|
|
60
|
+
### Setting Headers for Nine Realms endpoints
|
|
61
|
+
|
|
62
|
+
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
|
|
63
|
+
|
|
64
|
+
- https://midgard.ninerealms.com
|
|
65
|
+
- https://haskoin.ninerealms.com (BTC/BCH/LTC)
|
|
66
|
+
- https://thornode.ninerealms.com
|
|
67
|
+
|
|
68
|
+
Example
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
import cosmosclient from '@cosmos-client/core'
|
|
72
|
+
import axios from 'axios'
|
|
73
|
+
import { register9Rheader } from '@xchainjs/xchain-util'
|
|
74
|
+
|
|
75
|
+
register9Rheader(axios)
|
|
76
|
+
register9Rheader(cosmosclient.config.globalAxios)
|
|
77
|
+
```
|
|
60
78
|
|
|
79
|
+
For a complete example please see this [test](https://github.com/xchainjs/xchainjs-lib/blob/master/packages/xchain-thorchain-amm/__e2e__/wallet.e2e.ts)
|
package/lib/client.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cosmosclient from '@cosmos-client/core';
|
|
2
2
|
import { Balance, BaseXChainClient, Fees, Network, Tx, TxHash, TxHistoryParams, TxParams, TxsPage, XChainClient, XChainClientParams } from '@xchainjs/xchain-client';
|
|
3
3
|
import { CosmosSDKClient, RPCTxResult } from '@xchainjs/xchain-cosmos';
|
|
4
4
|
import { Address, Asset } from '@xchainjs/xchain-util';
|
|
@@ -33,7 +33,7 @@ declare class Client extends BaseXChainClient implements ThorchainClient, XChain
|
|
|
33
33
|
*
|
|
34
34
|
* @throws {"Invalid phrase"} Thrown if the given phase is invalid.
|
|
35
35
|
*/
|
|
36
|
-
constructor({ network, phrase, clientUrl, explorerUrls, rootDerivationPaths, chainIds,
|
|
36
|
+
constructor({ network, phrase, clientUrl, explorerUrls, rootDerivationPaths, chainIds, }: XChainClientParams & ThorchainClientParams);
|
|
37
37
|
/**
|
|
38
38
|
* Set/update the current network.
|
|
39
39
|
*
|
|
@@ -115,7 +115,7 @@ declare class Client extends BaseXChainClient implements ThorchainClient, XChain
|
|
|
115
115
|
* @throws {"Phrase not set"}
|
|
116
116
|
* Throws an error if phrase has not been set before
|
|
117
117
|
* */
|
|
118
|
-
getPrivateKey(index?: number): proto.cosmos.crypto.secp256k1.PrivKey;
|
|
118
|
+
getPrivateKey(index?: number): cosmosclient.proto.cosmos.crypto.secp256k1.PrivKey;
|
|
119
119
|
/**
|
|
120
120
|
* Get public key
|
|
121
121
|
*
|
package/lib/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cosmosclient from '@cosmos-client/core';
|
|
2
2
|
import { Network, TxType, singleFee, FeeType, BaseXChainClient } from '@xchainjs/xchain-client';
|
|
3
3
|
import { CosmosSDKClient } from '@xchainjs/xchain-cosmos';
|
|
4
4
|
import { isAssetRuneNative, isSynthAsset, assetToString, AssetRuneNative, assetFromString, baseAmount, assetToBase, assetAmount, Chain } from '@xchainjs/xchain-util';
|
|
@@ -9764,13 +9764,13 @@ const getChainId = (nodeUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
9764
9764
|
* @returns
|
|
9765
9765
|
*/
|
|
9766
9766
|
const buildUnsignedTx = ({ cosmosSdk, txBody, signerPubkey, sequence, gasLimit, }) => {
|
|
9767
|
-
const authInfo = new proto.cosmos.tx.v1beta1.AuthInfo({
|
|
9767
|
+
const authInfo = new cosmosclient.proto.cosmos.tx.v1beta1.AuthInfo({
|
|
9768
9768
|
signer_infos: [
|
|
9769
9769
|
{
|
|
9770
9770
|
public_key: signerPubkey,
|
|
9771
9771
|
mode_info: {
|
|
9772
9772
|
single: {
|
|
9773
|
-
mode: proto.cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_DIRECT,
|
|
9773
|
+
mode: cosmosclient.proto.cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_DIRECT,
|
|
9774
9774
|
},
|
|
9775
9775
|
},
|
|
9776
9776
|
sequence: sequence,
|
|
@@ -9801,7 +9801,7 @@ const getEstimatedGas = ({ cosmosSDKClient, txBody, privKey, accountNumber, acco
|
|
|
9801
9801
|
});
|
|
9802
9802
|
const signDocBytes = txBuilder.signDocBytes(accountNumber);
|
|
9803
9803
|
txBuilder.addSignature(privKey.sign(signDocBytes));
|
|
9804
|
-
const resp = yield rest.tx.simulate(cosmosSDKClient.sdk, { tx_bytes: txBuilder.txBytes() });
|
|
9804
|
+
const resp = yield cosmosclient.rest.tx.simulate(cosmosSDKClient.sdk, { tx_bytes: txBuilder.txBytes() });
|
|
9805
9805
|
const estimatedGas = (_d = (_c = (_b = resp.data) === null || _b === void 0 ? void 0 : _b.gas_info) === null || _c === void 0 ? void 0 : _c.gas_used) !== null && _d !== void 0 ? _d : null;
|
|
9806
9806
|
if (!estimatedGas) {
|
|
9807
9807
|
throw new Error('Could not get data of estimated gas');
|
|
@@ -9832,7 +9832,7 @@ const buildDepositTx = ({ msgNativeTx, nodeUrl, chainId, }) => __awaiter(void 0,
|
|
|
9832
9832
|
signer: signerDecoded.data,
|
|
9833
9833
|
};
|
|
9834
9834
|
const depositMsg = MsgCompiled.types.MsgDeposit.fromObject(msgDepositObj);
|
|
9835
|
-
return new proto.cosmos.tx.v1beta1.TxBody({
|
|
9835
|
+
return new cosmosclient.proto.cosmos.tx.v1beta1.TxBody({
|
|
9836
9836
|
messages: [cosmosclient.codec.instanceToProtoAny(depositMsg)],
|
|
9837
9837
|
memo: msgNativeTx.memo,
|
|
9838
9838
|
});
|
|
@@ -9866,7 +9866,7 @@ const buildTransferTx = ({ fromAddress, toAddress, assetAmount, assetDenom, memo
|
|
|
9866
9866
|
],
|
|
9867
9867
|
};
|
|
9868
9868
|
const transferMsg = MsgCompiled.types.MsgSend.fromObject(transferObj);
|
|
9869
|
-
return new proto.cosmos.tx.v1beta1.TxBody({
|
|
9869
|
+
return new cosmosclient.proto.cosmos.tx.v1beta1.TxBody({
|
|
9870
9870
|
messages: [cosmosclient.codec.instanceToProtoAny(transferMsg)],
|
|
9871
9871
|
memo,
|
|
9872
9872
|
});
|
|
@@ -9980,8 +9980,8 @@ class Client extends BaseXChainClient {
|
|
|
9980
9980
|
[Network.Mainnet]: 'thorchain-mainnet-v1',
|
|
9981
9981
|
[Network.Stagenet]: 'thorchain-stagenet-v2',
|
|
9982
9982
|
[Network.Testnet]: 'deprecated',
|
|
9983
|
-
},
|
|
9984
|
-
super(Chain.Cosmos, { network, rootDerivationPaths, phrase
|
|
9983
|
+
}, }) {
|
|
9984
|
+
super(Chain.Cosmos, { network, rootDerivationPaths, phrase });
|
|
9985
9985
|
/**
|
|
9986
9986
|
* Get transaction history of a given address with pagination options.
|
|
9987
9987
|
* By default it will return the transaction history of the current wallet.
|
|
@@ -10038,14 +10038,10 @@ class Client extends BaseXChainClient {
|
|
|
10038
10038
|
this.chainIds = chainIds;
|
|
10039
10039
|
registerSendCodecs();
|
|
10040
10040
|
registerDepositCodecs();
|
|
10041
|
-
if (this.clientUrl[Network.Mainnet].node.includes('ninerealms.com') && !this.customRequestHeaders['x-client-id']) {
|
|
10042
|
-
this.customRequestHeaders['x-client-id'] = 'xchainjs-client';
|
|
10043
|
-
}
|
|
10044
10041
|
this.cosmosClient = new CosmosSDKClient({
|
|
10045
10042
|
server: this.getClientUrl().node,
|
|
10046
10043
|
chainId: this.getChainId(network),
|
|
10047
10044
|
prefix: getPrefix(network),
|
|
10048
|
-
headers: this.customRequestHeaders,
|
|
10049
10045
|
});
|
|
10050
10046
|
}
|
|
10051
10047
|
/**
|
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var cosmosclient = require('@cosmos-client/core');
|
|
6
6
|
var xchainClient = require('@xchainjs/xchain-client');
|
|
7
7
|
var xchainCosmos = require('@xchainjs/xchain-cosmos');
|
|
8
8
|
var xchainUtil = require('@xchainjs/xchain-util');
|
|
@@ -11,6 +11,7 @@ var bech32Buffer = require('bech32-buffer');
|
|
|
11
11
|
|
|
12
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
13
13
|
|
|
14
|
+
var cosmosclient__default = /*#__PURE__*/_interopDefaultLegacy(cosmosclient);
|
|
14
15
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
15
16
|
|
|
16
17
|
/*! *****************************************************************************
|
|
@@ -9688,13 +9689,13 @@ const getPrefix = (network) => {
|
|
|
9688
9689
|
* Register type for encoding `MsgDeposit` messages
|
|
9689
9690
|
*/
|
|
9690
9691
|
const registerDepositCodecs = () => {
|
|
9691
|
-
|
|
9692
|
+
cosmosclient__default['default'].codec.register('/types.MsgDeposit', MsgCompiled.types.MsgDeposit);
|
|
9692
9693
|
};
|
|
9693
9694
|
/**
|
|
9694
9695
|
* Register type for encoding `MsgSend` messages
|
|
9695
9696
|
*/
|
|
9696
9697
|
const registerSendCodecs = () => {
|
|
9697
|
-
|
|
9698
|
+
cosmosclient__default['default'].codec.register('/types.MsgSend', MsgCompiled.types.MsgSend);
|
|
9698
9699
|
};
|
|
9699
9700
|
/**
|
|
9700
9701
|
* Parse transaction data from event logs
|
|
@@ -9772,13 +9773,13 @@ const getChainId = (nodeUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
9772
9773
|
* @returns
|
|
9773
9774
|
*/
|
|
9774
9775
|
const buildUnsignedTx = ({ cosmosSdk, txBody, signerPubkey, sequence, gasLimit, }) => {
|
|
9775
|
-
const authInfo = new
|
|
9776
|
+
const authInfo = new cosmosclient__default['default'].proto.cosmos.tx.v1beta1.AuthInfo({
|
|
9776
9777
|
signer_infos: [
|
|
9777
9778
|
{
|
|
9778
9779
|
public_key: signerPubkey,
|
|
9779
9780
|
mode_info: {
|
|
9780
9781
|
single: {
|
|
9781
|
-
mode:
|
|
9782
|
+
mode: cosmosclient__default['default'].proto.cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_DIRECT,
|
|
9782
9783
|
},
|
|
9783
9784
|
},
|
|
9784
9785
|
sequence: sequence,
|
|
@@ -9789,7 +9790,7 @@ const buildUnsignedTx = ({ cosmosSdk, txBody, signerPubkey, sequence, gasLimit,
|
|
|
9789
9790
|
gas_limit: gasLimit || null,
|
|
9790
9791
|
},
|
|
9791
9792
|
});
|
|
9792
|
-
return new
|
|
9793
|
+
return new cosmosclient__default['default'].TxBuilder(cosmosSdk, txBody, authInfo);
|
|
9793
9794
|
};
|
|
9794
9795
|
/**
|
|
9795
9796
|
* Estimates usage of gas
|
|
@@ -9804,12 +9805,12 @@ const getEstimatedGas = ({ cosmosSDKClient, txBody, privKey, accountNumber, acco
|
|
|
9804
9805
|
const txBuilder = buildUnsignedTx({
|
|
9805
9806
|
cosmosSdk: cosmosSDKClient.sdk,
|
|
9806
9807
|
txBody: txBody,
|
|
9807
|
-
signerPubkey:
|
|
9808
|
+
signerPubkey: cosmosclient__default['default'].codec.instanceToProtoAny(pubKey),
|
|
9808
9809
|
sequence: accountSequence,
|
|
9809
9810
|
});
|
|
9810
9811
|
const signDocBytes = txBuilder.signDocBytes(accountNumber);
|
|
9811
9812
|
txBuilder.addSignature(privKey.sign(signDocBytes));
|
|
9812
|
-
const resp = yield
|
|
9813
|
+
const resp = yield cosmosclient__default['default'].rest.tx.simulate(cosmosSDKClient.sdk, { tx_bytes: txBuilder.txBytes() });
|
|
9813
9814
|
const estimatedGas = (_d = (_c = (_b = resp.data) === null || _b === void 0 ? void 0 : _b.gas_info) === null || _c === void 0 ? void 0 : _c.gas_used) !== null && _d !== void 0 ? _d : null;
|
|
9814
9815
|
if (!estimatedGas) {
|
|
9815
9816
|
throw new Error('Could not get data of estimated gas');
|
|
@@ -9840,8 +9841,8 @@ const buildDepositTx = ({ msgNativeTx, nodeUrl, chainId, }) => __awaiter(void 0,
|
|
|
9840
9841
|
signer: signerDecoded.data,
|
|
9841
9842
|
};
|
|
9842
9843
|
const depositMsg = MsgCompiled.types.MsgDeposit.fromObject(msgDepositObj);
|
|
9843
|
-
return new
|
|
9844
|
-
messages: [
|
|
9844
|
+
return new cosmosclient__default['default'].proto.cosmos.tx.v1beta1.TxBody({
|
|
9845
|
+
messages: [cosmosclient__default['default'].codec.instanceToProtoAny(depositMsg)],
|
|
9845
9846
|
memo: msgNativeTx.memo,
|
|
9846
9847
|
});
|
|
9847
9848
|
});
|
|
@@ -9874,8 +9875,8 @@ const buildTransferTx = ({ fromAddress, toAddress, assetAmount, assetDenom, memo
|
|
|
9874
9875
|
],
|
|
9875
9876
|
};
|
|
9876
9877
|
const transferMsg = MsgCompiled.types.MsgSend.fromObject(transferObj);
|
|
9877
|
-
return new
|
|
9878
|
-
messages: [
|
|
9878
|
+
return new cosmosclient__default['default'].proto.cosmos.tx.v1beta1.TxBody({
|
|
9879
|
+
messages: [cosmosclient__default['default'].codec.instanceToProtoAny(transferMsg)],
|
|
9879
9880
|
memo,
|
|
9880
9881
|
});
|
|
9881
9882
|
});
|
|
@@ -9944,7 +9945,7 @@ const getExplorerTxUrl = ({ urls, network, txID, }) => {
|
|
|
9944
9945
|
}
|
|
9945
9946
|
};
|
|
9946
9947
|
const getAccount = (address, client) => {
|
|
9947
|
-
const accAddress =
|
|
9948
|
+
const accAddress = cosmosclient__default['default'].AccAddress.fromString(address);
|
|
9948
9949
|
return client.getAccount(accAddress);
|
|
9949
9950
|
};
|
|
9950
9951
|
const getSequence = (address, client) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -9988,8 +9989,8 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
9988
9989
|
[xchainClient.Network.Mainnet]: 'thorchain-mainnet-v1',
|
|
9989
9990
|
[xchainClient.Network.Stagenet]: 'thorchain-stagenet-v2',
|
|
9990
9991
|
[xchainClient.Network.Testnet]: 'deprecated',
|
|
9991
|
-
},
|
|
9992
|
-
super(xchainUtil.Chain.Cosmos, { network, rootDerivationPaths, phrase
|
|
9992
|
+
}, }) {
|
|
9993
|
+
super(xchainUtil.Chain.Cosmos, { network, rootDerivationPaths, phrase });
|
|
9993
9994
|
/**
|
|
9994
9995
|
* Get transaction history of a given address with pagination options.
|
|
9995
9996
|
* By default it will return the transaction history of the current wallet.
|
|
@@ -10046,14 +10047,10 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10046
10047
|
this.chainIds = chainIds;
|
|
10047
10048
|
registerSendCodecs();
|
|
10048
10049
|
registerDepositCodecs();
|
|
10049
|
-
if (this.clientUrl[xchainClient.Network.Mainnet].node.includes('ninerealms.com') && !this.customRequestHeaders['x-client-id']) {
|
|
10050
|
-
this.customRequestHeaders['x-client-id'] = 'xchainjs-client';
|
|
10051
|
-
}
|
|
10052
10050
|
this.cosmosClient = new xchainCosmos.CosmosSDKClient({
|
|
10053
10051
|
server: this.getClientUrl().node,
|
|
10054
10052
|
chainId: this.getChainId(network),
|
|
10055
10053
|
prefix: getPrefix(network),
|
|
10056
|
-
headers: this.customRequestHeaders,
|
|
10057
10054
|
});
|
|
10058
10055
|
}
|
|
10059
10056
|
/**
|
|
@@ -10307,7 +10304,7 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10307
10304
|
const privKey = this.getPrivateKey(walletIndex);
|
|
10308
10305
|
const signerPubkey = privKey.pubKey();
|
|
10309
10306
|
const fromAddress = this.getAddress(walletIndex);
|
|
10310
|
-
const fromAddressAcc =
|
|
10307
|
+
const fromAddressAcc = cosmosclient__default['default'].AccAddress.fromString(fromAddress);
|
|
10311
10308
|
const depositTxBody = yield buildDepositTx({
|
|
10312
10309
|
msgNativeTx: {
|
|
10313
10310
|
memo: memo,
|
|
@@ -10329,7 +10326,7 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10329
10326
|
const txBuilder = buildUnsignedTx({
|
|
10330
10327
|
cosmosSdk: this.getCosmosClient().sdk,
|
|
10331
10328
|
txBody: depositTxBody,
|
|
10332
|
-
signerPubkey:
|
|
10329
|
+
signerPubkey: cosmosclient__default['default'].codec.instanceToProtoAny(signerPubkey),
|
|
10333
10330
|
gasLimit: long_1.fromString(gasLimit.toFixed(0)),
|
|
10334
10331
|
sequence: sequence ? long_1.fromNumber(sequence) : account.sequence || long_1.ZERO,
|
|
10335
10332
|
});
|
|
@@ -10370,7 +10367,7 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10370
10367
|
const privKey = this.getPrivateKey(walletIndex);
|
|
10371
10368
|
const from = this.getAddress(walletIndex);
|
|
10372
10369
|
const signerPubkey = privKey.pubKey();
|
|
10373
|
-
const accAddress =
|
|
10370
|
+
const accAddress = cosmosclient__default['default'].AccAddress.fromString(from);
|
|
10374
10371
|
const denom = getDenom(asset);
|
|
10375
10372
|
const txBody = yield buildTransferTx({
|
|
10376
10373
|
fromAddress: from,
|
|
@@ -10389,7 +10386,7 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10389
10386
|
cosmosSdk: this.getCosmosClient().sdk,
|
|
10390
10387
|
txBody: txBody,
|
|
10391
10388
|
gasLimit: long_1.fromString(gasLimit.toString()),
|
|
10392
|
-
signerPubkey:
|
|
10389
|
+
signerPubkey: cosmosclient__default['default'].codec.instanceToProtoAny(signerPubkey),
|
|
10393
10390
|
sequence: sequence ? long_1.fromNumber(sequence) : account.sequence || long_1.ZERO,
|
|
10394
10391
|
});
|
|
10395
10392
|
const txHash = yield this.cosmosClient.signAndBroadcast(txBuilder, privKey, accountNumber);
|
|
@@ -10433,7 +10430,7 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10433
10430
|
cosmosSdk: this.getCosmosClient().sdk,
|
|
10434
10431
|
txBody: txBody,
|
|
10435
10432
|
gasLimit: long_1.fromString(gasLimit.toFixed(0)),
|
|
10436
|
-
signerPubkey:
|
|
10433
|
+
signerPubkey: cosmosclient__default['default'].codec.instanceToProtoAny(privKey.pubKey()),
|
|
10437
10434
|
sequence: fromSequence,
|
|
10438
10435
|
});
|
|
10439
10436
|
const signDocBytes = txBuilder.signDocBytes(fromAccountNumber);
|
|
@@ -10476,7 +10473,7 @@ class MsgNativeTx {
|
|
|
10476
10473
|
* @returns {MsgNativeTx}
|
|
10477
10474
|
*/
|
|
10478
10475
|
const msgNativeTxFromJson = (value) => {
|
|
10479
|
-
return new MsgNativeTx(value.coins, value.memo,
|
|
10476
|
+
return new MsgNativeTx(value.coins, value.memo, cosmosclient__default['default'].AccAddress.fromString(value.signer));
|
|
10480
10477
|
};
|
|
10481
10478
|
|
|
10482
10479
|
exports.Client = Client;
|
package/lib/types/messages.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cosmosclient from '@cosmos-client/core';
|
|
2
2
|
import { Asset } from '@xchainjs/xchain-util';
|
|
3
3
|
export declare type MsgCoin = {
|
|
4
4
|
asset: Asset;
|
|
@@ -31,7 +31,7 @@ export declare type ThorchainDepositResponse = AminoWrapping<{
|
|
|
31
31
|
memo: string;
|
|
32
32
|
signer: string;
|
|
33
33
|
}>[];
|
|
34
|
-
fee: proto.cosmos.tx.v1beta1.Fee;
|
|
34
|
+
fee: cosmosclient.proto.cosmos.tx.v1beta1.Fee;
|
|
35
35
|
signatures: string[];
|
|
36
36
|
memo: string;
|
|
37
37
|
timeout_height: string;
|
package/lib/util.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import cosmosclient from '@cosmos-client/core';
|
|
2
2
|
import { Balance, Fees, Network, TxHash } from '@xchainjs/xchain-client';
|
|
3
3
|
import { CosmosSDKClient, TxLog } from '@xchainjs/xchain-cosmos';
|
|
4
4
|
import { Address, Asset, BaseAmount } from '@xchainjs/xchain-util';
|
|
@@ -87,8 +87,8 @@ export declare const getChainId: (nodeUrl: string) => Promise<ChainId>;
|
|
|
87
87
|
*/
|
|
88
88
|
export declare const buildUnsignedTx: ({ cosmosSdk, txBody, signerPubkey, sequence, gasLimit, }: {
|
|
89
89
|
cosmosSdk: cosmosclient.CosmosSDK;
|
|
90
|
-
txBody: proto.cosmos.tx.v1beta1.TxBody;
|
|
91
|
-
signerPubkey: proto.google.protobuf.Any;
|
|
90
|
+
txBody: cosmosclient.proto.cosmos.tx.v1beta1.TxBody;
|
|
91
|
+
signerPubkey: cosmosclient.proto.google.protobuf.Any;
|
|
92
92
|
sequence: Long;
|
|
93
93
|
gasLimit?: Long.Long | undefined;
|
|
94
94
|
}) => cosmosclient.TxBuilder;
|
|
@@ -101,8 +101,8 @@ export declare const buildUnsignedTx: ({ cosmosSdk, txBody, signerPubkey, sequen
|
|
|
101
101
|
*/
|
|
102
102
|
export declare const getEstimatedGas: ({ cosmosSDKClient, txBody, privKey, accountNumber, accountSequence, multiplier, }: {
|
|
103
103
|
cosmosSDKClient: CosmosSDKClient;
|
|
104
|
-
txBody: proto.cosmos.tx.v1beta1.TxBody;
|
|
105
|
-
privKey: proto.cosmos.crypto.secp256k1.PrivKey;
|
|
104
|
+
txBody: cosmosclient.proto.cosmos.tx.v1beta1.TxBody;
|
|
105
|
+
privKey: cosmosclient.proto.cosmos.crypto.secp256k1.PrivKey;
|
|
106
106
|
accountNumber: Long;
|
|
107
107
|
accountSequence: Long;
|
|
108
108
|
multiplier?: number | undefined;
|
|
@@ -122,7 +122,7 @@ export declare const buildDepositTx: ({ msgNativeTx, nodeUrl, chainId, }: {
|
|
|
122
122
|
msgNativeTx: MsgNativeTx;
|
|
123
123
|
nodeUrl: string;
|
|
124
124
|
chainId: ChainId;
|
|
125
|
-
}) => Promise<proto.cosmos.tx.v1beta1.TxBody>;
|
|
125
|
+
}) => Promise<cosmosclient.proto.cosmos.tx.v1beta1.TxBody>;
|
|
126
126
|
/**
|
|
127
127
|
* Structure a MsgSend
|
|
128
128
|
*
|
|
@@ -142,7 +142,7 @@ export declare const buildTransferTx: ({ fromAddress, toAddress, assetAmount, as
|
|
|
142
142
|
memo?: string | undefined;
|
|
143
143
|
nodeUrl: string;
|
|
144
144
|
chainId: ChainId;
|
|
145
|
-
}) => Promise<proto.cosmos.tx.v1beta1.TxBody>;
|
|
145
|
+
}) => Promise<cosmosclient.proto.cosmos.tx.v1beta1.TxBody>;
|
|
146
146
|
/**
|
|
147
147
|
* Get the balance of a given address.
|
|
148
148
|
*
|
|
@@ -191,5 +191,5 @@ export declare const getExplorerTxUrl: ({ urls, network, txID, }: {
|
|
|
191
191
|
network: Network;
|
|
192
192
|
txID: TxHash;
|
|
193
193
|
}) => string;
|
|
194
|
-
export declare const getAccount: (address: string, client: CosmosSDKClient) => Promise<proto.cosmos.auth.v1beta1.IBaseAccount>;
|
|
194
|
+
export declare const getAccount: (address: string, client: CosmosSDKClient) => Promise<cosmosclient.proto.cosmos.auth.v1beta1.IBaseAccount>;
|
|
195
195
|
export declare const getSequence: (address: string, client: CosmosSDKClient) => Promise<number | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.6",
|
|
4
4
|
"description": "Custom Thorchain client and utilities used by XChainJS clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
"generate:ThorchainMsgs": "./genMsgs.sh"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@cosmos-client/core": "0.
|
|
37
|
+
"@cosmos-client/core": "0.46.1",
|
|
38
38
|
"@types/big.js": "^6.0.0",
|
|
39
39
|
"@xchainjs/xchain-client": "^0.13.3",
|
|
40
|
-
"@xchainjs/xchain-cosmos": "^0.20.
|
|
40
|
+
"@xchainjs/xchain-cosmos": "^0.20.5",
|
|
41
41
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
42
42
|
"@xchainjs/xchain-util": "^0.11.0",
|
|
43
43
|
"axios": "^0.25.0",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@cosmos-client/core": "0.
|
|
51
|
+
"@cosmos-client/core": "0.46.1",
|
|
52
52
|
"@xchainjs/xchain-client": "^0.13.3",
|
|
53
|
-
"@xchainjs/xchain-cosmos": "^0.20.
|
|
53
|
+
"@xchainjs/xchain-cosmos": "^0.20.5",
|
|
54
54
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
55
55
|
"@xchainjs/xchain-util": "^0.11.0",
|
|
56
56
|
"axios": "^0.25.0",
|