@xchainjs/xchain-thorchain 0.26.0 → 0.27.0
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 +2 -38
- package/lib/index.js +1 -39
- package/lib/types/client-types.d.ts +1 -1
- package/lib/util.d.ts +1 -12
- package/package.json +5 -5
package/lib/index.esm.js
CHANGED
|
@@ -9733,21 +9733,6 @@ const getChainId = (nodeUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
9733
9733
|
const { data } = yield axios.get(`${nodeUrl}/cosmos/base/tendermint/v1beta1/node_info`);
|
|
9734
9734
|
return ((_a = data === null || data === void 0 ? void 0 : data.default_node_info) === null || _a === void 0 ? void 0 : _a.network) || Promise.reject('Could not parse chain id');
|
|
9735
9735
|
});
|
|
9736
|
-
/**
|
|
9737
|
-
* Helper to get all THORChain's chain id
|
|
9738
|
-
* @param {ClientUrl} client urls (use `getDefaultClientUrl()` if you don't need to use custom urls)
|
|
9739
|
-
*/
|
|
9740
|
-
const getChainIds = (client) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9741
|
-
return Promise.all([
|
|
9742
|
-
getChainId(client[Network.Testnet].node),
|
|
9743
|
-
getChainId(client[Network.Stagenet].node),
|
|
9744
|
-
getChainId(client[Network.Mainnet].node),
|
|
9745
|
-
]).then(([testnetId, stagenetId, mainnetId]) => ({
|
|
9746
|
-
testnet: testnetId,
|
|
9747
|
-
stagenet: stagenetId,
|
|
9748
|
-
mainnet: mainnetId,
|
|
9749
|
-
}));
|
|
9750
|
-
});
|
|
9751
9736
|
/**
|
|
9752
9737
|
* Builds final unsigned TX
|
|
9753
9738
|
*
|
|
@@ -9884,27 +9869,6 @@ const getBalance = ({ address, assets, cosmosClient, }) => __awaiter(void 0, voi
|
|
|
9884
9869
|
}))
|
|
9885
9870
|
.filter((balance) => !assets || assets.filter((asset) => assetToString(balance.asset) === assetToString(asset)).length);
|
|
9886
9871
|
});
|
|
9887
|
-
/**
|
|
9888
|
-
* Get the client url.
|
|
9889
|
-
*
|
|
9890
|
-
* @returns {ClientUrl} The client url (both mainnet and testnet) for thorchain.
|
|
9891
|
-
*/
|
|
9892
|
-
const getDefaultClientUrl = () => {
|
|
9893
|
-
return {
|
|
9894
|
-
[Network.Testnet]: {
|
|
9895
|
-
node: 'https://testnet.thornode.thorchain.info',
|
|
9896
|
-
rpc: 'https://testnet-rpc.ninerealms.com',
|
|
9897
|
-
},
|
|
9898
|
-
[Network.Stagenet]: {
|
|
9899
|
-
node: 'https://stagenet-thornode.ninerealms.com',
|
|
9900
|
-
rpc: 'https://stagenet-rpc.ninerealms.com',
|
|
9901
|
-
},
|
|
9902
|
-
[Network.Mainnet]: {
|
|
9903
|
-
node: 'https://thornode.ninerealms.com',
|
|
9904
|
-
rpc: 'https://rpc.ninerealms.com',
|
|
9905
|
-
},
|
|
9906
|
-
};
|
|
9907
|
-
};
|
|
9908
9872
|
const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
|
|
9909
9873
|
/**
|
|
9910
9874
|
* Get default explorer urls.
|
|
@@ -10053,7 +10017,7 @@ class Client extends BaseXChainClient {
|
|
|
10053
10017
|
txs,
|
|
10054
10018
|
};
|
|
10055
10019
|
});
|
|
10056
|
-
this.clientUrl = clientUrl
|
|
10020
|
+
this.clientUrl = clientUrl;
|
|
10057
10021
|
this.explorerUrls = explorerUrls || getDefaultExplorerUrls();
|
|
10058
10022
|
this.chainIds = chainIds;
|
|
10059
10023
|
registerSendCodecs();
|
|
@@ -10487,4 +10451,4 @@ const msgNativeTxFromJson = (value) => {
|
|
|
10487
10451
|
return new MsgNativeTx(value.coins, value.memo, cosmosclient.AccAddress.fromString(value.signer));
|
|
10488
10452
|
};
|
|
10489
10453
|
|
|
10490
|
-
export { Client, DECIMAL, DEFAULT_GAS_ADJUSTMENT, DEFAULT_GAS_LIMIT_VALUE, DEPOSIT_GAS_LIMIT_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, buildTransferTx, buildUnsignedTx, getBalance, getChainId,
|
|
10454
|
+
export { Client, DECIMAL, DEFAULT_GAS_ADJUSTMENT, DEFAULT_GAS_LIMIT_VALUE, DEPOSIT_GAS_LIMIT_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, buildTransferTx, buildUnsignedTx, getBalance, getChainId, getDefaultExplorerUrls, getDefaultFees, getDenom, getDepositTxDataFromLogs, getEstimatedGas, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getTxType, isBroadcastSuccess, msgNativeTxFromJson, registerDepositCodecs, registerSendCodecs };
|
package/lib/index.js
CHANGED
|
@@ -9741,21 +9741,6 @@ const getChainId = (nodeUrl) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
9741
9741
|
const { data } = yield axios__default['default'].get(`${nodeUrl}/cosmos/base/tendermint/v1beta1/node_info`);
|
|
9742
9742
|
return ((_a = data === null || data === void 0 ? void 0 : data.default_node_info) === null || _a === void 0 ? void 0 : _a.network) || Promise.reject('Could not parse chain id');
|
|
9743
9743
|
});
|
|
9744
|
-
/**
|
|
9745
|
-
* Helper to get all THORChain's chain id
|
|
9746
|
-
* @param {ClientUrl} client urls (use `getDefaultClientUrl()` if you don't need to use custom urls)
|
|
9747
|
-
*/
|
|
9748
|
-
const getChainIds = (client) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9749
|
-
return Promise.all([
|
|
9750
|
-
getChainId(client[xchainClient.Network.Testnet].node),
|
|
9751
|
-
getChainId(client[xchainClient.Network.Stagenet].node),
|
|
9752
|
-
getChainId(client[xchainClient.Network.Mainnet].node),
|
|
9753
|
-
]).then(([testnetId, stagenetId, mainnetId]) => ({
|
|
9754
|
-
testnet: testnetId,
|
|
9755
|
-
stagenet: stagenetId,
|
|
9756
|
-
mainnet: mainnetId,
|
|
9757
|
-
}));
|
|
9758
|
-
});
|
|
9759
9744
|
/**
|
|
9760
9745
|
* Builds final unsigned TX
|
|
9761
9746
|
*
|
|
@@ -9892,27 +9877,6 @@ const getBalance = ({ address, assets, cosmosClient, }) => __awaiter(void 0, voi
|
|
|
9892
9877
|
}))
|
|
9893
9878
|
.filter((balance) => !assets || assets.filter((asset) => xchainUtil.assetToString(balance.asset) === xchainUtil.assetToString(asset)).length);
|
|
9894
9879
|
});
|
|
9895
|
-
/**
|
|
9896
|
-
* Get the client url.
|
|
9897
|
-
*
|
|
9898
|
-
* @returns {ClientUrl} The client url (both mainnet and testnet) for thorchain.
|
|
9899
|
-
*/
|
|
9900
|
-
const getDefaultClientUrl = () => {
|
|
9901
|
-
return {
|
|
9902
|
-
[xchainClient.Network.Testnet]: {
|
|
9903
|
-
node: 'https://testnet.thornode.thorchain.info',
|
|
9904
|
-
rpc: 'https://testnet-rpc.ninerealms.com',
|
|
9905
|
-
},
|
|
9906
|
-
[xchainClient.Network.Stagenet]: {
|
|
9907
|
-
node: 'https://stagenet-thornode.ninerealms.com',
|
|
9908
|
-
rpc: 'https://stagenet-rpc.ninerealms.com',
|
|
9909
|
-
},
|
|
9910
|
-
[xchainClient.Network.Mainnet]: {
|
|
9911
|
-
node: 'https://thornode.ninerealms.com',
|
|
9912
|
-
rpc: 'https://rpc.ninerealms.com',
|
|
9913
|
-
},
|
|
9914
|
-
};
|
|
9915
|
-
};
|
|
9916
9880
|
const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
|
|
9917
9881
|
/**
|
|
9918
9882
|
* Get default explorer urls.
|
|
@@ -10061,7 +10025,7 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10061
10025
|
txs,
|
|
10062
10026
|
};
|
|
10063
10027
|
});
|
|
10064
|
-
this.clientUrl = clientUrl
|
|
10028
|
+
this.clientUrl = clientUrl;
|
|
10065
10029
|
this.explorerUrls = explorerUrls || getDefaultExplorerUrls();
|
|
10066
10030
|
this.chainIds = chainIds;
|
|
10067
10031
|
registerSendCodecs();
|
|
@@ -10508,8 +10472,6 @@ exports.buildTransferTx = buildTransferTx;
|
|
|
10508
10472
|
exports.buildUnsignedTx = buildUnsignedTx;
|
|
10509
10473
|
exports.getBalance = getBalance;
|
|
10510
10474
|
exports.getChainId = getChainId;
|
|
10511
|
-
exports.getChainIds = getChainIds;
|
|
10512
|
-
exports.getDefaultClientUrl = getDefaultClientUrl;
|
|
10513
10475
|
exports.getDefaultExplorerUrls = getDefaultExplorerUrls;
|
|
10514
10476
|
exports.getDefaultFees = getDefaultFees;
|
|
10515
10477
|
exports.getDenom = getDenom;
|
|
@@ -16,7 +16,7 @@ export declare type ExplorerUrl = Record<Network, string>;
|
|
|
16
16
|
export declare type ChainId = string;
|
|
17
17
|
export declare type ChainIds = Record<Network, ChainId>;
|
|
18
18
|
export declare type ThorchainClientParams = {
|
|
19
|
-
clientUrl
|
|
19
|
+
clientUrl: ClientUrl;
|
|
20
20
|
explorerUrls?: ExplorerUrls;
|
|
21
21
|
chainIds: ChainIds;
|
|
22
22
|
};
|
package/lib/util.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ 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';
|
|
5
5
|
import Long from 'long';
|
|
6
|
-
import { ChainId,
|
|
6
|
+
import { ChainId, ExplorerUrls, TxData } from './types';
|
|
7
7
|
import { MsgNativeTx } from './types/messages';
|
|
8
8
|
export declare const DECIMAL = 8;
|
|
9
9
|
export declare const DEFAULT_GAS_ADJUSTMENT = 2;
|
|
@@ -74,11 +74,6 @@ export declare const getTxType: (txData: string, encoding: 'base64' | 'hex') =>
|
|
|
74
74
|
* @param {string} nodeUrl THORNode url
|
|
75
75
|
*/
|
|
76
76
|
export declare const getChainId: (nodeUrl: string) => Promise<ChainId>;
|
|
77
|
-
/**
|
|
78
|
-
* Helper to get all THORChain's chain id
|
|
79
|
-
* @param {ClientUrl} client urls (use `getDefaultClientUrl()` if you don't need to use custom urls)
|
|
80
|
-
*/
|
|
81
|
-
export declare const getChainIds: (client: ClientUrl) => Promise<ChainIds>;
|
|
82
77
|
/**
|
|
83
78
|
* Builds final unsigned TX
|
|
84
79
|
*
|
|
@@ -161,12 +156,6 @@ export declare const getBalance: ({ address, assets, cosmosClient, }: {
|
|
|
161
156
|
assets?: Asset[] | undefined;
|
|
162
157
|
cosmosClient: CosmosSDKClient;
|
|
163
158
|
}) => Promise<Balance[]>;
|
|
164
|
-
/**
|
|
165
|
-
* Get the client url.
|
|
166
|
-
*
|
|
167
|
-
* @returns {ClientUrl} The client url (both mainnet and testnet) for thorchain.
|
|
168
|
-
*/
|
|
169
|
-
export declare const getDefaultClientUrl: () => ClientUrl;
|
|
170
159
|
/**
|
|
171
160
|
* Get default explorer urls.
|
|
172
161
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xchainjs/xchain-thorchain",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Custom Thorchain client and utilities used by XChainJS clients",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"THORChain",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@cosmos-client/core": "0.45.13",
|
|
38
38
|
"@types/big.js": "^6.0.0",
|
|
39
|
-
"@xchainjs/xchain-client": "^0.13.
|
|
39
|
+
"@xchainjs/xchain-client": "^0.13.2",
|
|
40
40
|
"@xchainjs/xchain-cosmos": "^0.20.0",
|
|
41
41
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
42
|
-
"@xchainjs/xchain-util": "^0.
|
|
42
|
+
"@xchainjs/xchain-util": "^0.11.0",
|
|
43
43
|
"axios": "^0.25.0",
|
|
44
44
|
"bech32-buffer": "^0.2.0",
|
|
45
45
|
"nock": "^13.0.5"
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@cosmos-client/core": "0.45.13",
|
|
52
|
-
"@xchainjs/xchain-client": "^0.13.
|
|
52
|
+
"@xchainjs/xchain-client": "^0.13.2",
|
|
53
53
|
"@xchainjs/xchain-cosmos": "^0.19.0",
|
|
54
54
|
"@xchainjs/xchain-crypto": "^0.2.6",
|
|
55
|
-
"@xchainjs/xchain-util": "^0.
|
|
55
|
+
"@xchainjs/xchain-util": "^0.11.0",
|
|
56
56
|
"axios": "^0.25.0",
|
|
57
57
|
"bech32-buffer": "^0.2.0"
|
|
58
58
|
}
|