@paraspell/sdk-core 10.11.5 → 10.11.7

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 CHANGED
@@ -700,6 +700,7 @@ var convertSs58 = function convertSs58(api, address, node) {
700
700
  return encodeSs58(deriveAccountId(publicKey), ss58Prefix);
701
701
  };
702
702
 
703
+ var MIN_FEE = 1000n;
703
704
  var DEFAULT_FEE_ASSET = 0;
704
705
  var ETH_PARA_ID = 1;
705
706
  var ETH_CHAIN_ID = BigInt(ETH_PARA_ID);
@@ -715,6 +716,12 @@ var DOT_MULTILOCATION = {
715
716
  parents: sdkCommon.Parents.ONE,
716
717
  interior: 'Here'
717
718
  };
719
+ var RELAY_LOCATION = {
720
+ parents: sdkCommon.Parents.ONE,
721
+ interior: {
722
+ Here: null
723
+ }
724
+ };
718
725
  var CHAINS_DOT_RESERVE_AH = new Set(['Polimec', 'Moonbeam', 'AssetHubPolkadot', 'AssetHubKusama', 'AssetHubWestend', 'AssetHubPaseo', 'BifrostPolkadot', 'BifrostKusama', 'PeoplePolkadot', 'PeopleKusama', 'Ajuna']);
719
726
  var ASSET_HUB_EXECUTION_FEE = 2200000000n; // 0.22 DOT
720
727
  var TX_CLIENT_TIMEOUT_MS = 20 * 60 * 1000; // 20 minutes
@@ -738,7 +745,7 @@ var assertToIsString = function assertToIsString(to, overrideMsg) {
738
745
  };
739
746
  var assertAddressIsString = function assertAddressIsString(address) {
740
747
  if (sdkCommon.isTMultiLocation(address)) {
741
- throw new InvalidParameterError('Multi-Location address is not supported for XCM fee calculation.');
748
+ throw new InvalidParameterError('Multi-Location address is not supported for this transfer type.');
742
749
  }
743
750
  };
744
751
  var assertHasLocation = function assertHasLocation(asset) {
@@ -6192,136 +6199,307 @@ var send = /*#__PURE__*/function () {
6192
6199
  };
6193
6200
  }();
6194
6201
 
6195
- var createTypeAndThenCall = function createTypeAndThenCall(chain, destChain, reserveChain, input, reserveFee) {
6196
- var api = input.api,
6197
- destination = input.destination,
6198
- asset = input.asset,
6199
- version = input.version,
6200
- address = input.address,
6201
- paraIdTo = input.paraIdTo;
6202
- assertHasLocation(asset);
6202
+ var buildTypeAndThenCall = function buildTypeAndThenCall(_ref, isDotAsset, customXcm, assets) {
6203
+ var origin = _ref.origin,
6204
+ reserve = _ref.reserve,
6205
+ dest = _ref.dest,
6206
+ asset = _ref.asset,
6207
+ version = _ref.options.version;
6208
+ var feeAssetLocation = !isDotAsset ? RELAY_LOCATION : asset.multiLocation;
6209
+ var finalDest = origin.chain === reserve.chain ? dest.chain : reserve.chain;
6210
+ var destLocation = createDestination(version, origin.chain, finalDest, getParaId(finalDest));
6211
+ var reserveType = origin.chain === reserve.chain ? 'LocalReserve' : 'DestinationReserve';
6212
+ var feeMultiAsset = createMultiAsset(version, asset.amount, feeAssetLocation);
6213
+ return {
6214
+ module: 'PolkadotXcm',
6215
+ method: 'transfer_assets_using_type_and_then',
6216
+ parameters: {
6217
+ dest: addXcmVersionHeader(destLocation, version),
6218
+ assets: addXcmVersionHeader(assets, version),
6219
+ assets_transfer_type: reserveType,
6220
+ remote_fees_id: addXcmVersionHeader(feeMultiAsset.id, version),
6221
+ fees_transfer_type: reserveType,
6222
+ custom_xcm_on_dest: addXcmVersionHeader(customXcm, version),
6223
+ weight_limit: 'Unlimited'
6224
+ }
6225
+ };
6226
+ };
6227
+
6228
+ var FEE_PADDING_PERCENTAGE$2 = 20;
6229
+ var FEE_PADDING_HYDRATION = 150;
6230
+ var computeInstructionFee = /*#__PURE__*/function () {
6231
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, version, xcm) {
6232
+ var chain, api, _t, _t2, _t3;
6233
+ return _regenerator().w(function (_context) {
6234
+ while (1) switch (_context.n) {
6235
+ case 0:
6236
+ chain = _ref.chain, api = _ref.api;
6237
+ _t = padFeeBy;
6238
+ _context.n = 1;
6239
+ return api.getXcmPaymentApiFee(chain, addXcmVersionHeader(xcm, version), {
6240
+ multiLocation: DOT_MULTILOCATION
6241
+ }, true);
6242
+ case 1:
6243
+ _t2 = _context.v;
6244
+ _t3 = chain === 'Hydration' ? FEE_PADDING_HYDRATION : FEE_PADDING_PERCENTAGE$2;
6245
+ return _context.a(2, _t(_t2, _t3));
6246
+ }
6247
+ }, _callee);
6248
+ }));
6249
+ return function computeInstructionFee(_x, _x2, _x3) {
6250
+ return _ref2.apply(this, arguments);
6251
+ };
6252
+ }();
6253
+ var computeAllFees = /*#__PURE__*/function () {
6254
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref3, customXcm, isDotAsset, refundInstruction) {
6255
+ var reserve, dest, version, _t4, _t5, _t6, _t7, _t8, _t9, _t0, _t1, _t10;
6256
+ return _regenerator().w(function (_context2) {
6257
+ while (1) switch (_context2.n) {
6258
+ case 0:
6259
+ reserve = _ref3.reserve, dest = _ref3.dest, version = _ref3.options.version;
6260
+ if (!('DepositReserveAsset' in customXcm)) {
6261
+ _context2.n = 6;
6262
+ break;
6263
+ }
6264
+ _context2.n = 1;
6265
+ return computeInstructionFee(reserve, version, [customXcm]);
6266
+ case 1:
6267
+ _t5 = _context2.v;
6268
+ if (!refundInstruction) {
6269
+ _context2.n = 3;
6270
+ break;
6271
+ }
6272
+ _context2.n = 2;
6273
+ return computeInstructionFee(reserve, version, [refundInstruction]);
6274
+ case 2:
6275
+ _t6 = _context2.v;
6276
+ _context2.n = 4;
6277
+ break;
6278
+ case 3:
6279
+ _t6 = 0n;
6280
+ case 4:
6281
+ _t7 = _t6;
6282
+ _context2.n = 5;
6283
+ return computeInstructionFee(assets.hasXcmPaymentApiSupport(dest.chain) ? dest : reserve, version, customXcm.DepositReserveAsset.xcm);
6284
+ case 5:
6285
+ _t8 = _context2.v;
6286
+ _t4 = {
6287
+ reserveFee: _t5,
6288
+ refundFee: _t7,
6289
+ destFee: _t8
6290
+ };
6291
+ _context2.n = 13;
6292
+ break;
6293
+ case 6:
6294
+ if (isDotAsset) {
6295
+ _context2.n = 8;
6296
+ break;
6297
+ }
6298
+ _context2.n = 7;
6299
+ return computeInstructionFee(assets.hasXcmPaymentApiSupport(dest.chain) ? dest : reserve, version, [customXcm]);
6300
+ case 7:
6301
+ _t9 = _context2.v;
6302
+ _context2.n = 9;
6303
+ break;
6304
+ case 8:
6305
+ _t9 = 0n;
6306
+ case 9:
6307
+ _t0 = _t9;
6308
+ if (isDotAsset) {
6309
+ _context2.n = 11;
6310
+ break;
6311
+ }
6312
+ _context2.n = 10;
6313
+ return computeInstructionFee(assets.hasXcmPaymentApiSupport(reserve.chain) ? reserve : dest, version, [refundInstruction]);
6314
+ case 10:
6315
+ _t1 = _context2.v;
6316
+ _context2.n = 12;
6317
+ break;
6318
+ case 11:
6319
+ _t1 = 0n;
6320
+ case 12:
6321
+ _t10 = _t1;
6322
+ _t4 = {
6323
+ reserveFee: 0n,
6324
+ destFee: _t0,
6325
+ refundFee: _t10
6326
+ };
6327
+ case 13:
6328
+ return _context2.a(2, _t4);
6329
+ }
6330
+ }, _callee2);
6331
+ }));
6332
+ return function computeAllFees(_x4, _x5, _x6, _x7) {
6333
+ return _ref4.apply(this, arguments);
6334
+ };
6335
+ }();
6336
+
6337
+ var createTypeAndThenCallContext = /*#__PURE__*/function () {
6338
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
6339
+ var api, paraIdTo, asset, destChain, reserveChain, destApi, reserveApi;
6340
+ return _regenerator().w(function (_context) {
6341
+ while (1) switch (_context.n) {
6342
+ case 0:
6343
+ api = options.api, paraIdTo = options.paraIdTo, asset = options.asset;
6344
+ assertHasLocation(asset);
6345
+ destChain = getTNode(paraIdTo, getRelayChainOf(chain).toLowerCase());
6346
+ reserveChain = sdkCommon.isRelayChain(destChain) ? destChain : getAssetReserveChain(chain, chain, asset.multiLocation);
6347
+ destApi = api.clone();
6348
+ _context.n = 1;
6349
+ return destApi.init(destChain);
6350
+ case 1:
6351
+ reserveApi = reserveChain !== chain ? api.clone() : destApi;
6352
+ _context.n = 2;
6353
+ return reserveApi.init(reserveChain);
6354
+ case 2:
6355
+ return _context.a(2, {
6356
+ origin: {
6357
+ api: api,
6358
+ chain: chain
6359
+ },
6360
+ dest: {
6361
+ api: destApi,
6362
+ chain: destChain
6363
+ },
6364
+ reserve: {
6365
+ api: reserveApi,
6366
+ chain: reserveChain
6367
+ },
6368
+ asset: asset,
6369
+ options: options
6370
+ });
6371
+ }
6372
+ }, _callee);
6373
+ }));
6374
+ return function createTypeAndThenCallContext(_x, _x2) {
6375
+ return _ref.apply(this, arguments);
6376
+ };
6377
+ }();
6378
+
6379
+ var createCustomXcm = function createCustomXcm(_ref, isDotAsset) {
6380
+ var origin = _ref.origin,
6381
+ dest = _ref.dest,
6382
+ reserve = _ref.reserve,
6383
+ asset = _ref.asset,
6384
+ options = _ref.options;
6385
+ var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
6386
+ reserveFee: MIN_FEE,
6387
+ refundFee: 0n,
6388
+ destFee: MIN_FEE
6389
+ };
6390
+ var destination = options.destination,
6391
+ version = options.version,
6392
+ address = options.address,
6393
+ paraIdTo = options.paraIdTo;
6394
+ var reserveFee = fees.reserveFee,
6395
+ refundFee = fees.refundFee,
6396
+ destFee = fees.destFee;
6397
+ var feeAssetLocation = !isDotAsset ? RELAY_LOCATION : asset.multiLocation;
6398
+ var multiAsset = createMultiAsset(version, asset.amount, localizeLocation(dest.chain, asset.multiLocation));
6203
6399
  var depositInstruction = {
6204
6400
  DepositAsset: {
6205
6401
  assets: {
6206
- Wild: 'All'
6402
+ Wild: {
6403
+ AllOf: {
6404
+ id: multiAsset.id,
6405
+ fun: 'Fungible'
6406
+ }
6407
+ }
6207
6408
  },
6208
6409
  beneficiary: createBeneficiaryLocation({
6209
- api: api,
6410
+ api: origin.api,
6210
6411
  address: address,
6211
6412
  version: version
6212
6413
  })
6213
6414
  }
6214
6415
  };
6215
- var customXcm = chain === reserveChain || destChain === reserveChain ? [depositInstruction] : [{
6416
+ var assetsFilter = [];
6417
+ if (!isDotAsset) assetsFilter.push(createMultiAsset(version, reserveFee + destFee, localizeLocation(reserve.chain, RELAY_LOCATION)));
6418
+ assetsFilter.push(createMultiAsset(version, asset.amount, localizeLocation(reserve.chain, asset.multiLocation)));
6419
+ return origin.chain !== reserve.chain && dest.chain !== reserve.chain ? {
6216
6420
  DepositReserveAsset: {
6217
- assets: {
6421
+ assets: fees.destFee === MIN_FEE ? {
6218
6422
  Wild: 'All'
6423
+ } : {
6424
+ Definite: assetsFilter
6219
6425
  },
6220
- dest: createDestination(version, chain, destination, paraIdTo),
6426
+ dest: createDestination(version, origin.chain, destination, paraIdTo),
6221
6427
  xcm: [{
6222
6428
  BuyExecution: {
6223
- fees: createMultiAsset(version, reserveFee, asset.multiLocation),
6429
+ fees: createMultiAsset(version, !isDotAsset ? destFee : asset.amount - reserveFee - refundFee, feeAssetLocation),
6224
6430
  weight_limit: 'Unlimited'
6225
6431
  }
6226
6432
  }, depositInstruction]
6227
6433
  }
6228
- }];
6229
- var finalDest = chain === reserveChain ? destChain : reserveChain;
6230
- var dest = createVersionedDestination(version, chain, finalDest, getParaId(finalDest));
6231
- var multiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
6232
- var assets = addXcmVersionHeader([multiAsset], version);
6233
- var customXcmVersioned = addXcmVersionHeader(customXcm, version);
6234
- var feesLocation = addXcmVersionHeader(multiAsset.id, version);
6235
- var reserve = chain === reserveChain ? 'LocalReserve' : 'DestinationReserve';
6236
- return {
6237
- module: 'PolkadotXcm',
6238
- method: 'transfer_assets_using_type_and_then',
6239
- parameters: {
6240
- dest: dest,
6241
- assets: assets,
6242
- assets_transfer_type: reserve,
6243
- remote_fees_id: feesLocation,
6244
- fees_transfer_type: reserve,
6245
- custom_xcm_on_dest: customXcmVersioned,
6246
- weight_limit: 'Unlimited'
6247
- }
6248
- };
6434
+ } : depositInstruction;
6249
6435
  };
6250
6436
 
6251
- var validateHops$1 = function validateHops(hops) {
6252
- var _iterator = _createForOfIteratorHelper(hops),
6253
- _step;
6254
- try {
6255
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6256
- var hop = _step.value;
6257
- if (!hop.result.success) {
6258
- throw new DryRunFailedError("Dry run failed on an intermediate hop (".concat(hop.chain, "). Reason: ").concat(hop.result.failureReason || 'Unknown'));
6437
+ var createRefundInstruction = function createRefundInstruction(api, senderAddress, version) {
6438
+ return {
6439
+ SetAppendix: [{
6440
+ DepositAsset: {
6441
+ assets: {
6442
+ Wild: 'All'
6443
+ },
6444
+ beneficiary: createBeneficiaryLocation({
6445
+ api: api,
6446
+ address: senderAddress,
6447
+ version: version
6448
+ })
6259
6449
  }
6260
- }
6261
- } catch (err) {
6262
- _iterator.e(err);
6263
- } finally {
6264
- _iterator.f();
6265
- }
6450
+ }]
6451
+ };
6266
6452
  };
6267
- var getReserveFeeFromHops$1 = function getReserveFeeFromHops(hops) {
6268
- if (!hops || hops.length === 0 || !hops[0].result.success) {
6269
- return MIN_FEE$2;
6453
+
6454
+ var buildAssets = function buildAssets(asset, feeAmount, isDotAsset, version) {
6455
+ var assets = [];
6456
+ if (!isDotAsset) {
6457
+ assets.push(createMultiAsset(version, feeAmount, RELAY_LOCATION));
6270
6458
  }
6271
- return hops[0].result.fee;
6459
+ assets.push(createMultiAsset(version, asset.amount, asset.multiLocation));
6460
+ return assets;
6272
6461
  };
6273
- var MIN_FEE$2 = 1000n;
6274
- var FEE_PADDING_PERCENTAGE$2 = 40;
6275
- var createTypeAndThenTransfer$2 = /*#__PURE__*/function () {
6276
- var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, input) {
6277
- var api, address, paraIdTo, senderAddress, currency, asset, destChain, reserveChain, call, dryRunResult, reserveFeeEstimate, reserveFee;
6462
+ /**
6463
+ * Creates a type and then call for transferring assets using XCM. Works only for DOT and snowbridge assets so far.
6464
+ */
6465
+ var createTypeAndThenCall = /*#__PURE__*/function () {
6466
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
6467
+ var api, senderAddress, version, context, asset, isDotAsset, customXcm, refundInstruction, fees, finalCustomXcm, totalFee, assets;
6278
6468
  return _regenerator().w(function (_context) {
6279
6469
  while (1) switch (_context.n) {
6280
6470
  case 0:
6281
- api = input.api, address = input.address, paraIdTo = input.paraIdTo, senderAddress = input.senderAddress, currency = input.currency, asset = input.asset;
6282
- if (senderAddress) {
6283
- _context.n = 1;
6284
- break;
6285
- }
6286
- throw new InvalidParameterError('Please provide senderAddress');
6471
+ api = options.api, senderAddress = options.senderAddress, version = options.version;
6472
+ _context.n = 1;
6473
+ return createTypeAndThenCallContext(chain, options);
6287
6474
  case 1:
6288
- assertHasLocation(asset);
6289
- assertAddressIsString(address);
6290
- destChain = getTNode(paraIdTo, getRelayChainOf(chain).toLowerCase());
6291
- reserveChain = sdkCommon.isRelayChain(destChain) ? destChain : getAssetReserveChain(chain, chain, asset.multiLocation);
6292
- call = createTypeAndThenCall(chain, destChain, reserveChain, input, MIN_FEE$2);
6293
- if (!(chain === reserveChain || destChain === reserveChain)) {
6294
- _context.n = 2;
6295
- break;
6296
- }
6297
- return _context.a(2, call);
6298
- case 2:
6299
- _context.n = 3;
6300
- return dryRunInternal({
6301
- api: api,
6302
- tx: api.callTxMethod(call),
6303
- origin: chain,
6304
- destination: destChain,
6305
- senderAddress: senderAddress,
6306
- address: address,
6307
- currency: currency
6475
+ context = _context.v;
6476
+ asset = context.asset;
6477
+ isDotAsset = sdkCommon.deepEqual(asset.multiLocation, RELAY_LOCATION) || sdkCommon.deepEqual(asset.multiLocation, {
6478
+ parents: 2,
6479
+ interior: {
6480
+ X1: [{
6481
+ GlobalConsensus: {
6482
+ Kusama: null
6483
+ }
6484
+ }]
6485
+ }
6308
6486
  });
6309
- case 3:
6310
- dryRunResult = _context.v;
6311
- if (dryRunResult.origin.success) {
6312
- _context.n = 4;
6313
- break;
6314
- }
6315
- throw new DryRunFailedError(dryRunResult.failureReason);
6316
- case 4:
6317
- validateHops$1(dryRunResult.hops);
6318
- reserveFeeEstimate = getReserveFeeFromHops$1(dryRunResult.hops);
6319
- reserveFee = padFeeBy(reserveFeeEstimate, FEE_PADDING_PERCENTAGE$2);
6320
- return _context.a(2, createTypeAndThenCall(chain, destChain, reserveChain, input, reserveFee));
6487
+ customXcm = createCustomXcm(context, isDotAsset);
6488
+ refundInstruction = senderAddress ? createRefundInstruction(api, senderAddress, version) : null;
6489
+ _context.n = 2;
6490
+ return computeAllFees(context, customXcm, isDotAsset, refundInstruction);
6491
+ case 2:
6492
+ fees = _context.v;
6493
+ finalCustomXcm = [];
6494
+ if (refundInstruction) finalCustomXcm.push(refundInstruction);
6495
+ finalCustomXcm.push(createCustomXcm(context, isDotAsset, fees));
6496
+ totalFee = fees.reserveFee + fees.destFee + fees.refundFee;
6497
+ assets = buildAssets(asset, totalFee, isDotAsset, version);
6498
+ return _context.a(2, buildTypeAndThenCall(context, isDotAsset, finalCustomXcm, assets));
6321
6499
  }
6322
6500
  }, _callee);
6323
6501
  }));
6324
- return function createTypeAndThenTransfer(_x, _x2) {
6502
+ return function createTypeAndThenCall(_x, _x2) {
6325
6503
  return _ref.apply(this, arguments);
6326
6504
  };
6327
6505
  }();
@@ -7051,11 +7229,10 @@ var validateHops = function validateHops(hops) {
7051
7229
  };
7052
7230
  var getReserveFeeFromHops = function getReserveFeeFromHops(hops) {
7053
7231
  if (!hops || hops.length === 0 || !hops[0].result.success) {
7054
- return MIN_FEE$1;
7232
+ return MIN_FEE;
7055
7233
  }
7056
7234
  return hops[0].result.fee;
7057
7235
  };
7058
- var MIN_FEE$1 = 1000n;
7059
7236
  var FEE_PADDING_PERCENTAGE$1 = 40;
7060
7237
  var handleExecuteTransfer = /*#__PURE__*/function () {
7061
7238
  var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
@@ -7095,7 +7272,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
7095
7272
  throw new InvalidParameterError("Asset amount is too low, please increase the amount or use a different fee asset.");
7096
7273
  }
7097
7274
  };
7098
- checkAmount(MIN_FEE$1);
7275
+ checkAmount(MIN_FEE);
7099
7276
  destChain = getTNode(paraIdTo, getRelayChainOf(chain).toLowerCase());
7100
7277
  internalOptions = {
7101
7278
  api: api,
@@ -7113,8 +7290,8 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
7113
7290
  };
7114
7291
  call = createExecuteCall(chain, createDirectExecuteXcm(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
7115
7292
  fees: {
7116
- originFee: feeAssetBalance && feeAssetBalance > 1n ? feeAssetBalance : MIN_FEE$1,
7117
- reserveFee: MIN_FEE$1
7293
+ originFee: feeAssetBalance && feeAssetBalance > 1n ? feeAssetBalance : MIN_FEE,
7294
+ reserveFee: MIN_FEE
7118
7295
  }
7119
7296
  })), MAX_WEIGHT);
7120
7297
  _context.n = 5;
@@ -7285,7 +7462,6 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
7285
7462
  };
7286
7463
  }();
7287
7464
 
7288
- var MIN_FEE = 1000n;
7289
7465
  var FEE_PADDING_PERCENTAGE = 20;
7290
7466
  var validateAmount = function validateAmount(amount, requiredFee) {
7291
7467
  if (amount <= requiredFee) {
@@ -7864,7 +8040,7 @@ var ParachainNode = /*#__PURE__*/function () {
7864
8040
  key: "transfer",
7865
8041
  value: function () {
7866
8042
  var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
7867
- var api, asset, currency, feeAsset, feeCurrency, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, scenario, paraId, isLocalTransfer, isBifrostOrigin, isJamtonOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest;
8043
+ var api, asset, currency, feeAsset, feeCurrency, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, scenario, paraId, isLocalTransfer, isBifrostOrigin, isJamtonOrigin, isAssetHubDest, shouldUseMultiasset, input, _options, isEthAsset, isAHPOrigin, isAHPDest, isEthDest, isEthAssetViaAh, isEthAssetToAh, call;
7868
8044
  return _regenerator().w(function (_context) {
7869
8045
  while (1) switch (_context.n) {
7870
8046
  case 0:
@@ -7961,17 +8137,17 @@ var ParachainNode = /*#__PURE__*/function () {
7961
8137
  isAHPOrigin = this.node === 'AssetHubPolkadot' || this.node === 'AssetHubKusama';
7962
8138
  isAHPDest = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
7963
8139
  isEthDest = destination === 'Ethereum'; // Eth asset - Any origin to any dest via AH - DestinationReserve - multiple instructions
7964
- if (!(isEthAsset && !isAHPOrigin && !isAHPDest && !isEthDest && !feeAsset)) {
7965
- _context.n = 6;
7966
- break;
7967
- }
7968
- return _context.a(2, this.transferEthAssetViaAH(_options));
7969
- case 6:
7970
- if (!(isEthAsset && isAHPDest && !isAHPOrigin && !isEthDest && !feeAsset)) {
8140
+ isEthAssetViaAh = isEthAsset && !isAHPOrigin && !isAHPDest && !isEthDest && !feeAsset; // Eth asset - Any origin to AHP - DestinationReserve - one DepositAsset instruction
8141
+ isEthAssetToAh = isEthAsset && isAHPDest && !isAHPOrigin && !isEthDest && !feeAsset;
8142
+ if (!(isEthAssetViaAh || isEthAssetToAh)) {
7971
8143
  _context.n = 7;
7972
8144
  break;
7973
8145
  }
7974
- return _context.a(2, this.transferToEthereum(_options, true));
8146
+ _context.n = 6;
8147
+ return createTypeAndThenCall(this.node, _options);
8148
+ case 6:
8149
+ call = _context.v;
8150
+ return _context.a(2, api.callTxMethod(call));
7975
8151
  case 7:
7976
8152
  return _context.a(2, this.transferPolkadotXCM(_options));
7977
8153
  case 8:
@@ -8078,118 +8254,11 @@ var ParachainNode = /*#__PURE__*/function () {
8078
8254
  }
8079
8255
  });
8080
8256
  }
8081
- }, {
8082
- key: "transferEthAssetViaAH",
8083
- value: function () {
8084
- var _transferEthAssetViaAH = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
8085
- var _feeAsset$multiLocati;
8086
- var api, asset, version, destination, address, senderAddress, feeAsset, paraIdTo, ethMultiAsset, PARA_TO_PARA_FEE_DOT, AH_EXECUTION_FEE_PADDED, dryRunResult, dryRunFeePadded, dest, call;
8087
- return _regenerator().w(function (_context2) {
8088
- while (1) switch (_context2.n) {
8089
- case 0:
8090
- api = input.api, asset = input.asset, version = input.version, destination = input.destination, address = input.address, senderAddress = input.senderAddress, feeAsset = input.feeAsset, paraIdTo = input.paraIdTo;
8091
- assertHasLocation(asset);
8092
- if (!(senderAddress === undefined)) {
8093
- _context2.n = 1;
8094
- break;
8095
- }
8096
- throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
8097
- case 1:
8098
- if (!sdkCommon.isTMultiLocation(address)) {
8099
- _context2.n = 2;
8100
- break;
8101
- }
8102
- throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
8103
- case 2:
8104
- ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
8105
- PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
8106
- // Pad by 25%
8107
- AH_EXECUTION_FEE_PADDED = ASSET_HUB_EXECUTION_FEE * 125n / 100n; // Perform a dry run AH -> dest to calculate the BuyExecution amount
8108
- _context2.n = 3;
8109
- return Builder(api.clone()).from('AssetHubPolkadot').to(destination).currency({
8110
- symbol: assets.Native('DOT'),
8111
- amount: AH_EXECUTION_FEE_PADDED
8112
- }).address(address).senderAddress(senderAddress).dryRun();
8113
- case 3:
8114
- dryRunResult = _context2.v;
8115
- if (dryRunResult.origin.success) {
8116
- _context2.n = 4;
8117
- break;
8118
- }
8119
- throw new DryRunFailedError(dryRunResult.origin.failureReason);
8120
- case 4:
8121
- // Pad fee by 50%
8122
- dryRunFeePadded = BigInt(dryRunResult.origin.fee) * 3n / 2n;
8123
- dest = createDestination(version, this.node, destination, paraIdTo);
8124
- call = {
8125
- module: 'PolkadotXcm',
8126
- method: 'transfer_assets_using_type_and_then',
8127
- parameters: {
8128
- dest: createVersionedDestination(version, this.node, destination, getParaId('AssetHubPolkadot')),
8129
- assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
8130
- assets_transfer_type: 'DestinationReserve',
8131
- remote_fees_id: addXcmVersionHeader((_feeAsset$multiLocati = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati !== void 0 ? _feeAsset$multiLocati : DOT_MULTILOCATION, version),
8132
- fees_transfer_type: 'DestinationReserve',
8133
- custom_xcm_on_dest: addXcmVersionHeader([{
8134
- SetAppendix: [{
8135
- DepositAsset: {
8136
- assets: {
8137
- Wild: 'All'
8138
- },
8139
- beneficiary: createBeneficiaryLocation({
8140
- api: api,
8141
- address: senderAddress,
8142
- version: version
8143
- })
8144
- }
8145
- }]
8146
- }, {
8147
- DepositReserveAsset: {
8148
- assets: {
8149
- Wild: 'All'
8150
- },
8151
- dest: dest,
8152
- xcm: [{
8153
- BuyExecution: {
8154
- fees: {
8155
- id: DOT_MULTILOCATION,
8156
- fun: {
8157
- Fungible: dryRunFeePadded
8158
- }
8159
- },
8160
- weight_limit: 'Unlimited'
8161
- }
8162
- }, {
8163
- DepositAsset: {
8164
- assets: {
8165
- Wild: 'All'
8166
- },
8167
- beneficiary: createBeneficiaryLocation({
8168
- api: api,
8169
- address: address,
8170
- version: version
8171
- })
8172
- }
8173
- }]
8174
- }
8175
- }], version),
8176
- weight_limit: 'Unlimited'
8177
- }
8178
- };
8179
- return _context2.a(2, api.callTxMethod(call));
8180
- }
8181
- }, _callee2, this);
8182
- }));
8183
- function transferEthAssetViaAH(_x2) {
8184
- return _transferEthAssetViaAH.apply(this, arguments);
8185
- }
8186
- return transferEthAssetViaAH;
8187
- }()
8188
8257
  }, {
8189
8258
  key: "transferToEthereum",
8190
8259
  value: function () {
8191
- var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
8192
- var _feeAsset$multiLocati2;
8260
+ var _transferToEthereum = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
8261
+ var _feeAsset$multiLocati;
8193
8262
  var useOnlyDepositInstruction,
8194
8263
  api,
8195
8264
  asset,
@@ -8211,44 +8280,39 @@ var ParachainNode = /*#__PURE__*/function () {
8211
8280
  customXcmOnDest,
8212
8281
  messageId,
8213
8282
  call,
8214
- _args3 = arguments;
8215
- return _regenerator().w(function (_context3) {
8216
- while (1) switch (_context3.n) {
8283
+ _args2 = arguments;
8284
+ return _regenerator().w(function (_context2) {
8285
+ while (1) switch (_context2.n) {
8217
8286
  case 0:
8218
- useOnlyDepositInstruction = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
8287
+ useOnlyDepositInstruction = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : false;
8219
8288
  api = input.api, asset = input.asset, version = input.version, destination = input.destination, address = input.address, senderAddress = input.senderAddress, feeAsset = input.feeAsset;
8220
- _context3.n = 1;
8289
+ _context2.n = 1;
8221
8290
  return getBridgeStatus(api.clone());
8222
8291
  case 1:
8223
- bridgeStatus = _context3.v;
8292
+ bridgeStatus = _context2.v;
8224
8293
  if (!(bridgeStatus !== 'Normal')) {
8225
- _context3.n = 2;
8294
+ _context2.n = 2;
8226
8295
  break;
8227
8296
  }
8228
8297
  throw new BridgeHaltedError();
8229
8298
  case 2:
8230
8299
  assertHasLocation(asset);
8300
+ assertAddressIsString(address);
8231
8301
  if (!(senderAddress === undefined)) {
8232
- _context3.n = 3;
8302
+ _context2.n = 3;
8233
8303
  break;
8234
8304
  }
8235
8305
  throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
8236
8306
  case 3:
8237
- if (!sdkCommon.isTMultiLocation(address)) {
8238
- _context3.n = 4;
8239
- break;
8240
- }
8241
- throw new InvalidParameterError('Multi-location address is not supported for Ethereum transfers');
8242
- case 4:
8243
8307
  ethMultiAsset = createMultiAsset(version, asset.amount, asset.multiLocation);
8244
- _context3.n = 5;
8308
+ _context2.n = 4;
8245
8309
  return api.createApiForNode('AssetHubPolkadot');
8246
- case 5:
8247
- ahApi = _context3.v;
8248
- _context3.n = 6;
8310
+ case 4:
8311
+ ahApi = _context2.v;
8312
+ _context2.n = 5;
8249
8313
  return getParaEthTransferFees(ahApi);
8250
- case 6:
8251
- _yield$getParaEthTran = _context3.v;
8314
+ case 5:
8315
+ _yield$getParaEthTran = _context2.v;
8252
8316
  _yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
8253
8317
  bridgeFee = _yield$getParaEthTran2[0];
8254
8318
  executionFee = _yield$getParaEthTran2[1];
@@ -8256,13 +8320,13 @@ var ParachainNode = /*#__PURE__*/function () {
8256
8320
  fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : bridgeFee + executionFee;
8257
8321
  ethAsset = assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
8258
8322
  if (ethAsset) {
8259
- _context3.n = 7;
8323
+ _context2.n = 6;
8260
8324
  break;
8261
8325
  }
8262
8326
  throw new assets.InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt)));
8263
- case 7:
8327
+ case 6:
8264
8328
  if (!useOnlyDepositInstruction) {
8265
- _context3.n = 8;
8329
+ _context2.n = 7;
8266
8330
  break;
8267
8331
  }
8268
8332
  customXcmOnDest = addXcmVersionHeader([{
@@ -8279,16 +8343,16 @@ var ParachainNode = /*#__PURE__*/function () {
8279
8343
  })
8280
8344
  }
8281
8345
  }], version);
8282
- _context3.n = 10;
8346
+ _context2.n = 9;
8283
8347
  break;
8284
- case 8:
8348
+ case 7:
8285
8349
  assertHasId(ethAsset);
8286
- _context3.n = 9;
8350
+ _context2.n = 8;
8287
8351
  return generateMessageId(api, senderAddress, getParaId(this.node), ethAsset.assetId, address, asset.amount);
8288
- case 9:
8289
- messageId = _context3.v;
8352
+ case 8:
8353
+ messageId = _context2.v;
8290
8354
  customXcmOnDest = createCustomXcmOnDest(input, this.node, messageId);
8291
- case 10:
8355
+ case 9:
8292
8356
  call = {
8293
8357
  module: 'PolkadotXcm',
8294
8358
  method: 'transfer_assets_using_type_and_then',
@@ -8296,17 +8360,17 @@ var ParachainNode = /*#__PURE__*/function () {
8296
8360
  dest: createVersionedDestination(version, this.node, destination, getParaId('AssetHubPolkadot')),
8297
8361
  assets: addXcmVersionHeader([].concat(_toConsumableArray(!feeAsset ? [createMultiAsset(version, fee, DOT_MULTILOCATION)] : []), [ethMultiAsset]), version),
8298
8362
  assets_transfer_type: 'DestinationReserve',
8299
- remote_fees_id: addXcmVersionHeader((_feeAsset$multiLocati2 = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati2 !== void 0 ? _feeAsset$multiLocati2 : DOT_MULTILOCATION, version),
8363
+ remote_fees_id: addXcmVersionHeader((_feeAsset$multiLocati = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.multiLocation) !== null && _feeAsset$multiLocati !== void 0 ? _feeAsset$multiLocati : DOT_MULTILOCATION, version),
8300
8364
  fees_transfer_type: 'DestinationReserve',
8301
8365
  custom_xcm_on_dest: customXcmOnDest,
8302
8366
  weight_limit: 'Unlimited'
8303
8367
  }
8304
8368
  };
8305
- return _context3.a(2, api.callTxMethod(call));
8369
+ return _context2.a(2, api.callTxMethod(call));
8306
8370
  }
8307
- }, _callee3, this);
8371
+ }, _callee2, this);
8308
8372
  }));
8309
- function transferToEthereum(_x3) {
8373
+ function transferToEthereum(_x2) {
8310
8374
  return _transferToEthereum.apply(this, arguments);
8311
8375
  }
8312
8376
  return transferToEthereum;
@@ -8412,7 +8476,7 @@ var Ajuna = /*#__PURE__*/function (_ParachainNode) {
8412
8476
  api = input.api;
8413
8477
  _t = api;
8414
8478
  _context.n = 1;
8415
- return createTypeAndThenTransfer$2(this.node, input);
8479
+ return createTypeAndThenCall(this.node, input);
8416
8480
  case 1:
8417
8481
  _t2 = _context.v;
8418
8482
  return _context.a(2, _t.callTxMethod.call(_t, _t2));
@@ -8608,57 +8672,14 @@ var AssetHubKusama = /*#__PURE__*/function (_ParachainNode) {
8608
8672
  }]);
8609
8673
  }(ParachainNode);
8610
8674
 
8611
- var createCustomXcmToBifrost = function createCustomXcmToBifrost(_ref, version) {
8612
- var api = _ref.api,
8613
- address = _ref.address;
8614
- return _defineProperty({}, version, [{
8615
- DepositAsset: {
8616
- assets: {
8617
- Wild: 'All'
8618
- },
8619
- beneficiary: createBeneficiaryLocation({
8620
- api: api,
8621
- address: address,
8622
- version: version
8623
- })
8624
- }
8625
- }]);
8626
- };
8627
8675
  var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
8628
8676
  function AssetHubPolkadot() {
8629
- var _this;
8630
8677
  var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'AssetHubPolkadot';
8631
8678
  var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'PolkadotAssetHub';
8632
8679
  var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'polkadot';
8633
8680
  var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : sdkCommon.Version.V5;
8634
8681
  _classCallCheck(this, AssetHubPolkadot);
8635
- _this = _callSuper(this, AssetHubPolkadot, [chain, info, type, version]);
8636
- _this.handleLocalReserveTransfer = function (input) {
8637
- var useDOTAsFeeAsset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
8638
- var api = input.api,
8639
- version = input.version,
8640
- destination = input.destination,
8641
- asset = input.asset,
8642
- paraIdTo = input.paraIdTo;
8643
- assertIsForeign(asset);
8644
- assertHasLocation(asset);
8645
- var PARA_TO_PARA_FEE_DOT = 500000000n; // 0.5 DOT
8646
- var call = {
8647
- module: 'PolkadotXcm',
8648
- method: 'transfer_assets_using_type_and_then',
8649
- parameters: {
8650
- dest: createVersionedDestination(version, _this.node, destination, paraIdTo),
8651
- assets: addXcmVersionHeader([].concat(_toConsumableArray(useDOTAsFeeAsset ? [createMultiAsset(version, PARA_TO_PARA_FEE_DOT, DOT_MULTILOCATION)] : []), [createMultiAsset(version, asset.amount, asset.multiLocation)]), version),
8652
- assets_transfer_type: 'LocalReserve',
8653
- remote_fees_id: addXcmVersionHeader(useDOTAsFeeAsset ? DOT_MULTILOCATION : asset.multiLocation, version),
8654
- fees_transfer_type: 'LocalReserve',
8655
- custom_xcm_on_dest: createCustomXcmToBifrost(input, version),
8656
- weight_limit: 'Unlimited'
8657
- }
8658
- };
8659
- return api.callTxMethod(call);
8660
- };
8661
- return _this;
8682
+ return _callSuper(this, AssetHubPolkadot, [chain, info, type, version]);
8662
8683
  }
8663
8684
  _inherits(AssetHubPolkadot, _ParachainNode);
8664
8685
  return _createClass(AssetHubPolkadot, [{
@@ -8863,14 +8884,14 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
8863
8884
  }, {
8864
8885
  key: "transferPolkadotXCM",
8865
8886
  value: function () {
8866
- var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(input) {
8867
- var api, scenario, asset, destination, feeAsset, overriddenAsset, isNativeAsset, isNativeFeeAsset, isEthereumAsset, CHAINS_SUPPORT_DOT_TRANSFER, isTrusted, isDotReserveAh, method, modifiedInput, _t, _t2, _t3, _t4;
8887
+ var _transferPolkadotXCM = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(options) {
8888
+ var api, scenario, asset, destination, feeAsset, overriddenAsset, call, isNativeAsset, isNativeFeeAsset, isEthereumAsset, _call, CHAINS_SUPPORT_DOT_TRANSFER, isTrusted, isDotReserveAh, method, modifiedInput, _t, _t2, _t3, _t4;
8868
8889
  return _regenerator().w(function (_context3) {
8869
8890
  while (1) switch (_context3.n) {
8870
8891
  case 0:
8871
- api = input.api, scenario = input.scenario, asset = input.asset, destination = input.destination, feeAsset = input.feeAsset, overriddenAsset = input.overriddenAsset;
8892
+ api = options.api, scenario = options.scenario, asset = options.asset, destination = options.destination, feeAsset = options.feeAsset, overriddenAsset = options.overriddenAsset;
8872
8893
  if (!feeAsset) {
8873
- _context3.n = 4;
8894
+ _context3.n = 5;
8874
8895
  break;
8875
8896
  }
8876
8897
  if (!overriddenAsset) {
@@ -8880,83 +8901,85 @@ var AssetHubPolkadot = /*#__PURE__*/function (_ParachainNode) {
8880
8901
  throw new assets.InvalidCurrencyError('Cannot use overridden multi-assets with XCM execute');
8881
8902
  case 1:
8882
8903
  if (!assets.isSymbolMatch(asset.symbol, 'KSM')) {
8883
- _context3.n = 2;
8904
+ _context3.n = 3;
8884
8905
  break;
8885
8906
  }
8886
- return _context3.a(2, this.handleLocalReserveTransfer(input));
8907
+ _context3.n = 2;
8908
+ return createTypeAndThenCall(this.node, options);
8887
8909
  case 2:
8910
+ call = _context3.v;
8911
+ return _context3.a(2, api.callTxMethod(call));
8912
+ case 3:
8888
8913
  isNativeAsset = assets.isSymbolMatch(asset.symbol, this.getNativeAssetSymbol());
8889
8914
  isNativeFeeAsset = assets.isSymbolMatch(feeAsset.symbol, this.getNativeAssetSymbol());
8890
8915
  if (!(!isNativeAsset || !isNativeFeeAsset)) {
8891
- _context3.n = 4;
8916
+ _context3.n = 5;
8892
8917
  break;
8893
8918
  }
8894
8919
  _t = api;
8895
- _context3.n = 3;
8896
- return handleExecuteTransfer(this.node, input);
8897
- case 3:
8920
+ _context3.n = 4;
8921
+ return handleExecuteTransfer(this.node, options);
8922
+ case 4:
8898
8923
  _t2 = _context3.v;
8899
8924
  return _context3.a(2, _t.callTxMethod.call(_t, _t2));
8900
- case 4:
8901
- if (!(destination === 'AssetHubKusama')) {
8902
- _context3.n = 5;
8903
- break;
8904
- }
8905
- return _context3.a(2, this.handleBridgeTransfer(input, 'Kusama'));
8906
8925
  case 5:
8907
- if (!(destination === 'Ethereum')) {
8926
+ if (!(destination === 'AssetHubKusama')) {
8908
8927
  _context3.n = 6;
8909
8928
  break;
8910
8929
  }
8911
- return _context3.a(2, this.handleEthBridgeTransfer(input));
8930
+ return _context3.a(2, this.handleBridgeTransfer(options, 'Kusama'));
8912
8931
  case 6:
8913
- if (!(destination === 'Mythos')) {
8932
+ if (!(destination === 'Ethereum')) {
8914
8933
  _context3.n = 7;
8915
8934
  break;
8916
8935
  }
8917
- return _context3.a(2, this.handleMythosTransfer(input));
8936
+ return _context3.a(2, this.handleEthBridgeTransfer(options));
8918
8937
  case 7:
8919
- isEthereumAsset = asset.multiLocation && assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
8920
- if (!(destination === 'BifrostPolkadot' && isEthereumAsset)) {
8938
+ if (!(destination === 'Mythos')) {
8921
8939
  _context3.n = 8;
8922
8940
  break;
8923
8941
  }
8924
- return _context3.a(2, this.handleLocalReserveTransfer(input));
8942
+ return _context3.a(2, this.handleMythosTransfer(options));
8925
8943
  case 8:
8944
+ isEthereumAsset = asset.multiLocation && assets.findAssetByMultiLocation(assets.getOtherAssets('Ethereum'), asset.multiLocation);
8926
8945
  if (!isEthereumAsset) {
8927
- _context3.n = 9;
8946
+ _context3.n = 10;
8928
8947
  break;
8929
8948
  }
8930
- return _context3.a(2, this.handleLocalReserveTransfer(input, true));
8949
+ _context3.n = 9;
8950
+ return createTypeAndThenCall(this.node, options);
8931
8951
  case 9:
8952
+ _call = _context3.v;
8953
+ return _context3.a(2, api.callTxMethod(_call));
8954
+ case 10:
8932
8955
  CHAINS_SUPPORT_DOT_TRANSFER = new Set(['Hydration', 'Polimec', 'Moonbeam', 'BifrostPolkadot', 'PeoplePolkadot', 'Ajuna']);
8933
8956
  isTrusted = !sdkCommon.isTMultiLocation(destination) && sdkCommon.isSystemChain(destination);
8934
8957
  isDotReserveAh = !sdkCommon.isTMultiLocation(destination) && CHAINS_SUPPORT_DOT_TRANSFER.has(destination);
8935
8958
  if (!(scenario === 'ParaToPara' && asset.symbol === this.getNativeAssetSymbol() && !assets.isForeignAsset(asset) && !isDotReserveAh && !isTrusted)) {
8936
- _context3.n = 10;
8959
+ _context3.n = 11;
8937
8960
  break;
8938
8961
  }
8939
8962
  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.');
8940
- case 10:
8963
+ case 11:
8941
8964
  if (!(scenario === 'ParaToPara' && asset.symbol === 'KSM' && !assets.isForeignAsset(asset))) {
8942
- _context3.n = 11;
8965
+ _context3.n = 12;
8943
8966
  break;
8944
8967
  }
8945
8968
  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>}.');
8946
- case 11:
8969
+ case 12:
8947
8970
  method = this.getMethod(scenario, destination); // Patch transfer_assets to use type_and_then transfer
8948
8971
  if (!(method === 'transfer_assets' && assets.isSymbolMatch(asset.symbol, assets.getRelayChainSymbol(this.node)))) {
8949
- _context3.n = 13;
8972
+ _context3.n = 14;
8950
8973
  break;
8951
8974
  }
8952
8975
  _t3 = api;
8953
- _context3.n = 12;
8954
- return createTypeAndThenTransfer$2(this.node, input);
8955
- case 12:
8976
+ _context3.n = 13;
8977
+ return createTypeAndThenCall(this.node, options);
8978
+ case 13:
8956
8979
  _t4 = _context3.v;
8957
8980
  return _context3.a(2, _t3.callTxMethod.call(_t3, _t4));
8958
- case 13:
8959
- modifiedInput = this.patchInput(input);
8981
+ case 14:
8982
+ modifiedInput = this.patchInput(options);
8960
8983
  return _context3.a(2, transferPolkadotXcm(modifiedInput, method, 'Unlimited'));
8961
8984
  }
8962
8985
  }, _callee3, this);
@@ -9202,7 +9225,7 @@ var BifrostPolkadot = /*#__PURE__*/function (_ParachainNode) {
9202
9225
  }
9203
9226
  _t = api;
9204
9227
  _context.n = 1;
9205
- return createTypeAndThenTransfer$2(this.node, input);
9228
+ return createTypeAndThenCall(this.node, input);
9206
9229
  case 1:
9207
9230
  _t2 = _context.v;
9208
9231
  return _context.a(2, _t.callTxMethod.call(_t, _t2));
@@ -10557,7 +10580,7 @@ var Moonbeam = /*#__PURE__*/function (_ParachainNode) {
10557
10580
  }
10558
10581
  _t = api;
10559
10582
  _context.n = 2;
10560
- return createTypeAndThenTransfer$2(this.node, input);
10583
+ return createTypeAndThenCall(this.node, input);
10561
10584
  case 2:
10562
10585
  _t2 = _context.v;
10563
10586
  return _context.a(2, _t.callTxMethod.call(_t, _t2));
@@ -12288,7 +12311,7 @@ exports.createDirectExecuteXcm = createDirectExecuteXcm;
12288
12311
  exports.createExecuteCall = createExecuteCall;
12289
12312
  exports.createExecuteExchangeXcm = createExecuteExchangeXcm;
12290
12313
  exports.createMultiAsset = createMultiAsset;
12291
- exports.createTypeAndThenTransfer = createTypeAndThenTransfer$2;
12314
+ exports.createTypeAndThenCall = createTypeAndThenCall;
12292
12315
  exports.createVersionedMultiAssets = createVersionedMultiAssets;
12293
12316
  exports.createX1Payload = createX1Payload;
12294
12317
  exports.deriveAccountId = deriveAccountId;
@@ -12297,6 +12320,7 @@ exports.dryRunOrigin = dryRunOrigin;
12297
12320
  exports.encodeSs58 = encodeSs58;
12298
12321
  exports.getAssetBalance = getAssetBalance;
12299
12322
  exports.getAssetBalanceInternal = getAssetBalanceInternal;
12323
+ exports.getAssetReserveChain = getAssetReserveChain;
12300
12324
  exports.getBalanceForeign = getBalanceForeign;
12301
12325
  exports.getBalanceForeignInternal = getBalanceForeignInternal;
12302
12326
  exports.getBalanceNative = getBalanceNative;