@paraspell/sdk-core 11.8.0 → 11.8.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/dist/index.cjs +352 -249
- package/dist/index.d.ts +154 -163
- package/dist/index.mjs +352 -249
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -832,48 +832,49 @@ var isConfig = function isConfig(value) {
|
|
|
832
832
|
Object.keys(value).length < 3 || 'apiOverrides' in value || 'development' in value || 'abstractDecimals' in value || 'xcmFormatCheck' in value);
|
|
833
833
|
};
|
|
834
834
|
|
|
835
|
-
var computeOverridenAmount = function computeOverridenAmount(options) {
|
|
835
|
+
var computeOverridenAmount = function computeOverridenAmount(options, increaseAmount) {
|
|
836
836
|
var from = options.from,
|
|
837
837
|
to = options.to,
|
|
838
838
|
currency = options.currency,
|
|
839
839
|
api = options.api;
|
|
840
|
+
var amount = options.currency.amount;
|
|
840
841
|
var config = api.getConfig();
|
|
841
842
|
if (isConfig(config) && config.abstractDecimals) {
|
|
842
|
-
return
|
|
843
|
+
return BigInt(increaseAmount) + BigInt(amount);
|
|
843
844
|
} else {
|
|
844
845
|
assertToIsString(to);
|
|
845
846
|
var asset = findAssetInfoOrThrow(from, currency, to);
|
|
846
|
-
return parseUnits(
|
|
847
|
+
return parseUnits(increaseAmount, asset.decimals) + BigInt(amount);
|
|
847
848
|
}
|
|
848
849
|
};
|
|
849
|
-
var overrideTxAmount = function overrideTxAmount(options, builder) {
|
|
850
|
+
var overrideTxAmount = function overrideTxAmount(options, builder, amount) {
|
|
850
851
|
var modifiedBuilder = builder.currency(_objectSpread2(_objectSpread2({}, options.currency), {}, {
|
|
851
|
-
amount: computeOverridenAmount(options)
|
|
852
|
+
amount: computeOverridenAmount(options, amount)
|
|
852
853
|
}));
|
|
853
854
|
return modifiedBuilder['buildInternal']();
|
|
854
855
|
};
|
|
855
|
-
var
|
|
856
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, builder) {
|
|
857
|
-
var tx, txBypass;
|
|
856
|
+
var createTx = /*#__PURE__*/function () {
|
|
857
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, builder, amount) {
|
|
858
858
|
return _regenerator().w(function (_context) {
|
|
859
859
|
while (1) switch (_context.n) {
|
|
860
860
|
case 0:
|
|
861
|
+
if (!(amount === undefined)) {
|
|
862
|
+
_context.n = 2;
|
|
863
|
+
break;
|
|
864
|
+
}
|
|
861
865
|
_context.n = 1;
|
|
862
866
|
return builder['buildInternal']();
|
|
863
867
|
case 1:
|
|
864
|
-
|
|
865
|
-
_context.n = 2;
|
|
866
|
-
return overrideTxAmount(options, builder);
|
|
868
|
+
return _context.a(2, _context.v);
|
|
867
869
|
case 2:
|
|
868
|
-
|
|
869
|
-
return
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
});
|
|
870
|
+
_context.n = 3;
|
|
871
|
+
return overrideTxAmount(options, builder, amount);
|
|
872
|
+
case 3:
|
|
873
|
+
return _context.a(2, _context.v);
|
|
873
874
|
}
|
|
874
875
|
}, _callee);
|
|
875
876
|
}));
|
|
876
|
-
return function
|
|
877
|
+
return function createTx(_x, _x2, _x3) {
|
|
877
878
|
return _ref.apply(this, arguments);
|
|
878
879
|
};
|
|
879
880
|
}();
|
|
@@ -2720,7 +2721,7 @@ var getLocationTokenId = function getLocationTokenId(location, chain) {
|
|
|
2720
2721
|
return null;
|
|
2721
2722
|
};
|
|
2722
2723
|
|
|
2723
|
-
var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, chain,
|
|
2724
|
+
var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, chain, executionFee) {
|
|
2724
2725
|
var isFeeAsset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
2725
2726
|
// Extract delivery fees from emitted events
|
|
2726
2727
|
var deliveryFees = [];
|
|
@@ -2772,7 +2773,7 @@ var computeFeeFromDryRun = function computeFeeFromDryRun(dryRun, chain, _executi
|
|
|
2772
2773
|
}).reduce(function (acc, df) {
|
|
2773
2774
|
return acc + df.plancks;
|
|
2774
2775
|
}, 0n);
|
|
2775
|
-
return totalDeliveryFees;
|
|
2776
|
+
return totalDeliveryFees + executionFee;
|
|
2776
2777
|
}
|
|
2777
2778
|
};
|
|
2778
2779
|
|
|
@@ -3376,7 +3377,7 @@ var createBaseExecuteXcm = function createBaseExecuteXcm(options) {
|
|
|
3376
3377
|
dest: createDestination(version, reserveChain !== null && reserveChain !== void 0 ? reserveChain : chain, destChain, paraIdTo),
|
|
3377
3378
|
xcm: [{
|
|
3378
3379
|
BuyExecution: {
|
|
3379
|
-
fees: updateAsset(assetLocalizedToDest, amount - (feeAsset ? reserveFee : originFee + reserveFee)),
|
|
3380
|
+
fees: updateAsset(assetLocalizedToDest, reserveFee === 1000n ? amount / 2n : amount - (feeAsset ? reserveFee : originFee + reserveFee)),
|
|
3380
3381
|
weight_limit: 'Unlimited'
|
|
3381
3382
|
}
|
|
3382
3383
|
}].concat(_toConsumableArray(suffixXcm))
|
|
@@ -5447,7 +5448,7 @@ var isMultiHopSwap = function isMultiHopSwap(exchangeChain, assetFrom, assetTo)
|
|
|
5447
5448
|
|
|
5448
5449
|
var createExchangeInstructions = /*#__PURE__*/function () {
|
|
5449
5450
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, assetFrom, assetTo) {
|
|
5450
|
-
var chain, exchangeChain, assetInfoFrom, assetInfoTo, version, calculateMinAmountOut, _options$fees, originReserveFee, exchangeFee, nativeSymbol, needsMultiHop, nativeAsset,
|
|
5451
|
+
var chain, exchangeChain, assetInfoFrom, assetInfoTo, version, calculateMinAmountOut, _options$fees, originReserveFee, exchangeFee, nativeSymbol, needsMultiHop, nativeAsset, nativeAmountOut, assetNative;
|
|
5451
5452
|
return _regenerator().w(function (_context) {
|
|
5452
5453
|
while (1) switch (_context.n) {
|
|
5453
5454
|
case 0:
|
|
@@ -5458,7 +5459,6 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5458
5459
|
symbol: Native(nativeSymbol)
|
|
5459
5460
|
}, null);
|
|
5460
5461
|
assertHasLocation(nativeAsset);
|
|
5461
|
-
shouldUseMaximal = !chain || exchangeChain === 'Hydration' && exchangeFee === 0n;
|
|
5462
5462
|
if (needsMultiHop) {
|
|
5463
5463
|
_context.n = 1;
|
|
5464
5464
|
break;
|
|
@@ -5467,7 +5467,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5467
5467
|
ExchangeAsset: {
|
|
5468
5468
|
give: createAssetsFilter(assetFrom),
|
|
5469
5469
|
want: [assetTo],
|
|
5470
|
-
maximal:
|
|
5470
|
+
maximal: false
|
|
5471
5471
|
}
|
|
5472
5472
|
}]);
|
|
5473
5473
|
case 1:
|
|
@@ -5480,7 +5480,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5480
5480
|
ExchangeAsset: {
|
|
5481
5481
|
give: createAssetsFilter(assetFrom),
|
|
5482
5482
|
want: [assetNative],
|
|
5483
|
-
maximal:
|
|
5483
|
+
maximal: false
|
|
5484
5484
|
}
|
|
5485
5485
|
}, {
|
|
5486
5486
|
ExchangeAsset: {
|
|
@@ -5498,17 +5498,15 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5498
5498
|
}();
|
|
5499
5499
|
var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
5500
5500
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5501
|
-
var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, _options$fees2, originReserveFee,
|
|
5501
|
+
var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, _options$fees2, originReserveFee, destReserveFee, recipientAddress, version, paraIdTo, assetFrom, amountOut, assetTo, assetToLocalizedToDest, _prepareCommonExecute, prefix, depositInstruction, exchangeInstructions, exchangeToDestXcm, finalXcm, fullXcm;
|
|
5502
5502
|
return _regenerator().w(function (_context2) {
|
|
5503
5503
|
while (1) switch (_context2.n) {
|
|
5504
5504
|
case 0:
|
|
5505
|
-
api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetInfoFrom = options.assetInfoFrom, assetInfoTo = options.assetInfoTo, _options$fees2 = options.fees, originReserveFee = _options$fees2.originReserveFee,
|
|
5505
|
+
api = options.api, chain = options.chain, exchangeChain = options.exchangeChain, destChain = options.destChain, assetInfoFrom = options.assetInfoFrom, assetInfoTo = options.assetInfoTo, _options$fees2 = options.fees, originReserveFee = _options$fees2.originReserveFee, destReserveFee = _options$fees2.destReserveFee, recipientAddress = options.recipientAddress, version = options.version, paraIdTo = options.paraIdTo;
|
|
5506
5506
|
assertHasLocation(assetInfoFrom);
|
|
5507
5507
|
assertHasLocation(assetInfoTo);
|
|
5508
5508
|
assetFrom = createAsset(version, assetInfoFrom.amount, localizeLocation(exchangeChain, assetInfoFrom.location));
|
|
5509
|
-
|
|
5510
|
-
// Set want to 1000n to prevent NoDeal
|
|
5511
|
-
amountOut = chain && exchangeFee === 0n ? MIN_FEE : assetInfoTo.amount;
|
|
5509
|
+
amountOut = assetInfoTo.amount;
|
|
5512
5510
|
assetTo = createAsset(version, amountOut, localizeLocation(exchangeChain, assetInfoTo.location));
|
|
5513
5511
|
assetToLocalizedToDest = createAsset(version, amountOut, localizeLocation(destChain !== null && destChain !== void 0 ? destChain : exchangeChain, assetInfoTo.location));
|
|
5514
5512
|
_prepareCommonExecute = prepareCommonExecuteXcm({
|
|
@@ -5528,12 +5526,6 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
|
5528
5526
|
return createExchangeInstructions(options, assetFrom, assetTo);
|
|
5529
5527
|
case 1:
|
|
5530
5528
|
exchangeInstructions = _context2.v;
|
|
5531
|
-
if (!(assetInfoTo.amount < MIN_FEE)) {
|
|
5532
|
-
_context2.n = 2;
|
|
5533
|
-
break;
|
|
5534
|
-
}
|
|
5535
|
-
throw new AmountTooLowError('Amount to receive after swap is too low, Increase Currency From amount.');
|
|
5536
|
-
case 2:
|
|
5537
5529
|
exchangeToDestXcm = destChain ? createBaseExecuteXcm({
|
|
5538
5530
|
chain: exchangeChain,
|
|
5539
5531
|
destChain: destChain,
|
|
@@ -9675,7 +9667,6 @@ var MAX_WEIGHT = {
|
|
|
9675
9667
|
refTime: MAX_U64
|
|
9676
9668
|
};
|
|
9677
9669
|
var BYPASS_MINT_AMOUNT = '1000';
|
|
9678
|
-
var BYPASS_CURRENCY_AMOUNT = '800';
|
|
9679
9670
|
|
|
9680
9671
|
var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
|
|
9681
9672
|
var assets = options.assets,
|
|
@@ -10274,6 +10265,136 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10274
10265
|
};
|
|
10275
10266
|
}();
|
|
10276
10267
|
|
|
10268
|
+
var getBypassResultWithRetries = /*#__PURE__*/function () {
|
|
10269
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, internalFn, initialTx) {
|
|
10270
|
+
var maxRetries,
|
|
10271
|
+
bumpStep,
|
|
10272
|
+
hasError,
|
|
10273
|
+
first,
|
|
10274
|
+
result,
|
|
10275
|
+
i,
|
|
10276
|
+
amount,
|
|
10277
|
+
bumpedTx,
|
|
10278
|
+
_args = arguments,
|
|
10279
|
+
_t,
|
|
10280
|
+
_t2,
|
|
10281
|
+
_t3;
|
|
10282
|
+
return _regenerator().w(function (_context) {
|
|
10283
|
+
while (1) switch (_context.p = _context.n) {
|
|
10284
|
+
case 0:
|
|
10285
|
+
maxRetries = _args.length > 3 && _args[3] !== undefined ? _args[3] : 5;
|
|
10286
|
+
bumpStep = _args.length > 4 && _args[4] !== undefined ? _args[4] : 100;
|
|
10287
|
+
hasError = function hasError(res) {
|
|
10288
|
+
return 'failureReason' in res ? !!res.failureReason : 'dryRunError' in res ? !!res.dryRunError : false;
|
|
10289
|
+
};
|
|
10290
|
+
if (!initialTx) {
|
|
10291
|
+
_context.n = 5;
|
|
10292
|
+
break;
|
|
10293
|
+
}
|
|
10294
|
+
_context.p = 1;
|
|
10295
|
+
_context.n = 2;
|
|
10296
|
+
return internalFn(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10297
|
+
tx: initialTx,
|
|
10298
|
+
useRootOrigin: true
|
|
10299
|
+
}));
|
|
10300
|
+
case 2:
|
|
10301
|
+
first = _context.v;
|
|
10302
|
+
if (hasError(first)) {
|
|
10303
|
+
_context.n = 3;
|
|
10304
|
+
break;
|
|
10305
|
+
}
|
|
10306
|
+
return _context.a(2, first);
|
|
10307
|
+
case 3:
|
|
10308
|
+
_context.n = 5;
|
|
10309
|
+
break;
|
|
10310
|
+
case 4:
|
|
10311
|
+
_context.p = 4;
|
|
10312
|
+
_t = _context.v;
|
|
10313
|
+
if (_t instanceof AmountTooLowError) {
|
|
10314
|
+
_context.n = 5;
|
|
10315
|
+
break;
|
|
10316
|
+
}
|
|
10317
|
+
throw _t;
|
|
10318
|
+
case 5:
|
|
10319
|
+
result = null;
|
|
10320
|
+
i = 1;
|
|
10321
|
+
case 6:
|
|
10322
|
+
if (!(i <= maxRetries)) {
|
|
10323
|
+
_context.n = 19;
|
|
10324
|
+
break;
|
|
10325
|
+
}
|
|
10326
|
+
amount = (bumpStep * i).toString();
|
|
10327
|
+
bumpedTx = void 0;
|
|
10328
|
+
_context.p = 7;
|
|
10329
|
+
_context.n = 8;
|
|
10330
|
+
return options.buildTx(amount);
|
|
10331
|
+
case 8:
|
|
10332
|
+
bumpedTx = _context.v;
|
|
10333
|
+
_context.n = 12;
|
|
10334
|
+
break;
|
|
10335
|
+
case 9:
|
|
10336
|
+
_context.p = 9;
|
|
10337
|
+
_t2 = _context.v;
|
|
10338
|
+
if (!(_t2 instanceof AmountTooLowError)) {
|
|
10339
|
+
_context.n = 11;
|
|
10340
|
+
break;
|
|
10341
|
+
}
|
|
10342
|
+
if (!(i === maxRetries)) {
|
|
10343
|
+
_context.n = 10;
|
|
10344
|
+
break;
|
|
10345
|
+
}
|
|
10346
|
+
throw _t2;
|
|
10347
|
+
case 10:
|
|
10348
|
+
return _context.a(3, 18);
|
|
10349
|
+
case 11:
|
|
10350
|
+
throw _t2;
|
|
10351
|
+
case 12:
|
|
10352
|
+
_context.p = 12;
|
|
10353
|
+
_context.n = 13;
|
|
10354
|
+
return internalFn(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10355
|
+
tx: bumpedTx,
|
|
10356
|
+
useRootOrigin: true
|
|
10357
|
+
}));
|
|
10358
|
+
case 13:
|
|
10359
|
+
result = _context.v;
|
|
10360
|
+
if (hasError(result)) {
|
|
10361
|
+
_context.n = 14;
|
|
10362
|
+
break;
|
|
10363
|
+
}
|
|
10364
|
+
return _context.a(2, result);
|
|
10365
|
+
case 14:
|
|
10366
|
+
_context.n = 18;
|
|
10367
|
+
break;
|
|
10368
|
+
case 15:
|
|
10369
|
+
_context.p = 15;
|
|
10370
|
+
_t3 = _context.v;
|
|
10371
|
+
if (!(_t3 instanceof AmountTooLowError)) {
|
|
10372
|
+
_context.n = 17;
|
|
10373
|
+
break;
|
|
10374
|
+
}
|
|
10375
|
+
if (!(i === maxRetries)) {
|
|
10376
|
+
_context.n = 16;
|
|
10377
|
+
break;
|
|
10378
|
+
}
|
|
10379
|
+
throw _t3;
|
|
10380
|
+
case 16:
|
|
10381
|
+
return _context.a(3, 18);
|
|
10382
|
+
case 17:
|
|
10383
|
+
throw _t3;
|
|
10384
|
+
case 18:
|
|
10385
|
+
i++;
|
|
10386
|
+
_context.n = 6;
|
|
10387
|
+
break;
|
|
10388
|
+
case 19:
|
|
10389
|
+
return _context.a(2, result);
|
|
10390
|
+
}
|
|
10391
|
+
}, _callee, null, [[12, 15], [7, 9], [1, 4]]);
|
|
10392
|
+
}));
|
|
10393
|
+
return function getBypassResultWithRetries(_x, _x2, _x3) {
|
|
10394
|
+
return _ref.apply(this, arguments);
|
|
10395
|
+
};
|
|
10396
|
+
}();
|
|
10397
|
+
|
|
10277
10398
|
var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
10278
10399
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
10279
10400
|
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, _ref$useRootOrigin, useRootOrigin, asset, amount, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient, dryRunResult, _rawFee, _paddedFee, fee, forwardedXcms, destParaId, weight;
|
|
@@ -10374,30 +10495,48 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10374
10495
|
|
|
10375
10496
|
var getOriginXcmFee = /*#__PURE__*/function () {
|
|
10376
10497
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10377
|
-
var
|
|
10498
|
+
var buildTx, tx, real, forced, _forced, _t;
|
|
10378
10499
|
return _regenerator().w(function (_context) {
|
|
10379
|
-
while (1) switch (_context.n) {
|
|
10500
|
+
while (1) switch (_context.p = _context.n) {
|
|
10380
10501
|
case 0:
|
|
10381
|
-
|
|
10382
|
-
_context.
|
|
10383
|
-
return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10384
|
-
tx: txBypass,
|
|
10385
|
-
useRootOrigin: true
|
|
10386
|
-
}));
|
|
10387
|
-
case 1:
|
|
10388
|
-
forced = _context.v;
|
|
10502
|
+
buildTx = options.buildTx;
|
|
10503
|
+
_context.p = 1;
|
|
10389
10504
|
_context.n = 2;
|
|
10505
|
+
return buildTx();
|
|
10506
|
+
case 2:
|
|
10507
|
+
tx = _context.v;
|
|
10508
|
+
_context.n = 3;
|
|
10390
10509
|
return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10391
10510
|
tx: tx,
|
|
10392
10511
|
useRootOrigin: false
|
|
10393
10512
|
}));
|
|
10394
|
-
case
|
|
10513
|
+
case 3:
|
|
10395
10514
|
real = _context.v;
|
|
10515
|
+
_context.n = 4;
|
|
10516
|
+
return getBypassResultWithRetries(options, getOriginXcmFeeInternal, tx);
|
|
10517
|
+
case 4:
|
|
10518
|
+
forced = _context.v;
|
|
10396
10519
|
return _context.a(2, _objectSpread2(_objectSpread2({}, forced), {}, {
|
|
10397
10520
|
sufficient: real.sufficient
|
|
10398
10521
|
}));
|
|
10522
|
+
case 5:
|
|
10523
|
+
_context.p = 5;
|
|
10524
|
+
_t = _context.v;
|
|
10525
|
+
if (_t instanceof AmountTooLowError) {
|
|
10526
|
+
_context.n = 6;
|
|
10527
|
+
break;
|
|
10528
|
+
}
|
|
10529
|
+
throw _t;
|
|
10530
|
+
case 6:
|
|
10531
|
+
_context.n = 7;
|
|
10532
|
+
return getBypassResultWithRetries(options, getOriginXcmFeeInternal);
|
|
10533
|
+
case 7:
|
|
10534
|
+
_forced = _context.v;
|
|
10535
|
+
return _context.a(2, _objectSpread2(_objectSpread2({}, _forced), {}, {
|
|
10536
|
+
sufficient: false
|
|
10537
|
+
}));
|
|
10399
10538
|
}
|
|
10400
|
-
}, _callee);
|
|
10539
|
+
}, _callee, null, [[1, 5]]);
|
|
10401
10540
|
}));
|
|
10402
10541
|
return function getOriginXcmFee(_x) {
|
|
10403
10542
|
return _ref.apply(this, arguments);
|
|
@@ -10956,30 +11095,27 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10956
11095
|
|
|
10957
11096
|
var getXcmFee = /*#__PURE__*/function () {
|
|
10958
11097
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10959
|
-
var _real$assetHub, _real$bridgeHub;
|
|
10960
|
-
var _options$txs, tx, txBypass, forced, real, api;
|
|
11098
|
+
var buildTx, api, _real$assetHub, _real$bridgeHub, tx, real, forced, _forced, _t;
|
|
10961
11099
|
return _regenerator().w(function (_context) {
|
|
10962
|
-
while (1) switch (_context.n) {
|
|
11100
|
+
while (1) switch (_context.p = _context.n) {
|
|
10963
11101
|
case 0:
|
|
10964
|
-
|
|
10965
|
-
_context.
|
|
10966
|
-
return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10967
|
-
tx: txBypass,
|
|
10968
|
-
useRootOrigin: true
|
|
10969
|
-
}));
|
|
10970
|
-
case 1:
|
|
10971
|
-
forced = _context.v;
|
|
11102
|
+
buildTx = options.buildTx, api = options.api;
|
|
11103
|
+
_context.p = 1;
|
|
10972
11104
|
_context.n = 2;
|
|
11105
|
+
return buildTx();
|
|
11106
|
+
case 2:
|
|
11107
|
+
tx = _context.v;
|
|
11108
|
+
_context.n = 3;
|
|
10973
11109
|
return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10974
11110
|
tx: tx,
|
|
10975
11111
|
useRootOrigin: false
|
|
10976
11112
|
}));
|
|
10977
|
-
case 2:
|
|
10978
|
-
real = _context.v;
|
|
10979
|
-
api = options.api;
|
|
10980
|
-
_context.n = 3;
|
|
10981
|
-
return api.disconnect();
|
|
10982
11113
|
case 3:
|
|
11114
|
+
real = _context.v;
|
|
11115
|
+
_context.n = 4;
|
|
11116
|
+
return getBypassResultWithRetries(options, getXcmFeeInternal, tx);
|
|
11117
|
+
case 4:
|
|
11118
|
+
forced = _context.v;
|
|
10983
11119
|
return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, forced), {}, {
|
|
10984
11120
|
origin: _objectSpread2(_objectSpread2({}, forced.origin), {}, {
|
|
10985
11121
|
sufficient: real.origin.sufficient
|
|
@@ -10996,17 +11132,62 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
10996
11132
|
sufficient: (_real$bridgeHub = real.bridgeHub) === null || _real$bridgeHub === void 0 ? void 0 : _real$bridgeHub.sufficient
|
|
10997
11133
|
})
|
|
10998
11134
|
} : {}), {}, {
|
|
10999
|
-
hops: forced.hops.map(function (hop,
|
|
11000
|
-
var _real$hops$
|
|
11135
|
+
hops: forced.hops.map(function (hop, i) {
|
|
11136
|
+
var _real$hops$i;
|
|
11001
11137
|
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
11002
11138
|
result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
|
|
11003
|
-
sufficient: (_real$hops$
|
|
11139
|
+
sufficient: (_real$hops$i = real.hops[i]) === null || _real$hops$i === void 0 || (_real$hops$i = _real$hops$i.result) === null || _real$hops$i === void 0 ? void 0 : _real$hops$i.sufficient
|
|
11004
11140
|
})
|
|
11005
11141
|
});
|
|
11006
11142
|
})
|
|
11007
11143
|
}));
|
|
11144
|
+
case 5:
|
|
11145
|
+
_context.p = 5;
|
|
11146
|
+
_t = _context.v;
|
|
11147
|
+
if (_t instanceof AmountTooLowError) {
|
|
11148
|
+
_context.n = 6;
|
|
11149
|
+
break;
|
|
11150
|
+
}
|
|
11151
|
+
throw _t;
|
|
11152
|
+
case 6:
|
|
11153
|
+
_context.n = 7;
|
|
11154
|
+
return getBypassResultWithRetries(options, getXcmFeeInternal);
|
|
11155
|
+
case 7:
|
|
11156
|
+
_forced = _context.v;
|
|
11157
|
+
return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, _forced), {}, {
|
|
11158
|
+
origin: _objectSpread2(_objectSpread2({}, _forced.origin), {}, {
|
|
11159
|
+
sufficient: false
|
|
11160
|
+
}),
|
|
11161
|
+
destination: _objectSpread2(_objectSpread2({}, _forced.destination), {}, {
|
|
11162
|
+
sufficient: false
|
|
11163
|
+
})
|
|
11164
|
+
}, _forced.assetHub ? {
|
|
11165
|
+
assetHub: _objectSpread2(_objectSpread2({}, _forced.assetHub), {}, {
|
|
11166
|
+
sufficient: false
|
|
11167
|
+
})
|
|
11168
|
+
} : {}), _forced.bridgeHub ? {
|
|
11169
|
+
bridgeHub: _objectSpread2(_objectSpread2({}, _forced.bridgeHub), {}, {
|
|
11170
|
+
sufficient: false
|
|
11171
|
+
})
|
|
11172
|
+
} : {}), {}, {
|
|
11173
|
+
hops: _forced.hops.map(function (hop) {
|
|
11174
|
+
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
11175
|
+
result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
|
|
11176
|
+
sufficient: false
|
|
11177
|
+
})
|
|
11178
|
+
});
|
|
11179
|
+
})
|
|
11180
|
+
}));
|
|
11181
|
+
case 8:
|
|
11182
|
+
_context.p = 8;
|
|
11183
|
+
_context.n = 9;
|
|
11184
|
+
return api.disconnect();
|
|
11185
|
+
case 9:
|
|
11186
|
+
return _context.f(8);
|
|
11187
|
+
case 10:
|
|
11188
|
+
return _context.a(2);
|
|
11008
11189
|
}
|
|
11009
|
-
}, _callee);
|
|
11190
|
+
}, _callee, null, [[1, 5, 8, 10]]);
|
|
11010
11191
|
}));
|
|
11011
11192
|
return function getXcmFee(_x) {
|
|
11012
11193
|
return _ref.apply(this, arguments);
|
|
@@ -11452,11 +11633,11 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
11452
11633
|
|
|
11453
11634
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
11454
11635
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
11455
|
-
var api,
|
|
11636
|
+
var api, buildTx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
|
|
11456
11637
|
return _regenerator().w(function (_context2) {
|
|
11457
11638
|
while (1) switch (_context2.p = _context2.n) {
|
|
11458
11639
|
case 0:
|
|
11459
|
-
api = _ref.api,
|
|
11640
|
+
api = _ref.api, buildTx = _ref.buildTx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, ahAddress = _ref.ahAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset;
|
|
11460
11641
|
if (!(isChainEvm(origin) && !ahAddress)) {
|
|
11461
11642
|
_context2.n = 1;
|
|
11462
11643
|
break;
|
|
@@ -11510,7 +11691,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11510
11691
|
_context2.n = 9;
|
|
11511
11692
|
return getXcmFee({
|
|
11512
11693
|
api: api,
|
|
11513
|
-
|
|
11694
|
+
buildTx: buildTx,
|
|
11514
11695
|
origin: origin,
|
|
11515
11696
|
destination: destination,
|
|
11516
11697
|
senderAddress: senderAddress,
|
|
@@ -11678,11 +11859,11 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11678
11859
|
|
|
11679
11860
|
var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
11680
11861
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11681
|
-
var api, origin, senderAddress, address, chain, destination, currency, feeAsset,
|
|
11862
|
+
var api, origin, senderAddress, address, chain, destination, currency, feeAsset, buildTx, builder, resolvedFeeAsset, asset, destAsset, destCurrency, destApi, destBalance, destEd, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, amount, result, originFee, hopFeeTotal, destinationFee, edComponent, minAmount, modifiedBuilder, dryRunResult, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
11682
11863
|
return _regenerator().w(function (_context) {
|
|
11683
11864
|
while (1) switch (_context.n) {
|
|
11684
11865
|
case 0:
|
|
11685
|
-
api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, feeAsset = _ref.feeAsset,
|
|
11866
|
+
api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, feeAsset = _ref.feeAsset, buildTx = _ref.buildTx, builder = _ref.builder;
|
|
11686
11867
|
validateAddress(senderAddress, chain, false);
|
|
11687
11868
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
11688
11869
|
asset = findAssetInfoOrThrow(chain, currency, null);
|
|
@@ -11715,7 +11896,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11715
11896
|
api: api,
|
|
11716
11897
|
origin: origin,
|
|
11717
11898
|
destination: destination,
|
|
11718
|
-
|
|
11899
|
+
buildTx: buildTx,
|
|
11719
11900
|
senderAddress: senderAddress,
|
|
11720
11901
|
address: address,
|
|
11721
11902
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
@@ -11810,11 +11991,11 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
|
11810
11991
|
|
|
11811
11992
|
var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
11812
11993
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11813
|
-
var api, senderAddress, chain, destination, currency,
|
|
11994
|
+
var api, senderAddress, chain, destination, currency, buildTx, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
|
|
11814
11995
|
return _regenerator().w(function (_context) {
|
|
11815
11996
|
while (1) switch (_context.n) {
|
|
11816
11997
|
case 0:
|
|
11817
|
-
api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency,
|
|
11998
|
+
api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, buildTx = _ref.buildTx, feeAsset = _ref.feeAsset;
|
|
11818
11999
|
validateAddress(senderAddress, chain, false);
|
|
11819
12000
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
11820
12001
|
asset = findAssetInfoOrThrow(chain, currency, null);
|
|
@@ -11840,7 +12021,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11840
12021
|
_context.n = 2;
|
|
11841
12022
|
return getOriginXcmFee({
|
|
11842
12023
|
api: api,
|
|
11843
|
-
|
|
12024
|
+
buildTx: buildTx,
|
|
11844
12025
|
origin: chain,
|
|
11845
12026
|
destination: chain,
|
|
11846
12027
|
senderAddress: senderAddress,
|
|
@@ -12226,11 +12407,11 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
|
|
|
12226
12407
|
};
|
|
12227
12408
|
var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
12228
12409
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
12229
|
-
var api,
|
|
12410
|
+
var api, buildTx, origin, destination, currency, address, senderAddress, feeAsset, destApi, asset, amount, destCurrency, ed, balance, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, tx, totalFee, method, feeToSubtract;
|
|
12230
12411
|
return _regenerator().w(function (_context) {
|
|
12231
12412
|
while (1) switch (_context.n) {
|
|
12232
12413
|
case 0:
|
|
12233
|
-
api = options.api,
|
|
12414
|
+
api = options.api, buildTx = options.buildTx, origin = options.origin, destination = options.destination, currency = options.currency, address = options.address, senderAddress = options.senderAddress, feeAsset = options.feeAsset;
|
|
12234
12415
|
if (!(destination === 'Ethereum')) {
|
|
12235
12416
|
_context.n = 1;
|
|
12236
12417
|
break;
|
|
@@ -12271,11 +12452,10 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12271
12452
|
});
|
|
12272
12453
|
case 5:
|
|
12273
12454
|
balance = _context.v;
|
|
12274
|
-
tx = txs.tx, txBypass = txs.txBypass;
|
|
12275
12455
|
_context.n = 6;
|
|
12276
|
-
return
|
|
12456
|
+
return getXcmFee({
|
|
12277
12457
|
api: api,
|
|
12278
|
-
|
|
12458
|
+
buildTx: buildTx,
|
|
12279
12459
|
origin: origin,
|
|
12280
12460
|
destination: destination,
|
|
12281
12461
|
senderAddress: senderAddress,
|
|
@@ -12284,8 +12464,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12284
12464
|
amount: amount
|
|
12285
12465
|
}),
|
|
12286
12466
|
feeAsset: feeAsset,
|
|
12287
|
-
disableFallback: false
|
|
12288
|
-
useRootOrigin: true
|
|
12467
|
+
disableFallback: false
|
|
12289
12468
|
});
|
|
12290
12469
|
case 6:
|
|
12291
12470
|
xcmFeeResult = _context.v;
|
|
@@ -12315,6 +12494,10 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12315
12494
|
}
|
|
12316
12495
|
throw new UnableToComputeError("The XCM fee could not be calculated because the origin or destination chain does not support DryRun.\n As a result, fee estimation is only available through PaymentInfo, which provides the cost in the native asset.\n This limitation restricts support to transfers involving the native asset of the Destination chain only.");
|
|
12317
12496
|
case 10:
|
|
12497
|
+
_context.n = 11;
|
|
12498
|
+
return buildTx();
|
|
12499
|
+
case 11:
|
|
12500
|
+
tx = _context.v;
|
|
12318
12501
|
totalFee = calculateTotalXcmFee(xcmFeeResult);
|
|
12319
12502
|
method = api.getMethod(tx);
|
|
12320
12503
|
if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
|
|
@@ -12878,11 +13061,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12878
13061
|
return dryRunPreview;
|
|
12879
13062
|
}()
|
|
12880
13063
|
}, {
|
|
12881
|
-
key: "
|
|
12882
|
-
value: function
|
|
12883
|
-
|
|
12884
|
-
|
|
12885
|
-
|
|
13064
|
+
key: "createTxFactory",
|
|
13065
|
+
value: function createTxFactory() {
|
|
13066
|
+
var _this = this;
|
|
13067
|
+
return function (amount) {
|
|
13068
|
+
return createTx(_objectSpread2(_objectSpread2({}, _this._options), {}, {
|
|
13069
|
+
api: _this.api
|
|
13070
|
+
}), _this, amount);
|
|
13071
|
+
};
|
|
12886
13072
|
}
|
|
12887
13073
|
/**
|
|
12888
13074
|
* Returns the XCM fee for the transfer using dryRun or paymentInfo function.
|
|
@@ -12894,7 +13080,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12894
13080
|
value: (function () {
|
|
12895
13081
|
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
|
|
12896
13082
|
var _options$disableFallb;
|
|
12897
|
-
var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback
|
|
13083
|
+
var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback;
|
|
12898
13084
|
return _regenerator().w(function (_context7) {
|
|
12899
13085
|
while (1) switch (_context7.p = _context7.n) {
|
|
12900
13086
|
case 0:
|
|
@@ -12903,43 +13089,30 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12903
13089
|
assertAddressIsString(address);
|
|
12904
13090
|
disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
|
|
12905
13091
|
_context7.p = 1;
|
|
12906
|
-
_t = getXcmFee;
|
|
12907
|
-
_t2 = this.api;
|
|
12908
13092
|
_context7.n = 2;
|
|
12909
|
-
return
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
_context7.n = 3;
|
|
12920
|
-
return _t({
|
|
12921
|
-
api: _t2,
|
|
12922
|
-
txs: _t3,
|
|
12923
|
-
origin: _t4,
|
|
12924
|
-
destination: _t5,
|
|
12925
|
-
senderAddress: _t6,
|
|
12926
|
-
address: _t7,
|
|
12927
|
-
currency: _t8,
|
|
12928
|
-
feeAsset: _t9,
|
|
12929
|
-
disableFallback: _t0
|
|
13093
|
+
return getXcmFee({
|
|
13094
|
+
api: this.api,
|
|
13095
|
+
buildTx: this.createTxFactory(),
|
|
13096
|
+
origin: from,
|
|
13097
|
+
destination: to,
|
|
13098
|
+
senderAddress: senderAddress,
|
|
13099
|
+
address: address,
|
|
13100
|
+
currency: currency,
|
|
13101
|
+
feeAsset: feeAsset,
|
|
13102
|
+
disableFallback: disableFallback
|
|
12930
13103
|
});
|
|
12931
|
-
case
|
|
13104
|
+
case 2:
|
|
12932
13105
|
return _context7.a(2, _context7.v);
|
|
12933
|
-
case
|
|
12934
|
-
_context7.p =
|
|
12935
|
-
_context7.n =
|
|
13106
|
+
case 3:
|
|
13107
|
+
_context7.p = 3;
|
|
13108
|
+
_context7.n = 4;
|
|
12936
13109
|
return this.api.disconnect();
|
|
13110
|
+
case 4:
|
|
13111
|
+
return _context7.f(3);
|
|
12937
13112
|
case 5:
|
|
12938
|
-
return _context7.f(4);
|
|
12939
|
-
case 6:
|
|
12940
13113
|
return _context7.a(2);
|
|
12941
13114
|
}
|
|
12942
|
-
}, _callee7, this, [[1,,
|
|
13115
|
+
}, _callee7, this, [[1,, 3, 5]]);
|
|
12943
13116
|
}));
|
|
12944
13117
|
function getXcmFee$1(_x6) {
|
|
12945
13118
|
return _getXcmFee2.apply(this, arguments);
|
|
@@ -12965,16 +13138,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12965
13138
|
currency,
|
|
12966
13139
|
feeAsset,
|
|
12967
13140
|
api,
|
|
12968
|
-
_args8 = arguments
|
|
12969
|
-
_t1,
|
|
12970
|
-
_t10,
|
|
12971
|
-
_t11,
|
|
12972
|
-
_t12,
|
|
12973
|
-
_t13,
|
|
12974
|
-
_t14,
|
|
12975
|
-
_t15,
|
|
12976
|
-
_t16,
|
|
12977
|
-
_t17;
|
|
13141
|
+
_args8 = arguments;
|
|
12978
13142
|
return _regenerator().w(function (_context8) {
|
|
12979
13143
|
while (1) switch (_context8.p = _context8.n) {
|
|
12980
13144
|
case 0:
|
|
@@ -12985,41 +13149,29 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12985
13149
|
assertToIsString(to);
|
|
12986
13150
|
api = this.api;
|
|
12987
13151
|
_context8.p = 1;
|
|
12988
|
-
_t1 = getOriginXcmFee;
|
|
12989
|
-
_t10 = api;
|
|
12990
13152
|
_context8.n = 2;
|
|
12991
|
-
return
|
|
12992
|
-
|
|
12993
|
-
|
|
12994
|
-
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
_context8.n = 3;
|
|
13001
|
-
return _t1({
|
|
13002
|
-
api: _t10,
|
|
13003
|
-
txs: _t11,
|
|
13004
|
-
origin: _t12,
|
|
13005
|
-
destination: _t13,
|
|
13006
|
-
senderAddress: _t14,
|
|
13007
|
-
currency: _t15,
|
|
13008
|
-
feeAsset: _t16,
|
|
13009
|
-
disableFallback: _t17
|
|
13153
|
+
return getOriginXcmFee({
|
|
13154
|
+
api: api,
|
|
13155
|
+
buildTx: this.createTxFactory(),
|
|
13156
|
+
origin: from,
|
|
13157
|
+
destination: to,
|
|
13158
|
+
senderAddress: senderAddress,
|
|
13159
|
+
currency: currency,
|
|
13160
|
+
feeAsset: feeAsset,
|
|
13161
|
+
disableFallback: disableFallback
|
|
13010
13162
|
});
|
|
13011
|
-
case
|
|
13163
|
+
case 2:
|
|
13012
13164
|
return _context8.a(2, _context8.v);
|
|
13013
|
-
case
|
|
13014
|
-
_context8.p =
|
|
13015
|
-
_context8.n =
|
|
13165
|
+
case 3:
|
|
13166
|
+
_context8.p = 3;
|
|
13167
|
+
_context8.n = 4;
|
|
13016
13168
|
return this.api.disconnect();
|
|
13169
|
+
case 4:
|
|
13170
|
+
return _context8.f(3);
|
|
13017
13171
|
case 5:
|
|
13018
|
-
return _context8.f(4);
|
|
13019
|
-
case 6:
|
|
13020
13172
|
return _context8.a(2);
|
|
13021
13173
|
}
|
|
13022
|
-
}, _callee8, this, [[1,,
|
|
13174
|
+
}, _callee8, this, [[1,, 3, 5]]);
|
|
13023
13175
|
}));
|
|
13024
13176
|
function getOriginXcmFee$1() {
|
|
13025
13177
|
return _getOriginXcmFee2.apply(this, arguments);
|
|
@@ -13134,32 +13286,21 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13134
13286
|
key: "getTransferableAmount",
|
|
13135
13287
|
value: (function () {
|
|
13136
13288
|
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
13137
|
-
var _this$_options6, from, to, senderAddress, currency, feeAsset, api
|
|
13289
|
+
var _this$_options6, from, to, senderAddress, currency, feeAsset, api;
|
|
13138
13290
|
return _regenerator().w(function (_context1) {
|
|
13139
13291
|
while (1) switch (_context1.n) {
|
|
13140
13292
|
case 0:
|
|
13141
13293
|
_this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency, feeAsset = _this$_options6.feeAsset;
|
|
13142
13294
|
assertToIsString(to);
|
|
13143
13295
|
api = this.api;
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
_t23 = senderAddress;
|
|
13153
|
-
_t24 = feeAsset;
|
|
13154
|
-
_t25 = currency;
|
|
13155
|
-
return _context1.a(2, _t18({
|
|
13156
|
-
api: _t19,
|
|
13157
|
-
txs: _t20,
|
|
13158
|
-
origin: _t21,
|
|
13159
|
-
destination: _t22,
|
|
13160
|
-
senderAddress: _t23,
|
|
13161
|
-
feeAsset: _t24,
|
|
13162
|
-
currency: _t25
|
|
13296
|
+
return _context1.a(2, getTransferableAmount({
|
|
13297
|
+
api: api,
|
|
13298
|
+
buildTx: this.createTxFactory(),
|
|
13299
|
+
origin: from,
|
|
13300
|
+
destination: to,
|
|
13301
|
+
senderAddress: senderAddress,
|
|
13302
|
+
feeAsset: feeAsset,
|
|
13303
|
+
currency: currency
|
|
13163
13304
|
}));
|
|
13164
13305
|
}
|
|
13165
13306
|
}, _callee1, this);
|
|
@@ -13179,7 +13320,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13179
13320
|
key: "getMinTransferableAmount",
|
|
13180
13321
|
value: (function () {
|
|
13181
13322
|
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
13182
|
-
var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api
|
|
13323
|
+
var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api;
|
|
13183
13324
|
return _regenerator().w(function (_context10) {
|
|
13184
13325
|
while (1) switch (_context10.n) {
|
|
13185
13326
|
case 0:
|
|
@@ -13187,29 +13328,16 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13187
13328
|
assertToIsString(to);
|
|
13188
13329
|
assertAddressIsString(address);
|
|
13189
13330
|
api = this.api;
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13193
|
-
|
|
13194
|
-
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
|
|
13200
|
-
_t33 = feeAsset;
|
|
13201
|
-
_t34 = currency;
|
|
13202
|
-
_t35 = this;
|
|
13203
|
-
return _context10.a(2, _t26({
|
|
13204
|
-
api: _t27,
|
|
13205
|
-
txs: _t28,
|
|
13206
|
-
origin: _t29,
|
|
13207
|
-
destination: _t30,
|
|
13208
|
-
senderAddress: _t31,
|
|
13209
|
-
address: _t32,
|
|
13210
|
-
feeAsset: _t33,
|
|
13211
|
-
currency: _t34,
|
|
13212
|
-
builder: _t35
|
|
13331
|
+
return _context10.a(2, getMinTransferableAmount({
|
|
13332
|
+
api: api,
|
|
13333
|
+
buildTx: this.createTxFactory(),
|
|
13334
|
+
origin: from,
|
|
13335
|
+
destination: to,
|
|
13336
|
+
senderAddress: senderAddress,
|
|
13337
|
+
address: address,
|
|
13338
|
+
feeAsset: feeAsset,
|
|
13339
|
+
currency: currency,
|
|
13340
|
+
builder: this
|
|
13213
13341
|
}));
|
|
13214
13342
|
}
|
|
13215
13343
|
}, _callee10, this);
|
|
@@ -13229,34 +13357,22 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13229
13357
|
key: "verifyEdOnDestination",
|
|
13230
13358
|
value: (function () {
|
|
13231
13359
|
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
13232
|
-
var _this$_options8, from, to, address, currency, senderAddress, feeAsset
|
|
13360
|
+
var _this$_options8, from, to, address, currency, senderAddress, feeAsset;
|
|
13233
13361
|
return _regenerator().w(function (_context11) {
|
|
13234
13362
|
while (1) switch (_context11.n) {
|
|
13235
13363
|
case 0:
|
|
13236
13364
|
_this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, address = _this$_options8.address, currency = _this$_options8.currency, senderAddress = _this$_options8.senderAddress, feeAsset = _this$_options8.feeAsset;
|
|
13237
13365
|
assertToIsString(to);
|
|
13238
13366
|
assertAddressIsString(address);
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
_t42 = senderAddress;
|
|
13249
|
-
_t43 = feeAsset;
|
|
13250
|
-
_t44 = currency;
|
|
13251
|
-
return _context11.a(2, _t36({
|
|
13252
|
-
api: _t37,
|
|
13253
|
-
txs: _t38,
|
|
13254
|
-
origin: _t39,
|
|
13255
|
-
destination: _t40,
|
|
13256
|
-
address: _t41,
|
|
13257
|
-
senderAddress: _t42,
|
|
13258
|
-
feeAsset: _t43,
|
|
13259
|
-
currency: _t44
|
|
13367
|
+
return _context11.a(2, verifyEdOnDestination({
|
|
13368
|
+
api: this.api,
|
|
13369
|
+
buildTx: this.createTxFactory(),
|
|
13370
|
+
origin: from,
|
|
13371
|
+
destination: to,
|
|
13372
|
+
address: address,
|
|
13373
|
+
senderAddress: senderAddress,
|
|
13374
|
+
feeAsset: feeAsset,
|
|
13375
|
+
currency: currency
|
|
13260
13376
|
}));
|
|
13261
13377
|
}
|
|
13262
13378
|
}, _callee11, this);
|
|
@@ -13276,36 +13392,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13276
13392
|
key: "getTransferInfo",
|
|
13277
13393
|
value: (function () {
|
|
13278
13394
|
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
13279
|
-
var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset
|
|
13395
|
+
var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset;
|
|
13280
13396
|
return _regenerator().w(function (_context12) {
|
|
13281
13397
|
while (1) switch (_context12.n) {
|
|
13282
13398
|
case 0:
|
|
13283
13399
|
_this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, ahAddress = _this$_options9.ahAddress, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
|
|
13284
13400
|
assertToIsString(to);
|
|
13285
13401
|
assertAddressIsString(address);
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
|
|
13295
|
-
|
|
13296
|
-
_t52 = ahAddress;
|
|
13297
|
-
_t53 = currency;
|
|
13298
|
-
_t54 = feeAsset;
|
|
13299
|
-
return _context12.a(2, _t45({
|
|
13300
|
-
api: _t46,
|
|
13301
|
-
txs: _t47,
|
|
13302
|
-
origin: _t48,
|
|
13303
|
-
destination: _t49,
|
|
13304
|
-
address: _t50,
|
|
13305
|
-
senderAddress: _t51,
|
|
13306
|
-
ahAddress: _t52,
|
|
13307
|
-
currency: _t53,
|
|
13308
|
-
feeAsset: _t54
|
|
13402
|
+
return _context12.a(2, getTransferInfo({
|
|
13403
|
+
api: this.api,
|
|
13404
|
+
buildTx: this.createTxFactory(),
|
|
13405
|
+
origin: from,
|
|
13406
|
+
destination: to,
|
|
13407
|
+
address: address,
|
|
13408
|
+
senderAddress: senderAddress,
|
|
13409
|
+
ahAddress: ahAddress,
|
|
13410
|
+
currency: currency,
|
|
13411
|
+
feeAsset: feeAsset
|
|
13309
13412
|
}));
|
|
13310
13413
|
}
|
|
13311
13414
|
}, _callee12, this);
|
|
@@ -13348,4 +13451,4 @@ var Builder = function Builder(api) {
|
|
|
13348
13451
|
return new GeneralBuilder(api, new BatchTransactionManager());
|
|
13349
13452
|
};
|
|
13350
13453
|
|
|
13351
|
-
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm,
|
|
13454
|
+
export { AmountTooLowError, AssetClaimBuilder, AssetsPallet, BatchMode, BridgeHaltedError, Builder, ChainNotSupportedError, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETHEREUM_JUNCTION, ETH_CHAIN_ID, GeneralBuilder, IncompatibleChainsError, InvalidAddressError, InvalidParameterError, MissingChainApiError, NoXCMSupportImplementedError, PolkadotXcmError, ScenarioNotSupportedError, TX_CLIENT_TIMEOUT_MS, TransferToAhNotSupported, UnableToComputeError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, applyDecimalAbstraction, assertAddressIsString, assertHasId, assertHasLocation, assertIsForeign, assertSenderAddress, assertToIsString, blake2b256, blake2b512, calcPreviewMintAmount, claimAssets, computeFeeFromDryRun, computeFeeFromDryRunPjs, computeOverridenAmount, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, overrideTxAmount, padFee, padFeeBy, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, verifyEdOnDestination, wrapTxBypass };
|