@unifold/connect-react 0.1.63 → 0.1.65
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 +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1098 -461
- package/dist/index.mjs +1098 -461
- package/dist/styles-base.css +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -6624,6 +6624,40 @@ async function getAddressBalances(address, chainType, publishableKey) {
|
|
|
6624
6624
|
const data = await response.json();
|
|
6625
6625
|
return data;
|
|
6626
6626
|
}
|
|
6627
|
+
async function getExternalWallets(publishableKey) {
|
|
6628
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
6629
|
+
validatePublishableKey(pk);
|
|
6630
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets`, {
|
|
6631
|
+
method: "GET",
|
|
6632
|
+
headers: {
|
|
6633
|
+
accept: "application/json",
|
|
6634
|
+
"x-publishable-key": pk
|
|
6635
|
+
}
|
|
6636
|
+
});
|
|
6637
|
+
if (!response.ok) {
|
|
6638
|
+
throw new Error(`Failed to fetch external wallets: ${response.statusText}`);
|
|
6639
|
+
}
|
|
6640
|
+
const data = await response.json();
|
|
6641
|
+
return data;
|
|
6642
|
+
}
|
|
6643
|
+
async function getWalletMobileDeepLink(wallet, depositAddresses, publishableKey) {
|
|
6644
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
6645
|
+
validatePublishableKey(pk);
|
|
6646
|
+
const response = await fetch(`${API_BASE_URL}/v1/public/external_wallets/mobile_deeplink`, {
|
|
6647
|
+
method: "POST",
|
|
6648
|
+
headers: {
|
|
6649
|
+
"Content-Type": "application/json",
|
|
6650
|
+
accept: "application/json",
|
|
6651
|
+
"x-publishable-key": pk
|
|
6652
|
+
},
|
|
6653
|
+
body: JSON.stringify({ wallet, deposit_addresses: depositAddresses })
|
|
6654
|
+
});
|
|
6655
|
+
if (!response.ok) {
|
|
6656
|
+
throw new Error(`Failed to generate wallet deep link: ${response.statusText}`);
|
|
6657
|
+
}
|
|
6658
|
+
const data = await response.json();
|
|
6659
|
+
return data;
|
|
6660
|
+
}
|
|
6627
6661
|
async function getAddressBalance(address, chainType, chainId, tokenAddress, publishableKey) {
|
|
6628
6662
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
6629
6663
|
validatePublishableKey(pk);
|
|
@@ -6997,6 +7031,29 @@ async function getDepositQuote(request, publishableKey) {
|
|
|
6997
7031
|
const json = await response.json();
|
|
6998
7032
|
return json.data;
|
|
6999
7033
|
}
|
|
7034
|
+
async function buildHypercoreTransaction(request, publishableKey) {
|
|
7035
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
7036
|
+
validatePublishableKey(pk);
|
|
7037
|
+
const response = await fetch(
|
|
7038
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/build`,
|
|
7039
|
+
{
|
|
7040
|
+
method: "POST",
|
|
7041
|
+
headers: {
|
|
7042
|
+
accept: "application/json",
|
|
7043
|
+
"x-publishable-key": pk,
|
|
7044
|
+
"Content-Type": "application/json"
|
|
7045
|
+
},
|
|
7046
|
+
body: JSON.stringify(request)
|
|
7047
|
+
}
|
|
7048
|
+
);
|
|
7049
|
+
if (!response.ok) {
|
|
7050
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
7051
|
+
throw new Error(
|
|
7052
|
+
`Failed to build HyperCore transaction: ${error.message || response.statusText}`
|
|
7053
|
+
);
|
|
7054
|
+
}
|
|
7055
|
+
return response.json();
|
|
7056
|
+
}
|
|
7000
7057
|
async function getCashAppLimits(currency = "usd", publishableKey) {
|
|
7001
7058
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
7002
7059
|
validatePublishableKey(pk);
|
|
@@ -7062,6 +7119,29 @@ async function getCashAppSessionStatus(externalId, publishableKey) {
|
|
|
7062
7119
|
}
|
|
7063
7120
|
return response.json();
|
|
7064
7121
|
}
|
|
7122
|
+
async function sendHypercoreTransaction(request, publishableKey) {
|
|
7123
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
7124
|
+
validatePublishableKey(pk);
|
|
7125
|
+
const response = await fetch(
|
|
7126
|
+
`${API_BASE_URL}/v1/public/transactions/hypercore/send`,
|
|
7127
|
+
{
|
|
7128
|
+
method: "POST",
|
|
7129
|
+
headers: {
|
|
7130
|
+
accept: "application/json",
|
|
7131
|
+
"x-publishable-key": pk,
|
|
7132
|
+
"Content-Type": "application/json"
|
|
7133
|
+
},
|
|
7134
|
+
body: JSON.stringify(request)
|
|
7135
|
+
}
|
|
7136
|
+
);
|
|
7137
|
+
if (!response.ok) {
|
|
7138
|
+
const error = await response.json().catch(() => ({ message: response.statusText }));
|
|
7139
|
+
throw new Error(
|
|
7140
|
+
`Failed to send HyperCore transaction: ${error.message || response.statusText}`
|
|
7141
|
+
);
|
|
7142
|
+
}
|
|
7143
|
+
return response.json();
|
|
7144
|
+
}
|
|
7065
7145
|
var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
|
|
7066
7146
|
DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
|
|
7067
7147
|
return DepositEventType2;
|
|
@@ -13466,6 +13546,7 @@ var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
|
13466
13546
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
13467
13547
|
var React302 = __toESM(require("react"), 1);
|
|
13468
13548
|
var import_react_query14 = require("@tanstack/react-query");
|
|
13549
|
+
var import_react_query15 = require("@tanstack/react-query");
|
|
13469
13550
|
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
13470
13551
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
13471
13552
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
@@ -13475,19 +13556,19 @@ var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
|
13475
13556
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13476
13557
|
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13477
13558
|
var import_react28 = require("react");
|
|
13478
|
-
var
|
|
13559
|
+
var import_react_query16 = require("@tanstack/react-query");
|
|
13479
13560
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
13480
13561
|
var import_react29 = require("react");
|
|
13481
|
-
var import_react_query16 = require("@tanstack/react-query");
|
|
13482
13562
|
var import_react_query17 = require("@tanstack/react-query");
|
|
13483
13563
|
var import_react_query18 = require("@tanstack/react-query");
|
|
13484
13564
|
var import_react_query19 = require("@tanstack/react-query");
|
|
13565
|
+
var import_react_query20 = require("@tanstack/react-query");
|
|
13485
13566
|
var import_react30 = require("react");
|
|
13486
13567
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
13487
13568
|
var import_react31 = require("react");
|
|
13488
|
-
var import_react_query20 = require("@tanstack/react-query");
|
|
13489
|
-
var import_react32 = require("react");
|
|
13490
13569
|
var import_react_query21 = require("@tanstack/react-query");
|
|
13570
|
+
var import_react32 = require("react");
|
|
13571
|
+
var import_react_query22 = require("@tanstack/react-query");
|
|
13491
13572
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13492
13573
|
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13493
13574
|
var import_react33 = require("react");
|
|
@@ -13575,6 +13656,22 @@ function clearStoredWalletState() {
|
|
|
13575
13656
|
} catch {
|
|
13576
13657
|
}
|
|
13577
13658
|
}
|
|
13659
|
+
var LAST_OPENED_WALLET_KEY = "unifold_last_opened_wallet";
|
|
13660
|
+
function getLastOpenedWallet() {
|
|
13661
|
+
if (typeof window === "undefined") return void 0;
|
|
13662
|
+
try {
|
|
13663
|
+
return localStorage.getItem(LAST_OPENED_WALLET_KEY) ?? void 0;
|
|
13664
|
+
} catch {
|
|
13665
|
+
return void 0;
|
|
13666
|
+
}
|
|
13667
|
+
}
|
|
13668
|
+
function setLastOpenedWallet(walletId) {
|
|
13669
|
+
if (typeof window === "undefined") return;
|
|
13670
|
+
try {
|
|
13671
|
+
localStorage.setItem(LAST_OPENED_WALLET_KEY, walletId);
|
|
13672
|
+
} catch {
|
|
13673
|
+
}
|
|
13674
|
+
}
|
|
13578
13675
|
var MOBILE_VIEWPORT_MEDIA_QUERY = "(max-width: 768px)";
|
|
13579
13676
|
function isMobileViewport() {
|
|
13580
13677
|
if (typeof window === "undefined") return false;
|
|
@@ -13931,6 +14028,36 @@ function ThemeProvider({
|
|
|
13931
14028
|
);
|
|
13932
14029
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThemeContext.Provider, { value: contextValue, children });
|
|
13933
14030
|
}
|
|
14031
|
+
function AccentColorOverride({
|
|
14032
|
+
accentColor,
|
|
14033
|
+
accentForeground,
|
|
14034
|
+
children
|
|
14035
|
+
}) {
|
|
14036
|
+
const parent = useTheme();
|
|
14037
|
+
const value = React37.useMemo(() => {
|
|
14038
|
+
if (!accentColor) return parent;
|
|
14039
|
+
const foreground = accentForeground ?? parent.colors.primaryForeground;
|
|
14040
|
+
const nextColors = {
|
|
14041
|
+
...parent.colors,
|
|
14042
|
+
primary: accentColor,
|
|
14043
|
+
primaryForeground: foreground
|
|
14044
|
+
};
|
|
14045
|
+
const nextComponents = {
|
|
14046
|
+
...parent.components,
|
|
14047
|
+
button: {
|
|
14048
|
+
...parent.components.button,
|
|
14049
|
+
primaryBackground: accentColor,
|
|
14050
|
+
primaryText: foreground
|
|
14051
|
+
},
|
|
14052
|
+
card: {
|
|
14053
|
+
...parent.components.card,
|
|
14054
|
+
iconBackgroundColor: `${accentColor}26`
|
|
14055
|
+
}
|
|
14056
|
+
};
|
|
14057
|
+
return { ...parent, colors: nextColors, components: nextComponents };
|
|
14058
|
+
}, [parent, accentColor, accentForeground]);
|
|
14059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThemeContext.Provider, { value, children });
|
|
14060
|
+
}
|
|
13934
14061
|
function useTheme() {
|
|
13935
14062
|
const context = React37.useContext(ThemeContext);
|
|
13936
14063
|
if (!context) {
|
|
@@ -14350,7 +14477,7 @@ function DepositHeader({
|
|
|
14350
14477
|
setShowBalanceSkeleton(false);
|
|
14351
14478
|
return;
|
|
14352
14479
|
}
|
|
14353
|
-
const supportedChainTypes = ["ethereum", "solana", "bitcoin"];
|
|
14480
|
+
const supportedChainTypes = ["ethereum", "solana", "bitcoin", "n1"];
|
|
14354
14481
|
if (!supportedChainTypes.includes(
|
|
14355
14482
|
balanceChainType
|
|
14356
14483
|
)) {
|
|
@@ -14982,6 +15109,7 @@ function useDepositPolling({
|
|
|
14982
15109
|
clientSecret,
|
|
14983
15110
|
depositConfirmationMode = "auto_ui",
|
|
14984
15111
|
depositWalletId,
|
|
15112
|
+
depositWalletIds,
|
|
14985
15113
|
enabled = true,
|
|
14986
15114
|
immediateDirectPolling = false,
|
|
14987
15115
|
onDepositSuccess,
|
|
@@ -15127,21 +15255,25 @@ function useDepositPolling({
|
|
|
15127
15255
|
setIsPolling(false);
|
|
15128
15256
|
};
|
|
15129
15257
|
}, [userId, publishableKey, clientSecret, enabled]);
|
|
15258
|
+
const pollWalletIdsKey = depositWalletIds && depositWalletIds.length > 0 ? Array.from(new Set(depositWalletIds.filter(Boolean))).join(",") : depositWalletId || "";
|
|
15130
15259
|
(0, import_react12.useEffect)(() => {
|
|
15131
|
-
if (!pollingEnabled || !
|
|
15260
|
+
if (!pollingEnabled || !pollWalletIdsKey) return;
|
|
15261
|
+
const ids = pollWalletIdsKey.split(",").filter(Boolean);
|
|
15132
15262
|
const triggerPoll = async () => {
|
|
15133
|
-
|
|
15134
|
-
|
|
15135
|
-
|
|
15136
|
-
|
|
15137
|
-
|
|
15138
|
-
|
|
15139
|
-
|
|
15263
|
+
await Promise.all(
|
|
15264
|
+
ids.map(
|
|
15265
|
+
(id) => pollDirectExecutions(
|
|
15266
|
+
{ deposit_wallet_id: id },
|
|
15267
|
+
publishableKey
|
|
15268
|
+
).catch(() => {
|
|
15269
|
+
})
|
|
15270
|
+
)
|
|
15271
|
+
);
|
|
15140
15272
|
};
|
|
15141
15273
|
triggerPoll();
|
|
15142
15274
|
const interval = setInterval(triggerPoll, POLL_ENDPOINT_INTERVAL_MS);
|
|
15143
15275
|
return () => clearInterval(interval);
|
|
15144
|
-
}, [pollingEnabled,
|
|
15276
|
+
}, [pollingEnabled, pollWalletIdsKey, publishableKey]);
|
|
15145
15277
|
const handleIveDeposited = () => {
|
|
15146
15278
|
setPollingEnabled(true);
|
|
15147
15279
|
setShowWaitingUi(true);
|
|
@@ -16330,6 +16462,7 @@ function BuyWithCard({
|
|
|
16330
16462
|
if (!selectedProvider) return "0.000000";
|
|
16331
16463
|
return selectedProvider.destination_amount.toFixed(6);
|
|
16332
16464
|
};
|
|
16465
|
+
const canOpenProviderSelector = !quotesLoading && quotes.length > 1;
|
|
16333
16466
|
const selectedCurrencyData = fiatCurrencies.find(
|
|
16334
16467
|
(c) => c.currency_code.toLowerCase() === currency.toLowerCase()
|
|
16335
16468
|
);
|
|
@@ -16515,9 +16648,12 @@ function BuyWithCard({
|
|
|
16515
16648
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
16516
16649
|
"button",
|
|
16517
16650
|
{
|
|
16518
|
-
onClick: () =>
|
|
16651
|
+
onClick: () => {
|
|
16652
|
+
if (canOpenProviderSelector) handleViewChange("quotes");
|
|
16653
|
+
},
|
|
16519
16654
|
disabled: quotesLoading || quotes.length === 0,
|
|
16520
|
-
|
|
16655
|
+
"aria-disabled": !canOpenProviderSelector,
|
|
16656
|
+
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"}`,
|
|
16521
16657
|
style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
|
|
16522
16658
|
children: quotesLoading ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "uf-text-left uf-w-full uf-animate-pulse", children: [
|
|
16523
16659
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
@@ -16544,7 +16680,7 @@ function BuyWithCard({
|
|
|
16544
16680
|
)
|
|
16545
16681
|
] })
|
|
16546
16682
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "uf-w-full uf-text-left", children: [
|
|
16547
|
-
isAutoSelected && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
16683
|
+
isAutoSelected && canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
16548
16684
|
"div",
|
|
16549
16685
|
{
|
|
16550
16686
|
className: "uf-text-xs uf-font-normal uf-mb-2",
|
|
@@ -16580,7 +16716,7 @@ function BuyWithCard({
|
|
|
16580
16716
|
),
|
|
16581
16717
|
selectedProvider.low_kyc === false && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "uf-flex uf-items-center uf-gap-1.5 uf-mt-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "uf-text-[10px] uf-text-muted-foreground uf-font-normal", children: "No document upload" }) })
|
|
16582
16718
|
] }),
|
|
16583
|
-
|
|
16719
|
+
canOpenProviderSelector && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
16584
16720
|
ChevronRight,
|
|
16585
16721
|
{
|
|
16586
16722
|
className: "uf-w-4 uf-h-4 group-hover:uf-text-foreground uf-transition-colors uf-flex-shrink-0",
|
|
@@ -24359,7 +24495,7 @@ function useHypercoreActivation(params) {
|
|
|
24359
24495
|
publishableKey,
|
|
24360
24496
|
enabled = true
|
|
24361
24497
|
} = params;
|
|
24362
|
-
const isHypercore2 = destinationChainId === HYPERCORE_CHAIN_ID;
|
|
24498
|
+
const isHypercore2 = String(destinationChainId) === HYPERCORE_CHAIN_ID;
|
|
24363
24499
|
const recipient = recipientAddress?.trim() ?? "";
|
|
24364
24500
|
const source = sourceAddress?.trim() ?? "";
|
|
24365
24501
|
const hasAddresses = !!recipient && !!source;
|
|
@@ -25505,6 +25641,46 @@ function TransferCryptoDoubleInput({
|
|
|
25505
25641
|
}
|
|
25506
25642
|
) });
|
|
25507
25643
|
}
|
|
25644
|
+
function isHypercoreChain(chainId) {
|
|
25645
|
+
return chainId === HYPERCORE_CHAIN_ID;
|
|
25646
|
+
}
|
|
25647
|
+
async function sendHypercoreEvmTransfer(params) {
|
|
25648
|
+
const {
|
|
25649
|
+
provider,
|
|
25650
|
+
fromAddress,
|
|
25651
|
+
recipientAddress,
|
|
25652
|
+
sourceTokenAddress,
|
|
25653
|
+
amount,
|
|
25654
|
+
publishableKey
|
|
25655
|
+
} = params;
|
|
25656
|
+
const currentChainHex = await provider.request({
|
|
25657
|
+
method: "eth_chainId",
|
|
25658
|
+
params: []
|
|
25659
|
+
});
|
|
25660
|
+
const activeChainId = String(parseInt(currentChainHex, 16));
|
|
25661
|
+
const buildResult = await buildHypercoreTransaction(
|
|
25662
|
+
{
|
|
25663
|
+
signature_chain_id: activeChainId,
|
|
25664
|
+
recipient_address: recipientAddress,
|
|
25665
|
+
token_address: sourceTokenAddress,
|
|
25666
|
+
amount
|
|
25667
|
+
},
|
|
25668
|
+
publishableKey
|
|
25669
|
+
);
|
|
25670
|
+
const signature = await provider.request({
|
|
25671
|
+
method: "eth_signTypedData_v4",
|
|
25672
|
+
params: [fromAddress, JSON.stringify(buildResult.typed_data)]
|
|
25673
|
+
});
|
|
25674
|
+
await sendHypercoreTransaction(
|
|
25675
|
+
{
|
|
25676
|
+
action_payload: buildResult.action_payload,
|
|
25677
|
+
signature,
|
|
25678
|
+
nonce: buildResult.nonce
|
|
25679
|
+
},
|
|
25680
|
+
publishableKey
|
|
25681
|
+
);
|
|
25682
|
+
return { signature };
|
|
25683
|
+
}
|
|
25508
25684
|
function useDepositQuote(params) {
|
|
25509
25685
|
const {
|
|
25510
25686
|
publishableKey,
|
|
@@ -25556,6 +25732,60 @@ function useDepositQuote(params) {
|
|
|
25556
25732
|
retryDelay: (attempt) => Math.min(1e3 * 2 ** attempt, 5e3)
|
|
25557
25733
|
});
|
|
25558
25734
|
}
|
|
25735
|
+
function useExternalWallets({
|
|
25736
|
+
publishableKey,
|
|
25737
|
+
enabled = true
|
|
25738
|
+
}) {
|
|
25739
|
+
const { data: wallets = [], isLoading } = (0, import_react_query15.useQuery)({
|
|
25740
|
+
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
25741
|
+
queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
|
|
25742
|
+
enabled: enabled && !!publishableKey,
|
|
25743
|
+
staleTime: 1e3 * 60 * 30,
|
|
25744
|
+
refetchOnMount: false,
|
|
25745
|
+
refetchOnWindowFocus: false
|
|
25746
|
+
});
|
|
25747
|
+
return { wallets, isLoading };
|
|
25748
|
+
}
|
|
25749
|
+
var WALLET_BRAND_COLORS = {
|
|
25750
|
+
phantom: "#AB9FF2",
|
|
25751
|
+
metamask: "#F6851B",
|
|
25752
|
+
coinbase: "#0052FF",
|
|
25753
|
+
trust: "#3375BB",
|
|
25754
|
+
rainbow: "#5B6CFF",
|
|
25755
|
+
rabby: "#7084FF",
|
|
25756
|
+
okx: "#000000"
|
|
25757
|
+
};
|
|
25758
|
+
function normalizeWalletId(type) {
|
|
25759
|
+
return type.replace(/-(ethereum|solana)$/i, "").toLowerCase();
|
|
25760
|
+
}
|
|
25761
|
+
function getWalletBrandColor(type, mode = "dark") {
|
|
25762
|
+
if (!type) return void 0;
|
|
25763
|
+
const id = normalizeWalletId(type);
|
|
25764
|
+
const color = WALLET_BRAND_COLORS[id];
|
|
25765
|
+
if (!color) return void 0;
|
|
25766
|
+
if (id === "okx") return mode === "dark" ? "#FFFFFF" : "#111111";
|
|
25767
|
+
return color;
|
|
25768
|
+
}
|
|
25769
|
+
function getContrastingTextColor(hex) {
|
|
25770
|
+
const c = hex.replace("#", "");
|
|
25771
|
+
if (c.length !== 6) return "#FFFFFF";
|
|
25772
|
+
const r2 = parseInt(c.slice(0, 2), 16);
|
|
25773
|
+
const g = parseInt(c.slice(2, 4), 16);
|
|
25774
|
+
const b = parseInt(c.slice(4, 6), 16);
|
|
25775
|
+
const luminance = (0.299 * r2 + 0.587 * g + 0.114 * b) / 255;
|
|
25776
|
+
return luminance > 0.6 ? "#13111C" : "#FFFFFF";
|
|
25777
|
+
}
|
|
25778
|
+
function isMobileDevice() {
|
|
25779
|
+
if (typeof navigator === "undefined") return false;
|
|
25780
|
+
return /android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent);
|
|
25781
|
+
}
|
|
25782
|
+
function getMobilePlatform() {
|
|
25783
|
+
if (typeof navigator === "undefined") return null;
|
|
25784
|
+
const ua = navigator.userAgent;
|
|
25785
|
+
if (/iphone|ipad|ipod/i.test(ua)) return "ios";
|
|
25786
|
+
if (/android/i.test(ua)) return "android";
|
|
25787
|
+
return null;
|
|
25788
|
+
}
|
|
25559
25789
|
var WALLET_ICONS = {
|
|
25560
25790
|
metamask: MetamaskIcon,
|
|
25561
25791
|
phantom: PhantomIcon,
|
|
@@ -25858,7 +26088,8 @@ function EnterAmountView({
|
|
|
25858
26088
|
onClose,
|
|
25859
26089
|
quickSelectMode,
|
|
25860
26090
|
checkoutAmountUsd,
|
|
25861
|
-
checkoutReceivedUsd
|
|
26091
|
+
checkoutReceivedUsd,
|
|
26092
|
+
footer
|
|
25862
26093
|
}) {
|
|
25863
26094
|
const { colors: colors2, fonts, components } = useTheme();
|
|
25864
26095
|
const isCheckout = !!checkoutAmountUsd;
|
|
@@ -26114,6 +26345,7 @@ function EnterAmountView({
|
|
|
26114
26345
|
)
|
|
26115
26346
|
] })
|
|
26116
26347
|
] }),
|
|
26348
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "uf-shrink-0 uf-pt-2", children: footer }),
|
|
26117
26349
|
/* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { className: "uf-shrink-0 uf-pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
26118
26350
|
"button",
|
|
26119
26351
|
{
|
|
@@ -26561,18 +26793,33 @@ var WALLET_ICONS3 = {
|
|
|
26561
26793
|
backpack: BackpackIcon,
|
|
26562
26794
|
glow: GlowIcon
|
|
26563
26795
|
};
|
|
26564
|
-
var
|
|
26565
|
-
{ id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/" },
|
|
26566
|
-
{ id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum"
|
|
26567
|
-
{ id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/" },
|
|
26568
|
-
{ id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/" },
|
|
26569
|
-
{ id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/" },
|
|
26570
|
-
{ id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://
|
|
26571
|
-
{ id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3" }
|
|
26572
|
-
{ id: "solflare", name: "Solflare", networks: ["solana"], installUrl: "https://solflare.com/" },
|
|
26573
|
-
{ id: "backpack", name: "Backpack", networks: ["solana"], installUrl: "https://backpack.app/" },
|
|
26574
|
-
{ id: "glow", name: "Glow", networks: ["solana"], installUrl: "https://glow.app/" }
|
|
26796
|
+
var FALLBACK_WALLET_DEFINITIONS = [
|
|
26797
|
+
{ id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/", supportsMobileBrowse: true },
|
|
26798
|
+
{ id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
|
|
26799
|
+
{ id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/", supportsMobileBrowse: true },
|
|
26800
|
+
{ id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/", supportsMobileBrowse: true },
|
|
26801
|
+
{ id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/", supportsMobileBrowse: true },
|
|
26802
|
+
{ id: "rabby", name: "Rabby", networks: ["ethereum"], installUrl: "https://apps.apple.com/app/rabby-wallet/id6450663781", supportsMobileBrowse: true },
|
|
26803
|
+
{ id: "okx", name: "OKX Wallet", networks: ["ethereum"], installUrl: "https://www.okx.com/web3", supportsMobileBrowse: true, mobileBrowsePlatforms: ["ios"] }
|
|
26575
26804
|
];
|
|
26805
|
+
function getMobileInstallUrl(walletId, defaultUrl) {
|
|
26806
|
+
if (!isMobileDevice()) return defaultUrl;
|
|
26807
|
+
const ua = typeof navigator !== "undefined" ? navigator.userAgent : "";
|
|
26808
|
+
const isIOS = /iPhone|iPad|iPod/i.test(ua);
|
|
26809
|
+
const stores = {
|
|
26810
|
+
rabby: {
|
|
26811
|
+
ios: "https://apps.apple.com/app/rabby-wallet/id6450663781",
|
|
26812
|
+
android: "https://play.google.com/store/apps/details?id=com.debank.rabbymobile"
|
|
26813
|
+
},
|
|
26814
|
+
glow: {
|
|
26815
|
+
ios: "https://apps.apple.com/us/app/glow-solana-wallet/id1599584512",
|
|
26816
|
+
android: "https://play.google.com/store/apps/details?id=com.luma.wallet.prod"
|
|
26817
|
+
}
|
|
26818
|
+
};
|
|
26819
|
+
const entry = stores[walletId];
|
|
26820
|
+
if (!entry) return defaultUrl;
|
|
26821
|
+
return isIOS ? entry.ios : entry.android;
|
|
26822
|
+
}
|
|
26576
26823
|
function normalizeTokenAddress(address) {
|
|
26577
26824
|
const normalized = (address ?? "").toLowerCase();
|
|
26578
26825
|
if (normalized === "" || normalized === "native" || normalized === "0x0000000000000000000000000000000000000000") {
|
|
@@ -26608,7 +26855,7 @@ function getLegacyEvmProviders() {
|
|
|
26608
26855
|
okxEthereum: win.okxwallet
|
|
26609
26856
|
};
|
|
26610
26857
|
}
|
|
26611
|
-
function detectAvailableWallets(filterChainType) {
|
|
26858
|
+
function detectAvailableWallets(definitions, recentWalletId, filterChainType) {
|
|
26612
26859
|
const solProviders = getSolanaProviders();
|
|
26613
26860
|
const legacyEvm = getLegacyEvmProviders();
|
|
26614
26861
|
const eip6963List = getEip6963Providers();
|
|
@@ -26634,7 +26881,7 @@ function detectAvailableWallets(filterChainType) {
|
|
|
26634
26881
|
return false;
|
|
26635
26882
|
}
|
|
26636
26883
|
});
|
|
26637
|
-
|
|
26884
|
+
const sorted = definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
|
|
26638
26885
|
let isInstalled = false;
|
|
26639
26886
|
const detectedNetworks = [];
|
|
26640
26887
|
switch (wallet.id) {
|
|
@@ -26657,8 +26904,6 @@ function detectAvailableWallets(filterChainType) {
|
|
|
26657
26904
|
isInstalled = true;
|
|
26658
26905
|
detectedNetworks.push("ethereum");
|
|
26659
26906
|
}
|
|
26660
|
-
if (solProviders.coinbaseSolana || win?.coinbaseWalletExtension?.solana) detectedNetworks.push("solana");
|
|
26661
|
-
if (isInstalled && wallet.networks.includes("solana") && !detectedNetworks.includes("solana")) detectedNetworks.push("solana");
|
|
26662
26907
|
break;
|
|
26663
26908
|
case "trust":
|
|
26664
26909
|
if (hasEip6963("trust") || legacyEvm.trustEthereum || legacyEvm.ethereum?.isTrust || win?.trustwallet) {
|
|
@@ -26695,11 +26940,17 @@ function detectAvailableWallets(filterChainType) {
|
|
|
26695
26940
|
}
|
|
26696
26941
|
return { ...wallet, isInstalled, detectedNetworks };
|
|
26697
26942
|
}).sort((a, b) => {
|
|
26943
|
+
if (recentWalletId) {
|
|
26944
|
+
const aRecent = a.id === recentWalletId ? 1 : 0;
|
|
26945
|
+
const bRecent = b.id === recentWalletId ? 1 : 0;
|
|
26946
|
+
if (aRecent !== bRecent) return bRecent - aRecent;
|
|
26947
|
+
}
|
|
26698
26948
|
if (a.isInstalled && !b.isInstalled) return -1;
|
|
26699
26949
|
if (!a.isInstalled && b.isInstalled) return 1;
|
|
26700
26950
|
if (a.isInstalled && b.isInstalled) return b.networks.length - a.networks.length;
|
|
26701
26951
|
return 0;
|
|
26702
26952
|
});
|
|
26953
|
+
return sorted;
|
|
26703
26954
|
}
|
|
26704
26955
|
function WalletConnect({
|
|
26705
26956
|
walletInfo: initialWalletInfo,
|
|
@@ -26738,7 +26989,7 @@ function WalletConnect({
|
|
|
26738
26989
|
depositWalletsLoading = false,
|
|
26739
26990
|
onExecutionsChange
|
|
26740
26991
|
}) {
|
|
26741
|
-
const { colors: colors2, fonts, components } = useTheme();
|
|
26992
|
+
const { colors: colors2, fonts, components, mode } = useTheme();
|
|
26742
26993
|
const walletProvidedAtMount = React302.useRef(!!initialWalletInfo && !!initialDepositWallet);
|
|
26743
26994
|
const [activeWalletInfo, setActiveWalletInfo] = React302.useState(initialWalletInfo ?? null);
|
|
26744
26995
|
const [activeDepositWallet, setActiveDepositWallet] = React302.useState(initialDepositWallet ?? null);
|
|
@@ -26762,7 +27013,43 @@ function WalletConnect({
|
|
|
26762
27013
|
setEip6963ProviderCount(providers.length);
|
|
26763
27014
|
});
|
|
26764
27015
|
}, []);
|
|
26765
|
-
const
|
|
27016
|
+
const { wallets: backendWallets } = useExternalWallets({ publishableKey });
|
|
27017
|
+
const walletDefinitions = React302.useMemo(
|
|
27018
|
+
() => backendWallets.length > 0 ? backendWallets.map((w) => ({
|
|
27019
|
+
id: w.id,
|
|
27020
|
+
name: w.name,
|
|
27021
|
+
networks: w.chain_types,
|
|
27022
|
+
installUrl: w.install_url,
|
|
27023
|
+
supportsMobileBrowse: w.supports_mobile_browse,
|
|
27024
|
+
mobileBrowsePlatforms: w.mobile_browse_platforms ?? null
|
|
27025
|
+
})) : FALLBACK_WALLET_DEFINITIONS,
|
|
27026
|
+
[backendWallets]
|
|
27027
|
+
);
|
|
27028
|
+
const [recentWalletId, setRecentWalletIdState] = React302.useState(getLastOpenedWallet);
|
|
27029
|
+
React302.useEffect(() => {
|
|
27030
|
+
if (view === "select_wallet") {
|
|
27031
|
+
setRecentWalletIdState(getLastOpenedWallet());
|
|
27032
|
+
}
|
|
27033
|
+
}, [view]);
|
|
27034
|
+
const availableWallets = React302.useMemo(
|
|
27035
|
+
() => detectAvailableWallets(walletDefinitions, recentWalletId),
|
|
27036
|
+
[walletDefinitions, eip6963ProviderCount, recentWalletId]
|
|
27037
|
+
);
|
|
27038
|
+
const [isMobile, setIsMobile] = React302.useState(false);
|
|
27039
|
+
React302.useEffect(() => {
|
|
27040
|
+
setIsMobile(isMobileDevice());
|
|
27041
|
+
}, []);
|
|
27042
|
+
const mobileDepositAddresses = React302.useMemo(
|
|
27043
|
+
() => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
|
|
27044
|
+
[depositWallets]
|
|
27045
|
+
);
|
|
27046
|
+
const mobileDepositWalletIds = React302.useMemo(
|
|
27047
|
+
() => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
|
|
27048
|
+
[depositWallets]
|
|
27049
|
+
);
|
|
27050
|
+
const [mobileRedirect, setMobileRedirect] = React302.useState(null);
|
|
27051
|
+
const [pendingMobileWallet, setPendingMobileWallet] = React302.useState(null);
|
|
27052
|
+
const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React302.useState(false);
|
|
26766
27053
|
React302.useEffect(() => {
|
|
26767
27054
|
if (!standalone || autoResolved || detectingWallet) return;
|
|
26768
27055
|
if (!detectedWallet) {
|
|
@@ -26806,7 +27093,7 @@ function WalletConnect({
|
|
|
26806
27093
|
const chainType = activeDepositWallet?.chain_type ?? "ethereum";
|
|
26807
27094
|
const recipientAddress = activeDepositWallet?.address ?? "";
|
|
26808
27095
|
const isCheckoutMode = !!checkoutAmountUsd;
|
|
26809
|
-
const supportedChainType = chainType === "algorand" || chainType === "xrpl" ? "ethereum" : chainType;
|
|
27096
|
+
const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
|
|
26810
27097
|
const transitionTo = React302.useCallback((nextView) => {
|
|
26811
27098
|
if (nextView === viewRef.current) return;
|
|
26812
27099
|
setIsTransitioning(true);
|
|
@@ -26821,9 +27108,38 @@ function WalletConnect({
|
|
|
26821
27108
|
transform: isTransitioning ? "translateY(4px)" : "translateY(0)",
|
|
26822
27109
|
transition: "opacity 150ms ease, transform 150ms ease"
|
|
26823
27110
|
};
|
|
26824
|
-
const
|
|
27111
|
+
const openMobileWalletBrowse = async (wallet, depositAddresses) => {
|
|
27112
|
+
try {
|
|
27113
|
+
const res = await getWalletMobileDeepLink(
|
|
27114
|
+
wallet.id,
|
|
27115
|
+
depositAddresses,
|
|
27116
|
+
publishableKey
|
|
27117
|
+
);
|
|
27118
|
+
if (res.deeplink) {
|
|
27119
|
+
setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
|
|
27120
|
+
setLastOpenedWallet(wallet.id);
|
|
27121
|
+
setRecentWalletIdState(wallet.id);
|
|
27122
|
+
setAwaitingMobileDeposit(true);
|
|
27123
|
+
transitionTo("mobile_redirect");
|
|
27124
|
+
window.location.href = res.deeplink;
|
|
27125
|
+
return true;
|
|
27126
|
+
}
|
|
27127
|
+
} catch {
|
|
27128
|
+
}
|
|
27129
|
+
return false;
|
|
27130
|
+
};
|
|
27131
|
+
const handleWalletClick = async (wallet) => {
|
|
26825
27132
|
if (!wallet.isInstalled) {
|
|
26826
|
-
|
|
27133
|
+
const platform2 = getMobilePlatform();
|
|
27134
|
+
const platformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(platform2 ?? "");
|
|
27135
|
+
if (isMobileDevice() && wallet.supportsMobileBrowse !== false && platformAllowed) {
|
|
27136
|
+
if (mobileDepositAddresses.length === 0) {
|
|
27137
|
+
setPendingMobileWallet(wallet);
|
|
27138
|
+
return;
|
|
27139
|
+
}
|
|
27140
|
+
if (await openMobileWalletBrowse(wallet, mobileDepositAddresses)) return;
|
|
27141
|
+
}
|
|
27142
|
+
window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
|
|
26827
27143
|
return;
|
|
26828
27144
|
}
|
|
26829
27145
|
setSelectedWalletDef(wallet);
|
|
@@ -26839,9 +27155,32 @@ function WalletConnect({
|
|
|
26839
27155
|
if (!selectedWalletDef) return;
|
|
26840
27156
|
handleConnectWallet(selectedWalletDef, network);
|
|
26841
27157
|
};
|
|
27158
|
+
React302.useEffect(() => {
|
|
27159
|
+
if (!pendingMobileWallet) return;
|
|
27160
|
+
if (mobileDepositAddresses.length > 0) {
|
|
27161
|
+
const wallet = pendingMobileWallet;
|
|
27162
|
+
setPendingMobileWallet(null);
|
|
27163
|
+
void (async () => {
|
|
27164
|
+
if (!await openMobileWalletBrowse(wallet, mobileDepositAddresses)) {
|
|
27165
|
+
window.open(getMobileInstallUrl(wallet.id, wallet.installUrl), "_blank", "noopener,noreferrer");
|
|
27166
|
+
}
|
|
27167
|
+
})();
|
|
27168
|
+
return;
|
|
27169
|
+
}
|
|
27170
|
+
const timeout = setTimeout(() => {
|
|
27171
|
+
setPendingMobileWallet((current) => {
|
|
27172
|
+
if (!current) return null;
|
|
27173
|
+
window.open(getMobileInstallUrl(current.id, current.installUrl), "_blank", "noopener,noreferrer");
|
|
27174
|
+
return null;
|
|
27175
|
+
});
|
|
27176
|
+
}, 8e3);
|
|
27177
|
+
return () => clearTimeout(timeout);
|
|
27178
|
+
}, [pendingMobileWallet, mobileDepositAddresses]);
|
|
26842
27179
|
const handleConnectWallet = async (wallet, network) => {
|
|
26843
27180
|
setConnectingNetwork(network);
|
|
26844
27181
|
transitionTo("connecting");
|
|
27182
|
+
setLastOpenedWallet(wallet.id);
|
|
27183
|
+
setRecentWalletIdState(wallet.id);
|
|
26845
27184
|
setWalletError(null);
|
|
26846
27185
|
setIsWalletConnecting(true);
|
|
26847
27186
|
try {
|
|
@@ -26946,6 +27285,13 @@ function WalletConnect({
|
|
|
26946
27285
|
}
|
|
26947
27286
|
};
|
|
26948
27287
|
const selectedToken = selectedBalance ? getTokenFromBalance(selectedBalance) : null;
|
|
27288
|
+
const { needsActivation: hypercoreNeedsActivation, activationFee: hypercoreActivationFee, sponsored: hypercoreActivationSponsored } = useHypercoreActivation({
|
|
27289
|
+
recipientAddress,
|
|
27290
|
+
sourceAddress: activeWalletInfo?.address,
|
|
27291
|
+
destinationChainId: selectedToken?.chain_id,
|
|
27292
|
+
publishableKey,
|
|
27293
|
+
enabled: !!activeWalletInfo && !!recipientAddress
|
|
27294
|
+
});
|
|
26949
27295
|
const effectiveDestinationAmount = React302.useMemo(() => {
|
|
26950
27296
|
if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
|
|
26951
27297
|
if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
|
|
@@ -26983,14 +27329,32 @@ function WalletConnect({
|
|
|
26983
27329
|
userId,
|
|
26984
27330
|
publishableKey,
|
|
26985
27331
|
clientSecret,
|
|
27332
|
+
// In-tab flow: poll the single connected deposit wallet.
|
|
26986
27333
|
depositWalletId: activeDepositWallet?.id ?? "",
|
|
26987
|
-
|
|
27334
|
+
// Mobile redirect flow: the deposit chain isn't known up front, so /poll every
|
|
27335
|
+
// chain's deposit wallet. Detection still happens via the single /query by
|
|
27336
|
+
// external_user_id, which already spans all chains.
|
|
27337
|
+
depositWalletIds: awaitingMobileDeposit ? mobileDepositWalletIds : void 0,
|
|
27338
|
+
enabled: hasSignedTransaction && !!activeDepositWallet || awaitingMobileDeposit,
|
|
26988
27339
|
onDepositSuccess,
|
|
26989
27340
|
onDepositError
|
|
26990
27341
|
});
|
|
26991
27342
|
React302.useEffect(() => {
|
|
26992
27343
|
onExecutionsChange?.(depositExecutions);
|
|
26993
27344
|
}, [depositExecutions, onExecutionsChange]);
|
|
27345
|
+
const latestDepositExecution = React302.useMemo(() => {
|
|
27346
|
+
if (depositExecutions.length === 0) return null;
|
|
27347
|
+
return [...depositExecutions].sort((a, b) => {
|
|
27348
|
+
const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
27349
|
+
const tb = b.created_at ? new Date(b.created_at).getTime() : 0;
|
|
27350
|
+
return tb - ta;
|
|
27351
|
+
})[0];
|
|
27352
|
+
}, [depositExecutions]);
|
|
27353
|
+
React302.useEffect(() => {
|
|
27354
|
+
if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
|
|
27355
|
+
transitionTo("mobile_deposit_status");
|
|
27356
|
+
}
|
|
27357
|
+
}, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
|
|
26994
27358
|
React302.useEffect(() => {
|
|
26995
27359
|
if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
|
|
26996
27360
|
const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
|
|
@@ -27032,7 +27396,7 @@ function WalletConnect({
|
|
|
27032
27396
|
let cancelled = false;
|
|
27033
27397
|
setIsLoading(true);
|
|
27034
27398
|
setError(null);
|
|
27035
|
-
const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" ? "ethereum" : activeDepositWallet.chain_type;
|
|
27399
|
+
const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" || activeDepositWallet.chain_type === "cardano" || activeDepositWallet.chain_type === "n1" ? "ethereum" : activeDepositWallet.chain_type;
|
|
27036
27400
|
getAddressBalances(activeWalletInfo.address, sct, publishableKey).then((response) => {
|
|
27037
27401
|
if (cancelled) return;
|
|
27038
27402
|
const nonZero = response.balances.filter((b) => b.amount !== "0");
|
|
@@ -27121,6 +27485,16 @@ function WalletConnect({
|
|
|
27121
27485
|
setSelectedWalletDef(null);
|
|
27122
27486
|
setConnectingNetwork(null);
|
|
27123
27487
|
break;
|
|
27488
|
+
case "mobile_redirect":
|
|
27489
|
+
transitionTo("select_wallet");
|
|
27490
|
+
setMobileRedirect(null);
|
|
27491
|
+
setAwaitingMobileDeposit(false);
|
|
27492
|
+
break;
|
|
27493
|
+
case "mobile_deposit_status":
|
|
27494
|
+
transitionTo("select_wallet");
|
|
27495
|
+
setMobileRedirect(null);
|
|
27496
|
+
setAwaitingMobileDeposit(false);
|
|
27497
|
+
break;
|
|
27124
27498
|
case "select_token":
|
|
27125
27499
|
if (walletProvidedAtMount.current) parentOnBack?.();
|
|
27126
27500
|
else transitionTo("select_wallet");
|
|
@@ -27188,9 +27562,16 @@ function WalletConnect({
|
|
|
27188
27562
|
const [integerPart = "0", decimalPart = ""] = amountStr.trim().split(".");
|
|
27189
27563
|
return (integerPart + decimalPart.padEnd(decimals, "0").slice(0, decimals)).replace(/^0+/, "") || "0";
|
|
27190
27564
|
};
|
|
27191
|
-
const
|
|
27192
|
-
|
|
27193
|
-
|
|
27565
|
+
const resolveEvmProvider = () => {
|
|
27566
|
+
const walletIdMap = {
|
|
27567
|
+
"phantom-ethereum": "phantom",
|
|
27568
|
+
coinbase: "coinbase",
|
|
27569
|
+
trust: "trust",
|
|
27570
|
+
okx: "okx",
|
|
27571
|
+
rainbow: "rainbow",
|
|
27572
|
+
rabby: "rabby",
|
|
27573
|
+
metamask: "metamask"
|
|
27574
|
+
};
|
|
27194
27575
|
const lookupId = walletIdMap[walletInfo.type] || walletInfo.type;
|
|
27195
27576
|
const eip6963Match = findProviderByWalletId(lookupId);
|
|
27196
27577
|
let provider = eip6963Match?.provider;
|
|
@@ -27199,6 +27580,11 @@ function WalletConnect({
|
|
|
27199
27580
|
else if (walletInfo.type === "coinbase") provider = window.coinbaseWalletExtension || window.ethereum;
|
|
27200
27581
|
else provider = window.ethereum;
|
|
27201
27582
|
}
|
|
27583
|
+
return provider;
|
|
27584
|
+
};
|
|
27585
|
+
const sendEthereumTransaction = async (token, amountStr) => {
|
|
27586
|
+
if (!recipientAddress || !/^0x[a-fA-F0-9]{40}$/.test(recipientAddress)) throw new Error(`Invalid recipient address.`);
|
|
27587
|
+
const provider = resolveEvmProvider();
|
|
27202
27588
|
if (!provider) throw new Error("Ethereum wallet not found");
|
|
27203
27589
|
const currentChainIdHex = await provider.request({ method: "eth_chainId", params: [] });
|
|
27204
27590
|
if (parseInt(currentChainIdHex, 16).toString() !== token.chain_id) {
|
|
@@ -27263,6 +27649,19 @@ function WalletConnect({
|
|
|
27263
27649
|
const resp = await sendSolanaTransaction({ chain_id: "mainnet", signed_transaction: btoa(bs) }, publishableKey);
|
|
27264
27650
|
return resp.signature;
|
|
27265
27651
|
};
|
|
27652
|
+
const sendHypercoreDeposit = async (token, amountStr) => {
|
|
27653
|
+
const provider = resolveEvmProvider();
|
|
27654
|
+
if (!provider) throw new Error("Ethereum wallet not found");
|
|
27655
|
+
const { signature } = await sendHypercoreEvmTransfer({
|
|
27656
|
+
provider,
|
|
27657
|
+
fromAddress: walletInfo.address,
|
|
27658
|
+
recipientAddress,
|
|
27659
|
+
sourceTokenAddress: token.token_address,
|
|
27660
|
+
amount: amountStr,
|
|
27661
|
+
publishableKey
|
|
27662
|
+
});
|
|
27663
|
+
return signature;
|
|
27664
|
+
};
|
|
27266
27665
|
const handleConfirm = async () => {
|
|
27267
27666
|
if (!hasWallet || !selectedBalance || !amountUsd || tokenAmount === 0 || !recipientAddress) return;
|
|
27268
27667
|
const token = getTokenFromBalance(selectedBalance);
|
|
@@ -27282,7 +27681,33 @@ function WalletConnect({
|
|
|
27282
27681
|
setIsConfirming(true);
|
|
27283
27682
|
setError(null);
|
|
27284
27683
|
try {
|
|
27285
|
-
const
|
|
27684
|
+
const isHypercoreToken = String(token.chain_id) === HYPERCORE_CHAIN_ID;
|
|
27685
|
+
let txHash;
|
|
27686
|
+
if (token.chain_type === "solana") {
|
|
27687
|
+
txHash = await sendSolanaTransaction2(token, tokenAmount.toString());
|
|
27688
|
+
} else if (isHypercoreToken) {
|
|
27689
|
+
let sendAmount = tokenAmount;
|
|
27690
|
+
try {
|
|
27691
|
+
const activation = await checkHypercoreActivation(
|
|
27692
|
+
{ source_address: walletInfo.address, recipient_address: recipientAddress },
|
|
27693
|
+
publishableKey
|
|
27694
|
+
);
|
|
27695
|
+
if (!activation.user_exists) {
|
|
27696
|
+
const fee = activation.activation_fee;
|
|
27697
|
+
if (!Number.isFinite(tokenAmount) || tokenAmount <= fee) {
|
|
27698
|
+
throw new Error(
|
|
27699
|
+
`Insufficient amount. A ${fee} USDC activation fee is required for the first transfer to this address.`
|
|
27700
|
+
);
|
|
27701
|
+
}
|
|
27702
|
+
sendAmount = tokenAmount - fee;
|
|
27703
|
+
}
|
|
27704
|
+
} catch (e) {
|
|
27705
|
+
if (e instanceof Error && e.message.includes("activation fee")) throw e;
|
|
27706
|
+
}
|
|
27707
|
+
txHash = await sendHypercoreDeposit(token, sendAmount.toString());
|
|
27708
|
+
} else {
|
|
27709
|
+
txHash = await sendEthereumTransaction(token, tokenAmount.toString());
|
|
27710
|
+
}
|
|
27286
27711
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
27287
27712
|
setHasSignedTransaction(true);
|
|
27288
27713
|
handleIveDeposited();
|
|
@@ -27306,33 +27731,40 @@ function WalletConnect({
|
|
|
27306
27731
|
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
27307
27732
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DepositHeader, { title: "Connect Wallet", showBack: canGoBack, onBack: handleBack, onClose }),
|
|
27308
27733
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-pb-4", children: [
|
|
27309
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.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" }),
|
|
27310
|
-
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) =>
|
|
27311
|
-
"
|
|
27312
|
-
|
|
27313
|
-
|
|
27314
|
-
|
|
27315
|
-
|
|
27316
|
-
|
|
27317
|
-
|
|
27318
|
-
|
|
27319
|
-
|
|
27320
|
-
|
|
27321
|
-
|
|
27322
|
-
|
|
27323
|
-
|
|
27324
|
-
|
|
27325
|
-
|
|
27326
|
-
|
|
27327
|
-
|
|
27328
|
-
|
|
27329
|
-
|
|
27734
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.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" }),
|
|
27735
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => {
|
|
27736
|
+
const walletPlatformAllowed = !wallet.mobileBrowsePlatforms || wallet.mobileBrowsePlatforms.includes(getMobilePlatform() ?? "");
|
|
27737
|
+
const showOpenInApp = isMobile && !wallet.isInstalled && wallet.supportsMobileBrowse !== false && walletPlatformAllowed;
|
|
27738
|
+
const isPending = pendingMobileWallet?.id === wallet.id;
|
|
27739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
27740
|
+
"button",
|
|
27741
|
+
{
|
|
27742
|
+
onClick: () => void handleWalletClick(wallet),
|
|
27743
|
+
disabled: isWalletConnecting || !!pendingMobileWallet,
|
|
27744
|
+
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",
|
|
27745
|
+
style: { backgroundColor: components.card.backgroundColor, borderRadius: components.card.borderRadius, border: `${components.card.borderWidth}px solid ${components.card.borderColor}` },
|
|
27746
|
+
children: [
|
|
27747
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
27748
|
+
WALLET_ICONS3[wallet.id] ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(WalletIconWithNetwork, { WalletIcon: WALLET_ICONS3[wallet.id], networks: wallet.networks, size: 40, className: "uf-rounded-lg" }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-w-10 uf-h-10 uf-rounded-lg uf-bg-gray-500" }),
|
|
27749
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-text-sm uf-font-medium", style: { color: components.card.titleColor, fontFamily: fonts.medium }, children: wallet.name })
|
|
27750
|
+
] }),
|
|
27751
|
+
isPending ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LoaderCircle, { className: "uf-w-4 uf-h-4 uf-animate-spin", style: { color: colors2.primary } }) : wallet.isInstalled ? /* @__PURE__ */ (0, import_jsx_runtime71.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_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-1", children: [
|
|
27752
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("span", { className: "uf-text-xs", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: showOpenInApp ? "Open" : "Install" }),
|
|
27753
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ExternalLink, { className: "uf-w-3 uf-h-3", style: { color: colors2.foregroundMuted } })
|
|
27754
|
+
] })
|
|
27755
|
+
]
|
|
27756
|
+
},
|
|
27757
|
+
wallet.id
|
|
27758
|
+
);
|
|
27759
|
+
}) }),
|
|
27330
27760
|
walletError && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
|
|
27331
27761
|
] })
|
|
27332
27762
|
] });
|
|
27333
27763
|
}
|
|
27764
|
+
const preConnectAccent = selectedWalletDef ? getWalletBrandColor(selectedWalletDef.id, mode) : void 0;
|
|
27765
|
+
const preConnectFg = preConnectAccent ? getContrastingTextColor(preConnectAccent) : void 0;
|
|
27334
27766
|
if (view === "select_network" && selectedWalletDef) {
|
|
27335
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
27767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
27336
27768
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DepositHeader, { title: "Select Network", showBack: true, onBack: handleBack, onClose }),
|
|
27337
27769
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-pb-4", children: [
|
|
27338
27770
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-pb-4", children: [
|
|
@@ -27362,10 +27794,10 @@ function WalletConnect({
|
|
|
27362
27794
|
)) }),
|
|
27363
27795
|
walletError && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-text-center uf-text-sm uf-mt-4 uf-px-4", style: { color: "#ef4444" }, children: walletError })
|
|
27364
27796
|
] })
|
|
27365
|
-
] });
|
|
27797
|
+
] }) });
|
|
27366
27798
|
}
|
|
27367
27799
|
if (view === "connecting") {
|
|
27368
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
27800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
27369
27801
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DepositHeader, { title: "Connecting...", showBack: true, onBack: handleBack, onClose }),
|
|
27370
27802
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16", children: [
|
|
27371
27803
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(LoaderCircle, { className: "uf-w-12 uf-h-12 uf-animate-spin uf-mb-4", style: { color: colors2.primary } }),
|
|
@@ -27376,40 +27808,148 @@ function WalletConnect({
|
|
|
27376
27808
|
] }),
|
|
27377
27809
|
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-text-sm uf-mt-2", style: { color: colors2.foregroundMuted }, children: "Please approve the connection in your wallet" })
|
|
27378
27810
|
] })
|
|
27379
|
-
] });
|
|
27380
|
-
}
|
|
27381
|
-
if (!hasWallet) return null;
|
|
27382
|
-
if (view === "select_token") {
|
|
27383
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SelectTokenView, { walletInfo, projectName, assetCdnUrl, balances, isLoading, error, selectedBalance, totalBalanceUsd, onTokenSelect: handleTokenSelect, onContinue: handleContinueToAmount, onBack: handleBack, onClose: onClose ?? (() => {
|
|
27384
|
-
}), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) });
|
|
27385
|
-
}
|
|
27386
|
-
if (view === "enter_amount" && selectedToken && selectedBalance) {
|
|
27387
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
|
|
27388
|
-
}), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) });
|
|
27389
|
-
}
|
|
27390
|
-
if (view === "review" && selectedToken) {
|
|
27391
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
|
|
27392
|
-
}) }) });
|
|
27393
|
-
}
|
|
27394
|
-
if (view === "confirming") {
|
|
27395
|
-
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ConfirmingView, { isConfirming, onClose: onClose ?? (() => {
|
|
27396
|
-
}), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) });
|
|
27811
|
+
] }) });
|
|
27397
27812
|
}
|
|
27398
|
-
|
|
27399
|
-
|
|
27400
|
-
|
|
27401
|
-
|
|
27402
|
-
|
|
27403
|
-
|
|
27404
|
-
|
|
27405
|
-
|
|
27406
|
-
|
|
27407
|
-
|
|
27408
|
-
|
|
27409
|
-
|
|
27410
|
-
|
|
27411
|
-
|
|
27412
|
-
|
|
27813
|
+
if (view === "mobile_redirect" && mobileRedirect) {
|
|
27814
|
+
const Icon22 = WALLET_ICONS3[mobileRedirect.walletId];
|
|
27815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
27816
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DepositHeader, { title: mobileRedirect.walletName, showBack: true, onBack: handleBack, onClose }),
|
|
27817
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-px-6 uf-py-10", children: [
|
|
27818
|
+
Icon22 ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Icon22, { size: 64, className: "uf-rounded-2xl uf-mb-5" }) : /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-w-16 uf-h-16 uf-rounded-2xl uf-bg-gray-500 uf-mb-5" }),
|
|
27819
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
27820
|
+
"div",
|
|
27821
|
+
{
|
|
27822
|
+
className: "uf-text-base uf-font-medium uf-text-center uf-mb-1",
|
|
27823
|
+
style: { color: colors2.foreground, fontFamily: fonts.medium },
|
|
27824
|
+
children: [
|
|
27825
|
+
"Continue in ",
|
|
27826
|
+
mobileRedirect.walletName
|
|
27827
|
+
]
|
|
27828
|
+
}
|
|
27829
|
+
),
|
|
27830
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
27831
|
+
"div",
|
|
27832
|
+
{
|
|
27833
|
+
className: "uf-text-sm uf-text-center uf-mb-6",
|
|
27834
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
27835
|
+
children: [
|
|
27836
|
+
"Complete your deposit in the ",
|
|
27837
|
+
mobileRedirect.walletName,
|
|
27838
|
+
" app"
|
|
27839
|
+
]
|
|
27840
|
+
}
|
|
27841
|
+
),
|
|
27842
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(
|
|
27843
|
+
"button",
|
|
27844
|
+
{
|
|
27845
|
+
type: "button",
|
|
27846
|
+
onClick: () => {
|
|
27847
|
+
window.location.href = mobileRedirect.deeplink;
|
|
27848
|
+
},
|
|
27849
|
+
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",
|
|
27850
|
+
style: {
|
|
27851
|
+
backgroundColor: components.card.backgroundColor,
|
|
27852
|
+
borderRadius: components.card.borderRadius,
|
|
27853
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
|
|
27854
|
+
color: components.card.titleColor,
|
|
27855
|
+
fontFamily: fonts.medium
|
|
27856
|
+
},
|
|
27857
|
+
children: [
|
|
27858
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ExternalLink, { className: "uf-w-4 uf-h-4", style: { color: components.card.iconColor } }),
|
|
27859
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("span", { className: "uf-text-sm uf-font-medium", children: [
|
|
27860
|
+
"Open in ",
|
|
27861
|
+
mobileRedirect.walletName
|
|
27862
|
+
] })
|
|
27863
|
+
]
|
|
27864
|
+
}
|
|
27865
|
+
),
|
|
27866
|
+
awaitingMobileDeposit && /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: "uf-flex uf-items-center uf-justify-center uf-gap-2 uf-mt-6", children: [
|
|
27867
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
27868
|
+
LoaderCircle,
|
|
27869
|
+
{
|
|
27870
|
+
className: "uf-w-4 uf-h-4 uf-animate-spin",
|
|
27871
|
+
style: { color: colors2.foregroundMuted }
|
|
27872
|
+
}
|
|
27873
|
+
),
|
|
27874
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
27875
|
+
"span",
|
|
27876
|
+
{
|
|
27877
|
+
className: "uf-text-sm",
|
|
27878
|
+
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
27879
|
+
children: "Checking for deposit..."
|
|
27880
|
+
}
|
|
27881
|
+
)
|
|
27882
|
+
] })
|
|
27883
|
+
] })
|
|
27884
|
+
] }) });
|
|
27885
|
+
}
|
|
27886
|
+
if (view === "mobile_deposit_status" && latestDepositExecution) {
|
|
27887
|
+
const isComplete = latestDepositExecution.status === ExecutionStatus.SUCCEEDED;
|
|
27888
|
+
const isFailed = latestDepositExecution.status === ExecutionStatus.FAILED;
|
|
27889
|
+
const title = isComplete ? "Payment Complete" : isFailed ? "Payment Failed" : "Payment Processing";
|
|
27890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: preConnectAccent, accentForeground: preConnectFg, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { style: viewTransitionStyle, children: [
|
|
27891
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
27892
|
+
DepositHeader,
|
|
27893
|
+
{
|
|
27894
|
+
title,
|
|
27895
|
+
showBack: false,
|
|
27896
|
+
onClose: isComplete && onDone ? onDone : onClose
|
|
27897
|
+
}
|
|
27898
|
+
),
|
|
27899
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)(DepositDetailContent, { execution: latestDepositExecution }),
|
|
27900
|
+
isComplete && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "uf-flex uf-gap-2 uf-px-2 uf-pt-4 uf-pb-4", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
27901
|
+
"button",
|
|
27902
|
+
{
|
|
27903
|
+
type: "button",
|
|
27904
|
+
onClick: onDone ? onDone : onNewDeposit ? onNewDeposit : onClose ?? (() => {
|
|
27905
|
+
}),
|
|
27906
|
+
className: "uf-flex-1 uf-py-4 uf-text-sm uf-font-medium uf-transition-opacity hover:uf-opacity-80",
|
|
27907
|
+
style: {
|
|
27908
|
+
backgroundColor: colors2.primary,
|
|
27909
|
+
color: colors2.primaryForeground,
|
|
27910
|
+
fontFamily: fonts.medium,
|
|
27911
|
+
borderRadius: components.button.borderRadius,
|
|
27912
|
+
border: `${components.button.borderWidth}px solid ${components.button.borderColor}`
|
|
27913
|
+
},
|
|
27914
|
+
children: "Done"
|
|
27915
|
+
}
|
|
27916
|
+
) })
|
|
27917
|
+
] }) });
|
|
27918
|
+
}
|
|
27919
|
+
if (!hasWallet) return null;
|
|
27920
|
+
const walletAccent = getWalletBrandColor(walletInfo.type, mode);
|
|
27921
|
+
const walletAccentForeground = walletAccent ? getContrastingTextColor(walletAccent) : void 0;
|
|
27922
|
+
if (view === "select_token") {
|
|
27923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(SelectTokenView, { walletInfo, projectName, assetCdnUrl, balances, isLoading, error, selectedBalance, totalBalanceUsd, onTokenSelect: handleTokenSelect, onContinue: handleContinueToAmount, onBack: handleBack, onClose: onClose ?? (() => {
|
|
27924
|
+
}), onDisconnectWallet: onWalletDisconnect ? () => void handleDisconnect() : void 0, isDisconnectingWallet, checkoutAmountUsd, checkoutReceivedUsd }) }) });
|
|
27925
|
+
}
|
|
27926
|
+
if (view === "enter_amount" && selectedToken && selectedBalance) {
|
|
27927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
|
|
27928
|
+
}), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd, footer: hypercoreNeedsActivation && !hypercoreActivationSponsored ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(HypercoreActivationWarning, { activationFee: hypercoreActivationFee }) : void 0 }) }) });
|
|
27929
|
+
}
|
|
27930
|
+
if (view === "review" && selectedToken) {
|
|
27931
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
|
|
27932
|
+
}) }) }) });
|
|
27933
|
+
}
|
|
27934
|
+
if (view === "confirming") {
|
|
27935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(ConfirmingView, { isConfirming, onClose: onClose ?? (() => {
|
|
27936
|
+
}), executions: depositExecutions, isPolling, onNewDeposit, onDone, paymentIntentStatus, amountReceivedUsd: checkoutReceivedUsd, amountReceivedUsdAtSubmission: receivedUsdAtSubmission }) }) });
|
|
27937
|
+
}
|
|
27938
|
+
return null;
|
|
27939
|
+
}
|
|
27940
|
+
function SkeletonButton({
|
|
27941
|
+
variant = "default"
|
|
27942
|
+
}) {
|
|
27943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-w-full uf-bg-secondary uf-rounded-xl uf-p-3 uf-flex uf-items-center uf-justify-between uf-animate-pulse", children: [
|
|
27944
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
|
|
27945
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-bg-muted uf-rounded-lg uf-w-9 uf-h-9" }),
|
|
27946
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-space-y-1.5", children: [
|
|
27947
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-3.5 uf-w-24 uf-bg-muted uf-rounded" }),
|
|
27948
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-3 uf-w-32 uf-bg-muted uf-rounded" })
|
|
27949
|
+
] })
|
|
27950
|
+
] }),
|
|
27951
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
27952
|
+
variant === "with-icons" && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-flex uf--space-x-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
27413
27953
|
"div",
|
|
27414
27954
|
{
|
|
27415
27955
|
className: "uf-w-5 uf-h-5 uf-rounded-full uf-bg-muted uf-border-2 uf-border-secondary"
|
|
@@ -27421,6 +27961,9 @@ function SkeletonButton({
|
|
|
27421
27961
|
] });
|
|
27422
27962
|
}
|
|
27423
27963
|
var t7 = i18n2.depositModal;
|
|
27964
|
+
function depositTabForScreen(screen) {
|
|
27965
|
+
return screen === "card" || screen === "cashapp" ? "cash" : "crypto";
|
|
27966
|
+
}
|
|
27424
27967
|
function DepositModal({
|
|
27425
27968
|
open,
|
|
27426
27969
|
onOpenChange,
|
|
@@ -27456,6 +27999,7 @@ function DepositModal({
|
|
|
27456
27999
|
theme = "dark",
|
|
27457
28000
|
hideOverlay = false,
|
|
27458
28001
|
initialScreen = "main",
|
|
28002
|
+
displayMode = "stacked",
|
|
27459
28003
|
transferCryptoTitle = t7.transferCrypto.title,
|
|
27460
28004
|
depositWithCardTitle = t7.depositWithCard.title,
|
|
27461
28005
|
payWithExchangeTitle = t7.payWithExchange.title,
|
|
@@ -27490,6 +28034,9 @@ function DepositModal({
|
|
|
27490
28034
|
effectiveInitialScreen
|
|
27491
28035
|
);
|
|
27492
28036
|
const [coinbaseSkipToHoldings, setCoinbaseSkipToHoldings] = (0, import_react8.useState)(false);
|
|
28037
|
+
const [depositTab, setDepositTab] = (0, import_react8.useState)(
|
|
28038
|
+
() => depositTabForScreen(effectiveInitialScreen)
|
|
28039
|
+
);
|
|
27493
28040
|
const resetViewTimeoutRef = (0, import_react8.useRef)(null);
|
|
27494
28041
|
const [cardView, setCardView] = (0, import_react8.useState)(
|
|
27495
28042
|
"amount"
|
|
@@ -27505,7 +28052,6 @@ function DepositModal({
|
|
|
27505
28052
|
const [allExecutions, setAllExecutions] = (0, import_react8.useState)([]);
|
|
27506
28053
|
const [selectedExecution, setSelectedExecution] = (0, import_react8.useState)(null);
|
|
27507
28054
|
const [depositExecutions, setDepositExecutions] = (0, import_react8.useState)([]);
|
|
27508
|
-
const isMobileView = useIsMobileViewport();
|
|
27509
28055
|
const { projectConfig } = useProjectConfig({
|
|
27510
28056
|
publishableKey,
|
|
27511
28057
|
enabled: open
|
|
@@ -27788,6 +28334,7 @@ function DepositModal({
|
|
|
27788
28334
|
resetViewTimeoutRef.current = null;
|
|
27789
28335
|
}
|
|
27790
28336
|
setView(effectiveInitialScreen);
|
|
28337
|
+
setDepositTab(depositTabForScreen(effectiveInitialScreen));
|
|
27791
28338
|
setCardView("amount");
|
|
27792
28339
|
setExchangeView("providers");
|
|
27793
28340
|
setBrowserWalletInfo(null);
|
|
@@ -27816,6 +28363,7 @@ function DepositModal({
|
|
|
27816
28363
|
} else if (view === "cashapp" && cashAppView !== "amount") {
|
|
27817
28364
|
setCashAppView("amount");
|
|
27818
28365
|
} else {
|
|
28366
|
+
setDepositTab(depositTabForScreen(view));
|
|
27819
28367
|
setView("main");
|
|
27820
28368
|
setCardView("amount");
|
|
27821
28369
|
setExchangeView("providers");
|
|
@@ -27895,13 +28443,181 @@ function DepositModal({
|
|
|
27895
28443
|
className: "uf-flex uf-justify-center uf-shrink-0"
|
|
27896
28444
|
}
|
|
27897
28445
|
) });
|
|
28446
|
+
const transferCryptoMenuButton = showTransferCrypto ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28447
|
+
TransferCryptoButton,
|
|
28448
|
+
{
|
|
28449
|
+
onClick: () => setView("transfer"),
|
|
28450
|
+
title: transferCryptoTitle,
|
|
28451
|
+
subtitle: t7.transferCrypto.subtitle,
|
|
28452
|
+
featuredTokens: projectConfig?.transfer_crypto.networks
|
|
28453
|
+
},
|
|
28454
|
+
"transfer"
|
|
28455
|
+
) : null;
|
|
28456
|
+
const connectWalletMenuButton = showConnectWallet ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28457
|
+
BrowserWalletButton,
|
|
28458
|
+
{
|
|
28459
|
+
onClick: handleBrowserWalletClick,
|
|
28460
|
+
onConnectClick: handleWalletConnectClick,
|
|
28461
|
+
onDisconnect: handleWalletDisconnect,
|
|
28462
|
+
chainType: browserWalletChainType,
|
|
28463
|
+
publishableKey,
|
|
28464
|
+
featuredWallets: projectConfig?.connect_wallet?.wallets
|
|
28465
|
+
},
|
|
28466
|
+
"wallet"
|
|
28467
|
+
) : null;
|
|
28468
|
+
const depositWithCardMenuButton = showFiatOnramp ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28469
|
+
DepositWithCardButton,
|
|
28470
|
+
{
|
|
28471
|
+
onClick: () => setView("card"),
|
|
28472
|
+
title: depositWithCardTitle,
|
|
28473
|
+
subtitle: t7.depositWithCard.subtitle,
|
|
28474
|
+
paymentNetworks: projectConfig?.payment_networks.networks
|
|
28475
|
+
},
|
|
28476
|
+
"card"
|
|
28477
|
+
) : null;
|
|
28478
|
+
const payWithExchangeMenuButton = showPayWithExchange ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28479
|
+
PayWithExchangeButton,
|
|
28480
|
+
{
|
|
28481
|
+
onClick: () => setView("exchange"),
|
|
28482
|
+
title: payWithExchangeTitle,
|
|
28483
|
+
subtitle: t7.payWithExchange.subtitle,
|
|
28484
|
+
exchanges,
|
|
28485
|
+
loading: exchangesLoading
|
|
28486
|
+
},
|
|
28487
|
+
"exchange"
|
|
28488
|
+
) : null;
|
|
28489
|
+
const connectExchangeMenuButton = showConnectExchange && connectedExchange ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28490
|
+
ConnectExchangeButton,
|
|
28491
|
+
{
|
|
28492
|
+
onClick: () => {
|
|
28493
|
+
setCoinbaseSkipToHoldings(true);
|
|
28494
|
+
setView("coinbase_connect");
|
|
28495
|
+
},
|
|
28496
|
+
onDisconnect: handleExchangeDisconnect,
|
|
28497
|
+
title: i18n2.connectExchange.title,
|
|
28498
|
+
subtitle: i18n2.connectExchange.subtitle,
|
|
28499
|
+
exchanges: integrationExchanges,
|
|
28500
|
+
connectedExchange
|
|
28501
|
+
},
|
|
28502
|
+
"connect-exchange"
|
|
28503
|
+
) : showConnectExchange && !connectedExchange ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28504
|
+
ConnectExchangeButton,
|
|
28505
|
+
{
|
|
28506
|
+
onClick: () => {
|
|
28507
|
+
setCoinbaseSkipToHoldings(false);
|
|
28508
|
+
setView("coinbase_connect");
|
|
28509
|
+
},
|
|
28510
|
+
title: i18n2.connectExchange.title,
|
|
28511
|
+
subtitle: i18n2.connectExchange.subtitle,
|
|
28512
|
+
exchanges: integrationExchanges
|
|
28513
|
+
},
|
|
28514
|
+
"connect-exchange"
|
|
28515
|
+
) : null;
|
|
28516
|
+
const cashAppMenuButton = showCashApp ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28517
|
+
CashAppButton,
|
|
28518
|
+
{
|
|
28519
|
+
onClick: () => setView("cashapp"),
|
|
28520
|
+
title: "Pay with Cash App",
|
|
28521
|
+
subtitle: "Deposit via Cash App",
|
|
28522
|
+
iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
|
|
28523
|
+
},
|
|
28524
|
+
"cashapp"
|
|
28525
|
+
) : null;
|
|
28526
|
+
const depositTrackerMenuButton = showDepositTracker ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28527
|
+
DepositTrackerButton,
|
|
28528
|
+
{
|
|
28529
|
+
onClick: () => {
|
|
28530
|
+
setAllExecutions(depositExecutions);
|
|
28531
|
+
setView("tracker");
|
|
28532
|
+
},
|
|
28533
|
+
title: depositTrackerTitle,
|
|
28534
|
+
subtitle: depositTrackerSubTitle,
|
|
28535
|
+
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
28536
|
+
},
|
|
28537
|
+
"tracker"
|
|
28538
|
+
) : null;
|
|
28539
|
+
const cryptoMenuButtons = [
|
|
28540
|
+
transferCryptoMenuButton,
|
|
28541
|
+
connectWalletMenuButton,
|
|
28542
|
+
payWithExchangeMenuButton,
|
|
28543
|
+
connectExchangeMenuButton
|
|
28544
|
+
].filter(Boolean);
|
|
28545
|
+
const cashMenuButtons = [
|
|
28546
|
+
depositWithCardMenuButton,
|
|
28547
|
+
cashAppMenuButton
|
|
28548
|
+
].filter(Boolean);
|
|
28549
|
+
const depositTabs = [
|
|
28550
|
+
{ id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
|
|
28551
|
+
{ id: "cash", label: "Use Cash", buttons: cashMenuButtons }
|
|
28552
|
+
].filter((tab) => tab.buttons.length > 0);
|
|
28553
|
+
const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
|
|
28554
|
+
const renderMainMenuBody = () => {
|
|
28555
|
+
if (depositPrerequisiteBody) {
|
|
28556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-space-y-3", children: depositPrerequisiteBody });
|
|
28557
|
+
}
|
|
28558
|
+
if (displayMode === "tabs" && activeDepositTab) {
|
|
28559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { children: [
|
|
28560
|
+
depositTabs.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28561
|
+
"div",
|
|
28562
|
+
{
|
|
28563
|
+
className: "uf-flex uf-gap-1 uf-p-1 uf-rounded-xl uf-mb-3",
|
|
28564
|
+
style: {
|
|
28565
|
+
// Frosted-glass track: a translucent fill plus a backdrop blur so
|
|
28566
|
+
// the control reads as a soft surface rather than a solid bar.
|
|
28567
|
+
backgroundColor: `color-mix(in srgb, ${colors2.card} 55%, transparent)`,
|
|
28568
|
+
backdropFilter: "blur(12px)",
|
|
28569
|
+
WebkitBackdropFilter: "blur(12px)"
|
|
28570
|
+
},
|
|
28571
|
+
role: "tablist",
|
|
28572
|
+
children: depositTabs.map((tab) => {
|
|
28573
|
+
const active = activeDepositTab.id === tab.id;
|
|
28574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28575
|
+
"button",
|
|
28576
|
+
{
|
|
28577
|
+
type: "button",
|
|
28578
|
+
role: "tab",
|
|
28579
|
+
"aria-selected": active,
|
|
28580
|
+
onClick: () => setDepositTab(tab.id),
|
|
28581
|
+
className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
|
|
28582
|
+
style: {
|
|
28583
|
+
// Active tab is a soft, blurred glass pill — a faint accent
|
|
28584
|
+
// tint with its own backdrop blur and a subtle border/shadow,
|
|
28585
|
+
// so it looks frosted instead of like a hard solid button.
|
|
28586
|
+
backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
|
|
28587
|
+
backdropFilter: active ? "blur(8px)" : void 0,
|
|
28588
|
+
WebkitBackdropFilter: active ? "blur(8px)" : void 0,
|
|
28589
|
+
boxShadow: active ? `0 1px 8px color-mix(in srgb, ${colors2.primary} 25%, transparent)` : void 0,
|
|
28590
|
+
color: active ? colors2.foreground : colors2.foregroundMuted,
|
|
28591
|
+
fontFamily: fonts.medium
|
|
28592
|
+
},
|
|
28593
|
+
children: tab.label
|
|
28594
|
+
},
|
|
28595
|
+
tab.id
|
|
28596
|
+
);
|
|
28597
|
+
})
|
|
28598
|
+
}
|
|
28599
|
+
),
|
|
28600
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-space-y-3", children: activeDepositTab.buttons }),
|
|
28601
|
+
depositTrackerMenuButton && /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-mt-3", children: depositTrackerMenuButton })
|
|
28602
|
+
] });
|
|
28603
|
+
}
|
|
28604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-space-y-3", children: [
|
|
28605
|
+
transferCryptoMenuButton,
|
|
28606
|
+
connectWalletMenuButton,
|
|
28607
|
+
depositWithCardMenuButton,
|
|
28608
|
+
payWithExchangeMenuButton,
|
|
28609
|
+
connectExchangeMenuButton,
|
|
28610
|
+
cashAppMenuButton,
|
|
28611
|
+
depositTrackerMenuButton
|
|
28612
|
+
] });
|
|
28613
|
+
};
|
|
27898
28614
|
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
27899
28615
|
Dialog2,
|
|
27900
28616
|
{
|
|
27901
28617
|
open: hideOverlay || open,
|
|
27902
28618
|
onOpenChange: hideOverlay ? void 0 : handleClose,
|
|
27903
28619
|
modal: !hideOverlay,
|
|
27904
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime72.
|
|
28620
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(
|
|
27905
28621
|
DialogContent2,
|
|
27906
28622
|
{
|
|
27907
28623
|
ref: hideOverlay ? containerCallbackRef : void 0,
|
|
@@ -27910,386 +28626,302 @@ function DepositModal({
|
|
|
27910
28626
|
style: { backgroundColor: colors2.background },
|
|
27911
28627
|
onPointerDownOutside: (e) => e.preventDefault(),
|
|
27912
28628
|
onInteractOutside: (e) => e.preventDefault(),
|
|
27913
|
-
children:
|
|
27914
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
27915
|
-
|
|
27916
|
-
|
|
27917
|
-
|
|
27918
|
-
|
|
27919
|
-
|
|
27920
|
-
|
|
27921
|
-
|
|
27922
|
-
|
|
27923
|
-
|
|
27924
|
-
|
|
27925
|
-
|
|
27926
|
-
|
|
27927
|
-
|
|
27928
|
-
|
|
27929
|
-
|
|
27930
|
-
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
|
|
27934
|
-
|
|
27935
|
-
|
|
27936
|
-
|
|
27937
|
-
|
|
27938
|
-
|
|
27939
|
-
|
|
27940
|
-
|
|
27941
|
-
|
|
28629
|
+
children: [
|
|
28630
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DialogTitle2, { className: "uf-sr-only", children: modalTitle || "Deposit" }),
|
|
28631
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(ThemeStyleInjector, { children: view === "main" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28632
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28633
|
+
DepositHeader,
|
|
28634
|
+
{
|
|
28635
|
+
title: modalTitle || "Deposit",
|
|
28636
|
+
showClose: !hideOverlay,
|
|
28637
|
+
onClose: handleClose,
|
|
28638
|
+
showBalance: showBalanceHeader,
|
|
28639
|
+
balanceAddress: recipientAddress,
|
|
28640
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
|
|
28641
|
+
balanceChainId: destinationChainId,
|
|
28642
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
28643
|
+
projectName: projectConfig?.project_name,
|
|
28644
|
+
publishableKey
|
|
28645
|
+
}
|
|
28646
|
+
),
|
|
28647
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28648
|
+
renderMainMenuBody(),
|
|
28649
|
+
depositPoweredByFooter
|
|
28650
|
+
] })
|
|
28651
|
+
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28652
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28653
|
+
DepositHeader,
|
|
28654
|
+
{
|
|
28655
|
+
title: transferCryptoTitle,
|
|
28656
|
+
showBack: showBackTransfer,
|
|
28657
|
+
onBack: handleBack,
|
|
28658
|
+
onClose: handleClose,
|
|
28659
|
+
showBalance: showBalanceHeader,
|
|
28660
|
+
balanceAddress: recipientAddress,
|
|
28661
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
|
|
28662
|
+
balanceChainId: destinationChainId,
|
|
28663
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
28664
|
+
projectName: projectConfig?.project_name,
|
|
28665
|
+
publishableKey
|
|
28666
|
+
}
|
|
28667
|
+
),
|
|
28668
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28669
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28670
|
+
TransferCryptoSingleInput,
|
|
27942
28671
|
{
|
|
27943
|
-
|
|
27944
|
-
onConnectClick: handleWalletConnectClick,
|
|
27945
|
-
onDisconnect: handleWalletDisconnect,
|
|
27946
|
-
chainType: browserWalletChainType,
|
|
28672
|
+
userId,
|
|
27947
28673
|
publishableKey,
|
|
27948
|
-
|
|
28674
|
+
recipientAddress,
|
|
28675
|
+
destinationChainType,
|
|
28676
|
+
destinationChainId,
|
|
28677
|
+
destinationTokenAddress,
|
|
28678
|
+
defaultSourceChainType,
|
|
28679
|
+
defaultSourceChainId,
|
|
28680
|
+
defaultSourceTokenAddress,
|
|
28681
|
+
defaultSourceSymbol,
|
|
28682
|
+
depositConfirmationMode,
|
|
28683
|
+
onExecutionsChange: setDepositExecutions,
|
|
28684
|
+
onDepositSuccess,
|
|
28685
|
+
onDepositError,
|
|
28686
|
+
wallets
|
|
27949
28687
|
}
|
|
27950
|
-
),
|
|
27951
|
-
|
|
27952
|
-
DepositWithCardButton,
|
|
28688
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28689
|
+
TransferCryptoDoubleInput,
|
|
27953
28690
|
{
|
|
27954
|
-
|
|
27955
|
-
|
|
27956
|
-
|
|
27957
|
-
|
|
28691
|
+
userId,
|
|
28692
|
+
publishableKey,
|
|
28693
|
+
recipientAddress,
|
|
28694
|
+
destinationChainType,
|
|
28695
|
+
destinationChainId,
|
|
28696
|
+
destinationTokenAddress,
|
|
28697
|
+
defaultSourceChainType,
|
|
28698
|
+
defaultSourceChainId,
|
|
28699
|
+
defaultSourceTokenAddress,
|
|
28700
|
+
defaultSourceSymbol,
|
|
28701
|
+
depositConfirmationMode,
|
|
28702
|
+
onExecutionsChange: setDepositExecutions,
|
|
28703
|
+
onDepositSuccess,
|
|
28704
|
+
onDepositError,
|
|
28705
|
+
wallets
|
|
27958
28706
|
}
|
|
27959
28707
|
),
|
|
27960
|
-
|
|
27961
|
-
|
|
28708
|
+
depositPoweredByFooter
|
|
28709
|
+
] })
|
|
28710
|
+
] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28711
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28712
|
+
DepositHeader,
|
|
28713
|
+
{
|
|
28714
|
+
title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
|
|
28715
|
+
showBack: showBackTracker,
|
|
28716
|
+
onBack: handleBack,
|
|
28717
|
+
onClose: handleClose
|
|
28718
|
+
}
|
|
28719
|
+
),
|
|
28720
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28721
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28722
|
+
"div",
|
|
27962
28723
|
{
|
|
27963
|
-
|
|
27964
|
-
|
|
27965
|
-
|
|
27966
|
-
exchanges,
|
|
27967
|
-
loading: exchangesLoading
|
|
28724
|
+
className: "uf-text-sm",
|
|
28725
|
+
style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
|
|
28726
|
+
children: "No deposits yet"
|
|
27968
28727
|
}
|
|
27969
|
-
),
|
|
27970
|
-
|
|
27971
|
-
ConnectExchangeButton,
|
|
28728
|
+
) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28729
|
+
DepositExecutionItem,
|
|
27972
28730
|
{
|
|
27973
|
-
|
|
27974
|
-
|
|
27975
|
-
|
|
27976
|
-
|
|
27977
|
-
|
|
27978
|
-
|
|
27979
|
-
|
|
27980
|
-
|
|
27981
|
-
|
|
27982
|
-
|
|
27983
|
-
|
|
27984
|
-
|
|
27985
|
-
|
|
28731
|
+
execution,
|
|
28732
|
+
onClick: () => setSelectedExecution(execution)
|
|
28733
|
+
},
|
|
28734
|
+
execution.id
|
|
28735
|
+
)) }) }),
|
|
28736
|
+
depositPoweredByFooter
|
|
28737
|
+
] })
|
|
28738
|
+
] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28739
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28740
|
+
DepositHeader,
|
|
28741
|
+
{
|
|
28742
|
+
title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
|
|
28743
|
+
showBack: showBackCard,
|
|
28744
|
+
onBack: handleBack,
|
|
28745
|
+
onClose: handleClose,
|
|
28746
|
+
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
28747
|
+
showBalance: showBalanceHeader,
|
|
28748
|
+
balanceAddress: recipientAddress,
|
|
28749
|
+
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
|
|
28750
|
+
balanceChainId: destinationChainId,
|
|
28751
|
+
balanceTokenAddress: destinationTokenAddress,
|
|
28752
|
+
projectName: projectConfig?.project_name,
|
|
28753
|
+
publishableKey
|
|
28754
|
+
}
|
|
28755
|
+
),
|
|
28756
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28757
|
+
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28758
|
+
BuyWithCard,
|
|
27986
28759
|
{
|
|
27987
|
-
|
|
27988
|
-
|
|
27989
|
-
|
|
27990
|
-
|
|
27991
|
-
|
|
27992
|
-
|
|
27993
|
-
|
|
28760
|
+
userId,
|
|
28761
|
+
publishableKey,
|
|
28762
|
+
view: cardView,
|
|
28763
|
+
onViewChange: handleCardViewChange,
|
|
28764
|
+
destinationTokenSymbol,
|
|
28765
|
+
recipientAddress,
|
|
28766
|
+
destinationChainType,
|
|
28767
|
+
destinationChainId,
|
|
28768
|
+
destinationTokenAddress,
|
|
28769
|
+
onDepositSuccess,
|
|
28770
|
+
onDepositError,
|
|
28771
|
+
onEvent,
|
|
28772
|
+
themeClass,
|
|
28773
|
+
wallets,
|
|
28774
|
+
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
28775
|
+
hideDepositFlowInfo,
|
|
28776
|
+
hideDisplayDescription
|
|
27994
28777
|
}
|
|
27995
28778
|
),
|
|
27996
|
-
|
|
27997
|
-
|
|
28779
|
+
depositPoweredByFooter
|
|
28780
|
+
] })
|
|
28781
|
+
] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28782
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28783
|
+
DepositHeader,
|
|
28784
|
+
{
|
|
28785
|
+
title: payWithExchangeTitle,
|
|
28786
|
+
showBack: exchangeView === "pending" || sessionOpenedFromMenu,
|
|
28787
|
+
onBack: handleBack,
|
|
28788
|
+
onClose: handleClose
|
|
28789
|
+
}
|
|
28790
|
+
),
|
|
28791
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28792
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28793
|
+
PayWithExchange,
|
|
27998
28794
|
{
|
|
27999
|
-
|
|
28000
|
-
|
|
28001
|
-
|
|
28002
|
-
|
|
28795
|
+
userId,
|
|
28796
|
+
publishableKey,
|
|
28797
|
+
exchanges,
|
|
28798
|
+
view: exchangeView,
|
|
28799
|
+
onViewChange: setExchangeView,
|
|
28800
|
+
destinationTokenSymbol,
|
|
28801
|
+
recipientAddress,
|
|
28802
|
+
destinationChainType,
|
|
28803
|
+
destinationChainId,
|
|
28804
|
+
destinationTokenAddress,
|
|
28805
|
+
onDepositSuccess,
|
|
28806
|
+
onDepositError,
|
|
28807
|
+
wallets,
|
|
28808
|
+
defaultToken: defaultToken ?? null
|
|
28003
28809
|
}
|
|
28004
28810
|
),
|
|
28005
|
-
|
|
28006
|
-
|
|
28007
|
-
|
|
28008
|
-
|
|
28009
|
-
|
|
28010
|
-
setView("tracker");
|
|
28011
|
-
},
|
|
28012
|
-
title: depositTrackerTitle,
|
|
28013
|
-
subtitle: depositTrackerSubTitle,
|
|
28014
|
-
badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
|
|
28015
|
-
}
|
|
28016
|
-
)
|
|
28017
|
-
] }) }),
|
|
28018
|
-
depositPoweredByFooter
|
|
28019
|
-
] })
|
|
28020
|
-
] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28021
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28022
|
-
DepositHeader,
|
|
28023
|
-
{
|
|
28024
|
-
title: transferCryptoTitle,
|
|
28025
|
-
showBack: showBackTransfer,
|
|
28026
|
-
onBack: handleBack,
|
|
28027
|
-
onClose: handleClose,
|
|
28028
|
-
showBalance: showBalanceHeader,
|
|
28029
|
-
balanceAddress: recipientAddress,
|
|
28030
|
-
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
|
|
28031
|
-
balanceChainId: destinationChainId,
|
|
28032
|
-
balanceTokenAddress: destinationTokenAddress,
|
|
28033
|
-
projectName: projectConfig?.project_name,
|
|
28034
|
-
publishableKey
|
|
28035
|
-
}
|
|
28036
|
-
),
|
|
28037
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28038
|
-
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : transferInputVariant === "single_input" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28039
|
-
TransferCryptoSingleInput,
|
|
28811
|
+
depositPoweredByFooter
|
|
28812
|
+
] })
|
|
28813
|
+
] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28814
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28815
|
+
CoinbaseConnect,
|
|
28040
28816
|
{
|
|
28041
|
-
userId,
|
|
28042
28817
|
publishableKey,
|
|
28043
|
-
recipientAddress,
|
|
28044
|
-
destinationChainType,
|
|
28045
|
-
destinationChainId,
|
|
28046
|
-
destinationTokenAddress,
|
|
28047
|
-
defaultSourceChainType,
|
|
28048
|
-
defaultSourceChainId,
|
|
28049
|
-
defaultSourceTokenAddress,
|
|
28050
|
-
defaultSourceSymbol,
|
|
28051
|
-
depositConfirmationMode,
|
|
28052
|
-
onExecutionsChange: setDepositExecutions,
|
|
28053
|
-
onDepositSuccess,
|
|
28054
|
-
onDepositError,
|
|
28055
|
-
wallets
|
|
28056
|
-
}
|
|
28057
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28058
|
-
TransferCryptoDoubleInput,
|
|
28059
|
-
{
|
|
28060
28818
|
userId,
|
|
28061
|
-
|
|
28819
|
+
wallets,
|
|
28062
28820
|
recipientAddress,
|
|
28063
|
-
|
|
28064
|
-
destinationChainId,
|
|
28065
|
-
|
|
28821
|
+
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
28822
|
+
destinationChainId: destinationChainId ?? "",
|
|
28823
|
+
destinationChainType: destinationChainType ?? "",
|
|
28824
|
+
onTransferSuccess: (result) => {
|
|
28825
|
+
onDepositSuccess?.({
|
|
28826
|
+
message: "Transfer completed via Coinbase Connect",
|
|
28827
|
+
transaction: result
|
|
28828
|
+
});
|
|
28829
|
+
},
|
|
28830
|
+
onTransferError: (error) => {
|
|
28831
|
+
onDepositError?.({
|
|
28832
|
+
message: error.message,
|
|
28833
|
+
error
|
|
28834
|
+
});
|
|
28835
|
+
},
|
|
28836
|
+
onBack: handleBack,
|
|
28837
|
+
onClose: handleClose,
|
|
28838
|
+
onDisconnect: handleExchangeDisconnect,
|
|
28839
|
+
skipToHoldings: coinbaseSkipToHoldings,
|
|
28840
|
+
canGoBack: sessionOpenedFromMenu,
|
|
28841
|
+
onExecutionsChange: setDepositExecutions,
|
|
28066
28842
|
defaultSourceChainType,
|
|
28067
28843
|
defaultSourceChainId,
|
|
28068
28844
|
defaultSourceTokenAddress,
|
|
28069
|
-
defaultSourceSymbol
|
|
28070
|
-
depositConfirmationMode,
|
|
28071
|
-
onExecutionsChange: setDepositExecutions,
|
|
28072
|
-
onDepositSuccess,
|
|
28073
|
-
onDepositError,
|
|
28074
|
-
wallets
|
|
28845
|
+
defaultSourceSymbol
|
|
28075
28846
|
}
|
|
28076
28847
|
),
|
|
28077
28848
|
depositPoweredByFooter
|
|
28078
|
-
] })
|
|
28079
|
-
] }) : view === "tracker" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28080
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28081
|
-
DepositHeader,
|
|
28082
|
-
{
|
|
28083
|
-
title: selectedExecution ? "Deposit Details" : depositTrackerTitle,
|
|
28084
|
-
showBack: showBackTracker,
|
|
28085
|
-
onBack: handleBack,
|
|
28086
|
-
onClose: handleClose
|
|
28087
|
-
}
|
|
28088
|
-
),
|
|
28089
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28090
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-h-[460px] uf-overflow-y-auto [scrollbar-width:none] [&::-webkit-scrollbar]:uf-hidden", children: selectedExecution ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(DepositDetailContent, { execution: selectedExecution }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-space-y-2 uf-pb-8", children: allExecutions.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-py-8 uf-px-4 uf-text-center", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28091
|
-
"div",
|
|
28092
|
-
{
|
|
28093
|
-
className: "uf-text-sm",
|
|
28094
|
-
style: { color: components.container.subtitleColor, fontFamily: fonts.regular },
|
|
28095
|
-
children: "No deposits yet"
|
|
28096
|
-
}
|
|
28097
|
-
) }) : allExecutions.map((execution) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28098
|
-
DepositExecutionItem,
|
|
28099
|
-
{
|
|
28100
|
-
execution,
|
|
28101
|
-
onClick: () => setSelectedExecution(execution)
|
|
28102
|
-
},
|
|
28103
|
-
execution.id
|
|
28104
|
-
)) }) }),
|
|
28105
|
-
depositPoweredByFooter
|
|
28106
|
-
] })
|
|
28107
|
-
] }) : view === "card" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28108
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28109
|
-
DepositHeader,
|
|
28110
|
-
{
|
|
28111
|
-
title: cardView === "quotes" ? t7.quotes : depositWithCardTitle,
|
|
28112
|
-
showBack: showBackCard,
|
|
28113
|
-
onBack: handleBack,
|
|
28114
|
-
onClose: handleClose,
|
|
28115
|
-
badge: cardView === "quotes" ? { count: quotesCount } : void 0,
|
|
28116
|
-
showBalance: showBalanceHeader,
|
|
28117
|
-
balanceAddress: recipientAddress,
|
|
28118
|
-
balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
|
|
28119
|
-
balanceChainId: destinationChainId,
|
|
28120
|
-
balanceTokenAddress: destinationTokenAddress,
|
|
28121
|
-
projectName: projectConfig?.project_name,
|
|
28122
|
-
publishableKey
|
|
28123
|
-
}
|
|
28124
|
-
),
|
|
28125
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28126
|
-
standaloneNeedsDepositPrereq && depositPrerequisiteBody !== null ? /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: "uf-pb-4 uf-space-y-3", children: depositPrerequisiteBody }) : /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28127
|
-
BuyWithCard,
|
|
28128
|
-
{
|
|
28129
|
-
userId,
|
|
28130
|
-
publishableKey,
|
|
28131
|
-
view: cardView,
|
|
28132
|
-
onViewChange: handleCardViewChange,
|
|
28133
|
-
destinationTokenSymbol,
|
|
28134
|
-
recipientAddress,
|
|
28135
|
-
destinationChainType,
|
|
28136
|
-
destinationChainId,
|
|
28137
|
-
destinationTokenAddress,
|
|
28138
|
-
onDepositSuccess,
|
|
28139
|
-
onDepositError,
|
|
28140
|
-
onEvent,
|
|
28141
|
-
themeClass,
|
|
28142
|
-
wallets,
|
|
28143
|
-
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
28144
|
-
hideDepositFlowInfo,
|
|
28145
|
-
hideDisplayDescription
|
|
28146
|
-
}
|
|
28147
|
-
),
|
|
28148
|
-
depositPoweredByFooter
|
|
28149
|
-
] })
|
|
28150
|
-
] }) : view === "exchange" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28151
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28152
|
-
DepositHeader,
|
|
28153
|
-
{
|
|
28154
|
-
title: payWithExchangeTitle,
|
|
28155
|
-
showBack: exchangeView === "pending" || sessionOpenedFromMenu,
|
|
28156
|
-
onBack: handleBack,
|
|
28157
|
-
onClose: handleClose
|
|
28158
|
-
}
|
|
28159
|
-
),
|
|
28160
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28849
|
+
] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28161
28850
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28162
|
-
|
|
28851
|
+
WalletConnect,
|
|
28163
28852
|
{
|
|
28853
|
+
walletInfo: browserWalletInfo ?? void 0,
|
|
28854
|
+
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
28855
|
+
wallets,
|
|
28164
28856
|
userId,
|
|
28165
28857
|
publishableKey,
|
|
28166
|
-
|
|
28167
|
-
|
|
28168
|
-
|
|
28169
|
-
|
|
28170
|
-
|
|
28171
|
-
|
|
28172
|
-
|
|
28173
|
-
|
|
28858
|
+
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
28859
|
+
projectName: projectConfig?.project_name,
|
|
28860
|
+
onSuccess: (txHash) => {
|
|
28861
|
+
onDepositSuccess?.({
|
|
28862
|
+
message: "Transaction sent successfully",
|
|
28863
|
+
transaction: { txHash }
|
|
28864
|
+
});
|
|
28865
|
+
},
|
|
28866
|
+
onError: (error) => {
|
|
28867
|
+
onDepositError?.({
|
|
28868
|
+
message: error.message,
|
|
28869
|
+
error
|
|
28870
|
+
});
|
|
28871
|
+
},
|
|
28174
28872
|
onDepositSuccess,
|
|
28175
28873
|
onDepositError,
|
|
28176
|
-
|
|
28177
|
-
|
|
28874
|
+
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
28875
|
+
onWalletDisconnect: handleWalletDisconnect,
|
|
28876
|
+
onWalletConnected: (info, dw) => {
|
|
28877
|
+
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
28878
|
+
setStoredWalletState(info.type);
|
|
28879
|
+
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
28880
|
+
},
|
|
28881
|
+
onBack: handleBack,
|
|
28882
|
+
onClose: handleClose,
|
|
28883
|
+
defaultSourceChainType,
|
|
28884
|
+
defaultSourceChainId,
|
|
28885
|
+
defaultSourceTokenAddress,
|
|
28886
|
+
defaultSourceSymbol,
|
|
28887
|
+
canGoBack: sessionOpenedFromMenu,
|
|
28888
|
+
depositWalletsLoading: walletsLoading
|
|
28178
28889
|
}
|
|
28179
28890
|
),
|
|
28180
28891
|
depositPoweredByFooter
|
|
28181
|
-
] })
|
|
28182
|
-
] }) : view === "coinbase_connect" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28183
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28184
|
-
CoinbaseConnect,
|
|
28185
|
-
{
|
|
28186
|
-
publishableKey,
|
|
28187
|
-
userId,
|
|
28188
|
-
wallets,
|
|
28189
|
-
recipientAddress,
|
|
28190
|
-
destinationTokenAddress: destinationTokenAddress ?? "",
|
|
28191
|
-
destinationChainId: destinationChainId ?? "",
|
|
28192
|
-
destinationChainType: destinationChainType ?? "",
|
|
28193
|
-
onTransferSuccess: (result) => {
|
|
28194
|
-
onDepositSuccess?.({
|
|
28195
|
-
message: "Transfer completed via Coinbase Connect",
|
|
28196
|
-
transaction: result
|
|
28197
|
-
});
|
|
28198
|
-
},
|
|
28199
|
-
onTransferError: (error) => {
|
|
28200
|
-
onDepositError?.({
|
|
28201
|
-
message: error.message,
|
|
28202
|
-
error
|
|
28203
|
-
});
|
|
28204
|
-
},
|
|
28205
|
-
onBack: handleBack,
|
|
28206
|
-
onClose: handleClose,
|
|
28207
|
-
onDisconnect: handleExchangeDisconnect,
|
|
28208
|
-
skipToHoldings: coinbaseSkipToHoldings,
|
|
28209
|
-
canGoBack: sessionOpenedFromMenu,
|
|
28210
|
-
onExecutionsChange: setDepositExecutions,
|
|
28211
|
-
defaultSourceChainType,
|
|
28212
|
-
defaultSourceChainId,
|
|
28213
|
-
defaultSourceTokenAddress,
|
|
28214
|
-
defaultSourceSymbol
|
|
28215
|
-
}
|
|
28216
|
-
),
|
|
28217
|
-
depositPoweredByFooter
|
|
28218
|
-
] }) : view === "wallet_connect" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28219
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28220
|
-
WalletConnect,
|
|
28221
|
-
{
|
|
28222
|
-
walletInfo: browserWalletInfo ?? void 0,
|
|
28223
|
-
depositWallet: browserWalletInfo?.depositWallet ?? void 0,
|
|
28224
|
-
wallets,
|
|
28225
|
-
userId,
|
|
28226
|
-
publishableKey,
|
|
28227
|
-
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
28228
|
-
projectName: projectConfig?.project_name,
|
|
28229
|
-
onSuccess: (txHash) => {
|
|
28230
|
-
onDepositSuccess?.({
|
|
28231
|
-
message: "Transaction sent successfully",
|
|
28232
|
-
transaction: { txHash }
|
|
28233
|
-
});
|
|
28234
|
-
},
|
|
28235
|
-
onError: (error) => {
|
|
28236
|
-
onDepositError?.({
|
|
28237
|
-
message: error.message,
|
|
28238
|
-
error
|
|
28239
|
-
});
|
|
28240
|
-
},
|
|
28241
|
-
onDepositSuccess,
|
|
28242
|
-
onDepositError,
|
|
28243
|
-
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
28244
|
-
onWalletDisconnect: handleWalletDisconnect,
|
|
28245
|
-
onWalletConnected: (info, dw) => {
|
|
28246
|
-
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
28247
|
-
setStoredWalletState(info.type);
|
|
28248
|
-
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
28249
|
-
},
|
|
28250
|
-
onBack: handleBack,
|
|
28251
|
-
onClose: handleClose,
|
|
28252
|
-
defaultSourceChainType,
|
|
28253
|
-
defaultSourceChainId,
|
|
28254
|
-
defaultSourceTokenAddress,
|
|
28255
|
-
defaultSourceSymbol,
|
|
28256
|
-
canGoBack: sessionOpenedFromMenu,
|
|
28257
|
-
depositWalletsLoading: walletsLoading
|
|
28258
|
-
}
|
|
28259
|
-
),
|
|
28260
|
-
depositPoweredByFooter
|
|
28261
|
-
] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28262
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28263
|
-
DepositHeader,
|
|
28264
|
-
{
|
|
28265
|
-
title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
|
|
28266
|
-
showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
|
|
28267
|
-
onBack: handleBack,
|
|
28268
|
-
onClose: handleClose
|
|
28269
|
-
}
|
|
28270
|
-
),
|
|
28271
|
-
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28892
|
+
] }) : view === "cashapp" ? /* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(import_jsx_runtime72.Fragment, { children: [
|
|
28272
28893
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28273
|
-
|
|
28894
|
+
DepositHeader,
|
|
28274
28895
|
{
|
|
28275
|
-
|
|
28276
|
-
|
|
28277
|
-
|
|
28278
|
-
|
|
28279
|
-
destinationChainId,
|
|
28280
|
-
destinationTokenAddress,
|
|
28281
|
-
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
28282
|
-
view: cashAppView,
|
|
28283
|
-
onViewChange: setCashAppView,
|
|
28284
|
-
onAmountChange: setCashAppAmount,
|
|
28285
|
-
onEvent,
|
|
28286
|
-
onDepositSuccess,
|
|
28287
|
-
onDepositError
|
|
28896
|
+
title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
|
|
28897
|
+
showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
|
|
28898
|
+
onBack: handleBack,
|
|
28899
|
+
onClose: handleClose
|
|
28288
28900
|
}
|
|
28289
28901
|
),
|
|
28290
|
-
|
|
28291
|
-
|
|
28292
|
-
|
|
28902
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
|
|
28903
|
+
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
28904
|
+
PayWithCashApp,
|
|
28905
|
+
{
|
|
28906
|
+
userId,
|
|
28907
|
+
publishableKey,
|
|
28908
|
+
recipientAddress,
|
|
28909
|
+
destinationChainType,
|
|
28910
|
+
destinationChainId,
|
|
28911
|
+
destinationTokenAddress,
|
|
28912
|
+
cashAppIconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0,
|
|
28913
|
+
view: cashAppView,
|
|
28914
|
+
onViewChange: setCashAppView,
|
|
28915
|
+
onAmountChange: setCashAppAmount,
|
|
28916
|
+
onEvent,
|
|
28917
|
+
onDepositSuccess,
|
|
28918
|
+
onDepositError
|
|
28919
|
+
}
|
|
28920
|
+
),
|
|
28921
|
+
depositPoweredByFooter
|
|
28922
|
+
] })
|
|
28923
|
+
] }) : null })
|
|
28924
|
+
]
|
|
28293
28925
|
}
|
|
28294
28926
|
)
|
|
28295
28927
|
}
|
|
@@ -28308,7 +28940,7 @@ function usePaymentIntent(params) {
|
|
|
28308
28940
|
enabled = true,
|
|
28309
28941
|
pollingInterval = 3e3
|
|
28310
28942
|
} = params;
|
|
28311
|
-
return (0,
|
|
28943
|
+
return (0, import_react_query16.useQuery)({
|
|
28312
28944
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
28313
28945
|
queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
|
|
28314
28946
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
@@ -28374,7 +29006,6 @@ function CheckoutModal({
|
|
|
28374
29006
|
const [browserWalletInfo, setBrowserWalletInfo] = (0, import_react28.useState)(null);
|
|
28375
29007
|
const [walletSelectionModalOpen, setWalletSelectionModalOpen] = (0, import_react28.useState)(false);
|
|
28376
29008
|
const [browserWalletChainType, setBrowserWalletChainType] = (0, import_react28.useState)(() => getStoredWalletState()?.chainType);
|
|
28377
|
-
const isMobileView = useIsMobileViewport();
|
|
28378
29009
|
const [resolvedTheme, setResolvedTheme] = (0, import_react28.useState)(
|
|
28379
29010
|
theme === "auto" ? "dark" : theme
|
|
28380
29011
|
);
|
|
@@ -28800,7 +29431,7 @@ function CheckoutModal({
|
|
|
28800
29431
|
featuredTokens: projectConfig?.transfer_crypto.networks
|
|
28801
29432
|
}
|
|
28802
29433
|
),
|
|
28803
|
-
showConnectWallet &&
|
|
29434
|
+
showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(
|
|
28804
29435
|
BrowserWalletButton,
|
|
28805
29436
|
{
|
|
28806
29437
|
onClick: handleBrowserWalletClick,
|
|
@@ -28961,7 +29592,7 @@ function CheckoutModal({
|
|
|
28961
29592
|
) }) });
|
|
28962
29593
|
}
|
|
28963
29594
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
28964
|
-
return (0,
|
|
29595
|
+
return (0, import_react_query17.useQuery)({
|
|
28965
29596
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
28966
29597
|
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
28967
29598
|
staleTime: 1e3 * 60 * 5,
|
|
@@ -28996,7 +29627,7 @@ function useSourceTokenValidation(params) {
|
|
|
28996
29627
|
enabled = true
|
|
28997
29628
|
} = params;
|
|
28998
29629
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
28999
|
-
return (0,
|
|
29630
|
+
return (0, import_react_query18.useQuery)({
|
|
29000
29631
|
queryKey: [
|
|
29001
29632
|
"unifold",
|
|
29002
29633
|
"sourceTokenValidation",
|
|
@@ -29052,7 +29683,7 @@ function useAddressBalance(params) {
|
|
|
29052
29683
|
enabled = true
|
|
29053
29684
|
} = params;
|
|
29054
29685
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
29055
|
-
return (0,
|
|
29686
|
+
return (0, import_react_query19.useQuery)({
|
|
29056
29687
|
queryKey: [
|
|
29057
29688
|
"unifold",
|
|
29058
29689
|
"addressBalance",
|
|
@@ -29101,7 +29732,7 @@ function useAddressBalance(params) {
|
|
|
29101
29732
|
}
|
|
29102
29733
|
function useExecutions(userId, publishableKey, options) {
|
|
29103
29734
|
const actionType = options?.actionType ?? ActionType.Deposit;
|
|
29104
|
-
return (0,
|
|
29735
|
+
return (0, import_react_query20.useQuery)({
|
|
29105
29736
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
29106
29737
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
29107
29738
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
@@ -29384,7 +30015,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
29384
30015
|
} = params;
|
|
29385
30016
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
29386
30017
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
29387
|
-
return (0,
|
|
30018
|
+
return (0, import_react_query21.useQuery)({
|
|
29388
30019
|
queryKey: [
|
|
29389
30020
|
"unifold",
|
|
29390
30021
|
"verifyRecipientAddress",
|
|
@@ -29411,9 +30042,6 @@ function useVerifyRecipientAddress(params) {
|
|
|
29411
30042
|
refetchOnWindowFocus: false
|
|
29412
30043
|
});
|
|
29413
30044
|
}
|
|
29414
|
-
function isHypercoreChain(chainId) {
|
|
29415
|
-
return chainId === HYPERCORE_CHAIN_ID;
|
|
29416
|
-
}
|
|
29417
30045
|
function useGetDepositAddress(params) {
|
|
29418
30046
|
const {
|
|
29419
30047
|
userId,
|
|
@@ -29426,7 +30054,7 @@ function useGetDepositAddress(params) {
|
|
|
29426
30054
|
enabled = true
|
|
29427
30055
|
} = params;
|
|
29428
30056
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
29429
|
-
return (0,
|
|
30057
|
+
return (0, import_react_query22.useQuery)({
|
|
29430
30058
|
queryKey: [
|
|
29431
30059
|
"unifold",
|
|
29432
30060
|
"getDepositAddress",
|
|
@@ -30340,8 +30968,6 @@ function WithdrawConfirmingView({
|
|
|
30340
30968
|
className: "uf-text-sm uf-text-center",
|
|
30341
30969
|
style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
|
|
30342
30970
|
children: [
|
|
30343
|
-
txInfo.amount,
|
|
30344
|
-
" ",
|
|
30345
30971
|
txInfo.sourceTokenSymbol,
|
|
30346
30972
|
" to",
|
|
30347
30973
|
" ",
|
|
@@ -30709,6 +31335,16 @@ function UnifoldProvider2({
|
|
|
30709
31335
|
});
|
|
30710
31336
|
promise.catch(() => {
|
|
30711
31337
|
});
|
|
31338
|
+
if (!config2.recipientAddress) {
|
|
31339
|
+
const error = {
|
|
31340
|
+
message: "beginDeposit requires a `recipientAddress`.",
|
|
31341
|
+
code: "MISSING_RECIPIENT"
|
|
31342
|
+
};
|
|
31343
|
+
console.error(`[UnifoldProvider] ${error.message}`);
|
|
31344
|
+
depositPromiseRef.current.reject(error);
|
|
31345
|
+
depositPromiseRef.current = null;
|
|
31346
|
+
return promise;
|
|
31347
|
+
}
|
|
30712
31348
|
setDepositConfig(config2);
|
|
30713
31349
|
setIsOpen(true);
|
|
30714
31350
|
return promise;
|
|
@@ -30975,6 +31611,7 @@ function UnifoldProvider2({
|
|
|
30975
31611
|
hideDepositTracker: config?.hideDepositTracker,
|
|
30976
31612
|
showBalanceHeader: config?.showBalanceHeader,
|
|
30977
31613
|
transferInputVariant: config?.transferInputVariant,
|
|
31614
|
+
displayMode: config?.displayMode,
|
|
30978
31615
|
enableTransferCrypto: config?.enableTransferCrypto,
|
|
30979
31616
|
enableConnectWallet: config?.enableConnectWallet,
|
|
30980
31617
|
enablePayWithExchange: config?.enablePayWithExchange,
|