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