@xchainjs/xchain-thorchain 0.24.0-alpha.1 → 0.24.0-alpha.2
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 +9 -13
- package/lib/index.js +9 -13
- package/lib/util.d.ts +4 -8
- package/package.json +1 -1
package/lib/index.esm.js
CHANGED
|
@@ -5439,21 +5439,17 @@ const getPrefix = (network) => {
|
|
|
5439
5439
|
}
|
|
5440
5440
|
};
|
|
5441
5441
|
/**
|
|
5442
|
-
* Register
|
|
5443
|
-
*
|
|
5444
|
-
* @param {string} prefix
|
|
5442
|
+
* Register type for encoding `MsgDeposit` messages
|
|
5445
5443
|
*/
|
|
5446
|
-
const
|
|
5444
|
+
const registerDepositCodecs = () => {
|
|
5447
5445
|
cosmosclient.codec.register('/types.MsgDeposit', MsgCompiled.types.MsgDeposit);
|
|
5448
|
-
}
|
|
5446
|
+
};
|
|
5449
5447
|
/**
|
|
5450
|
-
* Register
|
|
5451
|
-
*
|
|
5452
|
-
* @param {string} prefix
|
|
5448
|
+
* Register type for encoding `MsgSend` messages
|
|
5453
5449
|
*/
|
|
5454
|
-
const registerSendCodecs = () =>
|
|
5450
|
+
const registerSendCodecs = () => {
|
|
5455
5451
|
cosmosclient.codec.register('/types.MsgSend', MsgCompiled.types.MsgSend);
|
|
5456
|
-
}
|
|
5452
|
+
};
|
|
5457
5453
|
/**
|
|
5458
5454
|
* Parse transaction data from event logs
|
|
5459
5455
|
*
|
|
@@ -5817,6 +5813,8 @@ class Client extends BaseXChainClient {
|
|
|
5817
5813
|
this.clientUrl = clientUrl || getDefaultClientUrl();
|
|
5818
5814
|
this.explorerUrls = explorerUrls || getDefaultExplorerUrls();
|
|
5819
5815
|
this.chainIds = chainIds;
|
|
5816
|
+
registerSendCodecs();
|
|
5817
|
+
registerDepositCodecs();
|
|
5820
5818
|
this.cosmosClient = new CosmosSDKClient({
|
|
5821
5819
|
server: this.getClientUrl().node,
|
|
5822
5820
|
chainId: this.getChainId(network),
|
|
@@ -6048,7 +6046,6 @@ class Client extends BaseXChainClient {
|
|
|
6048
6046
|
deposit({ walletIndex = 0, asset = AssetRuneNative, amount, memo }) {
|
|
6049
6047
|
var _a, _b, _c, _d;
|
|
6050
6048
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6051
|
-
yield registerDespositCodecs();
|
|
6052
6049
|
const balances = yield this.getBalance(this.getAddress(walletIndex));
|
|
6053
6050
|
const runeBalance = (_b = (_a = balances.filter(({ asset }) => isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : baseAmount(0, DECIMAL);
|
|
6054
6051
|
const assetBalance = (_d = (_c = balances.filter(({ asset: assetInList }) => assetToString(assetInList) === assetToString(asset))[0]) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : baseAmount(0, DECIMAL);
|
|
@@ -6103,7 +6100,6 @@ class Client extends BaseXChainClient {
|
|
|
6103
6100
|
transfer({ walletIndex = 0, asset = AssetRuneNative, amount, recipient, memo }) {
|
|
6104
6101
|
var _a, _b, _c, _d;
|
|
6105
6102
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6106
|
-
yield registerSendCodecs();
|
|
6107
6103
|
const balances = yield this.getBalance(this.getAddress(walletIndex));
|
|
6108
6104
|
const runeBalance = (_b = (_a = balances.filter(({ asset }) => isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : baseAmount(0, DECIMAL);
|
|
6109
6105
|
const assetBalance = (_d = (_c = balances.filter(({ asset: assetInList }) => assetToString(assetInList) === assetToString(asset))[0]) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : baseAmount(0, DECIMAL);
|
|
@@ -6226,4 +6222,4 @@ const msgNativeTxFromJson = (value) => {
|
|
|
6226
6222
|
return new MsgNativeTx(value.coins, value.memo, cosmosclient.AccAddress.fromString(value.signer));
|
|
6227
6223
|
};
|
|
6228
6224
|
|
|
6229
|
-
export { Client, DECIMAL, DEFAULT_GAS_VALUE, DEPOSIT_GAS_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, buildTransferTx, buildUnsignedTx, getBalance, getChainId, getChainIds, getDefaultClientUrl, getDefaultExplorerUrls, getDefaultFees, getDenom, getDepositTxDataFromLogs, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getTxType, isAssetRuneNative, isBroadcastSuccess, msgNativeTxFromJson,
|
|
6225
|
+
export { Client, DECIMAL, DEFAULT_GAS_VALUE, DEPOSIT_GAS_VALUE, MAX_TX_COUNT, MsgNativeTx, assetFromDenom, buildDepositTx, buildTransferTx, buildUnsignedTx, getBalance, getChainId, getChainIds, getDefaultClientUrl, getDefaultExplorerUrls, getDefaultFees, getDenom, getDepositTxDataFromLogs, getExplorerAddressUrl, getExplorerTxUrl, getExplorerUrl, getPrefix, getTxType, isAssetRuneNative, isBroadcastSuccess, msgNativeTxFromJson, registerDepositCodecs, registerSendCodecs };
|
package/lib/index.js
CHANGED
|
@@ -5447,21 +5447,17 @@ const getPrefix = (network) => {
|
|
|
5447
5447
|
}
|
|
5448
5448
|
};
|
|
5449
5449
|
/**
|
|
5450
|
-
* Register
|
|
5451
|
-
*
|
|
5452
|
-
* @param {string} prefix
|
|
5450
|
+
* Register type for encoding `MsgDeposit` messages
|
|
5453
5451
|
*/
|
|
5454
|
-
const
|
|
5452
|
+
const registerDepositCodecs = () => {
|
|
5455
5453
|
core.cosmosclient.codec.register('/types.MsgDeposit', MsgCompiled.types.MsgDeposit);
|
|
5456
|
-
}
|
|
5454
|
+
};
|
|
5457
5455
|
/**
|
|
5458
|
-
* Register
|
|
5459
|
-
*
|
|
5460
|
-
* @param {string} prefix
|
|
5456
|
+
* Register type for encoding `MsgSend` messages
|
|
5461
5457
|
*/
|
|
5462
|
-
const registerSendCodecs = () =>
|
|
5458
|
+
const registerSendCodecs = () => {
|
|
5463
5459
|
core.cosmosclient.codec.register('/types.MsgSend', MsgCompiled.types.MsgSend);
|
|
5464
|
-
}
|
|
5460
|
+
};
|
|
5465
5461
|
/**
|
|
5466
5462
|
* Parse transaction data from event logs
|
|
5467
5463
|
*
|
|
@@ -5825,6 +5821,8 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
5825
5821
|
this.clientUrl = clientUrl || getDefaultClientUrl();
|
|
5826
5822
|
this.explorerUrls = explorerUrls || getDefaultExplorerUrls();
|
|
5827
5823
|
this.chainIds = chainIds;
|
|
5824
|
+
registerSendCodecs();
|
|
5825
|
+
registerDepositCodecs();
|
|
5828
5826
|
this.cosmosClient = new xchainCosmos.CosmosSDKClient({
|
|
5829
5827
|
server: this.getClientUrl().node,
|
|
5830
5828
|
chainId: this.getChainId(network),
|
|
@@ -6056,7 +6054,6 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
6056
6054
|
deposit({ walletIndex = 0, asset = xchainUtil.AssetRuneNative, amount, memo }) {
|
|
6057
6055
|
var _a, _b, _c, _d;
|
|
6058
6056
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6059
|
-
yield registerDespositCodecs();
|
|
6060
6057
|
const balances = yield this.getBalance(this.getAddress(walletIndex));
|
|
6061
6058
|
const runeBalance = (_b = (_a = balances.filter(({ asset }) => isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : xchainUtil.baseAmount(0, DECIMAL);
|
|
6062
6059
|
const assetBalance = (_d = (_c = balances.filter(({ asset: assetInList }) => xchainUtil.assetToString(assetInList) === xchainUtil.assetToString(asset))[0]) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : xchainUtil.baseAmount(0, DECIMAL);
|
|
@@ -6111,7 +6108,6 @@ class Client extends xchainClient.BaseXChainClient {
|
|
|
6111
6108
|
transfer({ walletIndex = 0, asset = xchainUtil.AssetRuneNative, amount, recipient, memo }) {
|
|
6112
6109
|
var _a, _b, _c, _d;
|
|
6113
6110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
6114
|
-
yield registerSendCodecs();
|
|
6115
6111
|
const balances = yield this.getBalance(this.getAddress(walletIndex));
|
|
6116
6112
|
const runeBalance = (_b = (_a = balances.filter(({ asset }) => isAssetRuneNative(asset))[0]) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : xchainUtil.baseAmount(0, DECIMAL);
|
|
6117
6113
|
const assetBalance = (_d = (_c = balances.filter(({ asset: assetInList }) => xchainUtil.assetToString(assetInList) === xchainUtil.assetToString(asset))[0]) === null || _c === void 0 ? void 0 : _c.amount) !== null && _d !== void 0 ? _d : xchainUtil.baseAmount(0, DECIMAL);
|
|
@@ -6260,5 +6256,5 @@ exports.getTxType = getTxType;
|
|
|
6260
6256
|
exports.isAssetRuneNative = isAssetRuneNative;
|
|
6261
6257
|
exports.isBroadcastSuccess = isBroadcastSuccess;
|
|
6262
6258
|
exports.msgNativeTxFromJson = msgNativeTxFromJson;
|
|
6263
|
-
exports.
|
|
6259
|
+
exports.registerDepositCodecs = registerDepositCodecs;
|
|
6264
6260
|
exports.registerSendCodecs = registerSendCodecs;
|
package/lib/util.d.ts
CHANGED
|
@@ -45,17 +45,13 @@ export declare const isBroadcastSuccess: (response: unknown) => boolean;
|
|
|
45
45
|
**/
|
|
46
46
|
export declare const getPrefix: (network: Network) => "thor" | "sthor" | "tthor";
|
|
47
47
|
/**
|
|
48
|
-
* Register
|
|
49
|
-
*
|
|
50
|
-
* @param {string} prefix
|
|
48
|
+
* Register type for encoding `MsgDeposit` messages
|
|
51
49
|
*/
|
|
52
|
-
export declare const
|
|
50
|
+
export declare const registerDepositCodecs: () => void;
|
|
53
51
|
/**
|
|
54
|
-
* Register
|
|
55
|
-
*
|
|
56
|
-
* @param {string} prefix
|
|
52
|
+
* Register type for encoding `MsgSend` messages
|
|
57
53
|
*/
|
|
58
|
-
export declare const registerSendCodecs: () =>
|
|
54
|
+
export declare const registerSendCodecs: () => void;
|
|
59
55
|
/**
|
|
60
56
|
* Parse transaction data from event logs
|
|
61
57
|
*
|