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