@paraspell/sdk-core 10.5.1 → 10.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +267 -130
- package/dist/index.d.ts +5 -4
- package/dist/index.mjs +268 -132
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -720,6 +720,11 @@ var assertAddressIsString = function assertAddressIsString(address) {
|
|
|
720
720
|
throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
|
|
721
721
|
}
|
|
722
722
|
};
|
|
723
|
+
var assertHasLocation = function assertHasLocation(asset) {
|
|
724
|
+
if (!asset.multiLocation) {
|
|
725
|
+
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is missing multi-location"));
|
|
726
|
+
}
|
|
727
|
+
};
|
|
723
728
|
|
|
724
729
|
var AssetHubPolkadot$1 = {
|
|
725
730
|
name: "AssetHub",
|
|
@@ -3436,8 +3441,9 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
3436
3441
|
};
|
|
3437
3442
|
}();
|
|
3438
3443
|
|
|
3439
|
-
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, messageId) {
|
|
3444
|
+
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, messageId, feeAmount) {
|
|
3440
3445
|
var api = _ref.api,
|
|
3446
|
+
destination = _ref.destination,
|
|
3441
3447
|
address = _ref.address,
|
|
3442
3448
|
asset = _ref.asset,
|
|
3443
3449
|
scenario = _ref.scenario,
|
|
@@ -3447,9 +3453,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
|
|
|
3447
3453
|
if (!assets.isForeignAsset(asset)) {
|
|
3448
3454
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
3449
3455
|
}
|
|
3450
|
-
|
|
3451
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
3452
|
-
}
|
|
3456
|
+
assertHasLocation(asset);
|
|
3453
3457
|
if (!senderAddress) {
|
|
3454
3458
|
throw new InvalidParameterError("Please provide senderAddress");
|
|
3455
3459
|
}
|
|
@@ -3471,7 +3475,41 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
|
|
|
3471
3475
|
}]
|
|
3472
3476
|
};
|
|
3473
3477
|
return _defineProperty({}, version, [{
|
|
3474
|
-
SetAppendix: [{
|
|
3478
|
+
SetAppendix: [origin === 'Mythos' ? {
|
|
3479
|
+
DepositReserveAsset: {
|
|
3480
|
+
assets: {
|
|
3481
|
+
Wild: 'All'
|
|
3482
|
+
},
|
|
3483
|
+
dest: createDestination(scenario, version, destination, getParaId(origin), undefined, sdkCommon.Parents.ONE),
|
|
3484
|
+
xcm: [{
|
|
3485
|
+
BuyExecution: {
|
|
3486
|
+
fees: {
|
|
3487
|
+
id: {
|
|
3488
|
+
parents: sdkCommon.Parents.ZERO,
|
|
3489
|
+
interior: 'Here'
|
|
3490
|
+
},
|
|
3491
|
+
fun: {
|
|
3492
|
+
Fungible: feeAmount
|
|
3493
|
+
}
|
|
3494
|
+
},
|
|
3495
|
+
weight_limit: 'Unlimited'
|
|
3496
|
+
}
|
|
3497
|
+
}, {
|
|
3498
|
+
DepositAsset: {
|
|
3499
|
+
assets: {
|
|
3500
|
+
Wild: 'All'
|
|
3501
|
+
},
|
|
3502
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
3503
|
+
api: api,
|
|
3504
|
+
scenario: scenario,
|
|
3505
|
+
pallet: 'PolkadotXcm',
|
|
3506
|
+
recipientAddress: address,
|
|
3507
|
+
version: version
|
|
3508
|
+
})
|
|
3509
|
+
}
|
|
3510
|
+
}]
|
|
3511
|
+
}
|
|
3512
|
+
} : {
|
|
3475
3513
|
DepositAsset: {
|
|
3476
3514
|
assets: {
|
|
3477
3515
|
Wild: 'All'
|
|
@@ -3738,6 +3776,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
3738
3776
|
messageId = _context.v;
|
|
3739
3777
|
customXcm = createCustomXcmOnDest({
|
|
3740
3778
|
api: api,
|
|
3779
|
+
destination: to,
|
|
3741
3780
|
address: address,
|
|
3742
3781
|
scenario: 'ParaToPara',
|
|
3743
3782
|
senderAddress: senderAddress,
|
|
@@ -4559,8 +4598,8 @@ var verifyEdOnDestination = /*#__PURE__*/function () {
|
|
|
4559
4598
|
}();
|
|
4560
4599
|
|
|
4561
4600
|
var isSufficientOrigin = /*#__PURE__*/function () {
|
|
4562
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api,
|
|
4563
|
-
var
|
|
4601
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, origin, destination, senderAddress, feeNative, currency, asset, feeAsset) {
|
|
4602
|
+
var edNative, balanceNative, isNativeAssetToOrigin, isNativeAssetToDest, isSufficientNative, balanceAsset, edAsset, isSufficientAsset;
|
|
4564
4603
|
return _regenerator().w(function (_context) {
|
|
4565
4604
|
while (1) switch (_context.n) {
|
|
4566
4605
|
case 0:
|
|
@@ -4570,30 +4609,57 @@ var isSufficientOrigin = /*#__PURE__*/function () {
|
|
|
4570
4609
|
}
|
|
4571
4610
|
return _context.a(2, undefined);
|
|
4572
4611
|
case 1:
|
|
4573
|
-
|
|
4612
|
+
edNative = assets.getExistentialDepositOrThrow(origin);
|
|
4574
4613
|
_context.n = 2;
|
|
4575
4614
|
return getBalanceNativeInternal({
|
|
4576
4615
|
api: api,
|
|
4577
|
-
node:
|
|
4616
|
+
node: origin,
|
|
4578
4617
|
address: senderAddress
|
|
4579
4618
|
});
|
|
4580
4619
|
case 2:
|
|
4581
|
-
|
|
4582
|
-
|
|
4620
|
+
balanceNative = _context.v;
|
|
4621
|
+
isNativeAssetToOrigin = assets.isSymbolMatch(asset.symbol, assets.getNativeAssetSymbol(origin));
|
|
4622
|
+
isNativeAssetToDest = assets.isSymbolMatch(asset.symbol, assets.getNativeAssetSymbol(destination));
|
|
4623
|
+
if (!(isNativeAssetToOrigin && isNativeAssetToDest)) {
|
|
4624
|
+
_context.n = 3;
|
|
4625
|
+
break;
|
|
4626
|
+
}
|
|
4627
|
+
return _context.a(2, balanceNative - edNative - feeNative - BigInt(currency.amount) > 0n);
|
|
4628
|
+
case 3:
|
|
4629
|
+
if (isNativeAssetToOrigin) {
|
|
4630
|
+
_context.n = 5;
|
|
4631
|
+
break;
|
|
4632
|
+
}
|
|
4633
|
+
isSufficientNative = balanceNative - edNative - feeNative > 0n;
|
|
4634
|
+
_context.n = 4;
|
|
4635
|
+
return getAssetBalance({
|
|
4636
|
+
api: api,
|
|
4637
|
+
node: origin,
|
|
4638
|
+
address: senderAddress,
|
|
4639
|
+
currency: currency
|
|
4640
|
+
});
|
|
4641
|
+
case 4:
|
|
4642
|
+
balanceAsset = _context.v;
|
|
4643
|
+
edAsset = assets.getExistentialDepositOrThrow(origin, currency);
|
|
4644
|
+
isSufficientAsset = balanceAsset - edAsset > 0n;
|
|
4645
|
+
return _context.a(2, isSufficientNative && isSufficientAsset);
|
|
4646
|
+
case 5:
|
|
4647
|
+
return _context.a(2, balanceNative - edNative - feeNative - BigInt(currency.amount) > 0n);
|
|
4583
4648
|
}
|
|
4584
4649
|
}, _callee);
|
|
4585
4650
|
}));
|
|
4586
|
-
return function isSufficientOrigin(_x, _x2, _x3, _x4, _x5) {
|
|
4651
|
+
return function isSufficientOrigin(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
4587
4652
|
return _ref.apply(this, arguments);
|
|
4588
4653
|
};
|
|
4589
4654
|
}();
|
|
4590
4655
|
var isSufficientDestination = /*#__PURE__*/function () {
|
|
4591
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, destination, address, amount, asset) {
|
|
4592
|
-
var existentialDeposit, nativeBalance;
|
|
4656
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, destination, address, amount, asset, feeNative) {
|
|
4657
|
+
var isNativeAsset, existentialDeposit, nativeBalance;
|
|
4593
4658
|
return _regenerator().w(function (_context2) {
|
|
4594
4659
|
while (1) switch (_context2.n) {
|
|
4595
4660
|
case 0:
|
|
4596
|
-
|
|
4661
|
+
isNativeAsset = assets.isSymbolMatch(asset.symbol, assets.getNativeAssetSymbol(destination));
|
|
4662
|
+
if (isNativeAsset) {
|
|
4597
4663
|
_context2.n = 1;
|
|
4598
4664
|
break;
|
|
4599
4665
|
}
|
|
@@ -4608,11 +4674,11 @@ var isSufficientDestination = /*#__PURE__*/function () {
|
|
|
4608
4674
|
});
|
|
4609
4675
|
case 2:
|
|
4610
4676
|
nativeBalance = _context2.v;
|
|
4611
|
-
return _context2.a(2, nativeBalance + amount - existentialDeposit > 0n);
|
|
4677
|
+
return _context2.a(2, nativeBalance + amount - existentialDeposit - feeNative > 0n);
|
|
4612
4678
|
}
|
|
4613
4679
|
}, _callee2);
|
|
4614
4680
|
}));
|
|
4615
|
-
return function isSufficientDestination(
|
|
4681
|
+
return function isSufficientDestination(_x9, _x0, _x1, _x10, _x11, _x12) {
|
|
4616
4682
|
return _ref2.apply(this, arguments);
|
|
4617
4683
|
};
|
|
4618
4684
|
}();
|
|
@@ -4630,7 +4696,7 @@ var createOriginLocation = function createOriginLocation(origin, destination) {
|
|
|
4630
4696
|
};
|
|
4631
4697
|
var getDestXcmFee = /*#__PURE__*/function () {
|
|
4632
4698
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4633
|
-
var api, origin, hopNode, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, sufficient, dryRunResult, _sufficient, fee, newForwardedXcms, destParaId
|
|
4699
|
+
var api, origin, hopNode, destination, currency, forwardedXcms, asset, address, feeAsset, originFee, disableFallback, resolvedFeeAsset, calcPaymentInfoFee, _fee, sufficient, dryRunResult, _fee2, _sufficient, fee, newForwardedXcms, destParaId;
|
|
4634
4700
|
return _regenerator().w(function (_context2) {
|
|
4635
4701
|
while (1) switch (_context2.n) {
|
|
4636
4702
|
case 0:
|
|
@@ -4700,18 +4766,17 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4700
4766
|
break;
|
|
4701
4767
|
}
|
|
4702
4768
|
_context2.n = 1;
|
|
4703
|
-
return
|
|
4769
|
+
return calcPaymentInfoFee();
|
|
4704
4770
|
case 1:
|
|
4705
|
-
|
|
4771
|
+
_fee = _context2.v;
|
|
4706
4772
|
_context2.n = 2;
|
|
4707
|
-
return
|
|
4773
|
+
return isSufficientDestination(api, destination, address, BigInt(currency.amount), asset, _fee);
|
|
4708
4774
|
case 2:
|
|
4709
|
-
|
|
4710
|
-
_t3 = sufficient;
|
|
4775
|
+
sufficient = _context2.v;
|
|
4711
4776
|
return _context2.a(2, {
|
|
4712
|
-
fee:
|
|
4777
|
+
fee: _fee,
|
|
4713
4778
|
feeType: 'paymentInfo',
|
|
4714
|
-
sufficient:
|
|
4779
|
+
sufficient: sufficient
|
|
4715
4780
|
});
|
|
4716
4781
|
case 3:
|
|
4717
4782
|
_context2.n = 4;
|
|
@@ -4740,20 +4805,18 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4740
4805
|
});
|
|
4741
4806
|
case 5:
|
|
4742
4807
|
_context2.n = 6;
|
|
4743
|
-
return
|
|
4808
|
+
return calcPaymentInfoFee();
|
|
4744
4809
|
case 6:
|
|
4745
|
-
|
|
4810
|
+
_fee2 = _context2.v;
|
|
4746
4811
|
_context2.n = 7;
|
|
4747
|
-
return
|
|
4812
|
+
return isSufficientDestination(api, destination, address, BigInt(currency.amount), asset, _fee2);
|
|
4748
4813
|
case 7:
|
|
4749
|
-
|
|
4750
|
-
_t5 = dryRunResult.failureReason;
|
|
4751
|
-
_t6 = _sufficient;
|
|
4814
|
+
_sufficient = _context2.v;
|
|
4752
4815
|
return _context2.a(2, {
|
|
4753
|
-
fee:
|
|
4816
|
+
fee: _fee2,
|
|
4754
4817
|
feeType: 'paymentInfo',
|
|
4755
|
-
dryRunError:
|
|
4756
|
-
sufficient:
|
|
4818
|
+
dryRunError: dryRunResult.failureReason,
|
|
4819
|
+
sufficient: _sufficient
|
|
4757
4820
|
});
|
|
4758
4821
|
case 8:
|
|
4759
4822
|
fee = dryRunResult.fee, newForwardedXcms = dryRunResult.forwardedXcms, destParaId = dryRunResult.destParaId;
|
|
@@ -5014,11 +5077,12 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
5014
5077
|
|
|
5015
5078
|
var getOriginXcmFee = /*#__PURE__*/function () {
|
|
5016
5079
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
5017
|
-
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient,
|
|
5080
|
+
var api, tx, origin, destination, senderAddress, disableFallback, feeAsset, currency, asset, resolvedFeeAsset, nativeAssetSymbol, rawFee, paddedFee, sufficient, dryRunResult, _rawFee, _paddedFee, _sufficient, fee, forwardedXcms, destParaId, weight, currencySymbol;
|
|
5018
5081
|
return _regenerator().w(function (_context) {
|
|
5019
5082
|
while (1) switch (_context.n) {
|
|
5020
5083
|
case 0:
|
|
5021
5084
|
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, disableFallback = _ref.disableFallback, feeAsset = _ref.feeAsset, currency = _ref.currency;
|
|
5085
|
+
asset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
5022
5086
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5023
5087
|
_context.n = 1;
|
|
5024
5088
|
return api.init(origin, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
@@ -5034,7 +5098,7 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5034
5098
|
rawFee = _context.v;
|
|
5035
5099
|
paddedFee = padFee(rawFee, origin, destination, 'origin');
|
|
5036
5100
|
_context.n = 3;
|
|
5037
|
-
return isSufficientOrigin(api, origin, senderAddress, paddedFee, resolvedFeeAsset);
|
|
5101
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, paddedFee, currency, asset, resolvedFeeAsset);
|
|
5038
5102
|
case 3:
|
|
5039
5103
|
sufficient = _context.v;
|
|
5040
5104
|
return _context.a(2, {
|
|
@@ -5044,7 +5108,6 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5044
5108
|
sufficient: sufficient
|
|
5045
5109
|
});
|
|
5046
5110
|
case 4:
|
|
5047
|
-
asset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
5048
5111
|
_context.n = 5;
|
|
5049
5112
|
return api.getDryRunCall({
|
|
5050
5113
|
tx: tx,
|
|
@@ -5073,7 +5136,7 @@ var getOriginXcmFee = /*#__PURE__*/function () {
|
|
|
5073
5136
|
_rawFee = _context.v;
|
|
5074
5137
|
_paddedFee = padFee(_rawFee, origin, destination, 'origin');
|
|
5075
5138
|
_context.n = 8;
|
|
5076
|
-
return isSufficientOrigin(api, origin, senderAddress, _paddedFee, resolvedFeeAsset);
|
|
5139
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, _paddedFee, currency, asset, resolvedFeeAsset);
|
|
5077
5140
|
case 8:
|
|
5078
5141
|
_sufficient = _context.v;
|
|
5079
5142
|
return _context.a(2, {
|
|
@@ -5234,7 +5297,7 @@ var validateDestination = function validateDestination(origin, destination) {
|
|
|
5234
5297
|
if (sdkCommon.isRelayChain(origin) && !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination) && origin !== destination) {
|
|
5235
5298
|
throw new IncompatibleNodesError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
|
|
5236
5299
|
}
|
|
5237
|
-
var allowedChainsToEthereum = ['AssetHubPolkadot', 'Hydration', 'BifrostPolkadot', 'Moonbeam'];
|
|
5300
|
+
var allowedChainsToEthereum = ['AssetHubPolkadot', 'Hydration', 'BifrostPolkadot', 'Moonbeam', 'Mythos'];
|
|
5238
5301
|
if (destination === 'Ethereum' && !allowedChainsToEthereum.includes(origin)) {
|
|
5239
5302
|
throw new IncompatibleNodesError("Transfers to Ethereum are only supported from: ".concat(allowedChainsToEthereum.join(', ')));
|
|
5240
5303
|
}
|
|
@@ -5260,11 +5323,12 @@ var validateAssetSpecifiers = function validateAssetSpecifiers(assetCheckEnabled
|
|
|
5260
5323
|
|
|
5261
5324
|
var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
5262
5325
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
5263
|
-
var api, tx, origin, destination, currency, senderAddress, feeAsset, rawOriginFee, originFee, resolvedFeeAsset, sufficient;
|
|
5326
|
+
var api, tx, origin, destination, currency, senderAddress, feeAsset, originAsset, rawOriginFee, originFee, resolvedFeeAsset, sufficient;
|
|
5264
5327
|
return _regenerator().w(function (_context) {
|
|
5265
5328
|
while (1) switch (_context.n) {
|
|
5266
5329
|
case 0:
|
|
5267
5330
|
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, currency = _ref.currency, senderAddress = _ref.senderAddress, feeAsset = _ref.feeAsset;
|
|
5331
|
+
originAsset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
5268
5332
|
_context.n = 1;
|
|
5269
5333
|
return api.calculateTransactionFee(tx, senderAddress);
|
|
5270
5334
|
case 1:
|
|
@@ -5272,7 +5336,7 @@ var getOriginXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5272
5336
|
originFee = padFee(rawOriginFee, origin, destination, 'origin');
|
|
5273
5337
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
5274
5338
|
_context.n = 2;
|
|
5275
|
-
return isSufficientOrigin(api, origin, senderAddress, originFee, resolvedFeeAsset);
|
|
5339
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, originFee, currency, originAsset, resolvedFeeAsset);
|
|
5276
5340
|
case 2:
|
|
5277
5341
|
sufficient = _context.v;
|
|
5278
5342
|
return _context.a(2, {
|
|
@@ -5629,11 +5693,11 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5629
5693
|
}
|
|
5630
5694
|
_ref2 = origin === 'AssetHubPolkadot' ? [BRIDGE_FEE_DOT, BRIDGE_FEE_KSM] : [BRIDGE_FEE_KSM, BRIDGE_FEE_DOT], _ref3 = _slicedToArray(_ref2, 2), fixedOriginFee = _ref3[0], fixedDestinationFee = _ref3[1];
|
|
5631
5695
|
_context.n = 3;
|
|
5632
|
-
return isSufficientOrigin(api, origin, senderAddress, fixedOriginFee, resolvedFeeAsset);
|
|
5696
|
+
return isSufficientOrigin(api, origin, destination, senderAddress, fixedOriginFee, currency, originAsset, resolvedFeeAsset);
|
|
5633
5697
|
case 3:
|
|
5634
5698
|
originSufficient = _context.v;
|
|
5635
5699
|
_context.n = 4;
|
|
5636
|
-
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset);
|
|
5700
|
+
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset, fixedDestinationFee);
|
|
5637
5701
|
case 4:
|
|
5638
5702
|
_destinationSufficient = _context.v;
|
|
5639
5703
|
return _context.a(2, {
|
|
@@ -5676,7 +5740,7 @@ var getXcmFeeEstimate = /*#__PURE__*/function () {
|
|
|
5676
5740
|
case 9:
|
|
5677
5741
|
destinationFee = _t;
|
|
5678
5742
|
_context.n = 10;
|
|
5679
|
-
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset);
|
|
5743
|
+
return isSufficientDestination(destApi, destination, address, BigInt(currency.amount), originAsset, destinationFee);
|
|
5680
5744
|
case 10:
|
|
5681
5745
|
destinationSufficient = _context.v;
|
|
5682
5746
|
destFeeDetails = {
|
|
@@ -5825,7 +5889,7 @@ var send = /*#__PURE__*/function () {
|
|
|
5825
5889
|
});
|
|
5826
5890
|
finalVersion = selectXcmVersion(version, originVersion, destVersion);
|
|
5827
5891
|
normalizedAsset = finalAsset.multiLocation ? _objectSpread2(_objectSpread2({}, finalAsset), {}, {
|
|
5828
|
-
|
|
5892
|
+
multiLocation: assets.normalizeMultiLocation(finalAsset.multiLocation, finalVersion)
|
|
5829
5893
|
}) : finalAsset;
|
|
5830
5894
|
return _context.a(2, getNode(origin).transfer({
|
|
5831
5895
|
api: api,
|
|
@@ -6139,41 +6203,36 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6139
6203
|
while (1) switch (_context2.n) {
|
|
6140
6204
|
case 0:
|
|
6141
6205
|
api = input.api, asset = input.asset, scenario = input.scenario, version = input.version, destination = input.destination, address = input.address, senderAddress = input.senderAddress, feeAsset = input.feeAsset, paraIdTo = input.paraIdTo;
|
|
6142
|
-
|
|
6143
|
-
_context2.n = 1;
|
|
6144
|
-
break;
|
|
6145
|
-
}
|
|
6146
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6147
|
-
case 1:
|
|
6206
|
+
assertHasLocation(asset);
|
|
6148
6207
|
if (!(senderAddress === undefined)) {
|
|
6149
|
-
_context2.n =
|
|
6208
|
+
_context2.n = 1;
|
|
6150
6209
|
break;
|
|
6151
6210
|
}
|
|
6152
6211
|
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6153
|
-
case
|
|
6212
|
+
case 1:
|
|
6154
6213
|
if (!sdkCommon.isTMultiLocation(address)) {
|
|
6155
|
-
_context2.n =
|
|
6214
|
+
_context2.n = 2;
|
|
6156
6215
|
break;
|
|
6157
6216
|
}
|
|
6158
6217
|
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
6159
|
-
case
|
|
6218
|
+
case 2:
|
|
6160
6219
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
6161
6220
|
PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
|
|
6162
6221
|
// Pad by 25%
|
|
6163
6222
|
AH_EXECUTION_FEE_PADDED = ASSET_HUB_EXECUTION_FEE * 125n / 100n; // Perform a dry run AH -> dest to calculate the BuyExecution amount
|
|
6164
|
-
_context2.n =
|
|
6223
|
+
_context2.n = 3;
|
|
6165
6224
|
return Builder(api.clone()).from('AssetHubPolkadot').to(destination).currency({
|
|
6166
6225
|
symbol: 'DOT',
|
|
6167
6226
|
amount: AH_EXECUTION_FEE_PADDED
|
|
6168
6227
|
}).address(address).senderAddress(senderAddress).dryRun();
|
|
6169
|
-
case
|
|
6228
|
+
case 3:
|
|
6170
6229
|
dryRunResult = _context2.v;
|
|
6171
6230
|
if (dryRunResult.origin.success) {
|
|
6172
|
-
_context2.n =
|
|
6231
|
+
_context2.n = 4;
|
|
6173
6232
|
break;
|
|
6174
6233
|
}
|
|
6175
6234
|
throw new DryRunFailedError(dryRunResult.origin.failureReason);
|
|
6176
|
-
case
|
|
6235
|
+
case 4:
|
|
6177
6236
|
// Pad fee by 50%
|
|
6178
6237
|
dryRunFeePadded = BigInt(dryRunResult.origin.fee) * 3n / 2n;
|
|
6179
6238
|
dest = createDestination(scenario, version, destination, paraIdTo);
|
|
@@ -6288,32 +6347,27 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6288
6347
|
}
|
|
6289
6348
|
throw new BridgeHaltedError();
|
|
6290
6349
|
case 2:
|
|
6291
|
-
|
|
6292
|
-
_context3.n = 3;
|
|
6293
|
-
break;
|
|
6294
|
-
}
|
|
6295
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6296
|
-
case 3:
|
|
6350
|
+
assertHasLocation(asset);
|
|
6297
6351
|
if (!(senderAddress === undefined)) {
|
|
6298
|
-
_context3.n =
|
|
6352
|
+
_context3.n = 3;
|
|
6299
6353
|
break;
|
|
6300
6354
|
}
|
|
6301
6355
|
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6302
|
-
case
|
|
6356
|
+
case 3:
|
|
6303
6357
|
if (!sdkCommon.isTMultiLocation(address)) {
|
|
6304
|
-
_context3.n =
|
|
6358
|
+
_context3.n = 4;
|
|
6305
6359
|
break;
|
|
6306
6360
|
}
|
|
6307
6361
|
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
6308
|
-
case
|
|
6362
|
+
case 4:
|
|
6309
6363
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
6310
|
-
_context3.n =
|
|
6364
|
+
_context3.n = 5;
|
|
6311
6365
|
return api.createApiForNode('AssetHubPolkadot');
|
|
6312
|
-
case
|
|
6366
|
+
case 5:
|
|
6313
6367
|
ahApi = _context3.v;
|
|
6314
|
-
_context3.n =
|
|
6368
|
+
_context3.n = 6;
|
|
6315
6369
|
return getParaEthTransferFees(ahApi);
|
|
6316
|
-
case
|
|
6370
|
+
case 6:
|
|
6317
6371
|
_yield$getParaEthTran = _context3.v;
|
|
6318
6372
|
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
6319
6373
|
bridgeFee = _yield$getParaEthTran2[0];
|
|
@@ -6322,13 +6376,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6322
6376
|
fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : (bridgeFee + executionFee).toString();
|
|
6323
6377
|
ethAsset = assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
|
|
6324
6378
|
if (ethAsset) {
|
|
6325
|
-
_context3.n =
|
|
6379
|
+
_context3.n = 7;
|
|
6326
6380
|
break;
|
|
6327
6381
|
}
|
|
6328
6382
|
throw new assets.InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(asset)));
|
|
6329
|
-
case
|
|
6383
|
+
case 7:
|
|
6330
6384
|
if (!useOnlyDepositInstruction) {
|
|
6331
|
-
_context3.n =
|
|
6385
|
+
_context3.n = 8;
|
|
6332
6386
|
break;
|
|
6333
6387
|
}
|
|
6334
6388
|
customXcmOnDest = addXcmVersionHeader([{
|
|
@@ -6347,21 +6401,21 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6347
6401
|
})
|
|
6348
6402
|
}
|
|
6349
6403
|
}], version);
|
|
6350
|
-
_context3.n =
|
|
6404
|
+
_context3.n = 11;
|
|
6351
6405
|
break;
|
|
6352
|
-
case
|
|
6406
|
+
case 8:
|
|
6353
6407
|
if (ethAsset.assetId) {
|
|
6354
|
-
_context3.n =
|
|
6408
|
+
_context3.n = 9;
|
|
6355
6409
|
break;
|
|
6356
6410
|
}
|
|
6357
6411
|
throw new assets.InvalidCurrencyError("Ethereum asset ".concat(JSON.stringify(ethAsset), " has no assetId"));
|
|
6358
|
-
case
|
|
6359
|
-
_context3.n =
|
|
6412
|
+
case 9:
|
|
6413
|
+
_context3.n = 10;
|
|
6360
6414
|
return generateMessageId(api, senderAddress, getParaId(this.node), ethAsset.assetId, address, asset.amount);
|
|
6361
|
-
case
|
|
6415
|
+
case 10:
|
|
6362
6416
|
messageId = _context3.v;
|
|
6363
6417
|
customXcmOnDest = createCustomXcmOnDest(input, this.node, messageId);
|
|
6364
|
-
case
|
|
6418
|
+
case 11:
|
|
6365
6419
|
call = {
|
|
6366
6420
|
module: 'PolkadotXcm',
|
|
6367
6421
|
method: 'transfer_assets_using_type_and_then',
|
|
@@ -6697,9 +6751,7 @@ var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, weight,
|
|
|
6697
6751
|
version: version,
|
|
6698
6752
|
paraId: paraIdTo
|
|
6699
6753
|
});
|
|
6700
|
-
|
|
6701
|
-
throw new InvalidParameterError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6702
|
-
}
|
|
6754
|
+
assertHasLocation(asset);
|
|
6703
6755
|
var transformedMultiLocation = transformMultiLocation(asset.multiLocation);
|
|
6704
6756
|
var call = {
|
|
6705
6757
|
module: 'PolkadotXcm',
|
|
@@ -6992,9 +7044,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6992
7044
|
if (!assets.isForeignAsset(asset)) {
|
|
6993
7045
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
6994
7046
|
}
|
|
6995
|
-
|
|
6996
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6997
|
-
}
|
|
7047
|
+
assertHasLocation(asset);
|
|
6998
7048
|
var PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
|
|
6999
7049
|
var call = {
|
|
7000
7050
|
module: 'PolkadotXcm',
|
|
@@ -7085,15 +7135,10 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7085
7135
|
}
|
|
7086
7136
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
7087
7137
|
case 5:
|
|
7088
|
-
|
|
7089
|
-
|
|
7090
|
-
break;
|
|
7091
|
-
}
|
|
7092
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
7093
|
-
case 6:
|
|
7094
|
-
_context.n = 7;
|
|
7138
|
+
assertHasLocation(asset);
|
|
7139
|
+
_context.n = 6;
|
|
7095
7140
|
return generateMessageId(api, senderAddress, getParaId(this.node), JSON.stringify(asset.multiLocation), address, asset.amount);
|
|
7096
|
-
case
|
|
7141
|
+
case 6:
|
|
7097
7142
|
messageId = _context.v;
|
|
7098
7143
|
multiLocation = asset.symbol === this.getNativeAssetSymbol() ? DOT_MULTILOCATION : asset.multiLocation;
|
|
7099
7144
|
call = {
|
|
@@ -7160,18 +7205,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7160
7205
|
}
|
|
7161
7206
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
7162
7207
|
case 3:
|
|
7163
|
-
|
|
7164
|
-
_context2.n = 4;
|
|
7165
|
-
break;
|
|
7166
|
-
}
|
|
7167
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
7168
|
-
case 4:
|
|
7208
|
+
assertHasLocation(asset);
|
|
7169
7209
|
if (!(asset.symbol === this.getNativeAssetSymbol() || asset.symbol === assets.getNativeAssetSymbol('Kusama'))) {
|
|
7170
|
-
_context2.n =
|
|
7210
|
+
_context2.n = 4;
|
|
7171
7211
|
break;
|
|
7172
7212
|
}
|
|
7173
7213
|
return _context2.a(2, this.handleEthBridgeNativeTransfer(input));
|
|
7174
|
-
case
|
|
7214
|
+
case 4:
|
|
7175
7215
|
modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
|
|
7176
7216
|
destLocation: createDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
|
|
7177
7217
|
beneficiaryLocation: createBeneficiary({
|
|
@@ -8148,7 +8188,7 @@ var createTypeAndThenDest = function createTypeAndThenDest(destination, scenario
|
|
|
8148
8188
|
})
|
|
8149
8189
|
};
|
|
8150
8190
|
};
|
|
8151
|
-
var createTypeAndThenTransfer = function createTypeAndThenTransfer(_ref, version) {
|
|
8191
|
+
var createTypeAndThenTransfer$1 = function createTypeAndThenTransfer(_ref, version) {
|
|
8152
8192
|
var api = _ref.api,
|
|
8153
8193
|
asset = _ref.asset,
|
|
8154
8194
|
address = _ref.address,
|
|
@@ -8237,7 +8277,7 @@ var Polimec = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8237
8277
|
_context.n = 1;
|
|
8238
8278
|
break;
|
|
8239
8279
|
}
|
|
8240
|
-
_call = createTypeAndThenTransfer(input, version);
|
|
8280
|
+
_call = createTypeAndThenTransfer$1(input, version);
|
|
8241
8281
|
return _context.a(2, api.callTxMethod(_call));
|
|
8242
8282
|
case 1:
|
|
8243
8283
|
if (!(scenario === 'ParaToPara' && (destination === 'AssetHubPolkadot' || destination === 'Hydration'))) {
|
|
@@ -8252,7 +8292,7 @@ var Polimec = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8252
8292
|
}
|
|
8253
8293
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
8254
8294
|
case 3:
|
|
8255
|
-
call = createTypeAndThenTransfer(input, version, 'Teleport');
|
|
8295
|
+
call = createTypeAndThenTransfer$1(input, version, 'Teleport');
|
|
8256
8296
|
return _context.a(2, api.callTxMethod(call));
|
|
8257
8297
|
}
|
|
8258
8298
|
}, _callee, this);
|
|
@@ -8267,7 +8307,7 @@ var Polimec = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8267
8307
|
value: function transferRelayToPara(options) {
|
|
8268
8308
|
var _options$version = options.version,
|
|
8269
8309
|
version = _options$version === void 0 ? this.version : _options$version;
|
|
8270
|
-
var call = createTypeAndThenTransfer(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8310
|
+
var call = createTypeAndThenTransfer$1(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8271
8311
|
scenario: 'RelayToPara'
|
|
8272
8312
|
}), version, 'Teleport');
|
|
8273
8313
|
return call;
|
|
@@ -8361,7 +8401,7 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8361
8401
|
version = _options$version === void 0 ? this.version : _options$version;
|
|
8362
8402
|
var symbol = asset.symbol.toUpperCase();
|
|
8363
8403
|
if (symbol === 'DOT') {
|
|
8364
|
-
var call = createTypeAndThenTransfer(options, version);
|
|
8404
|
+
var call = createTypeAndThenTransfer$1(options, version);
|
|
8365
8405
|
return Promise.resolve(api.callTxMethod(call));
|
|
8366
8406
|
}
|
|
8367
8407
|
if ((symbol === 'USDC' || symbol === 'USDT') && !sdkCommon.hasJunction(asset.multiLocation, 'Parachain', getParaId('AssetHubPolkadot'))) {
|
|
@@ -8670,9 +8710,7 @@ var Moonbeam = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8670
8710
|
}
|
|
8671
8711
|
}
|
|
8672
8712
|
};
|
|
8673
|
-
|
|
8674
|
-
throw new assets.InvalidCurrencyError('throw new InvalidCurrencyError(`Asset ${JSON.stringify(asset)} has no assetId`)');
|
|
8675
|
-
}
|
|
8713
|
+
assertHasLocation(asset);
|
|
8676
8714
|
return asset.multiLocation;
|
|
8677
8715
|
}
|
|
8678
8716
|
}, {
|
|
@@ -8742,9 +8780,7 @@ var Moonriver = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8742
8780
|
}
|
|
8743
8781
|
}
|
|
8744
8782
|
};
|
|
8745
|
-
|
|
8746
|
-
throw new assets.InvalidCurrencyError('throw new InvalidCurrencyError(`Asset ${JSON.stringify(asset)} has no multiLocation`)');
|
|
8747
|
-
}
|
|
8783
|
+
assertHasLocation(asset);
|
|
8748
8784
|
return asset.multiLocation;
|
|
8749
8785
|
}
|
|
8750
8786
|
}, {
|
|
@@ -8775,6 +8811,94 @@ var Moonriver = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8775
8811
|
}]);
|
|
8776
8812
|
}(ParachainNode);
|
|
8777
8813
|
|
|
8814
|
+
var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
8815
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, node, version) {
|
|
8816
|
+
var api, scenario, asset, currency, senderAddress, address, destination, messageId, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, ahExecutionFee, feeConverted, nativeMythAmount, nativeMythBalance;
|
|
8817
|
+
return _regenerator().w(function (_context) {
|
|
8818
|
+
while (1) switch (_context.n) {
|
|
8819
|
+
case 0:
|
|
8820
|
+
api = options.api, scenario = options.scenario, asset = options.asset, currency = options.currency, senderAddress = options.senderAddress, address = options.address, destination = options.destination;
|
|
8821
|
+
assertHasLocation(asset);
|
|
8822
|
+
assertAddressIsString(address);
|
|
8823
|
+
if (senderAddress) {
|
|
8824
|
+
_context.n = 1;
|
|
8825
|
+
break;
|
|
8826
|
+
}
|
|
8827
|
+
throw new assets.InvalidCurrencyError("Sender address is required for Mythos transfer");
|
|
8828
|
+
case 1:
|
|
8829
|
+
if (!(!assets.isForeignAsset(asset) || !asset.assetId)) {
|
|
8830
|
+
_context.n = 2;
|
|
8831
|
+
break;
|
|
8832
|
+
}
|
|
8833
|
+
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is not a foreign asset"));
|
|
8834
|
+
case 2:
|
|
8835
|
+
_context.n = 3;
|
|
8836
|
+
return generateMessageId(api, senderAddress, getParaId(node), asset.assetId, address, asset.amount);
|
|
8837
|
+
case 3:
|
|
8838
|
+
messageId = _context.v;
|
|
8839
|
+
ahApi = api.clone();
|
|
8840
|
+
_context.n = 4;
|
|
8841
|
+
return ahApi.init('AssetHubPolkadot');
|
|
8842
|
+
case 4:
|
|
8843
|
+
_context.n = 5;
|
|
8844
|
+
return getParaEthTransferFees(ahApi);
|
|
8845
|
+
case 5:
|
|
8846
|
+
_yield$getParaEthTran = _context.v;
|
|
8847
|
+
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
8848
|
+
bridgeFee = _yield$getParaEthTran2[0];
|
|
8849
|
+
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
8850
|
+
_context.n = 6;
|
|
8851
|
+
return ahApi.quoteAhPrice(DOT_MULTILOCATION, assets.getNativeAssets(node)[0].multiLocation, bridgeFee + ahExecutionFee);
|
|
8852
|
+
case 6:
|
|
8853
|
+
feeConverted = _context.v;
|
|
8854
|
+
if (feeConverted) {
|
|
8855
|
+
_context.n = 7;
|
|
8856
|
+
break;
|
|
8857
|
+
}
|
|
8858
|
+
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
8859
|
+
case 7:
|
|
8860
|
+
nativeMythAmount = padFeeBy(feeConverted, 10);
|
|
8861
|
+
_context.n = 8;
|
|
8862
|
+
return getAssetBalanceInternal({
|
|
8863
|
+
api: api,
|
|
8864
|
+
address: senderAddress,
|
|
8865
|
+
node: node,
|
|
8866
|
+
currency: currency
|
|
8867
|
+
});
|
|
8868
|
+
case 8:
|
|
8869
|
+
nativeMythBalance = _context.v;
|
|
8870
|
+
if (!(nativeMythBalance - nativeMythAmount < 0)) {
|
|
8871
|
+
_context.n = 9;
|
|
8872
|
+
break;
|
|
8873
|
+
}
|
|
8874
|
+
throw new assets.InvalidCurrencyError("Insufficient balance. Fee: ".concat(nativeMythAmount, ", Amount: ").concat(asset.amount));
|
|
8875
|
+
case 9:
|
|
8876
|
+
return _context.a(2, {
|
|
8877
|
+
module: 'PolkadotXcm',
|
|
8878
|
+
method: 'transfer_assets_using_type_and_then',
|
|
8879
|
+
parameters: {
|
|
8880
|
+
dest: createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
|
|
8881
|
+
assets: _defineProperty({}, version, [createMultiAsset(version, nativeMythAmount, {
|
|
8882
|
+
parents: sdkCommon.Parents.ZERO,
|
|
8883
|
+
interior: 'Here'
|
|
8884
|
+
}), createMultiAsset(version, asset.amount, asset.multiLocation)]),
|
|
8885
|
+
assets_transfer_type: 'DestinationReserve',
|
|
8886
|
+
remote_fees_id: _defineProperty({}, version, {
|
|
8887
|
+
parents: sdkCommon.Parents.ZERO,
|
|
8888
|
+
interior: 'Here'
|
|
8889
|
+
}),
|
|
8890
|
+
fees_transfer_type: 'Teleport',
|
|
8891
|
+
custom_xcm_on_dest: createCustomXcmOnDest(options, node, messageId, nativeMythAmount),
|
|
8892
|
+
weight_limit: 'Unlimited'
|
|
8893
|
+
}
|
|
8894
|
+
});
|
|
8895
|
+
}
|
|
8896
|
+
}, _callee);
|
|
8897
|
+
}));
|
|
8898
|
+
return function createTypeAndThenTransfer(_x, _x2, _x3) {
|
|
8899
|
+
return _ref.apply(this, arguments);
|
|
8900
|
+
};
|
|
8901
|
+
}();
|
|
8778
8902
|
var Mythos = /*#__PURE__*/function (_ParachainNode) {
|
|
8779
8903
|
function Mythos() {
|
|
8780
8904
|
_classCallCheck(this, Mythos);
|
|
@@ -8799,27 +8923,38 @@ var Mythos = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8799
8923
|
}, {
|
|
8800
8924
|
key: "transferPolkadotXCM",
|
|
8801
8925
|
value: function () {
|
|
8802
|
-
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
8803
|
-
var destination, defaultTx;
|
|
8804
|
-
return _regenerator().w(function (
|
|
8805
|
-
while (1) switch (
|
|
8926
|
+
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
8927
|
+
var api, destination, defaultTx, _t, _t2;
|
|
8928
|
+
return _regenerator().w(function (_context2) {
|
|
8929
|
+
while (1) switch (_context2.n) {
|
|
8806
8930
|
case 0:
|
|
8807
|
-
destination = input.destination;
|
|
8808
|
-
|
|
8931
|
+
api = input.api, destination = input.destination;
|
|
8932
|
+
_context2.n = 1;
|
|
8809
8933
|
return this.createTx(input);
|
|
8810
8934
|
case 1:
|
|
8811
|
-
defaultTx =
|
|
8935
|
+
defaultTx = _context2.v;
|
|
8812
8936
|
if (!(destination === 'AssetHubPolkadot')) {
|
|
8813
|
-
|
|
8937
|
+
_context2.n = 2;
|
|
8814
8938
|
break;
|
|
8815
8939
|
}
|
|
8816
|
-
return
|
|
8940
|
+
return _context2.a(2, handleToAhTeleport('Mythos', input, defaultTx));
|
|
8817
8941
|
case 2:
|
|
8818
|
-
|
|
8942
|
+
if (!(destination == 'Ethereum')) {
|
|
8943
|
+
_context2.n = 4;
|
|
8944
|
+
break;
|
|
8945
|
+
}
|
|
8946
|
+
_t = api;
|
|
8947
|
+
_context2.n = 3;
|
|
8948
|
+
return createTypeAndThenTransfer(input, this.node, this.version);
|
|
8949
|
+
case 3:
|
|
8950
|
+
_t2 = _context2.v;
|
|
8951
|
+
return _context2.a(2, _t.callTxMethod.call(_t, _t2));
|
|
8952
|
+
case 4:
|
|
8953
|
+
return _context2.a(2, defaultTx);
|
|
8819
8954
|
}
|
|
8820
|
-
},
|
|
8955
|
+
}, _callee2, this);
|
|
8821
8956
|
}));
|
|
8822
|
-
function transferPolkadotXCM(
|
|
8957
|
+
function transferPolkadotXCM(_x4) {
|
|
8823
8958
|
return _transferPolkadotXCM.apply(this, arguments);
|
|
8824
8959
|
}
|
|
8825
8960
|
return transferPolkadotXCM;
|
|
@@ -10162,11 +10297,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
10162
10297
|
key: "getTransferInfo",
|
|
10163
10298
|
value: (function () {
|
|
10164
10299
|
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
10165
|
-
var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
|
|
10300
|
+
var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
|
|
10166
10301
|
return _regenerator().w(function (_context0) {
|
|
10167
10302
|
while (1) switch (_context0.n) {
|
|
10168
10303
|
case 0:
|
|
10169
|
-
_this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
|
|
10304
|
+
_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;
|
|
10170
10305
|
assertToIsString(to);
|
|
10171
10306
|
assertAddressIsString(address);
|
|
10172
10307
|
_context0.n = 1;
|
|
@@ -10180,6 +10315,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
10180
10315
|
destination: to,
|
|
10181
10316
|
address: address,
|
|
10182
10317
|
senderAddress: senderAddress,
|
|
10318
|
+
ahAddress: ahAddress,
|
|
10183
10319
|
currency: currency,
|
|
10184
10320
|
feeAsset: feeAsset
|
|
10185
10321
|
}));
|
|
@@ -10243,6 +10379,7 @@ exports.TransferToAhNotSupported = TransferToAhNotSupported;
|
|
|
10243
10379
|
exports.UnableToComputeError = UnableToComputeError;
|
|
10244
10380
|
exports.addXcmVersionHeader = addXcmVersionHeader;
|
|
10245
10381
|
exports.assertAddressIsString = assertAddressIsString;
|
|
10382
|
+
exports.assertHasLocation = assertHasLocation;
|
|
10246
10383
|
exports.assertToIsString = assertToIsString;
|
|
10247
10384
|
exports.blake2b256 = blake2b256;
|
|
10248
10385
|
exports.blake2b512 = blake2b512;
|