@paraspell/sdk-core 10.4.1 → 10.4.3
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 +187 -136
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +187 -136
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -2873,61 +2873,55 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
|
|
|
2873
2873
|
while (1) switch (_context.n) {
|
|
2874
2874
|
case 0:
|
|
2875
2875
|
if (!(node === 'Moonbeam' || node === 'Moonriver')) {
|
|
2876
|
-
_context.n =
|
|
2876
|
+
_context.n = 2;
|
|
2877
2877
|
break;
|
|
2878
2878
|
}
|
|
2879
|
-
if (!(!assets.isForeignAsset(asset) || !asset.assetId)) {
|
|
2879
|
+
if (!(!assets.isForeignAsset(asset) || !asset.assetId || !asset.multiLocation)) {
|
|
2880
2880
|
_context.n = 1;
|
|
2881
2881
|
break;
|
|
2882
2882
|
}
|
|
2883
|
-
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
|
|
2883
|
+
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location or assetId"));
|
|
2884
2884
|
case 1:
|
|
2885
|
-
if (!(asset.multiLocation && sdkCommon.hasJunction(asset.multiLocation, 'GlobalConsensus'))) {
|
|
2886
|
-
_context.n = 2;
|
|
2887
|
-
break;
|
|
2888
|
-
}
|
|
2889
2885
|
return _context.a(2, getMoonbeamErc20Balance(node, asset.assetId, address));
|
|
2890
2886
|
case 2:
|
|
2891
|
-
return _context.a(2, api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
|
|
2892
|
-
case 3:
|
|
2893
2887
|
if (!(node === 'Mythos')) {
|
|
2894
|
-
_context.n =
|
|
2888
|
+
_context.n = 3;
|
|
2895
2889
|
break;
|
|
2896
2890
|
}
|
|
2897
2891
|
return _context.a(2, api.getMythosForeignBalance(address));
|
|
2898
|
-
case
|
|
2892
|
+
case 3:
|
|
2899
2893
|
if (assets.isForeignAsset(asset)) {
|
|
2900
|
-
_context.n =
|
|
2894
|
+
_context.n = 4;
|
|
2901
2895
|
break;
|
|
2902
2896
|
}
|
|
2903
2897
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
2904
|
-
case
|
|
2898
|
+
case 4:
|
|
2905
2899
|
if (!(node === 'Polimec')) {
|
|
2906
|
-
_context.n =
|
|
2900
|
+
_context.n = 6;
|
|
2907
2901
|
break;
|
|
2908
2902
|
}
|
|
2909
2903
|
if (!(asset.multiLocation === undefined)) {
|
|
2910
|
-
_context.n =
|
|
2904
|
+
_context.n = 5;
|
|
2911
2905
|
break;
|
|
2912
2906
|
}
|
|
2913
2907
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location"));
|
|
2914
|
-
case
|
|
2908
|
+
case 5:
|
|
2915
2909
|
return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
|
|
2916
|
-
case
|
|
2910
|
+
case 6:
|
|
2917
2911
|
if (!(node === 'AssetHubPolkadot')) {
|
|
2918
|
-
_context.n =
|
|
2912
|
+
_context.n = 8;
|
|
2919
2913
|
break;
|
|
2920
2914
|
}
|
|
2921
2915
|
ASSETS_PALLET_ID = 50;
|
|
2922
2916
|
hasRequiredJunctions = asset.multiLocation && sdkCommon.hasJunction(asset.multiLocation, 'PalletInstance', ASSETS_PALLET_ID) && sdkCommon.hasJunction(asset.multiLocation, 'GeneralIndex');
|
|
2923
2917
|
if (!(!asset.multiLocation || hasRequiredJunctions)) {
|
|
2924
|
-
_context.n =
|
|
2918
|
+
_context.n = 7;
|
|
2925
2919
|
break;
|
|
2926
2920
|
}
|
|
2927
2921
|
return _context.a(2, api.getBalanceAssetsPallet(address, Number(asset.assetId)));
|
|
2928
|
-
case
|
|
2922
|
+
case 7:
|
|
2929
2923
|
return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
|
|
2930
|
-
case
|
|
2924
|
+
case 8:
|
|
2931
2925
|
return _context.a(2, api.getBalanceForeignPolkadotXcm(address, asset.assetId));
|
|
2932
2926
|
}
|
|
2933
2927
|
}, _callee);
|
|
@@ -6713,6 +6707,22 @@ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6713
6707
|
}]);
|
|
6714
6708
|
}(ParachainNode);
|
|
6715
6709
|
|
|
6710
|
+
var createExecuteCall = function createExecuteCall(
|
|
6711
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6712
|
+
xcm, maxWeight) {
|
|
6713
|
+
return {
|
|
6714
|
+
module: 'PolkadotXcm',
|
|
6715
|
+
method: 'execute',
|
|
6716
|
+
parameters: {
|
|
6717
|
+
message: xcm,
|
|
6718
|
+
max_weight: {
|
|
6719
|
+
ref_time: maxWeight.refTime,
|
|
6720
|
+
proof_size: maxWeight.proofSize
|
|
6721
|
+
}
|
|
6722
|
+
}
|
|
6723
|
+
};
|
|
6724
|
+
};
|
|
6725
|
+
|
|
6716
6726
|
var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, weight, originExecutionFee, destExecutionFee) {
|
|
6717
6727
|
var api = input.api,
|
|
6718
6728
|
_input$version = input.version,
|
|
@@ -6810,15 +6820,15 @@ var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, weight,
|
|
|
6810
6820
|
return api.callTxMethod(call);
|
|
6811
6821
|
};
|
|
6812
6822
|
|
|
6813
|
-
var createExecuteXcm = function createExecuteXcm(input,
|
|
6823
|
+
var createExecuteXcm = function createExecuteXcm(input, executionFee, version) {
|
|
6824
|
+
var _feeAsset$multiLocati;
|
|
6814
6825
|
var api = input.api,
|
|
6815
|
-
_input$version = input.version,
|
|
6816
|
-
version = _input$version === void 0 ? exports.Version.V4 : _input$version,
|
|
6817
6826
|
asset = input.asset,
|
|
6818
6827
|
scenario = input.scenario,
|
|
6819
6828
|
destination = input.destination,
|
|
6820
6829
|
paraIdTo = input.paraIdTo,
|
|
6821
|
-
address = input.address
|
|
6830
|
+
address = input.address,
|
|
6831
|
+
feeAsset = input.feeAsset;
|
|
6822
6832
|
var dest = createDestination(scenario, version, destination, paraIdTo);
|
|
6823
6833
|
var beneficiary = createBeneficiary({
|
|
6824
6834
|
api: api,
|
|
@@ -6828,77 +6838,74 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
|
6828
6838
|
version: version,
|
|
6829
6839
|
paraId: paraIdTo
|
|
6830
6840
|
});
|
|
6831
|
-
if (!asset.multiLocation) {
|
|
6832
|
-
throw new
|
|
6841
|
+
if (!asset.multiLocation || feeAsset && !feeAsset.multiLocation) {
|
|
6842
|
+
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6833
6843
|
}
|
|
6834
|
-
var
|
|
6844
|
+
var assetML = transformMultiLocation(asset.multiLocation);
|
|
6845
|
+
var feeML = transformMultiLocation((_feeAsset$multiLocati = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati !== void 0 ? _feeAsset$multiLocati : asset.multiLocation);
|
|
6846
|
+
var sameFeeAsset = feeAsset && assets.isAssetEqual(asset, feeAsset);
|
|
6835
6847
|
var amountWithoutFee = BigInt(asset.amount) - executionFee;
|
|
6836
|
-
var
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6848
|
+
var xcm = [{
|
|
6849
|
+
WithdrawAsset: [{
|
|
6850
|
+
id: assetML,
|
|
6851
|
+
fun: {
|
|
6852
|
+
Fungible: BigInt(asset.amount)
|
|
6853
|
+
}
|
|
6854
|
+
}].concat(_toConsumableArray(!sameFeeAsset && feeAsset !== null && feeAsset !== void 0 && feeAsset.multiLocation ? [{
|
|
6855
|
+
id: transformMultiLocation(feeAsset.multiLocation),
|
|
6856
|
+
fun: {
|
|
6857
|
+
Fungible: executionFee
|
|
6858
|
+
}
|
|
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
|
+
}
|
|
6874
|
+
}
|
|
6875
|
+
}, {
|
|
6876
|
+
DepositReserveAsset: {
|
|
6877
|
+
assets: {
|
|
6878
|
+
Definite: [{
|
|
6879
|
+
id: assetML,
|
|
6843
6880
|
fun: {
|
|
6844
|
-
Fungible: BigInt(asset.amount)
|
|
6881
|
+
Fungible: sameFeeAsset ? amountWithoutFee : BigInt(asset.amount)
|
|
6845
6882
|
}
|
|
6846
6883
|
}]
|
|
6847
|
-
},
|
|
6884
|
+
},
|
|
6885
|
+
dest: dest,
|
|
6886
|
+
xcm: [{
|
|
6848
6887
|
BuyExecution: {
|
|
6849
6888
|
fees: {
|
|
6850
|
-
id:
|
|
6889
|
+
id: asset.multiLocation,
|
|
6851
6890
|
fun: {
|
|
6852
|
-
Fungible: executionFee
|
|
6891
|
+
Fungible: sameFeeAsset ? amountWithoutFee - executionFee : BigInt(asset.amount)
|
|
6853
6892
|
}
|
|
6854
6893
|
},
|
|
6855
|
-
weight_limit:
|
|
6856
|
-
Limited: {
|
|
6857
|
-
ref_time: 150n,
|
|
6858
|
-
proof_size: 0n
|
|
6859
|
-
}
|
|
6860
|
-
}
|
|
6894
|
+
weight_limit: 'Unlimited'
|
|
6861
6895
|
}
|
|
6862
6896
|
}, {
|
|
6863
|
-
|
|
6897
|
+
DepositAsset: {
|
|
6864
6898
|
assets: {
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
fun: {
|
|
6868
|
-
Fungible: amountWithoutFee
|
|
6869
|
-
}
|
|
6870
|
-
}]
|
|
6871
|
-
},
|
|
6872
|
-
dest: dest,
|
|
6873
|
-
xcm: [{
|
|
6874
|
-
BuyExecution: {
|
|
6875
|
-
fees: {
|
|
6876
|
-
id: asset.multiLocation,
|
|
6877
|
-
fun: {
|
|
6878
|
-
Fungible: amountWithoutFee - executionFee
|
|
6879
|
-
}
|
|
6880
|
-
},
|
|
6881
|
-
weight_limit: 'Unlimited'
|
|
6882
|
-
}
|
|
6883
|
-
}, {
|
|
6884
|
-
DepositAsset: {
|
|
6885
|
-
assets: {
|
|
6886
|
-
Wild: {
|
|
6887
|
-
AllCounted: 1
|
|
6888
|
-
}
|
|
6889
|
-
},
|
|
6890
|
-
beneficiary: beneficiary
|
|
6899
|
+
Wild: {
|
|
6900
|
+
AllCounted: 1
|
|
6891
6901
|
}
|
|
6892
|
-
}
|
|
6902
|
+
},
|
|
6903
|
+
beneficiary: beneficiary
|
|
6893
6904
|
}
|
|
6894
|
-
}]
|
|
6895
|
-
max_weight: {
|
|
6896
|
-
ref_time: weight.refTime,
|
|
6897
|
-
proof_size: weight.proofSize
|
|
6898
|
-
}
|
|
6905
|
+
}]
|
|
6899
6906
|
}
|
|
6900
|
-
};
|
|
6901
|
-
return
|
|
6907
|
+
}];
|
|
6908
|
+
return addXcmVersionHeader(xcm, version);
|
|
6902
6909
|
};
|
|
6903
6910
|
|
|
6904
6911
|
var handleToAhTeleport = /*#__PURE__*/function () {
|
|
@@ -6993,7 +7000,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6993
7000
|
var _this;
|
|
6994
7001
|
_classCallCheck(this, AssetHubPolkadot);
|
|
6995
7002
|
_this = _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', exports.Version.V3]);
|
|
6996
|
-
_this.
|
|
7003
|
+
_this.handleLocalReserveTransfer = function (input) {
|
|
6997
7004
|
var useDOTAsFeeAsset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6998
7005
|
var api = input.api,
|
|
6999
7006
|
scenario = input.scenario,
|
|
@@ -7260,11 +7267,11 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7260
7267
|
key: "handleExecuteTransfer",
|
|
7261
7268
|
value: function () {
|
|
7262
7269
|
var _handleExecuteTransfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
|
|
7263
|
-
var api, senderAddress, asset, feeAsset, decimals, multiplier, base, scaledMultiplier, MIN_FEE,
|
|
7270
|
+
var api, senderAddress, asset, feeAsset, _input$version4, version, decimals, multiplier, base, scaledMultiplier, MIN_FEE, call, dryRunResult, paddedFee, xcm, weight;
|
|
7264
7271
|
return _regenerator().w(function (_context3) {
|
|
7265
7272
|
while (1) switch (_context3.n) {
|
|
7266
7273
|
case 0:
|
|
7267
|
-
api = input.api, senderAddress = input.senderAddress, asset = input.asset, feeAsset = input.feeAsset;
|
|
7274
|
+
api = input.api, senderAddress = input.senderAddress, asset = input.asset, feeAsset = input.feeAsset, _input$version4 = input.version, version = _input$version4 === void 0 ? exports.Version.V4 : _input$version4;
|
|
7268
7275
|
if (senderAddress) {
|
|
7269
7276
|
_context3.n = 1;
|
|
7270
7277
|
break;
|
|
@@ -7277,11 +7284,11 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7277
7284
|
base = BigInt(Math.pow(10, decimals));
|
|
7278
7285
|
scaledMultiplier = BigInt(Math.floor(multiplier * Math.pow(10, decimals)));
|
|
7279
7286
|
MIN_FEE = base * scaledMultiplier / BigInt(Math.pow(10, decimals));
|
|
7280
|
-
|
|
7287
|
+
call = createExecuteCall(createExecuteXcm(input, MIN_FEE, version), MAX_WEIGHT);
|
|
7281
7288
|
_context3.n = 2;
|
|
7282
7289
|
return api.getDryRunCall({
|
|
7283
7290
|
node: this.node,
|
|
7284
|
-
tx:
|
|
7291
|
+
tx: api.callTxMethod(call),
|
|
7285
7292
|
address: senderAddress,
|
|
7286
7293
|
isFeeAsset: !!feeAsset
|
|
7287
7294
|
});
|
|
@@ -7293,14 +7300,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7293
7300
|
}
|
|
7294
7301
|
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
7295
7302
|
case 3:
|
|
7296
|
-
if (dryRunResult.weight) {
|
|
7297
|
-
_context3.n = 4;
|
|
7298
|
-
break;
|
|
7299
|
-
}
|
|
7300
|
-
throw new DryRunFailedError('weight not found');
|
|
7301
|
-
case 4:
|
|
7302
7303
|
paddedFee = dryRunResult.fee * 120n / 100n;
|
|
7303
|
-
|
|
7304
|
+
xcm = createExecuteXcm(input, paddedFee, version);
|
|
7305
|
+
_context3.n = 4;
|
|
7306
|
+
return api.getXcmWeight(xcm);
|
|
7307
|
+
case 4:
|
|
7308
|
+
weight = _context3.v;
|
|
7309
|
+
return _context3.a(2, createExecuteCall(createExecuteXcm(input, paddedFee, version), weight));
|
|
7304
7310
|
}
|
|
7305
7311
|
}, _callee3, this);
|
|
7306
7312
|
}));
|
|
@@ -7311,51 +7317,96 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7311
7317
|
}()
|
|
7312
7318
|
}, {
|
|
7313
7319
|
key: "transferPolkadotXCM",
|
|
7314
|
-
value: function
|
|
7315
|
-
var
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7320
|
+
value: function () {
|
|
7321
|
+
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(input) {
|
|
7322
|
+
var api, scenario, asset, destination, feeAsset, overriddenAsset, isNativeAsset, isEthereumAsset, isSystemNode, method, modifiedInput, _t, _t2;
|
|
7323
|
+
return _regenerator().w(function (_context4) {
|
|
7324
|
+
while (1) switch (_context4.n) {
|
|
7325
|
+
case 0:
|
|
7326
|
+
api = input.api, scenario = input.scenario, asset = input.asset, destination = input.destination, feeAsset = input.feeAsset, overriddenAsset = input.overriddenAsset;
|
|
7327
|
+
if (!feeAsset) {
|
|
7328
|
+
_context4.n = 4;
|
|
7329
|
+
break;
|
|
7330
|
+
}
|
|
7331
|
+
if (!overriddenAsset) {
|
|
7332
|
+
_context4.n = 1;
|
|
7333
|
+
break;
|
|
7334
|
+
}
|
|
7335
|
+
throw new assets.InvalidCurrencyError('Cannot use overridden multi-assets with XCM execute');
|
|
7336
|
+
case 1:
|
|
7337
|
+
if (!(assets.normalizeSymbol(asset.symbol) === assets.normalizeSymbol('KSM'))) {
|
|
7338
|
+
_context4.n = 2;
|
|
7339
|
+
break;
|
|
7340
|
+
}
|
|
7341
|
+
return _context4.a(2, this.handleLocalReserveTransfer(input));
|
|
7342
|
+
case 2:
|
|
7343
|
+
isNativeAsset = asset.symbol === this.getNativeAssetSymbol();
|
|
7344
|
+
if (isNativeAsset) {
|
|
7345
|
+
_context4.n = 4;
|
|
7346
|
+
break;
|
|
7347
|
+
}
|
|
7348
|
+
_t = api;
|
|
7349
|
+
_context4.n = 3;
|
|
7350
|
+
return this.handleExecuteTransfer(input);
|
|
7351
|
+
case 3:
|
|
7352
|
+
_t2 = _context4.v;
|
|
7353
|
+
return _context4.a(2, _t.callTxMethod.call(_t, _t2));
|
|
7354
|
+
case 4:
|
|
7355
|
+
if (!(destination === 'AssetHubKusama')) {
|
|
7356
|
+
_context4.n = 5;
|
|
7357
|
+
break;
|
|
7358
|
+
}
|
|
7359
|
+
return _context4.a(2, this.handleBridgeTransfer(input, 'Kusama'));
|
|
7360
|
+
case 5:
|
|
7361
|
+
if (!(destination === 'Ethereum')) {
|
|
7362
|
+
_context4.n = 6;
|
|
7363
|
+
break;
|
|
7364
|
+
}
|
|
7365
|
+
return _context4.a(2, this.handleEthBridgeTransfer(input));
|
|
7366
|
+
case 6:
|
|
7367
|
+
if (!(destination === 'Mythos')) {
|
|
7368
|
+
_context4.n = 7;
|
|
7369
|
+
break;
|
|
7370
|
+
}
|
|
7371
|
+
return _context4.a(2, this.handleMythosTransfer(input));
|
|
7372
|
+
case 7:
|
|
7373
|
+
isEthereumAsset = asset.multiLocation && assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
|
|
7374
|
+
if (!(destination === 'BifrostPolkadot' && isEthereumAsset)) {
|
|
7375
|
+
_context4.n = 8;
|
|
7376
|
+
break;
|
|
7377
|
+
}
|
|
7378
|
+
return _context4.a(2, this.handleLocalReserveTransfer(input));
|
|
7379
|
+
case 8:
|
|
7380
|
+
if (!isEthereumAsset) {
|
|
7381
|
+
_context4.n = 9;
|
|
7382
|
+
break;
|
|
7383
|
+
}
|
|
7384
|
+
return _context4.a(2, this.handleLocalReserveTransfer(input, true));
|
|
7385
|
+
case 9:
|
|
7386
|
+
isSystemNode = !sdkCommon.isTMultiLocation(destination) && SYSTEM_NODES_POLKADOT.includes(destination);
|
|
7387
|
+
if (!(scenario === 'ParaToPara' && asset.symbol === 'DOT' && !assets.isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode)) {
|
|
7388
|
+
_context4.n = 10;
|
|
7389
|
+
break;
|
|
7390
|
+
}
|
|
7391
|
+
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.');
|
|
7392
|
+
case 10:
|
|
7393
|
+
if (!(scenario === 'ParaToPara' && asset.symbol === 'KSM' && !assets.isForeignAsset(asset))) {
|
|
7394
|
+
_context4.n = 11;
|
|
7395
|
+
break;
|
|
7396
|
+
}
|
|
7397
|
+
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>}.');
|
|
7398
|
+
case 11:
|
|
7399
|
+
method = this.getMethod(scenario, destination);
|
|
7400
|
+
modifiedInput = this.patchInput(input);
|
|
7401
|
+
return _context4.a(2, PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, method, 'Unlimited'));
|
|
7402
|
+
}
|
|
7403
|
+
}, _callee4, this);
|
|
7404
|
+
}));
|
|
7405
|
+
function transferPolkadotXCM(_x4) {
|
|
7406
|
+
return _transferPolkadotXCM.apply(this, arguments);
|
|
7354
7407
|
}
|
|
7355
|
-
|
|
7356
|
-
|
|
7357
|
-
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, method, 'Unlimited'));
|
|
7358
|
-
}
|
|
7408
|
+
return transferPolkadotXCM;
|
|
7409
|
+
}()
|
|
7359
7410
|
}, {
|
|
7360
7411
|
key: "getRelayToParaOverrides",
|
|
7361
7412
|
value: function getRelayToParaOverrides() {
|
package/dist/index.d.ts
CHANGED
|
@@ -938,6 +938,7 @@ interface IPolkadotApi<TApi, TRes> {
|
|
|
938
938
|
getMethod(tx: TRes): string;
|
|
939
939
|
calculateTransactionFee(tx: TRes, address: string): Promise<bigint>;
|
|
940
940
|
quoteAhPrice(fromMl: TMultiLocation, toMl: TMultiLocation, amountIn: bigint, includeFee?: boolean): Promise<bigint | undefined>;
|
|
941
|
+
getXcmWeight(xcm: any): Promise<TWeight>;
|
|
941
942
|
getBalanceNative(address: string): Promise<bigint>;
|
|
942
943
|
getBalanceNativeAcala(address: string, symbol: string): Promise<bigint>;
|
|
943
944
|
getBalanceForeignPolkadotXcm(address: string, id?: string): Promise<bigint>;
|
|
@@ -1298,7 +1299,7 @@ declare class AssetHubPolkadot<TApi, TRes> extends ParachainNode<TApi, TRes> imp
|
|
|
1298
1299
|
handleEthBridgeNativeTransfer<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): Promise<TRes>;
|
|
1299
1300
|
handleEthBridgeTransfer<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): Promise<TRes>;
|
|
1300
1301
|
handleMythosTransfer<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): TRes;
|
|
1301
|
-
|
|
1302
|
+
handleLocalReserveTransfer: <TApi_1, TRes_1>(input: TPolkadotXCMTransferOptions<TApi_1, TRes_1>, useDOTAsFeeAsset?: boolean) => TRes_1;
|
|
1302
1303
|
patchInput<TApi, TRes>(input: TPolkadotXCMTransferOptions<TApi, TRes>): TPolkadotXCMTransferOptions<TApi, TRes>;
|
|
1303
1304
|
private getMethod;
|
|
1304
1305
|
private handleExecuteTransfer;
|
package/dist/index.mjs
CHANGED
|
@@ -2874,61 +2874,55 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
|
|
|
2874
2874
|
while (1) switch (_context.n) {
|
|
2875
2875
|
case 0:
|
|
2876
2876
|
if (!(node === 'Moonbeam' || node === 'Moonriver')) {
|
|
2877
|
-
_context.n =
|
|
2877
|
+
_context.n = 2;
|
|
2878
2878
|
break;
|
|
2879
2879
|
}
|
|
2880
|
-
if (!(!isForeignAsset(asset) || !asset.assetId)) {
|
|
2880
|
+
if (!(!isForeignAsset(asset) || !asset.assetId || !asset.multiLocation)) {
|
|
2881
2881
|
_context.n = 1;
|
|
2882
2882
|
break;
|
|
2883
2883
|
}
|
|
2884
|
-
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no assetId"));
|
|
2884
|
+
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location or assetId"));
|
|
2885
2885
|
case 1:
|
|
2886
|
-
if (!(asset.multiLocation && hasJunction(asset.multiLocation, 'GlobalConsensus'))) {
|
|
2887
|
-
_context.n = 2;
|
|
2888
|
-
break;
|
|
2889
|
-
}
|
|
2890
2886
|
return _context.a(2, getMoonbeamErc20Balance(node, asset.assetId, address));
|
|
2891
2887
|
case 2:
|
|
2892
|
-
return _context.a(2, api.getBalanceAssetsPallet(address, BigInt(asset.assetId)));
|
|
2893
|
-
case 3:
|
|
2894
2888
|
if (!(node === 'Mythos')) {
|
|
2895
|
-
_context.n =
|
|
2889
|
+
_context.n = 3;
|
|
2896
2890
|
break;
|
|
2897
2891
|
}
|
|
2898
2892
|
return _context.a(2, api.getMythosForeignBalance(address));
|
|
2899
|
-
case
|
|
2893
|
+
case 3:
|
|
2900
2894
|
if (isForeignAsset(asset)) {
|
|
2901
|
-
_context.n =
|
|
2895
|
+
_context.n = 4;
|
|
2902
2896
|
break;
|
|
2903
2897
|
}
|
|
2904
2898
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " is not a foreign asset"));
|
|
2905
|
-
case
|
|
2899
|
+
case 4:
|
|
2906
2900
|
if (!(node === 'Polimec')) {
|
|
2907
|
-
_context.n =
|
|
2901
|
+
_context.n = 6;
|
|
2908
2902
|
break;
|
|
2909
2903
|
}
|
|
2910
2904
|
if (!(asset.multiLocation === undefined)) {
|
|
2911
|
-
_context.n =
|
|
2905
|
+
_context.n = 5;
|
|
2912
2906
|
break;
|
|
2913
2907
|
}
|
|
2914
2908
|
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multi-location"));
|
|
2915
|
-
case
|
|
2909
|
+
case 5:
|
|
2916
2910
|
return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
|
|
2917
|
-
case
|
|
2911
|
+
case 6:
|
|
2918
2912
|
if (!(node === 'AssetHubPolkadot')) {
|
|
2919
|
-
_context.n =
|
|
2913
|
+
_context.n = 8;
|
|
2920
2914
|
break;
|
|
2921
2915
|
}
|
|
2922
2916
|
ASSETS_PALLET_ID = 50;
|
|
2923
2917
|
hasRequiredJunctions = asset.multiLocation && hasJunction(asset.multiLocation, 'PalletInstance', ASSETS_PALLET_ID) && hasJunction(asset.multiLocation, 'GeneralIndex');
|
|
2924
2918
|
if (!(!asset.multiLocation || hasRequiredJunctions)) {
|
|
2925
|
-
_context.n =
|
|
2919
|
+
_context.n = 7;
|
|
2926
2920
|
break;
|
|
2927
2921
|
}
|
|
2928
2922
|
return _context.a(2, api.getBalanceAssetsPallet(address, Number(asset.assetId)));
|
|
2929
|
-
case
|
|
2923
|
+
case 7:
|
|
2930
2924
|
return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.multiLocation));
|
|
2931
|
-
case
|
|
2925
|
+
case 8:
|
|
2932
2926
|
return _context.a(2, api.getBalanceForeignPolkadotXcm(address, asset.assetId));
|
|
2933
2927
|
}
|
|
2934
2928
|
}, _callee);
|
|
@@ -6714,6 +6708,22 @@ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6714
6708
|
}]);
|
|
6715
6709
|
}(ParachainNode);
|
|
6716
6710
|
|
|
6711
|
+
var createExecuteCall = function createExecuteCall(
|
|
6712
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6713
|
+
xcm, maxWeight) {
|
|
6714
|
+
return {
|
|
6715
|
+
module: 'PolkadotXcm',
|
|
6716
|
+
method: 'execute',
|
|
6717
|
+
parameters: {
|
|
6718
|
+
message: xcm,
|
|
6719
|
+
max_weight: {
|
|
6720
|
+
ref_time: maxWeight.refTime,
|
|
6721
|
+
proof_size: maxWeight.proofSize
|
|
6722
|
+
}
|
|
6723
|
+
}
|
|
6724
|
+
};
|
|
6725
|
+
};
|
|
6726
|
+
|
|
6717
6727
|
var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, weight, originExecutionFee, destExecutionFee) {
|
|
6718
6728
|
var api = input.api,
|
|
6719
6729
|
_input$version = input.version,
|
|
@@ -6811,15 +6821,15 @@ var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, weight,
|
|
|
6811
6821
|
return api.callTxMethod(call);
|
|
6812
6822
|
};
|
|
6813
6823
|
|
|
6814
|
-
var createExecuteXcm = function createExecuteXcm(input,
|
|
6824
|
+
var createExecuteXcm = function createExecuteXcm(input, executionFee, version) {
|
|
6825
|
+
var _feeAsset$multiLocati;
|
|
6815
6826
|
var api = input.api,
|
|
6816
|
-
_input$version = input.version,
|
|
6817
|
-
version = _input$version === void 0 ? Version.V4 : _input$version,
|
|
6818
6827
|
asset = input.asset,
|
|
6819
6828
|
scenario = input.scenario,
|
|
6820
6829
|
destination = input.destination,
|
|
6821
6830
|
paraIdTo = input.paraIdTo,
|
|
6822
|
-
address = input.address
|
|
6831
|
+
address = input.address,
|
|
6832
|
+
feeAsset = input.feeAsset;
|
|
6823
6833
|
var dest = createDestination(scenario, version, destination, paraIdTo);
|
|
6824
6834
|
var beneficiary = createBeneficiary({
|
|
6825
6835
|
api: api,
|
|
@@ -6829,77 +6839,74 @@ var createExecuteXcm = function createExecuteXcm(input, weight, executionFee) {
|
|
|
6829
6839
|
version: version,
|
|
6830
6840
|
paraId: paraIdTo
|
|
6831
6841
|
});
|
|
6832
|
-
if (!asset.multiLocation) {
|
|
6833
|
-
throw new
|
|
6842
|
+
if (!asset.multiLocation || feeAsset && !feeAsset.multiLocation) {
|
|
6843
|
+
throw new InvalidCurrencyError("Asset ".concat(JSON.stringify(asset), " has no multiLocation"));
|
|
6834
6844
|
}
|
|
6835
|
-
var
|
|
6845
|
+
var assetML = transformMultiLocation(asset.multiLocation);
|
|
6846
|
+
var feeML = transformMultiLocation((_feeAsset$multiLocati = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati !== void 0 ? _feeAsset$multiLocati : asset.multiLocation);
|
|
6847
|
+
var sameFeeAsset = feeAsset && isAssetEqual(asset, feeAsset);
|
|
6836
6848
|
var amountWithoutFee = BigInt(asset.amount) - executionFee;
|
|
6837
|
-
var
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6849
|
+
var xcm = [{
|
|
6850
|
+
WithdrawAsset: [{
|
|
6851
|
+
id: assetML,
|
|
6852
|
+
fun: {
|
|
6853
|
+
Fungible: BigInt(asset.amount)
|
|
6854
|
+
}
|
|
6855
|
+
}].concat(_toConsumableArray(!sameFeeAsset && feeAsset !== null && feeAsset !== void 0 && feeAsset.multiLocation ? [{
|
|
6856
|
+
id: transformMultiLocation(feeAsset.multiLocation),
|
|
6857
|
+
fun: {
|
|
6858
|
+
Fungible: executionFee
|
|
6859
|
+
}
|
|
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
|
+
}
|
|
6875
|
+
}
|
|
6876
|
+
}, {
|
|
6877
|
+
DepositReserveAsset: {
|
|
6878
|
+
assets: {
|
|
6879
|
+
Definite: [{
|
|
6880
|
+
id: assetML,
|
|
6844
6881
|
fun: {
|
|
6845
|
-
Fungible: BigInt(asset.amount)
|
|
6882
|
+
Fungible: sameFeeAsset ? amountWithoutFee : BigInt(asset.amount)
|
|
6846
6883
|
}
|
|
6847
6884
|
}]
|
|
6848
|
-
},
|
|
6885
|
+
},
|
|
6886
|
+
dest: dest,
|
|
6887
|
+
xcm: [{
|
|
6849
6888
|
BuyExecution: {
|
|
6850
6889
|
fees: {
|
|
6851
|
-
id:
|
|
6890
|
+
id: asset.multiLocation,
|
|
6852
6891
|
fun: {
|
|
6853
|
-
Fungible: executionFee
|
|
6892
|
+
Fungible: sameFeeAsset ? amountWithoutFee - executionFee : BigInt(asset.amount)
|
|
6854
6893
|
}
|
|
6855
6894
|
},
|
|
6856
|
-
weight_limit:
|
|
6857
|
-
Limited: {
|
|
6858
|
-
ref_time: 150n,
|
|
6859
|
-
proof_size: 0n
|
|
6860
|
-
}
|
|
6861
|
-
}
|
|
6895
|
+
weight_limit: 'Unlimited'
|
|
6862
6896
|
}
|
|
6863
6897
|
}, {
|
|
6864
|
-
|
|
6898
|
+
DepositAsset: {
|
|
6865
6899
|
assets: {
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
fun: {
|
|
6869
|
-
Fungible: amountWithoutFee
|
|
6870
|
-
}
|
|
6871
|
-
}]
|
|
6872
|
-
},
|
|
6873
|
-
dest: dest,
|
|
6874
|
-
xcm: [{
|
|
6875
|
-
BuyExecution: {
|
|
6876
|
-
fees: {
|
|
6877
|
-
id: asset.multiLocation,
|
|
6878
|
-
fun: {
|
|
6879
|
-
Fungible: amountWithoutFee - executionFee
|
|
6880
|
-
}
|
|
6881
|
-
},
|
|
6882
|
-
weight_limit: 'Unlimited'
|
|
6883
|
-
}
|
|
6884
|
-
}, {
|
|
6885
|
-
DepositAsset: {
|
|
6886
|
-
assets: {
|
|
6887
|
-
Wild: {
|
|
6888
|
-
AllCounted: 1
|
|
6889
|
-
}
|
|
6890
|
-
},
|
|
6891
|
-
beneficiary: beneficiary
|
|
6900
|
+
Wild: {
|
|
6901
|
+
AllCounted: 1
|
|
6892
6902
|
}
|
|
6893
|
-
}
|
|
6903
|
+
},
|
|
6904
|
+
beneficiary: beneficiary
|
|
6894
6905
|
}
|
|
6895
|
-
}]
|
|
6896
|
-
max_weight: {
|
|
6897
|
-
ref_time: weight.refTime,
|
|
6898
|
-
proof_size: weight.proofSize
|
|
6899
|
-
}
|
|
6906
|
+
}]
|
|
6900
6907
|
}
|
|
6901
|
-
};
|
|
6902
|
-
return
|
|
6908
|
+
}];
|
|
6909
|
+
return addXcmVersionHeader(xcm, version);
|
|
6903
6910
|
};
|
|
6904
6911
|
|
|
6905
6912
|
var handleToAhTeleport = /*#__PURE__*/function () {
|
|
@@ -6994,7 +7001,7 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
6994
7001
|
var _this;
|
|
6995
7002
|
_classCallCheck(this, AssetHubPolkadot);
|
|
6996
7003
|
_this = _callSuper(this, AssetHubPolkadot, ['AssetHubPolkadot', 'PolkadotAssetHub', 'polkadot', Version.V3]);
|
|
6997
|
-
_this.
|
|
7004
|
+
_this.handleLocalReserveTransfer = function (input) {
|
|
6998
7005
|
var useDOTAsFeeAsset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
6999
7006
|
var api = input.api,
|
|
7000
7007
|
scenario = input.scenario,
|
|
@@ -7261,11 +7268,11 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7261
7268
|
key: "handleExecuteTransfer",
|
|
7262
7269
|
value: function () {
|
|
7263
7270
|
var _handleExecuteTransfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
|
|
7264
|
-
var api, senderAddress, asset, feeAsset, decimals, multiplier, base, scaledMultiplier, MIN_FEE,
|
|
7271
|
+
var api, senderAddress, asset, feeAsset, _input$version4, version, decimals, multiplier, base, scaledMultiplier, MIN_FEE, call, dryRunResult, paddedFee, xcm, weight;
|
|
7265
7272
|
return _regenerator().w(function (_context3) {
|
|
7266
7273
|
while (1) switch (_context3.n) {
|
|
7267
7274
|
case 0:
|
|
7268
|
-
api = input.api, senderAddress = input.senderAddress, asset = input.asset, feeAsset = input.feeAsset;
|
|
7275
|
+
api = input.api, senderAddress = input.senderAddress, asset = input.asset, feeAsset = input.feeAsset, _input$version4 = input.version, version = _input$version4 === void 0 ? Version.V4 : _input$version4;
|
|
7269
7276
|
if (senderAddress) {
|
|
7270
7277
|
_context3.n = 1;
|
|
7271
7278
|
break;
|
|
@@ -7278,11 +7285,11 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7278
7285
|
base = BigInt(Math.pow(10, decimals));
|
|
7279
7286
|
scaledMultiplier = BigInt(Math.floor(multiplier * Math.pow(10, decimals)));
|
|
7280
7287
|
MIN_FEE = base * scaledMultiplier / BigInt(Math.pow(10, decimals));
|
|
7281
|
-
|
|
7288
|
+
call = createExecuteCall(createExecuteXcm(input, MIN_FEE, version), MAX_WEIGHT);
|
|
7282
7289
|
_context3.n = 2;
|
|
7283
7290
|
return api.getDryRunCall({
|
|
7284
7291
|
node: this.node,
|
|
7285
|
-
tx:
|
|
7292
|
+
tx: api.callTxMethod(call),
|
|
7286
7293
|
address: senderAddress,
|
|
7287
7294
|
isFeeAsset: !!feeAsset
|
|
7288
7295
|
});
|
|
@@ -7294,14 +7301,13 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7294
7301
|
}
|
|
7295
7302
|
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
7296
7303
|
case 3:
|
|
7297
|
-
if (dryRunResult.weight) {
|
|
7298
|
-
_context3.n = 4;
|
|
7299
|
-
break;
|
|
7300
|
-
}
|
|
7301
|
-
throw new DryRunFailedError('weight not found');
|
|
7302
|
-
case 4:
|
|
7303
7304
|
paddedFee = dryRunResult.fee * 120n / 100n;
|
|
7304
|
-
|
|
7305
|
+
xcm = createExecuteXcm(input, paddedFee, version);
|
|
7306
|
+
_context3.n = 4;
|
|
7307
|
+
return api.getXcmWeight(xcm);
|
|
7308
|
+
case 4:
|
|
7309
|
+
weight = _context3.v;
|
|
7310
|
+
return _context3.a(2, createExecuteCall(createExecuteXcm(input, paddedFee, version), weight));
|
|
7305
7311
|
}
|
|
7306
7312
|
}, _callee3, this);
|
|
7307
7313
|
}));
|
|
@@ -7312,51 +7318,96 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
|
|
|
7312
7318
|
}()
|
|
7313
7319
|
}, {
|
|
7314
7320
|
key: "transferPolkadotXCM",
|
|
7315
|
-
value: function
|
|
7316
|
-
var
|
|
7317
|
-
|
|
7318
|
-
|
|
7319
|
-
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
|
|
7344
|
-
|
|
7345
|
-
|
|
7346
|
-
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
|
|
7353
|
-
|
|
7354
|
-
|
|
7321
|
+
value: function () {
|
|
7322
|
+
var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(input) {
|
|
7323
|
+
var api, scenario, asset, destination, feeAsset, overriddenAsset, isNativeAsset, isEthereumAsset, isSystemNode, method, modifiedInput, _t, _t2;
|
|
7324
|
+
return _regenerator().w(function (_context4) {
|
|
7325
|
+
while (1) switch (_context4.n) {
|
|
7326
|
+
case 0:
|
|
7327
|
+
api = input.api, scenario = input.scenario, asset = input.asset, destination = input.destination, feeAsset = input.feeAsset, overriddenAsset = input.overriddenAsset;
|
|
7328
|
+
if (!feeAsset) {
|
|
7329
|
+
_context4.n = 4;
|
|
7330
|
+
break;
|
|
7331
|
+
}
|
|
7332
|
+
if (!overriddenAsset) {
|
|
7333
|
+
_context4.n = 1;
|
|
7334
|
+
break;
|
|
7335
|
+
}
|
|
7336
|
+
throw new InvalidCurrencyError('Cannot use overridden multi-assets with XCM execute');
|
|
7337
|
+
case 1:
|
|
7338
|
+
if (!(normalizeSymbol(asset.symbol) === normalizeSymbol('KSM'))) {
|
|
7339
|
+
_context4.n = 2;
|
|
7340
|
+
break;
|
|
7341
|
+
}
|
|
7342
|
+
return _context4.a(2, this.handleLocalReserveTransfer(input));
|
|
7343
|
+
case 2:
|
|
7344
|
+
isNativeAsset = asset.symbol === this.getNativeAssetSymbol();
|
|
7345
|
+
if (isNativeAsset) {
|
|
7346
|
+
_context4.n = 4;
|
|
7347
|
+
break;
|
|
7348
|
+
}
|
|
7349
|
+
_t = api;
|
|
7350
|
+
_context4.n = 3;
|
|
7351
|
+
return this.handleExecuteTransfer(input);
|
|
7352
|
+
case 3:
|
|
7353
|
+
_t2 = _context4.v;
|
|
7354
|
+
return _context4.a(2, _t.callTxMethod.call(_t, _t2));
|
|
7355
|
+
case 4:
|
|
7356
|
+
if (!(destination === 'AssetHubKusama')) {
|
|
7357
|
+
_context4.n = 5;
|
|
7358
|
+
break;
|
|
7359
|
+
}
|
|
7360
|
+
return _context4.a(2, this.handleBridgeTransfer(input, 'Kusama'));
|
|
7361
|
+
case 5:
|
|
7362
|
+
if (!(destination === 'Ethereum')) {
|
|
7363
|
+
_context4.n = 6;
|
|
7364
|
+
break;
|
|
7365
|
+
}
|
|
7366
|
+
return _context4.a(2, this.handleEthBridgeTransfer(input));
|
|
7367
|
+
case 6:
|
|
7368
|
+
if (!(destination === 'Mythos')) {
|
|
7369
|
+
_context4.n = 7;
|
|
7370
|
+
break;
|
|
7371
|
+
}
|
|
7372
|
+
return _context4.a(2, this.handleMythosTransfer(input));
|
|
7373
|
+
case 7:
|
|
7374
|
+
isEthereumAsset = asset.multiLocation && findAssetByMultiLocation(getOtherAssets('Ethereum'), asset.multiLocation);
|
|
7375
|
+
if (!(destination === 'BifrostPolkadot' && isEthereumAsset)) {
|
|
7376
|
+
_context4.n = 8;
|
|
7377
|
+
break;
|
|
7378
|
+
}
|
|
7379
|
+
return _context4.a(2, this.handleLocalReserveTransfer(input));
|
|
7380
|
+
case 8:
|
|
7381
|
+
if (!isEthereumAsset) {
|
|
7382
|
+
_context4.n = 9;
|
|
7383
|
+
break;
|
|
7384
|
+
}
|
|
7385
|
+
return _context4.a(2, this.handleLocalReserveTransfer(input, true));
|
|
7386
|
+
case 9:
|
|
7387
|
+
isSystemNode = !isTMultiLocation(destination) && SYSTEM_NODES_POLKADOT.includes(destination);
|
|
7388
|
+
if (!(scenario === 'ParaToPara' && asset.symbol === 'DOT' && !isForeignAsset(asset) && destination !== 'Hydration' && destination !== 'Polimec' && destination !== 'Moonbeam' && destination !== 'BifrostPolkadot' && destination !== 'PeoplePolkadot' && destination !== 'Ajuna' && !isSystemNode)) {
|
|
7389
|
+
_context4.n = 10;
|
|
7390
|
+
break;
|
|
7391
|
+
}
|
|
7392
|
+
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.');
|
|
7393
|
+
case 10:
|
|
7394
|
+
if (!(scenario === 'ParaToPara' && asset.symbol === 'KSM' && !isForeignAsset(asset))) {
|
|
7395
|
+
_context4.n = 11;
|
|
7396
|
+
break;
|
|
7397
|
+
}
|
|
7398
|
+
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>}.');
|
|
7399
|
+
case 11:
|
|
7400
|
+
method = this.getMethod(scenario, destination);
|
|
7401
|
+
modifiedInput = this.patchInput(input);
|
|
7402
|
+
return _context4.a(2, PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, method, 'Unlimited'));
|
|
7403
|
+
}
|
|
7404
|
+
}, _callee4, this);
|
|
7405
|
+
}));
|
|
7406
|
+
function transferPolkadotXCM(_x4) {
|
|
7407
|
+
return _transferPolkadotXCM.apply(this, arguments);
|
|
7355
7408
|
}
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, method, 'Unlimited'));
|
|
7359
|
-
}
|
|
7409
|
+
return transferPolkadotXCM;
|
|
7410
|
+
}()
|
|
7360
7411
|
}, {
|
|
7361
7412
|
key: "getRelayToParaOverrides",
|
|
7362
7413
|
value: function getRelayToParaOverrides() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@paraspell/sdk-core",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.3",
|
|
4
4
|
"description": "SDK core for ParaSpell XCM/XCMP tool for developers",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@noble/hashes": "^1.8.0",
|
|
27
27
|
"@scure/base": "^1.2.6",
|
|
28
28
|
"viem": "^2.30.5",
|
|
29
|
-
"@paraspell/pallets": "10.4.
|
|
30
|
-
"@paraspell/assets": "10.4.
|
|
31
|
-
"@paraspell/sdk-common": "10.4.
|
|
29
|
+
"@paraspell/pallets": "10.4.3",
|
|
30
|
+
"@paraspell/assets": "10.4.3",
|
|
31
|
+
"@paraspell/sdk-common": "10.4.3"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/plugin-syntax-import-attributes": "^7.27.1",
|