@paraspell/sdk 3.0.9 → 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.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import { WsProvider, ApiPromise } from '@polkadot/api';
2
2
  import { ethers } from 'ethers';
3
3
  import { prodRelayPolkadot, prodRelayKusama } from '@polkadot/apps-config/endpoints';
4
+ import { mTypes, mRpc } from '@mangata-finance/type-definitions';
4
5
 
5
6
  function _regeneratorRuntime() {
6
7
  _regeneratorRuntime = function () {
@@ -469,6 +470,29 @@ function _createSuper(Derived) {
469
470
  return _possibleConstructorReturn(this, result);
470
471
  };
471
472
  }
473
+ function _superPropBase(object, property) {
474
+ while (!Object.prototype.hasOwnProperty.call(object, property)) {
475
+ object = _getPrototypeOf(object);
476
+ if (object === null) break;
477
+ }
478
+ return object;
479
+ }
480
+ function _get() {
481
+ if (typeof Reflect !== "undefined" && Reflect.get) {
482
+ _get = Reflect.get.bind();
483
+ } else {
484
+ _get = function _get(target, property, receiver) {
485
+ var base = _superPropBase(target, property);
486
+ if (!base) return;
487
+ var desc = Object.getOwnPropertyDescriptor(base, property);
488
+ if (desc.get) {
489
+ return desc.get.call(arguments.length < 3 ? target : receiver);
490
+ }
491
+ return desc.value;
492
+ };
493
+ }
494
+ return _get.apply(this, arguments);
495
+ }
472
496
  function _toConsumableArray(arr) {
473
497
  return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
474
498
  }
@@ -512,6 +536,18 @@ PERFORMANCE OF THIS SOFTWARE.
512
536
  /* global Reflect, Promise, SuppressedError, Symbol */
513
537
 
514
538
 
539
+ function __rest(s, e) {
540
+ var t = {};
541
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
542
+ t[p] = s[p];
543
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
544
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
545
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
546
+ t[p[i]] = s[p[i]];
547
+ }
548
+ return t;
549
+ }
550
+
515
551
  function __awaiter(thisArg, _arguments, P, generator) {
516
552
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
517
553
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -533,6 +569,11 @@ var Version;
533
569
  Version["V1"] = "V1";
534
570
  Version["V3"] = "V3";
535
571
  })(Version || (Version = {}));
572
+ var Parents;
573
+ (function (Parents) {
574
+ Parents[Parents["ONE"] = 1] = "ONE";
575
+ Parents[Parents["ZERO"] = 0] = "ZERO";
576
+ })(Parents || (Parents = {}));
536
577
 
537
578
  // Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
538
579
  var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
@@ -1458,23 +1499,6 @@ var Interlay$2 = {
1458
1499
  }
1459
1500
  ]
1460
1501
  };
1461
- var Kylin$2 = {
1462
- paraId: 2052,
1463
- relayChainAssetSymbol: "DOT",
1464
- nativeAssets: [
1465
- {
1466
- symbol: "KYL",
1467
- decimals: 18
1468
- }
1469
- ],
1470
- otherAssets: [
1471
- {
1472
- assetId: "1",
1473
- symbol: "DOT",
1474
- decimals: 0
1475
- }
1476
- ]
1477
- };
1478
1502
  var Litentry$2 = {
1479
1503
  paraId: 2013,
1480
1504
  relayChainAssetSymbol: "DOT",
@@ -4888,7 +4912,6 @@ var assets = {
4888
4912
  Darwinia: Darwinia$2,
4889
4913
  HydraDX: HydraDX$2,
4890
4914
  Interlay: Interlay$2,
4891
- Kylin: Kylin$2,
4892
4915
  Litentry: Litentry$2,
4893
4916
  Moonbeam: Moonbeam$2,
4894
4917
  Parallel: Parallel$2,
@@ -4961,7 +4984,6 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
4961
4984
  InvArchTinker: InvArchTinker$2,
4962
4985
  Karura: Karura$2,
4963
4986
  Kintsugi: Kintsugi$2,
4964
- Kylin: Kylin$2,
4965
4987
  Litentry: Litentry$2,
4966
4988
  Litmus: Litmus$2,
4967
4989
  Mangata: Mangata$2,
@@ -5036,10 +5058,10 @@ var getAssetDecimals = function getAssetDecimals(node, symbol) {
5036
5058
  var getParaId = function getParaId(node) {
5037
5059
  return getAssetsObject(node).paraId;
5038
5060
  };
5039
- var getTNode = function getTNode(nodeID) {
5061
+ var getTNode = function getTNode(paraId) {
5040
5062
  var _a;
5041
5063
  return (_a = NODE_NAMES.find(function (node) {
5042
- return getParaId(node) === nodeID;
5064
+ return getParaId(node) === paraId;
5043
5065
  })) !== null && _a !== void 0 ? _a : null;
5044
5066
  };
5045
5067
 
@@ -5061,15 +5083,30 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
5061
5083
  var api = _ref.api,
5062
5084
  destination = _ref.destination,
5063
5085
  address = _ref.address,
5064
- amount = _ref.amount;
5086
+ amount = _ref.amount,
5087
+ paraIdTo = _ref.paraIdTo;
5065
5088
  var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
5066
- var paraId = getParaId(destination);
5067
- var parameters = [createHeaderPolkadotXCM('RelayToPara', version, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpecification(amount, 'RelayToPara', version, destination), 0];
5089
+ var paraId = paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination);
5090
+ var parameters = [createHeaderPolkadotXCM('RelayToPara', version, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpec(amount, version, Parents.ZERO), 0];
5068
5091
  if (includeFee) {
5069
5092
  parameters.push('Unlimited');
5070
5093
  }
5071
5094
  return parameters;
5072
5095
  };
5096
+ var createCurrencySpec = function createCurrencySpec(amount, version, parents) {
5097
+ var interior = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'Here';
5098
+ return _defineProperty({}, version, [{
5099
+ id: {
5100
+ Concrete: {
5101
+ parents: parents,
5102
+ interior: interior
5103
+ }
5104
+ },
5105
+ fun: {
5106
+ Fungible: amount
5107
+ }
5108
+ }]);
5109
+ };
5073
5110
 
5074
5111
  var supportsXTokens = function supportsXTokens(obj) {
5075
5112
  return 'transferXTokens' in obj;
@@ -5113,10 +5150,10 @@ var ParachainNode = /*#__PURE__*/function () {
5113
5150
  }
5114
5151
  }, {
5115
5152
  key: "transfer",
5116
- value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
5117
- var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
5153
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
5154
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
5118
5155
  var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
5119
- var paraId = destination !== undefined ? getParaId(destination) : undefined;
5156
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
5120
5157
  if (supportsXTokens(this)) {
5121
5158
  return this.transferXTokens({
5122
5159
  api: api,
@@ -5133,7 +5170,7 @@ var ParachainNode = /*#__PURE__*/function () {
5133
5170
  api: api,
5134
5171
  header: createHeaderPolkadotXCM(scenario, this.version, paraId),
5135
5172
  addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
5136
- currencySelection: createCurrencySpecification(amount, scenario, this.version, this._node, currencyId),
5173
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
5137
5174
  scenario: scenario,
5138
5175
  currencySymbol: currencySymbol,
5139
5176
  serializedApiCallEnabled: serializedApiCallEnabled
@@ -5174,6 +5211,11 @@ var ParachainNode = /*#__PURE__*/function () {
5174
5211
  }, _callee, this);
5175
5212
  }));
5176
5213
  }
5214
+ }, {
5215
+ key: "createCurrencySpec",
5216
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
5217
+ return createCurrencySpec(amount, version, scenario === 'ParaToRelay' ? Parents.ONE : Parents.ZERO);
5218
+ }
5177
5219
  }]);
5178
5220
  return ParachainNode;
5179
5221
  }();
@@ -5434,24 +5476,6 @@ var Interlay$1 = /*#__PURE__*/function (_ParachainNode) {
5434
5476
  return Interlay;
5435
5477
  }(ParachainNode);
5436
5478
 
5437
- var Kylin$1 = /*#__PURE__*/function (_ParachainNode) {
5438
- _inherits(Kylin, _ParachainNode);
5439
- var _super = _createSuper(Kylin);
5440
- function Kylin() {
5441
- _classCallCheck(this, Kylin);
5442
- return _super.call(this, 'Kylin', 'kylin', 'polkadot', Version.V1);
5443
- }
5444
- _createClass(Kylin, [{
5445
- key: "transferXTokens",
5446
- value: function transferXTokens(input) {
5447
- var currency = input.currency,
5448
- fees = input.fees;
5449
- return XTokensTransferImpl.transferXTokens(input, currency, fees, 'OrmlXTokens');
5450
- }
5451
- }]);
5452
- return Kylin;
5453
- }(ParachainNode);
5454
-
5455
5479
  var Litentry$1 = /*#__PURE__*/function (_ParachainNode) {
5456
5480
  _inherits(Litentry, _ParachainNode);
5457
5481
  var _super = _createSuper(Litentry);
@@ -5700,6 +5724,18 @@ var Moonriver$1 = /*#__PURE__*/function (_ParachainNode) {
5700
5724
  return Moonriver;
5701
5725
  }(ParachainNode);
5702
5726
 
5727
+ var options = function options() {
5728
+ var _a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5729
+ var _a$types = _a.types,
5730
+ types = _a$types === void 0 ? {} : _a$types,
5731
+ _a$rpc = _a.rpc,
5732
+ rpc = _a$rpc === void 0 ? {} : _a$rpc,
5733
+ otherOptions = __rest(_a, ["types", "rpc"]);
5734
+ return Object.assign({
5735
+ types: Object.assign(Object.assign({}, mTypes), types),
5736
+ rpc: Object.assign(Object.assign({}, mRpc), rpc)
5737
+ }, otherOptions);
5738
+ };
5703
5739
  var Mangata$1 = /*#__PURE__*/function (_ParachainNode) {
5704
5740
  _inherits(Mangata, _ParachainNode);
5705
5741
  var _super = _createSuper(Mangata);
@@ -5716,20 +5752,21 @@ var Mangata$1 = /*#__PURE__*/function (_ParachainNode) {
5716
5752
  key: "createApiInstance",
5717
5753
  value: function createApiInstance() {
5718
5754
  return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5719
- var MangataSDK, instance;
5755
+ var provider;
5720
5756
  return _regeneratorRuntime().wrap(function _callee$(_context) {
5721
5757
  while (1) switch (_context.prev = _context.next) {
5722
5758
  case 0:
5723
- _context.next = 2;
5724
- return import('@mangata-finance/sdk');
5725
- case 2:
5726
- MangataSDK = _context.sent;
5727
- instance = MangataSDK.Mangata.instance([this.getProvider()]);
5728
- _context.next = 6;
5729
- return instance.api();
5730
- case 6:
5759
+ provider = new WsProvider(this.getProvider());
5760
+ _context.next = 3;
5761
+ return ApiPromise.create(options({
5762
+ provider: provider,
5763
+ throwOnConnect: true,
5764
+ throwOnUnknown: true,
5765
+ noInitWarn: true
5766
+ }));
5767
+ case 3:
5731
5768
  return _context.abrupt("return", _context.sent);
5732
- case 7:
5769
+ case 4:
5733
5770
  case "end":
5734
5771
  return _context.stop();
5735
5772
  }
@@ -6009,6 +6046,22 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
6009
6046
  parameters: constructRelayToParaParameters(options, Version.V3, true)
6010
6047
  };
6011
6048
  }
6049
+ }, {
6050
+ key: "createCurrencySpec",
6051
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
6052
+ if (scenario === 'ParaToPara') {
6053
+ var interior = {
6054
+ X2: [{
6055
+ PalletInstance: 50
6056
+ }, {
6057
+ GeneralIndex: currencyId
6058
+ }]
6059
+ };
6060
+ return createCurrencySpec(amount, version, Parents.ZERO, interior);
6061
+ } else {
6062
+ return _get(_getPrototypeOf(AssetHubPolkadot.prototype), "createCurrencySpec", this).call(this, amount, scenario, version, currencyId);
6063
+ }
6064
+ }
6012
6065
  }]);
6013
6066
  return AssetHubPolkadot;
6014
6067
  }(ParachainNode);
@@ -6036,6 +6089,11 @@ var AssetHubKusama$1 = /*#__PURE__*/function (_ParachainNode) {
6036
6089
  parameters: constructRelayToParaParameters(options, Version.V3, true)
6037
6090
  };
6038
6091
  }
6092
+ }, {
6093
+ key: "createCurrencySpec",
6094
+ value: function createCurrencySpec(amount, scenario, version, currencyId) {
6095
+ return getNode('AssetHubPolkadot').createCurrencySpec(amount, scenario, version, currencyId);
6096
+ }
6039
6097
  }]);
6040
6098
  return AssetHubKusama;
6041
6099
  }(ParachainNode);
@@ -6106,6 +6164,42 @@ var Astar$1 = /*#__PURE__*/function (_ParachainNode) {
6106
6164
  var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
6107
6165
  return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
6108
6166
  }
6167
+ }, {
6168
+ key: "transferXTokens",
6169
+ value: function transferXTokens(input) {
6170
+ return XTokensTransferImpl.transferXTokens(input, input.currencyID);
6171
+ }
6172
+ }, {
6173
+ key: "transfer",
6174
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
6175
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6176
+ var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
6177
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
6178
+ var node = this.node;
6179
+ if (supportsXTokens(this) && currencySymbol !== 'ASTR') {
6180
+ return this.transferXTokens({
6181
+ api: api,
6182
+ currency: currencySymbol,
6183
+ currencyID: currencyId,
6184
+ amount: amount,
6185
+ addressSelection: generateAddressPayload(api, scenario, 'XTokens', to, this.version, paraId),
6186
+ fees: getFees(scenario),
6187
+ scenario: scenario,
6188
+ serializedApiCallEnabled: serializedApiCallEnabled
6189
+ });
6190
+ } else if (supportsPolkadotXCM(this)) {
6191
+ return this.transferPolkadotXCM({
6192
+ api: api,
6193
+ header: createHeaderPolkadotXCM(scenario, this.version, paraId),
6194
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
6195
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
6196
+ scenario: scenario,
6197
+ currencySymbol: currencySymbol,
6198
+ serializedApiCallEnabled: serializedApiCallEnabled
6199
+ });
6200
+ }
6201
+ throw new NoXCMSupportImplementedError(node);
6202
+ }
6109
6203
  }]);
6110
6204
  return Astar;
6111
6205
  }(ParachainNode);
@@ -6135,19 +6229,31 @@ var Darwinia$1 = /*#__PURE__*/function (_ParachainNode) {
6135
6229
  return _super.call(this, 'Darwinia', 'darwinia', 'polkadot', Version.V3);
6136
6230
  }
6137
6231
  _createClass(Darwinia, [{
6138
- key: "transferPolkadotXCM",
6139
- value: function transferPolkadotXCM(input) {
6140
- // TESTED https://polkadot.subscan.io/xcm_message/polkadot-55c5c36c8fe8794c8cfbea725c9f8bc5984c6b05
6141
- if (input.scenario === 'ParaToPara') {
6142
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserveTransferAssets');
6143
- }
6144
- throw new ScenarioNotSupportedError(this.node, input.scenario);
6232
+ key: "transferXTokens",
6233
+ value: function transferXTokens(input) {
6234
+ return XTokensTransferImpl.transferXTokens(input, input.currency === 'RING' ? 'SelfReserve' : {
6235
+ ForeignAsset: input.currencyID
6236
+ });
6145
6237
  }
6146
6238
  }, {
6147
6239
  key: "transferRelayToPara",
6148
6240
  value: function transferRelayToPara() {
6149
6241
  throw new NodeNotSupportedError();
6150
6242
  }
6243
+ }, {
6244
+ key: "createCurrencySpec",
6245
+ value: function createCurrencySpec$1(amount, scenario, version, currencyId) {
6246
+ if (scenario === 'ParaToPara') {
6247
+ var interior = {
6248
+ X1: {
6249
+ PalletInstance: 5
6250
+ }
6251
+ };
6252
+ return createCurrencySpec(amount, version, Parents.ZERO, interior);
6253
+ } else {
6254
+ return _get(_getPrototypeOf(Darwinia.prototype), "createCurrencySpec", this).call(this, amount, scenario, version, currencyId);
6255
+ }
6256
+ }
6151
6257
  }]);
6152
6258
  return Darwinia;
6153
6259
  }(ParachainNode);
@@ -6173,6 +6279,11 @@ var Crab$1 = /*#__PURE__*/function (_ParachainNode) {
6173
6279
  value: function transferRelayToPara() {
6174
6280
  throw new NodeNotSupportedError();
6175
6281
  }
6282
+ }, {
6283
+ key: "createCurrencySpec",
6284
+ value: function createCurrencySpec(amount, scenario, version, currencyId) {
6285
+ return getNode('Darwinia').createCurrencySpec(amount, scenario, version, currencyId);
6286
+ }
6176
6287
  }]);
6177
6288
  return Crab;
6178
6289
  }(ParachainNode);
@@ -6214,6 +6325,42 @@ var Shiden$1 = /*#__PURE__*/function (_ParachainNode) {
6214
6325
  var method = input.scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
6215
6326
  return PolkadotXCMTransferImpl.transferPolkadotXCM(input, method);
6216
6327
  }
6328
+ }, {
6329
+ key: "transferXTokens",
6330
+ value: function transferXTokens(input) {
6331
+ return XTokensTransferImpl.transferXTokens(input, input.currencyID);
6332
+ }
6333
+ }, {
6334
+ key: "transfer",
6335
+ value: function transfer(api, currencySymbol, currencyId, amount, to, destination, paraIdTo) {
6336
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6337
+ var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
6338
+ var paraId = destination !== undefined ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
6339
+ var node = this.node;
6340
+ if (supportsXTokens(this) && currencySymbol !== 'SDN') {
6341
+ return this.transferXTokens({
6342
+ api: api,
6343
+ currency: currencySymbol,
6344
+ currencyID: currencyId,
6345
+ amount: amount,
6346
+ addressSelection: generateAddressPayload(api, scenario, 'XTokens', to, this.version, paraId),
6347
+ fees: getFees(scenario),
6348
+ scenario: scenario,
6349
+ serializedApiCallEnabled: serializedApiCallEnabled
6350
+ });
6351
+ } else if (supportsPolkadotXCM(this)) {
6352
+ return this.transferPolkadotXCM({
6353
+ api: api,
6354
+ header: createHeaderPolkadotXCM(scenario, this.version, paraId),
6355
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', to, this.version, paraId),
6356
+ currencySelection: this.createCurrencySpec(amount, scenario, this.version, currencyId),
6357
+ scenario: scenario,
6358
+ currencySymbol: currencySymbol,
6359
+ serializedApiCallEnabled: serializedApiCallEnabled
6360
+ });
6361
+ }
6362
+ throw new NoXCMSupportImplementedError(node);
6363
+ }
6217
6364
  }]);
6218
6365
  return Shiden;
6219
6366
  }(ParachainNode);
@@ -6303,7 +6450,7 @@ var Pendulum$1 = /*#__PURE__*/function (_ParachainNode) {
6303
6450
  var _super = _createSuper(Pendulum);
6304
6451
  function Pendulum() {
6305
6452
  _classCallCheck(this, Pendulum);
6306
- return _super.call(this, 'Pendulum', 'pendulum', 'polkadot', Version.V1);
6453
+ return _super.call(this, 'Pendulum', 'pendulum', 'polkadot', Version.V3);
6307
6454
  }
6308
6455
  _createClass(Pendulum, [{
6309
6456
  key: "transferXTokens",
@@ -6363,7 +6510,7 @@ var Zeitgeist$1 = /*#__PURE__*/function (_ParachainNode) {
6363
6510
  }(ParachainNode);
6364
6511
 
6365
6512
  // Contains supported Parachains and exports supported XCM Pallets
6366
- 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'];
6513
+ 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'];
6367
6514
  var NODES_WITH_RELAY_CHAINS = [].concat(NODE_NAMES, ['Polkadot', 'Kusama']);
6368
6515
  var nodes = {
6369
6516
  AssetHubPolkadot: new AssetHubPolkadot$1(),
@@ -6380,7 +6527,6 @@ var nodes = {
6380
6527
  Darwinia: new Darwinia$1(),
6381
6528
  HydraDX: new HydraDX$1(),
6382
6529
  Interlay: new Interlay$1(),
6383
- Kylin: new Kylin$1(),
6384
6530
  Litentry: new Litentry$1(),
6385
6531
  Moonbeam: new Moonbeam$1(),
6386
6532
  Parallel: new Parallel$1(),
@@ -6492,93 +6638,6 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
6492
6638
  }
6493
6639
  };
6494
6640
  };
6495
- // TODO: Refactor this function
6496
- var createCurrencySpecification = function createCurrencySpecification(amount, scenario, version, node, cur) {
6497
- if (scenario === 'ParaToRelay') {
6498
- return _defineProperty({}, version, [{
6499
- id: {
6500
- Concrete: {
6501
- parents: 1,
6502
- interior: 'Here'
6503
- }
6504
- },
6505
- fun: {
6506
- Fungible: amount
6507
- }
6508
- }]);
6509
- }
6510
- if (scenario === 'RelayToPara' || scenario === 'ParaToPara') {
6511
- console.log('polkadotXCM Native currency to sender chain transfer');
6512
- if ((node === 'Darwinia' || node === 'Crab') && scenario === 'ParaToPara') {
6513
- // Special case for Darwinia&Crab node
6514
- return {
6515
- V3: [{
6516
- id: {
6517
- Concrete: {
6518
- parents: 0,
6519
- interior: {
6520
- X1: {
6521
- PalletInstance: 5
6522
- }
6523
- }
6524
- }
6525
- },
6526
- fun: {
6527
- Fungible: amount
6528
- }
6529
- }]
6530
- };
6531
- } else if ((node === 'AssetHubPolkadot' || node === 'AssetHubKusama') && scenario === 'ParaToPara') {
6532
- // Another specific case for AssetHubPolkadot & AssetHubKusama to send for example USDt
6533
- return {
6534
- V3: [{
6535
- id: {
6536
- Concrete: {
6537
- parents: 0,
6538
- interior: {
6539
- X2: [{
6540
- PalletInstance: 50
6541
- }, {
6542
- GeneralIndex: cur
6543
- }]
6544
- }
6545
- }
6546
- },
6547
- fun: {
6548
- Fungible: amount
6549
- }
6550
- }]
6551
- };
6552
- }
6553
- if (scenario === 'ParaToPara' && node === 'Robonomics') {
6554
- return _defineProperty({}, version, [{
6555
- id: {
6556
- Concrete: {
6557
- parents: 0,
6558
- interior: 'Here'
6559
- }
6560
- },
6561
- fun: {
6562
- Fungible: amount
6563
- }
6564
- }]);
6565
- }
6566
- // Otherwise
6567
- return {
6568
- V3: [{
6569
- id: {
6570
- Concrete: {
6571
- parents: 0,
6572
- interior: 'Here'
6573
- }
6574
- },
6575
- fun: {
6576
- Fungible: amount
6577
- }
6578
- }]
6579
- };
6580
- }
6581
- };
6582
6641
  var createHeaderPolkadotXCM = function createHeaderPolkadotXCM(scenario, version, nodeId) {
6583
6642
  if (scenario === 'ParaToRelay') {
6584
6643
  return _defineProperty({}, version, {
@@ -6614,26 +6673,16 @@ var getNodeEndpointOption = function getNodeEndpointOption(node) {
6614
6673
  var _getNode = getNode(node),
6615
6674
  type = _getNode.type,
6616
6675
  name = _getNode.name;
6617
- var _ref9 = type === 'polkadot' ? prodRelayPolkadot : prodRelayKusama,
6618
- linked = _ref9.linked;
6619
- // TMP Fix because some nodes don't have providers in endpoint options
6620
- if (node === 'Kylin') {
6621
- return {
6622
- info: 'kylin',
6623
- paraId: 2052,
6624
- providers: {
6625
- 'Kylin Network': 'wss://polkadot.kylin-node.co.uk'
6626
- }
6627
- };
6628
- }
6676
+ var _ref7 = type === 'polkadot' ? prodRelayPolkadot : prodRelayKusama,
6677
+ linked = _ref7.linked;
6629
6678
  return linked !== undefined ? linked.find(function (o) {
6630
6679
  return o.info === name;
6631
6680
  }) : undefined;
6632
6681
  };
6633
6682
  var getAllNodeProviders = function getAllNodeProviders(node) {
6634
6683
  var _a;
6635
- var _ref10 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
6636
- providers = _ref10.providers;
6684
+ var _ref8 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
6685
+ providers = _ref8.providers;
6637
6686
  if (providers.length < 1) {
6638
6687
  throw new Error("Node ".concat(node, " does not have any providers."));
6639
6688
  }
@@ -6673,7 +6722,7 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
6673
6722
  break;
6674
6723
  }
6675
6724
  endpointOption = node === 'Polkadot' ? prodRelayPolkadot : prodRelayKusama;
6676
- wsUrl = Object.values(endpointOption.providers)[0];
6725
+ wsUrl = Object.values(endpointOption.providers)[1];
6677
6726
  _context2.next = 5;
6678
6727
  return createApiInstance(wsUrl);
6679
6728
  case 5:
@@ -6693,11 +6742,11 @@ var createApiInstanceForNode = function createApiInstanceForNode(node) {
6693
6742
  var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
6694
6743
  return str.charAt(0).toLowerCase() + str.slice(1);
6695
6744
  };
6696
- var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref11) {
6745
+ var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref9) {
6697
6746
  var _api$tx$module;
6698
- var module = _ref11.module,
6699
- section = _ref11.section,
6700
- parameters = _ref11.parameters;
6747
+ var module = _ref9.module,
6748
+ section = _ref9.section,
6749
+ parameters = _ref9.parameters;
6701
6750
  return (_api$tx$module = api.tx[module])[section].apply(_api$tx$module, _toConsumableArray(parameters));
6702
6751
  };
6703
6752
 
@@ -6726,8 +6775,8 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
6726
6775
  };
6727
6776
 
6728
6777
  // Contains basic call formatting for different XCM Palletss
6729
- var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination) {
6730
- var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
6778
+ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6779
+ var serializedApiCallEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
6731
6780
  if (typeof currencySymbolOrId === 'number' && currencySymbolOrId > Number.MAX_SAFE_INTEGER) {
6732
6781
  throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
6733
6782
  }
@@ -6747,32 +6796,33 @@ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to
6747
6796
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
6748
6797
  }
6749
6798
  var currencyId = originNode.assetCheckEnabled ? asset === null || asset === void 0 ? void 0 : asset.assetId : currencySymbolOrId.toString();
6750
- return originNode.transfer(api, asset === null || asset === void 0 ? void 0 : asset.symbol, currencyId, amount, to, destination, serializedApiCallEnabled);
6799
+ return originNode.transfer(api, asset === null || asset === void 0 ? void 0 : asset.symbol, currencyId, amount, to, destination, paraIdTo, serializedApiCallEnabled);
6751
6800
  };
6752
- var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
6753
- return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, true);
6801
+ var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6802
+ return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, paraIdTo, true);
6754
6803
  };
6755
- function send(api, origin, currencySymbolOrId, amount, to, destination) {
6756
- return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination);
6804
+ function send(api, origin, currencySymbolOrId, amount, to, destination, paraIdTo) {
6805
+ return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, paraIdTo);
6757
6806
  }
6758
- var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address) {
6759
- var serializedApiCallEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
6807
+ var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address, paraIdTo) {
6808
+ var serializedApiCallEnabled = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
6760
6809
  var serializedApiCall = getNode(destination).transferRelayToPara({
6761
6810
  api: api,
6762
6811
  destination: destination,
6763
6812
  address: address,
6764
- amount: amount
6813
+ amount: amount,
6814
+ paraIdTo: paraIdTo
6765
6815
  });
6766
6816
  if (serializedApiCallEnabled) {
6767
6817
  return serializedApiCall;
6768
6818
  }
6769
6819
  return callPolkadotJsTxFunction(api, serializedApiCall);
6770
6820
  };
6771
- function transferRelayToPara(api, destination, amount, to) {
6772
- return transferRelayToParaCommon(api, destination, amount.toString(), to);
6821
+ function transferRelayToPara(api, destination, amount, to, paraIdTo) {
6822
+ return transferRelayToParaCommon(api, destination, amount.toString(), to, paraIdTo);
6773
6823
  }
6774
- var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to) {
6775
- return transferRelayToParaCommon(api, destination, amount.toString(), to, true);
6824
+ var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to, paraIdTo) {
6825
+ return transferRelayToParaCommon(api, destination, amount.toString(), to, paraIdTo, true);
6776
6826
  };
6777
6827
 
6778
6828
  var index$3 = /*#__PURE__*/Object.freeze({
@@ -7079,10 +7129,11 @@ var OpenChannelBuilder = /*#__PURE__*/function () {
7079
7129
  }();
7080
7130
 
7081
7131
  var RelayToParaBuilder = /*#__PURE__*/function () {
7082
- function RelayToParaBuilder(api, to) {
7132
+ function RelayToParaBuilder(api, to, paraIdTo) {
7083
7133
  _classCallCheck(this, RelayToParaBuilder);
7084
7134
  this.api = api;
7085
7135
  this.to = to;
7136
+ this.paraIdTo = paraIdTo;
7086
7137
  }
7087
7138
  _createClass(RelayToParaBuilder, [{
7088
7139
  key: "amount",
@@ -7099,17 +7150,17 @@ var RelayToParaBuilder = /*#__PURE__*/function () {
7099
7150
  }, {
7100
7151
  key: "build",
7101
7152
  value: function build() {
7102
- return transferRelayToPara(this.api, this.to, this._amount, this._address);
7153
+ return transferRelayToPara(this.api, this.to, this._amount, this._address, this.paraIdTo);
7103
7154
  }
7104
7155
  }, {
7105
7156
  key: "buildSerializedApiCall",
7106
7157
  value: function buildSerializedApiCall() {
7107
- return transferRelayToParaSerializedApiCall(this.api, this.to, this._amount, this._address);
7158
+ return transferRelayToParaSerializedApiCall(this.api, this.to, this._amount, this._address, this.paraIdTo);
7108
7159
  }
7109
7160
  }], [{
7110
7161
  key: "create",
7111
- value: function create(api, to) {
7112
- return new RelayToParaBuilder(api, to);
7162
+ value: function create(api, to, paraIdTo) {
7163
+ return new RelayToParaBuilder(api, to, paraIdTo);
7113
7164
  }
7114
7165
  }]);
7115
7166
  return RelayToParaBuilder;
@@ -7202,12 +7253,13 @@ var SellBuilder = /*#__PURE__*/function () {
7202
7253
  }();
7203
7254
 
7204
7255
  var ParaToParaBuilder = /*#__PURE__*/function () {
7205
- function ParaToParaBuilder(api, from, to, currency) {
7256
+ function ParaToParaBuilder(api, from, to, currency, paraIdTo) {
7206
7257
  _classCallCheck(this, ParaToParaBuilder);
7207
7258
  this.api = api;
7208
7259
  this.from = from;
7209
7260
  this.to = to;
7210
7261
  this.currency = currency;
7262
+ this.paraIdTo = paraIdTo;
7211
7263
  }
7212
7264
  _createClass(ParaToParaBuilder, [{
7213
7265
  key: "amount",
@@ -7224,17 +7276,17 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
7224
7276
  }, {
7225
7277
  key: "build",
7226
7278
  value: function build() {
7227
- return send(this.api, this.from, this.currency, this._amount, this._address, this.to);
7279
+ return send(this.api, this.from, this.currency, this._amount, this._address, this.to, this.paraIdTo);
7228
7280
  }
7229
7281
  }, {
7230
7282
  key: "buildSerializedApiCall",
7231
7283
  value: function buildSerializedApiCall() {
7232
- return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
7284
+ return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to, this.paraIdTo);
7233
7285
  }
7234
7286
  }], [{
7235
7287
  key: "createParaToPara",
7236
- value: function createParaToPara(api, from, to, currency) {
7237
- return new ParaToParaBuilder(api, from, to, currency);
7288
+ value: function createParaToPara(api, from, to, currency, paraIdTo) {
7289
+ return new ParaToParaBuilder(api, from, to, currency, paraIdTo);
7238
7290
  }
7239
7291
  }]);
7240
7292
  return ParaToParaBuilder;
@@ -7275,16 +7327,17 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
7275
7327
  }();
7276
7328
 
7277
7329
  var ToGeneralBuilder = /*#__PURE__*/function () {
7278
- function ToGeneralBuilder(api, from, to) {
7330
+ function ToGeneralBuilder(api, from, to, paraIdTo) {
7279
7331
  _classCallCheck(this, ToGeneralBuilder);
7280
7332
  this.api = api;
7281
7333
  this.from = from;
7282
7334
  this.to = to;
7335
+ this.paraIdTo = paraIdTo;
7283
7336
  }
7284
7337
  _createClass(ToGeneralBuilder, [{
7285
7338
  key: "currency",
7286
7339
  value: function currency(_currency) {
7287
- return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency);
7340
+ return ParaToParaBuilder.createParaToPara(this.api, this.from, this.to, _currency, this.paraIdTo);
7288
7341
  }
7289
7342
  }, {
7290
7343
  key: "openChannel",
@@ -7302,8 +7355,8 @@ var FromGeneralBuilder = /*#__PURE__*/function () {
7302
7355
  }
7303
7356
  _createClass(FromGeneralBuilder, [{
7304
7357
  key: "to",
7305
- value: function to(node) {
7306
- return new ToGeneralBuilder(this.api, this.from, node);
7358
+ value: function to(node, paraIdTo) {
7359
+ return new ToGeneralBuilder(this.api, this.from, node, paraIdTo);
7307
7360
  }
7308
7361
  }, {
7309
7362
  key: "amount",
@@ -7330,8 +7383,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
7330
7383
  }
7331
7384
  }, {
7332
7385
  key: "to",
7333
- value: function to(node) {
7334
- return RelayToParaBuilder.create(this.api, node);
7386
+ value: function to(node, paraIdTo) {
7387
+ return RelayToParaBuilder.create(this.api, node, paraIdTo);
7335
7388
  }
7336
7389
  }, {
7337
7390
  key: "addLiquidity",
@@ -7439,13 +7492,6 @@ var Interlay = {
7439
7492
  "XTokens"
7440
7493
  ]
7441
7494
  };
7442
- var Kylin = {
7443
- defaultPallet: "OrmlXTokens",
7444
- supportedPallets: [
7445
- "PolkadotXcm",
7446
- "OrmlXTokens"
7447
- ]
7448
- };
7449
7495
  var Litentry = {
7450
7496
  defaultPallet: "XTokens",
7451
7497
  supportedPallets: [
@@ -7716,7 +7762,6 @@ var pallets = {
7716
7762
  Darwinia: Darwinia,
7717
7763
  HydraDX: HydraDX,
7718
7764
  Interlay: Interlay,
7719
- Kylin: Kylin,
7720
7765
  Litentry: Litentry,
7721
7766
  Moonbeam: Moonbeam,
7722
7767
  Parallel: Parallel,
@@ -7788,7 +7833,6 @@ var palletsMapJson = /*#__PURE__*/Object.freeze({
7788
7833
  InvArchTinker: InvArchTinker,
7789
7834
  Karura: Karura,
7790
7835
  Kintsugi: Kintsugi,
7791
- Kylin: Kylin,
7792
7836
  Litentry: Litentry,
7793
7837
  Litmus: Litmus,
7794
7838
  Mangata: Mangata,
@@ -7821,4 +7865,4 @@ var getSupportedPallets = function getSupportedPallets(node) {
7821
7865
  return palletsMap[node].supportedPallets;
7822
7866
  };
7823
7867
 
7824
- export { Builder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$4 as assets, index as closeChannels, createApiInstanceForNode, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };
7868
+ export { Builder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, index$4 as assets, index as closeChannels, createApiInstanceForNode, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };