@paraspell/sdk 3.0.10 → 3.1.1

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
@@ -471,6 +471,29 @@ function _createSuper(Derived) {
471
471
  return _possibleConstructorReturn(this, result);
472
472
  };
473
473
  }
474
+ function _superPropBase(object, property) {
475
+ while (!Object.prototype.hasOwnProperty.call(object, property)) {
476
+ object = _getPrototypeOf(object);
477
+ if (object === null) break;
478
+ }
479
+ return object;
480
+ }
481
+ function _get() {
482
+ if (typeof Reflect !== "undefined" && Reflect.get) {
483
+ _get = Reflect.get.bind();
484
+ } else {
485
+ _get = function _get(target, property, receiver) {
486
+ var base = _superPropBase(target, property);
487
+ if (!base) return;
488
+ var desc = Object.getOwnPropertyDescriptor(base, property);
489
+ if (desc.get) {
490
+ return desc.get.call(arguments.length < 3 ? target : receiver);
491
+ }
492
+ return desc.value;
493
+ };
494
+ }
495
+ return _get.apply(this, arguments);
496
+ }
474
497
  function _toConsumableArray(arr) {
475
498
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
476
499
  }
@@ -514,6 +537,18 @@ PERFORMANCE OF THIS SOFTWARE.
514
537
  /* global Reflect, Promise, SuppressedError, Symbol */
515
538
 
516
539
 
540
+ function __rest(s, e) {
541
+ var t = {};
542
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
543
+ t[p] = s[p];
544
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
545
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
546
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
547
+ t[p[i]] = s[p[i]];
548
+ }
549
+ return t;
550
+ }
551
+
517
552
  function __awaiter(thisArg, _arguments, P, generator) {
518
553
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
519
554
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -535,6 +570,11 @@ exports.Version = void 0;
535
570
  Version["V1"] = "V1";
536
571
  Version["V3"] = "V3";
537
572
  })(exports.Version || (exports.Version = {}));
573
+ exports.Parents = void 0;
574
+ (function (Parents) {
575
+ Parents[Parents["ONE"] = 1] = "ONE";
576
+ Parents[Parents["ZERO"] = 0] = "ZERO";
577
+ })(exports.Parents || (exports.Parents = {}));
538
578
 
539
579
  // Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
540
580
  var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
@@ -1460,23 +1500,6 @@ var Interlay$2 = {
1460
1500
  }
1461
1501
  ]
1462
1502
  };
1463
- var Kylin$2 = {
1464
- paraId: 2052,
1465
- relayChainAssetSymbol: "DOT",
1466
- nativeAssets: [
1467
- {
1468
- symbol: "KYL",
1469
- decimals: 18
1470
- }
1471
- ],
1472
- otherAssets: [
1473
- {
1474
- assetId: "1",
1475
- symbol: "DOT",
1476
- decimals: 0
1477
- }
1478
- ]
1479
- };
1480
1503
  var Litentry$2 = {
1481
1504
  paraId: 2013,
1482
1505
  relayChainAssetSymbol: "DOT",
@@ -4890,7 +4913,6 @@ var assets = {
4890
4913
  Darwinia: Darwinia$2,
4891
4914
  HydraDX: HydraDX$2,
4892
4915
  Interlay: Interlay$2,
4893
- Kylin: Kylin$2,
4894
4916
  Litentry: Litentry$2,
4895
4917
  Moonbeam: Moonbeam$2,
4896
4918
  Parallel: Parallel$2,
@@ -4963,7 +4985,6 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
4963
4985
  InvArchTinker: InvArchTinker$2,
4964
4986
  Karura: Karura$2,
4965
4987
  Kintsugi: Kintsugi$2,
4966
- Kylin: Kylin$2,
4967
4988
  Litentry: Litentry$2,
4968
4989
  Litmus: Litmus$2,
4969
4990
  Mangata: Mangata$2,
@@ -5038,10 +5059,10 @@ var getAssetDecimals = function getAssetDecimals(node, symbol) {
5038
5059
  var getParaId = function getParaId(node) {
5039
5060
  return getAssetsObject(node).paraId;
5040
5061
  };
5041
- var getTNode = function getTNode(nodeID) {
5062
+ var getTNode = function getTNode(paraId) {
5042
5063
  var _a;
5043
5064
  return (_a = NODE_NAMES.find(function (node) {
5044
- return getParaId(node) === nodeID;
5065
+ return getParaId(node) === paraId;
5045
5066
  })) !== null && _a !== void 0 ? _a : null;
5046
5067
  };
5047
5068
 
@@ -5063,15 +5084,42 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
5063
5084
  var api = _ref.api,
5064
5085
  destination = _ref.destination,
5065
5086
  address = _ref.address,
5066
- amount = _ref.amount;
5087
+ amount = _ref.amount,
5088
+ paraIdTo = _ref.paraIdTo;
5067
5089
  var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
5068
- var paraId = getParaId(destination);
5069
- var parameters = [createHeaderPolkadotXCM('RelayToPara', version, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpecification(amount, 'RelayToPara', version, destination), 0];
5090
+ var paraId = paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination);
5091
+ var parameters = [createPolkadotXcmHeader('RelayToPara', version, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpec(amount, version, exports.Parents.ZERO), 0];
5070
5092
  if (includeFee) {
5071
5093
  parameters.push('Unlimited');
5072
5094
  }
5073
5095
  return parameters;
5074
5096
  };
5097
+ var createCurrencySpec = function createCurrencySpec(amount, version, parents) {
5098
+ var interior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'Here';
5099
+ return _defineProperty({}, version, [{
5100
+ id: {
5101
+ Concrete: {
5102
+ parents: parents,
5103
+ interior: interior
5104
+ }
5105
+ },
5106
+ fun: {
5107
+ Fungible: amount
5108
+ }
5109
+ }]);
5110
+ };
5111
+ var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, nodeId) {
5112
+ var parents = scenario === 'RelayToPara' ? exports.Parents.ZERO : exports.Parents.ONE;
5113
+ var interior = scenario === 'ParaToRelay' ? 'Here' : {
5114
+ X1: {
5115
+ Parachain: nodeId
5116
+ }
5117
+ };
5118
+ return _defineProperty({}, scenario === 'RelayToPara' ? exports.Version.V3 : version, {
5119
+ parents: parents,
5120
+ interior: interior
5121
+ });
5122
+ };
5075
5123
 
5076
5124
  var supportsXTokens = function supportsXTokens(obj) {
5077
5125
  return 'transferXTokens' in obj;
@@ -5115,10 +5163,10 @@ var ParachainNode = /*#__PURE__*/function () {
5115
5163
  }
5116
5164
  }, {
5117
5165
  key: "transfer",
5118
- value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
5119
- var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
5166
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
5167
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
5120
5168
  var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
5121
- var paraId = destination !== undefined ? getParaId(destination) : undefined;
5169
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
5122
5170
  if (supportsXTokens(this)) {
5123
5171
  return this.transferXTokens({
5124
5172
  api: api,
@@ -5133,9 +5181,9 @@ var ParachainNode = /*#__PURE__*/function () {
5133
5181
  } else if (supportsPolkadotXCM(this)) {
5134
5182
  return this.transferPolkadotXCM({
5135
5183
  api: api,
5136
- header: createHeaderPolkadotXCM(scenario, this.version, paraId),
5184
+ header: this.createPolkadotXcmHeader(scenario, paraId),
5137
5185
  addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
5138
- currencySelection: createCurrencySpecification(amount, scenario, this.version, this._node, currencyId),
5186
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
5139
5187
  scenario: scenario,
5140
5188
  currencySymbol: currencySymbol,
5141
5189
  serializedApiCallEnabled: serializedApiCallEnabled
@@ -5176,6 +5224,16 @@ var ParachainNode = /*#__PURE__*/function () {
5176
5224
  }, _callee, this);
5177
5225
  }));
5178
5226
  }
5227
+ }, {
5228
+ key: "createCurrencySpec",
5229
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
5230
+ return createCurrencySpec(amount, version, scenario === 'ParaToRelay' ? exports.Parents.ONE : exports.Parents.ZERO);
5231
+ }
5232
+ }, {
5233
+ key: "createPolkadotXcmHeader",
5234
+ value: function createPolkadotXcmHeader$1(scenario, paraId) {
5235
+ return createPolkadotXcmHeader(scenario, this.version, paraId);
5236
+ }
5179
5237
  }]);
5180
5238
  return ParachainNode;
5181
5239
  }();
@@ -5436,24 +5494,6 @@ var Interlay$1 = /*#__PURE__*/function (_ParachainNode) {
5436
5494
  return Interlay;
5437
5495
  }(ParachainNode);
5438
5496
 
5439
- var Kylin$1 = /*#__PURE__*/function (_ParachainNode) {
5440
- _inherits(Kylin, _ParachainNode);
5441
- var _super = _createSuper(Kylin);
5442
- function Kylin() {
5443
- _classCallCheck(this, Kylin);
5444
- return _super.call(this, 'Kylin', 'kylin', 'polkadot', exports.Version.V1);
5445
- }
5446
- _createClass(Kylin, [{
5447
- key: "transferXTokens",
5448
- value: function transferXTokens(input) {
5449
- var currency = input.currency,
5450
- fees = input.fees;
5451
- return XTokensTransferImpl.transferXTokens(input, currency, fees, 'OrmlXTokens');
5452
- }
5453
- }]);
5454
- return Kylin;
5455
- }(ParachainNode);
5456
-
5457
5497
  var Litentry$1 = /*#__PURE__*/function (_ParachainNode) {
5458
5498
  _inherits(Litentry, _ParachainNode);
5459
5499
  var _super = _createSuper(Litentry);
@@ -5482,7 +5522,7 @@ var Moonbeam$1 = /*#__PURE__*/function (_ParachainNode) {
5482
5522
  value: function transferXTokens(input) {
5483
5523
  var currency = input.currency,
5484
5524
  currencyID = input.currencyID;
5485
- var currencySelection = currency === 'GLMR' ? 'SelfReserve ' : {
5525
+ var currencySelection = currency === 'GLMR' ? 'SelfReserve' : {
5486
5526
  ForeignAsset: currencyID
5487
5527
  };
5488
5528
  return XTokensTransferImpl.transferXTokens(input, currencySelection);
@@ -5505,7 +5545,7 @@ var Parallel$1 = /*#__PURE__*/function (_ParachainNode) {
5505
5545
  var _super = _createSuper(Parallel);
5506
5546
  function Parallel() {
5507
5547
  _classCallCheck(this, Parallel);
5508
- return _super.call(this, 'Parallel', 'parallel', 'polkadot', exports.Version.V1);
5548
+ return _super.call(this, 'Parallel', 'parallel', 'polkadot', exports.Version.V3);
5509
5549
  }
5510
5550
  _createClass(Parallel, [{
5511
5551
  key: "transferXTokens",
@@ -5684,7 +5724,7 @@ var Moonriver$1 = /*#__PURE__*/function (_ParachainNode) {
5684
5724
  value: function transferXTokens(input) {
5685
5725
  var currency = input.currency,
5686
5726
  currencyID = input.currencyID;
5687
- var currencySelection = currency === 'MOVR' ? 'SelfReserve ' : {
5727
+ var currencySelection = currency === 'MOVR' ? 'SelfReserve' : {
5688
5728
  ForeignAsset: currencyID
5689
5729
  };
5690
5730
  return XTokensTransferImpl.transferXTokens(input, currencySelection);
@@ -5718,20 +5758,39 @@ var Mangata$1 = /*#__PURE__*/function (_ParachainNode) {
5718
5758
  key: "createApiInstance",
5719
5759
  value: function createApiInstance() {
5720
5760
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5721
- var MangataSDK, instance;
5761
+ var _yield$import, mTypes, mRpc, options, provider;
5722
5762
  return _regeneratorRuntime().wrap(function _callee$(_context) {
5723
5763
  while (1) switch (_context.prev = _context.next) {
5724
5764
  case 0:
5725
5765
  _context.next = 2;
5726
- return import('@mangata-finance/sdk');
5766
+ return import('@mangata-finance/type-definitions');
5727
5767
  case 2:
5728
- MangataSDK = _context.sent;
5729
- instance = MangataSDK.Mangata.instance([this.getProvider()]);
5730
- _context.next = 6;
5731
- return instance.api();
5732
- case 6:
5768
+ _yield$import = _context.sent;
5769
+ mTypes = _yield$import.mTypes;
5770
+ mRpc = _yield$import.mRpc;
5771
+ options = function options() {
5772
+ var _a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5773
+ var _a$types = _a.types,
5774
+ types = _a$types === void 0 ? {} : _a$types,
5775
+ _a$rpc = _a.rpc,
5776
+ rpc = _a$rpc === void 0 ? {} : _a$rpc,
5777
+ otherOptions = __rest(_a, ["types", "rpc"]);
5778
+ return Object.assign({
5779
+ types: Object.assign(Object.assign({}, mTypes), types),
5780
+ rpc: Object.assign(Object.assign({}, mRpc), rpc)
5781
+ }, otherOptions);
5782
+ };
5783
+ provider = new api.WsProvider(this.getProvider());
5784
+ _context.next = 9;
5785
+ return api.ApiPromise.create(options({
5786
+ provider: provider,
5787
+ throwOnConnect: true,
5788
+ throwOnUnknown: true,
5789
+ noInitWarn: true
5790
+ }));
5791
+ case 9:
5733
5792
  return _context.abrupt("return", _context.sent);
5734
- case 7:
5793
+ case 10:
5735
5794
  case "end":
5736
5795
  return _context.stop();
5737
5796
  }
@@ -5793,11 +5852,10 @@ var Calamari$1 = /*#__PURE__*/function (_ParachainNode) {
5793
5852
  key: "transferXTokens",
5794
5853
  value: function transferXTokens(input) {
5795
5854
  // Currently only option for XCM transfer
5796
- var currencyID = input.currencyID,
5797
- fees = input.fees;
5855
+ var currencyID = input.currencyID;
5798
5856
  return XTokensTransferImpl.transferXTokens(input, {
5799
5857
  MantaCurrency: currencyID
5800
- }, fees);
5858
+ });
5801
5859
  }
5802
5860
  }]);
5803
5861
  return Calamari;
@@ -5828,7 +5886,7 @@ var CrustShadow$1 = /*#__PURE__*/function (_ParachainNode) {
5828
5886
  }, {
5829
5887
  key: "transferXTokens",
5830
5888
  value: function transferXTokens(input) {
5831
- return XTokensTransferImpl.transferXTokens(input, this.getCurrencySelection(input));
5889
+ return XTokensTransferImpl.transferXTokens(input, this.getCurrencySelection(input), input.fees);
5832
5890
  }
5833
5891
  }]);
5834
5892
  return CrustShadow;
@@ -6011,6 +6069,22 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
6011
6069
  parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
6012
6070
  };
6013
6071
  }
6072
+ }, {
6073
+ key: "createCurrencySpec",
6074
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
6075
+ if (scenario === 'ParaToPara') {
6076
+ var interior = {
6077
+ X2: [{
6078
+ PalletInstance: 50
6079
+ }, {
6080
+ GeneralIndex: currencyId
6081
+ }]
6082
+ };
6083
+ return createCurrencySpec(amount, version, exports.Parents.ZERO, interior);
6084
+ } else {
6085
+ return _get(_getPrototypeOf(AssetHubPolkadot.prototype), "createCurrencySpec", this).call(this, amount, scenario, version, currencyId);
6086
+ }
6087
+ }
6014
6088
  }]);
6015
6089
  return AssetHubPolkadot;
6016
6090
  }(ParachainNode);
@@ -6038,6 +6112,11 @@ var AssetHubKusama$1 = /*#__PURE__*/function (_ParachainNode) {
6038
6112
  parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
6039
6113
  };
6040
6114
  }
6115
+ }, {
6116
+ key: "createCurrencySpec",
6117
+ value: function createCurrencySpec(amount, scenario, version, currencyId) {
6118
+ return getNode('AssetHubPolkadot').createCurrencySpec(amount, scenario, version, currencyId);
6119
+ }
6041
6120
  }]);
6042
6121
  return AssetHubKusama;
6043
6122
  }(ParachainNode);
@@ -6108,6 +6187,42 @@ var Astar$1 = /*#__PURE__*/function (_ParachainNode) {
6108
6187
  var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
6109
6188
  return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
6110
6189
  }
6190
+ }, {
6191
+ key: "transferXTokens",
6192
+ value: function transferXTokens(input) {
6193
+ return XTokensTransferImpl.transferXTokens(input, input.currencyID);
6194
+ }
6195
+ }, {
6196
+ key: "transfer",
6197
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
6198
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6199
+ var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
6200
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
6201
+ var node = this.node;
6202
+ if (supportsXTokens(this) && currencySymbol !== 'ASTR') {
6203
+ return this.transferXTokens({
6204
+ api: api,
6205
+ currency: currencySymbol,
6206
+ currencyID: currencyId,
6207
+ amount: amount,
6208
+ addressSelection: generateAddressPayload(api, scenario, 'XTokens', to, this.version, paraId),
6209
+ fees: getFees(scenario),
6210
+ scenario: scenario,
6211
+ serializedApiCallEnabled: serializedApiCallEnabled
6212
+ });
6213
+ } else if (supportsPolkadotXCM(this)) {
6214
+ return this.transferPolkadotXCM({
6215
+ api: api,
6216
+ header: this.createPolkadotXcmHeader(scenario, paraId),
6217
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
6218
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
6219
+ scenario: scenario,
6220
+ currencySymbol: currencySymbol,
6221
+ serializedApiCallEnabled: serializedApiCallEnabled
6222
+ });
6223
+ }
6224
+ throw new NoXCMSupportImplementedError(node);
6225
+ }
6111
6226
  }]);
6112
6227
  return Astar;
6113
6228
  }(ParachainNode);
@@ -6137,19 +6252,31 @@ var Darwinia$1 = /*#__PURE__*/function (_ParachainNode) {
6137
6252
  return _super.call(this, 'Darwinia', 'darwinia', 'polkadot', exports.Version.V3);
6138
6253
  }
6139
6254
  _createClass(Darwinia, [{
6140
- key: "transferPolkadotXCM",
6141
- value: function transferPolkadotXCM(input) {
6142
- // TESTED https://polkadot.subscan.io/xcm_message/polkadot-55c5c36c8fe8794c8cfbea725c9f8bc5984c6b05
6143
- if (input.scenario === 'ParaToPara') {
6144
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserveTransferAssets');
6145
- }
6146
- throw new ScenarioNotSupportedError(this.node, input.scenario);
6255
+ key: "transferXTokens",
6256
+ value: function transferXTokens(input) {
6257
+ return XTokensTransferImpl.transferXTokens(input, input.currency === 'RING' ? 'SelfReserve' : {
6258
+ ForeignAsset: input.currencyID
6259
+ });
6147
6260
  }
6148
6261
  }, {
6149
6262
  key: "transferRelayToPara",
6150
6263
  value: function transferRelayToPara() {
6151
6264
  throw new NodeNotSupportedError();
6152
6265
  }
6266
+ }, {
6267
+ key: "createCurrencySpec",
6268
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
6269
+ if (scenario === 'ParaToPara') {
6270
+ var interior = {
6271
+ X1: {
6272
+ PalletInstance: 5
6273
+ }
6274
+ };
6275
+ return createCurrencySpec(amount, version, exports.Parents.ZERO, interior);
6276
+ } else {
6277
+ return _get(_getPrototypeOf(Darwinia.prototype), "createCurrencySpec", this).call(this, amount, scenario, version, currencyId);
6278
+ }
6279
+ }
6153
6280
  }]);
6154
6281
  return Darwinia;
6155
6282
  }(ParachainNode);
@@ -6175,6 +6302,11 @@ var Crab$1 = /*#__PURE__*/function (_ParachainNode) {
6175
6302
  value: function transferRelayToPara() {
6176
6303
  throw new NodeNotSupportedError();
6177
6304
  }
6305
+ }, {
6306
+ key: "createCurrencySpec",
6307
+ value: function createCurrencySpec(amount, scenario, version, currencyId) {
6308
+ return getNode('Darwinia').createCurrencySpec(amount, scenario, version, currencyId);
6309
+ }
6178
6310
  }]);
6179
6311
  return Crab;
6180
6312
  }(ParachainNode);
@@ -6216,6 +6348,42 @@ var Shiden$1 = /*#__PURE__*/function (_ParachainNode) {
6216
6348
  var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
6217
6349
  return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
6218
6350
  }
6351
+ }, {
6352
+ key: "transferXTokens",
6353
+ value: function transferXTokens(input) {
6354
+ return XTokensTransferImpl.transferXTokens(input, input.currencyID);
6355
+ }
6356
+ }, {
6357
+ key: "transfer",
6358
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
6359
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6360
+ var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
6361
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
6362
+ var node = this.node;
6363
+ if (supportsXTokens(this) && currencySymbol !== 'SDN') {
6364
+ return this.transferXTokens({
6365
+ api: api,
6366
+ currency: currencySymbol,
6367
+ currencyID: currencyId,
6368
+ amount: amount,
6369
+ addressSelection: generateAddressPayload(api, scenario, 'XTokens', to, this.version, paraId),
6370
+ fees: getFees(scenario),
6371
+ scenario: scenario,
6372
+ serializedApiCallEnabled: serializedApiCallEnabled
6373
+ });
6374
+ } else if (supportsPolkadotXCM(this)) {
6375
+ return this.transferPolkadotXCM({
6376
+ api: api,
6377
+ header: this.createPolkadotXcmHeader(scenario, paraId),
6378
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
6379
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
6380
+ scenario: scenario,
6381
+ currencySymbol: currencySymbol,
6382
+ serializedApiCallEnabled: serializedApiCallEnabled
6383
+ });
6384
+ }
6385
+ throw new NoXCMSupportImplementedError(node);
6386
+ }
6219
6387
  }]);
6220
6388
  return Shiden;
6221
6389
  }(ParachainNode);
@@ -6305,7 +6473,7 @@ var Pendulum$1 = /*#__PURE__*/function (_ParachainNode) {
6305
6473
  var _super = _createSuper(Pendulum);
6306
6474
  function Pendulum() {
6307
6475
  _classCallCheck(this, Pendulum);
6308
- return _super.call(this, 'Pendulum', 'pendulum', 'polkadot', exports.Version.V1);
6476
+ return _super.call(this, 'Pendulum', 'pendulum', 'polkadot', exports.Version.V3);
6309
6477
  }
6310
6478
  _createClass(Pendulum, [{
6311
6479
  key: "transferXTokens",
@@ -6365,7 +6533,7 @@ var Zeitgeist$1 = /*#__PURE__*/function (_ParachainNode) {
6365
6533
  }(ParachainNode);
6366
6534
 
6367
6535
  // Contains supported Parachains and exports supported XCM Pallets
6368
- var NODE_NAMES = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'Clover', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Kylin', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Equilibrium', 'Unique', 'Crust', 'Manta', 'Genshiro', 'Nodle', 'OriginTrail', 'Pendulum', 'Polkadex', 'Zeitgeist'];
6536
+ var NODE_NAMES = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'Clover', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Equilibrium', 'Unique', 'Crust', 'Manta', 'Genshiro', 'Nodle', 'OriginTrail', 'Pendulum', 'Polkadex', 'Zeitgeist'];
6369
6537
  var NODES_WITH_RELAY_CHAINS = [].concat(NODE_NAMES, ['Polkadot', 'Kusama']);
6370
6538
  var nodes = {
6371
6539
  AssetHubPolkadot: new AssetHubPolkadot$1(),
@@ -6382,7 +6550,6 @@ var nodes = {
6382
6550
  Darwinia: new Darwinia$1(),
6383
6551
  HydraDX: new HydraDX$1(),
6384
6552
  Interlay: new Interlay$1(),
6385
- Kylin: new Kylin$1(),
6386
6553
  Litentry: new Litentry$1(),
6387
6554
  Moonbeam: new Moonbeam$1(),
6388
6555
  Parallel: new Parallel$1(),
@@ -6494,121 +6661,6 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
6494
6661
  }
6495
6662
  };
6496
6663
  };
6497
- // TODO: Refactor this function
6498
- var createCurrencySpecification = function createCurrencySpecification(amount, scenario, version, node, cur) {
6499
- if (scenario === 'ParaToRelay') {
6500
- return _defineProperty({}, version, [{
6501
- id: {
6502
- Concrete: {
6503
- parents: 1,
6504
- interior: 'Here'
6505
- }
6506
- },
6507
- fun: {
6508
- Fungible: amount
6509
- }
6510
- }]);
6511
- }
6512
- if (scenario === 'RelayToPara' || scenario === 'ParaToPara') {
6513
- console.log('polkadotXCM Native currency to sender chain transfer');
6514
- if ((node === 'Darwinia' || node === 'Crab') && scenario === 'ParaToPara') {
6515
- // Special case for Darwinia&Crab node
6516
- return {
6517
- V3: [{
6518
- id: {
6519
- Concrete: {
6520
- parents: 0,
6521
- interior: {
6522
- X1: {
6523
- PalletInstance: 5
6524
- }
6525
- }
6526
- }
6527
- },
6528
- fun: {
6529
- Fungible: amount
6530
- }
6531
- }]
6532
- };
6533
- } else if ((node === 'AssetHubPolkadot' || node === 'AssetHubKusama') && scenario === 'ParaToPara') {
6534
- // Another specific case for AssetHubPolkadot & AssetHubKusama to send for example USDt
6535
- return {
6536
- V3: [{
6537
- id: {
6538
- Concrete: {
6539
- parents: 0,
6540
- interior: {
6541
- X2: [{
6542
- PalletInstance: 50
6543
- }, {
6544
- GeneralIndex: cur
6545
- }]
6546
- }
6547
- }
6548
- },
6549
- fun: {
6550
- Fungible: amount
6551
- }
6552
- }]
6553
- };
6554
- }
6555
- if (scenario === 'ParaToPara' && node === 'Robonomics') {
6556
- return _defineProperty({}, version, [{
6557
- id: {
6558
- Concrete: {
6559
- parents: 0,
6560
- interior: 'Here'
6561
- }
6562
- },
6563
- fun: {
6564
- Fungible: amount
6565
- }
6566
- }]);
6567
- }
6568
- // Otherwise
6569
- return {
6570
- V3: [{
6571
- id: {
6572
- Concrete: {
6573
- parents: 0,
6574
- interior: 'Here'
6575
- }
6576
- },
6577
- fun: {
6578
- Fungible: amount
6579
- }
6580
- }]
6581
- };
6582
- }
6583
- };
6584
- var createHeaderPolkadotXCM = function createHeaderPolkadotXCM(scenario, version, nodeId) {
6585
- if (scenario === 'ParaToRelay') {
6586
- return _defineProperty({}, version, {
6587
- parents: 1,
6588
- interior: 'Here'
6589
- });
6590
- }
6591
- if (scenario === 'ParaToPara') {
6592
- return _defineProperty({}, version, {
6593
- parents: 1,
6594
- interior: {
6595
- X1: {
6596
- Parachain: nodeId
6597
- }
6598
- }
6599
- });
6600
- }
6601
- return {
6602
- V3: {
6603
- parents: 0,
6604
- interior: {
6605
- X1: {
6606
- Parachain: nodeId
6607
- }
6608
- }
6609
- }
6610
- };
6611
- };
6612
6664
  var getNode = function getNode(node) {
6613
6665
  return nodes[node];
6614
6666
  };
@@ -6616,26 +6668,16 @@ var getNodeEndpointOption = function getNodeEndpointOption(node) {
6616
6668
  var _getNode = getNode(node),
6617
6669
  type = _getNode.type,
6618
6670
  name = _getNode.name;
6619
- var _ref9 = type === 'polkadot' ? endpoints.prodRelayPolkadot : endpoints.prodRelayKusama,
6620
- linked = _ref9.linked;
6621
- // TMP Fix because some nodes don't have providers in endpoint options
6622
- if (node === 'Kylin') {
6623
- return {
6624
- info: 'kylin',
6625
- paraId: 2052,
6626
- providers: {
6627
- 'Kylin Network': 'wss://polkadot.kylin-node.co.uk'
6628
- }
6629
- };
6630
- }
6671
+ var _ref5 = type === 'polkadot' ? endpoints.prodRelayPolkadot : endpoints.prodRelayKusama,
6672
+ linked = _ref5.linked;
6631
6673
  return linked !== undefined ? linked.find(function (o) {
6632
6674
  return o.info === name;
6633
6675
  }) : undefined;
6634
6676
  };
6635
6677
  var getAllNodeProviders = function getAllNodeProviders(node) {
6636
6678
  var _a;
6637
- var _ref10 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
6638
- providers = _ref10.providers;
6679
+ var _ref6 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
6680
+ providers = _ref6.providers;
6639
6681
  if (providers.length < 1) {
6640
6682
  throw new Error("Node ".concat(node, " does not have any providers."));
6641
6683
  }
@@ -6695,11 +6737,11 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
6695
6737
  var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
6696
6738
  return str.charAt(0).toLowerCase() + str.slice(1);
6697
6739
  };
6698
- var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref11) {
6740
+ var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref7) {
6699
6741
  var _api$tx$module;
6700
- var module = _ref11.module,
6701
- section = _ref11.section,
6702
- parameters = _ref11.parameters;
6742
+ var module = _ref7.module,
6743
+ section = _ref7.section,
6744
+ parameters = _ref7.parameters;
6703
6745
  return (_api$tx$module = api.tx[module])[section].apply(_api$tx$module, _toConsumableArray(parameters));
6704
6746
  };
6705
6747
 
@@ -6728,8 +6770,8 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
6728
6770
  };
6729
6771
 
6730
6772
  // Contains basic call formatting for different XCM Palletss
6731
- var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination) {
6732
- var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
6773
+ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6774
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6733
6775
  if (typeof currencySymbolOrId === 'number' && currencySymbolOrId > Number.MAX_SAFE_INTEGER) {
6734
6776
  throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
6735
6777
  }
@@ -6749,32 +6791,33 @@ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to
6749
6791
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
6750
6792
  }
6751
6793
  var currencyId = originNode.assetCheckEnabled ? asset === null || asset === void 0 ? void 0 : asset.assetId : currencySymbolOrId.toString();
6752
- return originNode.transfer(api, asset === null || asset === void 0 ? void 0 : asset.symbol, currencyId, amount, to, destination, serializedApiCallEnabled);
6794
+ return originNode.transfer(api, asset === null || asset === void 0 ? void 0 : asset.symbol, currencyId, amount, to, destination, paraIdTo, serializedApiCallEnabled);
6753
6795
  };
6754
- var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
6755
- return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, true);
6796
+ var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6797
+ return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, paraIdTo, true);
6756
6798
  };
6757
- function send(api, origin, currencySymbolOrId, amount, to, destination) {
6758
- return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination);
6799
+ function send(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6800
+ return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, paraIdTo);
6759
6801
  }
6760
- var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address) {
6761
- var serializedApiCallEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6802
+ var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address, paraIdTo) {
6803
+ var serializedApiCallEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
6762
6804
  var serializedApiCall = getNode(destination).transferRelayToPara({
6763
6805
  api: api,
6764
6806
  destination: destination,
6765
6807
  address: address,
6766
- amount: amount
6808
+ amount: amount,
6809
+ paraIdTo: paraIdTo
6767
6810
  });
6768
6811
  if (serializedApiCallEnabled) {
6769
6812
  return serializedApiCall;
6770
6813
  }
6771
6814
  return callPolkadotJsTxFunction(api, serializedApiCall);
6772
6815
  };
6773
- function transferRelayToPara(api, destination, amount, to) {
6774
- return transferRelayToParaCommon(api, destination, amount.toString(), to);
6816
+ function transferRelayToPara(api, destination, amount, to, paraIdTo) {
6817
+ return transferRelayToParaCommon(api, destination, amount.toString(), to, paraIdTo);
6775
6818
  }
6776
- var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to) {
6777
- return transferRelayToParaCommon(api, destination, amount.toString(), to, true);
6819
+ var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to, paraIdTo) {
6820
+ return transferRelayToParaCommon(api, destination, amount.toString(), to, paraIdTo, true);
6778
6821
  };
6779
6822
 
6780
6823
  var index$3 = /*#__PURE__*/Object.freeze({
@@ -7081,10 +7124,11 @@ var OpenChannelBuilder = /*#__PURE__*/function () {
7081
7124
  }();
7082
7125
 
7083
7126
  var RelayToParaBuilder = /*#__PURE__*/function () {
7084
- function RelayToParaBuilder(api, to) {
7127
+ function RelayToParaBuilder(api, to, paraIdTo) {
7085
7128
  _classCallCheck(this, RelayToParaBuilder);
7086
7129
  this.api = api;
7087
7130
  this.to = to;
7131
+ this.paraIdTo = paraIdTo;
7088
7132
  }
7089
7133
  _createClass(RelayToParaBuilder, [{
7090
7134
  key: "amount",
@@ -7101,17 +7145,17 @@ var RelayToParaBuilder = /*#__PURE__*/function () {
7101
7145
  }, {
7102
7146
  key: "build",
7103
7147
  value: function build() {
7104
- return transferRelayToPara(this.api, this.to, this._amount, this._address);
7148
+ return transferRelayToPara(this.api, this.to, this._amount, this._address, this.paraIdTo);
7105
7149
  }
7106
7150
  }, {
7107
7151
  key: "buildSerializedApiCall",
7108
7152
  value: function buildSerializedApiCall() {
7109
- return transferRelayToParaSerializedApiCall(this.api, this.to, this._amount, this._address);
7153
+ return transferRelayToParaSerializedApiCall(this.api, this.to, this._amount, this._address, this.paraIdTo);
7110
7154
  }
7111
7155
  }], [{
7112
7156
  key: "create",
7113
- value: function create(api, to) {
7114
- return new RelayToParaBuilder(api, to);
7157
+ value: function create(api, to, paraIdTo) {
7158
+ return new RelayToParaBuilder(api, to, paraIdTo);
7115
7159
  }
7116
7160
  }]);
7117
7161
  return RelayToParaBuilder;
@@ -7204,12 +7248,13 @@ var SellBuilder = /*#__PURE__*/function () {
7204
7248
  }();
7205
7249
 
7206
7250
  var ParaToParaBuilder = /*#__PURE__*/function () {
7207
- function ParaToParaBuilder(api, from, to, currency) {
7251
+ function ParaToParaBuilder(api, from, to, currency, paraIdTo) {
7208
7252
  _classCallCheck(this, ParaToParaBuilder);
7209
7253
  this.api = api;
7210
7254
  this.from = from;
7211
7255
  this.to = to;
7212
7256
  this.currency = currency;
7257
+ this.paraIdTo = paraIdTo;
7213
7258
  }
7214
7259
  _createClass(ParaToParaBuilder, [{
7215
7260
  key: "amount",
@@ -7226,17 +7271,17 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
7226
7271
  }, {
7227
7272
  key: "build",
7228
7273
  value: function build() {
7229
- return send(this.api, this.from, this.currency, this._amount, this._address, this.to);
7274
+ return send(this.api, this.from, this.currency, this._amount, this._address, this.to, this.paraIdTo);
7230
7275
  }
7231
7276
  }, {
7232
7277
  key: "buildSerializedApiCall",
7233
7278
  value: function buildSerializedApiCall() {
7234
- return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
7279
+ return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to, this.paraIdTo);
7235
7280
  }
7236
7281
  }], [{
7237
7282
  key: "createParaToPara",
7238
- value: function createParaToPara(api, from, to, currency) {
7239
- return new ParaToParaBuilder(api, from, to, currency);
7283
+ value: function createParaToPara(api, from, to, currency, paraIdTo) {
7284
+ return new ParaToParaBuilder(api, from, to, currency, paraIdTo);
7240
7285
  }
7241
7286
  }]);
7242
7287
  return ParaToParaBuilder;
@@ -7277,16 +7322,17 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
7277
7322
  }();
7278
7323
 
7279
7324
  var ToGeneralBuilder = /*#__PURE__*/function () {
7280
- function ToGeneralBuilder(api, from, to) {
7325
+ function ToGeneralBuilder(api, from, to, paraIdTo) {
7281
7326
  _classCallCheck(this, ToGeneralBuilder);
7282
7327
  this.api = api;
7283
7328
  this.from = from;
7284
7329
  this.to = to;
7330
+ this.paraIdTo = paraIdTo;
7285
7331
  }
7286
7332
  _createClass(ToGeneralBuilder, [{
7287
7333
  key: "currency",
7288
7334
  value: function currency(_currency) {
7289
- return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency);
7335
+ return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency, this.paraIdTo);
7290
7336
  }
7291
7337
  }, {
7292
7338
  key: "openChannel",
@@ -7304,8 +7350,8 @@ var FromGeneralBuilder = /*#__PURE__*/function () {
7304
7350
  }
7305
7351
  _createClass(FromGeneralBuilder, [{
7306
7352
  key: "to",
7307
- value: function to(node) {
7308
- return new ToGeneralBuilder(this.api, this.from, node);
7353
+ value: function to(node, paraIdTo) {
7354
+ return new ToGeneralBuilder(this.api, this.from, node, paraIdTo);
7309
7355
  }
7310
7356
  }, {
7311
7357
  key: "amount",
@@ -7332,8 +7378,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
7332
7378
  }
7333
7379
  }, {
7334
7380
  key: "to",
7335
- value: function to(node) {
7336
- return RelayToParaBuilder.create(this.api, node);
7381
+ value: function to(node, paraIdTo) {
7382
+ return RelayToParaBuilder.create(this.api, node, paraIdTo);
7337
7383
  }
7338
7384
  }, {
7339
7385
  key: "addLiquidity",
@@ -7441,13 +7487,6 @@ var Interlay = {
7441
7487
  "XTokens"
7442
7488
  ]
7443
7489
  };
7444
- var Kylin = {
7445
- defaultPallet: "OrmlXTokens",
7446
- supportedPallets: [
7447
- "PolkadotXcm",
7448
- "OrmlXTokens"
7449
- ]
7450
- };
7451
7490
  var Litentry = {
7452
7491
  defaultPallet: "XTokens",
7453
7492
  supportedPallets: [
@@ -7718,7 +7757,6 @@ var pallets = {
7718
7757
  Darwinia: Darwinia,
7719
7758
  HydraDX: HydraDX,
7720
7759
  Interlay: Interlay,
7721
- Kylin: Kylin,
7722
7760
  Litentry: Litentry,
7723
7761
  Moonbeam: Moonbeam,
7724
7762
  Parallel: Parallel,
@@ -7790,7 +7828,6 @@ var palletsMapJson = /*#__PURE__*/Object.freeze({
7790
7828
  InvArchTinker: InvArchTinker,
7791
7829
  Karura: Karura,
7792
7830
  Kintsugi: Kintsugi,
7793
- Kylin: Kylin,
7794
7831
  Litentry: Litentry,
7795
7832
  Litmus: Litmus,
7796
7833
  Mangata: Mangata,