@paraspell/sdk-core 10.5.2 → 10.7.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 +623 -316
- package/dist/index.d.ts +24 -16
- package/dist/index.mjs +624 -317
- 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",
|
|
@@ -2108,6 +2113,42 @@ var createBeneficiaryMultiLocation = function createBeneficiaryMultiLocation(_re
|
|
|
2108
2113
|
}
|
|
2109
2114
|
};
|
|
2110
2115
|
|
|
2116
|
+
/**
|
|
2117
|
+
* This function localizes a multiLocation by removing the `Parachain` junction
|
|
2118
|
+
* if it exists. The `parents` field is set to `0` either if a `Parachain` was removed
|
|
2119
|
+
* or if the resulting interior is `'Here'` and the node is a relay chain.
|
|
2120
|
+
*
|
|
2121
|
+
* @param node - The current node
|
|
2122
|
+
* @param multiLocation - The multiLocation to localize
|
|
2123
|
+
* @returns The localized multiLocation
|
|
2124
|
+
*/
|
|
2125
|
+
var localizeLocation = function localizeLocation(node, multiLocation) {
|
|
2126
|
+
var newInterior = multiLocation.interior;
|
|
2127
|
+
var parachainRemoved = false;
|
|
2128
|
+
if (multiLocation.interior !== 'Here') {
|
|
2129
|
+
var junctions = Object.values(multiLocation.interior).flat().filter(function (junction) {
|
|
2130
|
+
return _typeof(junction) === 'object' && junction !== null;
|
|
2131
|
+
});
|
|
2132
|
+
var filteredJunctions = junctions.filter(function (junction) {
|
|
2133
|
+
if ('Parachain' in junction) {
|
|
2134
|
+
parachainRemoved = true;
|
|
2135
|
+
return false;
|
|
2136
|
+
}
|
|
2137
|
+
return true;
|
|
2138
|
+
});
|
|
2139
|
+
if (filteredJunctions.length === 0) {
|
|
2140
|
+
newInterior = 'Here';
|
|
2141
|
+
} else {
|
|
2142
|
+
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
var shouldSetParentsToZero = parachainRemoved || newInterior === 'Here' && sdkCommon.isRelayChain(node);
|
|
2146
|
+
return {
|
|
2147
|
+
parents: shouldSetParentsToZero ? sdkCommon.Parents.ZERO : multiLocation.parents,
|
|
2148
|
+
interior: newInterior
|
|
2149
|
+
};
|
|
2150
|
+
};
|
|
2151
|
+
|
|
2111
2152
|
var reverseTransformMultiLocation = function reverseTransformMultiLocation(multiLocation) {
|
|
2112
2153
|
var parachainJunction = {
|
|
2113
2154
|
Parachain: 1000
|
|
@@ -2130,36 +2171,6 @@ var reverseTransformMultiLocation = function reverseTransformMultiLocation(multi
|
|
|
2130
2171
|
});
|
|
2131
2172
|
};
|
|
2132
2173
|
|
|
2133
|
-
/**
|
|
2134
|
-
* This function transforms a multiLocation by removing the `Parachain` junction
|
|
2135
|
-
* if it exists and setting the `parents` to `0`.
|
|
2136
|
-
*
|
|
2137
|
-
* @param multiLocation - The multiLocation to transform
|
|
2138
|
-
* @returns The transformed multiLocation
|
|
2139
|
-
*/
|
|
2140
|
-
var transformMultiLocation = function transformMultiLocation(multiLocation) {
|
|
2141
|
-
var newInterior;
|
|
2142
|
-
if (multiLocation.interior === 'Here') {
|
|
2143
|
-
newInterior = 'Here';
|
|
2144
|
-
} else {
|
|
2145
|
-
var junctions = Object.values(multiLocation.interior).flat().filter(function (junction) {
|
|
2146
|
-
return _typeof(junction) === 'object' && junction !== null;
|
|
2147
|
-
});
|
|
2148
|
-
var filteredJunctions = junctions.filter(function (junction) {
|
|
2149
|
-
return !('Parachain' in junction);
|
|
2150
|
-
});
|
|
2151
|
-
if (filteredJunctions.length === 0) {
|
|
2152
|
-
newInterior = 'Here';
|
|
2153
|
-
} else {
|
|
2154
|
-
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
return _objectSpread2(_objectSpread2({}, multiLocation), {}, {
|
|
2158
|
-
parents: sdkCommon.Parents.ZERO,
|
|
2159
|
-
interior: newInterior
|
|
2160
|
-
});
|
|
2161
|
-
};
|
|
2162
|
-
|
|
2163
2174
|
var createBeneficiary = function createBeneficiary(options) {
|
|
2164
2175
|
return createBeneficiaryMultiLocation(options);
|
|
2165
2176
|
};
|
|
@@ -2396,15 +2407,6 @@ var resolveModuleError = function resolveModuleError(node, error) {
|
|
|
2396
2407
|
return failureReason;
|
|
2397
2408
|
};
|
|
2398
2409
|
|
|
2399
|
-
var getFees = function getFees(scenario) {
|
|
2400
|
-
if (scenario === 'ParaToRelay') {
|
|
2401
|
-
return 4600000000;
|
|
2402
|
-
} else if (scenario === 'ParaToPara') {
|
|
2403
|
-
return 399600000000;
|
|
2404
|
-
}
|
|
2405
|
-
throw new InvalidParameterError("Fees for scenario ".concat(scenario, " are not defined."));
|
|
2406
|
-
};
|
|
2407
|
-
|
|
2408
2410
|
/**
|
|
2409
2411
|
* Retrieves the node instance for a given node.
|
|
2410
2412
|
*
|
|
@@ -2417,7 +2419,7 @@ var getNode = function getNode(node) {
|
|
|
2417
2419
|
};
|
|
2418
2420
|
|
|
2419
2421
|
var resolveParaId = function resolveParaId(paraId, destination) {
|
|
2420
|
-
if (sdkCommon.isTMultiLocation(destination)
|
|
2422
|
+
if (sdkCommon.isTMultiLocation(destination)) {
|
|
2421
2423
|
return undefined;
|
|
2422
2424
|
}
|
|
2423
2425
|
return paraId !== null && paraId !== void 0 ? paraId : getParaId(destination);
|
|
@@ -2555,14 +2557,14 @@ var getModifiedCurrencySelection = function getModifiedCurrencySelection(input)
|
|
|
2555
2557
|
return createDefaultCurrencySelection(input);
|
|
2556
2558
|
};
|
|
2557
2559
|
|
|
2558
|
-
var getXTokensParameters = function getXTokensParameters(isMultiAssetTransfer, currencySelection, destLocation, amount,
|
|
2560
|
+
var getXTokensParameters = function getXTokensParameters(isMultiAssetTransfer, currencySelection, destLocation, amount, weightLimit, version, overriddenAsset) {
|
|
2559
2561
|
var versionedDestLocation = addXcmVersionHeader(destLocation, version);
|
|
2560
2562
|
if (!isMultiAssetTransfer) {
|
|
2561
2563
|
return {
|
|
2562
2564
|
currency_id: currencySelection,
|
|
2563
2565
|
amount: BigInt(amount),
|
|
2564
2566
|
dest: versionedDestLocation,
|
|
2565
|
-
dest_weight_limit:
|
|
2567
|
+
dest_weight_limit: weightLimit
|
|
2566
2568
|
};
|
|
2567
2569
|
}
|
|
2568
2570
|
var isOverriddenMultiAssets = overriddenAsset && !sdkCommon.isTMultiLocation(overriddenAsset);
|
|
@@ -2575,7 +2577,7 @@ var getXTokensParameters = function getXTokensParameters(isMultiAssetTransfer, c
|
|
|
2575
2577
|
fee_item: feeIndexWithFallback
|
|
2576
2578
|
}), {}, {
|
|
2577
2579
|
dest: versionedDestLocation,
|
|
2578
|
-
dest_weight_limit:
|
|
2580
|
+
dest_weight_limit: weightLimit
|
|
2579
2581
|
});
|
|
2580
2582
|
};
|
|
2581
2583
|
|
|
@@ -3436,8 +3438,9 @@ var transferMoonbeamEvm = /*#__PURE__*/function () {
|
|
|
3436
3438
|
};
|
|
3437
3439
|
}();
|
|
3438
3440
|
|
|
3439
|
-
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, messageId) {
|
|
3441
|
+
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, messageId, feeAmount) {
|
|
3440
3442
|
var api = _ref.api,
|
|
3443
|
+
destination = _ref.destination,
|
|
3441
3444
|
address = _ref.address,
|
|
3442
3445
|
asset = _ref.asset,
|
|
3443
3446
|
scenario = _ref.scenario,
|
|
@@ -3447,9 +3450,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
|
|
|
3447
3450
|
if (!assets.isForeignAsset(asset)) {
|
|
3448
3451
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
3449
3452
|
}
|
|
3450
|
-
|
|
3451
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
3452
|
-
}
|
|
3453
|
+
assertHasLocation(asset);
|
|
3453
3454
|
if (!senderAddress) {
|
|
3454
3455
|
throw new InvalidParameterError("Please provide senderAddress");
|
|
3455
3456
|
}
|
|
@@ -3471,7 +3472,41 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
|
|
|
3471
3472
|
}]
|
|
3472
3473
|
};
|
|
3473
3474
|
return _defineProperty({}, version, [{
|
|
3474
|
-
SetAppendix: [{
|
|
3475
|
+
SetAppendix: [origin === 'Mythos' ? {
|
|
3476
|
+
DepositReserveAsset: {
|
|
3477
|
+
assets: {
|
|
3478
|
+
Wild: 'All'
|
|
3479
|
+
},
|
|
3480
|
+
dest: createDestination(scenario, version, destination, getParaId(origin), undefined, sdkCommon.Parents.ONE),
|
|
3481
|
+
xcm: [{
|
|
3482
|
+
BuyExecution: {
|
|
3483
|
+
fees: {
|
|
3484
|
+
id: {
|
|
3485
|
+
parents: sdkCommon.Parents.ZERO,
|
|
3486
|
+
interior: 'Here'
|
|
3487
|
+
},
|
|
3488
|
+
fun: {
|
|
3489
|
+
Fungible: feeAmount
|
|
3490
|
+
}
|
|
3491
|
+
},
|
|
3492
|
+
weight_limit: 'Unlimited'
|
|
3493
|
+
}
|
|
3494
|
+
}, {
|
|
3495
|
+
DepositAsset: {
|
|
3496
|
+
assets: {
|
|
3497
|
+
Wild: 'All'
|
|
3498
|
+
},
|
|
3499
|
+
beneficiary: createBeneficiaryMultiLocation({
|
|
3500
|
+
api: api,
|
|
3501
|
+
scenario: scenario,
|
|
3502
|
+
pallet: 'PolkadotXcm',
|
|
3503
|
+
recipientAddress: address,
|
|
3504
|
+
version: version
|
|
3505
|
+
})
|
|
3506
|
+
}
|
|
3507
|
+
}]
|
|
3508
|
+
}
|
|
3509
|
+
} : {
|
|
3475
3510
|
DepositAsset: {
|
|
3476
3511
|
assets: {
|
|
3477
3512
|
Wild: 'All'
|
|
@@ -3738,6 +3773,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
3738
3773
|
messageId = _context.v;
|
|
3739
3774
|
customXcm = createCustomXcmOnDest({
|
|
3740
3775
|
api: api,
|
|
3776
|
+
destination: to,
|
|
3741
3777
|
address: address,
|
|
3742
3778
|
scenario: 'ParaToPara',
|
|
3743
3779
|
senderAddress: senderAddress,
|
|
@@ -4796,7 +4832,8 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4796
4832
|
};
|
|
4797
4833
|
}();
|
|
4798
4834
|
|
|
4799
|
-
var getFailureInfo$1 = function getFailureInfo(results) {
|
|
4835
|
+
var getFailureInfo$1 = function getFailureInfo(results, hops) {
|
|
4836
|
+
// Check standard chains first for backwards compatibility
|
|
4800
4837
|
for (var _i = 0, _arr = ['destination', 'assetHub', 'bridgeHub']; _i < _arr.length; _i++) {
|
|
4801
4838
|
var chain = _arr[_i];
|
|
4802
4839
|
var res = results[chain];
|
|
@@ -4807,17 +4844,34 @@ var getFailureInfo$1 = function getFailureInfo(results) {
|
|
|
4807
4844
|
};
|
|
4808
4845
|
}
|
|
4809
4846
|
}
|
|
4847
|
+
var _iterator = _createForOfIteratorHelper(hops),
|
|
4848
|
+
_step;
|
|
4849
|
+
try {
|
|
4850
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
4851
|
+
var hop = _step.value;
|
|
4852
|
+
if (!hop.result.success && hop.result.failureReason) {
|
|
4853
|
+
return {
|
|
4854
|
+
failureReason: hop.result.failureReason,
|
|
4855
|
+
failureChain: hop.node
|
|
4856
|
+
};
|
|
4857
|
+
}
|
|
4858
|
+
}
|
|
4859
|
+
} catch (err) {
|
|
4860
|
+
_iterator.e(err);
|
|
4861
|
+
} finally {
|
|
4862
|
+
_iterator.f();
|
|
4863
|
+
}
|
|
4810
4864
|
return {};
|
|
4811
4865
|
};
|
|
4812
4866
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
4813
4867
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
4814
4868
|
var _intermediateFees$bri, _intermediateFees$ass, _processedBridgeHubDa, _destinationDryRun;
|
|
4815
|
-
var origin, destination, currency, api, tx, senderAddress, feeAsset, resolvedFeeAsset, asset, originDryRun, initialForwardedXcms, initialDestParaId, assetHubNode, bridgeHubNode, currentOrigin, forwardedXcms, nextParaId, intermediateFees, destinationDryRun, nextChain, hopApi, hopDryRun, newXcms, destParaId, processedBridgeHubData, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, _getFailureInfo, failureReason, failureChain;
|
|
4869
|
+
var origin, destination, currency, api, tx, senderAddress, feeAsset, resolvedFeeAsset, asset, originDryRun, initialForwardedXcms, initialDestParaId, assetHubNode, bridgeHubNode, currentOrigin, forwardedXcms, nextParaId, intermediateFees, hops, destinationDryRun, nextChain, hopApi, hopDryRun, hopCurrency, newXcms, destParaId, processedBridgeHubData, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, bridgeHubHopIndex, _getFailureInfo, failureReason, failureChain;
|
|
4816
4870
|
return _regenerator().w(function (_context) {
|
|
4817
4871
|
while (1) switch (_context.n) {
|
|
4818
4872
|
case 0:
|
|
4819
4873
|
origin = options.origin, destination = options.destination, currency = options.currency, api = options.api, tx = options.tx, senderAddress = options.senderAddress, feeAsset = options.feeAsset;
|
|
4820
|
-
resolvedFeeAsset = feeAsset
|
|
4874
|
+
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, origin, destination, currency) : undefined;
|
|
4821
4875
|
asset = assets.findAssetForNodeOrThrow(origin, currency, destination);
|
|
4822
4876
|
_context.n = 1;
|
|
4823
4877
|
return api.getDryRunCall({
|
|
@@ -4836,7 +4890,8 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
4836
4890
|
return _context.a(2, {
|
|
4837
4891
|
failureReason: originDryRun.failureReason,
|
|
4838
4892
|
failureChain: 'origin',
|
|
4839
|
-
origin: originDryRun
|
|
4893
|
+
origin: originDryRun,
|
|
4894
|
+
hops: []
|
|
4840
4895
|
});
|
|
4841
4896
|
case 2:
|
|
4842
4897
|
initialForwardedXcms = originDryRun.forwardedXcms, initialDestParaId = originDryRun.destParaId;
|
|
@@ -4846,6 +4901,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
4846
4901
|
forwardedXcms = initialForwardedXcms;
|
|
4847
4902
|
nextParaId = initialDestParaId;
|
|
4848
4903
|
intermediateFees = {};
|
|
4904
|
+
hops = [];
|
|
4849
4905
|
case 3:
|
|
4850
4906
|
if (!(Array.isArray(forwardedXcms) && forwardedXcms.length && forwardedXcms[1].length && ('disconnect' in api.getApi() ? Object.values(forwardedXcms[1][0]).length : forwardedXcms[1][0].value.length) > 0 && nextParaId !== undefined)) {
|
|
4851
4907
|
_context.n = 13;
|
|
@@ -4888,6 +4944,23 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
4888
4944
|
});
|
|
4889
4945
|
case 8:
|
|
4890
4946
|
hopDryRun = _context.v;
|
|
4947
|
+
// Determine the currency for this hop
|
|
4948
|
+
hopCurrency = void 0;
|
|
4949
|
+
if (nextChain === destination) {
|
|
4950
|
+
hopCurrency = asset === null || asset === void 0 ? void 0 : asset.symbol;
|
|
4951
|
+
} else if (sdkCommon.isRelayChain(nextChain) || nextChain === assetHubNode || nextChain === bridgeHubNode) {
|
|
4952
|
+
hopCurrency = resolvedFeeAsset ? resolvedFeeAsset.symbol : assets.getNativeAssetSymbol(nextChain);
|
|
4953
|
+
}
|
|
4954
|
+
// Add to hops array (only if not the destination)
|
|
4955
|
+
if (nextChain !== destination) {
|
|
4956
|
+
hops.push({
|
|
4957
|
+
node: nextChain,
|
|
4958
|
+
result: hopDryRun.success && hopCurrency ? _objectSpread2(_objectSpread2({}, hopDryRun), {}, {
|
|
4959
|
+
currency: hopCurrency
|
|
4960
|
+
}) : hopDryRun
|
|
4961
|
+
});
|
|
4962
|
+
}
|
|
4963
|
+
// Keep existing logic for backwards compatibility
|
|
4891
4964
|
if (nextChain === destination || sdkCommon.isRelayChain(nextChain) && !sdkCommon.isRelayChain(destination)) {
|
|
4892
4965
|
destinationDryRun = hopDryRun;
|
|
4893
4966
|
} else if (nextChain === assetHubNode) {
|
|
@@ -4933,12 +5006,21 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
4933
5006
|
processedBridgeHubData = _objectSpread2(_objectSpread2({}, intermediateFees.bridgeHub), {}, {
|
|
4934
5007
|
fee: intermediateFees.bridgeHub.fee + bridgeFee
|
|
4935
5008
|
});
|
|
5009
|
+
// Update the hop data if BridgeHub is in the hops array
|
|
5010
|
+
bridgeHubHopIndex = hops.findIndex(function (hop) {
|
|
5011
|
+
return hop.node === bridgeHubNode;
|
|
5012
|
+
});
|
|
5013
|
+
if (bridgeHubHopIndex !== -1 && hops[bridgeHubHopIndex].result.success) {
|
|
5014
|
+
hops[bridgeHubHopIndex].result = _objectSpread2(_objectSpread2({}, hops[bridgeHubHopIndex].result), {}, {
|
|
5015
|
+
fee: intermediateFees.bridgeHub.fee + bridgeFee
|
|
5016
|
+
});
|
|
5017
|
+
}
|
|
4936
5018
|
case 16:
|
|
4937
5019
|
_getFailureInfo = getFailureInfo$1({
|
|
4938
5020
|
destination: destinationDryRun,
|
|
4939
5021
|
assetHub: intermediateFees.assetHub,
|
|
4940
5022
|
bridgeHub: intermediateFees.bridgeHub
|
|
4941
|
-
}), failureReason = _getFailureInfo.failureReason, failureChain = _getFailureInfo.failureChain;
|
|
5023
|
+
}, hops), failureReason = _getFailureInfo.failureReason, failureChain = _getFailureInfo.failureChain;
|
|
4942
5024
|
return _context.a(2, {
|
|
4943
5025
|
failureReason: failureReason,
|
|
4944
5026
|
failureChain: failureChain,
|
|
@@ -4946,14 +5028,15 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
4946
5028
|
currency: resolvedFeeAsset ? resolvedFeeAsset.symbol : assets.getNativeAssetSymbol(origin)
|
|
4947
5029
|
}) : originDryRun,
|
|
4948
5030
|
assetHub: (_intermediateFees$ass = intermediateFees.assetHub) !== null && _intermediateFees$ass !== void 0 && _intermediateFees$ass.success ? _objectSpread2(_objectSpread2({}, intermediateFees.assetHub), {}, {
|
|
4949
|
-
currency: assets.getNativeAssetSymbol(assetHubNode)
|
|
5031
|
+
currency: resolvedFeeAsset ? resolvedFeeAsset.symbol : assets.getNativeAssetSymbol(assetHubNode)
|
|
4950
5032
|
}) : intermediateFees.assetHub,
|
|
4951
5033
|
bridgeHub: (_processedBridgeHubDa = processedBridgeHubData) !== null && _processedBridgeHubDa !== void 0 && _processedBridgeHubDa.success ? _objectSpread2(_objectSpread2({}, processedBridgeHubData), {}, {
|
|
4952
5034
|
currency: assets.getNativeAssetSymbol(bridgeHubNode)
|
|
4953
5035
|
}) : processedBridgeHubData,
|
|
4954
5036
|
destination: (_destinationDryRun = destinationDryRun) !== null && _destinationDryRun !== void 0 && _destinationDryRun.success ? _objectSpread2(_objectSpread2({}, destinationDryRun), {}, {
|
|
4955
5037
|
currency: asset === null || asset === void 0 ? void 0 : asset.symbol
|
|
4956
|
-
}) : destinationDryRun
|
|
5038
|
+
}) : destinationDryRun,
|
|
5039
|
+
hops: hops // Add the hops array to the return value
|
|
4957
5040
|
});
|
|
4958
5041
|
}
|
|
4959
5042
|
}, _callee, null, [[5,, 10, 12]]);
|
|
@@ -5258,7 +5341,7 @@ var validateDestination = function validateDestination(origin, destination) {
|
|
|
5258
5341
|
if (sdkCommon.isRelayChain(origin) && !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination) && origin !== destination) {
|
|
5259
5342
|
throw new IncompatibleNodesError('Direct relay chain to relay chain transfers are not supported. Please use Polkadot <-> Kusama bridge through AssetHub.');
|
|
5260
5343
|
}
|
|
5261
|
-
var allowedChainsToEthereum = ['AssetHubPolkadot', 'Hydration', 'BifrostPolkadot', 'Moonbeam'];
|
|
5344
|
+
var allowedChainsToEthereum = ['AssetHubPolkadot', 'Hydration', 'BifrostPolkadot', 'Moonbeam', 'Mythos'];
|
|
5262
5345
|
if (destination === 'Ethereum' && !allowedChainsToEthereum.includes(origin)) {
|
|
5263
5346
|
throw new IncompatibleNodesError("Transfers to Ethereum are only supported from: ".concat(allowedChainsToEthereum.join(', ')));
|
|
5264
5347
|
}
|
|
@@ -5850,13 +5933,14 @@ var send = /*#__PURE__*/function () {
|
|
|
5850
5933
|
});
|
|
5851
5934
|
finalVersion = selectXcmVersion(version, originVersion, destVersion);
|
|
5852
5935
|
normalizedAsset = finalAsset.multiLocation ? _objectSpread2(_objectSpread2({}, finalAsset), {}, {
|
|
5853
|
-
|
|
5936
|
+
multiLocation: assets.normalizeMultiLocation(finalAsset.multiLocation, finalVersion)
|
|
5854
5937
|
}) : finalAsset;
|
|
5855
5938
|
return _context.a(2, getNode(origin).transfer({
|
|
5856
5939
|
api: api,
|
|
5857
5940
|
asset: normalizedAsset,
|
|
5858
5941
|
currency: currency,
|
|
5859
5942
|
feeAsset: resolvedFeeAsset,
|
|
5943
|
+
feeCurrency: feeAsset,
|
|
5860
5944
|
address: address,
|
|
5861
5945
|
to: destination,
|
|
5862
5946
|
paraIdTo: paraIdTo,
|
|
@@ -5923,11 +6007,11 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5923
6007
|
key: "transfer",
|
|
5924
6008
|
value: function () {
|
|
5925
6009
|
var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
5926
|
-
var api, asset, currency, feeAsset, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, isRelayDestination, scenario, paraId, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
|
|
6010
|
+
var api, asset, currency, feeAsset, feeCurrency, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, isRelayDestination, scenario, paraId, isLocalTransfer, isBifrostOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
|
|
5927
6011
|
return _regenerator().w(function (_context) {
|
|
5928
6012
|
while (1) switch (_context.n) {
|
|
5929
6013
|
case 0:
|
|
5930
|
-
api = options.api, asset = options.asset, currency = options.currency, feeAsset = options.feeAsset, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
|
|
6014
|
+
api = options.api, asset = options.asset, currency = options.currency, feeAsset = options.feeAsset, feeCurrency = options.feeCurrency, address = options.address, destination = options.to, paraIdTo = options.paraIdTo, overriddenAsset = options.overriddenAsset, version = options.version, senderAddress = options.senderAddress, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method;
|
|
5931
6015
|
isRelayDestination = !sdkCommon.isTMultiLocation(destination) && sdkCommon.isRelayChain(destination);
|
|
5932
6016
|
scenario = isRelayDestination ? 'ParaToRelay' : 'ParaToPara';
|
|
5933
6017
|
paraId = resolveParaId(paraIdTo, destination);
|
|
@@ -5963,7 +6047,6 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
5963
6047
|
version: version,
|
|
5964
6048
|
paraId: paraId
|
|
5965
6049
|
}),
|
|
5966
|
-
fees: getFees(scenario),
|
|
5967
6050
|
origin: this.node,
|
|
5968
6051
|
scenario: scenario,
|
|
5969
6052
|
paraIdTo: paraId,
|
|
@@ -6019,6 +6102,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6019
6102
|
asset: asset,
|
|
6020
6103
|
currency: currency,
|
|
6021
6104
|
feeAsset: feeAsset,
|
|
6105
|
+
feeCurrency: feeCurrency,
|
|
6022
6106
|
scenario: scenario,
|
|
6023
6107
|
destination: destination,
|
|
6024
6108
|
paraIdTo: paraId,
|
|
@@ -6032,13 +6116,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6032
6116
|
isAHPOrigin = this.node === 'AssetHubPolkadot' || this.node === 'AssetHubKusama';
|
|
6033
6117
|
isAHPDest = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
|
|
6034
6118
|
isEthDest = destination === 'Ethereum'; // Eth asset - Any origin to any dest via AH - DestinationReserve - multiple instructions
|
|
6035
|
-
if (!(isEthAsset && !isAHPOrigin && !isAHPDest && !isEthDest)) {
|
|
6119
|
+
if (!(isEthAsset && !isAHPOrigin && !isAHPDest && !isEthDest && !feeAsset)) {
|
|
6036
6120
|
_context.n = 6;
|
|
6037
6121
|
break;
|
|
6038
6122
|
}
|
|
6039
6123
|
return _context.a(2, this.transferEthAssetViaAH(_options));
|
|
6040
6124
|
case 6:
|
|
6041
|
-
if (!(isEthAsset && isAHPDest && !isAHPOrigin && !isEthDest)) {
|
|
6125
|
+
if (!(isEthAsset && isAHPDest && !isAHPOrigin && !isEthDest && !feeAsset)) {
|
|
6042
6126
|
_context.n = 7;
|
|
6043
6127
|
break;
|
|
6044
6128
|
}
|
|
@@ -6164,41 +6248,36 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6164
6248
|
while (1) switch (_context2.n) {
|
|
6165
6249
|
case 0:
|
|
6166
6250
|
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;
|
|
6167
|
-
|
|
6168
|
-
_context2.n = 1;
|
|
6169
|
-
break;
|
|
6170
|
-
}
|
|
6171
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6172
|
-
case 1:
|
|
6251
|
+
assertHasLocation(asset);
|
|
6173
6252
|
if (!(senderAddress === undefined)) {
|
|
6174
|
-
_context2.n =
|
|
6253
|
+
_context2.n = 1;
|
|
6175
6254
|
break;
|
|
6176
6255
|
}
|
|
6177
6256
|
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6178
|
-
case
|
|
6257
|
+
case 1:
|
|
6179
6258
|
if (!sdkCommon.isTMultiLocation(address)) {
|
|
6180
|
-
_context2.n =
|
|
6259
|
+
_context2.n = 2;
|
|
6181
6260
|
break;
|
|
6182
6261
|
}
|
|
6183
6262
|
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
6184
|
-
case
|
|
6263
|
+
case 2:
|
|
6185
6264
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
6186
6265
|
PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
|
|
6187
6266
|
// Pad by 25%
|
|
6188
6267
|
AH_EXECUTION_FEE_PADDED = ASSET_HUB_EXECUTION_FEE * 125n / 100n; // Perform a dry run AH -> dest to calculate the BuyExecution amount
|
|
6189
|
-
_context2.n =
|
|
6268
|
+
_context2.n = 3;
|
|
6190
6269
|
return Builder(api.clone()).from('AssetHubPolkadot').to(destination).currency({
|
|
6191
6270
|
symbol: 'DOT',
|
|
6192
6271
|
amount: AH_EXECUTION_FEE_PADDED
|
|
6193
6272
|
}).address(address).senderAddress(senderAddress).dryRun();
|
|
6194
|
-
case
|
|
6273
|
+
case 3:
|
|
6195
6274
|
dryRunResult = _context2.v;
|
|
6196
6275
|
if (dryRunResult.origin.success) {
|
|
6197
|
-
_context2.n =
|
|
6276
|
+
_context2.n = 4;
|
|
6198
6277
|
break;
|
|
6199
6278
|
}
|
|
6200
6279
|
throw new DryRunFailedError(dryRunResult.origin.failureReason);
|
|
6201
|
-
case
|
|
6280
|
+
case 4:
|
|
6202
6281
|
// Pad fee by 50%
|
|
6203
6282
|
dryRunFeePadded = BigInt(dryRunResult.origin.fee) * 3n / 2n;
|
|
6204
6283
|
dest = createDestination(scenario, version, destination, paraIdTo);
|
|
@@ -6313,32 +6392,27 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6313
6392
|
}
|
|
6314
6393
|
throw new BridgeHaltedError();
|
|
6315
6394
|
case 2:
|
|
6316
|
-
|
|
6317
|
-
_context3.n = 3;
|
|
6318
|
-
break;
|
|
6319
|
-
}
|
|
6320
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6321
|
-
case 3:
|
|
6395
|
+
assertHasLocation(asset);
|
|
6322
6396
|
if (!(senderAddress === undefined)) {
|
|
6323
|
-
_context3.n =
|
|
6397
|
+
_context3.n = 3;
|
|
6324
6398
|
break;
|
|
6325
6399
|
}
|
|
6326
6400
|
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6327
|
-
case
|
|
6401
|
+
case 3:
|
|
6328
6402
|
if (!sdkCommon.isTMultiLocation(address)) {
|
|
6329
|
-
_context3.n =
|
|
6403
|
+
_context3.n = 4;
|
|
6330
6404
|
break;
|
|
6331
6405
|
}
|
|
6332
6406
|
throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
|
|
6333
|
-
case
|
|
6407
|
+
case 4:
|
|
6334
6408
|
ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
|
|
6335
|
-
_context3.n =
|
|
6409
|
+
_context3.n = 5;
|
|
6336
6410
|
return api.createApiForNode('AssetHubPolkadot');
|
|
6337
|
-
case
|
|
6411
|
+
case 5:
|
|
6338
6412
|
ahApi = _context3.v;
|
|
6339
|
-
_context3.n =
|
|
6413
|
+
_context3.n = 6;
|
|
6340
6414
|
return getParaEthTransferFees(ahApi);
|
|
6341
|
-
case
|
|
6415
|
+
case 6:
|
|
6342
6416
|
_yield$getParaEthTran = _context3.v;
|
|
6343
6417
|
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
6344
6418
|
bridgeFee = _yield$getParaEthTran2[0];
|
|
@@ -6347,13 +6421,13 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6347
6421
|
fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : (bridgeFee + executionFee).toString();
|
|
6348
6422
|
ethAsset = assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
|
|
6349
6423
|
if (ethAsset) {
|
|
6350
|
-
_context3.n =
|
|
6424
|
+
_context3.n = 7;
|
|
6351
6425
|
break;
|
|
6352
6426
|
}
|
|
6353
6427
|
throw new assets.InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(asset)));
|
|
6354
|
-
case
|
|
6428
|
+
case 7:
|
|
6355
6429
|
if (!useOnlyDepositInstruction) {
|
|
6356
|
-
_context3.n =
|
|
6430
|
+
_context3.n = 8;
|
|
6357
6431
|
break;
|
|
6358
6432
|
}
|
|
6359
6433
|
customXcmOnDest = addXcmVersionHeader([{
|
|
@@ -6372,21 +6446,21 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
6372
6446
|
})
|
|
6373
6447
|
}
|
|
6374
6448
|
}], version);
|
|
6375
|
-
_context3.n =
|
|
6449
|
+
_context3.n = 11;
|
|
6376
6450
|
break;
|
|
6377
|
-
case
|
|
6451
|
+
case 8:
|
|
6378
6452
|
if (ethAsset.assetId) {
|
|
6379
|
-
_context3.n =
|
|
6453
|
+
_context3.n = 9;
|
|
6380
6454
|
break;
|
|
6381
6455
|
}
|
|
6382
6456
|
throw new assets.InvalidCurrencyError("Ethereum asset ".concat(JSON.stringify(ethAsset), " has no assetId"));
|
|
6383
|
-
case
|
|
6384
|
-
_context3.n =
|
|
6457
|
+
case 9:
|
|
6458
|
+
_context3.n = 10;
|
|
6385
6459
|
return generateMessageId(api, senderAddress, getParaId(this.node), ethAsset.assetId, address, asset.amount);
|
|
6386
|
-
case
|
|
6460
|
+
case 10:
|
|
6387
6461
|
messageId = _context3.v;
|
|
6388
6462
|
customXcmOnDest = createCustomXcmOnDest(input, this.node, messageId);
|
|
6389
|
-
case
|
|
6463
|
+
case 11:
|
|
6390
6464
|
call = {
|
|
6391
6465
|
module: 'PolkadotXcm',
|
|
6392
6466
|
method: 'transfer_assets_using_type_and_then',
|
|
@@ -6722,10 +6796,8 @@ var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, weight,
|
|
|
6722
6796
|
version: version,
|
|
6723
6797
|
paraId: paraIdTo
|
|
6724
6798
|
});
|
|
6725
|
-
|
|
6726
|
-
|
|
6727
|
-
}
|
|
6728
|
-
var transformedMultiLocation = transformMultiLocation(asset.multiLocation);
|
|
6799
|
+
assertHasLocation(asset);
|
|
6800
|
+
var transformedMultiLocation = localizeLocation('AssetHubPolkadot', asset.multiLocation);
|
|
6729
6801
|
var call = {
|
|
6730
6802
|
module: 'PolkadotXcm',
|
|
6731
6803
|
method: 'execute',
|
|
@@ -6801,8 +6873,97 @@ var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, weight,
|
|
|
6801
6873
|
return api.callTxMethod(call);
|
|
6802
6874
|
};
|
|
6803
6875
|
|
|
6804
|
-
var
|
|
6805
|
-
var
|
|
6876
|
+
var getReserveParaId = function getReserveParaId(assetLocation) {
|
|
6877
|
+
var hasParaJunction = sdkCommon.hasJunction(assetLocation, 'Parachain');
|
|
6878
|
+
var hasGlobalConsensusJunction = sdkCommon.hasJunction(assetLocation, 'GlobalConsensus');
|
|
6879
|
+
if (hasParaJunction) {
|
|
6880
|
+
return sdkCommon.getJunctionValue(assetLocation, 'Parachain');
|
|
6881
|
+
}
|
|
6882
|
+
if (hasGlobalConsensusJunction) {
|
|
6883
|
+
return getParaId('AssetHubPolkadot');
|
|
6884
|
+
}
|
|
6885
|
+
if (sdkCommon.deepEqual(assetLocation, {
|
|
6886
|
+
parents: sdkCommon.Parents.ONE,
|
|
6887
|
+
interior: {
|
|
6888
|
+
Here: null
|
|
6889
|
+
}
|
|
6890
|
+
})) {
|
|
6891
|
+
return getParaId('Polkadot');
|
|
6892
|
+
}
|
|
6893
|
+
};
|
|
6894
|
+
var isOnReserveChain = function isOnReserveChain(node, reserveParaId) {
|
|
6895
|
+
if (reserveParaId === undefined) return false;
|
|
6896
|
+
var currentParaId = getParaId(node);
|
|
6897
|
+
return currentParaId === reserveParaId;
|
|
6898
|
+
};
|
|
6899
|
+
var getChainLocation = function getChainLocation(paraId) {
|
|
6900
|
+
var interior = paraId === getParaId('Polkadot') ? 'Here' : {
|
|
6901
|
+
X1: [{
|
|
6902
|
+
Parachain: paraId
|
|
6903
|
+
}]
|
|
6904
|
+
};
|
|
6905
|
+
return {
|
|
6906
|
+
parents: sdkCommon.Parents.ONE,
|
|
6907
|
+
interior: interior
|
|
6908
|
+
};
|
|
6909
|
+
};
|
|
6910
|
+
var createAssetsFilter = function createAssetsFilter(asset, feeAsset) {
|
|
6911
|
+
return !feeAsset ?
|
|
6912
|
+
// For same fee asset, deposit only this one asset
|
|
6913
|
+
{
|
|
6914
|
+
Wild: {
|
|
6915
|
+
AllCounted: 1
|
|
6916
|
+
}
|
|
6917
|
+
} :
|
|
6918
|
+
// For different fee asset, specify which one to deposit by location and amount
|
|
6919
|
+
{
|
|
6920
|
+
Definite: [asset]
|
|
6921
|
+
};
|
|
6922
|
+
};
|
|
6923
|
+
var sortMultiAssets = function sortMultiAssets(assets$1) {
|
|
6924
|
+
return assets$1.sort(function (a, b) {
|
|
6925
|
+
var aLoc = assets.extractMultiAssetLoc(a);
|
|
6926
|
+
var bLoc = assets.extractMultiAssetLoc(b);
|
|
6927
|
+
var aIsHere = isHere(aLoc);
|
|
6928
|
+
var bIsHere = isHere(bLoc);
|
|
6929
|
+
var aHasGlobal = sdkCommon.hasJunction(aLoc, 'GlobalConsensus');
|
|
6930
|
+
var bHasGlobal = sdkCommon.hasJunction(bLoc, 'GlobalConsensus');
|
|
6931
|
+
var aGeneralIndex = sdkCommon.getJunctionValue(aLoc, 'GeneralIndex');
|
|
6932
|
+
var bGeneralIndex = sdkCommon.getJunctionValue(bLoc, 'GeneralIndex');
|
|
6933
|
+
var getPriority = function getPriority(isHere, hasGlobal) {
|
|
6934
|
+
if (isHere) return 0;
|
|
6935
|
+
if (hasGlobal) return 2;
|
|
6936
|
+
return 1;
|
|
6937
|
+
};
|
|
6938
|
+
var aPriority = getPriority(aIsHere, aHasGlobal);
|
|
6939
|
+
var bPriority = getPriority(bIsHere, bHasGlobal);
|
|
6940
|
+
if (aPriority !== bPriority) return aPriority - bPriority;
|
|
6941
|
+
if (aGeneralIndex === undefined && bGeneralIndex === undefined) return 0;
|
|
6942
|
+
if (aGeneralIndex === undefined) return 1;
|
|
6943
|
+
if (bGeneralIndex === undefined) return -1;
|
|
6944
|
+
return aGeneralIndex - bGeneralIndex;
|
|
6945
|
+
});
|
|
6946
|
+
};
|
|
6947
|
+
function isHere(loc) {
|
|
6948
|
+
var _loc$interior;
|
|
6949
|
+
return loc.interior === 'Here' || ((_loc$interior = loc.interior) === null || _loc$interior === void 0 ? void 0 : _loc$interior.Here) !== undefined;
|
|
6950
|
+
}
|
|
6951
|
+
var updateAsset = function updateAsset(asset, amount) {
|
|
6952
|
+
return _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
6953
|
+
fun: {
|
|
6954
|
+
Fungible: amount
|
|
6955
|
+
}
|
|
6956
|
+
});
|
|
6957
|
+
};
|
|
6958
|
+
var createWithdrawAssets = function createWithdrawAssets(asset, feeAsset) {
|
|
6959
|
+
var assetsToWithdraw = [asset];
|
|
6960
|
+
if (feeAsset) {
|
|
6961
|
+
assetsToWithdraw.push(feeAsset);
|
|
6962
|
+
}
|
|
6963
|
+
return sortMultiAssets(assetsToWithdraw);
|
|
6964
|
+
};
|
|
6965
|
+
var createExecuteXcm = function createExecuteXcm(node, input, executionFee, hopExecutionFee, version) {
|
|
6966
|
+
var _ref;
|
|
6806
6967
|
var api = input.api,
|
|
6807
6968
|
asset = input.asset,
|
|
6808
6969
|
scenario = input.scenario,
|
|
@@ -6810,6 +6971,7 @@ var createExecuteXcm = function createExecuteXcm(input, executionFee, version) {
|
|
|
6810
6971
|
paraIdTo = input.paraIdTo,
|
|
6811
6972
|
address = input.address,
|
|
6812
6973
|
feeAsset = input.feeAsset;
|
|
6974
|
+
var amount = BigInt(asset.amount);
|
|
6813
6975
|
var dest = createDestination(scenario, version, destination, paraIdTo);
|
|
6814
6976
|
var beneficiary = createBeneficiary({
|
|
6815
6977
|
api: api,
|
|
@@ -6819,78 +6981,36 @@ var createExecuteXcm = function createExecuteXcm(input, executionFee, version) {
|
|
|
6819
6981
|
version: version,
|
|
6820
6982
|
paraId: paraIdTo
|
|
6821
6983
|
});
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6825
|
-
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
var
|
|
6829
|
-
var
|
|
6830
|
-
var
|
|
6831
|
-
var
|
|
6832
|
-
var
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
multiasset: {
|
|
6845
|
-
id: feeML,
|
|
6846
|
-
fun: {
|
|
6847
|
-
Fungible: executionFee
|
|
6848
|
-
}
|
|
6849
|
-
}
|
|
6850
|
-
});
|
|
6851
|
-
}
|
|
6852
|
-
assetsToWithdraw.sort(function (a, b) {
|
|
6853
|
-
return a.assetId > b.assetId ? 1 : -1;
|
|
6854
|
-
});
|
|
6855
|
-
var xcm = [{
|
|
6856
|
-
WithdrawAsset: assetsToWithdraw.map(function (_ref) {
|
|
6857
|
-
var multiasset = _ref.multiasset;
|
|
6858
|
-
return multiasset;
|
|
6859
|
-
})
|
|
6860
|
-
}, {
|
|
6861
|
-
BuyExecution: {
|
|
6862
|
-
fees: {
|
|
6863
|
-
id: feeML,
|
|
6864
|
-
fun: {
|
|
6865
|
-
Fungible: executionFee
|
|
6866
|
-
}
|
|
6867
|
-
},
|
|
6868
|
-
weight_limit: {
|
|
6869
|
-
Limited: {
|
|
6870
|
-
ref_time: 150n,
|
|
6871
|
-
proof_size: 0n
|
|
6872
|
-
}
|
|
6873
|
-
}
|
|
6984
|
+
assertHasLocation(asset);
|
|
6985
|
+
if (feeAsset) {
|
|
6986
|
+
assertHasLocation(feeAsset);
|
|
6987
|
+
}
|
|
6988
|
+
var reserveParaId = getReserveParaId(asset.multiLocation);
|
|
6989
|
+
var reserveChain = reserveParaId !== undefined ? getTNode(reserveParaId, determineRelayChain(node) === 'Polkadot' ? 'polkadot' : 'kusama') : undefined;
|
|
6990
|
+
var isReserveDest = reserveParaId === paraIdTo;
|
|
6991
|
+
var multiAsset = createMultiAsset(version, amount, asset.multiLocation);
|
|
6992
|
+
var multiAssetLocalized = createMultiAsset(version, amount, localizeLocation(node, asset.multiLocation));
|
|
6993
|
+
var multiAssetLocalizedToReserve = createMultiAsset(version, amount, localizeLocation(reserveChain !== null && reserveChain !== void 0 ? reserveChain : node, asset.multiLocation));
|
|
6994
|
+
var feeMultiAsset = feeAsset && !assets.isAssetEqual(asset, feeAsset) ? createMultiAsset(version, executionFee, feeAsset.multiLocation) : undefined;
|
|
6995
|
+
var feeMultiAssetLocalized = feeAsset && !assets.isAssetEqual(asset, feeAsset) ? createMultiAsset(version, executionFee, localizeLocation(node, feeAsset.multiLocation)) : undefined;
|
|
6996
|
+
var feeMultiAssetLocalizedToReserve = feeAsset && !assets.isAssetEqual(asset, feeAsset) ? createMultiAsset(version, executionFee, localizeLocation(reserveChain !== null && reserveChain !== void 0 ? reserveChain : node, feeAsset.multiLocation)) : undefined;
|
|
6997
|
+
var withdrawAssets = createWithdrawAssets(node === 'AssetHubPolkadot' ? multiAssetLocalized : multiAsset, node === 'AssetHubPolkadot' ? feeMultiAssetLocalized : feeMultiAsset);
|
|
6998
|
+
var assetsFilter = createAssetsFilter(multiAsset, feeMultiAsset);
|
|
6999
|
+
if (node !== 'AssetHubPolkadot' && reserveParaId === undefined) {
|
|
7000
|
+
throw new InvalidParameterError('Sending local reserve assets with custom fee asset is not yet supported for this chain.');
|
|
7001
|
+
}
|
|
7002
|
+
var depositInstruction = isReserveDest ? {
|
|
7003
|
+
DepositAsset: {
|
|
7004
|
+
assets: createAssetsFilter(multiAssetLocalizedToReserve, feeMultiAssetLocalizedToReserve),
|
|
7005
|
+
beneficiary: beneficiary
|
|
6874
7006
|
}
|
|
6875
|
-
}
|
|
7007
|
+
} : {
|
|
6876
7008
|
DepositReserveAsset: {
|
|
6877
|
-
assets:
|
|
6878
|
-
Definite: [{
|
|
6879
|
-
id: assetML,
|
|
6880
|
-
fun: {
|
|
6881
|
-
Fungible: sameFeeAsset ? amountWithoutFee : BigInt(asset.amount)
|
|
6882
|
-
}
|
|
6883
|
-
}]
|
|
6884
|
-
},
|
|
7009
|
+
assets: createAssetsFilter(multiAssetLocalized, feeMultiAssetLocalized),
|
|
6885
7010
|
dest: dest,
|
|
6886
7011
|
xcm: [{
|
|
6887
7012
|
BuyExecution: {
|
|
6888
|
-
fees:
|
|
6889
|
-
id: asset.multiLocation,
|
|
6890
|
-
fun: {
|
|
6891
|
-
Fungible: sameFeeAsset ? amountWithoutFee - executionFee : BigInt(asset.amount)
|
|
6892
|
-
}
|
|
6893
|
-
},
|
|
7013
|
+
fees: updateAsset(multiAsset, amount - (feeMultiAsset ? hopExecutionFee : executionFee + hopExecutionFee)),
|
|
6894
7014
|
weight_limit: 'Unlimited'
|
|
6895
7015
|
}
|
|
6896
7016
|
}, {
|
|
@@ -6904,10 +7024,149 @@ var createExecuteXcm = function createExecuteXcm(input, executionFee, version) {
|
|
|
6904
7024
|
}
|
|
6905
7025
|
}]
|
|
6906
7026
|
}
|
|
6907
|
-
}
|
|
7027
|
+
};
|
|
7028
|
+
var needsIntermediaryReserve = reserveParaId !== undefined &&
|
|
7029
|
+
// Has a reserve
|
|
7030
|
+
!isOnReserveChain(node, reserveParaId); // Not on reserve
|
|
7031
|
+
var lastInstruction = needsIntermediaryReserve ? {
|
|
7032
|
+
InitiateReserveWithdraw: {
|
|
7033
|
+
assets: assetsFilter,
|
|
7034
|
+
reserve: getChainLocation(reserveParaId),
|
|
7035
|
+
xcm: [{
|
|
7036
|
+
BuyExecution: {
|
|
7037
|
+
fees:
|
|
7038
|
+
// Decrease amount by 2 units becuase for some reason polkadot withdraws 2 units less
|
|
7039
|
+
// than requested, so we need to account for that
|
|
7040
|
+
updateAsset(multiAssetLocalizedToReserve, amount - 2n),
|
|
7041
|
+
weight_limit: 'Unlimited'
|
|
7042
|
+
}
|
|
7043
|
+
}, depositInstruction]
|
|
7044
|
+
}
|
|
7045
|
+
} : depositInstruction;
|
|
7046
|
+
var xcm = [{
|
|
7047
|
+
WithdrawAsset: withdrawAssets
|
|
7048
|
+
}, {
|
|
7049
|
+
BuyExecution: {
|
|
7050
|
+
fees: (_ref = node === 'AssetHubPolkadot' ? feeMultiAssetLocalized : feeMultiAsset) !== null && _ref !== void 0 ? _ref : node === 'AssetHubPolkadot' ? multiAssetLocalized : multiAsset,
|
|
7051
|
+
weight_limit: {
|
|
7052
|
+
Limited: {
|
|
7053
|
+
ref_time: 450n,
|
|
7054
|
+
proof_size: 0n
|
|
7055
|
+
}
|
|
7056
|
+
}
|
|
7057
|
+
}
|
|
7058
|
+
}, lastInstruction];
|
|
6908
7059
|
return addXcmVersionHeader(xcm, version);
|
|
6909
7060
|
};
|
|
6910
7061
|
|
|
7062
|
+
var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
7063
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(node, input) {
|
|
7064
|
+
var api, senderAddress, paraIdTo, asset, currency, feeCurrency, address, feeAsset, version, feeAssetBalance, checkAmount, MIN_FEE, call, destNode, dryRunResult, paddedFee, hopFee, paddedHopFee, xcm, weight, _t;
|
|
7065
|
+
return _regenerator().w(function (_context) {
|
|
7066
|
+
while (1) switch (_context.n) {
|
|
7067
|
+
case 0:
|
|
7068
|
+
api = input.api, senderAddress = input.senderAddress, paraIdTo = input.paraIdTo, asset = input.asset, currency = input.currency, feeCurrency = input.feeCurrency, address = input.address, feeAsset = input.feeAsset, version = input.version;
|
|
7069
|
+
if (senderAddress) {
|
|
7070
|
+
_context.n = 1;
|
|
7071
|
+
break;
|
|
7072
|
+
}
|
|
7073
|
+
throw new InvalidParameterError('Please provide senderAddress');
|
|
7074
|
+
case 1:
|
|
7075
|
+
assertAddressIsString(address);
|
|
7076
|
+
validateAddress(senderAddress, node, false);
|
|
7077
|
+
if (!(feeCurrency && feeAsset && !assets.isAssetEqual(asset, feeAsset))) {
|
|
7078
|
+
_context.n = 3;
|
|
7079
|
+
break;
|
|
7080
|
+
}
|
|
7081
|
+
_context.n = 2;
|
|
7082
|
+
return getAssetBalanceInternal({
|
|
7083
|
+
api: api,
|
|
7084
|
+
address: senderAddress,
|
|
7085
|
+
node: node,
|
|
7086
|
+
currency: feeCurrency
|
|
7087
|
+
});
|
|
7088
|
+
case 2:
|
|
7089
|
+
_t = _context.v;
|
|
7090
|
+
_context.n = 4;
|
|
7091
|
+
break;
|
|
7092
|
+
case 3:
|
|
7093
|
+
_t = undefined;
|
|
7094
|
+
case 4:
|
|
7095
|
+
feeAssetBalance = _t;
|
|
7096
|
+
checkAmount = function checkAmount(fee) {
|
|
7097
|
+
if (BigInt(asset.amount) <= fee) {
|
|
7098
|
+
throw new InvalidParameterError("Asset amount is too low, please increase the amount or use a different fee asset.");
|
|
7099
|
+
}
|
|
7100
|
+
};
|
|
7101
|
+
MIN_FEE = 1000n;
|
|
7102
|
+
checkAmount(MIN_FEE);
|
|
7103
|
+
call = createExecuteCall(createExecuteXcm(node, input, feeAssetBalance && feeAssetBalance > 1n ? feeAssetBalance : MIN_FEE, MIN_FEE, version), MAX_WEIGHT);
|
|
7104
|
+
destNode = getTNode(paraIdTo, determineRelayChain(node) === 'Polkadot' ? 'polkadot' : 'kusama');
|
|
7105
|
+
_context.n = 5;
|
|
7106
|
+
return dryRunInternal({
|
|
7107
|
+
api: api,
|
|
7108
|
+
tx: api.callTxMethod(call),
|
|
7109
|
+
origin: node,
|
|
7110
|
+
destination: destNode,
|
|
7111
|
+
senderAddress: senderAddress,
|
|
7112
|
+
address: address,
|
|
7113
|
+
currency: currency,
|
|
7114
|
+
feeAsset: feeCurrency
|
|
7115
|
+
});
|
|
7116
|
+
case 5:
|
|
7117
|
+
dryRunResult = _context.v;
|
|
7118
|
+
if (dryRunResult.origin.success) {
|
|
7119
|
+
_context.n = 6;
|
|
7120
|
+
break;
|
|
7121
|
+
}
|
|
7122
|
+
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
7123
|
+
case 6:
|
|
7124
|
+
if (!(dryRunResult.assetHub && !dryRunResult.assetHub.success)) {
|
|
7125
|
+
_context.n = 7;
|
|
7126
|
+
break;
|
|
7127
|
+
}
|
|
7128
|
+
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
7129
|
+
case 7:
|
|
7130
|
+
if (!(!dryRunResult.assetHub && dryRunResult.hops)) {
|
|
7131
|
+
_context.n = 9;
|
|
7132
|
+
break;
|
|
7133
|
+
}
|
|
7134
|
+
if (!(dryRunResult.hops.length > 1)) {
|
|
7135
|
+
_context.n = 8;
|
|
7136
|
+
break;
|
|
7137
|
+
}
|
|
7138
|
+
throw new InvalidParameterError("Multiple intermediate hops detected (".concat(dryRunResult.hops.length, "). Only single hop transfers are supported."));
|
|
7139
|
+
case 8:
|
|
7140
|
+
if (!(dryRunResult.hops.length === 1 && !dryRunResult.hops[0].result.success)) {
|
|
7141
|
+
_context.n = 9;
|
|
7142
|
+
break;
|
|
7143
|
+
}
|
|
7144
|
+
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
7145
|
+
case 9:
|
|
7146
|
+
paddedFee = padFeeBy(dryRunResult.origin.fee, 20);
|
|
7147
|
+
if (dryRunResult.assetHub) {
|
|
7148
|
+
hopFee = dryRunResult.assetHub.fee;
|
|
7149
|
+
} else if (dryRunResult.hops && dryRunResult.hops.length === 1 && dryRunResult.hops[0].result.success) {
|
|
7150
|
+
hopFee = dryRunResult.hops[0].result.fee;
|
|
7151
|
+
} else {
|
|
7152
|
+
hopFee = MIN_FEE;
|
|
7153
|
+
}
|
|
7154
|
+
paddedHopFee = padFeeBy(hopFee, 40);
|
|
7155
|
+
checkAmount(feeAsset && !assets.isAssetEqual(asset, feeAsset) ? paddedHopFee : paddedFee + paddedHopFee);
|
|
7156
|
+
xcm = createExecuteXcm(node, input, paddedFee, paddedHopFee, version);
|
|
7157
|
+
_context.n = 10;
|
|
7158
|
+
return api.getXcmWeight(xcm);
|
|
7159
|
+
case 10:
|
|
7160
|
+
weight = _context.v;
|
|
7161
|
+
return _context.a(2, createExecuteCall(xcm, weight));
|
|
7162
|
+
}
|
|
7163
|
+
}, _callee);
|
|
7164
|
+
}));
|
|
7165
|
+
return function handleExecuteTransfer(_x, _x2) {
|
|
7166
|
+
return _ref.apply(this, arguments);
|
|
7167
|
+
};
|
|
7168
|
+
}();
|
|
7169
|
+
|
|
6911
7170
|
var handleToAhTeleport = /*#__PURE__*/function () {
|
|
6912
7171
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(origin, input, defaultTx) {
|
|
6913
7172
|
var _dryRunResult$destina, _feeResult$origin$wei;
|
|
@@ -7017,9 +7276,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7017
7276
|
if (!assets.isForeignAsset(asset)) {
|
|
7018
7277
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
7019
7278
|
}
|
|
7020
|
-
|
|
7021
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
7022
|
-
}
|
|
7279
|
+
assertHasLocation(asset);
|
|
7023
7280
|
var PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
|
|
7024
7281
|
var call = {
|
|
7025
7282
|
module: 'PolkadotXcm',
|
|
@@ -7110,15 +7367,10 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7110
7367
|
}
|
|
7111
7368
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
7112
7369
|
case 5:
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
break;
|
|
7116
|
-
}
|
|
7117
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
7118
|
-
case 6:
|
|
7119
|
-
_context.n = 7;
|
|
7370
|
+
assertHasLocation(asset);
|
|
7371
|
+
_context.n = 6;
|
|
7120
7372
|
return generateMessageId(api, senderAddress, getParaId(this.node), JSON.stringify(asset.multiLocation), address, asset.amount);
|
|
7121
|
-
case
|
|
7373
|
+
case 6:
|
|
7122
7374
|
messageId = _context.v;
|
|
7123
7375
|
multiLocation = asset.symbol === this.getNativeAssetSymbol() ? DOT_MULTILOCATION : asset.multiLocation;
|
|
7124
7376
|
call = {
|
|
@@ -7185,18 +7437,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7185
7437
|
}
|
|
7186
7438
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
7187
7439
|
case 3:
|
|
7188
|
-
|
|
7189
|
-
_context2.n = 4;
|
|
7190
|
-
break;
|
|
7191
|
-
}
|
|
7192
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
7193
|
-
case 4:
|
|
7440
|
+
assertHasLocation(asset);
|
|
7194
7441
|
if (!(asset.symbol === this.getNativeAssetSymbol() || asset.symbol === assets.getNativeAssetSymbol('Kusama'))) {
|
|
7195
|
-
_context2.n =
|
|
7442
|
+
_context2.n = 4;
|
|
7196
7443
|
break;
|
|
7197
7444
|
}
|
|
7198
7445
|
return _context2.a(2, this.handleEthBridgeNativeTransfer(input));
|
|
7199
|
-
case
|
|
7446
|
+
case 4:
|
|
7200
7447
|
modifiedInput = _objectSpread2(_objectSpread2({}, input), {}, {
|
|
7201
7448
|
destLocation: createDestination(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, sdkCommon.Parents.TWO),
|
|
7202
7449
|
beneficiaryLocation: createBeneficiary({
|
|
@@ -7272,154 +7519,94 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7272
7519
|
if (destination === 'Polimec' || destination === 'Moonbeam') return 'transfer_assets';
|
|
7273
7520
|
return scenario === 'ParaToPara' && !isSystemNode ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
7274
7521
|
}
|
|
7275
|
-
}, {
|
|
7276
|
-
key: "handleExecuteTransfer",
|
|
7277
|
-
value: function () {
|
|
7278
|
-
var _handleExecuteTransfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
|
|
7279
|
-
var api, senderAddress, asset, feeAsset, version, decimals, multiplier, base, scaledMultiplier, MIN_FEE, checkAmount, call, dryRunResult, paddedFee, xcm, weight;
|
|
7280
|
-
return _regenerator().w(function (_context3) {
|
|
7281
|
-
while (1) switch (_context3.n) {
|
|
7282
|
-
case 0:
|
|
7283
|
-
api = input.api, senderAddress = input.senderAddress, asset = input.asset, feeAsset = input.feeAsset, version = input.version;
|
|
7284
|
-
if (senderAddress) {
|
|
7285
|
-
_context3.n = 1;
|
|
7286
|
-
break;
|
|
7287
|
-
}
|
|
7288
|
-
throw new InvalidParameterError('Please provide senderAddress');
|
|
7289
|
-
case 1:
|
|
7290
|
-
validateAddress(senderAddress, this.node, false);
|
|
7291
|
-
decimals = asset.decimals;
|
|
7292
|
-
multiplier = decimals > 10 ? 0.4 : 0.15;
|
|
7293
|
-
base = BigInt(Math.pow(10, decimals));
|
|
7294
|
-
scaledMultiplier = BigInt(Math.floor(multiplier * Math.pow(10, decimals)));
|
|
7295
|
-
MIN_FEE = base * scaledMultiplier / BigInt(Math.pow(10, decimals));
|
|
7296
|
-
checkAmount = function checkAmount(fee) {
|
|
7297
|
-
if (feeAsset && assets.isAssetEqual(asset, feeAsset) && BigInt(asset.amount) <= fee * 2n) {
|
|
7298
|
-
throw new InvalidParameterError("Asset amount ".concat(asset.amount, " is too low, please increase the amount or use a different fee asset."));
|
|
7299
|
-
}
|
|
7300
|
-
};
|
|
7301
|
-
checkAmount(MIN_FEE);
|
|
7302
|
-
call = createExecuteCall(createExecuteXcm(input, MIN_FEE, version), MAX_WEIGHT);
|
|
7303
|
-
_context3.n = 2;
|
|
7304
|
-
return api.getDryRunCall({
|
|
7305
|
-
node: this.node,
|
|
7306
|
-
tx: api.callTxMethod(call),
|
|
7307
|
-
address: senderAddress,
|
|
7308
|
-
asset: asset,
|
|
7309
|
-
feeAsset: feeAsset
|
|
7310
|
-
});
|
|
7311
|
-
case 2:
|
|
7312
|
-
dryRunResult = _context3.v;
|
|
7313
|
-
if (dryRunResult.success) {
|
|
7314
|
-
_context3.n = 3;
|
|
7315
|
-
break;
|
|
7316
|
-
}
|
|
7317
|
-
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
7318
|
-
case 3:
|
|
7319
|
-
paddedFee = dryRunResult.fee * 120n / 100n;
|
|
7320
|
-
checkAmount(paddedFee);
|
|
7321
|
-
xcm = createExecuteXcm(input, paddedFee, version);
|
|
7322
|
-
_context3.n = 4;
|
|
7323
|
-
return api.getXcmWeight(xcm);
|
|
7324
|
-
case 4:
|
|
7325
|
-
weight = _context3.v;
|
|
7326
|
-
return _context3.a(2, createExecuteCall(createExecuteXcm(input, paddedFee, version), weight));
|
|
7327
|
-
}
|
|
7328
|
-
}, _callee3, this);
|
|
7329
|
-
}));
|
|
7330
|
-
function handleExecuteTransfer(_x3) {
|
|
7331
|
-
return _handleExecuteTransfer.apply(this, arguments);
|
|
7332
|
-
}
|
|
7333
|
-
return handleExecuteTransfer;
|
|
7334
|
-
}()
|
|
7335
7522
|
}, {
|
|
7336
7523
|
key: "transferPolkadotXCM",
|
|
7337
7524
|
value: function () {
|
|
7338
|
-
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
7525
|
+
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
|
|
7339
7526
|
var api, scenario, asset, destination, feeAsset, overriddenAsset, isNativeAsset, isEthereumAsset, isSystemNode, method, modifiedInput, _t, _t2;
|
|
7340
|
-
return _regenerator().w(function (
|
|
7341
|
-
while (1) switch (
|
|
7527
|
+
return _regenerator().w(function (_context3) {
|
|
7528
|
+
while (1) switch (_context3.n) {
|
|
7342
7529
|
case 0:
|
|
7343
7530
|
api = input.api, scenario = input.scenario, asset = input.asset, destination = input.destination, feeAsset = input.feeAsset, overriddenAsset = input.overriddenAsset;
|
|
7344
7531
|
if (!feeAsset) {
|
|
7345
|
-
|
|
7532
|
+
_context3.n = 4;
|
|
7346
7533
|
break;
|
|
7347
7534
|
}
|
|
7348
7535
|
if (!overriddenAsset) {
|
|
7349
|
-
|
|
7536
|
+
_context3.n = 1;
|
|
7350
7537
|
break;
|
|
7351
7538
|
}
|
|
7352
7539
|
throw new assets.InvalidCurrencyError('Cannot use overridden multi-assets with XCM execute');
|
|
7353
7540
|
case 1:
|
|
7354
|
-
if (!
|
|
7355
|
-
|
|
7541
|
+
if (!assets.isSymbolMatch(asset.symbol, 'KSM')) {
|
|
7542
|
+
_context3.n = 2;
|
|
7356
7543
|
break;
|
|
7357
7544
|
}
|
|
7358
|
-
return
|
|
7545
|
+
return _context3.a(2, this.handleLocalReserveTransfer(input));
|
|
7359
7546
|
case 2:
|
|
7360
|
-
isNativeAsset = asset.symbol
|
|
7547
|
+
isNativeAsset = assets.isSymbolMatch(asset.symbol, this.getNativeAssetSymbol());
|
|
7361
7548
|
if (isNativeAsset) {
|
|
7362
|
-
|
|
7549
|
+
_context3.n = 4;
|
|
7363
7550
|
break;
|
|
7364
7551
|
}
|
|
7365
7552
|
_t = api;
|
|
7366
|
-
|
|
7367
|
-
return this.
|
|
7553
|
+
_context3.n = 3;
|
|
7554
|
+
return handleExecuteTransfer(this.node, input);
|
|
7368
7555
|
case 3:
|
|
7369
|
-
_t2 =
|
|
7370
|
-
return
|
|
7556
|
+
_t2 = _context3.v;
|
|
7557
|
+
return _context3.a(2, _t.callTxMethod.call(_t, _t2));
|
|
7371
7558
|
case 4:
|
|
7372
7559
|
if (!(destination === 'AssetHubKusama')) {
|
|
7373
|
-
|
|
7560
|
+
_context3.n = 5;
|
|
7374
7561
|
break;
|
|
7375
7562
|
}
|
|
7376
|
-
return
|
|
7563
|
+
return _context3.a(2, this.handleBridgeTransfer(input, 'Kusama'));
|
|
7377
7564
|
case 5:
|
|
7378
7565
|
if (!(destination === 'Ethereum')) {
|
|
7379
|
-
|
|
7566
|
+
_context3.n = 6;
|
|
7380
7567
|
break;
|
|
7381
7568
|
}
|
|
7382
|
-
return
|
|
7569
|
+
return _context3.a(2, this.handleEthBridgeTransfer(input));
|
|
7383
7570
|
case 6:
|
|
7384
7571
|
if (!(destination === 'Mythos')) {
|
|
7385
|
-
|
|
7572
|
+
_context3.n = 7;
|
|
7386
7573
|
break;
|
|
7387
7574
|
}
|
|
7388
|
-
return
|
|
7575
|
+
return _context3.a(2, this.handleMythosTransfer(input));
|
|
7389
7576
|
case 7:
|
|
7390
7577
|
isEthereumAsset = asset.multiLocation && assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
|
|
7391
7578
|
if (!(destination === 'BifrostPolkadot' && isEthereumAsset)) {
|
|
7392
|
-
|
|
7579
|
+
_context3.n = 8;
|
|
7393
7580
|
break;
|
|
7394
7581
|
}
|
|
7395
|
-
return
|
|
7582
|
+
return _context3.a(2, this.handleLocalReserveTransfer(input));
|
|
7396
7583
|
case 8:
|
|
7397
7584
|
if (!isEthereumAsset) {
|
|
7398
|
-
|
|
7585
|
+
_context3.n = 9;
|
|
7399
7586
|
break;
|
|
7400
7587
|
}
|
|
7401
|
-
return
|
|
7588
|
+
return _context3.a(2, this.handleLocalReserveTransfer(input, true));
|
|
7402
7589
|
case 9:
|
|
7403
7590
|
isSystemNode = !sdkCommon.isTMultiLocation(destination) && SYSTEM_NODES_POLKADOT.includes(destination);
|
|
7404
7591
|
if (!(scenario === 'ParaToPara' && asset.symbol === 'DOT' && !assets.isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode)) {
|
|
7405
|
-
|
|
7592
|
+
_context3.n = 10;
|
|
7406
7593
|
break;
|
|
7407
7594
|
}
|
|
7408
7595
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Some Parachains do not have a reserve for DOT on AssetHub. This can also include multihop transfers that have AssetHub as a hop chain and the call contains DOT. Chains that do not have a DOT reserve on AssetHub are not allowed to transfer DOT to it or through it because this transfer will result in asset loss.');
|
|
7409
7596
|
case 10:
|
|
7410
7597
|
if (!(scenario === 'ParaToPara' && asset.symbol === 'KSM' && !assets.isForeignAsset(asset))) {
|
|
7411
|
-
|
|
7598
|
+
_context3.n = 11;
|
|
7412
7599
|
break;
|
|
7413
7600
|
}
|
|
7414
7601
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged KSM cannot currently be transfered from AssetHubPolkadot, if you are sending different KSM asset, please specify {id: <KSMID>}.');
|
|
7415
7602
|
case 11:
|
|
7416
7603
|
method = this.getMethod(scenario, destination);
|
|
7417
7604
|
modifiedInput = this.patchInput(input);
|
|
7418
|
-
return
|
|
7605
|
+
return _context3.a(2, transferPolkadotXcm(modifiedInput, method, 'Unlimited'));
|
|
7419
7606
|
}
|
|
7420
|
-
},
|
|
7607
|
+
}, _callee3, this);
|
|
7421
7608
|
}));
|
|
7422
|
-
function transferPolkadotXCM(
|
|
7609
|
+
function transferPolkadotXCM(_x3) {
|
|
7423
7610
|
return _transferPolkadotXCM.apply(this, arguments);
|
|
7424
7611
|
}
|
|
7425
7612
|
return transferPolkadotXCM;
|
|
@@ -7445,7 +7632,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7445
7632
|
if (!multiLocation) {
|
|
7446
7633
|
throw new assets.InvalidCurrencyError('Asset does not have a multiLocation defined');
|
|
7447
7634
|
}
|
|
7448
|
-
var transformedMultiLocation = sdkCommon.hasJunction(multiLocation, 'Parachain',
|
|
7635
|
+
var transformedMultiLocation = sdkCommon.hasJunction(multiLocation, 'Parachain', getParaId(this.node)) ? localizeLocation(this.node, multiLocation) : multiLocation;
|
|
7449
7636
|
return createMultiAsset(version, amount, transformedMultiLocation);
|
|
7450
7637
|
} else {
|
|
7451
7638
|
return _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([amount, scenario, version, asset]);
|
|
@@ -8173,7 +8360,7 @@ var createTypeAndThenDest = function createTypeAndThenDest(destination, scenario
|
|
|
8173
8360
|
})
|
|
8174
8361
|
};
|
|
8175
8362
|
};
|
|
8176
|
-
var createTypeAndThenTransfer = function createTypeAndThenTransfer(_ref, version) {
|
|
8363
|
+
var createTypeAndThenTransfer$1 = function createTypeAndThenTransfer(_ref, version) {
|
|
8177
8364
|
var api = _ref.api,
|
|
8178
8365
|
asset = _ref.asset,
|
|
8179
8366
|
address = _ref.address,
|
|
@@ -8262,7 +8449,7 @@ var Polimec = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8262
8449
|
_context.n = 1;
|
|
8263
8450
|
break;
|
|
8264
8451
|
}
|
|
8265
|
-
_call = createTypeAndThenTransfer(input, version);
|
|
8452
|
+
_call = createTypeAndThenTransfer$1(input, version);
|
|
8266
8453
|
return _context.a(2, api.callTxMethod(_call));
|
|
8267
8454
|
case 1:
|
|
8268
8455
|
if (!(scenario === 'ParaToPara' && (destination === 'AssetHubPolkadot' || destination === 'Hydration'))) {
|
|
@@ -8277,7 +8464,7 @@ var Polimec = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8277
8464
|
}
|
|
8278
8465
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
8279
8466
|
case 3:
|
|
8280
|
-
call = createTypeAndThenTransfer(input, version, 'Teleport');
|
|
8467
|
+
call = createTypeAndThenTransfer$1(input, version, 'Teleport');
|
|
8281
8468
|
return _context.a(2, api.callTxMethod(call));
|
|
8282
8469
|
}
|
|
8283
8470
|
}, _callee, this);
|
|
@@ -8292,7 +8479,7 @@ var Polimec = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8292
8479
|
value: function transferRelayToPara(options) {
|
|
8293
8480
|
var _options$version = options.version,
|
|
8294
8481
|
version = _options$version === void 0 ? this.version : _options$version;
|
|
8295
|
-
var call = createTypeAndThenTransfer(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8482
|
+
var call = createTypeAndThenTransfer$1(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
8296
8483
|
scenario: 'RelayToPara'
|
|
8297
8484
|
}), version, 'Teleport');
|
|
8298
8485
|
return call;
|
|
@@ -8386,7 +8573,7 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8386
8573
|
version = _options$version === void 0 ? this.version : _options$version;
|
|
8387
8574
|
var symbol = asset.symbol.toUpperCase();
|
|
8388
8575
|
if (symbol === 'DOT') {
|
|
8389
|
-
var call = createTypeAndThenTransfer(options, version);
|
|
8576
|
+
var call = createTypeAndThenTransfer$1(options, version);
|
|
8390
8577
|
return Promise.resolve(api.callTxMethod(call));
|
|
8391
8578
|
}
|
|
8392
8579
|
if ((symbol === 'USDC' || symbol === 'USDT') && !sdkCommon.hasJunction(asset.multiLocation, 'Parachain', getParaId('AssetHubPolkadot'))) {
|
|
@@ -8398,23 +8585,46 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8398
8585
|
key: "transferPolkadotXCM",
|
|
8399
8586
|
value: function () {
|
|
8400
8587
|
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(input) {
|
|
8401
|
-
var destination;
|
|
8588
|
+
var api, destination, feeAsset, asset, overriddenAsset, isNativeAsset, isNativeFeeAsset, _t, _t2;
|
|
8402
8589
|
return _regenerator().w(function (_context) {
|
|
8403
8590
|
while (1) switch (_context.n) {
|
|
8404
8591
|
case 0:
|
|
8405
|
-
destination = input.destination;
|
|
8592
|
+
api = input.api, destination = input.destination, feeAsset = input.feeAsset, asset = input.asset, overriddenAsset = input.overriddenAsset;
|
|
8406
8593
|
if (!(destination === 'Ethereum')) {
|
|
8407
8594
|
_context.n = 1;
|
|
8408
8595
|
break;
|
|
8409
8596
|
}
|
|
8410
8597
|
return _context.a(2, this.transferToEthereum(input));
|
|
8411
8598
|
case 1:
|
|
8412
|
-
if (!
|
|
8599
|
+
if (!feeAsset) {
|
|
8600
|
+
_context.n = 4;
|
|
8601
|
+
break;
|
|
8602
|
+
}
|
|
8603
|
+
if (!overriddenAsset) {
|
|
8413
8604
|
_context.n = 2;
|
|
8414
8605
|
break;
|
|
8415
8606
|
}
|
|
8416
|
-
|
|
8607
|
+
throw new assets.InvalidCurrencyError('Cannot use overridden multi-assets with XCM execute');
|
|
8417
8608
|
case 2:
|
|
8609
|
+
isNativeAsset = assets.isSymbolMatch(asset.symbol, this.getNativeAssetSymbol());
|
|
8610
|
+
isNativeFeeAsset = assets.isSymbolMatch(feeAsset.symbol, this.getNativeAssetSymbol());
|
|
8611
|
+
if (!(!isNativeAsset || !isNativeFeeAsset)) {
|
|
8612
|
+
_context.n = 4;
|
|
8613
|
+
break;
|
|
8614
|
+
}
|
|
8615
|
+
_t = api;
|
|
8616
|
+
_context.n = 3;
|
|
8617
|
+
return handleExecuteTransfer(this.node, input);
|
|
8618
|
+
case 3:
|
|
8619
|
+
_t2 = _context.v;
|
|
8620
|
+
return _context.a(2, _t.callTxMethod.call(_t, _t2));
|
|
8621
|
+
case 4:
|
|
8622
|
+
if (!(destination === 'Polimec')) {
|
|
8623
|
+
_context.n = 5;
|
|
8624
|
+
break;
|
|
8625
|
+
}
|
|
8626
|
+
return _context.a(2, this.transferToPolimec(input));
|
|
8627
|
+
case 5:
|
|
8418
8628
|
return _context.a(2, this.transferToAssetHub(input));
|
|
8419
8629
|
}
|
|
8420
8630
|
}, _callee, this);
|
|
@@ -8440,9 +8650,10 @@ var Hydration = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8440
8650
|
key: "canUseXTokens",
|
|
8441
8651
|
value: function canUseXTokens(_ref3) {
|
|
8442
8652
|
var destination = _ref3.to,
|
|
8443
|
-
asset = _ref3.asset
|
|
8653
|
+
asset = _ref3.asset,
|
|
8654
|
+
feeAsset = _ref3.feeAsset;
|
|
8444
8655
|
var isEthAsset = asset.multiLocation && assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
|
|
8445
|
-
return destination !== 'Ethereum' && destination !== 'Polimec' && !(destination === 'AssetHubPolkadot' && asset.symbol === 'DOT') && !isEthAsset;
|
|
8656
|
+
return destination !== 'Ethereum' && destination !== 'Polimec' && !(destination === 'AssetHubPolkadot' && asset.symbol === 'DOT') && !isEthAsset && !feeAsset;
|
|
8446
8657
|
}
|
|
8447
8658
|
}, {
|
|
8448
8659
|
key: "transferLocalNativeAsset",
|
|
@@ -8695,9 +8906,7 @@ var Moonbeam = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8695
8906
|
}
|
|
8696
8907
|
}
|
|
8697
8908
|
};
|
|
8698
|
-
|
|
8699
|
-
throw new assets.InvalidCurrencyError('throw new InvalidCurrencyError(`Asset ${JSON.stringify(asset)} has no assetId`)');
|
|
8700
|
-
}
|
|
8909
|
+
assertHasLocation(asset);
|
|
8701
8910
|
return asset.multiLocation;
|
|
8702
8911
|
}
|
|
8703
8912
|
}, {
|
|
@@ -8767,9 +8976,7 @@ var Moonriver = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8767
8976
|
}
|
|
8768
8977
|
}
|
|
8769
8978
|
};
|
|
8770
|
-
|
|
8771
|
-
throw new assets.InvalidCurrencyError('throw new InvalidCurrencyError(`Asset ${JSON.stringify(asset)} has no multiLocation`)');
|
|
8772
|
-
}
|
|
8979
|
+
assertHasLocation(asset);
|
|
8773
8980
|
return asset.multiLocation;
|
|
8774
8981
|
}
|
|
8775
8982
|
}, {
|
|
@@ -8800,6 +9007,94 @@ var Moonriver = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8800
9007
|
}]);
|
|
8801
9008
|
}(ParachainNode);
|
|
8802
9009
|
|
|
9010
|
+
var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
9011
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, node, version) {
|
|
9012
|
+
var api, scenario, asset, currency, senderAddress, address, destination, messageId, ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, ahExecutionFee, feeConverted, nativeMythAmount, nativeMythBalance;
|
|
9013
|
+
return _regenerator().w(function (_context) {
|
|
9014
|
+
while (1) switch (_context.n) {
|
|
9015
|
+
case 0:
|
|
9016
|
+
api = options.api, scenario = options.scenario, asset = options.asset, currency = options.currency, senderAddress = options.senderAddress, address = options.address, destination = options.destination;
|
|
9017
|
+
assertHasLocation(asset);
|
|
9018
|
+
assertAddressIsString(address);
|
|
9019
|
+
if (senderAddress) {
|
|
9020
|
+
_context.n = 1;
|
|
9021
|
+
break;
|
|
9022
|
+
}
|
|
9023
|
+
throw new assets.InvalidCurrencyError("Sender address is required for Mythos transfer");
|
|
9024
|
+
case 1:
|
|
9025
|
+
if (!(!assets.isForeignAsset(asset) || !asset.assetId)) {
|
|
9026
|
+
_context.n = 2;
|
|
9027
|
+
break;
|
|
9028
|
+
}
|
|
9029
|
+
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is not a foreign asset"));
|
|
9030
|
+
case 2:
|
|
9031
|
+
_context.n = 3;
|
|
9032
|
+
return generateMessageId(api, senderAddress, getParaId(node), asset.assetId, address, asset.amount);
|
|
9033
|
+
case 3:
|
|
9034
|
+
messageId = _context.v;
|
|
9035
|
+
ahApi = api.clone();
|
|
9036
|
+
_context.n = 4;
|
|
9037
|
+
return ahApi.init('AssetHubPolkadot');
|
|
9038
|
+
case 4:
|
|
9039
|
+
_context.n = 5;
|
|
9040
|
+
return getParaEthTransferFees(ahApi);
|
|
9041
|
+
case 5:
|
|
9042
|
+
_yield$getParaEthTran = _context.v;
|
|
9043
|
+
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
9044
|
+
bridgeFee = _yield$getParaEthTran2[0];
|
|
9045
|
+
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
9046
|
+
_context.n = 6;
|
|
9047
|
+
return ahApi.quoteAhPrice(DOT_MULTILOCATION, assets.getNativeAssets(node)[0].multiLocation, bridgeFee + ahExecutionFee);
|
|
9048
|
+
case 6:
|
|
9049
|
+
feeConverted = _context.v;
|
|
9050
|
+
if (feeConverted) {
|
|
9051
|
+
_context.n = 7;
|
|
9052
|
+
break;
|
|
9053
|
+
}
|
|
9054
|
+
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
9055
|
+
case 7:
|
|
9056
|
+
nativeMythAmount = padFeeBy(feeConverted, 10);
|
|
9057
|
+
_context.n = 8;
|
|
9058
|
+
return getAssetBalanceInternal({
|
|
9059
|
+
api: api,
|
|
9060
|
+
address: senderAddress,
|
|
9061
|
+
node: node,
|
|
9062
|
+
currency: currency
|
|
9063
|
+
});
|
|
9064
|
+
case 8:
|
|
9065
|
+
nativeMythBalance = _context.v;
|
|
9066
|
+
if (!(nativeMythBalance - nativeMythAmount < 0)) {
|
|
9067
|
+
_context.n = 9;
|
|
9068
|
+
break;
|
|
9069
|
+
}
|
|
9070
|
+
throw new assets.InvalidCurrencyError("Insufficient balance. Fee: ".concat(nativeMythAmount, ", Amount: ").concat(asset.amount));
|
|
9071
|
+
case 9:
|
|
9072
|
+
return _context.a(2, {
|
|
9073
|
+
module: 'PolkadotXcm',
|
|
9074
|
+
method: 'transfer_assets_using_type_and_then',
|
|
9075
|
+
parameters: {
|
|
9076
|
+
dest: createVersionedDestination(scenario, version, destination, getParaId('AssetHubPolkadot')),
|
|
9077
|
+
assets: _defineProperty({}, version, [createMultiAsset(version, nativeMythAmount, {
|
|
9078
|
+
parents: sdkCommon.Parents.ZERO,
|
|
9079
|
+
interior: 'Here'
|
|
9080
|
+
}), createMultiAsset(version, asset.amount, asset.multiLocation)]),
|
|
9081
|
+
assets_transfer_type: 'DestinationReserve',
|
|
9082
|
+
remote_fees_id: _defineProperty({}, version, {
|
|
9083
|
+
parents: sdkCommon.Parents.ZERO,
|
|
9084
|
+
interior: 'Here'
|
|
9085
|
+
}),
|
|
9086
|
+
fees_transfer_type: 'Teleport',
|
|
9087
|
+
custom_xcm_on_dest: createCustomXcmOnDest(options, node, messageId, nativeMythAmount),
|
|
9088
|
+
weight_limit: 'Unlimited'
|
|
9089
|
+
}
|
|
9090
|
+
});
|
|
9091
|
+
}
|
|
9092
|
+
}, _callee);
|
|
9093
|
+
}));
|
|
9094
|
+
return function createTypeAndThenTransfer(_x, _x2, _x3) {
|
|
9095
|
+
return _ref.apply(this, arguments);
|
|
9096
|
+
};
|
|
9097
|
+
}();
|
|
8803
9098
|
var Mythos = /*#__PURE__*/function (_ParachainNode) {
|
|
8804
9099
|
function Mythos() {
|
|
8805
9100
|
_classCallCheck(this, Mythos);
|
|
@@ -8824,27 +9119,38 @@ var Mythos = /*#__PURE__*/function (_ParachainNode) {
|
|
|
8824
9119
|
}, {
|
|
8825
9120
|
key: "transferPolkadotXCM",
|
|
8826
9121
|
value: function () {
|
|
8827
|
-
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
8828
|
-
var destination, defaultTx;
|
|
8829
|
-
return _regenerator().w(function (
|
|
8830
|
-
while (1) switch (
|
|
9122
|
+
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
9123
|
+
var api, destination, defaultTx, _t, _t2;
|
|
9124
|
+
return _regenerator().w(function (_context2) {
|
|
9125
|
+
while (1) switch (_context2.n) {
|
|
8831
9126
|
case 0:
|
|
8832
|
-
destination = input.destination;
|
|
8833
|
-
|
|
9127
|
+
api = input.api, destination = input.destination;
|
|
9128
|
+
_context2.n = 1;
|
|
8834
9129
|
return this.createTx(input);
|
|
8835
9130
|
case 1:
|
|
8836
|
-
defaultTx =
|
|
9131
|
+
defaultTx = _context2.v;
|
|
8837
9132
|
if (!(destination === 'AssetHubPolkadot')) {
|
|
8838
|
-
|
|
9133
|
+
_context2.n = 2;
|
|
8839
9134
|
break;
|
|
8840
9135
|
}
|
|
8841
|
-
return
|
|
9136
|
+
return _context2.a(2, handleToAhTeleport('Mythos', input, defaultTx));
|
|
8842
9137
|
case 2:
|
|
8843
|
-
|
|
9138
|
+
if (!(destination == 'Ethereum')) {
|
|
9139
|
+
_context2.n = 4;
|
|
9140
|
+
break;
|
|
9141
|
+
}
|
|
9142
|
+
_t = api;
|
|
9143
|
+
_context2.n = 3;
|
|
9144
|
+
return createTypeAndThenTransfer(input, this.node, this.version);
|
|
9145
|
+
case 3:
|
|
9146
|
+
_t2 = _context2.v;
|
|
9147
|
+
return _context2.a(2, _t.callTxMethod.call(_t, _t2));
|
|
9148
|
+
case 4:
|
|
9149
|
+
return _context2.a(2, defaultTx);
|
|
8844
9150
|
}
|
|
8845
|
-
},
|
|
9151
|
+
}, _callee2, this);
|
|
8846
9152
|
}));
|
|
8847
|
-
function transferPolkadotXCM(
|
|
9153
|
+
function transferPolkadotXCM(_x4) {
|
|
8848
9154
|
return _transferPolkadotXCM.apply(this, arguments);
|
|
8849
9155
|
}
|
|
8850
9156
|
return transferPolkadotXCM;
|
|
@@ -10187,11 +10493,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
10187
10493
|
key: "getTransferInfo",
|
|
10188
10494
|
value: (function () {
|
|
10189
10495
|
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
10190
|
-
var _this$_options9, from, to, address, currency, senderAddress, feeAsset, tx;
|
|
10496
|
+
var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset, tx;
|
|
10191
10497
|
return _regenerator().w(function (_context0) {
|
|
10192
10498
|
while (1) switch (_context0.n) {
|
|
10193
10499
|
case 0:
|
|
10194
|
-
_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;
|
|
10500
|
+
_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;
|
|
10195
10501
|
assertToIsString(to);
|
|
10196
10502
|
assertAddressIsString(address);
|
|
10197
10503
|
_context0.n = 1;
|
|
@@ -10205,6 +10511,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
10205
10511
|
destination: to,
|
|
10206
10512
|
address: address,
|
|
10207
10513
|
senderAddress: senderAddress,
|
|
10514
|
+
ahAddress: ahAddress,
|
|
10208
10515
|
currency: currency,
|
|
10209
10516
|
feeAsset: feeAsset
|
|
10210
10517
|
}));
|
|
@@ -10268,6 +10575,7 @@ exports.TransferToAhNotSupported = TransferToAhNotSupported;
|
|
|
10268
10575
|
exports.UnableToComputeError = UnableToComputeError;
|
|
10269
10576
|
exports.addXcmVersionHeader = addXcmVersionHeader;
|
|
10270
10577
|
exports.assertAddressIsString = assertAddressIsString;
|
|
10578
|
+
exports.assertHasLocation = assertHasLocation;
|
|
10271
10579
|
exports.assertToIsString = assertToIsString;
|
|
10272
10580
|
exports.blake2b256 = blake2b256;
|
|
10273
10581
|
exports.blake2b512 = blake2b512;
|
|
@@ -10292,7 +10600,6 @@ exports.getBalanceForeignInternal = getBalanceForeignInternal;
|
|
|
10292
10600
|
exports.getBalanceNative = getBalanceNative;
|
|
10293
10601
|
exports.getBalanceNativeInternal = getBalanceNativeInternal;
|
|
10294
10602
|
exports.getBridgeStatus = getBridgeStatus;
|
|
10295
|
-
exports.getFees = getFees;
|
|
10296
10603
|
exports.getNode = getNode;
|
|
10297
10604
|
exports.getNodeConfig = getNodeConfig;
|
|
10298
10605
|
exports.getNodeProviders = getNodeProviders;
|
|
@@ -10308,6 +10615,7 @@ exports.getTransferableAmount = getTransferableAmount;
|
|
|
10308
10615
|
exports.getTransferableAmountInternal = getTransferableAmountInternal;
|
|
10309
10616
|
exports.getXcmFee = getXcmFee;
|
|
10310
10617
|
exports.getXcmFeeEstimate = getXcmFeeEstimate;
|
|
10618
|
+
exports.localizeLocation = localizeLocation;
|
|
10311
10619
|
exports.resolveModuleError = resolveModuleError;
|
|
10312
10620
|
exports.resolveParaId = resolveParaId;
|
|
10313
10621
|
exports.reverseTransformMultiLocation = reverseTransformMultiLocation;
|
|
@@ -10315,7 +10623,6 @@ exports.send = send;
|
|
|
10315
10623
|
exports.transferMoonbeamEvm = transferMoonbeamEvm;
|
|
10316
10624
|
exports.transferMoonbeamToEth = transferMoonbeamToEth;
|
|
10317
10625
|
exports.transferRelayToPara = transferRelayToPara;
|
|
10318
|
-
exports.transformMultiLocation = transformMultiLocation;
|
|
10319
10626
|
exports.validateAddress = validateAddress;
|
|
10320
10627
|
exports.verifyEdOnDestination = verifyEdOnDestination;
|
|
10321
10628
|
Object.keys(assets).forEach(function (k) {
|