@paraspell/sdk 5.2.1 → 5.3.0

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/README.md CHANGED
@@ -17,7 +17,7 @@
17
17
  <img alt="snyk" src="https://snyk.io/test/github/paraspell/sdk/badge.svg" />
18
18
  </a>
19
19
  </p>
20
- <p>Currently supporting 53 Polkadot & Kusama nodes list <a href = "https://github.com/paraspell/xcm-tools/blob/main/packages/sdk/docs/supportedNodes.md"\>[here]</p>
20
+ <p>Currently supporting 54 Polkadot & Kusama nodes list <a href = "https://github.com/paraspell/xcm-tools/blob/main/packages/sdk/docs/supportedNodes.md"\>[here]</p>
21
21
  <p>SDK documentation <a href = "https://paraspell.github.io/docs/" \>[here]</p>
22
22
  </div>
23
23
 
@@ -57,11 +57,13 @@ const paraspell = require('@paraspell/sdk')
57
57
 
58
58
  ```
59
59
  NOTES:
60
- - If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add the character 'n' the end of currencyID. Eg: .currency(42259045809535163221576417993425387648n) will mean you transfer xcDOT.
60
+ - If you wish to transfer from Parachain that uses long IDs for example Moonbeam you have to add the character 'n' to the end of currencyID. Eg: .currency(42259045809535163221576417993425387648n) will mean you transfer xcDOT.
61
61
  - You can now use custom ParachainIDs if you wish to test in TestNet. Just add parachainID as an additional parameter eg: .to('Basilisk', 2948)
62
- - You can now add optional parameter useKeepAlive which will ensure, that you send more than existential deposit.
63
- - Since v5 you can fully customize all multilocations (address, currency and destination). Instead of string parameter simply pass object with multilocation instead for more information refer to the following PR https://github.com/paraspell/xcm-tools/pull/199.
64
- - Fee asset is now an optional parameter.
62
+ - You can now add an optional parameter useKeepAlive which will ensure, that you send more than the existential deposit.
63
+ - Since v5 you can fully customize all multilocations (address, currency and destination). Instead of a string parameter simply pass an object with multilocation instead for more information refer to the following PR https://github.com/paraspell/xcm-tools/pull/199.
64
+ - Fee asset is now a required builder parameter when you enter a multilocation array.
65
+ - When using a multilocation array the amount parameter is overridden.
66
+ - Multilocation arrays are now available. Customize your asset multilocations by .currency([{multilocation1},{multilocation2}..{multilocationN}]) For more information refer to the official documentation or following PR https://github.com/paraspell/xcm-tools/pull/224.
65
67
  ```
66
68
 
67
69
  ### Builder pattern:
@@ -71,9 +73,9 @@ NOTES:
71
73
  await Builder(/*node api - optional*/)
72
74
  .from(NODE)
73
75
  .to(NODE /*,customParaId - optional*/ | Multilocation object /*Only works for PolkadotXCM pallet*/)
74
- .currency(CurrencyString| | CurrencyID | Multilocation object)
75
- /*.feeAsset(feeAsset) - Optional (Fee asset select id)*/
76
- .amount(amount)
76
+ .currency(CurrencyString| | CurrencyID | Multilocation object | MultilocationArray)
77
+ /*.feeAsset(feeAsset) - Parameter required when using MultilocationArray*/
78
+ .amount(amount) // Overriden when using MultilocationArray
77
79
  .address(address | Multilocation object /*If you are sending through xTokens, you need to pass the destination and address multilocation in one object (x2)*/)
78
80
  .build()
79
81
  /*
@@ -107,7 +109,6 @@ await Builder()
107
109
  ```ts
108
110
  await Builder(/*node api - optional*/)
109
111
  .from(NODE)
110
- /*.feeAsset(feeAsset) - Optional (Fee asset select id)*/
111
112
  .amount(amount)
112
113
  .address(address | Multilocation object)
113
114
  .build()
@@ -144,7 +145,7 @@ Builder(api)
144
145
 
145
146
  ##### Open HRMP channels
146
147
  ```ts
147
- Builder(api)
148
+ Builder()
148
149
  .from(NODE)
149
150
  .to(NODE)
150
151
  .openChannel()
@@ -182,7 +183,6 @@ await paraspell.xcmPallet.send(
182
183
  api?: ApiPromise,
183
184
  origin: origin Parachain name string,
184
185
  amount: any,
185
- feeAsset? - Fee asset select id,
186
186
  to: destination address string | Multilocation object,
187
187
  paraIdTo?: number,
188
188
  destApiForKeepAlive?: ApiPromise
@@ -223,6 +223,17 @@ paraspell.openChannels.openChannel(
223
223
  )
224
224
  ```
225
225
 
226
+ ### Asset claim:
227
+ ```ts
228
+ //Claim XCM trapped assets from the selected chain
229
+ await Builder(api)
230
+ .claimFrom(NODE)
231
+ .fungible(MultilocationArray (Only one multilocation allowed) [{Multilocation}])
232
+ .account(address | Multilocation object)
233
+ /*.xcmVersion(Version.V3) Optional parameter, by default V3. XCM Version ENUM if a different XCM version is needed (Supported V2 & V3). Requires importing Version enum.*/
234
+ .build()
235
+ ```
236
+
226
237
  ### Asset queries:
227
238
 
228
239
  ```ts
package/dist/index.cjs CHANGED
@@ -2891,6 +2891,28 @@ var InvArchTinker$3 = {
2891
2891
  otherAssets: [
2892
2892
  ]
2893
2893
  };
2894
+ var Curio$3 = {
2895
+ paraId: 3339,
2896
+ relayChainAssetSymbol: "KSM",
2897
+ nativeAssetSymbol: "CGT",
2898
+ nativeAssets: [
2899
+ {
2900
+ symbol: "CGT",
2901
+ decimals: 18
2902
+ },
2903
+ {
2904
+ symbol: "KSM",
2905
+ decimals: 12
2906
+ }
2907
+ ],
2908
+ otherAssets: [
2909
+ {
2910
+ assetId: "0",
2911
+ symbol: "BSX",
2912
+ decimals: 12
2913
+ }
2914
+ ]
2915
+ };
2894
2916
  var Karura$3 = {
2895
2917
  paraId: 2000,
2896
2918
  relayChainAssetSymbol: "KSM",
@@ -5791,6 +5813,7 @@ var assets = {
5791
5813
  KiltSpiritnet: KiltSpiritnet$3,
5792
5814
  Integritee: Integritee$3,
5793
5815
  InvArchTinker: InvArchTinker$3,
5816
+ Curio: Curio$3,
5794
5817
  Karura: Karura$3,
5795
5818
  Kintsugi: Kintsugi$3,
5796
5819
  Litmus: Litmus$3,
@@ -5839,6 +5862,7 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
5839
5862
  Crab: Crab$3,
5840
5863
  Crust: Crust$3,
5841
5864
  CrustShadow: CrustShadow$3,
5865
+ Curio: Curio$3,
5842
5866
  Darwinia: Darwinia$3,
5843
5867
  Encointer: Encointer$3,
5844
5868
  HydraDX: HydraDX$3,
@@ -5961,19 +5985,36 @@ var constructRelayToParaParameters = function constructRelayToParaParameters(_re
5961
5985
  }
5962
5986
  return parameters;
5963
5987
  };
5964
- var createCurrencySpec = function createCurrencySpec(amount, version, parents, overridedMultiLocation) {
5988
+ var isTMulti = function isTMulti(value) {
5989
+ return value && _typeof(value) === 'object' || Array.isArray(value);
5990
+ };
5991
+ var isTMultiLocation = function isTMultiLocation(value) {
5992
+ return value && typeof value.parents !== 'undefined' && typeof value.interior !== 'undefined';
5993
+ };
5994
+ var createCurrencySpec = function createCurrencySpec(amount, version, parents, overriddenCurrency) {
5965
5995
  var interior = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'Here';
5966
- return _defineProperty({}, version, [{
5967
- id: {
5968
- Concrete: overridedMultiLocation !== null && overridedMultiLocation !== void 0 ? overridedMultiLocation : {
5969
- parents: parents,
5970
- interior: interior
5996
+ if (!overriddenCurrency) {
5997
+ return _defineProperty({}, version, [{
5998
+ id: {
5999
+ Concrete: {
6000
+ parents: parents,
6001
+ interior: interior
6002
+ }
6003
+ },
6004
+ fun: {
6005
+ Fungible: amount
5971
6006
  }
6007
+ }]);
6008
+ }
6009
+ return isTMultiLocation(overriddenCurrency) ? _defineProperty({}, version, [{
6010
+ id: {
6011
+ Concrete: overriddenCurrency
5972
6012
  },
5973
6013
  fun: {
5974
6014
  Fungible: amount
5975
6015
  }
5976
- }]);
6016
+ }]) : // It must be TMultiAsset if not TMultiLocation
6017
+ _defineProperty({}, version, overriddenCurrency);
5977
6018
  };
5978
6019
  var createPolkadotXcmHeader = function createPolkadotXcmHeader(scenario, version, destination, nodeId) {
5979
6020
  var parents = scenario === 'RelayToPara' ? exports.Parents.ZERO : exports.Parents.ONE;
@@ -7624,8 +7665,37 @@ var KiltSpiritnet$2 = /*#__PURE__*/function (_ParachainNode) {
7624
7665
  }]);
7625
7666
  }(ParachainNode);
7626
7667
 
7668
+ var Curio$2 = /*#__PURE__*/function (_ParachainNode) {
7669
+ function Curio() {
7670
+ _classCallCheck(this, Curio);
7671
+ return _callSuper(this, Curio, ['Curio', 'curio', 'kusama', exports.Version.V3]);
7672
+ }
7673
+ _inherits(Curio, _ParachainNode);
7674
+ return _createClass(Curio, [{
7675
+ key: "getCurrencySelection",
7676
+ value: function getCurrencySelection(_ref) {
7677
+ var currency = _ref.currency,
7678
+ currencyID = _ref.currencyID;
7679
+ if (currencyID) {
7680
+ return {
7681
+ ForeignAsset: currencyID
7682
+ };
7683
+ }
7684
+ return {
7685
+ Token: currency
7686
+ };
7687
+ }
7688
+ }, {
7689
+ key: "transferXTokens",
7690
+ value: function transferXTokens(input) {
7691
+ var currencySelection = this.getCurrencySelection(input);
7692
+ return XTokensTransferImpl.transferXTokens(input, currencySelection);
7693
+ }
7694
+ }]);
7695
+ }(ParachainNode);
7696
+
7627
7697
  // Contains supported Parachains and exports supported XCM Pallets
7628
- var NODE_NAMES = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet'];
7698
+ var NODE_NAMES = ['AssetHubPolkadot', 'Acala', 'Astar', 'BifrostPolkadot', 'Bitgreen', 'Centrifuge', 'ComposableFinance', 'Darwinia', 'HydraDX', 'Interlay', 'Litentry', 'Moonbeam', 'Parallel', 'AssetHubKusama', 'CoretimeKusama', 'Encointer', 'Altair', 'Amplitude', 'Bajun', 'Basilisk', 'BifrostKusama', 'Pioneer', 'Calamari', 'CrustShadow', 'Crab', 'Imbue', 'Integritee', 'InvArchTinker', 'Karura', 'Kintsugi', 'Litmus', 'Mangata', 'Moonriver', 'ParallelHeiko', 'Picasso', 'Quartz', 'Robonomics', 'Shiden', 'Turing', 'Unique', 'Crust', 'Manta', 'Nodle', 'NeuroWeb', 'Pendulum', 'Polkadex', 'Zeitgeist', 'Collectives', 'Khala', 'Phala', 'Subsocial', 'KiltSpiritnet', 'Curio'];
7629
7699
  var NODES_WITH_RELAY_CHAINS = [].concat(NODE_NAMES, ['Polkadot', 'Kusama']);
7630
7700
  var nodes = {
7631
7701
  AssetHubPolkadot: new AssetHubPolkadot$2(),
@@ -7679,7 +7749,8 @@ var nodes = {
7679
7749
  Khala: new Khala$2(),
7680
7750
  Phala: new Phala$2(),
7681
7751
  Subsocial: new Subsocial$2(),
7682
- KiltSpiritnet: new KiltSpiritnet$2()
7752
+ KiltSpiritnet: new KiltSpiritnet$2(),
7753
+ Curio: new Curio$2()
7683
7754
  };
7684
7755
  var SUPPORTED_PALLETS = ['XTokens', 'OrmlXTokens', 'PolkadotXcm', 'RelayerXcm', 'XTransfer'];
7685
7756
 
@@ -7864,9 +7935,12 @@ var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref8) {
7864
7935
  var determineRelayChain = function determineRelayChain(node) {
7865
7936
  return getRelayChainSymbol(node) === 'KSM' ? 'Kusama' : 'Polkadot';
7866
7937
  };
7938
+ var isRelayChain = function isRelayChain(node) {
7939
+ return node === 'Polkadot' || node === 'Kusama';
7940
+ };
7867
7941
 
7868
7942
  var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, currency) {
7869
- if (_typeof(currency) === 'object') {
7943
+ if (isTMulti(currency)) {
7870
7944
  return null;
7871
7945
  }
7872
7946
  var currencyString = currency.toString();
@@ -7959,6 +8033,7 @@ var Khala$1 = "10000000000";
7959
8033
  var Phala$1 = "10000000000";
7960
8034
  var Subsocial$1 = "100000000";
7961
8035
  var KiltSpiritnet$1 = "10000000000000";
8036
+ var Curio$1 = "10000000000000000";
7962
8037
  var existentialDeposits = {
7963
8038
  AssetHubPolkadot: AssetHubPolkadot$1,
7964
8039
  Acala: Acala$1,
@@ -8013,7 +8088,8 @@ var existentialDeposits = {
8013
8088
  Khala: Khala$1,
8014
8089
  Phala: Phala$1,
8015
8090
  Subsocial: Subsocial$1,
8016
- KiltSpiritnet: KiltSpiritnet$1
8091
+ KiltSpiritnet: KiltSpiritnet$1,
8092
+ Curio: Curio$1
8017
8093
  };
8018
8094
 
8019
8095
  var edMapJson = /*#__PURE__*/Object.freeze({
@@ -8037,6 +8113,7 @@ var edMapJson = /*#__PURE__*/Object.freeze({
8037
8113
  Crab: Crab$1,
8038
8114
  Crust: Crust$1,
8039
8115
  CrustShadow: CrustShadow$1,
8116
+ Curio: Curio$1,
8040
8117
  Darwinia: Darwinia$1,
8041
8118
  Encointer: Encointer$1,
8042
8119
  HydraDX: HydraDX$1,
@@ -8453,6 +8530,9 @@ var ParaToRelayBuilder = /*#__PURE__*/function () {
8453
8530
  }, {
8454
8531
  key: "buildOptions",
8455
8532
  value: function buildOptions() {
8533
+ if (this.amount === null) {
8534
+ throw new Error('Amount is required');
8535
+ }
8456
8536
  var currency = getRelayChainSymbol(this.from);
8457
8537
  return {
8458
8538
  api: this.api,
@@ -8524,6 +8604,167 @@ var MissingApiPromiseError = /*#__PURE__*/function (_Error) {
8524
8604
  return _createClass(MissingApiPromiseError);
8525
8605
  }( /*#__PURE__*/_wrapNativeSuper(Error));
8526
8606
 
8607
+ var buildBeneficiaryInput = function buildBeneficiaryInput(api, address) {
8608
+ if (isTMultiLocation(address)) {
8609
+ return address;
8610
+ }
8611
+ var isEthAddress = ethers.ethers.utils.isAddress(address);
8612
+ return {
8613
+ parents: exports.Parents.ZERO,
8614
+ interior: {
8615
+ X1: isEthAddress ? {
8616
+ AccountKey20: {
8617
+ key: address
8618
+ }
8619
+ } : {
8620
+ AccountId32: {
8621
+ id: createAccID(api, address)
8622
+ }
8623
+ }
8624
+ }
8625
+ };
8626
+ };
8627
+ var buildClaimAssetsInput = function buildClaimAssetsInput(_ref) {
8628
+ var api = _ref.api,
8629
+ multiAssets = _ref.multiAssets,
8630
+ address = _ref.address,
8631
+ _ref$version = _ref.version,
8632
+ version = _ref$version === void 0 ? exports.Version.V3 : _ref$version;
8633
+ return [_defineProperty({}, version, multiAssets), _defineProperty({}, version, buildBeneficiaryInput(api, address))];
8634
+ };
8635
+ var MODULE = 'polkadotXcm';
8636
+ var MODULE_RELAY = 'xcmPallet';
8637
+ var SECTION = 'claimAssets';
8638
+ var claimAssets = function claimAssets(options) {
8639
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8640
+ var _apiWithFallback$tx$m;
8641
+ var api, node, serializedApiCallEnabled, apiWithFallback, args, module;
8642
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8643
+ while (1) switch (_context.prev = _context.next) {
8644
+ case 0:
8645
+ api = options.api, node = options.node, serializedApiCallEnabled = options.serializedApiCallEnabled;
8646
+ if (!(api !== null && api !== void 0)) {
8647
+ _context.next = 5;
8648
+ break;
8649
+ }
8650
+ _context.t0 = api;
8651
+ _context.next = 8;
8652
+ break;
8653
+ case 5:
8654
+ _context.next = 7;
8655
+ return createApiInstanceForNode(node);
8656
+ case 7:
8657
+ _context.t0 = _context.sent;
8658
+ case 8:
8659
+ apiWithFallback = _context.t0;
8660
+ args = buildClaimAssetsInput(Object.assign(Object.assign({}, options), {
8661
+ api: apiWithFallback
8662
+ }));
8663
+ module = isRelayChain(node) ? MODULE_RELAY : MODULE;
8664
+ if (!(serializedApiCallEnabled === true)) {
8665
+ _context.next = 13;
8666
+ break;
8667
+ }
8668
+ return _context.abrupt("return", {
8669
+ module: module,
8670
+ section: SECTION,
8671
+ parameters: args
8672
+ });
8673
+ case 13:
8674
+ return _context.abrupt("return", (_apiWithFallback$tx$m = apiWithFallback.tx[module])[SECTION].apply(_apiWithFallback$tx$m, _toConsumableArray(args)));
8675
+ case 14:
8676
+ case "end":
8677
+ return _context.stop();
8678
+ }
8679
+ }, _callee);
8680
+ }));
8681
+ };
8682
+
8683
+ var AssetClaimBuilder = /*#__PURE__*/function () {
8684
+ function AssetClaimBuilder(api, node) {
8685
+ _classCallCheck(this, AssetClaimBuilder);
8686
+ this.api = api;
8687
+ this.node = node;
8688
+ }
8689
+ return _createClass(AssetClaimBuilder, [{
8690
+ key: "fungible",
8691
+ value: function fungible(multiAssets) {
8692
+ this._multiAssets = multiAssets;
8693
+ return this;
8694
+ }
8695
+ }, {
8696
+ key: "account",
8697
+ value: function account(address) {
8698
+ this._address = address;
8699
+ return this;
8700
+ }
8701
+ }, {
8702
+ key: "xcmVersion",
8703
+ value: function xcmVersion(version) {
8704
+ this._version = version;
8705
+ return this;
8706
+ }
8707
+ }, {
8708
+ key: "buildOptions",
8709
+ value: function buildOptions() {
8710
+ return {
8711
+ api: this.api,
8712
+ node: this.node,
8713
+ multiAssets: this._multiAssets,
8714
+ address: this._address,
8715
+ version: this._version
8716
+ };
8717
+ }
8718
+ }, {
8719
+ key: "build",
8720
+ value: function build() {
8721
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8722
+ var options;
8723
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8724
+ while (1) switch (_context.prev = _context.next) {
8725
+ case 0:
8726
+ options = this.buildOptions();
8727
+ _context.next = 3;
8728
+ return claimAssets(options);
8729
+ case 3:
8730
+ return _context.abrupt("return", _context.sent);
8731
+ case 4:
8732
+ case "end":
8733
+ return _context.stop();
8734
+ }
8735
+ }, _callee, this);
8736
+ }));
8737
+ }
8738
+ }, {
8739
+ key: "buildSerializedApiCall",
8740
+ value: function buildSerializedApiCall() {
8741
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
8742
+ var options;
8743
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
8744
+ while (1) switch (_context2.prev = _context2.next) {
8745
+ case 0:
8746
+ options = this.buildOptions();
8747
+ _context2.next = 3;
8748
+ return claimAssets(Object.assign(Object.assign({}, options), {
8749
+ serializedApiCallEnabled: true
8750
+ }));
8751
+ case 3:
8752
+ return _context2.abrupt("return", _context2.sent);
8753
+ case 4:
8754
+ case "end":
8755
+ return _context2.stop();
8756
+ }
8757
+ }, _callee2, this);
8758
+ }));
8759
+ }
8760
+ }], [{
8761
+ key: "create",
8762
+ value: function create(api, node) {
8763
+ return new AssetClaimBuilder(api, node);
8764
+ }
8765
+ }]);
8766
+ }();
8767
+
8527
8768
  var ToGeneralBuilder = /*#__PURE__*/function () {
8528
8769
  function ToGeneralBuilder(api, from, to, paraIdTo) {
8529
8770
  _classCallCheck(this, ToGeneralBuilder);
@@ -8594,6 +8835,11 @@ var GeneralBuilder = /*#__PURE__*/function () {
8594
8835
  value: function to(node, paraIdTo) {
8595
8836
  return RelayToParaBuilder.create(this.api, node, paraIdTo);
8596
8837
  }
8838
+ }, {
8839
+ key: "claimFrom",
8840
+ value: function claimFrom(node) {
8841
+ return AssetClaimBuilder.create(this.api, node);
8842
+ }
8597
8843
  }]);
8598
8844
  }();
8599
8845
  var Builder = function Builder(api) {
@@ -8753,106 +8999,149 @@ var sendCommon = function sendCommon(options) {
8753
8999
  while (1) switch (_context.prev = _context.next) {
8754
9000
  case 0:
8755
9001
  api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
8756
- if (!(typeof currency === 'number' && currency > Number.MAX_SAFE_INTEGER)) {
9002
+ if (!((!isTMulti(currency) || isTMultiLocation(currency)) && amount === null)) {
8757
9003
  _context.next = 3;
8758
9004
  break;
8759
9005
  }
8760
- throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
9006
+ throw new Error('Amount is required');
8761
9007
  case 3:
9008
+ if (!(typeof currency === 'number' && currency > Number.MAX_SAFE_INTEGER)) {
9009
+ _context.next = 5;
9010
+ break;
9011
+ }
9012
+ throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
9013
+ case 5:
9014
+ if (!(isTMultiLocation(currency) && (feeAsset === 0 || feeAsset !== undefined))) {
9015
+ _context.next = 7;
9016
+ break;
9017
+ }
9018
+ throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
9019
+ case 7:
9020
+ if (!(isTMulti(currency) && Array.isArray(currency))) {
9021
+ _context.next = 17;
9022
+ break;
9023
+ }
9024
+ if (amount !== null) {
9025
+ console.warn('Amount is ignored when using overriding currency using multiple multi locations. Please set it to null.');
9026
+ }
9027
+ if (!(currency.length === 0)) {
9028
+ _context.next = 11;
9029
+ break;
9030
+ }
9031
+ throw new InvalidCurrencyError('Overrided multi assets cannot be empty');
9032
+ case 11:
9033
+ if (!(currency.length === 1 && (feeAsset === 0 || feeAsset !== undefined))) {
9034
+ _context.next = 13;
9035
+ break;
9036
+ }
9037
+ throw new InvalidCurrencyError('Overrided single multi asset cannot be used with fee asset');
9038
+ case 13:
9039
+ if (!(currency.length > 1 && feeAsset === undefined)) {
9040
+ _context.next = 15;
9041
+ break;
9042
+ }
9043
+ throw new InvalidCurrencyError('Overrided multi assets cannot be used without specifying fee asset');
9044
+ case 15:
9045
+ if (!(currency.length > 1 && feeAsset !== undefined && (feeAsset < 0 || feeAsset >= currency.length))) {
9046
+ _context.next = 17;
9047
+ break;
9048
+ }
9049
+ throw new InvalidCurrencyError('Fee asset index is out of bounds. Please provide a valid index.');
9050
+ case 17:
8762
9051
  asset = getAssetBySymbolOrId(origin, currency);
8763
9052
  isMultiLocationDestination = _typeof(destination) === 'object';
8764
9053
  isMultiLocationCurrency = _typeof(currency) === 'object';
8765
9054
  if (!(destination !== undefined && !isMultiLocationDestination)) {
8766
- _context.next = 11;
9055
+ _context.next = 25;
8767
9056
  break;
8768
9057
  }
8769
9058
  originRelayChainSymbol = getRelayChainSymbol(origin);
8770
9059
  destinationRelayChainSymbol = getRelayChainSymbol(destination);
8771
9060
  if (!(originRelayChainSymbol !== destinationRelayChainSymbol)) {
8772
- _context.next = 11;
9061
+ _context.next = 25;
8773
9062
  break;
8774
9063
  }
8775
9064
  throw new IncompatibleNodesError();
8776
- case 11:
9065
+ case 25:
8777
9066
  originNode = getNode(origin);
8778
9067
  assetCheckEnabled = destination === 'AssetHubKusama' || destination === 'AssetHubPolkadot' || isMultiLocationCurrency ? false : originNode.assetCheckEnabled;
8779
9068
  if (!(asset === null && assetCheckEnabled)) {
8780
- _context.next = 15;
9069
+ _context.next = 29;
8781
9070
  break;
8782
9071
  }
8783
9072
  throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
8784
- case 15:
9073
+ case 29:
8785
9074
  if (!(destination !== undefined && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !hasSupportForAsset(destination, asset.symbol))) {
8786
- _context.next = 17;
9075
+ _context.next = 31;
8787
9076
  break;
8788
9077
  }
8789
9078
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(JSON.stringify(currency), "."));
8790
- case 17:
9079
+ case 31:
8791
9080
  if (!(api !== null && api !== void 0)) {
8792
- _context.next = 21;
9081
+ _context.next = 35;
8793
9082
  break;
8794
9083
  }
8795
9084
  _context.t0 = api;
8796
- _context.next = 24;
9085
+ _context.next = 38;
8797
9086
  break;
8798
- case 21:
8799
- _context.next = 23;
9087
+ case 35:
9088
+ _context.next = 37;
8800
9089
  return createApiInstanceForNode(origin);
8801
- case 23:
9090
+ case 37:
8802
9091
  _context.t0 = _context.sent;
8803
- case 24:
9092
+ case 38:
8804
9093
  apiWithFallback = _context.t0;
8805
- amountStr = amount.toString();
8806
- if (!(_typeof(currency) === 'object')) {
8807
- _context.next = 30;
9094
+ amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
9095
+ if (!isTMulti(currency)) {
9096
+ _context.next = 44;
8808
9097
  break;
8809
9098
  }
8810
9099
  console.warn('Keep alive check is not supported when using MultiLocation as currency.');
8811
- _context.next = 40;
9100
+ _context.next = 54;
8812
9101
  break;
8813
- case 30:
9102
+ case 44:
8814
9103
  if (!(_typeof(address) === 'object')) {
8815
- _context.next = 34;
9104
+ _context.next = 48;
8816
9105
  break;
8817
9106
  }
8818
9107
  console.warn('Keep alive check is not supported when using MultiLocation as address.');
8819
- _context.next = 40;
9108
+ _context.next = 54;
8820
9109
  break;
8821
- case 34:
9110
+ case 48:
8822
9111
  if (!(_typeof(destination) === 'object')) {
8823
- _context.next = 38;
9112
+ _context.next = 52;
8824
9113
  break;
8825
9114
  }
8826
9115
  console.warn('Keep alive check is not supported when using MultiLocation as destination.');
8827
- _context.next = 40;
9116
+ _context.next = 54;
8828
9117
  break;
8829
- case 38:
8830
- _context.next = 40;
9118
+ case 52:
9119
+ _context.next = 54;
8831
9120
  return checkKeepAlive({
8832
9121
  originApi: apiWithFallback,
8833
9122
  address: address,
8834
- amount: amountStr,
9123
+ amount: amountStr !== null && amountStr !== void 0 ? amountStr : '',
8835
9124
  originNode: origin,
8836
9125
  destApi: destApiForKeepAlive,
8837
9126
  currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : currency.toString(),
8838
9127
  destNode: destination
8839
9128
  });
8840
- case 40:
8841
- currencyStr = _typeof(currency) === 'object' ? undefined : currency.toString();
9129
+ case 54:
9130
+ currencyStr = isTMulti(currency) ? undefined : currency.toString();
8842
9131
  currencyId = assetCheckEnabled ? asset === null || asset === void 0 ? void 0 : asset.assetId : currencyStr;
8843
9132
  return _context.abrupt("return", originNode.transfer({
8844
9133
  api: apiWithFallback,
8845
9134
  currencySymbol: asset === null || asset === void 0 ? void 0 : asset.symbol,
8846
9135
  currencyId: currencyId,
8847
- amount: amountStr,
9136
+ amount: amountStr !== null && amountStr !== void 0 ? amountStr : '',
8848
9137
  address: address,
8849
9138
  destination: destination,
8850
9139
  paraIdTo: paraIdTo,
8851
- overridedCurrencyMultiLocation: _typeof(currency) === 'object' ? currency : undefined,
9140
+ overridedCurrencyMultiLocation: isTMulti(currency) ? currency : undefined,
8852
9141
  feeAsset: feeAsset,
8853
9142
  serializedApiCallEnabled: serializedApiCallEnabled
8854
9143
  }));
8855
- case 43:
9144
+ case 57:
8856
9145
  case "end":
8857
9146
  return _context.stop();
8858
9147
  }
@@ -9369,6 +9658,13 @@ var KiltSpiritnet = {
9369
9658
  "PolkadotXcm"
9370
9659
  ]
9371
9660
  };
9661
+ var Curio = {
9662
+ defaultPallet: "XTokens",
9663
+ supportedPallets: [
9664
+ "PolkadotXcm",
9665
+ "XTokens"
9666
+ ]
9667
+ };
9372
9668
  var pallets = {
9373
9669
  AssetHubPolkadot: AssetHubPolkadot,
9374
9670
  Acala: Acala,
@@ -9421,7 +9717,8 @@ var pallets = {
9421
9717
  Khala: Khala,
9422
9718
  Phala: Phala,
9423
9719
  Subsocial: Subsocial,
9424
- KiltSpiritnet: KiltSpiritnet
9720
+ KiltSpiritnet: KiltSpiritnet,
9721
+ Curio: Curio
9425
9722
  };
9426
9723
 
9427
9724
  var palletsMapJson = /*#__PURE__*/Object.freeze({
@@ -9445,6 +9742,7 @@ var palletsMapJson = /*#__PURE__*/Object.freeze({
9445
9742
  Crab: Crab,
9446
9743
  Crust: Crust,
9447
9744
  CrustShadow: CrustShadow,
9745
+ Curio: Curio,
9448
9746
  Darwinia: Darwinia,
9449
9747
  Encointer: Encointer,
9450
9748
  HydraDX: HydraDX,