@paraspell/sdk 7.0.0 → 7.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
  ]
@@ -9062,6 +9062,45 @@ var Crust$2 = /*#__PURE__*/function (_ParachainNode) {
9062
9062
  }]);
9063
9063
  }(ParachainNode);
9064
9064
 
9065
+ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
9066
+ function PolkadotXCMTransferImpl() {
9067
+ _classCallCheck(this, PolkadotXCMTransferImpl);
9068
+ }
9069
+ return _createClass(PolkadotXCMTransferImpl, null, [{
9070
+ key: "transferPolkadotXCM",
9071
+ value: function transferPolkadotXCM(_ref, section) {
9072
+ var api = _ref.api,
9073
+ header = _ref.header,
9074
+ addressSelection = _ref.addressSelection,
9075
+ currencySelection = _ref.currencySelection,
9076
+ _ref$feeAsset = _ref.feeAsset,
9077
+ feeAsset = _ref$feeAsset === void 0 ? DEFAULT_FEE_ASSET : _ref$feeAsset,
9078
+ serializedApiCallEnabled = _ref.serializedApiCallEnabled;
9079
+ var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
9080
+ var module = 'PolkadotXcm';
9081
+ var call = {
9082
+ module: module,
9083
+ section: section,
9084
+ parameters: Object.assign({
9085
+ dest: header,
9086
+ beneficiary: addressSelection,
9087
+ assets: currencySelection,
9088
+ fee_asset_item: feeAsset
9089
+ }, fees !== undefined ? {
9090
+ weight_limit: fees
9091
+ } : {})
9092
+ };
9093
+ if (serializedApiCallEnabled === true) {
9094
+ // Keep compatible with old serialized call type
9095
+ return Object.assign(Object.assign({}, call), {
9096
+ parameters: Object.values(call.parameters)
9097
+ });
9098
+ }
9099
+ return api.callTxMethod(call);
9100
+ }
9101
+ }]);
9102
+ }();
9103
+
9065
9104
  var BifrostPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9066
9105
  function BifrostPolkadot() {
9067
9106
  _classCallCheck(this, BifrostPolkadot);
@@ -9109,6 +9148,39 @@ var BifrostPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9109
9148
  var currencySelection = this.getCurrencySelection(currency, currencyID);
9110
9149
  return XTokensTransferImpl.transferXTokens(input, currencySelection);
9111
9150
  }
9151
+ // Handles DOT, WETH transfers to AssetHubPolkadot
9152
+ }, {
9153
+ key: "transferPolkadotXCM",
9154
+ value: function transferPolkadotXCM(input) {
9155
+ var _a;
9156
+ var amount = input.amount,
9157
+ overridedCurrency = input.overridedCurrency,
9158
+ currencySymbol = input.currencySymbol;
9159
+ var ETH_CHAIN_ID = BigInt(1);
9160
+ var ethJunction = {
9161
+ GlobalConsensus: {
9162
+ Ethereum: {
9163
+ chain_id: ETH_CHAIN_ID
9164
+ }
9165
+ }
9166
+ };
9167
+ return PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
9168
+ currencySelection: createCurrencySpec(amount, this.version, currencySymbol === 'DOT' ? Parents.ONE : Parents.TWO, overridedCurrency, currencySymbol === 'WETH' ? {
9169
+ X2: [ethJunction, {
9170
+ AccountKey20: {
9171
+ key: (_a = getAssetId('Ethereum', 'WETH')) !== null && _a !== void 0 ? _a : ''
9172
+ }
9173
+ }]
9174
+ } : undefined)
9175
+ }), 'transfer_assets', 'Unlimited');
9176
+ }
9177
+ }, {
9178
+ key: "canUseXTokens",
9179
+ value: function canUseXTokens(_ref) {
9180
+ var currencySymbol = _ref.currencySymbol,
9181
+ destination = _ref.destination;
9182
+ return currencySymbol !== 'WETH' && currencySymbol !== 'DOT' || destination !== 'AssetHubPolkadot';
9183
+ }
9112
9184
  }]);
9113
9185
  }(ParachainNode);
9114
9186
 
@@ -9592,45 +9664,6 @@ var Karura$2 = /*#__PURE__*/function (_ParachainNode) {
9592
9664
  }]);
9593
9665
  }(ParachainNode);
9594
9666
 
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
9667
  var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
9635
9668
  function AssetHubPolkadot() {
9636
9669
  _classCallCheck(this, AssetHubPolkadot);
@@ -11284,21 +11317,63 @@ var getSupportedPallets = function getSupportedPallets(node) {
11284
11317
 
11285
11318
  // Contains function for getting Asset ID or Symbol used in XCM call creation
11286
11319
  var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAssets, nativeAssets, combinedAssets, symbol, isRelayDestination) {
11320
+ var lowerSymbol = symbol.toLowerCase();
11287
11321
  if (destination === 'Ethereum') {
11288
11322
  return combinedAssets.find(function (_ref) {
11289
11323
  var assetSymbol = _ref.symbol;
11290
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
11324
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11291
11325
  });
11292
11326
  }
11293
11327
  var otherAssetsMatches = otherAssets.filter(function (_ref2) {
11294
11328
  var assetSymbol = _ref2.symbol;
11295
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
11329
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11296
11330
  });
11297
11331
  var nativeAssetsMatches = nativeAssets.filter(function (_ref3) {
11298
11332
  var assetSymbol = _ref3.symbol;
11299
- return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === symbol.toLowerCase();
11333
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === lowerSymbol;
11300
11334
  });
11301
11335
  var isPolkadotXcm = !isRelayChain(node) && node !== 'Ethereum' && getDefaultPallet(node) === 'PolkadotXcm';
11336
+ if (otherAssetsMatches.length === 0 && nativeAssetsMatches.length === 0) {
11337
+ if (lowerSymbol.startsWith('xc')) {
11338
+ // No exact matches found, and symbol starts with 'xc', try stripping 'xc'
11339
+ var strippedSymbol = symbol.substring(2);
11340
+ var strippedLowerSymbol = strippedSymbol.toLowerCase();
11341
+ otherAssetsMatches = otherAssets.filter(function (_ref4) {
11342
+ var assetSymbol = _ref4.symbol;
11343
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
11344
+ });
11345
+ nativeAssetsMatches = nativeAssets.filter(function (_ref5) {
11346
+ var assetSymbol = _ref5.symbol;
11347
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === strippedLowerSymbol;
11348
+ });
11349
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11350
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11351
+ }
11352
+ var totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11353
+ if (totalMatches > 1) {
11354
+ throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after stripping 'xc' prefix. Please specify by ID."));
11355
+ }
11356
+ } else {
11357
+ // No matches found, and symbol does not start with 'xc', try adding 'xc' prefix
11358
+ var prefixedSymbol = "xc".concat(symbol);
11359
+ var prefixedLowerSymbol = prefixedSymbol.toLowerCase();
11360
+ otherAssetsMatches = otherAssets.filter(function (_ref6) {
11361
+ var assetSymbol = _ref6.symbol;
11362
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
11363
+ });
11364
+ nativeAssetsMatches = nativeAssets.filter(function (_ref7) {
11365
+ var assetSymbol = _ref7.symbol;
11366
+ return (assetSymbol === null || assetSymbol === void 0 ? void 0 : assetSymbol.toLowerCase()) === prefixedLowerSymbol;
11367
+ });
11368
+ if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11369
+ return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11370
+ }
11371
+ var _totalMatches = otherAssetsMatches.length + nativeAssetsMatches.length;
11372
+ if (_totalMatches > 1) {
11373
+ throw new InvalidCurrencyError("Multiple assets found for symbol ".concat(symbol, " after adding 'xc' prefix. Please specify by ID."));
11374
+ }
11375
+ }
11376
+ }
11302
11377
  if (node === 'Astar' || node === 'Shiden' || isPolkadotXcm) {
11303
11378
  return nativeAssetsMatches[0] || otherAssetsMatches[0] || null;
11304
11379
  }
@@ -11308,15 +11383,15 @@ var findAssetBySymbol = function findAssetBySymbol(node, destination, otherAsset
11308
11383
  return otherAssetsMatches[0] || nativeAssetsMatches[0] || null;
11309
11384
  };
11310
11385
  var findAssetById = function findAssetById(assets, assetId) {
11311
- var otherAssetsMatches = assets.filter(function (_ref4) {
11312
- var currentAssetId = _ref4.assetId;
11386
+ var otherAssetsMatches = assets.filter(function (_ref8) {
11387
+ var currentAssetId = _ref8.assetId;
11313
11388
  return currentAssetId === assetId.toString();
11314
11389
  });
11315
11390
  if (otherAssetsMatches.length > 1) {
11316
11391
  throw new DuplicateAssetIdError(assetId.toString());
11317
11392
  }
11318
- return assets.find(function (_ref5) {
11319
- var currentAssetId = _ref5.assetId;
11393
+ return assets.find(function (_ref9) {
11394
+ var currentAssetId = _ref9.assetId;
11320
11395
  return currentAssetId === assetId.toString();
11321
11396
  });
11322
11397
  };
@@ -11461,9 +11536,20 @@ var getNativeAssetSymbol = function getNativeAssetSymbol(node) {
11461
11536
  * @returns True if the asset is supported; otherwise, false.
11462
11537
  */
11463
11538
  var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
11464
- return getAllAssetsSymbols(node).map(function (s) {
11539
+ var lowerSymbol = symbol.toLowerCase();
11540
+ var symbolsToCheck = new Set();
11541
+ symbolsToCheck.add(lowerSymbol);
11542
+ if (lowerSymbol.startsWith('xc')) {
11543
+ symbolsToCheck.add(lowerSymbol.substring(2));
11544
+ } else {
11545
+ symbolsToCheck.add("xc".concat(lowerSymbol));
11546
+ }
11547
+ var nodeSymbols = getAllAssetsSymbols(node).map(function (s) {
11465
11548
  return s.toLowerCase();
11466
- }).includes(symbol.toLowerCase());
11549
+ });
11550
+ return nodeSymbols.some(function (nodeSymbol) {
11551
+ return symbolsToCheck.has(nodeSymbol);
11552
+ });
11467
11553
  };
11468
11554
  /**
11469
11555
  * Retrieves the number of decimals for an asset with the given symbol on a specified node.
@@ -13101,12 +13187,16 @@ var createTx$1 = function createTx(originApi, address, amount, currency, originN
13101
13187
  }, _callee);
13102
13188
  }));
13103
13189
  };
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;
13190
+ var getOriginFeeDetails$1 = function getOriginFeeDetails(_a) {
13191
+ return __awaiter(void 0, [_a], void 0, function (_ref) {
13192
+ var api = _ref.api,
13193
+ account = _ref.account,
13194
+ amount = _ref.amount,
13195
+ currency = _ref.currency,
13196
+ origin = _ref.origin,
13197
+ destination = _ref.destination,
13198
+ _ref$feeMarginPercent = _ref.feeMarginPercentage,
13199
+ feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
13110
13200
  return /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
13111
13201
  var nativeBalance, minTransferableAmount, tx, xcmFee, xcmFeeWithMargin, sufficientForXCM;
13112
13202
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
@@ -13170,7 +13260,14 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13170
13260
  case 4:
13171
13261
  originBalance = _context.sent;
13172
13262
  _context.next = 7;
13173
- return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
13263
+ return getOriginFeeDetails$1({
13264
+ origin: origin,
13265
+ destination: destination,
13266
+ currency: currency,
13267
+ amount: amount,
13268
+ account: accountOrigin,
13269
+ api: originApi
13270
+ });
13174
13271
  case 7:
13175
13272
  _yield$getOriginFeeDe = _context.sent;
13176
13273
  destXcmFee = _yield$getOriginFeeDe.xcmFee;
@@ -13211,7 +13308,14 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13211
13308
  _context.t4 = _context.sent;
13212
13309
  _context.t5 = expectedBalanceAfterXCMDelivery;
13213
13310
  _context.next = 25;
13214
- return getOriginFeeDetails(origin, destination, currency, amount, accountOrigin, originApi);
13311
+ return getOriginFeeDetails$1({
13312
+ origin: origin,
13313
+ destination: destination,
13314
+ currency: currency,
13315
+ amount: amount,
13316
+ account: accountOrigin,
13317
+ api: originApi
13318
+ });
13215
13319
  case 25:
13216
13320
  _context.t6 = _context.sent;
13217
13321
  _context.t7 = BigInt((_d = getExistentialDeposit(origin)) !== null && _d !== void 0 ? _d : 0);
@@ -13260,6 +13364,17 @@ var getTransferInfo$1 = function getTransferInfo(_a) {
13260
13364
  });
13261
13365
  };
13262
13366
 
13367
+ /**
13368
+ * Normalizes an asset symbol by stripping the 'xc' prefix (if present) and converting it to lowercase.
13369
+ *
13370
+ * @param symbol - The symbol to normalize.
13371
+ * @returns The normalized symbol.
13372
+ */
13373
+ var normalizeSymbol = function normalizeSymbol(symbol) {
13374
+ if (!symbol) return '';
13375
+ var lowerSymbol = symbol.toLowerCase();
13376
+ return lowerSymbol.startsWith('xc') ? lowerSymbol.substring(2) : lowerSymbol;
13377
+ };
13263
13378
  /**
13264
13379
  * Retrieves the list of assets that are supported for transfers between two specified nodes.
13265
13380
  *
@@ -13285,17 +13400,16 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
13285
13400
  if (!isRelayChain(origin) && getDefaultPallet(origin) === 'XTokens' && (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama')) {
13286
13401
  return getOtherAssets(destination).filter(function (asset) {
13287
13402
  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());
13403
+ return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
13290
13404
  }) && asset.assetId !== '';
13291
13405
  });
13292
13406
  }
13293
- return originAssets.filter(function (asset) {
13407
+ var supportedAssets = originAssets.filter(function (asset) {
13294
13408
  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());
13409
+ return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
13297
13410
  });
13298
13411
  });
13412
+ return supportedAssets;
13299
13413
  };
13300
13414
 
13301
13415
  var createTx = function createTx(originApi, destApi, address, amount, currencySymbol, originNode, destNode) {
@@ -13440,7 +13554,7 @@ var sendCommon = function sendCommon(options_1) {
13440
13554
  return __awaiter(void 0, [options_1].concat(args_1), void 0, function (options) {
13441
13555
  var serializedApiCallEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13442
13556
  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;
13557
+ var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, isDestAssetHub, pallet, asset, nativeAssets, amountStr, currencyStr;
13444
13558
  return _regeneratorRuntime().wrap(function _callee$(_context) {
13445
13559
  while (1) switch (_context.prev = _context.next) {
13446
13560
  case 0:
@@ -13520,83 +13634,89 @@ var sendCommon = function sendCommon(options_1) {
13520
13634
  isDestAssetHub = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
13521
13635
  pallet = getDefaultPallet(origin);
13522
13636
  if (!(!isBridge && isDestAssetHub && pallet === 'XTokens')) {
13523
- _context.next = 41;
13637
+ _context.next = 43;
13524
13638
  break;
13525
13639
  }
13526
13640
  asset = getAssetBySymbolOrId(destination, currency, false, destination);
13527
- if (!('symbol' in currency && getNativeAssets(destination).some(function (nativeAsset) {
13641
+ nativeAssets = getNativeAssets(destination);
13642
+ if (origin === 'BifrostPolkadot' && (asset === null || asset === void 0 ? void 0 : asset.symbol) === 'DOT') {
13643
+ nativeAssets = nativeAssets.filter(function (nativeAsset) {
13644
+ return nativeAsset.symbol !== 'DOT';
13645
+ });
13646
+ }
13647
+ if (!('symbol' in currency && nativeAssets.some(function (nativeAsset) {
13528
13648
  return nativeAsset.symbol.toLowerCase() === currency.symbol.toLowerCase();
13529
13649
  }))) {
13530
- _context.next = 35;
13650
+ _context.next = 37;
13531
13651
  break;
13532
13652
  }
13533
13653
  throw new InvalidCurrencyError("".concat(currency.symbol, " is not supported for transfers to ").concat(destination, "."));
13534
- case 35:
13654
+ case 37:
13535
13655
  if (!(assetCheckEnabled && asset === null)) {
13536
- _context.next = 37;
13656
+ _context.next = 39;
13537
13657
  break;
13538
13658
  }
13539
13659
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
13540
- case 37:
13660
+ case 39:
13541
13661
  if (!((asset === null || asset === void 0 ? void 0 : asset.symbol) && !hasSupportForAsset(origin, asset.symbol))) {
13542
- _context.next = 39;
13662
+ _context.next = 41;
13543
13663
  break;
13544
13664
  }
13545
13665
  throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(asset.symbol, "."));
13546
- case 39:
13547
- _context.next = 46;
13548
- break;
13549
13666
  case 41:
13667
+ _context.next = 48;
13668
+ break;
13669
+ case 43:
13550
13670
  asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isTMultiLocation(destination) ? undefined : destination) : null;
13551
13671
  if (!(!isBridge && asset === null && assetCheckEnabled)) {
13552
- _context.next = 44;
13672
+ _context.next = 46;
13553
13673
  break;
13554
13674
  }
13555
13675
  throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency), "."));
13556
- case 44:
13676
+ case 46:
13557
13677
  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;
13678
+ _context.next = 48;
13559
13679
  break;
13560
13680
  }
13561
13681
  throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
13562
- case 46:
13563
- _context.next = 48;
13564
- return api.init(origin);
13565
13682
  case 48:
13683
+ _context.next = 50;
13684
+ return api.init(origin);
13685
+ case 50:
13566
13686
  amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
13567
13687
  if (!('multilocation' in currency || 'multiasset' in currency)) {
13568
- _context.next = 53;
13688
+ _context.next = 55;
13569
13689
  break;
13570
13690
  }
13571
13691
  console.warn('Keep alive check is not supported when using MultiLocation as currency.');
13572
- _context.next = 67;
13692
+ _context.next = 69;
13573
13693
  break;
13574
- case 53:
13694
+ case 55:
13575
13695
  if (!(_typeof(address) === 'object')) {
13576
- _context.next = 57;
13696
+ _context.next = 59;
13577
13697
  break;
13578
13698
  }
13579
13699
  console.warn('Keep alive check is not supported when using MultiLocation as address.');
13580
- _context.next = 67;
13700
+ _context.next = 69;
13581
13701
  break;
13582
- case 57:
13702
+ case 59:
13583
13703
  if (!(_typeof(destination) === 'object')) {
13584
- _context.next = 61;
13704
+ _context.next = 63;
13585
13705
  break;
13586
13706
  }
13587
13707
  console.warn('Keep alive check is not supported when using MultiLocation as destination.');
13588
- _context.next = 67;
13708
+ _context.next = 69;
13589
13709
  break;
13590
- case 61:
13710
+ case 63:
13591
13711
  if (!(origin === 'Ethereum' || destination === 'Ethereum')) {
13592
- _context.next = 65;
13712
+ _context.next = 67;
13593
13713
  break;
13594
13714
  }
13595
13715
  console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
13596
- _context.next = 67;
13716
+ _context.next = 69;
13597
13717
  break;
13598
- case 65:
13599
- _context.next = 67;
13718
+ case 67:
13719
+ _context.next = 69;
13600
13720
  return checkKeepAlive({
13601
13721
  originApi: api,
13602
13722
  address: address,
@@ -13606,7 +13726,7 @@ var sendCommon = function sendCommon(options_1) {
13606
13726
  currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : 'symbol' in currency ? currency.symbol : undefined,
13607
13727
  destNode: destination
13608
13728
  });
13609
- case 67:
13729
+ case 69:
13610
13730
  currencyStr = 'symbol' in currency ? currency.symbol : 'id' in currency ? currency.id.toString() : undefined;
13611
13731
  return _context.abrupt("return", originNode.transfer({
13612
13732
  api: api,
@@ -13622,7 +13742,7 @@ var sendCommon = function sendCommon(options_1) {
13622
13742
  destApiForKeepAlive: destApiForKeepAlive,
13623
13743
  serializedApiCallEnabled: serializedApiCallEnabled
13624
13744
  }));
13625
- case 69:
13745
+ case 71:
13626
13746
  case "end":
13627
13747
  return _context.stop();
13628
13748
  }
@@ -14113,10 +14233,8 @@ var PapiApi = /*#__PURE__*/function () {
14113
14233
  return this.api.getUnsafeApi().query.Assets.Account.getValue(id, address);
14114
14234
  case 2:
14115
14235
  res = _context5.sent;
14116
- console.log(res);
14117
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
14118
14236
  return _context5.abrupt("return", res && res.balance ? BigInt(res.balance) : BigInt(0));
14119
- case 5:
14237
+ case 4:
14120
14238
  case "end":
14121
14239
  return _context5.stop();
14122
14240
  }
@@ -14287,6 +14405,7 @@ var getAssetBalance = createPapiApiCall(getAssetBalance$1);
14287
14405
  * @returns An extrinsic representing the claim transaction.
14288
14406
  */
14289
14407
  var claimAssets = createPapiApiCall(claimAssets$1);
14408
+ var getOriginFeeDetails = createPapiApiCall(getOriginFeeDetails$1);
14290
14409
 
14291
14410
  var assets = /*#__PURE__*/Object.freeze({
14292
14411
  __proto__: null,
@@ -14302,6 +14421,7 @@ var assets = /*#__PURE__*/Object.freeze({
14302
14421
  getExistentialDeposit: getExistentialDeposit$1,
14303
14422
  getNativeAssetSymbol: getNativeAssetSymbol,
14304
14423
  getNativeAssets: getNativeAssets,
14424
+ getOriginFeeDetails: getOriginFeeDetails,
14305
14425
  getOtherAssets: getOtherAssets,
14306
14426
  getParaId: getParaId,
14307
14427
  getRelayChainSymbol: getRelayChainSymbol,
@@ -14324,4 +14444,4 @@ var Builder = function Builder(api) {
14324
14444
  };
14325
14445
  var GeneralBuilder = GeneralBuilder$1;
14326
14446
 
14327
- 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, createPapiApiCall, 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, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index as xcmPallet };
14447
+ 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, createPapiApiCall, 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, transferRelayToParaCommon, transferRelayToParaSerializedApiCall, index as xcmPallet };