@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.cjs CHANGED
@@ -33,20 +33,12 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
33
33
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
 
35
35
  // src/config/defaults.ts
36
- var DEFAULT_SLIPPAGE, DEFAULT_AUTO_DETECT_PROVIDER, DEFAULT_THEME, DEFAULT_MESSAGES;
36
+ var DEFAULT_SLIPPAGE, DEFAULT_AUTO_DETECT_PROVIDER, DEFAULT_MESSAGES;
37
37
  var init_defaults = __esm({
38
38
  "src/config/defaults.ts"() {
39
39
  "use strict";
40
40
  DEFAULT_SLIPPAGE = 1;
41
41
  DEFAULT_AUTO_DETECT_PROVIDER = false;
42
- DEFAULT_THEME = {
43
- primaryColor: "#4F46E5",
44
- secondaryColor: "#6366F1",
45
- backgroundColor: "#FFFFFF",
46
- textColor: "#111827",
47
- borderColor: "#E5E7EB",
48
- radius: 8
49
- };
50
42
  DEFAULT_MESSAGES = {
51
43
  title: "Trustware SDK",
52
44
  description: "Seamlessly bridge assets across chains with Trustware."
@@ -142,7 +134,7 @@ function resolveConfig(input) {
142
134
  ...input.routes.options
143
135
  }
144
136
  };
145
- const theme = deepMerge(DEFAULT_THEME, input.theme);
137
+ const theme = input.theme ?? "system";
146
138
  const messages = deepMerge(DEFAULT_MESSAGES, input.messages);
147
139
  const retry = {
148
140
  autoRetry: input.retry?.autoRetry ?? DEFAULT_RETRY_CONFIG.autoRetry,
@@ -220,10 +212,7 @@ var init_store = __esm({
220
212
  ...this._cfg,
221
213
  ...patch,
222
214
  routes: { ...this._cfg.routes, ...patch.routes ?? {} },
223
- theme: {
224
- ...this._cfg.theme,
225
- ...patch.theme ?? {}
226
- },
215
+ theme: patch.theme ?? this._cfg.theme,
227
216
  messages: {
228
217
  ...this._cfg.messages,
229
218
  ...patch.messages ?? {}
@@ -442,7 +431,7 @@ var init_constants = __esm({
442
431
  "src/constants.ts"() {
443
432
  "use strict";
444
433
  SDK_NAME = "@trustware/sdk";
445
- SDK_VERSION = "1.1.8-staging.6";
434
+ SDK_VERSION = "1.1.8-staging.7";
446
435
  API_ROOT = "https://bv-staging-api.trustware.io";
447
436
  GTM_ID = "GTM-TZDGNCXB";
448
437
  API_PREFIX = "/api";
@@ -5376,10 +5365,26 @@ function compareChainPopularity(a, b) {
5376
5365
  if (rankA === null && rankB !== null) return 1;
5377
5366
  return 0;
5378
5367
  }
5379
- function sortTokensByPopularity(tokens) {
5368
+ function sortTokensByPopularity(tokens, options) {
5369
+ const nativeSet = options?.nativeAddresses ?? /* @__PURE__ */ new Set();
5370
+ const nativeSymbolSet = options?.nativeSymbols ?? /* @__PURE__ */ new Set();
5371
+ const featuredMap = options?.featuredAddresses ?? /* @__PURE__ */ new Map();
5372
+ const getMajorRank = (token) => {
5373
+ const addr = normalizeAddress3(token.address);
5374
+ if (nativeSet.has(addr)) return 0;
5375
+ if (nativeSymbolSet.has(normalizeSymbol(token.symbol))) return 0;
5376
+ if (featuredMap.has(addr)) return 1;
5377
+ return getGroupRank(token) + 2;
5378
+ };
5380
5379
  return tokens.map((token, index) => ({ token, index })).sort((a, b) => {
5381
- const rankDiff = getGroupRank(a.token) - getGroupRank(b.token);
5382
- if (rankDiff !== 0) return rankDiff;
5380
+ const majorA = getMajorRank(a.token);
5381
+ const majorB = getMajorRank(b.token);
5382
+ if (majorA !== majorB) return majorA - majorB;
5383
+ if (majorA === 1) {
5384
+ const orderA = featuredMap.get(normalizeAddress3(a.token.address)) ?? 0;
5385
+ const orderB = featuredMap.get(normalizeAddress3(b.token.address)) ?? 0;
5386
+ return orderA - orderB;
5387
+ }
5383
5388
  const chainPopularityDiff = compareChainPopularity(a.token, b.token);
5384
5389
  if (chainPopularityDiff !== 0) return chainPopularityDiff;
5385
5390
  const symbolDiff = compareText(a.token.symbol, b.token.symbol);
@@ -5438,6 +5443,1004 @@ var init_tokenPopularity = __esm({
5438
5443
  }
5439
5444
  });
5440
5445
 
5446
+ // src/widget/data/featuredAssets.json
5447
+ var featuredAssets_default;
5448
+ var init_featuredAssets = __esm({
5449
+ "src/widget/data/featuredAssets.json"() {
5450
+ featuredAssets_default = {
5451
+ "1": {
5452
+ top: [
5453
+ {
5454
+ symbol: "AAVE",
5455
+ address: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"
5456
+ },
5457
+ {
5458
+ symbol: "LINK",
5459
+ address: "0x514910771af9ca656af840dff83e8264ecf986ca"
5460
+ },
5461
+ {
5462
+ symbol: "UNI",
5463
+ address: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"
5464
+ },
5465
+ {
5466
+ symbol: "CRV",
5467
+ address: "0xd533a949740bb3306d119cc777fa900ba034cd52"
5468
+ },
5469
+ {
5470
+ symbol: "LDO",
5471
+ address: "0x5a98fcbea516cf06857215779fd812ca3bef1b32"
5472
+ },
5473
+ {
5474
+ symbol: "GRT",
5475
+ address: "0xc944e90c64b2c07662a292be6244bdf05cda44a7"
5476
+ },
5477
+ {
5478
+ symbol: "RENDER",
5479
+ address: "0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24"
5480
+ },
5481
+ {
5482
+ symbol: "PENDLE",
5483
+ address: "0x808507121b80c02388fad14726482e061b8da827"
5484
+ },
5485
+ {
5486
+ symbol: "MKR",
5487
+ address: "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2"
5488
+ },
5489
+ {
5490
+ symbol: "COMP",
5491
+ address: "0xc00e94cb662c3520282e6f5717214004a7f26888"
5492
+ },
5493
+ {
5494
+ symbol: "1INCH",
5495
+ address: "0x111111111117dc0aa78b770fa6a738034120c302"
5496
+ },
5497
+ {
5498
+ symbol: "BAL",
5499
+ address: "0xba100000625a3754423978a60c9317c58a424e3d"
5500
+ },
5501
+ {
5502
+ symbol: "SUSHI",
5503
+ address: "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2"
5504
+ },
5505
+ {
5506
+ symbol: "CAKE",
5507
+ address: "0x152649ea73beab28c5b49b26eb48f7ead6d4c898"
5508
+ },
5509
+ {
5510
+ symbol: "YFI",
5511
+ address: "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e"
5512
+ }
5513
+ ],
5514
+ stables: [
5515
+ {
5516
+ symbol: "USDT",
5517
+ address: "0xdac17f958d2ee523a2206206994597c13d831ec7"
5518
+ },
5519
+ {
5520
+ symbol: "USDC",
5521
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
5522
+ },
5523
+ {
5524
+ symbol: "DAI",
5525
+ address: "0x6b175474e89094c44da98b954eedeac495271d0f"
5526
+ },
5527
+ {
5528
+ symbol: "USDe",
5529
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3"
5530
+ },
5531
+ {
5532
+ symbol: "PYUSD",
5533
+ address: "0x6c3ea9036406852006290770bedfcaba0e23a0e8"
5534
+ },
5535
+ {
5536
+ symbol: "FDUSD",
5537
+ address: "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409"
5538
+ },
5539
+ {
5540
+ symbol: "USDS",
5541
+ address: "0xdc035d45d973e3ec169d2276ddab16f1e407384f"
5542
+ },
5543
+ {
5544
+ symbol: "EURC",
5545
+ address: "0x1abaea1f7c830bd89acc67ec4af516284b1bc33c"
5546
+ },
5547
+ {
5548
+ symbol: "crvUSD",
5549
+ address: "0xf939e0a03fb07f59a73314e73794be0e57ac1b4e"
5550
+ },
5551
+ {
5552
+ symbol: "TUSD",
5553
+ address: "0x0000000000085d4780b73119b644ae5ecd22b376"
5554
+ }
5555
+ ]
5556
+ },
5557
+ "10": {
5558
+ top: [
5559
+ {
5560
+ symbol: "OP",
5561
+ address: "0x4200000000000000000000000000000000000042"
5562
+ },
5563
+ {
5564
+ symbol: "AAVE",
5565
+ address: "0x76fb31fb4af56892a25e32cfc43de717950c9278"
5566
+ },
5567
+ {
5568
+ symbol: "LINK",
5569
+ address: "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6"
5570
+ },
5571
+ {
5572
+ symbol: "CRV",
5573
+ address: "0x0994206dfe8de6ec6920ff4d779b0d950605fb53"
5574
+ },
5575
+ {
5576
+ symbol: "LDO",
5577
+ address: "0xfdb794692724153d1488ccdbe0c56c252596735f"
5578
+ },
5579
+ {
5580
+ symbol: "ZRO",
5581
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5582
+ },
5583
+ {
5584
+ symbol: "STG",
5585
+ address: "0x296f55f8fb28e498b858d0bcda06d955b2cb3f97"
5586
+ }
5587
+ ],
5588
+ stables: [
5589
+ {
5590
+ symbol: "USDT",
5591
+ address: "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"
5592
+ },
5593
+ {
5594
+ symbol: "USDC",
5595
+ address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85"
5596
+ },
5597
+ {
5598
+ symbol: "DAI",
5599
+ address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"
5600
+ },
5601
+ {
5602
+ symbol: "FRAX",
5603
+ address: "0x2e3d870790dc77a83dd1d18184acc7439a53f475"
5604
+ },
5605
+ {
5606
+ symbol: "LUSD",
5607
+ address: "0xc40f949f8a4e094d1b49a23ea9241d289b7b2819"
5608
+ },
5609
+ {
5610
+ symbol: "MIM",
5611
+ address: "0xb153fb3d196a8eb25522705560ac152eeec57901"
5612
+ },
5613
+ {
5614
+ symbol: "sUSD",
5615
+ address: "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9"
5616
+ }
5617
+ ]
5618
+ },
5619
+ "100": {
5620
+ top: [],
5621
+ stables: [
5622
+ {
5623
+ symbol: "USDT",
5624
+ address: "0x4ecaba5870353805a9f068101a40e0f32ed605c6"
5625
+ },
5626
+ {
5627
+ symbol: "USDC",
5628
+ address: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83"
5629
+ }
5630
+ ]
5631
+ },
5632
+ "1284": {
5633
+ top: [
5634
+ {
5635
+ symbol: "WELL",
5636
+ address: "0x511ab53f793683763e5a8829738301368a2411e3"
5637
+ }
5638
+ ],
5639
+ stables: [
5640
+ {
5641
+ symbol: "xcUSDC",
5642
+ address: "0xffffffff7d2b0b761af01ca8e25242976ac0ad7d"
5643
+ },
5644
+ {
5645
+ symbol: "FRAX",
5646
+ address: "0x322e86852e492a7ee17f28a78c663da38fb33bfb"
5647
+ }
5648
+ ]
5649
+ },
5650
+ "13371": {
5651
+ top: [],
5652
+ stables: [
5653
+ {
5654
+ symbol: "USDT",
5655
+ address: "0x68bcc7f1190af20e7b572bcfb431c3ac10a936ab"
5656
+ },
5657
+ {
5658
+ symbol: "USDC",
5659
+ address: "0x6de8acc0d406837030ce4dd28e7c08c5a96a30d2"
5660
+ }
5661
+ ]
5662
+ },
5663
+ "137": {
5664
+ top: [
5665
+ {
5666
+ symbol: "AAVE",
5667
+ address: "0xd6df932a45c0f255f85145f286ea0b292b21c90b"
5668
+ },
5669
+ {
5670
+ symbol: "LINK",
5671
+ address: "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39"
5672
+ },
5673
+ {
5674
+ symbol: "UNI",
5675
+ address: "0xb33eaad8d922b1083446dc23f610c2567fb5180f"
5676
+ },
5677
+ {
5678
+ symbol: "CRV",
5679
+ address: "0x172370d5cd63279efa6d502dab29171933a610af"
5680
+ },
5681
+ {
5682
+ symbol: "LDO",
5683
+ address: "0xc3c7d422809852031b44ab29eec9f1eff2a58756"
5684
+ },
5685
+ {
5686
+ symbol: "GRT",
5687
+ address: "0x5fe2b58c013d7601147dcdd68c143a77499f5531"
5688
+ },
5689
+ {
5690
+ symbol: "RENDER",
5691
+ address: "0x61299774020da444af134c82fa83e3810b309991"
5692
+ },
5693
+ {
5694
+ symbol: "ZRO",
5695
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5696
+ },
5697
+ {
5698
+ symbol: "STG",
5699
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
5700
+ },
5701
+ {
5702
+ symbol: "MANA",
5703
+ address: "0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4"
5704
+ },
5705
+ {
5706
+ symbol: "TEL",
5707
+ address: "0xdf7837de1f2fa4631d716cf2502f8b230f1dcc32"
5708
+ },
5709
+ {
5710
+ symbol: "BONK",
5711
+ address: "0xe5b49820e5a1063f6f4ddf851327b5e8b2301048"
5712
+ }
5713
+ ],
5714
+ stables: [
5715
+ {
5716
+ symbol: "USDT",
5717
+ address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"
5718
+ },
5719
+ {
5720
+ symbol: "USDC",
5721
+ address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"
5722
+ },
5723
+ {
5724
+ symbol: "DAI",
5725
+ address: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063"
5726
+ },
5727
+ {
5728
+ symbol: "CRVUSD",
5729
+ address: "0xc4ce1d6f5d98d65ee25cf85e9f2e9dcfee6cb5d6"
5730
+ }
5731
+ ]
5732
+ },
5733
+ "143": {
5734
+ top: [],
5735
+ stables: [
5736
+ {
5737
+ symbol: "USDC",
5738
+ address: "0x754704bc059f8c67012fed69bc8a327a5aafb603"
5739
+ }
5740
+ ]
5741
+ },
5742
+ "146": {
5743
+ top: [],
5744
+ stables: [
5745
+ {
5746
+ symbol: "USDT",
5747
+ address: "0x6047828dc181963ba44974801ff68e538da5eaf9"
5748
+ },
5749
+ {
5750
+ symbol: "USDC",
5751
+ address: "0x29219dd400f2bf60e5a23d13be72b486d4038894"
5752
+ }
5753
+ ]
5754
+ },
5755
+ "1868": {
5756
+ top: [],
5757
+ stables: [
5758
+ {
5759
+ symbol: "USDT",
5760
+ address: "0x3a337a6ada9d885b6ad95ec48f9b75f197b5ae35"
5761
+ }
5762
+ ]
5763
+ },
5764
+ "2222": {
5765
+ top: [],
5766
+ stables: [
5767
+ {
5768
+ symbol: "USDt",
5769
+ address: "0x919c1c267bc06a7039e03fcc2ef738525769109c"
5770
+ },
5771
+ {
5772
+ symbol: "MIM",
5773
+ address: "0x471ee749ba270eb4c1165b5ad95e614947f6fceb"
5774
+ }
5775
+ ]
5776
+ },
5777
+ "250": {
5778
+ top: [
5779
+ {
5780
+ symbol: "STG",
5781
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
5782
+ }
5783
+ ],
5784
+ stables: [
5785
+ {
5786
+ symbol: "MIM",
5787
+ address: "0x82f0b8b456c1a451378467398982d4834b6829c1"
5788
+ }
5789
+ ]
5790
+ },
5791
+ "252": {
5792
+ top: [
5793
+ {
5794
+ symbol: "CRV",
5795
+ address: "0x331b9182088e2a7d6d3fe4742aba1fb231aecc56"
5796
+ }
5797
+ ],
5798
+ stables: [
5799
+ {
5800
+ symbol: "frxUSD",
5801
+ address: "0xfc00000000000000000000000000000000000001"
5802
+ }
5803
+ ]
5804
+ },
5805
+ "295": {
5806
+ top: [],
5807
+ stables: [
5808
+ {
5809
+ symbol: "USDC",
5810
+ address: "0x000000000000000000000000000000000006f89a"
5811
+ }
5812
+ ]
5813
+ },
5814
+ "314": {
5815
+ top: [],
5816
+ stables: [
5817
+ {
5818
+ symbol: "ceUSDC",
5819
+ address: "0x2421db204968a367cc2c866cd057fa754cb84edf"
5820
+ }
5821
+ ]
5822
+ },
5823
+ "3338": {
5824
+ top: [],
5825
+ stables: [
5826
+ {
5827
+ symbol: "USDT",
5828
+ address: "0xf4d9235269a96aadafc9adae454a0618ebe37949"
5829
+ },
5830
+ {
5831
+ symbol: "USDC",
5832
+ address: "0xbba60da06c2c5424f03f7434542280fcad453d10"
5833
+ }
5834
+ ]
5835
+ },
5836
+ "42161": {
5837
+ top: [
5838
+ {
5839
+ symbol: "AAVE",
5840
+ address: "0xba5ddd1f9d7f570dc94a51479a000e3bce967196"
5841
+ },
5842
+ {
5843
+ symbol: "LINK",
5844
+ address: "0xf97f4df75117a78c1a5a0dbb814af92458539fb4"
5845
+ },
5846
+ {
5847
+ symbol: "UNI",
5848
+ address: "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0"
5849
+ },
5850
+ {
5851
+ symbol: "CRV",
5852
+ address: "0x11cdb42b0eb46d95f990bedd4695a6e3fa034978"
5853
+ },
5854
+ {
5855
+ symbol: "GRT",
5856
+ address: "0x9623063377ad1b27544c965ccd7342f7ea7e88c7"
5857
+ },
5858
+ {
5859
+ symbol: "PENDLE",
5860
+ address: "0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8"
5861
+ },
5862
+ {
5863
+ symbol: "SUSHI",
5864
+ address: "0xd4d42f0b6def4ce0383636770ef773390d85c61a"
5865
+ },
5866
+ {
5867
+ symbol: "CAKE",
5868
+ address: "0x1b896893dfc86bb67cf57767298b9073d2c1ba2c"
5869
+ },
5870
+ {
5871
+ symbol: "ZRO",
5872
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5873
+ },
5874
+ {
5875
+ symbol: "STG",
5876
+ address: "0x6694340fc020c5e6b96567843da2df01b2ce1eb6"
5877
+ },
5878
+ {
5879
+ symbol: "ARB",
5880
+ address: "0x912ce59144191c1204e64559fe8253a0e49e6548"
5881
+ },
5882
+ {
5883
+ symbol: "cbBTC",
5884
+ address: "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf"
5885
+ },
5886
+ {
5887
+ symbol: "BONK",
5888
+ address: "0x09199d9a5f4448d0848e4395d065e1ad9c4a1f74"
5889
+ }
5890
+ ],
5891
+ stables: [
5892
+ {
5893
+ symbol: "USDT",
5894
+ address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
5895
+ },
5896
+ {
5897
+ symbol: "USDC",
5898
+ address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831"
5899
+ },
5900
+ {
5901
+ symbol: "DAI",
5902
+ address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"
5903
+ },
5904
+ {
5905
+ symbol: "PYUSD",
5906
+ address: "0x46850ad61c2b7d64d08c9c754f45254596696984"
5907
+ },
5908
+ {
5909
+ symbol: "USDD",
5910
+ address: "0x680447595e8b7b3aa1b43beb9f6098c79ac2ab3f"
5911
+ },
5912
+ {
5913
+ symbol: "FRAX",
5914
+ address: "0x17fc002b466eec40dae837fc4be5c67993ddbd6f"
5915
+ },
5916
+ {
5917
+ symbol: "LUSD",
5918
+ address: "0x93b346b6bc2548da6a1e7d98e9a421b42541425b"
5919
+ },
5920
+ {
5921
+ symbol: "MIM",
5922
+ address: "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a"
5923
+ }
5924
+ ]
5925
+ },
5926
+ "42220": {
5927
+ top: [],
5928
+ stables: [
5929
+ {
5930
+ symbol: "USDT",
5931
+ address: "0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e"
5932
+ },
5933
+ {
5934
+ symbol: "USDC",
5935
+ address: "0xceba9300f2b948710d2653dd7b07f33a8b32118c"
5936
+ }
5937
+ ]
5938
+ },
5939
+ "43114": {
5940
+ top: [
5941
+ {
5942
+ symbol: "PENDLE",
5943
+ address: "0xfb98b335551a418cd0737375a2ea0ded62ea213b"
5944
+ },
5945
+ {
5946
+ symbol: "ZRO",
5947
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
5948
+ },
5949
+ {
5950
+ symbol: "STG",
5951
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
5952
+ }
5953
+ ],
5954
+ stables: [
5955
+ {
5956
+ symbol: "USDT",
5957
+ address: "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7"
5958
+ },
5959
+ {
5960
+ symbol: "USDC",
5961
+ address: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"
5962
+ },
5963
+ {
5964
+ symbol: "EURC",
5965
+ address: "0xc891eb4cbdeff6e073e859e987815ed1505c2acd"
5966
+ },
5967
+ {
5968
+ symbol: "FRAX",
5969
+ address: "0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64"
5970
+ },
5971
+ {
5972
+ symbol: "MIM",
5973
+ address: "0x130966628846bfd36ff31a822705796e8cb8c18d"
5974
+ }
5975
+ ]
5976
+ },
5977
+ "5000": {
5978
+ top: [],
5979
+ stables: [
5980
+ {
5981
+ symbol: "USDT",
5982
+ address: "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae"
5983
+ },
5984
+ {
5985
+ symbol: "USDC",
5986
+ address: "0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9"
5987
+ },
5988
+ {
5989
+ symbol: "mUSD",
5990
+ address: "0xab575258d37eaa5c8956efabe71f4ee8f6397cf3"
5991
+ }
5992
+ ]
5993
+ },
5994
+ "534352": {
5995
+ top: [],
5996
+ stables: [
5997
+ {
5998
+ symbol: "USDT",
5999
+ address: "0xf55bec9cafdbe8730f096aa55dad6d22d44099df"
6000
+ },
6001
+ {
6002
+ symbol: "USDC",
6003
+ address: "0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4"
6004
+ }
6005
+ ]
6006
+ },
6007
+ "56": {
6008
+ top: [
6009
+ {
6010
+ symbol: "AAVE",
6011
+ address: "0xfb6115445bff7b52feb98650c87f44907e58f802"
6012
+ },
6013
+ {
6014
+ symbol: "LINK",
6015
+ address: "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd"
6016
+ },
6017
+ {
6018
+ symbol: "UNI",
6019
+ address: "0xbf5140a22578168fd562dccf235e5d43a02ce9b1"
6020
+ },
6021
+ {
6022
+ symbol: "PENDLE",
6023
+ address: "0xb3ed0a426155b79b898849803e3b36552f7ed507"
6024
+ },
6025
+ {
6026
+ symbol: "COMP",
6027
+ address: "0x52ce071bd9b1c4b00a0b92d298c512478cad67e8"
6028
+ },
6029
+ {
6030
+ symbol: "CAKE",
6031
+ address: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"
6032
+ },
6033
+ {
6034
+ symbol: "ZRO",
6035
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
6036
+ },
6037
+ {
6038
+ symbol: "STG",
6039
+ address: "0xb0d502e938ed5f4df2e681fe6e419ff29631d62b"
6040
+ },
6041
+ {
6042
+ symbol: "AXS",
6043
+ address: "0x715d400f88c167884bbcc41c5fea407ed4d2f8a0"
6044
+ },
6045
+ {
6046
+ symbol: "BONK",
6047
+ address: "0xa697e272a73744b343528c3bc4702f2565b2f422"
6048
+ }
6049
+ ],
6050
+ stables: [
6051
+ {
6052
+ symbol: "USDT",
6053
+ address: "0x55d398326f99059ff775485246999027b3197955"
6054
+ },
6055
+ {
6056
+ symbol: "USDC",
6057
+ address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"
6058
+ },
6059
+ {
6060
+ symbol: "FDUSD",
6061
+ address: "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409"
6062
+ },
6063
+ {
6064
+ symbol: "TUSD",
6065
+ address: "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9"
6066
+ }
6067
+ ]
6068
+ },
6069
+ "59144": {
6070
+ top: [
6071
+ {
6072
+ symbol: "Cake",
6073
+ address: "0x0d1e753a25ebda689453309112904807625befbe"
6074
+ }
6075
+ ],
6076
+ stables: [
6077
+ {
6078
+ symbol: "USDC",
6079
+ address: "0x176211869ca2b568f2a7d4ee941e073a821ee1ff"
6080
+ }
6081
+ ]
6082
+ },
6083
+ "80094": {
6084
+ top: [],
6085
+ stables: [
6086
+ {
6087
+ symbol: "MIM",
6088
+ address: "0x5b82028cfc477c4e7dda7ff33d59a23fa7be002a"
6089
+ }
6090
+ ]
6091
+ },
6092
+ "8453": {
6093
+ top: [
6094
+ {
6095
+ symbol: "AAVE",
6096
+ address: "0x63706e401c06ac8513145b7687a14804d17f814b"
6097
+ },
6098
+ {
6099
+ symbol: "PENDLE",
6100
+ address: "0xa99f6e6785da0f5d6fb42495fe424bce029eeb3e"
6101
+ },
6102
+ {
6103
+ symbol: "COMP",
6104
+ address: "0x9e1028f5f1d5ede59748ffcee5532509976840e0"
6105
+ },
6106
+ {
6107
+ symbol: "CAKE",
6108
+ address: "0x3055913c90fcc1a6ce9a358911721eeb942013a1"
6109
+ },
6110
+ {
6111
+ symbol: "YFI",
6112
+ address: "0x9eaf8c1e34f05a589eda6bafdf391cf6ad3cb239"
6113
+ },
6114
+ {
6115
+ symbol: "ZRO",
6116
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
6117
+ },
6118
+ {
6119
+ symbol: "STG",
6120
+ address: "0xe3b53af74a4bf62ae5511055290838050bf764df"
6121
+ },
6122
+ {
6123
+ symbol: "cbBTC",
6124
+ address: "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf"
6125
+ },
6126
+ {
6127
+ symbol: "AERO",
6128
+ address: "0x940181a94a35a4569e4529a3cdfb74e38fd98631"
6129
+ },
6130
+ {
6131
+ symbol: "VIRTUAL",
6132
+ address: "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b"
6133
+ },
6134
+ {
6135
+ symbol: "MORPHO",
6136
+ address: "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842"
6137
+ },
6138
+ {
6139
+ symbol: "BRETT",
6140
+ address: "0x532f27101965dd16442e59d40670faf5ebb142e4"
6141
+ },
6142
+ {
6143
+ symbol: "DEGEN",
6144
+ address: "0x4ed4e862860bed51a9570b96d89af5e1b0efefed"
6145
+ },
6146
+ {
6147
+ symbol: "WELL",
6148
+ address: "0xa88594d404727625a9437c3f886c7643872296ae"
6149
+ },
6150
+ {
6151
+ symbol: "ZORA",
6152
+ address: "0x1111111111166b7fe7bd91427724b487980afc69"
6153
+ }
6154
+ ],
6155
+ stables: [
6156
+ {
6157
+ symbol: "USDC",
6158
+ address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
6159
+ },
6160
+ {
6161
+ symbol: "DAI",
6162
+ address: "0x50c5725949a6f0c72e6c4a641f24049a917db0cb"
6163
+ },
6164
+ {
6165
+ symbol: "USDS",
6166
+ address: "0x820c137fa70c8691f0e44dc420a5e53c168921dc"
6167
+ },
6168
+ {
6169
+ symbol: "EURC",
6170
+ address: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"
6171
+ }
6172
+ ]
6173
+ },
6174
+ "999": {
6175
+ top: [
6176
+ {
6177
+ symbol: "AXL",
6178
+ address: "0xc4dc717136b8fd754df181d122914c2866f11a79"
6179
+ }
6180
+ ],
6181
+ stables: [
6182
+ {
6183
+ symbol: "USDC",
6184
+ address: "0xb88339cb7199b77e23db6e890353e22632ba630f"
6185
+ }
6186
+ ]
6187
+ },
6188
+ "agoric-3": {
6189
+ top: [],
6190
+ stables: [
6191
+ {
6192
+ symbol: "USDC",
6193
+ address: "ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
6194
+ }
6195
+ ]
6196
+ },
6197
+ "archway-1": {
6198
+ top: [],
6199
+ stables: [
6200
+ {
6201
+ symbol: "USDC",
6202
+ address: "ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D"
6203
+ }
6204
+ ]
6205
+ },
6206
+ "axelar-dojo-1": {
6207
+ top: [],
6208
+ stables: [
6209
+ {
6210
+ symbol: "USDe",
6211
+ address: "usde-wei"
6212
+ }
6213
+ ]
6214
+ },
6215
+ "core-1": {
6216
+ top: [],
6217
+ stables: [
6218
+ {
6219
+ symbol: "USDT",
6220
+ address: "ibc/C559977F5797BDC1D74C0836A10C379C991D664166CB60D776A83029852431B4"
6221
+ },
6222
+ {
6223
+ symbol: "USDC",
6224
+ address: "ibc/B3792E4A62DF4A934EF2DF5968556DB56F5776ED25BDE11188A4F58A7DD406F0"
6225
+ }
6226
+ ]
6227
+ },
6228
+ "cosmoshub-4": {
6229
+ top: [],
6230
+ stables: [
6231
+ {
6232
+ symbol: "USDC",
6233
+ address: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
6234
+ }
6235
+ ]
6236
+ },
6237
+ "crescent-1": {
6238
+ top: [
6239
+ {
6240
+ symbol: "AXL",
6241
+ address: "ibc/0634D0993744740D675AD01E81156EAC945AEAAE17C074918DC7FF52F41B263E"
6242
+ }
6243
+ ],
6244
+ stables: []
6245
+ },
6246
+ "dydx-mainnet-1": {
6247
+ top: [],
6248
+ stables: [
6249
+ {
6250
+ symbol: "USDC",
6251
+ address: "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5"
6252
+ }
6253
+ ]
6254
+ },
6255
+ "dymension_1100-1": {
6256
+ top: [],
6257
+ stables: [
6258
+ {
6259
+ symbol: "USDC",
6260
+ address: "ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4"
6261
+ }
6262
+ ]
6263
+ },
6264
+ "elys-1": {
6265
+ top: [
6266
+ {
6267
+ symbol: "LINK",
6268
+ address: "ibc/2A20C613F2BA256BE9FAD791B0743FBC4FE3C998EDF9234D969172F7D42FB8E7"
6269
+ }
6270
+ ],
6271
+ stables: [
6272
+ {
6273
+ symbol: "USDC",
6274
+ address: "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349"
6275
+ }
6276
+ ]
6277
+ },
6278
+ "juno-1": {
6279
+ top: [
6280
+ {
6281
+ symbol: "AXL",
6282
+ address: "ibc/EBE900AED8FF6BB2E186B17B066138F647CDD9647EF4FBE2DE6C8D4013A2C990"
6283
+ }
6284
+ ],
6285
+ stables: [
6286
+ {
6287
+ symbol: "USDC",
6288
+ address: "ibc/4A482FA914A4B9B05801ED81C33713899F322B24F76A06F4B8FE872485EA22FF"
6289
+ }
6290
+ ]
6291
+ },
6292
+ "kaiyo-1": {
6293
+ top: [
6294
+ {
6295
+ symbol: "AXL",
6296
+ address: "ibc/C01154C2547F4CB10A985EA78E7CD4BA891C1504360703A37E1D7043F06B5E1F"
6297
+ }
6298
+ ],
6299
+ stables: [
6300
+ {
6301
+ symbol: "USDC",
6302
+ address: "ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
6303
+ }
6304
+ ]
6305
+ },
6306
+ "kava_2222-10": {
6307
+ top: [],
6308
+ stables: [
6309
+ {
6310
+ symbol: "USDT",
6311
+ address: "erc20/tether/usdt"
6312
+ }
6313
+ ]
6314
+ },
6315
+ "lava-mainnet-1": {
6316
+ top: [
6317
+ {
6318
+ symbol: "OPaxl",
6319
+ address: "ibc/8F54CE650A35D2B04630DD57F91D6552E7FCA9002DBF1CFBA1254675C194C8C8"
6320
+ }
6321
+ ],
6322
+ stables: []
6323
+ },
6324
+ "migaloo-1": {
6325
+ top: [],
6326
+ stables: [
6327
+ {
6328
+ symbol: "USDC",
6329
+ address: "ibc/BC5C0BAFD19A5E4133FDA0F3E04AE1FBEE75A4A226554B2CBB021089FF2E1F8A"
6330
+ }
6331
+ ]
6332
+ },
6333
+ "neutron-1": {
6334
+ top: [
6335
+ {
6336
+ symbol: "AXL",
6337
+ address: "ibc/C0E66D1C81D8AAF0E6896E05190FDFBC222367148F86AC3EA679C28327A763CD"
6338
+ }
6339
+ ],
6340
+ stables: [
6341
+ {
6342
+ symbol: "USDC",
6343
+ address: "ibc/B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81"
6344
+ }
6345
+ ]
6346
+ },
6347
+ "noble-1": {
6348
+ top: [],
6349
+ stables: [
6350
+ {
6351
+ symbol: "USDY",
6352
+ address: "ausdy"
6353
+ }
6354
+ ]
6355
+ },
6356
+ "osmosis-1": {
6357
+ top: [
6358
+ {
6359
+ symbol: "AXL",
6360
+ address: "ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E"
6361
+ }
6362
+ ],
6363
+ stables: [
6364
+ {
6365
+ symbol: "USDT",
6366
+ address: "ibc/4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB"
6367
+ },
6368
+ {
6369
+ symbol: "USDC",
6370
+ address: "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4"
6371
+ },
6372
+ {
6373
+ symbol: "USDY",
6374
+ address: "ibc/23104D411A6EB6031FA92FB75F227422B84989969E91DCAD56A535DD7FF0A373"
6375
+ }
6376
+ ]
6377
+ },
6378
+ "phoenix-1": {
6379
+ top: [],
6380
+ stables: [
6381
+ {
6382
+ symbol: "USDC",
6383
+ address: "ibc/2C962DAB9F57FE0921435426AE75196009FAA1981BF86991203C8411F8980FDB"
6384
+ }
6385
+ ]
6386
+ },
6387
+ "ssc-1": {
6388
+ top: [
6389
+ {
6390
+ symbol: "UNI",
6391
+ address: "ibc/E4859520008F30CAB8A6548A390BC10C45F667A26A5A22D8891A79589DF57C41"
6392
+ }
6393
+ ],
6394
+ stables: [
6395
+ {
6396
+ symbol: "USDT",
6397
+ address: "ibc/B5F6DCC4FEF6BBBC356C67C46072AB3C01443FB5E3D19538C52A3CD439BE6BE3"
6398
+ },
6399
+ {
6400
+ symbol: "USDC",
6401
+ address: "ibc/37EF240838413BD7D3496183213F7F0F483EC7A330328F16AD901A1AC1450F72"
6402
+ },
6403
+ {
6404
+ symbol: "USDe",
6405
+ address: "ibc/23B8A6E4D4AD864A4DF7FBBC40818473691395EF9B6D8B8277037D536417768E"
6406
+ },
6407
+ {
6408
+ symbol: "USDY",
6409
+ address: "ibc/2115CC1B823DE5CC635692CB95E50E1C601A9B432703F7A611B4E492A914D968"
6410
+ }
6411
+ ]
6412
+ },
6413
+ "stargaze-1": {
6414
+ top: [],
6415
+ stables: [
6416
+ {
6417
+ symbol: "USDC",
6418
+ address: "ibc/4A1C18CA7F50544760CF306189B810CE4C1CB156C7FC870143D401FE7280E591"
6419
+ }
6420
+ ]
6421
+ },
6422
+ "umee-1": {
6423
+ top: [
6424
+ {
6425
+ symbol: "AXL",
6426
+ address: "ibc/D1CB2804AA5EB64D503F28E8DF3552F8A4D642802B66EFE50DE432B755F37AE1"
6427
+ }
6428
+ ],
6429
+ stables: []
6430
+ },
6431
+ "xion-mainnet-1": {
6432
+ top: [],
6433
+ stables: [
6434
+ {
6435
+ symbol: "USDC",
6436
+ address: "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349"
6437
+ }
6438
+ ]
6439
+ }
6440
+ };
6441
+ }
6442
+ });
6443
+
5441
6444
  // src/core/useTokens.ts
5442
6445
  function mapTokenDefToToken(tokenDef) {
5443
6446
  return {
@@ -5559,13 +6562,40 @@ function useTokens(chainId) {
5559
6562
  setIsLoadingMore(false);
5560
6563
  }
5561
6564
  };
6565
+ const featuredAddresses = (0, import_react4.useMemo)(() => {
6566
+ const key = chainId?.toString() ?? "";
6567
+ const chain = FEATURED[key];
6568
+ if (!chain) return /* @__PURE__ */ new Map();
6569
+ const map = /* @__PURE__ */ new Map();
6570
+ let order = 0;
6571
+ for (const s of chain.stables) map.set(s.address.toLowerCase(), order++);
6572
+ for (const t of chain.top) map.set(t.address.toLowerCase(), order++);
6573
+ return map;
6574
+ }, [chainId]);
6575
+ const nativeSymbols = (0, import_react4.useMemo)(() => {
6576
+ if (!chainId) return /* @__PURE__ */ new Set();
6577
+ const chain = chainMap.get(chainId.toString());
6578
+ const sym = chain?.nativeCurrency?.symbol;
6579
+ if (!sym) return /* @__PURE__ */ new Set();
6580
+ return /* @__PURE__ */ new Set([sym.toUpperCase()]);
6581
+ }, [chainId, chainMap]);
5562
6582
  const filteredTokens = (0, import_react4.useMemo)(() => {
5563
6583
  const query = searchQuery.toLowerCase().trim();
5564
6584
  const source = query.length === 0 || tokensPaginationEnabled ? tokens : tokens.filter(
5565
6585
  (token) => token.symbol.toLowerCase().includes(query) || token.name.toLowerCase().includes(query) || token.address.toLowerCase().includes(query)
5566
6586
  );
5567
- return sortTokensByPopularity(source);
5568
- }, [tokens, searchQuery, tokensPaginationEnabled]);
6587
+ return sortTokensByPopularity(source, {
6588
+ nativeAddresses: NATIVE_ADDRESSES,
6589
+ nativeSymbols,
6590
+ featuredAddresses
6591
+ });
6592
+ }, [
6593
+ tokens,
6594
+ searchQuery,
6595
+ tokensPaginationEnabled,
6596
+ nativeSymbols,
6597
+ featuredAddresses
6598
+ ]);
5569
6599
  return {
5570
6600
  tokens,
5571
6601
  filteredTokens,
@@ -5578,7 +6608,7 @@ function useTokens(chainId) {
5578
6608
  isLoadingMore
5579
6609
  };
5580
6610
  }
5581
- var import_react4, DEFAULT_PAGE_LIMIT;
6611
+ var import_react4, FEATURED, NATIVE_ADDRESSES, DEFAULT_PAGE_LIMIT;
5582
6612
  var init_useTokens = __esm({
5583
6613
  "src/core/useTokens.ts"() {
5584
6614
  "use strict";
@@ -5587,6 +6617,15 @@ var init_useTokens = __esm({
5587
6617
  init_useChains();
5588
6618
  init_tokenPopularity();
5589
6619
  init_store();
6620
+ init_chainHelpers();
6621
+ init_featuredAssets();
6622
+ FEATURED = featuredAssets_default;
6623
+ NATIVE_ADDRESSES = /* @__PURE__ */ new Set([
6624
+ NATIVE_EVM2.toLowerCase(),
6625
+ NATIVE_SOLANA2.toLowerCase(),
6626
+ // Some EVM chains (e.g. ZKsync, HyperEVM) use the zero address for the native token
6627
+ "0x0000000000000000000000000000000000000000"
6628
+ ]);
5590
6629
  DEFAULT_PAGE_LIMIT = 100;
5591
6630
  }
5592
6631
  });
@@ -5923,27 +6962,38 @@ var init_useDepositNavigationState = __esm({
5923
6962
  });
5924
6963
 
5925
6964
  // src/widget/state/deposit/useThemePreference.ts
5926
- function getInitialTheme() {
5927
- if (typeof window === "undefined") {
5928
- return "light";
5929
- }
6965
+ function resolveConfigTheme(configTheme) {
6966
+ if (typeof window === "undefined") return "light";
6967
+ if (configTheme !== "system") return configTheme;
5930
6968
  try {
5931
6969
  const stored = localStorage.getItem(THEME_STORAGE_KEY);
5932
- if (stored === "light" || stored === "dark") {
5933
- return stored;
5934
- }
6970
+ if (stored === "light" || stored === "dark") return stored;
5935
6971
  } catch {
5936
6972
  }
5937
- if (typeof window !== "undefined" && window.matchMedia) {
5938
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
5939
- }
5940
- return "light";
6973
+ return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
5941
6974
  }
5942
- function useThemePreference() {
5943
- const [resolvedTheme, setResolvedTheme] = (0, import_react7.useState)("light");
5944
- (0, import_react8.useEffect)(() => {
5945
- setResolvedTheme(getInitialTheme());
5946
- }, []);
6975
+ function useThemePreference(configTheme = "system") {
6976
+ const [resolvedTheme, setResolvedTheme] = (0, import_react7.useState)(
6977
+ () => resolveConfigTheme(configTheme)
6978
+ );
6979
+ (0, import_react7.useEffect)(() => {
6980
+ setResolvedTheme(resolveConfigTheme(configTheme));
6981
+ }, [configTheme]);
6982
+ (0, import_react7.useEffect)(() => {
6983
+ if (configTheme !== "system") return;
6984
+ if (typeof window === "undefined" || !window.matchMedia) return;
6985
+ try {
6986
+ const stored = localStorage.getItem(THEME_STORAGE_KEY);
6987
+ if (stored === "light" || stored === "dark") return;
6988
+ } catch {
6989
+ }
6990
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
6991
+ const handler = (e2) => {
6992
+ setResolvedTheme(e2.matches ? "dark" : "light");
6993
+ };
6994
+ mediaQuery.addEventListener("change", handler);
6995
+ return () => mediaQuery.removeEventListener("change", handler);
6996
+ }, [configTheme]);
5947
6997
  const toggleTheme = (0, import_react7.useCallback)(() => {
5948
6998
  setResolvedTheme((current) => {
5949
6999
  const nextTheme = current === "light" ? "dark" : "light";
@@ -5959,28 +7009,27 @@ function useThemePreference() {
5959
7009
  toggleTheme
5960
7010
  };
5961
7011
  }
5962
- var import_react7, import_react8, THEME_STORAGE_KEY;
7012
+ var import_react7, THEME_STORAGE_KEY;
5963
7013
  var init_useThemePreference = __esm({
5964
7014
  "src/widget/state/deposit/useThemePreference.ts"() {
5965
7015
  "use strict";
5966
7016
  import_react7 = require("react");
5967
- import_react8 = require("react");
5968
7017
  THEME_STORAGE_KEY = "trustware-widget-theme";
5969
7018
  }
5970
7019
  });
5971
7020
 
5972
7021
  // src/widget/state/deposit/useWalletSessionState.ts
5973
7022
  function useWalletSessionState() {
5974
- const [selectedWallet, setSelectedWallet] = (0, import_react9.useState)(walletManager.wallet);
5975
- const [walletAddress, setWalletAddress] = (0, import_react9.useState)(null);
5976
- const [walletStatus, setWalletStatus] = (0, import_react9.useState)(
7023
+ const [selectedWallet, setSelectedWallet] = (0, import_react8.useState)(walletManager.wallet);
7024
+ const [walletAddress, setWalletAddress] = (0, import_react8.useState)(null);
7025
+ const [walletStatus, setWalletStatus] = (0, import_react8.useState)(
5977
7026
  walletManager.status
5978
7027
  );
5979
7028
  const { detected } = useWalletDetection();
5980
- (0, import_react9.useEffect)(() => {
7029
+ (0, import_react8.useEffect)(() => {
5981
7030
  walletManager.setDetected(detected);
5982
7031
  }, [detected]);
5983
- (0, import_react9.useEffect)(() => {
7032
+ (0, import_react8.useEffect)(() => {
5984
7033
  const unsubscribe = walletManager.onChange((status) => {
5985
7034
  setWalletStatus(status);
5986
7035
  setSelectedWallet(walletManager.wallet);
@@ -6001,13 +7050,13 @@ function useWalletSessionState() {
6001
7050
  unsubscribe();
6002
7051
  };
6003
7052
  }, []);
6004
- const connectWallet = (0, import_react9.useCallback)(async (wallet) => {
7053
+ const connectWallet = (0, import_react8.useCallback)(async (wallet) => {
6005
7054
  await walletManager.connectDetected(wallet);
6006
7055
  const error = walletManager.error;
6007
7056
  const api = walletManager.wallet;
6008
7057
  return { error, api };
6009
7058
  }, []);
6010
- const disconnectWallet = (0, import_react9.useCallback)(async () => {
7059
+ const disconnectWallet = (0, import_react8.useCallback)(async () => {
6011
7060
  await walletManager.disconnect();
6012
7061
  }, []);
6013
7062
  return {
@@ -6018,11 +7067,11 @@ function useWalletSessionState() {
6018
7067
  disconnectWallet
6019
7068
  };
6020
7069
  }
6021
- var import_react9;
7070
+ var import_react8;
6022
7071
  var init_useWalletSessionState = __esm({
6023
7072
  "src/widget/state/deposit/useWalletSessionState.ts"() {
6024
7073
  "use strict";
6025
- import_react9 = require("react");
7074
+ import_react8 = require("react");
6026
7075
  init_wallets();
6027
7076
  }
6028
7077
  });
@@ -6034,7 +7083,7 @@ function useWalletConnect({
6034
7083
  }) {
6035
7084
  const walletConnectCfg = TrustwareConfigStore.peek()?.walletConnect;
6036
7085
  const connectWC = useWalletConnectConnect(walletConnectCfg);
6037
- const WalletConnect = (0, import_react10.useCallback)(async () => {
7086
+ const WalletConnect = (0, import_react9.useCallback)(async () => {
6038
7087
  if (walletManager.status === "connected" && walletManager.connectedVia === "walletconnect") {
6039
7088
  const address = walletManager.identity?.addresses[0]?.address ?? null;
6040
7089
  if (address) {
@@ -6054,7 +7103,7 @@ function useWalletConnect({
6054
7103
  setWalletType("other");
6055
7104
  }
6056
7105
  }, [connectWC, setCurrentStep, setWalletType]);
6057
- const disconnectWalletConnect = (0, import_react10.useCallback)(async () => {
7106
+ const disconnectWalletConnect = (0, import_react9.useCallback)(async () => {
6058
7107
  await walletManager.disconnect();
6059
7108
  setWalletType("other");
6060
7109
  setCurrentStep("home");
@@ -6066,16 +7115,74 @@ function useWalletConnect({
6066
7115
  disconnectWalletConnect
6067
7116
  };
6068
7117
  }
6069
- var import_react10;
7118
+ var import_react9;
6070
7119
  var init_useWalletConnect = __esm({
6071
7120
  "src/widget/state/deposit/useWalletConnect.ts"() {
6072
7121
  "use strict";
6073
- import_react10 = require("react");
7122
+ import_react9 = require("react");
6074
7123
  init_config2();
6075
7124
  init_wallets();
6076
7125
  }
6077
7126
  });
6078
7127
 
7128
+ // src/hooks/useTrustwareConfig.ts
7129
+ function useTrustwareConfig() {
7130
+ const [cfg, setCfg] = (0, import_react10.useState)(() => {
7131
+ try {
7132
+ return TrustwareConfigStore.get();
7133
+ } catch {
7134
+ return {
7135
+ apiKey: "",
7136
+ routes: {
7137
+ toChain: "",
7138
+ toToken: "",
7139
+ toAddress: void 0,
7140
+ defaultSlippage: 1,
7141
+ routeType: "swap",
7142
+ options: {}
7143
+ },
7144
+ autoDetectProvider: false,
7145
+ theme: "system",
7146
+ messages: {
7147
+ title: "Trustware SDK",
7148
+ description: "Seamlessly bridge assets across chains with Trustware."
7149
+ },
7150
+ retry: {
7151
+ autoRetry: true,
7152
+ maxRetries: 3,
7153
+ baseDelayMs: 1e3,
7154
+ approachingThreshold: 5
7155
+ },
7156
+ features: {
7157
+ tokensPagination: true,
7158
+ balanceStreaming: false,
7159
+ shouldAllowGA4: true,
7160
+ swapMode: false,
7161
+ swapDefaultDestToken: null,
7162
+ swapLockDestToken: false,
7163
+ swapAllowedDestTokens: null
7164
+ }
7165
+ };
7166
+ }
7167
+ });
7168
+ (0, import_react10.useEffect)(() => {
7169
+ const unsubscribe = TrustwareConfigStore.subscribe(setCfg);
7170
+ return () => {
7171
+ unsubscribe();
7172
+ };
7173
+ }, []);
7174
+ return cfg;
7175
+ }
7176
+ var import_react10;
7177
+ var init_useTrustwareConfig = __esm({
7178
+ "src/hooks/useTrustwareConfig.ts"() {
7179
+ "use strict";
7180
+ "use client";
7181
+ import_react10 = require("react");
7182
+ init_store();
7183
+ }
7184
+ });
7185
+
6079
7186
  // src/widget/context/DepositContext.tsx
6080
7187
  function DepositProvider({
6081
7188
  children,
@@ -6091,7 +7198,8 @@ function DepositProvider({
6091
7198
  resetNavigation,
6092
7199
  setCurrentStepInternal
6093
7200
  } = useDepositNavigationState(initialStep);
6094
- const { resolvedTheme, toggleTheme } = useThemePreference();
7201
+ const config = useTrustwareConfig();
7202
+ const { resolvedTheme, toggleTheme } = useThemePreference(config.theme);
6095
7203
  const {
6096
7204
  selectedWallet,
6097
7205
  walletAddress: otherWalletAddress,
@@ -6291,6 +7399,7 @@ var init_DepositContext = __esm({
6291
7399
  init_useWalletTokenState();
6292
7400
  init_useWalletConnect();
6293
7401
  init_wallets();
7402
+ init_useTrustwareConfig();
6294
7403
  import_jsx_runtime2 = require("react/jsx-runtime");
6295
7404
  DepositContext = (0, import_react11.createContext)(
6296
7405
  void 0
@@ -6568,71 +7677,6 @@ var init_useRouteBuilder = __esm({
6568
7677
  }
6569
7678
  });
6570
7679
 
6571
- // src/hooks/useTrustwareConfig.ts
6572
- function useTrustwareConfig() {
6573
- const [cfg, setCfg] = (0, import_react13.useState)(() => {
6574
- try {
6575
- return TrustwareConfigStore.get();
6576
- } catch {
6577
- return {
6578
- apiKey: "",
6579
- routes: {
6580
- toChain: "",
6581
- toToken: "",
6582
- toAddress: void 0,
6583
- defaultSlippage: 1,
6584
- routeType: "swap",
6585
- options: {}
6586
- },
6587
- autoDetectProvider: false,
6588
- theme: {
6589
- primaryColor: "#4F46E5",
6590
- secondaryColor: "#6366F1",
6591
- backgroundColor: "#FFFFFF",
6592
- textColor: "#111827",
6593
- borderColor: "#E5E7EB",
6594
- radius: 8
6595
- },
6596
- messages: {
6597
- title: "Trustware SDK",
6598
- description: "Seamlessly bridge assets across chains with Trustware."
6599
- },
6600
- retry: {
6601
- autoRetry: true,
6602
- maxRetries: 3,
6603
- baseDelayMs: 1e3,
6604
- approachingThreshold: 5
6605
- },
6606
- features: {
6607
- tokensPagination: true,
6608
- balanceStreaming: false,
6609
- shouldAllowGA4: true,
6610
- swapMode: false,
6611
- swapDefaultDestToken: null,
6612
- swapLockDestToken: false,
6613
- swapAllowedDestTokens: null
6614
- }
6615
- };
6616
- }
6617
- });
6618
- (0, import_react13.useEffect)(() => {
6619
- const unsubscribe = TrustwareConfigStore.subscribe(setCfg);
6620
- return () => {
6621
- unsubscribe();
6622
- };
6623
- }, []);
6624
- return cfg;
6625
- }
6626
- var import_react13;
6627
- var init_useTrustwareConfig = __esm({
6628
- "src/hooks/useTrustwareConfig.ts"() {
6629
- "use strict";
6630
- "use client";
6631
- import_react13 = require("react");
6632
- init_store();
6633
- }
6634
- });
6635
-
6636
7680
  // src/widget/hooks/useAmountConstraints.ts
6637
7681
  function parsePositiveNumber(value) {
6638
7682
  if (value === null || value === void 0) return void 0;
@@ -6644,7 +7688,7 @@ function parsePositiveNumber(value) {
6644
7688
  function useAmountConstraints() {
6645
7689
  const config = useTrustwareConfig();
6646
7690
  const routeOptions = config.routes?.options ?? {};
6647
- const fixedFromAmountString = (0, import_react14.useMemo)(() => {
7691
+ const fixedFromAmountString = (0, import_react13.useMemo)(() => {
6648
7692
  const raw = routeOptions.fixedFromAmount;
6649
7693
  if (raw === null || raw === void 0) return void 0;
6650
7694
  const str = String(raw).trim();
@@ -6652,16 +7696,16 @@ function useAmountConstraints() {
6652
7696
  const n = Number(str);
6653
7697
  return Number.isFinite(n) && n > 0 ? str : void 0;
6654
7698
  }, [routeOptions.fixedFromAmount]);
6655
- const fixedFromAmountValue = (0, import_react14.useMemo)(() => {
7699
+ const fixedFromAmountValue = (0, import_react13.useMemo)(() => {
6656
7700
  if (!fixedFromAmountString) return void 0;
6657
7701
  const n = Number(fixedFromAmountString);
6658
7702
  return Number.isFinite(n) ? n : void 0;
6659
7703
  }, [fixedFromAmountString]);
6660
- const minAmountUsd = (0, import_react14.useMemo)(
7704
+ const minAmountUsd = (0, import_react13.useMemo)(
6661
7705
  () => parsePositiveNumber(routeOptions.minAmountOut),
6662
7706
  [routeOptions.minAmountOut]
6663
7707
  );
6664
- const maxAmountUsd = (0, import_react14.useMemo)(
7708
+ const maxAmountUsd = (0, import_react13.useMemo)(
6665
7709
  () => parsePositiveNumber(routeOptions.maxAmountOut),
6666
7710
  [routeOptions.maxAmountOut]
6667
7711
  );
@@ -6691,11 +7735,11 @@ function getUsdAmountRangeError(amount, min, max) {
6691
7735
  }
6692
7736
  return null;
6693
7737
  }
6694
- var import_react14;
7738
+ var import_react13;
6695
7739
  var init_useAmountConstraints = __esm({
6696
7740
  "src/widget/hooks/useAmountConstraints.ts"() {
6697
7741
  "use strict";
6698
- import_react14 = require("react");
7742
+ import_react13 = require("react");
6699
7743
  init_useTrustwareConfig();
6700
7744
  }
6701
7745
  });
@@ -6710,12 +7754,12 @@ function useTransactionSubmit() {
6710
7754
  setErrorMessage,
6711
7755
  setIntentId
6712
7756
  } = useDepositTransaction();
6713
- const [state, setState] = (0, import_react15.useState)({
7757
+ const [state, setState] = (0, import_react14.useState)({
6714
7758
  isSubmitting: false,
6715
7759
  txHash: null,
6716
7760
  error: null
6717
7761
  });
6718
- const submitTransaction = (0, import_react15.useCallback)(
7762
+ const submitTransaction = (0, import_react14.useCallback)(
6719
7763
  async (routeResult, sendOverride) => {
6720
7764
  if (!routeResult?.txReq) {
6721
7765
  const errorMsg = "Invalid route data. Please try again.";
@@ -6782,7 +7826,7 @@ function useTransactionSubmit() {
6782
7826
  setIntentId
6783
7827
  ]
6784
7828
  );
6785
- const resetSubmit = (0, import_react15.useCallback)(() => {
7829
+ const resetSubmit = (0, import_react14.useCallback)(() => {
6786
7830
  setState({
6787
7831
  isSubmitting: false,
6788
7832
  txHash: null,
@@ -6833,12 +7877,12 @@ function mapTransactionError(err) {
6833
7877
  }
6834
7878
  return cleanedMsg || "Transaction failed. Please try again.";
6835
7879
  }
6836
- var import_react15;
7880
+ var import_react14;
6837
7881
  var init_useTransactionSubmit = __esm({
6838
7882
  "src/widget/hooks/useTransactionSubmit.ts"() {
6839
7883
  "use strict";
6840
7884
  "use client";
6841
- import_react15 = require("react");
7885
+ import_react14 = require("react");
6842
7886
  init_core2();
6843
7887
  init_routes();
6844
7888
  init_DepositContext();
@@ -6847,16 +7891,16 @@ var init_useTransactionSubmit = __esm({
6847
7891
 
6848
7892
  // src/hooks/useGTM.ts
6849
7893
  function useGTM(gtmId) {
6850
- const isInitialized = (0, import_react16.useRef)(false);
6851
- const scriptRef = (0, import_react16.useRef)(null);
6852
- const isGA4Allowed = (0, import_react16.useCallback)(() => {
7894
+ const isInitialized = (0, import_react15.useRef)(false);
7895
+ const scriptRef = (0, import_react15.useRef)(null);
7896
+ const isGA4Allowed = (0, import_react15.useCallback)(() => {
6853
7897
  try {
6854
7898
  return Trustware.getConfig().features.shouldAllowGA4;
6855
7899
  } catch {
6856
7900
  return false;
6857
7901
  }
6858
7902
  }, []);
6859
- (0, import_react16.useEffect)(() => {
7903
+ (0, import_react15.useEffect)(() => {
6860
7904
  if (!isGA4Allowed()) {
6861
7905
  console.warn(
6862
7906
  "useGTM: GA4 tracking is disabled or Trustware config not initialized."
@@ -6898,7 +7942,7 @@ function useGTM(gtmId) {
6898
7942
  isInitialized.current = false;
6899
7943
  };
6900
7944
  }, [gtmId, isGA4Allowed]);
6901
- const addNoscriptIframe = (0, import_react16.useCallback)(() => {
7945
+ const addNoscriptIframe = (0, import_react15.useCallback)(() => {
6902
7946
  if (!isGA4Allowed()) return;
6903
7947
  if (document.querySelector('iframe[src*="googletagmanager.com/ns.html"]'))
6904
7948
  return;
@@ -6912,7 +7956,7 @@ function useGTM(gtmId) {
6912
7956
  noscript.appendChild(iframe);
6913
7957
  document.body.insertBefore(noscript, document.body.firstChild);
6914
7958
  }, [gtmId, isGA4Allowed]);
6915
- const trackEvent = (0, import_react16.useCallback)(
7959
+ const trackEvent = (0, import_react15.useCallback)(
6916
7960
  (eventName, eventParams = {}) => {
6917
7961
  if (!isInitialized.current) {
6918
7962
  console.warn(
@@ -6929,7 +7973,7 @@ function useGTM(gtmId) {
6929
7973
  },
6930
7974
  []
6931
7975
  );
6932
- const trackPageView = (0, import_react16.useCallback)(
7976
+ const trackPageView = (0, import_react15.useCallback)(
6933
7977
  (pagePath, pageTitle = document.title) => {
6934
7978
  trackEvent("page_view", {
6935
7979
  page_path: pagePath,
@@ -6939,7 +7983,7 @@ function useGTM(gtmId) {
6939
7983
  },
6940
7984
  [trackEvent]
6941
7985
  );
6942
- const setUserProperty = (0, import_react16.useCallback)(
7986
+ const setUserProperty = (0, import_react15.useCallback)(
6943
7987
  (propertyName, value) => {
6944
7988
  if (!isInitialized.current) {
6945
7989
  console.warn(
@@ -6956,7 +8000,7 @@ function useGTM(gtmId) {
6956
8000
  },
6957
8001
  []
6958
8002
  );
6959
- const directGtag = (0, import_react16.useCallback)(
8003
+ const directGtag = (0, import_react15.useCallback)(
6960
8004
  (command, ...args) => {
6961
8005
  if (!isGA4Allowed()) return;
6962
8006
  if (!window.gtag) {
@@ -6977,11 +8021,11 @@ function useGTM(gtmId) {
6977
8021
  addNoscriptIframe
6978
8022
  };
6979
8023
  }
6980
- var import_react16;
8024
+ var import_react15;
6981
8025
  var init_useGTM = __esm({
6982
8026
  "src/hooks/useGTM.ts"() {
6983
8027
  "use strict";
6984
- import_react16 = require("react");
8028
+ import_react15 = require("react");
6985
8029
  init_core2();
6986
8030
  }
6987
8031
  });
@@ -7009,19 +8053,19 @@ function useTransactionPolling() {
7009
8053
  }
7010
8054
  })();
7011
8055
  const { trackEvent } = useGTM(GTM_ID);
7012
- const [state, setState] = (0, import_react17.useState)({
8056
+ const [state, setState] = (0, import_react16.useState)({
7013
8057
  isPolling: false,
7014
8058
  apiStatus: null,
7015
8059
  error: null,
7016
8060
  transaction: null,
7017
8061
  receiptSubmitted: false
7018
8062
  });
7019
- const pollingRef = (0, import_react17.useRef)(null);
7020
- const timeoutRef = (0, import_react17.useRef)(null);
7021
- const abortRef = (0, import_react17.useRef)(false);
7022
- const startTimeRef = (0, import_react17.useRef)(0);
7023
- const pollCountRef = (0, import_react17.useRef)(0);
7024
- const clearPolling = (0, import_react17.useCallback)(() => {
8063
+ const pollingRef = (0, import_react16.useRef)(null);
8064
+ const timeoutRef = (0, import_react16.useRef)(null);
8065
+ const abortRef = (0, import_react16.useRef)(false);
8066
+ const startTimeRef = (0, import_react16.useRef)(0);
8067
+ const pollCountRef = (0, import_react16.useRef)(0);
8068
+ const clearPolling = (0, import_react16.useCallback)(() => {
7025
8069
  abortRef.current = true;
7026
8070
  if (pollingRef.current) {
7027
8071
  clearTimeout(pollingRef.current);
@@ -7032,7 +8076,7 @@ function useTransactionPolling() {
7032
8076
  timeoutRef.current = null;
7033
8077
  }
7034
8078
  }, []);
7035
- const startPolling = (0, import_react17.useCallback)(
8079
+ const startPolling = (0, import_react16.useCallback)(
7036
8080
  async (intentId, _txHash) => {
7037
8081
  clearPolling();
7038
8082
  abortRef.current = false;
@@ -7161,14 +8205,14 @@ function useTransactionPolling() {
7161
8205
  trackEvent
7162
8206
  ]
7163
8207
  );
7164
- const stopPolling = (0, import_react17.useCallback)(() => {
8208
+ const stopPolling = (0, import_react16.useCallback)(() => {
7165
8209
  clearPolling();
7166
8210
  setState((prev) => ({
7167
8211
  ...prev,
7168
8212
  isPolling: false
7169
8213
  }));
7170
8214
  }, [clearPolling]);
7171
- const resetPolling = (0, import_react17.useCallback)(() => {
8215
+ const resetPolling = (0, import_react16.useCallback)(() => {
7172
8216
  clearPolling();
7173
8217
  setState({
7174
8218
  isPolling: false,
@@ -7178,9 +8222,9 @@ function useTransactionPolling() {
7178
8222
  receiptSubmitted: false
7179
8223
  });
7180
8224
  }, [clearPolling]);
7181
- const clearPollingRef = (0, import_react17.useRef)(clearPolling);
8225
+ const clearPollingRef = (0, import_react16.useRef)(clearPolling);
7182
8226
  clearPollingRef.current = clearPolling;
7183
- (0, import_react17.useEffect)(() => {
8227
+ (0, import_react16.useEffect)(() => {
7184
8228
  return () => {
7185
8229
  clearPollingRef.current();
7186
8230
  };
@@ -7239,12 +8283,12 @@ function mapFailedTransactionError(tx) {
7239
8283
  }
7240
8284
  return "Transaction failed. Please try again or contact support if the issue persists.";
7241
8285
  }
7242
- var import_react17, FAST_POLL_INTERVAL_MS, NORMAL_POLL_INTERVAL_MS, POLL_TIMEOUT_MS;
8286
+ var import_react16, FAST_POLL_INTERVAL_MS, NORMAL_POLL_INTERVAL_MS, POLL_TIMEOUT_MS;
7243
8287
  var init_useTransactionPolling = __esm({
7244
8288
  "src/widget/hooks/useTransactionPolling.ts"() {
7245
8289
  "use strict";
7246
8290
  "use client";
7247
- import_react17 = require("react");
8291
+ import_react16 = require("react");
7248
8292
  init_routes();
7249
8293
  init_DepositContext();
7250
8294
  init_provider();
@@ -7277,28 +8321,28 @@ function useWalletTokenState({
7277
8321
  selectedToken,
7278
8322
  setSelectedToken
7279
8323
  }) {
7280
- const [yourWalletTokens, setYourWalletTokens] = (0, import_react18.useState)([]);
7281
- const [yourWalletTokensLoading, setYourWalletTokensLoading] = (0, import_react18.useState)(false);
7282
- const [walletTokensReloadNonce, setWalletTokensReloadNonce] = (0, import_react18.useState)(0);
7283
- const lastLoadedWalletRef = (0, import_react18.useRef)(null);
8324
+ const [yourWalletTokens, setYourWalletTokens] = (0, import_react17.useState)([]);
8325
+ const [yourWalletTokensLoading, setYourWalletTokensLoading] = (0, import_react17.useState)(false);
8326
+ const [walletTokensReloadNonce, setWalletTokensReloadNonce] = (0, import_react17.useState)(0);
8327
+ const lastLoadedWalletRef = (0, import_react17.useRef)(null);
7284
8328
  const { tokens } = useTokens(null);
7285
8329
  const { chains } = useChains();
7286
- const selectedChainRef = (0, import_react18.useRef)(selectedChain);
8330
+ const selectedChainRef = (0, import_react17.useRef)(selectedChain);
7287
8331
  selectedChainRef.current = selectedChain;
7288
- const selectedTokenRef = (0, import_react18.useRef)(selectedToken);
8332
+ const selectedTokenRef = (0, import_react17.useRef)(selectedToken);
7289
8333
  selectedTokenRef.current = selectedToken;
7290
- const setSelectedChainRef = (0, import_react18.useRef)(setSelectedChain);
8334
+ const setSelectedChainRef = (0, import_react17.useRef)(setSelectedChain);
7291
8335
  setSelectedChainRef.current = setSelectedChain;
7292
- const setSelectedTokenRef = (0, import_react18.useRef)(setSelectedToken);
8336
+ const setSelectedTokenRef = (0, import_react17.useRef)(setSelectedToken);
7293
8337
  setSelectedTokenRef.current = setSelectedToken;
7294
8338
  const { address: fallbackAddress } = useWalletInfo();
7295
- const getCurrentWalletAddress = (0, import_react18.useCallback)(
8339
+ const getCurrentWalletAddress = (0, import_react17.useCallback)(
7296
8340
  (address) => {
7297
8341
  return address ?? fallbackAddress ?? null;
7298
8342
  },
7299
8343
  [fallbackAddress]
7300
8344
  );
7301
- (0, import_react18.useEffect)(() => {
8345
+ (0, import_react17.useEffect)(() => {
7302
8346
  if (!walletAddress || chains.length === 0 || tokens.length === 0) {
7303
8347
  setYourWalletTokens([]);
7304
8348
  if (!walletAddress) {
@@ -7539,11 +8583,11 @@ function mapWalletTokens(balances, chains, tokens) {
7539
8583
  ];
7540
8584
  });
7541
8585
  }
7542
- var import_react18;
8586
+ var import_react17;
7543
8587
  var init_useWalletTokenState = __esm({
7544
8588
  "src/widget/state/deposit/useWalletTokenState.ts"() {
7545
8589
  "use strict";
7546
- import_react18 = require("react");
8590
+ import_react17 = require("react");
7547
8591
  init_balances();
7548
8592
  init_hooks2();
7549
8593
  init_store();
@@ -8071,7 +9115,7 @@ function AmountSlider({
8071
9115
  style,
8072
9116
  disabled = false
8073
9117
  }) {
8074
- const generateTickMarks = (0, import_react19.useCallback)(
9118
+ const generateTickMarks = (0, import_react18.useCallback)(
8075
9119
  (minValue, maxValue) => {
8076
9120
  const range = maxValue - minValue;
8077
9121
  if (range <= 0) {
@@ -8119,25 +9163,25 @@ function AmountSlider({
8119
9163
  },
8120
9164
  []
8121
9165
  );
8122
- const tickMarks = (0, import_react19.useMemo)(
9166
+ const tickMarks = (0, import_react18.useMemo)(
8123
9167
  () => generateTickMarks(min, max),
8124
9168
  [generateTickMarks, min, max]
8125
9169
  );
8126
- const getPercentage = (0, import_react19.useCallback)(() => {
9170
+ const getPercentage = (0, import_react18.useCallback)(() => {
8127
9171
  const range = max - min;
8128
9172
  if (range <= 0) return 0;
8129
9173
  const clampedValue = Math.min(Math.max(value, min), max);
8130
9174
  return (clampedValue - min) / range * 100;
8131
9175
  }, [max, min, value]);
8132
- const percentage = (0, import_react19.useMemo)(() => getPercentage(), [getPercentage]);
8133
- const handleChange = (0, import_react19.useCallback)(
9176
+ const percentage = (0, import_react18.useMemo)(() => getPercentage(), [getPercentage]);
9177
+ const handleChange = (0, import_react18.useCallback)(
8134
9178
  (e2) => {
8135
9179
  const newValue = Math.min(Math.max(Number(e2.target.value), min), max);
8136
9180
  onChange(newValue);
8137
9181
  },
8138
9182
  [onChange, min, max]
8139
9183
  );
8140
- const handleTickClick = (0, import_react19.useCallback)(
9184
+ const handleTickClick = (0, import_react18.useCallback)(
8141
9185
  (tickValue) => {
8142
9186
  if (disabled) return;
8143
9187
  onChange(tickValue);
@@ -8352,11 +9396,11 @@ function AmountSlider({
8352
9396
  )
8353
9397
  ] }) });
8354
9398
  }
8355
- var import_react19, import_jsx_runtime3, roundToNiceNumber, formatValue;
9399
+ var import_react18, import_jsx_runtime3, roundToNiceNumber, formatValue;
8356
9400
  var init_AmountSlider = __esm({
8357
9401
  "src/widget/components/AmountSlider.tsx"() {
8358
9402
  "use strict";
8359
- import_react19 = require("react");
9403
+ import_react18 = require("react");
8360
9404
  init_styles();
8361
9405
  import_jsx_runtime3 = require("react/jsx-runtime");
8362
9406
  roundToNiceNumber = (value, range) => {
@@ -8440,8 +9484,8 @@ function AmountInputDisplay({
8440
9484
  style,
8441
9485
  inputAriaLabel = "Deposit amount"
8442
9486
  }) {
8443
- const [isEditing, setIsEditing] = (0, import_react20.useState)(false);
8444
- const inputRef = (0, import_react20.useRef)(null);
9487
+ const [isEditing, setIsEditing] = (0, import_react19.useState)(false);
9488
+ const inputRef = (0, import_react19.useRef)(null);
8445
9489
  const handleAmountClick = () => {
8446
9490
  if (isFixedAmount) return;
8447
9491
  const isZeroish = !amount || parseFloat(amount) === 0;
@@ -8557,11 +9601,11 @@ function AmountInputDisplay({
8557
9601
  }
8558
9602
  );
8559
9603
  }
8560
- var import_react20, import_jsx_runtime4;
9604
+ var import_react19, import_jsx_runtime4;
8561
9605
  var init_AmountInputDisplay = __esm({
8562
9606
  "src/widget/components/AmountInputDisplay.tsx"() {
8563
9607
  "use strict";
8564
- import_react20 = require("react");
9608
+ import_react19 = require("react");
8565
9609
  init_styles();
8566
9610
  import_jsx_runtime4 = require("react/jsx-runtime");
8567
9611
  }
@@ -8683,8 +9727,8 @@ function ConfettiEffect({
8683
9727
  clearDelay = 3e3,
8684
9728
  pieceCount = 50
8685
9729
  }) {
8686
- const [pieces, setPieces] = (0, import_react21.useState)([]);
8687
- (0, import_react21.useEffect)(() => {
9730
+ const [pieces, setPieces] = (0, import_react20.useState)([]);
9731
+ (0, import_react20.useEffect)(() => {
8688
9732
  if (isActive) {
8689
9733
  const colors2 = [
8690
9734
  "#10b981",
@@ -8760,22 +9804,22 @@ function ConfettiEffect({
8760
9804
  }
8761
9805
  );
8762
9806
  }
8763
- var import_react21, import_jsx_runtime6, ConfettiEffect_default;
9807
+ var import_react20, import_jsx_runtime6, ConfettiEffect_default;
8764
9808
  var init_ConfettiEffect = __esm({
8765
9809
  "src/widget/components/ConfettiEffect.tsx"() {
8766
9810
  "use strict";
8767
- import_react21 = require("react");
9811
+ import_react20 = require("react");
8768
9812
  import_jsx_runtime6 = require("react/jsx-runtime");
8769
9813
  ConfettiEffect_default = ConfettiEffect;
8770
9814
  }
8771
9815
  });
8772
9816
 
8773
9817
  // src/widget/components/Dialog.tsx
8774
- var import_react22, import_jsx_runtime7, Dialog;
9818
+ var import_react21, import_jsx_runtime7, Dialog;
8775
9819
  var init_Dialog = __esm({
8776
9820
  "src/widget/components/Dialog.tsx"() {
8777
9821
  "use strict";
8778
- import_react22 = require("react");
9822
+ import_react21 = require("react");
8779
9823
  init_styles();
8780
9824
  import_jsx_runtime7 = require("react/jsx-runtime");
8781
9825
  Dialog = ({
@@ -8788,11 +9832,11 @@ var init_Dialog = __esm({
8788
9832
  confirmText = "Close Anyway",
8789
9833
  isDark = false
8790
9834
  }) => {
8791
- const dialogRef = (0, import_react22.useRef)(null);
8792
- const overlayRef = (0, import_react22.useRef)(null);
8793
- const firstButtonRef = (0, import_react22.useRef)(null);
8794
- const lastButtonRef = (0, import_react22.useRef)(null);
8795
- (0, import_react22.useEffect)(() => {
9835
+ const dialogRef = (0, import_react21.useRef)(null);
9836
+ const overlayRef = (0, import_react21.useRef)(null);
9837
+ const firstButtonRef = (0, import_react21.useRef)(null);
9838
+ const lastButtonRef = (0, import_react21.useRef)(null);
9839
+ (0, import_react21.useEffect)(() => {
8796
9840
  const handleEscape = (e2) => {
8797
9841
  if (e2.key === "Escape" && open) {
8798
9842
  e2.preventDefault();
@@ -8806,7 +9850,7 @@ var init_Dialog = __esm({
8806
9850
  document.removeEventListener("keydown", handleEscape);
8807
9851
  };
8808
9852
  }, [open, onCancel]);
8809
- (0, import_react22.useEffect)(() => {
9853
+ (0, import_react21.useEffect)(() => {
8810
9854
  const handleTabKey = (e2) => {
8811
9855
  if (!open) return;
8812
9856
  if (e2.key === "Tab") {
@@ -8830,7 +9874,7 @@ var init_Dialog = __esm({
8830
9874
  document.removeEventListener("keydown", handleTabKey);
8831
9875
  };
8832
9876
  }, [open]);
8833
- (0, import_react22.useEffect)(() => {
9877
+ (0, import_react21.useEffect)(() => {
8834
9878
  if (open) {
8835
9879
  const originalStyle = window.getComputedStyle(document.body).overflow;
8836
9880
  document.body.style.overflow = "hidden";
@@ -9150,33 +10194,33 @@ function SwipeToConfirmTokens({
9150
10194
  style,
9151
10195
  text
9152
10196
  }) {
9153
- const [dragX, setDragX] = (0, import_react23.useState)(0);
9154
- const [isDragging, setIsDragging] = (0, import_react23.useState)(false);
9155
- const [isComplete, setIsComplete] = (0, import_react23.useState)(false);
9156
- const trackRef = (0, import_react23.useRef)(null);
9157
- const thumbRef = (0, import_react23.useRef)(null);
9158
- const [isLongPressing, setIsLongPressing] = (0, import_react23.useState)(false);
9159
- const [longPressProgress, setLongPressProgress] = (0, import_react23.useState)(0);
9160
- const longPressTimerRef = (0, import_react23.useRef)(null);
9161
- const longPressStartRef = (0, import_react23.useRef)(null);
9162
- const longPressAnimationRef = (0, import_react23.useRef)(null);
10197
+ const [dragX, setDragX] = (0, import_react22.useState)(0);
10198
+ const [isDragging, setIsDragging] = (0, import_react22.useState)(false);
10199
+ const [isComplete, setIsComplete] = (0, import_react22.useState)(false);
10200
+ const trackRef = (0, import_react22.useRef)(null);
10201
+ const thumbRef = (0, import_react22.useRef)(null);
10202
+ const [isLongPressing, setIsLongPressing] = (0, import_react22.useState)(false);
10203
+ const [longPressProgress, setLongPressProgress] = (0, import_react22.useState)(0);
10204
+ const longPressTimerRef = (0, import_react22.useRef)(null);
10205
+ const longPressStartRef = (0, import_react22.useRef)(null);
10206
+ const longPressAnimationRef = (0, import_react22.useRef)(null);
9163
10207
  const LONG_PRESS_DURATION = 1500;
9164
10208
  const thumbSize = 48;
9165
10209
  const padding = 4;
9166
10210
  const threshold = 0.8;
9167
- const getMaxDrag = (0, import_react23.useCallback)(() => {
10211
+ const getMaxDrag = (0, import_react22.useCallback)(() => {
9168
10212
  if (!trackRef.current) return 0;
9169
10213
  return trackRef.current.offsetWidth - thumbSize - padding * 2;
9170
10214
  }, []);
9171
- const getProgress = (0, import_react23.useCallback)(() => {
10215
+ const getProgress = (0, import_react22.useCallback)(() => {
9172
10216
  const maxDrag = getMaxDrag();
9173
10217
  return maxDrag > 0 ? dragX / maxDrag : 0;
9174
10218
  }, [dragX, getMaxDrag]);
9175
- const handleDragStart = (0, import_react23.useCallback)(() => {
10219
+ const handleDragStart = (0, import_react22.useCallback)(() => {
9176
10220
  if (disabled || isComplete) return;
9177
10221
  setIsDragging(true);
9178
10222
  }, [disabled, isComplete]);
9179
- const handleDragMove = (0, import_react23.useCallback)(
10223
+ const handleDragMove = (0, import_react22.useCallback)(
9180
10224
  (clientX) => {
9181
10225
  if (!isDragging || !trackRef.current || isComplete) return;
9182
10226
  const rect = trackRef.current.getBoundingClientRect();
@@ -9187,7 +10231,7 @@ function SwipeToConfirmTokens({
9187
10231
  },
9188
10232
  [isDragging, isComplete, getMaxDrag]
9189
10233
  );
9190
- const handleDragEnd = (0, import_react23.useCallback)(() => {
10234
+ const handleDragEnd = (0, import_react22.useCallback)(() => {
9191
10235
  if (!isDragging) return;
9192
10236
  setIsDragging(false);
9193
10237
  const progress2 = getProgress();
@@ -9200,14 +10244,14 @@ function SwipeToConfirmTokens({
9200
10244
  setDragX(0);
9201
10245
  }
9202
10246
  }, [isDragging, getProgress, getMaxDrag, onConfirm]);
9203
- const triggerConfirmation = (0, import_react23.useCallback)(() => {
10247
+ const triggerConfirmation = (0, import_react22.useCallback)(() => {
9204
10248
  if (isComplete) return;
9205
10249
  setDragX(getMaxDrag());
9206
10250
  setIsComplete(true);
9207
10251
  if (navigator.vibrate) navigator.vibrate(50);
9208
10252
  setTimeout(() => onConfirm(), 150);
9209
10253
  }, [isComplete, getMaxDrag, onConfirm]);
9210
- const cancelLongPress = (0, import_react23.useCallback)(() => {
10254
+ const cancelLongPress = (0, import_react22.useCallback)(() => {
9211
10255
  setIsLongPressing(false);
9212
10256
  setLongPressProgress(0);
9213
10257
  longPressStartRef.current = null;
@@ -9220,7 +10264,7 @@ function SwipeToConfirmTokens({
9220
10264
  longPressAnimationRef.current = null;
9221
10265
  }
9222
10266
  }, []);
9223
- const startLongPress = (0, import_react23.useCallback)(() => {
10267
+ const startLongPress = (0, import_react22.useCallback)(() => {
9224
10268
  if (disabled || isComplete || isDragging) return;
9225
10269
  setIsLongPressing(true);
9226
10270
  longPressStartRef.current = Date.now();
@@ -9238,7 +10282,7 @@ function SwipeToConfirmTokens({
9238
10282
  };
9239
10283
  longPressAnimationRef.current = requestAnimationFrame(animateProgress);
9240
10284
  }, [disabled, isComplete, isDragging, triggerConfirmation, cancelLongPress]);
9241
- const handleKeyDown = (0, import_react23.useCallback)(
10285
+ const handleKeyDown = (0, import_react22.useCallback)(
9242
10286
  (e2) => {
9243
10287
  if (disabled || isComplete) return;
9244
10288
  if (e2.key === "Enter" || e2.key === " ") {
@@ -9248,7 +10292,7 @@ function SwipeToConfirmTokens({
9248
10292
  },
9249
10293
  [disabled, isComplete, startLongPress]
9250
10294
  );
9251
- const handleKeyUp = (0, import_react23.useCallback)(
10295
+ const handleKeyUp = (0, import_react22.useCallback)(
9252
10296
  (e2) => {
9253
10297
  if (e2.key === "Enter" || e2.key === " ") {
9254
10298
  e2.preventDefault();
@@ -9257,7 +10301,7 @@ function SwipeToConfirmTokens({
9257
10301
  },
9258
10302
  [cancelLongPress]
9259
10303
  );
9260
- (0, import_react23.useEffect)(() => {
10304
+ (0, import_react22.useEffect)(() => {
9261
10305
  return () => {
9262
10306
  if (longPressTimerRef.current) clearTimeout(longPressTimerRef.current);
9263
10307
  if (longPressAnimationRef.current)
@@ -9268,15 +10312,15 @@ function SwipeToConfirmTokens({
9268
10312
  e2.preventDefault();
9269
10313
  handleDragStart();
9270
10314
  };
9271
- const handleMouseMove = (0, import_react23.useCallback)(
10315
+ const handleMouseMove = (0, import_react22.useCallback)(
9272
10316
  (e2) => handleDragMove(e2.clientX),
9273
10317
  [handleDragMove]
9274
10318
  );
9275
- const handleMouseUp = (0, import_react23.useCallback)(() => handleDragEnd(), [handleDragEnd]);
10319
+ const handleMouseUp = (0, import_react22.useCallback)(() => handleDragEnd(), [handleDragEnd]);
9276
10320
  const handleTouchStart = () => handleDragStart();
9277
10321
  const handleTouchMove = (e2) => handleDragMove(e2.touches[0].clientX);
9278
10322
  const handleTouchEnd = () => handleDragEnd();
9279
- (0, import_react23.useEffect)(() => {
10323
+ (0, import_react22.useEffect)(() => {
9280
10324
  if (isDragging) {
9281
10325
  window.addEventListener("mousemove", handleMouseMove);
9282
10326
  window.addEventListener("mouseup", handleMouseUp);
@@ -9288,8 +10332,8 @@ function SwipeToConfirmTokens({
9288
10332
  }, [isDragging, handleMouseMove, handleMouseUp]);
9289
10333
  const progress = getProgress();
9290
10334
  const effectiveProgress = isLongPressing ? longPressProgress : progress;
9291
- const [blinkOpacity, setBlinkOpacity] = (0, import_react23.useState)(1);
9292
- (0, import_react23.useEffect)(() => {
10335
+ const [blinkOpacity, setBlinkOpacity] = (0, import_react22.useState)(1);
10336
+ (0, import_react22.useEffect)(() => {
9293
10337
  if (disabled || isComplete || isDragging || isLongPressing) {
9294
10338
  setBlinkOpacity(1);
9295
10339
  return;
@@ -9650,11 +10694,11 @@ function SwipeToConfirmTokens({
9650
10694
  }
9651
10695
  );
9652
10696
  }
9653
- var import_react23, import_jsx_runtime9;
10697
+ var import_react22, import_jsx_runtime9;
9654
10698
  var init_SwipeToConfirmTokens = __esm({
9655
10699
  "src/widget/components/SwipeToConfirmTokens.tsx"() {
9656
10700
  "use strict";
9657
- import_react23 = require("react");
10701
+ import_react22 = require("react");
9658
10702
  init_styles();
9659
10703
  init_components();
9660
10704
  import_jsx_runtime9 = require("react/jsx-runtime");
@@ -9763,14 +10807,14 @@ function ToastItem({
9763
10807
  duration = 4e3,
9764
10808
  onDismiss
9765
10809
  }) {
9766
- const [isExiting, setIsExiting] = (0, import_react24.useState)(false);
9767
- (0, import_react24.useEffect)(() => {
10810
+ const [isExiting, setIsExiting] = (0, import_react23.useState)(false);
10811
+ (0, import_react23.useEffect)(() => {
9768
10812
  const timer = setTimeout(() => {
9769
10813
  setIsExiting(true);
9770
10814
  }, duration);
9771
10815
  return () => clearTimeout(timer);
9772
10816
  }, [duration]);
9773
- (0, import_react24.useEffect)(() => {
10817
+ (0, import_react23.useEffect)(() => {
9774
10818
  if (isExiting) {
9775
10819
  const exitTimer = setTimeout(() => {
9776
10820
  onDismiss(id);
@@ -9969,8 +11013,8 @@ function toast(data) {
9969
11013
  };
9970
11014
  }
9971
11015
  function ToastContainer() {
9972
- const [activeToasts, setActiveToasts] = (0, import_react24.useState)([]);
9973
- (0, import_react24.useEffect)(() => {
11016
+ const [activeToasts, setActiveToasts] = (0, import_react23.useState)([]);
11017
+ (0, import_react23.useEffect)(() => {
9974
11018
  const listener = (newToasts) => {
9975
11019
  setActiveToasts(newToasts);
9976
11020
  };
@@ -9982,7 +11026,7 @@ function ToastContainer() {
9982
11026
  }
9983
11027
  };
9984
11028
  }, []);
9985
- const handleDismiss = (0, import_react24.useCallback)((id) => {
11029
+ const handleDismiss = (0, import_react23.useCallback)((id) => {
9986
11030
  toasts = toasts.filter((t) => t.id !== id);
9987
11031
  notifyListeners();
9988
11032
  }, []);
@@ -10017,11 +11061,11 @@ function ToastContainer() {
10017
11061
  }
10018
11062
  );
10019
11063
  }
10020
- var import_react24, import_jsx_runtime11, variantStyles, listeners, toasts, toastId;
11064
+ var import_react23, import_jsx_runtime11, variantStyles, listeners, toasts, toastId;
10021
11065
  var init_Toast = __esm({
10022
11066
  "src/widget/components/Toast.tsx"() {
10023
11067
  "use strict";
10024
- import_react24 = require("react");
11068
+ import_react23 = require("react");
10025
11069
  init_styles();
10026
11070
  import_jsx_runtime11 = require("react/jsx-runtime");
10027
11071
  variantStyles = {
@@ -10062,10 +11106,10 @@ function TokenSwipePill({
10062
11106
  walletAddress,
10063
11107
  style
10064
11108
  }) {
10065
- const [isDragging, setIsDragging] = (0, import_react25.useState)(false);
10066
- const [dragOffset, setDragOffset] = (0, import_react25.useState)(0);
10067
- const startXRef = (0, import_react25.useRef)(0);
10068
- const containerRef = (0, import_react25.useRef)(null);
11109
+ const [isDragging, setIsDragging] = (0, import_react24.useState)(false);
11110
+ const [dragOffset, setDragOffset] = (0, import_react24.useState)(0);
11111
+ const startXRef = (0, import_react24.useRef)(0);
11112
+ const containerRef = (0, import_react24.useRef)(null);
10069
11113
  const currentIndex = tokens.findIndex(
10070
11114
  (t) => normalizeAddress2(
10071
11115
  t.address,
@@ -10086,11 +11130,11 @@ function TokenSwipePill({
10086
11130
  }
10087
11131
  return pos;
10088
11132
  };
10089
- const handleDragStart = (0, import_react25.useCallback)((clientX) => {
11133
+ const handleDragStart = (0, import_react24.useCallback)((clientX) => {
10090
11134
  setIsDragging(true);
10091
11135
  startXRef.current = clientX;
10092
11136
  }, []);
10093
- const handleDragMove = (0, import_react25.useCallback)(
11137
+ const handleDragMove = (0, import_react24.useCallback)(
10094
11138
  (clientX) => {
10095
11139
  if (!isDragging) return;
10096
11140
  const delta = startXRef.current - clientX;
@@ -10098,7 +11142,7 @@ function TokenSwipePill({
10098
11142
  },
10099
11143
  [isDragging]
10100
11144
  );
10101
- const handleDragEnd = (0, import_react25.useCallback)(() => {
11145
+ const handleDragEnd = (0, import_react24.useCallback)(() => {
10102
11146
  if (!isDragging) return;
10103
11147
  setIsDragging(false);
10104
11148
  if (Math.abs(dragOffset) > swipeThreshold) {
@@ -10116,13 +11160,13 @@ function TokenSwipePill({
10116
11160
  e2.preventDefault();
10117
11161
  handleDragStart(e2.clientX);
10118
11162
  };
10119
- const handleMouseMove = (0, import_react25.useCallback)(
11163
+ const handleMouseMove = (0, import_react24.useCallback)(
10120
11164
  (e2) => {
10121
11165
  handleDragMove(e2.clientX);
10122
11166
  },
10123
11167
  [handleDragMove]
10124
11168
  );
10125
- const handleMouseUp = (0, import_react25.useCallback)(() => {
11169
+ const handleMouseUp = (0, import_react24.useCallback)(() => {
10126
11170
  handleDragEnd();
10127
11171
  }, [handleDragEnd]);
10128
11172
  const handleTouchStart = (e2) => {
@@ -10136,7 +11180,7 @@ function TokenSwipePill({
10136
11180
  const handleTouchEnd = () => {
10137
11181
  handleDragEnd();
10138
11182
  };
10139
- (0, import_react25.useEffect)(() => {
11183
+ (0, import_react24.useEffect)(() => {
10140
11184
  if (isDragging) {
10141
11185
  window.addEventListener("mousemove", handleMouseMove);
10142
11186
  window.addEventListener("mouseup", handleMouseUp);
@@ -10150,7 +11194,7 @@ function TokenSwipePill({
10150
11194
  const getChainInitials = (chain) => {
10151
11195
  return chain?.slice(0, 2).toUpperCase();
10152
11196
  };
10153
- const chainBadge = (0, import_react25.useMemo)(() => {
11197
+ const chainBadge = (0, import_react24.useMemo)(() => {
10154
11198
  const url = selectedToken.chainData?.chainIconURI || selectedToken.chainData?.iconUrl;
10155
11199
  return url?.toString();
10156
11200
  }, [selectedToken]);
@@ -10436,7 +11480,7 @@ function TokenSwipePill({
10436
11480
  const token = tokens[index];
10437
11481
  const prevIndex = uniqueIndices[i - 1];
10438
11482
  const showGap = i > 0 && index - prevIndex > 1;
10439
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react25.default.Fragment, { children: [
11483
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_react24.default.Fragment, { children: [
10440
11484
  showGap && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
10441
11485
  "span",
10442
11486
  {
@@ -10616,11 +11660,11 @@ function TokenSwipePill({
10616
11660
  }
10617
11661
  );
10618
11662
  }
10619
- var import_react25, import_jsx_runtime12, MAX_VISIBLE_DOTS;
11663
+ var import_react24, import_jsx_runtime12, MAX_VISIBLE_DOTS;
10620
11664
  var init_TokenSwipePill = __esm({
10621
11665
  "src/widget/components/TokenSwipePill.tsx"() {
10622
11666
  "use strict";
10623
- import_react25 = __toESM(require("react"), 1);
11667
+ import_react24 = __toESM(require("react"), 1);
10624
11668
  init_styles();
10625
11669
  init_chainHelpers();
10626
11670
  init_components();
@@ -10662,14 +11706,14 @@ function TransactionSteps({
10662
11706
  style,
10663
11707
  stepLabels
10664
11708
  }) {
10665
- const labels = (0, import_react26.useMemo)(
11709
+ const labels = (0, import_react25.useMemo)(
10666
11710
  () => ({
10667
11711
  ...DEFAULT_LABELS,
10668
11712
  ...stepLabels
10669
11713
  }),
10670
11714
  [stepLabels]
10671
11715
  );
10672
- const steps = (0, import_react26.useMemo)(
11716
+ const steps = (0, import_react25.useMemo)(
10673
11717
  () => getSteps(transactionStatus, labels),
10674
11718
  [transactionStatus, labels]
10675
11719
  );
@@ -10826,11 +11870,11 @@ function TransactionSteps({
10826
11870
  }
10827
11871
  );
10828
11872
  }
10829
- var import_react26, import_jsx_runtime13, DEFAULT_LABELS;
11873
+ var import_react25, import_jsx_runtime13, DEFAULT_LABELS;
10830
11874
  var init_TransactionSteps = __esm({
10831
11875
  "src/widget/components/TransactionSteps.tsx"() {
10832
11876
  "use strict";
10833
- import_react26 = require("react");
11877
+ import_react25 = require("react");
10834
11878
  init_styles();
10835
11879
  import_jsx_runtime13 = require("react/jsx-runtime");
10836
11880
  DEFAULT_LABELS = {
@@ -10849,8 +11893,8 @@ function WidgetContainer({
10849
11893
  className,
10850
11894
  style
10851
11895
  }) {
10852
- const [resolvedTheme, setResolvedTheme] = (0, import_react27.useState)("light");
10853
- (0, import_react27.useEffect)(() => {
11896
+ const [resolvedTheme, setResolvedTheme] = (0, import_react26.useState)("light");
11897
+ (0, import_react26.useEffect)(() => {
10854
11898
  if (theme === "system") {
10855
11899
  const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
10856
11900
  setResolvedTheme(mediaQuery.matches ? "dark" : "light");
@@ -10899,11 +11943,11 @@ function WidgetContainer({
10899
11943
  )
10900
11944
  ] });
10901
11945
  }
10902
- var import_react27, import_jsx_runtime14, INJECTED_STYLES;
11946
+ var import_react26, import_jsx_runtime14, INJECTED_STYLES;
10903
11947
  var init_WidgetContainer = __esm({
10904
11948
  "src/widget/components/WidgetContainer.tsx"() {
10905
11949
  "use strict";
10906
- import_react27 = require("react");
11950
+ import_react26 = require("react");
10907
11951
  init_Toast();
10908
11952
  init_styles();
10909
11953
  init_styles();
@@ -11147,18 +12191,18 @@ function ImageLoader({
11147
12191
  onLoad,
11148
12192
  onError
11149
12193
  }) {
11150
- const [status, setStatus] = (0, import_react28.useState)("idle");
11151
- const [attempt, setAttempt] = (0, import_react28.useState)(0);
11152
- const [srcIsEmpty, setSrcIsEmpty] = (0, import_react28.useState)(false);
11153
- const imgRef = (0, import_react28.useRef)(null);
11154
- const observerRef = (0, import_react28.useRef)(null);
11155
- const onLoadRef = (0, import_react28.useRef)(onLoad);
11156
- const onErrorRef = (0, import_react28.useRef)(onError);
11157
- (0, import_react28.useEffect)(() => {
12194
+ const [status, setStatus] = (0, import_react27.useState)("idle");
12195
+ const [attempt, setAttempt] = (0, import_react27.useState)(0);
12196
+ const [srcIsEmpty, setSrcIsEmpty] = (0, import_react27.useState)(false);
12197
+ const imgRef = (0, import_react27.useRef)(null);
12198
+ const observerRef = (0, import_react27.useRef)(null);
12199
+ const onLoadRef = (0, import_react27.useRef)(onLoad);
12200
+ const onErrorRef = (0, import_react27.useRef)(onError);
12201
+ (0, import_react27.useEffect)(() => {
11158
12202
  onLoadRef.current = onLoad;
11159
12203
  onErrorRef.current = onError;
11160
12204
  }, [onLoad, onError]);
11161
- (0, import_react28.useEffect)(() => {
12205
+ (0, import_react27.useEffect)(() => {
11162
12206
  if (status === "error" && attempt < retry) {
11163
12207
  const timer = setTimeout(() => {
11164
12208
  setAttempt((prev) => prev + 1);
@@ -11167,7 +12211,7 @@ function ImageLoader({
11167
12211
  return () => clearTimeout(timer);
11168
12212
  }
11169
12213
  }, [status, attempt, retry, retryDelay]);
11170
- const loadImage = (0, import_react28.useCallback)(() => {
12214
+ const loadImage = (0, import_react27.useCallback)(() => {
11171
12215
  if (!src) {
11172
12216
  setSrcIsEmpty(true);
11173
12217
  return;
@@ -11185,7 +12229,7 @@ function ImageLoader({
11185
12229
  onErrorRef.current?.();
11186
12230
  };
11187
12231
  }, [src]);
11188
- (0, import_react28.useEffect)(() => {
12232
+ (0, import_react27.useEffect)(() => {
11189
12233
  if (!lazy3) {
11190
12234
  const timer = setTimeout(() => loadImage(), 0);
11191
12235
  return () => clearTimeout(timer);
@@ -11206,7 +12250,7 @@ function ImageLoader({
11206
12250
  }
11207
12251
  return () => observerRef.current?.disconnect();
11208
12252
  }, [lazy3, src, loadImage]);
11209
- const showFallback = (0, import_react28.useMemo)(() => {
12253
+ const showFallback = (0, import_react27.useMemo)(() => {
11210
12254
  return (status === "error" && attempt >= retry || srcIsEmpty) && Fallback;
11211
12255
  }, [status, attempt, retry, srcIsEmpty, Fallback]);
11212
12256
  return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: imgRef, style: { position: "relative" }, children: [
@@ -11244,11 +12288,11 @@ function ImageLoader({
11244
12288
  showFallback && Fallback
11245
12289
  ] });
11246
12290
  }
11247
- var import_react28, import_jsx_runtime17;
12291
+ var import_react27, import_jsx_runtime17;
11248
12292
  var init_ImageLoader = __esm({
11249
12293
  "src/widget/components/ImageLoader.tsx"() {
11250
12294
  "use strict";
11251
- import_react28 = require("react");
12295
+ import_react27 = require("react");
11252
12296
  import_jsx_runtime17 = require("react/jsx-runtime");
11253
12297
  }
11254
12298
  });
@@ -11762,8 +12806,8 @@ function ChainItem({
11762
12806
  src: chain.chainIconURI,
11763
12807
  alt: label,
11764
12808
  style: {
11765
- width: "2rem",
11766
- height: "2rem",
12809
+ width: "1.5rem",
12810
+ height: "1.5rem",
11767
12811
  borderRadius: "9999px",
11768
12812
  objectFit: "cover",
11769
12813
  flexShrink: 0
@@ -11773,8 +12817,8 @@ function ChainItem({
11773
12817
  "div",
11774
12818
  {
11775
12819
  style: {
11776
- width: "2rem",
11777
- height: "2rem",
12820
+ width: "1.5rem",
12821
+ height: "1.5rem",
11778
12822
  borderRadius: "9999px",
11779
12823
  backgroundColor: colors.muted,
11780
12824
  display: "flex",
@@ -11852,6 +12896,81 @@ function ChainItem({
11852
12896
  String(key)
11853
12897
  );
11854
12898
  }
12899
+ function SectionLabel({
12900
+ children,
12901
+ icon
12902
+ }) {
12903
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
12904
+ "div",
12905
+ {
12906
+ style: {
12907
+ display: "flex",
12908
+ alignItems: "center",
12909
+ gap: "0.25rem",
12910
+ padding: `${spacing[1.5]} ${spacing[3]}`,
12911
+ marginTop: spacing[2]
12912
+ },
12913
+ children: [
12914
+ icon === "spark" ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12915
+ "svg",
12916
+ {
12917
+ style: {
12918
+ width: "0.75rem",
12919
+ height: "0.75rem",
12920
+ color: colors.primary,
12921
+ flexShrink: 0
12922
+ },
12923
+ viewBox: "0 0 24 24",
12924
+ fill: "none",
12925
+ stroke: "currentColor",
12926
+ strokeWidth: 2,
12927
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12928
+ "path",
12929
+ {
12930
+ strokeLinecap: "round",
12931
+ strokeLinejoin: "round",
12932
+ 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"
12933
+ }
12934
+ )
12935
+ }
12936
+ ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12937
+ "svg",
12938
+ {
12939
+ style: {
12940
+ width: "0.75rem",
12941
+ height: "0.75rem",
12942
+ color: colors.primary,
12943
+ flexShrink: 0
12944
+ },
12945
+ viewBox: "0 0 24 24",
12946
+ fill: "none",
12947
+ stroke: "currentColor",
12948
+ strokeWidth: 2,
12949
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12950
+ "path",
12951
+ {
12952
+ strokeLinecap: "round",
12953
+ strokeLinejoin: "round",
12954
+ d: "M3 7.5 7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5"
12955
+ }
12956
+ )
12957
+ }
12958
+ ),
12959
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12960
+ "span",
12961
+ {
12962
+ style: {
12963
+ fontSize: "10px",
12964
+ fontWeight: fontWeight.medium,
12965
+ color: colors.primary
12966
+ },
12967
+ children
12968
+ }
12969
+ )
12970
+ ]
12971
+ }
12972
+ );
12973
+ }
11855
12974
  function ChainSelectorPanel({
11856
12975
  error,
11857
12976
  isChainSelected,
@@ -11860,6 +12979,21 @@ function ChainSelectorPanel({
11860
12979
  otherChains,
11861
12980
  popularChains
11862
12981
  }) {
12982
+ const [chainSearch, setChainSearch] = (0, import_react28.useState)("");
12983
+ const filteredPopular = (0, import_react28.useMemo)(() => {
12984
+ if (!chainSearch) return popularChains;
12985
+ const q = chainSearch.toLowerCase();
12986
+ return popularChains.filter(
12987
+ (c) => resolveChainLabel(c).toLowerCase().includes(q)
12988
+ );
12989
+ }, [popularChains, chainSearch]);
12990
+ const filteredOther = (0, import_react28.useMemo)(() => {
12991
+ if (!chainSearch) return otherChains;
12992
+ const q = chainSearch.toLowerCase();
12993
+ return otherChains.filter(
12994
+ (c) => resolveChainLabel(c).toLowerCase().includes(q)
12995
+ );
12996
+ }, [otherChains, chainSearch]);
11863
12997
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
11864
12998
  "div",
11865
12999
  {
@@ -11875,22 +13009,58 @@ function ChainSelectorPanel({
11875
13009
  "div",
11876
13010
  {
11877
13011
  style: {
11878
- padding: `${spacing[2]} ${spacing[3]}`,
11879
- borderBottom: `1px solid rgba(63, 63, 70, 0.5)`
13012
+ padding: `${spacing[2]} ${spacing[2]}`,
13013
+ borderBottom: `1px solid ${colors.border}`
11880
13014
  },
11881
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11882
- "span",
11883
- {
11884
- style: {
11885
- fontSize: fontSize.xs,
11886
- fontWeight: fontWeight.medium,
11887
- color: colors.mutedForeground,
11888
- textTransform: "uppercase",
11889
- letterSpacing: "0.05em"
11890
- },
11891
- children: "Chain"
11892
- }
11893
- )
13015
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { position: "relative" }, children: [
13016
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
13017
+ "svg",
13018
+ {
13019
+ style: {
13020
+ position: "absolute",
13021
+ left: spacing[2.5],
13022
+ top: "50%",
13023
+ transform: "translateY(-50%)",
13024
+ width: "1rem",
13025
+ height: "1rem",
13026
+ color: colors.mutedForeground,
13027
+ pointerEvents: "none"
13028
+ },
13029
+ viewBox: "0 0 24 24",
13030
+ fill: "none",
13031
+ stroke: "currentColor",
13032
+ strokeWidth: 2,
13033
+ children: [
13034
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("circle", { cx: "11", cy: "11", r: "8" }),
13035
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("path", { strokeLinecap: "round", d: "m21 21-4.35-4.35" })
13036
+ ]
13037
+ }
13038
+ ),
13039
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13040
+ "input",
13041
+ {
13042
+ type: "text",
13043
+ placeholder: "Chain",
13044
+ value: chainSearch,
13045
+ onChange: (e2) => setChainSearch(e2.target.value),
13046
+ style: {
13047
+ width: "100%",
13048
+ boxSizing: "border-box",
13049
+ paddingLeft: spacing[8],
13050
+ paddingRight: spacing[3],
13051
+ paddingTop: spacing[2],
13052
+ paddingBottom: spacing[2],
13053
+ fontSize: fontSize.sm,
13054
+ backgroundColor: colors.muted,
13055
+ border: `1px solid ${colors.border}`,
13056
+ borderRadius: borderRadius.lg,
13057
+ color: colors.foreground,
13058
+ outline: "none",
13059
+ transition: "all 0.2s"
13060
+ }
13061
+ }
13062
+ )
13063
+ ] })
11894
13064
  }
11895
13065
  ),
11896
13066
  /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
@@ -11978,21 +13148,9 @@ function ChainSelectorPanel({
11978
13148
  ]
11979
13149
  }
11980
13150
  ) : /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [
11981
- popularChains.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { style: { marginBottom: spacing[2] }, children: [
11982
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { style: { padding: `${spacing[1.5]} ${spacing[3]}` }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11983
- "span",
11984
- {
11985
- style: {
11986
- fontSize: "10px",
11987
- fontWeight: fontWeight.medium,
11988
- color: "rgba(161, 161, 170, 0.7)",
11989
- textTransform: "uppercase",
11990
- letterSpacing: "0.05em"
11991
- },
11992
- children: "Popular"
11993
- }
11994
- ) }),
11995
- popularChains.map((chain, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13151
+ filteredPopular.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
13152
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SectionLabel, { icon: "spark", children: "Popular chains" }),
13153
+ filteredPopular.map((chain, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
11996
13154
  ChainItem,
11997
13155
  {
11998
13156
  chain,
@@ -12005,30 +13163,9 @@ function ChainSelectorPanel({
12005
13163
  )
12006
13164
  ))
12007
13165
  ] }),
12008
- otherChains.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
12009
- popularChains.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12010
- "div",
12011
- {
12012
- style: {
12013
- padding: `${spacing[1.5]} ${spacing[3]}`,
12014
- marginTop: spacing[2]
12015
- },
12016
- children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12017
- "span",
12018
- {
12019
- style: {
12020
- fontSize: "10px",
12021
- fontWeight: fontWeight.medium,
12022
- color: "rgba(161, 161, 170, 0.7)",
12023
- textTransform: "uppercase",
12024
- letterSpacing: "0.05em"
12025
- },
12026
- children: "All Chains"
12027
- }
12028
- )
12029
- }
12030
- ),
12031
- otherChains.map((chain, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13166
+ filteredOther.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
13167
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(SectionLabel, { icon: "sort", children: "Chains A-Z" }),
13168
+ filteredOther.map((chain, idx) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12032
13169
  ChainItem,
12033
13170
  {
12034
13171
  chain,
@@ -12041,21 +13178,21 @@ function ChainSelectorPanel({
12041
13178
  )
12042
13179
  ))
12043
13180
  ] }),
12044
- popularChains.length === 0 && otherChains.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
13181
+ filteredPopular.length === 0 && filteredOther.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12045
13182
  "div",
12046
13183
  {
12047
13184
  style: {
12048
- padding: `${spacing[3]} ${spacing[4]}`,
13185
+ padding: `${spacing[3]} ${spacing[2]}`,
12049
13186
  textAlign: "center"
12050
13187
  },
12051
13188
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
12052
13189
  "p",
12053
13190
  {
12054
13191
  style: {
12055
- fontSize: fontSize.sm,
13192
+ fontSize: fontSize.xs,
12056
13193
  color: colors.mutedForeground
12057
13194
  },
12058
- children: "No chains available"
13195
+ children: "No chains found"
12059
13196
  }
12060
13197
  )
12061
13198
  }
@@ -12067,10 +13204,11 @@ function ChainSelectorPanel({
12067
13204
  }
12068
13205
  );
12069
13206
  }
12070
- var import_jsx_runtime21;
13207
+ var import_react28, import_jsx_runtime21;
12071
13208
  var init_ChainSelectorPanel = __esm({
12072
13209
  "src/widget/features/token-selection/components/ChainSelectorPanel.tsx"() {
12073
13210
  "use strict";
13211
+ import_react28 = require("react");
12074
13212
  init_utils2();
12075
13213
  init_styles();
12076
13214
  import_jsx_runtime21 = require("react/jsx-runtime");
@@ -12127,8 +13265,8 @@ function TokenSearchInput({
12127
13265
  paddingTop: spacing[2],
12128
13266
  paddingBottom: spacing[2],
12129
13267
  fontSize: fontSize.sm,
12130
- backgroundColor: "rgba(63, 63, 70, 0.5)",
12131
- border: `1px solid rgba(63, 63, 70, 0.5)`,
13268
+ backgroundColor: colors.muted,
13269
+ border: `1px solid ${colors.border}`,
12132
13270
  borderRadius: borderRadius.lg,
12133
13271
  color: colors.foreground,
12134
13272
  outline: "none",
@@ -12604,6 +13742,86 @@ var init_WalletTokenListItem = __esm({
12604
13742
  });
12605
13743
 
12606
13744
  // src/widget/features/token-selection/components/TokenSelectorPanel.tsx
13745
+ function TokenSectionLabel({
13746
+ children,
13747
+ icon
13748
+ }) {
13749
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
13750
+ "div",
13751
+ {
13752
+ style: {
13753
+ display: "flex",
13754
+ alignItems: "center",
13755
+ gap: "0.375rem",
13756
+ paddingLeft: spacing[3],
13757
+ paddingRight: spacing[3],
13758
+ paddingTop: spacing[1],
13759
+ paddingBottom: spacing[1],
13760
+ marginTop: spacing[1],
13761
+ marginBottom: spacing[1]
13762
+ },
13763
+ children: [
13764
+ icon === "wallet" ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13765
+ "svg",
13766
+ {
13767
+ style: {
13768
+ width: "0.75rem",
13769
+ height: "0.75rem",
13770
+ color: colors.primary,
13771
+ flexShrink: 0
13772
+ },
13773
+ viewBox: "0 0 24 24",
13774
+ fill: "none",
13775
+ stroke: "currentColor",
13776
+ strokeWidth: 2,
13777
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13778
+ "path",
13779
+ {
13780
+ strokeLinecap: "round",
13781
+ strokeLinejoin: "round",
13782
+ 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"
13783
+ }
13784
+ )
13785
+ }
13786
+ ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13787
+ "svg",
13788
+ {
13789
+ style: {
13790
+ width: "0.75rem",
13791
+ height: "0.75rem",
13792
+ color: colors.primary,
13793
+ flexShrink: 0
13794
+ },
13795
+ viewBox: "0 0 24 24",
13796
+ fill: "none",
13797
+ stroke: "currentColor",
13798
+ strokeWidth: 2,
13799
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13800
+ "path",
13801
+ {
13802
+ strokeLinecap: "round",
13803
+ strokeLinejoin: "round",
13804
+ 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"
13805
+ }
13806
+ )
13807
+ }
13808
+ ),
13809
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13810
+ "span",
13811
+ {
13812
+ style: {
13813
+ fontSize: "0.75rem",
13814
+ lineHeight: "1rem",
13815
+ fontWeight: fontWeight.medium,
13816
+ color: colors.primary
13817
+ },
13818
+ children
13819
+ }
13820
+ )
13821
+ ]
13822
+ }
13823
+ );
13824
+ }
12607
13825
  function TokenSelectorPanel({
12608
13826
  filteredTokens,
12609
13827
  filteredWalletTokens,
@@ -12616,9 +13834,10 @@ function TokenSelectorPanel({
12616
13834
  searchQuery,
12617
13835
  selectedChain,
12618
13836
  setSearchQuery,
12619
- tokensError,
12620
- walletAddress
13837
+ tokensError
12621
13838
  }) {
13839
+ const hasWalletTokens = filteredWalletTokens.length > 0;
13840
+ const hasPopularTokens = filteredTokens.length > 0;
12622
13841
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
12623
13842
  "div",
12624
13843
  {
@@ -12629,61 +13848,20 @@ function TokenSelectorPanel({
12629
13848
  overflow: "hidden"
12630
13849
  },
12631
13850
  children: [
12632
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
13851
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12633
13852
  "div",
12634
13853
  {
12635
13854
  style: {
12636
- padding: `${spacing[2]} ${spacing[3]}`,
12637
- borderBottom: `1px solid rgba(63, 63, 70, 0.5)`
13855
+ padding: `${spacing[2]} ${spacing[2]}`,
13856
+ borderBottom: `1px solid ${colors.border}`
12638
13857
  },
12639
- children: [
12640
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
12641
- "div",
12642
- {
12643
- style: {
12644
- display: "flex",
12645
- alignItems: "center",
12646
- gap: spacing[2],
12647
- marginBottom: spacing[2]
12648
- },
12649
- children: [
12650
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12651
- "span",
12652
- {
12653
- style: {
12654
- fontSize: fontSize.xs,
12655
- fontWeight: fontWeight.medium,
12656
- color: colors.mutedForeground,
12657
- textTransform: "uppercase",
12658
- letterSpacing: "0.05em"
12659
- },
12660
- children: "Token"
12661
- }
12662
- ),
12663
- walletAddress && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12664
- "span",
12665
- {
12666
- style: {
12667
- fontSize: "10px",
12668
- color: colors.primary,
12669
- backgroundColor: "rgba(59, 130, 246, 0.1)",
12670
- padding: `${spacing[0.5]} ${spacing[1.5]}`,
12671
- borderRadius: borderRadius.md
12672
- },
12673
- children: "Wallet Connected"
12674
- }
12675
- )
12676
- ]
12677
- }
12678
- ),
12679
- selectedChain ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12680
- TokenSearchInput,
12681
- {
12682
- searchQuery,
12683
- setSearchQuery
12684
- }
12685
- ) : null
12686
- ]
13858
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13859
+ TokenSearchInput,
13860
+ {
13861
+ searchQuery,
13862
+ setSearchQuery
13863
+ }
13864
+ )
12687
13865
  }
12688
13866
  ),
12689
13867
  /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
@@ -12692,115 +13870,99 @@ function TokenSelectorPanel({
12692
13870
  style: {
12693
13871
  flex: 1,
12694
13872
  overflowY: "auto",
12695
- padding: `${spacing[2]} ${spacing[1]}`
13873
+ padding: `${spacing[1]} ${spacing[1]}`
12696
13874
  },
12697
- children: !selectedChain || isLoadingTokens || tokensError || filteredTokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13875
+ children: !selectedChain ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12698
13876
  TokenSelectorStateView,
12699
13877
  {
12700
13878
  isLoadingTokens,
12701
13879
  searchQuery,
12702
13880
  setSearchQuery,
12703
- state: !selectedChain ? "no-chain" : tokensError ? "error" : "empty",
12704
- tokensError
13881
+ state: "no-chain",
13882
+ tokensError: null
12705
13883
  }
12706
- ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
12707
- "div",
13884
+ ) : isLoadingTokens && !hasWalletTokens ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13885
+ TokenSelectorStateView,
12708
13886
  {
12709
- style: {
12710
- display: "flex",
12711
- flexDirection: "column",
12712
- gap: spacing[0.5]
12713
- },
12714
- children: [
12715
- filteredWalletTokens.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
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__ */ (0, import_jsx_runtime25.jsx)(
12727
- "span",
12728
- {
12729
- style: {
12730
- fontSize: "0.75rem",
12731
- lineHeight: "1rem",
12732
- color: colors.primary
12733
- },
12734
- children: "Your tokens"
12735
- }
12736
- )
12737
- }
12738
- ) : null,
12739
- filteredWalletTokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12740
- WalletTokenListItem,
12741
- {
12742
- token,
12743
- onSelect: onSelectWalletToken
13887
+ isLoadingTokens: true,
13888
+ searchQuery,
13889
+ setSearchQuery,
13890
+ state: "empty",
13891
+ tokensError: null
13892
+ }
13893
+ ) : tokensError && !hasWalletTokens ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13894
+ TokenSelectorStateView,
13895
+ {
13896
+ isLoadingTokens: false,
13897
+ searchQuery,
13898
+ setSearchQuery,
13899
+ state: "error",
13900
+ tokensError
13901
+ }
13902
+ ) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { style: { display: "flex", flexDirection: "column" }, children: [
13903
+ hasWalletTokens && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
13904
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TokenSectionLabel, { icon: "wallet", children: "Your tokens" }),
13905
+ filteredWalletTokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13906
+ WalletTokenListItem,
13907
+ {
13908
+ token,
13909
+ onSelect: onSelectWalletToken
13910
+ },
13911
+ `${token.address}-${i}`
13912
+ ))
13913
+ ] }),
13914
+ isLoadingTokens ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13915
+ TokenSelectorStateView,
13916
+ {
13917
+ isLoadingTokens: true,
13918
+ searchQuery,
13919
+ setSearchQuery,
13920
+ state: "empty",
13921
+ tokensError: null
13922
+ }
13923
+ ) : hasPopularTokens ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
13924
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TokenSectionLabel, { icon: "spark", children: "Popular tokens" }),
13925
+ filteredTokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13926
+ AvailableTokenListItem,
13927
+ {
13928
+ token,
13929
+ onSelect: onSelectToken
13930
+ },
13931
+ `${token.address}-${i}`
13932
+ )),
13933
+ hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13934
+ "button",
13935
+ {
13936
+ type: "button",
13937
+ onClick: () => {
13938
+ void loadMore();
12744
13939
  },
12745
- `${token.address}-${i}`
12746
- )),
12747
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12748
- "div",
12749
- {
12750
- style: {
12751
- display: "flex",
12752
- alignItems: "center",
12753
- gap: "0.375rem",
12754
- paddingLeft: "0.5rem",
12755
- paddingRight: "0.5rem",
12756
- marginBottom: spacing[2]
12757
- },
12758
- children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12759
- "span",
12760
- {
12761
- style: {
12762
- fontSize: "0.75rem",
12763
- lineHeight: "1rem",
12764
- color: colors.primary
12765
- },
12766
- children: "Popular tokens"
12767
- }
12768
- )
12769
- }
12770
- ),
12771
- filteredTokens.map((token, i) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12772
- AvailableTokenListItem,
12773
- {
12774
- token,
12775
- onSelect: onSelectToken
13940
+ disabled: isLoadingMore,
13941
+ style: {
13942
+ marginTop: spacing[2],
13943
+ marginLeft: spacing[2],
13944
+ marginRight: spacing[2],
13945
+ padding: `${spacing[2]} ${spacing[3]}`,
13946
+ borderRadius: borderRadius.lg,
13947
+ border: `1px solid ${colors.border}`,
13948
+ backgroundColor: colors.card,
13949
+ color: colors.foreground,
13950
+ cursor: isLoadingMore ? "wait" : "pointer"
12776
13951
  },
12777
- `${token.address}-${i}`
12778
- )),
12779
- hasNextPage ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
12780
- "button",
12781
- {
12782
- type: "button",
12783
- onClick: () => {
12784
- void loadMore();
12785
- },
12786
- disabled: isLoadingMore,
12787
- style: {
12788
- marginTop: spacing[2],
12789
- marginLeft: spacing[2],
12790
- marginRight: spacing[2],
12791
- padding: `${spacing[2]} ${spacing[3]}`,
12792
- borderRadius: borderRadius.lg,
12793
- border: `1px solid ${colors.border}`,
12794
- backgroundColor: colors.card,
12795
- color: colors.foreground,
12796
- cursor: isLoadingMore ? "wait" : "pointer"
12797
- },
12798
- children: isLoadingMore ? "Loading more..." : "Load more"
12799
- }
12800
- ) : null
12801
- ]
12802
- }
12803
- )
13952
+ children: isLoadingMore ? "Loading more..." : "Load more"
13953
+ }
13954
+ ) : null
13955
+ ] }) : !hasWalletTokens ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
13956
+ TokenSelectorStateView,
13957
+ {
13958
+ isLoadingTokens: false,
13959
+ searchQuery,
13960
+ setSearchQuery,
13961
+ state: "empty",
13962
+ tokensError: null
13963
+ }
13964
+ ) : null
13965
+ ] })
12804
13966
  }
12805
13967
  )
12806
13968
  ]
@@ -31351,29 +32513,7 @@ function SwapTokenSelect({
31351
32513
  popularChains
31352
32514
  }
31353
32515
  ),
31354
- localChain === null ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
31355
- "div",
31356
- {
31357
- style: {
31358
- flex: 1,
31359
- display: "flex",
31360
- alignItems: "center",
31361
- justifyContent: "center",
31362
- padding: spacing[4]
31363
- },
31364
- children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
31365
- "p",
31366
- {
31367
- style: {
31368
- fontSize: fontSize.sm,
31369
- color: colors.mutedForeground,
31370
- textAlign: "center"
31371
- },
31372
- children: "Select a chain to see tokens"
31373
- }
31374
- )
31375
- }
31376
- ) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
32516
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
31377
32517
  TokenSelectorPanel,
31378
32518
  {
31379
32519
  filteredTokens: visibleTokens,
@@ -31565,58 +32705,38 @@ function SwapWalletSelector({
31565
32705
  children: "Connect Wallet"
31566
32706
  }
31567
32707
  ),
31568
- /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
32708
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
31569
32709
  "div",
31570
32710
  {
31571
32711
  style: {
31572
- position: "relative",
31573
32712
  display: "flex",
31574
32713
  alignItems: "center",
31575
- borderRadius: "9999px",
31576
- background: colors.background,
31577
- border: `1px solid ${colors.mutedForeground}`,
31578
- padding: "3px"
32714
+ borderRadius: borderRadius.lg,
32715
+ backgroundColor: colors.muted,
32716
+ padding: "3px",
32717
+ gap: "2px"
31579
32718
  },
31580
- children: [
31581
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
31582
- "div",
31583
- {
31584
- style: {
31585
- position: "absolute",
31586
- top: 3,
31587
- bottom: 3,
31588
- width: "calc(50% - 3px)",
31589
- borderRadius: "9999px",
31590
- background: `linear-gradient(to bottom, ${colors.zinc[100]}, ${colors.zinc[200]})`,
31591
- border: `1px solid ${colors.mutedForeground}`,
31592
- transition: "transform 300ms ease-out",
31593
- transform: selectedNamespace === "evm" ? "translateX(0)" : "translateX(100%)"
31594
- }
31595
- }
31596
- ),
31597
- tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
31598
- "button",
31599
- {
31600
- onClick: () => setSelectedNamespace(t.id),
31601
- style: {
31602
- position: "relative",
31603
- zIndex: 10,
31604
- padding: "4px 11px",
31605
- fontSize: "10px",
31606
- outline: "none",
31607
- fontWeight: 600,
31608
- borderRadius: "9999px",
31609
- background: "transparent",
31610
- border: "none",
31611
- cursor: "pointer",
31612
- transition: "color 200ms",
31613
- color: selectedNamespace === t.id ? colors.black : colors.mutedForeground
31614
- },
31615
- children: t.label
32719
+ children: tabs.map((t) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
32720
+ "button",
32721
+ {
32722
+ onClick: () => setSelectedNamespace(t.id),
32723
+ style: {
32724
+ padding: `${spacing[1]} ${spacing[3]}`,
32725
+ fontSize: fontSize.sm,
32726
+ fontWeight: fontWeight.medium,
32727
+ borderRadius: borderRadius.md,
32728
+ background: selectedNamespace === t.id ? colors.card : "transparent",
32729
+ border: selectedNamespace === t.id ? `1px solid ${colors.border}` : "1px solid transparent",
32730
+ cursor: "pointer",
32731
+ transition: "all 0.15s",
32732
+ color: selectedNamespace === t.id ? colors.foreground : colors.mutedForeground,
32733
+ boxShadow: selectedNamespace === t.id ? "0 1px 3px rgba(0,0,0,0.08)" : "none",
32734
+ outline: "none"
31616
32735
  },
31617
- t.id
31618
- ))
31619
- ]
32736
+ children: t.label
32737
+ },
32738
+ t.id
32739
+ ))
31620
32740
  }
31621
32741
  )
31622
32742
  ]
@@ -32217,7 +33337,7 @@ function RateRow({ label, value }) {
32217
33337
  );
32218
33338
  }
32219
33339
  function SwapMode({
32220
- theme = "system",
33340
+ theme: themeProp,
32221
33341
  style
32222
33342
  }) {
32223
33343
  const [stage, setStage] = (0, import_react46.useState)("home");
@@ -32266,7 +33386,11 @@ function SwapMode({
32266
33386
  const settingsRef = (0, import_react46.useRef)(null);
32267
33387
  const currencyDropdownRef = (0, import_react46.useRef)(null);
32268
33388
  const { emitEvent } = useTrustware();
32269
- const { features } = useTrustwareConfig();
33389
+ const { features, theme: configTheme } = useTrustwareConfig();
33390
+ const effectiveThemeSetting = themeProp ?? configTheme ?? "system";
33391
+ const { resolvedTheme, toggleTheme } = useThemePreference(
33392
+ effectiveThemeSetting
33393
+ );
32270
33394
  const defaultDestRef = features.swapDefaultDestToken;
32271
33395
  const lockDestToken = features.swapLockDestToken && !!defaultDestRef;
32272
33396
  const allowedDestTokens = features.swapAllowedDestTokens;
@@ -32832,7 +33956,7 @@ function SwapMode({
32832
33956
  return () => document.removeEventListener("mousedown", handler);
32833
33957
  }, [showCurrencyDropdown]);
32834
33958
  if (stage === "select-from") {
32835
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
33959
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
32836
33960
  SwapTokenSelect,
32837
33961
  {
32838
33962
  side: "from",
@@ -32850,7 +33974,7 @@ function SwapMode({
32850
33974
  ) });
32851
33975
  }
32852
33976
  if (stage === "select-to" && !lockDestToken) {
32853
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
33977
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
32854
33978
  SwapTokenSelect,
32855
33979
  {
32856
33980
  side: "to",
@@ -32869,7 +33993,7 @@ function SwapMode({
32869
33993
  ) });
32870
33994
  }
32871
33995
  if (stage === "connect-wallet") {
32872
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(WidgetContainer, { theme, style, children: [
33996
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(WidgetContainer, { theme: resolvedTheme, style, children: [
32873
33997
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
32874
33998
  SwapWalletSelector,
32875
33999
  {
@@ -32912,7 +34036,7 @@ function SwapMode({
32912
34036
  const offset = circ - progress / 100 * circ;
32913
34037
  const isApproving = txStatus === "approving";
32914
34038
  const title = isApproving ? "Approving..." : "Order Submitted";
32915
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
34039
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
32916
34040
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
32917
34041
  "div",
32918
34042
  {
@@ -33362,7 +34486,7 @@ function SwapMode({
33362
34486
  dateStyle: "medium",
33363
34487
  timeStyle: "short"
33364
34488
  }) ?? null;
33365
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { position: "relative", overflow: "hidden" }, children: [
34489
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { position: "relative", overflow: "hidden" }, children: [
33366
34490
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react46.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(ConfettiEffect3, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
33367
34491
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { padding: `${spacing[6]} ${spacing[6]} 0` }, children: [
33368
34492
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
@@ -33441,30 +34565,58 @@ function SwapMode({
33441
34565
  fontSize: fontSize.sm
33442
34566
  },
33443
34567
  children: [
33444
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: colors.mutedForeground }, children: "You sold" }),
33445
34568
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
33446
- "span",
34569
+ "div",
33447
34570
  {
33448
34571
  style: {
33449
- display: "inline-flex",
34572
+ display: "flex",
33450
34573
  alignItems: "center",
33451
- gap: spacing[2],
34574
+ gap: spacing[2]
34575
+ },
34576
+ children: [
34577
+ fromToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { position: "relative", flexShrink: 0 }, children: [
34578
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34579
+ "img",
34580
+ {
34581
+ src: fromToken.iconUrl,
34582
+ alt: "",
34583
+ style: {
34584
+ width: "1.375rem",
34585
+ height: "1.375rem",
34586
+ borderRadius: "9999px"
34587
+ }
34588
+ }
34589
+ ),
34590
+ fromChain?.chainIconURI && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34591
+ "img",
34592
+ {
34593
+ src: fromChain.chainIconURI,
34594
+ alt: "",
34595
+ style: {
34596
+ position: "absolute",
34597
+ bottom: -2,
34598
+ right: -2,
34599
+ width: "0.625rem",
34600
+ height: "0.625rem",
34601
+ borderRadius: "9999px",
34602
+ border: `1.5px solid ${colors.background}`,
34603
+ objectFit: "cover"
34604
+ }
34605
+ }
34606
+ )
34607
+ ] }),
34608
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: colors.mutedForeground }, children: "You sold" })
34609
+ ]
34610
+ }
34611
+ ),
34612
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34613
+ "span",
34614
+ {
34615
+ style: {
33452
34616
  fontWeight: fontWeight.semibold,
33453
34617
  color: colors.foreground
33454
34618
  },
33455
34619
  children: [
33456
- fromToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
33457
- "img",
33458
- {
33459
- src: fromToken.iconUrl,
33460
- style: {
33461
- width: "1.25rem",
33462
- height: "1.25rem",
33463
- borderRadius: "9999px"
33464
- },
33465
- alt: ""
33466
- }
33467
- ),
33468
34620
  fmtAmount(tokenSellNum, 4),
33469
34621
  " ",
33470
34622
  fromToken?.symbol
@@ -33485,30 +34637,58 @@ function SwapMode({
33485
34637
  marginTop: spacing[3]
33486
34638
  },
33487
34639
  children: [
33488
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: colors.mutedForeground }, children: "Received" }),
33489
34640
  /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
33490
- "span",
34641
+ "div",
33491
34642
  {
33492
34643
  style: {
33493
- display: "inline-flex",
34644
+ display: "flex",
33494
34645
  alignItems: "center",
33495
- gap: spacing[2],
34646
+ gap: spacing[2]
34647
+ },
34648
+ children: [
34649
+ toToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { position: "relative", flexShrink: 0 }, children: [
34650
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34651
+ "img",
34652
+ {
34653
+ src: toToken.iconUrl,
34654
+ alt: "",
34655
+ style: {
34656
+ width: "1.375rem",
34657
+ height: "1.375rem",
34658
+ borderRadius: "9999px"
34659
+ }
34660
+ }
34661
+ ),
34662
+ toChain?.chainIconURI && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34663
+ "img",
34664
+ {
34665
+ src: toChain.chainIconURI,
34666
+ alt: "",
34667
+ style: {
34668
+ position: "absolute",
34669
+ bottom: -2,
34670
+ right: -2,
34671
+ width: "0.625rem",
34672
+ height: "0.625rem",
34673
+ borderRadius: "9999px",
34674
+ border: `1.5px solid ${colors.background}`,
34675
+ objectFit: "cover"
34676
+ }
34677
+ }
34678
+ )
34679
+ ] }),
34680
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: colors.mutedForeground }, children: "Received" })
34681
+ ]
34682
+ }
34683
+ ),
34684
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34685
+ "span",
34686
+ {
34687
+ style: {
33496
34688
  fontWeight: fontWeight.semibold,
33497
34689
  color: colors.foreground
33498
34690
  },
33499
34691
  children: [
33500
- toToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
33501
- "img",
33502
- {
33503
- src: toToken.iconUrl,
33504
- style: {
33505
- width: "1.25rem",
33506
- height: "1.25rem",
33507
- borderRadius: "9999px"
33508
- },
33509
- alt: ""
33510
- }
33511
- ),
33512
34692
  finalToAmount !== null ? fmtAmount(finalToAmount, 4) : "\u2014",
33513
34693
  " ",
33514
34694
  toToken?.symbol
@@ -33559,13 +34739,6 @@ function SwapMode({
33559
34739
  value: effectiveRate
33560
34740
  }
33561
34741
  ),
33562
- (fromChain?.networkName ?? fromChain?.axelarChainName) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
33563
- SuccessReceiptRow,
33564
- {
33565
- label: "Network",
33566
- value: fromChain?.networkName ?? fromChain?.axelarChainName
33567
- }
33568
- ),
33569
34742
  completedStr && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SuccessReceiptRow, { label: "Completed", value: completedStr }),
33570
34743
  txHash && (() => {
33571
34744
  const srcUrl = buildExplorerUrl(
@@ -33874,7 +35047,7 @@ function SwapMode({
33874
35047
  ] }) });
33875
35048
  }
33876
35049
  if (stage === "error") {
33877
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35050
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
33878
35051
  "div",
33879
35052
  {
33880
35053
  style: {
@@ -34008,422 +35181,408 @@ function SwapMode({
34008
35181
  if (stage === "review") {
34009
35182
  const reviewToAmount = toAmount ?? displayToAmount;
34010
35183
  const reviewToUsd = toUsd > 0 ? toUsd : displayToUsd;
34011
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
34012
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34013
- "div",
34014
- {
34015
- style: {
34016
- display: "flex",
34017
- alignItems: "center",
34018
- justifyContent: "space-between",
34019
- marginBottom: spacing[5]
34020
- },
34021
- children: [
34022
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34023
- "span",
34024
- {
34025
- style: {
34026
- fontSize: fontSize.sm,
34027
- fontWeight: fontWeight.medium,
34028
- color: colors.mutedForeground
34029
- },
34030
- children: "You're swapping"
34031
- }
34032
- ),
34033
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34034
- "button",
34035
- {
34036
- onClick: () => setStage("home"),
34037
- style: {
34038
- width: "2rem",
34039
- height: "2rem",
34040
- borderRadius: "9999px",
34041
- display: "flex",
34042
- alignItems: "center",
34043
- justifyContent: "center",
34044
- backgroundColor: "transparent",
34045
- border: 0,
34046
- cursor: "pointer"
34047
- },
34048
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34049
- "svg",
35184
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35185
+ "div",
35186
+ {
35187
+ style: {
35188
+ padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}`,
35189
+ maxHeight: "85vh",
35190
+ overflowY: "auto"
35191
+ },
35192
+ children: [
35193
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35194
+ "div",
35195
+ {
35196
+ style: {
35197
+ display: "flex",
35198
+ alignItems: "center",
35199
+ justifyContent: "space-between",
35200
+ marginBottom: spacing[5]
35201
+ },
35202
+ children: [
35203
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35204
+ "span",
34050
35205
  {
34051
35206
  style: {
34052
- width: "1.25rem",
34053
- height: "1.25rem",
34054
- color: colors.foreground
35207
+ fontSize: fontSize.sm,
35208
+ fontWeight: fontWeight.medium,
35209
+ color: colors.mutedForeground
34055
35210
  },
34056
- viewBox: "0 0 24 24",
34057
- fill: "none",
34058
- stroke: "currentColor",
34059
- strokeWidth: 2,
34060
- strokeLinecap: "round",
34061
- strokeLinejoin: "round",
34062
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M18 6L6 18M6 6l12 12" })
35211
+ children: "You're swapping"
35212
+ }
35213
+ ),
35214
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35215
+ "button",
35216
+ {
35217
+ onClick: () => setStage("home"),
35218
+ style: {
35219
+ width: "2rem",
35220
+ height: "2rem",
35221
+ borderRadius: "9999px",
35222
+ display: "flex",
35223
+ alignItems: "center",
35224
+ justifyContent: "center",
35225
+ backgroundColor: "transparent",
35226
+ border: 0,
35227
+ cursor: "pointer"
35228
+ },
35229
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35230
+ "svg",
35231
+ {
35232
+ style: {
35233
+ width: "1.25rem",
35234
+ height: "1.25rem",
35235
+ color: colors.foreground
35236
+ },
35237
+ viewBox: "0 0 24 24",
35238
+ fill: "none",
35239
+ stroke: "currentColor",
35240
+ strokeWidth: 2,
35241
+ strokeLinecap: "round",
35242
+ strokeLinejoin: "round",
35243
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M18 6L6 18M6 6l12 12" })
35244
+ }
35245
+ )
34063
35246
  }
34064
35247
  )
34065
- }
34066
- )
34067
- ]
34068
- }
34069
- ),
34070
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34071
- "div",
34072
- {
34073
- style: {
34074
- display: "flex",
34075
- alignItems: "center",
34076
- justifyContent: "space-between"
34077
- },
34078
- children: [
34079
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { children: [
34080
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34081
- "p",
34082
- {
34083
- style: {
34084
- fontSize: "1.75rem",
34085
- fontWeight: fontWeight.semibold,
34086
- color: colors.foreground,
34087
- lineHeight: 1.2
34088
- },
34089
- children: [
34090
- fmtAmount(tokenSellNum, 5),
34091
- " ",
34092
- fromToken?.symbol
34093
- ]
34094
- }
34095
- ),
34096
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34097
- "p",
34098
- {
34099
- style: {
34100
- fontSize: fontSize.sm,
34101
- color: colors.mutedForeground,
34102
- marginTop: "0.125rem"
34103
- },
34104
- children: fmtLocal(fromUsd)
34105
- }
34106
- )
34107
- ] }),
34108
- fromToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34109
- TokenIcon,
34110
- {
34111
- icon: fromToken.iconUrl,
34112
- chainIcon: fromChain?.chainIconURI,
34113
- size: "lg"
34114
- }
34115
- )
34116
- ]
34117
- }
34118
- ),
34119
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34120
- "div",
34121
- {
34122
- style: {
34123
- display: "flex",
34124
- justifyContent: "center",
34125
- margin: `${spacing[3]} 0`
34126
- },
34127
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34128
- "svg",
35248
+ ]
35249
+ }
35250
+ ),
35251
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35252
+ "div",
34129
35253
  {
34130
35254
  style: {
34131
- width: "1rem",
34132
- height: "1rem",
34133
- color: colors.mutedForeground
35255
+ display: "flex",
35256
+ alignItems: "center",
35257
+ justifyContent: "space-between"
34134
35258
  },
34135
- viewBox: "0 0 24 24",
34136
- fill: "none",
34137
- stroke: "currentColor",
34138
- strokeWidth: 2,
34139
- strokeLinecap: "round",
34140
- strokeLinejoin: "round",
34141
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M12 5v14m-7-7l7 7 7-7" })
35259
+ children: [
35260
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { children: [
35261
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35262
+ "p",
35263
+ {
35264
+ style: {
35265
+ fontSize: "1.75rem",
35266
+ fontWeight: fontWeight.semibold,
35267
+ color: colors.foreground,
35268
+ lineHeight: 1.2
35269
+ },
35270
+ children: [
35271
+ fmtAmount(tokenSellNum, 5),
35272
+ " ",
35273
+ fromToken?.symbol
35274
+ ]
35275
+ }
35276
+ ),
35277
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35278
+ "p",
35279
+ {
35280
+ style: {
35281
+ fontSize: fontSize.sm,
35282
+ color: colors.mutedForeground,
35283
+ marginTop: "0.125rem"
35284
+ },
35285
+ children: fmtLocal(fromUsd)
35286
+ }
35287
+ )
35288
+ ] }),
35289
+ fromToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35290
+ TokenIcon,
35291
+ {
35292
+ icon: fromToken.iconUrl,
35293
+ chainIcon: fromChain?.chainIconURI,
35294
+ size: "lg"
35295
+ }
35296
+ )
35297
+ ]
34142
35298
  }
34143
- )
34144
- }
34145
- ),
34146
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34147
- "div",
34148
- {
34149
- style: {
34150
- display: "flex",
34151
- alignItems: "center",
34152
- justifyContent: "space-between"
34153
- },
34154
- children: [
34155
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { children: [
34156
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34157
- "p",
34158
- {
34159
- style: {
34160
- fontSize: "1.75rem",
34161
- fontWeight: fontWeight.semibold,
34162
- color: colors.foreground,
34163
- lineHeight: 1.2
34164
- },
34165
- children: [
34166
- reviewToAmount !== null ? fmtAmount(reviewToAmount, 5) : "\u2014",
34167
- " ",
34168
- toToken?.symbol
34169
- ]
34170
- }
34171
- ),
34172
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34173
- "p",
35299
+ ),
35300
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35301
+ "div",
35302
+ {
35303
+ style: {
35304
+ display: "flex",
35305
+ justifyContent: "center",
35306
+ margin: `${spacing[3]} 0`
35307
+ },
35308
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35309
+ "svg",
34174
35310
  {
34175
35311
  style: {
34176
- fontSize: fontSize.sm,
34177
- color: colors.mutedForeground,
34178
- marginTop: "0.125rem"
35312
+ width: "1rem",
35313
+ height: "1rem",
35314
+ color: colors.mutedForeground
34179
35315
  },
34180
- children: fmtLocal(reviewToUsd)
35316
+ viewBox: "0 0 24 24",
35317
+ fill: "none",
35318
+ stroke: "currentColor",
35319
+ strokeWidth: 2,
35320
+ strokeLinecap: "round",
35321
+ strokeLinejoin: "round",
35322
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M12 5v14m-7-7l7 7 7-7" })
34181
35323
  }
34182
35324
  )
34183
- ] }),
34184
- toToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34185
- TokenIcon,
34186
- {
34187
- icon: toToken.iconUrl,
34188
- chainIcon: toChain?.chainIconURI,
34189
- size: "lg"
34190
- }
34191
- )
34192
- ]
34193
- }
34194
- ),
34195
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34196
- "button",
34197
- {
34198
- onClick: () => setShowReviewDetails((v) => !v),
34199
- style: {
34200
- margin: `${spacing[5]} 0`,
34201
- display: "flex",
34202
- alignItems: "center",
34203
- gap: spacing[2],
34204
- width: "100%",
34205
- background: "none",
34206
- border: 0,
34207
- cursor: "pointer",
34208
- color: colors.foreground,
34209
- fontSize: fontSize.sm,
34210
- fontWeight: fontWeight.medium
34211
- },
34212
- children: [
34213
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34214
- "div",
34215
- {
34216
- style: { flex: 1, height: "1px", backgroundColor: colors.border }
34217
- }
34218
- ),
34219
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34220
- "span",
34221
- {
34222
- style: {
34223
- display: "flex",
34224
- alignItems: "center",
34225
- gap: "0.25rem",
34226
- padding: `0 ${spacing[2]}`,
34227
- whiteSpace: "nowrap"
34228
- },
34229
- children: [
34230
- showReviewDetails ? "Show less" : "Show more",
34231
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34232
- "svg",
35325
+ }
35326
+ ),
35327
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35328
+ "div",
35329
+ {
35330
+ style: {
35331
+ display: "flex",
35332
+ alignItems: "center",
35333
+ justifyContent: "space-between"
35334
+ },
35335
+ children: [
35336
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { children: [
35337
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35338
+ "p",
34233
35339
  {
34234
35340
  style: {
34235
- width: "0.875rem",
34236
- height: "0.875rem",
34237
- transform: showReviewDetails ? "rotate(180deg)" : void 0,
34238
- transition: "transform 0.2s"
35341
+ fontSize: "1.75rem",
35342
+ fontWeight: fontWeight.semibold,
35343
+ color: colors.foreground,
35344
+ lineHeight: 1.2
34239
35345
  },
34240
- viewBox: "0 0 24 24",
34241
- fill: "none",
34242
- stroke: "currentColor",
34243
- strokeWidth: 2,
34244
- strokeLinecap: "round",
34245
- strokeLinejoin: "round",
34246
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M6 9l6 6 6-6" })
35346
+ children: [
35347
+ reviewToAmount !== null ? fmtAmount(reviewToAmount, 5) : "\u2014",
35348
+ " ",
35349
+ toToken?.symbol
35350
+ ]
34247
35351
  }
34248
35352
  ),
34249
- route.data && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34250
- "svg",
35353
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35354
+ "p",
34251
35355
  {
34252
- width: "14",
34253
- height: "14",
34254
- viewBox: "0 0 14 14",
34255
35356
  style: {
34256
- transform: "rotate(-90deg)",
34257
- flexShrink: 0,
34258
- opacity: 0.75,
34259
- marginLeft: "0.125rem"
35357
+ fontSize: fontSize.sm,
35358
+ color: colors.mutedForeground,
35359
+ marginTop: "0.125rem"
34260
35360
  },
34261
- children: [
34262
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34263
- "circle",
34264
- {
34265
- cx: "7",
34266
- cy: "7",
34267
- r: "5",
34268
- fill: "none",
34269
- stroke: "hsl(var(--tw-border))",
34270
- strokeWidth: "1.5"
34271
- }
34272
- ),
34273
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34274
- "circle",
34275
- {
34276
- cx: "7",
34277
- cy: "7",
34278
- r: "5",
34279
- fill: "none",
34280
- stroke: quoteAge >= QUOTE_TTL - 10 ? colors.destructive : colors.primary,
34281
- strokeWidth: "1.5",
34282
- strokeLinecap: "round",
34283
- strokeDasharray: "31.416",
34284
- strokeDashoffset: 31.416 * (quoteAge / QUOTE_TTL),
34285
- style: { transition: "stroke-dashoffset 1s linear" }
34286
- }
34287
- )
34288
- ]
35361
+ children: fmtLocal(reviewToUsd)
34289
35362
  }
34290
35363
  )
34291
- ]
34292
- }
34293
- ),
34294
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34295
- "div",
34296
- {
34297
- style: { flex: 1, height: "1px", backgroundColor: colors.border }
34298
- }
34299
- )
34300
- ]
34301
- }
34302
- ),
34303
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34304
- "div",
34305
- {
34306
- style: {
34307
- display: "flex",
34308
- flexDirection: "column",
34309
- gap: spacing[3],
34310
- fontSize: fontSize.sm
34311
- },
34312
- children: [
34313
- showReviewDetails && exchangeRate !== null && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34314
- ReviewDetailRow,
34315
- {
34316
- label: "Rate",
34317
- tooltip: "Current exchange rate between the two tokens",
34318
- value: `1 ${fromToken?.symbol} = ${fmtAmount(1 / (exchangeRate ?? 1), 4)} ${toToken?.symbol} ($${fmtAmount(fromTokenPriceUSD, 2)})`
34319
- }
34320
- ),
34321
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34322
- ReviewDetailRow,
34323
- {
34324
- label: "Fee",
34325
- tooltip: "Protocol fee charged by the bridge or DEX",
34326
- value: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34327
- "span",
35364
+ ] }),
35365
+ toToken?.iconUrl && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35366
+ TokenIcon,
34328
35367
  {
34329
- style: {
34330
- color: colors.foreground,
34331
- fontWeight: fontWeight.medium
34332
- },
34333
- children: protocolFeeUsd !== null ? fmtLocal(protocolFeeUsd) : "Free"
35368
+ icon: toToken.iconUrl,
35369
+ chainIcon: toChain?.chainIconURI,
35370
+ size: "lg"
34334
35371
  }
34335
35372
  )
34336
- }
34337
- ),
34338
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34339
- ReviewDetailRow,
34340
- {
34341
- label: "Network cost",
34342
- tooltip: "Estimated gas fee paid to the blockchain network",
34343
- value: isGasSponsored ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SponsoredBadge, {}) : networkCostUsd !== null ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35373
+ ]
35374
+ }
35375
+ ),
35376
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35377
+ "button",
35378
+ {
35379
+ onClick: () => setShowReviewDetails((v) => !v),
35380
+ style: {
35381
+ margin: `${spacing[5]} 0`,
35382
+ display: "flex",
35383
+ alignItems: "center",
35384
+ gap: spacing[2],
35385
+ width: "100%",
35386
+ background: "none",
35387
+ border: 0,
35388
+ cursor: "pointer",
35389
+ color: colors.mutedForeground,
35390
+ fontSize: fontSize.sm,
35391
+ fontWeight: fontWeight.medium,
35392
+ padding: 0
35393
+ },
35394
+ children: [
35395
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35396
+ "div",
35397
+ {
35398
+ style: { flex: 1, height: "1px", backgroundColor: colors.border }
35399
+ }
35400
+ ),
35401
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34344
35402
  "span",
34345
35403
  {
34346
35404
  style: {
34347
35405
  display: "flex",
34348
35406
  alignItems: "center",
34349
35407
  gap: "0.25rem",
34350
- color: colors.mutedForeground
35408
+ padding: `0 ${spacing[2]}`,
35409
+ whiteSpace: "nowrap"
34351
35410
  },
34352
35411
  children: [
34353
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(GasIcon, { size: "0.875rem" }),
34354
- fmtLocal(networkCostUsd)
35412
+ showReviewDetails ? "Hide details" : "View details",
35413
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35414
+ "svg",
35415
+ {
35416
+ style: {
35417
+ width: "0.875rem",
35418
+ height: "0.875rem",
35419
+ transform: showReviewDetails ? "rotate(180deg)" : void 0,
35420
+ transition: "transform 0.2s"
35421
+ },
35422
+ viewBox: "0 0 24 24",
35423
+ fill: "none",
35424
+ stroke: "currentColor",
35425
+ strokeWidth: 2,
35426
+ strokeLinecap: "round",
35427
+ strokeLinejoin: "round",
35428
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M6 9l6 6 6-6" })
35429
+ }
35430
+ ),
35431
+ route.data && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35432
+ "svg",
35433
+ {
35434
+ width: "14",
35435
+ height: "14",
35436
+ viewBox: "0 0 14 14",
35437
+ style: {
35438
+ transform: "rotate(-90deg)",
35439
+ flexShrink: 0,
35440
+ opacity: 0.75,
35441
+ marginLeft: "0.125rem"
35442
+ },
35443
+ children: [
35444
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35445
+ "circle",
35446
+ {
35447
+ cx: "7",
35448
+ cy: "7",
35449
+ r: "5",
35450
+ fill: "none",
35451
+ stroke: "hsl(var(--tw-border))",
35452
+ strokeWidth: "1.5"
35453
+ }
35454
+ ),
35455
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35456
+ "circle",
35457
+ {
35458
+ cx: "7",
35459
+ cy: "7",
35460
+ r: "5",
35461
+ fill: "none",
35462
+ stroke: quoteAge >= QUOTE_TTL - 10 ? colors.destructive : colors.primary,
35463
+ strokeWidth: "1.5",
35464
+ strokeLinecap: "round",
35465
+ strokeDasharray: "31.416",
35466
+ strokeDashoffset: 31.416 * (quoteAge / QUOTE_TTL),
35467
+ style: { transition: "stroke-dashoffset 1s linear" }
35468
+ }
35469
+ )
35470
+ ]
35471
+ }
35472
+ )
34355
35473
  ]
34356
35474
  }
34357
- ) : /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: colors.mutedForeground }, children: "\u2014" })
34358
- }
34359
- ),
34360
- showReviewDetails && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(import_jsx_runtime56.Fragment, { children: [
34361
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34362
- ReviewDetailRow,
34363
- {
34364
- label: "Max slippage",
34365
- tooltip: "Max price movement allowed before the swap automatically reverts",
34366
- value: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34367
- "span",
34368
- {
34369
- style: {
34370
- display: "flex",
34371
- alignItems: "center",
34372
- gap: spacing[1.5]
34373
- },
34374
- children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { style: { color: colors.mutedForeground }, children: [
34375
- slippage,
34376
- "%"
34377
- ] })
34378
- }
34379
- )
34380
- }
34381
- ),
34382
- (routePath || route.data?.route?.provider) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34383
- ReviewDetailRow,
34384
- {
34385
- label: "Route",
34386
- tooltip: "Protocol or bridge used to execute your swap",
34387
- value: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34388
- "span",
34389
- {
34390
- style: {
34391
- color: colors.foreground,
34392
- overflow: "hidden",
34393
- textOverflow: "ellipsis",
34394
- whiteSpace: "nowrap",
34395
- maxWidth: "200px",
34396
- display: "inline-block",
34397
- verticalAlign: "bottom"
34398
- },
34399
- title: routePath ?? route.data?.route?.provider,
34400
- children: routePath ?? route.data?.route?.provider
34401
- }
34402
- )
34403
- }
34404
- )
34405
- ] })
34406
- ]
34407
- }
34408
- ),
34409
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34410
- SwapActionArea,
34411
- {
34412
- fromTokenSymbol: fromToken?.symbol ?? "",
34413
- allowanceStatus: execution.allowanceStatus,
34414
- txStatus: execution.txStatus,
34415
- isSubmitting: execution.isSubmitting,
34416
- isGasSponsored,
34417
- onExecute: () => void handleExecute()
34418
- }
34419
- )
34420
- ] }) });
35475
+ ),
35476
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35477
+ "div",
35478
+ {
35479
+ style: { flex: 1, height: "1px", backgroundColor: colors.border }
35480
+ }
35481
+ )
35482
+ ]
35483
+ }
35484
+ ),
35485
+ showReviewDetails && /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35486
+ "div",
35487
+ {
35488
+ style: {
35489
+ display: "flex",
35490
+ flexDirection: "column",
35491
+ gap: spacing[3],
35492
+ fontSize: fontSize.sm,
35493
+ marginBottom: spacing[2]
35494
+ },
35495
+ children: [
35496
+ exchangeRate !== null && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35497
+ ReviewDetailRow,
35498
+ {
35499
+ label: "Rate",
35500
+ tooltip: "Current exchange rate between the two tokens",
35501
+ value: `1 ${fromToken?.symbol} = ${fmtAmount(1 / (exchangeRate ?? 1), 4)} ${toToken?.symbol} ($${fmtAmount(fromTokenPriceUSD, 2)})`
35502
+ }
35503
+ ),
35504
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35505
+ ReviewDetailRow,
35506
+ {
35507
+ label: "Fee",
35508
+ tooltip: "Protocol fee charged by the bridge or DEX",
35509
+ value: protocolFeeUsd !== null ? fmtLocal(protocolFeeUsd) : "Free"
35510
+ }
35511
+ ),
35512
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35513
+ ReviewDetailRow,
35514
+ {
35515
+ label: "Network cost",
35516
+ tooltip: "Estimated gas fee paid to the blockchain network",
35517
+ value: isGasSponsored ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(SponsoredBadge, {}) : networkCostUsd !== null ? /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35518
+ "span",
35519
+ {
35520
+ style: {
35521
+ display: "flex",
35522
+ alignItems: "center",
35523
+ gap: "0.25rem"
35524
+ },
35525
+ children: [
35526
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(GasIcon, { size: "0.875rem" }),
35527
+ fmtLocal(networkCostUsd)
35528
+ ]
35529
+ }
35530
+ ) : "\u2014"
35531
+ }
35532
+ ),
35533
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35534
+ ReviewDetailRow,
35535
+ {
35536
+ label: "Max slippage",
35537
+ tooltip: "Max price movement allowed before the swap automatically reverts",
35538
+ value: `${slippage}%`
35539
+ }
35540
+ ),
35541
+ (routePath || route.data?.route?.provider) && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35542
+ ReviewDetailRow,
35543
+ {
35544
+ label: "Route",
35545
+ tooltip: "Protocol or bridge used to execute your swap",
35546
+ value: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35547
+ "span",
35548
+ {
35549
+ style: {
35550
+ overflow: "hidden",
35551
+ textOverflow: "ellipsis",
35552
+ whiteSpace: "nowrap",
35553
+ maxWidth: "200px",
35554
+ display: "inline-block",
35555
+ verticalAlign: "bottom"
35556
+ },
35557
+ title: routePath ?? route.data?.route?.provider,
35558
+ children: routePath ?? route.data?.route?.provider
35559
+ }
35560
+ )
35561
+ }
35562
+ )
35563
+ ]
35564
+ }
35565
+ ),
35566
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35567
+ SwapActionArea,
35568
+ {
35569
+ fromTokenSymbol: fromToken?.symbol ?? "",
35570
+ allowanceStatus: execution.allowanceStatus,
35571
+ txStatus: execution.txStatus,
35572
+ isSubmitting: execution.isSubmitting,
35573
+ isGasSponsored,
35574
+ onExecute: () => void handleExecute()
35575
+ }
35576
+ )
35577
+ ]
35578
+ }
35579
+ ) });
34421
35580
  }
34422
35581
  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";
34423
35582
  const ctaDisabled = !hasTokens || !hasAmount || insufficient || isConnected && needsDestAddress && !isValidDestAddress;
34424
35583
  const ctaAction = !isConnected ? handleConnectAndReview : () => void handleReview();
34425
35584
  const showRateRow = hasTokens && exchangeRate !== null;
34426
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35585
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
34427
35586
  "div",
34428
35587
  {
34429
35588
  style: { display: "flex", flexDirection: "column", minHeight: "500px" },
@@ -34549,6 +35708,91 @@ function SwapMode({
34549
35708
  zIndex: 100
34550
35709
  },
34551
35710
  children: [
35711
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35712
+ "p",
35713
+ {
35714
+ style: {
35715
+ fontSize: fontSize.xs,
35716
+ fontWeight: fontWeight.semibold,
35717
+ color: colors.mutedForeground,
35718
+ textTransform: "uppercase",
35719
+ letterSpacing: "0.06em",
35720
+ marginBottom: spacing[3]
35721
+ },
35722
+ children: "Appearance"
35723
+ }
35724
+ ),
35725
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { style: { marginBottom: spacing[4] }, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35726
+ "div",
35727
+ {
35728
+ style: {
35729
+ display: "flex",
35730
+ alignItems: "center",
35731
+ justifyContent: "space-between"
35732
+ },
35733
+ children: [
35734
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { children: [
35735
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35736
+ "p",
35737
+ {
35738
+ style: {
35739
+ fontSize: fontSize.sm,
35740
+ fontWeight: fontWeight.medium,
35741
+ color: colors.foreground
35742
+ },
35743
+ children: "Dark mode"
35744
+ }
35745
+ ),
35746
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35747
+ "p",
35748
+ {
35749
+ style: {
35750
+ fontSize: "0.625rem",
35751
+ color: colors.mutedForeground,
35752
+ marginTop: "2px"
35753
+ },
35754
+ children: resolvedTheme === "dark" ? "Dark theme active" : "Light theme active"
35755
+ }
35756
+ )
35757
+ ] }),
35758
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35759
+ "button",
35760
+ {
35761
+ role: "switch",
35762
+ "aria-checked": resolvedTheme === "dark",
35763
+ onClick: toggleTheme,
35764
+ style: {
35765
+ width: "2.5rem",
35766
+ height: "1.375rem",
35767
+ borderRadius: "9999px",
35768
+ backgroundColor: resolvedTheme === "dark" ? colors.primary : colors.muted,
35769
+ border: 0,
35770
+ cursor: "pointer",
35771
+ position: "relative",
35772
+ transition: "background-color 0.2s",
35773
+ flexShrink: 0
35774
+ },
35775
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35776
+ "span",
35777
+ {
35778
+ style: {
35779
+ position: "absolute",
35780
+ top: "0.1875rem",
35781
+ left: resolvedTheme === "dark" ? "calc(100% - 1rem - 0.1875rem)" : "0.1875rem",
35782
+ width: "1rem",
35783
+ height: "1rem",
35784
+ borderRadius: "9999px",
35785
+ backgroundColor: colors.primaryForeground,
35786
+ transition: "left 0.2s",
35787
+ display: "block"
35788
+ }
35789
+ }
35790
+ )
35791
+ }
35792
+ )
35793
+ ]
35794
+ }
35795
+ ) }),
34552
35796
  /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
34553
35797
  "p",
34554
35798
  {
@@ -35403,7 +36647,8 @@ function SwapMode({
35403
36647
  fontSize: fontSize.base,
35404
36648
  fontWeight: fontWeight.semibold,
35405
36649
  border: 0,
35406
- transition: "all 0.2s"
36650
+ transition: "all 0.2s",
36651
+ marginBottom: spacing[3]
35407
36652
  },
35408
36653
  !ctaDisabled ? {
35409
36654
  backgroundColor: colors.primary,
@@ -35701,12 +36946,15 @@ function SwapActionArea({
35701
36946
  fontSize: fontSize.xs,
35702
36947
  color: colors.mutedForeground,
35703
36948
  textAlign: "center",
35704
- marginTop: spacing[2]
36949
+ marginTop: spacing[2],
36950
+ whiteSpace: "nowrap",
36951
+ overflow: "hidden",
36952
+ textOverflow: "ellipsis"
35705
36953
  },
35706
36954
  children: [
35707
- "You'll approve ",
36955
+ "Approve ",
35708
36956
  fromTokenSymbol,
35709
- " spend, then confirm the swap \u2014 2 wallet steps."
36957
+ " access, then confirm swap \u2014 2 steps."
35710
36958
  ]
35711
36959
  }
35712
36960
  )
@@ -35921,7 +37169,14 @@ function ReviewDetailRow({
35921
37169
  value,
35922
37170
  tooltip
35923
37171
  }) {
35924
- const [tipVisible, setTipVisible] = (0, import_react46.useState)(false);
37172
+ const iconRef = (0, import_react46.useRef)(null);
37173
+ const [tipPos, setTipPos] = (0, import_react46.useState)(null);
37174
+ const handleMouseEnter = () => {
37175
+ if (!tooltip || !iconRef.current) return;
37176
+ const r = iconRef.current.getBoundingClientRect();
37177
+ setTipPos({ x: r.left + r.width / 2, y: r.top - 8 });
37178
+ };
37179
+ const handleMouseLeave = () => setTipPos(null);
35925
37180
  return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35926
37181
  "div",
35927
37182
  {
@@ -35942,66 +37197,65 @@ function ReviewDetailRow({
35942
37197
  },
35943
37198
  children: [
35944
37199
  label,
35945
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
37200
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35946
37201
  "span",
35947
37202
  {
35948
- style: {
35949
- position: "relative",
35950
- display: "inline-flex",
35951
- alignItems: "center"
35952
- },
35953
- onMouseEnter: () => setTipVisible(true),
35954
- onMouseLeave: () => setTipVisible(false),
35955
- children: [
35956
- /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
35957
- "svg",
35958
- {
35959
- style: {
35960
- width: "0.875rem",
35961
- height: "0.875rem",
35962
- opacity: 0.6,
35963
- cursor: tooltip ? "help" : "default"
35964
- },
35965
- viewBox: "0 0 24 24",
35966
- fill: "none",
35967
- stroke: "currentColor",
35968
- strokeWidth: 2,
35969
- strokeLinecap: "round",
35970
- strokeLinejoin: "round",
35971
- children: [
35972
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
35973
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M12 16v-4M12 8h.01" })
35974
- ]
35975
- }
35976
- ),
35977
- tooltip && tipVisible && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
35978
- "span",
35979
- {
35980
- style: {
35981
- position: "absolute",
35982
- bottom: "calc(100% + 6px)",
35983
- left: "50%",
35984
- transform: "translateX(-50%)",
35985
- backgroundColor: "hsl(var(--tw-foreground))",
35986
- color: "hsl(var(--tw-background))",
35987
- fontSize: "0.6875rem",
35988
- lineHeight: 1.4,
35989
- padding: "0.25rem 0.5rem",
35990
- borderRadius: "0.375rem",
35991
- whiteSpace: "nowrap",
35992
- pointerEvents: "none",
35993
- zIndex: 50
35994
- },
35995
- children: tooltip
35996
- }
35997
- )
35998
- ]
37203
+ ref: iconRef,
37204
+ style: { display: "inline-flex", alignItems: "center" },
37205
+ onMouseEnter: handleMouseEnter,
37206
+ onMouseLeave: handleMouseLeave,
37207
+ children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
37208
+ "svg",
37209
+ {
37210
+ style: {
37211
+ width: "0.875rem",
37212
+ height: "0.875rem",
37213
+ opacity: 0.6,
37214
+ cursor: tooltip ? "help" : "default"
37215
+ },
37216
+ viewBox: "0 0 24 24",
37217
+ fill: "none",
37218
+ stroke: "currentColor",
37219
+ strokeWidth: 2,
37220
+ strokeLinecap: "round",
37221
+ strokeLinejoin: "round",
37222
+ children: [
37223
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
37224
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("path", { d: "M12 16v-4M12 8h.01" })
37225
+ ]
37226
+ }
37227
+ )
35999
37228
  }
36000
37229
  )
36001
37230
  ]
36002
37231
  }
36003
37232
  ),
36004
- /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: colors.mutedForeground }, children: value })
37233
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { style: { color: colors.foreground, fontWeight: fontWeight.medium }, children: value }),
37234
+ tooltip && tipPos && typeof document !== "undefined" && import_react_dom.default.createPortal(
37235
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
37236
+ "span",
37237
+ {
37238
+ style: {
37239
+ position: "fixed",
37240
+ left: tipPos.x,
37241
+ top: tipPos.y,
37242
+ transform: "translate(-50%, -100%)",
37243
+ backgroundColor: "hsl(220 15% 15%)",
37244
+ color: "#fff",
37245
+ fontSize: "0.6875rem",
37246
+ lineHeight: 1.4,
37247
+ padding: "0.3rem 0.6rem",
37248
+ borderRadius: "0.375rem",
37249
+ whiteSpace: "nowrap",
37250
+ pointerEvents: "none",
37251
+ zIndex: 99999,
37252
+ boxShadow: "0 4px 12px rgba(0,0,0,0.25)"
37253
+ },
37254
+ children: tooltip
37255
+ }
37256
+ ),
37257
+ document.body
37258
+ )
36005
37259
  ]
36006
37260
  }
36007
37261
  );
@@ -36195,15 +37449,17 @@ function ProcessingStepLine({ done }) {
36195
37449
  }
36196
37450
  );
36197
37451
  }
36198
- var import_react46, import_jsx_runtime56, ConfettiEffect3, QUOTE_TTL, PERCENT_OPTIONS;
37452
+ var import_react46, import_react_dom, import_jsx_runtime56, ConfettiEffect3, QUOTE_TTL, PERCENT_OPTIONS;
36199
37453
  var init_SwapMode = __esm({
36200
37454
  "src/modes/swap/SwapMode.tsx"() {
36201
37455
  "use strict";
36202
37456
  import_react46 = require("react");
37457
+ import_react_dom = __toESM(require("react-dom"), 1);
36203
37458
  init_styles();
36204
37459
  init_utils();
36205
37460
  init_components();
36206
37461
  init_registryClient();
37462
+ init_useThemePreference();
36207
37463
  init_useWalletSessionState();
36208
37464
  init_useWalletTokenState();
36209
37465
  init_hooks2();
@@ -36383,7 +37639,7 @@ var init_TrustwareWidgetV2 = __esm({
36383
37639
  zIndex: 12
36384
37640
  };
36385
37641
  TrustwareWidgetV2 = (0, import_react47.forwardRef)(function TrustwareWidgetV22({
36386
- theme = "system",
37642
+ theme,
36387
37643
  style,
36388
37644
  initialStep = "home",
36389
37645
  defaultOpen = true,
@@ -36463,24 +37719,10 @@ var init_wallets2 = __esm({
36463
37719
  });
36464
37720
 
36465
37721
  // src/types/theme.ts
36466
- var DEFAULT_THEME2, DEFAULT_MESSAGES2;
37722
+ var DEFAULT_MESSAGES2;
36467
37723
  var init_theme2 = __esm({
36468
37724
  "src/types/theme.ts"() {
36469
37725
  "use strict";
36470
- DEFAULT_THEME2 = {
36471
- primaryColor: "#4F46E5",
36472
- // Indigo-600
36473
- secondaryColor: "#6366F1",
36474
- // Indigo-500
36475
- backgroundColor: "#FFFFFF",
36476
- // White
36477
- textColor: "#111827",
36478
- // Gray-900
36479
- borderColor: "#E5E7EB",
36480
- // Gray-200
36481
- radius: 8
36482
- // 8px border radius
36483
- };
36484
37726
  DEFAULT_MESSAGES2 = {
36485
37727
  title: "Trustware SDK",
36486
37728
  description: "Seamlessly bridge assets across chains with Trustware."
@@ -36526,7 +37768,6 @@ __export(index_exports, {
36526
37768
  DEFAULT_MESSAGES: () => DEFAULT_MESSAGES2,
36527
37769
  DEFAULT_RETRY_CONFIG: () => DEFAULT_RETRY_CONFIG,
36528
37770
  DEFAULT_SLIPPAGE: () => DEFAULT_SLIPPAGE2,
36529
- DEFAULT_THEME: () => DEFAULT_THEME2,
36530
37771
  GTM_ID: () => GTM_ID,
36531
37772
  IdentityStore: () => IdentityStore,
36532
37773
  RateLimitError: () => RateLimitError,
@@ -36586,7 +37827,6 @@ init_index();
36586
37827
  DEFAULT_MESSAGES,
36587
37828
  DEFAULT_RETRY_CONFIG,
36588
37829
  DEFAULT_SLIPPAGE,
36589
- DEFAULT_THEME,
36590
37830
  GTM_ID,
36591
37831
  IdentityStore,
36592
37832
  RateLimitError,