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