@paraspell/sdk 3.0.10 → 3.0.11

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
@@ -3,6 +3,7 @@
3
3
  var api = require('@polkadot/api');
4
4
  var ethers = require('ethers');
5
5
  var endpoints = require('@polkadot/apps-config/endpoints');
6
+ var typeDefinitions = require('@mangata-finance/type-definitions');
6
7
 
7
8
  function _regeneratorRuntime() {
8
9
  _regeneratorRuntime = function () {
@@ -471,6 +472,29 @@ function _createSuper(Derived) {
471
472
  return _possibleConstructorReturn(this, result);
472
473
  };
473
474
  }
475
+ function _superPropBase(object, property) {
476
+ while (!Object.prototype.hasOwnProperty.call(object, property)) {
477
+ object = _getPrototypeOf(object);
478
+ if (object === null) break;
479
+ }
480
+ return object;
481
+ }
482
+ function _get() {
483
+ if (typeof Reflect !== "undefined" && Reflect.get) {
484
+ _get = Reflect.get.bind();
485
+ } else {
486
+ _get = function _get(target, property, receiver) {
487
+ var base = _superPropBase(target, property);
488
+ if (!base) return;
489
+ var desc = Object.getOwnPropertyDescriptor(base, property);
490
+ if (desc.get) {
491
+ return desc.get.call(arguments.length < 3 ? target : receiver);
492
+ }
493
+ return desc.value;
494
+ };
495
+ }
496
+ return _get.apply(this, arguments);
497
+ }
474
498
  function _toConsumableArray(arr) {
475
499
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
476
500
  }
@@ -514,6 +538,18 @@ PERFORMANCE OF THIS SOFTWARE.
514
538
  /* global Reflect, Promise, SuppressedError, Symbol */
515
539
 
516
540
 
541
+ function __rest(s, e) {
542
+ var t = {};
543
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
544
+ t[p] = s[p];
545
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
546
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
547
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
548
+ t[p[i]] = s[p[i]];
549
+ }
550
+ return t;
551
+ }
552
+
517
553
  function __awaiter(thisArg, _arguments, P, generator) {
518
554
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
519
555
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -535,6 +571,11 @@ exports.Version = void 0;
535
571
  Version["V1"] = "V1";
536
572
  Version["V3"] = "V3";
537
573
  })(exports.Version || (exports.Version = {}));
574
+ exports.Parents = void 0;
575
+ (function (Parents) {
576
+ Parents[Parents["ONE"] = 1] = "ONE";
577
+ Parents[Parents["ZERO"] = 0] = "ZERO";
578
+ })(exports.Parents || (exports.Parents = {}));
538
579
 
539
580
  // Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
540
581
  var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
@@ -1460,23 +1501,6 @@ var Interlay$2 = {
1460
1501
  }
1461
1502
  ]
1462
1503
  };
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
1504
  var Litentry$2 = {
1481
1505
  paraId: 2013,
1482
1506
  relayChainAssetSymbol: "DOT",
@@ -4890,7 +4914,6 @@ var assets = {
4890
4914
  Darwinia: Darwinia$2,
4891
4915
  HydraDX: HydraDX$2,
4892
4916
  Interlay: Interlay$2,
4893
- Kylin: Kylin$2,
4894
4917
  Litentry: Litentry$2,
4895
4918
  Moonbeam: Moonbeam$2,
4896
4919
  Parallel: Parallel$2,
@@ -4963,7 +4986,6 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
4963
4986
  InvArchTinker: InvArchTinker$2,
4964
4987
  Karura: Karura$2,
4965
4988
  Kintsugi: Kintsugi$2,
4966
- Kylin: Kylin$2,
4967
4989
  Litentry: Litentry$2,
4968
4990
  Litmus: Litmus$2,
4969
4991
  Mangata: Mangata$2,
@@ -5038,10 +5060,10 @@ var getAssetDecimals = function getAssetDecimals(node, symbol) {
5038
5060
  var getParaId = function getParaId(node) {
5039
5061
  return getAssetsObject(node).paraId;
5040
5062
  };
5041
- var getTNode = function getTNode(nodeID) {
5063
+ var getTNode = function getTNode(paraId) {
5042
5064
  var _a;
5043
5065
  return (_a = NODE_NAMES.find(function (node) {
5044
- return getParaId(node) === nodeID;
5066
+ return getParaId(node) === paraId;
5045
5067
  })) !== null && _a !== void 0 ? _a : null;
5046
5068
  };
5047
5069
 
@@ -5063,15 +5085,30 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
5063
5085
  var api = _ref.api,
5064
5086
  destination = _ref.destination,
5065
5087
  address = _ref.address,
5066
- amount = _ref.amount;
5088
+ amount = _ref.amount,
5089
+ paraIdTo = _ref.paraIdTo;
5067
5090
  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];
5091
+ var paraId = paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination);
5092
+ var parameters = [createHeaderPolkadotXCM('RelayToPara', version, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpec(amount, version, exports.Parents.ZERO), 0];
5070
5093
  if (includeFee) {
5071
5094
  parameters.push('Unlimited');
5072
5095
  }
5073
5096
  return parameters;
5074
5097
  };
5098
+ var createCurrencySpec = function createCurrencySpec(amount, version, parents) {
5099
+ var interior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'Here';
5100
+ return _defineProperty({}, version, [{
5101
+ id: {
5102
+ Concrete: {
5103
+ parents: parents,
5104
+ interior: interior
5105
+ }
5106
+ },
5107
+ fun: {
5108
+ Fungible: amount
5109
+ }
5110
+ }]);
5111
+ };
5075
5112
 
5076
5113
  var supportsXTokens = function supportsXTokens(obj) {
5077
5114
  return 'transferXTokens' in obj;
@@ -5115,10 +5152,10 @@ var ParachainNode = /*#__PURE__*/function () {
5115
5152
  }
5116
5153
  }, {
5117
5154
  key: "transfer",
5118
- value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
5119
- var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
5155
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
5156
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
5120
5157
  var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
5121
- var paraId = destination !== undefined ? getParaId(destination) : undefined;
5158
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
5122
5159
  if (supportsXTokens(this)) {
5123
5160
  return this.transferXTokens({
5124
5161
  api: api,
@@ -5135,7 +5172,7 @@ var ParachainNode = /*#__PURE__*/function () {
5135
5172
  api: api,
5136
5173
  header: createHeaderPolkadotXCM(scenario, this.version, paraId),
5137
5174
  addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
5138
- currencySelection: createCurrencySpecification(amount, scenario, this.version, this._node, currencyId),
5175
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
5139
5176
  scenario: scenario,
5140
5177
  currencySymbol: currencySymbol,
5141
5178
  serializedApiCallEnabled: serializedApiCallEnabled
@@ -5176,6 +5213,11 @@ var ParachainNode = /*#__PURE__*/function () {
5176
5213
  }, _callee, this);
5177
5214
  }));
5178
5215
  }
5216
+ }, {
5217
+ key: "createCurrencySpec",
5218
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
5219
+ return createCurrencySpec(amount, version, scenario === 'ParaToRelay' ? exports.Parents.ONE : exports.Parents.ZERO);
5220
+ }
5179
5221
  }]);
5180
5222
  return ParachainNode;
5181
5223
  }();
@@ -5436,24 +5478,6 @@ var Interlay$1 = /*#__PURE__*/function (_ParachainNode) {
5436
5478
  return Interlay;
5437
5479
  }(ParachainNode);
5438
5480
 
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
5481
  var Litentry$1 = /*#__PURE__*/function (_ParachainNode) {
5458
5482
  _inherits(Litentry, _ParachainNode);
5459
5483
  var _super = _createSuper(Litentry);
@@ -5702,6 +5726,18 @@ var Moonriver$1 = /*#__PURE__*/function (_ParachainNode) {
5702
5726
  return Moonriver;
5703
5727
  }(ParachainNode);
5704
5728
 
5729
+ var options = function options() {
5730
+ var _a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5731
+ var _a$types = _a.types,
5732
+ types = _a$types === void 0 ? {} : _a$types,
5733
+ _a$rpc = _a.rpc,
5734
+ rpc = _a$rpc === void 0 ? {} : _a$rpc,
5735
+ otherOptions = __rest(_a, ["types", "rpc"]);
5736
+ return Object.assign({
5737
+ types: Object.assign(Object.assign({}, typeDefinitions.mTypes), types),
5738
+ rpc: Object.assign(Object.assign({}, typeDefinitions.mRpc), rpc)
5739
+ }, otherOptions);
5740
+ };
5705
5741
  var Mangata$1 = /*#__PURE__*/function (_ParachainNode) {
5706
5742
  _inherits(Mangata, _ParachainNode);
5707
5743
  var _super = _createSuper(Mangata);
@@ -5718,20 +5754,21 @@ var Mangata$1 = /*#__PURE__*/function (_ParachainNode) {
5718
5754
  key: "createApiInstance",
5719
5755
  value: function createApiInstance() {
5720
5756
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5721
- var MangataSDK, instance;
5757
+ var provider;
5722
5758
  return _regeneratorRuntime().wrap(function _callee$(_context) {
5723
5759
  while (1) switch (_context.prev = _context.next) {
5724
5760
  case 0:
5725
- _context.next = 2;
5726
- return import('@mangata-finance/sdk');
5727
- case 2:
5728
- MangataSDK = _context.sent;
5729
- instance = MangataSDK.Mangata.instance([this.getProvider()]);
5730
- _context.next = 6;
5731
- return instance.api();
5732
- case 6:
5761
+ provider = new api.WsProvider(this.getProvider());
5762
+ _context.next = 3;
5763
+ return api.ApiPromise.create(options({
5764
+ provider: provider,
5765
+ throwOnConnect: true,
5766
+ throwOnUnknown: true,
5767
+ noInitWarn: true
5768
+ }));
5769
+ case 3:
5733
5770
  return _context.abrupt("return", _context.sent);
5734
- case 7:
5771
+ case 4:
5735
5772
  case "end":
5736
5773
  return _context.stop();
5737
5774
  }
@@ -6011,6 +6048,22 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
6011
6048
  parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
6012
6049
  };
6013
6050
  }
6051
+ }, {
6052
+ key: "createCurrencySpec",
6053
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
6054
+ if (scenario === 'ParaToPara') {
6055
+ var interior = {
6056
+ X2: [{
6057
+ PalletInstance: 50
6058
+ }, {
6059
+ GeneralIndex: currencyId
6060
+ }]
6061
+ };
6062
+ return createCurrencySpec(amount, version, exports.Parents.ZERO, interior);
6063
+ } else {
6064
+ return _get(_getPrototypeOf(AssetHubPolkadot.prototype), "createCurrencySpec", this).call(this, amount, scenario, version, currencyId);
6065
+ }
6066
+ }
6014
6067
  }]);
6015
6068
  return AssetHubPolkadot;
6016
6069
  }(ParachainNode);
@@ -6038,6 +6091,11 @@ var AssetHubKusama$1 = /*#__PURE__*/function (_ParachainNode) {
6038
6091
  parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
6039
6092
  };
6040
6093
  }
6094
+ }, {
6095
+ key: "createCurrencySpec",
6096
+ value: function createCurrencySpec(amount, scenario, version, currencyId) {
6097
+ return getNode('AssetHubPolkadot').createCurrencySpec(amount, scenario, version, currencyId);
6098
+ }
6041
6099
  }]);
6042
6100
  return AssetHubKusama;
6043
6101
  }(ParachainNode);
@@ -6108,6 +6166,42 @@ var Astar$1 = /*#__PURE__*/function (_ParachainNode) {
6108
6166
  var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
6109
6167
  return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
6110
6168
  }
6169
+ }, {
6170
+ key: "transferXTokens",
6171
+ value: function transferXTokens(input) {
6172
+ return XTokensTransferImpl.transferXTokens(input, input.currencyID);
6173
+ }
6174
+ }, {
6175
+ key: "transfer",
6176
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
6177
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6178
+ var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
6179
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
6180
+ var node = this.node;
6181
+ if (supportsXTokens(this) && currencySymbol !== 'ASTR') {
6182
+ return this.transferXTokens({
6183
+ api: api,
6184
+ currency: currencySymbol,
6185
+ currencyID: currencyId,
6186
+ amount: amount,
6187
+ addressSelection: generateAddressPayload(api, scenario, 'XTokens', to, this.version, paraId),
6188
+ fees: getFees(scenario),
6189
+ scenario: scenario,
6190
+ serializedApiCallEnabled: serializedApiCallEnabled
6191
+ });
6192
+ } else if (supportsPolkadotXCM(this)) {
6193
+ return this.transferPolkadotXCM({
6194
+ api: api,
6195
+ header: createHeaderPolkadotXCM(scenario, this.version, paraId),
6196
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
6197
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
6198
+ scenario: scenario,
6199
+ currencySymbol: currencySymbol,
6200
+ serializedApiCallEnabled: serializedApiCallEnabled
6201
+ });
6202
+ }
6203
+ throw new NoXCMSupportImplementedError(node);
6204
+ }
6111
6205
  }]);
6112
6206
  return Astar;
6113
6207
  }(ParachainNode);
@@ -6137,19 +6231,31 @@ var Darwinia$1 = /*#__PURE__*/function (_ParachainNode) {
6137
6231
  return _super.call(this, 'Darwinia', 'darwinia', 'polkadot', exports.Version.V3);
6138
6232
  }
6139
6233
  _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);
6234
+ key: "transferXTokens",
6235
+ value: function transferXTokens(input) {
6236
+ return XTokensTransferImpl.transferXTokens(input, input.currency === 'RING' ? 'SelfReserve' : {
6237
+ ForeignAsset: input.currencyID
6238
+ });
6147
6239
  }
6148
6240
  }, {
6149
6241
  key: "transferRelayToPara",
6150
6242
  value: function transferRelayToPara() {
6151
6243
  throw new NodeNotSupportedError();
6152
6244
  }
6245
+ }, {
6246
+ key: "createCurrencySpec",
6247
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
6248
+ if (scenario === 'ParaToPara') {
6249
+ var interior = {
6250
+ X1: {
6251
+ PalletInstance: 5
6252
+ }
6253
+ };
6254
+ return createCurrencySpec(amount, version, exports.Parents.ZERO, interior);
6255
+ } else {
6256
+ return _get(_getPrototypeOf(Darwinia.prototype), "createCurrencySpec", this).call(this, amount, scenario, version, currencyId);
6257
+ }
6258
+ }
6153
6259
  }]);
6154
6260
  return Darwinia;
6155
6261
  }(ParachainNode);
@@ -6175,6 +6281,11 @@ var Crab$1 = /*#__PURE__*/function (_ParachainNode) {
6175
6281
  value: function transferRelayToPara() {
6176
6282
  throw new NodeNotSupportedError();
6177
6283
  }
6284
+ }, {
6285
+ key: "createCurrencySpec",
6286
+ value: function createCurrencySpec(amount, scenario, version, currencyId) {
6287
+ return getNode('Darwinia').createCurrencySpec(amount, scenario, version, currencyId);
6288
+ }
6178
6289
  }]);
6179
6290
  return Crab;
6180
6291
  }(ParachainNode);
@@ -6216,6 +6327,42 @@ var Shiden$1 = /*#__PURE__*/function (_ParachainNode) {
6216
6327
  var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
6217
6328
  return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
6218
6329
  }
6330
+ }, {
6331
+ key: "transferXTokens",
6332
+ value: function transferXTokens(input) {
6333
+ return XTokensTransferImpl.transferXTokens(input, input.currencyID);
6334
+ }
6335
+ }, {
6336
+ key: "transfer",
6337
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
6338
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6339
+ var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
6340
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
6341
+ var node = this.node;
6342
+ if (supportsXTokens(this) && currencySymbol !== 'SDN') {
6343
+ return this.transferXTokens({
6344
+ api: api,
6345
+ currency: currencySymbol,
6346
+ currencyID: currencyId,
6347
+ amount: amount,
6348
+ addressSelection: generateAddressPayload(api, scenario, 'XTokens', to, this.version, paraId),
6349
+ fees: getFees(scenario),
6350
+ scenario: scenario,
6351
+ serializedApiCallEnabled: serializedApiCallEnabled
6352
+ });
6353
+ } else if (supportsPolkadotXCM(this)) {
6354
+ return this.transferPolkadotXCM({
6355
+ api: api,
6356
+ header: createHeaderPolkadotXCM(scenario, this.version, paraId),
6357
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
6358
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
6359
+ scenario: scenario,
6360
+ currencySymbol: currencySymbol,
6361
+ serializedApiCallEnabled: serializedApiCallEnabled
6362
+ });
6363
+ }
6364
+ throw new NoXCMSupportImplementedError(node);
6365
+ }
6219
6366
  }]);
6220
6367
  return Shiden;
6221
6368
  }(ParachainNode);
@@ -6305,7 +6452,7 @@ var Pendulum$1 = /*#__PURE__*/function (_ParachainNode) {
6305
6452
  var _super = _createSuper(Pendulum);
6306
6453
  function Pendulum() {
6307
6454
  _classCallCheck(this, Pendulum);
6308
- return _super.call(this, 'Pendulum', 'pendulum', 'polkadot', exports.Version.V1);
6455
+ return _super.call(this, 'Pendulum', 'pendulum', 'polkadot', exports.Version.V3);
6309
6456
  }
6310
6457
  _createClass(Pendulum, [{
6311
6458
  key: "transferXTokens",
@@ -6365,7 +6512,7 @@ var Zeitgeist$1 = /*#__PURE__*/function (_ParachainNode) {
6365
6512
  }(ParachainNode);
6366
6513
 
6367
6514
  // 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'];
6515
+ 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
6516
  var NODES_WITH_RELAY_CHAINS = [].concat(NODE_NAMES, ['Polkadot', 'Kusama']);
6370
6517
  var nodes = {
6371
6518
  AssetHubPolkadot: new AssetHubPolkadot$1(),
@@ -6382,7 +6529,6 @@ var nodes = {
6382
6529
  Darwinia: new Darwinia$1(),
6383
6530
  HydraDX: new HydraDX$1(),
6384
6531
  Interlay: new Interlay$1(),
6385
- Kylin: new Kylin$1(),
6386
6532
  Litentry: new Litentry$1(),
6387
6533
  Moonbeam: new Moonbeam$1(),
6388
6534
  Parallel: new Parallel$1(),
@@ -6494,93 +6640,6 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
6494
6640
  }
6495
6641
  };
6496
6642
  };
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
6643
  var createHeaderPolkadotXCM = function createHeaderPolkadotXCM(scenario, version, nodeId) {
6585
6644
  if (scenario === 'ParaToRelay') {
6586
6645
  return _defineProperty({}, version, {
@@ -6616,26 +6675,16 @@ var getNodeEndpointOption = function getNodeEndpointOption(node) {
6616
6675
  var _getNode = getNode(node),
6617
6676
  type = _getNode.type,
6618
6677
  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
- }
6678
+ var _ref7 = type === 'polkadot' ? endpoints.prodRelayPolkadot : endpoints.prodRelayKusama,
6679
+ linked = _ref7.linked;
6631
6680
  return linked !== undefined ? linked.find(function (o) {
6632
6681
  return o.info === name;
6633
6682
  }) : undefined;
6634
6683
  };
6635
6684
  var getAllNodeProviders = function getAllNodeProviders(node) {
6636
6685
  var _a;
6637
- var _ref10 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
6638
- providers = _ref10.providers;
6686
+ var _ref8 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
6687
+ providers = _ref8.providers;
6639
6688
  if (providers.length < 1) {
6640
6689
  throw new Error("Node ".concat(node, " does not have any providers."));
6641
6690
  }
@@ -6695,11 +6744,11 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
6695
6744
  var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
6696
6745
  return str.charAt(0).toLowerCase() + str.slice(1);
6697
6746
  };
6698
- var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref11) {
6747
+ var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref9) {
6699
6748
  var _api$tx$module;
6700
- var module = _ref11.module,
6701
- section = _ref11.section,
6702
- parameters = _ref11.parameters;
6749
+ var module = _ref9.module,
6750
+ section = _ref9.section,
6751
+ parameters = _ref9.parameters;
6703
6752
  return (_api$tx$module = api.tx[module])[section].apply(_api$tx$module, _toConsumableArray(parameters));
6704
6753
  };
6705
6754
 
@@ -6728,8 +6777,8 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
6728
6777
  };
6729
6778
 
6730
6779
  // 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;
6780
+ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6781
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6733
6782
  if (typeof currencySymbolOrId === 'number' && currencySymbolOrId > Number.MAX_SAFE_INTEGER) {
6734
6783
  throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
6735
6784
  }
@@ -6749,32 +6798,33 @@ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to
6749
6798
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
6750
6799
  }
6751
6800
  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);
6801
+ return originNode.transfer(api, asset === null || asset === void 0 ? void 0 : asset.symbol, currencyId, amount, to, destination, paraIdTo, serializedApiCallEnabled);
6753
6802
  };
6754
- var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
6755
- return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, true);
6803
+ var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6804
+ return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, paraIdTo, true);
6756
6805
  };
6757
- function send(api, origin, currencySymbolOrId, amount, to, destination) {
6758
- return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination);
6806
+ function send(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6807
+ return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, paraIdTo);
6759
6808
  }
6760
- var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address) {
6761
- var serializedApiCallEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6809
+ var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address, paraIdTo) {
6810
+ var serializedApiCallEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
6762
6811
  var serializedApiCall = getNode(destination).transferRelayToPara({
6763
6812
  api: api,
6764
6813
  destination: destination,
6765
6814
  address: address,
6766
- amount: amount
6815
+ amount: amount,
6816
+ paraIdTo: paraIdTo
6767
6817
  });
6768
6818
  if (serializedApiCallEnabled) {
6769
6819
  return serializedApiCall;
6770
6820
  }
6771
6821
  return callPolkadotJsTxFunction(api, serializedApiCall);
6772
6822
  };
6773
- function transferRelayToPara(api, destination, amount, to) {
6774
- return transferRelayToParaCommon(api, destination, amount.toString(), to);
6823
+ function transferRelayToPara(api, destination, amount, to, paraIdTo) {
6824
+ return transferRelayToParaCommon(api, destination, amount.toString(), to, paraIdTo);
6775
6825
  }
6776
- var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to) {
6777
- return transferRelayToParaCommon(api, destination, amount.toString(), to, true);
6826
+ var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to, paraIdTo) {
6827
+ return transferRelayToParaCommon(api, destination, amount.toString(), to, paraIdTo, true);
6778
6828
  };
6779
6829
 
6780
6830
  var index$3 = /*#__PURE__*/Object.freeze({
@@ -7081,10 +7131,11 @@ var OpenChannelBuilder = /*#__PURE__*/function () {
7081
7131
  }();
7082
7132
 
7083
7133
  var RelayToParaBuilder = /*#__PURE__*/function () {
7084
- function RelayToParaBuilder(api, to) {
7134
+ function RelayToParaBuilder(api, to, paraIdTo) {
7085
7135
  _classCallCheck(this, RelayToParaBuilder);
7086
7136
  this.api = api;
7087
7137
  this.to = to;
7138
+ this.paraIdTo = paraIdTo;
7088
7139
  }
7089
7140
  _createClass(RelayToParaBuilder, [{
7090
7141
  key: "amount",
@@ -7101,17 +7152,17 @@ var RelayToParaBuilder = /*#__PURE__*/function () {
7101
7152
  }, {
7102
7153
  key: "build",
7103
7154
  value: function build() {
7104
- return transferRelayToPara(this.api, this.to, this._amount, this._address);
7155
+ return transferRelayToPara(this.api, this.to, this._amount, this._address, this.paraIdTo);
7105
7156
  }
7106
7157
  }, {
7107
7158
  key: "buildSerializedApiCall",
7108
7159
  value: function buildSerializedApiCall() {
7109
- return transferRelayToParaSerializedApiCall(this.api, this.to, this._amount, this._address);
7160
+ return transferRelayToParaSerializedApiCall(this.api, this.to, this._amount, this._address, this.paraIdTo);
7110
7161
  }
7111
7162
  }], [{
7112
7163
  key: "create",
7113
- value: function create(api, to) {
7114
- return new RelayToParaBuilder(api, to);
7164
+ value: function create(api, to, paraIdTo) {
7165
+ return new RelayToParaBuilder(api, to, paraIdTo);
7115
7166
  }
7116
7167
  }]);
7117
7168
  return RelayToParaBuilder;
@@ -7204,12 +7255,13 @@ var SellBuilder = /*#__PURE__*/function () {
7204
7255
  }();
7205
7256
 
7206
7257
  var ParaToParaBuilder = /*#__PURE__*/function () {
7207
- function ParaToParaBuilder(api, from, to, currency) {
7258
+ function ParaToParaBuilder(api, from, to, currency, paraIdTo) {
7208
7259
  _classCallCheck(this, ParaToParaBuilder);
7209
7260
  this.api = api;
7210
7261
  this.from = from;
7211
7262
  this.to = to;
7212
7263
  this.currency = currency;
7264
+ this.paraIdTo = paraIdTo;
7213
7265
  }
7214
7266
  _createClass(ParaToParaBuilder, [{
7215
7267
  key: "amount",
@@ -7226,17 +7278,17 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
7226
7278
  }, {
7227
7279
  key: "build",
7228
7280
  value: function build() {
7229
- return send(this.api, this.from, this.currency, this._amount, this._address, this.to);
7281
+ return send(this.api, this.from, this.currency, this._amount, this._address, this.to, this.paraIdTo);
7230
7282
  }
7231
7283
  }, {
7232
7284
  key: "buildSerializedApiCall",
7233
7285
  value: function buildSerializedApiCall() {
7234
- return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
7286
+ return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to, this.paraIdTo);
7235
7287
  }
7236
7288
  }], [{
7237
7289
  key: "createParaToPara",
7238
- value: function createParaToPara(api, from, to, currency) {
7239
- return new ParaToParaBuilder(api, from, to, currency);
7290
+ value: function createParaToPara(api, from, to, currency, paraIdTo) {
7291
+ return new ParaToParaBuilder(api, from, to, currency, paraIdTo);
7240
7292
  }
7241
7293
  }]);
7242
7294
  return ParaToParaBuilder;
@@ -7277,16 +7329,17 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
7277
7329
  }();
7278
7330
 
7279
7331
  var ToGeneralBuilder = /*#__PURE__*/function () {
7280
- function ToGeneralBuilder(api, from, to) {
7332
+ function ToGeneralBuilder(api, from, to, paraIdTo) {
7281
7333
  _classCallCheck(this, ToGeneralBuilder);
7282
7334
  this.api = api;
7283
7335
  this.from = from;
7284
7336
  this.to = to;
7337
+ this.paraIdTo = paraIdTo;
7285
7338
  }
7286
7339
  _createClass(ToGeneralBuilder, [{
7287
7340
  key: "currency",
7288
7341
  value: function currency(_currency) {
7289
- return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency);
7342
+ return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency, this.paraIdTo);
7290
7343
  }
7291
7344
  }, {
7292
7345
  key: "openChannel",
@@ -7304,8 +7357,8 @@ var FromGeneralBuilder = /*#__PURE__*/function () {
7304
7357
  }
7305
7358
  _createClass(FromGeneralBuilder, [{
7306
7359
  key: "to",
7307
- value: function to(node) {
7308
- return new ToGeneralBuilder(this.api, this.from, node);
7360
+ value: function to(node, paraIdTo) {
7361
+ return new ToGeneralBuilder(this.api, this.from, node, paraIdTo);
7309
7362
  }
7310
7363
  }, {
7311
7364
  key: "amount",
@@ -7332,8 +7385,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
7332
7385
  }
7333
7386
  }, {
7334
7387
  key: "to",
7335
- value: function to(node) {
7336
- return RelayToParaBuilder.create(this.api, node);
7388
+ value: function to(node, paraIdTo) {
7389
+ return RelayToParaBuilder.create(this.api, node, paraIdTo);
7337
7390
  }
7338
7391
  }, {
7339
7392
  key: "addLiquidity",
@@ -7441,13 +7494,6 @@ var Interlay = {
7441
7494
  "XTokens"
7442
7495
  ]
7443
7496
  };
7444
- var Kylin = {
7445
- defaultPallet: "OrmlXTokens",
7446
- supportedPallets: [
7447
- "PolkadotXcm",
7448
- "OrmlXTokens"
7449
- ]
7450
- };
7451
7497
  var Litentry = {
7452
7498
  defaultPallet: "XTokens",
7453
7499
  supportedPallets: [
@@ -7718,7 +7764,6 @@ var pallets = {
7718
7764
  Darwinia: Darwinia,
7719
7765
  HydraDX: HydraDX,
7720
7766
  Interlay: Interlay,
7721
- Kylin: Kylin,
7722
7767
  Litentry: Litentry,
7723
7768
  Moonbeam: Moonbeam,
7724
7769
  Parallel: Parallel,
@@ -7790,7 +7835,6 @@ var palletsMapJson = /*#__PURE__*/Object.freeze({
7790
7835
  InvArchTinker: InvArchTinker,
7791
7836
  Karura: Karura,
7792
7837
  Kintsugi: Kintsugi,
7793
- Kylin: Kylin,
7794
7838
  Litentry: Litentry,
7795
7839
  Litmus: Litmus,
7796
7840
  Mangata: Mangata,