@unifold/ui-react 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +271 -154
- package/dist/index.mjs +285 -158
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -121,10 +121,7 @@ var DialogTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
121
121
|
DialogPrimitive.Title,
|
|
122
122
|
{
|
|
123
123
|
ref,
|
|
124
|
-
className: cn(
|
|
125
|
-
"uf-leading-none uf-tracking-tight",
|
|
126
|
-
className
|
|
127
|
-
),
|
|
124
|
+
className: cn("uf-leading-none uf-tracking-tight", className),
|
|
128
125
|
...props
|
|
129
126
|
}
|
|
130
127
|
));
|
|
@@ -150,7 +147,8 @@ import {
|
|
|
150
147
|
ShieldCheck,
|
|
151
148
|
Clock,
|
|
152
149
|
FileText,
|
|
153
|
-
ChevronRight as ChevronRight2
|
|
150
|
+
ChevronRight as ChevronRight2,
|
|
151
|
+
Copy
|
|
154
152
|
} from "lucide-react";
|
|
155
153
|
|
|
156
154
|
// src/components/deposits/StyledQRCode.tsx
|
|
@@ -286,7 +284,10 @@ function DepositHeader({
|
|
|
286
284
|
|
|
287
285
|
// src/components/deposits/DepositExecutionItem.tsx
|
|
288
286
|
import { ChevronRight } from "lucide-react";
|
|
289
|
-
import {
|
|
287
|
+
import {
|
|
288
|
+
ExecutionStatus,
|
|
289
|
+
getIconUrl
|
|
290
|
+
} from "@unifold/core";
|
|
290
291
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
291
292
|
function DepositExecutionItem({
|
|
292
293
|
execution,
|
|
@@ -359,16 +360,26 @@ function DepositExecutionItem({
|
|
|
359
360
|
}
|
|
360
361
|
)
|
|
361
362
|
}
|
|
362
|
-
) }) : /* @__PURE__ */ jsx5("div", { className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-bg-green-500 uf-rounded-full uf-p-0.5", children: /* @__PURE__ */ jsx5(
|
|
363
|
-
"
|
|
363
|
+
) }) : /* @__PURE__ */ jsx5("div", { className: "uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-bg-green-500 uf-rounded-full uf-p-0.5", children: /* @__PURE__ */ jsx5(
|
|
364
|
+
"svg",
|
|
364
365
|
{
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
366
|
+
width: "10",
|
|
367
|
+
height: "10",
|
|
368
|
+
viewBox: "0 0 12 12",
|
|
369
|
+
fill: "none",
|
|
370
|
+
className: "uf-block",
|
|
371
|
+
children: /* @__PURE__ */ jsx5(
|
|
372
|
+
"path",
|
|
373
|
+
{
|
|
374
|
+
d: "M10 3L4.5 8.5L2 6",
|
|
375
|
+
stroke: "white",
|
|
376
|
+
strokeWidth: "2",
|
|
377
|
+
strokeLinecap: "round",
|
|
378
|
+
strokeLinejoin: "round"
|
|
379
|
+
}
|
|
380
|
+
)
|
|
370
381
|
}
|
|
371
|
-
) })
|
|
382
|
+
) })
|
|
372
383
|
] }),
|
|
373
384
|
/* @__PURE__ */ jsxs3("div", { className: "uf-flex-1 uf-min-w-0", children: [
|
|
374
385
|
/* @__PURE__ */ jsx5("h3", { className: "uf-text-foreground uf-font-medium uf-text-sm uf-leading-tight", children: isPending ? "Deposit processing" : "Deposit completed" }),
|
|
@@ -551,7 +562,10 @@ function DepositDetailContent({ execution }) {
|
|
|
551
562
|
/* @__PURE__ */ jsxs4("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
552
563
|
/* @__PURE__ */ jsx6("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Sent" }),
|
|
553
564
|
/* @__PURE__ */ jsxs4("span", { className: "uf-text-foreground uf-font-medium", children: [
|
|
554
|
-
formatAmount(
|
|
565
|
+
formatAmount(
|
|
566
|
+
execution.source_amount_base_unit,
|
|
567
|
+
execution.source_token_metadata?.decimals
|
|
568
|
+
),
|
|
555
569
|
" ",
|
|
556
570
|
formatCurrency(execution.source_currency)
|
|
557
571
|
] })
|
|
@@ -559,22 +573,34 @@ function DepositDetailContent({ execution }) {
|
|
|
559
573
|
/* @__PURE__ */ jsxs4("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
560
574
|
/* @__PURE__ */ jsx6("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Received" }),
|
|
561
575
|
/* @__PURE__ */ jsxs4("span", { className: "uf-text-foreground uf-font-medium", children: [
|
|
562
|
-
formatAmount(
|
|
576
|
+
formatAmount(
|
|
577
|
+
execution.destination_amount_base_unit,
|
|
578
|
+
execution.destination_token_metadata?.decimals
|
|
579
|
+
),
|
|
563
580
|
" ",
|
|
564
581
|
formatCurrency(execution.destination_currency)
|
|
565
582
|
] })
|
|
566
583
|
] }),
|
|
567
584
|
/* @__PURE__ */ jsxs4("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
568
585
|
/* @__PURE__ */ jsx6("span", { className: "uf-text-muted-foreground uf-text-sm", children: "USD Value" }),
|
|
569
|
-
/* @__PURE__ */ jsx6("span", { className: "uf-text-foreground uf-font-medium", children: formatUsdAmount(
|
|
586
|
+
/* @__PURE__ */ jsx6("span", { className: "uf-text-foreground uf-font-medium", children: formatUsdAmount(
|
|
587
|
+
execution.source_amount_usd,
|
|
588
|
+
execution.source_amount_base_unit
|
|
589
|
+
) })
|
|
570
590
|
] }),
|
|
571
591
|
/* @__PURE__ */ jsxs4("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
572
592
|
/* @__PURE__ */ jsx6("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Source Network" }),
|
|
573
|
-
/* @__PURE__ */ jsx6("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
593
|
+
/* @__PURE__ */ jsx6("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
594
|
+
execution.source_chain_type,
|
|
595
|
+
execution.source_chain_id
|
|
596
|
+
) })
|
|
574
597
|
] }),
|
|
575
598
|
/* @__PURE__ */ jsxs4("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3", children: [
|
|
576
599
|
/* @__PURE__ */ jsx6("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Destination Network" }),
|
|
577
|
-
/* @__PURE__ */ jsx6("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
600
|
+
/* @__PURE__ */ jsx6("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
601
|
+
execution.destination_chain_type,
|
|
602
|
+
execution.destination_chain_id
|
|
603
|
+
) })
|
|
578
604
|
] })
|
|
579
605
|
] }),
|
|
580
606
|
/* @__PURE__ */ jsxs4(
|
|
@@ -613,7 +639,9 @@ function DepositDetailContent({ execution }) {
|
|
|
613
639
|
className: "uf-grid uf-grid-cols-[auto_1fr_auto] uf-items-center uf-gap-2 uf-px-4 uf-py-3 hover:uf-bg-card/50 uf-transition-colors",
|
|
614
640
|
children: [
|
|
615
641
|
/* @__PURE__ */ jsx6("div", { className: "uf-text-muted-foreground uf-text-sm", children: "Completion Tx" }),
|
|
616
|
-
/* @__PURE__ */ jsx6("div", { className: "uf-text-sm uf-text-foreground uf-text-right", children: formatTransactionHash(
|
|
642
|
+
/* @__PURE__ */ jsx6("div", { className: "uf-text-sm uf-text-foreground uf-text-right", children: formatTransactionHash(
|
|
643
|
+
execution.destination_transaction_hashes[0]
|
|
644
|
+
) }),
|
|
617
645
|
/* @__PURE__ */ jsx6(ExternalLink, { className: "uf-w-3.5 uf-h-3.5 uf-text-muted-foreground uf-block" })
|
|
618
646
|
]
|
|
619
647
|
}
|
|
@@ -677,42 +705,51 @@ function DepositsModal({
|
|
|
677
705
|
const handleExecutionClick = (execution) => {
|
|
678
706
|
setSelectedExecution(execution);
|
|
679
707
|
};
|
|
680
|
-
return /* @__PURE__ */ jsx7(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx7(
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
{
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
708
|
+
return /* @__PURE__ */ jsx7(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsx7(
|
|
709
|
+
DialogContent,
|
|
710
|
+
{
|
|
711
|
+
className: `sm:uf-max-w-[400px] !uf-bg-card uf-border-secondary uf-text-foreground uf-p-0 uf-gap-0 [&>button]:uf-hidden ${themeClass}`,
|
|
712
|
+
children: selectedExecution ? /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
713
|
+
/* @__PURE__ */ jsx7(
|
|
714
|
+
DepositHeader,
|
|
715
|
+
{
|
|
716
|
+
title: "Deposit Details",
|
|
717
|
+
showBack: true,
|
|
718
|
+
onBack: () => setSelectedExecution(null),
|
|
719
|
+
onClose: handleClose
|
|
720
|
+
}
|
|
721
|
+
),
|
|
722
|
+
/* @__PURE__ */ jsx7(DepositDetailContent, { execution: selectedExecution })
|
|
723
|
+
] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
724
|
+
/* @__PURE__ */ jsx7(
|
|
725
|
+
DepositHeader,
|
|
726
|
+
{
|
|
727
|
+
title: "Deposit Tracker",
|
|
728
|
+
showBack: true,
|
|
729
|
+
onBack: handleBack,
|
|
730
|
+
onClose: handleClose
|
|
731
|
+
}
|
|
732
|
+
),
|
|
733
|
+
/* @__PURE__ */ jsx7("div", { className: "uf-max-h-[400px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: /* @__PURE__ */ jsx7("div", { className: "uf-space-y-2", children: allExecutions.length === 0 ? /* @__PURE__ */ jsx7("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ jsx7("div", { className: "uf-text-muted-foreground uf-text-sm", children: "No deposits yet" }) }) : /* @__PURE__ */ jsx7(Fragment, { children: allExecutions.map((execution) => /* @__PURE__ */ jsx7(
|
|
734
|
+
DepositExecutionItem,
|
|
735
|
+
{
|
|
736
|
+
execution,
|
|
737
|
+
onClick: () => handleExecutionClick(execution)
|
|
738
|
+
},
|
|
739
|
+
execution.id
|
|
740
|
+
)) }) }) })
|
|
741
|
+
] })
|
|
742
|
+
}
|
|
743
|
+
) });
|
|
710
744
|
}
|
|
711
745
|
|
|
712
746
|
// src/components/deposits/DepositSuccessToast.tsx
|
|
713
747
|
import { useState as useState3 } from "react";
|
|
714
748
|
import { X as X3 } from "lucide-react";
|
|
715
|
-
import {
|
|
749
|
+
import {
|
|
750
|
+
ExecutionStatus as ExecutionStatus3,
|
|
751
|
+
getIconUrl as getIconUrl3
|
|
752
|
+
} from "@unifold/core";
|
|
716
753
|
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
717
754
|
function DepositSuccessToast({
|
|
718
755
|
depositTx,
|
|
@@ -858,22 +895,28 @@ function DepositSuccessToast({
|
|
|
858
895
|
}
|
|
859
896
|
)
|
|
860
897
|
] }) }),
|
|
861
|
-
execution && /* @__PURE__ */ jsx8(Dialog, { open: detailModalOpen, onOpenChange: setDetailModalOpen, children: /* @__PURE__ */ jsxs6(
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
898
|
+
execution && /* @__PURE__ */ jsx8(Dialog, { open: detailModalOpen, onOpenChange: setDetailModalOpen, children: /* @__PURE__ */ jsxs6(
|
|
899
|
+
DialogContent,
|
|
900
|
+
{
|
|
901
|
+
className: `sm:uf-max-w-[400px] !uf-bg-card uf-border-secondary uf-text-foreground uf-p-0 uf-mt-8 uf-gap-0 [&>button]:uf-hidden ${themeClass}`,
|
|
902
|
+
children: [
|
|
903
|
+
/* @__PURE__ */ jsxs6("div", { className: "uf-flex uf-items-center uf-justify-between uf-px-4", children: [
|
|
904
|
+
/* @__PURE__ */ jsx8("div", { className: "uf-w-8" }),
|
|
905
|
+
" ",
|
|
906
|
+
/* @__PURE__ */ jsx8("h2", { className: "uf-text-lg uf-font-semibold uf-text-foreground", children: "Deposit Details" }),
|
|
907
|
+
/* @__PURE__ */ jsx8(
|
|
908
|
+
"button",
|
|
909
|
+
{
|
|
910
|
+
onClick: () => setDetailModalOpen(false),
|
|
911
|
+
className: "uf-text-muted-foreground hover:uf-text-foreground uf-transition-colors uf-w-8 uf-flex uf-justify-end",
|
|
912
|
+
children: /* @__PURE__ */ jsx8(X3, { className: "uf-w-5 uf-h-5" })
|
|
913
|
+
}
|
|
914
|
+
)
|
|
915
|
+
] }),
|
|
916
|
+
/* @__PURE__ */ jsx8(DepositDetailContent, { execution })
|
|
917
|
+
]
|
|
918
|
+
}
|
|
919
|
+
) })
|
|
877
920
|
] });
|
|
878
921
|
}
|
|
879
922
|
|
|
@@ -963,7 +1006,10 @@ var SelectLabel = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
963
1006
|
SelectPrimitive.Label,
|
|
964
1007
|
{
|
|
965
1008
|
ref,
|
|
966
|
-
className: cn(
|
|
1009
|
+
className: cn(
|
|
1010
|
+
"uf-py-1.5 uf-pl-8 uf-pr-2 uf-text-sm uf-font-semibold",
|
|
1011
|
+
className
|
|
1012
|
+
),
|
|
967
1013
|
...props
|
|
968
1014
|
}
|
|
969
1015
|
));
|
|
@@ -1224,7 +1270,9 @@ function TransferCryptoBase({
|
|
|
1224
1270
|
} catch (err) {
|
|
1225
1271
|
console.error("Error fetching wallets, retrying in 5s:", err);
|
|
1226
1272
|
if (!isCancelled) {
|
|
1227
|
-
setError(
|
|
1273
|
+
setError(
|
|
1274
|
+
err instanceof Error ? err.message : "Failed to load wallets"
|
|
1275
|
+
);
|
|
1228
1276
|
setLoading(false);
|
|
1229
1277
|
retryTimeout = setTimeout(fetchWallets, 5e3);
|
|
1230
1278
|
}
|
|
@@ -1469,21 +1517,28 @@ function TransferCryptoBase({
|
|
|
1469
1517
|
disabled: tokensLoading || availableChainsForToken.length === 0,
|
|
1470
1518
|
children: [
|
|
1471
1519
|
/* @__PURE__ */ jsx11(SelectTrigger, { className: "uf-bg-secondary uf-border-none uf-rounded-lg uf-h-10 hover:uf-bg-accent uf-text-foreground focus:uf-ring-1 focus:uf-ring-ring disabled:uf-opacity-50", children: /* @__PURE__ */ jsx11(SelectValue, { children: tokensLoading ? /* @__PURE__ */ jsx11("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx11("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ jsx11("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ jsx11("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
|
|
1472
|
-
/* @__PURE__ */ jsx11(
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1520
|
+
/* @__PURE__ */ jsx11(
|
|
1521
|
+
SelectContent,
|
|
1522
|
+
{
|
|
1523
|
+
align: "end",
|
|
1524
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
|
|
1525
|
+
children: availableChainsForToken.length === 0 ? /* @__PURE__ */ jsx11("div", { className: "uf-px-2 uf-py-3 uf-text-xs uf-text-muted-foreground uf-text-center", children: t.noChainsAvailable }) : availableChainsForToken.map((chainData) => {
|
|
1526
|
+
const chainKey = getChainKey(
|
|
1527
|
+
chainData.chain_id,
|
|
1528
|
+
chainData.chain_type
|
|
1529
|
+
);
|
|
1530
|
+
return /* @__PURE__ */ jsx11(
|
|
1531
|
+
SelectItem,
|
|
1532
|
+
{
|
|
1533
|
+
value: chainKey,
|
|
1534
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
1535
|
+
children: renderChainItem(chainData, true)
|
|
1536
|
+
},
|
|
1537
|
+
`${chainData.chain_id}-${chainData.chain_type}`
|
|
1538
|
+
);
|
|
1539
|
+
})
|
|
1540
|
+
}
|
|
1541
|
+
)
|
|
1487
1542
|
]
|
|
1488
1543
|
}
|
|
1489
1544
|
)
|
|
@@ -1540,22 +1595,31 @@ function TransferCryptoBase({
|
|
|
1540
1595
|
)
|
|
1541
1596
|
] })
|
|
1542
1597
|
] }),
|
|
1543
|
-
/* @__PURE__ */ jsxs8(
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1598
|
+
/* @__PURE__ */ jsxs8(
|
|
1599
|
+
"span",
|
|
1600
|
+
{
|
|
1601
|
+
className: `uf-flex uf-items-center uf-gap-1 uf-text-green-500 uf-transition-opacity uf-duration-200 ${copied ? "uf-opacity-100" : "uf-opacity-0"}`,
|
|
1602
|
+
children: [
|
|
1603
|
+
/* @__PURE__ */ jsx11(Check2, { className: "uf-w-3 uf-h-3" }),
|
|
1604
|
+
t.copied
|
|
1605
|
+
]
|
|
1606
|
+
}
|
|
1607
|
+
)
|
|
1547
1608
|
] }),
|
|
1548
|
-
loading ? /* @__PURE__ */ jsx11("div", { className: "uf-bg-secondary uf-rounded-lg uf-px-3 uf-py-2.5 uf-text-xs uf-text-muted-foreground uf-animate-pulse", children: t.loading }) : error ? /* @__PURE__ */ jsx11("div", { className: "uf-bg-secondary uf-rounded-lg uf-px-3 uf-py-2.5 uf-text-xs uf-text-red-400", children: error }) : /* @__PURE__ */
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1609
|
+
loading ? /* @__PURE__ */ jsx11("div", { className: "uf-bg-secondary uf-rounded-lg uf-px-3 uf-py-2.5 uf-text-xs uf-text-muted-foreground uf-animate-pulse", children: t.loading }) : error ? /* @__PURE__ */ jsx11("div", { className: "uf-bg-secondary uf-rounded-lg uf-px-3 uf-py-2.5 uf-text-xs uf-text-red-400", children: error }) : /* @__PURE__ */ jsxs8("div", { className: "uf-relative", children: [
|
|
1610
|
+
/* @__PURE__ */ jsx11(
|
|
1611
|
+
"button",
|
|
1612
|
+
{
|
|
1613
|
+
onClick: handleCopyAddress,
|
|
1614
|
+
disabled: !depositAddress,
|
|
1615
|
+
className: "uf-w-full uf-bg-secondary hover:uf-bg-accent uf-rounded-lg uf-px-2.5 uf-py-2.5 uf-text-xs uf-font-mono uf-break-all uf-text-left uf-transition-colors uf-cursor-pointer disabled:uf-opacity-50 disabled:uf-cursor-not-allowed",
|
|
1616
|
+
children: depositAddress || t.noAddressAvailable
|
|
1617
|
+
}
|
|
1618
|
+
),
|
|
1619
|
+
depositAddress && /* @__PURE__ */ jsx11("span", { className: "uf-absolute uf-right-3 uf-top-1/2 uf--translate-y-1/2 uf-text-muted-foreground uf-pointer-events-none", children: /* @__PURE__ */ jsx11(Copy, { className: "uf-w-3 uf-h-3" }) })
|
|
1620
|
+
] })
|
|
1557
1621
|
] }),
|
|
1558
|
-
/* @__PURE__ */ jsxs8("div", { className: "uf-bg-secondary uf-rounded-xl uf-px-
|
|
1622
|
+
/* @__PURE__ */ jsxs8("div", { className: "uf-bg-secondary uf-rounded-xl uf-px-2.5", children: [
|
|
1559
1623
|
/* @__PURE__ */ jsxs8(
|
|
1560
1624
|
"button",
|
|
1561
1625
|
{
|
|
@@ -1849,52 +1913,58 @@ function CurrencyModal({
|
|
|
1849
1913
|
onOpenChange(false);
|
|
1850
1914
|
setSearchQuery("");
|
|
1851
1915
|
};
|
|
1852
|
-
return /* @__PURE__ */ jsx15(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs11(
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
{
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
{
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1916
|
+
return /* @__PURE__ */ jsx15(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs11(
|
|
1917
|
+
DialogContent,
|
|
1918
|
+
{
|
|
1919
|
+
className: `sm:uf-max-w-[400px] !uf-bg-card uf-border-secondary uf-text-foreground uf-p-0 uf-gap-0 [&>button]:uf-hidden ${themeClass}`,
|
|
1920
|
+
children: [
|
|
1921
|
+
/* @__PURE__ */ jsx15(
|
|
1922
|
+
DepositHeader,
|
|
1923
|
+
{
|
|
1924
|
+
title: "Currency",
|
|
1925
|
+
showBack: true,
|
|
1926
|
+
onBack: handleClose,
|
|
1927
|
+
onClose: handleClose
|
|
1928
|
+
}
|
|
1929
|
+
),
|
|
1930
|
+
/* @__PURE__ */ jsx15("div", { children: /* @__PURE__ */ jsxs11("div", { className: "uf-relative", children: [
|
|
1931
|
+
/* @__PURE__ */ jsx15(Search, { className: "uf-absolute uf-left-4 uf-top-1/2 uf--translate-y-1/2 uf-w-4 uf-h-4 uf-text-muted-foreground" }),
|
|
1932
|
+
/* @__PURE__ */ jsx15(
|
|
1933
|
+
"input",
|
|
1934
|
+
{
|
|
1935
|
+
type: "text",
|
|
1936
|
+
value: searchQuery,
|
|
1937
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
1938
|
+
placeholder: "Search",
|
|
1939
|
+
className: "uf-w-full uf-bg-secondary uf-rounded-xl uf-pl-11 uf-pr-4 uf-py-2.5 uf-text-sm uf-text-foreground uf-placeholder-muted-foreground uf-outline-none focus:uf-ring-2 focus:uf-ring-ring/30"
|
|
1940
|
+
}
|
|
1941
|
+
)
|
|
1942
|
+
] }) }),
|
|
1943
|
+
/* @__PURE__ */ jsx15("div", { className: "uf-max-h-[500px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: /* @__PURE__ */ jsxs11("div", { className: "uf-space-y-2", children: [
|
|
1944
|
+
/* @__PURE__ */ jsx15(
|
|
1945
|
+
CurrencyListSection,
|
|
1946
|
+
{
|
|
1947
|
+
title: "Popular currencies",
|
|
1948
|
+
currencies: filteredPreferred,
|
|
1949
|
+
selectedCurrency,
|
|
1950
|
+
onSelect: handleSelect
|
|
1951
|
+
}
|
|
1952
|
+
),
|
|
1953
|
+
filteredPreferred.length > 0 && filteredOther.length > 0 && /* @__PURE__ */ jsx15("div", { className: "uf-h-2" }),
|
|
1954
|
+
/* @__PURE__ */ jsx15(
|
|
1955
|
+
CurrencyListSection,
|
|
1956
|
+
{
|
|
1957
|
+
title: "All currencies",
|
|
1958
|
+
currencies: filteredOther,
|
|
1959
|
+
selectedCurrency,
|
|
1960
|
+
onSelect: handleSelect
|
|
1961
|
+
}
|
|
1962
|
+
),
|
|
1963
|
+
filteredPreferred.length === 0 && filteredOther.length === 0 && /* @__PURE__ */ jsx15("div", { className: "uf-text-center uf-py-8 uf-text-muted-foreground uf-text-sm", children: "No currencies found" })
|
|
1964
|
+
] }) })
|
|
1965
|
+
]
|
|
1966
|
+
}
|
|
1967
|
+
) });
|
|
1898
1968
|
}
|
|
1899
1969
|
|
|
1900
1970
|
// src/hooks/use-user-ip.ts
|
|
@@ -1999,7 +2069,9 @@ function BuyWithCard({
|
|
|
1999
2069
|
const [autoSelectedProvider, setAutoSelectedProvider] = useState6(null);
|
|
2000
2070
|
const [hasManualSelection, setHasManualSelection] = useState6(false);
|
|
2001
2071
|
const [internalWallets, setInternalWallets] = useState6([]);
|
|
2002
|
-
const [walletsLoading, setWalletsLoading] = useState6(
|
|
2072
|
+
const [walletsLoading, setWalletsLoading] = useState6(
|
|
2073
|
+
!externalWallets?.length
|
|
2074
|
+
);
|
|
2003
2075
|
const wallets = externalWallets?.length ? externalWallets : internalWallets;
|
|
2004
2076
|
const [countdown, setCountdown] = useState6(60);
|
|
2005
2077
|
const [fiatCurrencies, setFiatCurrencies] = useState6([]);
|
|
@@ -2072,7 +2144,15 @@ function BuyWithCard({
|
|
|
2072
2144
|
clearTimeout(retryTimeout);
|
|
2073
2145
|
}
|
|
2074
2146
|
};
|
|
2075
|
-
}, [
|
|
2147
|
+
}, [
|
|
2148
|
+
userId,
|
|
2149
|
+
recipientAddress,
|
|
2150
|
+
destinationChainType,
|
|
2151
|
+
destinationChainId,
|
|
2152
|
+
destinationTokenAddress,
|
|
2153
|
+
publishableKey,
|
|
2154
|
+
externalWallets
|
|
2155
|
+
]);
|
|
2076
2156
|
useEffect5(() => {
|
|
2077
2157
|
async function fetchSupportedTokens() {
|
|
2078
2158
|
try {
|
|
@@ -2256,7 +2336,10 @@ function BuyWithCard({
|
|
|
2256
2336
|
selectedCurrencyData && /* @__PURE__ */ jsx16(
|
|
2257
2337
|
"img",
|
|
2258
2338
|
{
|
|
2259
|
-
src: getPreferredIconUrl2(
|
|
2339
|
+
src: getPreferredIconUrl2(
|
|
2340
|
+
selectedCurrencyData.icon_urls,
|
|
2341
|
+
"png"
|
|
2342
|
+
) || selectedCurrencyData.icon_url,
|
|
2260
2343
|
alt: selectedCurrencyData.name,
|
|
2261
2344
|
className: "uf-w-4 uf-h-4"
|
|
2262
2345
|
}
|
|
@@ -2489,7 +2572,10 @@ function BuyWithCard({
|
|
|
2489
2572
|
/* @__PURE__ */ jsx16(
|
|
2490
2573
|
"img",
|
|
2491
2574
|
{
|
|
2492
|
-
src: getIconUrlWithCdn(
|
|
2575
|
+
src: getIconUrlWithCdn(
|
|
2576
|
+
"/icons/tokens/png/usdc.png",
|
|
2577
|
+
assetCdnUrl
|
|
2578
|
+
),
|
|
2493
2579
|
alt: "USDC",
|
|
2494
2580
|
className: "uf-w-7 uf-h-7 uf-rounded-full"
|
|
2495
2581
|
}
|
|
@@ -2497,7 +2583,10 @@ function BuyWithCard({
|
|
|
2497
2583
|
/* @__PURE__ */ jsx16(
|
|
2498
2584
|
"img",
|
|
2499
2585
|
{
|
|
2500
|
-
src: getIconUrlWithCdn(
|
|
2586
|
+
src: getIconUrlWithCdn(
|
|
2587
|
+
"/icons/networks/png/polygon.png",
|
|
2588
|
+
assetCdnUrl
|
|
2589
|
+
),
|
|
2501
2590
|
alt: "Polygon",
|
|
2502
2591
|
className: "uf-w-3.5 uf-h-3.5 uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full"
|
|
2503
2592
|
}
|
|
@@ -2512,7 +2601,10 @@ function BuyWithCard({
|
|
|
2512
2601
|
/* @__PURE__ */ jsx16(
|
|
2513
2602
|
"img",
|
|
2514
2603
|
{
|
|
2515
|
-
src: destinationToken?.icon_url || getIconUrlWithCdn(
|
|
2604
|
+
src: destinationToken?.icon_url || getIconUrlWithCdn(
|
|
2605
|
+
"/icons/tokens/png/usdc.png",
|
|
2606
|
+
assetCdnUrl
|
|
2607
|
+
),
|
|
2516
2608
|
alt: displayTokenSymbol,
|
|
2517
2609
|
className: "uf-w-7 uf-h-7 uf-rounded-full"
|
|
2518
2610
|
}
|
|
@@ -2672,7 +2764,10 @@ function DepositTrackerButton({
|
|
|
2672
2764
|
}
|
|
2673
2765
|
|
|
2674
2766
|
// src/components/deposits/DepositModal.tsx
|
|
2675
|
-
import {
|
|
2767
|
+
import {
|
|
2768
|
+
getProjectConfig as getProjectConfig2,
|
|
2769
|
+
createDepositAddress as createDepositAddress3
|
|
2770
|
+
} from "@unifold/core";
|
|
2676
2771
|
|
|
2677
2772
|
// src/hooks/use-allowed-country.ts
|
|
2678
2773
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
@@ -2717,7 +2812,9 @@ function useAllowedCountry(publishableKey) {
|
|
|
2717
2812
|
if (ipData && configData) {
|
|
2718
2813
|
const blockedCodes = configData.blocked_country_codes || [];
|
|
2719
2814
|
const userCountryUpper = ipData.alpha2.toUpperCase();
|
|
2720
|
-
isAllowed = !blockedCodes.some(
|
|
2815
|
+
isAllowed = !blockedCodes.some(
|
|
2816
|
+
(code) => code.toUpperCase() === userCountryUpper
|
|
2817
|
+
);
|
|
2721
2818
|
}
|
|
2722
2819
|
return {
|
|
2723
2820
|
isAllowed,
|
|
@@ -2731,7 +2828,9 @@ function useAllowedCountry(publishableKey) {
|
|
|
2731
2828
|
|
|
2732
2829
|
// src/components/deposits/DepositModal.tsx
|
|
2733
2830
|
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2734
|
-
function SkeletonButton({
|
|
2831
|
+
function SkeletonButton({
|
|
2832
|
+
variant = "default"
|
|
2833
|
+
}) {
|
|
2735
2834
|
return /* @__PURE__ */ jsxs16("div", { className: "uf-w-full uf-bg-secondary uf-rounded-xl uf-p-3 uf-flex uf-items-center uf-justify-between uf-animate-pulse", children: [
|
|
2736
2835
|
/* @__PURE__ */ jsxs16("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
2737
2836
|
/* @__PURE__ */ jsx20("div", { className: "uf-bg-muted uf-rounded-lg uf-w-9 uf-h-9" }),
|
|
@@ -2741,7 +2840,13 @@ function SkeletonButton({ variant = "default" }) {
|
|
|
2741
2840
|
] })
|
|
2742
2841
|
] }),
|
|
2743
2842
|
/* @__PURE__ */ jsxs16("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
2744
|
-
variant === "with-icons" && /* @__PURE__ */ jsx20("div", { className: "uf-flex uf--space-x-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx20(
|
|
2843
|
+
variant === "with-icons" && /* @__PURE__ */ jsx20("div", { className: "uf-flex uf--space-x-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx20(
|
|
2844
|
+
"div",
|
|
2845
|
+
{
|
|
2846
|
+
className: "uf-w-5 uf-h-5 uf-rounded-full uf-bg-muted uf-border-2 uf-border-secondary"
|
|
2847
|
+
},
|
|
2848
|
+
i
|
|
2849
|
+
)) }),
|
|
2745
2850
|
/* @__PURE__ */ jsx20(ChevronRight7, { className: "uf-w-4 uf-h-4 uf-text-muted" })
|
|
2746
2851
|
] })
|
|
2747
2852
|
] });
|
|
@@ -2778,8 +2883,17 @@ function DepositModal({
|
|
|
2778
2883
|
}, [publishableKey]);
|
|
2779
2884
|
useEffect6(() => {
|
|
2780
2885
|
setWallets([]);
|
|
2781
|
-
}, [
|
|
2782
|
-
|
|
2886
|
+
}, [
|
|
2887
|
+
userId,
|
|
2888
|
+
recipientAddress,
|
|
2889
|
+
destinationChainType,
|
|
2890
|
+
destinationChainId,
|
|
2891
|
+
destinationTokenAddress,
|
|
2892
|
+
publishableKey
|
|
2893
|
+
]);
|
|
2894
|
+
const [resolvedTheme, setResolvedTheme] = useState7(
|
|
2895
|
+
theme === "auto" ? "dark" : theme
|
|
2896
|
+
);
|
|
2783
2897
|
useEffect6(() => {
|
|
2784
2898
|
if (theme === "auto") {
|
|
2785
2899
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
@@ -2798,7 +2912,11 @@ function DepositModal({
|
|
|
2798
2912
|
getProjectConfig2(publishableKey).then(setProjectConfig).catch(console.error);
|
|
2799
2913
|
}
|
|
2800
2914
|
}, [open, publishableKey, projectConfig]);
|
|
2801
|
-
const {
|
|
2915
|
+
const {
|
|
2916
|
+
isAllowed,
|
|
2917
|
+
isLoading: isCountryLoading,
|
|
2918
|
+
error: countryError
|
|
2919
|
+
} = useAllowedCountry(publishableKey);
|
|
2802
2920
|
useEffect6(() => {
|
|
2803
2921
|
if (!open || wallets.length > 0) return;
|
|
2804
2922
|
let retryTimeout = null;
|
|
@@ -2836,7 +2954,16 @@ function DepositModal({
|
|
|
2836
2954
|
clearTimeout(retryTimeout);
|
|
2837
2955
|
}
|
|
2838
2956
|
};
|
|
2839
|
-
}, [
|
|
2957
|
+
}, [
|
|
2958
|
+
open,
|
|
2959
|
+
userId,
|
|
2960
|
+
recipientAddress,
|
|
2961
|
+
destinationChainType,
|
|
2962
|
+
destinationChainId,
|
|
2963
|
+
destinationTokenAddress,
|
|
2964
|
+
publishableKey,
|
|
2965
|
+
wallets.length
|
|
2966
|
+
]);
|
|
2840
2967
|
const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
|
|
2841
2968
|
const handleClose = () => {
|
|
2842
2969
|
onOpenChange(false);
|