@trustware/sdk-staging 1.1.8-staging.6 → 1.1.8-staging.7

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
@@ -11,20 +11,12 @@ var __export = (target, all) => {
11
11
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12
12
 
13
13
  // src/config/defaults.ts
14
- var DEFAULT_SLIPPAGE, DEFAULT_AUTO_DETECT_PROVIDER, DEFAULT_THEME, DEFAULT_MESSAGES;
14
+ var DEFAULT_SLIPPAGE, DEFAULT_AUTO_DETECT_PROVIDER, DEFAULT_MESSAGES;
15
15
  var init_defaults = __esm({
16
16
  "src/config/defaults.ts"() {
17
17
  "use strict";
18
18
  DEFAULT_SLIPPAGE = 1;
19
19
  DEFAULT_AUTO_DETECT_PROVIDER = false;
20
- DEFAULT_THEME = {
21
- primaryColor: "#4F46E5",
22
- secondaryColor: "#6366F1",
23
- backgroundColor: "#FFFFFF",
24
- textColor: "#111827",
25
- borderColor: "#E5E7EB",
26
- radius: 8
27
- };
28
20
  DEFAULT_MESSAGES = {
29
21
  title: "Trustware SDK",
30
22
  description: "Seamlessly bridge assets across chains with Trustware."
@@ -120,7 +112,7 @@ function resolveConfig(input) {
120
112
  ...input.routes.options
121
113
  }
122
114
  };
123
- const theme = deepMerge(DEFAULT_THEME, input.theme);
115
+ const theme = input.theme ?? "system";
124
116
  const messages = deepMerge(DEFAULT_MESSAGES, input.messages);
125
117
  const retry = {
126
118
  autoRetry: input.retry?.autoRetry ?? DEFAULT_RETRY_CONFIG.autoRetry,
@@ -198,10 +190,7 @@ var init_store = __esm({
198
190
  ...this._cfg,
199
191
  ...patch,
200
192
  routes: { ...this._cfg.routes, ...patch.routes ?? {} },
201
- theme: {
202
- ...this._cfg.theme,
203
- ...patch.theme ?? {}
204
- },
193
+ theme: patch.theme ?? this._cfg.theme,
205
194
  messages: {
206
195
  ...this._cfg.messages,
207
196
  ...patch.messages ?? {}
@@ -420,7 +409,7 @@ var init_constants = __esm({
420
409
  "src/constants.ts"() {
421
410
  "use strict";
422
411
  SDK_NAME = "@trustware/sdk";
423
- SDK_VERSION = "1.1.8-staging.6";
412
+ SDK_VERSION = "1.1.8-staging.7";
424
413
  API_ROOT = "https://bv-staging-api.trustware.io";
425
414
  GTM_ID = "GTM-TZDGNCXB";
426
415
  API_PREFIX = "/api";
@@ -5353,10 +5342,26 @@ function compareChainPopularity(a, b) {
5353
5342
  if (rankA === null && rankB !== null) return 1;
5354
5343
  return 0;
5355
5344
  }
5356
- function sortTokensByPopularity(tokens) {
5345
+ function sortTokensByPopularity(tokens, options) {
5346
+ const nativeSet = options?.nativeAddresses ?? /* @__PURE__ */ new Set();
5347
+ const nativeSymbolSet = options?.nativeSymbols ?? /* @__PURE__ */ new Set();
5348
+ const featuredMap = options?.featuredAddresses ?? /* @__PURE__ */ new Map();
5349
+ const getMajorRank = (token) => {
5350
+ const addr = normalizeAddress3(token.address);
5351
+ if (nativeSet.has(addr)) return 0;
5352
+ if (nativeSymbolSet.has(normalizeSymbol(token.symbol))) return 0;
5353
+ if (featuredMap.has(addr)) return 1;
5354
+ return getGroupRank(token) + 2;
5355
+ };
5357
5356
  return tokens.map((token, index) => ({ token, index })).sort((a, b) => {
5358
- const rankDiff = getGroupRank(a.token) - getGroupRank(b.token);
5359
- if (rankDiff !== 0) return rankDiff;
5357
+ const majorA = getMajorRank(a.token);
5358
+ const majorB = getMajorRank(b.token);
5359
+ if (majorA !== majorB) return majorA - majorB;
5360
+ if (majorA === 1) {
5361
+ const orderA = featuredMap.get(normalizeAddress3(a.token.address)) ?? 0;
5362
+ const orderB = featuredMap.get(normalizeAddress3(b.token.address)) ?? 0;
5363
+ return orderA - orderB;
5364
+ }
5360
5365
  const chainPopularityDiff = compareChainPopularity(a.token, b.token);
5361
5366
  if (chainPopularityDiff !== 0) return chainPopularityDiff;
5362
5367
  const symbolDiff = compareText(a.token.symbol, b.token.symbol);
@@ -5415,6 +5420,1004 @@ var init_tokenPopularity = __esm({
5415
5420
  }
5416
5421
  });
5417
5422
 
5423
+ // src/widget/data/featuredAssets.json
5424
+ var featuredAssets_default;
5425
+ var init_featuredAssets = __esm({
5426
+ "src/widget/data/featuredAssets.json"() {
5427
+ featuredAssets_default = {
5428
+ "1": {
5429
+ top: [
5430
+ {
5431
+ symbol: "AAVE",
5432
+ address: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"
5433
+ },
5434
+ {
5435
+ symbol: "LINK",
5436
+ address: "0x514910771af9ca656af840dff83e8264ecf986ca"
5437
+ },
5438
+ {
5439
+ symbol: "UNI",
5440
+ address: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"
5441
+ },
5442
+ {
5443
+ symbol: "CRV",
5444
+ address: "0xd533a949740bb3306d119cc777fa900ba034cd52"
5445
+ },
5446
+ {
5447
+ symbol: "LDO",
5448
+ address: "0x5a98fcbea516cf06857215779fd812ca3bef1b32"
5449
+ },
5450
+ {
5451
+ symbol: "GRT",
5452
+ address: "0xc944e90c64b2c07662a292be6244bdf05cda44a7"
5453
+ },
5454
+ {
5455
+ symbol: "RENDER",
5456
+ address: "0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24"
5457
+ },
5458
+ {
5459
+ symbol: "PENDLE",
5460
+ address: "0x808507121b80c02388fad14726482e061b8da827"
5461
+ },
5462
+ {
5463
+ symbol: "MKR",
5464
+ address: "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2"
5465
+ },
5466
+ {
5467
+ symbol: "COMP",
5468
+ address: "0xc00e94cb662c3520282e6f5717214004a7f26888"
5469
+ },
5470
+ {
5471
+ symbol: "1INCH",
5472
+ address: "0x111111111117dc0aa78b770fa6a738034120c302"
5473
+ },
5474
+ {
5475
+ symbol: "BAL",
5476
+ address: "0xba100000625a3754423978a60c9317c58a424e3d"
5477
+ },
5478
+ {
5479
+ symbol: "SUSHI",
5480
+ address: "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2"
5481
+ },
5482
+ {
5483
+ symbol: "CAKE",
5484
+ address: "0x152649ea73beab28c5b49b26eb48f7ead6d4c898"
5485
+ },
5486
+ {
5487
+ symbol: "YFI",
5488
+ address: "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e"
5489
+ }
5490
+ ],
5491
+ stables: [
5492
+ {
5493
+ symbol: "USDT",
5494
+ address: "0xdac17f958d2ee523a2206206994597c13d831ec7"
5495
+ },
5496
+ {
5497
+ symbol: "USDC",
5498
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
5499
+ },
5500
+ {
5501
+ symbol: "DAI",
5502
+ address: "0x6b175474e89094c44da98b954eedeac495271d0f"
5503
+ },
5504
+ {
5505
+ symbol: "USDe",
5506
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3"
5507
+ },
5508
+ {
5509
+ symbol: "PYUSD",
5510
+ address: "0x6c3ea9036406852006290770bedfcaba0e23a0e8"
5511
+ },
5512
+ {
5513
+ symbol: "FDUSD",
5514
+ address: "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409"
5515
+ },
5516
+ {
5517
+ symbol: "USDS",
5518
+ address: "0xdc035d45d973e3ec169d2276ddab16f1e407384f"
5519
+ },
5520
+ {
5521
+ symbol: "EURC",
5522
+ address: "0x1abaea1f7c830bd89acc67ec4af516284b1bc33c"
5523
+ },
5524
+ {
5525
+ symbol: "crvUSD",
5526
+ address: "0xf939e0a03fb07f59a73314e73794be0e57ac1b4e"
5527
+ },
5528
+ {
5529
+ symbol: "TUSD",
5530
+ address: "0x0000000000085d4780b73119b644ae5ecd22b376"
5531
+ }
5532
+ ]
5533
+ },
5534
+ "10": {
5535
+ top: [
5536
+ {
5537
+ symbol: "OP",
5538
+ address: "0x4200000000000000000000000000000000000042"
5539
+ },
5540
+ {
5541
+ symbol: "AAVE",
5542
+ address: "0x76fb31fb4af56892a25e32cfc43de717950c9278"
5543
+ },
5544
+ {
5545
+ symbol: "LINK",
5546
+ address: "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6"
5547
+ },
5548
+ {
5549
+ symbol: "CRV",
5550
+ address: "0x0994206dfe8de6ec6920ff4d779b0d950605fb53"
5551
+ },
5552
+ {
5553
+ symbol: "LDO",
5554
+ address: "0xfdb794692724153d1488ccdbe0c56c252596735f"
5555
+ },
5556
+ {
5557
+ symbol: "ZRO",
5558
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5559
+ },
5560
+ {
5561
+ symbol: "STG",
5562
+ address: "0x296f55f8fb28e498b858d0bcda06d955b2cb3f97"
5563
+ }
5564
+ ],
5565
+ stables: [
5566
+ {
5567
+ symbol: "USDT",
5568
+ address: "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"
5569
+ },
5570
+ {
5571
+ symbol: "USDC",
5572
+ address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85"
5573
+ },
5574
+ {
5575
+ symbol: "DAI",
5576
+ address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"
5577
+ },
5578
+ {
5579
+ symbol: "FRAX",
5580
+ address: "0x2e3d870790dc77a83dd1d18184acc7439a53f475"
5581
+ },
5582
+ {
5583
+ symbol: "LUSD",
5584
+ address: "0xc40f949f8a4e094d1b49a23ea9241d289b7b2819"
5585
+ },
5586
+ {
5587
+ symbol: "MIM",
5588
+ address: "0xb153fb3d196a8eb25522705560ac152eeec57901"
5589
+ },
5590
+ {
5591
+ symbol: "sUSD",
5592
+ address: "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9"
5593
+ }
5594
+ ]
5595
+ },
5596
+ "100": {
5597
+ top: [],
5598
+ stables: [
5599
+ {
5600
+ symbol: "USDT",
5601
+ address: "0x4ecaba5870353805a9f068101a40e0f32ed605c6"
5602
+ },
5603
+ {
5604
+ symbol: "USDC",
5605
+ address: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83"
5606
+ }
5607
+ ]
5608
+ },
5609
+ "1284": {
5610
+ top: [
5611
+ {
5612
+ symbol: "WELL",
5613
+ address: "0x511ab53f793683763e5a8829738301368a2411e3"
5614
+ }
5615
+ ],
5616
+ stables: [
5617
+ {
5618
+ symbol: "xcUSDC",
5619
+ address: "0xffffffff7d2b0b761af01ca8e25242976ac0ad7d"
5620
+ },
5621
+ {
5622
+ symbol: "FRAX",
5623
+ address: "0x322e86852e492a7ee17f28a78c663da38fb33bfb"
5624
+ }
5625
+ ]
5626
+ },
5627
+ "13371": {
5628
+ top: [],
5629
+ stables: [
5630
+ {
5631
+ symbol: "USDT",
5632
+ address: "0x68bcc7f1190af20e7b572bcfb431c3ac10a936ab"
5633
+ },
5634
+ {
5635
+ symbol: "USDC",
5636
+ address: "0x6de8acc0d406837030ce4dd28e7c08c5a96a30d2"
5637
+ }
5638
+ ]
5639
+ },
5640
+ "137": {
5641
+ top: [
5642
+ {
5643
+ symbol: "AAVE",
5644
+ address: "0xd6df932a45c0f255f85145f286ea0b292b21c90b"
5645
+ },
5646
+ {
5647
+ symbol: "LINK",
5648
+ address: "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39"
5649
+ },
5650
+ {
5651
+ symbol: "UNI",
5652
+ address: "0xb33eaad8d922b1083446dc23f610c2567fb5180f"
5653
+ },
5654
+ {
5655
+ symbol: "CRV",
5656
+ address: "0x172370d5cd63279efa6d502dab29171933a610af"
5657
+ },
5658
+ {
5659
+ symbol: "LDO",
5660
+ address: "0xc3c7d422809852031b44ab29eec9f1eff2a58756"
5661
+ },
5662
+ {
5663
+ symbol: "GRT",
5664
+ address: "0x5fe2b58c013d7601147dcdd68c143a77499f5531"
5665
+ },
5666
+ {
5667
+ symbol: "RENDER",
5668
+ address: "0x61299774020da444af134c82fa83e3810b309991"
5669
+ },
5670
+ {
5671
+ symbol: "ZRO",
5672
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5673
+ },
5674
+ {
5675
+ symbol: "STG",
5676
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
5677
+ },
5678
+ {
5679
+ symbol: "MANA",
5680
+ address: "0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4"
5681
+ },
5682
+ {
5683
+ symbol: "TEL",
5684
+ address: "0xdf7837de1f2fa4631d716cf2502f8b230f1dcc32"
5685
+ },
5686
+ {
5687
+ symbol: "BONK",
5688
+ address: "0xe5b49820e5a1063f6f4ddf851327b5e8b2301048"
5689
+ }
5690
+ ],
5691
+ stables: [
5692
+ {
5693
+ symbol: "USDT",
5694
+ address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"
5695
+ },
5696
+ {
5697
+ symbol: "USDC",
5698
+ address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"
5699
+ },
5700
+ {
5701
+ symbol: "DAI",
5702
+ address: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063"
5703
+ },
5704
+ {
5705
+ symbol: "CRVUSD",
5706
+ address: "0xc4ce1d6f5d98d65ee25cf85e9f2e9dcfee6cb5d6"
5707
+ }
5708
+ ]
5709
+ },
5710
+ "143": {
5711
+ top: [],
5712
+ stables: [
5713
+ {
5714
+ symbol: "USDC",
5715
+ address: "0x754704bc059f8c67012fed69bc8a327a5aafb603"
5716
+ }
5717
+ ]
5718
+ },
5719
+ "146": {
5720
+ top: [],
5721
+ stables: [
5722
+ {
5723
+ symbol: "USDT",
5724
+ address: "0x6047828dc181963ba44974801ff68e538da5eaf9"
5725
+ },
5726
+ {
5727
+ symbol: "USDC",
5728
+ address: "0x29219dd400f2bf60e5a23d13be72b486d4038894"
5729
+ }
5730
+ ]
5731
+ },
5732
+ "1868": {
5733
+ top: [],
5734
+ stables: [
5735
+ {
5736
+ symbol: "USDT",
5737
+ address: "0x3a337a6ada9d885b6ad95ec48f9b75f197b5ae35"
5738
+ }
5739
+ ]
5740
+ },
5741
+ "2222": {
5742
+ top: [],
5743
+ stables: [
5744
+ {
5745
+ symbol: "USDt",
5746
+ address: "0x919c1c267bc06a7039e03fcc2ef738525769109c"
5747
+ },
5748
+ {
5749
+ symbol: "MIM",
5750
+ address: "0x471ee749ba270eb4c1165b5ad95e614947f6fceb"
5751
+ }
5752
+ ]
5753
+ },
5754
+ "250": {
5755
+ top: [
5756
+ {
5757
+ symbol: "STG",
5758
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
5759
+ }
5760
+ ],
5761
+ stables: [
5762
+ {
5763
+ symbol: "MIM",
5764
+ address: "0x82f0b8b456c1a451378467398982d4834b6829c1"
5765
+ }
5766
+ ]
5767
+ },
5768
+ "252": {
5769
+ top: [
5770
+ {
5771
+ symbol: "CRV",
5772
+ address: "0x331b9182088e2a7d6d3fe4742aba1fb231aecc56"
5773
+ }
5774
+ ],
5775
+ stables: [
5776
+ {
5777
+ symbol: "frxUSD",
5778
+ address: "0xfc00000000000000000000000000000000000001"
5779
+ }
5780
+ ]
5781
+ },
5782
+ "295": {
5783
+ top: [],
5784
+ stables: [
5785
+ {
5786
+ symbol: "USDC",
5787
+ address: "0x000000000000000000000000000000000006f89a"
5788
+ }
5789
+ ]
5790
+ },
5791
+ "314": {
5792
+ top: [],
5793
+ stables: [
5794
+ {
5795
+ symbol: "ceUSDC",
5796
+ address: "0x2421db204968a367cc2c866cd057fa754cb84edf"
5797
+ }
5798
+ ]
5799
+ },
5800
+ "3338": {
5801
+ top: [],
5802
+ stables: [
5803
+ {
5804
+ symbol: "USDT",
5805
+ address: "0xf4d9235269a96aadafc9adae454a0618ebe37949"
5806
+ },
5807
+ {
5808
+ symbol: "USDC",
5809
+ address: "0xbba60da06c2c5424f03f7434542280fcad453d10"
5810
+ }
5811
+ ]
5812
+ },
5813
+ "42161": {
5814
+ top: [
5815
+ {
5816
+ symbol: "AAVE",
5817
+ address: "0xba5ddd1f9d7f570dc94a51479a000e3bce967196"
5818
+ },
5819
+ {
5820
+ symbol: "LINK",
5821
+ address: "0xf97f4df75117a78c1a5a0dbb814af92458539fb4"
5822
+ },
5823
+ {
5824
+ symbol: "UNI",
5825
+ address: "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0"
5826
+ },
5827
+ {
5828
+ symbol: "CRV",
5829
+ address: "0x11cdb42b0eb46d95f990bedd4695a6e3fa034978"
5830
+ },
5831
+ {
5832
+ symbol: "GRT",
5833
+ address: "0x9623063377ad1b27544c965ccd7342f7ea7e88c7"
5834
+ },
5835
+ {
5836
+ symbol: "PENDLE",
5837
+ address: "0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8"
5838
+ },
5839
+ {
5840
+ symbol: "SUSHI",
5841
+ address: "0xd4d42f0b6def4ce0383636770ef773390d85c61a"
5842
+ },
5843
+ {
5844
+ symbol: "CAKE",
5845
+ address: "0x1b896893dfc86bb67cf57767298b9073d2c1ba2c"
5846
+ },
5847
+ {
5848
+ symbol: "ZRO",
5849
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5850
+ },
5851
+ {
5852
+ symbol: "STG",
5853
+ address: "0x6694340fc020c5e6b96567843da2df01b2ce1eb6"
5854
+ },
5855
+ {
5856
+ symbol: "ARB",
5857
+ address: "0x912ce59144191c1204e64559fe8253a0e49e6548"
5858
+ },
5859
+ {
5860
+ symbol: "cbBTC",
5861
+ address: "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf"
5862
+ },
5863
+ {
5864
+ symbol: "BONK",
5865
+ address: "0x09199d9a5f4448d0848e4395d065e1ad9c4a1f74"
5866
+ }
5867
+ ],
5868
+ stables: [
5869
+ {
5870
+ symbol: "USDT",
5871
+ address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
5872
+ },
5873
+ {
5874
+ symbol: "USDC",
5875
+ address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831"
5876
+ },
5877
+ {
5878
+ symbol: "DAI",
5879
+ address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"
5880
+ },
5881
+ {
5882
+ symbol: "PYUSD",
5883
+ address: "0x46850ad61c2b7d64d08c9c754f45254596696984"
5884
+ },
5885
+ {
5886
+ symbol: "USDD",
5887
+ address: "0x680447595e8b7b3aa1b43beb9f6098c79ac2ab3f"
5888
+ },
5889
+ {
5890
+ symbol: "FRAX",
5891
+ address: "0x17fc002b466eec40dae837fc4be5c67993ddbd6f"
5892
+ },
5893
+ {
5894
+ symbol: "LUSD",
5895
+ address: "0x93b346b6bc2548da6a1e7d98e9a421b42541425b"
5896
+ },
5897
+ {
5898
+ symbol: "MIM",
5899
+ address: "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a"
5900
+ }
5901
+ ]
5902
+ },
5903
+ "42220": {
5904
+ top: [],
5905
+ stables: [
5906
+ {
5907
+ symbol: "USDT",
5908
+ address: "0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e"
5909
+ },
5910
+ {
5911
+ symbol: "USDC",
5912
+ address: "0xceba9300f2b948710d2653dd7b07f33a8b32118c"
5913
+ }
5914
+ ]
5915
+ },
5916
+ "43114": {
5917
+ top: [
5918
+ {
5919
+ symbol: "PENDLE",
5920
+ address: "0xfb98b335551a418cd0737375a2ea0ded62ea213b"
5921
+ },
5922
+ {
5923
+ symbol: "ZRO",
5924
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5925
+ },
5926
+ {
5927
+ symbol: "STG",
5928
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
5929
+ }
5930
+ ],
5931
+ stables: [
5932
+ {
5933
+ symbol: "USDT",
5934
+ address: "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7"
5935
+ },
5936
+ {
5937
+ symbol: "USDC",
5938
+ address: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"
5939
+ },
5940
+ {
5941
+ symbol: "EURC",
5942
+ address: "0xc891eb4cbdeff6e073e859e987815ed1505c2acd"
5943
+ },
5944
+ {
5945
+ symbol: "FRAX",
5946
+ address: "0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64"
5947
+ },
5948
+ {
5949
+ symbol: "MIM",
5950
+ address: "0x130966628846bfd36ff31a822705796e8cb8c18d"
5951
+ }
5952
+ ]
5953
+ },
5954
+ "5000": {
5955
+ top: [],
5956
+ stables: [
5957
+ {
5958
+ symbol: "USDT",
5959
+ address: "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae"
5960
+ },
5961
+ {
5962
+ symbol: "USDC",
5963
+ address: "0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9"
5964
+ },
5965
+ {
5966
+ symbol: "mUSD",
5967
+ address: "0xab575258d37eaa5c8956efabe71f4ee8f6397cf3"
5968
+ }
5969
+ ]
5970
+ },
5971
+ "534352": {
5972
+ top: [],
5973
+ stables: [
5974
+ {
5975
+ symbol: "USDT",
5976
+ address: "0xf55bec9cafdbe8730f096aa55dad6d22d44099df"
5977
+ },
5978
+ {
5979
+ symbol: "USDC",
5980
+ address: "0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4"
5981
+ }
5982
+ ]
5983
+ },
5984
+ "56": {
5985
+ top: [
5986
+ {
5987
+ symbol: "AAVE",
5988
+ address: "0xfb6115445bff7b52feb98650c87f44907e58f802"
5989
+ },
5990
+ {
5991
+ symbol: "LINK",
5992
+ address: "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd"
5993
+ },
5994
+ {
5995
+ symbol: "UNI",
5996
+ address: "0xbf5140a22578168fd562dccf235e5d43a02ce9b1"
5997
+ },
5998
+ {
5999
+ symbol: "PENDLE",
6000
+ address: "0xb3ed0a426155b79b898849803e3b36552f7ed507"
6001
+ },
6002
+ {
6003
+ symbol: "COMP",
6004
+ address: "0x52ce071bd9b1c4b00a0b92d298c512478cad67e8"
6005
+ },
6006
+ {
6007
+ symbol: "CAKE",
6008
+ address: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"
6009
+ },
6010
+ {
6011
+ symbol: "ZRO",
6012
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
6013
+ },
6014
+ {
6015
+ symbol: "STG",
6016
+ address: "0xb0d502e938ed5f4df2e681fe6e419ff29631d62b"
6017
+ },
6018
+ {
6019
+ symbol: "AXS",
6020
+ address: "0x715d400f88c167884bbcc41c5fea407ed4d2f8a0"
6021
+ },
6022
+ {
6023
+ symbol: "BONK",
6024
+ address: "0xa697e272a73744b343528c3bc4702f2565b2f422"
6025
+ }
6026
+ ],
6027
+ stables: [
6028
+ {
6029
+ symbol: "USDT",
6030
+ address: "0x55d398326f99059ff775485246999027b3197955"
6031
+ },
6032
+ {
6033
+ symbol: "USDC",
6034
+ address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"
6035
+ },
6036
+ {
6037
+ symbol: "FDUSD",
6038
+ address: "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409"
6039
+ },
6040
+ {
6041
+ symbol: "TUSD",
6042
+ address: "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9"
6043
+ }
6044
+ ]
6045
+ },
6046
+ "59144": {
6047
+ top: [
6048
+ {
6049
+ symbol: "Cake",
6050
+ address: "0x0d1e753a25ebda689453309112904807625befbe"
6051
+ }
6052
+ ],
6053
+ stables: [
6054
+ {
6055
+ symbol: "USDC",
6056
+ address: "0x176211869ca2b568f2a7d4ee941e073a821ee1ff"
6057
+ }
6058
+ ]
6059
+ },
6060
+ "80094": {
6061
+ top: [],
6062
+ stables: [
6063
+ {
6064
+ symbol: "MIM",
6065
+ address: "0x5b82028cfc477c4e7dda7ff33d59a23fa7be002a"
6066
+ }
6067
+ ]
6068
+ },
6069
+ "8453": {
6070
+ top: [
6071
+ {
6072
+ symbol: "AAVE",
6073
+ address: "0x63706e401c06ac8513145b7687a14804d17f814b"
6074
+ },
6075
+ {
6076
+ symbol: "PENDLE",
6077
+ address: "0xa99f6e6785da0f5d6fb42495fe424bce029eeb3e"
6078
+ },
6079
+ {
6080
+ symbol: "COMP",
6081
+ address: "0x9e1028f5f1d5ede59748ffcee5532509976840e0"
6082
+ },
6083
+ {
6084
+ symbol: "CAKE",
6085
+ address: "0x3055913c90fcc1a6ce9a358911721eeb942013a1"
6086
+ },
6087
+ {
6088
+ symbol: "YFI",
6089
+ address: "0x9eaf8c1e34f05a589eda6bafdf391cf6ad3cb239"
6090
+ },
6091
+ {
6092
+ symbol: "ZRO",
6093
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
6094
+ },
6095
+ {
6096
+ symbol: "STG",
6097
+ address: "0xe3b53af74a4bf62ae5511055290838050bf764df"
6098
+ },
6099
+ {
6100
+ symbol: "cbBTC",
6101
+ address: "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf"
6102
+ },
6103
+ {
6104
+ symbol: "AERO",
6105
+ address: "0x940181a94a35a4569e4529a3cdfb74e38fd98631"
6106
+ },
6107
+ {
6108
+ symbol: "VIRTUAL",
6109
+ address: "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b"
6110
+ },
6111
+ {
6112
+ symbol: "MORPHO",
6113
+ address: "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842"
6114
+ },
6115
+ {
6116
+ symbol: "BRETT",
6117
+ address: "0x532f27101965dd16442e59d40670faf5ebb142e4"
6118
+ },
6119
+ {
6120
+ symbol: "DEGEN",
6121
+ address: "0x4ed4e862860bed51a9570b96d89af5e1b0efefed"
6122
+ },
6123
+ {
6124
+ symbol: "WELL",
6125
+ address: "0xa88594d404727625a9437c3f886c7643872296ae"
6126
+ },
6127
+ {
6128
+ symbol: "ZORA",
6129
+ address: "0x1111111111166b7fe7bd91427724b487980afc69"
6130
+ }
6131
+ ],
6132
+ stables: [
6133
+ {
6134
+ symbol: "USDC",
6135
+ address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
6136
+ },
6137
+ {
6138
+ symbol: "DAI",
6139
+ address: "0x50c5725949a6f0c72e6c4a641f24049a917db0cb"
6140
+ },
6141
+ {
6142
+ symbol: "USDS",
6143
+ address: "0x820c137fa70c8691f0e44dc420a5e53c168921dc"
6144
+ },
6145
+ {
6146
+ symbol: "EURC",
6147
+ address: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"
6148
+ }
6149
+ ]
6150
+ },
6151
+ "999": {
6152
+ top: [
6153
+ {
6154
+ symbol: "AXL",
6155
+ address: "0xc4dc717136b8fd754df181d122914c2866f11a79"
6156
+ }
6157
+ ],
6158
+ stables: [
6159
+ {
6160
+ symbol: "USDC",
6161
+ address: "0xb88339cb7199b77e23db6e890353e22632ba630f"
6162
+ }
6163
+ ]
6164
+ },
6165
+ "agoric-3": {
6166
+ top: [],
6167
+ stables: [
6168
+ {
6169
+ symbol: "USDC",
6170
+ address: "ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
6171
+ }
6172
+ ]
6173
+ },
6174
+ "archway-1": {
6175
+ top: [],
6176
+ stables: [
6177
+ {
6178
+ symbol: "USDC",
6179
+ address: "ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D"
6180
+ }
6181
+ ]
6182
+ },
6183
+ "axelar-dojo-1": {
6184
+ top: [],
6185
+ stables: [
6186
+ {
6187
+ symbol: "USDe",
6188
+ address: "usde-wei"
6189
+ }
6190
+ ]
6191
+ },
6192
+ "core-1": {
6193
+ top: [],
6194
+ stables: [
6195
+ {
6196
+ symbol: "USDT",
6197
+ address: "ibc/C559977F5797BDC1D74C0836A10C379C991D664166CB60D776A83029852431B4"
6198
+ },
6199
+ {
6200
+ symbol: "USDC",
6201
+ address: "ibc/B3792E4A62DF4A934EF2DF5968556DB56F5776ED25BDE11188A4F58A7DD406F0"
6202
+ }
6203
+ ]
6204
+ },
6205
+ "cosmoshub-4": {
6206
+ top: [],
6207
+ stables: [
6208
+ {
6209
+ symbol: "USDC",
6210
+ address: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
6211
+ }
6212
+ ]
6213
+ },
6214
+ "crescent-1": {
6215
+ top: [
6216
+ {
6217
+ symbol: "AXL",
6218
+ address: "ibc/0634D0993744740D675AD01E81156EAC945AEAAE17C074918DC7FF52F41B263E"
6219
+ }
6220
+ ],
6221
+ stables: []
6222
+ },
6223
+ "dydx-mainnet-1": {
6224
+ top: [],
6225
+ stables: [
6226
+ {
6227
+ symbol: "USDC",
6228
+ address: "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5"
6229
+ }
6230
+ ]
6231
+ },
6232
+ "dymension_1100-1": {
6233
+ top: [],
6234
+ stables: [
6235
+ {
6236
+ symbol: "USDC",
6237
+ address: "ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4"
6238
+ }
6239
+ ]
6240
+ },
6241
+ "elys-1": {
6242
+ top: [
6243
+ {
6244
+ symbol: "LINK",
6245
+ address: "ibc/2A20C613F2BA256BE9FAD791B0743FBC4FE3C998EDF9234D969172F7D42FB8E7"
6246
+ }
6247
+ ],
6248
+ stables: [
6249
+ {
6250
+ symbol: "USDC",
6251
+ address: "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349"
6252
+ }
6253
+ ]
6254
+ },
6255
+ "juno-1": {
6256
+ top: [
6257
+ {
6258
+ symbol: "AXL",
6259
+ address: "ibc/EBE900AED8FF6BB2E186B17B066138F647CDD9647EF4FBE2DE6C8D4013A2C990"
6260
+ }
6261
+ ],
6262
+ stables: [
6263
+ {
6264
+ symbol: "USDC",
6265
+ address: "ibc/4A482FA914A4B9B05801ED81C33713899F322B24F76A06F4B8FE872485EA22FF"
6266
+ }
6267
+ ]
6268
+ },
6269
+ "kaiyo-1": {
6270
+ top: [
6271
+ {
6272
+ symbol: "AXL",
6273
+ address: "ibc/C01154C2547F4CB10A985EA78E7CD4BA891C1504360703A37E1D7043F06B5E1F"
6274
+ }
6275
+ ],
6276
+ stables: [
6277
+ {
6278
+ symbol: "USDC",
6279
+ address: "ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
6280
+ }
6281
+ ]
6282
+ },
6283
+ "kava_2222-10": {
6284
+ top: [],
6285
+ stables: [
6286
+ {
6287
+ symbol: "USDT",
6288
+ address: "erc20/tether/usdt"
6289
+ }
6290
+ ]
6291
+ },
6292
+ "lava-mainnet-1": {
6293
+ top: [
6294
+ {
6295
+ symbol: "OPaxl",
6296
+ address: "ibc/8F54CE650A35D2B04630DD57F91D6552E7FCA9002DBF1CFBA1254675C194C8C8"
6297
+ }
6298
+ ],
6299
+ stables: []
6300
+ },
6301
+ "migaloo-1": {
6302
+ top: [],
6303
+ stables: [
6304
+ {
6305
+ symbol: "USDC",
6306
+ address: "ibc/BC5C0BAFD19A5E4133FDA0F3E04AE1FBEE75A4A226554B2CBB021089FF2E1F8A"
6307
+ }
6308
+ ]
6309
+ },
6310
+ "neutron-1": {
6311
+ top: [
6312
+ {
6313
+ symbol: "AXL",
6314
+ address: "ibc/C0E66D1C81D8AAF0E6896E05190FDFBC222367148F86AC3EA679C28327A763CD"
6315
+ }
6316
+ ],
6317
+ stables: [
6318
+ {
6319
+ symbol: "USDC",
6320
+ address: "ibc/B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81"
6321
+ }
6322
+ ]
6323
+ },
6324
+ "noble-1": {
6325
+ top: [],
6326
+ stables: [
6327
+ {
6328
+ symbol: "USDY",
6329
+ address: "ausdy"
6330
+ }
6331
+ ]
6332
+ },
6333
+ "osmosis-1": {
6334
+ top: [
6335
+ {
6336
+ symbol: "AXL",
6337
+ address: "ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E"
6338
+ }
6339
+ ],
6340
+ stables: [
6341
+ {
6342
+ symbol: "USDT",
6343
+ address: "ibc/4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB"
6344
+ },
6345
+ {
6346
+ symbol: "USDC",
6347
+ address: "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4"
6348
+ },
6349
+ {
6350
+ symbol: "USDY",
6351
+ address: "ibc/23104D411A6EB6031FA92FB75F227422B84989969E91DCAD56A535DD7FF0A373"
6352
+ }
6353
+ ]
6354
+ },
6355
+ "phoenix-1": {
6356
+ top: [],
6357
+ stables: [
6358
+ {
6359
+ symbol: "USDC",
6360
+ address: "ibc/2C962DAB9F57FE0921435426AE75196009FAA1981BF86991203C8411F8980FDB"
6361
+ }
6362
+ ]
6363
+ },
6364
+ "ssc-1": {
6365
+ top: [
6366
+ {
6367
+ symbol: "UNI",
6368
+ address: "ibc/E4859520008F30CAB8A6548A390BC10C45F667A26A5A22D8891A79589DF57C41"
6369
+ }
6370
+ ],
6371
+ stables: [
6372
+ {
6373
+ symbol: "USDT",
6374
+ address: "ibc/B5F6DCC4FEF6BBBC356C67C46072AB3C01443FB5E3D19538C52A3CD439BE6BE3"
6375
+ },
6376
+ {
6377
+ symbol: "USDC",
6378
+ address: "ibc/37EF240838413BD7D3496183213F7F0F483EC7A330328F16AD901A1AC1450F72"
6379
+ },
6380
+ {
6381
+ symbol: "USDe",
6382
+ address: "ibc/23B8A6E4D4AD864A4DF7FBBC40818473691395EF9B6D8B8277037D536417768E"
6383
+ },
6384
+ {
6385
+ symbol: "USDY",
6386
+ address: "ibc/2115CC1B823DE5CC635692CB95E50E1C601A9B432703F7A611B4E492A914D968"
6387
+ }
6388
+ ]
6389
+ },
6390
+ "stargaze-1": {
6391
+ top: [],
6392
+ stables: [
6393
+ {
6394
+ symbol: "USDC",
6395
+ address: "ibc/4A1C18CA7F50544760CF306189B810CE4C1CB156C7FC870143D401FE7280E591"
6396
+ }
6397
+ ]
6398
+ },
6399
+ "umee-1": {
6400
+ top: [
6401
+ {
6402
+ symbol: "AXL",
6403
+ address: "ibc/D1CB2804AA5EB64D503F28E8DF3552F8A4D642802B66EFE50DE432B755F37AE1"
6404
+ }
6405
+ ],
6406
+ stables: []
6407
+ },
6408
+ "xion-mainnet-1": {
6409
+ top: [],
6410
+ stables: [
6411
+ {
6412
+ symbol: "USDC",
6413
+ address: "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349"
6414
+ }
6415
+ ]
6416
+ }
6417
+ };
6418
+ }
6419
+ });
6420
+
5418
6421
  // src/core/useTokens.ts
5419
6422
  import { useState as useState3, useEffect as useEffect4, useMemo as useMemo3 } from "react";
5420
6423
  function mapTokenDefToToken(tokenDef) {
@@ -5537,13 +6540,40 @@ function useTokens(chainId) {
5537
6540
  setIsLoadingMore(false);
5538
6541
  }
5539
6542
  };
6543
+ const featuredAddresses = useMemo3(() => {
6544
+ const key = chainId?.toString() ?? "";
6545
+ const chain = FEATURED[key];
6546
+ if (!chain) return /* @__PURE__ */ new Map();
6547
+ const map = /* @__PURE__ */ new Map();
6548
+ let order = 0;
6549
+ for (const s of chain.stables) map.set(s.address.toLowerCase(), order++);
6550
+ for (const t of chain.top) map.set(t.address.toLowerCase(), order++);
6551
+ return map;
6552
+ }, [chainId]);
6553
+ const nativeSymbols = useMemo3(() => {
6554
+ if (!chainId) return /* @__PURE__ */ new Set();
6555
+ const chain = chainMap.get(chainId.toString());
6556
+ const sym = chain?.nativeCurrency?.symbol;
6557
+ if (!sym) return /* @__PURE__ */ new Set();
6558
+ return /* @__PURE__ */ new Set([sym.toUpperCase()]);
6559
+ }, [chainId, chainMap]);
5540
6560
  const filteredTokens = useMemo3(() => {
5541
6561
  const query = searchQuery.toLowerCase().trim();
5542
6562
  const source = query.length === 0 || tokensPaginationEnabled ? tokens : tokens.filter(
5543
6563
  (token) => token.symbol.toLowerCase().includes(query) || token.name.toLowerCase().includes(query) || token.address.toLowerCase().includes(query)
5544
6564
  );
5545
- return sortTokensByPopularity(source);
5546
- }, [tokens, searchQuery, tokensPaginationEnabled]);
6565
+ return sortTokensByPopularity(source, {
6566
+ nativeAddresses: NATIVE_ADDRESSES,
6567
+ nativeSymbols,
6568
+ featuredAddresses
6569
+ });
6570
+ }, [
6571
+ tokens,
6572
+ searchQuery,
6573
+ tokensPaginationEnabled,
6574
+ nativeSymbols,
6575
+ featuredAddresses
6576
+ ]);
5547
6577
  return {
5548
6578
  tokens,
5549
6579
  filteredTokens,
@@ -5556,7 +6586,7 @@ function useTokens(chainId) {
5556
6586
  isLoadingMore
5557
6587
  };
5558
6588
  }
5559
- var DEFAULT_PAGE_LIMIT;
6589
+ var FEATURED, NATIVE_ADDRESSES, DEFAULT_PAGE_LIMIT;
5560
6590
  var init_useTokens = __esm({
5561
6591
  "src/core/useTokens.ts"() {
5562
6592
  "use strict";
@@ -5564,6 +6594,15 @@ var init_useTokens = __esm({
5564
6594
  init_useChains();
5565
6595
  init_tokenPopularity();
5566
6596
  init_store();
6597
+ init_chainHelpers();
6598
+ init_featuredAssets();
6599
+ FEATURED = featuredAssets_default;
6600
+ NATIVE_ADDRESSES = /* @__PURE__ */ new Set([
6601
+ NATIVE_EVM2.toLowerCase(),
6602
+ NATIVE_SOLANA2.toLowerCase(),
6603
+ // Some EVM chains (e.g. ZKsync, HyperEVM) use the zero address for the native token
6604
+ "0x0000000000000000000000000000000000000000"
6605
+ ]);
5567
6606
  DEFAULT_PAGE_LIMIT = 100;
5568
6607
  }
5569
6608
  });
@@ -5906,29 +6945,39 @@ var init_useDepositNavigationState = __esm({
5906
6945
  });
5907
6946
 
5908
6947
  // src/widget/state/deposit/useThemePreference.ts
5909
- import { useCallback as useCallback4, useState as useState6 } from "react";
5910
- import { useEffect as useEffect6 } from "react";
5911
- function getInitialTheme() {
5912
- if (typeof window === "undefined") {
5913
- return "light";
5914
- }
6948
+ import { useCallback as useCallback4, useEffect as useEffect6, useState as useState6 } from "react";
6949
+ function resolveConfigTheme(configTheme) {
6950
+ if (typeof window === "undefined") return "light";
6951
+ if (configTheme !== "system") return configTheme;
5915
6952
  try {
5916
6953
  const stored = localStorage.getItem(THEME_STORAGE_KEY);
5917
- if (stored === "light" || stored === "dark") {
5918
- return stored;
5919
- }
6954
+ if (stored === "light" || stored === "dark") return stored;
5920
6955
  } catch {
5921
6956
  }
5922
- if (typeof window !== "undefined" && window.matchMedia) {
5923
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
5924
- }
5925
- return "light";
6957
+ return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
5926
6958
  }
5927
- function useThemePreference() {
5928
- const [resolvedTheme, setResolvedTheme] = useState6("light");
6959
+ function useThemePreference(configTheme = "system") {
6960
+ const [resolvedTheme, setResolvedTheme] = useState6(
6961
+ () => resolveConfigTheme(configTheme)
6962
+ );
5929
6963
  useEffect6(() => {
5930
- setResolvedTheme(getInitialTheme());
5931
- }, []);
6964
+ setResolvedTheme(resolveConfigTheme(configTheme));
6965
+ }, [configTheme]);
6966
+ useEffect6(() => {
6967
+ if (configTheme !== "system") return;
6968
+ if (typeof window === "undefined" || !window.matchMedia) return;
6969
+ try {
6970
+ const stored = localStorage.getItem(THEME_STORAGE_KEY);
6971
+ if (stored === "light" || stored === "dark") return;
6972
+ } catch {
6973
+ }
6974
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
6975
+ const handler = (e2) => {
6976
+ setResolvedTheme(e2.matches ? "dark" : "light");
6977
+ };
6978
+ mediaQuery.addEventListener("change", handler);
6979
+ return () => mediaQuery.removeEventListener("change", handler);
6980
+ }, [configTheme]);
5932
6981
  const toggleTheme = useCallback4(() => {
5933
6982
  setResolvedTheme((current) => {
5934
6983
  const nextTheme = current === "light" ? "dark" : "light";
@@ -6057,8 +7106,65 @@ var init_useWalletConnect = __esm({
6057
7106
  }
6058
7107
  });
6059
7108
 
7109
+ // src/hooks/useTrustwareConfig.ts
7110
+ import { useEffect as useEffect8, useState as useState8 } from "react";
7111
+ function useTrustwareConfig() {
7112
+ const [cfg, setCfg] = useState8(() => {
7113
+ try {
7114
+ return TrustwareConfigStore.get();
7115
+ } catch {
7116
+ return {
7117
+ apiKey: "",
7118
+ routes: {
7119
+ toChain: "",
7120
+ toToken: "",
7121
+ toAddress: void 0,
7122
+ defaultSlippage: 1,
7123
+ routeType: "swap",
7124
+ options: {}
7125
+ },
7126
+ autoDetectProvider: false,
7127
+ theme: "system",
7128
+ messages: {
7129
+ title: "Trustware SDK",
7130
+ description: "Seamlessly bridge assets across chains with Trustware."
7131
+ },
7132
+ retry: {
7133
+ autoRetry: true,
7134
+ maxRetries: 3,
7135
+ baseDelayMs: 1e3,
7136
+ approachingThreshold: 5
7137
+ },
7138
+ features: {
7139
+ tokensPagination: true,
7140
+ balanceStreaming: false,
7141
+ shouldAllowGA4: true,
7142
+ swapMode: false,
7143
+ swapDefaultDestToken: null,
7144
+ swapLockDestToken: false,
7145
+ swapAllowedDestTokens: null
7146
+ }
7147
+ };
7148
+ }
7149
+ });
7150
+ useEffect8(() => {
7151
+ const unsubscribe = TrustwareConfigStore.subscribe(setCfg);
7152
+ return () => {
7153
+ unsubscribe();
7154
+ };
7155
+ }, []);
7156
+ return cfg;
7157
+ }
7158
+ var init_useTrustwareConfig = __esm({
7159
+ "src/hooks/useTrustwareConfig.ts"() {
7160
+ "use strict";
7161
+ "use client";
7162
+ init_store();
7163
+ }
7164
+ });
7165
+
6060
7166
  // src/widget/context/DepositContext.tsx
6061
- import React2, { createContext as createContext2, useContext as useContext2, useState as useState8, useMemo as useMemo5 } from "react";
7167
+ import React2, { createContext as createContext2, useContext as useContext2, useState as useState9, useMemo as useMemo5 } from "react";
6062
7168
  import { jsx as jsx2 } from "react/jsx-runtime";
6063
7169
  function DepositProvider({
6064
7170
  children,
@@ -6074,7 +7180,8 @@ function DepositProvider({
6074
7180
  resetNavigation,
6075
7181
  setCurrentStepInternal
6076
7182
  } = useDepositNavigationState(initialStep);
6077
- const { resolvedTheme, toggleTheme } = useThemePreference();
7183
+ const config = useTrustwareConfig();
7184
+ const { resolvedTheme, toggleTheme } = useThemePreference(config.theme);
6078
7185
  const {
6079
7186
  selectedWallet,
6080
7187
  walletAddress: otherWalletAddress,
@@ -6082,20 +7189,20 @@ function DepositProvider({
6082
7189
  connectWallet,
6083
7190
  disconnectWallet
6084
7191
  } = useWalletSessionState();
6085
- const [amountInputMode, setAmountInputMode] = useState8(
7192
+ const [amountInputMode, setAmountInputMode] = useState9(
6086
7193
  "usd"
6087
7194
  );
6088
- const [walletType, setWalletType] = useState8(
7195
+ const [walletType, setWalletType] = useState9(
6089
7196
  "other"
6090
7197
  );
6091
7198
  const { walletConnectAddress, WalletConnect, disconnectWalletConnect } = useWalletConnect({
6092
7199
  setWalletType,
6093
7200
  setCurrentStep
6094
7201
  });
6095
- const [selectedToken, setSelectedToken] = useState8(null);
6096
- const [selectedChain, setSelectedChain] = useState8(null);
6097
- const [amount, setAmount] = useState8("");
6098
- const [selectedNamespace, setSelectedNamespace] = useState8("evm");
7202
+ const [selectedToken, setSelectedToken] = useState9(null);
7203
+ const [selectedChain, setSelectedChain] = useState9(null);
7204
+ const [amount, setAmount] = useState9("");
7205
+ const [selectedNamespace, setSelectedNamespace] = useState9("evm");
6099
7206
  const walletAddress = useMemo5(
6100
7207
  () => walletType === "walletconnect" ? walletConnectAddress : otherWalletAddress,
6101
7208
  [walletType, walletConnectAddress, otherWalletAddress]
@@ -6113,11 +7220,11 @@ function DepositProvider({
6113
7220
  selectedToken,
6114
7221
  setSelectedToken
6115
7222
  });
6116
- const [transactionStatus, setTransactionStatus] = useState8("idle");
6117
- const [transactionHash, setTransactionHash] = useState8(null);
6118
- const [errorMessage, setErrorMessage] = useState8(null);
6119
- const [intentId, setIntentId] = useState8(null);
6120
- const [paymentMethod, setPaymentMethod] = useState8("crypto");
7223
+ const [transactionStatus, setTransactionStatus] = useState9("idle");
7224
+ const [transactionHash, setTransactionHash] = useState9(null);
7225
+ const [errorMessage, setErrorMessage] = useState9(null);
7226
+ const [intentId, setIntentId] = useState9(null);
7227
+ const [paymentMethod, setPaymentMethod] = useState9("crypto");
6121
7228
  const resetState = React2.useCallback(() => {
6122
7229
  resetNavigation();
6123
7230
  setSelectedToken(null);
@@ -6273,6 +7380,7 @@ var init_DepositContext = __esm({
6273
7380
  init_useWalletTokenState();
6274
7381
  init_useWalletConnect();
6275
7382
  init_wallets();
7383
+ init_useTrustwareConfig();
6276
7384
  DepositContext = createContext2(
6277
7385
  void 0
6278
7386
  );
@@ -6285,7 +7393,7 @@ var init_DepositContext = __esm({
6285
7393
  });
6286
7394
 
6287
7395
  // src/widget/hooks/useRouteBuilder.ts
6288
- import { useEffect as useEffect8, useMemo as useMemo6, useRef, useState as useState9 } from "react";
7396
+ import { useEffect as useEffect9, useMemo as useMemo6, useRef, useState as useState10 } from "react";
6289
7397
  function useRouteBuilder({
6290
7398
  enabled = true,
6291
7399
  debounceMs = 300,
@@ -6306,7 +7414,7 @@ function useRouteBuilder({
6306
7414
  const { selectedToken, selectedChain, amount } = useDepositForm();
6307
7415
  const { walletAddress } = useDepositWallet();
6308
7416
  const { errorMessage } = useDepositTransaction();
6309
- const [state, setState] = useState9({
7417
+ const [state, setState] = useState10({
6310
7418
  isLoadingRoute: false,
6311
7419
  networkFees: null,
6312
7420
  estimatedReceive: null,
@@ -6315,7 +7423,7 @@ function useRouteBuilder({
6315
7423
  routeResult: null
6316
7424
  });
6317
7425
  const abortRef = useRef(null);
6318
- const [refreshTick, setRefreshTick] = useState9(0);
7426
+ const [refreshTick, setRefreshTick] = useState10(0);
6319
7427
  const routeKey = useMemo6(() => {
6320
7428
  if (!enabled || !selectedToken || !selectedChain || !amount || !walletAddress) {
6321
7429
  return null;
@@ -6356,7 +7464,7 @@ function useRouteBuilder({
6356
7464
  ]);
6357
7465
  const hasFromChainId = fromChainId !== void 0 && fromChainId !== null && String(fromChainId).trim() !== "";
6358
7466
  const hasToChainId = toChainId !== void 0 && toChainId !== null && String(toChainId).trim() !== "";
6359
- useEffect8(() => {
7467
+ useEffect9(() => {
6360
7468
  if (!fromChain || !hasFromChainId || !hasToChainId || !fromToken || !toToken || !fromAmountWei || !fromAddress || !toAddress)
6361
7469
  return;
6362
7470
  abortRef.current?.abort();
@@ -6492,7 +7600,7 @@ function useRouteBuilder({
6492
7600
  walletAddress,
6493
7601
  errorMessage
6494
7602
  ]);
6495
- useEffect8(() => {
7603
+ useEffect9(() => {
6496
7604
  if (!enabled || !routeKey || !refreshMs || refreshMs <= 0) return;
6497
7605
  const id = setInterval(() => {
6498
7606
  setRefreshTick((tick) => tick + 1);
@@ -6548,70 +7656,6 @@ var init_useRouteBuilder = __esm({
6548
7656
  }
6549
7657
  });
6550
7658
 
6551
- // src/hooks/useTrustwareConfig.ts
6552
- import { useEffect as useEffect9, useState as useState10 } from "react";
6553
- function useTrustwareConfig() {
6554
- const [cfg, setCfg] = useState10(() => {
6555
- try {
6556
- return TrustwareConfigStore.get();
6557
- } catch {
6558
- return {
6559
- apiKey: "",
6560
- routes: {
6561
- toChain: "",
6562
- toToken: "",
6563
- toAddress: void 0,
6564
- defaultSlippage: 1,
6565
- routeType: "swap",
6566
- options: {}
6567
- },
6568
- autoDetectProvider: false,
6569
- theme: {
6570
- primaryColor: "#4F46E5",
6571
- secondaryColor: "#6366F1",
6572
- backgroundColor: "#FFFFFF",
6573
- textColor: "#111827",
6574
- borderColor: "#E5E7EB",
6575
- radius: 8
6576
- },
6577
- messages: {
6578
- title: "Trustware SDK",
6579
- description: "Seamlessly bridge assets across chains with Trustware."
6580
- },
6581
- retry: {
6582
- autoRetry: true,
6583
- maxRetries: 3,
6584
- baseDelayMs: 1e3,
6585
- approachingThreshold: 5
6586
- },
6587
- features: {
6588
- tokensPagination: true,
6589
- balanceStreaming: false,
6590
- shouldAllowGA4: true,
6591
- swapMode: false,
6592
- swapDefaultDestToken: null,
6593
- swapLockDestToken: false,
6594
- swapAllowedDestTokens: null
6595
- }
6596
- };
6597
- }
6598
- });
6599
- useEffect9(() => {
6600
- const unsubscribe = TrustwareConfigStore.subscribe(setCfg);
6601
- return () => {
6602
- unsubscribe();
6603
- };
6604
- }, []);
6605
- return cfg;
6606
- }
6607
- var init_useTrustwareConfig = __esm({
6608
- "src/hooks/useTrustwareConfig.ts"() {
6609
- "use strict";
6610
- "use client";
6611
- init_store();
6612
- }
6613
- });
6614
-
6615
7659
  // src/widget/hooks/useAmountConstraints.ts
6616
7660
  import { useMemo as useMemo7 } from "react";
6617
7661
  function parsePositiveNumber(value) {
@@ -11697,6 +12741,7 @@ var init_AvailableTokenListItem = __esm({
11697
12741
  });
11698
12742
 
11699
12743
  // src/widget/features/token-selection/components/ChainSelectorPanel.tsx
12744
+ import { useState as useState21, useMemo as useMemo12 } from "react";
11700
12745
  import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
11701
12746
  function ChainItem({
11702
12747
  chain,
@@ -11734,8 +12779,8 @@ function ChainItem({
11734
12779
  src: chain.chainIconURI,
11735
12780
  alt: label,
11736
12781
  style: {
11737
- width: "2rem",
11738
- height: "2rem",
12782
+ width: "1.5rem",
12783
+ height: "1.5rem",
11739
12784
  borderRadius: "9999px",
11740
12785
  objectFit: "cover",
11741
12786
  flexShrink: 0
@@ -11745,8 +12790,8 @@ function ChainItem({
11745
12790
  "div",
11746
12791
  {
11747
12792
  style: {
11748
- width: "2rem",
11749
- height: "2rem",
12793
+ width: "1.5rem",
12794
+ height: "1.5rem",
11750
12795
  borderRadius: "9999px",
11751
12796
  backgroundColor: colors.muted,
11752
12797
  display: "flex",
@@ -11824,6 +12869,81 @@ function ChainItem({
11824
12869
  String(key)
11825
12870
  );
11826
12871
  }
12872
+ function SectionLabel({
12873
+ children,
12874
+ icon
12875
+ }) {
12876
+ return /* @__PURE__ */ jsxs18(
12877
+ "div",
12878
+ {
12879
+ style: {
12880
+ display: "flex",
12881
+ alignItems: "center",
12882
+ gap: "0.25rem",
12883
+ padding: `${spacing[1.5]} ${spacing[3]}`,
12884
+ marginTop: spacing[2]
12885
+ },
12886
+ children: [
12887
+ icon === "spark" ? /* @__PURE__ */ jsx21(
12888
+ "svg",
12889
+ {
12890
+ style: {
12891
+ width: "0.75rem",
12892
+ height: "0.75rem",
12893
+ color: colors.primary,
12894
+ flexShrink: 0
12895
+ },
12896
+ viewBox: "0 0 24 24",
12897
+ fill: "none",
12898
+ stroke: "currentColor",
12899
+ strokeWidth: 2,
12900
+ children: /* @__PURE__ */ jsx21(
12901
+ "path",
12902
+ {
12903
+ strokeLinecap: "round",
12904
+ strokeLinejoin: "round",
12905
+ d: "M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"
12906
+ }
12907
+ )
12908
+ }
12909
+ ) : /* @__PURE__ */ jsx21(
12910
+ "svg",
12911
+ {
12912
+ style: {
12913
+ width: "0.75rem",
12914
+ height: "0.75rem",
12915
+ color: colors.primary,
12916
+ flexShrink: 0
12917
+ },
12918
+ viewBox: "0 0 24 24",
12919
+ fill: "none",
12920
+ stroke: "currentColor",
12921
+ strokeWidth: 2,
12922
+ children: /* @__PURE__ */ jsx21(
12923
+ "path",
12924
+ {
12925
+ strokeLinecap: "round",
12926
+ strokeLinejoin: "round",
12927
+ d: "M3 7.5 7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5"
12928
+ }
12929
+ )
12930
+ }
12931
+ ),
12932
+ /* @__PURE__ */ jsx21(
12933
+ "span",
12934
+ {
12935
+ style: {
12936
+ fontSize: "10px",
12937
+ fontWeight: fontWeight.medium,
12938
+ color: colors.primary
12939
+ },
12940
+ children
12941
+ }
12942
+ )
12943
+ ]
12944
+ }
12945
+ );
12946
+ }
11827
12947
  function ChainSelectorPanel({
11828
12948
  error,
11829
12949
  isChainSelected,
@@ -11832,6 +12952,21 @@ function ChainSelectorPanel({
11832
12952
  otherChains,
11833
12953
  popularChains
11834
12954
  }) {
12955
+ const [chainSearch, setChainSearch] = useState21("");
12956
+ const filteredPopular = useMemo12(() => {
12957
+ if (!chainSearch) return popularChains;
12958
+ const q = chainSearch.toLowerCase();
12959
+ return popularChains.filter(
12960
+ (c) => resolveChainLabel(c).toLowerCase().includes(q)
12961
+ );
12962
+ }, [popularChains, chainSearch]);
12963
+ const filteredOther = useMemo12(() => {
12964
+ if (!chainSearch) return otherChains;
12965
+ const q = chainSearch.toLowerCase();
12966
+ return otherChains.filter(
12967
+ (c) => resolveChainLabel(c).toLowerCase().includes(q)
12968
+ );
12969
+ }, [otherChains, chainSearch]);
11835
12970
  return /* @__PURE__ */ jsxs18(
11836
12971
  "div",
11837
12972
  {
@@ -11847,22 +12982,58 @@ function ChainSelectorPanel({
11847
12982
  "div",
11848
12983
  {
11849
12984
  style: {
11850
- padding: `${spacing[2]} ${spacing[3]}`,
11851
- borderBottom: `1px solid rgba(63, 63, 70, 0.5)`
12985
+ padding: `${spacing[2]} ${spacing[2]}`,
12986
+ borderBottom: `1px solid ${colors.border}`
11852
12987
  },
11853
- children: /* @__PURE__ */ jsx21(
11854
- "span",
11855
- {
11856
- style: {
11857
- fontSize: fontSize.xs,
11858
- fontWeight: fontWeight.medium,
11859
- color: colors.mutedForeground,
11860
- textTransform: "uppercase",
11861
- letterSpacing: "0.05em"
11862
- },
11863
- children: "Chain"
11864
- }
11865
- )
12988
+ children: /* @__PURE__ */ jsxs18("div", { style: { position: "relative" }, children: [
12989
+ /* @__PURE__ */ jsxs18(
12990
+ "svg",
12991
+ {
12992
+ style: {
12993
+ position: "absolute",
12994
+ left: spacing[2.5],
12995
+ top: "50%",
12996
+ transform: "translateY(-50%)",
12997
+ width: "1rem",
12998
+ height: "1rem",
12999
+ color: colors.mutedForeground,
13000
+ pointerEvents: "none"
13001
+ },
13002
+ viewBox: "0 0 24 24",
13003
+ fill: "none",
13004
+ stroke: "currentColor",
13005
+ strokeWidth: 2,
13006
+ children: [
13007
+ /* @__PURE__ */ jsx21("circle", { cx: "11", cy: "11", r: "8" }),
13008
+ /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", d: "m21 21-4.35-4.35" })
13009
+ ]
13010
+ }
13011
+ ),
13012
+ /* @__PURE__ */ jsx21(
13013
+ "input",
13014
+ {
13015
+ type: "text",
13016
+ placeholder: "Chain",
13017
+ value: chainSearch,
13018
+ onChange: (e2) => setChainSearch(e2.target.value),
13019
+ style: {
13020
+ width: "100%",
13021
+ boxSizing: "border-box",
13022
+ paddingLeft: spacing[8],
13023
+ paddingRight: spacing[3],
13024
+ paddingTop: spacing[2],
13025
+ paddingBottom: spacing[2],
13026
+ fontSize: fontSize.sm,
13027
+ backgroundColor: colors.muted,
13028
+ border: `1px solid ${colors.border}`,
13029
+ borderRadius: borderRadius.lg,
13030
+ color: colors.foreground,
13031
+ outline: "none",
13032
+ transition: "all 0.2s"
13033
+ }
13034
+ }
13035
+ )
13036
+ ] })
11866
13037
  }
11867
13038
  ),
11868
13039
  /* @__PURE__ */ jsx21(
@@ -11950,21 +13121,9 @@ function ChainSelectorPanel({
11950
13121
  ]
11951
13122
  }
11952
13123
  ) : /* @__PURE__ */ jsxs18(Fragment3, { children: [
11953
- popularChains.length > 0 && /* @__PURE__ */ jsxs18("div", { style: { marginBottom: spacing[2] }, children: [
11954
- /* @__PURE__ */ jsx21("div", { style: { padding: `${spacing[1.5]} ${spacing[3]}` }, children: /* @__PURE__ */ jsx21(
11955
- "span",
11956
- {
11957
- style: {
11958
- fontSize: "10px",
11959
- fontWeight: fontWeight.medium,
11960
- color: "rgba(161, 161, 170, 0.7)",
11961
- textTransform: "uppercase",
11962
- letterSpacing: "0.05em"
11963
- },
11964
- children: "Popular"
11965
- }
11966
- ) }),
11967
- popularChains.map((chain, idx) => /* @__PURE__ */ jsx21(
13124
+ filteredPopular.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
13125
+ /* @__PURE__ */ jsx21(SectionLabel, { icon: "spark", children: "Popular chains" }),
13126
+ filteredPopular.map((chain, idx) => /* @__PURE__ */ jsx21(
11968
13127
  ChainItem,
11969
13128
  {
11970
13129
  chain,
@@ -11977,30 +13136,9 @@ function ChainSelectorPanel({
11977
13136
  )
11978
13137
  ))
11979
13138
  ] }),
11980
- otherChains.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
11981
- popularChains.length > 0 && /* @__PURE__ */ jsx21(
11982
- "div",
11983
- {
11984
- style: {
11985
- padding: `${spacing[1.5]} ${spacing[3]}`,
11986
- marginTop: spacing[2]
11987
- },
11988
- children: /* @__PURE__ */ jsx21(
11989
- "span",
11990
- {
11991
- style: {
11992
- fontSize: "10px",
11993
- fontWeight: fontWeight.medium,
11994
- color: "rgba(161, 161, 170, 0.7)",
11995
- textTransform: "uppercase",
11996
- letterSpacing: "0.05em"
11997
- },
11998
- children: "All Chains"
11999
- }
12000
- )
12001
- }
12002
- ),
12003
- otherChains.map((chain, idx) => /* @__PURE__ */ jsx21(
13139
+ filteredOther.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
13140
+ /* @__PURE__ */ jsx21(SectionLabel, { icon: "sort", children: "Chains A-Z" }),
13141
+ filteredOther.map((chain, idx) => /* @__PURE__ */ jsx21(
12004
13142
  ChainItem,
12005
13143
  {
12006
13144
  chain,
@@ -12013,21 +13151,21 @@ function ChainSelectorPanel({
12013
13151
  )
12014
13152
  ))
12015
13153
  ] }),
12016
- popularChains.length === 0 && otherChains.length === 0 && /* @__PURE__ */ jsx21(
13154
+ filteredPopular.length === 0 && filteredOther.length === 0 && /* @__PURE__ */ jsx21(
12017
13155
  "div",
12018
13156
  {
12019
13157
  style: {
12020
- padding: `${spacing[3]} ${spacing[4]}`,
13158
+ padding: `${spacing[3]} ${spacing[2]}`,
12021
13159
  textAlign: "center"
12022
13160
  },
12023
13161
  children: /* @__PURE__ */ jsx21(
12024
13162
  "p",
12025
13163
  {
12026
13164
  style: {
12027
- fontSize: fontSize.sm,
13165
+ fontSize: fontSize.xs,
12028
13166
  color: colors.mutedForeground
12029
13167
  },
12030
- children: "No chains available"
13168
+ children: "No chains found"
12031
13169
  }
12032
13170
  )
12033
13171
  }
@@ -12098,8 +13236,8 @@ function TokenSearchInput({
12098
13236
  paddingTop: spacing[2],
12099
13237
  paddingBottom: spacing[2],
12100
13238
  fontSize: fontSize.sm,
12101
- backgroundColor: "rgba(63, 63, 70, 0.5)",
12102
- border: `1px solid rgba(63, 63, 70, 0.5)`,
13239
+ backgroundColor: colors.muted,
13240
+ border: `1px solid ${colors.border}`,
12103
13241
  borderRadius: borderRadius.lg,
12104
13242
  color: colors.foreground,
12105
13243
  outline: "none",
@@ -12571,7 +13709,87 @@ var init_WalletTokenListItem = __esm({
12571
13709
  });
12572
13710
 
12573
13711
  // src/widget/features/token-selection/components/TokenSelectorPanel.tsx
12574
- import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
13712
+ import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
13713
+ function TokenSectionLabel({
13714
+ children,
13715
+ icon
13716
+ }) {
13717
+ return /* @__PURE__ */ jsxs22(
13718
+ "div",
13719
+ {
13720
+ style: {
13721
+ display: "flex",
13722
+ alignItems: "center",
13723
+ gap: "0.375rem",
13724
+ paddingLeft: spacing[3],
13725
+ paddingRight: spacing[3],
13726
+ paddingTop: spacing[1],
13727
+ paddingBottom: spacing[1],
13728
+ marginTop: spacing[1],
13729
+ marginBottom: spacing[1]
13730
+ },
13731
+ children: [
13732
+ icon === "wallet" ? /* @__PURE__ */ jsx25(
13733
+ "svg",
13734
+ {
13735
+ style: {
13736
+ width: "0.75rem",
13737
+ height: "0.75rem",
13738
+ color: colors.primary,
13739
+ flexShrink: 0
13740
+ },
13741
+ viewBox: "0 0 24 24",
13742
+ fill: "none",
13743
+ stroke: "currentColor",
13744
+ strokeWidth: 2,
13745
+ children: /* @__PURE__ */ jsx25(
13746
+ "path",
13747
+ {
13748
+ strokeLinecap: "round",
13749
+ strokeLinejoin: "round",
13750
+ d: "M21 12a2.25 2.25 0 0 0-2.25-2.25H15a3 3 0 1 1-6 0H5.25A2.25 2.25 0 0 0 3 12m18 0v6a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 18v-6m18 0V9M3 12V9m18-3H3m18 0a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6"
13751
+ }
13752
+ )
13753
+ }
13754
+ ) : /* @__PURE__ */ jsx25(
13755
+ "svg",
13756
+ {
13757
+ style: {
13758
+ width: "0.75rem",
13759
+ height: "0.75rem",
13760
+ color: colors.primary,
13761
+ flexShrink: 0
13762
+ },
13763
+ viewBox: "0 0 24 24",
13764
+ fill: "none",
13765
+ stroke: "currentColor",
13766
+ strokeWidth: 2,
13767
+ children: /* @__PURE__ */ jsx25(
13768
+ "path",
13769
+ {
13770
+ strokeLinecap: "round",
13771
+ strokeLinejoin: "round",
13772
+ d: "M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"
13773
+ }
13774
+ )
13775
+ }
13776
+ ),
13777
+ /* @__PURE__ */ jsx25(
13778
+ "span",
13779
+ {
13780
+ style: {
13781
+ fontSize: "0.75rem",
13782
+ lineHeight: "1rem",
13783
+ fontWeight: fontWeight.medium,
13784
+ color: colors.primary
13785
+ },
13786
+ children
13787
+ }
13788
+ )
13789
+ ]
13790
+ }
13791
+ );
13792
+ }
12575
13793
  function TokenSelectorPanel({
12576
13794
  filteredTokens,
12577
13795
  filteredWalletTokens,
@@ -12584,9 +13802,10 @@ function TokenSelectorPanel({
12584
13802
  searchQuery,
12585
13803
  selectedChain,
12586
13804
  setSearchQuery,
12587
- tokensError,
12588
- walletAddress
13805
+ tokensError
12589
13806
  }) {
13807
+ const hasWalletTokens = filteredWalletTokens.length > 0;
13808
+ const hasPopularTokens = filteredTokens.length > 0;
12590
13809
  return /* @__PURE__ */ jsxs22(
12591
13810
  "div",
12592
13811
  {
@@ -12597,61 +13816,20 @@ function TokenSelectorPanel({
12597
13816
  overflow: "hidden"
12598
13817
  },
12599
13818
  children: [
12600
- /* @__PURE__ */ jsxs22(
13819
+ /* @__PURE__ */ jsx25(
12601
13820
  "div",
12602
13821
  {
12603
13822
  style: {
12604
- padding: `${spacing[2]} ${spacing[3]}`,
12605
- borderBottom: `1px solid rgba(63, 63, 70, 0.5)`
13823
+ padding: `${spacing[2]} ${spacing[2]}`,
13824
+ borderBottom: `1px solid ${colors.border}`
12606
13825
  },
12607
- children: [
12608
- /* @__PURE__ */ jsxs22(
12609
- "div",
12610
- {
12611
- style: {
12612
- display: "flex",
12613
- alignItems: "center",
12614
- gap: spacing[2],
12615
- marginBottom: spacing[2]
12616
- },
12617
- children: [
12618
- /* @__PURE__ */ jsx25(
12619
- "span",
12620
- {
12621
- style: {
12622
- fontSize: fontSize.xs,
12623
- fontWeight: fontWeight.medium,
12624
- color: colors.mutedForeground,
12625
- textTransform: "uppercase",
12626
- letterSpacing: "0.05em"
12627
- },
12628
- children: "Token"
12629
- }
12630
- ),
12631
- walletAddress && /* @__PURE__ */ jsx25(
12632
- "span",
12633
- {
12634
- style: {
12635
- fontSize: "10px",
12636
- color: colors.primary,
12637
- backgroundColor: "rgba(59, 130, 246, 0.1)",
12638
- padding: `${spacing[0.5]} ${spacing[1.5]}`,
12639
- borderRadius: borderRadius.md
12640
- },
12641
- children: "Wallet Connected"
12642
- }
12643
- )
12644
- ]
12645
- }
12646
- ),
12647
- selectedChain ? /* @__PURE__ */ jsx25(
12648
- TokenSearchInput,
12649
- {
12650
- searchQuery,
12651
- setSearchQuery
12652
- }
12653
- ) : null
12654
- ]
13826
+ children: /* @__PURE__ */ jsx25(
13827
+ TokenSearchInput,
13828
+ {
13829
+ searchQuery,
13830
+ setSearchQuery
13831
+ }
13832
+ )
12655
13833
  }
12656
13834
  ),
12657
13835
  /* @__PURE__ */ jsx25(
@@ -12660,115 +13838,99 @@ function TokenSelectorPanel({
12660
13838
  style: {
12661
13839
  flex: 1,
12662
13840
  overflowY: "auto",
12663
- padding: `${spacing[2]} ${spacing[1]}`
13841
+ padding: `${spacing[1]} ${spacing[1]}`
12664
13842
  },
12665
- children: !selectedChain || isLoadingTokens || tokensError || filteredTokens.length === 0 ? /* @__PURE__ */ jsx25(
13843
+ children: !selectedChain ? /* @__PURE__ */ jsx25(
12666
13844
  TokenSelectorStateView,
12667
13845
  {
12668
13846
  isLoadingTokens,
12669
13847
  searchQuery,
12670
13848
  setSearchQuery,
12671
- state: !selectedChain ? "no-chain" : tokensError ? "error" : "empty",
12672
- tokensError
13849
+ state: "no-chain",
13850
+ tokensError: null
12673
13851
  }
12674
- ) : /* @__PURE__ */ jsxs22(
12675
- "div",
13852
+ ) : isLoadingTokens && !hasWalletTokens ? /* @__PURE__ */ jsx25(
13853
+ TokenSelectorStateView,
12676
13854
  {
12677
- style: {
12678
- display: "flex",
12679
- flexDirection: "column",
12680
- gap: spacing[0.5]
12681
- },
12682
- children: [
12683
- filteredWalletTokens.length > 0 ? /* @__PURE__ */ jsx25(
12684
- "div",
12685
- {
12686
- style: {
12687
- display: "flex",
12688
- alignItems: "center",
12689
- gap: "0.375rem",
12690
- paddingLeft: "0.5rem",
12691
- paddingRight: "0.5rem",
12692
- marginBottom: spacing[2]
12693
- },
12694
- children: /* @__PURE__ */ jsx25(
12695
- "span",
12696
- {
12697
- style: {
12698
- fontSize: "0.75rem",
12699
- lineHeight: "1rem",
12700
- color: colors.primary
12701
- },
12702
- children: "Your tokens"
12703
- }
12704
- )
12705
- }
12706
- ) : null,
12707
- filteredWalletTokens.map((token, i) => /* @__PURE__ */ jsx25(
12708
- WalletTokenListItem,
12709
- {
12710
- token,
12711
- onSelect: onSelectWalletToken
13855
+ isLoadingTokens: true,
13856
+ searchQuery,
13857
+ setSearchQuery,
13858
+ state: "empty",
13859
+ tokensError: null
13860
+ }
13861
+ ) : tokensError && !hasWalletTokens ? /* @__PURE__ */ jsx25(
13862
+ TokenSelectorStateView,
13863
+ {
13864
+ isLoadingTokens: false,
13865
+ searchQuery,
13866
+ setSearchQuery,
13867
+ state: "error",
13868
+ tokensError
13869
+ }
13870
+ ) : /* @__PURE__ */ jsxs22("div", { style: { display: "flex", flexDirection: "column" }, children: [
13871
+ hasWalletTokens && /* @__PURE__ */ jsxs22(Fragment4, { children: [
13872
+ /* @__PURE__ */ jsx25(TokenSectionLabel, { icon: "wallet", children: "Your tokens" }),
13873
+ filteredWalletTokens.map((token, i) => /* @__PURE__ */ jsx25(
13874
+ WalletTokenListItem,
13875
+ {
13876
+ token,
13877
+ onSelect: onSelectWalletToken
13878
+ },
13879
+ `${token.address}-${i}`
13880
+ ))
13881
+ ] }),
13882
+ isLoadingTokens ? /* @__PURE__ */ jsx25(
13883
+ TokenSelectorStateView,
13884
+ {
13885
+ isLoadingTokens: true,
13886
+ searchQuery,
13887
+ setSearchQuery,
13888
+ state: "empty",
13889
+ tokensError: null
13890
+ }
13891
+ ) : hasPopularTokens ? /* @__PURE__ */ jsxs22(Fragment4, { children: [
13892
+ /* @__PURE__ */ jsx25(TokenSectionLabel, { icon: "spark", children: "Popular tokens" }),
13893
+ filteredTokens.map((token, i) => /* @__PURE__ */ jsx25(
13894
+ AvailableTokenListItem,
13895
+ {
13896
+ token,
13897
+ onSelect: onSelectToken
13898
+ },
13899
+ `${token.address}-${i}`
13900
+ )),
13901
+ hasNextPage ? /* @__PURE__ */ jsx25(
13902
+ "button",
13903
+ {
13904
+ type: "button",
13905
+ onClick: () => {
13906
+ void loadMore();
12712
13907
  },
12713
- `${token.address}-${i}`
12714
- )),
12715
- /* @__PURE__ */ jsx25(
12716
- "div",
12717
- {
12718
- style: {
12719
- display: "flex",
12720
- alignItems: "center",
12721
- gap: "0.375rem",
12722
- paddingLeft: "0.5rem",
12723
- paddingRight: "0.5rem",
12724
- marginBottom: spacing[2]
12725
- },
12726
- children: /* @__PURE__ */ jsx25(
12727
- "span",
12728
- {
12729
- style: {
12730
- fontSize: "0.75rem",
12731
- lineHeight: "1rem",
12732
- color: colors.primary
12733
- },
12734
- children: "Popular tokens"
12735
- }
12736
- )
12737
- }
12738
- ),
12739
- filteredTokens.map((token, i) => /* @__PURE__ */ jsx25(
12740
- AvailableTokenListItem,
12741
- {
12742
- token,
12743
- onSelect: onSelectToken
13908
+ disabled: isLoadingMore,
13909
+ style: {
13910
+ marginTop: spacing[2],
13911
+ marginLeft: spacing[2],
13912
+ marginRight: spacing[2],
13913
+ padding: `${spacing[2]} ${spacing[3]}`,
13914
+ borderRadius: borderRadius.lg,
13915
+ border: `1px solid ${colors.border}`,
13916
+ backgroundColor: colors.card,
13917
+ color: colors.foreground,
13918
+ cursor: isLoadingMore ? "wait" : "pointer"
12744
13919
  },
12745
- `${token.address}-${i}`
12746
- )),
12747
- hasNextPage ? /* @__PURE__ */ jsx25(
12748
- "button",
12749
- {
12750
- type: "button",
12751
- onClick: () => {
12752
- void loadMore();
12753
- },
12754
- disabled: isLoadingMore,
12755
- style: {
12756
- marginTop: spacing[2],
12757
- marginLeft: spacing[2],
12758
- marginRight: spacing[2],
12759
- padding: `${spacing[2]} ${spacing[3]}`,
12760
- borderRadius: borderRadius.lg,
12761
- border: `1px solid ${colors.border}`,
12762
- backgroundColor: colors.card,
12763
- color: colors.foreground,
12764
- cursor: isLoadingMore ? "wait" : "pointer"
12765
- },
12766
- children: isLoadingMore ? "Loading more..." : "Load more"
12767
- }
12768
- ) : null
12769
- ]
12770
- }
12771
- )
13920
+ children: isLoadingMore ? "Loading more..." : "Load more"
13921
+ }
13922
+ ) : null
13923
+ ] }) : !hasWalletTokens ? /* @__PURE__ */ jsx25(
13924
+ TokenSelectorStateView,
13925
+ {
13926
+ isLoadingTokens: false,
13927
+ searchQuery,
13928
+ setSearchQuery,
13929
+ state: "empty",
13930
+ tokensError: null
13931
+ }
13932
+ ) : null
13933
+ ] })
12772
13934
  }
12773
13935
  )
12774
13936
  ]
@@ -12787,7 +13949,7 @@ var init_TokenSelectorPanel = __esm({
12787
13949
  });
12788
13950
 
12789
13951
  // src/widget/features/token-selection/hooks/useOrderedWalletTokens.ts
12790
- import { useCallback as useCallback16, useMemo as useMemo12 } from "react";
13952
+ import { useCallback as useCallback16, useMemo as useMemo13 } from "react";
12791
13953
  function useOrderedWalletTokens({
12792
13954
  amount,
12793
13955
  amountInputMode,
@@ -12805,7 +13967,7 @@ function useOrderedWalletTokens({
12805
13967
  },
12806
13968
  [setSelectedChain, setSelectedToken]
12807
13969
  );
12808
- const orderedTokens = useMemo12(() => {
13970
+ const orderedTokens = useMemo13(() => {
12809
13971
  const selectedTokenChainType = selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType;
12810
13972
  const index = yourWalletTokens.findIndex(
12811
13973
  (token) => normalizeAddress2(
@@ -12881,7 +14043,7 @@ var init_useOrderedWalletTokens = __esm({
12881
14043
  });
12882
14044
 
12883
14045
  // src/widget/features/token-selection/hooks/useSelectTokenModel.ts
12884
- import { useCallback as useCallback17, useMemo as useMemo13 } from "react";
14046
+ import { useCallback as useCallback17, useMemo as useMemo14 } from "react";
12885
14047
  function useSelectTokenModel({
12886
14048
  goBack,
12887
14049
  searchQuery,
@@ -12960,7 +14122,7 @@ function useSelectTokenModel({
12960
14122
  const address = token.address?.toLowerCase() ?? "";
12961
14123
  return symbol.includes(normalizedSearchQuery) || name.includes(normalizedSearchQuery) || address.includes(normalizedSearchQuery);
12962
14124
  };
12963
- const filteredWalletTokens = useMemo13(() => {
14125
+ const filteredWalletTokens = useMemo14(() => {
12964
14126
  if (!selectedChain?.chainId) {
12965
14127
  return [];
12966
14128
  }
@@ -13151,7 +14313,7 @@ var init_AmountBalanceRow = __esm({
13151
14313
  });
13152
14314
 
13153
14315
  // src/widget/features/amount/components/AmountConversionRow.tsx
13154
- import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
14316
+ import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
13155
14317
  function formatTokenAmount(value) {
13156
14318
  const amount = Number(value ?? 0);
13157
14319
  if (amount <= 0) return "0";
@@ -13183,11 +14345,11 @@ function AmountConversionRow({
13183
14345
  fontSize: fontSize.lg,
13184
14346
  color: colors.mutedForeground
13185
14347
  },
13186
- children: amountInputMode === "usd" ? /* @__PURE__ */ jsxs24(Fragment4, { children: [
14348
+ children: amountInputMode === "usd" ? /* @__PURE__ */ jsxs24(Fragment5, { children: [
13187
14349
  formatTokenAmount(amountComputation.tokenAmount),
13188
14350
  " ",
13189
14351
  selectedTokenSymbol
13190
- ] }) : /* @__PURE__ */ jsx27(Fragment4, { children: hasUsdPrice ? formatUsdAmount2(amountComputation.usdAmount) : "USD pricing unavailable" })
14352
+ ] }) : /* @__PURE__ */ jsx27(Fragment5, { children: hasUsdPrice ? formatUsdAmount2(amountComputation.usdAmount) : "USD pricing unavailable" })
13191
14353
  }
13192
14354
  ),
13193
14355
  /* @__PURE__ */ jsx27(
@@ -13228,7 +14390,7 @@ var init_AmountConversionRow = __esm({
13228
14390
  });
13229
14391
 
13230
14392
  // src/widget/features/amount/components/AmountFeeSummary.tsx
13231
- import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
14393
+ import { Fragment as Fragment6, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
13232
14394
  function formatEstimatedReceive(estimatedReceive, parsedAmount) {
13233
14395
  if (estimatedReceive) {
13234
14396
  return `~$${parseFloat(estimatedReceive).toLocaleString(void 0, {
@@ -13306,7 +14468,7 @@ function AmountFeeSummary({
13306
14468
  },
13307
14469
  children: "Enter an amount to continue."
13308
14470
  }
13309
- ) }) : /* @__PURE__ */ jsxs25(Fragment5, { children: [
14471
+ ) }) : /* @__PURE__ */ jsxs25(Fragment6, { children: [
13310
14472
  /* @__PURE__ */ jsxs25("div", { style: feeSummaryRowStyle, children: [
13311
14473
  /* @__PURE__ */ jsx28("span", { style: { color: colors.mutedForeground }, children: "Network fee" }),
13312
14474
  isGasSponsored ? /* @__PURE__ */ jsx28(
@@ -13331,7 +14493,7 @@ function AmountFeeSummary({
13331
14493
  6
13332
14494
  ) })
13333
14495
  ] }),
13334
- relayFeeUsd != null && relayFeeUsd > 0 && /* @__PURE__ */ jsxs25(Fragment5, { children: [
14496
+ relayFeeUsd != null && relayFeeUsd > 0 && /* @__PURE__ */ jsxs25(Fragment6, { children: [
13335
14497
  /* @__PURE__ */ jsx28("div", { style: feeSummaryDividerStyle }),
13336
14498
  /* @__PURE__ */ jsxs25("div", { style: feeSummaryRowStyle, children: [
13337
14499
  /* @__PURE__ */ jsx28("span", { style: { color: colors.mutedForeground }, children: "Bridge relay fee" }),
@@ -13537,7 +14699,7 @@ var init_CryptoPayAmountSection = __esm({
13537
14699
  });
13538
14700
 
13539
14701
  // src/widget/features/amount/hooks/useDepositAmountModel.ts
13540
- import { useEffect as useEffect20, useMemo as useMemo14 } from "react";
14702
+ import { useEffect as useEffect20, useMemo as useMemo15 } from "react";
13541
14703
  function useDepositAmountModel({
13542
14704
  amount,
13543
14705
  setAmount,
@@ -13551,7 +14713,7 @@ function useDepositAmountModel({
13551
14713
  }) {
13552
14714
  const tokenPriceUSD = typeof selectedToken?.usdPrice === "number" && Number.isFinite(selectedToken.usdPrice) && selectedToken.usdPrice > 0 ? selectedToken.usdPrice : 0;
13553
14715
  const hasUsdPrice = typeof tokenPriceUSD === "number" && Number.isFinite(tokenPriceUSD) && tokenPriceUSD > 0;
13554
- const normalizedTokenBalance = useMemo14(() => {
14716
+ const normalizedTokenBalance = useMemo15(() => {
13555
14717
  if (!selectedToken?.balance) return 0;
13556
14718
  const normalized = Number(
13557
14719
  rawToDecimal(selectedToken.balance, selectedToken.decimals ?? 18)
@@ -13585,7 +14747,7 @@ function useDepositAmountModel({
13585
14747
  setAmount,
13586
14748
  setAmountInputMode
13587
14749
  ]);
13588
- const amountComputation = useMemo14(() => {
14750
+ const amountComputation = useMemo15(() => {
13589
14751
  const rawAmount = (fixedFromAmountString ?? amount)?.trim();
13590
14752
  if (!rawAmount) {
13591
14753
  return {
@@ -13652,11 +14814,11 @@ function useDepositAmountModel({
13652
14814
  selectedToken?.decimals,
13653
14815
  tokenPriceUSD
13654
14816
  ]);
13655
- const requestedTokenAmount = useMemo14(() => {
14817
+ const requestedTokenAmount = useMemo15(() => {
13656
14818
  const tokenAmount = Number(amountComputation.tokenAmount);
13657
14819
  return Number.isFinite(tokenAmount) ? tokenAmount : 0;
13658
14820
  }, [amountComputation.tokenAmount]);
13659
- const amountValidationError = useMemo14(() => {
14821
+ const amountValidationError = useMemo15(() => {
13660
14822
  if (amountComputation.parseError) {
13661
14823
  return amountComputation.parseError;
13662
14824
  }
@@ -13689,17 +14851,17 @@ function useDepositAmountModel({
13689
14851
  ]);
13690
14852
  const amountWei = amountValidationError ? 0n : amountComputation.fromAmountWei ?? 0n;
13691
14853
  const parsedAmount = parseFloat(fixedFromAmountString ?? amount) || 0;
13692
- const maxTokenAmount = useMemo14(() => {
14854
+ const maxTokenAmount = useMemo15(() => {
13693
14855
  const cap = Math.min(normalizedTokenBalance, 1e4);
13694
14856
  const token = selectedToken;
13695
14857
  const isSolNative = token?.category === "native" && typeof token.chain_key === "string" && token.chain_key.toLowerCase().includes("solana");
13696
14858
  return isSolNative ? Math.max(0, cap - 0.01) : cap;
13697
14859
  }, [normalizedTokenBalance, selectedToken]);
13698
- const maxUsdAmount = useMemo14(() => {
14860
+ const maxUsdAmount = useMemo15(() => {
13699
14861
  if (!hasUsdPrice) return void 0;
13700
14862
  return Math.min(maxTokenAmount * tokenPriceUSD, 1e4);
13701
14863
  }, [hasUsdPrice, maxTokenAmount, tokenPriceUSD]);
13702
- const minAmountForMode = useMemo14(() => {
14864
+ const minAmountForMode = useMemo15(() => {
13703
14865
  if (minAmountUsd == null) return 0;
13704
14866
  if (amountInputMode === "usd") {
13705
14867
  return minAmountUsd;
@@ -13708,11 +14870,11 @@ function useDepositAmountModel({
13708
14870
  return minAmountUsd / tokenPriceUSD;
13709
14871
  }, [amountInputMode, hasUsdPrice, minAmountUsd, tokenPriceUSD]);
13710
14872
  const sliderMax = amountInputMode === "usd" ? maxUsdAmount : maxTokenAmount;
13711
- const effectiveSliderMax = useMemo14(() => {
14873
+ const effectiveSliderMax = useMemo15(() => {
13712
14874
  if (sliderMax == null || !Number.isFinite(sliderMax)) return void 0;
13713
14875
  return Math.max(sliderMax, 0);
13714
14876
  }, [sliderMax]);
13715
- const effectiveSliderMin = useMemo14(() => {
14877
+ const effectiveSliderMin = useMemo15(() => {
13716
14878
  if (effectiveSliderMax == null || !Number.isFinite(effectiveSliderMax) || effectiveSliderMax <= 0) {
13717
14879
  return 0;
13718
14880
  }
@@ -13748,7 +14910,7 @@ var init_useDepositAmountModel = __esm({
13748
14910
  });
13749
14911
 
13750
14912
  // src/widget/features/amount/hooks/useHomeAmountModel.ts
13751
- import { useEffect as useEffect21, useMemo as useMemo15 } from "react";
14913
+ import { useEffect as useEffect21, useMemo as useMemo16 } from "react";
13752
14914
  function useHomeAmountModel({
13753
14915
  amount,
13754
14916
  setAmount,
@@ -13775,7 +14937,7 @@ function useHomeAmountModel({
13775
14937
  setAmountInputMode
13776
14938
  ]);
13777
14939
  const parsedAmount = parseFloat(fixedFromAmountString ?? amount) || 0;
13778
- const amountValidationMessage = useMemo15(() => {
14940
+ const amountValidationMessage = useMemo16(() => {
13779
14941
  const rawAmount = (fixedFromAmountString ?? amount)?.trim();
13780
14942
  if (!rawAmount) return null;
13781
14943
  if (!/^\d*\.?\d*$/.test(rawAmount)) {
@@ -14698,7 +15860,7 @@ var init_HomePaymentOptions = __esm({
14698
15860
  });
14699
15861
 
14700
15862
  // src/widget/features/wallet/hooks/useHomeWalletActions.ts
14701
- import { useCallback as useCallback18, useEffect as useEffect22, useMemo as useMemo16, useRef as useRef10, useState as useState21 } from "react";
15863
+ import { useCallback as useCallback18, useEffect as useEffect22, useMemo as useMemo17, useRef as useRef10, useState as useState22 } from "react";
14702
15864
  function useHomeWalletActions({
14703
15865
  connectWallet,
14704
15866
  detectedWallets,
@@ -14707,8 +15869,8 @@ function useHomeWalletActions({
14707
15869
  WalletConnect
14708
15870
  // setCurrentStepInternal,
14709
15871
  }) {
14710
- const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState21(false);
14711
- const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState21(false);
15872
+ const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState22(false);
15873
+ const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState22(false);
14712
15874
  const cryptoDropdownRef = useRef10(null);
14713
15875
  const fiatDropdownRef = useRef10(null);
14714
15876
  const { disconnect } = useWalletInfo();
@@ -14759,7 +15921,7 @@ function useHomeWalletActions({
14759
15921
  WalletConnect().catch(() => resetNavigation());
14760
15922
  }, [setYourWalletTokens, disconnect]);
14761
15923
  const { selectedNamespace } = useDepositWallet();
14762
- const browserWallets = useMemo16(() => {
15924
+ const browserWallets = useMemo17(() => {
14763
15925
  if (!detectedWallets?.length) return [];
14764
15926
  return detectedWallets.filter(
14765
15927
  (wallet) => wallet?.meta?.id !== "walletconnect" && wallet?.meta?.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase()
@@ -15171,7 +16333,7 @@ var init_relayFeeUtils = __esm({
15171
16333
  });
15172
16334
 
15173
16335
  // src/widget/features/route-preview/hooks/useRoutePreviewModel.ts
15174
- import { useMemo as useMemo17 } from "react";
16336
+ import { useMemo as useMemo18 } from "react";
15175
16337
  function useRoutePreviewModel({
15176
16338
  amountUsd,
15177
16339
  amountValidationError,
@@ -15184,7 +16346,7 @@ function useRoutePreviewModel({
15184
16346
  walletAddress
15185
16347
  }) {
15186
16348
  const { chains } = useChains();
15187
- const destinationConfig = useMemo17(
16349
+ const destinationConfig = useMemo18(
15188
16350
  () => ({
15189
16351
  dappName: config.messages?.title || "DApp",
15190
16352
  toChain: config.routes.toChain,
@@ -15198,7 +16360,7 @@ function useRoutePreviewModel({
15198
16360
  config.routes.toToken
15199
16361
  ]
15200
16362
  );
15201
- const routeConfig = useMemo17(() => {
16363
+ const routeConfig = useMemo18(() => {
15202
16364
  const toChainId = config.routes.toChain;
15203
16365
  const toChainKey = normalizeChainKey2(toChainId);
15204
16366
  const toChain = toChainKey ? chains.find(
@@ -15235,7 +16397,7 @@ function useRoutePreviewModel({
15235
16397
  ...routeConfig,
15236
16398
  enabled: !!isReady
15237
16399
  });
15238
- const routePrerequisiteError = useMemo17(() => {
16400
+ const routePrerequisiteError = useMemo18(() => {
15239
16401
  if (!isReady) return;
15240
16402
  if (!selectedChain) {
15241
16403
  return "Select a source chain to fetch a route.";
@@ -28977,7 +30139,7 @@ var init_smart_account2 = __esm({
28977
30139
  });
28978
30140
 
28979
30141
  // src/widget/features/transaction/hooks/useTransactionActionModel.ts
28980
- import { useCallback as useCallback19, useEffect as useEffect23, useMemo as useMemo18, useRef as useRef11, useState as useState22 } from "react";
30142
+ import { useCallback as useCallback19, useEffect as useEffect23, useMemo as useMemo19, useRef as useRef11, useState as useState23 } from "react";
28981
30143
  import { encodeFunctionData as encodeFunctionData8, erc20Abi } from "viem";
28982
30144
  function normalizeTokenAddressForCompare(chain, addr) {
28983
30145
  const chainType = (chain.type ?? chain.chainType ?? "").toLowerCase();
@@ -29012,7 +30174,7 @@ function useTransactionActionModel({
29012
30174
  const chainType = selectedChain?.type ?? selectedChain?.chainType;
29013
30175
  const chainTypeNormalized = (chainType ?? "").toLowerCase();
29014
30176
  const isEvm = chainTypeNormalized === "evm";
29015
- const backendChainId2 = useMemo18(() => {
30177
+ const backendChainId2 = useMemo19(() => {
29016
30178
  const chainRef = routeResult?.txReq?.chainId ?? selectedChain?.networkIdentifier ?? selectedChain?.chainId ?? selectedChain?.id;
29017
30179
  if (chainRef == null) return null;
29018
30180
  return String(chainRef);
@@ -29022,7 +30184,7 @@ function useTransactionActionModel({
29022
30184
  selectedChain?.id,
29023
30185
  selectedChain?.networkIdentifier
29024
30186
  ]);
29025
- const selectedTokenOnBackendChain = useMemo18(() => {
30187
+ const selectedTokenOnBackendChain = useMemo19(() => {
29026
30188
  if (!backendChainId2) return false;
29027
30189
  const target = normalizeChainKey2(backendChainId2);
29028
30190
  return [
@@ -29039,22 +30201,22 @@ function useTransactionActionModel({
29039
30201
  selectedChain?.id,
29040
30202
  selectedChain?.networkIdentifier
29041
30203
  ]);
29042
- const isNativeSelected = useMemo18(() => {
30204
+ const isNativeSelected = useMemo19(() => {
29043
30205
  const address = selectedToken?.address;
29044
30206
  return isNativeTokenAddress(address, chainType) || isZeroAddrLike(address, chainType) || normalizeTokenAddressForCompare(selectedChain, address) === normalizeTokenAddressForCompare(
29045
30207
  selectedChain,
29046
30208
  getNativeTokenAddress2(chainType)
29047
30209
  );
29048
30210
  }, [chainType, selectedChain, selectedToken?.address]);
29049
- const spender = useMemo18(() => {
30211
+ const spender = useMemo19(() => {
29050
30212
  const txReq = routeResult?.txReq;
29051
30213
  const addr = txReq?.to ?? txReq?.target;
29052
30214
  return addr ?? null;
29053
30215
  }, [routeResult?.txReq]);
29054
- const [allowanceWei, setAllowanceWei] = useState22(0n);
29055
- const [isReadingAllowance, setIsReadingAllowance] = useState22(false);
29056
- const [isApproving, setIsApproving] = useState22(false);
29057
- const [gasReservationWei, setGasReservationWei] = useState22(0n);
30216
+ const [allowanceWei, setAllowanceWei] = useState23(0n);
30217
+ const [isReadingAllowance, setIsReadingAllowance] = useState23(false);
30218
+ const [isApproving, setIsApproving] = useState23(false);
30219
+ const [gasReservationWei, setGasReservationWei] = useState23(0n);
29058
30220
  const readAllowance = useCallback19(async () => {
29059
30221
  if (!isEvm || isNativeSelected || !!routeResult?.sponsorship || // sponsored routes: SA approves bridge inside the UO batch
29060
30222
  !backendChainId2 || !selectedTokenOnBackendChain || !walletAddress || !spender || !selectedToken?.address) {
@@ -29294,7 +30456,7 @@ function useTransactionActionModel({
29294
30456
  void estimateGasReservationWei();
29295
30457
  }
29296
30458
  }, [estimateGasReservationWei, routeResult]);
29297
- const [smartAccountFailed, setSmartAccountFailed] = useState22(false);
30459
+ const [smartAccountFailed, setSmartAccountFailed] = useState23(false);
29298
30460
  useEffect23(() => {
29299
30461
  setSmartAccountFailed(false);
29300
30462
  }, [routeResult?.intentId]);
@@ -29399,7 +30561,7 @@ function useTransactionActionModel({
29399
30561
  ]);
29400
30562
  const isWalletConnected = walletStatus === "connected";
29401
30563
  const canSwipe = parsedAmount > 0 && !!selectedToken && isWalletConnected && !isLoadingRoute && !isSubmitting && !!routeResult && !actionErrorMessage && !isApproving && !isReadingAllowance;
29402
- const swipeResetKey = useMemo18(() => {
30564
+ const swipeResetKey = useMemo19(() => {
29403
30565
  const tokenAddress = selectedToken ? normalizeAddress2(
29404
30566
  selectedToken.address,
29405
30567
  selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType
@@ -29630,8 +30792,8 @@ var init_DefaultCryptoPay = __esm({
29630
30792
  });
29631
30793
 
29632
30794
  // src/widget/pages/CryptoPay/index.tsx
29633
- import { useEffect as useEffect24, useMemo as useMemo19 } from "react";
29634
- import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
30795
+ import { useEffect as useEffect24, useMemo as useMemo20 } from "react";
30796
+ import { Fragment as Fragment7, jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
29635
30797
  function CryptoPay({ style: _style }) {
29636
30798
  const {
29637
30799
  amount,
@@ -29654,17 +30816,17 @@ function CryptoPay({ style: _style }) {
29654
30816
  const { goBack, setCurrentStep, currentStep } = useDepositNavigation();
29655
30817
  const config = useTrustwareConfig();
29656
30818
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
29657
- const routeRefreshMs = useMemo19(() => {
30819
+ const routeRefreshMs = useMemo20(() => {
29658
30820
  const raw = config.routes?.options?.routeRefreshMs;
29659
30821
  const n = Number(raw);
29660
30822
  return Number.isFinite(n) && n > 0 ? n : void 0;
29661
30823
  }, [config.routes?.options?.routeRefreshMs]);
29662
30824
  const IsPos = (x) => x !== null && x !== void 0 && x.balance !== "0";
29663
- const showDefaultCryptoPay = useMemo19(() => {
30825
+ const showDefaultCryptoPay = useMemo20(() => {
29664
30826
  const nonZer0Tks = (yourWalletTokens ?? []).filter(IsPos);
29665
30827
  return !yourWalletTokensLoading && nonZer0Tks.length === 0 && yourWalletTokens.length > 0;
29666
30828
  }, [yourWalletTokens, yourWalletTokensLoading]);
29667
- const showSkeleton = useMemo19(() => {
30829
+ const showSkeleton = useMemo20(() => {
29668
30830
  return (yourWalletTokens ?? []).length === 0;
29669
30831
  }, [yourWalletTokens]);
29670
30832
  const isReady = selectedToken != null && selectedToken?.chainData !== void 0 && !showDefaultCryptoPay && !showSkeleton;
@@ -29769,7 +30931,7 @@ function CryptoPay({ style: _style }) {
29769
30931
  if (isFixedAmount) return;
29770
30932
  setAmount(value.toString());
29771
30933
  };
29772
- const relayFeeUsd = useMemo19(
30934
+ const relayFeeUsd = useMemo20(
29773
30935
  () => computeRelayFeeUsd(routeResult, isNativeSelected),
29774
30936
  [isNativeSelected, routeResult]
29775
30937
  );
@@ -29870,7 +31032,7 @@ function CryptoPay({ style: _style }) {
29870
31032
  ]
29871
31033
  }
29872
31034
  ),
29873
- showSkeleton ? /* @__PURE__ */ jsx49(Fragment6, { children: /* @__PURE__ */ jsx49(
31035
+ showSkeleton ? /* @__PURE__ */ jsx49(Fragment7, { children: /* @__PURE__ */ jsx49(
29874
31036
  "div",
29875
31037
  {
29876
31038
  style: {
@@ -29881,8 +31043,8 @@ function CryptoPay({ style: _style }) {
29881
31043
  },
29882
31044
  children: /* @__PURE__ */ jsx49(LoadingSkeleton, {})
29883
31045
  }
29884
- ) }) : /* @__PURE__ */ jsxs39(Fragment6, { children: [
29885
- isReady && /* @__PURE__ */ jsxs39(Fragment6, { children: [
31046
+ ) }) : /* @__PURE__ */ jsxs39(Fragment7, { children: [
31047
+ isReady && /* @__PURE__ */ jsxs39(Fragment7, { children: [
29886
31048
  /* @__PURE__ */ jsx49(
29887
31049
  CryptoPayAmountSection,
29888
31050
  {
@@ -29960,7 +31122,7 @@ var init_CryptoPay = __esm({
29960
31122
  });
29961
31123
 
29962
31124
  // src/widget/pages/Processing.tsx
29963
- import { useEffect as useEffect25, useMemo as useMemo20, useRef as useRef12 } from "react";
31125
+ import { useEffect as useEffect25, useMemo as useMemo21, useRef as useRef12 } from "react";
29964
31126
  import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
29965
31127
  function getProgressFromStatus(status) {
29966
31128
  switch (status) {
@@ -30011,15 +31173,15 @@ function Processing({ style }) {
30011
31173
  startPolling(intentId, transactionHash);
30012
31174
  }
30013
31175
  }, [intentId, transactionHash, isPolling, transactionStatus, startPolling]);
30014
- const progress = useMemo20(
31176
+ const progress = useMemo21(
30015
31177
  () => getProgressFromStatus(transactionStatus),
30016
31178
  [transactionStatus]
30017
31179
  );
30018
- const stepText = useMemo20(
31180
+ const stepText = useMemo21(
30019
31181
  () => getStepText(transactionStatus),
30020
31182
  [transactionStatus]
30021
31183
  );
30022
- const explorerUrl = useMemo20(() => {
31184
+ const explorerUrl = useMemo21(() => {
30023
31185
  if (transaction?.fromChainTxUrl) {
30024
31186
  return transaction.fromChainTxUrl;
30025
31187
  }
@@ -30165,15 +31327,15 @@ var init_Processing = __esm({
30165
31327
  });
30166
31328
 
30167
31329
  // src/widget/pages/Success.tsx
30168
- import { lazy, Suspense, useMemo as useMemo21 } from "react";
31330
+ import { lazy, Suspense, useMemo as useMemo22 } from "react";
30169
31331
  import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
30170
31332
  function Success({ style }) {
30171
31333
  const { selectedToken, selectedChain, amount } = useDepositForm();
30172
31334
  const { resetState } = useDepositNavigation();
30173
31335
  const { transactionHash } = useDepositTransaction();
30174
31336
  const { transaction } = useTransactionPolling();
30175
- const parsedAmount = useMemo21(() => parseFloat(amount) || 0, [amount]);
30176
- const explorerUrl = useMemo21(() => {
31337
+ const parsedAmount = useMemo22(() => parseFloat(amount) || 0, [amount]);
31338
+ const explorerUrl = useMemo22(() => {
30177
31339
  if (transaction?.toChainTxUrl) {
30178
31340
  return transaction.toChainTxUrl;
30179
31341
  }
@@ -30246,7 +31408,7 @@ var init_Success = __esm({
30246
31408
  });
30247
31409
 
30248
31410
  // src/widget/pages/Error.tsx
30249
- import { useMemo as useMemo22, useEffect as useEffect26 } from "react";
31411
+ import { useMemo as useMemo23, useEffect as useEffect26 } from "react";
30250
31412
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
30251
31413
  function categorizeError(errorMessage) {
30252
31414
  if (!errorMessage) return "unknown";
@@ -30334,19 +31496,19 @@ function Error2({ style }) {
30334
31496
  setErrorMessage,
30335
31497
  transactionHash
30336
31498
  } = useDepositTransaction();
30337
- const errorCategory = useMemo22(
31499
+ const errorCategory = useMemo23(
30338
31500
  () => categorizeError(errorMessage),
30339
31501
  [errorMessage]
30340
31502
  );
30341
- const errorTitle = useMemo22(
31503
+ const errorTitle = useMemo23(
30342
31504
  () => getErrorTitle(errorCategory),
30343
31505
  [errorCategory]
30344
31506
  );
30345
- const errorSuggestion = useMemo22(
31507
+ const errorSuggestion = useMemo23(
30346
31508
  () => getErrorSuggestion(errorCategory),
30347
31509
  [errorCategory]
30348
31510
  );
30349
- const retryStep = useMemo22(() => getRetryStep(errorCategory), [errorCategory]);
31511
+ const retryStep = useMemo23(() => getRetryStep(errorCategory), [errorCategory]);
30350
31512
  useEffect26(() => {
30351
31513
  if (errorMessage) {
30352
31514
  try {
@@ -30369,7 +31531,7 @@ function Error2({ style }) {
30369
31531
  const handleStartOver = () => {
30370
31532
  resetState();
30371
31533
  };
30372
- const explorerUrl = useMemo22(() => {
31534
+ const explorerUrl = useMemo23(() => {
30373
31535
  if (transactionHash && selectedChain?.blockExplorerUrls?.length) {
30374
31536
  return `${selectedChain.blockExplorerUrls[0].replace(/\/+$/, "")}/tx/${transactionHash}`;
30375
31537
  }
@@ -30518,18 +31680,18 @@ var init_widgetSteps = __esm({
30518
31680
  });
30519
31681
 
30520
31682
  // src/widget/app/WidgetRouter.tsx
30521
- import { useMemo as useMemo23 } from "react";
31683
+ import { useMemo as useMemo24 } from "react";
30522
31684
  import { jsx as jsx53 } from "react/jsx-runtime";
30523
31685
  function WidgetRouter({
30524
31686
  currentStep,
30525
31687
  navigationDirection,
30526
31688
  stepHistory
30527
31689
  }) {
30528
- const PageComponent = useMemo23(
31690
+ const PageComponent = useMemo24(
30529
31691
  () => PAGE_COMPONENTS[currentStep],
30530
31692
  [currentStep]
30531
31693
  );
30532
- const animationClass = useMemo23(() => {
31694
+ const animationClass = useMemo24(() => {
30533
31695
  return navigationDirection === "forward" ? "tw-animate-slide-in-right" : "tw-animate-slide-in-left";
30534
31696
  }, [navigationDirection]);
30535
31697
  return /* @__PURE__ */ jsx53(
@@ -30557,9 +31719,9 @@ var init_WidgetRouter = __esm({
30557
31719
  });
30558
31720
 
30559
31721
  // src/modes/swap/hooks/useSwapRoute.ts
30560
- import { useCallback as useCallback20, useRef as useRef13, useState as useState23 } from "react";
31722
+ import { useCallback as useCallback20, useRef as useRef13, useState as useState24 } from "react";
30561
31723
  function useSwapRoute() {
30562
- const [state, setState] = useState23({
31724
+ const [state, setState] = useState24({
30563
31725
  data: null,
30564
31726
  loading: false,
30565
31727
  error: null
@@ -30623,7 +31785,7 @@ var init_useSwapRoute = __esm({
30623
31785
  });
30624
31786
 
30625
31787
  // src/modes/swap/hooks/useSwapExecution.ts
30626
- import { useCallback as useCallback21, useRef as useRef14, useState as useState24 } from "react";
31788
+ import { useCallback as useCallback21, useRef as useRef14, useState as useState25 } from "react";
30627
31789
  import { encodeFunctionData as encodeFunctionData9, erc20Abi as erc20Abi2 } from "viem";
30628
31790
  function normalizeTx(raw) {
30629
31791
  const r = raw;
@@ -30658,7 +31820,7 @@ async function waitForApprovalConfirmation(chainId, txHash) {
30658
31820
  throw new Error("Timed out waiting for approval confirmation");
30659
31821
  }
30660
31822
  function useSwapExecution(fromChain) {
30661
- const [state, setState] = useState24({
31823
+ const [state, setState] = useState25({
30662
31824
  txStatus: "idle",
30663
31825
  txHash: null,
30664
31826
  intentId: null,
@@ -31034,11 +32196,11 @@ var init_forex = __esm({
31034
32196
  });
31035
32197
 
31036
32198
  // src/modes/swap/hooks/useForex.ts
31037
- import { useEffect as useEffect27, useRef as useRef15, useState as useState25 } from "react";
32199
+ import { useEffect as useEffect27, useRef as useRef15, useState as useState26 } from "react";
31038
32200
  function useForex() {
31039
- const [rates, setRates] = useState25({ USD: 1 });
31040
- const [error, setError] = useState25(null);
31041
- const [lastUpdated, setLastUpdated] = useState25(null);
32201
+ const [rates, setRates] = useState26({ USD: 1 });
32202
+ const [error, setError] = useState26(null);
32203
+ const [lastUpdated, setLastUpdated] = useState26(null);
31042
32204
  const timerRef = useRef15(null);
31043
32205
  useEffect27(() => {
31044
32206
  let cancelled = false;
@@ -31077,7 +32239,7 @@ var init_useForex = __esm({
31077
32239
  });
31078
32240
 
31079
32241
  // src/modes/swap/components/SwapTokenSelect.tsx
31080
- import { useState as useState26, useMemo as useMemo24, useEffect as useEffect28 } from "react";
32242
+ import { useState as useState27, useMemo as useMemo25, useEffect as useEffect28 } from "react";
31081
32243
  import { jsx as jsx54, jsxs as jsxs43 } from "react/jsx-runtime";
31082
32244
  function SwapTokenSelect({
31083
32245
  side,
@@ -31093,9 +32255,9 @@ function SwapTokenSelect({
31093
32255
  allowedTokens,
31094
32256
  excludeToken
31095
32257
  }) {
31096
- const [localChain, setLocalChain] = useState26(initialChain);
31097
- const [pinnedTokens, setPinnedTokens] = useState26([]);
31098
- const [pinnedLoading, setPinnedLoading] = useState26(false);
32258
+ const [localChain, setLocalChain] = useState27(initialChain);
32259
+ const [pinnedTokens, setPinnedTokens] = useState27([]);
32260
+ const [pinnedLoading, setPinnedLoading] = useState27(false);
31099
32261
  useEffect28(() => {
31100
32262
  if (!allowedTokens || allowedTokens.length === 0 || !localChain) {
31101
32263
  setPinnedTokens([]);
@@ -31177,26 +32339,26 @@ function SwapTokenSelect({
31177
32339
  walletAddress,
31178
32340
  yourWalletTokens
31179
32341
  });
31180
- const allowedSet = useMemo24(() => {
32342
+ const allowedSet = useMemo25(() => {
31181
32343
  if (!allowedTokens || allowedTokens.length === 0) return null;
31182
32344
  return new Set(
31183
32345
  allowedTokens.map((t) => `${t.chainId}:${t.address.toLowerCase()}`)
31184
32346
  );
31185
32347
  }, [allowedTokens]);
31186
- const filteredWalletTokens = useMemo24(() => {
32348
+ const filteredWalletTokens = useMemo25(() => {
31187
32349
  if (!allowedSet) return rawWalletTokens;
31188
32350
  return rawWalletTokens.filter(
31189
32351
  (t) => allowedSet.has(`${Number(t.chainId)}:${t.address.toLowerCase()}`)
31190
32352
  );
31191
32353
  }, [rawWalletTokens, allowedSet]);
31192
32354
  const excludeKey = excludeToken ? `${Number(excludeToken.chainId)}:${excludeToken.address.toLowerCase()}` : null;
31193
- const visibleTokens = useMemo24(() => {
32355
+ const visibleTokens = useMemo25(() => {
31194
32356
  if (!excludeKey) return filteredTokens;
31195
32357
  return filteredTokens.filter(
31196
32358
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
31197
32359
  );
31198
32360
  }, [filteredTokens, excludeKey]);
31199
- const visibleWalletTokens = useMemo24(() => {
32361
+ const visibleWalletTokens = useMemo25(() => {
31200
32362
  if (!excludeKey) return filteredWalletTokens;
31201
32363
  return filteredWalletTokens.filter(
31202
32364
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
@@ -31289,29 +32451,7 @@ function SwapTokenSelect({
31289
32451
  popularChains
31290
32452
  }
31291
32453
  ),
31292
- localChain === null ? /* @__PURE__ */ jsx54(
31293
- "div",
31294
- {
31295
- style: {
31296
- flex: 1,
31297
- display: "flex",
31298
- alignItems: "center",
31299
- justifyContent: "center",
31300
- padding: spacing[4]
31301
- },
31302
- children: /* @__PURE__ */ jsx54(
31303
- "p",
31304
- {
31305
- style: {
31306
- fontSize: fontSize.sm,
31307
- color: colors.mutedForeground,
31308
- textAlign: "center"
31309
- },
31310
- children: "Select a chain to see tokens"
31311
- }
31312
- )
31313
- }
31314
- ) : /* @__PURE__ */ jsx54(
32454
+ /* @__PURE__ */ jsx54(
31315
32455
  TokenSelectorPanel,
31316
32456
  {
31317
32457
  filteredTokens: visibleTokens,
@@ -31347,8 +32487,8 @@ var init_SwapTokenSelect = __esm({
31347
32487
  });
31348
32488
 
31349
32489
  // src/modes/swap/components/SwapWalletSelector.tsx
31350
- import { useEffect as useEffect29, useMemo as useMemo25, useRef as useRef16, useState as useState27 } from "react";
31351
- import { Fragment as Fragment7, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32490
+ import { useEffect as useEffect29, useMemo as useMemo26, useRef as useRef16, useState as useState28 } from "react";
32491
+ import { Fragment as Fragment8, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
31352
32492
  function SwapWalletSelector({
31353
32493
  walletStatus,
31354
32494
  walletAddress,
@@ -31364,10 +32504,10 @@ function SwapWalletSelector({
31364
32504
  } = useWalletInfo();
31365
32505
  const walletConnectCfg = TrustwareConfigStore.peek()?.walletConnect;
31366
32506
  const connectWC = useWalletConnectConnect(walletConnectCfg);
31367
- const [wcConnecting, setWcConnecting] = useState27(false);
31368
- const [connectingId, setConnectingId] = useState27(null);
31369
- const [timerExpired, setTimerExpired] = useState27(false);
31370
- const [selectedNamespace, setSelectedNamespace] = useState27("evm");
32507
+ const [wcConnecting, setWcConnecting] = useState28(false);
32508
+ const [connectingId, setConnectingId] = useState28(null);
32509
+ const [timerExpired, setTimerExpired] = useState28(false);
32510
+ const [selectedNamespace, setSelectedNamespace] = useState28("evm");
31371
32511
  const prevStatusRef = useRef16(walletStatus);
31372
32512
  useEffect29(() => {
31373
32513
  const t = setTimeout(() => setTimerExpired(true), 450);
@@ -31382,7 +32522,7 @@ function SwapWalletSelector({
31382
32522
  prevStatusRef.current = walletStatus;
31383
32523
  }
31384
32524
  }, [walletStatus]);
31385
- const filteredWallets = useMemo25(
32525
+ const filteredWallets = useMemo26(
31386
32526
  () => detected.filter(
31387
32527
  (w) => (w.meta?.ecosystem ?? "").toLowerCase() === selectedNamespace
31388
32528
  ),
@@ -31502,58 +32642,38 @@ function SwapWalletSelector({
31502
32642
  children: "Connect Wallet"
31503
32643
  }
31504
32644
  ),
31505
- /* @__PURE__ */ jsxs44(
32645
+ /* @__PURE__ */ jsx55(
31506
32646
  "div",
31507
32647
  {
31508
32648
  style: {
31509
- position: "relative",
31510
32649
  display: "flex",
31511
32650
  alignItems: "center",
31512
- borderRadius: "9999px",
31513
- background: colors.background,
31514
- border: `1px solid ${colors.mutedForeground}`,
31515
- padding: "3px"
32651
+ borderRadius: borderRadius.lg,
32652
+ backgroundColor: colors.muted,
32653
+ padding: "3px",
32654
+ gap: "2px"
31516
32655
  },
31517
- children: [
31518
- /* @__PURE__ */ jsx55(
31519
- "div",
31520
- {
31521
- style: {
31522
- position: "absolute",
31523
- top: 3,
31524
- bottom: 3,
31525
- width: "calc(50% - 3px)",
31526
- borderRadius: "9999px",
31527
- background: `linear-gradient(to bottom, ${colors.zinc[100]}, ${colors.zinc[200]})`,
31528
- border: `1px solid ${colors.mutedForeground}`,
31529
- transition: "transform 300ms ease-out",
31530
- transform: selectedNamespace === "evm" ? "translateX(0)" : "translateX(100%)"
31531
- }
31532
- }
31533
- ),
31534
- tabs.map((t) => /* @__PURE__ */ jsx55(
31535
- "button",
31536
- {
31537
- onClick: () => setSelectedNamespace(t.id),
31538
- style: {
31539
- position: "relative",
31540
- zIndex: 10,
31541
- padding: "4px 11px",
31542
- fontSize: "10px",
31543
- outline: "none",
31544
- fontWeight: 600,
31545
- borderRadius: "9999px",
31546
- background: "transparent",
31547
- border: "none",
31548
- cursor: "pointer",
31549
- transition: "color 200ms",
31550
- color: selectedNamespace === t.id ? colors.black : colors.mutedForeground
31551
- },
31552
- children: t.label
32656
+ children: tabs.map((t) => /* @__PURE__ */ jsx55(
32657
+ "button",
32658
+ {
32659
+ onClick: () => setSelectedNamespace(t.id),
32660
+ style: {
32661
+ padding: `${spacing[1]} ${spacing[3]}`,
32662
+ fontSize: fontSize.sm,
32663
+ fontWeight: fontWeight.medium,
32664
+ borderRadius: borderRadius.md,
32665
+ background: selectedNamespace === t.id ? colors.card : "transparent",
32666
+ border: selectedNamespace === t.id ? `1px solid ${colors.border}` : "1px solid transparent",
32667
+ cursor: "pointer",
32668
+ transition: "all 0.15s",
32669
+ color: selectedNamespace === t.id ? colors.foreground : colors.mutedForeground,
32670
+ boxShadow: selectedNamespace === t.id ? "0 1px 3px rgba(0,0,0,0.08)" : "none",
32671
+ outline: "none"
31553
32672
  },
31554
- t.id
31555
- ))
31556
- ]
32673
+ children: t.label
32674
+ },
32675
+ t.id
32676
+ ))
31557
32677
  }
31558
32678
  )
31559
32679
  ]
@@ -31826,7 +32946,7 @@ function SwapWalletSelector({
31826
32946
  })
31827
32947
  }
31828
32948
  ),
31829
- selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment7, { children: [
32949
+ selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment8, { children: [
31830
32950
  /* @__PURE__ */ jsx55(
31831
32951
  "div",
31832
32952
  {
@@ -32068,11 +33188,12 @@ import {
32068
33188
  Suspense as Suspense2,
32069
33189
  useCallback as useCallback22,
32070
33190
  useEffect as useEffect30,
32071
- useMemo as useMemo26,
33191
+ useMemo as useMemo27,
32072
33192
  useRef as useRef17,
32073
- useState as useState28
33193
+ useState as useState29
32074
33194
  } from "react";
32075
- import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
33195
+ import ReactDOM from "react-dom";
33196
+ import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
32076
33197
  function fmtAmount(n, max = 6) {
32077
33198
  if (!isFinite(n) || n === 0) return "0";
32078
33199
  return n.toLocaleString(void 0, { maximumFractionDigits: max });
@@ -32161,35 +33282,35 @@ function RateRow({ label, value }) {
32161
33282
  );
32162
33283
  }
32163
33284
  function SwapMode({
32164
- theme = "system",
33285
+ theme: themeProp,
32165
33286
  style
32166
33287
  }) {
32167
- const [stage, setStage] = useState28("home");
32168
- const [fromToken, setFromToken] = useState28(
33288
+ const [stage, setStage] = useState29("home");
33289
+ const [fromToken, setFromToken] = useState29(
32169
33290
  null
32170
33291
  );
32171
- const [fromChain, setFromChain] = useState28(null);
32172
- const [toToken, setToToken] = useState28(null);
32173
- const [toChain, setToChain] = useState28(null);
32174
- const [amount, setAmount] = useState28("");
32175
- const [amountInputMode, setAmountInputMode] = useState28(
33292
+ const [fromChain, setFromChain] = useState29(null);
33293
+ const [toToken, setToToken] = useState29(null);
33294
+ const [toChain, setToChain] = useState29(null);
33295
+ const [amount, setAmount] = useState29("");
33296
+ const [amountInputMode, setAmountInputMode] = useState29(
32176
33297
  "usd"
32177
33298
  );
32178
- const [hoverSell, setHoverSell] = useState28(false);
32179
- const [showRateDetails, setShowRateDetails] = useState28(false);
32180
- const [showReviewDetails, setShowReviewDetails] = useState28(false);
32181
- const [showSettings, setShowSettings] = useState28(false);
32182
- const [maxApproval, setMaxApproval] = useState28(false);
32183
- const [slippage, setSlippage] = useState28(0.5);
32184
- const [slippageInput, setSlippageInput] = useState28("");
32185
- const [selectedCurrency, setSelectedCurrency] = useState28("USD");
32186
- const [showCurrencyDropdown, setShowCurrencyDropdown] = useState28(false);
32187
- const [completedAt, setCompletedAt] = useState28(null);
32188
- const [copiedHash, setCopiedHash] = useState28(null);
32189
- const [rateUpdated, setRateUpdated] = useState28(false);
33299
+ const [hoverSell, setHoverSell] = useState29(false);
33300
+ const [showRateDetails, setShowRateDetails] = useState29(false);
33301
+ const [showReviewDetails, setShowReviewDetails] = useState29(false);
33302
+ const [showSettings, setShowSettings] = useState29(false);
33303
+ const [maxApproval, setMaxApproval] = useState29(false);
33304
+ const [slippage, setSlippage] = useState29(0.5);
33305
+ const [slippageInput, setSlippageInput] = useState29("");
33306
+ const [selectedCurrency, setSelectedCurrency] = useState29("USD");
33307
+ const [showCurrencyDropdown, setShowCurrencyDropdown] = useState29(false);
33308
+ const [completedAt, setCompletedAt] = useState29(null);
33309
+ const [copiedHash, setCopiedHash] = useState29(null);
33310
+ const [rateUpdated, setRateUpdated] = useState29(false);
32190
33311
  const prevToAmountRef = useRef17(null);
32191
- const [destAddress, setDestAddress] = useState28("");
32192
- const [quoteAge, setQuoteAge] = useState28(0);
33312
+ const [destAddress, setDestAddress] = useState29("");
33313
+ const [quoteAge, setQuoteAge] = useState29(0);
32193
33314
  const quoteTimestampRef = useRef17(null);
32194
33315
  const latestFetchParamsRef = useRef17(null);
32195
33316
  const { rates: forexRates } = useForex();
@@ -32210,7 +33331,11 @@ function SwapMode({
32210
33331
  const settingsRef = useRef17(null);
32211
33332
  const currencyDropdownRef = useRef17(null);
32212
33333
  const { emitEvent } = useTrustware();
32213
- const { features } = useTrustwareConfig();
33334
+ const { features, theme: configTheme } = useTrustwareConfig();
33335
+ const effectiveThemeSetting = themeProp ?? configTheme ?? "system";
33336
+ const { resolvedTheme, toggleTheme } = useThemePreference(
33337
+ effectiveThemeSetting
33338
+ );
32214
33339
  const defaultDestRef = features.swapDefaultDestToken;
32215
33340
  const lockDestToken = features.swapLockDestToken && !!defaultDestRef;
32216
33341
  const allowedDestTokens = features.swapAllowedDestTokens;
@@ -32220,21 +33345,21 @@ function SwapMode({
32220
33345
  isLoading: chainsLoading,
32221
33346
  error: chainsError
32222
33347
  } = useChains();
32223
- const allowedDestChainIds = useMemo26(() => {
33348
+ const allowedDestChainIds = useMemo27(() => {
32224
33349
  if (!allowedDestTokens || allowedDestTokens.length === 0) return null;
32225
33350
  return new Set(allowedDestTokens.map((t) => t.chainId));
32226
33351
  }, [allowedDestTokens]);
32227
- const toPopularChains = useMemo26(
33352
+ const toPopularChains = useMemo27(
32228
33353
  () => allowedDestChainIds ? popularChains.filter(
32229
33354
  (c) => allowedDestChainIds.has(Number(c.chainId))
32230
33355
  ) : popularChains,
32231
33356
  [popularChains, allowedDestChainIds]
32232
33357
  );
32233
- const toOtherChains = useMemo26(
33358
+ const toOtherChains = useMemo27(
32234
33359
  () => allowedDestChainIds ? otherChains.filter((c) => allowedDestChainIds.has(Number(c.chainId))) : otherChains,
32235
33360
  [otherChains, allowedDestChainIds]
32236
33361
  );
32237
- const allChains = useMemo26(
33362
+ const allChains = useMemo27(
32238
33363
  () => [...popularChains, ...otherChains],
32239
33364
  [popularChains, otherChains]
32240
33365
  );
@@ -32287,18 +33412,18 @@ function SwapMode({
32287
33412
  });
32288
33413
  const route = useSwapRoute();
32289
33414
  const execution = useSwapExecution(fromChain);
32290
- const fromTokenPriceUSD = useMemo26(() => {
33415
+ const fromTokenPriceUSD = useMemo27(() => {
32291
33416
  const p = fromToken?.usdPrice;
32292
33417
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
32293
33418
  }, [fromToken]);
32294
33419
  const hasFromUsdPrice = fromTokenPriceUSD > 0;
32295
- const toTokenPriceUSD = useMemo26(() => {
33420
+ const toTokenPriceUSD = useMemo27(() => {
32296
33421
  const p = toToken?.usdPrice;
32297
33422
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
32298
33423
  }, [toToken]);
32299
33424
  const hasToUsdPrice = toTokenPriceUSD > 0;
32300
33425
  const rawSellNum = parseFloat(amount) || 0;
32301
- const usdSellNum = useMemo26(() => {
33426
+ const usdSellNum = useMemo27(() => {
32302
33427
  if (amountInputMode === "usd") return rawSellNum / currencyRate;
32303
33428
  return hasFromUsdPrice ? rawSellNum * fromTokenPriceUSD : 0;
32304
33429
  }, [
@@ -32308,7 +33433,7 @@ function SwapMode({
32308
33433
  hasFromUsdPrice,
32309
33434
  fromTokenPriceUSD
32310
33435
  ]);
32311
- const tokenSellNum = useMemo26(() => {
33436
+ const tokenSellNum = useMemo27(() => {
32312
33437
  if (amountInputMode === "usd") {
32313
33438
  return hasFromUsdPrice && fromTokenPriceUSD > 0 ? usdSellNum / fromTokenPriceUSD : 0;
32314
33439
  }
@@ -32320,7 +33445,7 @@ function SwapMode({
32320
33445
  hasFromUsdPrice,
32321
33446
  fromTokenPriceUSD
32322
33447
  ]);
32323
- const tokenAmountStr = useMemo26(() => {
33448
+ const tokenAmountStr = useMemo27(() => {
32324
33449
  if (tokenSellNum <= 0) return "";
32325
33450
  const decimals = fromToken?.decimals ?? 18;
32326
33451
  return truncateDecimal(tokenSellNum, Math.min(decimals, 18));
@@ -32527,7 +33652,7 @@ function SwapMode({
32527
33652
  fromToken?.decimals,
32528
33653
  route
32529
33654
  ]);
32530
- const fromBalance = useMemo26(() => {
33655
+ const fromBalance = useMemo27(() => {
32531
33656
  const walletToken = fromToken;
32532
33657
  if (!walletToken || !("balance" in walletToken)) return null;
32533
33658
  const raw = walletToken.balance;
@@ -32537,7 +33662,7 @@ function SwapMode({
32537
33662
  return Number.isFinite(n) ? n : null;
32538
33663
  }, [fromToken]);
32539
33664
  const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
32540
- const estimatedToAmount = useMemo26(() => {
33665
+ const estimatedToAmount = useMemo27(() => {
32541
33666
  if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
32542
33667
  return tokenSellNum * (fromTokenPriceUSD / toTokenPriceUSD);
32543
33668
  }, [
@@ -32547,10 +33672,10 @@ function SwapMode({
32547
33672
  hasFromUsdPrice,
32548
33673
  hasToUsdPrice
32549
33674
  ]);
32550
- const backendToUsdStr = useMemo26(() => {
33675
+ const backendToUsdStr = useMemo27(() => {
32551
33676
  return route.data?.finalExchangeRate?.toAmountMinUSD ?? route.data?.route?.estimate?.toAmountMinUsd ?? route.data?.route?.estimate?.toAmountUsd ?? null;
32552
33677
  }, [route.data]);
32553
- const toAmount = useMemo26(() => {
33678
+ const toAmount = useMemo27(() => {
32554
33679
  if (backendToUsdStr && toTokenPriceUSD > 0) {
32555
33680
  const usd = parseFloat(backendToUsdStr);
32556
33681
  if (Number.isFinite(usd) && usd > 0) return usd / toTokenPriceUSD;
@@ -32576,7 +33701,7 @@ function SwapMode({
32576
33701
  estimatedToAmount
32577
33702
  ]);
32578
33703
  const fromUsd = usdSellNum;
32579
- const toUsd = useMemo26(() => {
33704
+ const toUsd = useMemo27(() => {
32580
33705
  if (backendToUsdStr) {
32581
33706
  const n = parseFloat(backendToUsdStr);
32582
33707
  if (Number.isFinite(n) && n > 0) return n;
@@ -32587,12 +33712,12 @@ function SwapMode({
32587
33712
  const isEstimate = !route.data;
32588
33713
  const USD_EPSILON = 1e-3;
32589
33714
  const displayToUsd = toUsd > USD_EPSILON ? toUsd : estimatedToAmount !== null && hasToUsdPrice ? estimatedToAmount * toTokenPriceUSD : 0;
32590
- const priceImpact = useMemo26(() => {
33715
+ const priceImpact = useMemo27(() => {
32591
33716
  if (!route.data || fromUsd < 0.01 || displayToUsd < 0.01) return null;
32592
33717
  const impact = 1 - displayToUsd / fromUsd;
32593
33718
  return impact > 1e-3 ? impact : null;
32594
33719
  }, [route.data, fromUsd, displayToUsd]);
32595
- const routePath = useMemo26(() => {
33720
+ const routePath = useMemo27(() => {
32596
33721
  if (!route.data) return null;
32597
33722
  const provider = route.data.route?.provider;
32598
33723
  const steps = route.data.route?.steps;
@@ -32619,19 +33744,19 @@ function SwapMode({
32619
33744
  return null;
32620
33745
  }, [route.data, fromToken?.symbol, toToken?.symbol]);
32621
33746
  const isGasSponsored = !!route.data?.sponsorship;
32622
- const networkCostUsd = useMemo26(() => {
33747
+ const networkCostUsd = useMemo27(() => {
32623
33748
  const fees = route.data?.route?.estimate?.fees;
32624
33749
  if (!fees?.length) return null;
32625
33750
  const gasTotal = fees.filter((f) => f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
32626
33751
  return gasTotal > 0 ? gasTotal : null;
32627
33752
  }, [route.data]);
32628
- const protocolFeeUsd = useMemo26(() => {
33753
+ const protocolFeeUsd = useMemo27(() => {
32629
33754
  const fees = route.data?.route?.estimate?.fees;
32630
33755
  if (!fees?.length) return null;
32631
33756
  const total = fees.filter((f) => !f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
32632
33757
  return total > 0 ? total : null;
32633
33758
  }, [route.data]);
32634
- const exchangeRate = useMemo26(() => {
33759
+ const exchangeRate = useMemo27(() => {
32635
33760
  if (!hasFromUsdPrice || !hasToUsdPrice) return null;
32636
33761
  return toTokenPriceUSD / fromTokenPriceUSD;
32637
33762
  }, [fromTokenPriceUSD, toTokenPriceUSD, hasFromUsdPrice, hasToUsdPrice]);
@@ -32776,7 +33901,7 @@ function SwapMode({
32776
33901
  return () => document.removeEventListener("mousedown", handler);
32777
33902
  }, [showCurrencyDropdown]);
32778
33903
  if (stage === "select-from") {
32779
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsx56(
33904
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsx56(
32780
33905
  SwapTokenSelect,
32781
33906
  {
32782
33907
  side: "from",
@@ -32794,7 +33919,7 @@ function SwapMode({
32794
33919
  ) });
32795
33920
  }
32796
33921
  if (stage === "select-to" && !lockDestToken) {
32797
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsx56(
33922
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsx56(
32798
33923
  SwapTokenSelect,
32799
33924
  {
32800
33925
  side: "to",
@@ -32813,7 +33938,7 @@ function SwapMode({
32813
33938
  ) });
32814
33939
  }
32815
33940
  if (stage === "connect-wallet") {
32816
- return /* @__PURE__ */ jsxs45(WidgetContainer, { theme, style, children: [
33941
+ return /* @__PURE__ */ jsxs45(WidgetContainer, { theme: resolvedTheme, style, children: [
32817
33942
  /* @__PURE__ */ jsx56(
32818
33943
  SwapWalletSelector,
32819
33944
  {
@@ -32856,7 +33981,7 @@ function SwapMode({
32856
33981
  const offset = circ - progress / 100 * circ;
32857
33982
  const isApproving = txStatus === "approving";
32858
33983
  const title = isApproving ? "Approving..." : "Order Submitted";
32859
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
33984
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
32860
33985
  /* @__PURE__ */ jsxs45(
32861
33986
  "div",
32862
33987
  {
@@ -33252,7 +34377,7 @@ function SwapMode({
33252
34377
  padding: 0,
33253
34378
  transition: "color 0.15s"
33254
34379
  },
33255
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment8, { children: [
34380
+ children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment9, { children: [
33256
34381
  txHash.slice(0, 6),
33257
34382
  "\u2026",
33258
34383
  txHash.slice(-4),
@@ -33306,7 +34431,7 @@ function SwapMode({
33306
34431
  dateStyle: "medium",
33307
34432
  timeStyle: "short"
33308
34433
  }) ?? null;
33309
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45("div", { style: { position: "relative", overflow: "hidden" }, children: [
34434
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45("div", { style: { position: "relative", overflow: "hidden" }, children: [
33310
34435
  /* @__PURE__ */ jsx56(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx56(ConfettiEffect3, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
33311
34436
  /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[6]} ${spacing[6]} 0` }, children: [
33312
34437
  /* @__PURE__ */ jsxs45(
@@ -33385,30 +34510,58 @@ function SwapMode({
33385
34510
  fontSize: fontSize.sm
33386
34511
  },
33387
34512
  children: [
33388
- /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "You sold" }),
33389
34513
  /* @__PURE__ */ jsxs45(
33390
- "span",
34514
+ "div",
33391
34515
  {
33392
34516
  style: {
33393
- display: "inline-flex",
34517
+ display: "flex",
33394
34518
  alignItems: "center",
33395
- gap: spacing[2],
34519
+ gap: spacing[2]
34520
+ },
34521
+ children: [
34522
+ fromToken?.iconUrl && /* @__PURE__ */ jsxs45("div", { style: { position: "relative", flexShrink: 0 }, children: [
34523
+ /* @__PURE__ */ jsx56(
34524
+ "img",
34525
+ {
34526
+ src: fromToken.iconUrl,
34527
+ alt: "",
34528
+ style: {
34529
+ width: "1.375rem",
34530
+ height: "1.375rem",
34531
+ borderRadius: "9999px"
34532
+ }
34533
+ }
34534
+ ),
34535
+ fromChain?.chainIconURI && /* @__PURE__ */ jsx56(
34536
+ "img",
34537
+ {
34538
+ src: fromChain.chainIconURI,
34539
+ alt: "",
34540
+ style: {
34541
+ position: "absolute",
34542
+ bottom: -2,
34543
+ right: -2,
34544
+ width: "0.625rem",
34545
+ height: "0.625rem",
34546
+ borderRadius: "9999px",
34547
+ border: `1.5px solid ${colors.background}`,
34548
+ objectFit: "cover"
34549
+ }
34550
+ }
34551
+ )
34552
+ ] }),
34553
+ /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "You sold" })
34554
+ ]
34555
+ }
34556
+ ),
34557
+ /* @__PURE__ */ jsxs45(
34558
+ "span",
34559
+ {
34560
+ style: {
33396
34561
  fontWeight: fontWeight.semibold,
33397
34562
  color: colors.foreground
33398
34563
  },
33399
34564
  children: [
33400
- fromToken?.iconUrl && /* @__PURE__ */ jsx56(
33401
- "img",
33402
- {
33403
- src: fromToken.iconUrl,
33404
- style: {
33405
- width: "1.25rem",
33406
- height: "1.25rem",
33407
- borderRadius: "9999px"
33408
- },
33409
- alt: ""
33410
- }
33411
- ),
33412
34565
  fmtAmount(tokenSellNum, 4),
33413
34566
  " ",
33414
34567
  fromToken?.symbol
@@ -33429,30 +34582,58 @@ function SwapMode({
33429
34582
  marginTop: spacing[3]
33430
34583
  },
33431
34584
  children: [
33432
- /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "Received" }),
33433
34585
  /* @__PURE__ */ jsxs45(
33434
- "span",
34586
+ "div",
33435
34587
  {
33436
34588
  style: {
33437
- display: "inline-flex",
34589
+ display: "flex",
33438
34590
  alignItems: "center",
33439
- gap: spacing[2],
34591
+ gap: spacing[2]
34592
+ },
34593
+ children: [
34594
+ toToken?.iconUrl && /* @__PURE__ */ jsxs45("div", { style: { position: "relative", flexShrink: 0 }, children: [
34595
+ /* @__PURE__ */ jsx56(
34596
+ "img",
34597
+ {
34598
+ src: toToken.iconUrl,
34599
+ alt: "",
34600
+ style: {
34601
+ width: "1.375rem",
34602
+ height: "1.375rem",
34603
+ borderRadius: "9999px"
34604
+ }
34605
+ }
34606
+ ),
34607
+ toChain?.chainIconURI && /* @__PURE__ */ jsx56(
34608
+ "img",
34609
+ {
34610
+ src: toChain.chainIconURI,
34611
+ alt: "",
34612
+ style: {
34613
+ position: "absolute",
34614
+ bottom: -2,
34615
+ right: -2,
34616
+ width: "0.625rem",
34617
+ height: "0.625rem",
34618
+ borderRadius: "9999px",
34619
+ border: `1.5px solid ${colors.background}`,
34620
+ objectFit: "cover"
34621
+ }
34622
+ }
34623
+ )
34624
+ ] }),
34625
+ /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "Received" })
34626
+ ]
34627
+ }
34628
+ ),
34629
+ /* @__PURE__ */ jsxs45(
34630
+ "span",
34631
+ {
34632
+ style: {
33440
34633
  fontWeight: fontWeight.semibold,
33441
34634
  color: colors.foreground
33442
34635
  },
33443
34636
  children: [
33444
- toToken?.iconUrl && /* @__PURE__ */ jsx56(
33445
- "img",
33446
- {
33447
- src: toToken.iconUrl,
33448
- style: {
33449
- width: "1.25rem",
33450
- height: "1.25rem",
33451
- borderRadius: "9999px"
33452
- },
33453
- alt: ""
33454
- }
33455
- ),
33456
34637
  finalToAmount !== null ? fmtAmount(finalToAmount, 4) : "\u2014",
33457
34638
  " ",
33458
34639
  toToken?.symbol
@@ -33503,13 +34684,6 @@ function SwapMode({
33503
34684
  value: effectiveRate
33504
34685
  }
33505
34686
  ),
33506
- (fromChain?.networkName ?? fromChain?.axelarChainName) && /* @__PURE__ */ jsx56(
33507
- SuccessReceiptRow,
33508
- {
33509
- label: "Network",
33510
- value: fromChain?.networkName ?? fromChain?.axelarChainName
33511
- }
33512
- ),
33513
34687
  completedStr && /* @__PURE__ */ jsx56(SuccessReceiptRow, { label: "Completed", value: completedStr }),
33514
34688
  txHash && (() => {
33515
34689
  const srcUrl = buildExplorerUrl(
@@ -33818,7 +34992,7 @@ function SwapMode({
33818
34992
  ] }) });
33819
34993
  }
33820
34994
  if (stage === "error") {
33821
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45(
34995
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45(
33822
34996
  "div",
33823
34997
  {
33824
34998
  style: {
@@ -33952,422 +35126,408 @@ function SwapMode({
33952
35126
  if (stage === "review") {
33953
35127
  const reviewToAmount = toAmount ?? displayToAmount;
33954
35128
  const reviewToUsd = toUsd > 0 ? toUsd : displayToUsd;
33955
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
33956
- /* @__PURE__ */ jsxs45(
33957
- "div",
33958
- {
33959
- style: {
33960
- display: "flex",
33961
- alignItems: "center",
33962
- justifyContent: "space-between",
33963
- marginBottom: spacing[5]
33964
- },
33965
- children: [
33966
- /* @__PURE__ */ jsx56(
33967
- "span",
33968
- {
33969
- style: {
33970
- fontSize: fontSize.sm,
33971
- fontWeight: fontWeight.medium,
33972
- color: colors.mutedForeground
33973
- },
33974
- children: "You're swapping"
33975
- }
33976
- ),
33977
- /* @__PURE__ */ jsx56(
33978
- "button",
33979
- {
33980
- onClick: () => setStage("home"),
33981
- style: {
33982
- width: "2rem",
33983
- height: "2rem",
33984
- borderRadius: "9999px",
33985
- display: "flex",
33986
- alignItems: "center",
33987
- justifyContent: "center",
33988
- backgroundColor: "transparent",
33989
- border: 0,
33990
- cursor: "pointer"
33991
- },
33992
- children: /* @__PURE__ */ jsx56(
33993
- "svg",
35129
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45(
35130
+ "div",
35131
+ {
35132
+ style: {
35133
+ padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}`,
35134
+ maxHeight: "85vh",
35135
+ overflowY: "auto"
35136
+ },
35137
+ children: [
35138
+ /* @__PURE__ */ jsxs45(
35139
+ "div",
35140
+ {
35141
+ style: {
35142
+ display: "flex",
35143
+ alignItems: "center",
35144
+ justifyContent: "space-between",
35145
+ marginBottom: spacing[5]
35146
+ },
35147
+ children: [
35148
+ /* @__PURE__ */ jsx56(
35149
+ "span",
33994
35150
  {
33995
35151
  style: {
33996
- width: "1.25rem",
33997
- height: "1.25rem",
33998
- color: colors.foreground
35152
+ fontSize: fontSize.sm,
35153
+ fontWeight: fontWeight.medium,
35154
+ color: colors.mutedForeground
33999
35155
  },
34000
- viewBox: "0 0 24 24",
34001
- fill: "none",
34002
- stroke: "currentColor",
34003
- strokeWidth: 2,
34004
- strokeLinecap: "round",
34005
- strokeLinejoin: "round",
34006
- children: /* @__PURE__ */ jsx56("path", { d: "M18 6L6 18M6 6l12 12" })
35156
+ children: "You're swapping"
35157
+ }
35158
+ ),
35159
+ /* @__PURE__ */ jsx56(
35160
+ "button",
35161
+ {
35162
+ onClick: () => setStage("home"),
35163
+ style: {
35164
+ width: "2rem",
35165
+ height: "2rem",
35166
+ borderRadius: "9999px",
35167
+ display: "flex",
35168
+ alignItems: "center",
35169
+ justifyContent: "center",
35170
+ backgroundColor: "transparent",
35171
+ border: 0,
35172
+ cursor: "pointer"
35173
+ },
35174
+ children: /* @__PURE__ */ jsx56(
35175
+ "svg",
35176
+ {
35177
+ style: {
35178
+ width: "1.25rem",
35179
+ height: "1.25rem",
35180
+ color: colors.foreground
35181
+ },
35182
+ viewBox: "0 0 24 24",
35183
+ fill: "none",
35184
+ stroke: "currentColor",
35185
+ strokeWidth: 2,
35186
+ strokeLinecap: "round",
35187
+ strokeLinejoin: "round",
35188
+ children: /* @__PURE__ */ jsx56("path", { d: "M18 6L6 18M6 6l12 12" })
35189
+ }
35190
+ )
34007
35191
  }
34008
35192
  )
34009
- }
34010
- )
34011
- ]
34012
- }
34013
- ),
34014
- /* @__PURE__ */ jsxs45(
34015
- "div",
34016
- {
34017
- style: {
34018
- display: "flex",
34019
- alignItems: "center",
34020
- justifyContent: "space-between"
34021
- },
34022
- children: [
34023
- /* @__PURE__ */ jsxs45("div", { children: [
34024
- /* @__PURE__ */ jsxs45(
34025
- "p",
34026
- {
34027
- style: {
34028
- fontSize: "1.75rem",
34029
- fontWeight: fontWeight.semibold,
34030
- color: colors.foreground,
34031
- lineHeight: 1.2
34032
- },
34033
- children: [
34034
- fmtAmount(tokenSellNum, 5),
34035
- " ",
34036
- fromToken?.symbol
34037
- ]
34038
- }
34039
- ),
34040
- /* @__PURE__ */ jsx56(
34041
- "p",
34042
- {
34043
- style: {
34044
- fontSize: fontSize.sm,
34045
- color: colors.mutedForeground,
34046
- marginTop: "0.125rem"
34047
- },
34048
- children: fmtLocal(fromUsd)
34049
- }
34050
- )
34051
- ] }),
34052
- fromToken?.iconUrl && /* @__PURE__ */ jsx56(
34053
- TokenIcon,
34054
- {
34055
- icon: fromToken.iconUrl,
34056
- chainIcon: fromChain?.chainIconURI,
34057
- size: "lg"
34058
- }
34059
- )
34060
- ]
34061
- }
34062
- ),
34063
- /* @__PURE__ */ jsx56(
34064
- "div",
34065
- {
34066
- style: {
34067
- display: "flex",
34068
- justifyContent: "center",
34069
- margin: `${spacing[3]} 0`
34070
- },
34071
- children: /* @__PURE__ */ jsx56(
34072
- "svg",
35193
+ ]
35194
+ }
35195
+ ),
35196
+ /* @__PURE__ */ jsxs45(
35197
+ "div",
34073
35198
  {
34074
35199
  style: {
34075
- width: "1rem",
34076
- height: "1rem",
34077
- color: colors.mutedForeground
35200
+ display: "flex",
35201
+ alignItems: "center",
35202
+ justifyContent: "space-between"
34078
35203
  },
34079
- viewBox: "0 0 24 24",
34080
- fill: "none",
34081
- stroke: "currentColor",
34082
- strokeWidth: 2,
34083
- strokeLinecap: "round",
34084
- strokeLinejoin: "round",
34085
- children: /* @__PURE__ */ jsx56("path", { d: "M12 5v14m-7-7l7 7 7-7" })
35204
+ children: [
35205
+ /* @__PURE__ */ jsxs45("div", { children: [
35206
+ /* @__PURE__ */ jsxs45(
35207
+ "p",
35208
+ {
35209
+ style: {
35210
+ fontSize: "1.75rem",
35211
+ fontWeight: fontWeight.semibold,
35212
+ color: colors.foreground,
35213
+ lineHeight: 1.2
35214
+ },
35215
+ children: [
35216
+ fmtAmount(tokenSellNum, 5),
35217
+ " ",
35218
+ fromToken?.symbol
35219
+ ]
35220
+ }
35221
+ ),
35222
+ /* @__PURE__ */ jsx56(
35223
+ "p",
35224
+ {
35225
+ style: {
35226
+ fontSize: fontSize.sm,
35227
+ color: colors.mutedForeground,
35228
+ marginTop: "0.125rem"
35229
+ },
35230
+ children: fmtLocal(fromUsd)
35231
+ }
35232
+ )
35233
+ ] }),
35234
+ fromToken?.iconUrl && /* @__PURE__ */ jsx56(
35235
+ TokenIcon,
35236
+ {
35237
+ icon: fromToken.iconUrl,
35238
+ chainIcon: fromChain?.chainIconURI,
35239
+ size: "lg"
35240
+ }
35241
+ )
35242
+ ]
34086
35243
  }
34087
- )
34088
- }
34089
- ),
34090
- /* @__PURE__ */ jsxs45(
34091
- "div",
34092
- {
34093
- style: {
34094
- display: "flex",
34095
- alignItems: "center",
34096
- justifyContent: "space-between"
34097
- },
34098
- children: [
34099
- /* @__PURE__ */ jsxs45("div", { children: [
34100
- /* @__PURE__ */ jsxs45(
34101
- "p",
34102
- {
34103
- style: {
34104
- fontSize: "1.75rem",
34105
- fontWeight: fontWeight.semibold,
34106
- color: colors.foreground,
34107
- lineHeight: 1.2
34108
- },
34109
- children: [
34110
- reviewToAmount !== null ? fmtAmount(reviewToAmount, 5) : "\u2014",
34111
- " ",
34112
- toToken?.symbol
34113
- ]
34114
- }
34115
- ),
34116
- /* @__PURE__ */ jsx56(
34117
- "p",
35244
+ ),
35245
+ /* @__PURE__ */ jsx56(
35246
+ "div",
35247
+ {
35248
+ style: {
35249
+ display: "flex",
35250
+ justifyContent: "center",
35251
+ margin: `${spacing[3]} 0`
35252
+ },
35253
+ children: /* @__PURE__ */ jsx56(
35254
+ "svg",
34118
35255
  {
34119
35256
  style: {
34120
- fontSize: fontSize.sm,
34121
- color: colors.mutedForeground,
34122
- marginTop: "0.125rem"
35257
+ width: "1rem",
35258
+ height: "1rem",
35259
+ color: colors.mutedForeground
34123
35260
  },
34124
- children: fmtLocal(reviewToUsd)
35261
+ viewBox: "0 0 24 24",
35262
+ fill: "none",
35263
+ stroke: "currentColor",
35264
+ strokeWidth: 2,
35265
+ strokeLinecap: "round",
35266
+ strokeLinejoin: "round",
35267
+ children: /* @__PURE__ */ jsx56("path", { d: "M12 5v14m-7-7l7 7 7-7" })
34125
35268
  }
34126
35269
  )
34127
- ] }),
34128
- toToken?.iconUrl && /* @__PURE__ */ jsx56(
34129
- TokenIcon,
34130
- {
34131
- icon: toToken.iconUrl,
34132
- chainIcon: toChain?.chainIconURI,
34133
- size: "lg"
34134
- }
34135
- )
34136
- ]
34137
- }
34138
- ),
34139
- /* @__PURE__ */ jsxs45(
34140
- "button",
34141
- {
34142
- onClick: () => setShowReviewDetails((v) => !v),
34143
- style: {
34144
- margin: `${spacing[5]} 0`,
34145
- display: "flex",
34146
- alignItems: "center",
34147
- gap: spacing[2],
34148
- width: "100%",
34149
- background: "none",
34150
- border: 0,
34151
- cursor: "pointer",
34152
- color: colors.foreground,
34153
- fontSize: fontSize.sm,
34154
- fontWeight: fontWeight.medium
34155
- },
34156
- children: [
34157
- /* @__PURE__ */ jsx56(
34158
- "div",
34159
- {
34160
- style: { flex: 1, height: "1px", backgroundColor: colors.border }
34161
- }
34162
- ),
34163
- /* @__PURE__ */ jsxs45(
34164
- "span",
34165
- {
34166
- style: {
34167
- display: "flex",
34168
- alignItems: "center",
34169
- gap: "0.25rem",
34170
- padding: `0 ${spacing[2]}`,
34171
- whiteSpace: "nowrap"
34172
- },
34173
- children: [
34174
- showReviewDetails ? "Show less" : "Show more",
34175
- /* @__PURE__ */ jsx56(
34176
- "svg",
35270
+ }
35271
+ ),
35272
+ /* @__PURE__ */ jsxs45(
35273
+ "div",
35274
+ {
35275
+ style: {
35276
+ display: "flex",
35277
+ alignItems: "center",
35278
+ justifyContent: "space-between"
35279
+ },
35280
+ children: [
35281
+ /* @__PURE__ */ jsxs45("div", { children: [
35282
+ /* @__PURE__ */ jsxs45(
35283
+ "p",
34177
35284
  {
34178
35285
  style: {
34179
- width: "0.875rem",
34180
- height: "0.875rem",
34181
- transform: showReviewDetails ? "rotate(180deg)" : void 0,
34182
- transition: "transform 0.2s"
35286
+ fontSize: "1.75rem",
35287
+ fontWeight: fontWeight.semibold,
35288
+ color: colors.foreground,
35289
+ lineHeight: 1.2
34183
35290
  },
34184
- viewBox: "0 0 24 24",
34185
- fill: "none",
34186
- stroke: "currentColor",
34187
- strokeWidth: 2,
34188
- strokeLinecap: "round",
34189
- strokeLinejoin: "round",
34190
- children: /* @__PURE__ */ jsx56("path", { d: "M6 9l6 6 6-6" })
35291
+ children: [
35292
+ reviewToAmount !== null ? fmtAmount(reviewToAmount, 5) : "\u2014",
35293
+ " ",
35294
+ toToken?.symbol
35295
+ ]
34191
35296
  }
34192
35297
  ),
34193
- route.data && /* @__PURE__ */ jsxs45(
34194
- "svg",
35298
+ /* @__PURE__ */ jsx56(
35299
+ "p",
34195
35300
  {
34196
- width: "14",
34197
- height: "14",
34198
- viewBox: "0 0 14 14",
34199
35301
  style: {
34200
- transform: "rotate(-90deg)",
34201
- flexShrink: 0,
34202
- opacity: 0.75,
34203
- marginLeft: "0.125rem"
35302
+ fontSize: fontSize.sm,
35303
+ color: colors.mutedForeground,
35304
+ marginTop: "0.125rem"
34204
35305
  },
34205
- children: [
34206
- /* @__PURE__ */ jsx56(
34207
- "circle",
34208
- {
34209
- cx: "7",
34210
- cy: "7",
34211
- r: "5",
34212
- fill: "none",
34213
- stroke: "hsl(var(--tw-border))",
34214
- strokeWidth: "1.5"
34215
- }
34216
- ),
34217
- /* @__PURE__ */ jsx56(
34218
- "circle",
34219
- {
34220
- cx: "7",
34221
- cy: "7",
34222
- r: "5",
34223
- fill: "none",
34224
- stroke: quoteAge >= QUOTE_TTL - 10 ? colors.destructive : colors.primary,
34225
- strokeWidth: "1.5",
34226
- strokeLinecap: "round",
34227
- strokeDasharray: "31.416",
34228
- strokeDashoffset: 31.416 * (quoteAge / QUOTE_TTL),
34229
- style: { transition: "stroke-dashoffset 1s linear" }
34230
- }
34231
- )
34232
- ]
35306
+ children: fmtLocal(reviewToUsd)
34233
35307
  }
34234
35308
  )
34235
- ]
34236
- }
34237
- ),
34238
- /* @__PURE__ */ jsx56(
34239
- "div",
34240
- {
34241
- style: { flex: 1, height: "1px", backgroundColor: colors.border }
34242
- }
34243
- )
34244
- ]
34245
- }
34246
- ),
34247
- /* @__PURE__ */ jsxs45(
34248
- "div",
34249
- {
34250
- style: {
34251
- display: "flex",
34252
- flexDirection: "column",
34253
- gap: spacing[3],
34254
- fontSize: fontSize.sm
34255
- },
34256
- children: [
34257
- showReviewDetails && exchangeRate !== null && /* @__PURE__ */ jsx56(
34258
- ReviewDetailRow,
34259
- {
34260
- label: "Rate",
34261
- tooltip: "Current exchange rate between the two tokens",
34262
- value: `1 ${fromToken?.symbol} = ${fmtAmount(1 / (exchangeRate ?? 1), 4)} ${toToken?.symbol} ($${fmtAmount(fromTokenPriceUSD, 2)})`
34263
- }
34264
- ),
34265
- /* @__PURE__ */ jsx56(
34266
- ReviewDetailRow,
34267
- {
34268
- label: "Fee",
34269
- tooltip: "Protocol fee charged by the bridge or DEX",
34270
- value: /* @__PURE__ */ jsx56(
34271
- "span",
35309
+ ] }),
35310
+ toToken?.iconUrl && /* @__PURE__ */ jsx56(
35311
+ TokenIcon,
34272
35312
  {
34273
- style: {
34274
- color: colors.foreground,
34275
- fontWeight: fontWeight.medium
34276
- },
34277
- children: protocolFeeUsd !== null ? fmtLocal(protocolFeeUsd) : "Free"
35313
+ icon: toToken.iconUrl,
35314
+ chainIcon: toChain?.chainIconURI,
35315
+ size: "lg"
34278
35316
  }
34279
35317
  )
34280
- }
34281
- ),
34282
- /* @__PURE__ */ jsx56(
34283
- ReviewDetailRow,
34284
- {
34285
- label: "Network cost",
34286
- tooltip: "Estimated gas fee paid to the blockchain network",
34287
- value: isGasSponsored ? /* @__PURE__ */ jsx56(SponsoredBadge, {}) : networkCostUsd !== null ? /* @__PURE__ */ jsxs45(
35318
+ ]
35319
+ }
35320
+ ),
35321
+ /* @__PURE__ */ jsxs45(
35322
+ "button",
35323
+ {
35324
+ onClick: () => setShowReviewDetails((v) => !v),
35325
+ style: {
35326
+ margin: `${spacing[5]} 0`,
35327
+ display: "flex",
35328
+ alignItems: "center",
35329
+ gap: spacing[2],
35330
+ width: "100%",
35331
+ background: "none",
35332
+ border: 0,
35333
+ cursor: "pointer",
35334
+ color: colors.mutedForeground,
35335
+ fontSize: fontSize.sm,
35336
+ fontWeight: fontWeight.medium,
35337
+ padding: 0
35338
+ },
35339
+ children: [
35340
+ /* @__PURE__ */ jsx56(
35341
+ "div",
35342
+ {
35343
+ style: { flex: 1, height: "1px", backgroundColor: colors.border }
35344
+ }
35345
+ ),
35346
+ /* @__PURE__ */ jsxs45(
34288
35347
  "span",
34289
35348
  {
34290
35349
  style: {
34291
35350
  display: "flex",
34292
35351
  alignItems: "center",
34293
35352
  gap: "0.25rem",
34294
- color: colors.mutedForeground
35353
+ padding: `0 ${spacing[2]}`,
35354
+ whiteSpace: "nowrap"
34295
35355
  },
34296
35356
  children: [
34297
- /* @__PURE__ */ jsx56(GasIcon, { size: "0.875rem" }),
34298
- fmtLocal(networkCostUsd)
35357
+ showReviewDetails ? "Hide details" : "View details",
35358
+ /* @__PURE__ */ jsx56(
35359
+ "svg",
35360
+ {
35361
+ style: {
35362
+ width: "0.875rem",
35363
+ height: "0.875rem",
35364
+ transform: showReviewDetails ? "rotate(180deg)" : void 0,
35365
+ transition: "transform 0.2s"
35366
+ },
35367
+ viewBox: "0 0 24 24",
35368
+ fill: "none",
35369
+ stroke: "currentColor",
35370
+ strokeWidth: 2,
35371
+ strokeLinecap: "round",
35372
+ strokeLinejoin: "round",
35373
+ children: /* @__PURE__ */ jsx56("path", { d: "M6 9l6 6 6-6" })
35374
+ }
35375
+ ),
35376
+ route.data && /* @__PURE__ */ jsxs45(
35377
+ "svg",
35378
+ {
35379
+ width: "14",
35380
+ height: "14",
35381
+ viewBox: "0 0 14 14",
35382
+ style: {
35383
+ transform: "rotate(-90deg)",
35384
+ flexShrink: 0,
35385
+ opacity: 0.75,
35386
+ marginLeft: "0.125rem"
35387
+ },
35388
+ children: [
35389
+ /* @__PURE__ */ jsx56(
35390
+ "circle",
35391
+ {
35392
+ cx: "7",
35393
+ cy: "7",
35394
+ r: "5",
35395
+ fill: "none",
35396
+ stroke: "hsl(var(--tw-border))",
35397
+ strokeWidth: "1.5"
35398
+ }
35399
+ ),
35400
+ /* @__PURE__ */ jsx56(
35401
+ "circle",
35402
+ {
35403
+ cx: "7",
35404
+ cy: "7",
35405
+ r: "5",
35406
+ fill: "none",
35407
+ stroke: quoteAge >= QUOTE_TTL - 10 ? colors.destructive : colors.primary,
35408
+ strokeWidth: "1.5",
35409
+ strokeLinecap: "round",
35410
+ strokeDasharray: "31.416",
35411
+ strokeDashoffset: 31.416 * (quoteAge / QUOTE_TTL),
35412
+ style: { transition: "stroke-dashoffset 1s linear" }
35413
+ }
35414
+ )
35415
+ ]
35416
+ }
35417
+ )
34299
35418
  ]
34300
35419
  }
34301
- ) : /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "\u2014" })
34302
- }
34303
- ),
34304
- showReviewDetails && /* @__PURE__ */ jsxs45(Fragment8, { children: [
34305
- /* @__PURE__ */ jsx56(
34306
- ReviewDetailRow,
34307
- {
34308
- label: "Max slippage",
34309
- tooltip: "Max price movement allowed before the swap automatically reverts",
34310
- value: /* @__PURE__ */ jsx56(
34311
- "span",
34312
- {
34313
- style: {
34314
- display: "flex",
34315
- alignItems: "center",
34316
- gap: spacing[1.5]
34317
- },
34318
- children: /* @__PURE__ */ jsxs45("span", { style: { color: colors.mutedForeground }, children: [
34319
- slippage,
34320
- "%"
34321
- ] })
34322
- }
34323
- )
34324
- }
34325
- ),
34326
- (routePath || route.data?.route?.provider) && /* @__PURE__ */ jsx56(
34327
- ReviewDetailRow,
34328
- {
34329
- label: "Route",
34330
- tooltip: "Protocol or bridge used to execute your swap",
34331
- value: /* @__PURE__ */ jsx56(
34332
- "span",
34333
- {
34334
- style: {
34335
- color: colors.foreground,
34336
- overflow: "hidden",
34337
- textOverflow: "ellipsis",
34338
- whiteSpace: "nowrap",
34339
- maxWidth: "200px",
34340
- display: "inline-block",
34341
- verticalAlign: "bottom"
34342
- },
34343
- title: routePath ?? route.data?.route?.provider,
34344
- children: routePath ?? route.data?.route?.provider
34345
- }
34346
- )
34347
- }
34348
- )
34349
- ] })
34350
- ]
34351
- }
34352
- ),
34353
- /* @__PURE__ */ jsx56(
34354
- SwapActionArea,
34355
- {
34356
- fromTokenSymbol: fromToken?.symbol ?? "",
34357
- allowanceStatus: execution.allowanceStatus,
34358
- txStatus: execution.txStatus,
34359
- isSubmitting: execution.isSubmitting,
34360
- isGasSponsored,
34361
- onExecute: () => void handleExecute()
34362
- }
34363
- )
34364
- ] }) });
35420
+ ),
35421
+ /* @__PURE__ */ jsx56(
35422
+ "div",
35423
+ {
35424
+ style: { flex: 1, height: "1px", backgroundColor: colors.border }
35425
+ }
35426
+ )
35427
+ ]
35428
+ }
35429
+ ),
35430
+ showReviewDetails && /* @__PURE__ */ jsxs45(
35431
+ "div",
35432
+ {
35433
+ style: {
35434
+ display: "flex",
35435
+ flexDirection: "column",
35436
+ gap: spacing[3],
35437
+ fontSize: fontSize.sm,
35438
+ marginBottom: spacing[2]
35439
+ },
35440
+ children: [
35441
+ exchangeRate !== null && /* @__PURE__ */ jsx56(
35442
+ ReviewDetailRow,
35443
+ {
35444
+ label: "Rate",
35445
+ tooltip: "Current exchange rate between the two tokens",
35446
+ value: `1 ${fromToken?.symbol} = ${fmtAmount(1 / (exchangeRate ?? 1), 4)} ${toToken?.symbol} ($${fmtAmount(fromTokenPriceUSD, 2)})`
35447
+ }
35448
+ ),
35449
+ /* @__PURE__ */ jsx56(
35450
+ ReviewDetailRow,
35451
+ {
35452
+ label: "Fee",
35453
+ tooltip: "Protocol fee charged by the bridge or DEX",
35454
+ value: protocolFeeUsd !== null ? fmtLocal(protocolFeeUsd) : "Free"
35455
+ }
35456
+ ),
35457
+ /* @__PURE__ */ jsx56(
35458
+ ReviewDetailRow,
35459
+ {
35460
+ label: "Network cost",
35461
+ tooltip: "Estimated gas fee paid to the blockchain network",
35462
+ value: isGasSponsored ? /* @__PURE__ */ jsx56(SponsoredBadge, {}) : networkCostUsd !== null ? /* @__PURE__ */ jsxs45(
35463
+ "span",
35464
+ {
35465
+ style: {
35466
+ display: "flex",
35467
+ alignItems: "center",
35468
+ gap: "0.25rem"
35469
+ },
35470
+ children: [
35471
+ /* @__PURE__ */ jsx56(GasIcon, { size: "0.875rem" }),
35472
+ fmtLocal(networkCostUsd)
35473
+ ]
35474
+ }
35475
+ ) : "\u2014"
35476
+ }
35477
+ ),
35478
+ /* @__PURE__ */ jsx56(
35479
+ ReviewDetailRow,
35480
+ {
35481
+ label: "Max slippage",
35482
+ tooltip: "Max price movement allowed before the swap automatically reverts",
35483
+ value: `${slippage}%`
35484
+ }
35485
+ ),
35486
+ (routePath || route.data?.route?.provider) && /* @__PURE__ */ jsx56(
35487
+ ReviewDetailRow,
35488
+ {
35489
+ label: "Route",
35490
+ tooltip: "Protocol or bridge used to execute your swap",
35491
+ value: /* @__PURE__ */ jsx56(
35492
+ "span",
35493
+ {
35494
+ style: {
35495
+ overflow: "hidden",
35496
+ textOverflow: "ellipsis",
35497
+ whiteSpace: "nowrap",
35498
+ maxWidth: "200px",
35499
+ display: "inline-block",
35500
+ verticalAlign: "bottom"
35501
+ },
35502
+ title: routePath ?? route.data?.route?.provider,
35503
+ children: routePath ?? route.data?.route?.provider
35504
+ }
35505
+ )
35506
+ }
35507
+ )
35508
+ ]
35509
+ }
35510
+ ),
35511
+ /* @__PURE__ */ jsx56(
35512
+ SwapActionArea,
35513
+ {
35514
+ fromTokenSymbol: fromToken?.symbol ?? "",
35515
+ allowanceStatus: execution.allowanceStatus,
35516
+ txStatus: execution.txStatus,
35517
+ isSubmitting: execution.isSubmitting,
35518
+ isGasSponsored,
35519
+ onExecute: () => void handleExecute()
35520
+ }
35521
+ )
35522
+ ]
35523
+ }
35524
+ ) });
34365
35525
  }
34366
35526
  const ctaLabel = !hasTokens ? "Get started" : !hasAmount ? "Enter an amount" : insufficient ? `Insufficient ${fromToken?.symbol} balance` : !isConnected ? "Connect Wallet" : needsDestAddress && !isValidDestAddress ? `Enter ${toChain?.networkName ?? "destination"} address` : "Review";
34367
35527
  const ctaDisabled = !hasTokens || !hasAmount || insufficient || isConnected && needsDestAddress && !isValidDestAddress;
34368
35528
  const ctaAction = !isConnected ? handleConnectAndReview : () => void handleReview();
34369
35529
  const showRateRow = hasTokens && exchangeRate !== null;
34370
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45(
35530
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45(
34371
35531
  "div",
34372
35532
  {
34373
35533
  style: { display: "flex", flexDirection: "column", minHeight: "500px" },
@@ -34493,6 +35653,91 @@ function SwapMode({
34493
35653
  zIndex: 100
34494
35654
  },
34495
35655
  children: [
35656
+ /* @__PURE__ */ jsx56(
35657
+ "p",
35658
+ {
35659
+ style: {
35660
+ fontSize: fontSize.xs,
35661
+ fontWeight: fontWeight.semibold,
35662
+ color: colors.mutedForeground,
35663
+ textTransform: "uppercase",
35664
+ letterSpacing: "0.06em",
35665
+ marginBottom: spacing[3]
35666
+ },
35667
+ children: "Appearance"
35668
+ }
35669
+ ),
35670
+ /* @__PURE__ */ jsx56("div", { style: { marginBottom: spacing[4] }, children: /* @__PURE__ */ jsxs45(
35671
+ "div",
35672
+ {
35673
+ style: {
35674
+ display: "flex",
35675
+ alignItems: "center",
35676
+ justifyContent: "space-between"
35677
+ },
35678
+ children: [
35679
+ /* @__PURE__ */ jsxs45("div", { children: [
35680
+ /* @__PURE__ */ jsx56(
35681
+ "p",
35682
+ {
35683
+ style: {
35684
+ fontSize: fontSize.sm,
35685
+ fontWeight: fontWeight.medium,
35686
+ color: colors.foreground
35687
+ },
35688
+ children: "Dark mode"
35689
+ }
35690
+ ),
35691
+ /* @__PURE__ */ jsx56(
35692
+ "p",
35693
+ {
35694
+ style: {
35695
+ fontSize: "0.625rem",
35696
+ color: colors.mutedForeground,
35697
+ marginTop: "2px"
35698
+ },
35699
+ children: resolvedTheme === "dark" ? "Dark theme active" : "Light theme active"
35700
+ }
35701
+ )
35702
+ ] }),
35703
+ /* @__PURE__ */ jsx56(
35704
+ "button",
35705
+ {
35706
+ role: "switch",
35707
+ "aria-checked": resolvedTheme === "dark",
35708
+ onClick: toggleTheme,
35709
+ style: {
35710
+ width: "2.5rem",
35711
+ height: "1.375rem",
35712
+ borderRadius: "9999px",
35713
+ backgroundColor: resolvedTheme === "dark" ? colors.primary : colors.muted,
35714
+ border: 0,
35715
+ cursor: "pointer",
35716
+ position: "relative",
35717
+ transition: "background-color 0.2s",
35718
+ flexShrink: 0
35719
+ },
35720
+ children: /* @__PURE__ */ jsx56(
35721
+ "span",
35722
+ {
35723
+ style: {
35724
+ position: "absolute",
35725
+ top: "0.1875rem",
35726
+ left: resolvedTheme === "dark" ? "calc(100% - 1rem - 0.1875rem)" : "0.1875rem",
35727
+ width: "1rem",
35728
+ height: "1rem",
35729
+ borderRadius: "9999px",
35730
+ backgroundColor: colors.primaryForeground,
35731
+ transition: "left 0.2s",
35732
+ display: "block"
35733
+ }
35734
+ }
35735
+ )
35736
+ }
35737
+ )
35738
+ ]
35739
+ }
35740
+ ) }),
34496
35741
  /* @__PURE__ */ jsx56(
34497
35742
  "p",
34498
35743
  {
@@ -35347,7 +36592,8 @@ function SwapMode({
35347
36592
  fontSize: fontSize.base,
35348
36593
  fontWeight: fontWeight.semibold,
35349
36594
  border: 0,
35350
- transition: "all 0.2s"
36595
+ transition: "all 0.2s",
36596
+ marginBottom: spacing[3]
35351
36597
  },
35352
36598
  !ctaDisabled ? {
35353
36599
  backgroundColor: colors.primary,
@@ -35645,12 +36891,15 @@ function SwapActionArea({
35645
36891
  fontSize: fontSize.xs,
35646
36892
  color: colors.mutedForeground,
35647
36893
  textAlign: "center",
35648
- marginTop: spacing[2]
36894
+ marginTop: spacing[2],
36895
+ whiteSpace: "nowrap",
36896
+ overflow: "hidden",
36897
+ textOverflow: "ellipsis"
35649
36898
  },
35650
36899
  children: [
35651
- "You'll approve ",
36900
+ "Approve ",
35652
36901
  fromTokenSymbol,
35653
- " spend, then confirm the swap \u2014 2 wallet steps."
36902
+ " access, then confirm swap \u2014 2 steps."
35654
36903
  ]
35655
36904
  }
35656
36905
  )
@@ -35865,7 +37114,14 @@ function ReviewDetailRow({
35865
37114
  value,
35866
37115
  tooltip
35867
37116
  }) {
35868
- const [tipVisible, setTipVisible] = useState28(false);
37117
+ const iconRef = useRef17(null);
37118
+ const [tipPos, setTipPos] = useState29(null);
37119
+ const handleMouseEnter = () => {
37120
+ if (!tooltip || !iconRef.current) return;
37121
+ const r = iconRef.current.getBoundingClientRect();
37122
+ setTipPos({ x: r.left + r.width / 2, y: r.top - 8 });
37123
+ };
37124
+ const handleMouseLeave = () => setTipPos(null);
35869
37125
  return /* @__PURE__ */ jsxs45(
35870
37126
  "div",
35871
37127
  {
@@ -35886,66 +37142,65 @@ function ReviewDetailRow({
35886
37142
  },
35887
37143
  children: [
35888
37144
  label,
35889
- /* @__PURE__ */ jsxs45(
37145
+ /* @__PURE__ */ jsx56(
35890
37146
  "span",
35891
37147
  {
35892
- style: {
35893
- position: "relative",
35894
- display: "inline-flex",
35895
- alignItems: "center"
35896
- },
35897
- onMouseEnter: () => setTipVisible(true),
35898
- onMouseLeave: () => setTipVisible(false),
35899
- children: [
35900
- /* @__PURE__ */ jsxs45(
35901
- "svg",
35902
- {
35903
- style: {
35904
- width: "0.875rem",
35905
- height: "0.875rem",
35906
- opacity: 0.6,
35907
- cursor: tooltip ? "help" : "default"
35908
- },
35909
- viewBox: "0 0 24 24",
35910
- fill: "none",
35911
- stroke: "currentColor",
35912
- strokeWidth: 2,
35913
- strokeLinecap: "round",
35914
- strokeLinejoin: "round",
35915
- children: [
35916
- /* @__PURE__ */ jsx56("circle", { cx: "12", cy: "12", r: "10" }),
35917
- /* @__PURE__ */ jsx56("path", { d: "M12 16v-4M12 8h.01" })
35918
- ]
35919
- }
35920
- ),
35921
- tooltip && tipVisible && /* @__PURE__ */ jsx56(
35922
- "span",
35923
- {
35924
- style: {
35925
- position: "absolute",
35926
- bottom: "calc(100% + 6px)",
35927
- left: "50%",
35928
- transform: "translateX(-50%)",
35929
- backgroundColor: "hsl(var(--tw-foreground))",
35930
- color: "hsl(var(--tw-background))",
35931
- fontSize: "0.6875rem",
35932
- lineHeight: 1.4,
35933
- padding: "0.25rem 0.5rem",
35934
- borderRadius: "0.375rem",
35935
- whiteSpace: "nowrap",
35936
- pointerEvents: "none",
35937
- zIndex: 50
35938
- },
35939
- children: tooltip
35940
- }
35941
- )
35942
- ]
37148
+ ref: iconRef,
37149
+ style: { display: "inline-flex", alignItems: "center" },
37150
+ onMouseEnter: handleMouseEnter,
37151
+ onMouseLeave: handleMouseLeave,
37152
+ children: /* @__PURE__ */ jsxs45(
37153
+ "svg",
37154
+ {
37155
+ style: {
37156
+ width: "0.875rem",
37157
+ height: "0.875rem",
37158
+ opacity: 0.6,
37159
+ cursor: tooltip ? "help" : "default"
37160
+ },
37161
+ viewBox: "0 0 24 24",
37162
+ fill: "none",
37163
+ stroke: "currentColor",
37164
+ strokeWidth: 2,
37165
+ strokeLinecap: "round",
37166
+ strokeLinejoin: "round",
37167
+ children: [
37168
+ /* @__PURE__ */ jsx56("circle", { cx: "12", cy: "12", r: "10" }),
37169
+ /* @__PURE__ */ jsx56("path", { d: "M12 16v-4M12 8h.01" })
37170
+ ]
37171
+ }
37172
+ )
35943
37173
  }
35944
37174
  )
35945
37175
  ]
35946
37176
  }
35947
37177
  ),
35948
- /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: value })
37178
+ /* @__PURE__ */ jsx56("span", { style: { color: colors.foreground, fontWeight: fontWeight.medium }, children: value }),
37179
+ tooltip && tipPos && typeof document !== "undefined" && ReactDOM.createPortal(
37180
+ /* @__PURE__ */ jsx56(
37181
+ "span",
37182
+ {
37183
+ style: {
37184
+ position: "fixed",
37185
+ left: tipPos.x,
37186
+ top: tipPos.y,
37187
+ transform: "translate(-50%, -100%)",
37188
+ backgroundColor: "hsl(220 15% 15%)",
37189
+ color: "#fff",
37190
+ fontSize: "0.6875rem",
37191
+ lineHeight: 1.4,
37192
+ padding: "0.3rem 0.6rem",
37193
+ borderRadius: "0.375rem",
37194
+ whiteSpace: "nowrap",
37195
+ pointerEvents: "none",
37196
+ zIndex: 99999,
37197
+ boxShadow: "0 4px 12px rgba(0,0,0,0.25)"
37198
+ },
37199
+ children: tooltip
37200
+ }
37201
+ ),
37202
+ document.body
37203
+ )
35949
37204
  ]
35950
37205
  }
35951
37206
  );
@@ -36147,6 +37402,7 @@ var init_SwapMode = __esm({
36147
37402
  init_utils();
36148
37403
  init_components();
36149
37404
  init_registryClient();
37405
+ init_useThemePreference();
36150
37406
  init_useWalletSessionState();
36151
37407
  init_useWalletTokenState();
36152
37408
  init_hooks2();
@@ -36183,14 +37439,14 @@ var init_swap = __esm({
36183
37439
 
36184
37440
  // src/widget/TrustwareWidgetV2.tsx
36185
37441
  import {
36186
- useState as useState29,
37442
+ useState as useState30,
36187
37443
  useEffect as useEffect31,
36188
37444
  useRef as useRef18,
36189
37445
  useCallback as useCallback23,
36190
37446
  useImperativeHandle,
36191
37447
  forwardRef
36192
37448
  } from "react";
36193
- import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
37449
+ import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
36194
37450
  function WidgetContent({
36195
37451
  style,
36196
37452
  onStateChange,
@@ -36244,7 +37500,7 @@ function WidgetInner({
36244
37500
  const { transactionStatus } = useDepositTransaction();
36245
37501
  const { resolvedTheme } = useDepositUi();
36246
37502
  const { status, revalidate, errors } = useTrustware();
36247
- const [showConfirmDialog, setShowConfirmDialog] = useState29(false);
37503
+ const [showConfirmDialog, setShowConfirmDialog] = useState30(false);
36248
37504
  const handleCloseRequest = useCallback23(() => {
36249
37505
  if (ACTIVE_TRANSACTION_STATUSES.includes(transactionStatus)) {
36250
37506
  setShowConfirmDialog(true);
@@ -36272,7 +37528,7 @@ function WidgetInner({
36272
37528
  const handleRefresh = useCallback23(() => {
36273
37529
  revalidate?.();
36274
37530
  }, [revalidate]);
36275
- return /* @__PURE__ */ jsxs46(Fragment9, { children: [
37531
+ return /* @__PURE__ */ jsxs46(Fragment10, { children: [
36276
37532
  /* @__PURE__ */ jsxs46(WidgetContainer, { theme: effectiveTheme, style, children: [
36277
37533
  /* @__PURE__ */ jsx57(
36278
37534
  WidgetContent,
@@ -36332,7 +37588,7 @@ var init_TrustwareWidgetV2 = __esm({
36332
37588
  zIndex: 12
36333
37589
  };
36334
37590
  TrustwareWidgetV2 = forwardRef(function TrustwareWidgetV22({
36335
- theme = "system",
37591
+ theme,
36336
37592
  style,
36337
37593
  initialStep = "home",
36338
37594
  defaultOpen = true,
@@ -36340,7 +37596,7 @@ var init_TrustwareWidgetV2 = __esm({
36340
37596
  onOpen,
36341
37597
  showThemeToggle = true
36342
37598
  }, ref) {
36343
- const [isOpen, setIsOpen] = useState29(defaultOpen);
37599
+ const [isOpen, setIsOpen] = useState30(defaultOpen);
36344
37600
  const closeRequestRef = useRef18(null);
36345
37601
  const config = useTrustwareConfig();
36346
37602
  const effectiveInitialStep = initialStep;
@@ -36412,24 +37668,10 @@ var init_wallets2 = __esm({
36412
37668
  });
36413
37669
 
36414
37670
  // src/types/theme.ts
36415
- var DEFAULT_THEME2, DEFAULT_MESSAGES2;
37671
+ var DEFAULT_MESSAGES2;
36416
37672
  var init_theme2 = __esm({
36417
37673
  "src/types/theme.ts"() {
36418
37674
  "use strict";
36419
- DEFAULT_THEME2 = {
36420
- primaryColor: "#4F46E5",
36421
- // Indigo-600
36422
- secondaryColor: "#6366F1",
36423
- // Indigo-500
36424
- backgroundColor: "#FFFFFF",
36425
- // White
36426
- textColor: "#111827",
36427
- // Gray-900
36428
- borderColor: "#E5E7EB",
36429
- // Gray-200
36430
- radius: 8
36431
- // 8px border radius
36432
- };
36433
37675
  DEFAULT_MESSAGES2 = {
36434
37676
  title: "Trustware SDK",
36435
37677
  description: "Seamlessly bridge assets across chains with Trustware."
@@ -36490,7 +37732,6 @@ export {
36490
37732
  DEFAULT_MESSAGES2 as DEFAULT_MESSAGES,
36491
37733
  DEFAULT_RETRY_CONFIG,
36492
37734
  DEFAULT_SLIPPAGE2 as DEFAULT_SLIPPAGE,
36493
- DEFAULT_THEME2 as DEFAULT_THEME,
36494
37735
  GTM_ID,
36495
37736
  IdentityStore,
36496
37737
  RateLimitError,