@xchainjs/xchain-thorchain 0.27.0 → 0.27.1
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 +41 -34
- package/lib/index.js +41 -34
- package/lib/types/client-types.d.ts +2 -2
- package/lib/util.d.ts +1 -6
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -9605,6 +9605,26 @@ const DEFAULT_GAS_LIMIT_VALUE = '4000000';
|
|
|
9605
9605
|
const DEPOSIT_GAS_LIMIT_VALUE = '600000000';
|
|
9606
9606
|
const MAX_TX_COUNT = 100;
|
|
9607
9607
|
const DENOM_RUNE_NATIVE = 'rune';
|
|
9608
|
+
const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
|
|
9609
|
+
const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
|
|
9610
|
+
const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
|
|
9611
|
+
const defaultExplorerUrls = {
|
|
9612
|
+
root: {
|
|
9613
|
+
[Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
|
|
9614
|
+
[Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
|
|
9615
|
+
[Network.Mainnet]: DEFAULT_EXPLORER_URL,
|
|
9616
|
+
},
|
|
9617
|
+
tx: {
|
|
9618
|
+
[Network.Testnet]: txUrl,
|
|
9619
|
+
[Network.Stagenet]: txUrl,
|
|
9620
|
+
[Network.Mainnet]: txUrl,
|
|
9621
|
+
},
|
|
9622
|
+
address: {
|
|
9623
|
+
[Network.Testnet]: addressUrl,
|
|
9624
|
+
[Network.Stagenet]: addressUrl,
|
|
9625
|
+
[Network.Mainnet]: addressUrl,
|
|
9626
|
+
},
|
|
9627
|
+
};
|
|
9608
9628
|
/**
|
|
9609
9629
|
* Get denomination from Asset
|
|
9610
9630
|
*
|
|
@@ -9869,36 +9889,6 @@ const getBalance = ({ address, assets, cosmosClient, }) => __awaiter(void 0, voi
|
|
|
9869
9889
|
}))
|
|
9870
9890
|
.filter((balance) => !assets || assets.filter((asset) => assetToString(balance.asset) === assetToString(asset)).length);
|
|
9871
9891
|
});
|
|
9872
|
-
const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
|
|
9873
|
-
/**
|
|
9874
|
-
* Get default explorer urls.
|
|
9875
|
-
*
|
|
9876
|
-
* @returns {ExplorerUrls} Default explorer urls (both mainnet and testnet) for thorchain.
|
|
9877
|
-
*/
|
|
9878
|
-
const getDefaultExplorerUrls = () => {
|
|
9879
|
-
const root = {
|
|
9880
|
-
[Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
|
|
9881
|
-
[Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
|
|
9882
|
-
[Network.Mainnet]: DEFAULT_EXPLORER_URL,
|
|
9883
|
-
};
|
|
9884
|
-
const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
|
|
9885
|
-
const tx = {
|
|
9886
|
-
[Network.Testnet]: txUrl,
|
|
9887
|
-
[Network.Stagenet]: txUrl,
|
|
9888
|
-
[Network.Mainnet]: txUrl,
|
|
9889
|
-
};
|
|
9890
|
-
const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
|
|
9891
|
-
const address = {
|
|
9892
|
-
[Network.Testnet]: addressUrl,
|
|
9893
|
-
[Network.Stagenet]: addressUrl,
|
|
9894
|
-
[Network.Mainnet]: addressUrl,
|
|
9895
|
-
};
|
|
9896
|
-
return {
|
|
9897
|
-
root,
|
|
9898
|
-
tx,
|
|
9899
|
-
address,
|
|
9900
|
-
};
|
|
9901
|
-
};
|
|
9902
9892
|
/**
|
|
9903
9893
|
* Get the explorer url.
|
|
9904
9894
|
*
|
|
@@ -9960,11 +9950,28 @@ class Client extends BaseXChainClient {
|
|
|
9960
9950
|
*
|
|
9961
9951
|
* @throws {"Invalid phrase"} Thrown if the given phase is invalid.
|
|
9962
9952
|
*/
|
|
9963
|
-
constructor({ network = Network.
|
|
9953
|
+
constructor({ network = Network.Mainnet, phrase, clientUrl = {
|
|
9954
|
+
[Network.Testnet]: {
|
|
9955
|
+
node: 'deprecated',
|
|
9956
|
+
rpc: 'deprecated',
|
|
9957
|
+
},
|
|
9958
|
+
[Network.Stagenet]: {
|
|
9959
|
+
node: 'https://stagenet-thornode.ninerealms.com',
|
|
9960
|
+
rpc: 'https://stagenet-rpc.ninerealms.com',
|
|
9961
|
+
},
|
|
9962
|
+
[Network.Mainnet]: {
|
|
9963
|
+
node: 'https://thornode.ninerealms.com',
|
|
9964
|
+
rpc: 'https://rpc.ninerealms.com',
|
|
9965
|
+
},
|
|
9966
|
+
}, explorerUrls = defaultExplorerUrls, rootDerivationPaths = {
|
|
9964
9967
|
[Network.Mainnet]: "44'/931'/0'/0/",
|
|
9965
9968
|
[Network.Stagenet]: "44'/931'/0'/0/",
|
|
9966
9969
|
[Network.Testnet]: "44'/931'/0'/0/",
|
|
9967
|
-
}, chainIds
|
|
9970
|
+
}, chainIds = {
|
|
9971
|
+
[Network.Mainnet]: 'thorchain-mainnet-v1',
|
|
9972
|
+
[Network.Stagenet]: 'chain-id-stagenet',
|
|
9973
|
+
[Network.Testnet]: 'deprecated',
|
|
9974
|
+
}, }) {
|
|
9968
9975
|
super(Chain.Cosmos, { network, rootDerivationPaths, phrase });
|
|
9969
9976
|
/**
|
|
9970
9977
|
* Get transaction history of a given address with pagination options.
|
|
@@ -10018,7 +10025,7 @@ class Client extends BaseXChainClient {
|
|
|
10018
10025
|
};
|
|
10019
10026
|
});
|
|
10020
10027
|
this.clientUrl = clientUrl;
|
|
10021
|
-
this.explorerUrls = explorerUrls
|
|
10028
|
+
this.explorerUrls = explorerUrls;
|
|
10022
10029
|
this.chainIds = chainIds;
|
|
10023
10030
|
registerSendCodecs();
|
|
10024
10031
|
registerDepositCodecs();
|
|
@@ -10451,4 +10458,4 @@ const msgNativeTxFromJson = (value) => {
|
|
|
10451
10458
|
return new MsgNativeTx(value.coins, value.memo, cosmosclient.AccAddress.fromString(value.signer));
|
|
10452
10459
|
};
|
|
10453
10460
|
|
|
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,
|
|
10461
|
+
export { Client, DECIMAL, DEFAULT_GAS_ADJUSTMENT, DEFAULT_GAS_LIMIT_VALUE, DEPOSIT_GAS_LIMIT_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, buildTransferTx, buildUnsignedTx, defaultExplorerUrls, getBalance, getChainId, getDefaultFees, getDenom, getDepositTxDataFromLogs, getEstimatedGas, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getTxType, isBroadcastSuccess, msgNativeTxFromJson, registerDepositCodecs, registerSendCodecs };
|
package/lib/index.js
CHANGED
|
@@ -9613,6 +9613,26 @@ const DEFAULT_GAS_LIMIT_VALUE = '4000000';
|
|
|
9613
9613
|
const DEPOSIT_GAS_LIMIT_VALUE = '600000000';
|
|
9614
9614
|
const MAX_TX_COUNT = 100;
|
|
9615
9615
|
const DENOM_RUNE_NATIVE = 'rune';
|
|
9616
|
+
const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
|
|
9617
|
+
const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
|
|
9618
|
+
const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
|
|
9619
|
+
const defaultExplorerUrls = {
|
|
9620
|
+
root: {
|
|
9621
|
+
[xchainClient.Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
|
|
9622
|
+
[xchainClient.Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
|
|
9623
|
+
[xchainClient.Network.Mainnet]: DEFAULT_EXPLORER_URL,
|
|
9624
|
+
},
|
|
9625
|
+
tx: {
|
|
9626
|
+
[xchainClient.Network.Testnet]: txUrl,
|
|
9627
|
+
[xchainClient.Network.Stagenet]: txUrl,
|
|
9628
|
+
[xchainClient.Network.Mainnet]: txUrl,
|
|
9629
|
+
},
|
|
9630
|
+
address: {
|
|
9631
|
+
[xchainClient.Network.Testnet]: addressUrl,
|
|
9632
|
+
[xchainClient.Network.Stagenet]: addressUrl,
|
|
9633
|
+
[xchainClient.Network.Mainnet]: addressUrl,
|
|
9634
|
+
},
|
|
9635
|
+
};
|
|
9616
9636
|
/**
|
|
9617
9637
|
* Get denomination from Asset
|
|
9618
9638
|
*
|
|
@@ -9877,36 +9897,6 @@ const getBalance = ({ address, assets, cosmosClient, }) => __awaiter(void 0, voi
|
|
|
9877
9897
|
}))
|
|
9878
9898
|
.filter((balance) => !assets || assets.filter((asset) => xchainUtil.assetToString(balance.asset) === xchainUtil.assetToString(asset)).length);
|
|
9879
9899
|
});
|
|
9880
|
-
const DEFAULT_EXPLORER_URL = 'https://viewblock.io/thorchain';
|
|
9881
|
-
/**
|
|
9882
|
-
* Get default explorer urls.
|
|
9883
|
-
*
|
|
9884
|
-
* @returns {ExplorerUrls} Default explorer urls (both mainnet and testnet) for thorchain.
|
|
9885
|
-
*/
|
|
9886
|
-
const getDefaultExplorerUrls = () => {
|
|
9887
|
-
const root = {
|
|
9888
|
-
[xchainClient.Network.Testnet]: `${DEFAULT_EXPLORER_URL}?network=testnet`,
|
|
9889
|
-
[xchainClient.Network.Stagenet]: `${DEFAULT_EXPLORER_URL}?network=stagenet`,
|
|
9890
|
-
[xchainClient.Network.Mainnet]: DEFAULT_EXPLORER_URL,
|
|
9891
|
-
};
|
|
9892
|
-
const txUrl = `${DEFAULT_EXPLORER_URL}/tx`;
|
|
9893
|
-
const tx = {
|
|
9894
|
-
[xchainClient.Network.Testnet]: txUrl,
|
|
9895
|
-
[xchainClient.Network.Stagenet]: txUrl,
|
|
9896
|
-
[xchainClient.Network.Mainnet]: txUrl,
|
|
9897
|
-
};
|
|
9898
|
-
const addressUrl = `${DEFAULT_EXPLORER_URL}/address`;
|
|
9899
|
-
const address = {
|
|
9900
|
-
[xchainClient.Network.Testnet]: addressUrl,
|
|
9901
|
-
[xchainClient.Network.Stagenet]: addressUrl,
|
|
9902
|
-
[xchainClient.Network.Mainnet]: addressUrl,
|
|
9903
|
-
};
|
|
9904
|
-
return {
|
|
9905
|
-
root,
|
|
9906
|
-
tx,
|
|
9907
|
-
address,
|
|
9908
|
-
};
|
|
9909
|
-
};
|
|
9910
9900
|
/**
|
|
9911
9901
|
* Get the explorer url.
|
|
9912
9902
|
*
|
|
@@ -9968,11 +9958,28 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
9968
9958
|
*
|
|
9969
9959
|
* @throws {"Invalid phrase"} Thrown if the given phase is invalid.
|
|
9970
9960
|
*/
|
|
9971
|
-
constructor({ network = xchainClient.Network.
|
|
9961
|
+
constructor({ network = xchainClient.Network.Mainnet, phrase, clientUrl = {
|
|
9962
|
+
[xchainClient.Network.Testnet]: {
|
|
9963
|
+
node: 'deprecated',
|
|
9964
|
+
rpc: 'deprecated',
|
|
9965
|
+
},
|
|
9966
|
+
[xchainClient.Network.Stagenet]: {
|
|
9967
|
+
node: 'https://stagenet-thornode.ninerealms.com',
|
|
9968
|
+
rpc: 'https://stagenet-rpc.ninerealms.com',
|
|
9969
|
+
},
|
|
9970
|
+
[xchainClient.Network.Mainnet]: {
|
|
9971
|
+
node: 'https://thornode.ninerealms.com',
|
|
9972
|
+
rpc: 'https://rpc.ninerealms.com',
|
|
9973
|
+
},
|
|
9974
|
+
}, explorerUrls = defaultExplorerUrls, rootDerivationPaths = {
|
|
9972
9975
|
[xchainClient.Network.Mainnet]: "44'/931'/0'/0/",
|
|
9973
9976
|
[xchainClient.Network.Stagenet]: "44'/931'/0'/0/",
|
|
9974
9977
|
[xchainClient.Network.Testnet]: "44'/931'/0'/0/",
|
|
9975
|
-
}, chainIds
|
|
9978
|
+
}, chainIds = {
|
|
9979
|
+
[xchainClient.Network.Mainnet]: 'thorchain-mainnet-v1',
|
|
9980
|
+
[xchainClient.Network.Stagenet]: 'chain-id-stagenet',
|
|
9981
|
+
[xchainClient.Network.Testnet]: 'deprecated',
|
|
9982
|
+
}, }) {
|
|
9976
9983
|
super(xchainUtil.Chain.Cosmos, { network, rootDerivationPaths, phrase });
|
|
9977
9984
|
/**
|
|
9978
9985
|
* Get transaction history of a given address with pagination options.
|
|
@@ -10026,7 +10033,7 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
10026
10033
|
};
|
|
10027
10034
|
});
|
|
10028
10035
|
this.clientUrl = clientUrl;
|
|
10029
|
-
this.explorerUrls = explorerUrls
|
|
10036
|
+
this.explorerUrls = explorerUrls;
|
|
10030
10037
|
this.chainIds = chainIds;
|
|
10031
10038
|
registerSendCodecs();
|
|
10032
10039
|
registerDepositCodecs();
|
|
@@ -10470,9 +10477,9 @@ exports.assetFromDenom = assetFromDenom;
|
|
|
10470
10477
|
exports.buildDepositTx = buildDepositTx;
|
|
10471
10478
|
exports.buildTransferTx = buildTransferTx;
|
|
10472
10479
|
exports.buildUnsignedTx = buildUnsignedTx;
|
|
10480
|
+
exports.defaultExplorerUrls = defaultExplorerUrls;
|
|
10473
10481
|
exports.getBalance = getBalance;
|
|
10474
10482
|
exports.getChainId = getChainId;
|
|
10475
|
-
exports.getDefaultExplorerUrls = getDefaultExplorerUrls;
|
|
10476
10483
|
exports.getDefaultFees = getDefaultFees;
|
|
10477
10484
|
exports.getDenom = getDenom;
|
|
10478
10485
|
exports.getDepositTxDataFromLogs = getDepositTxDataFromLogs;
|
|
@@ -16,9 +16,9 @@ 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
|
-
chainIds
|
|
21
|
+
chainIds?: ChainIds;
|
|
22
22
|
};
|
|
23
23
|
export declare type DepositParam = {
|
|
24
24
|
walletIndex?: number;
|
package/lib/util.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const DEFAULT_GAS_ADJUSTMENT = 2;
|
|
|
10
10
|
export declare const DEFAULT_GAS_LIMIT_VALUE = "4000000";
|
|
11
11
|
export declare const DEPOSIT_GAS_LIMIT_VALUE = "600000000";
|
|
12
12
|
export declare const MAX_TX_COUNT = 100;
|
|
13
|
+
export declare const defaultExplorerUrls: ExplorerUrls;
|
|
13
14
|
/**
|
|
14
15
|
* Get denomination from Asset
|
|
15
16
|
*
|
|
@@ -156,12 +157,6 @@ export declare const getBalance: ({ address, assets, cosmosClient, }: {
|
|
|
156
157
|
assets?: Asset[] | undefined;
|
|
157
158
|
cosmosClient: CosmosSDKClient;
|
|
158
159
|
}) => Promise<Balance[]>;
|
|
159
|
-
/**
|
|
160
|
-
* Get default explorer urls.
|
|
161
|
-
*
|
|
162
|
-
* @returns {ExplorerUrls} Default explorer urls (both mainnet and testnet) for thorchain.
|
|
163
|
-
*/
|
|
164
|
-
export declare const getDefaultExplorerUrls: () => ExplorerUrls;
|
|
165
160
|
/**
|
|
166
161
|
* Get the explorer url.
|
|
167
162
|
*
|