@paraspell/sdk 7.0.0 → 7.1.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/dist/index.mjs CHANGED
@@ -504,11 +504,11 @@ function _toPrimitive(t, r) {
504
504
  if ("object" != typeof t || !t) return t;
505
505
  var e = t[Symbol.toPrimitive];
506
506
  if (void 0 !== e) {
507
- var i = e.call(t, r);
507
+ var i = e.call(t, r || "default");
508
508
  if ("object" != typeof i) return i;
509
509
  throw new TypeError("@@toPrimitive must return a primitive value.");
510
510
  }
511
- return (String )(t);
511
+ return ("string" === r ? String : Number)(t);
512
512
  }
513
513
  function _toPropertyKey(t) {
514
514
  var i = _toPrimitive(t, "string");
@@ -2064,22 +2064,22 @@ var Moonbeam$3 = {
2064
2064
  otherAssets: [
2065
2065
  {
2066
2066
  assetId: "78407957940239408223554844611219482002",
2067
- symbol: "ibcMOVR",
2067
+ symbol: "xcibcMOVR",
2068
2068
  decimals: 18
2069
2069
  },
2070
2070
  {
2071
2071
  assetId: "150874409661081770150564009349448205842",
2072
- symbol: "ZTG",
2072
+ symbol: "xcZTG",
2073
2073
  decimals: 10
2074
2074
  },
2075
2075
  {
2076
2076
  assetId: "283870493414747423842723289889816153538",
2077
- symbol: "UNQ",
2077
+ symbol: "xcUNQ",
2078
2078
  decimals: 18
2079
2079
  },
2080
2080
  {
2081
2081
  assetId: "90225766094594282577230355136633846906",
2082
- symbol: "PDEX",
2082
+ symbol: "xcPDEX",
2083
2083
  decimals: 12
2084
2084
  },
2085
2085
  {
@@ -2089,27 +2089,27 @@ var Moonbeam$3 = {
2089
2089
  },
2090
2090
  {
2091
2091
  assetId: "314077021455772878282433861213184736939",
2092
- symbol: "PEAQ",
2092
+ symbol: "xcPEAQ",
2093
2093
  decimals: 18
2094
2094
  },
2095
2095
  {
2096
2096
  assetId: "144012926827374458669278577633504620722",
2097
- symbol: "FIL",
2097
+ symbol: "xcFIL",
2098
2098
  decimals: 18
2099
2099
  },
2100
2100
  {
2101
2101
  assetId: "125699734534028342599692732320197985871",
2102
- symbol: "RING",
2102
+ symbol: "xcRING",
2103
2103
  decimals: 18
2104
2104
  },
2105
2105
  {
2106
2106
  assetId: "91372035960551235635465443179559840483",
2107
- symbol: "CFG",
2107
+ symbol: "xcCFG",
2108
2108
  decimals: 18
2109
2109
  },
2110
2110
  {
2111
2111
  assetId: "187224307232923873519830480073807488153",
2112
- symbol: "EQD",
2112
+ symbol: "xcEQD",
2113
2113
  decimals: 9
2114
2114
  },
2115
2115
  {
@@ -2119,37 +2119,37 @@ var Moonbeam$3 = {
2119
2119
  },
2120
2120
  {
2121
2121
  assetId: "69606720909260275826784788104880799692",
2122
- symbol: "HDX",
2122
+ symbol: "xcHDX",
2123
2123
  decimals: 12
2124
2124
  },
2125
2125
  {
2126
2126
  assetId: "133307414193833606001516599592873928539",
2127
- symbol: "ibcTIA",
2127
+ symbol: "xcibcTIA",
2128
2128
  decimals: 6
2129
2129
  },
2130
2130
  {
2131
2131
  assetId: "190590555344745888270686124937537713878",
2132
- symbol: "EQ",
2132
+ symbol: "xcEQ",
2133
2133
  decimals: 9
2134
2134
  },
2135
2135
  {
2136
2136
  assetId: "61295607754960722617854661686514597014",
2137
- symbol: "WIFD",
2137
+ symbol: "xcWIFD",
2138
2138
  decimals: 10
2139
2139
  },
2140
2140
  {
2141
2141
  assetId: "141196559012917796508928734717797136690",
2142
- symbol: "ibcIST",
2142
+ symbol: "xcibcIST",
2143
2143
  decimals: 6
2144
2144
  },
2145
2145
  {
2146
2146
  assetId: "29085784439601774464560083082574142143",
2147
- symbol: "vDOT",
2147
+ symbol: "xcvDOT",
2148
2148
  decimals: 10
2149
2149
  },
2150
2150
  {
2151
2151
  assetId: "225719522181998468294117309041779353812",
2152
- symbol: "LDOT",
2152
+ symbol: "xcLDOT",
2153
2153
  decimals: 10
2154
2154
  },
2155
2155
  {
@@ -2159,142 +2159,142 @@ var Moonbeam$3 = {
2159
2159
  },
2160
2160
  {
2161
2161
  assetId: "124463719055550872076363892993240202694",
2162
- symbol: "DED",
2162
+ symbol: "xcDED",
2163
2163
  decimals: 10
2164
2164
  },
2165
2165
  {
2166
2166
  assetId: "224077081838586484055667086558292981199",
2167
- symbol: "ASTR",
2167
+ symbol: "xcASTR",
2168
2168
  decimals: 18
2169
2169
  },
2170
2170
  {
2171
2171
  assetId: "199907282886248358976504623107230837230",
2172
- symbol: "ibcBLD",
2172
+ symbol: "xcibcBLD",
2173
2173
  decimals: 6
2174
2174
  },
2175
2175
  {
2176
2176
  assetId: "166377000701797186346254371275954761085",
2177
- symbol: "USDC",
2177
+ symbol: "xcUSDC",
2178
2178
  decimals: 6
2179
2179
  },
2180
2180
  {
2181
2181
  assetId: "142155548796783636521833385094843759961",
2182
- symbol: "BNCS",
2182
+ symbol: "xcBNCS",
2183
2183
  decimals: 12
2184
2184
  },
2185
2185
  {
2186
2186
  assetId: "89994634370519791027168048838578580624",
2187
- symbol: "SUB",
2187
+ symbol: "xcSUB",
2188
2188
  decimals: 10
2189
2189
  },
2190
2190
  {
2191
2191
  assetId: "138280378441551394289980644963240827219",
2192
- symbol: "ibcATOM",
2192
+ symbol: "xcibcATOM",
2193
2193
  decimals: 6
2194
2194
  },
2195
2195
  {
2196
2196
  assetId: "228510780171552721666262089780561563481",
2197
- symbol: "ibcPICA",
2197
+ symbol: "xcibcPICA",
2198
2198
  decimals: 12
2199
2199
  },
2200
2200
  {
2201
2201
  assetId: "204507659831918931608354793288110796652",
2202
- symbol: "vGLMR",
2202
+ symbol: "xcvGLMR",
2203
2203
  decimals: 18
2204
2204
  },
2205
2205
  {
2206
2206
  assetId: "184218609779515850660274730699350567246",
2207
- symbol: "NCTR",
2207
+ symbol: "xcNCTR",
2208
2208
  decimals: 18
2209
2209
  },
2210
2210
  {
2211
2211
  assetId: "289989900872525819559124583375550296953",
2212
- symbol: "vMANTA",
2212
+ symbol: "xcvMANTA",
2213
2213
  decimals: 18
2214
2214
  },
2215
2215
  {
2216
2216
  assetId: "110021739665376159354538090254163045594",
2217
- symbol: "aUSD",
2217
+ symbol: "xcaUSD",
2218
2218
  decimals: 12
2219
2219
  },
2220
2220
  {
2221
2221
  assetId: "311091173110107856861649819128533077277",
2222
- symbol: "USDT",
2222
+ symbol: "xcUSDT",
2223
2223
  decimals: 6
2224
2224
  },
2225
2225
  {
2226
2226
  assetId: "64174511183114006009298114091987195453",
2227
- symbol: "PINK",
2227
+ symbol: "xcPINK",
2228
2228
  decimals: 10
2229
2229
  },
2230
2230
  {
2231
2231
  assetId: "309163521958167876851250718453738106865",
2232
- symbol: "NODL",
2232
+ symbol: "xcNODL",
2233
2233
  decimals: 11
2234
2234
  },
2235
2235
  {
2236
2236
  assetId: "120637696315203257380661607956669368914",
2237
- symbol: "IBTC",
2237
+ symbol: "xcIBTC",
2238
2238
  decimals: 8
2239
2239
  },
2240
2240
  {
2241
2241
  assetId: "166446646689194205559791995948102903873",
2242
- symbol: "MANTA",
2242
+ symbol: "xcMANTA",
2243
2243
  decimals: 18
2244
2244
  },
2245
2245
  {
2246
2246
  assetId: "101170542313601871197860408087030232491",
2247
- symbol: "INTR",
2247
+ symbol: "xcINTR",
2248
2248
  decimals: 10
2249
2249
  },
2250
2250
  {
2251
2251
  assetId: "165823357460190568952172802245839421906",
2252
- symbol: "BNC",
2252
+ symbol: "xcBNC",
2253
2253
  decimals: 12
2254
2254
  },
2255
2255
  {
2256
2256
  assetId: "32615670524745285411807346420584982855",
2257
- symbol: "PARA",
2257
+ symbol: "xcPARA",
2258
2258
  decimals: 12
2259
2259
  },
2260
2260
  {
2261
2261
  assetId: "42259045809535163221576417993425387648",
2262
- symbol: "DOT",
2262
+ symbol: "xcDOT",
2263
2263
  decimals: 10
2264
2264
  },
2265
2265
  {
2266
2266
  assetId: "45647473099451451833602657905356404688",
2267
- symbol: "PEN",
2267
+ symbol: "xcPEN",
2268
2268
  decimals: 12
2269
2269
  },
2270
2270
  {
2271
2271
  assetId: "224821240862170613278369189818311486111",
2272
- symbol: "ACA",
2272
+ symbol: "xcACA",
2273
2273
  decimals: 12
2274
2274
  },
2275
2275
  {
2276
2276
  assetId: "272547899416482196831721420898811311297",
2277
- symbol: "vFIL",
2277
+ symbol: "xcvFIL",
2278
2278
  decimals: 18
2279
2279
  },
2280
2280
  {
2281
2281
  assetId: "114018676402354620972806895487280206446",
2282
- symbol: "vASTR",
2282
+ symbol: "xcvASTR",
2283
2283
  decimals: 18
2284
2284
  },
2285
2285
  {
2286
2286
  assetId: "238111524681612888331172110363070489924",
2287
- symbol: "NEURO",
2287
+ symbol: "xcNEURO",
2288
2288
  decimals: 12
2289
2289
  },
2290
2290
  {
2291
2291
  assetId: "112679793397406599376365943185137098326",
2292
- symbol: "STINK",
2292
+ symbol: "xcSTINK",
2293
2293
  decimals: 10
2294
2294
  },
2295
2295
  {
2296
2296
  assetId: "132685552157663328694213725410064821485",
2297
- symbol: "PHA",
2297
+ symbol: "xcPHA",
2298
2298
  decimals: 12
2299
2299
  }
2300
2300
  ]
@@ -5469,122 +5469,122 @@ var Moonriver$3 = {
5469
5469
  otherAssets: [
5470
5470
  {
5471
5471
  assetId: "108457044225666871745333730479173774551",
5472
- symbol: "CSM",
5472
+ symbol: "xcCSM",
5473
5473
  decimals: 12
5474
5474
  },
5475
5475
  {
5476
5476
  assetId: "16797826370226091782818345603793389938",
5477
- symbol: "SDN",
5477
+ symbol: "xcSDN",
5478
5478
  decimals: 18
5479
5479
  },
5480
5480
  {
5481
5481
  assetId: "76100021443485661246318545281171740067",
5482
- symbol: "HKO",
5482
+ symbol: "xcHKO",
5483
5483
  decimals: 12
5484
5484
  },
5485
5485
  {
5486
5486
  assetId: "138512078356357941985706694377215053953",
5487
- symbol: "TNKR",
5487
+ symbol: "xcTNKR",
5488
5488
  decimals: 12
5489
5489
  },
5490
5490
  {
5491
5491
  assetId: "328179947973504579459046439826496046832",
5492
- symbol: "KBTC",
5492
+ symbol: "xcKBTC",
5493
5493
  decimals: 8
5494
5494
  },
5495
5495
  {
5496
5496
  assetId: "108036400430056508975016746969135344601",
5497
- symbol: "XRT",
5497
+ symbol: "xcXRT",
5498
5498
  decimals: 9
5499
5499
  },
5500
5500
  {
5501
5501
  assetId: "133300872918374599700079037156071917454",
5502
- symbol: "TUR",
5502
+ symbol: "xcTUR",
5503
5503
  decimals: 10
5504
5504
  },
5505
5505
  {
5506
5506
  assetId: "213357169630950964874127107356898319277",
5507
- symbol: "KMA",
5507
+ symbol: "xcKMA",
5508
5508
  decimals: 12
5509
5509
  },
5510
5510
  {
5511
5511
  assetId: "65216491554813189869575508812319036608",
5512
- symbol: "LIT",
5512
+ symbol: "xcLIT",
5513
5513
  decimals: 12
5514
5514
  },
5515
5515
  {
5516
5516
  assetId: "173481220575862801646329923366065693029",
5517
- symbol: "CRAB",
5517
+ symbol: "xcCRAB",
5518
5518
  decimals: 18
5519
5519
  },
5520
5520
  {
5521
5521
  assetId: "189307976387032586987344677431204943363",
5522
- symbol: "PHA",
5522
+ symbol: "xcPHA",
5523
5523
  decimals: 12
5524
5524
  },
5525
5525
  {
5526
5526
  assetId: "264344629840762281112027368930249420542",
5527
- symbol: "vKSM",
5527
+ symbol: "xcvKSM",
5528
5528
  decimals: 12
5529
5529
  },
5530
5530
  {
5531
5531
  assetId: "72145018963825376852137222787619937732",
5532
- symbol: "vBNC",
5532
+ symbol: "xcvBNC",
5533
5533
  decimals: 12
5534
5534
  },
5535
5535
  {
5536
5536
  assetId: "214920334981412447805621250067209749032",
5537
- symbol: "aSeed",
5537
+ symbol: "xcaSeed",
5538
5538
  decimals: 12
5539
5539
  },
5540
5540
  {
5541
5541
  assetId: "175400718394635817552109270754364440562",
5542
- symbol: "KINT",
5542
+ symbol: "xcKINT",
5543
5543
  decimals: 12
5544
5544
  },
5545
5545
  {
5546
5546
  assetId: "167283995827706324502761431814209211090",
5547
- symbol: "PICA",
5547
+ symbol: "xcPICA",
5548
5548
  decimals: 12
5549
5549
  },
5550
5550
  {
5551
5551
  assetId: "105075627293246237499203909093923548958",
5552
- symbol: "TEER",
5552
+ symbol: "xcTEER",
5553
5553
  decimals: 12
5554
5554
  },
5555
5555
  {
5556
5556
  assetId: "118095707745084482624853002839493125353",
5557
- symbol: "MGX",
5557
+ symbol: "xcMGX",
5558
5558
  decimals: 18
5559
5559
  },
5560
5560
  {
5561
5561
  assetId: "203223821023327994093278529517083736593",
5562
- symbol: "vMOVR",
5562
+ symbol: "xcvMOVR",
5563
5563
  decimals: 18
5564
5564
  },
5565
5565
  {
5566
5566
  assetId: "311091173110107856861649819128533077277",
5567
- symbol: "USDT",
5567
+ symbol: "xcUSDT",
5568
5568
  decimals: 6
5569
5569
  },
5570
5570
  {
5571
5571
  assetId: "182365888117048807484804376330534607370",
5572
- symbol: "RMRK",
5572
+ symbol: "xcRMRK",
5573
5573
  decimals: 10
5574
5574
  },
5575
5575
  {
5576
5576
  assetId: "42259045809535163221576417993425387648",
5577
- symbol: "KSM",
5577
+ symbol: "xcKSM",
5578
5578
  decimals: 12
5579
5579
  },
5580
5580
  {
5581
5581
  assetId: "10810581592933651521121702237638664357",
5582
- symbol: "KAR",
5582
+ symbol: "xcKAR",
5583
5583
  decimals: 12
5584
5584
  },
5585
5585
  {
5586
5586
  assetId: "319623561105283008236062145480775032445",
5587
- symbol: "BNC",
5587
+ symbol: "xcBNC",
5588
5588
  decimals: 12
5589
5589
  }
5590
5590
  ]
@@ -8615,6 +8615,14 @@ var findParachainJunction = function findParachainJunction(multilocation) {
8615
8615
  };
8616
8616
 
8617
8617
  var DEFAULT_FEE_ASSET = 0;
8618
+ var ETH_CHAIN_ID = BigInt(1);
8619
+ var ETHEREUM_JUNCTION = {
8620
+ GlobalConsensus: {
8621
+ Ethereum: {
8622
+ chain_id: ETH_CHAIN_ID
8623
+ }
8624
+ }
8625
+ };
8618
8626
 
8619
8627
  var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
8620
8628
  var api = _ref.api,
@@ -8772,82 +8780,103 @@ var ParachainNode = /*#__PURE__*/function () {
8772
8780
  }, {
8773
8781
  key: "transfer",
8774
8782
  value: function transfer(options) {
8775
- var api = options.api,
8776
- currencySymbol = options.currencySymbol,
8777
- currencyId = options.currencyId,
8778
- amount = options.amount,
8779
- address = options.address,
8780
- destination = options.destination,
8781
- paraIdTo = options.paraIdTo,
8782
- overridedCurrencyMultiLocation = options.overridedCurrencyMultiLocation,
8783
- feeAsset = options.feeAsset,
8784
- _options$version = options.version,
8785
- version = _options$version === void 0 ? this.version : _options$version,
8786
- _options$serializedAp = options.serializedApiCallEnabled,
8787
- serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
8788
- var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
8789
- var paraId = destination !== undefined && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
8790
- if (destination === 'Polimec' && this.node !== 'AssetHubPolkadot') {
8791
- throw new Error('Sending assets to Polimec is supported only from AssetHubPolkadot');
8792
- }
8793
- if (supportsXTokens(this) && this.canUseXTokens(options)) {
8794
- return this.transferXTokens({
8795
- api: api,
8796
- currency: currencySymbol,
8797
- currencyID: currencyId,
8798
- amount: amount,
8799
- addressSelection: generateAddressPayload(api, scenario, 'XTokens', address, version, paraId),
8800
- fees: getFees(scenario),
8801
- origin: this.node,
8802
- scenario: scenario,
8803
- paraIdTo: paraId,
8804
- destination: destination,
8805
- overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
8806
- feeAsset: feeAsset,
8807
- serializedApiCallEnabled: serializedApiCallEnabled
8808
- });
8809
- } else if (supportsXTransfer(this)) {
8810
- return this.transferXTransfer({
8811
- api: api,
8812
- currency: currencySymbol,
8813
- currencyID: currencyId,
8814
- amount: amount,
8815
- recipientAddress: address,
8816
- paraId: paraId,
8817
- origin: this.node,
8818
- destination: destination,
8819
- overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
8820
- serializedApiCallEnabled: serializedApiCallEnabled
8821
- });
8822
- } else if (supportsPolkadotXCM(this)) {
8823
- if (isTMultiLocation(overridedCurrencyMultiLocation) && !verifyMultiLocation(this.node, overridedCurrencyMultiLocation)) {
8824
- throw new InvalidCurrencyError('Provided Multi-location is not a valid currency.');
8825
- }
8826
- return this.transferPolkadotXCM({
8827
- api: api,
8828
- header: this.createPolkadotXcmHeader(scenario, version, destination, paraId),
8829
- addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, version, paraId),
8830
- address: address,
8831
- amount: amount,
8832
- currencySelection: this.createCurrencySpec(amount, scenario, version, currencyId, overridedCurrencyMultiLocation),
8833
- currencyId: currencyId,
8834
- scenario: scenario,
8835
- currencySymbol: currencySymbol,
8836
- feeAsset: feeAsset,
8837
- destination: destination,
8838
- paraIdTo: paraId,
8839
- overridedCurrency: overridedCurrencyMultiLocation,
8840
- serializedApiCallEnabled: serializedApiCallEnabled
8841
- });
8842
- } else {
8843
- throw new NoXCMSupportImplementedError(this._node);
8844
- }
8783
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8784
+ var api, currencySymbol, currencyId, amount, address, destination, paraIdTo, overridedCurrencyMultiLocation, feeAsset, version, ahAddress, _options$serializedAp, serializedApiCallEnabled, scenario, paraId, versionOrDefault;
8785
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
8786
+ while (1) switch (_context.prev = _context.next) {
8787
+ case 0:
8788
+ api = options.api, currencySymbol = options.currencySymbol, currencyId = options.currencyId, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, overridedCurrencyMultiLocation = options.overridedCurrencyMultiLocation, feeAsset = options.feeAsset, version = options.version, ahAddress = options.ahAddress, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
8789
+ scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
8790
+ paraId = destination !== undefined && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
8791
+ if (!(destination === 'Polimec' && this.node !== 'AssetHubPolkadot')) {
8792
+ _context.next = 5;
8793
+ break;
8794
+ }
8795
+ throw new Error('Sending assets to Polimec is supported only from AssetHubPolkadot');
8796
+ case 5:
8797
+ versionOrDefault = version !== null && version !== void 0 ? version : this.version;
8798
+ if (!(supportsXTokens(this) && this.canUseXTokens(options))) {
8799
+ _context.next = 10;
8800
+ break;
8801
+ }
8802
+ return _context.abrupt("return", this.transferXTokens({
8803
+ api: api,
8804
+ currency: currencySymbol,
8805
+ currencyID: currencyId,
8806
+ amount: amount,
8807
+ addressSelection: generateAddressPayload(api, scenario, 'XTokens', address, versionOrDefault, paraId),
8808
+ fees: getFees(scenario),
8809
+ origin: this.node,
8810
+ scenario: scenario,
8811
+ paraIdTo: paraId,
8812
+ destination: destination,
8813
+ overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
8814
+ feeAsset: feeAsset,
8815
+ serializedApiCallEnabled: serializedApiCallEnabled
8816
+ }));
8817
+ case 10:
8818
+ if (!supportsXTransfer(this)) {
8819
+ _context.next = 14;
8820
+ break;
8821
+ }
8822
+ return _context.abrupt("return", this.transferXTransfer({
8823
+ api: api,
8824
+ currency: currencySymbol,
8825
+ currencyID: currencyId,
8826
+ amount: amount,
8827
+ recipientAddress: address,
8828
+ paraId: paraId,
8829
+ origin: this.node,
8830
+ destination: destination,
8831
+ overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
8832
+ serializedApiCallEnabled: serializedApiCallEnabled
8833
+ }));
8834
+ case 14:
8835
+ if (!supportsPolkadotXCM(this)) {
8836
+ _context.next = 22;
8837
+ break;
8838
+ }
8839
+ if (!(isTMultiLocation(overridedCurrencyMultiLocation) && !verifyMultiLocation(this.node, overridedCurrencyMultiLocation))) {
8840
+ _context.next = 17;
8841
+ break;
8842
+ }
8843
+ throw new InvalidCurrencyError('Provided Multi-location is not a valid currency.');
8844
+ case 17:
8845
+ _context.next = 19;
8846
+ return this.transferPolkadotXCM({
8847
+ api: api,
8848
+ header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraId),
8849
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, versionOrDefault, paraId),
8850
+ address: address,
8851
+ amount: amount,
8852
+ currencySelection: this.createCurrencySpec(amount, scenario, versionOrDefault, currencyId, overridedCurrencyMultiLocation),
8853
+ currencyId: currencyId,
8854
+ scenario: scenario,
8855
+ currencySymbol: currencySymbol,
8856
+ feeAsset: feeAsset,
8857
+ destination: destination,
8858
+ paraIdTo: paraId,
8859
+ overridedCurrency: overridedCurrencyMultiLocation,
8860
+ serializedApiCallEnabled: serializedApiCallEnabled,
8861
+ version: version,
8862
+ ahAddress: ahAddress
8863
+ });
8864
+ case 19:
8865
+ return _context.abrupt("return", _context.sent);
8866
+ case 22:
8867
+ throw new NoXCMSupportImplementedError(this._node);
8868
+ case 23:
8869
+ case "end":
8870
+ return _context.stop();
8871
+ }
8872
+ }, _callee, this);
8873
+ }));
8845
8874
  }
8846
8875
  }, {
8847
8876
  key: "transferRelayToPara",
8848
8877
  value: function transferRelayToPara(options) {
8849
- var _options$version2 = options.version,
8850
- version = _options$version2 === void 0 ? Version.V3 : _options$version2;
8878
+ var _options$version = options.version,
8879
+ version = _options$version === void 0 ? Version.V3 : _options$version;
8851
8880
  return {
8852
8881
  module: 'XcmPallet',
8853
8882
  section: 'reserve_transfer_assets',
@@ -8862,21 +8891,21 @@ var ParachainNode = /*#__PURE__*/function () {
8862
8891
  }, {
8863
8892
  key: "createApiInstance",
8864
8893
  value: function createApiInstance(api) {
8865
- return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
8866
- return _regeneratorRuntime().wrap(function _callee$(_context) {
8867
- while (1) switch (_context.prev = _context.next) {
8894
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
8895
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
8896
+ while (1) switch (_context2.prev = _context2.next) {
8868
8897
  case 0:
8869
- return _context.abrupt("return", api.createApiInstance(this.getProvider()));
8898
+ return _context2.abrupt("return", api.createApiInstance(this.getProvider()));
8870
8899
  case 1:
8871
8900
  case "end":
8872
- return _context.stop();
8901
+ return _context2.stop();
8873
8902
  }
8874
- }, _callee, this);
8903
+ }, _callee2, this);
8875
8904
  }));
8876
8905
  }
8877
8906
  }, {
8878
8907
  key: "createCurrencySpec",
8879
- value: function createCurrencySpec$1(amount, scenario, version, _, overridedMultiLocation) {
8908
+ value: function createCurrencySpec$1(amount, scenario, version, _currencyId, overridedMultiLocation) {
8880
8909
  return createCurrencySpec(amount, version, scenario === 'ParaToRelay' ? Parents.ONE : Parents.ZERO, overridedMultiLocation);
8881
8910
  }
8882
8911
  }, {
@@ -8960,6 +8989,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
8960
8989
  value: function transferXTokens(input, currencySelection) {
8961
8990
  var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
8962
8991
  var api = input.api,
8992
+ origin = input.origin,
8963
8993
  amount = input.amount,
8964
8994
  addressSelection = input.addressSelection,
8965
8995
  destination = input.destination,
@@ -8969,10 +8999,12 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
8969
8999
  if (isMultiLocationDestination) {
8970
9000
  throw new Error('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
8971
9001
  }
8972
- var isAssetHub = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
8973
- var modifiedCurrencySelection = getCurrencySelection(input, isAssetHub, currencySelection);
8974
- var section = isAssetHub ? feeAsset ? 'transfer_multiassets' : 'transfer_multiasset' : 'transfer';
8975
- var parameters = getXTokensParameters(isAssetHub, modifiedCurrencySelection, addressSelection, amount, fees, feeAsset);
9002
+ var isBifrostOrigin = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
9003
+ var isAssetHubDest = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
9004
+ var shouldUseMultiasset = isAssetHubDest && !isBifrostOrigin;
9005
+ var modifiedCurrencySelection = getCurrencySelection(input, shouldUseMultiasset, currencySelection);
9006
+ var section = shouldUseMultiasset ? feeAsset ? 'transfer_multiassets' : 'transfer_multiasset' : 'transfer';
9007
+ var parameters = getXTokensParameters(shouldUseMultiasset, modifiedCurrencySelection, addressSelection, amount, fees, feeAsset);
8976
9008
  var call = {
8977
9009
  module: 'XTokens',
8978
9010
  section: section,
@@ -9062,6 +9094,45 @@ var Crust$2 = /*#__PURE__*/function (_ParachainNode) {
9062
9094
  }]);
9063
9095
  }(ParachainNode);
9064
9096
 
9097
+ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
9098
+ function PolkadotXCMTransferImpl() {
9099
+ _classCallCheck(this, PolkadotXCMTransferImpl);
9100
+ }
9101
+ return _createClass(PolkadotXCMTransferImpl, null, [{
9102
+ key: "transferPolkadotXCM",
9103
+ value: function transferPolkadotXCM(_ref, section) {
9104
+ var api = _ref.api,
9105
+ header = _ref.header,
9106
+ addressSelection = _ref.addressSelection,
9107
+ currencySelection = _ref.currencySelection,
9108
+ _ref$feeAsset = _ref.feeAsset,
9109
+ feeAsset = _ref$feeAsset === void 0 ? DEFAULT_FEE_ASSET : _ref$feeAsset,
9110
+ serializedApiCallEnabled = _ref.serializedApiCallEnabled;
9111
+ var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
9112
+ var module = 'PolkadotXcm';
9113
+ var call = {
9114
+ module: module,
9115
+ section: section,
9116
+ parameters: Object.assign({
9117
+ dest: header,
9118
+ beneficiary: addressSelection,
9119
+ assets: currencySelection,
9120
+ fee_asset_item: feeAsset
9121
+ }, fees !== undefined ? {
9122
+ weight_limit: fees
9123
+ } : {})
9124
+ };
9125
+ if (serializedApiCallEnabled === true) {
9126
+ // Keep compatible with old serialized call type
9127
+ return Object.assign(Object.assign({}, call), {
9128
+ parameters: Object.values(call.parameters)
9129
+ });
9130
+ }
9131
+ return api.callTxMethod(call);
9132
+ }
9133
+ }]);
9134
+ }();
9135
+
9065
9136
  var BifrostPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9066
9137
  function BifrostPolkadot() {
9067
9138
  _classCallCheck(this, BifrostPolkadot);
@@ -9109,6 +9180,31 @@ var BifrostPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9109
9180
  var currencySelection = this.getCurrencySelection(currency, currencyID);
9110
9181
  return XTokensTransferImpl.transferXTokens(input, currencySelection);
9111
9182
  }
9183
+ // Handles DOT, WETH transfers to AssetHubPolkadot
9184
+ }, {
9185
+ key: "transferPolkadotXCM",
9186
+ value: function transferPolkadotXCM(input) {
9187
+ var _a;
9188
+ var amount = input.amount,
9189
+ overridedCurrency = input.overridedCurrency,
9190
+ currencySymbol = input.currencySymbol;
9191
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
9192
+ currencySelection: createCurrencySpec(amount, this.version, currencySymbol === 'DOT' ? Parents.ONE : Parents.TWO, overridedCurrency, currencySymbol === 'WETH' ? {
9193
+ X2: [ETHEREUM_JUNCTION, {
9194
+ AccountKey20: {
9195
+ key: (_a = getAssetId('Ethereum', 'WETH')) !== null && _a !== void 0 ? _a : ''
9196
+ }
9197
+ }]
9198
+ } : undefined)
9199
+ }), 'transfer_assets', 'Unlimited'));
9200
+ }
9201
+ }, {
9202
+ key: "canUseXTokens",
9203
+ value: function canUseXTokens(_ref) {
9204
+ var currencySymbol = _ref.currencySymbol,
9205
+ destination = _ref.destination;
9206
+ return currencySymbol !== 'WETH' && currencySymbol !== 'DOT' || destination !== 'AssetHubPolkadot';
9207
+ }
9112
9208
  }]);
9113
9209
  }(ParachainNode);
9114
9210
 
@@ -9155,18 +9251,195 @@ var ComposableFinance$2 = /*#__PURE__*/function (_ParachainNode) {
9155
9251
  }]);
9156
9252
  }(ParachainNode);
9157
9253
 
9254
+ var calculateFee = function calculateFee(api) {
9255
+ return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
9256
+ var DEFAULT_FEE, ahApi, feeStorageItem, leFeeHex, leFee, transfer_bridge_fee, transfer_assethub_execution_fee;
9257
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
9258
+ while (1) switch (_context.prev = _context.next) {
9259
+ case 0:
9260
+ DEFAULT_FEE = BigInt(2750872500000);
9261
+ _context.next = 3;
9262
+ return api.createApiForNode('AssetHubPolkadot');
9263
+ case 3:
9264
+ ahApi = _context.sent;
9265
+ _context.next = 6;
9266
+ return ahApi.getFromStorage('0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
9267
+ case 6:
9268
+ feeStorageItem = _context.sent;
9269
+ leFeeHex = feeStorageItem.replace('0x', '');
9270
+ leFee = BigInt('0x' + leFeeHex.split('').reverse().join(''));
9271
+ transfer_bridge_fee = leFee === BigInt(0) ? DEFAULT_FEE : BigInt(leFee.toString());
9272
+ transfer_assethub_execution_fee = BigInt(2200000000);
9273
+ return _context.abrupt("return", (transfer_bridge_fee + transfer_assethub_execution_fee).toString());
9274
+ case 12:
9275
+ case "end":
9276
+ return _context.stop();
9277
+ }
9278
+ }, _callee);
9279
+ }));
9280
+ };
9281
+ var createEthereumTokenLocation = function createEthereumTokenLocation(currencyId) {
9282
+ return {
9283
+ parents: Parents.TWO,
9284
+ interior: {
9285
+ X2: [ETHEREUM_JUNCTION, {
9286
+ AccountKey20: {
9287
+ key: currencyId
9288
+ }
9289
+ }]
9290
+ }
9291
+ };
9292
+ };
9293
+ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, versionOrDefault) {
9294
+ var api = _ref.api,
9295
+ address = _ref.address,
9296
+ currencyId = _ref.currencyId,
9297
+ scenario = _ref.scenario,
9298
+ ahAddress = _ref.ahAddress;
9299
+ return _defineProperty({}, versionOrDefault, [{
9300
+ SetAppendix: [{
9301
+ DepositAsset: {
9302
+ assets: {
9303
+ Wild: 'All'
9304
+ },
9305
+ beneficiary: Object.values(generateAddressPayload(api, scenario, 'PolkadotXcm', ahAddress !== null && ahAddress !== void 0 ? ahAddress : '', versionOrDefault, undefined))[0]
9306
+ }
9307
+ }]
9308
+ }, {
9309
+ InitiateReserveWithdraw: {
9310
+ assets: {
9311
+ Wild: {
9312
+ AllOf: {
9313
+ id: createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : ''),
9314
+ fun: 'Fungible'
9315
+ }
9316
+ }
9317
+ },
9318
+ reserve: {
9319
+ parents: Parents.TWO,
9320
+ interior: {
9321
+ X1: [ETHEREUM_JUNCTION]
9322
+ }
9323
+ },
9324
+ xcm: [{
9325
+ BuyExecution: {
9326
+ fees: {
9327
+ id: {
9328
+ parents: Parents.ZERO,
9329
+ interior: {
9330
+ X1: [{
9331
+ AccountKey20: {
9332
+ network: null,
9333
+ key: currencyId
9334
+ }
9335
+ }]
9336
+ }
9337
+ },
9338
+ fun: {
9339
+ Fungible: BigInt(1)
9340
+ }
9341
+ },
9342
+ weight_limit: 'Unlimited'
9343
+ }
9344
+ }, {
9345
+ DepositAsset: {
9346
+ assets: {
9347
+ Wild: {
9348
+ AllCounted: 1
9349
+ }
9350
+ },
9351
+ beneficiary: {
9352
+ parents: Parents.ZERO,
9353
+ interior: {
9354
+ X1: [{
9355
+ AccountKey20: {
9356
+ network: null,
9357
+ key: address
9358
+ }
9359
+ }]
9360
+ }
9361
+ }
9362
+ }
9363
+ }]
9364
+ }
9365
+ }]);
9366
+ };
9158
9367
  var Hydration$2 = /*#__PURE__*/function (_ParachainNode) {
9159
9368
  function Hydration() {
9160
9369
  _classCallCheck(this, Hydration);
9161
9370
  return _callSuper(this, Hydration, ['Hydration', 'hydradx', 'polkadot', Version.V3]);
9162
9371
  }
9372
+ // Handles WETH Ethereum transfers
9163
9373
  _inherits(Hydration, _ParachainNode);
9164
9374
  return _createClass(Hydration, [{
9375
+ key: "transferPolkadotXCM",
9376
+ value: function transferPolkadotXCM(input) {
9377
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
9378
+ var api, address, currencySymbol, scenario, version, destination, amount, currencyId, ahAddress, versionOrDefault, ethMultiAsset, fee, call;
9379
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
9380
+ while (1) switch (_context2.prev = _context2.next) {
9381
+ case 0:
9382
+ api = input.api, address = input.address, currencySymbol = input.currencySymbol, scenario = input.scenario, version = input.version, destination = input.destination, amount = input.amount, currencyId = input.currencyId, ahAddress = input.ahAddress;
9383
+ if (ethers.isAddress(address)) {
9384
+ _context2.next = 3;
9385
+ break;
9386
+ }
9387
+ throw new Error('Only Ethereum addresses are supported for Ethereum transfers');
9388
+ case 3:
9389
+ if (!((currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) !== 'WETH')) {
9390
+ _context2.next = 5;
9391
+ break;
9392
+ }
9393
+ throw new InvalidCurrencyError("Currency ".concat(currencySymbol, " is not supported for Ethereum transfers from Hydration"));
9394
+ case 5:
9395
+ if (!(ahAddress === undefined)) {
9396
+ _context2.next = 7;
9397
+ break;
9398
+ }
9399
+ throw new Error('AssetHub address is required for Ethereum transfers');
9400
+ case 7:
9401
+ versionOrDefault = version !== null && version !== void 0 ? version : Version.V4;
9402
+ ethMultiAsset = Object.values(createCurrencySpec(amount, versionOrDefault, Parents.TWO, createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : '')))[0][0];
9403
+ _context2.next = 11;
9404
+ return calculateFee(api);
9405
+ case 11:
9406
+ fee = _context2.sent;
9407
+ call = {
9408
+ module: 'PolkadotXcm',
9409
+ section: 'transfer_assets_using_type_and_then',
9410
+ parameters: {
9411
+ dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
9412
+ assets: _defineProperty({}, versionOrDefault, [Object.values(this.createCurrencySpec(fee, 'ParaToRelay', versionOrDefault))[0][0], ethMultiAsset]),
9413
+ assets_transfer_type: 'DestinationReserve',
9414
+ remote_fees_id: _defineProperty({}, versionOrDefault, {
9415
+ parents: Parents.ONE,
9416
+ interior: 'Here'
9417
+ }),
9418
+ fees_transfer_type: 'DestinationReserve',
9419
+ custom_xcm_on_dest: createCustomXcmOnDest(input, versionOrDefault),
9420
+ weight_limit: 'Unlimited'
9421
+ }
9422
+ };
9423
+ return _context2.abrupt("return", api.callTxMethod(call));
9424
+ case 14:
9425
+ case "end":
9426
+ return _context2.stop();
9427
+ }
9428
+ }, _callee2, this);
9429
+ }));
9430
+ }
9431
+ }, {
9165
9432
  key: "transferXTokens",
9166
9433
  value: function transferXTokens(input) {
9167
9434
  var currencyID = input.currencyID;
9168
9435
  return XTokensTransferImpl.transferXTokens(input, currencyID);
9169
9436
  }
9437
+ }, {
9438
+ key: "canUseXTokens",
9439
+ value: function canUseXTokens(_ref3) {
9440
+ var destination = _ref3.destination;
9441
+ return destination !== 'Ethereum';
9442
+ }
9170
9443
  }]);
9171
9444
  }(ParachainNode);
9172
9445
 
@@ -9592,45 +9865,6 @@ var Karura$2 = /*#__PURE__*/function (_ParachainNode) {
9592
9865
  }]);
9593
9866
  }(ParachainNode);
9594
9867
 
9595
- var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
9596
- function PolkadotXCMTransferImpl() {
9597
- _classCallCheck(this, PolkadotXCMTransferImpl);
9598
- }
9599
- return _createClass(PolkadotXCMTransferImpl, null, [{
9600
- key: "transferPolkadotXCM",
9601
- value: function transferPolkadotXCM(_ref, section) {
9602
- var api = _ref.api,
9603
- header = _ref.header,
9604
- addressSelection = _ref.addressSelection,
9605
- currencySelection = _ref.currencySelection,
9606
- _ref$feeAsset = _ref.feeAsset,
9607
- feeAsset = _ref$feeAsset === void 0 ? DEFAULT_FEE_ASSET : _ref$feeAsset,
9608
- serializedApiCallEnabled = _ref.serializedApiCallEnabled;
9609
- var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
9610
- var module = 'PolkadotXcm';
9611
- var call = {
9612
- module: module,
9613
- section: section,
9614
- parameters: Object.assign({
9615
- dest: header,
9616
- beneficiary: addressSelection,
9617
- assets: currencySelection,
9618
- fee_asset_item: feeAsset
9619
- }, fees !== undefined ? {
9620
- weight_limit: fees
9621
- } : {})
9622
- };
9623
- if (serializedApiCallEnabled === true) {
9624
- // Keep compatible with old serialized call type
9625
- return Object.assign(Object.assign({}, call), {
9626
- parameters: Object.values(call.parameters)
9627
- });
9628
- }
9629
- return api.callTxMethod(call);
9630
- }
9631
- }]);
9632
- }();
9633
-
9634
9868
  var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9635
9869
  function AssetHubPolkadot() {
9636
9870
  _classCallCheck(this, AssetHubPolkadot);
@@ -9676,21 +9910,13 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9676
9910
  if (!ethAsset) {
9677
9911
  throw new InvalidCurrencyError("Currency ".concat(currencySymbol, " is not supported for Ethereum transfers"));
9678
9912
  }
9679
- var ETH_CHAIN_ID = BigInt(1);
9680
- var ethJunction = {
9681
- GlobalConsensus: {
9682
- Ethereum: {
9683
- chain_id: ETH_CHAIN_ID
9684
- }
9685
- }
9686
- };
9687
9913
  var modifiedInput = Object.assign(Object.assign({}, input), {
9688
- header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ethJunction, Parents.TWO),
9914
+ header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, Parents.TWO),
9689
9915
  addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, this.version, paraIdTo),
9690
9916
  currencySelection: createCurrencySpec(input.amount, Version.V3, Parents.TWO, {
9691
9917
  parents: Parents.TWO,
9692
9918
  interior: {
9693
- X2: [ethJunction, {
9919
+ X2: [ETHEREUM_JUNCTION, {
9694
9920
  AccountKey20: {
9695
9921
  key: ethAsset.assetId
9696
9922
  }
@@ -9731,17 +9957,18 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9731
9957
  }, {
9732
9958
  key: "transferPolkadotXCM",
9733
9959
  value: function transferPolkadotXCM(input) {
9960
+ var _a;
9734
9961
  var scenario = input.scenario,
9735
9962
  currencySymbol = input.currencySymbol,
9736
9963
  currencyId = input.currencyId;
9737
9964
  if (input.destination === 'AssetHubKusama') {
9738
- return this.handleBridgeTransfer(input, 'Kusama');
9965
+ return Promise.resolve(this.handleBridgeTransfer(input, 'Kusama'));
9739
9966
  }
9740
9967
  if (input.destination === 'Ethereum') {
9741
- return this.handleEthBridgeTransfer(input);
9968
+ return Promise.resolve(this.handleEthBridgeTransfer(input));
9742
9969
  }
9743
9970
  if (input.destination === 'Mythos') {
9744
- return this.handleMythosTransfer(input);
9971
+ return Promise.resolve(this.handleMythosTransfer(input));
9745
9972
  }
9746
9973
  if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined) {
9747
9974
  throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
@@ -9750,7 +9977,19 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9750
9977
  throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged KSM cannot currently be transfered from AssetHubPolkadot, if you are sending different KSM asset, please specify {id: <KSMID>}.');
9751
9978
  }
9752
9979
  var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
9753
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
9980
+ var api = input.api,
9981
+ destination = input.destination,
9982
+ paraIdTo = input.paraIdTo,
9983
+ address = input.address,
9984
+ amount = input.amount,
9985
+ overridedCurrency = input.overridedCurrency;
9986
+ var versionOrDefault = (_a = input.version) !== null && _a !== void 0 ? _a : Version.V2;
9987
+ var modifiedInput = ((currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) === 'USDT' || (currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) === 'USDC') && destination === 'BifrostPolkadot' ? Object.assign(Object.assign({}, input), {
9988
+ header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
9989
+ addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, versionOrDefault, paraIdTo),
9990
+ currencySelection: this.createCurrencySpec(amount, scenario, versionOrDefault, currencyId, overridedCurrency)
9991
+ }) : input;
9992
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, section, 'Unlimited'));
9754
9993
  }
9755
9994
  }, {
9756
9995
  key: "transferRelayToPara",
@@ -9799,7 +10038,7 @@ var AssetHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
9799
10038
  // TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
9800
10039
  // TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
9801
10040
  if (destination === 'AssetHubPolkadot') {
9802
- return getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot');
10041
+ return Promise.resolve(getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot'));
9803
10042
  }
9804
10043
  if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
9805
10044
  throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for KSM transfer from AssetHub are not supported, you have to transfer KSM to Relay chain and transfer to destination chain from Relay chain.');
@@ -9808,7 +10047,7 @@ var AssetHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
9808
10047
  throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged DOT cannot currently be transfered from AssetHubKusama, if you are sending different DOT asset, please specify {id: <DOTID>}.');
9809
10048
  }
9810
10049
  var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
9811
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10050
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
9812
10051
  }
9813
10052
  }, {
9814
10053
  key: "transferRelayToPara",
@@ -9844,7 +10083,7 @@ var CoretimeKusama$2 = /*#__PURE__*/function (_ParachainNode) {
9844
10083
  // TESTED block hash on Rococo: 0x78ace0f1bf7cac9a42e56143321b617d98327e2750f795efb0abb833025c9082
9845
10084
  var scenario = input.scenario;
9846
10085
  var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
9847
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10086
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
9848
10087
  }
9849
10088
  }, {
9850
10089
  key: "transferRelayToPara",
@@ -9876,7 +10115,7 @@ var CoretimePolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9876
10115
  value: function transferPolkadotXCM(input) {
9877
10116
  var scenario = input.scenario;
9878
10117
  var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
9879
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10118
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
9880
10119
  }
9881
10120
  }, {
9882
10121
  key: "transferRelayToPara",
@@ -9904,7 +10143,7 @@ var Encointer$2 = /*#__PURE__*/function (_ParachainNode) {
9904
10143
  // NO PARA TO PARA SCENARIOS ON SUBSCAN
9905
10144
  // TESTED https://encointer.subscan.io/xcm_message/kusama-418501e86e947b16c4e4e9040694017e64f9b162
9906
10145
  if (input.scenario === 'ParaToRelay') {
9907
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited');
10146
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited'));
9908
10147
  }
9909
10148
  throw new ScenarioNotSupportedError(this.node, input.scenario);
9910
10149
  }
@@ -9931,7 +10170,7 @@ var RobonomicsKusama$2 = /*#__PURE__*/function (_ParachainNode) {
9931
10170
  return _createClass(RobonomicsKusama, [{
9932
10171
  key: "transferPolkadotXCM",
9933
10172
  value: function transferPolkadotXCM(input) {
9934
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
10173
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
9935
10174
  }
9936
10175
  }]);
9937
10176
  }(ParachainNode);
@@ -9945,7 +10184,7 @@ var RobonomicsPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9945
10184
  return _createClass(RobonomicsPolkadot, [{
9946
10185
  key: "transferPolkadotXCM",
9947
10186
  value: function transferPolkadotXCM(input) {
9948
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
10187
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
9949
10188
  }
9950
10189
  }]);
9951
10190
  }(ParachainNode);
@@ -9964,7 +10203,7 @@ var PeoplePolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9964
10203
  throw new ScenarioNotSupportedError(this.node, scenario);
9965
10204
  }
9966
10205
  var section = 'limited_teleport_assets';
9967
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10206
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
9968
10207
  }
9969
10208
  }, {
9970
10209
  key: "transferRelayToPara",
@@ -9994,7 +10233,7 @@ var PeopleKusama$2 = /*#__PURE__*/function (_ParachainNode) {
9994
10233
  throw new ScenarioNotSupportedError(this.node, scenario);
9995
10234
  }
9996
10235
  var section = 'limited_teleport_assets';
9997
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10236
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
9998
10237
  }
9999
10238
  }, {
10000
10239
  key: "transferRelayToPara",
@@ -10021,7 +10260,7 @@ var Astar$2 = /*#__PURE__*/function (_ParachainNode) {
10021
10260
  value: function transferPolkadotXCM(input) {
10022
10261
  // TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
10023
10262
  var section = input.scenario === 'ParaToPara' ? 'reserve_transfer_assets' : 'reserve_withdraw_assets';
10024
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section);
10263
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section));
10025
10264
  }
10026
10265
  }, {
10027
10266
  key: "transferXTokens",
@@ -10093,7 +10332,7 @@ var Crab$2 = /*#__PURE__*/function (_ParachainNode) {
10093
10332
  value: function transferPolkadotXCM(input) {
10094
10333
  // TESTED https://kusama.subscan.io/xcm_message/kusama-ce7396ec470ba0c6516a50075046ee65464572dc
10095
10334
  if (input.scenario === 'ParaToPara') {
10096
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets');
10335
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
10097
10336
  }
10098
10337
  throw new ScenarioNotSupportedError(this.node, input.scenario);
10099
10338
  }
@@ -10208,7 +10447,7 @@ var NeuroWeb$2 = /*#__PURE__*/function (_ParachainNode) {
10208
10447
  return _createClass(NeuroWeb, [{
10209
10448
  key: "transferPolkadotXCM",
10210
10449
  value: function transferPolkadotXCM(input) {
10211
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
10450
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
10212
10451
  }
10213
10452
  }]);
10214
10453
  }(ParachainNode);
@@ -10286,7 +10525,7 @@ var Collectives$2 = /*#__PURE__*/function (_ParachainNode) {
10286
10525
  if (scenario === 'ParaToPara') {
10287
10526
  throw new ScenarioNotSupportedError(this.node, scenario);
10288
10527
  }
10289
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited');
10528
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited'));
10290
10529
  }
10291
10530
  }, {
10292
10531
  key: "transferRelayToPara",
@@ -10448,7 +10687,7 @@ var Subsocial$2 = /*#__PURE__*/function (_ParachainNode) {
10448
10687
  if (currencySymbol !== this.getNativeAssetSymbol()) {
10449
10688
  throw new InvalidCurrencyError("Asset ".concat(currencySymbol, " is not supported by node ").concat(this.node, "."));
10450
10689
  }
10451
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
10690
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
10452
10691
  }
10453
10692
  }]);
10454
10693
  }(ParachainNode);
@@ -10465,7 +10704,7 @@ var KiltSpiritnet$2 = /*#__PURE__*/function (_ParachainNode) {
10465
10704
  if (input.scenario !== 'ParaToPara') {
10466
10705
  throw new ScenarioNotSupportedError(this.node, input.scenario);
10467
10706
  }
10468
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets');
10707
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
10469
10708
  }
10470
10709
  }, {
10471
10710
  key: "transferRelayToPara",
@@ -10519,7 +10758,7 @@ var BridgeHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
10519
10758
  throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
10520
10759
  }
10521
10760
  var section = 'limited_teleport_assets';
10522
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10761
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
10523
10762
  }
10524
10763
  }, {
10525
10764
  key: "transferRelayToPara",
@@ -10552,7 +10791,7 @@ var BridgeHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
10552
10791
  throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
10553
10792
  }
10554
10793
  var section = 'limited_teleport_assets';
10555
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
10794
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
10556
10795
  }
10557
10796
  }, {
10558
10797
  key: "transferRelayToPara",
@@ -10596,7 +10835,7 @@ var Mythos$2 = /*#__PURE__*/function (_ParachainNode) {
10596
10835
  if (currencySymbol !== nativeSymbol) {
10597
10836
  throw new InvalidCurrencyError("Node ".concat(this.node, " does not support currency ").concat(currencySymbol));
10598
10837
  }
10599
- return PolkadotXCMTransferImpl.transferPolkadotXCM(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited');
10838
+ return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited'));
10600
10839
  }
10601
10840
  }, {
10602
10841
  key: "transferRelayToPara",
@@ -11284,21 +11523,63 @@ var getSupportedPallets = function getSupportedPallets(node) {
11284
11523
 
11285
11524
  // Contains function for getting Asset ID or Symbol used in XCM call creation
11286
11525
  var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination) {
11526
+ var lowerSymbol = symbol.toLowerCase();
11287
11527
  if (destination === 'Ethereum') {
11288
11528
  return combinedAssets.find(function (_ref) {
11289
11529
  var assetSymbol = _ref.symbol;
11290
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
11530
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11291
11531
  });
11292
11532
  }
11293
11533
  var otherAssetsMatches = otherAssets.filter(function (_ref2) {
11294
11534
  var assetSymbol = _ref2.symbol;
11295
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
11535
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11296
11536
  });
11297
11537
  var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
11298
11538
  var assetSymbol = _ref3.symbol;
11299
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
11539
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11300
11540
  });
11301
11541
  var isPolkadotXcm = !isRelayChain(node) && node !== 'Ethereum' && getDefaultPallet(node) === 'PolkadotXcm';
11542
+ if (otherAssetsMatches.length === 0 && nativeAssetsMatches.length === 0) {
11543
+ if (lowerSymbol.startsWith('xc')) {
11544
+ // No exact matches found, and symbol starts with 'xc', try stripping 'xc'
11545
+ var strippedSymbol = symbol.substring(2);
11546
+ var strippedLowerSymbol = strippedSymbol.toLowerCase();
11547
+ otherAssetsMatches = otherAssets.filter(function (_ref4) {
11548
+ var assetSymbol = _ref4.symbol;
11549
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
11550
+ });
11551
+ nativeAssetsMatches = nativeAssets.filter(function (_ref5) {
11552
+ var assetSymbol = _ref5.symbol;
11553
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
11554
+ });
11555
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11556
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11557
+ }
11558
+ var totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11559
+ if (totalMatches > 1) {
11560
+ throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after stripping 'xc' prefix. Please specify by ID."));
11561
+ }
11562
+ } else {
11563
+ // No matches found, and symbol does not start with 'xc', try adding 'xc' prefix
11564
+ var prefixedSymbol = "xc".concat(symbol);
11565
+ var prefixedLowerSymbol = prefixedSymbol.toLowerCase();
11566
+ otherAssetsMatches = otherAssets.filter(function (_ref6) {
11567
+ var assetSymbol = _ref6.symbol;
11568
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
11569
+ });
11570
+ nativeAssetsMatches = nativeAssets.filter(function (_ref7) {
11571
+ var assetSymbol = _ref7.symbol;
11572
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
11573
+ });
11574
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11575
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11576
+ }
11577
+ var _totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11578
+ if (_totalMatches > 1) {
11579
+ throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after adding 'xc' prefix. Please specify by ID."));
11580
+ }
11581
+ }
11582
+ }
11302
11583
  if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11303
11584
  return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11304
11585
  }
@@ -11308,15 +11589,15 @@ var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAsset
11308
11589
  return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
11309
11590
  };
11310
11591
  var findAssetById = function findAssetById(assets, assetId) {
11311
- var otherAssetsMatches = assets.filter(function (_ref4) {
11312
- var currentAssetId = _ref4.assetId;
11592
+ var otherAssetsMatches = assets.filter(function (_ref8) {
11593
+ var currentAssetId = _ref8.assetId;
11313
11594
  return currentAssetId === assetId.toString();
11314
11595
  });
11315
11596
  if (otherAssetsMatches.length > 1) {
11316
11597
  throw new DuplicateAssetIdError(assetId.toString());
11317
11598
  }
11318
- return assets.find(function (_ref5) {
11319
- var currentAssetId = _ref5.assetId;
11599
+ return assets.find(function (_ref9) {
11600
+ var currentAssetId = _ref9.assetId;
11320
11601
  return currentAssetId === assetId.toString();
11321
11602
  });
11322
11603
  };
@@ -11461,9 +11742,20 @@ var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
11461
11742
  * @returns True if the asset is supported; otherwise, false.
11462
11743
  */
11463
11744
  var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
11464
- return getAllAssetsSymbols(node).map(function (s) {
11745
+ var lowerSymbol = symbol.toLowerCase();
11746
+ var symbolsToCheck = new Set();
11747
+ symbolsToCheck.add(lowerSymbol);
11748
+ if (lowerSymbol.startsWith('xc')) {
11749
+ symbolsToCheck.add(lowerSymbol.substring(2));
11750
+ } else {
11751
+ symbolsToCheck.add("xc".concat(lowerSymbol));
11752
+ }
11753
+ var nodeSymbols = getAllAssetsSymbols(node).map(function (s) {
11465
11754
  return s.toLowerCase();
11466
- }).includes(symbol.toLowerCase());
11755
+ });
11756
+ return nodeSymbols.some(function (nodeSymbol) {
11757
+ return symbolsToCheck.has(nodeSymbol);
11758
+ });
11467
11759
  };
11468
11760
  /**
11469
11761
  * Retrieves the number of decimals for an asset with the given symbol on a specified node.
@@ -12195,8 +12487,9 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
12195
12487
  */
12196
12488
  }, {
12197
12489
  key: "address",
12198
- value: function address(_address) {
12490
+ value: function address(_address, ahAddress) {
12199
12491
  this._address = _address;
12492
+ this._ahAddress = ahAddress;
12200
12493
  return this;
12201
12494
  }
12202
12495
  /**
@@ -12236,7 +12529,8 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
12236
12529
  paraIdTo: this.paraIdTo,
12237
12530
  feeAsset: this._feeAsset,
12238
12531
  destApiForKeepAlive: this._destApi,
12239
- version: this._version
12532
+ version: this._version,
12533
+ ahAddress: this._ahAddress
12240
12534
  };
12241
12535
  }
12242
12536
  /**
@@ -13101,12 +13395,16 @@ var createTx$1 = function createTx(originApi, address, amount, currency, originN
13101
13395
  }, _callee);
13102
13396
  }));
13103
13397
  };
13104
- var getOriginFeeDetails = function getOriginFeeDetails(origin_1, destination_1, currency_1, amount_1, account_1, api_1) {
13105
- for (var _len = arguments.length, args_1 = new Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
13106
- args_1[_key - 6] = arguments[_key];
13107
- }
13108
- return __awaiter(void 0, [origin_1, destination_1, currency_1, amount_1, account_1, api_1].concat(args_1), void 0, function (origin, destination, currency, amount, account, api) {
13109
- var feeMarginPercentage = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 10;
13398
+ var getOriginFeeDetails$1 = function getOriginFeeDetails(_a) {
13399
+ return __awaiter(void 0, [_a], void 0, function (_ref) {
13400
+ var api = _ref.api,
13401
+ account = _ref.account,
13402
+ amount = _ref.amount,
13403
+ currency = _ref.currency,
13404
+ origin = _ref.origin,
13405
+ destination = _ref.destination,
13406
+ _ref$feeMarginPercent = _ref.feeMarginPercentage,
13407
+ feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
13110
13408
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
13111
13409
  var nativeBalance, minTransferableAmount, tx, xcmFee, xcmFeeWithMargin, sufficientForXCM;
13112
13410
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -13170,7 +13468,14 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13170
13468
  case 4:
13171
13469
  originBalance = _context.sent;
13172
13470
  _context.next = 7;
13173
- return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
13471
+ return getOriginFeeDetails$1({
13472
+ origin: origin,
13473
+ destination: destination,
13474
+ currency: currency,
13475
+ amount: amount,
13476
+ account: accountOrigin,
13477
+ api: originApi
13478
+ });
13174
13479
  case 7:
13175
13480
  _yield$getOriginFeeDe = _context.sent;
13176
13481
  destXcmFee = _yield$getOriginFeeDe.xcmFee;
@@ -13211,7 +13516,14 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13211
13516
  _context.t4 = _context.sent;
13212
13517
  _context.t5 = expectedBalanceAfterXCMDelivery;
13213
13518
  _context.next = 25;
13214
- return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
13519
+ return getOriginFeeDetails$1({
13520
+ origin: origin,
13521
+ destination: destination,
13522
+ currency: currency,
13523
+ amount: amount,
13524
+ account: accountOrigin,
13525
+ api: originApi
13526
+ });
13215
13527
  case 25:
13216
13528
  _context.t6 = _context.sent;
13217
13529
  _context.t7 = BigInt((_d = getExistentialDeposit(origin)) !== null && _d !== void 0 ? _d : 0);
@@ -13260,6 +13572,17 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13260
13572
  });
13261
13573
  };
13262
13574
 
13575
+ /**
13576
+ * Normalizes an asset symbol by stripping the 'xc' prefix (if present) and converting it to lowercase.
13577
+ *
13578
+ * @param symbol - The symbol to normalize.
13579
+ * @returns The normalized symbol.
13580
+ */
13581
+ var normalizeSymbol = function normalizeSymbol(symbol) {
13582
+ if (!symbol) return '';
13583
+ var lowerSymbol = symbol.toLowerCase();
13584
+ return lowerSymbol.startsWith('xc') ? lowerSymbol.substring(2) : lowerSymbol;
13585
+ };
13263
13586
  /**
13264
13587
  * Retrieves the list of assets that are supported for transfers between two specified nodes.
13265
13588
  *
@@ -13282,20 +13605,20 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
13282
13605
  });
13283
13606
  return [].concat(_toConsumableArray(polkadotAsset ? [polkadotAsset] : []), _toConsumableArray(kusamaAsset ? [kusamaAsset] : []));
13284
13607
  }
13285
- if (!isRelayChain(origin) && getDefaultPallet(origin) === 'XTokens' && (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama')) {
13608
+ var isBifrost = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
13609
+ if (!isRelayChain(origin) && getDefaultPallet(origin) === 'XTokens' && (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama') && !isBifrost) {
13286
13610
  return getOtherAssets(destination).filter(function (asset) {
13287
13611
  return originAssets.some(function (a) {
13288
- var _a, _b;
13289
- return ((_a = a.symbol) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = asset.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase());
13612
+ return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
13290
13613
  }) && asset.assetId !== '';
13291
13614
  });
13292
13615
  }
13293
- return originAssets.filter(function (asset) {
13616
+ var supportedAssets = originAssets.filter(function (asset) {
13294
13617
  return destinationAssets.some(function (a) {
13295
- var _a, _b;
13296
- return ((_a = a.symbol) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()) === ((_b = asset.symbol) === null || _b === void 0 ? void 0 : _b.toLowerCase());
13618
+ return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
13297
13619
  });
13298
13620
  });
13621
+ return supportedAssets;
13299
13622
  };
13300
13623
 
13301
13624
  var createTx = function createTx(originApi, destApi, address, amount, currencySymbol, originNode, destNode) {
@@ -13440,11 +13763,11 @@ var sendCommon = function sendCommon(options_1) {
13440
13763
  return __awaiter(void 0, [options_1].concat(args_1), void 0, function (options) {
13441
13764
  var serializedApiCallEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13442
13765
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
13443
- var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, isDestAssetHub, pallet, asset, amountStr, currencyStr;
13766
+ var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, ahAddress, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, isDestAssetHub, pallet, isBifrost, asset, amountStr, currencyStr;
13444
13767
  return _regeneratorRuntime().wrap(function _callee$(_context) {
13445
13768
  while (1) switch (_context.prev = _context.next) {
13446
13769
  case 0:
13447
- 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, version = options.version;
13770
+ 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, version = options.version, ahAddress = options.ahAddress;
13448
13771
  if (!((!('multiasset' in currency) || 'multilocation' in currency) && amount === null)) {
13449
13772
  _context.next = 3;
13450
13773
  break;
@@ -13494,11 +13817,11 @@ var sendCommon = function sendCommon(options_1) {
13494
13817
  }
13495
13818
  throw new InvalidCurrencyError('Fee asset index is out of bounds. Please provide a valid index.');
13496
13819
  case 17:
13497
- if (!(destination === 'Ethereum' && origin !== 'AssetHubPolkadot')) {
13820
+ if (!(destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration')) {
13498
13821
  _context.next = 19;
13499
13822
  break;
13500
13823
  }
13501
- throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot.');
13824
+ throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot and Hydration.');
13502
13825
  case 19:
13503
13826
  isMultiLocationDestination = _typeof(destination) === 'object';
13504
13827
  isBridge = origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
@@ -13519,84 +13842,85 @@ var sendCommon = function sendCommon(options_1) {
13519
13842
  assetCheckEnabled = 'multilocation' in currency || 'multiasset' in currency || isBridge ? false : originNode.assetCheckEnabled;
13520
13843
  isDestAssetHub = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
13521
13844
  pallet = getDefaultPallet(origin);
13522
- if (!(!isBridge && isDestAssetHub && pallet === 'XTokens')) {
13523
- _context.next = 41;
13845
+ isBifrost = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
13846
+ if (!(!isBridge && isDestAssetHub && pallet === 'XTokens' && !isBifrost)) {
13847
+ _context.next = 42;
13524
13848
  break;
13525
13849
  }
13526
13850
  asset = getAssetBySymbolOrId(destination, currency, false, destination);
13527
13851
  if (!('symbol' in currency && getNativeAssets(destination).some(function (nativeAsset) {
13528
13852
  return nativeAsset.symbol.toLowerCase() === currency.symbol.toLowerCase();
13529
13853
  }))) {
13530
- _context.next = 35;
13854
+ _context.next = 36;
13531
13855
  break;
13532
13856
  }
13533
13857
  throw new InvalidCurrencyError("".concat(currency.symbol, " is not supported for transfers to ").concat(destination, "."));
13534
- case 35:
13858
+ case 36:
13535
13859
  if (!(assetCheckEnabled && asset === null)) {
13536
- _context.next = 37;
13860
+ _context.next = 38;
13537
13861
  break;
13538
13862
  }
13539
13863
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
13540
- case 37:
13864
+ case 38:
13541
13865
  if (!((asset === null || asset === void 0 ? void 0 : asset.symbol) && !hasSupportForAsset(origin, asset.symbol))) {
13542
- _context.next = 39;
13866
+ _context.next = 40;
13543
13867
  break;
13544
13868
  }
13545
13869
  throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(asset.symbol, "."));
13546
- case 39:
13547
- _context.next = 46;
13870
+ case 40:
13871
+ _context.next = 47;
13548
13872
  break;
13549
- case 41:
13873
+ case 42:
13550
13874
  asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isTMultiLocation(destination) ? undefined : destination) : null;
13551
13875
  if (!(!isBridge && asset === null && assetCheckEnabled)) {
13552
- _context.next = 44;
13876
+ _context.next = 45;
13553
13877
  break;
13554
13878
  }
13555
13879
  throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency), "."));
13556
- case 44:
13880
+ case 45:
13557
13881
  if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol))) {
13558
- _context.next = 46;
13882
+ _context.next = 47;
13559
13883
  break;
13560
13884
  }
13561
13885
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
13562
- case 46:
13563
- _context.next = 48;
13886
+ case 47:
13887
+ _context.next = 49;
13564
13888
  return api.init(origin);
13565
- case 48:
13889
+ case 49:
13566
13890
  amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
13567
13891
  if (!('multilocation' in currency || 'multiasset' in currency)) {
13568
- _context.next = 53;
13892
+ _context.next = 54;
13569
13893
  break;
13570
13894
  }
13571
13895
  console.warn('Keep alive check is not supported when using MultiLocation as currency.');
13572
- _context.next = 67;
13896
+ _context.next = 68;
13573
13897
  break;
13574
- case 53:
13898
+ case 54:
13575
13899
  if (!(_typeof(address) === 'object')) {
13576
- _context.next = 57;
13900
+ _context.next = 58;
13577
13901
  break;
13578
13902
  }
13579
13903
  console.warn('Keep alive check is not supported when using MultiLocation as address.');
13580
- _context.next = 67;
13904
+ _context.next = 68;
13581
13905
  break;
13582
- case 57:
13906
+ case 58:
13583
13907
  if (!(_typeof(destination) === 'object')) {
13584
- _context.next = 61;
13908
+ _context.next = 62;
13585
13909
  break;
13586
13910
  }
13587
13911
  console.warn('Keep alive check is not supported when using MultiLocation as destination.');
13588
- _context.next = 67;
13912
+ _context.next = 68;
13589
13913
  break;
13590
- case 61:
13914
+ case 62:
13591
13915
  if (!(origin === 'Ethereum' || destination === 'Ethereum')) {
13592
- _context.next = 65;
13916
+ _context.next = 66;
13593
13917
  break;
13594
13918
  }
13595
13919
  console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
13596
- _context.next = 67;
13920
+ _context.next = 68;
13597
13921
  break;
13598
- case 65:
13599
- _context.next = 67;
13922
+ case 66:
13923
+ _context.next = 68;
13600
13924
  return checkKeepAlive({
13601
13925
  originApi: api,
13602
13926
  address: address,
@@ -13606,7 +13930,7 @@ var sendCommon = function sendCommon(options_1) {
13606
13930
  currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : 'symbol' in currency ? currency.symbol : undefined,
13607
13931
  destNode: destination
13608
13932
  });
13609
- case 67:
13933
+ case 68:
13610
13934
  currencyStr = 'symbol' in currency ? currency.symbol : 'id' in currency ? currency.id.toString() : undefined;
13611
13935
  return _context.abrupt("return", originNode.transfer({
13612
13936
  api: api,
@@ -13620,9 +13944,10 @@ var sendCommon = function sendCommon(options_1) {
13620
13944
  feeAsset: feeAsset,
13621
13945
  version: version,
13622
13946
  destApiForKeepAlive: destApiForKeepAlive,
13623
- serializedApiCallEnabled: serializedApiCallEnabled
13947
+ serializedApiCallEnabled: serializedApiCallEnabled,
13948
+ ahAddress: ahAddress
13624
13949
  }));
13625
- case 69:
13950
+ case 70:
13626
13951
  case "end":
13627
13952
  return _context.stop();
13628
13953
  }
@@ -13797,21 +14122,32 @@ var PolkadotJsApi = /*#__PURE__*/function () {
13797
14122
  return _regeneratorRuntime().wrap(function _callee$(_context) {
13798
14123
  while (1) switch (_context.prev = _context.next) {
13799
14124
  case 0:
14125
+ if (!(typeof this._api === 'string')) {
14126
+ _context.next = 6;
14127
+ break;
14128
+ }
14129
+ _context.next = 3;
14130
+ return this.createApiInstance(this._api);
14131
+ case 3:
14132
+ this.api = _context.sent;
14133
+ _context.next = 14;
14134
+ break;
14135
+ case 6:
13800
14136
  if (!((_a = this._api) !== null && _a !== void 0)) {
13801
- _context.next = 4;
14137
+ _context.next = 10;
13802
14138
  break;
13803
14139
  }
13804
14140
  _context.t0 = _a;
13805
- _context.next = 7;
14141
+ _context.next = 13;
13806
14142
  break;
13807
- case 4:
13808
- _context.next = 6;
14143
+ case 10:
14144
+ _context.next = 12;
13809
14145
  return createApiInstanceForNode$1(this, node);
13810
- case 6:
14146
+ case 12:
13811
14147
  _context.t0 = _context.sent;
13812
- case 7:
14148
+ case 13:
13813
14149
  this.api = _context.t0;
13814
- case 8:
14150
+ case 14:
13815
14151
  case "end":
13816
14152
  return _context.stop();
13817
14153
  }
@@ -14015,11 +14351,51 @@ var PolkadotJsApi = /*#__PURE__*/function () {
14015
14351
  }, _callee9, this);
14016
14352
  }));
14017
14353
  }
14354
+ }, {
14355
+ key: "getFromStorage",
14356
+ value: function getFromStorage(key) {
14357
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
14358
+ var response;
14359
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
14360
+ while (1) switch (_context10.prev = _context10.next) {
14361
+ case 0:
14362
+ _context10.next = 2;
14363
+ return this.api.rpc.state.getStorage(key);
14364
+ case 2:
14365
+ response = _context10.sent;
14366
+ return _context10.abrupt("return", response.toHex());
14367
+ case 4:
14368
+ case "end":
14369
+ return _context10.stop();
14370
+ }
14371
+ }, _callee10, this);
14372
+ }));
14373
+ }
14018
14374
  }, {
14019
14375
  key: "clone",
14020
14376
  value: function clone() {
14021
14377
  return new PolkadotJsApi();
14022
14378
  }
14379
+ }, {
14380
+ key: "createApiForNode",
14381
+ value: function createApiForNode(node) {
14382
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
14383
+ var api;
14384
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
14385
+ while (1) switch (_context11.prev = _context11.next) {
14386
+ case 0:
14387
+ api = new PolkadotJsApi();
14388
+ _context11.next = 3;
14389
+ return api.init(node);
14390
+ case 3:
14391
+ return _context11.abrupt("return", api);
14392
+ case 4:
14393
+ case "end":
14394
+ return _context11.stop();
14395
+ }
14396
+ }, _callee11);
14397
+ }));
14398
+ }
14023
14399
  }]);
14024
14400
  }();
14025
14401
 
@@ -14193,6 +14569,7 @@ var getAssetBalance = createPolkadotJsApiCall(getAssetBalance$1);
14193
14569
  * @returns An extrinsic representing the claim transaction.
14194
14570
  */
14195
14571
  var claimAssets = createPolkadotJsApiCall(claimAssets$1);
14572
+ var getOriginFeeDetails = createPolkadotJsApiCall(getOriginFeeDetails$1);
14196
14573
 
14197
14574
  var assets = /*#__PURE__*/Object.freeze({
14198
14575
  __proto__: null,
@@ -14208,6 +14585,7 @@ var assets = /*#__PURE__*/Object.freeze({
14208
14585
  getExistentialDeposit: getExistentialDeposit$1,
14209
14586
  getNativeAssetSymbol: getNativeAssetSymbol,
14210
14587
  getNativeAssets: getNativeAssets,
14588
+ getOriginFeeDetails: getOriginFeeDetails,
14211
14589
  getOtherAssets: getOtherAssets,
14212
14590
  getParaId: getParaId,
14213
14591
  getRelayChainSymbol: getRelayChainSymbol,
@@ -14230,4 +14608,4 @@ var Builder = function Builder(api) {
14230
14608
  };
14231
14609
  var GeneralBuilder = GeneralBuilder$1;
14232
14610
 
14233
- export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, EvmBuilder, GeneralBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, assets, buildEthTransferOptions, claimAssets, createApiInstanceForNode, createPolkadotJsApiCall, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetBalance, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit$1 as getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaSerializedApiCall, transfer as xcmPallet };
14611
+ export { BatchMode, Builder, DuplicateAssetError, DuplicateAssetIdError, EvmBuilder, GeneralBuilder, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODES_WITH_RELAY_CHAINS_DOT_KSM, NODE_NAMES, NODE_NAMES_DOT_KSM, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, SUPPORTED_PALLETS, ScenarioNotSupportedError, Version, assets, buildEthTransferOptions, claimAssets, createApiInstanceForNode, createPolkadotJsApiCall, determineRelayChain, getAllAssetsSymbols, getAllNodeProviders, getAssetBalance, getAssetDecimals, getAssetId, getAssets, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit$1 as getExistentialDeposit, getNativeAssetSymbol, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOriginFeeDetails, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedAssets, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, isRelayChain, send, sendSerializedApiCall, transferRelayToPara, transferRelayToParaSerializedApiCall, transfer as xcmPallet };