@paraspell/sdk-core 11.8.0 → 11.8.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 +457 -325
- package/dist/index.d.ts +156 -164
- package/dist/index.mjs +457 -325
- 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))
|
|
@@ -4371,95 +4372,125 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4371
4372
|
};
|
|
4372
4373
|
};
|
|
4373
4374
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4374
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4375
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
|
|
4375
4376
|
var api, origin, hopChain, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, tx, disableFallback, swapConfig, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, fee, newForwardedXcms, destParaId;
|
|
4376
|
-
return _regenerator().w(function (
|
|
4377
|
-
while (1) switch (
|
|
4377
|
+
return _regenerator().w(function (_context3) {
|
|
4378
|
+
while (1) switch (_context3.n) {
|
|
4378
4379
|
case 0:
|
|
4379
4380
|
api = options.api, origin = options.origin, hopChain = options.prevChain, destination = options.destination, currency = options.currency, forwardedXcms = options.forwardedXcms, asset = options.asset, address = options.address, feeAsset = options.feeAsset, originFee = options.originFee, tx = options.tx, disableFallback = options.disableFallback, swapConfig = options.swapConfig;
|
|
4380
4381
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
4381
4382
|
calcPaymentInfoFee = /*#__PURE__*/function () {
|
|
4382
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
4383
|
-
var
|
|
4384
|
-
return _regenerator().w(function (
|
|
4385
|
-
while (1) switch (
|
|
4383
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
4384
|
+
var attempt, _t2;
|
|
4385
|
+
return _regenerator().w(function (_context2) {
|
|
4386
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
4386
4387
|
case 0:
|
|
4387
4388
|
if (!(destination === 'Ethereum')) {
|
|
4388
|
-
|
|
4389
|
+
_context2.n = 1;
|
|
4389
4390
|
break;
|
|
4390
4391
|
}
|
|
4391
|
-
return
|
|
4392
|
+
return _context2.a(2, 0n);
|
|
4392
4393
|
case 1:
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4394
|
+
attempt = /*#__PURE__*/function () {
|
|
4395
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, curr, amt) {
|
|
4396
|
+
var assetInfo, _t;
|
|
4397
|
+
return _regenerator().w(function (_context) {
|
|
4398
|
+
while (1) switch (_context.p = _context.n) {
|
|
4399
|
+
case 0:
|
|
4400
|
+
assetInfo = assets.findAssetInfoOrThrow(chain, curr, destination);
|
|
4401
|
+
if (!assetInfo.location) {
|
|
4402
|
+
_context.n = 6;
|
|
4403
|
+
break;
|
|
4404
|
+
}
|
|
4405
|
+
_context.p = 1;
|
|
4406
|
+
_context.n = 2;
|
|
4407
|
+
return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
4408
|
+
destination: destination
|
|
4409
|
+
}), {
|
|
4410
|
+
location: assetInfo.location,
|
|
4411
|
+
amount: amt
|
|
4412
|
+
});
|
|
4413
|
+
case 2:
|
|
4414
|
+
return _context.a(2, _context.v);
|
|
4415
|
+
case 3:
|
|
4416
|
+
_context.p = 3;
|
|
4417
|
+
_t = _context.v;
|
|
4418
|
+
if (!(_t instanceof assets.InvalidCurrencyError)) {
|
|
4419
|
+
_context.n = 5;
|
|
4420
|
+
break;
|
|
4421
|
+
}
|
|
4422
|
+
_context.n = 4;
|
|
4423
|
+
return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
4424
|
+
destination: destination
|
|
4425
|
+
}), {
|
|
4426
|
+
symbol: assetInfo.symbol,
|
|
4427
|
+
amount: amt
|
|
4428
|
+
});
|
|
4429
|
+
case 4:
|
|
4430
|
+
return _context.a(2, _context.v);
|
|
4431
|
+
case 5:
|
|
4432
|
+
throw _t;
|
|
4433
|
+
case 6:
|
|
4434
|
+
_context.n = 7;
|
|
4435
|
+
return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
4436
|
+
destination: destination
|
|
4437
|
+
}), {
|
|
4438
|
+
symbol: assetInfo.symbol,
|
|
4439
|
+
amount: amt
|
|
4440
|
+
});
|
|
4441
|
+
case 7:
|
|
4442
|
+
return _context.a(2, _context.v);
|
|
4443
|
+
}
|
|
4444
|
+
}, _callee, null, [[1, 3]]);
|
|
4445
|
+
}));
|
|
4446
|
+
return function attempt(_x2, _x3, _x4) {
|
|
4447
|
+
return _ref3.apply(this, arguments);
|
|
4448
|
+
};
|
|
4449
|
+
}();
|
|
4450
|
+
_context2.p = 2;
|
|
4451
|
+
_context2.n = 3;
|
|
4452
|
+
return attempt(origin, currency, currency.amount);
|
|
4407
4453
|
case 3:
|
|
4408
|
-
return
|
|
4454
|
+
return _context2.a(2, _context2.v);
|
|
4409
4455
|
case 4:
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
if (!(
|
|
4413
|
-
|
|
4456
|
+
_context2.p = 4;
|
|
4457
|
+
_t2 = _context2.v;
|
|
4458
|
+
if (!(!(_t2 instanceof assets.InvalidCurrencyError) || !swapConfig)) {
|
|
4459
|
+
_context2.n = 5;
|
|
4414
4460
|
break;
|
|
4415
4461
|
}
|
|
4416
|
-
|
|
4417
|
-
return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
4418
|
-
destination: destination
|
|
4419
|
-
}), {
|
|
4420
|
-
symbol: originAsset.symbol,
|
|
4421
|
-
amount: amount
|
|
4422
|
-
});
|
|
4462
|
+
throw _t2;
|
|
4423
4463
|
case 5:
|
|
4424
|
-
|
|
4464
|
+
_context2.n = 6;
|
|
4465
|
+
return attempt(swapConfig.exchangeChain, swapConfig.currencyTo, swapConfig.amountOut);
|
|
4425
4466
|
case 6:
|
|
4426
|
-
|
|
4427
|
-
case 7:
|
|
4428
|
-
_context.n = 8;
|
|
4429
|
-
return getReverseTxFee(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
4430
|
-
destination: destination
|
|
4431
|
-
}), {
|
|
4432
|
-
symbol: originAsset.symbol,
|
|
4433
|
-
amount: amount
|
|
4434
|
-
});
|
|
4435
|
-
case 8:
|
|
4436
|
-
return _context.a(2, _context.v);
|
|
4467
|
+
return _context2.a(2, _context2.v);
|
|
4437
4468
|
}
|
|
4438
|
-
},
|
|
4469
|
+
}, _callee2, null, [[2, 4]]);
|
|
4439
4470
|
}));
|
|
4440
4471
|
return function calcPaymentInfoFee() {
|
|
4441
4472
|
return _ref2.apply(this, arguments);
|
|
4442
4473
|
};
|
|
4443
4474
|
}();
|
|
4444
4475
|
if (!(!assets.hasDryRunSupport(destination) || !forwardedXcms || destination === 'Ethereum')) {
|
|
4445
|
-
|
|
4476
|
+
_context3.n = 3;
|
|
4446
4477
|
break;
|
|
4447
4478
|
}
|
|
4448
|
-
|
|
4479
|
+
_context3.n = 1;
|
|
4449
4480
|
return calcPaymentInfoFee();
|
|
4450
4481
|
case 1:
|
|
4451
|
-
_fee =
|
|
4452
|
-
|
|
4482
|
+
_fee = _context3.v;
|
|
4483
|
+
_context3.n = 2;
|
|
4453
4484
|
return isSufficientDestination(api, destination, address, BigInt(currency.amount), asset, _fee);
|
|
4454
4485
|
case 2:
|
|
4455
|
-
sufficient =
|
|
4456
|
-
return
|
|
4486
|
+
sufficient = _context3.v;
|
|
4487
|
+
return _context3.a(2, {
|
|
4457
4488
|
fee: _fee,
|
|
4458
4489
|
feeType: 'paymentInfo',
|
|
4459
4490
|
sufficient: !assets.hasDryRunSupport(destination) ? sufficient : false
|
|
4460
4491
|
});
|
|
4461
4492
|
case 3:
|
|
4462
|
-
|
|
4493
|
+
_context3.n = 4;
|
|
4463
4494
|
return api.getDryRunXcm({
|
|
4464
4495
|
originLocation: addXcmVersionHeader(createOriginLocation(hopChain, destination), sdkCommon.Version.V4),
|
|
4465
4496
|
tx: tx,
|
|
@@ -4472,24 +4503,24 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4472
4503
|
amount: BigInt(currency.amount) < 2n ? 2n : BigInt(currency.amount)
|
|
4473
4504
|
});
|
|
4474
4505
|
case 4:
|
|
4475
|
-
dryRunResult =
|
|
4506
|
+
dryRunResult = _context3.v;
|
|
4476
4507
|
if (dryRunResult.success) {
|
|
4477
|
-
|
|
4508
|
+
_context3.n = 7;
|
|
4478
4509
|
break;
|
|
4479
4510
|
}
|
|
4480
4511
|
if (!disableFallback) {
|
|
4481
|
-
|
|
4512
|
+
_context3.n = 5;
|
|
4482
4513
|
break;
|
|
4483
4514
|
}
|
|
4484
|
-
return
|
|
4515
|
+
return _context3.a(2, {
|
|
4485
4516
|
dryRunError: dryRunResult.failureReason
|
|
4486
4517
|
});
|
|
4487
4518
|
case 5:
|
|
4488
|
-
|
|
4519
|
+
_context3.n = 6;
|
|
4489
4520
|
return calcPaymentInfoFee();
|
|
4490
4521
|
case 6:
|
|
4491
|
-
_fee2 =
|
|
4492
|
-
return
|
|
4522
|
+
_fee2 = _context3.v;
|
|
4523
|
+
return _context3.a(2, {
|
|
4493
4524
|
fee: _fee2,
|
|
4494
4525
|
feeType: 'paymentInfo',
|
|
4495
4526
|
dryRunError: dryRunResult.failureReason,
|
|
@@ -4497,7 +4528,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4497
4528
|
});
|
|
4498
4529
|
case 7:
|
|
4499
4530
|
fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
|
|
4500
|
-
return
|
|
4531
|
+
return _context3.a(2, {
|
|
4501
4532
|
fee: fee,
|
|
4502
4533
|
feeType: 'dryRun',
|
|
4503
4534
|
sufficient: true,
|
|
@@ -4505,7 +4536,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4505
4536
|
destParaId: destParaId
|
|
4506
4537
|
});
|
|
4507
4538
|
}
|
|
4508
|
-
},
|
|
4539
|
+
}, _callee3);
|
|
4509
4540
|
}));
|
|
4510
4541
|
return function getDestXcmFee(_x) {
|
|
4511
4542
|
return _ref.apply(this, arguments);
|
|
@@ -5133,7 +5164,7 @@ function _traverseXcmHops() {
|
|
|
5133
5164
|
case 4:
|
|
5134
5165
|
// true if this hop should be treated as the destination
|
|
5135
5166
|
// - normally when nextChain === destination
|
|
5136
|
-
// - but if swap is required, only after (or on) the exchange hop
|
|
5167
|
+
// - but if swap is required, only after (or on) the exchange hop
|
|
5137
5168
|
isDestination = nextChain === destination && (!swapConfig || hasPassedExchange || nextChain === swapConfig.exchangeChain);
|
|
5138
5169
|
isAssetHub = nextChain === assetHubChain;
|
|
5139
5170
|
isBridgeHub = nextChain === bridgeHubChain;
|
|
@@ -5271,8 +5302,8 @@ var getFailureInfo$1 = function getFailureInfo(results, hops) {
|
|
|
5271
5302
|
};
|
|
5272
5303
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5273
5304
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5274
|
-
var _traversalResult$brid
|
|
5275
|
-
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex,
|
|
5305
|
+
var _traversalResult$brid;
|
|
5306
|
+
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, _getFailureInfo, failureReason, failureChain, _t;
|
|
5276
5307
|
return _regenerator().w(function (_context2) {
|
|
5277
5308
|
while (1) switch (_context2.n) {
|
|
5278
5309
|
case 0:
|
|
@@ -5408,24 +5439,20 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5408
5439
|
});
|
|
5409
5440
|
}
|
|
5410
5441
|
}
|
|
5411
|
-
assetHubWithCurrency = (_traversalResult$asse = traversalResult.assetHub) !== null && _traversalResult$asse !== void 0 && _traversalResult$asse.success ? _objectSpread2(_objectSpread2({}, traversalResult.assetHub), {}, {
|
|
5412
|
-
currency: resolvedFeeAsset ? resolvedFeeAsset.symbol : assets.getNativeAssetSymbol(assetHubChain),
|
|
5413
|
-
asset: resolvedFeeAsset !== null && resolvedFeeAsset !== void 0 ? resolvedFeeAsset : assets.findNativeAssetInfoOrThrow(assetHubChain)
|
|
5414
|
-
}) : traversalResult.assetHub;
|
|
5415
5442
|
bridgeHubWithCurrency = processedBridgeHub !== null && processedBridgeHub !== void 0 && processedBridgeHub.success ? _objectSpread2(_objectSpread2({}, processedBridgeHub), {}, {
|
|
5416
5443
|
currency: assets.getNativeAssetSymbol(bridgeHubChain),
|
|
5417
5444
|
asset: assets.findNativeAssetInfoOrThrow(bridgeHubChain)
|
|
5418
5445
|
}) : processedBridgeHub;
|
|
5419
5446
|
_getFailureInfo = getFailureInfo$1({
|
|
5420
5447
|
destination: traversalResult.destination,
|
|
5421
|
-
assetHub:
|
|
5448
|
+
assetHub: traversalResult.assetHub,
|
|
5422
5449
|
bridgeHub: bridgeHubWithCurrency
|
|
5423
5450
|
}, traversalResult.hops), failureReason = _getFailureInfo.failureReason, failureChain = _getFailureInfo.failureChain;
|
|
5424
5451
|
return _context2.a(2, {
|
|
5425
5452
|
failureReason: failureReason,
|
|
5426
5453
|
failureChain: failureChain,
|
|
5427
5454
|
origin: originDryRun,
|
|
5428
|
-
assetHub:
|
|
5455
|
+
assetHub: traversalResult.assetHub,
|
|
5429
5456
|
bridgeHub: bridgeHubWithCurrency,
|
|
5430
5457
|
destination: traversalResult.destination,
|
|
5431
5458
|
hops: traversalResult.hops
|
|
@@ -5446,7 +5473,7 @@ var isMultiHopSwap = function isMultiHopSwap(exchangeChain, assetFrom, assetTo)
|
|
|
5446
5473
|
|
|
5447
5474
|
var createExchangeInstructions = /*#__PURE__*/function () {
|
|
5448
5475
|
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,
|
|
5476
|
+
var chain, exchangeChain, assetInfoFrom, assetInfoTo, version, calculateMinAmountOut, _options$fees, originReserveFee, exchangeFee, nativeSymbol, needsMultiHop, nativeAsset, nativeAmountOut, assetNative;
|
|
5450
5477
|
return _regenerator().w(function (_context) {
|
|
5451
5478
|
while (1) switch (_context.n) {
|
|
5452
5479
|
case 0:
|
|
@@ -5457,7 +5484,6 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5457
5484
|
symbol: assets.Native(nativeSymbol)
|
|
5458
5485
|
}, null);
|
|
5459
5486
|
assertHasLocation(nativeAsset);
|
|
5460
|
-
shouldUseMaximal = !chain || exchangeChain === 'Hydration' && exchangeFee === 0n;
|
|
5461
5487
|
if (needsMultiHop) {
|
|
5462
5488
|
_context.n = 1;
|
|
5463
5489
|
break;
|
|
@@ -5466,7 +5492,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5466
5492
|
ExchangeAsset: {
|
|
5467
5493
|
give: createAssetsFilter(assetFrom),
|
|
5468
5494
|
want: [assetTo],
|
|
5469
|
-
maximal:
|
|
5495
|
+
maximal: false
|
|
5470
5496
|
}
|
|
5471
5497
|
}]);
|
|
5472
5498
|
case 1:
|
|
@@ -5479,7 +5505,7 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5479
5505
|
ExchangeAsset: {
|
|
5480
5506
|
give: createAssetsFilter(assetFrom),
|
|
5481
5507
|
want: [assetNative],
|
|
5482
|
-
maximal:
|
|
5508
|
+
maximal: false
|
|
5483
5509
|
}
|
|
5484
5510
|
}, {
|
|
5485
5511
|
ExchangeAsset: {
|
|
@@ -5497,17 +5523,15 @@ var createExchangeInstructions = /*#__PURE__*/function () {
|
|
|
5497
5523
|
}();
|
|
5498
5524
|
var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
5499
5525
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5500
|
-
var api, chain, exchangeChain, destChain, assetInfoFrom, assetInfoTo, _options$fees2, originReserveFee,
|
|
5526
|
+
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
5527
|
return _regenerator().w(function (_context2) {
|
|
5502
5528
|
while (1) switch (_context2.n) {
|
|
5503
5529
|
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,
|
|
5530
|
+
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
5531
|
assertHasLocation(assetInfoFrom);
|
|
5506
5532
|
assertHasLocation(assetInfoTo);
|
|
5507
5533
|
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;
|
|
5534
|
+
amountOut = assetInfoTo.amount;
|
|
5511
5535
|
assetTo = createAsset(version, amountOut, localizeLocation(exchangeChain, assetInfoTo.location));
|
|
5512
5536
|
assetToLocalizedToDest = createAsset(version, amountOut, localizeLocation(destChain !== null && destChain !== void 0 ? destChain : exchangeChain, assetInfoTo.location));
|
|
5513
5537
|
_prepareCommonExecute = prepareCommonExecuteXcm({
|
|
@@ -5527,12 +5551,6 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
|
5527
5551
|
return createExchangeInstructions(options, assetFrom, assetTo);
|
|
5528
5552
|
case 1:
|
|
5529
5553
|
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
5554
|
exchangeToDestXcm = destChain ? createBaseExecuteXcm({
|
|
5537
5555
|
chain: exchangeChain,
|
|
5538
5556
|
destChain: destChain,
|
|
@@ -9674,7 +9692,6 @@ var MAX_WEIGHT = {
|
|
|
9674
9692
|
refTime: MAX_U64
|
|
9675
9693
|
};
|
|
9676
9694
|
var BYPASS_MINT_AMOUNT = '1000';
|
|
9677
|
-
var BYPASS_CURRENCY_AMOUNT = '800';
|
|
9678
9695
|
|
|
9679
9696
|
var buildClaimAssetsParams = function buildClaimAssetsParams(options) {
|
|
9680
9697
|
var assets = options.assets,
|
|
@@ -10273,6 +10290,136 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10273
10290
|
};
|
|
10274
10291
|
}();
|
|
10275
10292
|
|
|
10293
|
+
var getBypassResultWithRetries = /*#__PURE__*/function () {
|
|
10294
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, internalFn, initialTx) {
|
|
10295
|
+
var maxRetries,
|
|
10296
|
+
bumpStep,
|
|
10297
|
+
hasError,
|
|
10298
|
+
first,
|
|
10299
|
+
result,
|
|
10300
|
+
i,
|
|
10301
|
+
amount,
|
|
10302
|
+
bumpedTx,
|
|
10303
|
+
_args = arguments,
|
|
10304
|
+
_t,
|
|
10305
|
+
_t2,
|
|
10306
|
+
_t3;
|
|
10307
|
+
return _regenerator().w(function (_context) {
|
|
10308
|
+
while (1) switch (_context.p = _context.n) {
|
|
10309
|
+
case 0:
|
|
10310
|
+
maxRetries = _args.length > 3 && _args[3] !== undefined ? _args[3] : 5;
|
|
10311
|
+
bumpStep = _args.length > 4 && _args[4] !== undefined ? _args[4] : 100;
|
|
10312
|
+
hasError = function hasError(res) {
|
|
10313
|
+
return 'failureReason' in res ? !!res.failureReason : 'dryRunError' in res ? !!res.dryRunError : false;
|
|
10314
|
+
};
|
|
10315
|
+
if (!initialTx) {
|
|
10316
|
+
_context.n = 5;
|
|
10317
|
+
break;
|
|
10318
|
+
}
|
|
10319
|
+
_context.p = 1;
|
|
10320
|
+
_context.n = 2;
|
|
10321
|
+
return internalFn(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10322
|
+
tx: initialTx,
|
|
10323
|
+
useRootOrigin: true
|
|
10324
|
+
}));
|
|
10325
|
+
case 2:
|
|
10326
|
+
first = _context.v;
|
|
10327
|
+
if (hasError(first)) {
|
|
10328
|
+
_context.n = 3;
|
|
10329
|
+
break;
|
|
10330
|
+
}
|
|
10331
|
+
return _context.a(2, first);
|
|
10332
|
+
case 3:
|
|
10333
|
+
_context.n = 5;
|
|
10334
|
+
break;
|
|
10335
|
+
case 4:
|
|
10336
|
+
_context.p = 4;
|
|
10337
|
+
_t = _context.v;
|
|
10338
|
+
if (_t instanceof AmountTooLowError) {
|
|
10339
|
+
_context.n = 5;
|
|
10340
|
+
break;
|
|
10341
|
+
}
|
|
10342
|
+
throw _t;
|
|
10343
|
+
case 5:
|
|
10344
|
+
result = null;
|
|
10345
|
+
i = 1;
|
|
10346
|
+
case 6:
|
|
10347
|
+
if (!(i <= maxRetries)) {
|
|
10348
|
+
_context.n = 19;
|
|
10349
|
+
break;
|
|
10350
|
+
}
|
|
10351
|
+
amount = (bumpStep * i).toString();
|
|
10352
|
+
bumpedTx = void 0;
|
|
10353
|
+
_context.p = 7;
|
|
10354
|
+
_context.n = 8;
|
|
10355
|
+
return options.buildTx(amount);
|
|
10356
|
+
case 8:
|
|
10357
|
+
bumpedTx = _context.v;
|
|
10358
|
+
_context.n = 12;
|
|
10359
|
+
break;
|
|
10360
|
+
case 9:
|
|
10361
|
+
_context.p = 9;
|
|
10362
|
+
_t2 = _context.v;
|
|
10363
|
+
if (!(_t2 instanceof AmountTooLowError)) {
|
|
10364
|
+
_context.n = 11;
|
|
10365
|
+
break;
|
|
10366
|
+
}
|
|
10367
|
+
if (!(i === maxRetries)) {
|
|
10368
|
+
_context.n = 10;
|
|
10369
|
+
break;
|
|
10370
|
+
}
|
|
10371
|
+
throw _t2;
|
|
10372
|
+
case 10:
|
|
10373
|
+
return _context.a(3, 18);
|
|
10374
|
+
case 11:
|
|
10375
|
+
throw _t2;
|
|
10376
|
+
case 12:
|
|
10377
|
+
_context.p = 12;
|
|
10378
|
+
_context.n = 13;
|
|
10379
|
+
return internalFn(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10380
|
+
tx: bumpedTx,
|
|
10381
|
+
useRootOrigin: true
|
|
10382
|
+
}));
|
|
10383
|
+
case 13:
|
|
10384
|
+
result = _context.v;
|
|
10385
|
+
if (hasError(result)) {
|
|
10386
|
+
_context.n = 14;
|
|
10387
|
+
break;
|
|
10388
|
+
}
|
|
10389
|
+
return _context.a(2, result);
|
|
10390
|
+
case 14:
|
|
10391
|
+
_context.n = 18;
|
|
10392
|
+
break;
|
|
10393
|
+
case 15:
|
|
10394
|
+
_context.p = 15;
|
|
10395
|
+
_t3 = _context.v;
|
|
10396
|
+
if (!(_t3 instanceof AmountTooLowError)) {
|
|
10397
|
+
_context.n = 17;
|
|
10398
|
+
break;
|
|
10399
|
+
}
|
|
10400
|
+
if (!(i === maxRetries)) {
|
|
10401
|
+
_context.n = 16;
|
|
10402
|
+
break;
|
|
10403
|
+
}
|
|
10404
|
+
throw _t3;
|
|
10405
|
+
case 16:
|
|
10406
|
+
return _context.a(3, 18);
|
|
10407
|
+
case 17:
|
|
10408
|
+
throw _t3;
|
|
10409
|
+
case 18:
|
|
10410
|
+
i++;
|
|
10411
|
+
_context.n = 6;
|
|
10412
|
+
break;
|
|
10413
|
+
case 19:
|
|
10414
|
+
return _context.a(2, result);
|
|
10415
|
+
}
|
|
10416
|
+
}, _callee, null, [[12, 15], [7, 9], [1, 4]]);
|
|
10417
|
+
}));
|
|
10418
|
+
return function getBypassResultWithRetries(_x, _x2, _x3) {
|
|
10419
|
+
return _ref.apply(this, arguments);
|
|
10420
|
+
};
|
|
10421
|
+
}();
|
|
10422
|
+
|
|
10276
10423
|
var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
10277
10424
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
10278
10425
|
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 +10520,48 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10373
10520
|
|
|
10374
10521
|
var getOriginXcmFee = /*#__PURE__*/function () {
|
|
10375
10522
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10376
|
-
var
|
|
10523
|
+
var buildTx, tx, real, forced, _forced, _t;
|
|
10377
10524
|
return _regenerator().w(function (_context) {
|
|
10378
|
-
while (1) switch (_context.n) {
|
|
10525
|
+
while (1) switch (_context.p = _context.n) {
|
|
10379
10526
|
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;
|
|
10527
|
+
buildTx = options.buildTx;
|
|
10528
|
+
_context.p = 1;
|
|
10388
10529
|
_context.n = 2;
|
|
10530
|
+
return buildTx();
|
|
10531
|
+
case 2:
|
|
10532
|
+
tx = _context.v;
|
|
10533
|
+
_context.n = 3;
|
|
10389
10534
|
return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10390
10535
|
tx: tx,
|
|
10391
10536
|
useRootOrigin: false
|
|
10392
10537
|
}));
|
|
10393
|
-
case
|
|
10538
|
+
case 3:
|
|
10394
10539
|
real = _context.v;
|
|
10540
|
+
_context.n = 4;
|
|
10541
|
+
return getBypassResultWithRetries(options, getOriginXcmFeeInternal, tx);
|
|
10542
|
+
case 4:
|
|
10543
|
+
forced = _context.v;
|
|
10395
10544
|
return _context.a(2, _objectSpread2(_objectSpread2({}, forced), {}, {
|
|
10396
10545
|
sufficient: real.sufficient
|
|
10397
10546
|
}));
|
|
10547
|
+
case 5:
|
|
10548
|
+
_context.p = 5;
|
|
10549
|
+
_t = _context.v;
|
|
10550
|
+
if (_t instanceof AmountTooLowError) {
|
|
10551
|
+
_context.n = 6;
|
|
10552
|
+
break;
|
|
10553
|
+
}
|
|
10554
|
+
throw _t;
|
|
10555
|
+
case 6:
|
|
10556
|
+
_context.n = 7;
|
|
10557
|
+
return getBypassResultWithRetries(options, getOriginXcmFeeInternal);
|
|
10558
|
+
case 7:
|
|
10559
|
+
_forced = _context.v;
|
|
10560
|
+
return _context.a(2, _objectSpread2(_objectSpread2({}, _forced), {}, {
|
|
10561
|
+
sufficient: false
|
|
10562
|
+
}));
|
|
10398
10563
|
}
|
|
10399
|
-
}, _callee);
|
|
10564
|
+
}, _callee, null, [[1, 5]]);
|
|
10400
10565
|
}));
|
|
10401
10566
|
return function getOriginXcmFee(_x) {
|
|
10402
10567
|
return _ref.apply(this, arguments);
|
|
@@ -10753,7 +10918,9 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10753
10918
|
feeAsset: feeAsset,
|
|
10754
10919
|
tx: tx,
|
|
10755
10920
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10756
|
-
disableFallback: disableFallback
|
|
10921
|
+
disableFallback: disableFallback,
|
|
10922
|
+
hasPassedExchange: hasPassedExchange,
|
|
10923
|
+
swapConfig: swapConfig
|
|
10757
10924
|
});
|
|
10758
10925
|
case 1:
|
|
10759
10926
|
hopResult = _context.v;
|
|
@@ -10847,7 +11014,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10847
11014
|
tx: tx,
|
|
10848
11015
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
10849
11016
|
senderAddress: senderAddress,
|
|
10850
|
-
disableFallback: disableFallback
|
|
11017
|
+
disableFallback: disableFallback,
|
|
11018
|
+
swapConfig: swapConfig
|
|
10851
11019
|
});
|
|
10852
11020
|
case 11:
|
|
10853
11021
|
destFallback = _context2.v;
|
|
@@ -10955,30 +11123,27 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10955
11123
|
|
|
10956
11124
|
var getXcmFee = /*#__PURE__*/function () {
|
|
10957
11125
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10958
|
-
var _real$assetHub, _real$bridgeHub;
|
|
10959
|
-
var _options$txs, tx, txBypass, forced, real, api;
|
|
11126
|
+
var buildTx, api, _real$assetHub, _real$bridgeHub, tx, real, forced, _forced, _t;
|
|
10960
11127
|
return _regenerator().w(function (_context) {
|
|
10961
|
-
while (1) switch (_context.n) {
|
|
11128
|
+
while (1) switch (_context.p = _context.n) {
|
|
10962
11129
|
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;
|
|
11130
|
+
buildTx = options.buildTx, api = options.api;
|
|
11131
|
+
_context.p = 1;
|
|
10971
11132
|
_context.n = 2;
|
|
11133
|
+
return buildTx();
|
|
11134
|
+
case 2:
|
|
11135
|
+
tx = _context.v;
|
|
11136
|
+
_context.n = 3;
|
|
10972
11137
|
return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10973
11138
|
tx: tx,
|
|
10974
11139
|
useRootOrigin: false
|
|
10975
11140
|
}));
|
|
10976
|
-
case 2:
|
|
10977
|
-
real = _context.v;
|
|
10978
|
-
api = options.api;
|
|
10979
|
-
_context.n = 3;
|
|
10980
|
-
return api.disconnect();
|
|
10981
11141
|
case 3:
|
|
11142
|
+
real = _context.v;
|
|
11143
|
+
_context.n = 4;
|
|
11144
|
+
return getBypassResultWithRetries(options, getXcmFeeInternal, tx);
|
|
11145
|
+
case 4:
|
|
11146
|
+
forced = _context.v;
|
|
10982
11147
|
return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, forced), {}, {
|
|
10983
11148
|
origin: _objectSpread2(_objectSpread2({}, forced.origin), {}, {
|
|
10984
11149
|
sufficient: real.origin.sufficient
|
|
@@ -10995,17 +11160,62 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
10995
11160
|
sufficient: (_real$bridgeHub = real.bridgeHub) === null || _real$bridgeHub === void 0 ? void 0 : _real$bridgeHub.sufficient
|
|
10996
11161
|
})
|
|
10997
11162
|
} : {}), {}, {
|
|
10998
|
-
hops: forced.hops.map(function (hop,
|
|
10999
|
-
var _real$hops$
|
|
11163
|
+
hops: forced.hops.map(function (hop, i) {
|
|
11164
|
+
var _real$hops$i;
|
|
11000
11165
|
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
11001
11166
|
result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
|
|
11002
|
-
sufficient: (_real$hops$
|
|
11167
|
+
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
11168
|
})
|
|
11004
11169
|
});
|
|
11005
11170
|
})
|
|
11006
11171
|
}));
|
|
11172
|
+
case 5:
|
|
11173
|
+
_context.p = 5;
|
|
11174
|
+
_t = _context.v;
|
|
11175
|
+
if (_t instanceof AmountTooLowError) {
|
|
11176
|
+
_context.n = 6;
|
|
11177
|
+
break;
|
|
11178
|
+
}
|
|
11179
|
+
throw _t;
|
|
11180
|
+
case 6:
|
|
11181
|
+
_context.n = 7;
|
|
11182
|
+
return getBypassResultWithRetries(options, getXcmFeeInternal);
|
|
11183
|
+
case 7:
|
|
11184
|
+
_forced = _context.v;
|
|
11185
|
+
return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, _forced), {}, {
|
|
11186
|
+
origin: _objectSpread2(_objectSpread2({}, _forced.origin), {}, {
|
|
11187
|
+
sufficient: false
|
|
11188
|
+
}),
|
|
11189
|
+
destination: _objectSpread2(_objectSpread2({}, _forced.destination), {}, {
|
|
11190
|
+
sufficient: false
|
|
11191
|
+
})
|
|
11192
|
+
}, _forced.assetHub ? {
|
|
11193
|
+
assetHub: _objectSpread2(_objectSpread2({}, _forced.assetHub), {}, {
|
|
11194
|
+
sufficient: false
|
|
11195
|
+
})
|
|
11196
|
+
} : {}), _forced.bridgeHub ? {
|
|
11197
|
+
bridgeHub: _objectSpread2(_objectSpread2({}, _forced.bridgeHub), {}, {
|
|
11198
|
+
sufficient: false
|
|
11199
|
+
})
|
|
11200
|
+
} : {}), {}, {
|
|
11201
|
+
hops: _forced.hops.map(function (hop) {
|
|
11202
|
+
return _objectSpread2(_objectSpread2({}, hop), {}, {
|
|
11203
|
+
result: _objectSpread2(_objectSpread2({}, hop.result), {}, {
|
|
11204
|
+
sufficient: false
|
|
11205
|
+
})
|
|
11206
|
+
});
|
|
11207
|
+
})
|
|
11208
|
+
}));
|
|
11209
|
+
case 8:
|
|
11210
|
+
_context.p = 8;
|
|
11211
|
+
_context.n = 9;
|
|
11212
|
+
return api.disconnect();
|
|
11213
|
+
case 9:
|
|
11214
|
+
return _context.f(8);
|
|
11215
|
+
case 10:
|
|
11216
|
+
return _context.a(2);
|
|
11007
11217
|
}
|
|
11008
|
-
}, _callee);
|
|
11218
|
+
}, _callee, null, [[1, 5, 8, 10]]);
|
|
11009
11219
|
}));
|
|
11010
11220
|
return function getXcmFee(_x) {
|
|
11011
11221
|
return _ref.apply(this, arguments);
|
|
@@ -11451,11 +11661,11 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
11451
11661
|
|
|
11452
11662
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
11453
11663
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
11454
|
-
var api,
|
|
11664
|
+
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
11665
|
return _regenerator().w(function (_context2) {
|
|
11456
11666
|
while (1) switch (_context2.p = _context2.n) {
|
|
11457
11667
|
case 0:
|
|
11458
|
-
api = _ref.api,
|
|
11668
|
+
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
11669
|
if (!(assets.isChainEvm(origin) && !ahAddress)) {
|
|
11460
11670
|
_context2.n = 1;
|
|
11461
11671
|
break;
|
|
@@ -11509,7 +11719,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11509
11719
|
_context2.n = 9;
|
|
11510
11720
|
return getXcmFee({
|
|
11511
11721
|
api: api,
|
|
11512
|
-
|
|
11722
|
+
buildTx: buildTx,
|
|
11513
11723
|
origin: origin,
|
|
11514
11724
|
destination: destination,
|
|
11515
11725
|
senderAddress: senderAddress,
|
|
@@ -11677,11 +11887,11 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11677
11887
|
|
|
11678
11888
|
var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
11679
11889
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11680
|
-
var api, origin, senderAddress, address, chain, destination, currency, feeAsset,
|
|
11890
|
+
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
11891
|
return _regenerator().w(function (_context) {
|
|
11682
11892
|
while (1) switch (_context.n) {
|
|
11683
11893
|
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,
|
|
11894
|
+
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
11895
|
validateAddress(senderAddress, chain, false);
|
|
11686
11896
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
11687
11897
|
asset = assets.findAssetInfoOrThrow(chain, currency, null);
|
|
@@ -11714,7 +11924,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11714
11924
|
api: api,
|
|
11715
11925
|
origin: origin,
|
|
11716
11926
|
destination: destination,
|
|
11717
|
-
|
|
11927
|
+
buildTx: buildTx,
|
|
11718
11928
|
senderAddress: senderAddress,
|
|
11719
11929
|
address: address,
|
|
11720
11930
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
@@ -11809,11 +12019,11 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
|
11809
12019
|
|
|
11810
12020
|
var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
11811
12021
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11812
|
-
var api, senderAddress, chain, destination, currency,
|
|
12022
|
+
var api, senderAddress, chain, destination, currency, buildTx, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
|
|
11813
12023
|
return _regenerator().w(function (_context) {
|
|
11814
12024
|
while (1) switch (_context.n) {
|
|
11815
12025
|
case 0:
|
|
11816
|
-
api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency,
|
|
12026
|
+
api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, buildTx = _ref.buildTx, feeAsset = _ref.feeAsset;
|
|
11817
12027
|
validateAddress(senderAddress, chain, false);
|
|
11818
12028
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
11819
12029
|
asset = assets.findAssetInfoOrThrow(chain, currency, null);
|
|
@@ -11839,7 +12049,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11839
12049
|
_context.n = 2;
|
|
11840
12050
|
return getOriginXcmFee({
|
|
11841
12051
|
api: api,
|
|
11842
|
-
|
|
12052
|
+
buildTx: buildTx,
|
|
11843
12053
|
origin: chain,
|
|
11844
12054
|
destination: chain,
|
|
11845
12055
|
senderAddress: senderAddress,
|
|
@@ -11936,7 +12146,7 @@ var computeInstructionFee = /*#__PURE__*/function () {
|
|
|
11936
12146
|
chain = _ref.chain, api = _ref.api;
|
|
11937
12147
|
_t = padFeeBy;
|
|
11938
12148
|
_context.n = 1;
|
|
11939
|
-
return api.getXcmPaymentApiFee(chain, addXcmVersionHeader(xcm, version), {
|
|
12149
|
+
return api.getXcmPaymentApiFee(chain, addXcmVersionHeader(xcm, version), [], {
|
|
11940
12150
|
location: DOT_LOCATION
|
|
11941
12151
|
}, true);
|
|
11942
12152
|
case 1:
|
|
@@ -12225,11 +12435,11 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
|
|
|
12225
12435
|
};
|
|
12226
12436
|
var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
12227
12437
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
12228
|
-
var api,
|
|
12438
|
+
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
12439
|
return _regenerator().w(function (_context) {
|
|
12230
12440
|
while (1) switch (_context.n) {
|
|
12231
12441
|
case 0:
|
|
12232
|
-
api = options.api,
|
|
12442
|
+
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
12443
|
if (!(destination === 'Ethereum')) {
|
|
12234
12444
|
_context.n = 1;
|
|
12235
12445
|
break;
|
|
@@ -12270,11 +12480,10 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12270
12480
|
});
|
|
12271
12481
|
case 5:
|
|
12272
12482
|
balance = _context.v;
|
|
12273
|
-
tx = txs.tx, txBypass = txs.txBypass;
|
|
12274
12483
|
_context.n = 6;
|
|
12275
|
-
return
|
|
12484
|
+
return getXcmFee({
|
|
12276
12485
|
api: api,
|
|
12277
|
-
|
|
12486
|
+
buildTx: buildTx,
|
|
12278
12487
|
origin: origin,
|
|
12279
12488
|
destination: destination,
|
|
12280
12489
|
senderAddress: senderAddress,
|
|
@@ -12283,8 +12492,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12283
12492
|
amount: amount
|
|
12284
12493
|
}),
|
|
12285
12494
|
feeAsset: feeAsset,
|
|
12286
|
-
disableFallback: false
|
|
12287
|
-
useRootOrigin: true
|
|
12495
|
+
disableFallback: false
|
|
12288
12496
|
});
|
|
12289
12497
|
case 6:
|
|
12290
12498
|
xcmFeeResult = _context.v;
|
|
@@ -12314,6 +12522,10 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12314
12522
|
}
|
|
12315
12523
|
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
12524
|
case 10:
|
|
12525
|
+
_context.n = 11;
|
|
12526
|
+
return buildTx();
|
|
12527
|
+
case 11:
|
|
12528
|
+
tx = _context.v;
|
|
12317
12529
|
totalFee = calculateTotalXcmFee(xcmFeeResult);
|
|
12318
12530
|
method = api.getMethod(tx);
|
|
12319
12531
|
if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
|
|
@@ -12877,11 +13089,14 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12877
13089
|
return dryRunPreview;
|
|
12878
13090
|
}()
|
|
12879
13091
|
}, {
|
|
12880
|
-
key: "
|
|
12881
|
-
value: function
|
|
12882
|
-
|
|
12883
|
-
|
|
12884
|
-
|
|
13092
|
+
key: "createTxFactory",
|
|
13093
|
+
value: function createTxFactory() {
|
|
13094
|
+
var _this = this;
|
|
13095
|
+
return function (amount) {
|
|
13096
|
+
return createTx(_objectSpread2(_objectSpread2({}, _this._options), {}, {
|
|
13097
|
+
api: _this.api
|
|
13098
|
+
}), _this, amount);
|
|
13099
|
+
};
|
|
12885
13100
|
}
|
|
12886
13101
|
/**
|
|
12887
13102
|
* Returns the XCM fee for the transfer using dryRun or paymentInfo function.
|
|
@@ -12893,7 +13108,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12893
13108
|
value: (function () {
|
|
12894
13109
|
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
|
|
12895
13110
|
var _options$disableFallb;
|
|
12896
|
-
var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback
|
|
13111
|
+
var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback;
|
|
12897
13112
|
return _regenerator().w(function (_context7) {
|
|
12898
13113
|
while (1) switch (_context7.p = _context7.n) {
|
|
12899
13114
|
case 0:
|
|
@@ -12902,43 +13117,30 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12902
13117
|
assertAddressIsString(address);
|
|
12903
13118
|
disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
|
|
12904
13119
|
_context7.p = 1;
|
|
12905
|
-
_t = getXcmFee;
|
|
12906
|
-
_t2 = this.api;
|
|
12907
13120
|
_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
|
|
13121
|
+
return getXcmFee({
|
|
13122
|
+
api: this.api,
|
|
13123
|
+
buildTx: this.createTxFactory(),
|
|
13124
|
+
origin: from,
|
|
13125
|
+
destination: to,
|
|
13126
|
+
senderAddress: senderAddress,
|
|
13127
|
+
address: address,
|
|
13128
|
+
currency: currency,
|
|
13129
|
+
feeAsset: feeAsset,
|
|
13130
|
+
disableFallback: disableFallback
|
|
12929
13131
|
});
|
|
12930
|
-
case
|
|
13132
|
+
case 2:
|
|
12931
13133
|
return _context7.a(2, _context7.v);
|
|
12932
|
-
case
|
|
12933
|
-
_context7.p =
|
|
12934
|
-
_context7.n =
|
|
13134
|
+
case 3:
|
|
13135
|
+
_context7.p = 3;
|
|
13136
|
+
_context7.n = 4;
|
|
12935
13137
|
return this.api.disconnect();
|
|
13138
|
+
case 4:
|
|
13139
|
+
return _context7.f(3);
|
|
12936
13140
|
case 5:
|
|
12937
|
-
return _context7.f(4);
|
|
12938
|
-
case 6:
|
|
12939
13141
|
return _context7.a(2);
|
|
12940
13142
|
}
|
|
12941
|
-
}, _callee7, this, [[1,,
|
|
13143
|
+
}, _callee7, this, [[1,, 3, 5]]);
|
|
12942
13144
|
}));
|
|
12943
13145
|
function getXcmFee$1(_x6) {
|
|
12944
13146
|
return _getXcmFee2.apply(this, arguments);
|
|
@@ -12964,16 +13166,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12964
13166
|
currency,
|
|
12965
13167
|
feeAsset,
|
|
12966
13168
|
api,
|
|
12967
|
-
_args8 = arguments
|
|
12968
|
-
_t1,
|
|
12969
|
-
_t10,
|
|
12970
|
-
_t11,
|
|
12971
|
-
_t12,
|
|
12972
|
-
_t13,
|
|
12973
|
-
_t14,
|
|
12974
|
-
_t15,
|
|
12975
|
-
_t16,
|
|
12976
|
-
_t17;
|
|
13169
|
+
_args8 = arguments;
|
|
12977
13170
|
return _regenerator().w(function (_context8) {
|
|
12978
13171
|
while (1) switch (_context8.p = _context8.n) {
|
|
12979
13172
|
case 0:
|
|
@@ -12984,41 +13177,29 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12984
13177
|
assertToIsString(to);
|
|
12985
13178
|
api = this.api;
|
|
12986
13179
|
_context8.p = 1;
|
|
12987
|
-
_t1 = getOriginXcmFee;
|
|
12988
|
-
_t10 = api;
|
|
12989
13180
|
_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
|
|
13181
|
+
return getOriginXcmFee({
|
|
13182
|
+
api: api,
|
|
13183
|
+
buildTx: this.createTxFactory(),
|
|
13184
|
+
origin: from,
|
|
13185
|
+
destination: to,
|
|
13186
|
+
senderAddress: senderAddress,
|
|
13187
|
+
currency: currency,
|
|
13188
|
+
feeAsset: feeAsset,
|
|
13189
|
+
disableFallback: disableFallback
|
|
13009
13190
|
});
|
|
13010
|
-
case
|
|
13191
|
+
case 2:
|
|
13011
13192
|
return _context8.a(2, _context8.v);
|
|
13012
|
-
case
|
|
13013
|
-
_context8.p =
|
|
13014
|
-
_context8.n =
|
|
13193
|
+
case 3:
|
|
13194
|
+
_context8.p = 3;
|
|
13195
|
+
_context8.n = 4;
|
|
13015
13196
|
return this.api.disconnect();
|
|
13197
|
+
case 4:
|
|
13198
|
+
return _context8.f(3);
|
|
13016
13199
|
case 5:
|
|
13017
|
-
return _context8.f(4);
|
|
13018
|
-
case 6:
|
|
13019
13200
|
return _context8.a(2);
|
|
13020
13201
|
}
|
|
13021
|
-
}, _callee8, this, [[1,,
|
|
13202
|
+
}, _callee8, this, [[1,, 3, 5]]);
|
|
13022
13203
|
}));
|
|
13023
13204
|
function getOriginXcmFee$1() {
|
|
13024
13205
|
return _getOriginXcmFee2.apply(this, arguments);
|
|
@@ -13133,32 +13314,21 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13133
13314
|
key: "getTransferableAmount",
|
|
13134
13315
|
value: (function () {
|
|
13135
13316
|
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
13136
|
-
var _this$_options6, from, to, senderAddress, currency, feeAsset, api
|
|
13317
|
+
var _this$_options6, from, to, senderAddress, currency, feeAsset, api;
|
|
13137
13318
|
return _regenerator().w(function (_context1) {
|
|
13138
13319
|
while (1) switch (_context1.n) {
|
|
13139
13320
|
case 0:
|
|
13140
13321
|
_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
13322
|
assertToIsString(to);
|
|
13142
13323
|
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
|
|
13324
|
+
return _context1.a(2, getTransferableAmount({
|
|
13325
|
+
api: api,
|
|
13326
|
+
buildTx: this.createTxFactory(),
|
|
13327
|
+
origin: from,
|
|
13328
|
+
destination: to,
|
|
13329
|
+
senderAddress: senderAddress,
|
|
13330
|
+
feeAsset: feeAsset,
|
|
13331
|
+
currency: currency
|
|
13162
13332
|
}));
|
|
13163
13333
|
}
|
|
13164
13334
|
}, _callee1, this);
|
|
@@ -13178,7 +13348,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13178
13348
|
key: "getMinTransferableAmount",
|
|
13179
13349
|
value: (function () {
|
|
13180
13350
|
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
13181
|
-
var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api
|
|
13351
|
+
var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api;
|
|
13182
13352
|
return _regenerator().w(function (_context10) {
|
|
13183
13353
|
while (1) switch (_context10.n) {
|
|
13184
13354
|
case 0:
|
|
@@ -13186,29 +13356,16 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13186
13356
|
assertToIsString(to);
|
|
13187
13357
|
assertAddressIsString(address);
|
|
13188
13358
|
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
|
|
13359
|
+
return _context10.a(2, getMinTransferableAmount({
|
|
13360
|
+
api: api,
|
|
13361
|
+
buildTx: this.createTxFactory(),
|
|
13362
|
+
origin: from,
|
|
13363
|
+
destination: to,
|
|
13364
|
+
senderAddress: senderAddress,
|
|
13365
|
+
address: address,
|
|
13366
|
+
feeAsset: feeAsset,
|
|
13367
|
+
currency: currency,
|
|
13368
|
+
builder: this
|
|
13212
13369
|
}));
|
|
13213
13370
|
}
|
|
13214
13371
|
}, _callee10, this);
|
|
@@ -13228,34 +13385,22 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13228
13385
|
key: "verifyEdOnDestination",
|
|
13229
13386
|
value: (function () {
|
|
13230
13387
|
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
13231
|
-
var _this$_options8, from, to, address, currency, senderAddress, feeAsset
|
|
13388
|
+
var _this$_options8, from, to, address, currency, senderAddress, feeAsset;
|
|
13232
13389
|
return _regenerator().w(function (_context11) {
|
|
13233
13390
|
while (1) switch (_context11.n) {
|
|
13234
13391
|
case 0:
|
|
13235
13392
|
_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
13393
|
assertToIsString(to);
|
|
13237
13394
|
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
|
|
13395
|
+
return _context11.a(2, verifyEdOnDestination({
|
|
13396
|
+
api: this.api,
|
|
13397
|
+
buildTx: this.createTxFactory(),
|
|
13398
|
+
origin: from,
|
|
13399
|
+
destination: to,
|
|
13400
|
+
address: address,
|
|
13401
|
+
senderAddress: senderAddress,
|
|
13402
|
+
feeAsset: feeAsset,
|
|
13403
|
+
currency: currency
|
|
13259
13404
|
}));
|
|
13260
13405
|
}
|
|
13261
13406
|
}, _callee11, this);
|
|
@@ -13275,36 +13420,23 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13275
13420
|
key: "getTransferInfo",
|
|
13276
13421
|
value: (function () {
|
|
13277
13422
|
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
13278
|
-
var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset
|
|
13423
|
+
var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset;
|
|
13279
13424
|
return _regenerator().w(function (_context12) {
|
|
13280
13425
|
while (1) switch (_context12.n) {
|
|
13281
13426
|
case 0:
|
|
13282
13427
|
_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
13428
|
assertToIsString(to);
|
|
13284
13429
|
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
|
|
13430
|
+
return _context12.a(2, getTransferInfo({
|
|
13431
|
+
api: this.api,
|
|
13432
|
+
buildTx: this.createTxFactory(),
|
|
13433
|
+
origin: from,
|
|
13434
|
+
destination: to,
|
|
13435
|
+
address: address,
|
|
13436
|
+
senderAddress: senderAddress,
|
|
13437
|
+
ahAddress: ahAddress,
|
|
13438
|
+
currency: currency,
|
|
13439
|
+
feeAsset: feeAsset
|
|
13308
13440
|
}));
|
|
13309
13441
|
}
|
|
13310
13442
|
}, _callee12, this);
|
|
@@ -13394,7 +13526,7 @@ exports.createChainClient = createChainClient;
|
|
|
13394
13526
|
exports.createDirectExecuteXcm = createDirectExecuteXcm;
|
|
13395
13527
|
exports.createExecuteCall = createExecuteCall;
|
|
13396
13528
|
exports.createExecuteExchangeXcm = createExecuteExchangeXcm;
|
|
13397
|
-
exports.
|
|
13529
|
+
exports.createTx = createTx;
|
|
13398
13530
|
exports.createTypeAndThenCall = createTypeAndThenCall;
|
|
13399
13531
|
exports.createVersionedAssets = createVersionedAssets;
|
|
13400
13532
|
exports.createX1Payload = createX1Payload;
|