@paraspell/sdk-core 11.10.0 → 11.11.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/dist/index.cjs +54 -49
- package/dist/index.d.ts +9 -4
- package/dist/index.mjs +55 -50
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -5316,19 +5316,18 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5316
5316
|
initialForwardedXcms = originDryModified.forwardedXcms, initialDestParaId = originDryModified.destParaId;
|
|
5317
5317
|
processHop = /*#__PURE__*/function () {
|
|
5318
5318
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
5319
|
-
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange,
|
|
5319
|
+
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, _findAssetInfoOnDest, hopDryRun;
|
|
5320
5320
|
return _regenerator().w(function (_context) {
|
|
5321
5321
|
while (1) switch (_context.n) {
|
|
5322
5322
|
case 0:
|
|
5323
|
-
hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange
|
|
5323
|
+
hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange;
|
|
5324
5324
|
if (asset.location && asset.location.parents === sdkCommon.Parents.TWO) {
|
|
5325
5325
|
hopAsset = assets.findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
|
|
5326
5326
|
} else if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
|
|
5327
5327
|
hopAsset = assets.findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
|
|
5328
|
-
} else if (isDestination) {
|
|
5329
|
-
hopAsset = assets.findAssetOnDestOrThrow(origin, currentChain, currency);
|
|
5330
5328
|
} else {
|
|
5331
5329
|
hopAsset = asset;
|
|
5330
|
+
hopAsset = (_findAssetInfoOnDest = assets.findAssetInfoOnDest(origin, currentChain, currency)) !== null && _findAssetInfoOnDest !== void 0 ? _findAssetInfoOnDest : asset;
|
|
5332
5331
|
}
|
|
5333
5332
|
if (assets.hasDryRunSupport(currentChain)) {
|
|
5334
5333
|
_context.n = 1;
|
|
@@ -11468,7 +11467,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11468
11467
|
case 10:
|
|
11469
11468
|
processHop = /*#__PURE__*/function () {
|
|
11470
11469
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
11471
|
-
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, hopResult;
|
|
11470
|
+
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, _findAssetInfoOnDest, hopResult;
|
|
11472
11471
|
return _regenerator().w(function (_context) {
|
|
11473
11472
|
while (1) switch (_context.n) {
|
|
11474
11473
|
case 0:
|
|
@@ -11476,10 +11475,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11476
11475
|
if (!(currentAsset.location && currentAsset.location.parents === sdkCommon.Parents.TWO)) {
|
|
11477
11476
|
if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
|
|
11478
11477
|
hopAsset = assets.findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
|
|
11479
|
-
} else if (destination === currentChain) {
|
|
11480
|
-
hopAsset = assets.findAssetOnDestOrThrow(origin, currentChain, currency);
|
|
11481
11478
|
} else {
|
|
11482
|
-
hopAsset = currentAsset;
|
|
11479
|
+
hopAsset = (_findAssetInfoOnDest = assets.findAssetInfoOnDest(origin, currentChain, currency)) !== null && _findAssetInfoOnDest !== void 0 ? _findAssetInfoOnDest : currentAsset;
|
|
11483
11480
|
}
|
|
11484
11481
|
} else {
|
|
11485
11482
|
hopAsset = assets.findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
|
|
@@ -12161,83 +12158,56 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
12161
12158
|
|
|
12162
12159
|
var buildHopInfo = /*#__PURE__*/function () {
|
|
12163
12160
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
12164
|
-
var api, chain, feeData, originChain, asset, currency,
|
|
12161
|
+
var api, chain, feeData, originChain, asset, currency, hopApi, xcmFeeDetails, isBridgeHub, hopAsset, hopCurrencyPayload, ed;
|
|
12165
12162
|
return _regenerator().w(function (_context) {
|
|
12166
12163
|
while (1) switch (_context.p = _context.n) {
|
|
12167
12164
|
case 0:
|
|
12168
|
-
api = _ref.api, chain = _ref.chain, feeData = _ref.feeData, originChain = _ref.originChain, asset = _ref.asset, currency = _ref.currency
|
|
12165
|
+
api = _ref.api, chain = _ref.chain, feeData = _ref.feeData, originChain = _ref.originChain, asset = _ref.asset, currency = _ref.currency;
|
|
12169
12166
|
hopApi = api.clone();
|
|
12170
12167
|
_context.n = 1;
|
|
12171
12168
|
return hopApi.init(chain);
|
|
12172
12169
|
case 1:
|
|
12173
12170
|
hopApi.setDisconnectAllowed(false);
|
|
12174
12171
|
_context.p = 2;
|
|
12175
|
-
resolvedAddress = assets.isChainEvm(originChain) && ahAddress ? ahAddress : senderAddress;
|
|
12176
|
-
_context.n = 3;
|
|
12177
|
-
return getBalanceNativeInternal({
|
|
12178
|
-
api: hopApi,
|
|
12179
|
-
address: resolvedAddress,
|
|
12180
|
-
chain: chain
|
|
12181
|
-
});
|
|
12182
|
-
case 3:
|
|
12183
|
-
nativeBalanceOnHop = _context.v;
|
|
12184
|
-
nativeAssetSymbolOnHop = assets.getNativeAssetSymbol(chain);
|
|
12185
12172
|
xcmFeeDetails = {
|
|
12186
12173
|
fee: feeData.fee,
|
|
12187
|
-
|
|
12188
|
-
currencySymbol: nativeAssetSymbolOnHop,
|
|
12174
|
+
currencySymbol: asset.symbol,
|
|
12189
12175
|
asset: asset
|
|
12190
12176
|
};
|
|
12191
12177
|
isBridgeHub = chain.includes('BridgeHub');
|
|
12192
12178
|
if (!isBridgeHub) {
|
|
12193
|
-
_context.n =
|
|
12179
|
+
_context.n = 3;
|
|
12194
12180
|
break;
|
|
12195
12181
|
}
|
|
12196
12182
|
return _context.a(2, {
|
|
12197
12183
|
currencySymbol: assets.getNativeAssetSymbol(chain),
|
|
12198
12184
|
xcmFee: xcmFeeDetails
|
|
12199
12185
|
});
|
|
12200
|
-
case
|
|
12186
|
+
case 3:
|
|
12201
12187
|
hopAsset = assets.findAssetOnDestOrThrow(originChain, chain, currency);
|
|
12202
12188
|
hopCurrencyPayload = hopAsset.location ? {
|
|
12203
12189
|
location: hopAsset.location
|
|
12204
12190
|
} : {
|
|
12205
12191
|
symbol: hopAsset.symbol
|
|
12206
12192
|
};
|
|
12207
|
-
|
|
12208
|
-
return getAssetBalanceInternal({
|
|
12209
|
-
api: hopApi,
|
|
12210
|
-
address: resolvedAddress,
|
|
12211
|
-
chain: chain,
|
|
12212
|
-
currency: hopCurrencyPayload
|
|
12213
|
-
});
|
|
12214
|
-
case 5:
|
|
12215
|
-
balance = _context.v;
|
|
12216
|
-
ed = assets.getExistentialDeposit(chain, hopCurrencyPayload);
|
|
12217
|
-
if (ed) {
|
|
12218
|
-
_context.n = 6;
|
|
12219
|
-
break;
|
|
12220
|
-
}
|
|
12221
|
-
throw new InvalidParameterError("Existential deposit not found for chain ".concat(chain, " with currency ").concat(JSON.stringify(hopCurrencyPayload)));
|
|
12222
|
-
case 6:
|
|
12193
|
+
ed = assets.getExistentialDepositOrThrow(chain, hopCurrencyPayload);
|
|
12223
12194
|
return _context.a(2, {
|
|
12224
|
-
balance: balance,
|
|
12225
12195
|
currencySymbol: hopAsset.symbol,
|
|
12226
12196
|
asset: hopAsset,
|
|
12227
|
-
existentialDeposit:
|
|
12197
|
+
existentialDeposit: ed,
|
|
12228
12198
|
xcmFee: xcmFeeDetails
|
|
12229
12199
|
});
|
|
12230
|
-
case
|
|
12231
|
-
_context.p =
|
|
12200
|
+
case 4:
|
|
12201
|
+
_context.p = 4;
|
|
12232
12202
|
hopApi.setDisconnectAllowed(true);
|
|
12233
|
-
_context.n =
|
|
12203
|
+
_context.n = 5;
|
|
12234
12204
|
return hopApi.disconnect();
|
|
12235
|
-
case
|
|
12236
|
-
return _context.f(
|
|
12237
|
-
case
|
|
12205
|
+
case 5:
|
|
12206
|
+
return _context.f(4);
|
|
12207
|
+
case 6:
|
|
12238
12208
|
return _context.a(2);
|
|
12239
12209
|
}
|
|
12240
|
-
}, _callee, null, [[2,,
|
|
12210
|
+
}, _callee, null, [[2,, 4, 6]]);
|
|
12241
12211
|
}));
|
|
12242
12212
|
return function buildHopInfo(_x) {
|
|
12243
12213
|
return _ref2.apply(this, arguments);
|
|
@@ -14378,6 +14348,41 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
14378
14348
|
}
|
|
14379
14349
|
return getTransferInfo$1;
|
|
14380
14350
|
}()
|
|
14351
|
+
/**
|
|
14352
|
+
* Returns the receivable amount on the destination after the transfer
|
|
14353
|
+
*
|
|
14354
|
+
* @returns The computed receivable amount.
|
|
14355
|
+
* @throws \{UnableToComputeError\} Thrown when the receivable amount cannot be determined.
|
|
14356
|
+
*/
|
|
14357
|
+
)
|
|
14358
|
+
}, {
|
|
14359
|
+
key: "getReceivableAmount",
|
|
14360
|
+
value: (function () {
|
|
14361
|
+
var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
14362
|
+
var _yield$this$getTransf, receivedAmount;
|
|
14363
|
+
return _regenerator().w(function (_context14) {
|
|
14364
|
+
while (1) switch (_context14.n) {
|
|
14365
|
+
case 0:
|
|
14366
|
+
_context14.n = 1;
|
|
14367
|
+
return this.getTransferInfo();
|
|
14368
|
+
case 1:
|
|
14369
|
+
_yield$this$getTransf = _context14.v;
|
|
14370
|
+
receivedAmount = _yield$this$getTransf.destination.receivedCurrency.receivedAmount;
|
|
14371
|
+
if (!(receivedAmount instanceof UnableToComputeError)) {
|
|
14372
|
+
_context14.n = 2;
|
|
14373
|
+
break;
|
|
14374
|
+
}
|
|
14375
|
+
throw receivedAmount;
|
|
14376
|
+
case 2:
|
|
14377
|
+
return _context14.a(2, receivedAmount);
|
|
14378
|
+
}
|
|
14379
|
+
}, _callee14, this);
|
|
14380
|
+
}));
|
|
14381
|
+
function getReceivableAmount() {
|
|
14382
|
+
return _getReceivableAmount.apply(this, arguments);
|
|
14383
|
+
}
|
|
14384
|
+
return getReceivableAmount;
|
|
14385
|
+
}()
|
|
14381
14386
|
/**
|
|
14382
14387
|
* Returns the API instance used by the builder.
|
|
14383
14388
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -518,6 +518,13 @@ declare class GeneralBuilder<TApi, TRes, T extends Partial<TSendBaseOptions> = o
|
|
|
518
518
|
* @returns The transfer info.
|
|
519
519
|
*/
|
|
520
520
|
getTransferInfo(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<TTransferInfo>;
|
|
521
|
+
/**
|
|
522
|
+
* Returns the receivable amount on the destination after the transfer
|
|
523
|
+
*
|
|
524
|
+
* @returns The computed receivable amount.
|
|
525
|
+
* @throws \{UnableToComputeError\} Thrown when the receivable amount cannot be determined.
|
|
526
|
+
*/
|
|
527
|
+
getReceivableAmount(this: GeneralBuilder<TApi, TRes, TSendBaseOptionsWithSenderAddress>): Promise<bigint>;
|
|
521
528
|
/**
|
|
522
529
|
* Returns the API instance used by the builder.
|
|
523
530
|
*
|
|
@@ -1305,8 +1312,7 @@ type THopTransferInfo = {
|
|
|
1305
1312
|
chain: TChain;
|
|
1306
1313
|
result: {
|
|
1307
1314
|
xcmFee: TXcmFeeBase;
|
|
1308
|
-
|
|
1309
|
-
existentialDeposit?: bigint;
|
|
1315
|
+
existentialDeposit: bigint;
|
|
1310
1316
|
/** @deprecated use `asset` property instead */
|
|
1311
1317
|
currencySymbol: string;
|
|
1312
1318
|
asset: TAssetInfo;
|
|
@@ -1314,7 +1320,6 @@ type THopTransferInfo = {
|
|
|
1314
1320
|
};
|
|
1315
1321
|
type TXcmFeeBase = {
|
|
1316
1322
|
fee: bigint;
|
|
1317
|
-
balance: bigint;
|
|
1318
1323
|
/** @deprecated use `asset` property instead */
|
|
1319
1324
|
currencySymbol: string;
|
|
1320
1325
|
asset: TAssetInfo;
|
|
@@ -1337,11 +1342,11 @@ type TTransferInfo = {
|
|
|
1337
1342
|
};
|
|
1338
1343
|
xcmFee: TXcmFeeBase & {
|
|
1339
1344
|
sufficient: boolean;
|
|
1345
|
+
balance: bigint;
|
|
1340
1346
|
balanceAfter: bigint;
|
|
1341
1347
|
};
|
|
1342
1348
|
};
|
|
1343
1349
|
assetHub?: {
|
|
1344
|
-
balance: bigint;
|
|
1345
1350
|
/** @deprecated use `asset` property instead */
|
|
1346
1351
|
currencySymbol: string;
|
|
1347
1352
|
asset: TAssetInfo;
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { blake2b } from '@noble/hashes/blake2';
|
|
2
|
-
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findNativeAssetInfoOrThrow, findAssetInfo, isTAsset, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, Native, hasXcmPaymentApiSupport, getExistentialDeposit, getRelayChainSymbol, findNativeAssetInfo, isAssetXcEqual, hasSupportForAsset, isSymbolSpecifier, normalizeLocation, getEdFromAssetOrThrow, normalizeSymbol } from '@paraspell/assets';
|
|
2
|
+
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findNativeAssetInfoOrThrow, findAssetInfo, isTAsset, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, findAssetInfoOnDest, Native, hasXcmPaymentApiSupport, getExistentialDeposit, getRelayChainSymbol, findNativeAssetInfo, isAssetXcEqual, hasSupportForAsset, isSymbolSpecifier, normalizeLocation, getEdFromAssetOrThrow, normalizeSymbol } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
4
|
import { base58 } from '@scure/base';
|
|
5
5
|
import { isAddress, parseUnits, createPublicClient, http, getContract, pad, toHex, getAddress, concat, keccak256 } from 'viem';
|
|
@@ -5317,19 +5317,18 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5317
5317
|
initialForwardedXcms = originDryModified.forwardedXcms, initialDestParaId = originDryModified.destParaId;
|
|
5318
5318
|
processHop = /*#__PURE__*/function () {
|
|
5319
5319
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
5320
|
-
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange,
|
|
5320
|
+
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, _findAssetInfoOnDest, hopDryRun;
|
|
5321
5321
|
return _regenerator().w(function (_context) {
|
|
5322
5322
|
while (1) switch (_context.n) {
|
|
5323
5323
|
case 0:
|
|
5324
|
-
hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange
|
|
5324
|
+
hopApi = params.api, currentChain = params.currentChain, currentOrigin = params.currentOrigin, currentAsset = params.currentAsset, forwardedXcms = params.forwardedXcms, hasPassedExchange = params.hasPassedExchange;
|
|
5325
5325
|
if (asset.location && asset.location.parents === Parents.TWO) {
|
|
5326
5326
|
hopAsset = findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
|
|
5327
5327
|
} else if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
|
|
5328
5328
|
hopAsset = findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
|
|
5329
|
-
} else if (isDestination) {
|
|
5330
|
-
hopAsset = findAssetOnDestOrThrow(origin, currentChain, currency);
|
|
5331
5329
|
} else {
|
|
5332
5330
|
hopAsset = asset;
|
|
5331
|
+
hopAsset = (_findAssetInfoOnDest = findAssetInfoOnDest(origin, currentChain, currency)) !== null && _findAssetInfoOnDest !== void 0 ? _findAssetInfoOnDest : asset;
|
|
5333
5332
|
}
|
|
5334
5333
|
if (hasDryRunSupport(currentChain)) {
|
|
5335
5334
|
_context.n = 1;
|
|
@@ -11469,7 +11468,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11469
11468
|
case 10:
|
|
11470
11469
|
processHop = /*#__PURE__*/function () {
|
|
11471
11470
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
11472
|
-
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, hopResult;
|
|
11471
|
+
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, _findAssetInfoOnDest, hopResult;
|
|
11473
11472
|
return _regenerator().w(function (_context) {
|
|
11474
11473
|
while (1) switch (_context.n) {
|
|
11475
11474
|
case 0:
|
|
@@ -11477,10 +11476,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11477
11476
|
if (!(currentAsset.location && currentAsset.location.parents === Parents.TWO)) {
|
|
11478
11477
|
if (hasPassedExchange && swapConfig && currentChain !== swapConfig.exchangeChain) {
|
|
11479
11478
|
hopAsset = findAssetOnDestOrThrow(swapConfig.exchangeChain, currentChain, swapConfig.currencyTo);
|
|
11480
|
-
} else if (destination === currentChain) {
|
|
11481
|
-
hopAsset = findAssetOnDestOrThrow(origin, currentChain, currency);
|
|
11482
11479
|
} else {
|
|
11483
|
-
hopAsset = currentAsset;
|
|
11480
|
+
hopAsset = (_findAssetInfoOnDest = findAssetInfoOnDest(origin, currentChain, currency)) !== null && _findAssetInfoOnDest !== void 0 ? _findAssetInfoOnDest : currentAsset;
|
|
11484
11481
|
}
|
|
11485
11482
|
} else {
|
|
11486
11483
|
hopAsset = findNativeAssetInfoOrThrow(getRelayChainOf(currentChain));
|
|
@@ -12162,83 +12159,56 @@ var buildDestInfo = /*#__PURE__*/function () {
|
|
|
12162
12159
|
|
|
12163
12160
|
var buildHopInfo = /*#__PURE__*/function () {
|
|
12164
12161
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
12165
|
-
var api, chain, feeData, originChain, asset, currency,
|
|
12162
|
+
var api, chain, feeData, originChain, asset, currency, hopApi, xcmFeeDetails, isBridgeHub, hopAsset, hopCurrencyPayload, ed;
|
|
12166
12163
|
return _regenerator().w(function (_context) {
|
|
12167
12164
|
while (1) switch (_context.p = _context.n) {
|
|
12168
12165
|
case 0:
|
|
12169
|
-
api = _ref.api, chain = _ref.chain, feeData = _ref.feeData, originChain = _ref.originChain, asset = _ref.asset, currency = _ref.currency
|
|
12166
|
+
api = _ref.api, chain = _ref.chain, feeData = _ref.feeData, originChain = _ref.originChain, asset = _ref.asset, currency = _ref.currency;
|
|
12170
12167
|
hopApi = api.clone();
|
|
12171
12168
|
_context.n = 1;
|
|
12172
12169
|
return hopApi.init(chain);
|
|
12173
12170
|
case 1:
|
|
12174
12171
|
hopApi.setDisconnectAllowed(false);
|
|
12175
12172
|
_context.p = 2;
|
|
12176
|
-
resolvedAddress = isChainEvm(originChain) && ahAddress ? ahAddress : senderAddress;
|
|
12177
|
-
_context.n = 3;
|
|
12178
|
-
return getBalanceNativeInternal({
|
|
12179
|
-
api: hopApi,
|
|
12180
|
-
address: resolvedAddress,
|
|
12181
|
-
chain: chain
|
|
12182
|
-
});
|
|
12183
|
-
case 3:
|
|
12184
|
-
nativeBalanceOnHop = _context.v;
|
|
12185
|
-
nativeAssetSymbolOnHop = getNativeAssetSymbol(chain);
|
|
12186
12173
|
xcmFeeDetails = {
|
|
12187
12174
|
fee: feeData.fee,
|
|
12188
|
-
|
|
12189
|
-
currencySymbol: nativeAssetSymbolOnHop,
|
|
12175
|
+
currencySymbol: asset.symbol,
|
|
12190
12176
|
asset: asset
|
|
12191
12177
|
};
|
|
12192
12178
|
isBridgeHub = chain.includes('BridgeHub');
|
|
12193
12179
|
if (!isBridgeHub) {
|
|
12194
|
-
_context.n =
|
|
12180
|
+
_context.n = 3;
|
|
12195
12181
|
break;
|
|
12196
12182
|
}
|
|
12197
12183
|
return _context.a(2, {
|
|
12198
12184
|
currencySymbol: getNativeAssetSymbol(chain),
|
|
12199
12185
|
xcmFee: xcmFeeDetails
|
|
12200
12186
|
});
|
|
12201
|
-
case
|
|
12187
|
+
case 3:
|
|
12202
12188
|
hopAsset = findAssetOnDestOrThrow(originChain, chain, currency);
|
|
12203
12189
|
hopCurrencyPayload = hopAsset.location ? {
|
|
12204
12190
|
location: hopAsset.location
|
|
12205
12191
|
} : {
|
|
12206
12192
|
symbol: hopAsset.symbol
|
|
12207
12193
|
};
|
|
12208
|
-
|
|
12209
|
-
return getAssetBalanceInternal({
|
|
12210
|
-
api: hopApi,
|
|
12211
|
-
address: resolvedAddress,
|
|
12212
|
-
chain: chain,
|
|
12213
|
-
currency: hopCurrencyPayload
|
|
12214
|
-
});
|
|
12215
|
-
case 5:
|
|
12216
|
-
balance = _context.v;
|
|
12217
|
-
ed = getExistentialDeposit(chain, hopCurrencyPayload);
|
|
12218
|
-
if (ed) {
|
|
12219
|
-
_context.n = 6;
|
|
12220
|
-
break;
|
|
12221
|
-
}
|
|
12222
|
-
throw new InvalidParameterError("Existential deposit not found for chain ".concat(chain, " with currency ").concat(JSON.stringify(hopCurrencyPayload)));
|
|
12223
|
-
case 6:
|
|
12194
|
+
ed = getExistentialDepositOrThrow(chain, hopCurrencyPayload);
|
|
12224
12195
|
return _context.a(2, {
|
|
12225
|
-
balance: balance,
|
|
12226
12196
|
currencySymbol: hopAsset.symbol,
|
|
12227
12197
|
asset: hopAsset,
|
|
12228
|
-
existentialDeposit:
|
|
12198
|
+
existentialDeposit: ed,
|
|
12229
12199
|
xcmFee: xcmFeeDetails
|
|
12230
12200
|
});
|
|
12231
|
-
case
|
|
12232
|
-
_context.p =
|
|
12201
|
+
case 4:
|
|
12202
|
+
_context.p = 4;
|
|
12233
12203
|
hopApi.setDisconnectAllowed(true);
|
|
12234
|
-
_context.n =
|
|
12204
|
+
_context.n = 5;
|
|
12235
12205
|
return hopApi.disconnect();
|
|
12236
|
-
case
|
|
12237
|
-
return _context.f(
|
|
12238
|
-
case
|
|
12206
|
+
case 5:
|
|
12207
|
+
return _context.f(4);
|
|
12208
|
+
case 6:
|
|
12239
12209
|
return _context.a(2);
|
|
12240
12210
|
}
|
|
12241
|
-
}, _callee, null, [[2,,
|
|
12211
|
+
}, _callee, null, [[2,, 4, 6]]);
|
|
12242
12212
|
}));
|
|
12243
12213
|
return function buildHopInfo(_x) {
|
|
12244
12214
|
return _ref2.apply(this, arguments);
|
|
@@ -14379,6 +14349,41 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
14379
14349
|
}
|
|
14380
14350
|
return getTransferInfo$1;
|
|
14381
14351
|
}()
|
|
14352
|
+
/**
|
|
14353
|
+
* Returns the receivable amount on the destination after the transfer
|
|
14354
|
+
*
|
|
14355
|
+
* @returns The computed receivable amount.
|
|
14356
|
+
* @throws \{UnableToComputeError\} Thrown when the receivable amount cannot be determined.
|
|
14357
|
+
*/
|
|
14358
|
+
)
|
|
14359
|
+
}, {
|
|
14360
|
+
key: "getReceivableAmount",
|
|
14361
|
+
value: (function () {
|
|
14362
|
+
var _getReceivableAmount = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee14() {
|
|
14363
|
+
var _yield$this$getTransf, receivedAmount;
|
|
14364
|
+
return _regenerator().w(function (_context14) {
|
|
14365
|
+
while (1) switch (_context14.n) {
|
|
14366
|
+
case 0:
|
|
14367
|
+
_context14.n = 1;
|
|
14368
|
+
return this.getTransferInfo();
|
|
14369
|
+
case 1:
|
|
14370
|
+
_yield$this$getTransf = _context14.v;
|
|
14371
|
+
receivedAmount = _yield$this$getTransf.destination.receivedCurrency.receivedAmount;
|
|
14372
|
+
if (!(receivedAmount instanceof UnableToComputeError)) {
|
|
14373
|
+
_context14.n = 2;
|
|
14374
|
+
break;
|
|
14375
|
+
}
|
|
14376
|
+
throw receivedAmount;
|
|
14377
|
+
case 2:
|
|
14378
|
+
return _context14.a(2, receivedAmount);
|
|
14379
|
+
}
|
|
14380
|
+
}, _callee14, this);
|
|
14381
|
+
}));
|
|
14382
|
+
function getReceivableAmount() {
|
|
14383
|
+
return _getReceivableAmount.apply(this, arguments);
|
|
14384
|
+
}
|
|
14385
|
+
return getReceivableAmount;
|
|
14386
|
+
}()
|
|
14382
14387
|
/**
|
|
14383
14388
|
* Returns the API instance used by the builder.
|
|
14384
14389
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.11.0",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@noble/hashes": "^1.8.0",
|
|
27
27
|
"@scure/base": "^2.0.0",
|
|
28
28
|
"viem": "^2.37.9",
|
|
29
|
-
"@paraspell/sdk-common": "11.
|
|
30
|
-
"@paraspell/
|
|
31
|
-
"@paraspell/
|
|
29
|
+
"@paraspell/sdk-common": "11.11.0",
|
|
30
|
+
"@paraspell/assets": "11.11.0",
|
|
31
|
+
"@paraspell/pallets": "11.11.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|