@paraspell/sdk-core 10.5.1 → 10.5.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/dist/index.cjs +63 -38
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +64 -39
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -4559,8 +4559,8 @@ var verifyEdOnDestination = /*#__PURE__*/function () {
|
|
|
4559
4559
|
}();
|
|
4560
4560
|
|
|
4561
4561
|
var isSufficientOrigin = /*#__PURE__*/function () {
|
|
4562
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api,
|
|
4563
|
-
var
|
|
4562
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, origin, destination, senderAddress, feeNative, currency, asset, feeAsset) {
|
|
4563
|
+
var edNative, balanceNative, isNativeAssetToOrigin, isNativeAssetToDest, isSufficientNative, balanceAsset, edAsset, isSufficientAsset;
|
|
4564
4564
|
return _regenerator().w(function (_context) {
|
|
4565
4565
|
while (1) switch (_context.n) {
|
|
4566
4566
|
case 0:
|
|
@@ -4570,30 +4570,57 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
4570
4570
|
}
|
|
4571
4571
|
return _context.a(2, undefined);
|
|
4572
4572
|
case 1:
|
|
4573
|
-
|
|
4573
|
+
edNative = assets.getExistentialDepositOrThrow(origin);
|
|
4574
4574
|
_context.n = 2;
|
|
4575
4575
|
return getBalanceNativeInternal({
|
|
4576
4576
|
api: api,
|
|
4577
|
-
node:
|
|
4577
|
+
node: origin,
|
|
4578
4578
|
address: senderAddress
|
|
4579
4579
|
});
|
|
4580
4580
|
case 2:
|
|
4581
|
-
|
|
4582
|
-
|
|
4581
|
+
balanceNative = _context.v;
|
|
4582
|
+
isNativeAssetToOrigin = assets.isSymbolMatch(asset.symbol, assets.getNativeAssetSymbol(origin));
|
|
4583
|
+
isNativeAssetToDest = assets.isSymbolMatch(asset.symbol, assets.getNativeAssetSymbol(destination));
|
|
4584
|
+
if (!(isNativeAssetToOrigin && isNativeAssetToDest)) {
|
|
4585
|
+
_context.n = 3;
|
|
4586
|
+
break;
|
|
4587
|
+
}
|
|
4588
|
+
return _context.a(2, balanceNative - edNative - feeNative - BigInt(currency.amount) > 0n);
|
|
4589
|
+
case 3:
|
|
4590
|
+
if (isNativeAssetToOrigin) {
|
|
4591
|
+
_context.n = 5;
|
|
4592
|
+
break;
|
|
4593
|
+
}
|
|
4594
|
+
isSufficientNative = balanceNative - edNative - feeNative > 0n;
|
|
4595
|
+
_context.n = 4;
|
|
4596
|
+
return getAssetBalance({
|
|
4597
|
+
api: api,
|
|
4598
|
+
node: origin,
|
|
4599
|
+
address: senderAddress,
|
|
4600
|
+
currency: currency
|
|
4601
|
+
});
|
|
4602
|
+
case 4:
|
|
4603
|
+
balanceAsset = _context.v;
|
|
4604
|
+
edAsset = assets.getExistentialDepositOrThrow(origin, currency);
|
|
4605
|
+
isSufficientAsset = balanceAsset - edAsset > 0n;
|
|
4606
|
+
return _context.a(2, isSufficientNative && isSufficientAsset);
|
|
4607
|
+
case 5:
|
|
4608
|
+
return _context.a(2, balanceNative - edNative - feeNative - BigInt(currency.amount) > 0n);
|
|
4583
4609
|
}
|
|
4584
4610
|
}, _callee);
|
|
4585
4611
|
}));
|
|
4586
|
-
return function isSufficientOrigin(_x, _x2, _x3, _x4, _x5) {
|
|
4612
|
+
return function isSufficientOrigin(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
4587
4613
|
return _ref.apply(this, arguments);
|
|
4588
4614
|
};
|
|
4589
4615
|
}();
|
|
4590
4616
|
var isSufficientDestination = /*#__PURE__*/function () {
|
|
4591
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, destination, address, amount, asset) {
|
|
4592
|
-
var existentialDeposit, nativeBalance;
|
|
4617
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, destination, address, amount, asset, feeNative) {
|
|
4618
|
+
var isNativeAsset, existentialDeposit, nativeBalance;
|
|
4593
4619
|
return _regenerator().w(function (_context2) {
|
|
4594
4620
|
while (1) switch (_context2.n) {
|
|
4595
4621
|
case 0:
|
|
4596
|
-
|
|
4622
|
+
isNativeAsset = assets.isSymbolMatch(asset.symbol, assets.getNativeAssetSymbol(destination));
|
|
4623
|
+
if (isNativeAsset) {
|
|
4597
4624
|
_context2.n = 1;
|
|
4598
4625
|
break;
|
|
4599
4626
|
}
|
|
@@ -4608,11 +4635,11 @@ var isSufficientDestination = /*#__PURE__*/function () {
|
|
|
4608
4635
|
});
|
|
4609
4636
|
case 2:
|
|
4610
4637
|
nativeBalance = _context2.v;
|
|
4611
|
-
return _context2.a(2, nativeBalance + amount - existentialDeposit > 0n);
|
|
4638
|
+
return _context2.a(2, nativeBalance + amount - existentialDeposit - feeNative > 0n);
|
|
4612
4639
|
}
|
|
4613
4640
|
}, _callee2);
|
|
4614
4641
|
}));
|
|
4615
|
-
return function isSufficientDestination(
|
|
4642
|
+
return function isSufficientDestination(_x9, _x0, _x1, _x10, _x11, _x12) {
|
|
4616
4643
|
return _ref2.apply(this, arguments);
|
|
4617
4644
|
};
|
|
4618
4645
|
}();
|
|
@@ -4630,7 +4657,7 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4630
4657
|
};
|
|
4631
4658
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4632
4659
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4633
|
-
var api, origin, hopNode, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, sufficient, dryRunResult, _sufficient, fee, newForwardedXcms, destParaId
|
|
4660
|
+
var api, origin, hopNode, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, _sufficient, fee, newForwardedXcms, destParaId;
|
|
4634
4661
|
return _regenerator().w(function (_context2) {
|
|
4635
4662
|
while (1) switch (_context2.n) {
|
|
4636
4663
|
case 0:
|
|
@@ -4700,18 +4727,17 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4700
4727
|
break;
|
|
4701
4728
|
}
|
|
4702
4729
|
_context2.n = 1;
|
|
4703
|
-
return
|
|
4730
|
+
return calcPaymentInfoFee();
|
|
4704
4731
|
case 1:
|
|
4705
|
-
|
|
4732
|
+
_fee = _context2.v;
|
|
4706
4733
|
_context2.n = 2;
|
|
4707
|
-
return
|
|
4734
|
+
return isSufficientDestination(api, destination, address, BigInt(currency.amount), asset, _fee);
|
|
4708
4735
|
case 2:
|
|
4709
|
-
|
|
4710
|
-
_t3 = sufficient;
|
|
4736
|
+
sufficient = _context2.v;
|
|
4711
4737
|
return _context2.a(2, {
|
|
4712
|
-
fee:
|
|
4738
|
+
fee: _fee,
|
|
4713
4739
|
feeType: 'paymentInfo',
|
|
4714
|
-
sufficient:
|
|
4740
|
+
sufficient: sufficient
|
|
4715
4741
|
});
|
|
4716
4742
|
case 3:
|
|
4717
4743
|
_context2.n = 4;
|
|
@@ -4740,20 +4766,18 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4740
4766
|
});
|
|
4741
4767
|
case 5:
|
|
4742
4768
|
_context2.n = 6;
|
|
4743
|
-
return
|
|
4769
|
+
return calcPaymentInfoFee();
|
|
4744
4770
|
case 6:
|
|
4745
|
-
|
|
4771
|
+
_fee2 = _context2.v;
|
|
4746
4772
|
_context2.n = 7;
|
|
4747
|
-
return
|
|
4773
|
+
return isSufficientDestination(api, destination, address, BigInt(currency.amount), asset, _fee2);
|
|
4748
4774
|
case 7:
|
|
4749
|
-
|
|
4750
|
-
_t5 = dryRunResult.failureReason;
|
|
4751
|
-
_t6 = _sufficient;
|
|
4775
|
+
_sufficient = _context2.v;
|
|
4752
4776
|
return _context2.a(2, {
|
|
4753
|
-
fee:
|
|
4777
|
+
fee: _fee2,
|
|
4754
4778
|
feeType: 'paymentInfo',
|
|
4755
|
-
dryRunError:
|
|
4756
|
-
sufficient:
|
|
4779
|
+
dryRunError: dryRunResult.failureReason,
|
|
4780
|
+
sufficient: _sufficient
|
|
4757
4781
|
});
|
|
4758
4782
|
case 8:
|
|
4759
4783
|
fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
|
|
@@ -5014,11 +5038,12 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
5014
5038
|
|
|
5015
5039
|
var getOriginXcmFee = /*#__PURE__*/function () {
|
|
5016
5040
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
5017
|
-
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient,
|
|
5041
|
+
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, asset, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient, dryRunResult, _rawFee, _paddedFee, _sufficient, fee, forwardedXcms, destParaId, weight, currencySymbol;
|
|
5018
5042
|
return _regenerator().w(function (_context) {
|
|
5019
5043
|
while (1) switch (_context.n) {
|
|
5020
5044
|
case 0:
|
|
5021
5045
|
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, disableFallback = _ref.disableFallback, feeAsset = _ref.feeAsset, currency = _ref.currency;
|
|
5046
|
+
asset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
5022
5047
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5023
5048
|
_context.n = 1;
|
|
5024
5049
|
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
@@ -5034,7 +5059,7 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5034
5059
|
rawFee = _context.v;
|
|
5035
5060
|
paddedFee = padFee(rawFee, origin, destination, 'origin');
|
|
5036
5061
|
_context.n = 3;
|
|
5037
|
-
return isSufficientOrigin(api, origin, senderAddress, paddedFee, resolvedFeeAsset);
|
|
5062
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, paddedFee, currency, asset, resolvedFeeAsset);
|
|
5038
5063
|
case 3:
|
|
5039
5064
|
sufficient = _context.v;
|
|
5040
5065
|
return _context.a(2, {
|
|
@@ -5044,7 +5069,6 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5044
5069
|
sufficient: sufficient
|
|
5045
5070
|
});
|
|
5046
5071
|
case 4:
|
|
5047
|
-
asset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
5048
5072
|
_context.n = 5;
|
|
5049
5073
|
return api.getDryRunCall({
|
|
5050
5074
|
tx: tx,
|
|
@@ -5073,7 +5097,7 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5073
5097
|
_rawFee = _context.v;
|
|
5074
5098
|
_paddedFee = padFee(_rawFee, origin, destination, 'origin');
|
|
5075
5099
|
_context.n = 8;
|
|
5076
|
-
return isSufficientOrigin(api, origin, senderAddress, _paddedFee, resolvedFeeAsset);
|
|
5100
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, _paddedFee, currency, asset, resolvedFeeAsset);
|
|
5077
5101
|
case 8:
|
|
5078
5102
|
_sufficient = _context.v;
|
|
5079
5103
|
return _context.a(2, {
|
|
@@ -5260,11 +5284,12 @@ var validateAssetSpecifiers = function validateAssetSpecifiers(assetCheckEnabled
|
|
|
5260
5284
|
|
|
5261
5285
|
var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
5262
5286
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
5263
|
-
var api, tx, origin, destination, currency, senderAddress, feeAsset, rawOriginFee, originFee, resolvedFeeAsset, sufficient;
|
|
5287
|
+
var api, tx, origin, destination, currency, senderAddress, feeAsset, originAsset, rawOriginFee, originFee, resolvedFeeAsset, sufficient;
|
|
5264
5288
|
return _regenerator().w(function (_context) {
|
|
5265
5289
|
while (1) switch (_context.n) {
|
|
5266
5290
|
case 0:
|
|
5267
5291
|
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, currency = _ref.currency, senderAddress = _ref.senderAddress, feeAsset = _ref.feeAsset;
|
|
5292
|
+
originAsset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
5268
5293
|
_context.n = 1;
|
|
5269
5294
|
return api.calculateTransactionFee(tx, senderAddress);
|
|
5270
5295
|
case 1:
|
|
@@ -5272,7 +5297,7 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5272
5297
|
originFee = padFee(rawOriginFee, origin, destination, 'origin');
|
|
5273
5298
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5274
5299
|
_context.n = 2;
|
|
5275
|
-
return isSufficientOrigin(api, origin, senderAddress, originFee, resolvedFeeAsset);
|
|
5300
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, originFee, currency, originAsset, resolvedFeeAsset);
|
|
5276
5301
|
case 2:
|
|
5277
5302
|
sufficient = _context.v;
|
|
5278
5303
|
return _context.a(2, {
|
|
@@ -5629,11 +5654,11 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5629
5654
|
}
|
|
5630
5655
|
_ref2 = origin === 'AssetHubPolkadot' ? [BRIDGE_FEE_DOT, BRIDGE_FEE_KSM] : [BRIDGE_FEE_KSM, BRIDGE_FEE_DOT], _ref3 = _slicedToArray(_ref2, 2), fixedOriginFee = _ref3[0], fixedDestinationFee = _ref3[1];
|
|
5631
5656
|
_context.n = 3;
|
|
5632
|
-
return isSufficientOrigin(api, origin, senderAddress, fixedOriginFee, resolvedFeeAsset);
|
|
5657
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, fixedOriginFee, currency, originAsset, resolvedFeeAsset);
|
|
5633
5658
|
case 3:
|
|
5634
5659
|
originSufficient = _context.v;
|
|
5635
5660
|
_context.n = 4;
|
|
5636
|
-
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset);
|
|
5661
|
+
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset, fixedDestinationFee);
|
|
5637
5662
|
case 4:
|
|
5638
5663
|
_destinationSufficient = _context.v;
|
|
5639
5664
|
return _context.a(2, {
|
|
@@ -5676,7 +5701,7 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5676
5701
|
case 9:
|
|
5677
5702
|
destinationFee = _t;
|
|
5678
5703
|
_context.n = 10;
|
|
5679
|
-
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset);
|
|
5704
|
+
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset, destinationFee);
|
|
5680
5705
|
case 10:
|
|
5681
5706
|
destinationSufficient = _context.v;
|
|
5682
5707
|
destFeeDetails = {
|
package/dist/index.d.ts
CHANGED
|
@@ -354,7 +354,7 @@ type TGetTransferableAmountOptionsBase<TRes> = {
|
|
|
354
354
|
/**
|
|
355
355
|
* The currency to query.
|
|
356
356
|
*/
|
|
357
|
-
currency: TCurrencyCore
|
|
357
|
+
currency: WithAmount<TCurrencyCore>;
|
|
358
358
|
/**
|
|
359
359
|
* The transaction to calculate the fee for
|
|
360
360
|
*/
|
|
@@ -855,7 +855,7 @@ type TGetOriginXcmFeeBaseOptions<TRes> = {
|
|
|
855
855
|
origin: TNodeDotKsmWithRelayChains;
|
|
856
856
|
destination: TNodeWithRelayChains;
|
|
857
857
|
senderAddress: string;
|
|
858
|
-
currency:
|
|
858
|
+
currency: WithAmount<TCurrencyCore>;
|
|
859
859
|
feeAsset?: TCurrencyInput;
|
|
860
860
|
disableFallback: boolean;
|
|
861
861
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { blake2b } from '@noble/hashes/blake2';
|
|
2
|
-
import { isNodeEvm, getAssetsObject, getNativeAssetSymbol, getOtherAssets, getRelayChainSymbol, isForeignAsset, InvalidCurrencyError, findAssetForNodeOrThrow, isOverrideMultiLocationSpecifier, findAssetByMultiLocation, findAsset, isTMultiAsset, getExistentialDeposit, getExistentialDepositOrThrow, isAssetEqual, findAssetOnDestOrThrow, normalizeSymbol, hasDryRunSupport, hasSupportForAsset, extractMultiAssetLoc, isSymbolSpecifier, normalizeMultiLocation, getAssetId } from '@paraspell/assets';
|
|
2
|
+
import { isNodeEvm, getAssetsObject, getNativeAssetSymbol, getOtherAssets, getRelayChainSymbol, isForeignAsset, InvalidCurrencyError, findAssetForNodeOrThrow, isOverrideMultiLocationSpecifier, findAssetByMultiLocation, findAsset, isTMultiAsset, getExistentialDeposit, getExistentialDepositOrThrow, isAssetEqual, findAssetOnDestOrThrow, normalizeSymbol, isSymbolMatch, hasDryRunSupport, hasSupportForAsset, extractMultiAssetLoc, isSymbolSpecifier, normalizeMultiLocation, getAssetId } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
4
|
import { base58 } from '@scure/base';
|
|
5
5
|
import { isAddress, createPublicClient, http, getContract } from 'viem';
|
|
@@ -4560,8 +4560,8 @@ var verifyEdOnDestination = /*#__PURE__*/function () {
|
|
|
4560
4560
|
}();
|
|
4561
4561
|
|
|
4562
4562
|
var isSufficientOrigin = /*#__PURE__*/function () {
|
|
4563
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api,
|
|
4564
|
-
var
|
|
4563
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, origin, destination, senderAddress, feeNative, currency, asset, feeAsset) {
|
|
4564
|
+
var edNative, balanceNative, isNativeAssetToOrigin, isNativeAssetToDest, isSufficientNative, balanceAsset, edAsset, isSufficientAsset;
|
|
4565
4565
|
return _regenerator().w(function (_context) {
|
|
4566
4566
|
while (1) switch (_context.n) {
|
|
4567
4567
|
case 0:
|
|
@@ -4571,30 +4571,57 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
4571
4571
|
}
|
|
4572
4572
|
return _context.a(2, undefined);
|
|
4573
4573
|
case 1:
|
|
4574
|
-
|
|
4574
|
+
edNative = getExistentialDepositOrThrow(origin);
|
|
4575
4575
|
_context.n = 2;
|
|
4576
4576
|
return getBalanceNativeInternal({
|
|
4577
4577
|
api: api,
|
|
4578
|
-
node:
|
|
4578
|
+
node: origin,
|
|
4579
4579
|
address: senderAddress
|
|
4580
4580
|
});
|
|
4581
4581
|
case 2:
|
|
4582
|
-
|
|
4583
|
-
|
|
4582
|
+
balanceNative = _context.v;
|
|
4583
|
+
isNativeAssetToOrigin = isSymbolMatch(asset.symbol, getNativeAssetSymbol(origin));
|
|
4584
|
+
isNativeAssetToDest = isSymbolMatch(asset.symbol, getNativeAssetSymbol(destination));
|
|
4585
|
+
if (!(isNativeAssetToOrigin && isNativeAssetToDest)) {
|
|
4586
|
+
_context.n = 3;
|
|
4587
|
+
break;
|
|
4588
|
+
}
|
|
4589
|
+
return _context.a(2, balanceNative - edNative - feeNative - BigInt(currency.amount) > 0n);
|
|
4590
|
+
case 3:
|
|
4591
|
+
if (isNativeAssetToOrigin) {
|
|
4592
|
+
_context.n = 5;
|
|
4593
|
+
break;
|
|
4594
|
+
}
|
|
4595
|
+
isSufficientNative = balanceNative - edNative - feeNative > 0n;
|
|
4596
|
+
_context.n = 4;
|
|
4597
|
+
return getAssetBalance({
|
|
4598
|
+
api: api,
|
|
4599
|
+
node: origin,
|
|
4600
|
+
address: senderAddress,
|
|
4601
|
+
currency: currency
|
|
4602
|
+
});
|
|
4603
|
+
case 4:
|
|
4604
|
+
balanceAsset = _context.v;
|
|
4605
|
+
edAsset = getExistentialDepositOrThrow(origin, currency);
|
|
4606
|
+
isSufficientAsset = balanceAsset - edAsset > 0n;
|
|
4607
|
+
return _context.a(2, isSufficientNative && isSufficientAsset);
|
|
4608
|
+
case 5:
|
|
4609
|
+
return _context.a(2, balanceNative - edNative - feeNative - BigInt(currency.amount) > 0n);
|
|
4584
4610
|
}
|
|
4585
4611
|
}, _callee);
|
|
4586
4612
|
}));
|
|
4587
|
-
return function isSufficientOrigin(_x, _x2, _x3, _x4, _x5) {
|
|
4613
|
+
return function isSufficientOrigin(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
4588
4614
|
return _ref.apply(this, arguments);
|
|
4589
4615
|
};
|
|
4590
4616
|
}();
|
|
4591
4617
|
var isSufficientDestination = /*#__PURE__*/function () {
|
|
4592
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, destination, address, amount, asset) {
|
|
4593
|
-
var existentialDeposit, nativeBalance;
|
|
4618
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, destination, address, amount, asset, feeNative) {
|
|
4619
|
+
var isNativeAsset, existentialDeposit, nativeBalance;
|
|
4594
4620
|
return _regenerator().w(function (_context2) {
|
|
4595
4621
|
while (1) switch (_context2.n) {
|
|
4596
4622
|
case 0:
|
|
4597
|
-
|
|
4623
|
+
isNativeAsset = isSymbolMatch(asset.symbol, getNativeAssetSymbol(destination));
|
|
4624
|
+
if (isNativeAsset) {
|
|
4598
4625
|
_context2.n = 1;
|
|
4599
4626
|
break;
|
|
4600
4627
|
}
|
|
@@ -4609,11 +4636,11 @@ var isSufficientDestination = /*#__PURE__*/function () {
|
|
|
4609
4636
|
});
|
|
4610
4637
|
case 2:
|
|
4611
4638
|
nativeBalance = _context2.v;
|
|
4612
|
-
return _context2.a(2, nativeBalance + amount - existentialDeposit > 0n);
|
|
4639
|
+
return _context2.a(2, nativeBalance + amount - existentialDeposit - feeNative > 0n);
|
|
4613
4640
|
}
|
|
4614
4641
|
}, _callee2);
|
|
4615
4642
|
}));
|
|
4616
|
-
return function isSufficientDestination(
|
|
4643
|
+
return function isSufficientDestination(_x9, _x0, _x1, _x10, _x11, _x12) {
|
|
4617
4644
|
return _ref2.apply(this, arguments);
|
|
4618
4645
|
};
|
|
4619
4646
|
}();
|
|
@@ -4631,7 +4658,7 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4631
4658
|
};
|
|
4632
4659
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4633
4660
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4634
|
-
var api, origin, hopNode, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, sufficient, dryRunResult, _sufficient, fee, newForwardedXcms, destParaId
|
|
4661
|
+
var api, origin, hopNode, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, _sufficient, fee, newForwardedXcms, destParaId;
|
|
4635
4662
|
return _regenerator().w(function (_context2) {
|
|
4636
4663
|
while (1) switch (_context2.n) {
|
|
4637
4664
|
case 0:
|
|
@@ -4701,18 +4728,17 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4701
4728
|
break;
|
|
4702
4729
|
}
|
|
4703
4730
|
_context2.n = 1;
|
|
4704
|
-
return
|
|
4731
|
+
return calcPaymentInfoFee();
|
|
4705
4732
|
case 1:
|
|
4706
|
-
|
|
4733
|
+
_fee = _context2.v;
|
|
4707
4734
|
_context2.n = 2;
|
|
4708
|
-
return
|
|
4735
|
+
return isSufficientDestination(api, destination, address, BigInt(currency.amount), asset, _fee);
|
|
4709
4736
|
case 2:
|
|
4710
|
-
|
|
4711
|
-
_t3 = sufficient;
|
|
4737
|
+
sufficient = _context2.v;
|
|
4712
4738
|
return _context2.a(2, {
|
|
4713
|
-
fee:
|
|
4739
|
+
fee: _fee,
|
|
4714
4740
|
feeType: 'paymentInfo',
|
|
4715
|
-
sufficient:
|
|
4741
|
+
sufficient: sufficient
|
|
4716
4742
|
});
|
|
4717
4743
|
case 3:
|
|
4718
4744
|
_context2.n = 4;
|
|
@@ -4741,20 +4767,18 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4741
4767
|
});
|
|
4742
4768
|
case 5:
|
|
4743
4769
|
_context2.n = 6;
|
|
4744
|
-
return
|
|
4770
|
+
return calcPaymentInfoFee();
|
|
4745
4771
|
case 6:
|
|
4746
|
-
|
|
4772
|
+
_fee2 = _context2.v;
|
|
4747
4773
|
_context2.n = 7;
|
|
4748
|
-
return
|
|
4774
|
+
return isSufficientDestination(api, destination, address, BigInt(currency.amount), asset, _fee2);
|
|
4749
4775
|
case 7:
|
|
4750
|
-
|
|
4751
|
-
_t5 = dryRunResult.failureReason;
|
|
4752
|
-
_t6 = _sufficient;
|
|
4776
|
+
_sufficient = _context2.v;
|
|
4753
4777
|
return _context2.a(2, {
|
|
4754
|
-
fee:
|
|
4778
|
+
fee: _fee2,
|
|
4755
4779
|
feeType: 'paymentInfo',
|
|
4756
|
-
dryRunError:
|
|
4757
|
-
sufficient:
|
|
4780
|
+
dryRunError: dryRunResult.failureReason,
|
|
4781
|
+
sufficient: _sufficient
|
|
4758
4782
|
});
|
|
4759
4783
|
case 8:
|
|
4760
4784
|
fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
|
|
@@ -5015,11 +5039,12 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
5015
5039
|
|
|
5016
5040
|
var getOriginXcmFee = /*#__PURE__*/function () {
|
|
5017
5041
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
5018
|
-
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient,
|
|
5042
|
+
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, asset, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient, dryRunResult, _rawFee, _paddedFee, _sufficient, fee, forwardedXcms, destParaId, weight, currencySymbol;
|
|
5019
5043
|
return _regenerator().w(function (_context) {
|
|
5020
5044
|
while (1) switch (_context.n) {
|
|
5021
5045
|
case 0:
|
|
5022
5046
|
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, disableFallback = _ref.disableFallback, feeAsset = _ref.feeAsset, currency = _ref.currency;
|
|
5047
|
+
asset = findAssetForNodeOrThrow(origin, currency, destination);
|
|
5023
5048
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5024
5049
|
_context.n = 1;
|
|
5025
5050
|
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
@@ -5035,7 +5060,7 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5035
5060
|
rawFee = _context.v;
|
|
5036
5061
|
paddedFee = padFee(rawFee, origin, destination, 'origin');
|
|
5037
5062
|
_context.n = 3;
|
|
5038
|
-
return isSufficientOrigin(api, origin, senderAddress, paddedFee, resolvedFeeAsset);
|
|
5063
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, paddedFee, currency, asset, resolvedFeeAsset);
|
|
5039
5064
|
case 3:
|
|
5040
5065
|
sufficient = _context.v;
|
|
5041
5066
|
return _context.a(2, {
|
|
@@ -5045,7 +5070,6 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5045
5070
|
sufficient: sufficient
|
|
5046
5071
|
});
|
|
5047
5072
|
case 4:
|
|
5048
|
-
asset = findAssetForNodeOrThrow(origin, currency, destination);
|
|
5049
5073
|
_context.n = 5;
|
|
5050
5074
|
return api.getDryRunCall({
|
|
5051
5075
|
tx: tx,
|
|
@@ -5074,7 +5098,7 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5074
5098
|
_rawFee = _context.v;
|
|
5075
5099
|
_paddedFee = padFee(_rawFee, origin, destination, 'origin');
|
|
5076
5100
|
_context.n = 8;
|
|
5077
|
-
return isSufficientOrigin(api, origin, senderAddress, _paddedFee, resolvedFeeAsset);
|
|
5101
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, _paddedFee, currency, asset, resolvedFeeAsset);
|
|
5078
5102
|
case 8:
|
|
5079
5103
|
_sufficient = _context.v;
|
|
5080
5104
|
return _context.a(2, {
|
|
@@ -5261,11 +5285,12 @@ var validateAssetSpecifiers = function validateAssetSpecifiers(assetCheckEnabled
|
|
|
5261
5285
|
|
|
5262
5286
|
var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
5263
5287
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
5264
|
-
var api, tx, origin, destination, currency, senderAddress, feeAsset, rawOriginFee, originFee, resolvedFeeAsset, sufficient;
|
|
5288
|
+
var api, tx, origin, destination, currency, senderAddress, feeAsset, originAsset, rawOriginFee, originFee, resolvedFeeAsset, sufficient;
|
|
5265
5289
|
return _regenerator().w(function (_context) {
|
|
5266
5290
|
while (1) switch (_context.n) {
|
|
5267
5291
|
case 0:
|
|
5268
5292
|
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, currency = _ref.currency, senderAddress = _ref.senderAddress, feeAsset = _ref.feeAsset;
|
|
5293
|
+
originAsset = findAssetForNodeOrThrow(origin, currency, destination);
|
|
5269
5294
|
_context.n = 1;
|
|
5270
5295
|
return api.calculateTransactionFee(tx, senderAddress);
|
|
5271
5296
|
case 1:
|
|
@@ -5273,7 +5298,7 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5273
5298
|
originFee = padFee(rawOriginFee, origin, destination, 'origin');
|
|
5274
5299
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5275
5300
|
_context.n = 2;
|
|
5276
|
-
return isSufficientOrigin(api, origin, senderAddress, originFee, resolvedFeeAsset);
|
|
5301
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, originFee, currency, originAsset, resolvedFeeAsset);
|
|
5277
5302
|
case 2:
|
|
5278
5303
|
sufficient = _context.v;
|
|
5279
5304
|
return _context.a(2, {
|
|
@@ -5630,11 +5655,11 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5630
5655
|
}
|
|
5631
5656
|
_ref2 = origin === 'AssetHubPolkadot' ? [BRIDGE_FEE_DOT, BRIDGE_FEE_KSM] : [BRIDGE_FEE_KSM, BRIDGE_FEE_DOT], _ref3 = _slicedToArray(_ref2, 2), fixedOriginFee = _ref3[0], fixedDestinationFee = _ref3[1];
|
|
5632
5657
|
_context.n = 3;
|
|
5633
|
-
return isSufficientOrigin(api, origin, senderAddress, fixedOriginFee, resolvedFeeAsset);
|
|
5658
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, fixedOriginFee, currency, originAsset, resolvedFeeAsset);
|
|
5634
5659
|
case 3:
|
|
5635
5660
|
originSufficient = _context.v;
|
|
5636
5661
|
_context.n = 4;
|
|
5637
|
-
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset);
|
|
5662
|
+
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset, fixedDestinationFee);
|
|
5638
5663
|
case 4:
|
|
5639
5664
|
_destinationSufficient = _context.v;
|
|
5640
5665
|
return _context.a(2, {
|
|
@@ -5677,7 +5702,7 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5677
5702
|
case 9:
|
|
5678
5703
|
destinationFee = _t;
|
|
5679
5704
|
_context.n = 10;
|
|
5680
|
-
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset);
|
|
5705
|
+
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset, destinationFee);
|
|
5681
5706
|
case 10:
|
|
5682
5707
|
destinationSufficient = _context.v;
|
|
5683
5708
|
destFeeDetails = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "10.5.
|
|
3
|
+
"version": "10.5.2",
|
|
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": "^1.2.6",
|
|
28
28
|
"viem": "^2.30.5",
|
|
29
|
-
"@paraspell/assets": "10.5.
|
|
30
|
-
"@paraspell/
|
|
31
|
-
"@paraspell/
|
|
29
|
+
"@paraspell/assets": "10.5.2",
|
|
30
|
+
"@paraspell/pallets": "10.5.2",
|
|
31
|
+
"@paraspell/sdk-common": "10.5.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|