@unifold/connect-react 0.1.60 → 0.1.62
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/README.md +1 -1
- package/dist/index.d.mts +15 -4
- package/dist/index.d.ts +15 -4
- package/dist/index.js +380 -360
- package/dist/index.mjs +538 -518
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1145,10 +1145,10 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
|
1145
1145
|
|
|
1146
1146
|
// src/provider.tsx
|
|
1147
1147
|
import React38, {
|
|
1148
|
-
useState as
|
|
1148
|
+
useState as useState31,
|
|
1149
1149
|
useCallback as useCallback13,
|
|
1150
1150
|
useMemo as useMemo15,
|
|
1151
|
-
useEffect as
|
|
1151
|
+
useEffect as useEffect33
|
|
1152
1152
|
} from "react";
|
|
1153
1153
|
|
|
1154
1154
|
// ../react-provider/dist/index.mjs
|
|
@@ -1225,11 +1225,11 @@ function useUnifold() {
|
|
|
1225
1225
|
|
|
1226
1226
|
// ../ui-react/dist/index.mjs
|
|
1227
1227
|
import {
|
|
1228
|
-
useState as
|
|
1229
|
-
useEffect as
|
|
1228
|
+
useState as useState32,
|
|
1229
|
+
useEffect as useEffect26,
|
|
1230
1230
|
useLayoutEffect as useLayoutEffect22,
|
|
1231
1231
|
useCallback as useCallback52,
|
|
1232
|
-
useRef as
|
|
1232
|
+
useRef as useRef92,
|
|
1233
1233
|
useMemo as useMemo10
|
|
1234
1234
|
} from "react";
|
|
1235
1235
|
|
|
@@ -6193,6 +6193,7 @@ async function createDepositAddress(overrides, publishableKey) {
|
|
|
6193
6193
|
recipient_address: overrides?.recipient_address || DEFAULT_CONFIG.recipientAddress || "0x309a4154a2CD4153Da886E780890C9cb5161553C",
|
|
6194
6194
|
...overrides?.action_type ? { action_type: overrides.action_type } : {},
|
|
6195
6195
|
...overrides?.source_chain_type ? { source_chain_type: overrides.source_chain_type } : {},
|
|
6196
|
+
...overrides?.contract_calls ? { contract_calls: overrides.contract_calls } : {},
|
|
6196
6197
|
client_metadata: overrides?.client_metadata || {}
|
|
6197
6198
|
};
|
|
6198
6199
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
@@ -7354,7 +7355,7 @@ import * as React102 from "react";
|
|
|
7354
7355
|
import { jsx as jsx21, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7355
7356
|
import * as React112 from "react";
|
|
7356
7357
|
import { jsx as jsx222, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7357
|
-
import * as
|
|
7358
|
+
import * as React252 from "react";
|
|
7358
7359
|
|
|
7359
7360
|
// ../../node_modules/.pnpm/mipd@0.0.7_typescript@5.9.3/node_modules/mipd/dist/esm/utils.js
|
|
7360
7361
|
function requestProviders(listener) {
|
|
@@ -7412,32 +7413,33 @@ function createStore() {
|
|
|
7412
7413
|
|
|
7413
7414
|
// ../ui-react/dist/index.mjs
|
|
7414
7415
|
import * as React122 from "react";
|
|
7415
|
-
import { jsx as jsx232, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7416
7416
|
import * as React132 from "react";
|
|
7417
|
-
import { jsx as
|
|
7417
|
+
import { jsx as jsx232, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7418
7418
|
import * as React142 from "react";
|
|
7419
|
-
import { jsx as
|
|
7419
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7420
7420
|
import * as React152 from "react";
|
|
7421
|
-
import { jsx as
|
|
7421
|
+
import { jsx as jsx25, jsxs as jsxs222 } from "react/jsx-runtime";
|
|
7422
7422
|
import * as React162 from "react";
|
|
7423
|
-
import { jsx as
|
|
7423
|
+
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7424
7424
|
import * as React172 from "react";
|
|
7425
|
-
import { jsx as
|
|
7425
|
+
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7426
7426
|
import * as React182 from "react";
|
|
7427
|
-
import { jsx as
|
|
7427
|
+
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7428
7428
|
import * as React192 from "react";
|
|
7429
|
-
import { jsx as
|
|
7429
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7430
7430
|
import * as React202 from "react";
|
|
7431
|
-
import { jsx as
|
|
7431
|
+
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7432
7432
|
import * as React212 from "react";
|
|
7433
|
-
import { jsx as
|
|
7433
|
+
import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7434
7434
|
import * as React222 from "react";
|
|
7435
|
-
import { jsx as
|
|
7435
|
+
import { jsx as jsx322, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7436
7436
|
import * as React232 from "react";
|
|
7437
|
+
import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7438
|
+
import * as React242 from "react";
|
|
7437
7439
|
import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7438
7440
|
import { jsx as jsx35, jsxs as jsxs322 } from "react/jsx-runtime";
|
|
7439
7441
|
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
7440
|
-
import { useState as
|
|
7442
|
+
import { useState as useState222, useEffect as useEffect172, useCallback as useCallback22, useMemo as useMemo42, useRef as useRef62 } from "react";
|
|
7441
7443
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
7442
7444
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
7443
7445
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
@@ -7446,13 +7448,13 @@ import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
|
7446
7448
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
7447
7449
|
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
7448
7450
|
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
7449
|
-
import { useState as
|
|
7450
|
-
import { useEffect as
|
|
7451
|
-
import * as
|
|
7451
|
+
import { useState as useState28, useEffect as useEffect222, useMemo as useMemo72 } from "react";
|
|
7452
|
+
import { useEffect as useEffect192, useState as useState232 } from "react";
|
|
7453
|
+
import * as React272 from "react";
|
|
7452
7454
|
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
7453
7455
|
import { jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
7454
7456
|
import { Fragment as Fragment52, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
7455
|
-
import { useState as
|
|
7457
|
+
import { useState as useState242, useMemo as useMemo62, useEffect as useEffect202 } from "react";
|
|
7456
7458
|
|
|
7457
7459
|
// ../../node_modules/.pnpm/fuse.js@7.4.0/node_modules/fuse.js/dist/fuse.mjs
|
|
7458
7460
|
function isArray(value) {
|
|
@@ -9454,11 +9456,11 @@ Fuse.use = function(...plugins) {
|
|
|
9454
9456
|
|
|
9455
9457
|
// ../ui-react/dist/index.mjs
|
|
9456
9458
|
import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
9457
|
-
import { useState as
|
|
9459
|
+
import { useState as useState252, useEffect as useEffect212, useRef as useRef72 } from "react";
|
|
9458
9460
|
import { jsx as jsx422, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
9459
9461
|
import { Fragment as Fragment62, jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
9460
|
-
import { useState as
|
|
9461
|
-
import * as
|
|
9462
|
+
import { useState as useState262 } from "react";
|
|
9463
|
+
import * as React282 from "react";
|
|
9462
9464
|
|
|
9463
9465
|
// ../../node_modules/.pnpm/@radix-ui+react-tooltip@1.2.8_@types+react-dom@19.2.3_@types+react@19.2.9__@types+react@19.2._udyjcec5g7ve3mpsxbgla63vgi/node_modules/@radix-ui/react-tooltip/dist/index.mjs
|
|
9464
9466
|
import * as React31 from "react";
|
|
@@ -12199,8 +12201,8 @@ import { jsx as jsx44 } from "react/jsx-runtime";
|
|
|
12199
12201
|
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
12200
12202
|
import { jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
12201
12203
|
import { Fragment as Fragment72, jsx as jsx46, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
12202
|
-
import { useState as
|
|
12203
|
-
import * as
|
|
12204
|
+
import { useState as useState29, useEffect as useEffect232, useMemo as useMemo82 } from "react";
|
|
12205
|
+
import * as React292 from "react";
|
|
12204
12206
|
|
|
12205
12207
|
// ../../node_modules/.pnpm/@radix-ui+react-select@2.2.6_@types+react-dom@19.2.3_@types+react@19.2.9__@types+react@19.2.9_cot3leusltbsophitaz3dgdqdm/node_modules/@radix-ui/react-select/dist/index.mjs
|
|
12206
12208
|
import * as React35 from "react";
|
|
@@ -13437,49 +13439,49 @@ var Separator = SelectSeparator;
|
|
|
13437
13439
|
// ../ui-react/dist/index.mjs
|
|
13438
13440
|
import { jsx as jsx47, jsxs as jsxs422 } from "react/jsx-runtime";
|
|
13439
13441
|
import { jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
13440
|
-
import * as
|
|
13442
|
+
import * as React302 from "react";
|
|
13441
13443
|
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
13442
13444
|
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
13443
13445
|
import { jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
13444
13446
|
import { Fragment as Fragment82, jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
13445
13447
|
import { Fragment as Fragment9, jsx as jsx522, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
13446
|
-
import { useEffect as
|
|
13448
|
+
import { useEffect as useEffect242, useState as useState302 } from "react";
|
|
13447
13449
|
import { Fragment as Fragment10, jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
13448
13450
|
import { jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
13449
13451
|
import { Fragment as Fragment11, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
13450
13452
|
import {
|
|
13451
|
-
useState as
|
|
13452
|
-
useEffect as
|
|
13453
|
+
useState as useState33,
|
|
13454
|
+
useEffect as useEffect272,
|
|
13453
13455
|
useLayoutEffect as useLayoutEffect32,
|
|
13454
13456
|
useCallback as useCallback62,
|
|
13455
|
-
useRef as
|
|
13457
|
+
useRef as useRef102,
|
|
13456
13458
|
useMemo as useMemo112
|
|
13457
13459
|
} from "react";
|
|
13458
13460
|
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
13459
13461
|
import { Fragment as Fragment12, jsx as jsx56, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
13460
13462
|
import {
|
|
13461
|
-
useState as
|
|
13462
|
-
useEffect as
|
|
13463
|
+
useState as useState37,
|
|
13464
|
+
useEffect as useEffect31,
|
|
13463
13465
|
useLayoutEffect as useLayoutEffect42,
|
|
13464
13466
|
useCallback as useCallback82,
|
|
13465
|
-
useRef as
|
|
13467
|
+
useRef as useRef122
|
|
13466
13468
|
} from "react";
|
|
13467
13469
|
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
13468
13470
|
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
13469
13471
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
13470
13472
|
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
13471
|
-
import { useState as
|
|
13473
|
+
import { useState as useState34, useEffect as useEffect282, useRef as useRef112 } from "react";
|
|
13472
13474
|
import { jsx as jsx57, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
13473
|
-
import { useState as
|
|
13475
|
+
import { useState as useState35, useCallback as useCallback72, useMemo as useMemo132, useEffect as useEffect292 } from "react";
|
|
13474
13476
|
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
13475
13477
|
import { useMemo as useMemo122 } from "react";
|
|
13476
13478
|
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
13477
13479
|
import { Fragment as Fragment13, jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
13478
13480
|
import { jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
13479
|
-
import { useState as
|
|
13481
|
+
import { useState as useState36, useEffect as useEffect302 } from "react";
|
|
13480
13482
|
import { Fragment as Fragment14, jsx as jsx60, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
13481
13483
|
import { Fragment as Fragment15, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
13482
|
-
import { useState as
|
|
13484
|
+
import { useState as useState38, useMemo as useMemo142 } from "react";
|
|
13483
13485
|
import { jsx as jsx622, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
13484
13486
|
function cn(...inputs) {
|
|
13485
13487
|
return twMerge(clsx(inputs));
|
|
@@ -14047,6 +14049,7 @@ function useDepositAddress(params) {
|
|
|
14047
14049
|
destinationChainId,
|
|
14048
14050
|
destinationTokenAddress,
|
|
14049
14051
|
actionType,
|
|
14052
|
+
contractCalls,
|
|
14050
14053
|
enabled = true
|
|
14051
14054
|
} = params;
|
|
14052
14055
|
return useQuery2({
|
|
@@ -14059,6 +14062,7 @@ function useDepositAddress(params) {
|
|
|
14059
14062
|
destinationChainId ?? null,
|
|
14060
14063
|
destinationTokenAddress ?? null,
|
|
14061
14064
|
actionType ?? null,
|
|
14065
|
+
contractCalls ?? null,
|
|
14062
14066
|
publishableKey
|
|
14063
14067
|
],
|
|
14064
14068
|
queryFn: () => createDepositAddress(
|
|
@@ -14068,7 +14072,8 @@ function useDepositAddress(params) {
|
|
|
14068
14072
|
destination_chain_type: destinationChainType,
|
|
14069
14073
|
destination_chain_id: destinationChainId,
|
|
14070
14074
|
destination_token_address: destinationTokenAddress,
|
|
14071
|
-
action_type: actionType
|
|
14075
|
+
action_type: actionType,
|
|
14076
|
+
contract_calls: contractCalls
|
|
14072
14077
|
},
|
|
14073
14078
|
publishableKey
|
|
14074
14079
|
),
|
|
@@ -18559,6 +18564,190 @@ function collectAllEip6963EthProviders() {
|
|
|
18559
18564
|
if (!store) return [];
|
|
18560
18565
|
return store.getProviders().map((d) => d.provider);
|
|
18561
18566
|
}
|
|
18567
|
+
function identifyEthWallet(provider, hint) {
|
|
18568
|
+
switch (hint) {
|
|
18569
|
+
case "metamask":
|
|
18570
|
+
return { type: "metamask", name: "MetaMask", icon: "metamask" };
|
|
18571
|
+
case "phantom":
|
|
18572
|
+
return { type: "phantom-ethereum", name: "Phantom", icon: "phantom" };
|
|
18573
|
+
case "coinbase":
|
|
18574
|
+
return { type: "coinbase", name: "Coinbase Wallet", icon: "coinbase" };
|
|
18575
|
+
case "okx":
|
|
18576
|
+
return { type: "okx", name: "OKX Wallet", icon: "okx" };
|
|
18577
|
+
case "rabby":
|
|
18578
|
+
return { type: "rabby", name: "Rabby", icon: "rabby" };
|
|
18579
|
+
case "trust":
|
|
18580
|
+
return { type: "trust", name: "Trust Wallet", icon: "trust" };
|
|
18581
|
+
case "rainbow":
|
|
18582
|
+
return { type: "rainbow", name: "Rainbow", icon: "rainbow" };
|
|
18583
|
+
}
|
|
18584
|
+
const anyProvider = provider;
|
|
18585
|
+
if (provider.isPhantom) {
|
|
18586
|
+
return { type: "phantom-ethereum", name: "Phantom", icon: "phantom" };
|
|
18587
|
+
}
|
|
18588
|
+
if (anyProvider.isCoinbaseWallet) {
|
|
18589
|
+
return { type: "coinbase", name: "Coinbase Wallet", icon: "coinbase" };
|
|
18590
|
+
}
|
|
18591
|
+
if (anyProvider.isRabby) {
|
|
18592
|
+
return { type: "rabby", name: "Rabby", icon: "rabby" };
|
|
18593
|
+
}
|
|
18594
|
+
if (anyProvider.isTrust) {
|
|
18595
|
+
return { type: "trust", name: "Trust Wallet", icon: "trust" };
|
|
18596
|
+
}
|
|
18597
|
+
if (anyProvider.isRainbow) {
|
|
18598
|
+
return { type: "rainbow", name: "Rainbow", icon: "rainbow" };
|
|
18599
|
+
}
|
|
18600
|
+
if (provider.isMetaMask && !provider.isPhantom) {
|
|
18601
|
+
return { type: "metamask", name: "MetaMask", icon: "metamask" };
|
|
18602
|
+
}
|
|
18603
|
+
return { type: "metamask", name: "Wallet", icon: "metamask" };
|
|
18604
|
+
}
|
|
18605
|
+
async function detectConnectedBrowserWallet(chainType) {
|
|
18606
|
+
if (typeof window === "undefined") return null;
|
|
18607
|
+
if (getUserDisconnectedWallet()) return null;
|
|
18608
|
+
try {
|
|
18609
|
+
const win = window;
|
|
18610
|
+
if (!chainType || chainType === "solana") {
|
|
18611
|
+
const trySilentSolana = async (provider, type, name, icon) => {
|
|
18612
|
+
if (!provider) return null;
|
|
18613
|
+
if (provider.isConnected && provider.publicKey) {
|
|
18614
|
+
return { type, name, address: provider.publicKey.toString(), icon };
|
|
18615
|
+
}
|
|
18616
|
+
try {
|
|
18617
|
+
const resp = await provider.connect({ onlyIfTrusted: true });
|
|
18618
|
+
if (resp.publicKey) {
|
|
18619
|
+
return { type, name, address: resp.publicKey.toString(), icon };
|
|
18620
|
+
}
|
|
18621
|
+
} catch {
|
|
18622
|
+
}
|
|
18623
|
+
return null;
|
|
18624
|
+
};
|
|
18625
|
+
const solanaCandidates = [
|
|
18626
|
+
[win.phantom?.solana, "phantom-solana", "Phantom", "phantom"],
|
|
18627
|
+
[win.solflare, "solflare", "Solflare", "solflare"],
|
|
18628
|
+
[win.backpack, "backpack", "Backpack", "backpack"],
|
|
18629
|
+
[win.glow, "glow", "Glow", "glow"]
|
|
18630
|
+
];
|
|
18631
|
+
for (const [provider, type, name, icon] of solanaCandidates) {
|
|
18632
|
+
const found = await trySilentSolana(provider, type, name, icon);
|
|
18633
|
+
if (found) return found;
|
|
18634
|
+
}
|
|
18635
|
+
}
|
|
18636
|
+
if (!chainType || chainType === "ethereum") {
|
|
18637
|
+
const allProviders = [];
|
|
18638
|
+
const eip6963 = getEip6963Providers();
|
|
18639
|
+
for (const { provider, walletId } of eip6963) {
|
|
18640
|
+
allProviders.push({
|
|
18641
|
+
provider,
|
|
18642
|
+
walletId: walletId === "unknown" ? "default" : walletId
|
|
18643
|
+
});
|
|
18644
|
+
}
|
|
18645
|
+
if (allProviders.length === 0) {
|
|
18646
|
+
if (win.phantom?.ethereum) {
|
|
18647
|
+
allProviders.push({ provider: win.phantom.ethereum, walletId: "phantom" });
|
|
18648
|
+
}
|
|
18649
|
+
if (win.okxwallet) {
|
|
18650
|
+
allProviders.push({ provider: win.okxwallet, walletId: "okx" });
|
|
18651
|
+
}
|
|
18652
|
+
if (win.coinbaseWalletExtension) {
|
|
18653
|
+
allProviders.push({ provider: win.coinbaseWalletExtension, walletId: "coinbase" });
|
|
18654
|
+
}
|
|
18655
|
+
if (win.ethereum && !allProviders.some((p) => p.provider === win.ethereum)) {
|
|
18656
|
+
allProviders.push({ provider: win.ethereum, walletId: "default" });
|
|
18657
|
+
}
|
|
18658
|
+
}
|
|
18659
|
+
for (const { provider, walletId } of allProviders) {
|
|
18660
|
+
if (!provider) continue;
|
|
18661
|
+
try {
|
|
18662
|
+
const accounts = await provider.request({ method: "eth_accounts" });
|
|
18663
|
+
if (!accounts || accounts.length === 0) continue;
|
|
18664
|
+
const resolved = identifyEthWallet(provider, walletId);
|
|
18665
|
+
return { ...resolved, address: accounts[0] };
|
|
18666
|
+
} catch {
|
|
18667
|
+
}
|
|
18668
|
+
}
|
|
18669
|
+
}
|
|
18670
|
+
} catch (error) {
|
|
18671
|
+
console.error("[detectConnectedBrowserWallet] detection error:", error);
|
|
18672
|
+
}
|
|
18673
|
+
return null;
|
|
18674
|
+
}
|
|
18675
|
+
function useDetectedBrowserWallet(opts = {}) {
|
|
18676
|
+
const { chainType, enabled = true, onDisconnect } = opts;
|
|
18677
|
+
const [wallet, setWallet] = React122.useState(null);
|
|
18678
|
+
const [isLoading, setIsLoading] = React122.useState(enabled);
|
|
18679
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React122.useState(0);
|
|
18680
|
+
const onDisconnectRef = React122.useRef(onDisconnect);
|
|
18681
|
+
onDisconnectRef.current = onDisconnect;
|
|
18682
|
+
React122.useEffect(() => {
|
|
18683
|
+
const store = getEip6963Store();
|
|
18684
|
+
if (!store) return;
|
|
18685
|
+
setEip6963ProviderCount(store.getProviders().length);
|
|
18686
|
+
return store.subscribe((providers) => setEip6963ProviderCount(providers.length));
|
|
18687
|
+
}, []);
|
|
18688
|
+
React122.useEffect(() => {
|
|
18689
|
+
if (!enabled) {
|
|
18690
|
+
setWallet(null);
|
|
18691
|
+
setIsLoading(false);
|
|
18692
|
+
return;
|
|
18693
|
+
}
|
|
18694
|
+
let mounted = true;
|
|
18695
|
+
const detect = async () => {
|
|
18696
|
+
if (!mounted) return;
|
|
18697
|
+
setIsLoading(true);
|
|
18698
|
+
const detected = await detectConnectedBrowserWallet(chainType);
|
|
18699
|
+
if (!mounted) return;
|
|
18700
|
+
setWallet(detected);
|
|
18701
|
+
setIsLoading(false);
|
|
18702
|
+
};
|
|
18703
|
+
detect();
|
|
18704
|
+
const onChange = () => detect();
|
|
18705
|
+
const onDisc = () => {
|
|
18706
|
+
onDisconnectRef.current?.();
|
|
18707
|
+
detect();
|
|
18708
|
+
};
|
|
18709
|
+
const onEthAccounts = (accounts) => {
|
|
18710
|
+
if (Array.isArray(accounts) && accounts.length === 0) onDisconnectRef.current?.();
|
|
18711
|
+
detect();
|
|
18712
|
+
};
|
|
18713
|
+
const win = typeof window !== "undefined" ? window : void 0;
|
|
18714
|
+
const solanaProvider = win?.phantom?.solana || win?.solana;
|
|
18715
|
+
if (solanaProvider) {
|
|
18716
|
+
solanaProvider.on("connect", onChange);
|
|
18717
|
+
solanaProvider.on("disconnect", onDisc);
|
|
18718
|
+
solanaProvider.on("accountChanged", onChange);
|
|
18719
|
+
}
|
|
18720
|
+
const ethProviders = [];
|
|
18721
|
+
for (const { provider } of getEip6963Providers()) {
|
|
18722
|
+
const p = provider;
|
|
18723
|
+
if (p && !ethProviders.includes(p)) ethProviders.push(p);
|
|
18724
|
+
}
|
|
18725
|
+
if (win?.ethereum && !ethProviders.includes(win.ethereum)) ethProviders.push(win.ethereum);
|
|
18726
|
+
if (win?.phantom?.ethereum && !ethProviders.includes(win.phantom.ethereum)) {
|
|
18727
|
+
ethProviders.push(win.phantom.ethereum);
|
|
18728
|
+
}
|
|
18729
|
+
for (const p of ethProviders) {
|
|
18730
|
+
p.on("accountsChanged", onEthAccounts);
|
|
18731
|
+
p.on("chainChanged", onChange);
|
|
18732
|
+
}
|
|
18733
|
+
return () => {
|
|
18734
|
+
mounted = false;
|
|
18735
|
+
if (solanaProvider) {
|
|
18736
|
+
solanaProvider.off?.("connect", onChange);
|
|
18737
|
+
solanaProvider.off?.("disconnect", onDisc);
|
|
18738
|
+
solanaProvider.off?.("accountChanged", onChange);
|
|
18739
|
+
}
|
|
18740
|
+
for (const p of ethProviders) {
|
|
18741
|
+
const off = p.off?.bind(p) ?? p.removeListener?.bind(p);
|
|
18742
|
+
if (off) {
|
|
18743
|
+
off("accountsChanged", onEthAccounts);
|
|
18744
|
+
off("chainChanged", onChange);
|
|
18745
|
+
}
|
|
18746
|
+
}
|
|
18747
|
+
};
|
|
18748
|
+
}, [chainType, eip6963ProviderCount, enabled]);
|
|
18749
|
+
return { wallet, isLoading, setWallet };
|
|
18750
|
+
}
|
|
18562
18751
|
var SOLANA_DISCONNECT_TYPES = [
|
|
18563
18752
|
"phantom-solana",
|
|
18564
18753
|
"solflare",
|
|
@@ -18646,7 +18835,7 @@ function MetamaskIcon({
|
|
|
18646
18835
|
className,
|
|
18647
18836
|
variant = "color"
|
|
18648
18837
|
}) {
|
|
18649
|
-
const id =
|
|
18838
|
+
const id = React132.useId();
|
|
18650
18839
|
if (variant === "light" || variant === "dark") {
|
|
18651
18840
|
return /* @__PURE__ */ jsxs20(
|
|
18652
18841
|
"svg",
|
|
@@ -18771,7 +18960,7 @@ function PhantomIcon({
|
|
|
18771
18960
|
className,
|
|
18772
18961
|
variant = "color"
|
|
18773
18962
|
}) {
|
|
18774
|
-
const id =
|
|
18963
|
+
const id = React142.useId();
|
|
18775
18964
|
if (variant === "light") {
|
|
18776
18965
|
return /* @__PURE__ */ jsx24(
|
|
18777
18966
|
"svg",
|
|
@@ -18842,7 +19031,7 @@ function CoinbaseIcon({
|
|
|
18842
19031
|
className,
|
|
18843
19032
|
variant = "color"
|
|
18844
19033
|
}) {
|
|
18845
|
-
const id =
|
|
19034
|
+
const id = React152.useId();
|
|
18846
19035
|
if (variant === "light") {
|
|
18847
19036
|
return /* @__PURE__ */ jsxs222(
|
|
18848
19037
|
"svg",
|
|
@@ -18926,7 +19115,7 @@ function RabbyIcon({
|
|
|
18926
19115
|
className,
|
|
18927
19116
|
variant = "color"
|
|
18928
19117
|
}) {
|
|
18929
|
-
const id =
|
|
19118
|
+
const id = React162.useId();
|
|
18930
19119
|
if (variant === "light") {
|
|
18931
19120
|
return /* @__PURE__ */ jsxs23(
|
|
18932
19121
|
"svg",
|
|
@@ -19277,7 +19466,7 @@ function RainbowIcon({
|
|
|
19277
19466
|
className,
|
|
19278
19467
|
variant = "color"
|
|
19279
19468
|
}) {
|
|
19280
|
-
const id =
|
|
19469
|
+
const id = React172.useId();
|
|
19281
19470
|
if (variant === "light") {
|
|
19282
19471
|
return /* @__PURE__ */ jsxs24(
|
|
19283
19472
|
"svg",
|
|
@@ -19743,7 +19932,7 @@ function TrustIcon({
|
|
|
19743
19932
|
className,
|
|
19744
19933
|
variant = "color"
|
|
19745
19934
|
}) {
|
|
19746
|
-
const id =
|
|
19935
|
+
const id = React182.useId();
|
|
19747
19936
|
if (variant === "light") {
|
|
19748
19937
|
return /* @__PURE__ */ jsx28(
|
|
19749
19938
|
"svg",
|
|
@@ -19836,7 +20025,7 @@ function OkxIcon({
|
|
|
19836
20025
|
className,
|
|
19837
20026
|
variant = "color"
|
|
19838
20027
|
}) {
|
|
19839
|
-
const id =
|
|
20028
|
+
const id = React192.useId();
|
|
19840
20029
|
if (variant === "light") {
|
|
19841
20030
|
return /* @__PURE__ */ jsx29(
|
|
19842
20031
|
"svg",
|
|
@@ -19907,7 +20096,7 @@ function GlowIcon({
|
|
|
19907
20096
|
className,
|
|
19908
20097
|
variant = "color"
|
|
19909
20098
|
}) {
|
|
19910
|
-
const id =
|
|
20099
|
+
const id = React202.useId();
|
|
19911
20100
|
if (variant === "light") {
|
|
19912
20101
|
return /* @__PURE__ */ jsx30(
|
|
19913
20102
|
"svg",
|
|
@@ -20012,7 +20201,7 @@ function BackpackIcon({
|
|
|
20012
20201
|
className,
|
|
20013
20202
|
variant = "color"
|
|
20014
20203
|
}) {
|
|
20015
|
-
const id =
|
|
20204
|
+
const id = React212.useId();
|
|
20016
20205
|
if (variant === "light") {
|
|
20017
20206
|
return /* @__PURE__ */ jsx31(
|
|
20018
20207
|
"svg",
|
|
@@ -20089,7 +20278,7 @@ function SolflareIcon({
|
|
|
20089
20278
|
className,
|
|
20090
20279
|
variant = "color"
|
|
20091
20280
|
}) {
|
|
20092
|
-
const id =
|
|
20281
|
+
const id = React222.useId();
|
|
20093
20282
|
if (variant === "light") {
|
|
20094
20283
|
return /* @__PURE__ */ jsx322(
|
|
20095
20284
|
"svg",
|
|
@@ -20160,7 +20349,7 @@ function EthereumIcon({
|
|
|
20160
20349
|
className,
|
|
20161
20350
|
variant = "color"
|
|
20162
20351
|
}) {
|
|
20163
|
-
const id =
|
|
20352
|
+
const id = React232.useId();
|
|
20164
20353
|
if (variant === "light") {
|
|
20165
20354
|
return /* @__PURE__ */ jsxs30(
|
|
20166
20355
|
"svg",
|
|
@@ -20294,7 +20483,7 @@ function SolanaIcon({
|
|
|
20294
20483
|
className,
|
|
20295
20484
|
variant = "color"
|
|
20296
20485
|
}) {
|
|
20297
|
-
const id =
|
|
20486
|
+
const id = React242.useId();
|
|
20298
20487
|
if (variant === "light") {
|
|
20299
20488
|
return /* @__PURE__ */ jsx34(
|
|
20300
20489
|
"svg",
|
|
@@ -20543,44 +20732,6 @@ function truncateAddress3(address) {
|
|
|
20543
20732
|
if (address.length <= 10) return address;
|
|
20544
20733
|
return `${address.slice(0, 4)}...${address.slice(-4)}`;
|
|
20545
20734
|
}
|
|
20546
|
-
function identifyEthWallet(provider, _win, hint) {
|
|
20547
|
-
switch (hint) {
|
|
20548
|
-
case "metamask":
|
|
20549
|
-
return { type: "metamask", name: "MetaMask", icon: "metamask" };
|
|
20550
|
-
case "phantom":
|
|
20551
|
-
return { type: "phantom-ethereum", name: "Phantom", icon: "phantom" };
|
|
20552
|
-
case "coinbase":
|
|
20553
|
-
return { type: "coinbase", name: "Coinbase Wallet", icon: "coinbase" };
|
|
20554
|
-
case "okx":
|
|
20555
|
-
return { type: "okx", name: "OKX Wallet", icon: "okx" };
|
|
20556
|
-
case "rabby":
|
|
20557
|
-
return { type: "rabby", name: "Rabby", icon: "rabby" };
|
|
20558
|
-
case "trust":
|
|
20559
|
-
return { type: "trust", name: "Trust Wallet", icon: "trust" };
|
|
20560
|
-
case "rainbow":
|
|
20561
|
-
return { type: "rainbow", name: "Rainbow", icon: "rainbow" };
|
|
20562
|
-
}
|
|
20563
|
-
const anyProvider = provider;
|
|
20564
|
-
if (provider.isPhantom) {
|
|
20565
|
-
return { type: "phantom-ethereum", name: "Phantom", icon: "phantom" };
|
|
20566
|
-
}
|
|
20567
|
-
if (anyProvider.isCoinbaseWallet) {
|
|
20568
|
-
return { type: "coinbase", name: "Coinbase Wallet", icon: "coinbase" };
|
|
20569
|
-
}
|
|
20570
|
-
if (anyProvider.isRabby) {
|
|
20571
|
-
return { type: "rabby", name: "Rabby", icon: "rabby" };
|
|
20572
|
-
}
|
|
20573
|
-
if (anyProvider.isTrust) {
|
|
20574
|
-
return { type: "trust", name: "Trust Wallet", icon: "trust" };
|
|
20575
|
-
}
|
|
20576
|
-
if (anyProvider.isRainbow) {
|
|
20577
|
-
return { type: "rainbow", name: "Rainbow", icon: "rainbow" };
|
|
20578
|
-
}
|
|
20579
|
-
if (provider.isMetaMask && !provider.isPhantom) {
|
|
20580
|
-
return { type: "metamask", name: "MetaMask", icon: "metamask" };
|
|
20581
|
-
}
|
|
20582
|
-
return { type: "metamask", name: "Wallet", icon: "metamask" };
|
|
20583
|
-
}
|
|
20584
20735
|
function BrowserWalletButton({
|
|
20585
20736
|
onClick,
|
|
20586
20737
|
onConnectClick,
|
|
@@ -20591,30 +20742,19 @@ function BrowserWalletButton({
|
|
|
20591
20742
|
subtitle = i18n2.depositModal.browserWallet.subtitle
|
|
20592
20743
|
}) {
|
|
20593
20744
|
const { colors: colors2, fonts, components } = useTheme();
|
|
20594
|
-
const [isHovered, setIsHovered] =
|
|
20595
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
20596
|
-
const
|
|
20597
|
-
const [
|
|
20598
|
-
const [
|
|
20599
|
-
const [
|
|
20600
|
-
const [
|
|
20601
|
-
const
|
|
20602
|
-
const onDisconnectRef = React242.useRef(onDisconnect);
|
|
20745
|
+
const [isHovered, setIsHovered] = React252.useState(false);
|
|
20746
|
+
const [isTouchDevice, setIsTouchDevice] = React252.useState(false);
|
|
20747
|
+
const { wallet, isLoading, setWallet } = useDetectedBrowserWallet({ chainType, onDisconnect });
|
|
20748
|
+
const [isConnecting, setIsConnecting] = React252.useState(false);
|
|
20749
|
+
const [balanceText, setBalanceText] = React252.useState(null);
|
|
20750
|
+
const [isLoadingBalance, setIsLoadingBalance] = React252.useState(false);
|
|
20751
|
+
const [isDisconnecting, setIsDisconnecting] = React252.useState(false);
|
|
20752
|
+
const onDisconnectRef = React252.useRef(onDisconnect);
|
|
20603
20753
|
onDisconnectRef.current = onDisconnect;
|
|
20604
|
-
|
|
20754
|
+
React252.useEffect(() => {
|
|
20605
20755
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
20606
20756
|
}, []);
|
|
20607
|
-
|
|
20608
|
-
React242.useEffect(() => {
|
|
20609
|
-
const store = getEip6963Store();
|
|
20610
|
-
if (!store) return;
|
|
20611
|
-
setEip6963ProviderCount(store.getProviders().length);
|
|
20612
|
-
const unsubscribe = store.subscribe((providers) => {
|
|
20613
|
-
setEip6963ProviderCount(providers.length);
|
|
20614
|
-
});
|
|
20615
|
-
return unsubscribe;
|
|
20616
|
-
}, []);
|
|
20617
|
-
React242.useEffect(() => {
|
|
20757
|
+
React252.useEffect(() => {
|
|
20618
20758
|
if (!wallet || !publishableKey) {
|
|
20619
20759
|
setBalanceText(null);
|
|
20620
20760
|
return;
|
|
@@ -20655,206 +20795,6 @@ function BrowserWalletButton({
|
|
|
20655
20795
|
cancelled = true;
|
|
20656
20796
|
};
|
|
20657
20797
|
}, [wallet, publishableKey]);
|
|
20658
|
-
React242.useEffect(() => {
|
|
20659
|
-
let mounted = true;
|
|
20660
|
-
const detectWallet = async () => {
|
|
20661
|
-
if (!mounted) return;
|
|
20662
|
-
setIsLoading(true);
|
|
20663
|
-
try {
|
|
20664
|
-
const win = typeof window !== "undefined" ? window : null;
|
|
20665
|
-
if (!win) return;
|
|
20666
|
-
if (getUserDisconnectedWallet()) {
|
|
20667
|
-
if (mounted) {
|
|
20668
|
-
setWallet(null);
|
|
20669
|
-
setIsLoading(false);
|
|
20670
|
-
}
|
|
20671
|
-
return;
|
|
20672
|
-
}
|
|
20673
|
-
if (!chainType || chainType === "solana") {
|
|
20674
|
-
const anyWin = win;
|
|
20675
|
-
const trySilentSolana = async (provider, type, name, icon) => {
|
|
20676
|
-
if (!provider) return false;
|
|
20677
|
-
if (provider.isConnected && provider.publicKey) {
|
|
20678
|
-
if (mounted) {
|
|
20679
|
-
setWallet({
|
|
20680
|
-
type,
|
|
20681
|
-
name,
|
|
20682
|
-
address: provider.publicKey.toString(),
|
|
20683
|
-
icon
|
|
20684
|
-
});
|
|
20685
|
-
setIsLoading(false);
|
|
20686
|
-
}
|
|
20687
|
-
return true;
|
|
20688
|
-
}
|
|
20689
|
-
try {
|
|
20690
|
-
const resp = await provider.connect({ onlyIfTrusted: true });
|
|
20691
|
-
if (mounted && resp.publicKey) {
|
|
20692
|
-
setWallet({
|
|
20693
|
-
type,
|
|
20694
|
-
name,
|
|
20695
|
-
address: resp.publicKey.toString(),
|
|
20696
|
-
icon
|
|
20697
|
-
});
|
|
20698
|
-
setIsLoading(false);
|
|
20699
|
-
return true;
|
|
20700
|
-
}
|
|
20701
|
-
} catch {
|
|
20702
|
-
}
|
|
20703
|
-
return false;
|
|
20704
|
-
};
|
|
20705
|
-
if (await trySilentSolana(
|
|
20706
|
-
win.phantom?.solana,
|
|
20707
|
-
"phantom-solana",
|
|
20708
|
-
"Phantom",
|
|
20709
|
-
"phantom"
|
|
20710
|
-
))
|
|
20711
|
-
return;
|
|
20712
|
-
if (await trySilentSolana(
|
|
20713
|
-
anyWin.solflare,
|
|
20714
|
-
"solflare",
|
|
20715
|
-
"Solflare",
|
|
20716
|
-
"solflare"
|
|
20717
|
-
))
|
|
20718
|
-
return;
|
|
20719
|
-
if (await trySilentSolana(
|
|
20720
|
-
anyWin.backpack,
|
|
20721
|
-
"backpack",
|
|
20722
|
-
"Backpack",
|
|
20723
|
-
"backpack"
|
|
20724
|
-
))
|
|
20725
|
-
return;
|
|
20726
|
-
if (await trySilentSolana(
|
|
20727
|
-
anyWin.glow,
|
|
20728
|
-
"glow",
|
|
20729
|
-
"Glow",
|
|
20730
|
-
"glow"
|
|
20731
|
-
))
|
|
20732
|
-
return;
|
|
20733
|
-
}
|
|
20734
|
-
if (!chainType || chainType === "ethereum") {
|
|
20735
|
-
const anyWin = win;
|
|
20736
|
-
const allProviders = [];
|
|
20737
|
-
const eip6963 = getEip6963Providers();
|
|
20738
|
-
for (const { provider, walletId } of eip6963) {
|
|
20739
|
-
allProviders.push({
|
|
20740
|
-
provider,
|
|
20741
|
-
walletId: walletId === "unknown" ? "default" : walletId
|
|
20742
|
-
});
|
|
20743
|
-
}
|
|
20744
|
-
if (allProviders.length === 0) {
|
|
20745
|
-
if (win.phantom?.ethereum) {
|
|
20746
|
-
allProviders.push({
|
|
20747
|
-
provider: win.phantom.ethereum,
|
|
20748
|
-
walletId: "phantom"
|
|
20749
|
-
});
|
|
20750
|
-
}
|
|
20751
|
-
if (anyWin.okxwallet) {
|
|
20752
|
-
allProviders.push({
|
|
20753
|
-
provider: anyWin.okxwallet,
|
|
20754
|
-
walletId: "okx"
|
|
20755
|
-
});
|
|
20756
|
-
}
|
|
20757
|
-
if (anyWin.coinbaseWalletExtension) {
|
|
20758
|
-
allProviders.push({
|
|
20759
|
-
provider: anyWin.coinbaseWalletExtension,
|
|
20760
|
-
walletId: "coinbase"
|
|
20761
|
-
});
|
|
20762
|
-
}
|
|
20763
|
-
if (win.ethereum) {
|
|
20764
|
-
const isDuplicate = allProviders.some(
|
|
20765
|
-
(p) => p.provider === win.ethereum
|
|
20766
|
-
);
|
|
20767
|
-
if (!isDuplicate) {
|
|
20768
|
-
allProviders.push({
|
|
20769
|
-
provider: win.ethereum,
|
|
20770
|
-
walletId: "default"
|
|
20771
|
-
});
|
|
20772
|
-
}
|
|
20773
|
-
}
|
|
20774
|
-
}
|
|
20775
|
-
for (const { provider, walletId } of allProviders) {
|
|
20776
|
-
if (!provider) continue;
|
|
20777
|
-
try {
|
|
20778
|
-
const accounts = await provider.request({
|
|
20779
|
-
method: "eth_accounts"
|
|
20780
|
-
});
|
|
20781
|
-
if (!accounts || accounts.length === 0) continue;
|
|
20782
|
-
const address = accounts[0];
|
|
20783
|
-
const resolved = identifyEthWallet(provider, anyWin, walletId);
|
|
20784
|
-
if (mounted) {
|
|
20785
|
-
setWallet({ ...resolved, address });
|
|
20786
|
-
setIsLoading(false);
|
|
20787
|
-
}
|
|
20788
|
-
return;
|
|
20789
|
-
} catch {
|
|
20790
|
-
}
|
|
20791
|
-
}
|
|
20792
|
-
}
|
|
20793
|
-
if (mounted) {
|
|
20794
|
-
setWallet(null);
|
|
20795
|
-
setIsLoading(false);
|
|
20796
|
-
}
|
|
20797
|
-
} catch (error) {
|
|
20798
|
-
console.error("[BrowserWalletButton] Error detecting wallet:", error);
|
|
20799
|
-
if (mounted) {
|
|
20800
|
-
setWallet(null);
|
|
20801
|
-
setIsLoading(false);
|
|
20802
|
-
}
|
|
20803
|
-
}
|
|
20804
|
-
};
|
|
20805
|
-
detectWallet();
|
|
20806
|
-
const handleAccountsChanged = () => {
|
|
20807
|
-
detectWallet();
|
|
20808
|
-
};
|
|
20809
|
-
const handleDisconnect = () => {
|
|
20810
|
-
onDisconnectRef.current?.();
|
|
20811
|
-
detectWallet();
|
|
20812
|
-
};
|
|
20813
|
-
const handleEthAccountsChanged = (accounts) => {
|
|
20814
|
-
if (Array.isArray(accounts) && accounts.length === 0) {
|
|
20815
|
-
onDisconnectRef.current?.();
|
|
20816
|
-
}
|
|
20817
|
-
detectWallet();
|
|
20818
|
-
};
|
|
20819
|
-
const solanaProvider = window.phantom?.solana || window.solana;
|
|
20820
|
-
if (solanaProvider) {
|
|
20821
|
-
solanaProvider.on("connect", handleAccountsChanged);
|
|
20822
|
-
solanaProvider.on("disconnect", handleDisconnect);
|
|
20823
|
-
solanaProvider.on("accountChanged", handleAccountsChanged);
|
|
20824
|
-
}
|
|
20825
|
-
const ethProviders = [];
|
|
20826
|
-
for (const { provider } of getEip6963Providers()) {
|
|
20827
|
-
const p = provider;
|
|
20828
|
-
if (p && !ethProviders.includes(p)) {
|
|
20829
|
-
ethProviders.push(p);
|
|
20830
|
-
}
|
|
20831
|
-
}
|
|
20832
|
-
if (window.ethereum && !ethProviders.includes(window.ethereum)) {
|
|
20833
|
-
ethProviders.push(window.ethereum);
|
|
20834
|
-
}
|
|
20835
|
-
if (window.phantom?.ethereum && !ethProviders.includes(window.phantom.ethereum)) {
|
|
20836
|
-
ethProviders.push(window.phantom.ethereum);
|
|
20837
|
-
}
|
|
20838
|
-
for (const provider of ethProviders) {
|
|
20839
|
-
provider.on("accountsChanged", handleEthAccountsChanged);
|
|
20840
|
-
provider.on("chainChanged", handleAccountsChanged);
|
|
20841
|
-
}
|
|
20842
|
-
return () => {
|
|
20843
|
-
mounted = false;
|
|
20844
|
-
if (solanaProvider) {
|
|
20845
|
-
solanaProvider.off("connect", handleAccountsChanged);
|
|
20846
|
-
solanaProvider.off("disconnect", handleDisconnect);
|
|
20847
|
-
solanaProvider.off("accountChanged", handleAccountsChanged);
|
|
20848
|
-
}
|
|
20849
|
-
for (const provider of ethProviders) {
|
|
20850
|
-
const off = provider.off?.bind(provider) ?? provider.removeListener?.bind(provider);
|
|
20851
|
-
if (off) {
|
|
20852
|
-
off("accountsChanged", handleEthAccountsChanged);
|
|
20853
|
-
off("chainChanged", handleAccountsChanged);
|
|
20854
|
-
}
|
|
20855
|
-
}
|
|
20856
|
-
};
|
|
20857
|
-
}, [chainType, eip6963ProviderCount]);
|
|
20858
20798
|
const handleConnect = async () => {
|
|
20859
20799
|
if (wallet) {
|
|
20860
20800
|
onClick(wallet);
|
|
@@ -20938,7 +20878,7 @@ function BrowserWalletButton({
|
|
|
20938
20878
|
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
20939
20879
|
};
|
|
20940
20880
|
const sortedWallets = featuredWallets ? [...featuredWallets].sort((a, b) => a.position - b.position) : [];
|
|
20941
|
-
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ?
|
|
20881
|
+
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React252.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
|
|
20942
20882
|
size: 36,
|
|
20943
20883
|
className: "uf-rounded-lg",
|
|
20944
20884
|
variant: "color"
|
|
@@ -21200,6 +21140,7 @@ function CoinbaseConnect({
|
|
|
21200
21140
|
onBack: parentOnBack,
|
|
21201
21141
|
onDisconnect,
|
|
21202
21142
|
skipToHoldings,
|
|
21143
|
+
canGoBack = true,
|
|
21203
21144
|
onExecutionsChange
|
|
21204
21145
|
}) {
|
|
21205
21146
|
const { colors: colors2, fonts, components } = useTheme();
|
|
@@ -21225,25 +21166,25 @@ function CoinbaseConnect({
|
|
|
21225
21166
|
const appName = projectConfig?.project_name ?? "Unifold";
|
|
21226
21167
|
const t12 = i18n2.connectExchange;
|
|
21227
21168
|
const initialView = skipToHoldings && getStoredIntegrationToken(IntegrationProvider.COINBASE) ? "holdings" : "select_exchange";
|
|
21228
|
-
const [view, setView] =
|
|
21229
|
-
const [prevView, setPrevView] =
|
|
21230
|
-
const [isTransitioning, setIsTransitioning] =
|
|
21231
|
-
const [exchanges, setExchanges] =
|
|
21232
|
-
const [exchangesLoading, setExchangesLoading] =
|
|
21233
|
-
const [selectedExchange, setSelectedExchange] =
|
|
21234
|
-
const [accessToken, setAccessToken] =
|
|
21235
|
-
const [holdings, setHoldings] =
|
|
21236
|
-
const [selectedHolding, setSelectedHolding] =
|
|
21237
|
-
const [selectedAsset, setSelectedAsset] =
|
|
21238
|
-
const [sendAmount, setSendAmount] =
|
|
21239
|
-
const [transferIntent, setTransferIntent] =
|
|
21240
|
-
const [mfaCode, setMfaCode] =
|
|
21241
|
-
const [mfaError, setMfaError] =
|
|
21242
|
-
const [errorMessage, setErrorMessage] =
|
|
21243
|
-
const [isLoading, setIsLoading] =
|
|
21244
|
-
const [confirmResult, setConfirmResult] =
|
|
21245
|
-
const [showTransferDetails, setShowTransferDetails] =
|
|
21246
|
-
const [transferDepositWalletId, setTransferDepositWalletId] =
|
|
21169
|
+
const [view, setView] = useState222(initialView);
|
|
21170
|
+
const [prevView, setPrevView] = useState222(initialView);
|
|
21171
|
+
const [isTransitioning, setIsTransitioning] = useState222(false);
|
|
21172
|
+
const [exchanges, setExchanges] = useState222([]);
|
|
21173
|
+
const [exchangesLoading, setExchangesLoading] = useState222(true);
|
|
21174
|
+
const [selectedExchange, setSelectedExchange] = useState222(null);
|
|
21175
|
+
const [accessToken, setAccessToken] = useState222(null);
|
|
21176
|
+
const [holdings, setHoldings] = useState222([]);
|
|
21177
|
+
const [selectedHolding, setSelectedHolding] = useState222(null);
|
|
21178
|
+
const [selectedAsset, setSelectedAsset] = useState222(null);
|
|
21179
|
+
const [sendAmount, setSendAmount] = useState222("");
|
|
21180
|
+
const [transferIntent, setTransferIntent] = useState222(null);
|
|
21181
|
+
const [mfaCode, setMfaCode] = useState222("");
|
|
21182
|
+
const [mfaError, setMfaError] = useState222(false);
|
|
21183
|
+
const [errorMessage, setErrorMessage] = useState222("");
|
|
21184
|
+
const [isLoading, setIsLoading] = useState222(initialView === "holdings");
|
|
21185
|
+
const [confirmResult, setConfirmResult] = useState222(null);
|
|
21186
|
+
const [showTransferDetails, setShowTransferDetails] = useState222(false);
|
|
21187
|
+
const [transferDepositWalletId, setTransferDepositWalletId] = useState222(void 0);
|
|
21247
21188
|
const exchangeSupportedCurrencies = useMemo42(() => {
|
|
21248
21189
|
const set = /* @__PURE__ */ new Set();
|
|
21249
21190
|
selectedExchange?.supported_currencies.forEach((c) => set.add(c.toLowerCase()));
|
|
@@ -21298,12 +21239,12 @@ function CoinbaseConnect({
|
|
|
21298
21239
|
} : void 0,
|
|
21299
21240
|
onDepositError: onTransferError
|
|
21300
21241
|
});
|
|
21301
|
-
|
|
21242
|
+
useEffect172(() => {
|
|
21302
21243
|
onExecutionsChange?.(depositExecutions);
|
|
21303
21244
|
}, [depositExecutions, onExecutionsChange]);
|
|
21304
|
-
const pollRef =
|
|
21305
|
-
const popupRef =
|
|
21306
|
-
const viewRef =
|
|
21245
|
+
const pollRef = useRef62(null);
|
|
21246
|
+
const popupRef = useRef62(null);
|
|
21247
|
+
const viewRef = useRef62(initialView);
|
|
21307
21248
|
const transitionTo = useCallback22((nextView) => {
|
|
21308
21249
|
if (nextView === viewRef.current) return;
|
|
21309
21250
|
setIsTransitioning(true);
|
|
@@ -21333,7 +21274,7 @@ function CoinbaseConnect({
|
|
|
21333
21274
|
},
|
|
21334
21275
|
[publishableKey]
|
|
21335
21276
|
);
|
|
21336
|
-
|
|
21277
|
+
useEffect172(() => {
|
|
21337
21278
|
getIntegrationExchanges(publishableKey).then((res) => {
|
|
21338
21279
|
setExchanges(res.data);
|
|
21339
21280
|
if (!selectedExchange) {
|
|
@@ -21391,7 +21332,7 @@ function CoinbaseConnect({
|
|
|
21391
21332
|
},
|
|
21392
21333
|
[publishableKey, transitionTo, tryRefreshToken]
|
|
21393
21334
|
);
|
|
21394
|
-
|
|
21335
|
+
useEffect172(() => {
|
|
21395
21336
|
return () => {
|
|
21396
21337
|
if (pollRef.current) clearInterval(pollRef.current);
|
|
21397
21338
|
};
|
|
@@ -21587,6 +21528,16 @@ function CoinbaseConnect({
|
|
|
21587
21528
|
setIsLoading(false);
|
|
21588
21529
|
}
|
|
21589
21530
|
};
|
|
21531
|
+
const handleDisconnect = () => {
|
|
21532
|
+
onDisconnect?.();
|
|
21533
|
+
if (!canGoBack) {
|
|
21534
|
+
setAccessToken(null);
|
|
21535
|
+
setHoldings([]);
|
|
21536
|
+
setSelectedHolding(null);
|
|
21537
|
+
setSelectedAsset(null);
|
|
21538
|
+
transitionTo("select_exchange");
|
|
21539
|
+
}
|
|
21540
|
+
};
|
|
21590
21541
|
const handleBack = () => {
|
|
21591
21542
|
switch (view) {
|
|
21592
21543
|
case "select_exchange":
|
|
@@ -21647,7 +21598,7 @@ function CoinbaseConnect({
|
|
|
21647
21598
|
DepositHeader,
|
|
21648
21599
|
{
|
|
21649
21600
|
title: t12.title,
|
|
21650
|
-
showBack:
|
|
21601
|
+
showBack: canGoBack,
|
|
21651
21602
|
onBack: handleBack,
|
|
21652
21603
|
onClose
|
|
21653
21604
|
}
|
|
@@ -21660,7 +21611,7 @@ function CoinbaseConnect({
|
|
|
21660
21611
|
DepositHeader,
|
|
21661
21612
|
{
|
|
21662
21613
|
title: t12.title,
|
|
21663
|
-
showBack:
|
|
21614
|
+
showBack: canGoBack,
|
|
21664
21615
|
onBack: handleBack,
|
|
21665
21616
|
onClose
|
|
21666
21617
|
}
|
|
@@ -22372,7 +22323,7 @@ function CoinbaseConnect({
|
|
|
22372
22323
|
borderRadius: components.button.borderRadius,
|
|
22373
22324
|
fontFamily: fonts.medium
|
|
22374
22325
|
},
|
|
22375
|
-
onClick:
|
|
22326
|
+
onClick: handleDisconnect,
|
|
22376
22327
|
children: t12.disconnect
|
|
22377
22328
|
}
|
|
22378
22329
|
)
|
|
@@ -23159,7 +23110,7 @@ function ThemeStyleInjector({
|
|
|
23159
23110
|
className
|
|
23160
23111
|
}) {
|
|
23161
23112
|
const { colors: colors2, fonts, mode } = useTheme();
|
|
23162
|
-
const cssVars =
|
|
23113
|
+
const cssVars = React272.useMemo(() => {
|
|
23163
23114
|
const hexToHSL = (hex) => {
|
|
23164
23115
|
hex = hex.replace("#", "");
|
|
23165
23116
|
const r2 = parseInt(hex.slice(0, 2), 16) / 255;
|
|
@@ -23219,7 +23170,7 @@ function ThemeStyleInjector({
|
|
|
23219
23170
|
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
23220
23171
|
};
|
|
23221
23172
|
}, [colors2, fonts.regular]);
|
|
23222
|
-
|
|
23173
|
+
React272.useEffect(() => {
|
|
23223
23174
|
if (typeof document === "undefined") return;
|
|
23224
23175
|
if (fonts.regular) {
|
|
23225
23176
|
document.documentElement.style.setProperty(
|
|
@@ -23301,9 +23252,9 @@ function DepositsModal({
|
|
|
23301
23252
|
themeClass = ""
|
|
23302
23253
|
}) {
|
|
23303
23254
|
const { colors: colors2, fonts, components } = useTheme();
|
|
23304
|
-
const [allExecutions, setAllExecutions] =
|
|
23305
|
-
const [selectedExecution, setSelectedExecution] =
|
|
23306
|
-
|
|
23255
|
+
const [allExecutions, setAllExecutions] = useState232(sessionExecutions);
|
|
23256
|
+
const [selectedExecution, setSelectedExecution] = useState232(null);
|
|
23257
|
+
useEffect192(() => {
|
|
23307
23258
|
if (!open || !userId) return;
|
|
23308
23259
|
const fetchExecutions = async () => {
|
|
23309
23260
|
try {
|
|
@@ -23325,7 +23276,7 @@ function DepositsModal({
|
|
|
23325
23276
|
clearInterval(pollInterval);
|
|
23326
23277
|
};
|
|
23327
23278
|
}, [open, userId, publishableKey, sessionExecutions]);
|
|
23328
|
-
|
|
23279
|
+
useEffect192(() => {
|
|
23329
23280
|
if (!open) {
|
|
23330
23281
|
setSelectedExecution(null);
|
|
23331
23282
|
}
|
|
@@ -23456,10 +23407,10 @@ function TokenSelectorSheet({
|
|
|
23456
23407
|
}) {
|
|
23457
23408
|
const { themeClass, colors: colors2, fonts, components } = useTheme();
|
|
23458
23409
|
const isDarkMode = themeClass.includes("uf-dark");
|
|
23459
|
-
const [searchQuery, setSearchQuery] =
|
|
23460
|
-
const [recentTokens, setRecentTokens] =
|
|
23461
|
-
const [hoveredTokenKey, setHoveredTokenKey] =
|
|
23462
|
-
|
|
23410
|
+
const [searchQuery, setSearchQuery] = useState242("");
|
|
23411
|
+
const [recentTokens, setRecentTokens] = useState242([]);
|
|
23412
|
+
const [hoveredTokenKey, setHoveredTokenKey] = useState242(null);
|
|
23413
|
+
useEffect202(() => {
|
|
23463
23414
|
setRecentTokens(getRecentTokens());
|
|
23464
23415
|
}, []);
|
|
23465
23416
|
const allOptions = useMemo62(() => {
|
|
@@ -23943,11 +23894,11 @@ function useDefaultToken({
|
|
|
23943
23894
|
defaultTokenAddress,
|
|
23944
23895
|
defaultSymbol
|
|
23945
23896
|
}) {
|
|
23946
|
-
const [token, setToken] =
|
|
23947
|
-
const [chain, setChain] =
|
|
23948
|
-
const [initialSelectionDone, setInitialSelectionDone] =
|
|
23949
|
-
const appliedDefaultsRef =
|
|
23950
|
-
|
|
23897
|
+
const [token, setToken] = useState252(null);
|
|
23898
|
+
const [chain, setChain] = useState252(null);
|
|
23899
|
+
const [initialSelectionDone, setInitialSelectionDone] = useState252(false);
|
|
23900
|
+
const appliedDefaultsRef = useRef72("");
|
|
23901
|
+
useEffect212(() => {
|
|
23951
23902
|
if (!tokens.length) return;
|
|
23952
23903
|
const defaultsKey = `${defaultTokenAddress ?? ""}|${defaultSymbol ?? ""}|${defaultChainType ?? ""}|${defaultChainId ?? ""}`;
|
|
23953
23904
|
const defaultsChanged = appliedDefaultsRef.current !== defaultsKey;
|
|
@@ -23973,7 +23924,7 @@ function useDefaultToken({
|
|
|
23973
23924
|
defaultChainId,
|
|
23974
23925
|
initialSelectionDone
|
|
23975
23926
|
]);
|
|
23976
|
-
|
|
23927
|
+
useEffect212(() => {
|
|
23977
23928
|
if (!tokens.length || !token) return;
|
|
23978
23929
|
const currentToken = tokens.find((t12) => t12.symbol === token);
|
|
23979
23930
|
if (!currentToken || currentToken.chains.length === 0) return;
|
|
@@ -24168,7 +24119,7 @@ function GlossaryModal({
|
|
|
24168
24119
|
) });
|
|
24169
24120
|
}
|
|
24170
24121
|
function useCopyAddress() {
|
|
24171
|
-
const [copied, setCopied] =
|
|
24122
|
+
const [copied, setCopied] = useState262(false);
|
|
24172
24123
|
const handleCopy = (address) => {
|
|
24173
24124
|
if (!address) return;
|
|
24174
24125
|
navigator.clipboard.writeText(address);
|
|
@@ -24178,14 +24129,14 @@ function useCopyAddress() {
|
|
|
24178
24129
|
return { copied, handleCopy };
|
|
24179
24130
|
}
|
|
24180
24131
|
var TooltipProvider2 = Provider;
|
|
24181
|
-
var TooltipContext =
|
|
24132
|
+
var TooltipContext = React282.createContext({
|
|
24182
24133
|
open: false,
|
|
24183
24134
|
onOpenChange: () => {
|
|
24184
24135
|
}
|
|
24185
24136
|
});
|
|
24186
|
-
var TooltipTrigger2 =
|
|
24187
|
-
const { open, onOpenChange } =
|
|
24188
|
-
const handleClick =
|
|
24137
|
+
var TooltipTrigger2 = React282.forwardRef(({ onClick, ...props }, ref) => {
|
|
24138
|
+
const { open, onOpenChange } = React282.useContext(TooltipContext);
|
|
24139
|
+
const handleClick = React282.useCallback(
|
|
24189
24140
|
(e) => {
|
|
24190
24141
|
onOpenChange(!open);
|
|
24191
24142
|
onClick?.(e);
|
|
@@ -24195,7 +24146,7 @@ var TooltipTrigger2 = React272.forwardRef(({ onClick, ...props }, ref) => {
|
|
|
24195
24146
|
return /* @__PURE__ */ jsx44(Trigger, { ref, onClick: handleClick, ...props });
|
|
24196
24147
|
});
|
|
24197
24148
|
TooltipTrigger2.displayName = Trigger.displayName;
|
|
24198
|
-
var TooltipContent2 =
|
|
24149
|
+
var TooltipContent2 = React282.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
|
|
24199
24150
|
const { themeClass, colors: colors2 } = useTheme();
|
|
24200
24151
|
return /* @__PURE__ */ jsx44(Portal3, { children: /* @__PURE__ */ jsx44(
|
|
24201
24152
|
Content22,
|
|
@@ -24318,12 +24269,12 @@ function TransferCryptoSingleInput({
|
|
|
24318
24269
|
}) {
|
|
24319
24270
|
const { themeClass, colors: colors2, fonts, components } = useTheme();
|
|
24320
24271
|
const isDarkMode = themeClass.includes("uf-dark");
|
|
24321
|
-
const [copied, setCopied] =
|
|
24272
|
+
const [copied, setCopied] = useState28(false);
|
|
24322
24273
|
const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
|
|
24323
|
-
const [glossaryOpen, setGlossaryOpen] =
|
|
24324
|
-
const [detailsExpanded, setDetailsExpanded] =
|
|
24325
|
-
const [depositsModalOpen, setDepositsModalOpen] =
|
|
24326
|
-
const [tokenSelectorOpen, setTokenSelectorOpen] =
|
|
24274
|
+
const [glossaryOpen, setGlossaryOpen] = useState28(false);
|
|
24275
|
+
const [detailsExpanded, setDetailsExpanded] = useState28(false);
|
|
24276
|
+
const [depositsModalOpen, setDepositsModalOpen] = useState28(false);
|
|
24277
|
+
const [tokenSelectorOpen, setTokenSelectorOpen] = useState28(false);
|
|
24327
24278
|
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
|
|
24328
24279
|
destination_token_address: destinationTokenAddress,
|
|
24329
24280
|
destination_chain_id: destinationChainId,
|
|
@@ -24396,7 +24347,7 @@ function TransferCryptoSingleInput({
|
|
|
24396
24347
|
publishableKey,
|
|
24397
24348
|
enabled: !!depositAddress && !!recipientAddress
|
|
24398
24349
|
});
|
|
24399
|
-
|
|
24350
|
+
useEffect222(() => {
|
|
24400
24351
|
if (!onSourceTokenChange || !token || !chain || !initialSelectionDone) return;
|
|
24401
24352
|
const { chainType, chainId } = parseChainKey(chain);
|
|
24402
24353
|
const matchedToken = supportedTokens.find((t12) => t12.symbol === token);
|
|
@@ -24413,7 +24364,7 @@ function TransferCryptoSingleInput({
|
|
|
24413
24364
|
isStablecoin: matchedToken?.is_stablecoin ?? false
|
|
24414
24365
|
});
|
|
24415
24366
|
}, [token, chain, initialSelectionDone, onSourceTokenChange, supportedTokens]);
|
|
24416
|
-
|
|
24367
|
+
useEffect222(() => {
|
|
24417
24368
|
if (onExecutionsChange) {
|
|
24418
24369
|
onExecutionsChange(depositExecutions);
|
|
24419
24370
|
}
|
|
@@ -24800,7 +24751,7 @@ function TransferCryptoSingleInput({
|
|
|
24800
24751
|
}
|
|
24801
24752
|
var Select2 = Root23;
|
|
24802
24753
|
var SelectValue2 = Value;
|
|
24803
|
-
var SelectTrigger2 =
|
|
24754
|
+
var SelectTrigger2 = React292.forwardRef(({ className, style, children, ...props }, ref) => {
|
|
24804
24755
|
const { components } = useTheme();
|
|
24805
24756
|
return /* @__PURE__ */ jsxs422(
|
|
24806
24757
|
Trigger2,
|
|
@@ -24824,7 +24775,7 @@ var SelectTrigger2 = React282.forwardRef(({ className, style, children, ...props
|
|
|
24824
24775
|
);
|
|
24825
24776
|
});
|
|
24826
24777
|
SelectTrigger2.displayName = Trigger2.displayName;
|
|
24827
|
-
var SelectScrollUpButton2 =
|
|
24778
|
+
var SelectScrollUpButton2 = React292.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx47(
|
|
24828
24779
|
ScrollUpButton,
|
|
24829
24780
|
{
|
|
24830
24781
|
ref,
|
|
@@ -24837,7 +24788,7 @@ var SelectScrollUpButton2 = React282.forwardRef(({ className, ...props }, ref) =
|
|
|
24837
24788
|
}
|
|
24838
24789
|
));
|
|
24839
24790
|
SelectScrollUpButton2.displayName = ScrollUpButton.displayName;
|
|
24840
|
-
var SelectScrollDownButton2 =
|
|
24791
|
+
var SelectScrollDownButton2 = React292.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx47(
|
|
24841
24792
|
ScrollDownButton,
|
|
24842
24793
|
{
|
|
24843
24794
|
ref,
|
|
@@ -24850,7 +24801,7 @@ var SelectScrollDownButton2 = React282.forwardRef(({ className, ...props }, ref)
|
|
|
24850
24801
|
}
|
|
24851
24802
|
));
|
|
24852
24803
|
SelectScrollDownButton2.displayName = ScrollDownButton.displayName;
|
|
24853
|
-
var SelectContent2 =
|
|
24804
|
+
var SelectContent2 = React292.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
|
|
24854
24805
|
const { themeClass, colors: colors2, components } = useTheme();
|
|
24855
24806
|
return /* @__PURE__ */ jsx47(Portal4, { children: /* @__PURE__ */ jsxs422(
|
|
24856
24807
|
Content23,
|
|
@@ -24888,7 +24839,7 @@ var SelectContent2 = React282.forwardRef(({ className, style, children, position
|
|
|
24888
24839
|
) });
|
|
24889
24840
|
});
|
|
24890
24841
|
SelectContent2.displayName = Content23.displayName;
|
|
24891
|
-
var SelectLabel2 =
|
|
24842
|
+
var SelectLabel2 = React292.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx47(
|
|
24892
24843
|
Label,
|
|
24893
24844
|
{
|
|
24894
24845
|
ref,
|
|
@@ -24900,7 +24851,7 @@ var SelectLabel2 = React282.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
24900
24851
|
}
|
|
24901
24852
|
));
|
|
24902
24853
|
SelectLabel2.displayName = Label.displayName;
|
|
24903
|
-
var SelectItem2 =
|
|
24854
|
+
var SelectItem2 = React292.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs422(
|
|
24904
24855
|
Item,
|
|
24905
24856
|
{
|
|
24906
24857
|
ref,
|
|
@@ -24916,7 +24867,7 @@ var SelectItem2 = React282.forwardRef(({ className, children, ...props }, ref) =
|
|
|
24916
24867
|
}
|
|
24917
24868
|
));
|
|
24918
24869
|
SelectItem2.displayName = Item.displayName;
|
|
24919
|
-
var SelectSeparator2 =
|
|
24870
|
+
var SelectSeparator2 = React292.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx47(
|
|
24920
24871
|
Separator,
|
|
24921
24872
|
{
|
|
24922
24873
|
ref,
|
|
@@ -24952,11 +24903,11 @@ function TransferCryptoDoubleInput({
|
|
|
24952
24903
|
}) {
|
|
24953
24904
|
const { themeClass, colors: colors2, fonts, components } = useTheme();
|
|
24954
24905
|
const isDarkMode = themeClass.includes("uf-dark");
|
|
24955
|
-
const [copied, setCopied] =
|
|
24906
|
+
const [copied, setCopied] = useState29(false);
|
|
24956
24907
|
const { copied: copiedRecipient, handleCopy: handleCopyRecipientAddress } = useCopyAddress();
|
|
24957
|
-
const [glossaryOpen, setGlossaryOpen] =
|
|
24958
|
-
const [detailsExpanded, setDetailsExpanded] =
|
|
24959
|
-
const [depositsModalOpen, setDepositsModalOpen] =
|
|
24908
|
+
const [glossaryOpen, setGlossaryOpen] = useState29(false);
|
|
24909
|
+
const [detailsExpanded, setDetailsExpanded] = useState29(false);
|
|
24910
|
+
const [depositsModalOpen, setDepositsModalOpen] = useState29(false);
|
|
24960
24911
|
const { data: tokensResponse, isLoading: tokensLoading } = useSupportedDepositTokens(publishableKey, {
|
|
24961
24912
|
destination_token_address: destinationTokenAddress,
|
|
24962
24913
|
destination_chain_id: destinationChainId,
|
|
@@ -25027,7 +24978,7 @@ function TransferCryptoDoubleInput({
|
|
|
25027
24978
|
publishableKey,
|
|
25028
24979
|
enabled: !!depositAddress && !!recipientAddress
|
|
25029
24980
|
});
|
|
25030
|
-
|
|
24981
|
+
useEffect232(() => {
|
|
25031
24982
|
if (onExecutionsChange) {
|
|
25032
24983
|
onExecutionsChange(depositExecutions);
|
|
25033
24984
|
}
|
|
@@ -26301,13 +26252,13 @@ function ConfirmingView({
|
|
|
26301
26252
|
amountReceivedUsdAtSubmission
|
|
26302
26253
|
}) {
|
|
26303
26254
|
const { colors: colors2, fonts, components } = useTheme();
|
|
26304
|
-
const [fallbackSettled, setFallbackSettled] =
|
|
26255
|
+
const [fallbackSettled, setFallbackSettled] = useState302(false);
|
|
26305
26256
|
const hasExecution = executions.length > 0;
|
|
26306
26257
|
const isCheckoutMode = paymentIntentStatus != null;
|
|
26307
26258
|
const isPaymentComplete = paymentIntentStatus === "succeeded";
|
|
26308
26259
|
const amountChanged = amountReceivedUsdAtSubmission != null && amountReceivedUsd != null && amountReceivedUsd !== amountReceivedUsdAtSubmission;
|
|
26309
26260
|
const piSettled = !isCheckoutMode || isPaymentComplete || amountChanged || fallbackSettled;
|
|
26310
|
-
|
|
26261
|
+
useEffect242(() => {
|
|
26311
26262
|
if (!hasExecution || piSettled) return;
|
|
26312
26263
|
const timeout = setTimeout(() => setFallbackSettled(true), SETTLE_FALLBACK_MS);
|
|
26313
26264
|
return () => clearTimeout(timeout);
|
|
@@ -26580,22 +26531,27 @@ function WalletConnect({
|
|
|
26580
26531
|
productType,
|
|
26581
26532
|
onBack: parentOnBack,
|
|
26582
26533
|
onClose,
|
|
26534
|
+
canGoBack = true,
|
|
26535
|
+
depositWalletsLoading = false,
|
|
26583
26536
|
onExecutionsChange
|
|
26584
26537
|
}) {
|
|
26585
26538
|
const { colors: colors2, fonts, components } = useTheme();
|
|
26586
|
-
const walletProvidedAtMount =
|
|
26587
|
-
const [activeWalletInfo, setActiveWalletInfo] =
|
|
26588
|
-
const [activeDepositWallet, setActiveDepositWallet] =
|
|
26539
|
+
const walletProvidedAtMount = React302.useRef(!!initialWalletInfo && !!initialDepositWallet);
|
|
26540
|
+
const [activeWalletInfo, setActiveWalletInfo] = React302.useState(initialWalletInfo ?? null);
|
|
26541
|
+
const [activeDepositWallet, setActiveDepositWallet] = React302.useState(initialDepositWallet ?? null);
|
|
26589
26542
|
const initialView = initialWalletInfo && initialDepositWallet ? "select_token" : "select_wallet";
|
|
26590
|
-
const [view, setView] =
|
|
26591
|
-
const [isTransitioning, setIsTransitioning] =
|
|
26592
|
-
const viewRef =
|
|
26593
|
-
const
|
|
26594
|
-
const
|
|
26595
|
-
const [
|
|
26596
|
-
const [
|
|
26597
|
-
const [
|
|
26598
|
-
|
|
26543
|
+
const [view, setView] = React302.useState(initialView);
|
|
26544
|
+
const [isTransitioning, setIsTransitioning] = React302.useState(false);
|
|
26545
|
+
const viewRef = React302.useRef(initialView);
|
|
26546
|
+
const standalone = !canGoBack && !walletProvidedAtMount.current;
|
|
26547
|
+
const { wallet: detectedWallet, isLoading: detectingWallet } = useDetectedBrowserWallet({ enabled: standalone });
|
|
26548
|
+
const [autoResolved, setAutoResolved] = React302.useState(false);
|
|
26549
|
+
const [selectedWalletDef, setSelectedWalletDef] = React302.useState(null);
|
|
26550
|
+
const [connectingNetwork, setConnectingNetwork] = React302.useState(null);
|
|
26551
|
+
const [walletError, setWalletError] = React302.useState(null);
|
|
26552
|
+
const [isWalletConnecting, setIsWalletConnecting] = React302.useState(false);
|
|
26553
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React302.useState(0);
|
|
26554
|
+
React302.useEffect(() => {
|
|
26599
26555
|
const store = getEip6963Store();
|
|
26600
26556
|
if (!store) return;
|
|
26601
26557
|
setEip6963ProviderCount(store.getProviders().length);
|
|
@@ -26603,20 +26559,44 @@ function WalletConnect({
|
|
|
26603
26559
|
setEip6963ProviderCount(providers.length);
|
|
26604
26560
|
});
|
|
26605
26561
|
}, []);
|
|
26606
|
-
const availableWallets =
|
|
26607
|
-
|
|
26608
|
-
|
|
26609
|
-
|
|
26610
|
-
|
|
26611
|
-
|
|
26612
|
-
|
|
26613
|
-
|
|
26614
|
-
|
|
26615
|
-
|
|
26616
|
-
|
|
26617
|
-
|
|
26618
|
-
|
|
26619
|
-
|
|
26562
|
+
const availableWallets = React302.useMemo(() => detectAvailableWallets(), [eip6963ProviderCount]);
|
|
26563
|
+
React302.useEffect(() => {
|
|
26564
|
+
if (!standalone || autoResolved || detectingWallet) return;
|
|
26565
|
+
if (!detectedWallet) {
|
|
26566
|
+
setAutoResolved(true);
|
|
26567
|
+
return;
|
|
26568
|
+
}
|
|
26569
|
+
const wct = detectedWallet.type === "phantom-solana" || detectedWallet.type === "solflare" || detectedWallet.type === "backpack" || detectedWallet.type === "glow" ? "solana" : "ethereum";
|
|
26570
|
+
const matching = depositWallets?.find((w) => w.chain_type === wct);
|
|
26571
|
+
if (!matching) {
|
|
26572
|
+
if (!depositWalletsLoading) setAutoResolved(true);
|
|
26573
|
+
return;
|
|
26574
|
+
}
|
|
26575
|
+
setActiveWalletInfo(detectedWallet);
|
|
26576
|
+
setActiveDepositWallet(matching);
|
|
26577
|
+
onWalletConnected?.(detectedWallet, matching);
|
|
26578
|
+
setView("select_token");
|
|
26579
|
+
viewRef.current = "select_token";
|
|
26580
|
+
setAutoResolved(true);
|
|
26581
|
+
}, [standalone, autoResolved, detectingWallet, detectedWallet, depositWallets, depositWalletsLoading]);
|
|
26582
|
+
React302.useEffect(() => {
|
|
26583
|
+
if (!standalone || autoResolved) return;
|
|
26584
|
+
const t12 = setTimeout(() => setAutoResolved(true), 5e3);
|
|
26585
|
+
return () => clearTimeout(t12);
|
|
26586
|
+
}, [standalone, autoResolved]);
|
|
26587
|
+
const [balances, setBalances] = React302.useState([]);
|
|
26588
|
+
const [isLoading, setIsLoading] = React302.useState(false);
|
|
26589
|
+
const [selectedBalance, setSelectedBalance] = React302.useState(null);
|
|
26590
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = React302.useState(null);
|
|
26591
|
+
const [error, setError] = React302.useState(null);
|
|
26592
|
+
const [isDisconnectingWallet, setIsDisconnectingWallet] = React302.useState(false);
|
|
26593
|
+
const [amountUsd, setAmountUsd] = React302.useState(prefillAmountUsd ?? "");
|
|
26594
|
+
const [isConfirming, setIsConfirming] = React302.useState(false);
|
|
26595
|
+
const [hasSignedTransaction, setHasSignedTransaction] = React302.useState(false);
|
|
26596
|
+
const [tokenChainDetails, setTokenChainDetails] = React302.useState(null);
|
|
26597
|
+
const [loadingTokenDetails, setLoadingTokenDetails] = React302.useState(false);
|
|
26598
|
+
const [showTransactionDetails, setShowTransactionDetails] = React302.useState(false);
|
|
26599
|
+
const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React302.useState(null);
|
|
26620
26600
|
const walletInfo = activeWalletInfo;
|
|
26621
26601
|
const depositWallet = activeDepositWallet;
|
|
26622
26602
|
const hasWallet = !!activeWalletInfo && !!activeDepositWallet;
|
|
@@ -26624,7 +26604,7 @@ function WalletConnect({
|
|
|
26624
26604
|
const recipientAddress = activeDepositWallet?.address ?? "";
|
|
26625
26605
|
const isCheckoutMode = !!checkoutAmountUsd;
|
|
26626
26606
|
const supportedChainType = chainType === "algorand" || chainType === "xrpl" ? "ethereum" : chainType;
|
|
26627
|
-
const transitionTo =
|
|
26607
|
+
const transitionTo = React302.useCallback((nextView) => {
|
|
26628
26608
|
if (nextView === viewRef.current) return;
|
|
26629
26609
|
setIsTransitioning(true);
|
|
26630
26610
|
setTimeout(() => {
|
|
@@ -26761,7 +26741,7 @@ function WalletConnect({
|
|
|
26761
26741
|
}
|
|
26762
26742
|
};
|
|
26763
26743
|
const selectedToken = selectedBalance ? getTokenFromBalance(selectedBalance) : null;
|
|
26764
|
-
const effectiveDestinationAmount =
|
|
26744
|
+
const effectiveDestinationAmount = React302.useMemo(() => {
|
|
26765
26745
|
if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
|
|
26766
26746
|
if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
|
|
26767
26747
|
const remaining = BigInt(checkoutRemainingBaseUnits);
|
|
@@ -26789,7 +26769,7 @@ function WalletConnect({
|
|
|
26789
26769
|
stablecoinParity,
|
|
26790
26770
|
enabled: isCheckoutMode && !!selectedToken && !!checkoutDestination && effectiveDestinationAmount !== "0"
|
|
26791
26771
|
});
|
|
26792
|
-
const activeCheckoutQuote =
|
|
26772
|
+
const activeCheckoutQuote = React302.useMemo(() => {
|
|
26793
26773
|
if (!isCheckoutMode) return null;
|
|
26794
26774
|
if (walletCheckoutQuote) return { sourceAmount: walletCheckoutQuote.source_amount, sourceTokenDecimals: walletCheckoutQuote.source_token_decimals, sourceTokenSymbol: walletCheckoutQuote.source_token_symbol, sourceAmountUsd: walletCheckoutQuote.source_amount_usd, slippageBufferPercent: walletCheckoutQuote.slippage_buffer_percent ?? null };
|
|
26795
26775
|
return checkoutQuote ?? null;
|
|
@@ -26803,19 +26783,19 @@ function WalletConnect({
|
|
|
26803
26783
|
onDepositSuccess,
|
|
26804
26784
|
onDepositError
|
|
26805
26785
|
});
|
|
26806
|
-
|
|
26786
|
+
React302.useEffect(() => {
|
|
26807
26787
|
onExecutionsChange?.(depositExecutions);
|
|
26808
26788
|
}, [depositExecutions, onExecutionsChange]);
|
|
26809
|
-
|
|
26789
|
+
React302.useEffect(() => {
|
|
26810
26790
|
if (!prefillAmountUsd || !tokenChainDetails || view !== "enter_amount") return;
|
|
26811
26791
|
const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
|
|
26812
26792
|
const currentAmount = parseFloat(amountUsd) || 0;
|
|
26813
26793
|
if (currentAmount > 0 && currentAmount < minDeposit) setAmountUsd(minDeposit.toFixed(2));
|
|
26814
26794
|
}, [tokenChainDetails, view, prefillAmountUsd]);
|
|
26815
|
-
|
|
26795
|
+
React302.useEffect(() => {
|
|
26816
26796
|
if (view === "review") setShowTransactionDetails(false);
|
|
26817
26797
|
}, [view]);
|
|
26818
|
-
|
|
26798
|
+
React302.useEffect(() => {
|
|
26819
26799
|
if (view !== "enter_amount" && view !== "review" || !selectedBalance || !activeDepositWallet) return;
|
|
26820
26800
|
let cancelled = false;
|
|
26821
26801
|
const fetchTokenDetails = async () => {
|
|
@@ -26842,7 +26822,7 @@ function WalletConnect({
|
|
|
26842
26822
|
cancelled = true;
|
|
26843
26823
|
};
|
|
26844
26824
|
}, [view, selectedBalance, publishableKey, activeDepositWallet]);
|
|
26845
|
-
|
|
26825
|
+
React302.useEffect(() => {
|
|
26846
26826
|
if (!activeWalletInfo || !activeDepositWallet) return;
|
|
26847
26827
|
let cancelled = false;
|
|
26848
26828
|
setIsLoading(true);
|
|
@@ -26875,20 +26855,20 @@ function WalletConnect({
|
|
|
26875
26855
|
cancelled = true;
|
|
26876
26856
|
};
|
|
26877
26857
|
}, [activeWalletInfo?.address, activeDepositWallet?.chain_type, publishableKey]);
|
|
26878
|
-
const usdToTokenRate =
|
|
26858
|
+
const usdToTokenRate = React302.useMemo(() => {
|
|
26879
26859
|
if (!selectedBalance || !selectedBalance.amount_usd || !selectedToken) return 0;
|
|
26880
26860
|
const balanceAmount = Number(selectedBalance.amount) / 10 ** selectedToken.decimals;
|
|
26881
26861
|
const balanceUsd = parseFloat(selectedBalance.amount_usd);
|
|
26882
26862
|
if (balanceAmount === 0 || balanceUsd === 0) return 0;
|
|
26883
26863
|
return balanceAmount / balanceUsd;
|
|
26884
26864
|
}, [selectedBalance, selectedToken]);
|
|
26885
|
-
const tokenAmount =
|
|
26865
|
+
const tokenAmount = React302.useMemo(() => {
|
|
26886
26866
|
if (isCheckoutMode && activeCheckoutQuote && selectedToken) return Number(activeCheckoutQuote.sourceAmount) / 10 ** activeCheckoutQuote.sourceTokenDecimals;
|
|
26887
26867
|
const usdNum = parseFloat(amountUsd) || 0;
|
|
26888
26868
|
if (usdNum === 0 || usdToTokenRate === 0) return 0;
|
|
26889
26869
|
return usdNum * usdToTokenRate;
|
|
26890
26870
|
}, [amountUsd, usdToTokenRate, isCheckoutMode, activeCheckoutQuote, selectedToken]);
|
|
26891
|
-
|
|
26871
|
+
React302.useEffect(() => {
|
|
26892
26872
|
if (isCheckoutMode && activeCheckoutQuote?.sourceAmountUsd && view === "enter_amount") setAmountUsd(activeCheckoutQuote.sourceAmountUsd);
|
|
26893
26873
|
}, [isCheckoutMode, activeCheckoutQuote, view]);
|
|
26894
26874
|
const maxTokenAmount = selectedBalance && selectedToken ? Number(selectedBalance.amount) / 10 ** selectedToken.decimals : 0;
|
|
@@ -26896,7 +26876,7 @@ function WalletConnect({
|
|
|
26896
26876
|
const inputUsdNum = parseFloat(amountUsd) || 0;
|
|
26897
26877
|
const minDepositUsd = tokenChainDetails?.minimum_deposit_amount_usd || 0;
|
|
26898
26878
|
const isValidAmount = isCheckoutMode && activeCheckoutQuote ? tokenAmount > 0 && tokenAmount <= maxTokenAmount : inputUsdNum > 0 && inputUsdNum <= maxUsdAmount && inputUsdNum >= minDepositUsd;
|
|
26899
|
-
const formattedTokenAmount =
|
|
26879
|
+
const formattedTokenAmount = React302.useMemo(() => {
|
|
26900
26880
|
if (tokenAmount === 0 || !selectedToken) return null;
|
|
26901
26881
|
return `${tokenAmount.toFixed(6)} ${selectedToken.symbol}`.replace(/\.?0+$/, "");
|
|
26902
26882
|
}, [tokenAmount, selectedToken]);
|
|
@@ -26944,16 +26924,25 @@ function WalletConnect({
|
|
|
26944
26924
|
} catch (err) {
|
|
26945
26925
|
console.warn("[WalletConnect] disconnect error:", err);
|
|
26946
26926
|
} finally {
|
|
26947
|
-
setActiveWalletInfo(null);
|
|
26948
|
-
setActiveDepositWallet(null);
|
|
26949
|
-
setSelectedBalance(null);
|
|
26950
|
-
setBalances([]);
|
|
26951
|
-
setTotalBalanceUsd(null);
|
|
26952
|
-
setAmountUsd(prefillAmountUsd ?? "");
|
|
26953
|
-
setError(null);
|
|
26954
26927
|
setIsDisconnectingWallet(false);
|
|
26955
|
-
|
|
26956
|
-
|
|
26928
|
+
const clearWalletState = () => {
|
|
26929
|
+
setActiveWalletInfo(null);
|
|
26930
|
+
setActiveDepositWallet(null);
|
|
26931
|
+
setSelectedBalance(null);
|
|
26932
|
+
setBalances([]);
|
|
26933
|
+
setTotalBalanceUsd(null);
|
|
26934
|
+
setAmountUsd(prefillAmountUsd ?? "");
|
|
26935
|
+
setError(null);
|
|
26936
|
+
};
|
|
26937
|
+
if (standalone) {
|
|
26938
|
+
onWalletDisconnect?.();
|
|
26939
|
+
transitionTo("select_wallet");
|
|
26940
|
+
setTimeout(clearWalletState, 160);
|
|
26941
|
+
} else {
|
|
26942
|
+
clearWalletState();
|
|
26943
|
+
if (onWalletDisconnect) onWalletDisconnect();
|
|
26944
|
+
else parentOnBack?.();
|
|
26945
|
+
}
|
|
26957
26946
|
}
|
|
26958
26947
|
};
|
|
26959
26948
|
const handleReview = () => {
|
|
@@ -27079,9 +27068,15 @@ function WalletConnect({
|
|
|
27079
27068
|
setIsConfirming(false);
|
|
27080
27069
|
}
|
|
27081
27070
|
};
|
|
27071
|
+
if (standalone && !autoResolved) {
|
|
27072
|
+
return /* @__PURE__ */ jsxs48("div", { style: viewTransitionStyle, children: [
|
|
27073
|
+
/* @__PURE__ */ jsx54(DepositHeader, { title: "Connect Wallet", showBack: canGoBack, onBack: handleBack, onClose }),
|
|
27074
|
+
/* @__PURE__ */ jsx54("div", { className: "uf-flex uf-flex-col uf-items-center uf-justify-center uf-py-16", children: /* @__PURE__ */ jsx54(LoaderCircle, { className: "uf-w-8 uf-h-8 uf-animate-spin", style: { color: colors2.primary } }) })
|
|
27075
|
+
] });
|
|
27076
|
+
}
|
|
27082
27077
|
if (view === "select_wallet") {
|
|
27083
27078
|
return /* @__PURE__ */ jsxs48("div", { style: viewTransitionStyle, children: [
|
|
27084
|
-
/* @__PURE__ */ jsx54(DepositHeader, { title: "Connect Wallet", showBack:
|
|
27079
|
+
/* @__PURE__ */ jsx54(DepositHeader, { title: "Connect Wallet", showBack: canGoBack, onBack: handleBack, onClose }),
|
|
27085
27080
|
/* @__PURE__ */ jsxs48("div", { className: "uf-pb-4", children: [
|
|
27086
27081
|
/* @__PURE__ */ jsx54("p", { className: "uf-text-sm uf-text-center uf-pb-4", style: { color: colors2.foregroundMuted, fontFamily: fonts.regular }, children: "Select a wallet to connect" }),
|
|
27087
27082
|
/* @__PURE__ */ jsx54("div", { className: "uf-space-y-2", style: { maxHeight: 330, overflowY: "auto" }, children: availableWallets.map((wallet) => /* @__PURE__ */ jsxs48(
|
|
@@ -27209,6 +27204,7 @@ function DepositModal({
|
|
|
27209
27204
|
destinationChainType,
|
|
27210
27205
|
destinationChainId,
|
|
27211
27206
|
destinationTokenAddress,
|
|
27207
|
+
contractCalls,
|
|
27212
27208
|
defaultSourceChainType,
|
|
27213
27209
|
defaultSourceChainId,
|
|
27214
27210
|
defaultSourceTokenAddress,
|
|
@@ -27243,45 +27239,56 @@ function DepositModal({
|
|
|
27243
27239
|
if (s === "tracker" && hideDepositTracker) return "main";
|
|
27244
27240
|
if (s === "cashapp" && !enableCashApp) return "main";
|
|
27245
27241
|
if (s === "card" && enableFiatOnramp === false) return "main";
|
|
27242
|
+
if (s === "pay_with_exchange") return enablePayWithExchange === false ? "main" : "exchange";
|
|
27243
|
+
if (s === "exchange_connect") return enableConnectExchange ? "coinbase_connect" : "main";
|
|
27244
|
+
if (s === "wallet_connect") return enableConnectWallet ? "wallet_connect" : "main";
|
|
27246
27245
|
return s;
|
|
27247
|
-
}, [
|
|
27248
|
-
|
|
27246
|
+
}, [
|
|
27247
|
+
initialScreen,
|
|
27248
|
+
hideDepositTracker,
|
|
27249
|
+
enableCashApp,
|
|
27250
|
+
enableFiatOnramp,
|
|
27251
|
+
enablePayWithExchange,
|
|
27252
|
+
enableConnectExchange,
|
|
27253
|
+
enableConnectWallet
|
|
27254
|
+
]);
|
|
27255
|
+
const [containerEl, setContainerEl] = useState32(null);
|
|
27249
27256
|
const containerCallbackRef = useCallback52((el) => {
|
|
27250
27257
|
setContainerEl(el);
|
|
27251
27258
|
}, []);
|
|
27252
|
-
const [view, setView] =
|
|
27259
|
+
const [view, setView] = useState32(
|
|
27253
27260
|
effectiveInitialScreen
|
|
27254
27261
|
);
|
|
27255
|
-
const [coinbaseSkipToHoldings, setCoinbaseSkipToHoldings] =
|
|
27256
|
-
const resetViewTimeoutRef =
|
|
27257
|
-
const [cardView, setCardView] =
|
|
27262
|
+
const [coinbaseSkipToHoldings, setCoinbaseSkipToHoldings] = useState32(false);
|
|
27263
|
+
const resetViewTimeoutRef = useRef92(null);
|
|
27264
|
+
const [cardView, setCardView] = useState32(
|
|
27258
27265
|
"amount"
|
|
27259
27266
|
);
|
|
27260
|
-
const [exchangeView, setExchangeView] =
|
|
27267
|
+
const [exchangeView, setExchangeView] = useState32(
|
|
27261
27268
|
"providers"
|
|
27262
27269
|
);
|
|
27263
|
-
const [browserWalletModalOpen, setBrowserWalletModalOpen] =
|
|
27264
|
-
const [browserWalletInfo, setBrowserWalletInfo] =
|
|
27265
|
-
const [walletSelectionModalOpen, setWalletSelectionModalOpen] =
|
|
27266
|
-
const [browserWalletChainType, setBrowserWalletChainType] =
|
|
27267
|
-
const [quotesCount, setQuotesCount] =
|
|
27268
|
-
const [allExecutions, setAllExecutions] =
|
|
27269
|
-
const [selectedExecution, setSelectedExecution] =
|
|
27270
|
-
const [depositExecutions, setDepositExecutions] =
|
|
27270
|
+
const [browserWalletModalOpen, setBrowserWalletModalOpen] = useState32(false);
|
|
27271
|
+
const [browserWalletInfo, setBrowserWalletInfo] = useState32(null);
|
|
27272
|
+
const [walletSelectionModalOpen, setWalletSelectionModalOpen] = useState32(false);
|
|
27273
|
+
const [browserWalletChainType, setBrowserWalletChainType] = useState32(() => getStoredWalletChainType());
|
|
27274
|
+
const [quotesCount, setQuotesCount] = useState32(0);
|
|
27275
|
+
const [allExecutions, setAllExecutions] = useState32([]);
|
|
27276
|
+
const [selectedExecution, setSelectedExecution] = useState32(null);
|
|
27277
|
+
const [depositExecutions, setDepositExecutions] = useState32([]);
|
|
27271
27278
|
const isMobileView = useIsMobileViewport();
|
|
27272
|
-
const [integrationExchanges, setIntegrationExchanges] =
|
|
27273
|
-
|
|
27279
|
+
const [integrationExchanges, setIntegrationExchanges] = useState32([]);
|
|
27280
|
+
useEffect26(() => {
|
|
27274
27281
|
if (!enableConnectExchange || !open) return;
|
|
27275
27282
|
getIntegrationExchanges(publishableKey).then((res) => setIntegrationExchanges(res.data)).catch(() => {
|
|
27276
27283
|
});
|
|
27277
27284
|
}, [enableConnectExchange, open, publishableKey]);
|
|
27278
|
-
const [connectedExchange, setConnectedExchange] =
|
|
27285
|
+
const [connectedExchange, setConnectedExchange] = useState32(() => {
|
|
27279
27286
|
if (!enableConnectExchange) return null;
|
|
27280
27287
|
const stored = getStoredIntegrationToken(IntegrationProvider.COINBASE);
|
|
27281
27288
|
if (!stored) return null;
|
|
27282
27289
|
return { name: "Coinbase", iconUrl: void 0, balanceUsd: null, isLoading: true };
|
|
27283
27290
|
});
|
|
27284
|
-
|
|
27291
|
+
useEffect26(() => {
|
|
27285
27292
|
if (!enableConnectExchange || !open || view !== "main") return;
|
|
27286
27293
|
const stored = getStoredIntegrationToken(IntegrationProvider.COINBASE);
|
|
27287
27294
|
if (!stored) {
|
|
@@ -27318,7 +27325,7 @@ function DepositModal({
|
|
|
27318
27325
|
}
|
|
27319
27326
|
});
|
|
27320
27327
|
}, [enableConnectExchange, open, view, publishableKey]);
|
|
27321
|
-
|
|
27328
|
+
useEffect26(() => {
|
|
27322
27329
|
if (!connectedExchange || integrationExchanges.length === 0) return;
|
|
27323
27330
|
const cbExchange = integrationExchanges.find(
|
|
27324
27331
|
(e) => e.service_provider === IntegrationProvider.COINBASE
|
|
@@ -27335,14 +27342,15 @@ function DepositModal({
|
|
|
27335
27342
|
destinationChainType,
|
|
27336
27343
|
destinationChainId,
|
|
27337
27344
|
destinationTokenAddress,
|
|
27345
|
+
contractCalls,
|
|
27338
27346
|
enabled: open
|
|
27339
27347
|
// Only fetch when modal is open
|
|
27340
27348
|
});
|
|
27341
27349
|
const wallets = depositAddressResponse?.data ?? [];
|
|
27342
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
27350
|
+
const [resolvedTheme, setResolvedTheme] = useState32(
|
|
27343
27351
|
theme === "auto" ? "dark" : theme
|
|
27344
27352
|
);
|
|
27345
|
-
|
|
27353
|
+
useEffect26(() => {
|
|
27346
27354
|
if (theme === "auto") {
|
|
27347
27355
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
27348
27356
|
setResolvedTheme(mediaQuery.matches ? "dark" : "light");
|
|
@@ -27361,12 +27369,18 @@ function DepositModal({
|
|
|
27361
27369
|
});
|
|
27362
27370
|
const showPayWithExchange = enablePayWithExchange ?? projectConfig?.pay_with_exchange?.enabled ?? true;
|
|
27363
27371
|
const showFiatOnramp = enableFiatOnramp ?? projectConfig?.fiat_onramp?.enabled ?? true;
|
|
27364
|
-
|
|
27372
|
+
useEffect26(() => {
|
|
27365
27373
|
if (view === "card" && !showFiatOnramp) {
|
|
27366
27374
|
setView("main");
|
|
27367
27375
|
setCardView("amount");
|
|
27368
27376
|
}
|
|
27369
27377
|
}, [view, showFiatOnramp]);
|
|
27378
|
+
useEffect26(() => {
|
|
27379
|
+
if (view === "exchange" && !showPayWithExchange) {
|
|
27380
|
+
setView("main");
|
|
27381
|
+
setExchangeView("providers");
|
|
27382
|
+
}
|
|
27383
|
+
}, [view, showPayWithExchange]);
|
|
27370
27384
|
const { exchanges, isLoading: exchangesLoading } = useExchanges({
|
|
27371
27385
|
publishableKey,
|
|
27372
27386
|
enabled: open && showPayWithExchange
|
|
@@ -27381,7 +27395,7 @@ function DepositModal({
|
|
|
27381
27395
|
subdivisionCode: userIpInfo?.subdivisionCode ?? void 0,
|
|
27382
27396
|
enabled: open && !isLoadingIp
|
|
27383
27397
|
});
|
|
27384
|
-
|
|
27398
|
+
useEffect26(() => {
|
|
27385
27399
|
if (view !== "tracker" || !userId) return;
|
|
27386
27400
|
const fetchExecutions = async () => {
|
|
27387
27401
|
try {
|
|
@@ -27402,7 +27416,7 @@ function DepositModal({
|
|
|
27402
27416
|
clearInterval(pollInterval);
|
|
27403
27417
|
};
|
|
27404
27418
|
}, [view, userId, publishableKey]);
|
|
27405
|
-
|
|
27419
|
+
useEffect26(() => {
|
|
27406
27420
|
if (view !== "tracker") {
|
|
27407
27421
|
setSelectedExecution(null);
|
|
27408
27422
|
}
|
|
@@ -27486,7 +27500,7 @@ function DepositModal({
|
|
|
27486
27500
|
setBrowserWalletChainType(void 0);
|
|
27487
27501
|
setBrowserWalletInfo(null);
|
|
27488
27502
|
setBrowserWalletModalOpen(false);
|
|
27489
|
-
if (view === "wallet_connect") setView("main");
|
|
27503
|
+
if (view === "wallet_connect" && sessionOpenedFromMenu) setView("main");
|
|
27490
27504
|
};
|
|
27491
27505
|
const handleExchangeDisconnect = () => {
|
|
27492
27506
|
const stored = getStoredIntegrationToken(IntegrationProvider.COINBASE);
|
|
@@ -27495,7 +27509,7 @@ function DepositModal({
|
|
|
27495
27509
|
}
|
|
27496
27510
|
clearStoredIntegrationToken(IntegrationProvider.COINBASE);
|
|
27497
27511
|
setConnectedExchange(null);
|
|
27498
|
-
if (view === "coinbase_connect") setView("main");
|
|
27512
|
+
if (view === "coinbase_connect" && sessionOpenedFromMenu) setView("main");
|
|
27499
27513
|
};
|
|
27500
27514
|
const handleClose = () => {
|
|
27501
27515
|
onOpenChange(false);
|
|
@@ -27507,6 +27521,7 @@ function DepositModal({
|
|
|
27507
27521
|
setCardView("amount");
|
|
27508
27522
|
setExchangeView("providers");
|
|
27509
27523
|
setBrowserWalletInfo(null);
|
|
27524
|
+
setCoinbaseSkipToHoldings(false);
|
|
27510
27525
|
resetViewTimeoutRef.current = null;
|
|
27511
27526
|
}, 200);
|
|
27512
27527
|
};
|
|
@@ -27521,8 +27536,9 @@ function DepositModal({
|
|
|
27521
27536
|
setExchangeView("providers");
|
|
27522
27537
|
setBrowserWalletInfo(null);
|
|
27523
27538
|
setSelectedExecution(null);
|
|
27539
|
+
setCoinbaseSkipToHoldings(false);
|
|
27524
27540
|
}, [open, effectiveInitialScreen]);
|
|
27525
|
-
|
|
27541
|
+
useEffect26(
|
|
27526
27542
|
() => () => {
|
|
27527
27543
|
if (resetViewTimeoutRef.current) {
|
|
27528
27544
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -27530,8 +27546,8 @@ function DepositModal({
|
|
|
27530
27546
|
},
|
|
27531
27547
|
[]
|
|
27532
27548
|
);
|
|
27533
|
-
const [cashAppView, setCashAppView] =
|
|
27534
|
-
const [cashAppAmount, setCashAppAmount] =
|
|
27549
|
+
const [cashAppView, setCashAppView] = useState32("amount");
|
|
27550
|
+
const [cashAppAmount, setCashAppAmount] = useState32("");
|
|
27535
27551
|
const handleBack = () => {
|
|
27536
27552
|
if (view === "card" && cardView === "quotes") {
|
|
27537
27553
|
setCardView("amount");
|
|
@@ -27880,7 +27896,7 @@ function DepositModal({
|
|
|
27880
27896
|
DepositHeader,
|
|
27881
27897
|
{
|
|
27882
27898
|
title: payWithExchangeTitle,
|
|
27883
|
-
showBack:
|
|
27899
|
+
showBack: exchangeView === "pending" || sessionOpenedFromMenu,
|
|
27884
27900
|
onBack: handleBack,
|
|
27885
27901
|
onClose: handleClose
|
|
27886
27902
|
}
|
|
@@ -27934,6 +27950,7 @@ function DepositModal({
|
|
|
27934
27950
|
onClose: handleClose,
|
|
27935
27951
|
onDisconnect: handleExchangeDisconnect,
|
|
27936
27952
|
skipToHoldings: coinbaseSkipToHoldings,
|
|
27953
|
+
canGoBack: sessionOpenedFromMenu,
|
|
27937
27954
|
onExecutionsChange: setDepositExecutions
|
|
27938
27955
|
}
|
|
27939
27956
|
),
|
|
@@ -27971,7 +27988,9 @@ function DepositModal({
|
|
|
27971
27988
|
setBrowserWalletChainType(dw.chain_type === "solana" ? "solana" : "ethereum");
|
|
27972
27989
|
},
|
|
27973
27990
|
onBack: handleBack,
|
|
27974
|
-
onClose: handleClose
|
|
27991
|
+
onClose: handleClose,
|
|
27992
|
+
canGoBack: sessionOpenedFromMenu,
|
|
27993
|
+
depositWalletsLoading: walletsLoading
|
|
27975
27994
|
}
|
|
27976
27995
|
),
|
|
27977
27996
|
depositPoweredByFooter
|
|
@@ -27980,7 +27999,7 @@ function DepositModal({
|
|
|
27980
27999
|
DepositHeader,
|
|
27981
28000
|
{
|
|
27982
28001
|
title: cashAppView !== "amount" && cashAppAmount ? `Pay $${cashAppAmount} via Cash App` : "Pay with Cash App",
|
|
27983
|
-
showBack:
|
|
28002
|
+
showBack: cashAppView !== "amount" || sessionOpenedFromMenu,
|
|
27984
28003
|
onBack: handleBack,
|
|
27985
28004
|
onClose: handleClose
|
|
27986
28005
|
}
|
|
@@ -28082,19 +28101,19 @@ function CheckoutModal({
|
|
|
28082
28101
|
onCheckoutError
|
|
28083
28102
|
}) {
|
|
28084
28103
|
const { colors: colors2, fonts, components } = useTheme();
|
|
28085
|
-
const [view, setView] =
|
|
28086
|
-
const resetViewTimeoutRef =
|
|
28104
|
+
const [view, setView] = useState33("main");
|
|
28105
|
+
const resetViewTimeoutRef = useRef102(
|
|
28087
28106
|
null
|
|
28088
28107
|
);
|
|
28089
|
-
const [browserWalletModalOpen, setBrowserWalletModalOpen] =
|
|
28090
|
-
const [browserWalletInfo, setBrowserWalletInfo] =
|
|
28091
|
-
const [walletSelectionModalOpen, setWalletSelectionModalOpen] =
|
|
28092
|
-
const [browserWalletChainType, setBrowserWalletChainType] =
|
|
28108
|
+
const [browserWalletModalOpen, setBrowserWalletModalOpen] = useState33(false);
|
|
28109
|
+
const [browserWalletInfo, setBrowserWalletInfo] = useState33(null);
|
|
28110
|
+
const [walletSelectionModalOpen, setWalletSelectionModalOpen] = useState33(false);
|
|
28111
|
+
const [browserWalletChainType, setBrowserWalletChainType] = useState33(() => getStoredWalletChainType());
|
|
28093
28112
|
const isMobileView = useIsMobileViewport();
|
|
28094
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
28113
|
+
const [resolvedTheme, setResolvedTheme] = useState33(
|
|
28095
28114
|
theme === "auto" ? "dark" : theme
|
|
28096
28115
|
);
|
|
28097
|
-
|
|
28116
|
+
useEffect272(() => {
|
|
28098
28117
|
if (theme === "auto") {
|
|
28099
28118
|
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
28100
28119
|
setResolvedTheme(mediaQuery.matches ? "dark" : "light");
|
|
@@ -28122,8 +28141,8 @@ function CheckoutModal({
|
|
|
28122
28141
|
publishableKey,
|
|
28123
28142
|
enabled: open
|
|
28124
28143
|
});
|
|
28125
|
-
const prevStatusRef =
|
|
28126
|
-
|
|
28144
|
+
const prevStatusRef = useRef102(null);
|
|
28145
|
+
useEffect272(() => {
|
|
28127
28146
|
if (!paymentIntent) return;
|
|
28128
28147
|
const prev = prevStatusRef.current;
|
|
28129
28148
|
prevStatusRef.current = paymentIntent.status;
|
|
@@ -28169,7 +28188,7 @@ function CheckoutModal({
|
|
|
28169
28188
|
const remaining = total - received;
|
|
28170
28189
|
return remaining > 0n ? remaining.toString() : "0";
|
|
28171
28190
|
}, [paymentIntent]);
|
|
28172
|
-
const [selectedSource, setSelectedSource] =
|
|
28191
|
+
const [selectedSource, setSelectedSource] = useState33(null);
|
|
28173
28192
|
const remainingDestinationAmount = useMemo112(() => {
|
|
28174
28193
|
if (!paymentIntent) return "0";
|
|
28175
28194
|
const remaining = BigInt(paymentIntent.destination_amount) - BigInt(paymentIntent.destination_amount_received);
|
|
@@ -28289,7 +28308,7 @@ function CheckoutModal({
|
|
|
28289
28308
|
setView("main");
|
|
28290
28309
|
setBrowserWalletInfo(null);
|
|
28291
28310
|
}, [open]);
|
|
28292
|
-
|
|
28311
|
+
useEffect272(
|
|
28293
28312
|
() => () => {
|
|
28294
28313
|
if (resetViewTimeoutRef.current) {
|
|
28295
28314
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -28825,20 +28844,20 @@ function useWithdrawPolling({
|
|
|
28825
28844
|
onWithdrawSuccess,
|
|
28826
28845
|
onWithdrawError
|
|
28827
28846
|
}) {
|
|
28828
|
-
const [executions, setExecutions] =
|
|
28829
|
-
const [isPolling, setIsPolling] =
|
|
28830
|
-
const enabledAtRef =
|
|
28831
|
-
const trackedRef =
|
|
28832
|
-
const prevEnabledRef =
|
|
28833
|
-
const onSuccessRef =
|
|
28834
|
-
const onErrorRef =
|
|
28835
|
-
|
|
28847
|
+
const [executions, setExecutions] = useState34([]);
|
|
28848
|
+
const [isPolling, setIsPolling] = useState34(false);
|
|
28849
|
+
const enabledAtRef = useRef112(/* @__PURE__ */ new Date());
|
|
28850
|
+
const trackedRef = useRef112(/* @__PURE__ */ new Map());
|
|
28851
|
+
const prevEnabledRef = useRef112(false);
|
|
28852
|
+
const onSuccessRef = useRef112(onWithdrawSuccess);
|
|
28853
|
+
const onErrorRef = useRef112(onWithdrawError);
|
|
28854
|
+
useEffect282(() => {
|
|
28836
28855
|
onSuccessRef.current = onWithdrawSuccess;
|
|
28837
28856
|
}, [onWithdrawSuccess]);
|
|
28838
|
-
|
|
28857
|
+
useEffect282(() => {
|
|
28839
28858
|
onErrorRef.current = onWithdrawError;
|
|
28840
28859
|
}, [onWithdrawError]);
|
|
28841
|
-
|
|
28860
|
+
useEffect282(() => {
|
|
28842
28861
|
if (enabled && !prevEnabledRef.current) {
|
|
28843
28862
|
enabledAtRef.current = /* @__PURE__ */ new Date();
|
|
28844
28863
|
trackedRef.current.clear();
|
|
@@ -28848,7 +28867,7 @@ function useWithdrawPolling({
|
|
|
28848
28867
|
}
|
|
28849
28868
|
prevEnabledRef.current = enabled;
|
|
28850
28869
|
}, [enabled]);
|
|
28851
|
-
|
|
28870
|
+
useEffect282(() => {
|
|
28852
28871
|
if (!userId || !enabled) return;
|
|
28853
28872
|
const enabledAt = enabledAtRef.current;
|
|
28854
28873
|
const poll = async () => {
|
|
@@ -28910,7 +28929,7 @@ function useWithdrawPolling({
|
|
|
28910
28929
|
setIsPolling(false);
|
|
28911
28930
|
};
|
|
28912
28931
|
}, [userId, publishableKey, enabled]);
|
|
28913
|
-
|
|
28932
|
+
useEffect282(() => {
|
|
28914
28933
|
if (!enabled || !depositWalletId) return;
|
|
28915
28934
|
const trigger = async () => {
|
|
28916
28935
|
try {
|
|
@@ -29282,27 +29301,27 @@ function WithdrawForm({
|
|
|
29282
29301
|
footerLeft
|
|
29283
29302
|
}) {
|
|
29284
29303
|
const { colors: colors2, fonts, components } = useTheme();
|
|
29285
|
-
const [recipientAddress, setRecipientAddress] =
|
|
29286
|
-
const [amount, setAmount] =
|
|
29287
|
-
const [inputUnit, setInputUnit] =
|
|
29288
|
-
const [isSubmitting, setIsSubmitting] =
|
|
29289
|
-
const [submitError, setSubmitError] =
|
|
29290
|
-
const [detailsExpanded, setDetailsExpanded] =
|
|
29291
|
-
const [glossaryOpen, setGlossaryOpen] =
|
|
29292
|
-
const [isMaxed, setIsMaxed] =
|
|
29293
|
-
|
|
29304
|
+
const [recipientAddress, setRecipientAddress] = useState35(recipientAddressProp || "");
|
|
29305
|
+
const [amount, setAmount] = useState35("");
|
|
29306
|
+
const [inputUnit, setInputUnit] = useState35("fiat");
|
|
29307
|
+
const [isSubmitting, setIsSubmitting] = useState35(false);
|
|
29308
|
+
const [submitError, setSubmitError] = useState35(null);
|
|
29309
|
+
const [detailsExpanded, setDetailsExpanded] = useState35(false);
|
|
29310
|
+
const [glossaryOpen, setGlossaryOpen] = useState35(false);
|
|
29311
|
+
const [isMaxed, setIsMaxed] = useState35(false);
|
|
29312
|
+
useEffect292(() => {
|
|
29294
29313
|
setRecipientAddress(recipientAddressProp || "");
|
|
29295
29314
|
setAmount("");
|
|
29296
29315
|
setInputUnit("fiat");
|
|
29297
29316
|
setSubmitError(null);
|
|
29298
29317
|
setIsMaxed(false);
|
|
29299
29318
|
}, [recipientAddressProp]);
|
|
29300
|
-
|
|
29319
|
+
useEffect292(() => {
|
|
29301
29320
|
setIsMaxed(false);
|
|
29302
29321
|
}, [balanceData?.balanceBaseUnit]);
|
|
29303
29322
|
const trimmedAddress = recipientAddress.trim();
|
|
29304
|
-
const [debouncedAddress, setDebouncedAddress] =
|
|
29305
|
-
|
|
29323
|
+
const [debouncedAddress, setDebouncedAddress] = useState35(trimmedAddress);
|
|
29324
|
+
useEffect292(() => {
|
|
29306
29325
|
const id = setTimeout(() => setDebouncedAddress(trimmedAddress), 500);
|
|
29307
29326
|
return () => clearTimeout(id);
|
|
29308
29327
|
}, [trimmedAddress]);
|
|
@@ -29944,9 +29963,9 @@ function WithdrawConfirmingView({
|
|
|
29944
29963
|
onViewTracker
|
|
29945
29964
|
}) {
|
|
29946
29965
|
const { colors: colors2, fonts, components } = useTheme();
|
|
29947
|
-
const [showButton, setShowButton] =
|
|
29966
|
+
const [showButton, setShowButton] = useState36(false);
|
|
29948
29967
|
const latestExecution = executions.length > 0 ? executions[executions.length - 1] : null;
|
|
29949
|
-
|
|
29968
|
+
useEffect302(() => {
|
|
29950
29969
|
if (latestExecution) return;
|
|
29951
29970
|
const timer = setTimeout(() => setShowButton(true), SHOW_BUTTON_DELAY_MS);
|
|
29952
29971
|
return () => clearTimeout(timer);
|
|
@@ -30103,14 +30122,14 @@ function WithdrawModal({
|
|
|
30103
30122
|
hideOverlay = false
|
|
30104
30123
|
}) {
|
|
30105
30124
|
const { colors: colors2, fonts, components } = useTheme();
|
|
30106
|
-
const [containerEl, setContainerEl] =
|
|
30125
|
+
const [containerEl, setContainerEl] = useState37(null);
|
|
30107
30126
|
const containerCallbackRef = useCallback82((el) => {
|
|
30108
30127
|
setContainerEl(el);
|
|
30109
30128
|
}, []);
|
|
30110
|
-
const [resolvedTheme, setResolvedTheme] =
|
|
30129
|
+
const [resolvedTheme, setResolvedTheme] = useState37(
|
|
30111
30130
|
theme === "auto" ? "dark" : theme
|
|
30112
30131
|
);
|
|
30113
|
-
|
|
30132
|
+
useEffect31(() => {
|
|
30114
30133
|
if (theme === "auto") {
|
|
30115
30134
|
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
30116
30135
|
setResolvedTheme(mq.matches ? "dark" : "light");
|
|
@@ -30154,10 +30173,10 @@ function WithdrawModal({
|
|
|
30154
30173
|
});
|
|
30155
30174
|
const selectedToken = selectedTokenSymbol ? destinationTokens.find((t12) => t12.symbol === selectedTokenSymbol) ?? null : null;
|
|
30156
30175
|
const selectedChain = selectedToken && selectedChainKey ? selectedToken.chains.find((c) => getChainKey5(c.chain_id, c.chain_type) === selectedChainKey) ?? null : null;
|
|
30157
|
-
const [view, setView] =
|
|
30158
|
-
const [withdrawDepositWalletId, setWithdrawDepositWalletId] =
|
|
30159
|
-
const [selectedExecution, setSelectedExecution] =
|
|
30160
|
-
const [submittedTxInfo, setSubmittedTxInfo] =
|
|
30176
|
+
const [view, setView] = useState37("form");
|
|
30177
|
+
const [withdrawDepositWalletId, setWithdrawDepositWalletId] = useState37();
|
|
30178
|
+
const [selectedExecution, setSelectedExecution] = useState37(null);
|
|
30179
|
+
const [submittedTxInfo, setSubmittedTxInfo] = useState37(null);
|
|
30161
30180
|
const { executions: realtimeExecutions } = useWithdrawPolling({
|
|
30162
30181
|
userId: externalUserId,
|
|
30163
30182
|
publishableKey,
|
|
@@ -30196,7 +30215,7 @@ function WithdrawModal({
|
|
|
30196
30215
|
setSubmittedTxInfo(txInfo);
|
|
30197
30216
|
setView("confirming");
|
|
30198
30217
|
}, []);
|
|
30199
|
-
const resetViewTimeoutRef =
|
|
30218
|
+
const resetViewTimeoutRef = useRef122(null);
|
|
30200
30219
|
const handleClose = useCallback82(() => {
|
|
30201
30220
|
onOpenChange(false);
|
|
30202
30221
|
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -30219,7 +30238,7 @@ function WithdrawModal({
|
|
|
30219
30238
|
setSubmittedTxInfo(null);
|
|
30220
30239
|
setWithdrawDepositWalletId(void 0);
|
|
30221
30240
|
}, [open]);
|
|
30222
|
-
|
|
30241
|
+
useEffect31(() => () => {
|
|
30223
30242
|
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
30224
30243
|
}, []);
|
|
30225
30244
|
const handleTokenSymbolChange = useCallback82((symbol) => {
|
|
@@ -30350,20 +30369,20 @@ function UnifoldProvider2({
|
|
|
30350
30369
|
queryClient,
|
|
30351
30370
|
config
|
|
30352
30371
|
}) {
|
|
30353
|
-
const [isOpen, setIsOpen] =
|
|
30354
|
-
const [depositConfig, setDepositConfig] =
|
|
30372
|
+
const [isOpen, setIsOpen] = useState31(false);
|
|
30373
|
+
const [depositConfig, setDepositConfig] = useState31(
|
|
30355
30374
|
null
|
|
30356
30375
|
);
|
|
30357
|
-
const [isCheckoutOpen, setIsCheckoutOpen] =
|
|
30358
|
-
const [checkoutConfig, setCheckoutConfig] =
|
|
30376
|
+
const [isCheckoutOpen, setIsCheckoutOpen] = useState31(false);
|
|
30377
|
+
const [checkoutConfig, setCheckoutConfig] = useState31(
|
|
30359
30378
|
null
|
|
30360
30379
|
);
|
|
30361
|
-
const [isWithdrawOpen, setIsWithdrawOpen] =
|
|
30362
|
-
const [withdrawConfig, setWithdrawConfig] =
|
|
30380
|
+
const [isWithdrawOpen, setIsWithdrawOpen] = useState31(false);
|
|
30381
|
+
const [withdrawConfig, setWithdrawConfig] = useState31(
|
|
30363
30382
|
null
|
|
30364
30383
|
);
|
|
30365
30384
|
const [resolvedTheme, setResolvedTheme] = React38.useState("dark");
|
|
30366
|
-
|
|
30385
|
+
useEffect33(() => {
|
|
30367
30386
|
if (publishableKey) {
|
|
30368
30387
|
setApiConfig({ publishableKey });
|
|
30369
30388
|
}
|
|
@@ -30668,6 +30687,7 @@ function UnifoldProvider2({
|
|
|
30668
30687
|
destinationChainType: depositConfig.destinationChainType,
|
|
30669
30688
|
destinationChainId: depositConfig.destinationChainId,
|
|
30670
30689
|
destinationTokenAddress: depositConfig.destinationTokenAddress,
|
|
30690
|
+
contractCalls: depositConfig.contractCalls,
|
|
30671
30691
|
defaultSourceChainType: depositConfig.defaultSourceChainType,
|
|
30672
30692
|
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
30673
30693
|
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|