@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/widget.mjs CHANGED
@@ -521,20 +521,12 @@ var init_styles = __esm({
521
521
  });
522
522
 
523
523
  // src/config/defaults.ts
524
- var DEFAULT_SLIPPAGE, DEFAULT_AUTO_DETECT_PROVIDER, DEFAULT_THEME, DEFAULT_MESSAGES;
524
+ var DEFAULT_SLIPPAGE, DEFAULT_AUTO_DETECT_PROVIDER, DEFAULT_MESSAGES;
525
525
  var init_defaults = __esm({
526
526
  "src/config/defaults.ts"() {
527
527
  "use strict";
528
528
  DEFAULT_SLIPPAGE = 1;
529
529
  DEFAULT_AUTO_DETECT_PROVIDER = false;
530
- DEFAULT_THEME = {
531
- primaryColor: "#4F46E5",
532
- secondaryColor: "#6366F1",
533
- backgroundColor: "#FFFFFF",
534
- textColor: "#111827",
535
- borderColor: "#E5E7EB",
536
- radius: 8
537
- };
538
530
  DEFAULT_MESSAGES = {
539
531
  title: "Trustware SDK",
540
532
  description: "Seamlessly bridge assets across chains with Trustware."
@@ -571,7 +563,7 @@ var init_constants = __esm({
571
563
  "src/constants.ts"() {
572
564
  "use strict";
573
565
  SDK_NAME = "@trustware/sdk";
574
- SDK_VERSION = "1.1.8-staging.6";
566
+ SDK_VERSION = "1.1.8-staging.7";
575
567
  API_ROOT = "https://bv-staging-api.trustware.io";
576
568
  GTM_ID = "GTM-TZDGNCXB";
577
569
  API_PREFIX = "/api";
@@ -2847,14 +2839,7 @@ function useTrustwareConfig() {
2847
2839
  options: {}
2848
2840
  },
2849
2841
  autoDetectProvider: false,
2850
- theme: {
2851
- primaryColor: "#4F46E5",
2852
- secondaryColor: "#6366F1",
2853
- backgroundColor: "#FFFFFF",
2854
- textColor: "#111827",
2855
- borderColor: "#E5E7EB",
2856
- radius: 8
2857
- },
2842
+ theme: "system",
2858
2843
  messages: {
2859
2844
  title: "Trustware SDK",
2860
2845
  description: "Seamlessly bridge assets across chains with Trustware."
@@ -3368,10 +3353,26 @@ function compareChainPopularity(a, b) {
3368
3353
  if (rankA === null && rankB !== null) return 1;
3369
3354
  return 0;
3370
3355
  }
3371
- function sortTokensByPopularity(tokens) {
3356
+ function sortTokensByPopularity(tokens, options) {
3357
+ const nativeSet = options?.nativeAddresses ?? /* @__PURE__ */ new Set();
3358
+ const nativeSymbolSet = options?.nativeSymbols ?? /* @__PURE__ */ new Set();
3359
+ const featuredMap = options?.featuredAddresses ?? /* @__PURE__ */ new Map();
3360
+ const getMajorRank = (token) => {
3361
+ const addr = normalizeAddress3(token.address);
3362
+ if (nativeSet.has(addr)) return 0;
3363
+ if (nativeSymbolSet.has(normalizeSymbol(token.symbol))) return 0;
3364
+ if (featuredMap.has(addr)) return 1;
3365
+ return getGroupRank(token) + 2;
3366
+ };
3372
3367
  return tokens.map((token, index) => ({ token, index })).sort((a, b) => {
3373
- const rankDiff = getGroupRank(a.token) - getGroupRank(b.token);
3374
- if (rankDiff !== 0) return rankDiff;
3368
+ const majorA = getMajorRank(a.token);
3369
+ const majorB = getMajorRank(b.token);
3370
+ if (majorA !== majorB) return majorA - majorB;
3371
+ if (majorA === 1) {
3372
+ const orderA = featuredMap.get(normalizeAddress3(a.token.address)) ?? 0;
3373
+ const orderB = featuredMap.get(normalizeAddress3(b.token.address)) ?? 0;
3374
+ return orderA - orderB;
3375
+ }
3375
3376
  const chainPopularityDiff = compareChainPopularity(a.token, b.token);
3376
3377
  if (chainPopularityDiff !== 0) return chainPopularityDiff;
3377
3378
  const symbolDiff = compareText(a.token.symbol, b.token.symbol);
@@ -3430,6 +3431,1004 @@ var init_tokenPopularity = __esm({
3430
3431
  }
3431
3432
  });
3432
3433
 
3434
+ // src/widget/data/featuredAssets.json
3435
+ var featuredAssets_default;
3436
+ var init_featuredAssets = __esm({
3437
+ "src/widget/data/featuredAssets.json"() {
3438
+ featuredAssets_default = {
3439
+ "1": {
3440
+ top: [
3441
+ {
3442
+ symbol: "AAVE",
3443
+ address: "0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9"
3444
+ },
3445
+ {
3446
+ symbol: "LINK",
3447
+ address: "0x514910771af9ca656af840dff83e8264ecf986ca"
3448
+ },
3449
+ {
3450
+ symbol: "UNI",
3451
+ address: "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984"
3452
+ },
3453
+ {
3454
+ symbol: "CRV",
3455
+ address: "0xd533a949740bb3306d119cc777fa900ba034cd52"
3456
+ },
3457
+ {
3458
+ symbol: "LDO",
3459
+ address: "0x5a98fcbea516cf06857215779fd812ca3bef1b32"
3460
+ },
3461
+ {
3462
+ symbol: "GRT",
3463
+ address: "0xc944e90c64b2c07662a292be6244bdf05cda44a7"
3464
+ },
3465
+ {
3466
+ symbol: "RENDER",
3467
+ address: "0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24"
3468
+ },
3469
+ {
3470
+ symbol: "PENDLE",
3471
+ address: "0x808507121b80c02388fad14726482e061b8da827"
3472
+ },
3473
+ {
3474
+ symbol: "MKR",
3475
+ address: "0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2"
3476
+ },
3477
+ {
3478
+ symbol: "COMP",
3479
+ address: "0xc00e94cb662c3520282e6f5717214004a7f26888"
3480
+ },
3481
+ {
3482
+ symbol: "1INCH",
3483
+ address: "0x111111111117dc0aa78b770fa6a738034120c302"
3484
+ },
3485
+ {
3486
+ symbol: "BAL",
3487
+ address: "0xba100000625a3754423978a60c9317c58a424e3d"
3488
+ },
3489
+ {
3490
+ symbol: "SUSHI",
3491
+ address: "0x6b3595068778dd592e39a122f4f5a5cf09c90fe2"
3492
+ },
3493
+ {
3494
+ symbol: "CAKE",
3495
+ address: "0x152649ea73beab28c5b49b26eb48f7ead6d4c898"
3496
+ },
3497
+ {
3498
+ symbol: "YFI",
3499
+ address: "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e"
3500
+ }
3501
+ ],
3502
+ stables: [
3503
+ {
3504
+ symbol: "USDT",
3505
+ address: "0xdac17f958d2ee523a2206206994597c13d831ec7"
3506
+ },
3507
+ {
3508
+ symbol: "USDC",
3509
+ address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"
3510
+ },
3511
+ {
3512
+ symbol: "DAI",
3513
+ address: "0x6b175474e89094c44da98b954eedeac495271d0f"
3514
+ },
3515
+ {
3516
+ symbol: "USDe",
3517
+ address: "0x4c9edd5852cd905f086c759e8383e09bff1e68b3"
3518
+ },
3519
+ {
3520
+ symbol: "PYUSD",
3521
+ address: "0x6c3ea9036406852006290770bedfcaba0e23a0e8"
3522
+ },
3523
+ {
3524
+ symbol: "FDUSD",
3525
+ address: "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409"
3526
+ },
3527
+ {
3528
+ symbol: "USDS",
3529
+ address: "0xdc035d45d973e3ec169d2276ddab16f1e407384f"
3530
+ },
3531
+ {
3532
+ symbol: "EURC",
3533
+ address: "0x1abaea1f7c830bd89acc67ec4af516284b1bc33c"
3534
+ },
3535
+ {
3536
+ symbol: "crvUSD",
3537
+ address: "0xf939e0a03fb07f59a73314e73794be0e57ac1b4e"
3538
+ },
3539
+ {
3540
+ symbol: "TUSD",
3541
+ address: "0x0000000000085d4780b73119b644ae5ecd22b376"
3542
+ }
3543
+ ]
3544
+ },
3545
+ "10": {
3546
+ top: [
3547
+ {
3548
+ symbol: "OP",
3549
+ address: "0x4200000000000000000000000000000000000042"
3550
+ },
3551
+ {
3552
+ symbol: "AAVE",
3553
+ address: "0x76fb31fb4af56892a25e32cfc43de717950c9278"
3554
+ },
3555
+ {
3556
+ symbol: "LINK",
3557
+ address: "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6"
3558
+ },
3559
+ {
3560
+ symbol: "CRV",
3561
+ address: "0x0994206dfe8de6ec6920ff4d779b0d950605fb53"
3562
+ },
3563
+ {
3564
+ symbol: "LDO",
3565
+ address: "0xfdb794692724153d1488ccdbe0c56c252596735f"
3566
+ },
3567
+ {
3568
+ symbol: "ZRO",
3569
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
3570
+ },
3571
+ {
3572
+ symbol: "STG",
3573
+ address: "0x296f55f8fb28e498b858d0bcda06d955b2cb3f97"
3574
+ }
3575
+ ],
3576
+ stables: [
3577
+ {
3578
+ symbol: "USDT",
3579
+ address: "0x94b008aa00579c1307b0ef2c499ad98a8ce58e58"
3580
+ },
3581
+ {
3582
+ symbol: "USDC",
3583
+ address: "0x0b2c639c533813f4aa9d7837caf62653d097ff85"
3584
+ },
3585
+ {
3586
+ symbol: "DAI",
3587
+ address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"
3588
+ },
3589
+ {
3590
+ symbol: "FRAX",
3591
+ address: "0x2e3d870790dc77a83dd1d18184acc7439a53f475"
3592
+ },
3593
+ {
3594
+ symbol: "LUSD",
3595
+ address: "0xc40f949f8a4e094d1b49a23ea9241d289b7b2819"
3596
+ },
3597
+ {
3598
+ symbol: "MIM",
3599
+ address: "0xb153fb3d196a8eb25522705560ac152eeec57901"
3600
+ },
3601
+ {
3602
+ symbol: "sUSD",
3603
+ address: "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9"
3604
+ }
3605
+ ]
3606
+ },
3607
+ "100": {
3608
+ top: [],
3609
+ stables: [
3610
+ {
3611
+ symbol: "USDT",
3612
+ address: "0x4ecaba5870353805a9f068101a40e0f32ed605c6"
3613
+ },
3614
+ {
3615
+ symbol: "USDC",
3616
+ address: "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83"
3617
+ }
3618
+ ]
3619
+ },
3620
+ "1284": {
3621
+ top: [
3622
+ {
3623
+ symbol: "WELL",
3624
+ address: "0x511ab53f793683763e5a8829738301368a2411e3"
3625
+ }
3626
+ ],
3627
+ stables: [
3628
+ {
3629
+ symbol: "xcUSDC",
3630
+ address: "0xffffffff7d2b0b761af01ca8e25242976ac0ad7d"
3631
+ },
3632
+ {
3633
+ symbol: "FRAX",
3634
+ address: "0x322e86852e492a7ee17f28a78c663da38fb33bfb"
3635
+ }
3636
+ ]
3637
+ },
3638
+ "13371": {
3639
+ top: [],
3640
+ stables: [
3641
+ {
3642
+ symbol: "USDT",
3643
+ address: "0x68bcc7f1190af20e7b572bcfb431c3ac10a936ab"
3644
+ },
3645
+ {
3646
+ symbol: "USDC",
3647
+ address: "0x6de8acc0d406837030ce4dd28e7c08c5a96a30d2"
3648
+ }
3649
+ ]
3650
+ },
3651
+ "137": {
3652
+ top: [
3653
+ {
3654
+ symbol: "AAVE",
3655
+ address: "0xd6df932a45c0f255f85145f286ea0b292b21c90b"
3656
+ },
3657
+ {
3658
+ symbol: "LINK",
3659
+ address: "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39"
3660
+ },
3661
+ {
3662
+ symbol: "UNI",
3663
+ address: "0xb33eaad8d922b1083446dc23f610c2567fb5180f"
3664
+ },
3665
+ {
3666
+ symbol: "CRV",
3667
+ address: "0x172370d5cd63279efa6d502dab29171933a610af"
3668
+ },
3669
+ {
3670
+ symbol: "LDO",
3671
+ address: "0xc3c7d422809852031b44ab29eec9f1eff2a58756"
3672
+ },
3673
+ {
3674
+ symbol: "GRT",
3675
+ address: "0x5fe2b58c013d7601147dcdd68c143a77499f5531"
3676
+ },
3677
+ {
3678
+ symbol: "RENDER",
3679
+ address: "0x61299774020da444af134c82fa83e3810b309991"
3680
+ },
3681
+ {
3682
+ symbol: "ZRO",
3683
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
3684
+ },
3685
+ {
3686
+ symbol: "STG",
3687
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
3688
+ },
3689
+ {
3690
+ symbol: "MANA",
3691
+ address: "0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4"
3692
+ },
3693
+ {
3694
+ symbol: "TEL",
3695
+ address: "0xdf7837de1f2fa4631d716cf2502f8b230f1dcc32"
3696
+ },
3697
+ {
3698
+ symbol: "BONK",
3699
+ address: "0xe5b49820e5a1063f6f4ddf851327b5e8b2301048"
3700
+ }
3701
+ ],
3702
+ stables: [
3703
+ {
3704
+ symbol: "USDT",
3705
+ address: "0xc2132d05d31c914a87c6611c10748aeb04b58e8f"
3706
+ },
3707
+ {
3708
+ symbol: "USDC",
3709
+ address: "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359"
3710
+ },
3711
+ {
3712
+ symbol: "DAI",
3713
+ address: "0x8f3cf7ad23cd3cadbd9735aff958023239c6a063"
3714
+ },
3715
+ {
3716
+ symbol: "CRVUSD",
3717
+ address: "0xc4ce1d6f5d98d65ee25cf85e9f2e9dcfee6cb5d6"
3718
+ }
3719
+ ]
3720
+ },
3721
+ "143": {
3722
+ top: [],
3723
+ stables: [
3724
+ {
3725
+ symbol: "USDC",
3726
+ address: "0x754704bc059f8c67012fed69bc8a327a5aafb603"
3727
+ }
3728
+ ]
3729
+ },
3730
+ "146": {
3731
+ top: [],
3732
+ stables: [
3733
+ {
3734
+ symbol: "USDT",
3735
+ address: "0x6047828dc181963ba44974801ff68e538da5eaf9"
3736
+ },
3737
+ {
3738
+ symbol: "USDC",
3739
+ address: "0x29219dd400f2bf60e5a23d13be72b486d4038894"
3740
+ }
3741
+ ]
3742
+ },
3743
+ "1868": {
3744
+ top: [],
3745
+ stables: [
3746
+ {
3747
+ symbol: "USDT",
3748
+ address: "0x3a337a6ada9d885b6ad95ec48f9b75f197b5ae35"
3749
+ }
3750
+ ]
3751
+ },
3752
+ "2222": {
3753
+ top: [],
3754
+ stables: [
3755
+ {
3756
+ symbol: "USDt",
3757
+ address: "0x919c1c267bc06a7039e03fcc2ef738525769109c"
3758
+ },
3759
+ {
3760
+ symbol: "MIM",
3761
+ address: "0x471ee749ba270eb4c1165b5ad95e614947f6fceb"
3762
+ }
3763
+ ]
3764
+ },
3765
+ "250": {
3766
+ top: [
3767
+ {
3768
+ symbol: "STG",
3769
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
3770
+ }
3771
+ ],
3772
+ stables: [
3773
+ {
3774
+ symbol: "MIM",
3775
+ address: "0x82f0b8b456c1a451378467398982d4834b6829c1"
3776
+ }
3777
+ ]
3778
+ },
3779
+ "252": {
3780
+ top: [
3781
+ {
3782
+ symbol: "CRV",
3783
+ address: "0x331b9182088e2a7d6d3fe4742aba1fb231aecc56"
3784
+ }
3785
+ ],
3786
+ stables: [
3787
+ {
3788
+ symbol: "frxUSD",
3789
+ address: "0xfc00000000000000000000000000000000000001"
3790
+ }
3791
+ ]
3792
+ },
3793
+ "295": {
3794
+ top: [],
3795
+ stables: [
3796
+ {
3797
+ symbol: "USDC",
3798
+ address: "0x000000000000000000000000000000000006f89a"
3799
+ }
3800
+ ]
3801
+ },
3802
+ "314": {
3803
+ top: [],
3804
+ stables: [
3805
+ {
3806
+ symbol: "ceUSDC",
3807
+ address: "0x2421db204968a367cc2c866cd057fa754cb84edf"
3808
+ }
3809
+ ]
3810
+ },
3811
+ "3338": {
3812
+ top: [],
3813
+ stables: [
3814
+ {
3815
+ symbol: "USDT",
3816
+ address: "0xf4d9235269a96aadafc9adae454a0618ebe37949"
3817
+ },
3818
+ {
3819
+ symbol: "USDC",
3820
+ address: "0xbba60da06c2c5424f03f7434542280fcad453d10"
3821
+ }
3822
+ ]
3823
+ },
3824
+ "42161": {
3825
+ top: [
3826
+ {
3827
+ symbol: "AAVE",
3828
+ address: "0xba5ddd1f9d7f570dc94a51479a000e3bce967196"
3829
+ },
3830
+ {
3831
+ symbol: "LINK",
3832
+ address: "0xf97f4df75117a78c1a5a0dbb814af92458539fb4"
3833
+ },
3834
+ {
3835
+ symbol: "UNI",
3836
+ address: "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0"
3837
+ },
3838
+ {
3839
+ symbol: "CRV",
3840
+ address: "0x11cdb42b0eb46d95f990bedd4695a6e3fa034978"
3841
+ },
3842
+ {
3843
+ symbol: "GRT",
3844
+ address: "0x9623063377ad1b27544c965ccd7342f7ea7e88c7"
3845
+ },
3846
+ {
3847
+ symbol: "PENDLE",
3848
+ address: "0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8"
3849
+ },
3850
+ {
3851
+ symbol: "SUSHI",
3852
+ address: "0xd4d42f0b6def4ce0383636770ef773390d85c61a"
3853
+ },
3854
+ {
3855
+ symbol: "CAKE",
3856
+ address: "0x1b896893dfc86bb67cf57767298b9073d2c1ba2c"
3857
+ },
3858
+ {
3859
+ symbol: "ZRO",
3860
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
3861
+ },
3862
+ {
3863
+ symbol: "STG",
3864
+ address: "0x6694340fc020c5e6b96567843da2df01b2ce1eb6"
3865
+ },
3866
+ {
3867
+ symbol: "ARB",
3868
+ address: "0x912ce59144191c1204e64559fe8253a0e49e6548"
3869
+ },
3870
+ {
3871
+ symbol: "cbBTC",
3872
+ address: "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf"
3873
+ },
3874
+ {
3875
+ symbol: "BONK",
3876
+ address: "0x09199d9a5f4448d0848e4395d065e1ad9c4a1f74"
3877
+ }
3878
+ ],
3879
+ stables: [
3880
+ {
3881
+ symbol: "USDT",
3882
+ address: "0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"
3883
+ },
3884
+ {
3885
+ symbol: "USDC",
3886
+ address: "0xaf88d065e77c8cc2239327c5edb3a432268e5831"
3887
+ },
3888
+ {
3889
+ symbol: "DAI",
3890
+ address: "0xda10009cbd5d07dd0cecc66161fc93d7c9000da1"
3891
+ },
3892
+ {
3893
+ symbol: "PYUSD",
3894
+ address: "0x46850ad61c2b7d64d08c9c754f45254596696984"
3895
+ },
3896
+ {
3897
+ symbol: "USDD",
3898
+ address: "0x680447595e8b7b3aa1b43beb9f6098c79ac2ab3f"
3899
+ },
3900
+ {
3901
+ symbol: "FRAX",
3902
+ address: "0x17fc002b466eec40dae837fc4be5c67993ddbd6f"
3903
+ },
3904
+ {
3905
+ symbol: "LUSD",
3906
+ address: "0x93b346b6bc2548da6a1e7d98e9a421b42541425b"
3907
+ },
3908
+ {
3909
+ symbol: "MIM",
3910
+ address: "0xfea7a6a0b346362bf88a9e4a88416b77a57d6c2a"
3911
+ }
3912
+ ]
3913
+ },
3914
+ "42220": {
3915
+ top: [],
3916
+ stables: [
3917
+ {
3918
+ symbol: "USDT",
3919
+ address: "0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e"
3920
+ },
3921
+ {
3922
+ symbol: "USDC",
3923
+ address: "0xceba9300f2b948710d2653dd7b07f33a8b32118c"
3924
+ }
3925
+ ]
3926
+ },
3927
+ "43114": {
3928
+ top: [
3929
+ {
3930
+ symbol: "PENDLE",
3931
+ address: "0xfb98b335551a418cd0737375a2ea0ded62ea213b"
3932
+ },
3933
+ {
3934
+ symbol: "ZRO",
3935
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
3936
+ },
3937
+ {
3938
+ symbol: "STG",
3939
+ address: "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590"
3940
+ }
3941
+ ],
3942
+ stables: [
3943
+ {
3944
+ symbol: "USDT",
3945
+ address: "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7"
3946
+ },
3947
+ {
3948
+ symbol: "USDC",
3949
+ address: "0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e"
3950
+ },
3951
+ {
3952
+ symbol: "EURC",
3953
+ address: "0xc891eb4cbdeff6e073e859e987815ed1505c2acd"
3954
+ },
3955
+ {
3956
+ symbol: "FRAX",
3957
+ address: "0xd24c2ad096400b6fbcd2ad8b24e7acbc21a1da64"
3958
+ },
3959
+ {
3960
+ symbol: "MIM",
3961
+ address: "0x130966628846bfd36ff31a822705796e8cb8c18d"
3962
+ }
3963
+ ]
3964
+ },
3965
+ "5000": {
3966
+ top: [],
3967
+ stables: [
3968
+ {
3969
+ symbol: "USDT",
3970
+ address: "0x201eba5cc46d216ce6dc03f6a759e8e766e956ae"
3971
+ },
3972
+ {
3973
+ symbol: "USDC",
3974
+ address: "0x09bc4e0d864854c6afb6eb9a9cdf58ac190d0df9"
3975
+ },
3976
+ {
3977
+ symbol: "mUSD",
3978
+ address: "0xab575258d37eaa5c8956efabe71f4ee8f6397cf3"
3979
+ }
3980
+ ]
3981
+ },
3982
+ "534352": {
3983
+ top: [],
3984
+ stables: [
3985
+ {
3986
+ symbol: "USDT",
3987
+ address: "0xf55bec9cafdbe8730f096aa55dad6d22d44099df"
3988
+ },
3989
+ {
3990
+ symbol: "USDC",
3991
+ address: "0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4"
3992
+ }
3993
+ ]
3994
+ },
3995
+ "56": {
3996
+ top: [
3997
+ {
3998
+ symbol: "AAVE",
3999
+ address: "0xfb6115445bff7b52feb98650c87f44907e58f802"
4000
+ },
4001
+ {
4002
+ symbol: "LINK",
4003
+ address: "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd"
4004
+ },
4005
+ {
4006
+ symbol: "UNI",
4007
+ address: "0xbf5140a22578168fd562dccf235e5d43a02ce9b1"
4008
+ },
4009
+ {
4010
+ symbol: "PENDLE",
4011
+ address: "0xb3ed0a426155b79b898849803e3b36552f7ed507"
4012
+ },
4013
+ {
4014
+ symbol: "COMP",
4015
+ address: "0x52ce071bd9b1c4b00a0b92d298c512478cad67e8"
4016
+ },
4017
+ {
4018
+ symbol: "CAKE",
4019
+ address: "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82"
4020
+ },
4021
+ {
4022
+ symbol: "ZRO",
4023
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
4024
+ },
4025
+ {
4026
+ symbol: "STG",
4027
+ address: "0xb0d502e938ed5f4df2e681fe6e419ff29631d62b"
4028
+ },
4029
+ {
4030
+ symbol: "AXS",
4031
+ address: "0x715d400f88c167884bbcc41c5fea407ed4d2f8a0"
4032
+ },
4033
+ {
4034
+ symbol: "BONK",
4035
+ address: "0xa697e272a73744b343528c3bc4702f2565b2f422"
4036
+ }
4037
+ ],
4038
+ stables: [
4039
+ {
4040
+ symbol: "USDT",
4041
+ address: "0x55d398326f99059ff775485246999027b3197955"
4042
+ },
4043
+ {
4044
+ symbol: "USDC",
4045
+ address: "0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d"
4046
+ },
4047
+ {
4048
+ symbol: "FDUSD",
4049
+ address: "0xc5f0f7b66764f6ec8c8dff7ba683102295e16409"
4050
+ },
4051
+ {
4052
+ symbol: "TUSD",
4053
+ address: "0x40af3827f39d0eacbf4a168f8d4ee67c121d11c9"
4054
+ }
4055
+ ]
4056
+ },
4057
+ "59144": {
4058
+ top: [
4059
+ {
4060
+ symbol: "Cake",
4061
+ address: "0x0d1e753a25ebda689453309112904807625befbe"
4062
+ }
4063
+ ],
4064
+ stables: [
4065
+ {
4066
+ symbol: "USDC",
4067
+ address: "0x176211869ca2b568f2a7d4ee941e073a821ee1ff"
4068
+ }
4069
+ ]
4070
+ },
4071
+ "80094": {
4072
+ top: [],
4073
+ stables: [
4074
+ {
4075
+ symbol: "MIM",
4076
+ address: "0x5b82028cfc477c4e7dda7ff33d59a23fa7be002a"
4077
+ }
4078
+ ]
4079
+ },
4080
+ "8453": {
4081
+ top: [
4082
+ {
4083
+ symbol: "AAVE",
4084
+ address: "0x63706e401c06ac8513145b7687a14804d17f814b"
4085
+ },
4086
+ {
4087
+ symbol: "PENDLE",
4088
+ address: "0xa99f6e6785da0f5d6fb42495fe424bce029eeb3e"
4089
+ },
4090
+ {
4091
+ symbol: "COMP",
4092
+ address: "0x9e1028f5f1d5ede59748ffcee5532509976840e0"
4093
+ },
4094
+ {
4095
+ symbol: "CAKE",
4096
+ address: "0x3055913c90fcc1a6ce9a358911721eeb942013a1"
4097
+ },
4098
+ {
4099
+ symbol: "YFI",
4100
+ address: "0x9eaf8c1e34f05a589eda6bafdf391cf6ad3cb239"
4101
+ },
4102
+ {
4103
+ symbol: "ZRO",
4104
+ address: "0x6985884c4392d348587b19cb9eaaf157f13271cd"
4105
+ },
4106
+ {
4107
+ symbol: "STG",
4108
+ address: "0xe3b53af74a4bf62ae5511055290838050bf764df"
4109
+ },
4110
+ {
4111
+ symbol: "cbBTC",
4112
+ address: "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf"
4113
+ },
4114
+ {
4115
+ symbol: "AERO",
4116
+ address: "0x940181a94a35a4569e4529a3cdfb74e38fd98631"
4117
+ },
4118
+ {
4119
+ symbol: "VIRTUAL",
4120
+ address: "0x0b3e328455c4059eeb9e3f84b5543f74e24e7e1b"
4121
+ },
4122
+ {
4123
+ symbol: "MORPHO",
4124
+ address: "0xbaa5cc21fd487b8fcc2f632f3f4e8d37262a0842"
4125
+ },
4126
+ {
4127
+ symbol: "BRETT",
4128
+ address: "0x532f27101965dd16442e59d40670faf5ebb142e4"
4129
+ },
4130
+ {
4131
+ symbol: "DEGEN",
4132
+ address: "0x4ed4e862860bed51a9570b96d89af5e1b0efefed"
4133
+ },
4134
+ {
4135
+ symbol: "WELL",
4136
+ address: "0xa88594d404727625a9437c3f886c7643872296ae"
4137
+ },
4138
+ {
4139
+ symbol: "ZORA",
4140
+ address: "0x1111111111166b7fe7bd91427724b487980afc69"
4141
+ }
4142
+ ],
4143
+ stables: [
4144
+ {
4145
+ symbol: "USDC",
4146
+ address: "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
4147
+ },
4148
+ {
4149
+ symbol: "DAI",
4150
+ address: "0x50c5725949a6f0c72e6c4a641f24049a917db0cb"
4151
+ },
4152
+ {
4153
+ symbol: "USDS",
4154
+ address: "0x820c137fa70c8691f0e44dc420a5e53c168921dc"
4155
+ },
4156
+ {
4157
+ symbol: "EURC",
4158
+ address: "0x60a3e35cc302bfa44cb288bc5a4f316fdb1adb42"
4159
+ }
4160
+ ]
4161
+ },
4162
+ "999": {
4163
+ top: [
4164
+ {
4165
+ symbol: "AXL",
4166
+ address: "0xc4dc717136b8fd754df181d122914c2866f11a79"
4167
+ }
4168
+ ],
4169
+ stables: [
4170
+ {
4171
+ symbol: "USDC",
4172
+ address: "0xb88339cb7199b77e23db6e890353e22632ba630f"
4173
+ }
4174
+ ]
4175
+ },
4176
+ "agoric-3": {
4177
+ top: [],
4178
+ stables: [
4179
+ {
4180
+ symbol: "USDC",
4181
+ address: "ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
4182
+ }
4183
+ ]
4184
+ },
4185
+ "archway-1": {
4186
+ top: [],
4187
+ stables: [
4188
+ {
4189
+ symbol: "USDC",
4190
+ address: "ibc/43897B9739BD63E3A08A88191999C632E052724AB96BD4C74AE31375C991F48D"
4191
+ }
4192
+ ]
4193
+ },
4194
+ "axelar-dojo-1": {
4195
+ top: [],
4196
+ stables: [
4197
+ {
4198
+ symbol: "USDe",
4199
+ address: "usde-wei"
4200
+ }
4201
+ ]
4202
+ },
4203
+ "core-1": {
4204
+ top: [],
4205
+ stables: [
4206
+ {
4207
+ symbol: "USDT",
4208
+ address: "ibc/C559977F5797BDC1D74C0836A10C379C991D664166CB60D776A83029852431B4"
4209
+ },
4210
+ {
4211
+ symbol: "USDC",
4212
+ address: "ibc/B3792E4A62DF4A934EF2DF5968556DB56F5776ED25BDE11188A4F58A7DD406F0"
4213
+ }
4214
+ ]
4215
+ },
4216
+ "cosmoshub-4": {
4217
+ top: [],
4218
+ stables: [
4219
+ {
4220
+ symbol: "USDC",
4221
+ address: "ibc/F663521BF1836B00F5F177680F74BFB9A8B5654A694D0D2BC249E03CF2509013"
4222
+ }
4223
+ ]
4224
+ },
4225
+ "crescent-1": {
4226
+ top: [
4227
+ {
4228
+ symbol: "AXL",
4229
+ address: "ibc/0634D0993744740D675AD01E81156EAC945AEAAE17C074918DC7FF52F41B263E"
4230
+ }
4231
+ ],
4232
+ stables: []
4233
+ },
4234
+ "dydx-mainnet-1": {
4235
+ top: [],
4236
+ stables: [
4237
+ {
4238
+ symbol: "USDC",
4239
+ address: "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5"
4240
+ }
4241
+ ]
4242
+ },
4243
+ "dymension_1100-1": {
4244
+ top: [],
4245
+ stables: [
4246
+ {
4247
+ symbol: "USDC",
4248
+ address: "ibc/B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4"
4249
+ }
4250
+ ]
4251
+ },
4252
+ "elys-1": {
4253
+ top: [
4254
+ {
4255
+ symbol: "LINK",
4256
+ address: "ibc/2A20C613F2BA256BE9FAD791B0743FBC4FE3C998EDF9234D969172F7D42FB8E7"
4257
+ }
4258
+ ],
4259
+ stables: [
4260
+ {
4261
+ symbol: "USDC",
4262
+ address: "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349"
4263
+ }
4264
+ ]
4265
+ },
4266
+ "juno-1": {
4267
+ top: [
4268
+ {
4269
+ symbol: "AXL",
4270
+ address: "ibc/EBE900AED8FF6BB2E186B17B066138F647CDD9647EF4FBE2DE6C8D4013A2C990"
4271
+ }
4272
+ ],
4273
+ stables: [
4274
+ {
4275
+ symbol: "USDC",
4276
+ address: "ibc/4A482FA914A4B9B05801ED81C33713899F322B24F76A06F4B8FE872485EA22FF"
4277
+ }
4278
+ ]
4279
+ },
4280
+ "kaiyo-1": {
4281
+ top: [
4282
+ {
4283
+ symbol: "AXL",
4284
+ address: "ibc/C01154C2547F4CB10A985EA78E7CD4BA891C1504360703A37E1D7043F06B5E1F"
4285
+ }
4286
+ ],
4287
+ stables: [
4288
+ {
4289
+ symbol: "USDC",
4290
+ address: "ibc/FE98AAD68F02F03565E9FA39A5E627946699B2B07115889ED812D8BA639576A9"
4291
+ }
4292
+ ]
4293
+ },
4294
+ "kava_2222-10": {
4295
+ top: [],
4296
+ stables: [
4297
+ {
4298
+ symbol: "USDT",
4299
+ address: "erc20/tether/usdt"
4300
+ }
4301
+ ]
4302
+ },
4303
+ "lava-mainnet-1": {
4304
+ top: [
4305
+ {
4306
+ symbol: "OPaxl",
4307
+ address: "ibc/8F54CE650A35D2B04630DD57F91D6552E7FCA9002DBF1CFBA1254675C194C8C8"
4308
+ }
4309
+ ],
4310
+ stables: []
4311
+ },
4312
+ "migaloo-1": {
4313
+ top: [],
4314
+ stables: [
4315
+ {
4316
+ symbol: "USDC",
4317
+ address: "ibc/BC5C0BAFD19A5E4133FDA0F3E04AE1FBEE75A4A226554B2CBB021089FF2E1F8A"
4318
+ }
4319
+ ]
4320
+ },
4321
+ "neutron-1": {
4322
+ top: [
4323
+ {
4324
+ symbol: "AXL",
4325
+ address: "ibc/C0E66D1C81D8AAF0E6896E05190FDFBC222367148F86AC3EA679C28327A763CD"
4326
+ }
4327
+ ],
4328
+ stables: [
4329
+ {
4330
+ symbol: "USDC",
4331
+ address: "ibc/B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81"
4332
+ }
4333
+ ]
4334
+ },
4335
+ "noble-1": {
4336
+ top: [],
4337
+ stables: [
4338
+ {
4339
+ symbol: "USDY",
4340
+ address: "ausdy"
4341
+ }
4342
+ ]
4343
+ },
4344
+ "osmosis-1": {
4345
+ top: [
4346
+ {
4347
+ symbol: "AXL",
4348
+ address: "ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E"
4349
+ }
4350
+ ],
4351
+ stables: [
4352
+ {
4353
+ symbol: "USDT",
4354
+ address: "ibc/4ABBEF4C8926DDDB320AE5188CFD63267ABBCEFC0583E4AE05D6E5AA2401DDAB"
4355
+ },
4356
+ {
4357
+ symbol: "USDC",
4358
+ address: "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4"
4359
+ },
4360
+ {
4361
+ symbol: "USDY",
4362
+ address: "ibc/23104D411A6EB6031FA92FB75F227422B84989969E91DCAD56A535DD7FF0A373"
4363
+ }
4364
+ ]
4365
+ },
4366
+ "phoenix-1": {
4367
+ top: [],
4368
+ stables: [
4369
+ {
4370
+ symbol: "USDC",
4371
+ address: "ibc/2C962DAB9F57FE0921435426AE75196009FAA1981BF86991203C8411F8980FDB"
4372
+ }
4373
+ ]
4374
+ },
4375
+ "ssc-1": {
4376
+ top: [
4377
+ {
4378
+ symbol: "UNI",
4379
+ address: "ibc/E4859520008F30CAB8A6548A390BC10C45F667A26A5A22D8891A79589DF57C41"
4380
+ }
4381
+ ],
4382
+ stables: [
4383
+ {
4384
+ symbol: "USDT",
4385
+ address: "ibc/B5F6DCC4FEF6BBBC356C67C46072AB3C01443FB5E3D19538C52A3CD439BE6BE3"
4386
+ },
4387
+ {
4388
+ symbol: "USDC",
4389
+ address: "ibc/37EF240838413BD7D3496183213F7F0F483EC7A330328F16AD901A1AC1450F72"
4390
+ },
4391
+ {
4392
+ symbol: "USDe",
4393
+ address: "ibc/23B8A6E4D4AD864A4DF7FBBC40818473691395EF9B6D8B8277037D536417768E"
4394
+ },
4395
+ {
4396
+ symbol: "USDY",
4397
+ address: "ibc/2115CC1B823DE5CC635692CB95E50E1C601A9B432703F7A611B4E492A914D968"
4398
+ }
4399
+ ]
4400
+ },
4401
+ "stargaze-1": {
4402
+ top: [],
4403
+ stables: [
4404
+ {
4405
+ symbol: "USDC",
4406
+ address: "ibc/4A1C18CA7F50544760CF306189B810CE4C1CB156C7FC870143D401FE7280E591"
4407
+ }
4408
+ ]
4409
+ },
4410
+ "umee-1": {
4411
+ top: [
4412
+ {
4413
+ symbol: "AXL",
4414
+ address: "ibc/D1CB2804AA5EB64D503F28E8DF3552F8A4D642802B66EFE50DE432B755F37AE1"
4415
+ }
4416
+ ],
4417
+ stables: []
4418
+ },
4419
+ "xion-mainnet-1": {
4420
+ top: [],
4421
+ stables: [
4422
+ {
4423
+ symbol: "USDC",
4424
+ address: "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349"
4425
+ }
4426
+ ]
4427
+ }
4428
+ };
4429
+ }
4430
+ });
4431
+
3433
4432
  // src/core/useTokens.ts
3434
4433
  import { useState as useState4, useEffect as useEffect4, useMemo as useMemo4 } from "react";
3435
4434
  function mapTokenDefToToken(tokenDef) {
@@ -3552,13 +4551,40 @@ function useTokens(chainId) {
3552
4551
  setIsLoadingMore(false);
3553
4552
  }
3554
4553
  };
4554
+ const featuredAddresses = useMemo4(() => {
4555
+ const key = chainId?.toString() ?? "";
4556
+ const chain = FEATURED[key];
4557
+ if (!chain) return /* @__PURE__ */ new Map();
4558
+ const map = /* @__PURE__ */ new Map();
4559
+ let order = 0;
4560
+ for (const s of chain.stables) map.set(s.address.toLowerCase(), order++);
4561
+ for (const t of chain.top) map.set(t.address.toLowerCase(), order++);
4562
+ return map;
4563
+ }, [chainId]);
4564
+ const nativeSymbols = useMemo4(() => {
4565
+ if (!chainId) return /* @__PURE__ */ new Set();
4566
+ const chain = chainMap.get(chainId.toString());
4567
+ const sym = chain?.nativeCurrency?.symbol;
4568
+ if (!sym) return /* @__PURE__ */ new Set();
4569
+ return /* @__PURE__ */ new Set([sym.toUpperCase()]);
4570
+ }, [chainId, chainMap]);
3555
4571
  const filteredTokens = useMemo4(() => {
3556
4572
  const query = searchQuery.toLowerCase().trim();
3557
4573
  const source = query.length === 0 || tokensPaginationEnabled ? tokens : tokens.filter(
3558
4574
  (token) => token.symbol.toLowerCase().includes(query) || token.name.toLowerCase().includes(query) || token.address.toLowerCase().includes(query)
3559
4575
  );
3560
- return sortTokensByPopularity(source);
3561
- }, [tokens, searchQuery, tokensPaginationEnabled]);
4576
+ return sortTokensByPopularity(source, {
4577
+ nativeAddresses: NATIVE_ADDRESSES,
4578
+ nativeSymbols,
4579
+ featuredAddresses
4580
+ });
4581
+ }, [
4582
+ tokens,
4583
+ searchQuery,
4584
+ tokensPaginationEnabled,
4585
+ nativeSymbols,
4586
+ featuredAddresses
4587
+ ]);
3562
4588
  return {
3563
4589
  tokens,
3564
4590
  filteredTokens,
@@ -3571,7 +4597,7 @@ function useTokens(chainId) {
3571
4597
  isLoadingMore
3572
4598
  };
3573
4599
  }
3574
- var DEFAULT_PAGE_LIMIT;
4600
+ var FEATURED, NATIVE_ADDRESSES, DEFAULT_PAGE_LIMIT;
3575
4601
  var init_useTokens = __esm({
3576
4602
  "src/core/useTokens.ts"() {
3577
4603
  "use strict";
@@ -3579,6 +4605,15 @@ var init_useTokens = __esm({
3579
4605
  init_useChains();
3580
4606
  init_tokenPopularity();
3581
4607
  init_store();
4608
+ init_chainHelpers();
4609
+ init_featuredAssets();
4610
+ FEATURED = featuredAssets_default;
4611
+ NATIVE_ADDRESSES = /* @__PURE__ */ new Set([
4612
+ NATIVE_EVM2.toLowerCase(),
4613
+ NATIVE_SOLANA2.toLowerCase(),
4614
+ // Some EVM chains (e.g. ZKsync, HyperEVM) use the zero address for the native token
4615
+ "0x0000000000000000000000000000000000000000"
4616
+ ]);
3582
4617
  DEFAULT_PAGE_LIMIT = 100;
3583
4618
  }
3584
4619
  });
@@ -7044,7 +8079,7 @@ function resolveConfig(input) {
7044
8079
  ...input.routes.options
7045
8080
  }
7046
8081
  };
7047
- const theme = deepMerge(DEFAULT_THEME, input.theme);
8082
+ const theme = input.theme ?? "system";
7048
8083
  const messages = deepMerge(DEFAULT_MESSAGES, input.messages);
7049
8084
  const retry = {
7050
8085
  autoRetry: input.retry?.autoRetry ?? DEFAULT_RETRY_CONFIG.autoRetry,
@@ -7122,10 +8157,7 @@ var init_store = __esm({
7122
8157
  ...this._cfg,
7123
8158
  ...patch,
7124
8159
  routes: { ...this._cfg.routes, ...patch.routes ?? {} },
7125
- theme: {
7126
- ...this._cfg.theme,
7127
- ...patch.theme ?? {}
7128
- },
8160
+ theme: patch.theme ?? this._cfg.theme,
7129
8161
  messages: {
7130
8162
  ...this._cfg.messages,
7131
8163
  ...patch.messages ?? {}
@@ -7530,29 +8562,39 @@ var init_useDepositNavigationState = __esm({
7530
8562
  });
7531
8563
 
7532
8564
  // src/widget/state/deposit/useThemePreference.ts
7533
- import { useCallback as useCallback8, useState as useState11 } from "react";
7534
- import { useEffect as useEffect11 } from "react";
7535
- function getInitialTheme() {
7536
- if (typeof window === "undefined") {
7537
- return "light";
7538
- }
8565
+ import { useCallback as useCallback8, useEffect as useEffect11, useState as useState11 } from "react";
8566
+ function resolveConfigTheme(configTheme) {
8567
+ if (typeof window === "undefined") return "light";
8568
+ if (configTheme !== "system") return configTheme;
7539
8569
  try {
7540
8570
  const stored = localStorage.getItem(THEME_STORAGE_KEY);
7541
- if (stored === "light" || stored === "dark") {
7542
- return stored;
7543
- }
8571
+ if (stored === "light" || stored === "dark") return stored;
7544
8572
  } catch {
7545
8573
  }
7546
- if (typeof window !== "undefined" && window.matchMedia) {
7547
- return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
7548
- }
7549
- return "light";
8574
+ return window.matchMedia?.("(prefers-color-scheme: dark)").matches ? "dark" : "light";
7550
8575
  }
7551
- function useThemePreference() {
7552
- const [resolvedTheme, setResolvedTheme] = useState11("light");
8576
+ function useThemePreference(configTheme = "system") {
8577
+ const [resolvedTheme, setResolvedTheme] = useState11(
8578
+ () => resolveConfigTheme(configTheme)
8579
+ );
7553
8580
  useEffect11(() => {
7554
- setResolvedTheme(getInitialTheme());
7555
- }, []);
8581
+ setResolvedTheme(resolveConfigTheme(configTheme));
8582
+ }, [configTheme]);
8583
+ useEffect11(() => {
8584
+ if (configTheme !== "system") return;
8585
+ if (typeof window === "undefined" || !window.matchMedia) return;
8586
+ try {
8587
+ const stored = localStorage.getItem(THEME_STORAGE_KEY);
8588
+ if (stored === "light" || stored === "dark") return;
8589
+ } catch {
8590
+ }
8591
+ const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
8592
+ const handler = (e2) => {
8593
+ setResolvedTheme(e2.matches ? "dark" : "light");
8594
+ };
8595
+ mediaQuery.addEventListener("change", handler);
8596
+ return () => mediaQuery.removeEventListener("change", handler);
8597
+ }, [configTheme]);
7556
8598
  const toggleTheme = useCallback8(() => {
7557
8599
  setResolvedTheme((current) => {
7558
8600
  const nextTheme = current === "light" ? "dark" : "light";
@@ -7698,7 +8740,8 @@ function DepositProvider({
7698
8740
  resetNavigation,
7699
8741
  setCurrentStepInternal
7700
8742
  } = useDepositNavigationState(initialStep);
7701
- const { resolvedTheme, toggleTheme } = useThemePreference();
8743
+ const config = useTrustwareConfig();
8744
+ const { resolvedTheme, toggleTheme } = useThemePreference(config.theme);
7702
8745
  const {
7703
8746
  selectedWallet,
7704
8747
  walletAddress: otherWalletAddress,
@@ -7897,6 +8940,7 @@ var init_DepositContext = __esm({
7897
8940
  init_useWalletTokenState();
7898
8941
  init_useWalletConnect();
7899
8942
  init_wallets();
8943
+ init_useTrustwareConfig();
7900
8944
  DepositContext = createContext2(
7901
8945
  void 0
7902
8946
  );
@@ -11568,6 +12612,7 @@ var init_AvailableTokenListItem = __esm({
11568
12612
  });
11569
12613
 
11570
12614
  // src/widget/features/token-selection/components/ChainSelectorPanel.tsx
12615
+ import { useState as useState21, useMemo as useMemo12 } from "react";
11571
12616
  import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
11572
12617
  function ChainItem({
11573
12618
  chain,
@@ -11605,8 +12650,8 @@ function ChainItem({
11605
12650
  src: chain.chainIconURI,
11606
12651
  alt: label,
11607
12652
  style: {
11608
- width: "2rem",
11609
- height: "2rem",
12653
+ width: "1.5rem",
12654
+ height: "1.5rem",
11610
12655
  borderRadius: "9999px",
11611
12656
  objectFit: "cover",
11612
12657
  flexShrink: 0
@@ -11616,8 +12661,8 @@ function ChainItem({
11616
12661
  "div",
11617
12662
  {
11618
12663
  style: {
11619
- width: "2rem",
11620
- height: "2rem",
12664
+ width: "1.5rem",
12665
+ height: "1.5rem",
11621
12666
  borderRadius: "9999px",
11622
12667
  backgroundColor: colors.muted,
11623
12668
  display: "flex",
@@ -11695,6 +12740,81 @@ function ChainItem({
11695
12740
  String(key)
11696
12741
  );
11697
12742
  }
12743
+ function SectionLabel({
12744
+ children,
12745
+ icon
12746
+ }) {
12747
+ return /* @__PURE__ */ jsxs18(
12748
+ "div",
12749
+ {
12750
+ style: {
12751
+ display: "flex",
12752
+ alignItems: "center",
12753
+ gap: "0.25rem",
12754
+ padding: `${spacing[1.5]} ${spacing[3]}`,
12755
+ marginTop: spacing[2]
12756
+ },
12757
+ children: [
12758
+ icon === "spark" ? /* @__PURE__ */ jsx21(
12759
+ "svg",
12760
+ {
12761
+ style: {
12762
+ width: "0.75rem",
12763
+ height: "0.75rem",
12764
+ color: colors.primary,
12765
+ flexShrink: 0
12766
+ },
12767
+ viewBox: "0 0 24 24",
12768
+ fill: "none",
12769
+ stroke: "currentColor",
12770
+ strokeWidth: 2,
12771
+ children: /* @__PURE__ */ jsx21(
12772
+ "path",
12773
+ {
12774
+ strokeLinecap: "round",
12775
+ strokeLinejoin: "round",
12776
+ 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"
12777
+ }
12778
+ )
12779
+ }
12780
+ ) : /* @__PURE__ */ jsx21(
12781
+ "svg",
12782
+ {
12783
+ style: {
12784
+ width: "0.75rem",
12785
+ height: "0.75rem",
12786
+ color: colors.primary,
12787
+ flexShrink: 0
12788
+ },
12789
+ viewBox: "0 0 24 24",
12790
+ fill: "none",
12791
+ stroke: "currentColor",
12792
+ strokeWidth: 2,
12793
+ children: /* @__PURE__ */ jsx21(
12794
+ "path",
12795
+ {
12796
+ strokeLinecap: "round",
12797
+ strokeLinejoin: "round",
12798
+ d: "M3 7.5 7.5 3m0 0L12 7.5M7.5 3v13.5m13.5 0L16.5 21m0 0L12 16.5m4.5 4.5V7.5"
12799
+ }
12800
+ )
12801
+ }
12802
+ ),
12803
+ /* @__PURE__ */ jsx21(
12804
+ "span",
12805
+ {
12806
+ style: {
12807
+ fontSize: "10px",
12808
+ fontWeight: fontWeight.medium,
12809
+ color: colors.primary
12810
+ },
12811
+ children
12812
+ }
12813
+ )
12814
+ ]
12815
+ }
12816
+ );
12817
+ }
11698
12818
  function ChainSelectorPanel({
11699
12819
  error,
11700
12820
  isChainSelected,
@@ -11703,6 +12823,21 @@ function ChainSelectorPanel({
11703
12823
  otherChains,
11704
12824
  popularChains
11705
12825
  }) {
12826
+ const [chainSearch, setChainSearch] = useState21("");
12827
+ const filteredPopular = useMemo12(() => {
12828
+ if (!chainSearch) return popularChains;
12829
+ const q = chainSearch.toLowerCase();
12830
+ return popularChains.filter(
12831
+ (c) => resolveChainLabel(c).toLowerCase().includes(q)
12832
+ );
12833
+ }, [popularChains, chainSearch]);
12834
+ const filteredOther = useMemo12(() => {
12835
+ if (!chainSearch) return otherChains;
12836
+ const q = chainSearch.toLowerCase();
12837
+ return otherChains.filter(
12838
+ (c) => resolveChainLabel(c).toLowerCase().includes(q)
12839
+ );
12840
+ }, [otherChains, chainSearch]);
11706
12841
  return /* @__PURE__ */ jsxs18(
11707
12842
  "div",
11708
12843
  {
@@ -11718,22 +12853,58 @@ function ChainSelectorPanel({
11718
12853
  "div",
11719
12854
  {
11720
12855
  style: {
11721
- padding: `${spacing[2]} ${spacing[3]}`,
11722
- borderBottom: `1px solid rgba(63, 63, 70, 0.5)`
12856
+ padding: `${spacing[2]} ${spacing[2]}`,
12857
+ borderBottom: `1px solid ${colors.border}`
11723
12858
  },
11724
- children: /* @__PURE__ */ jsx21(
11725
- "span",
11726
- {
11727
- style: {
11728
- fontSize: fontSize.xs,
11729
- fontWeight: fontWeight.medium,
11730
- color: colors.mutedForeground,
11731
- textTransform: "uppercase",
11732
- letterSpacing: "0.05em"
11733
- },
11734
- children: "Chain"
11735
- }
11736
- )
12859
+ children: /* @__PURE__ */ jsxs18("div", { style: { position: "relative" }, children: [
12860
+ /* @__PURE__ */ jsxs18(
12861
+ "svg",
12862
+ {
12863
+ style: {
12864
+ position: "absolute",
12865
+ left: spacing[2.5],
12866
+ top: "50%",
12867
+ transform: "translateY(-50%)",
12868
+ width: "1rem",
12869
+ height: "1rem",
12870
+ color: colors.mutedForeground,
12871
+ pointerEvents: "none"
12872
+ },
12873
+ viewBox: "0 0 24 24",
12874
+ fill: "none",
12875
+ stroke: "currentColor",
12876
+ strokeWidth: 2,
12877
+ children: [
12878
+ /* @__PURE__ */ jsx21("circle", { cx: "11", cy: "11", r: "8" }),
12879
+ /* @__PURE__ */ jsx21("path", { strokeLinecap: "round", d: "m21 21-4.35-4.35" })
12880
+ ]
12881
+ }
12882
+ ),
12883
+ /* @__PURE__ */ jsx21(
12884
+ "input",
12885
+ {
12886
+ type: "text",
12887
+ placeholder: "Chain",
12888
+ value: chainSearch,
12889
+ onChange: (e2) => setChainSearch(e2.target.value),
12890
+ style: {
12891
+ width: "100%",
12892
+ boxSizing: "border-box",
12893
+ paddingLeft: spacing[8],
12894
+ paddingRight: spacing[3],
12895
+ paddingTop: spacing[2],
12896
+ paddingBottom: spacing[2],
12897
+ fontSize: fontSize.sm,
12898
+ backgroundColor: colors.muted,
12899
+ border: `1px solid ${colors.border}`,
12900
+ borderRadius: borderRadius.lg,
12901
+ color: colors.foreground,
12902
+ outline: "none",
12903
+ transition: "all 0.2s"
12904
+ }
12905
+ }
12906
+ )
12907
+ ] })
11737
12908
  }
11738
12909
  ),
11739
12910
  /* @__PURE__ */ jsx21(
@@ -11821,21 +12992,9 @@ function ChainSelectorPanel({
11821
12992
  ]
11822
12993
  }
11823
12994
  ) : /* @__PURE__ */ jsxs18(Fragment3, { children: [
11824
- popularChains.length > 0 && /* @__PURE__ */ jsxs18("div", { style: { marginBottom: spacing[2] }, children: [
11825
- /* @__PURE__ */ jsx21("div", { style: { padding: `${spacing[1.5]} ${spacing[3]}` }, children: /* @__PURE__ */ jsx21(
11826
- "span",
11827
- {
11828
- style: {
11829
- fontSize: "10px",
11830
- fontWeight: fontWeight.medium,
11831
- color: "rgba(161, 161, 170, 0.7)",
11832
- textTransform: "uppercase",
11833
- letterSpacing: "0.05em"
11834
- },
11835
- children: "Popular"
11836
- }
11837
- ) }),
11838
- popularChains.map((chain, idx) => /* @__PURE__ */ jsx21(
12995
+ filteredPopular.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
12996
+ /* @__PURE__ */ jsx21(SectionLabel, { icon: "spark", children: "Popular chains" }),
12997
+ filteredPopular.map((chain, idx) => /* @__PURE__ */ jsx21(
11839
12998
  ChainItem,
11840
12999
  {
11841
13000
  chain,
@@ -11848,30 +13007,9 @@ function ChainSelectorPanel({
11848
13007
  )
11849
13008
  ))
11850
13009
  ] }),
11851
- otherChains.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
11852
- popularChains.length > 0 && /* @__PURE__ */ jsx21(
11853
- "div",
11854
- {
11855
- style: {
11856
- padding: `${spacing[1.5]} ${spacing[3]}`,
11857
- marginTop: spacing[2]
11858
- },
11859
- children: /* @__PURE__ */ jsx21(
11860
- "span",
11861
- {
11862
- style: {
11863
- fontSize: "10px",
11864
- fontWeight: fontWeight.medium,
11865
- color: "rgba(161, 161, 170, 0.7)",
11866
- textTransform: "uppercase",
11867
- letterSpacing: "0.05em"
11868
- },
11869
- children: "All Chains"
11870
- }
11871
- )
11872
- }
11873
- ),
11874
- otherChains.map((chain, idx) => /* @__PURE__ */ jsx21(
13010
+ filteredOther.length > 0 && /* @__PURE__ */ jsxs18("div", { children: [
13011
+ /* @__PURE__ */ jsx21(SectionLabel, { icon: "sort", children: "Chains A-Z" }),
13012
+ filteredOther.map((chain, idx) => /* @__PURE__ */ jsx21(
11875
13013
  ChainItem,
11876
13014
  {
11877
13015
  chain,
@@ -11884,21 +13022,21 @@ function ChainSelectorPanel({
11884
13022
  )
11885
13023
  ))
11886
13024
  ] }),
11887
- popularChains.length === 0 && otherChains.length === 0 && /* @__PURE__ */ jsx21(
13025
+ filteredPopular.length === 0 && filteredOther.length === 0 && /* @__PURE__ */ jsx21(
11888
13026
  "div",
11889
13027
  {
11890
13028
  style: {
11891
- padding: `${spacing[3]} ${spacing[4]}`,
13029
+ padding: `${spacing[3]} ${spacing[2]}`,
11892
13030
  textAlign: "center"
11893
13031
  },
11894
13032
  children: /* @__PURE__ */ jsx21(
11895
13033
  "p",
11896
13034
  {
11897
13035
  style: {
11898
- fontSize: fontSize.sm,
13036
+ fontSize: fontSize.xs,
11899
13037
  color: colors.mutedForeground
11900
13038
  },
11901
- children: "No chains available"
13039
+ children: "No chains found"
11902
13040
  }
11903
13041
  )
11904
13042
  }
@@ -11969,8 +13107,8 @@ function TokenSearchInput({
11969
13107
  paddingTop: spacing[2],
11970
13108
  paddingBottom: spacing[2],
11971
13109
  fontSize: fontSize.sm,
11972
- backgroundColor: "rgba(63, 63, 70, 0.5)",
11973
- border: `1px solid rgba(63, 63, 70, 0.5)`,
13110
+ backgroundColor: colors.muted,
13111
+ border: `1px solid ${colors.border}`,
11974
13112
  borderRadius: borderRadius.lg,
11975
13113
  color: colors.foreground,
11976
13114
  outline: "none",
@@ -12442,7 +13580,87 @@ var init_WalletTokenListItem = __esm({
12442
13580
  });
12443
13581
 
12444
13582
  // src/widget/features/token-selection/components/TokenSelectorPanel.tsx
12445
- import { jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
13583
+ import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs22 } from "react/jsx-runtime";
13584
+ function TokenSectionLabel({
13585
+ children,
13586
+ icon
13587
+ }) {
13588
+ return /* @__PURE__ */ jsxs22(
13589
+ "div",
13590
+ {
13591
+ style: {
13592
+ display: "flex",
13593
+ alignItems: "center",
13594
+ gap: "0.375rem",
13595
+ paddingLeft: spacing[3],
13596
+ paddingRight: spacing[3],
13597
+ paddingTop: spacing[1],
13598
+ paddingBottom: spacing[1],
13599
+ marginTop: spacing[1],
13600
+ marginBottom: spacing[1]
13601
+ },
13602
+ children: [
13603
+ icon === "wallet" ? /* @__PURE__ */ jsx25(
13604
+ "svg",
13605
+ {
13606
+ style: {
13607
+ width: "0.75rem",
13608
+ height: "0.75rem",
13609
+ color: colors.primary,
13610
+ flexShrink: 0
13611
+ },
13612
+ viewBox: "0 0 24 24",
13613
+ fill: "none",
13614
+ stroke: "currentColor",
13615
+ strokeWidth: 2,
13616
+ children: /* @__PURE__ */ jsx25(
13617
+ "path",
13618
+ {
13619
+ strokeLinecap: "round",
13620
+ strokeLinejoin: "round",
13621
+ 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"
13622
+ }
13623
+ )
13624
+ }
13625
+ ) : /* @__PURE__ */ jsx25(
13626
+ "svg",
13627
+ {
13628
+ style: {
13629
+ width: "0.75rem",
13630
+ height: "0.75rem",
13631
+ color: colors.primary,
13632
+ flexShrink: 0
13633
+ },
13634
+ viewBox: "0 0 24 24",
13635
+ fill: "none",
13636
+ stroke: "currentColor",
13637
+ strokeWidth: 2,
13638
+ children: /* @__PURE__ */ jsx25(
13639
+ "path",
13640
+ {
13641
+ strokeLinecap: "round",
13642
+ strokeLinejoin: "round",
13643
+ 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"
13644
+ }
13645
+ )
13646
+ }
13647
+ ),
13648
+ /* @__PURE__ */ jsx25(
13649
+ "span",
13650
+ {
13651
+ style: {
13652
+ fontSize: "0.75rem",
13653
+ lineHeight: "1rem",
13654
+ fontWeight: fontWeight.medium,
13655
+ color: colors.primary
13656
+ },
13657
+ children
13658
+ }
13659
+ )
13660
+ ]
13661
+ }
13662
+ );
13663
+ }
12446
13664
  function TokenSelectorPanel({
12447
13665
  filteredTokens,
12448
13666
  filteredWalletTokens,
@@ -12455,9 +13673,10 @@ function TokenSelectorPanel({
12455
13673
  searchQuery,
12456
13674
  selectedChain,
12457
13675
  setSearchQuery,
12458
- tokensError,
12459
- walletAddress
13676
+ tokensError
12460
13677
  }) {
13678
+ const hasWalletTokens = filteredWalletTokens.length > 0;
13679
+ const hasPopularTokens = filteredTokens.length > 0;
12461
13680
  return /* @__PURE__ */ jsxs22(
12462
13681
  "div",
12463
13682
  {
@@ -12468,61 +13687,20 @@ function TokenSelectorPanel({
12468
13687
  overflow: "hidden"
12469
13688
  },
12470
13689
  children: [
12471
- /* @__PURE__ */ jsxs22(
13690
+ /* @__PURE__ */ jsx25(
12472
13691
  "div",
12473
13692
  {
12474
13693
  style: {
12475
- padding: `${spacing[2]} ${spacing[3]}`,
12476
- borderBottom: `1px solid rgba(63, 63, 70, 0.5)`
13694
+ padding: `${spacing[2]} ${spacing[2]}`,
13695
+ borderBottom: `1px solid ${colors.border}`
12477
13696
  },
12478
- children: [
12479
- /* @__PURE__ */ jsxs22(
12480
- "div",
12481
- {
12482
- style: {
12483
- display: "flex",
12484
- alignItems: "center",
12485
- gap: spacing[2],
12486
- marginBottom: spacing[2]
12487
- },
12488
- children: [
12489
- /* @__PURE__ */ jsx25(
12490
- "span",
12491
- {
12492
- style: {
12493
- fontSize: fontSize.xs,
12494
- fontWeight: fontWeight.medium,
12495
- color: colors.mutedForeground,
12496
- textTransform: "uppercase",
12497
- letterSpacing: "0.05em"
12498
- },
12499
- children: "Token"
12500
- }
12501
- ),
12502
- walletAddress && /* @__PURE__ */ jsx25(
12503
- "span",
12504
- {
12505
- style: {
12506
- fontSize: "10px",
12507
- color: colors.primary,
12508
- backgroundColor: "rgba(59, 130, 246, 0.1)",
12509
- padding: `${spacing[0.5]} ${spacing[1.5]}`,
12510
- borderRadius: borderRadius.md
12511
- },
12512
- children: "Wallet Connected"
12513
- }
12514
- )
12515
- ]
12516
- }
12517
- ),
12518
- selectedChain ? /* @__PURE__ */ jsx25(
12519
- TokenSearchInput,
12520
- {
12521
- searchQuery,
12522
- setSearchQuery
12523
- }
12524
- ) : null
12525
- ]
13697
+ children: /* @__PURE__ */ jsx25(
13698
+ TokenSearchInput,
13699
+ {
13700
+ searchQuery,
13701
+ setSearchQuery
13702
+ }
13703
+ )
12526
13704
  }
12527
13705
  ),
12528
13706
  /* @__PURE__ */ jsx25(
@@ -12531,115 +13709,99 @@ function TokenSelectorPanel({
12531
13709
  style: {
12532
13710
  flex: 1,
12533
13711
  overflowY: "auto",
12534
- padding: `${spacing[2]} ${spacing[1]}`
13712
+ padding: `${spacing[1]} ${spacing[1]}`
12535
13713
  },
12536
- children: !selectedChain || isLoadingTokens || tokensError || filteredTokens.length === 0 ? /* @__PURE__ */ jsx25(
13714
+ children: !selectedChain ? /* @__PURE__ */ jsx25(
12537
13715
  TokenSelectorStateView,
12538
13716
  {
12539
13717
  isLoadingTokens,
12540
13718
  searchQuery,
12541
13719
  setSearchQuery,
12542
- state: !selectedChain ? "no-chain" : tokensError ? "error" : "empty",
12543
- tokensError
13720
+ state: "no-chain",
13721
+ tokensError: null
12544
13722
  }
12545
- ) : /* @__PURE__ */ jsxs22(
12546
- "div",
13723
+ ) : isLoadingTokens && !hasWalletTokens ? /* @__PURE__ */ jsx25(
13724
+ TokenSelectorStateView,
12547
13725
  {
12548
- style: {
12549
- display: "flex",
12550
- flexDirection: "column",
12551
- gap: spacing[0.5]
12552
- },
12553
- children: [
12554
- filteredWalletTokens.length > 0 ? /* @__PURE__ */ jsx25(
12555
- "div",
12556
- {
12557
- style: {
12558
- display: "flex",
12559
- alignItems: "center",
12560
- gap: "0.375rem",
12561
- paddingLeft: "0.5rem",
12562
- paddingRight: "0.5rem",
12563
- marginBottom: spacing[2]
12564
- },
12565
- children: /* @__PURE__ */ jsx25(
12566
- "span",
12567
- {
12568
- style: {
12569
- fontSize: "0.75rem",
12570
- lineHeight: "1rem",
12571
- color: colors.primary
12572
- },
12573
- children: "Your tokens"
12574
- }
12575
- )
12576
- }
12577
- ) : null,
12578
- filteredWalletTokens.map((token, i) => /* @__PURE__ */ jsx25(
12579
- WalletTokenListItem,
12580
- {
12581
- token,
12582
- onSelect: onSelectWalletToken
13726
+ isLoadingTokens: true,
13727
+ searchQuery,
13728
+ setSearchQuery,
13729
+ state: "empty",
13730
+ tokensError: null
13731
+ }
13732
+ ) : tokensError && !hasWalletTokens ? /* @__PURE__ */ jsx25(
13733
+ TokenSelectorStateView,
13734
+ {
13735
+ isLoadingTokens: false,
13736
+ searchQuery,
13737
+ setSearchQuery,
13738
+ state: "error",
13739
+ tokensError
13740
+ }
13741
+ ) : /* @__PURE__ */ jsxs22("div", { style: { display: "flex", flexDirection: "column" }, children: [
13742
+ hasWalletTokens && /* @__PURE__ */ jsxs22(Fragment4, { children: [
13743
+ /* @__PURE__ */ jsx25(TokenSectionLabel, { icon: "wallet", children: "Your tokens" }),
13744
+ filteredWalletTokens.map((token, i) => /* @__PURE__ */ jsx25(
13745
+ WalletTokenListItem,
13746
+ {
13747
+ token,
13748
+ onSelect: onSelectWalletToken
13749
+ },
13750
+ `${token.address}-${i}`
13751
+ ))
13752
+ ] }),
13753
+ isLoadingTokens ? /* @__PURE__ */ jsx25(
13754
+ TokenSelectorStateView,
13755
+ {
13756
+ isLoadingTokens: true,
13757
+ searchQuery,
13758
+ setSearchQuery,
13759
+ state: "empty",
13760
+ tokensError: null
13761
+ }
13762
+ ) : hasPopularTokens ? /* @__PURE__ */ jsxs22(Fragment4, { children: [
13763
+ /* @__PURE__ */ jsx25(TokenSectionLabel, { icon: "spark", children: "Popular tokens" }),
13764
+ filteredTokens.map((token, i) => /* @__PURE__ */ jsx25(
13765
+ AvailableTokenListItem,
13766
+ {
13767
+ token,
13768
+ onSelect: onSelectToken
13769
+ },
13770
+ `${token.address}-${i}`
13771
+ )),
13772
+ hasNextPage ? /* @__PURE__ */ jsx25(
13773
+ "button",
13774
+ {
13775
+ type: "button",
13776
+ onClick: () => {
13777
+ void loadMore();
12583
13778
  },
12584
- `${token.address}-${i}`
12585
- )),
12586
- /* @__PURE__ */ jsx25(
12587
- "div",
12588
- {
12589
- style: {
12590
- display: "flex",
12591
- alignItems: "center",
12592
- gap: "0.375rem",
12593
- paddingLeft: "0.5rem",
12594
- paddingRight: "0.5rem",
12595
- marginBottom: spacing[2]
12596
- },
12597
- children: /* @__PURE__ */ jsx25(
12598
- "span",
12599
- {
12600
- style: {
12601
- fontSize: "0.75rem",
12602
- lineHeight: "1rem",
12603
- color: colors.primary
12604
- },
12605
- children: "Popular tokens"
12606
- }
12607
- )
12608
- }
12609
- ),
12610
- filteredTokens.map((token, i) => /* @__PURE__ */ jsx25(
12611
- AvailableTokenListItem,
12612
- {
12613
- token,
12614
- onSelect: onSelectToken
13779
+ disabled: isLoadingMore,
13780
+ style: {
13781
+ marginTop: spacing[2],
13782
+ marginLeft: spacing[2],
13783
+ marginRight: spacing[2],
13784
+ padding: `${spacing[2]} ${spacing[3]}`,
13785
+ borderRadius: borderRadius.lg,
13786
+ border: `1px solid ${colors.border}`,
13787
+ backgroundColor: colors.card,
13788
+ color: colors.foreground,
13789
+ cursor: isLoadingMore ? "wait" : "pointer"
12615
13790
  },
12616
- `${token.address}-${i}`
12617
- )),
12618
- hasNextPage ? /* @__PURE__ */ jsx25(
12619
- "button",
12620
- {
12621
- type: "button",
12622
- onClick: () => {
12623
- void loadMore();
12624
- },
12625
- disabled: isLoadingMore,
12626
- style: {
12627
- marginTop: spacing[2],
12628
- marginLeft: spacing[2],
12629
- marginRight: spacing[2],
12630
- padding: `${spacing[2]} ${spacing[3]}`,
12631
- borderRadius: borderRadius.lg,
12632
- border: `1px solid ${colors.border}`,
12633
- backgroundColor: colors.card,
12634
- color: colors.foreground,
12635
- cursor: isLoadingMore ? "wait" : "pointer"
12636
- },
12637
- children: isLoadingMore ? "Loading more..." : "Load more"
12638
- }
12639
- ) : null
12640
- ]
12641
- }
12642
- )
13791
+ children: isLoadingMore ? "Loading more..." : "Load more"
13792
+ }
13793
+ ) : null
13794
+ ] }) : !hasWalletTokens ? /* @__PURE__ */ jsx25(
13795
+ TokenSelectorStateView,
13796
+ {
13797
+ isLoadingTokens: false,
13798
+ searchQuery,
13799
+ setSearchQuery,
13800
+ state: "empty",
13801
+ tokensError: null
13802
+ }
13803
+ ) : null
13804
+ ] })
12643
13805
  }
12644
13806
  )
12645
13807
  ]
@@ -12658,7 +13820,7 @@ var init_TokenSelectorPanel = __esm({
12658
13820
  });
12659
13821
 
12660
13822
  // src/widget/features/token-selection/hooks/useOrderedWalletTokens.ts
12661
- import { useCallback as useCallback16, useMemo as useMemo12 } from "react";
13823
+ import { useCallback as useCallback16, useMemo as useMemo13 } from "react";
12662
13824
  function useOrderedWalletTokens({
12663
13825
  amount,
12664
13826
  amountInputMode,
@@ -12676,7 +13838,7 @@ function useOrderedWalletTokens({
12676
13838
  },
12677
13839
  [setSelectedChain, setSelectedToken]
12678
13840
  );
12679
- const orderedTokens = useMemo12(() => {
13841
+ const orderedTokens = useMemo13(() => {
12680
13842
  const selectedTokenChainType = selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType;
12681
13843
  const index = yourWalletTokens.findIndex(
12682
13844
  (token) => normalizeAddress2(
@@ -12752,7 +13914,7 @@ var init_useOrderedWalletTokens = __esm({
12752
13914
  });
12753
13915
 
12754
13916
  // src/widget/features/token-selection/hooks/useSelectTokenModel.ts
12755
- import { useCallback as useCallback17, useMemo as useMemo13 } from "react";
13917
+ import { useCallback as useCallback17, useMemo as useMemo14 } from "react";
12756
13918
  function useSelectTokenModel({
12757
13919
  goBack,
12758
13920
  searchQuery,
@@ -12831,7 +13993,7 @@ function useSelectTokenModel({
12831
13993
  const address = token.address?.toLowerCase() ?? "";
12832
13994
  return symbol.includes(normalizedSearchQuery) || name.includes(normalizedSearchQuery) || address.includes(normalizedSearchQuery);
12833
13995
  };
12834
- const filteredWalletTokens = useMemo13(() => {
13996
+ const filteredWalletTokens = useMemo14(() => {
12835
13997
  if (!selectedChain?.chainId) {
12836
13998
  return [];
12837
13999
  }
@@ -13022,7 +14184,7 @@ var init_AmountBalanceRow = __esm({
13022
14184
  });
13023
14185
 
13024
14186
  // src/widget/features/amount/components/AmountConversionRow.tsx
13025
- import { Fragment as Fragment4, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
14187
+ import { Fragment as Fragment5, jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
13026
14188
  function formatTokenAmount(value) {
13027
14189
  const amount = Number(value ?? 0);
13028
14190
  if (amount <= 0) return "0";
@@ -13054,11 +14216,11 @@ function AmountConversionRow({
13054
14216
  fontSize: fontSize.lg,
13055
14217
  color: colors.mutedForeground
13056
14218
  },
13057
- children: amountInputMode === "usd" ? /* @__PURE__ */ jsxs24(Fragment4, { children: [
14219
+ children: amountInputMode === "usd" ? /* @__PURE__ */ jsxs24(Fragment5, { children: [
13058
14220
  formatTokenAmount(amountComputation.tokenAmount),
13059
14221
  " ",
13060
14222
  selectedTokenSymbol
13061
- ] }) : /* @__PURE__ */ jsx27(Fragment4, { children: hasUsdPrice ? formatUsdAmount2(amountComputation.usdAmount) : "USD pricing unavailable" })
14223
+ ] }) : /* @__PURE__ */ jsx27(Fragment5, { children: hasUsdPrice ? formatUsdAmount2(amountComputation.usdAmount) : "USD pricing unavailable" })
13062
14224
  }
13063
14225
  ),
13064
14226
  /* @__PURE__ */ jsx27(
@@ -13099,7 +14261,7 @@ var init_AmountConversionRow = __esm({
13099
14261
  });
13100
14262
 
13101
14263
  // src/widget/features/amount/components/AmountFeeSummary.tsx
13102
- import { Fragment as Fragment5, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
14264
+ import { Fragment as Fragment6, jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
13103
14265
  function formatEstimatedReceive(estimatedReceive, parsedAmount) {
13104
14266
  if (estimatedReceive) {
13105
14267
  return `~$${parseFloat(estimatedReceive).toLocaleString(void 0, {
@@ -13177,7 +14339,7 @@ function AmountFeeSummary({
13177
14339
  },
13178
14340
  children: "Enter an amount to continue."
13179
14341
  }
13180
- ) }) : /* @__PURE__ */ jsxs25(Fragment5, { children: [
14342
+ ) }) : /* @__PURE__ */ jsxs25(Fragment6, { children: [
13181
14343
  /* @__PURE__ */ jsxs25("div", { style: feeSummaryRowStyle, children: [
13182
14344
  /* @__PURE__ */ jsx28("span", { style: { color: colors.mutedForeground }, children: "Network fee" }),
13183
14345
  isGasSponsored ? /* @__PURE__ */ jsx28(
@@ -13202,7 +14364,7 @@ function AmountFeeSummary({
13202
14364
  6
13203
14365
  ) })
13204
14366
  ] }),
13205
- relayFeeUsd != null && relayFeeUsd > 0 && /* @__PURE__ */ jsxs25(Fragment5, { children: [
14367
+ relayFeeUsd != null && relayFeeUsd > 0 && /* @__PURE__ */ jsxs25(Fragment6, { children: [
13206
14368
  /* @__PURE__ */ jsx28("div", { style: feeSummaryDividerStyle }),
13207
14369
  /* @__PURE__ */ jsxs25("div", { style: feeSummaryRowStyle, children: [
13208
14370
  /* @__PURE__ */ jsx28("span", { style: { color: colors.mutedForeground }, children: "Bridge relay fee" }),
@@ -13408,7 +14570,7 @@ var init_CryptoPayAmountSection = __esm({
13408
14570
  });
13409
14571
 
13410
14572
  // src/widget/features/amount/hooks/useDepositAmountModel.ts
13411
- import { useEffect as useEffect20, useMemo as useMemo14 } from "react";
14573
+ import { useEffect as useEffect20, useMemo as useMemo15 } from "react";
13412
14574
  function useDepositAmountModel({
13413
14575
  amount,
13414
14576
  setAmount,
@@ -13422,7 +14584,7 @@ function useDepositAmountModel({
13422
14584
  }) {
13423
14585
  const tokenPriceUSD = typeof selectedToken?.usdPrice === "number" && Number.isFinite(selectedToken.usdPrice) && selectedToken.usdPrice > 0 ? selectedToken.usdPrice : 0;
13424
14586
  const hasUsdPrice = typeof tokenPriceUSD === "number" && Number.isFinite(tokenPriceUSD) && tokenPriceUSD > 0;
13425
- const normalizedTokenBalance = useMemo14(() => {
14587
+ const normalizedTokenBalance = useMemo15(() => {
13426
14588
  if (!selectedToken?.balance) return 0;
13427
14589
  const normalized = Number(
13428
14590
  rawToDecimal(selectedToken.balance, selectedToken.decimals ?? 18)
@@ -13456,7 +14618,7 @@ function useDepositAmountModel({
13456
14618
  setAmount,
13457
14619
  setAmountInputMode
13458
14620
  ]);
13459
- const amountComputation = useMemo14(() => {
14621
+ const amountComputation = useMemo15(() => {
13460
14622
  const rawAmount = (fixedFromAmountString ?? amount)?.trim();
13461
14623
  if (!rawAmount) {
13462
14624
  return {
@@ -13523,11 +14685,11 @@ function useDepositAmountModel({
13523
14685
  selectedToken?.decimals,
13524
14686
  tokenPriceUSD
13525
14687
  ]);
13526
- const requestedTokenAmount = useMemo14(() => {
14688
+ const requestedTokenAmount = useMemo15(() => {
13527
14689
  const tokenAmount = Number(amountComputation.tokenAmount);
13528
14690
  return Number.isFinite(tokenAmount) ? tokenAmount : 0;
13529
14691
  }, [amountComputation.tokenAmount]);
13530
- const amountValidationError = useMemo14(() => {
14692
+ const amountValidationError = useMemo15(() => {
13531
14693
  if (amountComputation.parseError) {
13532
14694
  return amountComputation.parseError;
13533
14695
  }
@@ -13560,17 +14722,17 @@ function useDepositAmountModel({
13560
14722
  ]);
13561
14723
  const amountWei = amountValidationError ? 0n : amountComputation.fromAmountWei ?? 0n;
13562
14724
  const parsedAmount = parseFloat(fixedFromAmountString ?? amount) || 0;
13563
- const maxTokenAmount = useMemo14(() => {
14725
+ const maxTokenAmount = useMemo15(() => {
13564
14726
  const cap = Math.min(normalizedTokenBalance, 1e4);
13565
14727
  const token = selectedToken;
13566
14728
  const isSolNative = token?.category === "native" && typeof token.chain_key === "string" && token.chain_key.toLowerCase().includes("solana");
13567
14729
  return isSolNative ? Math.max(0, cap - 0.01) : cap;
13568
14730
  }, [normalizedTokenBalance, selectedToken]);
13569
- const maxUsdAmount = useMemo14(() => {
14731
+ const maxUsdAmount = useMemo15(() => {
13570
14732
  if (!hasUsdPrice) return void 0;
13571
14733
  return Math.min(maxTokenAmount * tokenPriceUSD, 1e4);
13572
14734
  }, [hasUsdPrice, maxTokenAmount, tokenPriceUSD]);
13573
- const minAmountForMode = useMemo14(() => {
14735
+ const minAmountForMode = useMemo15(() => {
13574
14736
  if (minAmountUsd == null) return 0;
13575
14737
  if (amountInputMode === "usd") {
13576
14738
  return minAmountUsd;
@@ -13579,11 +14741,11 @@ function useDepositAmountModel({
13579
14741
  return minAmountUsd / tokenPriceUSD;
13580
14742
  }, [amountInputMode, hasUsdPrice, minAmountUsd, tokenPriceUSD]);
13581
14743
  const sliderMax = amountInputMode === "usd" ? maxUsdAmount : maxTokenAmount;
13582
- const effectiveSliderMax = useMemo14(() => {
14744
+ const effectiveSliderMax = useMemo15(() => {
13583
14745
  if (sliderMax == null || !Number.isFinite(sliderMax)) return void 0;
13584
14746
  return Math.max(sliderMax, 0);
13585
14747
  }, [sliderMax]);
13586
- const effectiveSliderMin = useMemo14(() => {
14748
+ const effectiveSliderMin = useMemo15(() => {
13587
14749
  if (effectiveSliderMax == null || !Number.isFinite(effectiveSliderMax) || effectiveSliderMax <= 0) {
13588
14750
  return 0;
13589
14751
  }
@@ -13619,7 +14781,7 @@ var init_useDepositAmountModel = __esm({
13619
14781
  });
13620
14782
 
13621
14783
  // src/widget/features/amount/hooks/useHomeAmountModel.ts
13622
- import { useEffect as useEffect21, useMemo as useMemo15 } from "react";
14784
+ import { useEffect as useEffect21, useMemo as useMemo16 } from "react";
13623
14785
  function useHomeAmountModel({
13624
14786
  amount,
13625
14787
  setAmount,
@@ -13646,7 +14808,7 @@ function useHomeAmountModel({
13646
14808
  setAmountInputMode
13647
14809
  ]);
13648
14810
  const parsedAmount = parseFloat(fixedFromAmountString ?? amount) || 0;
13649
- const amountValidationMessage = useMemo15(() => {
14811
+ const amountValidationMessage = useMemo16(() => {
13650
14812
  const rawAmount = (fixedFromAmountString ?? amount)?.trim();
13651
14813
  if (!rawAmount) return null;
13652
14814
  if (!/^\d*\.?\d*$/.test(rawAmount)) {
@@ -14569,7 +15731,7 @@ var init_HomePaymentOptions = __esm({
14569
15731
  });
14570
15732
 
14571
15733
  // src/widget/features/wallet/hooks/useHomeWalletActions.ts
14572
- import { useCallback as useCallback18, useEffect as useEffect22, useMemo as useMemo16, useRef as useRef10, useState as useState21 } from "react";
15734
+ import { useCallback as useCallback18, useEffect as useEffect22, useMemo as useMemo17, useRef as useRef10, useState as useState22 } from "react";
14573
15735
  function useHomeWalletActions({
14574
15736
  connectWallet,
14575
15737
  detectedWallets,
@@ -14578,8 +15740,8 @@ function useHomeWalletActions({
14578
15740
  WalletConnect
14579
15741
  // setCurrentStepInternal,
14580
15742
  }) {
14581
- const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState21(false);
14582
- const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState21(false);
15743
+ const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState22(false);
15744
+ const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState22(false);
14583
15745
  const cryptoDropdownRef = useRef10(null);
14584
15746
  const fiatDropdownRef = useRef10(null);
14585
15747
  const { disconnect } = useWalletInfo();
@@ -14630,7 +15792,7 @@ function useHomeWalletActions({
14630
15792
  WalletConnect().catch(() => resetNavigation());
14631
15793
  }, [setYourWalletTokens, disconnect]);
14632
15794
  const { selectedNamespace } = useDepositWallet();
14633
- const browserWallets = useMemo16(() => {
15795
+ const browserWallets = useMemo17(() => {
14634
15796
  if (!detectedWallets?.length) return [];
14635
15797
  return detectedWallets.filter(
14636
15798
  (wallet) => wallet?.meta?.id !== "walletconnect" && wallet?.meta?.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase()
@@ -15042,7 +16204,7 @@ var init_relayFeeUtils = __esm({
15042
16204
  });
15043
16205
 
15044
16206
  // src/widget/features/route-preview/hooks/useRoutePreviewModel.ts
15045
- import { useMemo as useMemo17 } from "react";
16207
+ import { useMemo as useMemo18 } from "react";
15046
16208
  function useRoutePreviewModel({
15047
16209
  amountUsd,
15048
16210
  amountValidationError,
@@ -15055,7 +16217,7 @@ function useRoutePreviewModel({
15055
16217
  walletAddress
15056
16218
  }) {
15057
16219
  const { chains } = useChains();
15058
- const destinationConfig = useMemo17(
16220
+ const destinationConfig = useMemo18(
15059
16221
  () => ({
15060
16222
  dappName: config.messages?.title || "DApp",
15061
16223
  toChain: config.routes.toChain,
@@ -15069,7 +16231,7 @@ function useRoutePreviewModel({
15069
16231
  config.routes.toToken
15070
16232
  ]
15071
16233
  );
15072
- const routeConfig = useMemo17(() => {
16234
+ const routeConfig = useMemo18(() => {
15073
16235
  const toChainId = config.routes.toChain;
15074
16236
  const toChainKey = normalizeChainKey2(toChainId);
15075
16237
  const toChain = toChainKey ? chains.find(
@@ -15106,7 +16268,7 @@ function useRoutePreviewModel({
15106
16268
  ...routeConfig,
15107
16269
  enabled: !!isReady
15108
16270
  });
15109
- const routePrerequisiteError = useMemo17(() => {
16271
+ const routePrerequisiteError = useMemo18(() => {
15110
16272
  if (!isReady) return;
15111
16273
  if (!selectedChain) {
15112
16274
  return "Select a source chain to fetch a route.";
@@ -28848,7 +30010,7 @@ var init_smart_account2 = __esm({
28848
30010
  });
28849
30011
 
28850
30012
  // src/widget/features/transaction/hooks/useTransactionActionModel.ts
28851
- import { useCallback as useCallback19, useEffect as useEffect23, useMemo as useMemo18, useRef as useRef11, useState as useState22 } from "react";
30013
+ import { useCallback as useCallback19, useEffect as useEffect23, useMemo as useMemo19, useRef as useRef11, useState as useState23 } from "react";
28852
30014
  import { encodeFunctionData as encodeFunctionData8, erc20Abi } from "viem";
28853
30015
  function normalizeTokenAddressForCompare(chain, addr) {
28854
30016
  const chainType = (chain.type ?? chain.chainType ?? "").toLowerCase();
@@ -28883,7 +30045,7 @@ function useTransactionActionModel({
28883
30045
  const chainType = selectedChain?.type ?? selectedChain?.chainType;
28884
30046
  const chainTypeNormalized = (chainType ?? "").toLowerCase();
28885
30047
  const isEvm = chainTypeNormalized === "evm";
28886
- const backendChainId2 = useMemo18(() => {
30048
+ const backendChainId2 = useMemo19(() => {
28887
30049
  const chainRef = routeResult?.txReq?.chainId ?? selectedChain?.networkIdentifier ?? selectedChain?.chainId ?? selectedChain?.id;
28888
30050
  if (chainRef == null) return null;
28889
30051
  return String(chainRef);
@@ -28893,7 +30055,7 @@ function useTransactionActionModel({
28893
30055
  selectedChain?.id,
28894
30056
  selectedChain?.networkIdentifier
28895
30057
  ]);
28896
- const selectedTokenOnBackendChain = useMemo18(() => {
30058
+ const selectedTokenOnBackendChain = useMemo19(() => {
28897
30059
  if (!backendChainId2) return false;
28898
30060
  const target = normalizeChainKey2(backendChainId2);
28899
30061
  return [
@@ -28910,22 +30072,22 @@ function useTransactionActionModel({
28910
30072
  selectedChain?.id,
28911
30073
  selectedChain?.networkIdentifier
28912
30074
  ]);
28913
- const isNativeSelected = useMemo18(() => {
30075
+ const isNativeSelected = useMemo19(() => {
28914
30076
  const address = selectedToken?.address;
28915
30077
  return isNativeTokenAddress(address, chainType) || isZeroAddrLike(address, chainType) || normalizeTokenAddressForCompare(selectedChain, address) === normalizeTokenAddressForCompare(
28916
30078
  selectedChain,
28917
30079
  getNativeTokenAddress2(chainType)
28918
30080
  );
28919
30081
  }, [chainType, selectedChain, selectedToken?.address]);
28920
- const spender = useMemo18(() => {
30082
+ const spender = useMemo19(() => {
28921
30083
  const txReq = routeResult?.txReq;
28922
30084
  const addr = txReq?.to ?? txReq?.target;
28923
30085
  return addr ?? null;
28924
30086
  }, [routeResult?.txReq]);
28925
- const [allowanceWei, setAllowanceWei] = useState22(0n);
28926
- const [isReadingAllowance, setIsReadingAllowance] = useState22(false);
28927
- const [isApproving, setIsApproving] = useState22(false);
28928
- const [gasReservationWei, setGasReservationWei] = useState22(0n);
30087
+ const [allowanceWei, setAllowanceWei] = useState23(0n);
30088
+ const [isReadingAllowance, setIsReadingAllowance] = useState23(false);
30089
+ const [isApproving, setIsApproving] = useState23(false);
30090
+ const [gasReservationWei, setGasReservationWei] = useState23(0n);
28929
30091
  const readAllowance = useCallback19(async () => {
28930
30092
  if (!isEvm || isNativeSelected || !!routeResult?.sponsorship || // sponsored routes: SA approves bridge inside the UO batch
28931
30093
  !backendChainId2 || !selectedTokenOnBackendChain || !walletAddress || !spender || !selectedToken?.address) {
@@ -29165,7 +30327,7 @@ function useTransactionActionModel({
29165
30327
  void estimateGasReservationWei();
29166
30328
  }
29167
30329
  }, [estimateGasReservationWei, routeResult]);
29168
- const [smartAccountFailed, setSmartAccountFailed] = useState22(false);
30330
+ const [smartAccountFailed, setSmartAccountFailed] = useState23(false);
29169
30331
  useEffect23(() => {
29170
30332
  setSmartAccountFailed(false);
29171
30333
  }, [routeResult?.intentId]);
@@ -29270,7 +30432,7 @@ function useTransactionActionModel({
29270
30432
  ]);
29271
30433
  const isWalletConnected = walletStatus === "connected";
29272
30434
  const canSwipe = parsedAmount > 0 && !!selectedToken && isWalletConnected && !isLoadingRoute && !isSubmitting && !!routeResult && !actionErrorMessage && !isApproving && !isReadingAllowance;
29273
- const swipeResetKey = useMemo18(() => {
30435
+ const swipeResetKey = useMemo19(() => {
29274
30436
  const tokenAddress = selectedToken ? normalizeAddress2(
29275
30437
  selectedToken.address,
29276
30438
  selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType
@@ -29501,8 +30663,8 @@ var init_DefaultCryptoPay = __esm({
29501
30663
  });
29502
30664
 
29503
30665
  // src/widget/pages/CryptoPay/index.tsx
29504
- import { useEffect as useEffect24, useMemo as useMemo19 } from "react";
29505
- import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
30666
+ import { useEffect as useEffect24, useMemo as useMemo20 } from "react";
30667
+ import { Fragment as Fragment7, jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
29506
30668
  function CryptoPay({ style: _style }) {
29507
30669
  const {
29508
30670
  amount,
@@ -29525,17 +30687,17 @@ function CryptoPay({ style: _style }) {
29525
30687
  const { goBack, setCurrentStep, currentStep } = useDepositNavigation();
29526
30688
  const config = useTrustwareConfig();
29527
30689
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
29528
- const routeRefreshMs = useMemo19(() => {
30690
+ const routeRefreshMs = useMemo20(() => {
29529
30691
  const raw = config.routes?.options?.routeRefreshMs;
29530
30692
  const n = Number(raw);
29531
30693
  return Number.isFinite(n) && n > 0 ? n : void 0;
29532
30694
  }, [config.routes?.options?.routeRefreshMs]);
29533
30695
  const IsPos = (x) => x !== null && x !== void 0 && x.balance !== "0";
29534
- const showDefaultCryptoPay = useMemo19(() => {
30696
+ const showDefaultCryptoPay = useMemo20(() => {
29535
30697
  const nonZer0Tks = (yourWalletTokens ?? []).filter(IsPos);
29536
30698
  return !yourWalletTokensLoading && nonZer0Tks.length === 0 && yourWalletTokens.length > 0;
29537
30699
  }, [yourWalletTokens, yourWalletTokensLoading]);
29538
- const showSkeleton = useMemo19(() => {
30700
+ const showSkeleton = useMemo20(() => {
29539
30701
  return (yourWalletTokens ?? []).length === 0;
29540
30702
  }, [yourWalletTokens]);
29541
30703
  const isReady = selectedToken != null && selectedToken?.chainData !== void 0 && !showDefaultCryptoPay && !showSkeleton;
@@ -29640,7 +30802,7 @@ function CryptoPay({ style: _style }) {
29640
30802
  if (isFixedAmount) return;
29641
30803
  setAmount(value.toString());
29642
30804
  };
29643
- const relayFeeUsd = useMemo19(
30805
+ const relayFeeUsd = useMemo20(
29644
30806
  () => computeRelayFeeUsd(routeResult, isNativeSelected),
29645
30807
  [isNativeSelected, routeResult]
29646
30808
  );
@@ -29741,7 +30903,7 @@ function CryptoPay({ style: _style }) {
29741
30903
  ]
29742
30904
  }
29743
30905
  ),
29744
- showSkeleton ? /* @__PURE__ */ jsx49(Fragment6, { children: /* @__PURE__ */ jsx49(
30906
+ showSkeleton ? /* @__PURE__ */ jsx49(Fragment7, { children: /* @__PURE__ */ jsx49(
29745
30907
  "div",
29746
30908
  {
29747
30909
  style: {
@@ -29752,8 +30914,8 @@ function CryptoPay({ style: _style }) {
29752
30914
  },
29753
30915
  children: /* @__PURE__ */ jsx49(LoadingSkeleton, {})
29754
30916
  }
29755
- ) }) : /* @__PURE__ */ jsxs39(Fragment6, { children: [
29756
- isReady && /* @__PURE__ */ jsxs39(Fragment6, { children: [
30917
+ ) }) : /* @__PURE__ */ jsxs39(Fragment7, { children: [
30918
+ isReady && /* @__PURE__ */ jsxs39(Fragment7, { children: [
29757
30919
  /* @__PURE__ */ jsx49(
29758
30920
  CryptoPayAmountSection,
29759
30921
  {
@@ -29831,7 +30993,7 @@ var init_CryptoPay = __esm({
29831
30993
  });
29832
30994
 
29833
30995
  // src/widget/pages/Processing.tsx
29834
- import { useEffect as useEffect25, useMemo as useMemo20, useRef as useRef12 } from "react";
30996
+ import { useEffect as useEffect25, useMemo as useMemo21, useRef as useRef12 } from "react";
29835
30997
  import { jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
29836
30998
  function getProgressFromStatus(status) {
29837
30999
  switch (status) {
@@ -29882,15 +31044,15 @@ function Processing({ style }) {
29882
31044
  startPolling(intentId, transactionHash);
29883
31045
  }
29884
31046
  }, [intentId, transactionHash, isPolling, transactionStatus, startPolling]);
29885
- const progress = useMemo20(
31047
+ const progress = useMemo21(
29886
31048
  () => getProgressFromStatus(transactionStatus),
29887
31049
  [transactionStatus]
29888
31050
  );
29889
- const stepText = useMemo20(
31051
+ const stepText = useMemo21(
29890
31052
  () => getStepText(transactionStatus),
29891
31053
  [transactionStatus]
29892
31054
  );
29893
- const explorerUrl = useMemo20(() => {
31055
+ const explorerUrl = useMemo21(() => {
29894
31056
  if (transaction?.fromChainTxUrl) {
29895
31057
  return transaction.fromChainTxUrl;
29896
31058
  }
@@ -30036,15 +31198,15 @@ var init_Processing = __esm({
30036
31198
  });
30037
31199
 
30038
31200
  // src/widget/pages/Success.tsx
30039
- import { lazy, Suspense, useMemo as useMemo21 } from "react";
31201
+ import { lazy, Suspense, useMemo as useMemo22 } from "react";
30040
31202
  import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
30041
31203
  function Success({ style }) {
30042
31204
  const { selectedToken, selectedChain, amount } = useDepositForm();
30043
31205
  const { resetState } = useDepositNavigation();
30044
31206
  const { transactionHash } = useDepositTransaction();
30045
31207
  const { transaction } = useTransactionPolling();
30046
- const parsedAmount = useMemo21(() => parseFloat(amount) || 0, [amount]);
30047
- const explorerUrl = useMemo21(() => {
31208
+ const parsedAmount = useMemo22(() => parseFloat(amount) || 0, [amount]);
31209
+ const explorerUrl = useMemo22(() => {
30048
31210
  if (transaction?.toChainTxUrl) {
30049
31211
  return transaction.toChainTxUrl;
30050
31212
  }
@@ -30117,7 +31279,7 @@ var init_Success = __esm({
30117
31279
  });
30118
31280
 
30119
31281
  // src/widget/pages/Error.tsx
30120
- import { useMemo as useMemo22, useEffect as useEffect26 } from "react";
31282
+ import { useMemo as useMemo23, useEffect as useEffect26 } from "react";
30121
31283
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
30122
31284
  function categorizeError(errorMessage) {
30123
31285
  if (!errorMessage) return "unknown";
@@ -30205,19 +31367,19 @@ function Error2({ style }) {
30205
31367
  setErrorMessage,
30206
31368
  transactionHash
30207
31369
  } = useDepositTransaction();
30208
- const errorCategory = useMemo22(
31370
+ const errorCategory = useMemo23(
30209
31371
  () => categorizeError(errorMessage),
30210
31372
  [errorMessage]
30211
31373
  );
30212
- const errorTitle = useMemo22(
31374
+ const errorTitle = useMemo23(
30213
31375
  () => getErrorTitle(errorCategory),
30214
31376
  [errorCategory]
30215
31377
  );
30216
- const errorSuggestion = useMemo22(
31378
+ const errorSuggestion = useMemo23(
30217
31379
  () => getErrorSuggestion(errorCategory),
30218
31380
  [errorCategory]
30219
31381
  );
30220
- const retryStep = useMemo22(() => getRetryStep(errorCategory), [errorCategory]);
31382
+ const retryStep = useMemo23(() => getRetryStep(errorCategory), [errorCategory]);
30221
31383
  useEffect26(() => {
30222
31384
  if (errorMessage) {
30223
31385
  try {
@@ -30240,7 +31402,7 @@ function Error2({ style }) {
30240
31402
  const handleStartOver = () => {
30241
31403
  resetState();
30242
31404
  };
30243
- const explorerUrl = useMemo22(() => {
31405
+ const explorerUrl = useMemo23(() => {
30244
31406
  if (transactionHash && selectedChain?.blockExplorerUrls?.length) {
30245
31407
  return `${selectedChain.blockExplorerUrls[0].replace(/\/+$/, "")}/tx/${transactionHash}`;
30246
31408
  }
@@ -30389,18 +31551,18 @@ var init_widgetSteps = __esm({
30389
31551
  });
30390
31552
 
30391
31553
  // src/widget/app/WidgetRouter.tsx
30392
- import { useMemo as useMemo23 } from "react";
31554
+ import { useMemo as useMemo24 } from "react";
30393
31555
  import { jsx as jsx53 } from "react/jsx-runtime";
30394
31556
  function WidgetRouter({
30395
31557
  currentStep,
30396
31558
  navigationDirection,
30397
31559
  stepHistory
30398
31560
  }) {
30399
- const PageComponent = useMemo23(
31561
+ const PageComponent = useMemo24(
30400
31562
  () => PAGE_COMPONENTS[currentStep],
30401
31563
  [currentStep]
30402
31564
  );
30403
- const animationClass = useMemo23(() => {
31565
+ const animationClass = useMemo24(() => {
30404
31566
  return navigationDirection === "forward" ? "tw-animate-slide-in-right" : "tw-animate-slide-in-left";
30405
31567
  }, [navigationDirection]);
30406
31568
  return /* @__PURE__ */ jsx53(
@@ -30428,9 +31590,9 @@ var init_WidgetRouter = __esm({
30428
31590
  });
30429
31591
 
30430
31592
  // src/modes/swap/hooks/useSwapRoute.ts
30431
- import { useCallback as useCallback20, useRef as useRef13, useState as useState23 } from "react";
31593
+ import { useCallback as useCallback20, useRef as useRef13, useState as useState24 } from "react";
30432
31594
  function useSwapRoute() {
30433
- const [state, setState] = useState23({
31595
+ const [state, setState] = useState24({
30434
31596
  data: null,
30435
31597
  loading: false,
30436
31598
  error: null
@@ -30494,7 +31656,7 @@ var init_useSwapRoute = __esm({
30494
31656
  });
30495
31657
 
30496
31658
  // src/modes/swap/hooks/useSwapExecution.ts
30497
- import { useCallback as useCallback21, useRef as useRef14, useState as useState24 } from "react";
31659
+ import { useCallback as useCallback21, useRef as useRef14, useState as useState25 } from "react";
30498
31660
  import { encodeFunctionData as encodeFunctionData9, erc20Abi as erc20Abi2 } from "viem";
30499
31661
  function normalizeTx(raw) {
30500
31662
  const r = raw;
@@ -30529,7 +31691,7 @@ async function waitForApprovalConfirmation(chainId, txHash) {
30529
31691
  throw new Error("Timed out waiting for approval confirmation");
30530
31692
  }
30531
31693
  function useSwapExecution(fromChain) {
30532
- const [state, setState] = useState24({
31694
+ const [state, setState] = useState25({
30533
31695
  txStatus: "idle",
30534
31696
  txHash: null,
30535
31697
  intentId: null,
@@ -30905,11 +32067,11 @@ var init_forex = __esm({
30905
32067
  });
30906
32068
 
30907
32069
  // src/modes/swap/hooks/useForex.ts
30908
- import { useEffect as useEffect27, useRef as useRef15, useState as useState25 } from "react";
32070
+ import { useEffect as useEffect27, useRef as useRef15, useState as useState26 } from "react";
30909
32071
  function useForex() {
30910
- const [rates, setRates] = useState25({ USD: 1 });
30911
- const [error, setError] = useState25(null);
30912
- const [lastUpdated, setLastUpdated] = useState25(null);
32072
+ const [rates, setRates] = useState26({ USD: 1 });
32073
+ const [error, setError] = useState26(null);
32074
+ const [lastUpdated, setLastUpdated] = useState26(null);
30913
32075
  const timerRef = useRef15(null);
30914
32076
  useEffect27(() => {
30915
32077
  let cancelled = false;
@@ -30948,7 +32110,7 @@ var init_useForex = __esm({
30948
32110
  });
30949
32111
 
30950
32112
  // src/modes/swap/components/SwapTokenSelect.tsx
30951
- import { useState as useState26, useMemo as useMemo24, useEffect as useEffect28 } from "react";
32113
+ import { useState as useState27, useMemo as useMemo25, useEffect as useEffect28 } from "react";
30952
32114
  import { jsx as jsx54, jsxs as jsxs43 } from "react/jsx-runtime";
30953
32115
  function SwapTokenSelect({
30954
32116
  side,
@@ -30964,9 +32126,9 @@ function SwapTokenSelect({
30964
32126
  allowedTokens,
30965
32127
  excludeToken
30966
32128
  }) {
30967
- const [localChain, setLocalChain] = useState26(initialChain);
30968
- const [pinnedTokens, setPinnedTokens] = useState26([]);
30969
- const [pinnedLoading, setPinnedLoading] = useState26(false);
32129
+ const [localChain, setLocalChain] = useState27(initialChain);
32130
+ const [pinnedTokens, setPinnedTokens] = useState27([]);
32131
+ const [pinnedLoading, setPinnedLoading] = useState27(false);
30970
32132
  useEffect28(() => {
30971
32133
  if (!allowedTokens || allowedTokens.length === 0 || !localChain) {
30972
32134
  setPinnedTokens([]);
@@ -31048,26 +32210,26 @@ function SwapTokenSelect({
31048
32210
  walletAddress,
31049
32211
  yourWalletTokens
31050
32212
  });
31051
- const allowedSet = useMemo24(() => {
32213
+ const allowedSet = useMemo25(() => {
31052
32214
  if (!allowedTokens || allowedTokens.length === 0) return null;
31053
32215
  return new Set(
31054
32216
  allowedTokens.map((t) => `${t.chainId}:${t.address.toLowerCase()}`)
31055
32217
  );
31056
32218
  }, [allowedTokens]);
31057
- const filteredWalletTokens = useMemo24(() => {
32219
+ const filteredWalletTokens = useMemo25(() => {
31058
32220
  if (!allowedSet) return rawWalletTokens;
31059
32221
  return rawWalletTokens.filter(
31060
32222
  (t) => allowedSet.has(`${Number(t.chainId)}:${t.address.toLowerCase()}`)
31061
32223
  );
31062
32224
  }, [rawWalletTokens, allowedSet]);
31063
32225
  const excludeKey = excludeToken ? `${Number(excludeToken.chainId)}:${excludeToken.address.toLowerCase()}` : null;
31064
- const visibleTokens = useMemo24(() => {
32226
+ const visibleTokens = useMemo25(() => {
31065
32227
  if (!excludeKey) return filteredTokens;
31066
32228
  return filteredTokens.filter(
31067
32229
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
31068
32230
  );
31069
32231
  }, [filteredTokens, excludeKey]);
31070
- const visibleWalletTokens = useMemo24(() => {
32232
+ const visibleWalletTokens = useMemo25(() => {
31071
32233
  if (!excludeKey) return filteredWalletTokens;
31072
32234
  return filteredWalletTokens.filter(
31073
32235
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
@@ -31160,29 +32322,7 @@ function SwapTokenSelect({
31160
32322
  popularChains
31161
32323
  }
31162
32324
  ),
31163
- localChain === null ? /* @__PURE__ */ jsx54(
31164
- "div",
31165
- {
31166
- style: {
31167
- flex: 1,
31168
- display: "flex",
31169
- alignItems: "center",
31170
- justifyContent: "center",
31171
- padding: spacing[4]
31172
- },
31173
- children: /* @__PURE__ */ jsx54(
31174
- "p",
31175
- {
31176
- style: {
31177
- fontSize: fontSize.sm,
31178
- color: colors.mutedForeground,
31179
- textAlign: "center"
31180
- },
31181
- children: "Select a chain to see tokens"
31182
- }
31183
- )
31184
- }
31185
- ) : /* @__PURE__ */ jsx54(
32325
+ /* @__PURE__ */ jsx54(
31186
32326
  TokenSelectorPanel,
31187
32327
  {
31188
32328
  filteredTokens: visibleTokens,
@@ -31218,8 +32358,8 @@ var init_SwapTokenSelect = __esm({
31218
32358
  });
31219
32359
 
31220
32360
  // src/modes/swap/components/SwapWalletSelector.tsx
31221
- import { useEffect as useEffect29, useMemo as useMemo25, useRef as useRef16, useState as useState27 } from "react";
31222
- import { Fragment as Fragment7, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
32361
+ import { useEffect as useEffect29, useMemo as useMemo26, useRef as useRef16, useState as useState28 } from "react";
32362
+ import { Fragment as Fragment8, jsx as jsx55, jsxs as jsxs44 } from "react/jsx-runtime";
31223
32363
  function SwapWalletSelector({
31224
32364
  walletStatus,
31225
32365
  walletAddress,
@@ -31235,10 +32375,10 @@ function SwapWalletSelector({
31235
32375
  } = useWalletInfo();
31236
32376
  const walletConnectCfg = TrustwareConfigStore.peek()?.walletConnect;
31237
32377
  const connectWC = useWalletConnectConnect(walletConnectCfg);
31238
- const [wcConnecting, setWcConnecting] = useState27(false);
31239
- const [connectingId, setConnectingId] = useState27(null);
31240
- const [timerExpired, setTimerExpired] = useState27(false);
31241
- const [selectedNamespace, setSelectedNamespace] = useState27("evm");
32378
+ const [wcConnecting, setWcConnecting] = useState28(false);
32379
+ const [connectingId, setConnectingId] = useState28(null);
32380
+ const [timerExpired, setTimerExpired] = useState28(false);
32381
+ const [selectedNamespace, setSelectedNamespace] = useState28("evm");
31242
32382
  const prevStatusRef = useRef16(walletStatus);
31243
32383
  useEffect29(() => {
31244
32384
  const t = setTimeout(() => setTimerExpired(true), 450);
@@ -31253,7 +32393,7 @@ function SwapWalletSelector({
31253
32393
  prevStatusRef.current = walletStatus;
31254
32394
  }
31255
32395
  }, [walletStatus]);
31256
- const filteredWallets = useMemo25(
32396
+ const filteredWallets = useMemo26(
31257
32397
  () => detected.filter(
31258
32398
  (w) => (w.meta?.ecosystem ?? "").toLowerCase() === selectedNamespace
31259
32399
  ),
@@ -31373,58 +32513,38 @@ function SwapWalletSelector({
31373
32513
  children: "Connect Wallet"
31374
32514
  }
31375
32515
  ),
31376
- /* @__PURE__ */ jsxs44(
32516
+ /* @__PURE__ */ jsx55(
31377
32517
  "div",
31378
32518
  {
31379
32519
  style: {
31380
- position: "relative",
31381
32520
  display: "flex",
31382
32521
  alignItems: "center",
31383
- borderRadius: "9999px",
31384
- background: colors.background,
31385
- border: `1px solid ${colors.mutedForeground}`,
31386
- padding: "3px"
32522
+ borderRadius: borderRadius.lg,
32523
+ backgroundColor: colors.muted,
32524
+ padding: "3px",
32525
+ gap: "2px"
31387
32526
  },
31388
- children: [
31389
- /* @__PURE__ */ jsx55(
31390
- "div",
31391
- {
31392
- style: {
31393
- position: "absolute",
31394
- top: 3,
31395
- bottom: 3,
31396
- width: "calc(50% - 3px)",
31397
- borderRadius: "9999px",
31398
- background: `linear-gradient(to bottom, ${colors.zinc[100]}, ${colors.zinc[200]})`,
31399
- border: `1px solid ${colors.mutedForeground}`,
31400
- transition: "transform 300ms ease-out",
31401
- transform: selectedNamespace === "evm" ? "translateX(0)" : "translateX(100%)"
31402
- }
31403
- }
31404
- ),
31405
- tabs.map((t) => /* @__PURE__ */ jsx55(
31406
- "button",
31407
- {
31408
- onClick: () => setSelectedNamespace(t.id),
31409
- style: {
31410
- position: "relative",
31411
- zIndex: 10,
31412
- padding: "4px 11px",
31413
- fontSize: "10px",
31414
- outline: "none",
31415
- fontWeight: 600,
31416
- borderRadius: "9999px",
31417
- background: "transparent",
31418
- border: "none",
31419
- cursor: "pointer",
31420
- transition: "color 200ms",
31421
- color: selectedNamespace === t.id ? colors.black : colors.mutedForeground
31422
- },
31423
- children: t.label
32527
+ children: tabs.map((t) => /* @__PURE__ */ jsx55(
32528
+ "button",
32529
+ {
32530
+ onClick: () => setSelectedNamespace(t.id),
32531
+ style: {
32532
+ padding: `${spacing[1]} ${spacing[3]}`,
32533
+ fontSize: fontSize.sm,
32534
+ fontWeight: fontWeight.medium,
32535
+ borderRadius: borderRadius.md,
32536
+ background: selectedNamespace === t.id ? colors.card : "transparent",
32537
+ border: selectedNamespace === t.id ? `1px solid ${colors.border}` : "1px solid transparent",
32538
+ cursor: "pointer",
32539
+ transition: "all 0.15s",
32540
+ color: selectedNamespace === t.id ? colors.foreground : colors.mutedForeground,
32541
+ boxShadow: selectedNamespace === t.id ? "0 1px 3px rgba(0,0,0,0.08)" : "none",
32542
+ outline: "none"
31424
32543
  },
31425
- t.id
31426
- ))
31427
- ]
32544
+ children: t.label
32545
+ },
32546
+ t.id
32547
+ ))
31428
32548
  }
31429
32549
  )
31430
32550
  ]
@@ -31697,7 +32817,7 @@ function SwapWalletSelector({
31697
32817
  })
31698
32818
  }
31699
32819
  ),
31700
- selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment7, { children: [
32820
+ selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment8, { children: [
31701
32821
  /* @__PURE__ */ jsx55(
31702
32822
  "div",
31703
32823
  {
@@ -31939,11 +33059,12 @@ import {
31939
33059
  Suspense as Suspense2,
31940
33060
  useCallback as useCallback22,
31941
33061
  useEffect as useEffect30,
31942
- useMemo as useMemo26,
33062
+ useMemo as useMemo27,
31943
33063
  useRef as useRef17,
31944
- useState as useState28
33064
+ useState as useState29
31945
33065
  } from "react";
31946
- import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
33066
+ import ReactDOM from "react-dom";
33067
+ import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs45 } from "react/jsx-runtime";
31947
33068
  function fmtAmount(n, max = 6) {
31948
33069
  if (!isFinite(n) || n === 0) return "0";
31949
33070
  return n.toLocaleString(void 0, { maximumFractionDigits: max });
@@ -32032,35 +33153,35 @@ function RateRow({ label, value }) {
32032
33153
  );
32033
33154
  }
32034
33155
  function SwapMode({
32035
- theme = "system",
33156
+ theme: themeProp,
32036
33157
  style
32037
33158
  }) {
32038
- const [stage, setStage] = useState28("home");
32039
- const [fromToken, setFromToken] = useState28(
33159
+ const [stage, setStage] = useState29("home");
33160
+ const [fromToken, setFromToken] = useState29(
32040
33161
  null
32041
33162
  );
32042
- const [fromChain, setFromChain] = useState28(null);
32043
- const [toToken, setToToken] = useState28(null);
32044
- const [toChain, setToChain] = useState28(null);
32045
- const [amount, setAmount] = useState28("");
32046
- const [amountInputMode, setAmountInputMode] = useState28(
33163
+ const [fromChain, setFromChain] = useState29(null);
33164
+ const [toToken, setToToken] = useState29(null);
33165
+ const [toChain, setToChain] = useState29(null);
33166
+ const [amount, setAmount] = useState29("");
33167
+ const [amountInputMode, setAmountInputMode] = useState29(
32047
33168
  "usd"
32048
33169
  );
32049
- const [hoverSell, setHoverSell] = useState28(false);
32050
- const [showRateDetails, setShowRateDetails] = useState28(false);
32051
- const [showReviewDetails, setShowReviewDetails] = useState28(false);
32052
- const [showSettings, setShowSettings] = useState28(false);
32053
- const [maxApproval, setMaxApproval] = useState28(false);
32054
- const [slippage, setSlippage] = useState28(0.5);
32055
- const [slippageInput, setSlippageInput] = useState28("");
32056
- const [selectedCurrency, setSelectedCurrency] = useState28("USD");
32057
- const [showCurrencyDropdown, setShowCurrencyDropdown] = useState28(false);
32058
- const [completedAt, setCompletedAt] = useState28(null);
32059
- const [copiedHash, setCopiedHash] = useState28(null);
32060
- const [rateUpdated, setRateUpdated] = useState28(false);
33170
+ const [hoverSell, setHoverSell] = useState29(false);
33171
+ const [showRateDetails, setShowRateDetails] = useState29(false);
33172
+ const [showReviewDetails, setShowReviewDetails] = useState29(false);
33173
+ const [showSettings, setShowSettings] = useState29(false);
33174
+ const [maxApproval, setMaxApproval] = useState29(false);
33175
+ const [slippage, setSlippage] = useState29(0.5);
33176
+ const [slippageInput, setSlippageInput] = useState29("");
33177
+ const [selectedCurrency, setSelectedCurrency] = useState29("USD");
33178
+ const [showCurrencyDropdown, setShowCurrencyDropdown] = useState29(false);
33179
+ const [completedAt, setCompletedAt] = useState29(null);
33180
+ const [copiedHash, setCopiedHash] = useState29(null);
33181
+ const [rateUpdated, setRateUpdated] = useState29(false);
32061
33182
  const prevToAmountRef = useRef17(null);
32062
- const [destAddress, setDestAddress] = useState28("");
32063
- const [quoteAge, setQuoteAge] = useState28(0);
33183
+ const [destAddress, setDestAddress] = useState29("");
33184
+ const [quoteAge, setQuoteAge] = useState29(0);
32064
33185
  const quoteTimestampRef = useRef17(null);
32065
33186
  const latestFetchParamsRef = useRef17(null);
32066
33187
  const { rates: forexRates } = useForex();
@@ -32081,7 +33202,11 @@ function SwapMode({
32081
33202
  const settingsRef = useRef17(null);
32082
33203
  const currencyDropdownRef = useRef17(null);
32083
33204
  const { emitEvent } = useTrustware();
32084
- const { features } = useTrustwareConfig();
33205
+ const { features, theme: configTheme } = useTrustwareConfig();
33206
+ const effectiveThemeSetting = themeProp ?? configTheme ?? "system";
33207
+ const { resolvedTheme, toggleTheme } = useThemePreference(
33208
+ effectiveThemeSetting
33209
+ );
32085
33210
  const defaultDestRef = features.swapDefaultDestToken;
32086
33211
  const lockDestToken = features.swapLockDestToken && !!defaultDestRef;
32087
33212
  const allowedDestTokens = features.swapAllowedDestTokens;
@@ -32091,21 +33216,21 @@ function SwapMode({
32091
33216
  isLoading: chainsLoading,
32092
33217
  error: chainsError
32093
33218
  } = useChains();
32094
- const allowedDestChainIds = useMemo26(() => {
33219
+ const allowedDestChainIds = useMemo27(() => {
32095
33220
  if (!allowedDestTokens || allowedDestTokens.length === 0) return null;
32096
33221
  return new Set(allowedDestTokens.map((t) => t.chainId));
32097
33222
  }, [allowedDestTokens]);
32098
- const toPopularChains = useMemo26(
33223
+ const toPopularChains = useMemo27(
32099
33224
  () => allowedDestChainIds ? popularChains.filter(
32100
33225
  (c) => allowedDestChainIds.has(Number(c.chainId))
32101
33226
  ) : popularChains,
32102
33227
  [popularChains, allowedDestChainIds]
32103
33228
  );
32104
- const toOtherChains = useMemo26(
33229
+ const toOtherChains = useMemo27(
32105
33230
  () => allowedDestChainIds ? otherChains.filter((c) => allowedDestChainIds.has(Number(c.chainId))) : otherChains,
32106
33231
  [otherChains, allowedDestChainIds]
32107
33232
  );
32108
- const allChains = useMemo26(
33233
+ const allChains = useMemo27(
32109
33234
  () => [...popularChains, ...otherChains],
32110
33235
  [popularChains, otherChains]
32111
33236
  );
@@ -32158,18 +33283,18 @@ function SwapMode({
32158
33283
  });
32159
33284
  const route = useSwapRoute();
32160
33285
  const execution = useSwapExecution(fromChain);
32161
- const fromTokenPriceUSD = useMemo26(() => {
33286
+ const fromTokenPriceUSD = useMemo27(() => {
32162
33287
  const p = fromToken?.usdPrice;
32163
33288
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
32164
33289
  }, [fromToken]);
32165
33290
  const hasFromUsdPrice = fromTokenPriceUSD > 0;
32166
- const toTokenPriceUSD = useMemo26(() => {
33291
+ const toTokenPriceUSD = useMemo27(() => {
32167
33292
  const p = toToken?.usdPrice;
32168
33293
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
32169
33294
  }, [toToken]);
32170
33295
  const hasToUsdPrice = toTokenPriceUSD > 0;
32171
33296
  const rawSellNum = parseFloat(amount) || 0;
32172
- const usdSellNum = useMemo26(() => {
33297
+ const usdSellNum = useMemo27(() => {
32173
33298
  if (amountInputMode === "usd") return rawSellNum / currencyRate;
32174
33299
  return hasFromUsdPrice ? rawSellNum * fromTokenPriceUSD : 0;
32175
33300
  }, [
@@ -32179,7 +33304,7 @@ function SwapMode({
32179
33304
  hasFromUsdPrice,
32180
33305
  fromTokenPriceUSD
32181
33306
  ]);
32182
- const tokenSellNum = useMemo26(() => {
33307
+ const tokenSellNum = useMemo27(() => {
32183
33308
  if (amountInputMode === "usd") {
32184
33309
  return hasFromUsdPrice && fromTokenPriceUSD > 0 ? usdSellNum / fromTokenPriceUSD : 0;
32185
33310
  }
@@ -32191,7 +33316,7 @@ function SwapMode({
32191
33316
  hasFromUsdPrice,
32192
33317
  fromTokenPriceUSD
32193
33318
  ]);
32194
- const tokenAmountStr = useMemo26(() => {
33319
+ const tokenAmountStr = useMemo27(() => {
32195
33320
  if (tokenSellNum <= 0) return "";
32196
33321
  const decimals = fromToken?.decimals ?? 18;
32197
33322
  return truncateDecimal(tokenSellNum, Math.min(decimals, 18));
@@ -32398,7 +33523,7 @@ function SwapMode({
32398
33523
  fromToken?.decimals,
32399
33524
  route
32400
33525
  ]);
32401
- const fromBalance = useMemo26(() => {
33526
+ const fromBalance = useMemo27(() => {
32402
33527
  const walletToken = fromToken;
32403
33528
  if (!walletToken || !("balance" in walletToken)) return null;
32404
33529
  const raw = walletToken.balance;
@@ -32408,7 +33533,7 @@ function SwapMode({
32408
33533
  return Number.isFinite(n) ? n : null;
32409
33534
  }, [fromToken]);
32410
33535
  const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
32411
- const estimatedToAmount = useMemo26(() => {
33536
+ const estimatedToAmount = useMemo27(() => {
32412
33537
  if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
32413
33538
  return tokenSellNum * (fromTokenPriceUSD / toTokenPriceUSD);
32414
33539
  }, [
@@ -32418,10 +33543,10 @@ function SwapMode({
32418
33543
  hasFromUsdPrice,
32419
33544
  hasToUsdPrice
32420
33545
  ]);
32421
- const backendToUsdStr = useMemo26(() => {
33546
+ const backendToUsdStr = useMemo27(() => {
32422
33547
  return route.data?.finalExchangeRate?.toAmountMinUSD ?? route.data?.route?.estimate?.toAmountMinUsd ?? route.data?.route?.estimate?.toAmountUsd ?? null;
32423
33548
  }, [route.data]);
32424
- const toAmount = useMemo26(() => {
33549
+ const toAmount = useMemo27(() => {
32425
33550
  if (backendToUsdStr && toTokenPriceUSD > 0) {
32426
33551
  const usd = parseFloat(backendToUsdStr);
32427
33552
  if (Number.isFinite(usd) && usd > 0) return usd / toTokenPriceUSD;
@@ -32447,7 +33572,7 @@ function SwapMode({
32447
33572
  estimatedToAmount
32448
33573
  ]);
32449
33574
  const fromUsd = usdSellNum;
32450
- const toUsd = useMemo26(() => {
33575
+ const toUsd = useMemo27(() => {
32451
33576
  if (backendToUsdStr) {
32452
33577
  const n = parseFloat(backendToUsdStr);
32453
33578
  if (Number.isFinite(n) && n > 0) return n;
@@ -32458,12 +33583,12 @@ function SwapMode({
32458
33583
  const isEstimate = !route.data;
32459
33584
  const USD_EPSILON = 1e-3;
32460
33585
  const displayToUsd = toUsd > USD_EPSILON ? toUsd : estimatedToAmount !== null && hasToUsdPrice ? estimatedToAmount * toTokenPriceUSD : 0;
32461
- const priceImpact = useMemo26(() => {
33586
+ const priceImpact = useMemo27(() => {
32462
33587
  if (!route.data || fromUsd < 0.01 || displayToUsd < 0.01) return null;
32463
33588
  const impact = 1 - displayToUsd / fromUsd;
32464
33589
  return impact > 1e-3 ? impact : null;
32465
33590
  }, [route.data, fromUsd, displayToUsd]);
32466
- const routePath = useMemo26(() => {
33591
+ const routePath = useMemo27(() => {
32467
33592
  if (!route.data) return null;
32468
33593
  const provider = route.data.route?.provider;
32469
33594
  const steps = route.data.route?.steps;
@@ -32490,19 +33615,19 @@ function SwapMode({
32490
33615
  return null;
32491
33616
  }, [route.data, fromToken?.symbol, toToken?.symbol]);
32492
33617
  const isGasSponsored = !!route.data?.sponsorship;
32493
- const networkCostUsd = useMemo26(() => {
33618
+ const networkCostUsd = useMemo27(() => {
32494
33619
  const fees = route.data?.route?.estimate?.fees;
32495
33620
  if (!fees?.length) return null;
32496
33621
  const gasTotal = fees.filter((f) => f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
32497
33622
  return gasTotal > 0 ? gasTotal : null;
32498
33623
  }, [route.data]);
32499
- const protocolFeeUsd = useMemo26(() => {
33624
+ const protocolFeeUsd = useMemo27(() => {
32500
33625
  const fees = route.data?.route?.estimate?.fees;
32501
33626
  if (!fees?.length) return null;
32502
33627
  const total = fees.filter((f) => !f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
32503
33628
  return total > 0 ? total : null;
32504
33629
  }, [route.data]);
32505
- const exchangeRate = useMemo26(() => {
33630
+ const exchangeRate = useMemo27(() => {
32506
33631
  if (!hasFromUsdPrice || !hasToUsdPrice) return null;
32507
33632
  return toTokenPriceUSD / fromTokenPriceUSD;
32508
33633
  }, [fromTokenPriceUSD, toTokenPriceUSD, hasFromUsdPrice, hasToUsdPrice]);
@@ -32647,7 +33772,7 @@ function SwapMode({
32647
33772
  return () => document.removeEventListener("mousedown", handler);
32648
33773
  }, [showCurrencyDropdown]);
32649
33774
  if (stage === "select-from") {
32650
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsx56(
33775
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsx56(
32651
33776
  SwapTokenSelect,
32652
33777
  {
32653
33778
  side: "from",
@@ -32665,7 +33790,7 @@ function SwapMode({
32665
33790
  ) });
32666
33791
  }
32667
33792
  if (stage === "select-to" && !lockDestToken) {
32668
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsx56(
33793
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsx56(
32669
33794
  SwapTokenSelect,
32670
33795
  {
32671
33796
  side: "to",
@@ -32684,7 +33809,7 @@ function SwapMode({
32684
33809
  ) });
32685
33810
  }
32686
33811
  if (stage === "connect-wallet") {
32687
- return /* @__PURE__ */ jsxs45(WidgetContainer, { theme, style, children: [
33812
+ return /* @__PURE__ */ jsxs45(WidgetContainer, { theme: resolvedTheme, style, children: [
32688
33813
  /* @__PURE__ */ jsx56(
32689
33814
  SwapWalletSelector,
32690
33815
  {
@@ -32727,7 +33852,7 @@ function SwapMode({
32727
33852
  const offset = circ - progress / 100 * circ;
32728
33853
  const isApproving = txStatus === "approving";
32729
33854
  const title = isApproving ? "Approving..." : "Order Submitted";
32730
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
33855
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
32731
33856
  /* @__PURE__ */ jsxs45(
32732
33857
  "div",
32733
33858
  {
@@ -33123,7 +34248,7 @@ function SwapMode({
33123
34248
  padding: 0,
33124
34249
  transition: "color 0.15s"
33125
34250
  },
33126
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment8, { children: [
34251
+ children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment9, { children: [
33127
34252
  txHash.slice(0, 6),
33128
34253
  "\u2026",
33129
34254
  txHash.slice(-4),
@@ -33177,7 +34302,7 @@ function SwapMode({
33177
34302
  dateStyle: "medium",
33178
34303
  timeStyle: "short"
33179
34304
  }) ?? null;
33180
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45("div", { style: { position: "relative", overflow: "hidden" }, children: [
34305
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45("div", { style: { position: "relative", overflow: "hidden" }, children: [
33181
34306
  /* @__PURE__ */ jsx56(Suspense2, { fallback: null, children: /* @__PURE__ */ jsx56(ConfettiEffect3, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
33182
34307
  /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[6]} ${spacing[6]} 0` }, children: [
33183
34308
  /* @__PURE__ */ jsxs45(
@@ -33256,30 +34381,58 @@ function SwapMode({
33256
34381
  fontSize: fontSize.sm
33257
34382
  },
33258
34383
  children: [
33259
- /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "You sold" }),
33260
34384
  /* @__PURE__ */ jsxs45(
33261
- "span",
34385
+ "div",
33262
34386
  {
33263
34387
  style: {
33264
- display: "inline-flex",
34388
+ display: "flex",
33265
34389
  alignItems: "center",
33266
- gap: spacing[2],
34390
+ gap: spacing[2]
34391
+ },
34392
+ children: [
34393
+ fromToken?.iconUrl && /* @__PURE__ */ jsxs45("div", { style: { position: "relative", flexShrink: 0 }, children: [
34394
+ /* @__PURE__ */ jsx56(
34395
+ "img",
34396
+ {
34397
+ src: fromToken.iconUrl,
34398
+ alt: "",
34399
+ style: {
34400
+ width: "1.375rem",
34401
+ height: "1.375rem",
34402
+ borderRadius: "9999px"
34403
+ }
34404
+ }
34405
+ ),
34406
+ fromChain?.chainIconURI && /* @__PURE__ */ jsx56(
34407
+ "img",
34408
+ {
34409
+ src: fromChain.chainIconURI,
34410
+ alt: "",
34411
+ style: {
34412
+ position: "absolute",
34413
+ bottom: -2,
34414
+ right: -2,
34415
+ width: "0.625rem",
34416
+ height: "0.625rem",
34417
+ borderRadius: "9999px",
34418
+ border: `1.5px solid ${colors.background}`,
34419
+ objectFit: "cover"
34420
+ }
34421
+ }
34422
+ )
34423
+ ] }),
34424
+ /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "You sold" })
34425
+ ]
34426
+ }
34427
+ ),
34428
+ /* @__PURE__ */ jsxs45(
34429
+ "span",
34430
+ {
34431
+ style: {
33267
34432
  fontWeight: fontWeight.semibold,
33268
34433
  color: colors.foreground
33269
34434
  },
33270
34435
  children: [
33271
- fromToken?.iconUrl && /* @__PURE__ */ jsx56(
33272
- "img",
33273
- {
33274
- src: fromToken.iconUrl,
33275
- style: {
33276
- width: "1.25rem",
33277
- height: "1.25rem",
33278
- borderRadius: "9999px"
33279
- },
33280
- alt: ""
33281
- }
33282
- ),
33283
34436
  fmtAmount(tokenSellNum, 4),
33284
34437
  " ",
33285
34438
  fromToken?.symbol
@@ -33300,30 +34453,58 @@ function SwapMode({
33300
34453
  marginTop: spacing[3]
33301
34454
  },
33302
34455
  children: [
33303
- /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "Received" }),
33304
34456
  /* @__PURE__ */ jsxs45(
33305
- "span",
34457
+ "div",
33306
34458
  {
33307
34459
  style: {
33308
- display: "inline-flex",
34460
+ display: "flex",
33309
34461
  alignItems: "center",
33310
- gap: spacing[2],
34462
+ gap: spacing[2]
34463
+ },
34464
+ children: [
34465
+ toToken?.iconUrl && /* @__PURE__ */ jsxs45("div", { style: { position: "relative", flexShrink: 0 }, children: [
34466
+ /* @__PURE__ */ jsx56(
34467
+ "img",
34468
+ {
34469
+ src: toToken.iconUrl,
34470
+ alt: "",
34471
+ style: {
34472
+ width: "1.375rem",
34473
+ height: "1.375rem",
34474
+ borderRadius: "9999px"
34475
+ }
34476
+ }
34477
+ ),
34478
+ toChain?.chainIconURI && /* @__PURE__ */ jsx56(
34479
+ "img",
34480
+ {
34481
+ src: toChain.chainIconURI,
34482
+ alt: "",
34483
+ style: {
34484
+ position: "absolute",
34485
+ bottom: -2,
34486
+ right: -2,
34487
+ width: "0.625rem",
34488
+ height: "0.625rem",
34489
+ borderRadius: "9999px",
34490
+ border: `1.5px solid ${colors.background}`,
34491
+ objectFit: "cover"
34492
+ }
34493
+ }
34494
+ )
34495
+ ] }),
34496
+ /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "Received" })
34497
+ ]
34498
+ }
34499
+ ),
34500
+ /* @__PURE__ */ jsxs45(
34501
+ "span",
34502
+ {
34503
+ style: {
33311
34504
  fontWeight: fontWeight.semibold,
33312
34505
  color: colors.foreground
33313
34506
  },
33314
34507
  children: [
33315
- toToken?.iconUrl && /* @__PURE__ */ jsx56(
33316
- "img",
33317
- {
33318
- src: toToken.iconUrl,
33319
- style: {
33320
- width: "1.25rem",
33321
- height: "1.25rem",
33322
- borderRadius: "9999px"
33323
- },
33324
- alt: ""
33325
- }
33326
- ),
33327
34508
  finalToAmount !== null ? fmtAmount(finalToAmount, 4) : "\u2014",
33328
34509
  " ",
33329
34510
  toToken?.symbol
@@ -33374,13 +34555,6 @@ function SwapMode({
33374
34555
  value: effectiveRate
33375
34556
  }
33376
34557
  ),
33377
- (fromChain?.networkName ?? fromChain?.axelarChainName) && /* @__PURE__ */ jsx56(
33378
- SuccessReceiptRow,
33379
- {
33380
- label: "Network",
33381
- value: fromChain?.networkName ?? fromChain?.axelarChainName
33382
- }
33383
- ),
33384
34558
  completedStr && /* @__PURE__ */ jsx56(SuccessReceiptRow, { label: "Completed", value: completedStr }),
33385
34559
  txHash && (() => {
33386
34560
  const srcUrl = buildExplorerUrl(
@@ -33689,7 +34863,7 @@ function SwapMode({
33689
34863
  ] }) });
33690
34864
  }
33691
34865
  if (stage === "error") {
33692
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45(
34866
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45(
33693
34867
  "div",
33694
34868
  {
33695
34869
  style: {
@@ -33823,422 +34997,408 @@ function SwapMode({
33823
34997
  if (stage === "review") {
33824
34998
  const reviewToAmount = toAmount ?? displayToAmount;
33825
34999
  const reviewToUsd = toUsd > 0 ? toUsd : displayToUsd;
33826
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45("div", { style: { padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}` }, children: [
33827
- /* @__PURE__ */ jsxs45(
33828
- "div",
33829
- {
33830
- style: {
33831
- display: "flex",
33832
- alignItems: "center",
33833
- justifyContent: "space-between",
33834
- marginBottom: spacing[5]
33835
- },
33836
- children: [
33837
- /* @__PURE__ */ jsx56(
33838
- "span",
33839
- {
33840
- style: {
33841
- fontSize: fontSize.sm,
33842
- fontWeight: fontWeight.medium,
33843
- color: colors.mutedForeground
33844
- },
33845
- children: "You're swapping"
33846
- }
33847
- ),
33848
- /* @__PURE__ */ jsx56(
33849
- "button",
33850
- {
33851
- onClick: () => setStage("home"),
33852
- style: {
33853
- width: "2rem",
33854
- height: "2rem",
33855
- borderRadius: "9999px",
33856
- display: "flex",
33857
- alignItems: "center",
33858
- justifyContent: "center",
33859
- backgroundColor: "transparent",
33860
- border: 0,
33861
- cursor: "pointer"
33862
- },
33863
- children: /* @__PURE__ */ jsx56(
33864
- "svg",
35000
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45(
35001
+ "div",
35002
+ {
35003
+ style: {
35004
+ padding: `${spacing[5]} ${spacing[6]} ${spacing[6]}`,
35005
+ maxHeight: "85vh",
35006
+ overflowY: "auto"
35007
+ },
35008
+ children: [
35009
+ /* @__PURE__ */ jsxs45(
35010
+ "div",
35011
+ {
35012
+ style: {
35013
+ display: "flex",
35014
+ alignItems: "center",
35015
+ justifyContent: "space-between",
35016
+ marginBottom: spacing[5]
35017
+ },
35018
+ children: [
35019
+ /* @__PURE__ */ jsx56(
35020
+ "span",
33865
35021
  {
33866
35022
  style: {
33867
- width: "1.25rem",
33868
- height: "1.25rem",
33869
- color: colors.foreground
35023
+ fontSize: fontSize.sm,
35024
+ fontWeight: fontWeight.medium,
35025
+ color: colors.mutedForeground
33870
35026
  },
33871
- viewBox: "0 0 24 24",
33872
- fill: "none",
33873
- stroke: "currentColor",
33874
- strokeWidth: 2,
33875
- strokeLinecap: "round",
33876
- strokeLinejoin: "round",
33877
- children: /* @__PURE__ */ jsx56("path", { d: "M18 6L6 18M6 6l12 12" })
35027
+ children: "You're swapping"
35028
+ }
35029
+ ),
35030
+ /* @__PURE__ */ jsx56(
35031
+ "button",
35032
+ {
35033
+ onClick: () => setStage("home"),
35034
+ style: {
35035
+ width: "2rem",
35036
+ height: "2rem",
35037
+ borderRadius: "9999px",
35038
+ display: "flex",
35039
+ alignItems: "center",
35040
+ justifyContent: "center",
35041
+ backgroundColor: "transparent",
35042
+ border: 0,
35043
+ cursor: "pointer"
35044
+ },
35045
+ children: /* @__PURE__ */ jsx56(
35046
+ "svg",
35047
+ {
35048
+ style: {
35049
+ width: "1.25rem",
35050
+ height: "1.25rem",
35051
+ color: colors.foreground
35052
+ },
35053
+ viewBox: "0 0 24 24",
35054
+ fill: "none",
35055
+ stroke: "currentColor",
35056
+ strokeWidth: 2,
35057
+ strokeLinecap: "round",
35058
+ strokeLinejoin: "round",
35059
+ children: /* @__PURE__ */ jsx56("path", { d: "M18 6L6 18M6 6l12 12" })
35060
+ }
35061
+ )
33878
35062
  }
33879
35063
  )
33880
- }
33881
- )
33882
- ]
33883
- }
33884
- ),
33885
- /* @__PURE__ */ jsxs45(
33886
- "div",
33887
- {
33888
- style: {
33889
- display: "flex",
33890
- alignItems: "center",
33891
- justifyContent: "space-between"
33892
- },
33893
- children: [
33894
- /* @__PURE__ */ jsxs45("div", { children: [
33895
- /* @__PURE__ */ jsxs45(
33896
- "p",
33897
- {
33898
- style: {
33899
- fontSize: "1.75rem",
33900
- fontWeight: fontWeight.semibold,
33901
- color: colors.foreground,
33902
- lineHeight: 1.2
33903
- },
33904
- children: [
33905
- fmtAmount(tokenSellNum, 5),
33906
- " ",
33907
- fromToken?.symbol
33908
- ]
33909
- }
33910
- ),
33911
- /* @__PURE__ */ jsx56(
33912
- "p",
33913
- {
33914
- style: {
33915
- fontSize: fontSize.sm,
33916
- color: colors.mutedForeground,
33917
- marginTop: "0.125rem"
33918
- },
33919
- children: fmtLocal(fromUsd)
33920
- }
33921
- )
33922
- ] }),
33923
- fromToken?.iconUrl && /* @__PURE__ */ jsx56(
33924
- TokenIcon,
33925
- {
33926
- icon: fromToken.iconUrl,
33927
- chainIcon: fromChain?.chainIconURI,
33928
- size: "lg"
33929
- }
33930
- )
33931
- ]
33932
- }
33933
- ),
33934
- /* @__PURE__ */ jsx56(
33935
- "div",
33936
- {
33937
- style: {
33938
- display: "flex",
33939
- justifyContent: "center",
33940
- margin: `${spacing[3]} 0`
33941
- },
33942
- children: /* @__PURE__ */ jsx56(
33943
- "svg",
35064
+ ]
35065
+ }
35066
+ ),
35067
+ /* @__PURE__ */ jsxs45(
35068
+ "div",
33944
35069
  {
33945
35070
  style: {
33946
- width: "1rem",
33947
- height: "1rem",
33948
- color: colors.mutedForeground
35071
+ display: "flex",
35072
+ alignItems: "center",
35073
+ justifyContent: "space-between"
33949
35074
  },
33950
- viewBox: "0 0 24 24",
33951
- fill: "none",
33952
- stroke: "currentColor",
33953
- strokeWidth: 2,
33954
- strokeLinecap: "round",
33955
- strokeLinejoin: "round",
33956
- children: /* @__PURE__ */ jsx56("path", { d: "M12 5v14m-7-7l7 7 7-7" })
35075
+ children: [
35076
+ /* @__PURE__ */ jsxs45("div", { children: [
35077
+ /* @__PURE__ */ jsxs45(
35078
+ "p",
35079
+ {
35080
+ style: {
35081
+ fontSize: "1.75rem",
35082
+ fontWeight: fontWeight.semibold,
35083
+ color: colors.foreground,
35084
+ lineHeight: 1.2
35085
+ },
35086
+ children: [
35087
+ fmtAmount(tokenSellNum, 5),
35088
+ " ",
35089
+ fromToken?.symbol
35090
+ ]
35091
+ }
35092
+ ),
35093
+ /* @__PURE__ */ jsx56(
35094
+ "p",
35095
+ {
35096
+ style: {
35097
+ fontSize: fontSize.sm,
35098
+ color: colors.mutedForeground,
35099
+ marginTop: "0.125rem"
35100
+ },
35101
+ children: fmtLocal(fromUsd)
35102
+ }
35103
+ )
35104
+ ] }),
35105
+ fromToken?.iconUrl && /* @__PURE__ */ jsx56(
35106
+ TokenIcon,
35107
+ {
35108
+ icon: fromToken.iconUrl,
35109
+ chainIcon: fromChain?.chainIconURI,
35110
+ size: "lg"
35111
+ }
35112
+ )
35113
+ ]
33957
35114
  }
33958
- )
33959
- }
33960
- ),
33961
- /* @__PURE__ */ jsxs45(
33962
- "div",
33963
- {
33964
- style: {
33965
- display: "flex",
33966
- alignItems: "center",
33967
- justifyContent: "space-between"
33968
- },
33969
- children: [
33970
- /* @__PURE__ */ jsxs45("div", { children: [
33971
- /* @__PURE__ */ jsxs45(
33972
- "p",
33973
- {
33974
- style: {
33975
- fontSize: "1.75rem",
33976
- fontWeight: fontWeight.semibold,
33977
- color: colors.foreground,
33978
- lineHeight: 1.2
33979
- },
33980
- children: [
33981
- reviewToAmount !== null ? fmtAmount(reviewToAmount, 5) : "\u2014",
33982
- " ",
33983
- toToken?.symbol
33984
- ]
33985
- }
33986
- ),
33987
- /* @__PURE__ */ jsx56(
33988
- "p",
35115
+ ),
35116
+ /* @__PURE__ */ jsx56(
35117
+ "div",
35118
+ {
35119
+ style: {
35120
+ display: "flex",
35121
+ justifyContent: "center",
35122
+ margin: `${spacing[3]} 0`
35123
+ },
35124
+ children: /* @__PURE__ */ jsx56(
35125
+ "svg",
33989
35126
  {
33990
35127
  style: {
33991
- fontSize: fontSize.sm,
33992
- color: colors.mutedForeground,
33993
- marginTop: "0.125rem"
35128
+ width: "1rem",
35129
+ height: "1rem",
35130
+ color: colors.mutedForeground
33994
35131
  },
33995
- children: fmtLocal(reviewToUsd)
35132
+ viewBox: "0 0 24 24",
35133
+ fill: "none",
35134
+ stroke: "currentColor",
35135
+ strokeWidth: 2,
35136
+ strokeLinecap: "round",
35137
+ strokeLinejoin: "round",
35138
+ children: /* @__PURE__ */ jsx56("path", { d: "M12 5v14m-7-7l7 7 7-7" })
33996
35139
  }
33997
35140
  )
33998
- ] }),
33999
- toToken?.iconUrl && /* @__PURE__ */ jsx56(
34000
- TokenIcon,
34001
- {
34002
- icon: toToken.iconUrl,
34003
- chainIcon: toChain?.chainIconURI,
34004
- size: "lg"
34005
- }
34006
- )
34007
- ]
34008
- }
34009
- ),
34010
- /* @__PURE__ */ jsxs45(
34011
- "button",
34012
- {
34013
- onClick: () => setShowReviewDetails((v) => !v),
34014
- style: {
34015
- margin: `${spacing[5]} 0`,
34016
- display: "flex",
34017
- alignItems: "center",
34018
- gap: spacing[2],
34019
- width: "100%",
34020
- background: "none",
34021
- border: 0,
34022
- cursor: "pointer",
34023
- color: colors.foreground,
34024
- fontSize: fontSize.sm,
34025
- fontWeight: fontWeight.medium
34026
- },
34027
- children: [
34028
- /* @__PURE__ */ jsx56(
34029
- "div",
34030
- {
34031
- style: { flex: 1, height: "1px", backgroundColor: colors.border }
34032
- }
34033
- ),
34034
- /* @__PURE__ */ jsxs45(
34035
- "span",
34036
- {
34037
- style: {
34038
- display: "flex",
34039
- alignItems: "center",
34040
- gap: "0.25rem",
34041
- padding: `0 ${spacing[2]}`,
34042
- whiteSpace: "nowrap"
34043
- },
34044
- children: [
34045
- showReviewDetails ? "Show less" : "Show more",
34046
- /* @__PURE__ */ jsx56(
34047
- "svg",
35141
+ }
35142
+ ),
35143
+ /* @__PURE__ */ jsxs45(
35144
+ "div",
35145
+ {
35146
+ style: {
35147
+ display: "flex",
35148
+ alignItems: "center",
35149
+ justifyContent: "space-between"
35150
+ },
35151
+ children: [
35152
+ /* @__PURE__ */ jsxs45("div", { children: [
35153
+ /* @__PURE__ */ jsxs45(
35154
+ "p",
34048
35155
  {
34049
35156
  style: {
34050
- width: "0.875rem",
34051
- height: "0.875rem",
34052
- transform: showReviewDetails ? "rotate(180deg)" : void 0,
34053
- transition: "transform 0.2s"
35157
+ fontSize: "1.75rem",
35158
+ fontWeight: fontWeight.semibold,
35159
+ color: colors.foreground,
35160
+ lineHeight: 1.2
34054
35161
  },
34055
- viewBox: "0 0 24 24",
34056
- fill: "none",
34057
- stroke: "currentColor",
34058
- strokeWidth: 2,
34059
- strokeLinecap: "round",
34060
- strokeLinejoin: "round",
34061
- children: /* @__PURE__ */ jsx56("path", { d: "M6 9l6 6 6-6" })
35162
+ children: [
35163
+ reviewToAmount !== null ? fmtAmount(reviewToAmount, 5) : "\u2014",
35164
+ " ",
35165
+ toToken?.symbol
35166
+ ]
34062
35167
  }
34063
35168
  ),
34064
- route.data && /* @__PURE__ */ jsxs45(
34065
- "svg",
35169
+ /* @__PURE__ */ jsx56(
35170
+ "p",
34066
35171
  {
34067
- width: "14",
34068
- height: "14",
34069
- viewBox: "0 0 14 14",
34070
35172
  style: {
34071
- transform: "rotate(-90deg)",
34072
- flexShrink: 0,
34073
- opacity: 0.75,
34074
- marginLeft: "0.125rem"
35173
+ fontSize: fontSize.sm,
35174
+ color: colors.mutedForeground,
35175
+ marginTop: "0.125rem"
34075
35176
  },
34076
- children: [
34077
- /* @__PURE__ */ jsx56(
34078
- "circle",
34079
- {
34080
- cx: "7",
34081
- cy: "7",
34082
- r: "5",
34083
- fill: "none",
34084
- stroke: "hsl(var(--tw-border))",
34085
- strokeWidth: "1.5"
34086
- }
34087
- ),
34088
- /* @__PURE__ */ jsx56(
34089
- "circle",
34090
- {
34091
- cx: "7",
34092
- cy: "7",
34093
- r: "5",
34094
- fill: "none",
34095
- stroke: quoteAge >= QUOTE_TTL - 10 ? colors.destructive : colors.primary,
34096
- strokeWidth: "1.5",
34097
- strokeLinecap: "round",
34098
- strokeDasharray: "31.416",
34099
- strokeDashoffset: 31.416 * (quoteAge / QUOTE_TTL),
34100
- style: { transition: "stroke-dashoffset 1s linear" }
34101
- }
34102
- )
34103
- ]
35177
+ children: fmtLocal(reviewToUsd)
34104
35178
  }
34105
35179
  )
34106
- ]
34107
- }
34108
- ),
34109
- /* @__PURE__ */ jsx56(
34110
- "div",
34111
- {
34112
- style: { flex: 1, height: "1px", backgroundColor: colors.border }
34113
- }
34114
- )
34115
- ]
34116
- }
34117
- ),
34118
- /* @__PURE__ */ jsxs45(
34119
- "div",
34120
- {
34121
- style: {
34122
- display: "flex",
34123
- flexDirection: "column",
34124
- gap: spacing[3],
34125
- fontSize: fontSize.sm
34126
- },
34127
- children: [
34128
- showReviewDetails && exchangeRate !== null && /* @__PURE__ */ jsx56(
34129
- ReviewDetailRow,
34130
- {
34131
- label: "Rate",
34132
- tooltip: "Current exchange rate between the two tokens",
34133
- value: `1 ${fromToken?.symbol} = ${fmtAmount(1 / (exchangeRate ?? 1), 4)} ${toToken?.symbol} ($${fmtAmount(fromTokenPriceUSD, 2)})`
34134
- }
34135
- ),
34136
- /* @__PURE__ */ jsx56(
34137
- ReviewDetailRow,
34138
- {
34139
- label: "Fee",
34140
- tooltip: "Protocol fee charged by the bridge or DEX",
34141
- value: /* @__PURE__ */ jsx56(
34142
- "span",
35180
+ ] }),
35181
+ toToken?.iconUrl && /* @__PURE__ */ jsx56(
35182
+ TokenIcon,
34143
35183
  {
34144
- style: {
34145
- color: colors.foreground,
34146
- fontWeight: fontWeight.medium
34147
- },
34148
- children: protocolFeeUsd !== null ? fmtLocal(protocolFeeUsd) : "Free"
35184
+ icon: toToken.iconUrl,
35185
+ chainIcon: toChain?.chainIconURI,
35186
+ size: "lg"
34149
35187
  }
34150
35188
  )
34151
- }
34152
- ),
34153
- /* @__PURE__ */ jsx56(
34154
- ReviewDetailRow,
34155
- {
34156
- label: "Network cost",
34157
- tooltip: "Estimated gas fee paid to the blockchain network",
34158
- value: isGasSponsored ? /* @__PURE__ */ jsx56(SponsoredBadge, {}) : networkCostUsd !== null ? /* @__PURE__ */ jsxs45(
35189
+ ]
35190
+ }
35191
+ ),
35192
+ /* @__PURE__ */ jsxs45(
35193
+ "button",
35194
+ {
35195
+ onClick: () => setShowReviewDetails((v) => !v),
35196
+ style: {
35197
+ margin: `${spacing[5]} 0`,
35198
+ display: "flex",
35199
+ alignItems: "center",
35200
+ gap: spacing[2],
35201
+ width: "100%",
35202
+ background: "none",
35203
+ border: 0,
35204
+ cursor: "pointer",
35205
+ color: colors.mutedForeground,
35206
+ fontSize: fontSize.sm,
35207
+ fontWeight: fontWeight.medium,
35208
+ padding: 0
35209
+ },
35210
+ children: [
35211
+ /* @__PURE__ */ jsx56(
35212
+ "div",
35213
+ {
35214
+ style: { flex: 1, height: "1px", backgroundColor: colors.border }
35215
+ }
35216
+ ),
35217
+ /* @__PURE__ */ jsxs45(
34159
35218
  "span",
34160
35219
  {
34161
35220
  style: {
34162
35221
  display: "flex",
34163
35222
  alignItems: "center",
34164
35223
  gap: "0.25rem",
34165
- color: colors.mutedForeground
35224
+ padding: `0 ${spacing[2]}`,
35225
+ whiteSpace: "nowrap"
34166
35226
  },
34167
35227
  children: [
34168
- /* @__PURE__ */ jsx56(GasIcon, { size: "0.875rem" }),
34169
- fmtLocal(networkCostUsd)
35228
+ showReviewDetails ? "Hide details" : "View details",
35229
+ /* @__PURE__ */ jsx56(
35230
+ "svg",
35231
+ {
35232
+ style: {
35233
+ width: "0.875rem",
35234
+ height: "0.875rem",
35235
+ transform: showReviewDetails ? "rotate(180deg)" : void 0,
35236
+ transition: "transform 0.2s"
35237
+ },
35238
+ viewBox: "0 0 24 24",
35239
+ fill: "none",
35240
+ stroke: "currentColor",
35241
+ strokeWidth: 2,
35242
+ strokeLinecap: "round",
35243
+ strokeLinejoin: "round",
35244
+ children: /* @__PURE__ */ jsx56("path", { d: "M6 9l6 6 6-6" })
35245
+ }
35246
+ ),
35247
+ route.data && /* @__PURE__ */ jsxs45(
35248
+ "svg",
35249
+ {
35250
+ width: "14",
35251
+ height: "14",
35252
+ viewBox: "0 0 14 14",
35253
+ style: {
35254
+ transform: "rotate(-90deg)",
35255
+ flexShrink: 0,
35256
+ opacity: 0.75,
35257
+ marginLeft: "0.125rem"
35258
+ },
35259
+ children: [
35260
+ /* @__PURE__ */ jsx56(
35261
+ "circle",
35262
+ {
35263
+ cx: "7",
35264
+ cy: "7",
35265
+ r: "5",
35266
+ fill: "none",
35267
+ stroke: "hsl(var(--tw-border))",
35268
+ strokeWidth: "1.5"
35269
+ }
35270
+ ),
35271
+ /* @__PURE__ */ jsx56(
35272
+ "circle",
35273
+ {
35274
+ cx: "7",
35275
+ cy: "7",
35276
+ r: "5",
35277
+ fill: "none",
35278
+ stroke: quoteAge >= QUOTE_TTL - 10 ? colors.destructive : colors.primary,
35279
+ strokeWidth: "1.5",
35280
+ strokeLinecap: "round",
35281
+ strokeDasharray: "31.416",
35282
+ strokeDashoffset: 31.416 * (quoteAge / QUOTE_TTL),
35283
+ style: { transition: "stroke-dashoffset 1s linear" }
35284
+ }
35285
+ )
35286
+ ]
35287
+ }
35288
+ )
34170
35289
  ]
34171
35290
  }
34172
- ) : /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: "\u2014" })
34173
- }
34174
- ),
34175
- showReviewDetails && /* @__PURE__ */ jsxs45(Fragment8, { children: [
34176
- /* @__PURE__ */ jsx56(
34177
- ReviewDetailRow,
34178
- {
34179
- label: "Max slippage",
34180
- tooltip: "Max price movement allowed before the swap automatically reverts",
34181
- value: /* @__PURE__ */ jsx56(
34182
- "span",
34183
- {
34184
- style: {
34185
- display: "flex",
34186
- alignItems: "center",
34187
- gap: spacing[1.5]
34188
- },
34189
- children: /* @__PURE__ */ jsxs45("span", { style: { color: colors.mutedForeground }, children: [
34190
- slippage,
34191
- "%"
34192
- ] })
34193
- }
34194
- )
34195
- }
34196
- ),
34197
- (routePath || route.data?.route?.provider) && /* @__PURE__ */ jsx56(
34198
- ReviewDetailRow,
34199
- {
34200
- label: "Route",
34201
- tooltip: "Protocol or bridge used to execute your swap",
34202
- value: /* @__PURE__ */ jsx56(
34203
- "span",
34204
- {
34205
- style: {
34206
- color: colors.foreground,
34207
- overflow: "hidden",
34208
- textOverflow: "ellipsis",
34209
- whiteSpace: "nowrap",
34210
- maxWidth: "200px",
34211
- display: "inline-block",
34212
- verticalAlign: "bottom"
34213
- },
34214
- title: routePath ?? route.data?.route?.provider,
34215
- children: routePath ?? route.data?.route?.provider
34216
- }
34217
- )
34218
- }
34219
- )
34220
- ] })
34221
- ]
34222
- }
34223
- ),
34224
- /* @__PURE__ */ jsx56(
34225
- SwapActionArea,
34226
- {
34227
- fromTokenSymbol: fromToken?.symbol ?? "",
34228
- allowanceStatus: execution.allowanceStatus,
34229
- txStatus: execution.txStatus,
34230
- isSubmitting: execution.isSubmitting,
34231
- isGasSponsored,
34232
- onExecute: () => void handleExecute()
34233
- }
34234
- )
34235
- ] }) });
35291
+ ),
35292
+ /* @__PURE__ */ jsx56(
35293
+ "div",
35294
+ {
35295
+ style: { flex: 1, height: "1px", backgroundColor: colors.border }
35296
+ }
35297
+ )
35298
+ ]
35299
+ }
35300
+ ),
35301
+ showReviewDetails && /* @__PURE__ */ jsxs45(
35302
+ "div",
35303
+ {
35304
+ style: {
35305
+ display: "flex",
35306
+ flexDirection: "column",
35307
+ gap: spacing[3],
35308
+ fontSize: fontSize.sm,
35309
+ marginBottom: spacing[2]
35310
+ },
35311
+ children: [
35312
+ exchangeRate !== null && /* @__PURE__ */ jsx56(
35313
+ ReviewDetailRow,
35314
+ {
35315
+ label: "Rate",
35316
+ tooltip: "Current exchange rate between the two tokens",
35317
+ value: `1 ${fromToken?.symbol} = ${fmtAmount(1 / (exchangeRate ?? 1), 4)} ${toToken?.symbol} ($${fmtAmount(fromTokenPriceUSD, 2)})`
35318
+ }
35319
+ ),
35320
+ /* @__PURE__ */ jsx56(
35321
+ ReviewDetailRow,
35322
+ {
35323
+ label: "Fee",
35324
+ tooltip: "Protocol fee charged by the bridge or DEX",
35325
+ value: protocolFeeUsd !== null ? fmtLocal(protocolFeeUsd) : "Free"
35326
+ }
35327
+ ),
35328
+ /* @__PURE__ */ jsx56(
35329
+ ReviewDetailRow,
35330
+ {
35331
+ label: "Network cost",
35332
+ tooltip: "Estimated gas fee paid to the blockchain network",
35333
+ value: isGasSponsored ? /* @__PURE__ */ jsx56(SponsoredBadge, {}) : networkCostUsd !== null ? /* @__PURE__ */ jsxs45(
35334
+ "span",
35335
+ {
35336
+ style: {
35337
+ display: "flex",
35338
+ alignItems: "center",
35339
+ gap: "0.25rem"
35340
+ },
35341
+ children: [
35342
+ /* @__PURE__ */ jsx56(GasIcon, { size: "0.875rem" }),
35343
+ fmtLocal(networkCostUsd)
35344
+ ]
35345
+ }
35346
+ ) : "\u2014"
35347
+ }
35348
+ ),
35349
+ /* @__PURE__ */ jsx56(
35350
+ ReviewDetailRow,
35351
+ {
35352
+ label: "Max slippage",
35353
+ tooltip: "Max price movement allowed before the swap automatically reverts",
35354
+ value: `${slippage}%`
35355
+ }
35356
+ ),
35357
+ (routePath || route.data?.route?.provider) && /* @__PURE__ */ jsx56(
35358
+ ReviewDetailRow,
35359
+ {
35360
+ label: "Route",
35361
+ tooltip: "Protocol or bridge used to execute your swap",
35362
+ value: /* @__PURE__ */ jsx56(
35363
+ "span",
35364
+ {
35365
+ style: {
35366
+ overflow: "hidden",
35367
+ textOverflow: "ellipsis",
35368
+ whiteSpace: "nowrap",
35369
+ maxWidth: "200px",
35370
+ display: "inline-block",
35371
+ verticalAlign: "bottom"
35372
+ },
35373
+ title: routePath ?? route.data?.route?.provider,
35374
+ children: routePath ?? route.data?.route?.provider
35375
+ }
35376
+ )
35377
+ }
35378
+ )
35379
+ ]
35380
+ }
35381
+ ),
35382
+ /* @__PURE__ */ jsx56(
35383
+ SwapActionArea,
35384
+ {
35385
+ fromTokenSymbol: fromToken?.symbol ?? "",
35386
+ allowanceStatus: execution.allowanceStatus,
35387
+ txStatus: execution.txStatus,
35388
+ isSubmitting: execution.isSubmitting,
35389
+ isGasSponsored,
35390
+ onExecute: () => void handleExecute()
35391
+ }
35392
+ )
35393
+ ]
35394
+ }
35395
+ ) });
34236
35396
  }
34237
35397
  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";
34238
35398
  const ctaDisabled = !hasTokens || !hasAmount || insufficient || isConnected && needsDestAddress && !isValidDestAddress;
34239
35399
  const ctaAction = !isConnected ? handleConnectAndReview : () => void handleReview();
34240
35400
  const showRateRow = hasTokens && exchangeRate !== null;
34241
- return /* @__PURE__ */ jsx56(WidgetContainer, { theme, style, children: /* @__PURE__ */ jsxs45(
35401
+ return /* @__PURE__ */ jsx56(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ jsxs45(
34242
35402
  "div",
34243
35403
  {
34244
35404
  style: { display: "flex", flexDirection: "column", minHeight: "500px" },
@@ -34364,6 +35524,91 @@ function SwapMode({
34364
35524
  zIndex: 100
34365
35525
  },
34366
35526
  children: [
35527
+ /* @__PURE__ */ jsx56(
35528
+ "p",
35529
+ {
35530
+ style: {
35531
+ fontSize: fontSize.xs,
35532
+ fontWeight: fontWeight.semibold,
35533
+ color: colors.mutedForeground,
35534
+ textTransform: "uppercase",
35535
+ letterSpacing: "0.06em",
35536
+ marginBottom: spacing[3]
35537
+ },
35538
+ children: "Appearance"
35539
+ }
35540
+ ),
35541
+ /* @__PURE__ */ jsx56("div", { style: { marginBottom: spacing[4] }, children: /* @__PURE__ */ jsxs45(
35542
+ "div",
35543
+ {
35544
+ style: {
35545
+ display: "flex",
35546
+ alignItems: "center",
35547
+ justifyContent: "space-between"
35548
+ },
35549
+ children: [
35550
+ /* @__PURE__ */ jsxs45("div", { children: [
35551
+ /* @__PURE__ */ jsx56(
35552
+ "p",
35553
+ {
35554
+ style: {
35555
+ fontSize: fontSize.sm,
35556
+ fontWeight: fontWeight.medium,
35557
+ color: colors.foreground
35558
+ },
35559
+ children: "Dark mode"
35560
+ }
35561
+ ),
35562
+ /* @__PURE__ */ jsx56(
35563
+ "p",
35564
+ {
35565
+ style: {
35566
+ fontSize: "0.625rem",
35567
+ color: colors.mutedForeground,
35568
+ marginTop: "2px"
35569
+ },
35570
+ children: resolvedTheme === "dark" ? "Dark theme active" : "Light theme active"
35571
+ }
35572
+ )
35573
+ ] }),
35574
+ /* @__PURE__ */ jsx56(
35575
+ "button",
35576
+ {
35577
+ role: "switch",
35578
+ "aria-checked": resolvedTheme === "dark",
35579
+ onClick: toggleTheme,
35580
+ style: {
35581
+ width: "2.5rem",
35582
+ height: "1.375rem",
35583
+ borderRadius: "9999px",
35584
+ backgroundColor: resolvedTheme === "dark" ? colors.primary : colors.muted,
35585
+ border: 0,
35586
+ cursor: "pointer",
35587
+ position: "relative",
35588
+ transition: "background-color 0.2s",
35589
+ flexShrink: 0
35590
+ },
35591
+ children: /* @__PURE__ */ jsx56(
35592
+ "span",
35593
+ {
35594
+ style: {
35595
+ position: "absolute",
35596
+ top: "0.1875rem",
35597
+ left: resolvedTheme === "dark" ? "calc(100% - 1rem - 0.1875rem)" : "0.1875rem",
35598
+ width: "1rem",
35599
+ height: "1rem",
35600
+ borderRadius: "9999px",
35601
+ backgroundColor: colors.primaryForeground,
35602
+ transition: "left 0.2s",
35603
+ display: "block"
35604
+ }
35605
+ }
35606
+ )
35607
+ }
35608
+ )
35609
+ ]
35610
+ }
35611
+ ) }),
34367
35612
  /* @__PURE__ */ jsx56(
34368
35613
  "p",
34369
35614
  {
@@ -35218,7 +36463,8 @@ function SwapMode({
35218
36463
  fontSize: fontSize.base,
35219
36464
  fontWeight: fontWeight.semibold,
35220
36465
  border: 0,
35221
- transition: "all 0.2s"
36466
+ transition: "all 0.2s",
36467
+ marginBottom: spacing[3]
35222
36468
  },
35223
36469
  !ctaDisabled ? {
35224
36470
  backgroundColor: colors.primary,
@@ -35516,12 +36762,15 @@ function SwapActionArea({
35516
36762
  fontSize: fontSize.xs,
35517
36763
  color: colors.mutedForeground,
35518
36764
  textAlign: "center",
35519
- marginTop: spacing[2]
36765
+ marginTop: spacing[2],
36766
+ whiteSpace: "nowrap",
36767
+ overflow: "hidden",
36768
+ textOverflow: "ellipsis"
35520
36769
  },
35521
36770
  children: [
35522
- "You'll approve ",
36771
+ "Approve ",
35523
36772
  fromTokenSymbol,
35524
- " spend, then confirm the swap \u2014 2 wallet steps."
36773
+ " access, then confirm swap \u2014 2 steps."
35525
36774
  ]
35526
36775
  }
35527
36776
  )
@@ -35736,7 +36985,14 @@ function ReviewDetailRow({
35736
36985
  value,
35737
36986
  tooltip
35738
36987
  }) {
35739
- const [tipVisible, setTipVisible] = useState28(false);
36988
+ const iconRef = useRef17(null);
36989
+ const [tipPos, setTipPos] = useState29(null);
36990
+ const handleMouseEnter = () => {
36991
+ if (!tooltip || !iconRef.current) return;
36992
+ const r = iconRef.current.getBoundingClientRect();
36993
+ setTipPos({ x: r.left + r.width / 2, y: r.top - 8 });
36994
+ };
36995
+ const handleMouseLeave = () => setTipPos(null);
35740
36996
  return /* @__PURE__ */ jsxs45(
35741
36997
  "div",
35742
36998
  {
@@ -35757,66 +37013,65 @@ function ReviewDetailRow({
35757
37013
  },
35758
37014
  children: [
35759
37015
  label,
35760
- /* @__PURE__ */ jsxs45(
37016
+ /* @__PURE__ */ jsx56(
35761
37017
  "span",
35762
37018
  {
35763
- style: {
35764
- position: "relative",
35765
- display: "inline-flex",
35766
- alignItems: "center"
35767
- },
35768
- onMouseEnter: () => setTipVisible(true),
35769
- onMouseLeave: () => setTipVisible(false),
35770
- children: [
35771
- /* @__PURE__ */ jsxs45(
35772
- "svg",
35773
- {
35774
- style: {
35775
- width: "0.875rem",
35776
- height: "0.875rem",
35777
- opacity: 0.6,
35778
- cursor: tooltip ? "help" : "default"
35779
- },
35780
- viewBox: "0 0 24 24",
35781
- fill: "none",
35782
- stroke: "currentColor",
35783
- strokeWidth: 2,
35784
- strokeLinecap: "round",
35785
- strokeLinejoin: "round",
35786
- children: [
35787
- /* @__PURE__ */ jsx56("circle", { cx: "12", cy: "12", r: "10" }),
35788
- /* @__PURE__ */ jsx56("path", { d: "M12 16v-4M12 8h.01" })
35789
- ]
35790
- }
35791
- ),
35792
- tooltip && tipVisible && /* @__PURE__ */ jsx56(
35793
- "span",
35794
- {
35795
- style: {
35796
- position: "absolute",
35797
- bottom: "calc(100% + 6px)",
35798
- left: "50%",
35799
- transform: "translateX(-50%)",
35800
- backgroundColor: "hsl(var(--tw-foreground))",
35801
- color: "hsl(var(--tw-background))",
35802
- fontSize: "0.6875rem",
35803
- lineHeight: 1.4,
35804
- padding: "0.25rem 0.5rem",
35805
- borderRadius: "0.375rem",
35806
- whiteSpace: "nowrap",
35807
- pointerEvents: "none",
35808
- zIndex: 50
35809
- },
35810
- children: tooltip
35811
- }
35812
- )
35813
- ]
37019
+ ref: iconRef,
37020
+ style: { display: "inline-flex", alignItems: "center" },
37021
+ onMouseEnter: handleMouseEnter,
37022
+ onMouseLeave: handleMouseLeave,
37023
+ children: /* @__PURE__ */ jsxs45(
37024
+ "svg",
37025
+ {
37026
+ style: {
37027
+ width: "0.875rem",
37028
+ height: "0.875rem",
37029
+ opacity: 0.6,
37030
+ cursor: tooltip ? "help" : "default"
37031
+ },
37032
+ viewBox: "0 0 24 24",
37033
+ fill: "none",
37034
+ stroke: "currentColor",
37035
+ strokeWidth: 2,
37036
+ strokeLinecap: "round",
37037
+ strokeLinejoin: "round",
37038
+ children: [
37039
+ /* @__PURE__ */ jsx56("circle", { cx: "12", cy: "12", r: "10" }),
37040
+ /* @__PURE__ */ jsx56("path", { d: "M12 16v-4M12 8h.01" })
37041
+ ]
37042
+ }
37043
+ )
35814
37044
  }
35815
37045
  )
35816
37046
  ]
35817
37047
  }
35818
37048
  ),
35819
- /* @__PURE__ */ jsx56("span", { style: { color: colors.mutedForeground }, children: value })
37049
+ /* @__PURE__ */ jsx56("span", { style: { color: colors.foreground, fontWeight: fontWeight.medium }, children: value }),
37050
+ tooltip && tipPos && typeof document !== "undefined" && ReactDOM.createPortal(
37051
+ /* @__PURE__ */ jsx56(
37052
+ "span",
37053
+ {
37054
+ style: {
37055
+ position: "fixed",
37056
+ left: tipPos.x,
37057
+ top: tipPos.y,
37058
+ transform: "translate(-50%, -100%)",
37059
+ backgroundColor: "hsl(220 15% 15%)",
37060
+ color: "#fff",
37061
+ fontSize: "0.6875rem",
37062
+ lineHeight: 1.4,
37063
+ padding: "0.3rem 0.6rem",
37064
+ borderRadius: "0.375rem",
37065
+ whiteSpace: "nowrap",
37066
+ pointerEvents: "none",
37067
+ zIndex: 99999,
37068
+ boxShadow: "0 4px 12px rgba(0,0,0,0.25)"
37069
+ },
37070
+ children: tooltip
37071
+ }
37072
+ ),
37073
+ document.body
37074
+ )
35820
37075
  ]
35821
37076
  }
35822
37077
  );
@@ -36018,6 +37273,7 @@ var init_SwapMode = __esm({
36018
37273
  init_utils();
36019
37274
  init_components();
36020
37275
  init_registryClient();
37276
+ init_useThemePreference();
36021
37277
  init_useWalletSessionState();
36022
37278
  init_useWalletTokenState();
36023
37279
  init_hooks2();
@@ -36054,14 +37310,14 @@ var init_swap = __esm({
36054
37310
 
36055
37311
  // src/widget/TrustwareWidgetV2.tsx
36056
37312
  import {
36057
- useState as useState29,
37313
+ useState as useState30,
36058
37314
  useEffect as useEffect31,
36059
37315
  useRef as useRef18,
36060
37316
  useCallback as useCallback23,
36061
37317
  useImperativeHandle,
36062
37318
  forwardRef
36063
37319
  } from "react";
36064
- import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
37320
+ import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs46 } from "react/jsx-runtime";
36065
37321
  function WidgetContent({
36066
37322
  style,
36067
37323
  onStateChange,
@@ -36115,7 +37371,7 @@ function WidgetInner({
36115
37371
  const { transactionStatus } = useDepositTransaction();
36116
37372
  const { resolvedTheme } = useDepositUi();
36117
37373
  const { status, revalidate, errors } = useTrustware();
36118
- const [showConfirmDialog, setShowConfirmDialog] = useState29(false);
37374
+ const [showConfirmDialog, setShowConfirmDialog] = useState30(false);
36119
37375
  const handleCloseRequest = useCallback23(() => {
36120
37376
  if (ACTIVE_TRANSACTION_STATUSES.includes(transactionStatus)) {
36121
37377
  setShowConfirmDialog(true);
@@ -36143,7 +37399,7 @@ function WidgetInner({
36143
37399
  const handleRefresh = useCallback23(() => {
36144
37400
  revalidate?.();
36145
37401
  }, [revalidate]);
36146
- return /* @__PURE__ */ jsxs46(Fragment9, { children: [
37402
+ return /* @__PURE__ */ jsxs46(Fragment10, { children: [
36147
37403
  /* @__PURE__ */ jsxs46(WidgetContainer, { theme: effectiveTheme, style, children: [
36148
37404
  /* @__PURE__ */ jsx57(
36149
37405
  WidgetContent,
@@ -36203,7 +37459,7 @@ var init_TrustwareWidgetV2 = __esm({
36203
37459
  zIndex: 12
36204
37460
  };
36205
37461
  TrustwareWidgetV2 = forwardRef(function TrustwareWidgetV22({
36206
- theme = "system",
37462
+ theme,
36207
37463
  style,
36208
37464
  initialStep = "home",
36209
37465
  defaultOpen = true,
@@ -36211,7 +37467,7 @@ var init_TrustwareWidgetV2 = __esm({
36211
37467
  onOpen,
36212
37468
  showThemeToggle = true
36213
37469
  }, ref) {
36214
- const [isOpen, setIsOpen] = useState29(defaultOpen);
37470
+ const [isOpen, setIsOpen] = useState30(defaultOpen);
36215
37471
  const closeRequestRef = useRef18(null);
36216
37472
  const config = useTrustwareConfig();
36217
37473
  const effectiveInitialStep = initialStep;