@unifold/ui-react 0.1.63 → 0.1.64
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 +10 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.js +822 -484
- package/dist/index.mjs +772 -432
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -572,6 +572,36 @@ function ThemeProvider({
|
|
|
572
572
|
);
|
|
573
573
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value: contextValue, children });
|
|
574
574
|
}
|
|
575
|
+
function AccentColorOverride({
|
|
576
|
+
accentColor,
|
|
577
|
+
accentForeground,
|
|
578
|
+
children
|
|
579
|
+
}) {
|
|
580
|
+
const parent = useTheme();
|
|
581
|
+
const value = React.useMemo(() => {
|
|
582
|
+
if (!accentColor) return parent;
|
|
583
|
+
const foreground = accentForeground ?? parent.colors.primaryForeground;
|
|
584
|
+
const nextColors = {
|
|
585
|
+
...parent.colors,
|
|
586
|
+
primary: accentColor,
|
|
587
|
+
primaryForeground: foreground
|
|
588
|
+
};
|
|
589
|
+
const nextComponents = {
|
|
590
|
+
...parent.components,
|
|
591
|
+
button: {
|
|
592
|
+
...parent.components.button,
|
|
593
|
+
primaryBackground: accentColor,
|
|
594
|
+
primaryText: foreground
|
|
595
|
+
},
|
|
596
|
+
card: {
|
|
597
|
+
...parent.components.card,
|
|
598
|
+
iconBackgroundColor: `${accentColor}26`
|
|
599
|
+
}
|
|
600
|
+
};
|
|
601
|
+
return { ...parent, colors: nextColors, components: nextComponents };
|
|
602
|
+
}, [parent, accentColor, accentForeground]);
|
|
603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ThemeContext.Provider, { value, children });
|
|
604
|
+
}
|
|
575
605
|
function useTheme() {
|
|
576
606
|
const context = React.useContext(ThemeContext);
|
|
577
607
|
if (!context) {
|
|
@@ -1678,6 +1708,7 @@ function useDepositPolling({
|
|
|
1678
1708
|
clientSecret,
|
|
1679
1709
|
depositConfirmationMode = "auto_ui",
|
|
1680
1710
|
depositWalletId,
|
|
1711
|
+
depositWalletIds,
|
|
1681
1712
|
enabled = true,
|
|
1682
1713
|
immediateDirectPolling = false,
|
|
1683
1714
|
onDepositSuccess,
|
|
@@ -1823,21 +1854,25 @@ function useDepositPolling({
|
|
|
1823
1854
|
setIsPolling(false);
|
|
1824
1855
|
};
|
|
1825
1856
|
}, [userId, publishableKey, clientSecret, enabled]);
|
|
1857
|
+
const pollWalletIdsKey = depositWalletIds && depositWalletIds.length > 0 ? Array.from(new Set(depositWalletIds.filter(Boolean))).join(",") : depositWalletId || "";
|
|
1826
1858
|
(0, import_react3.useEffect)(() => {
|
|
1827
|
-
if (!pollingEnabled || !
|
|
1859
|
+
if (!pollingEnabled || !pollWalletIdsKey) return;
|
|
1860
|
+
const ids = pollWalletIdsKey.split(",").filter(Boolean);
|
|
1828
1861
|
const triggerPoll = async () => {
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1862
|
+
await Promise.all(
|
|
1863
|
+
ids.map(
|
|
1864
|
+
(id) => (0, import_core6.pollDirectExecutions)(
|
|
1865
|
+
{ deposit_wallet_id: id },
|
|
1866
|
+
publishableKey
|
|
1867
|
+
).catch(() => {
|
|
1868
|
+
})
|
|
1869
|
+
)
|
|
1870
|
+
);
|
|
1836
1871
|
};
|
|
1837
1872
|
triggerPoll();
|
|
1838
1873
|
const interval = setInterval(triggerPoll, POLL_ENDPOINT_INTERVAL_MS);
|
|
1839
1874
|
return () => clearInterval(interval);
|
|
1840
|
-
}, [pollingEnabled,
|
|
1875
|
+
}, [pollingEnabled, pollWalletIdsKey, publishableKey]);
|
|
1841
1876
|
const handleIveDeposited = () => {
|
|
1842
1877
|
setPollingEnabled(true);
|
|
1843
1878
|
setShowWaitingUi(true);
|
|
@@ -3053,6 +3088,7 @@ function BuyWithCard({
|
|
|
3053
3088
|
if (!selectedProvider) return "0.000000";
|
|
3054
3089
|
return selectedProvider.destination_amount.toFixed(6);
|
|
3055
3090
|
};
|
|
3091
|
+
const canOpenProviderSelector = !quotesLoading && quotes.length > 1;
|
|
3056
3092
|
const selectedCurrencyData = fiatCurrencies.find(
|
|
3057
3093
|
(c) => c.currency_code.toLowerCase() === currency.toLowerCase()
|
|
3058
3094
|
);
|
|
@@ -3238,9 +3274,12 @@ function BuyWithCard({
|
|
|
3238
3274
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3239
3275
|
"button",
|
|
3240
3276
|
{
|
|
3241
|
-
onClick: () =>
|
|
3277
|
+
onClick: () => {
|
|
3278
|
+
if (canOpenProviderSelector) handleViewChange("quotes");
|
|
3279
|
+
},
|
|
3242
3280
|
disabled: quotesLoading || quotes.length === 0,
|
|
3243
|
-
|
|
3281
|
+
"aria-disabled": !canOpenProviderSelector,
|
|
3282
|
+
className: `uf-w-full uf-transition-colors uf-p-4 uf-group disabled:uf-opacity-50 disabled:uf-cursor-not-allowed ${canOpenProviderSelector ? "hover:uf-bg-accent uf-cursor-pointer" : "uf-cursor-default"}`,
|
|
3244
3283
|
style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
|
|
3245
3284
|
children: quotesLoading ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uf-text-left uf-w-full uf-animate-pulse", children: [
|
|
3246
3285
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
@@ -3267,7 +3306,7 @@ function BuyWithCard({
|
|
|
3267
3306
|
)
|
|
3268
3307
|
] })
|
|
3269
3308
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "uf-w-full uf-text-left", children: [
|
|
3270
|
-
isAutoSelected && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3309
|
+
isAutoSelected && canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3271
3310
|
"div",
|
|
3272
3311
|
{
|
|
3273
3312
|
className: "uf-text-xs uf-font-normal uf-mb-2",
|
|
@@ -3303,7 +3342,7 @@ function BuyWithCard({
|
|
|
3303
3342
|
),
|
|
3304
3343
|
selectedProvider.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "uf-text-[10px] uf-text-muted-foreground uf-font-normal", children: "No document upload" }) })
|
|
3305
3344
|
] }),
|
|
3306
|
-
|
|
3345
|
+
canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
3307
3346
|
import_lucide_react7.ChevronRight,
|
|
3308
3347
|
{
|
|
3309
3348
|
className: "uf-w-4 uf-h-4 group-hover:uf-text-foreground uf-transition-colors uf-flex-shrink-0",
|
|
@@ -10071,7 +10110,7 @@ function useDefaultOnrampToken({
|
|
|
10071
10110
|
}
|
|
10072
10111
|
|
|
10073
10112
|
// src/components/deposits/DepositModal.tsx
|
|
10074
|
-
var
|
|
10113
|
+
var import_core30 = require("@unifold/core");
|
|
10075
10114
|
|
|
10076
10115
|
// src/hooks/use-allowed-country.ts
|
|
10077
10116
|
var import_react_query9 = require("@tanstack/react-query");
|
|
@@ -12514,7 +12553,7 @@ function TransferCryptoDoubleInput({
|
|
|
12514
12553
|
// src/components/deposits/WalletConnect.tsx
|
|
12515
12554
|
var React30 = __toESM(require("react"));
|
|
12516
12555
|
var import_lucide_react28 = require("lucide-react");
|
|
12517
|
-
var
|
|
12556
|
+
var import_core29 = require("@unifold/core");
|
|
12518
12557
|
|
|
12519
12558
|
// src/hooks/use-deposit-quote.ts
|
|
12520
12559
|
var import_react_query12 = require("@tanstack/react-query");
|
|
@@ -12571,6 +12610,68 @@ function useDepositQuote(params) {
|
|
|
12571
12610
|
});
|
|
12572
12611
|
}
|
|
12573
12612
|
|
|
12613
|
+
// src/hooks/use-external-wallets.ts
|
|
12614
|
+
var import_react_query13 = require("@tanstack/react-query");
|
|
12615
|
+
var import_core28 = require("@unifold/core");
|
|
12616
|
+
function useExternalWallets({
|
|
12617
|
+
publishableKey,
|
|
12618
|
+
enabled = true
|
|
12619
|
+
}) {
|
|
12620
|
+
const { data: wallets = [], isLoading } = (0, import_react_query13.useQuery)({
|
|
12621
|
+
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
12622
|
+
queryFn: () => (0, import_core28.getExternalWallets)(publishableKey).then((res) => res.data),
|
|
12623
|
+
enabled: enabled && !!publishableKey,
|
|
12624
|
+
staleTime: 1e3 * 60 * 30,
|
|
12625
|
+
refetchOnMount: false,
|
|
12626
|
+
refetchOnWindowFocus: false
|
|
12627
|
+
});
|
|
12628
|
+
return { wallets, isLoading };
|
|
12629
|
+
}
|
|
12630
|
+
|
|
12631
|
+
// src/theme/walletBrandColors.ts
|
|
12632
|
+
var WALLET_BRAND_COLORS = {
|
|
12633
|
+
phantom: "#AB9FF2",
|
|
12634
|
+
metamask: "#F6851B",
|
|
12635
|
+
coinbase: "#0052FF",
|
|
12636
|
+
trust: "#3375BB",
|
|
12637
|
+
rainbow: "#5B6CFF",
|
|
12638
|
+
rabby: "#7084FF",
|
|
12639
|
+
okx: "#000000"
|
|
12640
|
+
};
|
|
12641
|
+
function normalizeWalletId(type) {
|
|
12642
|
+
return type.replace(/-(ethereum|solana)$/i, "").toLowerCase();
|
|
12643
|
+
}
|
|
12644
|
+
function getWalletBrandColor(type, mode = "dark") {
|
|
12645
|
+
if (!type) return void 0;
|
|
12646
|
+
const id = normalizeWalletId(type);
|
|
12647
|
+
const color = WALLET_BRAND_COLORS[id];
|
|
12648
|
+
if (!color) return void 0;
|
|
12649
|
+
if (id === "okx") return mode === "dark" ? "#FFFFFF" : "#111111";
|
|
12650
|
+
return color;
|
|
12651
|
+
}
|
|
12652
|
+
function getContrastingTextColor(hex) {
|
|
12653
|
+
const c = hex.replace("#", "");
|
|
12654
|
+
if (c.length !== 6) return "#FFFFFF";
|
|
12655
|
+
const r = parseInt(c.slice(0, 2), 16);
|
|
12656
|
+
const g = parseInt(c.slice(2, 4), 16);
|
|
12657
|
+
const b = parseInt(c.slice(4, 6), 16);
|
|
12658
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
12659
|
+
return luminance > 0.6 ? "#13111C" : "#FFFFFF";
|
|
12660
|
+
}
|
|
12661
|
+
|
|
12662
|
+
// src/components/deposits/browser-wallets/mobileDeepLinks.ts
|
|
12663
|
+
function isMobileDevice() {
|
|
12664
|
+
if (typeof navigator === "undefined") return false;
|
|
12665
|
+
return /android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent);
|
|
12666
|
+
}
|
|
12667
|
+
function getMobilePlatform() {
|
|
12668
|
+
if (typeof navigator === "undefined") return null;
|
|
12669
|
+
const ua = navigator.userAgent;
|
|
12670
|
+
if (/iphone|ipad|ipod/i.test(ua)) return "ios";
|
|
12671
|
+
if (/android/i.test(ua)) return "android";
|
|
12672
|
+
return null;
|
|
12673
|
+
}
|
|
12674
|
+
|
|
12574
12675
|
// src/components/deposits/browser-wallets/SelectTokenView.tsx
|
|
12575
12676
|
var import_lucide_react25 = require("lucide-react");
|
|
12576
12677
|
|
|
@@ -13599,18 +13700,33 @@ var WALLET_ICONS3 = {
|
|
|
13599
13700
|
backpack: BackpackIcon,
|
|
13600
13701
|
glow: GlowIcon
|
|
13601
13702
|
};
|
|
13602
|
-
var
|
|
13603
|
-
{ id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/" },
|
|
13604
|
-
{ id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet" },
|
|
13605
|
-
{ id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/" },
|
|
13606
|
-
{ id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/" },
|
|
13607
|
-
{ id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/" },
|
|
13608
|
-
{ id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://
|
|
13609
|
-
{ id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3" }
|
|
13610
|
-
{ id: "solflare", name: "Solflare", networks: ["solana"], installUrl: "https://solflare.com/" },
|
|
13611
|
-
{ id: "backpack", name: "Backpack", networks: ["solana"], installUrl: "https://backpack.app/" },
|
|
13612
|
-
{ id: "glow", name: "Glow", networks: ["solana"], installUrl: "https://glow.app/" }
|
|
13703
|
+
var FALLBACK_WALLET_DEFINITIONS = [
|
|
13704
|
+
{ id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/", supportsMobileBrowse: true },
|
|
13705
|
+
{ id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
|
|
13706
|
+
{ id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/", supportsMobileBrowse: true },
|
|
13707
|
+
{ id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/", supportsMobileBrowse: true },
|
|
13708
|
+
{ id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/", supportsMobileBrowse: true },
|
|
13709
|
+
{ id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://apps.apple.com/app/rabby-wallet/id6450663781", supportsMobileBrowse: true },
|
|
13710
|
+
{ id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3", supportsMobileBrowse: true, mobileBrowsePlatforms: ["ios"] }
|
|
13613
13711
|
];
|
|
13712
|
+
function getMobileInstallUrl(walletId, defaultUrl) {
|
|
13713
|
+
if (!isMobileDevice()) return defaultUrl;
|
|
13714
|
+
const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
|
|
13715
|
+
const isIOS = /iPhone|iPad|iPod/i.test(ua);
|
|
13716
|
+
const stores = {
|
|
13717
|
+
rabby: {
|
|
13718
|
+
ios: "https://apps.apple.com/app/rabby-wallet/id6450663781",
|
|
13719
|
+
android: "https://play.google.com/store/apps/details?id=com.debank.rabbymobile"
|
|
13720
|
+
},
|
|
13721
|
+
glow: {
|
|
13722
|
+
ios: "https://apps.apple.com/us/app/glow-solana-wallet/id1599584512",
|
|
13723
|
+
android: "https://play.google.com/store/apps/details?id=com.luma.wallet.prod"
|
|
13724
|
+
}
|
|
13725
|
+
};
|
|
13726
|
+
const entry = stores[walletId];
|
|
13727
|
+
if (!entry) return defaultUrl;
|
|
13728
|
+
return isIOS ? entry.ios : entry.android;
|
|
13729
|
+
}
|
|
13614
13730
|
function normalizeTokenAddress(address) {
|
|
13615
13731
|
const normalized = (address ?? "").toLowerCase();
|
|
13616
13732
|
if (normalized === "" || normalized === "native" || normalized === "0x0000000000000000000000000000000000000000") {
|
|
@@ -13646,7 +13762,7 @@ function getLegacyEvmProviders() {
|
|
|
13646
13762
|
okxEthereum: win.okxwallet
|
|
13647
13763
|
};
|
|
13648
13764
|
}
|
|
13649
|
-
function detectAvailableWallets(filterChainType) {
|
|
13765
|
+
function detectAvailableWallets(definitions, filterChainType) {
|
|
13650
13766
|
const solProviders = getSolanaProviders();
|
|
13651
13767
|
const legacyEvm = getLegacyEvmProviders();
|
|
13652
13768
|
const eip6963List = getEip6963Providers();
|
|
@@ -13672,7 +13788,7 @@ function detectAvailableWallets(filterChainType) {
|
|
|
13672
13788
|
return false;
|
|
13673
13789
|
}
|
|
13674
13790
|
});
|
|
13675
|
-
return
|
|
13791
|
+
return definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
|
|
13676
13792
|
let isInstalled = false;
|
|
13677
13793
|
const detectedNetworks = [];
|
|
13678
13794
|
switch (wallet.id) {
|
|
@@ -13776,7 +13892,7 @@ function WalletConnect({
|
|
|
13776
13892
|
depositWalletsLoading = false,
|
|
13777
13893
|
onExecutionsChange
|
|
13778
13894
|
}) {
|
|
13779
|
-
const { colors: colors2, fonts, components } = useTheme();
|
|
13895
|
+
const { colors: colors2, fonts, components, mode } = useTheme();
|
|
13780
13896
|
const walletProvidedAtMount = React30.useRef(!!initialWalletInfo && !!initialDepositWallet);
|
|
13781
13897
|
const [activeWalletInfo, setActiveWalletInfo] = React30.useState(initialWalletInfo ?? null);
|
|
13782
13898
|
const [activeDepositWallet, setActiveDepositWallet] = React30.useState(initialDepositWallet ?? null);
|
|
@@ -13800,7 +13916,37 @@ function WalletConnect({
|
|
|
13800
13916
|
setEip6963ProviderCount(providers.length);
|
|
13801
13917
|
});
|
|
13802
13918
|
}, []);
|
|
13803
|
-
const
|
|
13919
|
+
const { wallets: backendWallets } = useExternalWallets({ publishableKey });
|
|
13920
|
+
const walletDefinitions = React30.useMemo(
|
|
13921
|
+
() => backendWallets.length > 0 ? backendWallets.map((w) => ({
|
|
13922
|
+
id: w.id,
|
|
13923
|
+
name: w.name,
|
|
13924
|
+
networks: w.chain_types,
|
|
13925
|
+
installUrl: w.install_url,
|
|
13926
|
+
supportsMobileBrowse: w.supports_mobile_browse,
|
|
13927
|
+
mobileBrowsePlatforms: w.mobile_browse_platforms ?? null
|
|
13928
|
+
})) : FALLBACK_WALLET_DEFINITIONS,
|
|
13929
|
+
[backendWallets]
|
|
13930
|
+
);
|
|
13931
|
+
const availableWallets = React30.useMemo(
|
|
13932
|
+
() => detectAvailableWallets(walletDefinitions),
|
|
13933
|
+
[walletDefinitions, eip6963ProviderCount]
|
|
13934
|
+
);
|
|
13935
|
+
const [isMobile, setIsMobile] = React30.useState(false);
|
|
13936
|
+
React30.useEffect(() => {
|
|
13937
|
+
setIsMobile(isMobileDevice());
|
|
13938
|
+
}, []);
|
|
13939
|
+
const mobileDepositAddresses = React30.useMemo(
|
|
13940
|
+
() => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
|
|
13941
|
+
[depositWallets]
|
|
13942
|
+
);
|
|
13943
|
+
const mobileDepositWalletIds = React30.useMemo(
|
|
13944
|
+
() => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
|
|
13945
|
+
[depositWallets]
|
|
13946
|
+
);
|
|
13947
|
+
const [mobileRedirect, setMobileRedirect] = React30.useState(null);
|
|
13948
|
+
const [pendingMobileWallet, setPendingMobileWallet] = React30.useState(null);
|
|
13949
|
+
const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React30.useState(false);
|
|
13804
13950
|
React30.useEffect(() => {
|
|
13805
13951
|
if (!standalone || autoResolved || detectingWallet) return;
|
|
13806
13952
|
if (!detectedWallet) {
|
|
@@ -13859,9 +14005,36 @@ function WalletConnect({
|
|
|
13859
14005
|
transform: isTransitioning ? "translateY(4px)" : "translateY(0)",
|
|
13860
14006
|
transition: "opacity 150ms ease, transform 150ms ease"
|
|
13861
14007
|
};
|
|
13862
|
-
const
|
|
14008
|
+
const openMobileWalletBrowse = async (wallet, depositAddresses) => {
|
|
14009
|
+
try {
|
|
14010
|
+
const res = await (0, import_core29.getWalletMobileDeepLink)(
|
|
14011
|
+
wallet.id,
|
|
14012
|
+
depositAddresses,
|
|
14013
|
+
publishableKey
|
|
14014
|
+
);
|
|
14015
|
+
if (res.deeplink) {
|
|
14016
|
+
setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
|
|
14017
|
+
setAwaitingMobileDeposit(true);
|
|
14018
|
+
transitionTo("mobile_redirect");
|
|
14019
|
+
window.location.href = res.deeplink;
|
|
14020
|
+
return true;
|
|
14021
|
+
}
|
|
14022
|
+
} catch {
|
|
14023
|
+
}
|
|
14024
|
+
return false;
|
|
14025
|
+
};
|
|
14026
|
+
const handleWalletClick = async (wallet) => {
|
|
13863
14027
|
if (!wallet.isInstalled) {
|
|
13864
|
-
|
|
14028
|
+
const platform = getMobilePlatform();
|
|
14029
|
+
const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(platform ?? "");
|
|
14030
|
+
if (isMobileDevice() && wallet.supportsMobileBrowse !== false && platformAllowed) {
|
|
14031
|
+
if (mobileDepositAddresses.length === 0) {
|
|
14032
|
+
setPendingMobileWallet(wallet);
|
|
14033
|
+
return;
|
|
14034
|
+
}
|
|
14035
|
+
if (await openMobileWalletBrowse(wallet, mobileDepositAddresses)) return;
|
|
14036
|
+
}
|
|
14037
|
+
window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
|
|
13865
14038
|
return;
|
|
13866
14039
|
}
|
|
13867
14040
|
setSelectedWalletDef(wallet);
|
|
@@ -13877,6 +14050,27 @@ function WalletConnect({
|
|
|
13877
14050
|
if (!selectedWalletDef) return;
|
|
13878
14051
|
handleConnectWallet(selectedWalletDef, network);
|
|
13879
14052
|
};
|
|
14053
|
+
React30.useEffect(() => {
|
|
14054
|
+
if (!pendingMobileWallet) return;
|
|
14055
|
+
if (mobileDepositAddresses.length > 0) {
|
|
14056
|
+
const wallet = pendingMobileWallet;
|
|
14057
|
+
setPendingMobileWallet(null);
|
|
14058
|
+
void (async () => {
|
|
14059
|
+
if (!await openMobileWalletBrowse(wallet, mobileDepositAddresses)) {
|
|
14060
|
+
window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
|
|
14061
|
+
}
|
|
14062
|
+
})();
|
|
14063
|
+
return;
|
|
14064
|
+
}
|
|
14065
|
+
const timeout = setTimeout(() => {
|
|
14066
|
+
setPendingMobileWallet((current) => {
|
|
14067
|
+
if (!current) return null;
|
|
14068
|
+
window.open(getMobileInstallUrl(current.id, current.installUrl), "_blank", "noopener,noreferrer");
|
|
14069
|
+
return null;
|
|
14070
|
+
});
|
|
14071
|
+
}, 8e3);
|
|
14072
|
+
return () => clearTimeout(timeout);
|
|
14073
|
+
}, [pendingMobileWallet, mobileDepositAddresses]);
|
|
13880
14074
|
const handleConnectWallet = async (wallet, network) => {
|
|
13881
14075
|
setConnectingNetwork(network);
|
|
13882
14076
|
transitionTo("connecting");
|
|
@@ -14021,14 +14215,32 @@ function WalletConnect({
|
|
|
14021
14215
|
userId,
|
|
14022
14216
|
publishableKey,
|
|
14023
14217
|
clientSecret,
|
|
14218
|
+
// In-tab flow: poll the single connected deposit wallet.
|
|
14024
14219
|
depositWalletId: activeDepositWallet?.id ?? "",
|
|
14025
|
-
|
|
14220
|
+
// Mobile redirect flow: the deposit chain isn't known up front, so /poll every
|
|
14221
|
+
// chain's deposit wallet. Detection still happens via the single /query by
|
|
14222
|
+
// external_user_id, which already spans all chains.
|
|
14223
|
+
depositWalletIds: awaitingMobileDeposit ? mobileDepositWalletIds : void 0,
|
|
14224
|
+
enabled: hasSignedTransaction && !!activeDepositWallet || awaitingMobileDeposit,
|
|
14026
14225
|
onDepositSuccess,
|
|
14027
14226
|
onDepositError
|
|
14028
14227
|
});
|
|
14029
14228
|
React30.useEffect(() => {
|
|
14030
14229
|
onExecutionsChange?.(depositExecutions);
|
|
14031
14230
|
}, [depositExecutions, onExecutionsChange]);
|
|
14231
|
+
const latestDepositExecution = React30.useMemo(() => {
|
|
14232
|
+
if (depositExecutions.length === 0) return null;
|
|
14233
|
+
return [...depositExecutions].sort((a, b) => {
|
|
14234
|
+
const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
14235
|
+
const tb = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
14236
|
+
return tb - ta;
|
|
14237
|
+
})[0];
|
|
14238
|
+
}, [depositExecutions]);
|
|
14239
|
+
React30.useEffect(() => {
|
|
14240
|
+
if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
|
|
14241
|
+
transitionTo("mobile_deposit_status");
|
|
14242
|
+
}
|
|
14243
|
+
}, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
|
|
14032
14244
|
React30.useEffect(() => {
|
|
14033
14245
|
if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
|
|
14034
14246
|
const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
|
|
@@ -14047,7 +14259,7 @@ function WalletConnect({
|
|
|
14047
14259
|
const token = getTokenFromBalance(selectedBalance);
|
|
14048
14260
|
if (!token) return;
|
|
14049
14261
|
const options = { destination_token_address: activeDepositWallet.destination_token_address, destination_chain_id: activeDepositWallet.destination_chain_id, destination_chain_type: activeDepositWallet.destination_chain_type, ...productType ? { product_type: productType } : {} };
|
|
14050
|
-
const response = await (0,
|
|
14262
|
+
const response = await (0, import_core29.getSupportedDepositTokens)(publishableKey, options);
|
|
14051
14263
|
if (cancelled) return;
|
|
14052
14264
|
const supportedToken = response.data.find((t12) => t12.symbol.toLowerCase() === token.symbol.toLowerCase());
|
|
14053
14265
|
if (supportedToken) {
|
|
@@ -14071,7 +14283,7 @@ function WalletConnect({
|
|
|
14071
14283
|
setIsLoading(true);
|
|
14072
14284
|
setError(null);
|
|
14073
14285
|
const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" ? "ethereum" : activeDepositWallet.chain_type;
|
|
14074
|
-
(0,
|
|
14286
|
+
(0, import_core29.getAddressBalances)(activeWalletInfo.address, sct, publishableKey).then((response) => {
|
|
14075
14287
|
if (cancelled) return;
|
|
14076
14288
|
const nonZero = response.balances.filter((b) => b.amount !== "0");
|
|
14077
14289
|
const defaultSource = {
|
|
@@ -14159,6 +14371,16 @@ function WalletConnect({
|
|
|
14159
14371
|
setSelectedWalletDef(null);
|
|
14160
14372
|
setConnectingNetwork(null);
|
|
14161
14373
|
break;
|
|
14374
|
+
case "mobile_redirect":
|
|
14375
|
+
transitionTo("select_wallet");
|
|
14376
|
+
setMobileRedirect(null);
|
|
14377
|
+
setAwaitingMobileDeposit(false);
|
|
14378
|
+
break;
|
|
14379
|
+
case "mobile_deposit_status":
|
|
14380
|
+
transitionTo("select_wallet");
|
|
14381
|
+
setMobileRedirect(null);
|
|
14382
|
+
setAwaitingMobileDeposit(false);
|
|
14383
|
+
break;
|
|
14162
14384
|
case "select_token":
|
|
14163
14385
|
if (walletProvidedAtMount.current) parentOnBack?.();
|
|
14164
14386
|
else transitionTo("select_wallet");
|
|
@@ -14285,7 +14507,7 @@ function WalletConnect({
|
|
|
14285
14507
|
if (!provider.publicKey) await provider.connect();
|
|
14286
14508
|
const isNative = token.token_address === "native" || token.token_address === "So11111111111111111111111111111111111111112" || token.token_address === "";
|
|
14287
14509
|
const smallestUnit = isNative ? decimalToSmallestUnit(amountStr, 9) : decimalToSmallestUnit(amountStr, token.decimals);
|
|
14288
|
-
const buildResp = await (0,
|
|
14510
|
+
const buildResp = await (0, import_core29.buildSolanaTransaction)({ chain_id: "mainnet", token_address: token.token_address === "" ? "native" : token.token_address, source_address: walletInfo.address, destination_address: recipientAddress, amount: smallestUnit }, publishableKey);
|
|
14289
14511
|
const { VersionedTransaction } = await import(
|
|
14290
14512
|
/* @vite-ignore */
|
|
14291
14513
|
"@solana/web3.js"
|
|
@@ -14298,7 +14520,7 @@ function WalletConnect({
|
|
|
14298
14520
|
const ser = signed.serialize();
|
|
14299
14521
|
let bs = "";
|
|
14300
14522
|
for (let i = 0; i < ser.length; i++) bs += String.fromCharCode(ser[i]);
|
|
14301
|
-
const resp = await (0,
|
|
14523
|
+
const resp = await (0, import_core29.sendSolanaTransaction)({ chain_id: "mainnet", signed_transaction: btoa(bs) }, publishableKey);
|
|
14302
14524
|
return resp.signature;
|
|
14303
14525
|
};
|
|
14304
14526
|
const handleConfirm = async () => {
|
|
@@ -14344,33 +14566,40 @@ function WalletConnect({
|
|
|
14344
14566
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
14345
14567
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DepositHeader, { title: "Connect Wallet", showBack: canGoBack, onBack: handleBack, onClose }),
|
|
14346
14568
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-pb-4", children: [
|
|
14347
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "uf-text-sm uf-text-center uf-pb-4", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "Select a wallet to connect" }),
|
|
14348
|
-
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) =>
|
|
14349
|
-
"
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14354
|
-
|
|
14355
|
-
|
|
14356
|
-
|
|
14357
|
-
|
|
14358
|
-
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14362
|
-
|
|
14363
|
-
|
|
14364
|
-
|
|
14365
|
-
|
|
14366
|
-
|
|
14367
|
-
|
|
14569
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "uf-text-sm uf-text-center uf-pb-4", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: isMobile ? "Open this page in your wallet's app to connect" : "Select a wallet to connect" }),
|
|
14570
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => {
|
|
14571
|
+
const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
|
|
14572
|
+
const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
|
|
14573
|
+
const isPending = pendingMobileWallet?.id === wallet.id;
|
|
14574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14575
|
+
"button",
|
|
14576
|
+
{
|
|
14577
|
+
onClick: () => void handleWalletClick(wallet),
|
|
14578
|
+
disabled: isWalletConnecting || !!pendingMobileWallet,
|
|
14579
|
+
className: "uf-w-full uf-transition-colors uf-p-3 uf-flex uf-items-center uf-justify-between hover:uf-opacity-90 disabled:uf-opacity-50",
|
|
14580
|
+
style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
|
|
14581
|
+
children: [
|
|
14582
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
14583
|
+
WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
|
|
14584
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name })
|
|
14585
|
+
] }),
|
|
14586
|
+
isPending ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react28.Loader2, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uf-text-xs uf-px-2 uf-py-1 uf-rounded-full", style: { backgroundColor: colors2.primary + "20", color: colors2.primary, fontFamily: fonts.medium }, children: "Detected" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
14587
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
|
|
14588
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react28.ExternalLink, { className: "uf-w-3 uf-h-3", style: { color: colors2.foregroundMuted } })
|
|
14589
|
+
] })
|
|
14590
|
+
]
|
|
14591
|
+
},
|
|
14592
|
+
wallet.id
|
|
14593
|
+
);
|
|
14594
|
+
}) }),
|
|
14368
14595
|
walletError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
|
|
14369
14596
|
] })
|
|
14370
14597
|
] });
|
|
14371
14598
|
}
|
|
14599
|
+
const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
|
|
14600
|
+
const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
|
|
14372
14601
|
if (view === "select_network" && selectedWalletDef) {
|
|
14373
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
14602
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
14374
14603
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DepositHeader, { title: "Select Network", showBack: true, onBack: handleBack, onClose }),
|
|
14375
14604
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-pb-4", children: [
|
|
14376
14605
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-pb-4", children: [
|
|
@@ -14400,10 +14629,10 @@ function WalletConnect({
|
|
|
14400
14629
|
)) }),
|
|
14401
14630
|
walletError && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
|
|
14402
14631
|
] })
|
|
14403
|
-
] });
|
|
14632
|
+
] }) });
|
|
14404
14633
|
}
|
|
14405
14634
|
if (view === "connecting") {
|
|
14406
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
14635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
14407
14636
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DepositHeader, { title: "Connecting...", showBack: true, onBack: handleBack, onClose }),
|
|
14408
14637
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16", children: [
|
|
14409
14638
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react28.Loader2, { className: "uf-w-12 uf-h-12 uf-animate-spin uf-mb-4", style: { color: colors2.primary } }),
|
|
@@ -14414,24 +14643,132 @@ function WalletConnect({
|
|
|
14414
14643
|
] }),
|
|
14415
14644
|
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-text-sm uf-mt-2", style: { color: colors2.foregroundMuted }, children: "Please approve the connection in your wallet" })
|
|
14416
14645
|
] })
|
|
14417
|
-
] });
|
|
14646
|
+
] }) });
|
|
14647
|
+
}
|
|
14648
|
+
if (view === "mobile_redirect" && mobileRedirect) {
|
|
14649
|
+
const Icon2 = WALLET_ICONS3[mobileRedirect.walletId];
|
|
14650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
14651
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DepositHeader, { title: mobileRedirect.walletName, showBack: true, onBack: handleBack, onClose }),
|
|
14652
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-px-6 uf-py-10", children: [
|
|
14653
|
+
Icon2 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Icon2, { size: 64, className: "uf-rounded-2xl uf-mb-5" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-2xl uf-bg-gray-500 uf-mb-5" }),
|
|
14654
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14655
|
+
"div",
|
|
14656
|
+
{
|
|
14657
|
+
className: "uf-text-base uf-font-medium uf-text-center uf-mb-1",
|
|
14658
|
+
style: { color: colors2.foreground, fontFamily: fonts.medium },
|
|
14659
|
+
children: [
|
|
14660
|
+
"Continue in ",
|
|
14661
|
+
mobileRedirect.walletName
|
|
14662
|
+
]
|
|
14663
|
+
}
|
|
14664
|
+
),
|
|
14665
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14666
|
+
"div",
|
|
14667
|
+
{
|
|
14668
|
+
className: "uf-text-sm uf-text-center uf-mb-6",
|
|
14669
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
14670
|
+
children: [
|
|
14671
|
+
"Complete your deposit in the ",
|
|
14672
|
+
mobileRedirect.walletName,
|
|
14673
|
+
" app"
|
|
14674
|
+
]
|
|
14675
|
+
}
|
|
14676
|
+
),
|
|
14677
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
14678
|
+
"button",
|
|
14679
|
+
{
|
|
14680
|
+
type: "button",
|
|
14681
|
+
onClick: () => {
|
|
14682
|
+
window.location.href = mobileRedirect.deeplink;
|
|
14683
|
+
},
|
|
14684
|
+
className: "uf-w-full uf-transition-colors uf-p-3.5 uf-flex uf-items-center uf-justify-center uf-gap-2 hover:uf-opacity-90",
|
|
14685
|
+
style: {
|
|
14686
|
+
backgroundColor: components.card.backgroundColor,
|
|
14687
|
+
borderRadius: components.card.borderRadius,
|
|
14688
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
|
|
14689
|
+
color: components.card.titleColor,
|
|
14690
|
+
fontFamily: fonts.medium
|
|
14691
|
+
},
|
|
14692
|
+
children: [
|
|
14693
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_lucide_react28.ExternalLink, { className: "uf-w-4 uf-h-4", style: { color: components.card.iconColor } }),
|
|
14694
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("span", { className: "uf-text-sm uf-font-medium", children: [
|
|
14695
|
+
"Open in ",
|
|
14696
|
+
mobileRedirect.walletName
|
|
14697
|
+
] })
|
|
14698
|
+
]
|
|
14699
|
+
}
|
|
14700
|
+
),
|
|
14701
|
+
awaitingMobileDeposit && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2 uf-mt-6", children: [
|
|
14702
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14703
|
+
import_lucide_react28.Loader2,
|
|
14704
|
+
{
|
|
14705
|
+
className: "uf-w-4 uf-h-4 uf-animate-spin",
|
|
14706
|
+
style: { color: colors2.foregroundMuted }
|
|
14707
|
+
}
|
|
14708
|
+
),
|
|
14709
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14710
|
+
"span",
|
|
14711
|
+
{
|
|
14712
|
+
className: "uf-text-sm",
|
|
14713
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
14714
|
+
children: "Checking for deposit..."
|
|
14715
|
+
}
|
|
14716
|
+
)
|
|
14717
|
+
] })
|
|
14718
|
+
] })
|
|
14719
|
+
] }) });
|
|
14720
|
+
}
|
|
14721
|
+
if (view === "mobile_deposit_status" && latestDepositExecution) {
|
|
14722
|
+
const isComplete = latestDepositExecution.status === import_core29.ExecutionStatus.SUCCEEDED;
|
|
14723
|
+
const isFailed = latestDepositExecution.status === import_core29.ExecutionStatus.FAILED;
|
|
14724
|
+
const title = isComplete ? "Payment Complete" : isFailed ? "Payment Failed" : "Payment Processing";
|
|
14725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
14726
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14727
|
+
DepositHeader,
|
|
14728
|
+
{
|
|
14729
|
+
title,
|
|
14730
|
+
showBack: false,
|
|
14731
|
+
onClose: isComplete && onDone ? onDone : onClose
|
|
14732
|
+
}
|
|
14733
|
+
),
|
|
14734
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DepositDetailContent, { execution: latestDepositExecution }),
|
|
14735
|
+
isComplete && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-4 uf-pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
14736
|
+
"button",
|
|
14737
|
+
{
|
|
14738
|
+
type: "button",
|
|
14739
|
+
onClick: onDone ? onDone : onNewDeposit ? onNewDeposit : onClose ?? (() => {
|
|
14740
|
+
}),
|
|
14741
|
+
className: "uf-flex-1 uf-py-4 uf-text-sm uf-font-medium uf-transition-opacity hover:uf-opacity-80",
|
|
14742
|
+
style: {
|
|
14743
|
+
backgroundColor: colors2.primary,
|
|
14744
|
+
color: colors2.primaryForeground,
|
|
14745
|
+
fontFamily: fonts.medium,
|
|
14746
|
+
borderRadius: components.button.borderRadius,
|
|
14747
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
14748
|
+
},
|
|
14749
|
+
children: "Done"
|
|
14750
|
+
}
|
|
14751
|
+
) })
|
|
14752
|
+
] }) });
|
|
14418
14753
|
}
|
|
14419
14754
|
if (!hasWallet) return null;
|
|
14755
|
+
const walletAccent = getWalletBrandColor(walletInfo.type, mode);
|
|
14756
|
+
const walletAccentForeground = walletAccent ? getContrastingTextColor(walletAccent) : void 0;
|
|
14420
14757
|
if (view === "select_token") {
|
|
14421
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectTokenView, { walletInfo, projectName, assetCdnUrl, balances, isLoading, error, selectedBalance, totalBalanceUsd, onTokenSelect: handleTokenSelect, onContinue: handleContinueToAmount, onBack: handleBack, onClose: onClose ?? (() => {
|
|
14422
|
-
}), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) });
|
|
14758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SelectTokenView, { walletInfo, projectName, assetCdnUrl, balances, isLoading, error, selectedBalance, totalBalanceUsd, onTokenSelect: handleTokenSelect, onContinue: handleContinueToAmount, onBack: handleBack, onClose: onClose ?? (() => {
|
|
14759
|
+
}), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) }) });
|
|
14423
14760
|
}
|
|
14424
14761
|
if (view === "enter_amount" && selectedToken && selectedBalance) {
|
|
14425
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
|
|
14426
|
-
}), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) });
|
|
14762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
|
|
14763
|
+
}), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) }) });
|
|
14427
14764
|
}
|
|
14428
14765
|
if (view === "review" && selectedToken) {
|
|
14429
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
|
|
14430
|
-
}) }) });
|
|
14766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
|
|
14767
|
+
}) }) }) });
|
|
14431
14768
|
}
|
|
14432
14769
|
if (view === "confirming") {
|
|
14433
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ConfirmingView, { isConfirming, onClose: onClose ?? (() => {
|
|
14434
|
-
}), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) });
|
|
14770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ConfirmingView, { isConfirming, onClose: onClose ?? (() => {
|
|
14771
|
+
}), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) }) });
|
|
14435
14772
|
}
|
|
14436
14773
|
return null;
|
|
14437
14774
|
}
|
|
@@ -14546,7 +14883,6 @@ function DepositModal({
|
|
|
14546
14883
|
const [allExecutions, setAllExecutions] = (0, import_react20.useState)([]);
|
|
14547
14884
|
const [selectedExecution, setSelectedExecution] = (0, import_react20.useState)(null);
|
|
14548
14885
|
const [depositExecutions, setDepositExecutions] = (0, import_react20.useState)([]);
|
|
14549
|
-
const isMobileView = useIsMobileViewport();
|
|
14550
14886
|
const { projectConfig } = useProjectConfig({
|
|
14551
14887
|
publishableKey,
|
|
14552
14888
|
enabled: open
|
|
@@ -14561,18 +14897,18 @@ function DepositModal({
|
|
|
14561
14897
|
const [integrationExchanges, setIntegrationExchanges] = (0, import_react20.useState)([]);
|
|
14562
14898
|
(0, import_react20.useEffect)(() => {
|
|
14563
14899
|
if (!showConnectExchange || !open) return;
|
|
14564
|
-
(0,
|
|
14900
|
+
(0, import_core30.getIntegrationExchanges)(publishableKey).then((res) => setIntegrationExchanges(res.data)).catch(() => {
|
|
14565
14901
|
});
|
|
14566
14902
|
}, [showConnectExchange, open, publishableKey]);
|
|
14567
14903
|
const [connectedExchange, setConnectedExchange] = (0, import_react20.useState)(() => {
|
|
14568
14904
|
if (!showConnectExchange) return null;
|
|
14569
|
-
const stored = getStoredIntegrationToken(
|
|
14905
|
+
const stored = getStoredIntegrationToken(import_core30.IntegrationProvider.COINBASE);
|
|
14570
14906
|
if (!stored) return null;
|
|
14571
14907
|
return { name: "Coinbase", iconUrl: void 0, balanceUsd: null, isLoading: true };
|
|
14572
14908
|
});
|
|
14573
14909
|
(0, import_react20.useEffect)(() => {
|
|
14574
14910
|
if (!showConnectExchange || !open || view !== "main") return;
|
|
14575
|
-
const stored = getStoredIntegrationToken(
|
|
14911
|
+
const stored = getStoredIntegrationToken(import_core30.IntegrationProvider.COINBASE);
|
|
14576
14912
|
if (!stored) {
|
|
14577
14913
|
setConnectedExchange(null);
|
|
14578
14914
|
return;
|
|
@@ -14589,20 +14925,20 @@ function DepositModal({
|
|
|
14589
14925
|
const balanceUsd = totalUsd > 0 ? totalUsd.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) : null;
|
|
14590
14926
|
setConnectedExchange((prev) => prev ? { ...prev, balanceUsd, isLoading: false } : null);
|
|
14591
14927
|
};
|
|
14592
|
-
(0,
|
|
14928
|
+
(0, import_core30.getIntegrationHoldings)(import_core30.IntegrationProvider.COINBASE, stored.access_token, publishableKey).then(processHoldings).catch(async () => {
|
|
14593
14929
|
try {
|
|
14594
|
-
const refreshResult = await (0,
|
|
14595
|
-
if (!getStoredIntegrationToken(
|
|
14930
|
+
const refreshResult = await (0, import_core30.refreshIntegrationToken)(stored.access_token, publishableKey);
|
|
14931
|
+
if (!getStoredIntegrationToken(import_core30.IntegrationProvider.COINBASE)) return;
|
|
14596
14932
|
setStoredIntegrationToken({
|
|
14597
|
-
integration_provider:
|
|
14933
|
+
integration_provider: import_core30.IntegrationProvider.COINBASE,
|
|
14598
14934
|
access_token: refreshResult.access_token,
|
|
14599
14935
|
expires_at: refreshResult.expires_at
|
|
14600
14936
|
});
|
|
14601
|
-
const retryResult = await (0,
|
|
14937
|
+
const retryResult = await (0, import_core30.getIntegrationHoldings)(import_core30.IntegrationProvider.COINBASE, refreshResult.access_token, publishableKey);
|
|
14602
14938
|
processHoldings(retryResult);
|
|
14603
14939
|
} catch {
|
|
14604
|
-
if (!getStoredIntegrationToken(
|
|
14605
|
-
clearStoredIntegrationToken(
|
|
14940
|
+
if (!getStoredIntegrationToken(import_core30.IntegrationProvider.COINBASE)) return;
|
|
14941
|
+
clearStoredIntegrationToken(import_core30.IntegrationProvider.COINBASE);
|
|
14606
14942
|
setConnectedExchange(null);
|
|
14607
14943
|
}
|
|
14608
14944
|
});
|
|
@@ -14610,7 +14946,7 @@ function DepositModal({
|
|
|
14610
14946
|
(0, import_react20.useEffect)(() => {
|
|
14611
14947
|
if (!connectedExchange || integrationExchanges.length === 0) return;
|
|
14612
14948
|
const cbExchange = integrationExchanges.find(
|
|
14613
|
-
(e) => e.service_provider ===
|
|
14949
|
+
(e) => e.service_provider === import_core30.IntegrationProvider.COINBASE
|
|
14614
14950
|
);
|
|
14615
14951
|
const iconUrl = cbExchange?.icon_urls?.find((u) => u.format === "svg")?.url || cbExchange?.icon_urls?.find((u) => u.format === "png")?.url || cbExchange?.icon_url;
|
|
14616
14952
|
if (iconUrl && iconUrl !== connectedExchange.iconUrl) {
|
|
@@ -14696,7 +15032,7 @@ function DepositModal({
|
|
|
14696
15032
|
if (view !== "tracker" || !userId) return;
|
|
14697
15033
|
const fetchExecutions = async () => {
|
|
14698
15034
|
try {
|
|
14699
|
-
const response = await (0,
|
|
15035
|
+
const response = await (0, import_core30.queryExecutions)(userId, publishableKey, import_core30.ActionType.Deposit);
|
|
14700
15036
|
const sorted = [...response.data].sort((a, b) => {
|
|
14701
15037
|
const timeA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
14702
15038
|
const timeB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
@@ -14800,11 +15136,11 @@ function DepositModal({
|
|
|
14800
15136
|
if (view === "wallet_connect" && sessionOpenedFromMenu) setView("main");
|
|
14801
15137
|
};
|
|
14802
15138
|
const handleExchangeDisconnect = () => {
|
|
14803
|
-
const stored = getStoredIntegrationToken(
|
|
15139
|
+
const stored = getStoredIntegrationToken(import_core30.IntegrationProvider.COINBASE);
|
|
14804
15140
|
if (stored) {
|
|
14805
|
-
(0,
|
|
15141
|
+
(0, import_core30.revokeIntegrationToken)(stored.access_token, publishableKey);
|
|
14806
15142
|
}
|
|
14807
|
-
clearStoredIntegrationToken(
|
|
15143
|
+
clearStoredIntegrationToken(import_core30.IntegrationProvider.COINBASE);
|
|
14808
15144
|
setConnectedExchange(null);
|
|
14809
15145
|
if (view === "coinbase_connect" && sessionOpenedFromMenu) setView("main");
|
|
14810
15146
|
};
|
|
@@ -14942,7 +15278,7 @@ function DepositModal({
|
|
|
14942
15278
|
open: hideOverlay || open,
|
|
14943
15279
|
onOpenChange: hideOverlay ? void 0 : handleClose,
|
|
14944
15280
|
modal: !hideOverlay,
|
|
14945
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime55.
|
|
15281
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(
|
|
14946
15282
|
DialogContent,
|
|
14947
15283
|
{
|
|
14948
15284
|
ref: hideOverlay ? containerCallbackRef : void 0,
|
|
@@ -14951,386 +15287,389 @@ function DepositModal({
|
|
|
14951
15287
|
style: { backgroundColor: colors2.background },
|
|
14952
15288
|
onPointerDownOutside: (e) => e.preventDefault(),
|
|
14953
15289
|
onInteractOutside: (e) => e.preventDefault(),
|
|
14954
|
-
children:
|
|
14955
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
14956
|
-
|
|
14957
|
-
|
|
14958
|
-
|
|
14959
|
-
|
|
14960
|
-
|
|
14961
|
-
|
|
14962
|
-
|
|
14963
|
-
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14970
|
-
|
|
14971
|
-
|
|
14972
|
-
|
|
14973
|
-
|
|
14974
|
-
|
|
14975
|
-
|
|
14976
|
-
|
|
14977
|
-
|
|
14978
|
-
|
|
14979
|
-
|
|
14980
|
-
|
|
14981
|
-
|
|
14982
|
-
|
|
15290
|
+
children: [
|
|
15291
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DialogTitle, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
|
|
15292
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15293
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15294
|
+
DepositHeader,
|
|
15295
|
+
{
|
|
15296
|
+
title: modalTitle || "Deposit",
|
|
15297
|
+
showClose: !hideOverlay,
|
|
15298
|
+
onClose: handleClose,
|
|
15299
|
+
showBalance: showBalanceHeader,
|
|
15300
|
+
balanceAddress: recipientAddress,
|
|
15301
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
|
|
15302
|
+
balanceChainId: destinationChainId,
|
|
15303
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
15304
|
+
projectName: projectConfig?.project_name,
|
|
15305
|
+
publishableKey
|
|
15306
|
+
}
|
|
15307
|
+
),
|
|
15308
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15309
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-space-y-3", children: depositPrerequisiteBody ?? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15310
|
+
showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15311
|
+
TransferCryptoButton,
|
|
15312
|
+
{
|
|
15313
|
+
onClick: () => setView("transfer"),
|
|
15314
|
+
title: transferCryptoTitle,
|
|
15315
|
+
subtitle: t7.transferCrypto.subtitle,
|
|
15316
|
+
featuredTokens: projectConfig?.transfer_crypto.networks
|
|
15317
|
+
}
|
|
15318
|
+
),
|
|
15319
|
+
showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15320
|
+
BrowserWalletButton,
|
|
15321
|
+
{
|
|
15322
|
+
onClick: handleBrowserWalletClick,
|
|
15323
|
+
onConnectClick: handleWalletConnectClick,
|
|
15324
|
+
onDisconnect: handleWalletDisconnect,
|
|
15325
|
+
chainType: browserWalletChainType,
|
|
15326
|
+
publishableKey,
|
|
15327
|
+
featuredWallets: projectConfig?.connect_wallet?.wallets
|
|
15328
|
+
}
|
|
15329
|
+
),
|
|
15330
|
+
showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15331
|
+
DepositWithCardButton,
|
|
15332
|
+
{
|
|
15333
|
+
onClick: () => setView("card"),
|
|
15334
|
+
title: depositWithCardTitle,
|
|
15335
|
+
subtitle: t7.depositWithCard.subtitle,
|
|
15336
|
+
paymentNetworks: projectConfig?.payment_networks.networks
|
|
15337
|
+
}
|
|
15338
|
+
),
|
|
15339
|
+
showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15340
|
+
PayWithExchangeButton,
|
|
15341
|
+
{
|
|
15342
|
+
onClick: () => setView("exchange"),
|
|
15343
|
+
title: payWithExchangeTitle,
|
|
15344
|
+
subtitle: t7.payWithExchange.subtitle,
|
|
15345
|
+
exchanges,
|
|
15346
|
+
loading: exchangesLoading
|
|
15347
|
+
}
|
|
15348
|
+
),
|
|
15349
|
+
showConnectExchange && connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15350
|
+
ConnectExchangeButton,
|
|
15351
|
+
{
|
|
15352
|
+
onClick: () => {
|
|
15353
|
+
setCoinbaseSkipToHoldings(true);
|
|
15354
|
+
setView("coinbase_connect");
|
|
15355
|
+
},
|
|
15356
|
+
onDisconnect: handleExchangeDisconnect,
|
|
15357
|
+
title: i18n.connectExchange.title,
|
|
15358
|
+
subtitle: i18n.connectExchange.subtitle,
|
|
15359
|
+
exchanges: integrationExchanges,
|
|
15360
|
+
connectedExchange
|
|
15361
|
+
}
|
|
15362
|
+
),
|
|
15363
|
+
showConnectExchange && !connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15364
|
+
ConnectExchangeButton,
|
|
15365
|
+
{
|
|
15366
|
+
onClick: () => {
|
|
15367
|
+
setCoinbaseSkipToHoldings(false);
|
|
15368
|
+
setView("coinbase_connect");
|
|
15369
|
+
},
|
|
15370
|
+
title: i18n.connectExchange.title,
|
|
15371
|
+
subtitle: i18n.connectExchange.subtitle,
|
|
15372
|
+
exchanges: integrationExchanges
|
|
15373
|
+
}
|
|
15374
|
+
),
|
|
15375
|
+
showCashApp && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15376
|
+
CashAppButton,
|
|
15377
|
+
{
|
|
15378
|
+
onClick: () => setView("cashapp"),
|
|
15379
|
+
title: "Pay with Cash App",
|
|
15380
|
+
subtitle: "Deposit via Cash App",
|
|
15381
|
+
iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
|
|
15382
|
+
}
|
|
15383
|
+
),
|
|
15384
|
+
showDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15385
|
+
DepositTrackerButton,
|
|
15386
|
+
{
|
|
15387
|
+
onClick: () => {
|
|
15388
|
+
setAllExecutions(depositExecutions);
|
|
15389
|
+
setView("tracker");
|
|
15390
|
+
},
|
|
15391
|
+
title: depositTrackerTitle,
|
|
15392
|
+
subtitle: depositTrackerSubTitle,
|
|
15393
|
+
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
15394
|
+
}
|
|
15395
|
+
)
|
|
15396
|
+
] }) }),
|
|
15397
|
+
depositPoweredByFooter
|
|
15398
|
+
] })
|
|
15399
|
+
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15400
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15401
|
+
DepositHeader,
|
|
15402
|
+
{
|
|
15403
|
+
title: transferCryptoTitle,
|
|
15404
|
+
showBack: showBackTransfer,
|
|
15405
|
+
onBack: handleBack,
|
|
15406
|
+
onClose: handleClose,
|
|
15407
|
+
showBalance: showBalanceHeader,
|
|
15408
|
+
balanceAddress: recipientAddress,
|
|
15409
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
|
|
15410
|
+
balanceChainId: destinationChainId,
|
|
15411
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
15412
|
+
projectName: projectConfig?.project_name,
|
|
15413
|
+
publishableKey
|
|
15414
|
+
}
|
|
15415
|
+
),
|
|
15416
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15417
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15418
|
+
TransferCryptoSingleInput,
|
|
14983
15419
|
{
|
|
14984
|
-
|
|
14985
|
-
onConnectClick: handleWalletConnectClick,
|
|
14986
|
-
onDisconnect: handleWalletDisconnect,
|
|
14987
|
-
chainType: browserWalletChainType,
|
|
15420
|
+
userId,
|
|
14988
15421
|
publishableKey,
|
|
14989
|
-
|
|
15422
|
+
recipientAddress,
|
|
15423
|
+
destinationChainType,
|
|
15424
|
+
destinationChainId,
|
|
15425
|
+
destinationTokenAddress,
|
|
15426
|
+
defaultSourceChainType,
|
|
15427
|
+
defaultSourceChainId,
|
|
15428
|
+
defaultSourceTokenAddress,
|
|
15429
|
+
defaultSourceSymbol,
|
|
15430
|
+
depositConfirmationMode,
|
|
15431
|
+
onExecutionsChange: setDepositExecutions,
|
|
15432
|
+
onDepositSuccess,
|
|
15433
|
+
onDepositError,
|
|
15434
|
+
wallets
|
|
14990
15435
|
}
|
|
14991
|
-
),
|
|
14992
|
-
|
|
14993
|
-
DepositWithCardButton,
|
|
15436
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15437
|
+
TransferCryptoDoubleInput,
|
|
14994
15438
|
{
|
|
14995
|
-
|
|
14996
|
-
|
|
14997
|
-
|
|
14998
|
-
|
|
15439
|
+
userId,
|
|
15440
|
+
publishableKey,
|
|
15441
|
+
recipientAddress,
|
|
15442
|
+
destinationChainType,
|
|
15443
|
+
destinationChainId,
|
|
15444
|
+
destinationTokenAddress,
|
|
15445
|
+
defaultSourceChainType,
|
|
15446
|
+
defaultSourceChainId,
|
|
15447
|
+
defaultSourceTokenAddress,
|
|
15448
|
+
defaultSourceSymbol,
|
|
15449
|
+
depositConfirmationMode,
|
|
15450
|
+
onExecutionsChange: setDepositExecutions,
|
|
15451
|
+
onDepositSuccess,
|
|
15452
|
+
onDepositError,
|
|
15453
|
+
wallets
|
|
14999
15454
|
}
|
|
15000
15455
|
),
|
|
15001
|
-
|
|
15002
|
-
|
|
15456
|
+
depositPoweredByFooter
|
|
15457
|
+
] })
|
|
15458
|
+
] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15459
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15460
|
+
DepositHeader,
|
|
15461
|
+
{
|
|
15462
|
+
title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
|
|
15463
|
+
showBack: showBackTracker,
|
|
15464
|
+
onBack: handleBack,
|
|
15465
|
+
onClose: handleClose
|
|
15466
|
+
}
|
|
15467
|
+
),
|
|
15468
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15469
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15470
|
+
"div",
|
|
15003
15471
|
{
|
|
15004
|
-
|
|
15005
|
-
|
|
15006
|
-
|
|
15007
|
-
exchanges,
|
|
15008
|
-
loading: exchangesLoading
|
|
15472
|
+
className: "uf-text-sm",
|
|
15473
|
+
style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
|
|
15474
|
+
children: "No deposits yet"
|
|
15009
15475
|
}
|
|
15010
|
-
),
|
|
15011
|
-
|
|
15012
|
-
ConnectExchangeButton,
|
|
15476
|
+
) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15477
|
+
DepositExecutionItem,
|
|
15013
15478
|
{
|
|
15014
|
-
|
|
15015
|
-
|
|
15016
|
-
|
|
15017
|
-
|
|
15018
|
-
|
|
15019
|
-
|
|
15020
|
-
|
|
15021
|
-
|
|
15022
|
-
|
|
15023
|
-
|
|
15024
|
-
|
|
15025
|
-
|
|
15026
|
-
|
|
15479
|
+
execution,
|
|
15480
|
+
onClick: () => setSelectedExecution(execution)
|
|
15481
|
+
},
|
|
15482
|
+
execution.id
|
|
15483
|
+
)) }) }),
|
|
15484
|
+
depositPoweredByFooter
|
|
15485
|
+
] })
|
|
15486
|
+
] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15487
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15488
|
+
DepositHeader,
|
|
15489
|
+
{
|
|
15490
|
+
title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
|
|
15491
|
+
showBack: showBackCard,
|
|
15492
|
+
onBack: handleBack,
|
|
15493
|
+
onClose: handleClose,
|
|
15494
|
+
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
15495
|
+
showBalance: showBalanceHeader,
|
|
15496
|
+
balanceAddress: recipientAddress,
|
|
15497
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
|
|
15498
|
+
balanceChainId: destinationChainId,
|
|
15499
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
15500
|
+
projectName: projectConfig?.project_name,
|
|
15501
|
+
publishableKey
|
|
15502
|
+
}
|
|
15503
|
+
),
|
|
15504
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15505
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15506
|
+
BuyWithCard,
|
|
15027
15507
|
{
|
|
15028
|
-
|
|
15029
|
-
|
|
15030
|
-
|
|
15031
|
-
|
|
15032
|
-
|
|
15033
|
-
|
|
15034
|
-
|
|
15508
|
+
userId,
|
|
15509
|
+
publishableKey,
|
|
15510
|
+
view: cardView,
|
|
15511
|
+
onViewChange: handleCardViewChange,
|
|
15512
|
+
destinationTokenSymbol,
|
|
15513
|
+
recipientAddress,
|
|
15514
|
+
destinationChainType,
|
|
15515
|
+
destinationChainId,
|
|
15516
|
+
destinationTokenAddress,
|
|
15517
|
+
onDepositSuccess,
|
|
15518
|
+
onDepositError,
|
|
15519
|
+
onEvent,
|
|
15520
|
+
themeClass,
|
|
15521
|
+
wallets,
|
|
15522
|
+
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
15523
|
+
hideDepositFlowInfo,
|
|
15524
|
+
hideDisplayDescription
|
|
15035
15525
|
}
|
|
15036
15526
|
),
|
|
15037
|
-
|
|
15038
|
-
|
|
15527
|
+
depositPoweredByFooter
|
|
15528
|
+
] })
|
|
15529
|
+
] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15530
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15531
|
+
DepositHeader,
|
|
15532
|
+
{
|
|
15533
|
+
title: payWithExchangeTitle,
|
|
15534
|
+
showBack: exchangeView === "pending" || sessionOpenedFromMenu,
|
|
15535
|
+
onBack: handleBack,
|
|
15536
|
+
onClose: handleClose
|
|
15537
|
+
}
|
|
15538
|
+
),
|
|
15539
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15540
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15541
|
+
PayWithExchange,
|
|
15039
15542
|
{
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15543
|
+
userId,
|
|
15544
|
+
publishableKey,
|
|
15545
|
+
exchanges,
|
|
15546
|
+
view: exchangeView,
|
|
15547
|
+
onViewChange: setExchangeView,
|
|
15548
|
+
destinationTokenSymbol,
|
|
15549
|
+
recipientAddress,
|
|
15550
|
+
destinationChainType,
|
|
15551
|
+
destinationChainId,
|
|
15552
|
+
destinationTokenAddress,
|
|
15553
|
+
onDepositSuccess,
|
|
15554
|
+
onDepositError,
|
|
15555
|
+
wallets,
|
|
15556
|
+
defaultToken: defaultToken ?? null
|
|
15044
15557
|
}
|
|
15045
15558
|
),
|
|
15046
|
-
|
|
15047
|
-
|
|
15048
|
-
|
|
15049
|
-
|
|
15050
|
-
|
|
15051
|
-
setView("tracker");
|
|
15052
|
-
},
|
|
15053
|
-
title: depositTrackerTitle,
|
|
15054
|
-
subtitle: depositTrackerSubTitle,
|
|
15055
|
-
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
15056
|
-
}
|
|
15057
|
-
)
|
|
15058
|
-
] }) }),
|
|
15059
|
-
depositPoweredByFooter
|
|
15060
|
-
] })
|
|
15061
|
-
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15062
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15063
|
-
DepositHeader,
|
|
15064
|
-
{
|
|
15065
|
-
title: transferCryptoTitle,
|
|
15066
|
-
showBack: showBackTransfer,
|
|
15067
|
-
onBack: handleBack,
|
|
15068
|
-
onClose: handleClose,
|
|
15069
|
-
showBalance: showBalanceHeader,
|
|
15070
|
-
balanceAddress: recipientAddress,
|
|
15071
|
-
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
|
|
15072
|
-
balanceChainId: destinationChainId,
|
|
15073
|
-
balanceTokenAddress: destinationTokenAddress,
|
|
15074
|
-
projectName: projectConfig?.project_name,
|
|
15075
|
-
publishableKey
|
|
15076
|
-
}
|
|
15077
|
-
),
|
|
15078
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15079
|
-
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15080
|
-
TransferCryptoSingleInput,
|
|
15559
|
+
depositPoweredByFooter
|
|
15560
|
+
] })
|
|
15561
|
+
] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15562
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15563
|
+
CoinbaseConnect,
|
|
15081
15564
|
{
|
|
15082
|
-
userId,
|
|
15083
15565
|
publishableKey,
|
|
15084
|
-
recipientAddress,
|
|
15085
|
-
destinationChainType,
|
|
15086
|
-
destinationChainId,
|
|
15087
|
-
destinationTokenAddress,
|
|
15088
|
-
defaultSourceChainType,
|
|
15089
|
-
defaultSourceChainId,
|
|
15090
|
-
defaultSourceTokenAddress,
|
|
15091
|
-
defaultSourceSymbol,
|
|
15092
|
-
depositConfirmationMode,
|
|
15093
|
-
onExecutionsChange: setDepositExecutions,
|
|
15094
|
-
onDepositSuccess,
|
|
15095
|
-
onDepositError,
|
|
15096
|
-
wallets
|
|
15097
|
-
}
|
|
15098
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15099
|
-
TransferCryptoDoubleInput,
|
|
15100
|
-
{
|
|
15101
15566
|
userId,
|
|
15102
|
-
|
|
15567
|
+
wallets,
|
|
15103
15568
|
recipientAddress,
|
|
15104
|
-
|
|
15105
|
-
destinationChainId,
|
|
15106
|
-
|
|
15569
|
+
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
15570
|
+
destinationChainId: destinationChainId ?? "",
|
|
15571
|
+
destinationChainType: destinationChainType ?? "",
|
|
15572
|
+
onTransferSuccess: (result) => {
|
|
15573
|
+
onDepositSuccess?.({
|
|
15574
|
+
message: "Transfer completed via Coinbase Connect",
|
|
15575
|
+
transaction: result
|
|
15576
|
+
});
|
|
15577
|
+
},
|
|
15578
|
+
onTransferError: (error) => {
|
|
15579
|
+
onDepositError?.({
|
|
15580
|
+
message: error.message,
|
|
15581
|
+
error
|
|
15582
|
+
});
|
|
15583
|
+
},
|
|
15584
|
+
onBack: handleBack,
|
|
15585
|
+
onClose: handleClose,
|
|
15586
|
+
onDisconnect: handleExchangeDisconnect,
|
|
15587
|
+
skipToHoldings: coinbaseSkipToHoldings,
|
|
15588
|
+
canGoBack: sessionOpenedFromMenu,
|
|
15589
|
+
onExecutionsChange: setDepositExecutions,
|
|
15107
15590
|
defaultSourceChainType,
|
|
15108
15591
|
defaultSourceChainId,
|
|
15109
15592
|
defaultSourceTokenAddress,
|
|
15110
|
-
defaultSourceSymbol
|
|
15111
|
-
depositConfirmationMode,
|
|
15112
|
-
onExecutionsChange: setDepositExecutions,
|
|
15113
|
-
onDepositSuccess,
|
|
15114
|
-
onDepositError,
|
|
15115
|
-
wallets
|
|
15116
|
-
}
|
|
15117
|
-
),
|
|
15118
|
-
depositPoweredByFooter
|
|
15119
|
-
] })
|
|
15120
|
-
] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15121
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15122
|
-
DepositHeader,
|
|
15123
|
-
{
|
|
15124
|
-
title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
|
|
15125
|
-
showBack: showBackTracker,
|
|
15126
|
-
onBack: handleBack,
|
|
15127
|
-
onClose: handleClose
|
|
15128
|
-
}
|
|
15129
|
-
),
|
|
15130
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15131
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15132
|
-
"div",
|
|
15133
|
-
{
|
|
15134
|
-
className: "uf-text-sm",
|
|
15135
|
-
style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
|
|
15136
|
-
children: "No deposits yet"
|
|
15137
|
-
}
|
|
15138
|
-
) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15139
|
-
DepositExecutionItem,
|
|
15140
|
-
{
|
|
15141
|
-
execution,
|
|
15142
|
-
onClick: () => setSelectedExecution(execution)
|
|
15143
|
-
},
|
|
15144
|
-
execution.id
|
|
15145
|
-
)) }) }),
|
|
15146
|
-
depositPoweredByFooter
|
|
15147
|
-
] })
|
|
15148
|
-
] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15149
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15150
|
-
DepositHeader,
|
|
15151
|
-
{
|
|
15152
|
-
title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
|
|
15153
|
-
showBack: showBackCard,
|
|
15154
|
-
onBack: handleBack,
|
|
15155
|
-
onClose: handleClose,
|
|
15156
|
-
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
15157
|
-
showBalance: showBalanceHeader,
|
|
15158
|
-
balanceAddress: recipientAddress,
|
|
15159
|
-
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
|
|
15160
|
-
balanceChainId: destinationChainId,
|
|
15161
|
-
balanceTokenAddress: destinationTokenAddress,
|
|
15162
|
-
projectName: projectConfig?.project_name,
|
|
15163
|
-
publishableKey
|
|
15164
|
-
}
|
|
15165
|
-
),
|
|
15166
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15167
|
-
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15168
|
-
BuyWithCard,
|
|
15169
|
-
{
|
|
15170
|
-
userId,
|
|
15171
|
-
publishableKey,
|
|
15172
|
-
view: cardView,
|
|
15173
|
-
onViewChange: handleCardViewChange,
|
|
15174
|
-
destinationTokenSymbol,
|
|
15175
|
-
recipientAddress,
|
|
15176
|
-
destinationChainType,
|
|
15177
|
-
destinationChainId,
|
|
15178
|
-
destinationTokenAddress,
|
|
15179
|
-
onDepositSuccess,
|
|
15180
|
-
onDepositError,
|
|
15181
|
-
onEvent,
|
|
15182
|
-
themeClass,
|
|
15183
|
-
wallets,
|
|
15184
|
-
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
15185
|
-
hideDepositFlowInfo,
|
|
15186
|
-
hideDisplayDescription
|
|
15593
|
+
defaultSourceSymbol
|
|
15187
15594
|
}
|
|
15188
15595
|
),
|
|
15189
15596
|
depositPoweredByFooter
|
|
15190
|
-
] })
|
|
15191
|
-
] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15192
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15193
|
-
DepositHeader,
|
|
15194
|
-
{
|
|
15195
|
-
title: payWithExchangeTitle,
|
|
15196
|
-
showBack: exchangeView === "pending" || sessionOpenedFromMenu,
|
|
15197
|
-
onBack: handleBack,
|
|
15198
|
-
onClose: handleClose
|
|
15199
|
-
}
|
|
15200
|
-
),
|
|
15201
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15597
|
+
] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15202
15598
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15203
|
-
|
|
15599
|
+
WalletConnect,
|
|
15204
15600
|
{
|
|
15601
|
+
walletInfo: browserWalletInfo ?? void 0,
|
|
15602
|
+
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
15603
|
+
wallets,
|
|
15205
15604
|
userId,
|
|
15206
15605
|
publishableKey,
|
|
15207
|
-
|
|
15208
|
-
|
|
15209
|
-
|
|
15210
|
-
|
|
15211
|
-
|
|
15212
|
-
|
|
15213
|
-
|
|
15214
|
-
|
|
15606
|
+
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
15607
|
+
projectName: projectConfig?.project_name,
|
|
15608
|
+
onSuccess: (txHash) => {
|
|
15609
|
+
onDepositSuccess?.({
|
|
15610
|
+
message: "Transaction sent successfully",
|
|
15611
|
+
transaction: { txHash }
|
|
15612
|
+
});
|
|
15613
|
+
},
|
|
15614
|
+
onError: (error) => {
|
|
15615
|
+
onDepositError?.({
|
|
15616
|
+
message: error.message,
|
|
15617
|
+
error
|
|
15618
|
+
});
|
|
15619
|
+
},
|
|
15215
15620
|
onDepositSuccess,
|
|
15216
15621
|
onDepositError,
|
|
15217
|
-
|
|
15218
|
-
|
|
15622
|
+
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
15623
|
+
onWalletDisconnect: handleWalletDisconnect,
|
|
15624
|
+
onWalletConnected: (info, dw) => {
|
|
15625
|
+
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
15626
|
+
setStoredWalletState(info.type);
|
|
15627
|
+
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
15628
|
+
},
|
|
15629
|
+
onBack: handleBack,
|
|
15630
|
+
onClose: handleClose,
|
|
15631
|
+
defaultSourceChainType,
|
|
15632
|
+
defaultSourceChainId,
|
|
15633
|
+
defaultSourceTokenAddress,
|
|
15634
|
+
defaultSourceSymbol,
|
|
15635
|
+
canGoBack: sessionOpenedFromMenu,
|
|
15636
|
+
depositWalletsLoading: walletsLoading
|
|
15219
15637
|
}
|
|
15220
15638
|
),
|
|
15221
15639
|
depositPoweredByFooter
|
|
15222
|
-
] })
|
|
15223
|
-
] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15224
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15225
|
-
CoinbaseConnect,
|
|
15226
|
-
{
|
|
15227
|
-
publishableKey,
|
|
15228
|
-
userId,
|
|
15229
|
-
wallets,
|
|
15230
|
-
recipientAddress,
|
|
15231
|
-
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
15232
|
-
destinationChainId: destinationChainId ?? "",
|
|
15233
|
-
destinationChainType: destinationChainType ?? "",
|
|
15234
|
-
onTransferSuccess: (result) => {
|
|
15235
|
-
onDepositSuccess?.({
|
|
15236
|
-
message: "Transfer completed via Coinbase Connect",
|
|
15237
|
-
transaction: result
|
|
15238
|
-
});
|
|
15239
|
-
},
|
|
15240
|
-
onTransferError: (error) => {
|
|
15241
|
-
onDepositError?.({
|
|
15242
|
-
message: error.message,
|
|
15243
|
-
error
|
|
15244
|
-
});
|
|
15245
|
-
},
|
|
15246
|
-
onBack: handleBack,
|
|
15247
|
-
onClose: handleClose,
|
|
15248
|
-
onDisconnect: handleExchangeDisconnect,
|
|
15249
|
-
skipToHoldings: coinbaseSkipToHoldings,
|
|
15250
|
-
canGoBack: sessionOpenedFromMenu,
|
|
15251
|
-
onExecutionsChange: setDepositExecutions,
|
|
15252
|
-
defaultSourceChainType,
|
|
15253
|
-
defaultSourceChainId,
|
|
15254
|
-
defaultSourceTokenAddress,
|
|
15255
|
-
defaultSourceSymbol
|
|
15256
|
-
}
|
|
15257
|
-
),
|
|
15258
|
-
depositPoweredByFooter
|
|
15259
|
-
] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15260
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15261
|
-
WalletConnect,
|
|
15262
|
-
{
|
|
15263
|
-
walletInfo: browserWalletInfo ?? void 0,
|
|
15264
|
-
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
15265
|
-
wallets,
|
|
15266
|
-
userId,
|
|
15267
|
-
publishableKey,
|
|
15268
|
-
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
15269
|
-
projectName: projectConfig?.project_name,
|
|
15270
|
-
onSuccess: (txHash) => {
|
|
15271
|
-
onDepositSuccess?.({
|
|
15272
|
-
message: "Transaction sent successfully",
|
|
15273
|
-
transaction: { txHash }
|
|
15274
|
-
});
|
|
15275
|
-
},
|
|
15276
|
-
onError: (error) => {
|
|
15277
|
-
onDepositError?.({
|
|
15278
|
-
message: error.message,
|
|
15279
|
-
error
|
|
15280
|
-
});
|
|
15281
|
-
},
|
|
15282
|
-
onDepositSuccess,
|
|
15283
|
-
onDepositError,
|
|
15284
|
-
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
15285
|
-
onWalletDisconnect: handleWalletDisconnect,
|
|
15286
|
-
onWalletConnected: (info, dw) => {
|
|
15287
|
-
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
15288
|
-
setStoredWalletState(info.type);
|
|
15289
|
-
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
15290
|
-
},
|
|
15291
|
-
onBack: handleBack,
|
|
15292
|
-
onClose: handleClose,
|
|
15293
|
-
defaultSourceChainType,
|
|
15294
|
-
defaultSourceChainId,
|
|
15295
|
-
defaultSourceTokenAddress,
|
|
15296
|
-
defaultSourceSymbol,
|
|
15297
|
-
canGoBack: sessionOpenedFromMenu,
|
|
15298
|
-
depositWalletsLoading: walletsLoading
|
|
15299
|
-
}
|
|
15300
|
-
),
|
|
15301
|
-
depositPoweredByFooter
|
|
15302
|
-
] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15303
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15304
|
-
DepositHeader,
|
|
15305
|
-
{
|
|
15306
|
-
title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
|
|
15307
|
-
showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
|
|
15308
|
-
onBack: handleBack,
|
|
15309
|
-
onClose: handleClose
|
|
15310
|
-
}
|
|
15311
|
-
),
|
|
15312
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15640
|
+
] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
15313
15641
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15314
|
-
|
|
15642
|
+
DepositHeader,
|
|
15315
15643
|
{
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
destinationChainId,
|
|
15321
|
-
destinationTokenAddress,
|
|
15322
|
-
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
15323
|
-
view: cashAppView,
|
|
15324
|
-
onViewChange: setCashAppView,
|
|
15325
|
-
onAmountChange: setCashAppAmount,
|
|
15326
|
-
onEvent,
|
|
15327
|
-
onDepositSuccess,
|
|
15328
|
-
onDepositError
|
|
15644
|
+
title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
|
|
15645
|
+
showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
|
|
15646
|
+
onBack: handleBack,
|
|
15647
|
+
onClose: handleClose
|
|
15329
15648
|
}
|
|
15330
15649
|
),
|
|
15331
|
-
|
|
15332
|
-
|
|
15333
|
-
|
|
15650
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
15651
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
15652
|
+
PayWithCashApp,
|
|
15653
|
+
{
|
|
15654
|
+
userId,
|
|
15655
|
+
publishableKey,
|
|
15656
|
+
recipientAddress,
|
|
15657
|
+
destinationChainType,
|
|
15658
|
+
destinationChainId,
|
|
15659
|
+
destinationTokenAddress,
|
|
15660
|
+
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
15661
|
+
view: cashAppView,
|
|
15662
|
+
onViewChange: setCashAppView,
|
|
15663
|
+
onAmountChange: setCashAppAmount,
|
|
15664
|
+
onEvent,
|
|
15665
|
+
onDepositSuccess,
|
|
15666
|
+
onDepositError
|
|
15667
|
+
}
|
|
15668
|
+
),
|
|
15669
|
+
depositPoweredByFooter
|
|
15670
|
+
] })
|
|
15671
|
+
] }) : null })
|
|
15672
|
+
]
|
|
15334
15673
|
}
|
|
15335
15674
|
)
|
|
15336
15675
|
}
|
|
@@ -15342,8 +15681,8 @@ var import_react21 = require("react");
|
|
|
15342
15681
|
var import_lucide_react30 = require("lucide-react");
|
|
15343
15682
|
|
|
15344
15683
|
// src/hooks/use-payment-intent.ts
|
|
15345
|
-
var
|
|
15346
|
-
var
|
|
15684
|
+
var import_react_query14 = require("@tanstack/react-query");
|
|
15685
|
+
var import_core31 = require("@unifold/core");
|
|
15347
15686
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
15348
15687
|
"succeeded",
|
|
15349
15688
|
"expired",
|
|
@@ -15357,9 +15696,9 @@ function usePaymentIntent(params) {
|
|
|
15357
15696
|
enabled = true,
|
|
15358
15697
|
pollingInterval = 3e3
|
|
15359
15698
|
} = params;
|
|
15360
|
-
return (0,
|
|
15699
|
+
return (0, import_react_query14.useQuery)({
|
|
15361
15700
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
15362
|
-
queryFn: () => (0,
|
|
15701
|
+
queryFn: () => (0, import_core31.retrievePaymentIntent)(clientSecret, publishableKey),
|
|
15363
15702
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
15364
15703
|
staleTime: 0,
|
|
15365
15704
|
refetchInterval: (query) => {
|
|
@@ -15426,7 +15765,6 @@ function CheckoutModal({
|
|
|
15426
15765
|
const [browserWalletInfo, setBrowserWalletInfo] = (0, import_react21.useState)(null);
|
|
15427
15766
|
const [walletSelectionModalOpen, setWalletSelectionModalOpen] = (0, import_react21.useState)(false);
|
|
15428
15767
|
const [browserWalletChainType, setBrowserWalletChainType] = (0, import_react21.useState)(() => getStoredWalletState()?.chainType);
|
|
15429
|
-
const isMobileView = useIsMobileViewport();
|
|
15430
15768
|
const [resolvedTheme, setResolvedTheme] = (0, import_react21.useState)(
|
|
15431
15769
|
theme === "auto" ? "dark" : theme
|
|
15432
15770
|
);
|
|
@@ -15852,7 +16190,7 @@ function CheckoutModal({
|
|
|
15852
16190
|
featuredTokens: projectConfig?.transfer_crypto.networks
|
|
15853
16191
|
}
|
|
15854
16192
|
),
|
|
15855
|
-
showConnectWallet &&
|
|
16193
|
+
showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
15856
16194
|
BrowserWalletButton,
|
|
15857
16195
|
{
|
|
15858
16196
|
onClick: handleBrowserWalletClick,
|
|
@@ -16018,12 +16356,12 @@ var import_react26 = require("react");
|
|
|
16018
16356
|
var import_lucide_react33 = require("lucide-react");
|
|
16019
16357
|
|
|
16020
16358
|
// src/hooks/use-supported-destination-tokens.ts
|
|
16021
|
-
var
|
|
16022
|
-
var
|
|
16359
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
16360
|
+
var import_core32 = require("@unifold/core");
|
|
16023
16361
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
16024
|
-
return (0,
|
|
16362
|
+
return (0, import_react_query15.useQuery)({
|
|
16025
16363
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
16026
|
-
queryFn: () => (0,
|
|
16364
|
+
queryFn: () => (0, import_core32.getSupportedDestinationTokens)(publishableKey),
|
|
16027
16365
|
staleTime: 1e3 * 60 * 5,
|
|
16028
16366
|
gcTime: 1e3 * 60 * 30,
|
|
16029
16367
|
refetchOnMount: false,
|
|
@@ -16050,8 +16388,8 @@ function useDefaultDestinationToken({
|
|
|
16050
16388
|
}
|
|
16051
16389
|
|
|
16052
16390
|
// src/hooks/use-source-token-validation.ts
|
|
16053
|
-
var
|
|
16054
|
-
var
|
|
16391
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
16392
|
+
var import_core33 = require("@unifold/core");
|
|
16055
16393
|
function useSourceTokenValidation(params) {
|
|
16056
16394
|
const {
|
|
16057
16395
|
sourceChainType,
|
|
@@ -16062,7 +16400,7 @@ function useSourceTokenValidation(params) {
|
|
|
16062
16400
|
enabled = true
|
|
16063
16401
|
} = params;
|
|
16064
16402
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
16065
|
-
return (0,
|
|
16403
|
+
return (0, import_react_query16.useQuery)({
|
|
16066
16404
|
queryKey: [
|
|
16067
16405
|
"unifold",
|
|
16068
16406
|
"sourceTokenValidation",
|
|
@@ -16072,7 +16410,7 @@ function useSourceTokenValidation(params) {
|
|
|
16072
16410
|
publishableKey
|
|
16073
16411
|
],
|
|
16074
16412
|
queryFn: async () => {
|
|
16075
|
-
const res = await (0,
|
|
16413
|
+
const res = await (0, import_core33.getSupportedDepositTokens)(publishableKey);
|
|
16076
16414
|
let matchedMinUsd = null;
|
|
16077
16415
|
let matchedProcessingTime = null;
|
|
16078
16416
|
let matchedSlippage = null;
|
|
@@ -16110,8 +16448,8 @@ function useSourceTokenValidation(params) {
|
|
|
16110
16448
|
}
|
|
16111
16449
|
|
|
16112
16450
|
// src/hooks/use-address-balance.ts
|
|
16113
|
-
var
|
|
16114
|
-
var
|
|
16451
|
+
var import_react_query17 = require("@tanstack/react-query");
|
|
16452
|
+
var import_core34 = require("@unifold/core");
|
|
16115
16453
|
function useAddressBalance(params) {
|
|
16116
16454
|
const {
|
|
16117
16455
|
address,
|
|
@@ -16122,7 +16460,7 @@ function useAddressBalance(params) {
|
|
|
16122
16460
|
enabled = true
|
|
16123
16461
|
} = params;
|
|
16124
16462
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
16125
|
-
return (0,
|
|
16463
|
+
return (0, import_react_query17.useQuery)({
|
|
16126
16464
|
queryKey: [
|
|
16127
16465
|
"unifold",
|
|
16128
16466
|
"addressBalance",
|
|
@@ -16133,7 +16471,7 @@ function useAddressBalance(params) {
|
|
|
16133
16471
|
publishableKey
|
|
16134
16472
|
],
|
|
16135
16473
|
queryFn: async () => {
|
|
16136
|
-
const res = await (0,
|
|
16474
|
+
const res = await (0, import_core34.getAddressBalance)(
|
|
16137
16475
|
address,
|
|
16138
16476
|
chainType,
|
|
16139
16477
|
chainId,
|
|
@@ -16171,13 +16509,13 @@ function useAddressBalance(params) {
|
|
|
16171
16509
|
}
|
|
16172
16510
|
|
|
16173
16511
|
// src/hooks/use-executions.ts
|
|
16174
|
-
var
|
|
16175
|
-
var
|
|
16512
|
+
var import_react_query18 = require("@tanstack/react-query");
|
|
16513
|
+
var import_core35 = require("@unifold/core");
|
|
16176
16514
|
function useExecutions(userId, publishableKey, options) {
|
|
16177
|
-
const actionType = options?.actionType ??
|
|
16178
|
-
return (0,
|
|
16515
|
+
const actionType = options?.actionType ?? import_core35.ActionType.Deposit;
|
|
16516
|
+
return (0, import_react_query18.useQuery)({
|
|
16179
16517
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
16180
|
-
queryFn: () => (0,
|
|
16518
|
+
queryFn: () => (0, import_core35.queryExecutions)(userId, publishableKey, actionType),
|
|
16181
16519
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
16182
16520
|
refetchInterval: options?.refetchInterval ?? 3e3,
|
|
16183
16521
|
staleTime: 0,
|
|
@@ -16188,7 +16526,7 @@ function useExecutions(userId, publishableKey, options) {
|
|
|
16188
16526
|
|
|
16189
16527
|
// src/hooks/use-withdraw-polling.ts
|
|
16190
16528
|
var import_react22 = require("react");
|
|
16191
|
-
var
|
|
16529
|
+
var import_core36 = require("@unifold/core");
|
|
16192
16530
|
var POLL_INTERVAL_MS3 = 2500;
|
|
16193
16531
|
var POLL_ENDPOINT_INTERVAL_MS2 = 5e3;
|
|
16194
16532
|
var CUTOFF_BUFFER_MS2 = 6e4;
|
|
@@ -16228,15 +16566,15 @@ function useWithdrawPolling({
|
|
|
16228
16566
|
const enabledAt = enabledAtRef.current;
|
|
16229
16567
|
const poll = async () => {
|
|
16230
16568
|
try {
|
|
16231
|
-
const response = await (0,
|
|
16569
|
+
const response = await (0, import_core36.queryExecutions)(userId, publishableKey, import_core36.ActionType.Withdraw);
|
|
16232
16570
|
const cutoff = new Date(enabledAt.getTime() - CUTOFF_BUFFER_MS2);
|
|
16233
16571
|
const sorted = [...response.data].sort((a, b) => {
|
|
16234
16572
|
const tA = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
16235
16573
|
const tB = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
16236
16574
|
return tB - tA;
|
|
16237
16575
|
});
|
|
16238
|
-
const inProgress = [
|
|
16239
|
-
const terminal = [
|
|
16576
|
+
const inProgress = [import_core36.ExecutionStatus.PENDING, import_core36.ExecutionStatus.WAITING, import_core36.ExecutionStatus.DELAYED];
|
|
16577
|
+
const terminal = [import_core36.ExecutionStatus.SUCCEEDED, import_core36.ExecutionStatus.FAILED];
|
|
16240
16578
|
let target = null;
|
|
16241
16579
|
for (const ex of sorted) {
|
|
16242
16580
|
const t12 = ex.created_at ? new Date(ex.created_at) : null;
|
|
@@ -16266,9 +16604,9 @@ function useWithdrawPolling({
|
|
|
16266
16604
|
}
|
|
16267
16605
|
return [...list, ex];
|
|
16268
16606
|
});
|
|
16269
|
-
if (ex.status ===
|
|
16607
|
+
if (ex.status === import_core36.ExecutionStatus.SUCCEEDED && (!prev || inProgress.includes(prev))) {
|
|
16270
16608
|
onSuccessRef.current?.({ message: "Withdrawal completed successfully", executionId: ex.id, transaction: ex });
|
|
16271
|
-
} else if (ex.status ===
|
|
16609
|
+
} else if (ex.status === import_core36.ExecutionStatus.FAILED && prev !== import_core36.ExecutionStatus.FAILED) {
|
|
16272
16610
|
onErrorRef.current?.({ message: "Withdrawal failed", code: "WITHDRAW_FAILED", error: ex });
|
|
16273
16611
|
}
|
|
16274
16612
|
}
|
|
@@ -16289,7 +16627,7 @@ function useWithdrawPolling({
|
|
|
16289
16627
|
if (!enabled || !depositWalletId) return;
|
|
16290
16628
|
const trigger = async () => {
|
|
16291
16629
|
try {
|
|
16292
|
-
await (0,
|
|
16630
|
+
await (0, import_core36.pollDirectExecutions)({ deposit_wallet_id: depositWalletId }, publishableKey);
|
|
16293
16631
|
} catch {
|
|
16294
16632
|
}
|
|
16295
16633
|
};
|
|
@@ -16458,11 +16796,11 @@ function WithdrawDoubleInput({
|
|
|
16458
16796
|
// src/components/withdrawals/WithdrawForm.tsx
|
|
16459
16797
|
var import_react24 = require("react");
|
|
16460
16798
|
var import_lucide_react31 = require("lucide-react");
|
|
16461
|
-
var
|
|
16799
|
+
var import_core41 = require("@unifold/core");
|
|
16462
16800
|
|
|
16463
16801
|
// src/hooks/use-verify-recipient-address.ts
|
|
16464
|
-
var
|
|
16465
|
-
var
|
|
16802
|
+
var import_react_query19 = require("@tanstack/react-query");
|
|
16803
|
+
var import_core37 = require("@unifold/core");
|
|
16466
16804
|
function useVerifyRecipientAddress(params) {
|
|
16467
16805
|
const {
|
|
16468
16806
|
chainType,
|
|
@@ -16474,7 +16812,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
16474
16812
|
} = params;
|
|
16475
16813
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
16476
16814
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
16477
|
-
return (0,
|
|
16815
|
+
return (0, import_react_query19.useQuery)({
|
|
16478
16816
|
queryKey: [
|
|
16479
16817
|
"unifold",
|
|
16480
16818
|
"verifyRecipientAddress",
|
|
@@ -16484,7 +16822,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
16484
16822
|
trimmedAddress,
|
|
16485
16823
|
publishableKey
|
|
16486
16824
|
],
|
|
16487
|
-
queryFn: () => (0,
|
|
16825
|
+
queryFn: () => (0, import_core37.verifyRecipientAddress)(
|
|
16488
16826
|
{
|
|
16489
16827
|
chain_type: chainType,
|
|
16490
16828
|
chain_id: chainId,
|
|
@@ -16503,7 +16841,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
16503
16841
|
}
|
|
16504
16842
|
|
|
16505
16843
|
// src/components/withdrawals/send-withdraw.ts
|
|
16506
|
-
var
|
|
16844
|
+
var import_core38 = require("@unifold/core");
|
|
16507
16845
|
async function sendEvmWithdraw(params) {
|
|
16508
16846
|
const {
|
|
16509
16847
|
provider,
|
|
@@ -16581,7 +16919,7 @@ async function sendSolanaWithdraw(params) {
|
|
|
16581
16919
|
if (!provider.publicKey) {
|
|
16582
16920
|
await provider.connect();
|
|
16583
16921
|
}
|
|
16584
|
-
const buildResponse = await (0,
|
|
16922
|
+
const buildResponse = await (0, import_core38.buildSolanaTransaction)(
|
|
16585
16923
|
{
|
|
16586
16924
|
chain_id: "mainnet",
|
|
16587
16925
|
token_address: sourceTokenAddress === "" ? "native" : sourceTokenAddress,
|
|
@@ -16607,7 +16945,7 @@ async function sendSolanaWithdraw(params) {
|
|
|
16607
16945
|
for (let i = 0; i < serialized.length; i++) {
|
|
16608
16946
|
binaryStr += String.fromCharCode(serialized[i]);
|
|
16609
16947
|
}
|
|
16610
|
-
const sendResponse = await (0,
|
|
16948
|
+
const sendResponse = await (0, import_core38.sendSolanaTransaction)(
|
|
16611
16949
|
{ chain_id: "mainnet", signed_transaction: btoa(binaryStr) },
|
|
16612
16950
|
publishableKey
|
|
16613
16951
|
);
|
|
@@ -16633,7 +16971,7 @@ async function sendHypercoreWithdraw(params) {
|
|
|
16633
16971
|
params: []
|
|
16634
16972
|
});
|
|
16635
16973
|
const activeChainId = String(parseInt(currentChainHex, 16));
|
|
16636
|
-
const buildResult = await (0,
|
|
16974
|
+
const buildResult = await (0, import_core38.buildHypercoreTransaction)(
|
|
16637
16975
|
{
|
|
16638
16976
|
action_type: isSpot ? "spot_send" : "usd_send",
|
|
16639
16977
|
signature_chain_type: "ethereum",
|
|
@@ -16649,7 +16987,7 @@ async function sendHypercoreWithdraw(params) {
|
|
|
16649
16987
|
method: "eth_signTypedData_v4",
|
|
16650
16988
|
params: [fromAddress, JSON.stringify(buildResult.typed_data)]
|
|
16651
16989
|
});
|
|
16652
|
-
await (0,
|
|
16990
|
+
await (0, import_core38.sendHypercoreTransaction)(
|
|
16653
16991
|
{
|
|
16654
16992
|
action_payload: buildResult.action_payload,
|
|
16655
16993
|
signature,
|
|
@@ -16738,11 +17076,11 @@ async function detectBrowserWallet(chainType, senderAddress) {
|
|
|
16738
17076
|
|
|
16739
17077
|
// src/hooks/use-hypercore-withdraw-activation.ts
|
|
16740
17078
|
var import_react23 = require("react");
|
|
16741
|
-
var
|
|
17079
|
+
var import_core40 = require("@unifold/core");
|
|
16742
17080
|
|
|
16743
17081
|
// src/hooks/use-get-deposit-address.ts
|
|
16744
|
-
var
|
|
16745
|
-
var
|
|
17082
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
17083
|
+
var import_core39 = require("@unifold/core");
|
|
16746
17084
|
function useGetDepositAddress(params) {
|
|
16747
17085
|
const {
|
|
16748
17086
|
userId,
|
|
@@ -16755,7 +17093,7 @@ function useGetDepositAddress(params) {
|
|
|
16755
17093
|
enabled = true
|
|
16756
17094
|
} = params;
|
|
16757
17095
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
16758
|
-
return (0,
|
|
17096
|
+
return (0, import_react_query20.useQuery)({
|
|
16759
17097
|
queryKey: [
|
|
16760
17098
|
"unifold",
|
|
16761
17099
|
"getDepositAddress",
|
|
@@ -16767,7 +17105,7 @@ function useGetDepositAddress(params) {
|
|
|
16767
17105
|
actionType ?? null,
|
|
16768
17106
|
publishableKey
|
|
16769
17107
|
],
|
|
16770
|
-
queryFn: () => (0,
|
|
17108
|
+
queryFn: () => (0, import_core39.getDepositAddress)(
|
|
16771
17109
|
{
|
|
16772
17110
|
external_user_id: userId,
|
|
16773
17111
|
recipient_address: recipientAddress,
|
|
@@ -16821,7 +17159,7 @@ function useHypercoreWithdrawActivation(params) {
|
|
|
16821
17159
|
destinationChainType,
|
|
16822
17160
|
destinationChainId,
|
|
16823
17161
|
destinationTokenAddress,
|
|
16824
|
-
actionType:
|
|
17162
|
+
actionType: import_core40.ActionType.Withdraw,
|
|
16825
17163
|
enabled: enabled && isHypercore(sourceChainId)
|
|
16826
17164
|
});
|
|
16827
17165
|
const depositWalletAddress = (0, import_react23.useMemo)(() => {
|
|
@@ -17090,7 +17428,7 @@ function WithdrawForm({
|
|
|
17090
17428
|
let humanAmount = isMaxed ? balanceData.balanceHuman : toSafeDecimalString(cryptoAmountFromInput, sourceDecimals);
|
|
17091
17429
|
if (isHypercoreChain(sourceChainId)) {
|
|
17092
17430
|
try {
|
|
17093
|
-
const check = await (0,
|
|
17431
|
+
const check = await (0, import_core41.checkHypercoreActivation)(
|
|
17094
17432
|
{
|
|
17095
17433
|
source_address: senderAddress,
|
|
17096
17434
|
recipient_address: depositWallet.address
|
|
@@ -17407,14 +17745,14 @@ function WithdrawForm({
|
|
|
17407
17745
|
|
|
17408
17746
|
// src/components/withdrawals/WithdrawExecutionItem.tsx
|
|
17409
17747
|
var import_lucide_react32 = require("lucide-react");
|
|
17410
|
-
var
|
|
17748
|
+
var import_core42 = require("@unifold/core");
|
|
17411
17749
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
17412
17750
|
function WithdrawExecutionItem({
|
|
17413
17751
|
execution,
|
|
17414
17752
|
onClick
|
|
17415
17753
|
}) {
|
|
17416
17754
|
const { colors: colors2, fonts, components } = useTheme();
|
|
17417
|
-
const isPending = execution.status ===
|
|
17755
|
+
const isPending = execution.status === import_core42.ExecutionStatus.PENDING || execution.status === import_core42.ExecutionStatus.WAITING || execution.status === import_core42.ExecutionStatus.DELAYED;
|
|
17418
17756
|
const formatDateTime = (timestamp) => {
|
|
17419
17757
|
try {
|
|
17420
17758
|
const date = new Date(timestamp);
|
|
@@ -17461,7 +17799,7 @@ function WithdrawExecutionItem({
|
|
|
17461
17799
|
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
17462
17800
|
"img",
|
|
17463
17801
|
{
|
|
17464
|
-
src: execution.destination_token_metadata?.icon_url || (0,
|
|
17802
|
+
src: execution.destination_token_metadata?.icon_url || (0, import_core42.getIconUrl)("/icons/tokens/svg/usdc.svg"),
|
|
17465
17803
|
alt: "Token",
|
|
17466
17804
|
width: 36,
|
|
17467
17805
|
height: 36,
|
|
@@ -17720,7 +18058,7 @@ function WithdrawConfirmingView({
|
|
|
17720
18058
|
}
|
|
17721
18059
|
|
|
17722
18060
|
// src/components/withdrawals/WithdrawModal.tsx
|
|
17723
|
-
var
|
|
18061
|
+
var import_core43 = require("@unifold/core");
|
|
17724
18062
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
17725
18063
|
var t10 = i18n.withdrawModal;
|
|
17726
18064
|
var getChainKey5 = (chainId, chainType) => `${chainType}:${chainId}`;
|
|
@@ -17811,25 +18149,25 @@ function WithdrawModal({
|
|
|
17811
18149
|
onWithdrawError
|
|
17812
18150
|
});
|
|
17813
18151
|
const { data: allWithdrawalsData } = useExecutions(externalUserId, publishableKey, {
|
|
17814
|
-
actionType:
|
|
18152
|
+
actionType: import_core43.ActionType.Withdraw,
|
|
17815
18153
|
enabled: open,
|
|
17816
18154
|
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
17817
18155
|
});
|
|
17818
18156
|
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
17819
18157
|
const handleDepositWalletCreation = (0, import_react26.useCallback)(async (params) => {
|
|
17820
|
-
const { data: wallets } = await (0,
|
|
18158
|
+
const { data: wallets } = await (0, import_core43.createDepositAddress)(
|
|
17821
18159
|
{
|
|
17822
18160
|
external_user_id: externalUserId,
|
|
17823
18161
|
destination_chain_type: params.destinationChainType,
|
|
17824
18162
|
destination_chain_id: params.destinationChainId,
|
|
17825
18163
|
destination_token_address: params.destinationTokenAddress,
|
|
17826
18164
|
recipient_address: params.recipientAddress,
|
|
17827
|
-
action_type:
|
|
18165
|
+
action_type: import_core43.ActionType.Withdraw,
|
|
17828
18166
|
source_chain_type: sourceChainType
|
|
17829
18167
|
},
|
|
17830
18168
|
publishableKey
|
|
17831
18169
|
);
|
|
17832
|
-
const depositWallet = (0,
|
|
18170
|
+
const depositWallet = (0, import_core43.getWalletByChainType)(wallets, sourceChainType);
|
|
17833
18171
|
if (!depositWallet) {
|
|
17834
18172
|
throw new Error(`No deposit wallet available for ${sourceChainType}`);
|
|
17835
18173
|
}
|