@unifold/ui-react 0.1.18 → 0.1.20
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.js
CHANGED
|
@@ -203,10 +203,7 @@ var DialogTitle = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
203
203
|
DialogPrimitive.Title,
|
|
204
204
|
{
|
|
205
205
|
ref,
|
|
206
|
-
className: cn(
|
|
207
|
-
"uf-leading-none uf-tracking-tight",
|
|
208
|
-
className
|
|
209
|
-
),
|
|
206
|
+
className: cn("uf-leading-none uf-tracking-tight", className),
|
|
210
207
|
...props
|
|
211
208
|
}
|
|
212
209
|
));
|
|
@@ -431,16 +428,26 @@ function DepositExecutionItem({
|
|
|
431
428
|
}
|
|
432
429
|
)
|
|
433
430
|
}
|
|
434
|
-
) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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__ */ (0, import_jsx_runtime5.jsx)(
|
|
435
|
-
"
|
|
431
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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__ */ (0, import_jsx_runtime5.jsx)(
|
|
432
|
+
"svg",
|
|
436
433
|
{
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
434
|
+
width: "10",
|
|
435
|
+
height: "10",
|
|
436
|
+
viewBox: "0 0 12 12",
|
|
437
|
+
fill: "none",
|
|
438
|
+
className: "uf-block",
|
|
439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
440
|
+
"path",
|
|
441
|
+
{
|
|
442
|
+
d: "M10 3L4.5 8.5L2 6",
|
|
443
|
+
stroke: "white",
|
|
444
|
+
strokeWidth: "2",
|
|
445
|
+
strokeLinecap: "round",
|
|
446
|
+
strokeLinejoin: "round"
|
|
447
|
+
}
|
|
448
|
+
)
|
|
442
449
|
}
|
|
443
|
-
) })
|
|
450
|
+
) })
|
|
444
451
|
] }),
|
|
445
452
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "uf-flex-1 uf-min-w-0", children: [
|
|
446
453
|
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h3", { className: "uf-text-foreground uf-font-medium uf-text-sm uf-leading-tight", children: isPending ? "Deposit processing" : "Deposit completed" }),
|
|
@@ -618,7 +625,10 @@ function DepositDetailContent({ execution }) {
|
|
|
618
625
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
619
626
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Sent" }),
|
|
620
627
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "uf-text-foreground uf-font-medium", children: [
|
|
621
|
-
formatAmount(
|
|
628
|
+
formatAmount(
|
|
629
|
+
execution.source_amount_base_unit,
|
|
630
|
+
execution.source_token_metadata?.decimals
|
|
631
|
+
),
|
|
622
632
|
" ",
|
|
623
633
|
formatCurrency(execution.source_currency)
|
|
624
634
|
] })
|
|
@@ -626,22 +636,34 @@ function DepositDetailContent({ execution }) {
|
|
|
626
636
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
627
637
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Amount Received" }),
|
|
628
638
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { className: "uf-text-foreground uf-font-medium", children: [
|
|
629
|
-
formatAmount(
|
|
639
|
+
formatAmount(
|
|
640
|
+
execution.destination_amount_base_unit,
|
|
641
|
+
execution.destination_token_metadata?.decimals
|
|
642
|
+
),
|
|
630
643
|
" ",
|
|
631
644
|
formatCurrency(execution.destination_currency)
|
|
632
645
|
] })
|
|
633
646
|
] }),
|
|
634
647
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
635
648
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-muted-foreground uf-text-sm", children: "USD Value" }),
|
|
636
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-foreground uf-font-medium", children: formatUsdAmount(
|
|
649
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-foreground uf-font-medium", children: formatUsdAmount(
|
|
650
|
+
execution.source_amount_usd,
|
|
651
|
+
execution.source_amount_base_unit
|
|
652
|
+
) })
|
|
637
653
|
] }),
|
|
638
654
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3 uf-border-b uf-border-border/50", children: [
|
|
639
655
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Source Network" }),
|
|
640
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
656
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
657
|
+
execution.source_chain_type,
|
|
658
|
+
execution.source_chain_id
|
|
659
|
+
) })
|
|
641
660
|
] }),
|
|
642
661
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "uf-flex uf-justify-between uf-items-center uf-px-4 uf-py-3", children: [
|
|
643
662
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-muted-foreground uf-text-sm", children: "Destination Network" }),
|
|
644
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "uf-text-foreground uf-font-medium", children: getNetworkName(
|
|
664
|
+
execution.destination_chain_type,
|
|
665
|
+
execution.destination_chain_id
|
|
666
|
+
) })
|
|
645
667
|
] })
|
|
646
668
|
] }),
|
|
647
669
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
@@ -680,7 +702,9 @@ function DepositDetailContent({ execution }) {
|
|
|
680
702
|
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",
|
|
681
703
|
children: [
|
|
682
704
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "uf-text-muted-foreground uf-text-sm", children: "Completion Tx" }),
|
|
683
|
-
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "uf-text-sm uf-text-foreground uf-text-right", children: formatTransactionHash(
|
|
705
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "uf-text-sm uf-text-foreground uf-text-right", children: formatTransactionHash(
|
|
706
|
+
execution.destination_transaction_hashes[0]
|
|
707
|
+
) }),
|
|
684
708
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_lucide_react4.ExternalLink, { className: "uf-w-3.5 uf-h-3.5 uf-text-muted-foreground uf-block" })
|
|
685
709
|
]
|
|
686
710
|
}
|
|
@@ -744,36 +768,42 @@ function DepositsModal({
|
|
|
744
768
|
const handleExecutionClick = (execution) => {
|
|
745
769
|
setSelectedExecution(execution);
|
|
746
770
|
};
|
|
747
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
{
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
771
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
772
|
+
DialogContent,
|
|
773
|
+
{
|
|
774
|
+
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}`,
|
|
775
|
+
children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
776
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
777
|
+
DepositHeader,
|
|
778
|
+
{
|
|
779
|
+
title: "Deposit Details",
|
|
780
|
+
showBack: true,
|
|
781
|
+
onBack: () => setSelectedExecution(null),
|
|
782
|
+
onClose: handleClose
|
|
783
|
+
}
|
|
784
|
+
),
|
|
785
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DepositDetailContent, { execution: selectedExecution })
|
|
786
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
787
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
788
|
+
DepositHeader,
|
|
789
|
+
{
|
|
790
|
+
title: "Deposit Tracker",
|
|
791
|
+
showBack: true,
|
|
792
|
+
onBack: handleBack,
|
|
793
|
+
onClose: handleClose
|
|
794
|
+
}
|
|
795
|
+
),
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "uf-max-h-[400px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "uf-space-y-2", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "uf-text-muted-foreground uf-text-sm", children: "No deposits yet" }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_jsx_runtime7.Fragment, { children: allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
797
|
+
DepositExecutionItem,
|
|
798
|
+
{
|
|
799
|
+
execution,
|
|
800
|
+
onClick: () => handleExecutionClick(execution)
|
|
801
|
+
},
|
|
802
|
+
execution.id
|
|
803
|
+
)) }) }) })
|
|
804
|
+
] })
|
|
805
|
+
}
|
|
806
|
+
) });
|
|
777
807
|
}
|
|
778
808
|
|
|
779
809
|
// src/components/deposits/DepositSuccessToast.tsx
|
|
@@ -925,22 +955,28 @@ function DepositSuccessToast({
|
|
|
925
955
|
}
|
|
926
956
|
)
|
|
927
957
|
] }) }),
|
|
928
|
-
execution && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog, { open: detailModalOpen, onOpenChange: setDetailModalOpen, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
958
|
+
execution && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Dialog, { open: detailModalOpen, onOpenChange: setDetailModalOpen, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
959
|
+
DialogContent,
|
|
960
|
+
{
|
|
961
|
+
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}`,
|
|
962
|
+
children: [
|
|
963
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-between uf-px-4", children: [
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "uf-w-8" }),
|
|
965
|
+
" ",
|
|
966
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("h2", { className: "uf-text-lg uf-font-semibold uf-text-foreground", children: "Deposit Details" }),
|
|
967
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
968
|
+
"button",
|
|
969
|
+
{
|
|
970
|
+
onClick: () => setDetailModalOpen(false),
|
|
971
|
+
className: "uf-text-muted-foreground hover:uf-text-foreground uf-transition-colors uf-w-8 uf-flex uf-justify-end",
|
|
972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react5.X, { className: "uf-w-5 uf-h-5" })
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
] }),
|
|
976
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DepositDetailContent, { execution })
|
|
977
|
+
]
|
|
978
|
+
}
|
|
979
|
+
) })
|
|
944
980
|
] });
|
|
945
981
|
}
|
|
946
982
|
|
|
@@ -1030,7 +1066,10 @@ var SelectLabel = React3.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
|
1030
1066
|
SelectPrimitive.Label,
|
|
1031
1067
|
{
|
|
1032
1068
|
ref,
|
|
1033
|
-
className: cn(
|
|
1069
|
+
className: cn(
|
|
1070
|
+
"uf-py-1.5 uf-pl-8 uf-pr-2 uf-text-sm uf-font-semibold",
|
|
1071
|
+
className
|
|
1072
|
+
),
|
|
1034
1073
|
...props
|
|
1035
1074
|
}
|
|
1036
1075
|
));
|
|
@@ -1285,7 +1324,9 @@ function TransferCryptoBase({
|
|
|
1285
1324
|
} catch (err) {
|
|
1286
1325
|
console.error("Error fetching wallets, retrying in 5s:", err);
|
|
1287
1326
|
if (!isCancelled) {
|
|
1288
|
-
setError(
|
|
1327
|
+
setError(
|
|
1328
|
+
err instanceof Error ? err.message : "Failed to load wallets"
|
|
1329
|
+
);
|
|
1289
1330
|
setLoading(false);
|
|
1290
1331
|
retryTimeout = setTimeout(fetchWallets, 5e3);
|
|
1291
1332
|
}
|
|
@@ -1530,21 +1571,28 @@ function TransferCryptoBase({
|
|
|
1530
1571
|
disabled: tokensLoading || availableChainsForToken.length === 0,
|
|
1531
1572
|
children: [
|
|
1532
1573
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(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__ */ (0, import_jsx_runtime11.jsx)(SelectValue, { children: tokensLoading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "uf-text-xs uf-font-light uf-text-muted-foreground", children: t.loading }) }) : currentChainFromBackend ? renderChainItem(currentChainFromBackend) : currentChainData ? renderChainItem(currentChainData) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uf-flex uf-items-center uf-gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "uf-text-xs uf-font-normal", children: chain }) }) }) }),
|
|
1533
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1574
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1575
|
+
SelectContent,
|
|
1576
|
+
{
|
|
1577
|
+
align: "end",
|
|
1578
|
+
className: "uf-bg-secondary uf-border uf-text-foreground uf-max-h-[300px] uf-min-w-[200px]",
|
|
1579
|
+
children: availableChainsForToken.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uf-px-2 uf-py-3 uf-text-xs uf-text-muted-foreground uf-text-center", children: t.noChainsAvailable }) : availableChainsForToken.map((chainData) => {
|
|
1580
|
+
const chainKey = getChainKey(
|
|
1581
|
+
chainData.chain_id,
|
|
1582
|
+
chainData.chain_type
|
|
1583
|
+
);
|
|
1584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1585
|
+
SelectItem,
|
|
1586
|
+
{
|
|
1587
|
+
value: chainKey,
|
|
1588
|
+
className: "focus:uf-bg-accent focus:uf-text-foreground",
|
|
1589
|
+
children: renderChainItem(chainData, true)
|
|
1590
|
+
},
|
|
1591
|
+
`${chainData.chain_id}-${chainData.chain_type}`
|
|
1592
|
+
);
|
|
1593
|
+
})
|
|
1594
|
+
}
|
|
1595
|
+
)
|
|
1548
1596
|
]
|
|
1549
1597
|
}
|
|
1550
1598
|
)
|
|
@@ -1601,22 +1649,31 @@ function TransferCryptoBase({
|
|
|
1601
1649
|
)
|
|
1602
1650
|
] })
|
|
1603
1651
|
] }),
|
|
1604
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1653
|
+
"span",
|
|
1654
|
+
{
|
|
1655
|
+
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"}`,
|
|
1656
|
+
children: [
|
|
1657
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.Check, { className: "uf-w-3 uf-h-3" }),
|
|
1658
|
+
t.copied
|
|
1659
|
+
]
|
|
1660
|
+
}
|
|
1661
|
+
)
|
|
1608
1662
|
] }),
|
|
1609
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1663
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsx)("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__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uf-relative", children: [
|
|
1664
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1665
|
+
"button",
|
|
1666
|
+
{
|
|
1667
|
+
onClick: handleCopyAddress,
|
|
1668
|
+
disabled: !depositAddress,
|
|
1669
|
+
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",
|
|
1670
|
+
children: depositAddress || t.noAddressAvailable
|
|
1671
|
+
}
|
|
1672
|
+
),
|
|
1673
|
+
depositAddress && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "uf-absolute uf-inset-y-0 uf-right-3 uf-flex uf-items-center uf-text-muted-foreground uf-pointer-events-none", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react7.Copy, { className: "uf-w-3 uf-h-3" }) })
|
|
1674
|
+
] })
|
|
1618
1675
|
] }),
|
|
1619
|
-
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uf-bg-secondary uf-rounded-xl uf-px-
|
|
1676
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uf-bg-secondary uf-rounded-xl uf-px-2.5", children: [
|
|
1620
1677
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1621
1678
|
"button",
|
|
1622
1679
|
{
|
|
@@ -1901,52 +1958,58 @@ function CurrencyModal({
|
|
|
1901
1958
|
onOpenChange(false);
|
|
1902
1959
|
setSearchQuery("");
|
|
1903
1960
|
};
|
|
1904
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
{
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
{
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Dialog, { open, onOpenChange, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
1962
|
+
DialogContent,
|
|
1963
|
+
{
|
|
1964
|
+
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}`,
|
|
1965
|
+
children: [
|
|
1966
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1967
|
+
DepositHeader,
|
|
1968
|
+
{
|
|
1969
|
+
title: "Currency",
|
|
1970
|
+
showBack: true,
|
|
1971
|
+
onBack: handleClose,
|
|
1972
|
+
onClose: handleClose
|
|
1973
|
+
}
|
|
1974
|
+
),
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "uf-relative", children: [
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react9.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" }),
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1978
|
+
"input",
|
|
1979
|
+
{
|
|
1980
|
+
type: "text",
|
|
1981
|
+
value: searchQuery,
|
|
1982
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
1983
|
+
placeholder: "Search",
|
|
1984
|
+
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"
|
|
1985
|
+
}
|
|
1986
|
+
)
|
|
1987
|
+
] }) }),
|
|
1988
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uf-max-h-[500px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "uf-space-y-2", children: [
|
|
1989
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
1990
|
+
CurrencyListSection,
|
|
1991
|
+
{
|
|
1992
|
+
title: "Popular currencies",
|
|
1993
|
+
currencies: filteredPreferred,
|
|
1994
|
+
selectedCurrency,
|
|
1995
|
+
onSelect: handleSelect
|
|
1996
|
+
}
|
|
1997
|
+
),
|
|
1998
|
+
filteredPreferred.length > 0 && filteredOther.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uf-h-2" }),
|
|
1999
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2000
|
+
CurrencyListSection,
|
|
2001
|
+
{
|
|
2002
|
+
title: "All currencies",
|
|
2003
|
+
currencies: filteredOther,
|
|
2004
|
+
selectedCurrency,
|
|
2005
|
+
onSelect: handleSelect
|
|
2006
|
+
}
|
|
2007
|
+
),
|
|
2008
|
+
filteredPreferred.length === 0 && filteredOther.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "uf-text-center uf-py-8 uf-text-muted-foreground uf-text-sm", children: "No currencies found" })
|
|
2009
|
+
] }) })
|
|
2010
|
+
]
|
|
2011
|
+
}
|
|
2012
|
+
) });
|
|
1950
2013
|
}
|
|
1951
2014
|
|
|
1952
2015
|
// src/hooks/use-user-ip.ts
|
|
@@ -2051,7 +2114,9 @@ function BuyWithCard({
|
|
|
2051
2114
|
const [autoSelectedProvider, setAutoSelectedProvider] = (0, import_react7.useState)(null);
|
|
2052
2115
|
const [hasManualSelection, setHasManualSelection] = (0, import_react7.useState)(false);
|
|
2053
2116
|
const [internalWallets, setInternalWallets] = (0, import_react7.useState)([]);
|
|
2054
|
-
const [walletsLoading, setWalletsLoading] = (0, import_react7.useState)(
|
|
2117
|
+
const [walletsLoading, setWalletsLoading] = (0, import_react7.useState)(
|
|
2118
|
+
!externalWallets?.length
|
|
2119
|
+
);
|
|
2055
2120
|
const wallets = externalWallets?.length ? externalWallets : internalWallets;
|
|
2056
2121
|
const [countdown, setCountdown] = (0, import_react7.useState)(60);
|
|
2057
2122
|
const [fiatCurrencies, setFiatCurrencies] = (0, import_react7.useState)([]);
|
|
@@ -2124,7 +2189,15 @@ function BuyWithCard({
|
|
|
2124
2189
|
clearTimeout(retryTimeout);
|
|
2125
2190
|
}
|
|
2126
2191
|
};
|
|
2127
|
-
}, [
|
|
2192
|
+
}, [
|
|
2193
|
+
userId,
|
|
2194
|
+
recipientAddress,
|
|
2195
|
+
destinationChainType,
|
|
2196
|
+
destinationChainId,
|
|
2197
|
+
destinationTokenAddress,
|
|
2198
|
+
publishableKey,
|
|
2199
|
+
externalWallets
|
|
2200
|
+
]);
|
|
2128
2201
|
(0, import_react7.useEffect)(() => {
|
|
2129
2202
|
async function fetchSupportedTokens() {
|
|
2130
2203
|
try {
|
|
@@ -2308,7 +2381,10 @@ function BuyWithCard({
|
|
|
2308
2381
|
selectedCurrencyData && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2309
2382
|
"img",
|
|
2310
2383
|
{
|
|
2311
|
-
src: (0, import_core8.getPreferredIconUrl)(
|
|
2384
|
+
src: (0, import_core8.getPreferredIconUrl)(
|
|
2385
|
+
selectedCurrencyData.icon_urls,
|
|
2386
|
+
"png"
|
|
2387
|
+
) || selectedCurrencyData.icon_url,
|
|
2312
2388
|
alt: selectedCurrencyData.name,
|
|
2313
2389
|
className: "uf-w-4 uf-h-4"
|
|
2314
2390
|
}
|
|
@@ -2541,7 +2617,10 @@ function BuyWithCard({
|
|
|
2541
2617
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2542
2618
|
"img",
|
|
2543
2619
|
{
|
|
2544
|
-
src: (0, import_core8.getIconUrlWithCdn)(
|
|
2620
|
+
src: (0, import_core8.getIconUrlWithCdn)(
|
|
2621
|
+
"/icons/tokens/png/usdc.png",
|
|
2622
|
+
assetCdnUrl
|
|
2623
|
+
),
|
|
2545
2624
|
alt: "USDC",
|
|
2546
2625
|
className: "uf-w-7 uf-h-7 uf-rounded-full"
|
|
2547
2626
|
}
|
|
@@ -2549,7 +2628,10 @@ function BuyWithCard({
|
|
|
2549
2628
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2550
2629
|
"img",
|
|
2551
2630
|
{
|
|
2552
|
-
src: (0, import_core8.getIconUrlWithCdn)(
|
|
2631
|
+
src: (0, import_core8.getIconUrlWithCdn)(
|
|
2632
|
+
"/icons/networks/png/polygon.png",
|
|
2633
|
+
assetCdnUrl
|
|
2634
|
+
),
|
|
2553
2635
|
alt: "Polygon",
|
|
2554
2636
|
className: "uf-w-3.5 uf-h-3.5 uf-absolute -uf-bottom-0.5 -uf-right-0.5 uf-rounded-full"
|
|
2555
2637
|
}
|
|
@@ -2564,7 +2646,10 @@ function BuyWithCard({
|
|
|
2564
2646
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2565
2647
|
"img",
|
|
2566
2648
|
{
|
|
2567
|
-
src: destinationToken?.icon_url || (0, import_core8.getIconUrlWithCdn)(
|
|
2649
|
+
src: destinationToken?.icon_url || (0, import_core8.getIconUrlWithCdn)(
|
|
2650
|
+
"/icons/tokens/png/usdc.png",
|
|
2651
|
+
assetCdnUrl
|
|
2652
|
+
),
|
|
2568
2653
|
alt: displayTokenSymbol,
|
|
2569
2654
|
className: "uf-w-7 uf-h-7 uf-rounded-full"
|
|
2570
2655
|
}
|
|
@@ -2766,7 +2851,9 @@ function useAllowedCountry(publishableKey) {
|
|
|
2766
2851
|
if (ipData && configData) {
|
|
2767
2852
|
const blockedCodes = configData.blocked_country_codes || [];
|
|
2768
2853
|
const userCountryUpper = ipData.alpha2.toUpperCase();
|
|
2769
|
-
isAllowed = !blockedCodes.some(
|
|
2854
|
+
isAllowed = !blockedCodes.some(
|
|
2855
|
+
(code) => code.toUpperCase() === userCountryUpper
|
|
2856
|
+
);
|
|
2770
2857
|
}
|
|
2771
2858
|
return {
|
|
2772
2859
|
isAllowed,
|
|
@@ -2780,7 +2867,9 @@ function useAllowedCountry(publishableKey) {
|
|
|
2780
2867
|
|
|
2781
2868
|
// src/components/deposits/DepositModal.tsx
|
|
2782
2869
|
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2783
|
-
function SkeletonButton({
|
|
2870
|
+
function SkeletonButton({
|
|
2871
|
+
variant = "default"
|
|
2872
|
+
}) {
|
|
2784
2873
|
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("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: [
|
|
2785
2874
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
2786
2875
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "uf-bg-muted uf-rounded-lg uf-w-9 uf-h-9" }),
|
|
@@ -2790,7 +2879,13 @@ function SkeletonButton({ variant = "default" }) {
|
|
|
2790
2879
|
] })
|
|
2791
2880
|
] }),
|
|
2792
2881
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
2793
|
-
variant === "with-icons" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "uf-flex uf--space-x-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2882
|
+
variant === "with-icons" && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "uf-flex uf--space-x-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2883
|
+
"div",
|
|
2884
|
+
{
|
|
2885
|
+
className: "uf-w-5 uf-h-5 uf-rounded-full uf-bg-muted uf-border-2 uf-border-secondary"
|
|
2886
|
+
},
|
|
2887
|
+
i
|
|
2888
|
+
)) }),
|
|
2794
2889
|
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react14.ChevronRight, { className: "uf-w-4 uf-h-4 uf-text-muted" })
|
|
2795
2890
|
] })
|
|
2796
2891
|
] });
|
|
@@ -2827,8 +2922,17 @@ function DepositModal({
|
|
|
2827
2922
|
}, [publishableKey]);
|
|
2828
2923
|
(0, import_react8.useEffect)(() => {
|
|
2829
2924
|
setWallets([]);
|
|
2830
|
-
}, [
|
|
2831
|
-
|
|
2925
|
+
}, [
|
|
2926
|
+
userId,
|
|
2927
|
+
recipientAddress,
|
|
2928
|
+
destinationChainType,
|
|
2929
|
+
destinationChainId,
|
|
2930
|
+
destinationTokenAddress,
|
|
2931
|
+
publishableKey
|
|
2932
|
+
]);
|
|
2933
|
+
const [resolvedTheme, setResolvedTheme] = (0, import_react8.useState)(
|
|
2934
|
+
theme === "auto" ? "dark" : theme
|
|
2935
|
+
);
|
|
2832
2936
|
(0, import_react8.useEffect)(() => {
|
|
2833
2937
|
if (theme === "auto") {
|
|
2834
2938
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
@@ -2847,7 +2951,11 @@ function DepositModal({
|
|
|
2847
2951
|
(0, import_core10.getProjectConfig)(publishableKey).then(setProjectConfig).catch(console.error);
|
|
2848
2952
|
}
|
|
2849
2953
|
}, [open, publishableKey, projectConfig]);
|
|
2850
|
-
const {
|
|
2954
|
+
const {
|
|
2955
|
+
isAllowed,
|
|
2956
|
+
isLoading: isCountryLoading,
|
|
2957
|
+
error: countryError
|
|
2958
|
+
} = useAllowedCountry(publishableKey);
|
|
2851
2959
|
(0, import_react8.useEffect)(() => {
|
|
2852
2960
|
if (!open || wallets.length > 0) return;
|
|
2853
2961
|
let retryTimeout = null;
|
|
@@ -2885,7 +2993,16 @@ function DepositModal({
|
|
|
2885
2993
|
clearTimeout(retryTimeout);
|
|
2886
2994
|
}
|
|
2887
2995
|
};
|
|
2888
|
-
}, [
|
|
2996
|
+
}, [
|
|
2997
|
+
open,
|
|
2998
|
+
userId,
|
|
2999
|
+
recipientAddress,
|
|
3000
|
+
destinationChainType,
|
|
3001
|
+
destinationChainId,
|
|
3002
|
+
destinationTokenAddress,
|
|
3003
|
+
publishableKey,
|
|
3004
|
+
wallets.length
|
|
3005
|
+
]);
|
|
2889
3006
|
const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
|
|
2890
3007
|
const handleClose = () => {
|
|
2891
3008
|
onOpenChange(false);
|