@unifold/connect-react 0.1.68 → 0.1.69
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 +12 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +525 -218
- package/dist/index.mjs +679 -372
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1144,7 +1144,7 @@ ${new this._window.XMLSerializer().serializeToString(e3)}`;
|
|
|
1144
1144
|
});
|
|
1145
1145
|
|
|
1146
1146
|
// src/provider.tsx
|
|
1147
|
-
import React38, { useState as useState39, useCallback as
|
|
1147
|
+
import React38, { useState as useState39, useCallback as useCallback14, useMemo as useMemo19, useEffect as useEffect40 } from "react";
|
|
1148
1148
|
|
|
1149
1149
|
// ../react-provider/dist/index.mjs
|
|
1150
1150
|
import { createContext, useContext, useState, useEffect, useMemo, useRef } from "react";
|
|
@@ -1216,9 +1216,9 @@ import {
|
|
|
1216
1216
|
useState as useState40,
|
|
1217
1217
|
useEffect as useEffect34,
|
|
1218
1218
|
useLayoutEffect as useLayoutEffect22,
|
|
1219
|
-
useCallback as
|
|
1220
|
-
useRef as
|
|
1221
|
-
useMemo as
|
|
1219
|
+
useCallback as useCallback10,
|
|
1220
|
+
useRef as useRef132,
|
|
1221
|
+
useMemo as useMemo14
|
|
1222
1222
|
} from "react";
|
|
1223
1223
|
|
|
1224
1224
|
// ../../node_modules/.pnpm/lucide-react@0.454.0_react@19.2.3/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
@@ -6136,7 +6136,9 @@ import { jsx as jsx17 } from "react/jsx-runtime";
|
|
|
6136
6136
|
import * as React211 from "react";
|
|
6137
6137
|
import { jsx as jsx23, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
6138
6138
|
import { jsx as jsx32, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6139
|
+
import * as React52 from "react";
|
|
6139
6140
|
import { useState as useState102, useEffect as useEffect62, useRef as useRef22 } from "react";
|
|
6141
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
6140
6142
|
|
|
6141
6143
|
// ../core/dist/index.mjs
|
|
6142
6144
|
import { useQuery } from "@tanstack/react-query";
|
|
@@ -6430,6 +6432,27 @@ async function getFiatCurrencies(publishableKey) {
|
|
|
6430
6432
|
}
|
|
6431
6433
|
return response.json();
|
|
6432
6434
|
}
|
|
6435
|
+
async function getFiatExchangeRates(options = {}, publishableKey) {
|
|
6436
|
+
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
6437
|
+
validatePublishableKey(pk);
|
|
6438
|
+
const params = new URLSearchParams();
|
|
6439
|
+
if (options.currencies && options.currencies.length > 0) {
|
|
6440
|
+
params.set("currencies", options.currencies.join(","));
|
|
6441
|
+
}
|
|
6442
|
+
const queryString = params.toString();
|
|
6443
|
+
const url = `${API_BASE_URL}/v1/public/exchange_rates/fiat_currencies${queryString ? `?${queryString}` : ""}`;
|
|
6444
|
+
const response = await fetch(url, {
|
|
6445
|
+
method: "GET",
|
|
6446
|
+
headers: {
|
|
6447
|
+
accept: "application/json",
|
|
6448
|
+
"x-publishable-key": pk
|
|
6449
|
+
}
|
|
6450
|
+
});
|
|
6451
|
+
if (!response.ok) {
|
|
6452
|
+
throw new Error(`Failed to fetch fiat exchange rates: ${response.statusText}`);
|
|
6453
|
+
}
|
|
6454
|
+
return response.json();
|
|
6455
|
+
}
|
|
6433
6456
|
async function getOnrampQuotes(request, publishableKey) {
|
|
6434
6457
|
const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
|
|
6435
6458
|
validatePublishableKey(pk);
|
|
@@ -7111,6 +7134,7 @@ async function stripeGetDefaultToken(params, publishableKey) {
|
|
|
7111
7134
|
chain_type: params.chainType
|
|
7112
7135
|
});
|
|
7113
7136
|
if (params.countryCode) query.append("country_code", params.countryCode);
|
|
7137
|
+
if (params.subdivisionCode) query.append("subdivision_code", params.subdivisionCode);
|
|
7114
7138
|
const response = await fetch(
|
|
7115
7139
|
`${API_BASE_URL}${HEADLESS_STRIPE_BASE}/default_token?${query.toString()}`,
|
|
7116
7140
|
{
|
|
@@ -7768,34 +7792,34 @@ import { jsx as jsx92, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
|
7768
7792
|
import { Fragment as Fragment23, jsx as jsx102, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
7769
7793
|
import { jsx as jsx112 } from "react/jsx-runtime";
|
|
7770
7794
|
import { jsx as jsx122, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
7771
|
-
import * as
|
|
7772
|
-
import { useCallback as
|
|
7773
|
-
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
7774
|
-
import { useMemo as useMemo22 } from "react";
|
|
7795
|
+
import * as React62 from "react";
|
|
7796
|
+
import { useCallback as useCallback22, useEffect as useEffect72, useMemo as useMemo42, useRef as useRef32, useState as useState112 } from "react";
|
|
7775
7797
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
7798
|
+
import { useMemo as useMemo32 } from "react";
|
|
7776
7799
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
7800
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
7777
7801
|
import { Fragment as Fragment42, jsx as jsx132, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
7778
7802
|
import { useState as useState122 } from "react";
|
|
7779
7803
|
import { jsx as jsx142, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
7780
|
-
import { useState as useState152, useEffect as useEffect102, useCallback as
|
|
7804
|
+
import { useState as useState152, useEffect as useEffect102, useCallback as useCallback32 } from "react";
|
|
7781
7805
|
var import_qr_code_styling = __toESM(require_qr_code_styling(), 1);
|
|
7782
|
-
import { useEffect as useEffect82, useRef as useRef42, useState as useState132, useMemo as
|
|
7806
|
+
import { useEffect as useEffect82, useRef as useRef42, useState as useState132, useMemo as useMemo52 } from "react";
|
|
7783
7807
|
import { jsx as jsx152, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
7784
7808
|
import { useState as useState142, useEffect as useEffect92 } from "react";
|
|
7785
|
-
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
7786
|
-
import { Fragment as Fragment52, jsx as jsx162, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7787
|
-
import { useEffect as useEffect112, useMemo as useMemo52, useState as useState162 } from "react";
|
|
7788
7809
|
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
7810
|
+
import { Fragment as Fragment52, jsx as jsx162, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
7811
|
+
import { useCallback as useCallback42, useEffect as useEffect112, useMemo as useMemo62, useRef as useRef52, useState as useState162 } from "react";
|
|
7812
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
7789
7813
|
import { jsx as jsx172, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
7790
7814
|
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
7791
|
-
import * as React62 from "react";
|
|
7792
|
-
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7793
7815
|
import * as React72 from "react";
|
|
7794
|
-
import { jsx as
|
|
7816
|
+
import { jsx as jsx19, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7795
7817
|
import * as React82 from "react";
|
|
7818
|
+
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7819
|
+
import * as React92 from "react";
|
|
7796
7820
|
import { jsx as jsx21, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7821
|
+
import * as React112 from "react";
|
|
7797
7822
|
import * as React102 from "react";
|
|
7798
|
-
import * as React92 from "react";
|
|
7799
7823
|
|
|
7800
7824
|
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.4_@types+react@19.2.9_react@19.2.3/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
7801
7825
|
import * as React25 from "react";
|
|
@@ -7943,15 +7967,15 @@ var cva = (base, config) => (props) => {
|
|
|
7943
7967
|
// ../ui-react/dist/index.mjs
|
|
7944
7968
|
import { jsx as jsx222 } from "react/jsx-runtime";
|
|
7945
7969
|
import { jsx as jsx232, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7946
|
-
import * as React112 from "react";
|
|
7947
|
-
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7948
7970
|
import * as React122 from "react";
|
|
7949
|
-
import { jsx as
|
|
7971
|
+
import { jsx as jsx24, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7950
7972
|
import * as React132 from "react";
|
|
7951
|
-
import { jsx as
|
|
7973
|
+
import { jsx as jsx25, jsxs as jsxs222 } from "react/jsx-runtime";
|
|
7952
7974
|
import * as React142 from "react";
|
|
7975
|
+
import { jsx as jsx26, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
7976
|
+
import * as React152 from "react";
|
|
7953
7977
|
import { jsx as jsx27, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
7954
|
-
import * as
|
|
7978
|
+
import * as React292 from "react";
|
|
7955
7979
|
|
|
7956
7980
|
// ../../node_modules/.pnpm/mipd@0.0.7_typescript@5.9.3/node_modules/mipd/dist/esm/utils.js
|
|
7957
7981
|
function requestProviders(listener) {
|
|
@@ -8008,54 +8032,54 @@ function createStore() {
|
|
|
8008
8032
|
}
|
|
8009
8033
|
|
|
8010
8034
|
// ../ui-react/dist/index.mjs
|
|
8011
|
-
import * as React152 from "react";
|
|
8012
8035
|
import * as React162 from "react";
|
|
8013
|
-
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8014
8036
|
import * as React172 from "react";
|
|
8015
|
-
import { jsx as
|
|
8037
|
+
import { jsx as jsx28, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8016
8038
|
import * as React182 from "react";
|
|
8017
|
-
import { jsx as
|
|
8039
|
+
import { jsx as jsx29, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8018
8040
|
import * as React192 from "react";
|
|
8019
|
-
import { jsx as
|
|
8041
|
+
import { jsx as jsx30, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8020
8042
|
import * as React202 from "react";
|
|
8021
|
-
import { jsx as
|
|
8043
|
+
import { jsx as jsx31, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8022
8044
|
import * as React212 from "react";
|
|
8023
|
-
import { jsx as
|
|
8045
|
+
import { jsx as jsx322, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8024
8046
|
import * as React222 from "react";
|
|
8025
|
-
import { jsx as
|
|
8047
|
+
import { jsx as jsx33, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8026
8048
|
import * as React232 from "react";
|
|
8027
|
-
import { jsx as
|
|
8049
|
+
import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8028
8050
|
import * as React242 from "react";
|
|
8029
|
-
import { jsx as
|
|
8051
|
+
import { jsx as jsx35, jsxs as jsxs322 } from "react/jsx-runtime";
|
|
8030
8052
|
import * as React252 from "react";
|
|
8031
|
-
import { jsx as
|
|
8053
|
+
import { jsx as jsx36, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
8032
8054
|
import * as React262 from "react";
|
|
8033
|
-
import { jsx as
|
|
8055
|
+
import { jsx as jsx37, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
8034
8056
|
import * as React272 from "react";
|
|
8057
|
+
import { jsx as jsx38, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
8058
|
+
import * as React282 from "react";
|
|
8035
8059
|
import { jsx as jsx39, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
8036
8060
|
import { jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
8037
8061
|
import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
8038
|
-
import * as
|
|
8062
|
+
import * as React302 from "react";
|
|
8039
8063
|
import { jsx as jsx422, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
8040
|
-
import { useState as useState292, useEffect as useEffect242, useCallback as
|
|
8064
|
+
import { useState as useState292, useEffect as useEffect242, useCallback as useCallback62, useRef as useRef92 } from "react";
|
|
8041
8065
|
import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
8042
|
-
import { useState as useState282, useEffect as useEffect232, useRef as
|
|
8066
|
+
import { useState as useState282, useEffect as useEffect232, useRef as useRef82, useCallback as useCallback52 } from "react";
|
|
8043
8067
|
import { Fragment as Fragment62, jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
8044
|
-
import { useState as useState30, useEffect as useEffect252, useCallback as
|
|
8045
|
-
import { useQuery as
|
|
8046
|
-
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
8068
|
+
import { useState as useState30, useEffect as useEffect252, useCallback as useCallback72, useMemo as useMemo82, useRef as useRef102 } from "react";
|
|
8069
|
+
import { useQuery as useQuery9, keepPreviousData } from "@tanstack/react-query";
|
|
8047
8070
|
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
8048
|
-
import { Fragment as Fragment72, jsx as jsx45, jsxs as jsxs422 } from "react/jsx-runtime";
|
|
8049
8071
|
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
8072
|
+
import { Fragment as Fragment72, jsx as jsx45, jsxs as jsxs422 } from "react/jsx-runtime";
|
|
8050
8073
|
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
8051
8074
|
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
8052
|
-
import {
|
|
8075
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
8076
|
+
import { useState as useState36, useEffect as useEffect302, useMemo as useMemo112 } from "react";
|
|
8053
8077
|
import { useEffect as useEffect272, useState as useState31 } from "react";
|
|
8054
|
-
import * as
|
|
8078
|
+
import * as React322 from "react";
|
|
8055
8079
|
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
8056
8080
|
import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
8057
8081
|
import { Fragment as Fragment82, jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
8058
|
-
import { useState as useState322, useMemo as
|
|
8082
|
+
import { useState as useState322, useMemo as useMemo102, useEffect as useEffect282 } from "react";
|
|
8059
8083
|
|
|
8060
8084
|
// ../../node_modules/.pnpm/fuse.js@7.4.0/node_modules/fuse.js/dist/fuse.mjs
|
|
8061
8085
|
function isArray(value) {
|
|
@@ -10057,11 +10081,11 @@ Fuse.use = function(...plugins) {
|
|
|
10057
10081
|
|
|
10058
10082
|
// ../ui-react/dist/index.mjs
|
|
10059
10083
|
import { jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
10060
|
-
import { useState as useState33, useEffect as useEffect292, useRef as
|
|
10084
|
+
import { useState as useState33, useEffect as useEffect292, useRef as useRef112 } from "react";
|
|
10061
10085
|
import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
10062
10086
|
import { Fragment as Fragment92, jsx as jsx51, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10063
10087
|
import { useState as useState34 } from "react";
|
|
10064
|
-
import * as
|
|
10088
|
+
import * as React332 from "react";
|
|
10065
10089
|
|
|
10066
10090
|
// ../../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
|
|
10067
10091
|
import * as React31 from "react";
|
|
@@ -12799,11 +12823,11 @@ var Content22 = TooltipContent;
|
|
|
12799
12823
|
|
|
12800
12824
|
// ../ui-react/dist/index.mjs
|
|
12801
12825
|
import { jsx as jsx522 } from "react/jsx-runtime";
|
|
12802
|
-
import { useQuery as
|
|
12826
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
12803
12827
|
import { jsx as jsx53, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
12804
12828
|
import { Fragment as Fragment10, jsx as jsx54, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
12805
|
-
import { useState as useState37, useEffect as useEffect312, useMemo as
|
|
12806
|
-
import * as
|
|
12829
|
+
import { useState as useState37, useEffect as useEffect312, useMemo as useMemo122 } from "react";
|
|
12830
|
+
import * as React342 from "react";
|
|
12807
12831
|
|
|
12808
12832
|
// ../../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
|
|
12809
12833
|
import * as React35 from "react";
|
|
@@ -14040,9 +14064,9 @@ var Separator = SelectSeparator;
|
|
|
14040
14064
|
// ../ui-react/dist/index.mjs
|
|
14041
14065
|
import { jsx as jsx55, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
14042
14066
|
import { jsx as jsx56, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
14043
|
-
import * as
|
|
14044
|
-
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
14067
|
+
import * as React352 from "react";
|
|
14045
14068
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
14069
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
14046
14070
|
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
14047
14071
|
import { jsx as jsx58, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
14048
14072
|
import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
@@ -14051,26 +14075,26 @@ import { useEffect as useEffect322, useState as useState382 } from "react";
|
|
|
14051
14075
|
import { Fragment as Fragment13, jsx as jsx61, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
14052
14076
|
import { jsx as jsx622, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
14053
14077
|
import { Fragment as Fragment14, jsx as jsx63, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
14054
|
-
import { useState as useState41, useEffect as useEffect35, useLayoutEffect as useLayoutEffect32, useCallback as
|
|
14055
|
-
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
14056
|
-
import { Fragment as Fragment15, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14057
|
-
import { useState as useState45, useEffect as useEffect39, useLayoutEffect as useLayoutEffect42, useCallback as useCallback112, useRef as useRef152 } from "react";
|
|
14078
|
+
import { useState as useState41, useEffect as useEffect35, useLayoutEffect as useLayoutEffect32, useCallback as useCallback112, useRef as useRef142, useMemo as useMemo152 } from "react";
|
|
14058
14079
|
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
14080
|
+
import { Fragment as Fragment15, jsx as jsx64, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
14081
|
+
import { useState as useState45, useEffect as useEffect39, useLayoutEffect as useLayoutEffect42, useCallback as useCallback132, useRef as useRef162 } from "react";
|
|
14059
14082
|
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
14060
14083
|
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
14061
14084
|
import { useQuery as useQuery21 } from "@tanstack/react-query";
|
|
14062
|
-
import { useState as useState42, useEffect as useEffect36, useRef as useRef142 } from "react";
|
|
14063
|
-
import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
14064
|
-
import { useState as useState43, useCallback as useCallback102, useMemo as useMemo16, useEffect as useEffect37 } from "react";
|
|
14065
14085
|
import { useQuery as useQuery222 } from "@tanstack/react-query";
|
|
14066
|
-
import {
|
|
14086
|
+
import { useState as useState42, useEffect as useEffect36, useRef as useRef152 } from "react";
|
|
14087
|
+
import { jsx as jsx65, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
14088
|
+
import { useState as useState43, useCallback as useCallback122, useMemo as useMemo17, useEffect as useEffect37 } from "react";
|
|
14067
14089
|
import { useQuery as useQuery23 } from "@tanstack/react-query";
|
|
14090
|
+
import { useMemo as useMemo16 } from "react";
|
|
14091
|
+
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
14068
14092
|
import { Fragment as Fragment16, jsx as jsx66, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
14069
14093
|
import { jsx as jsx67, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
14070
14094
|
import { useState as useState44, useEffect as useEffect38 } from "react";
|
|
14071
14095
|
import { Fragment as Fragment17, jsx as jsx68, jsxs as jsxs62 } from "react/jsx-runtime";
|
|
14072
14096
|
import { Fragment as Fragment18, jsx as jsx69, jsxs as jsxs63 } from "react/jsx-runtime";
|
|
14073
|
-
import { useState as useState46, useMemo as
|
|
14097
|
+
import { useState as useState46, useMemo as useMemo18 } from "react";
|
|
14074
14098
|
import { jsx as jsx70, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
14075
14099
|
function cn(...inputs) {
|
|
14076
14100
|
return twMerge(clsx(inputs));
|
|
@@ -16522,13 +16546,25 @@ function BuyWithCard({
|
|
|
16522
16546
|
wallets: externalWallets,
|
|
16523
16547
|
assetCdnUrl,
|
|
16524
16548
|
hideDepositFlowInfo = false,
|
|
16525
|
-
hideDisplayDescription = false
|
|
16549
|
+
hideDisplayDescription = false,
|
|
16550
|
+
prefilledAmountUsd
|
|
16526
16551
|
}) {
|
|
16527
16552
|
const { colors: colors2, fonts, components } = useTheme();
|
|
16528
|
-
const
|
|
16553
|
+
const cleanedPrefilledAmountUsd = React52.useMemo(() => {
|
|
16554
|
+
if (!prefilledAmountUsd) return "";
|
|
16555
|
+
return prefilledAmountUsd.replace(/[^0-9.]/g, "");
|
|
16556
|
+
}, [prefilledAmountUsd]);
|
|
16557
|
+
const parsedPrefilledAmountUsd = React52.useMemo(() => {
|
|
16558
|
+
const parsed = parseFloat(cleanedPrefilledAmountUsd);
|
|
16559
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : null;
|
|
16560
|
+
}, [cleanedPrefilledAmountUsd]);
|
|
16561
|
+
const shouldAutoConvertPrefilledRef = useRef22(!!cleanedPrefilledAmountUsd);
|
|
16562
|
+
const [amount, setAmount] = useState102(() => cleanedPrefilledAmountUsd);
|
|
16529
16563
|
const [currency, setCurrency] = useState102("usd");
|
|
16530
16564
|
const [hasManualCurrencySelection, setHasManualCurrencySelection] = useState102(false);
|
|
16531
|
-
const [hasManualAmountEntry, setHasManualAmountEntry] = useState102(
|
|
16565
|
+
const [hasManualAmountEntry, setHasManualAmountEntry] = useState102(
|
|
16566
|
+
() => !!cleanedPrefilledAmountUsd
|
|
16567
|
+
);
|
|
16532
16568
|
const [showCurrencyModal, setShowCurrencyModal] = useState102(false);
|
|
16533
16569
|
const [quotes, setQuotes] = useState102([]);
|
|
16534
16570
|
const [quotesLoading, setQuotesLoading] = useState102(false);
|
|
@@ -16585,6 +16621,71 @@ function BuyWithCard({
|
|
|
16585
16621
|
const [preferredCurrencyCodes, setPreferredCurrencyCodes] = useState102([]);
|
|
16586
16622
|
const [currenciesLoading, setCurrenciesLoading] = useState102(true);
|
|
16587
16623
|
const [destinationToken, setDestinationToken] = useState102(null);
|
|
16624
|
+
useEffect62(() => {
|
|
16625
|
+
const hasPrefilledAmount = !!cleanedPrefilledAmountUsd;
|
|
16626
|
+
shouldAutoConvertPrefilledRef.current = hasPrefilledAmount;
|
|
16627
|
+
if (!hasPrefilledAmount) return;
|
|
16628
|
+
setAmount(cleanedPrefilledAmountUsd);
|
|
16629
|
+
setHasManualAmountEntry(true);
|
|
16630
|
+
}, [cleanedPrefilledAmountUsd]);
|
|
16631
|
+
const { data: fiatExchangeRatesResponse, isLoading: isFiatExchangeRatesLoading } = useQuery3({
|
|
16632
|
+
queryKey: ["fiat-exchange-rates", publishableKey],
|
|
16633
|
+
staleTime: 3e4,
|
|
16634
|
+
refetchInterval: 3e4,
|
|
16635
|
+
queryFn: async () => {
|
|
16636
|
+
try {
|
|
16637
|
+
return await getFiatExchangeRates({}, publishableKey);
|
|
16638
|
+
} catch (error) {
|
|
16639
|
+
console.error("Error fetching fiat exchange rates:", error);
|
|
16640
|
+
return { base_currency: "usd", rates: {} };
|
|
16641
|
+
}
|
|
16642
|
+
}
|
|
16643
|
+
});
|
|
16644
|
+
const fiatExchangeRates = fiatExchangeRatesResponse?.rates ?? {};
|
|
16645
|
+
const convertAmountBetweenCurrencies = React52.useCallback(
|
|
16646
|
+
(rawAmount, fromCurrencyCode, toCurrencyCode) => {
|
|
16647
|
+
const parsedAmount = parseFloat(rawAmount);
|
|
16648
|
+
if (!Number.isFinite(parsedAmount) || parsedAmount <= 0) return null;
|
|
16649
|
+
const fromCode = fromCurrencyCode.toLowerCase();
|
|
16650
|
+
const toCode = toCurrencyCode.toLowerCase();
|
|
16651
|
+
const fromRate = fromCode === "usd" ? 1 : fiatExchangeRates[fromCode];
|
|
16652
|
+
const toRate = toCode === "usd" ? 1 : fiatExchangeRates[toCode];
|
|
16653
|
+
if (!Number.isFinite(fromRate) || fromRate <= 0) return null;
|
|
16654
|
+
if (!Number.isFinite(toRate) || toRate <= 0) return null;
|
|
16655
|
+
const usdAmount = parsedAmount / fromRate;
|
|
16656
|
+
return parseFloat((usdAmount * toRate).toFixed(2)).toString();
|
|
16657
|
+
},
|
|
16658
|
+
[fiatExchangeRates]
|
|
16659
|
+
);
|
|
16660
|
+
const getConvertedPrefilledAmount = React52.useCallback(
|
|
16661
|
+
(targetCurrencyCode) => {
|
|
16662
|
+
if (!parsedPrefilledAmountUsd) return null;
|
|
16663
|
+
const normalizedTargetCurrency = targetCurrencyCode.toLowerCase();
|
|
16664
|
+
const rate = normalizedTargetCurrency === "usd" ? 1 : fiatExchangeRates[normalizedTargetCurrency];
|
|
16665
|
+
if (!Number.isFinite(rate) || rate <= 0) return null;
|
|
16666
|
+
return parseFloat((parsedPrefilledAmountUsd * rate).toFixed(2)).toString();
|
|
16667
|
+
},
|
|
16668
|
+
[parsedPrefilledAmountUsd, fiatExchangeRates]
|
|
16669
|
+
);
|
|
16670
|
+
useEffect62(() => {
|
|
16671
|
+
if (!cleanedPrefilledAmountUsd || !shouldAutoConvertPrefilledRef.current) return;
|
|
16672
|
+
const convertedAmount = getConvertedPrefilledAmount(currency);
|
|
16673
|
+
if (!convertedAmount) {
|
|
16674
|
+
if (isFiatExchangeRatesLoading) return;
|
|
16675
|
+
const targetCurrency = currency.toLowerCase();
|
|
16676
|
+
if (targetCurrency !== "usd") {
|
|
16677
|
+
setCurrency("usd");
|
|
16678
|
+
}
|
|
16679
|
+
return;
|
|
16680
|
+
}
|
|
16681
|
+
setAmount(convertedAmount);
|
|
16682
|
+
setHasManualAmountEntry(true);
|
|
16683
|
+
}, [
|
|
16684
|
+
cleanedPrefilledAmountUsd,
|
|
16685
|
+
currency,
|
|
16686
|
+
getConvertedPrefilledAmount,
|
|
16687
|
+
isFiatExchangeRatesLoading
|
|
16688
|
+
]);
|
|
16588
16689
|
const depositWalletId = defaultToken ? getWalletByChainType(wallets, defaultToken.destination_token_metadata.chain_type)?.id : void 0;
|
|
16589
16690
|
const { executions, isPolling, showWaitingUi } = useDepositPolling({
|
|
16590
16691
|
userId,
|
|
@@ -16615,6 +16716,7 @@ function BuyWithCard({
|
|
|
16615
16716
|
}, [publishableKey]);
|
|
16616
16717
|
useEffect62(() => {
|
|
16617
16718
|
if (hasManualCurrencySelection) return;
|
|
16719
|
+
if (hasManualAmountEntry && !shouldAutoConvertPrefilledRef.current) return;
|
|
16618
16720
|
if (fiatCurrencies.length === 0 || !userIpInfo?.alpha2) return;
|
|
16619
16721
|
const userCountryCode = userIpInfo.alpha2;
|
|
16620
16722
|
const matchingCurrency = fiatCurrencies.find((c) => c.country_codes.includes(userCountryCode));
|
|
@@ -16633,7 +16735,15 @@ function BuyWithCard({
|
|
|
16633
16735
|
const prevCurrencyRef = useRef22(null);
|
|
16634
16736
|
useEffect62(() => {
|
|
16635
16737
|
if (fiatCurrencies.length === 0) return;
|
|
16738
|
+
if (shouldAutoConvertPrefilledRef.current) {
|
|
16739
|
+
prevCurrencyRef.current = currency;
|
|
16740
|
+
return;
|
|
16741
|
+
}
|
|
16636
16742
|
if (prevCurrencyRef.current !== null && prevCurrencyRef.current !== currency) {
|
|
16743
|
+
if (hasManualAmountEntry) {
|
|
16744
|
+
prevCurrencyRef.current = currency;
|
|
16745
|
+
return;
|
|
16746
|
+
}
|
|
16637
16747
|
const currentCurrency = fiatCurrencies.find(
|
|
16638
16748
|
(c) => c.currency_code.toLowerCase() === currency.toLowerCase()
|
|
16639
16749
|
);
|
|
@@ -16642,7 +16752,7 @@ function BuyWithCard({
|
|
|
16642
16752
|
}
|
|
16643
16753
|
}
|
|
16644
16754
|
prevCurrencyRef.current = currency;
|
|
16645
|
-
}, [currency]);
|
|
16755
|
+
}, [currency, fiatCurrencies, hasManualAmountEntry]);
|
|
16646
16756
|
useEffect62(() => {
|
|
16647
16757
|
async function fetchDestinationToken() {
|
|
16648
16758
|
try {
|
|
@@ -16819,6 +16929,7 @@ function BuyWithCard({
|
|
|
16819
16929
|
return () => clearInterval(timer);
|
|
16820
16930
|
}, [quotes.length, amount]);
|
|
16821
16931
|
const handleAmountChange = (value) => {
|
|
16932
|
+
shouldAutoConvertPrefilledRef.current = false;
|
|
16822
16933
|
if (value === "") {
|
|
16823
16934
|
setAmount(value);
|
|
16824
16935
|
setHasManualAmountEntry(true);
|
|
@@ -16832,6 +16943,7 @@ function BuyWithCard({
|
|
|
16832
16943
|
}
|
|
16833
16944
|
};
|
|
16834
16945
|
const handleQuickAmount = (quickAmount) => {
|
|
16946
|
+
shouldAutoConvertPrefilledRef.current = false;
|
|
16835
16947
|
setAmount(quickAmount.toString());
|
|
16836
16948
|
setHasManualAmountEntry(true);
|
|
16837
16949
|
};
|
|
@@ -17435,8 +17547,43 @@ function BuyWithCard({
|
|
|
17435
17547
|
preferredCurrencyCodes,
|
|
17436
17548
|
selectedCurrency: currency,
|
|
17437
17549
|
onSelectCurrency: (currencyCode) => {
|
|
17438
|
-
|
|
17550
|
+
const nextCurrency = currencyCode.toLowerCase();
|
|
17551
|
+
if (nextCurrency === currency.toLowerCase()) {
|
|
17552
|
+
setHasManualCurrencySelection(true);
|
|
17553
|
+
return;
|
|
17554
|
+
}
|
|
17555
|
+
const currentCurrency = currency;
|
|
17439
17556
|
setHasManualCurrencySelection(true);
|
|
17557
|
+
if (shouldAutoConvertPrefilledRef.current) {
|
|
17558
|
+
const convertedAmount = getConvertedPrefilledAmount(nextCurrency);
|
|
17559
|
+
if (convertedAmount) {
|
|
17560
|
+
setCurrency(nextCurrency);
|
|
17561
|
+
setAmount(convertedAmount);
|
|
17562
|
+
setHasManualAmountEntry(true);
|
|
17563
|
+
} else {
|
|
17564
|
+
if (isFiatExchangeRatesLoading) return;
|
|
17565
|
+
const fallbackUsdAmount = getConvertedPrefilledAmount("usd");
|
|
17566
|
+
setCurrency("usd");
|
|
17567
|
+
if (fallbackUsdAmount) {
|
|
17568
|
+
setAmount(fallbackUsdAmount);
|
|
17569
|
+
setHasManualAmountEntry(true);
|
|
17570
|
+
}
|
|
17571
|
+
}
|
|
17572
|
+
return;
|
|
17573
|
+
}
|
|
17574
|
+
if (hasManualAmountEntry && amount) {
|
|
17575
|
+
const convertedAmount = convertAmountBetweenCurrencies(
|
|
17576
|
+
amount,
|
|
17577
|
+
currentCurrency,
|
|
17578
|
+
nextCurrency
|
|
17579
|
+
);
|
|
17580
|
+
if (convertedAmount) {
|
|
17581
|
+
setCurrency(nextCurrency);
|
|
17582
|
+
setAmount(convertedAmount);
|
|
17583
|
+
}
|
|
17584
|
+
return;
|
|
17585
|
+
}
|
|
17586
|
+
setCurrency(nextCurrency);
|
|
17440
17587
|
},
|
|
17441
17588
|
themeClass
|
|
17442
17589
|
}
|
|
@@ -17489,7 +17636,7 @@ function useCoinbaseLegalAgreements({
|
|
|
17489
17636
|
publishableKey,
|
|
17490
17637
|
enabled = true
|
|
17491
17638
|
}) {
|
|
17492
|
-
return
|
|
17639
|
+
return useQuery4({
|
|
17493
17640
|
queryKey: ["unifold", "coinbaseLegalAgreements", publishableKey],
|
|
17494
17641
|
queryFn: () => getCoinbaseLegalAgreements(publishableKey),
|
|
17495
17642
|
enabled: enabled && !!publishableKey,
|
|
@@ -17507,7 +17654,7 @@ function useApplePayLimits({
|
|
|
17507
17654
|
enabled = true
|
|
17508
17655
|
}) {
|
|
17509
17656
|
const phoneValid = US_E164_REGEX.test(phone);
|
|
17510
|
-
return
|
|
17657
|
+
return useQuery5({
|
|
17511
17658
|
queryKey: ["unifold", "applePayLimits", phone, publishableKey],
|
|
17512
17659
|
queryFn: ({ signal }) => getCoinbaseApplePayLimits(phone, publishableKey, signal),
|
|
17513
17660
|
enabled: enabled && phoneValid && !!publishableKey,
|
|
@@ -17546,7 +17693,7 @@ function useApplePayInitialScreen({
|
|
|
17546
17693
|
sessionPhoneVerified,
|
|
17547
17694
|
isWaiting
|
|
17548
17695
|
}) {
|
|
17549
|
-
const initialStoredSession =
|
|
17696
|
+
const initialStoredSession = useMemo32(() => getStoredApplePaySession(userId), [userId]);
|
|
17550
17697
|
const phoneVerified = PHONE_REGEX.test(normalizedPhone) && (sessionPhoneVerified || initialStoredSession?.phone === normalizedPhone && !!initialStoredSession?.phoneVerifiedAt);
|
|
17551
17698
|
const {
|
|
17552
17699
|
data: applePayLimits,
|
|
@@ -17557,7 +17704,7 @@ function useApplePayInitialScreen({
|
|
|
17557
17704
|
publishableKey,
|
|
17558
17705
|
enabled: phoneVerified
|
|
17559
17706
|
});
|
|
17560
|
-
const action =
|
|
17707
|
+
const action = useMemo32(() => {
|
|
17561
17708
|
if (isWaiting || applePayLimitsLoading) return { kind: "pending" };
|
|
17562
17709
|
const stored = initialStoredSession;
|
|
17563
17710
|
const hasUserEmail = !!userEmail && EMAIL_REGEX.test(userEmail);
|
|
@@ -17607,7 +17754,7 @@ function useDefaultOnrampToken({
|
|
|
17607
17754
|
isLoading,
|
|
17608
17755
|
isError,
|
|
17609
17756
|
error
|
|
17610
|
-
} =
|
|
17757
|
+
} = useQuery6({
|
|
17611
17758
|
queryKey: [
|
|
17612
17759
|
"unifold",
|
|
17613
17760
|
"defaultOnrampToken",
|
|
@@ -17681,7 +17828,7 @@ function parseCoinbasePostMessage(raw) {
|
|
|
17681
17828
|
} : void 0
|
|
17682
17829
|
};
|
|
17683
17830
|
}
|
|
17684
|
-
var BuyWithApplePay =
|
|
17831
|
+
var BuyWithApplePay = React62.forwardRef(
|
|
17685
17832
|
function BuyWithApplePay2({
|
|
17686
17833
|
userId,
|
|
17687
17834
|
publishableKey,
|
|
@@ -17752,7 +17899,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
17752
17899
|
countryCode: userIpInfo?.alpha2,
|
|
17753
17900
|
subdivisionCode: userIpInfo?.subdivisionCode ?? void 0
|
|
17754
17901
|
});
|
|
17755
|
-
const depositWallet =
|
|
17902
|
+
const depositWallet = useMemo42(() => {
|
|
17756
17903
|
const routingChainType = defaultToken?.destination_token_metadata?.chain_type;
|
|
17757
17904
|
if (!routingChainType) return void 0;
|
|
17758
17905
|
return getWalletByChainType(depositWallets ?? [], routingChainType);
|
|
@@ -17840,7 +17987,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
17840
17987
|
popupRef.current = null;
|
|
17841
17988
|
};
|
|
17842
17989
|
}, []);
|
|
17843
|
-
|
|
17990
|
+
React62.useImperativeHandle(
|
|
17844
17991
|
ref,
|
|
17845
17992
|
() => ({
|
|
17846
17993
|
requestBack: () => {
|
|
@@ -17882,9 +18029,9 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
17882
18029
|
}),
|
|
17883
18030
|
[view, emailLocked]
|
|
17884
18031
|
);
|
|
17885
|
-
const normalizedPhone =
|
|
18032
|
+
const normalizedPhone = useMemo42(() => formatPhoneInput(phoneInput), [phoneInput]);
|
|
17886
18033
|
const isContactValid = EMAIL_REGEX2.test(email) && PHONE_REGEX2.test(normalizedPhone);
|
|
17887
|
-
const storeApplePaySession =
|
|
18034
|
+
const storeApplePaySession = useCallback22(
|
|
17888
18035
|
(patch = {}) => {
|
|
17889
18036
|
const session = {
|
|
17890
18037
|
email,
|
|
@@ -17896,7 +18043,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
17896
18043
|
},
|
|
17897
18044
|
[email, normalizedPhone, userId]
|
|
17898
18045
|
);
|
|
17899
|
-
const createSessionAndSendOtp =
|
|
18046
|
+
const createSessionAndSendOtp = useCallback22(async () => {
|
|
17900
18047
|
setView("submitting_session");
|
|
17901
18048
|
setErrorMessage("");
|
|
17902
18049
|
try {
|
|
@@ -17924,7 +18071,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
17924
18071
|
setView("phone_input");
|
|
17925
18072
|
}
|
|
17926
18073
|
}, [email, normalizedPhone, publishableKey, storeApplePaySession]);
|
|
17927
|
-
const clearUpgradeFields =
|
|
18074
|
+
const clearUpgradeFields = useCallback22(() => {
|
|
17928
18075
|
setSsnLast4("");
|
|
17929
18076
|
setDobInput("");
|
|
17930
18077
|
}, []);
|
|
@@ -17936,7 +18083,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
17936
18083
|
sessionPhoneVerified: verificationSession?.phone?.status === "verified",
|
|
17937
18084
|
isWaiting: defaultTokenLoading || legalAgreementsLoading || userIpInfoLoading
|
|
17938
18085
|
});
|
|
17939
|
-
const pollLimitUpgradeStatus =
|
|
18086
|
+
const pollLimitUpgradeStatus = useCallback22(
|
|
17940
18087
|
async (signal) => {
|
|
17941
18088
|
const POLL_INTERVAL_MS4 = 1500;
|
|
17942
18089
|
const POLL_TIMEOUT_MS = 3e4;
|
|
@@ -17998,7 +18145,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
17998
18145
|
clearUpgradeFields
|
|
17999
18146
|
]
|
|
18000
18147
|
);
|
|
18001
|
-
const startUpgradePolling =
|
|
18148
|
+
const startUpgradePolling = useCallback22(async () => {
|
|
18002
18149
|
upgradeFlowAbortRef.current?.abort();
|
|
18003
18150
|
const controller = new AbortController();
|
|
18004
18151
|
upgradeFlowAbortRef.current = controller;
|
|
@@ -18010,7 +18157,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
18010
18157
|
}
|
|
18011
18158
|
}
|
|
18012
18159
|
}, [pollLimitUpgradeStatus]);
|
|
18013
|
-
const applyLimitRouting =
|
|
18160
|
+
const applyLimitRouting = useCallback22(
|
|
18014
18161
|
(nextView, status) => {
|
|
18015
18162
|
if (nextView === "limit_upgrade_form" && status === "resubmit") {
|
|
18016
18163
|
setLimitUpgradeError(
|
|
@@ -18047,11 +18194,11 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
18047
18194
|
break;
|
|
18048
18195
|
}
|
|
18049
18196
|
}, [initialAction, applyLimitRouting, createSessionAndSendOtp]);
|
|
18050
|
-
const startVerification =
|
|
18197
|
+
const startVerification = useCallback22(async () => {
|
|
18051
18198
|
if (!isContactValid) return;
|
|
18052
18199
|
await createSessionAndSendOtp();
|
|
18053
18200
|
}, [isContactValid, createSessionAndSendOtp]);
|
|
18054
|
-
const submitLimitUpgrade =
|
|
18201
|
+
const submitLimitUpgrade = useCallback22(async () => {
|
|
18055
18202
|
if (upgradeSubmitting) return;
|
|
18056
18203
|
try {
|
|
18057
18204
|
const dob = parseDobInput(dobInput);
|
|
@@ -18101,7 +18248,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
18101
18248
|
startUpgradePolling,
|
|
18102
18249
|
clearUpgradeFields
|
|
18103
18250
|
]);
|
|
18104
|
-
const submitPhoneOtp =
|
|
18251
|
+
const submitPhoneOtp = useCallback22(async () => {
|
|
18105
18252
|
if (!verificationSession || !clientSecret || phoneCode.length !== 6) return;
|
|
18106
18253
|
if (otpSubmitting) return;
|
|
18107
18254
|
setOtpError(null);
|
|
@@ -18169,7 +18316,7 @@ var BuyWithApplePay = React52.forwardRef(
|
|
|
18169
18316
|
getViewForLimitStatus,
|
|
18170
18317
|
applyLimitRouting
|
|
18171
18318
|
]);
|
|
18172
|
-
const prepareSession =
|
|
18319
|
+
const prepareSession = useCallback22(
|
|
18173
18320
|
async (token, amt) => {
|
|
18174
18321
|
setErrorMessage("");
|
|
18175
18322
|
if (!destinationChainType || !destinationChainId) {
|
|
@@ -19150,7 +19297,7 @@ function LegalDisclaimer({ legalAgreements, loading }) {
|
|
|
19150
19297
|
children: [
|
|
19151
19298
|
"By continuing, you agree to Coinbase's",
|
|
19152
19299
|
" ",
|
|
19153
|
-
agreements.map((a, idx, arr) => /* @__PURE__ */ jsxs11(
|
|
19300
|
+
agreements.map((a, idx, arr) => /* @__PURE__ */ jsxs11(React62.Fragment, { children: [
|
|
19154
19301
|
/* @__PURE__ */ jsx132(
|
|
19155
19302
|
"a",
|
|
19156
19303
|
{
|
|
@@ -19466,7 +19613,7 @@ function QRCodeSkeleton({ size: size4 = 180, darkMode = false }) {
|
|
|
19466
19613
|
const spacing = size4 / gridCount;
|
|
19467
19614
|
const fillColor = darkMode ? "rgba(255,255,255,0.10)" : "rgba(0,0,0,0.08)";
|
|
19468
19615
|
const cornerColor = darkMode ? "rgba(255,255,255,0.14)" : "rgba(0,0,0,0.12)";
|
|
19469
|
-
const dots =
|
|
19616
|
+
const dots = useMemo52(() => {
|
|
19470
19617
|
const result = [];
|
|
19471
19618
|
const cornerSize = 7;
|
|
19472
19619
|
const centerStart = Math.floor(gridCount / 2) - 2;
|
|
@@ -19566,7 +19713,7 @@ function useIsMobileViewport() {
|
|
|
19566
19713
|
return isMobile;
|
|
19567
19714
|
}
|
|
19568
19715
|
function useCashAppLimits({ publishableKey, currency = "usd" }) {
|
|
19569
|
-
return
|
|
19716
|
+
return useQuery7({
|
|
19570
19717
|
queryKey: ["unifold", "cashAppLimits", currency, publishableKey],
|
|
19571
19718
|
queryFn: () => getCashAppLimits(currency, publishableKey),
|
|
19572
19719
|
enabled: !!publishableKey,
|
|
@@ -19579,6 +19726,7 @@ var POLL_INTERVAL_MS2 = 5e3;
|
|
|
19579
19726
|
var FALLBACK_MIN_USD = 5;
|
|
19580
19727
|
var SUGGESTED_AMOUNTS = [25, 50, 100];
|
|
19581
19728
|
var t3 = i18n2.depositModal.cashApp;
|
|
19729
|
+
var sanitizePrefilledUsd = (value) => value?.replace(/[^0-9.]/g, "") ?? "";
|
|
19582
19730
|
function PayWithCashApp({
|
|
19583
19731
|
userId,
|
|
19584
19732
|
publishableKey,
|
|
@@ -19593,6 +19741,7 @@ function PayWithCashApp({
|
|
|
19593
19741
|
onEvent,
|
|
19594
19742
|
onDepositSuccess,
|
|
19595
19743
|
onDepositError,
|
|
19744
|
+
prefilledAmountUsd,
|
|
19596
19745
|
wallets = []
|
|
19597
19746
|
}) {
|
|
19598
19747
|
const { colors: colors2, fonts, components } = useTheme();
|
|
@@ -19608,14 +19757,14 @@ function PayWithCashApp({
|
|
|
19608
19757
|
const { data: limits, isLoading: limitsLoading } = useCashAppLimits({ publishableKey });
|
|
19609
19758
|
const minUsd = limits?.minimum_amount ?? FALLBACK_MIN_USD;
|
|
19610
19759
|
const maxUsd = limits?.maximum_amount ?? null;
|
|
19611
|
-
const [amount, setAmount] = useState152(
|
|
19760
|
+
const [amount, setAmount] = useState152(() => sanitizePrefilledUsd(prefilledAmountUsd));
|
|
19612
19761
|
const [loading, setLoading] = useState152(false);
|
|
19613
19762
|
const [session, setSession] = useState152(null);
|
|
19614
19763
|
const [status, setStatus] = useState152("pending");
|
|
19615
19764
|
const [error, setError] = useState152(null);
|
|
19616
19765
|
const [copied, setCopied] = useState152(false);
|
|
19617
19766
|
const [view, setViewInternal] = useState152(controlledView ?? "amount");
|
|
19618
|
-
const setView =
|
|
19767
|
+
const setView = useCallback32(
|
|
19619
19768
|
(v) => {
|
|
19620
19769
|
setViewInternal(v);
|
|
19621
19770
|
onViewChange?.(v);
|
|
@@ -19645,7 +19794,7 @@ function PayWithCashApp({
|
|
|
19645
19794
|
onDepositSuccess,
|
|
19646
19795
|
onDepositError
|
|
19647
19796
|
});
|
|
19648
|
-
const handleAmountChange =
|
|
19797
|
+
const handleAmountChange = useCallback32(
|
|
19649
19798
|
(raw) => {
|
|
19650
19799
|
const cleaned = raw.replace(/[^0-9.]/g, "");
|
|
19651
19800
|
const parts = cleaned.split(".");
|
|
@@ -19657,7 +19806,7 @@ function PayWithCashApp({
|
|
|
19657
19806
|
},
|
|
19658
19807
|
[onAmountChange]
|
|
19659
19808
|
);
|
|
19660
|
-
const handleCreateSession =
|
|
19809
|
+
const handleCreateSession = useCallback32(async () => {
|
|
19661
19810
|
if (!amount || !recipientAddress || !destinationChainType || !destinationChainId || !destinationTokenAddress) {
|
|
19662
19811
|
setError("Missing required fields");
|
|
19663
19812
|
return;
|
|
@@ -19731,6 +19880,13 @@ function PayWithCashApp({
|
|
|
19731
19880
|
return () => clearInterval(interval);
|
|
19732
19881
|
}, [session, view, status, publishableKey, onDepositSuccess, onDepositError]);
|
|
19733
19882
|
const [softExpired, setSoftExpired] = useState152(false);
|
|
19883
|
+
useEffect102(() => {
|
|
19884
|
+
if (!prefilledAmountUsd) return;
|
|
19885
|
+
const cleaned = sanitizePrefilledUsd(prefilledAmountUsd);
|
|
19886
|
+
if (!cleaned) return;
|
|
19887
|
+
setAmount(cleaned);
|
|
19888
|
+
onAmountChange?.(cleaned);
|
|
19889
|
+
}, [prefilledAmountUsd, onAmountChange]);
|
|
19734
19890
|
useEffect102(() => {
|
|
19735
19891
|
if (!session?.expires_at || view !== "payment") return;
|
|
19736
19892
|
const expiresMs = new Date(session.expires_at).getTime();
|
|
@@ -19745,12 +19901,12 @@ function PayWithCashApp({
|
|
|
19745
19901
|
const interval = setInterval(tick, 1e3);
|
|
19746
19902
|
return () => clearInterval(interval);
|
|
19747
19903
|
}, [session, view, status]);
|
|
19748
|
-
const handleCopy =
|
|
19904
|
+
const handleCopy = useCallback32(async (text) => {
|
|
19749
19905
|
await navigator.clipboard.writeText(text);
|
|
19750
19906
|
setCopied(true);
|
|
19751
19907
|
setTimeout(() => setCopied(false), 2e3);
|
|
19752
19908
|
}, []);
|
|
19753
|
-
const handleRecreate =
|
|
19909
|
+
const handleRecreate = useCallback32(() => {
|
|
19754
19910
|
setSession(null);
|
|
19755
19911
|
setStatus("pending");
|
|
19756
19912
|
setError(null);
|
|
@@ -20085,7 +20241,7 @@ function useBankTransferProviders({
|
|
|
20085
20241
|
countryCode
|
|
20086
20242
|
}) {
|
|
20087
20243
|
const normalizedCountry = countryCode?.toUpperCase();
|
|
20088
|
-
const { data: providers, isLoading } =
|
|
20244
|
+
const { data: providers, isLoading } = useQuery8({
|
|
20089
20245
|
queryKey: ["unifold", "bankTransferProviders", publishableKey, normalizedCountry ?? null],
|
|
20090
20246
|
queryFn: () => getBankTransferProviders(publishableKey, { countryCode: normalizedCountry }),
|
|
20091
20247
|
enabled,
|
|
@@ -20123,7 +20279,8 @@ function BankTransfer({
|
|
|
20123
20279
|
assetCdnUrl,
|
|
20124
20280
|
onDepositSuccess,
|
|
20125
20281
|
onEvent,
|
|
20126
|
-
onDepositError
|
|
20282
|
+
onDepositError,
|
|
20283
|
+
prefilledAmountUsd
|
|
20127
20284
|
}) {
|
|
20128
20285
|
const { colors: colors2, fonts, components } = useTheme();
|
|
20129
20286
|
const [internalView, setInternalView] = useState162("providers");
|
|
@@ -20133,6 +20290,10 @@ function BankTransfer({
|
|
|
20133
20290
|
const [requestBase, setRequestBase] = useState162(null);
|
|
20134
20291
|
const [activeRequest, setActiveRequest] = useState162(null);
|
|
20135
20292
|
const [amount, setAmount] = useState162("");
|
|
20293
|
+
const [fiatExchangeRates, setFiatExchangeRates] = useState162({
|
|
20294
|
+
usd: 1
|
|
20295
|
+
});
|
|
20296
|
+
const providerSelectionRequestIdRef = useRef52(0);
|
|
20136
20297
|
const currentView = externalView ?? internalView;
|
|
20137
20298
|
const setView = (v) => {
|
|
20138
20299
|
setInternalView(v);
|
|
@@ -20157,7 +20318,7 @@ function BankTransfer({
|
|
|
20157
20318
|
countryCode: userIpInfo?.alpha2
|
|
20158
20319
|
});
|
|
20159
20320
|
const providers = providersResponse?.data ?? [];
|
|
20160
|
-
const pollingWalletId =
|
|
20321
|
+
const pollingWalletId = useMemo62(() => {
|
|
20161
20322
|
if (!defaultToken) return void 0;
|
|
20162
20323
|
return getWalletByChainType(
|
|
20163
20324
|
wallets,
|
|
@@ -20178,11 +20339,42 @@ function BankTransfer({
|
|
|
20178
20339
|
const currencySymbol = getCurrencySymbol2(sourceCurrency);
|
|
20179
20340
|
const parsedAmount = parseFloat(amount);
|
|
20180
20341
|
const amountValid = !!amount && Number.isFinite(parsedAmount) && parsedAmount >= MIN_AMOUNT;
|
|
20181
|
-
const displayTokenSymbol =
|
|
20342
|
+
const displayTokenSymbol = useMemo62(
|
|
20182
20343
|
() => destinationTokenSymbol?.toUpperCase() ?? defaultToken?.destination_token_metadata?.symbol?.toUpperCase() ?? defaultToken?.destination_currency?.toUpperCase() ?? "USDC",
|
|
20183
20344
|
[destinationTokenSymbol, defaultToken]
|
|
20184
20345
|
);
|
|
20185
|
-
const
|
|
20346
|
+
const resolvePrefilledSourceAmount = useCallback42(
|
|
20347
|
+
async (sourceCurrencyCode) => {
|
|
20348
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
20349
|
+
if (!cleanedPrefilled) return "";
|
|
20350
|
+
const prefilledUsd = parseFloat(cleanedPrefilled);
|
|
20351
|
+
if (!Number.isFinite(prefilledUsd) || prefilledUsd <= 0) return "";
|
|
20352
|
+
const sourceCurrency2 = sourceCurrencyCode.toLowerCase();
|
|
20353
|
+
let rate = sourceCurrency2 === "usd" ? 1 : fiatExchangeRates[sourceCurrency2];
|
|
20354
|
+
if ((!rate || rate <= 0) && sourceCurrency2 !== "usd") {
|
|
20355
|
+
try {
|
|
20356
|
+
const response = await getFiatExchangeRates({}, publishableKey);
|
|
20357
|
+
if (response?.rates) {
|
|
20358
|
+
setFiatExchangeRates((prev) => ({
|
|
20359
|
+
...prev,
|
|
20360
|
+
...response.rates,
|
|
20361
|
+
usd: 1
|
|
20362
|
+
}));
|
|
20363
|
+
}
|
|
20364
|
+
const fetchedRate = response.rates?.[sourceCurrency2];
|
|
20365
|
+
if (Number.isFinite(fetchedRate) && fetchedRate > 0) {
|
|
20366
|
+
rate = fetchedRate;
|
|
20367
|
+
}
|
|
20368
|
+
} catch (error) {
|
|
20369
|
+
console.error("Error fetching fiat exchange rates for bank transfer:", error);
|
|
20370
|
+
}
|
|
20371
|
+
}
|
|
20372
|
+
if (!rate || rate <= 0) return sourceCurrency2 === "usd" ? cleanedPrefilled : "";
|
|
20373
|
+
return parseFloat((prefilledUsd * rate).toFixed(2)).toString();
|
|
20374
|
+
},
|
|
20375
|
+
[fiatExchangeRates, prefilledAmountUsd, publishableKey]
|
|
20376
|
+
);
|
|
20377
|
+
const handleProviderClick = async (provider) => {
|
|
20186
20378
|
if (!provider.enabled) return;
|
|
20187
20379
|
setSessionError(null);
|
|
20188
20380
|
if (!defaultToken) {
|
|
@@ -20201,6 +20393,7 @@ function BankTransfer({
|
|
|
20201
20393
|
});
|
|
20202
20394
|
return;
|
|
20203
20395
|
}
|
|
20396
|
+
const requestId = ++providerSelectionRequestIdRef.current;
|
|
20204
20397
|
setRequestBase({
|
|
20205
20398
|
service_provider: provider.service_provider,
|
|
20206
20399
|
country_code: (userIpInfo?.alpha2 || "DE").toUpperCase(),
|
|
@@ -20214,7 +20407,10 @@ function BankTransfer({
|
|
|
20214
20407
|
payment_method: provider.payment_methods[0]
|
|
20215
20408
|
});
|
|
20216
20409
|
setActiveProvider(provider);
|
|
20217
|
-
|
|
20410
|
+
const convertedPrefilled = await resolvePrefilledSourceAmount(provider.source_currency);
|
|
20411
|
+
if (requestId !== providerSelectionRequestIdRef.current) return;
|
|
20412
|
+
const hasPrefilledAmount = !!prefilledAmountUsd?.replace(/[^0-9.]/g, "");
|
|
20413
|
+
setAmount(hasPrefilledAmount ? convertedPrefilled : "100");
|
|
20218
20414
|
setView("amount");
|
|
20219
20415
|
};
|
|
20220
20416
|
const handleAmountChange = (value) => {
|
|
@@ -20312,7 +20508,7 @@ function BankTransfer({
|
|
|
20312
20508
|
return /* @__PURE__ */ jsxs15(
|
|
20313
20509
|
"button",
|
|
20314
20510
|
{
|
|
20315
|
-
onClick: () => handleProviderClick(provider),
|
|
20511
|
+
onClick: () => void handleProviderClick(provider),
|
|
20316
20512
|
onMouseEnter: () => !disabled && setHoveredId(provider.service_provider),
|
|
20317
20513
|
onMouseLeave: () => setHoveredId(null),
|
|
20318
20514
|
disabled,
|
|
@@ -20881,9 +21077,9 @@ function TransferCryptoButton({
|
|
|
20881
21077
|
featuredTokens
|
|
20882
21078
|
}) {
|
|
20883
21079
|
const { colors: colors2, fonts, components } = useTheme();
|
|
20884
|
-
const [isHovered, setIsHovered] =
|
|
20885
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
20886
|
-
|
|
21080
|
+
const [isHovered, setIsHovered] = React72.useState(false);
|
|
21081
|
+
const [isTouchDevice, setIsTouchDevice] = React72.useState(false);
|
|
21082
|
+
React72.useEffect(() => {
|
|
20887
21083
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
20888
21084
|
}, []);
|
|
20889
21085
|
const sortedTokens = featuredTokens ? [...featuredTokens].sort((a, b) => a.position - b.position) : [];
|
|
@@ -20963,9 +21159,9 @@ function DepositWithCardButton({
|
|
|
20963
21159
|
paymentNetworks
|
|
20964
21160
|
}) {
|
|
20965
21161
|
const { colors: colors2, fonts, components } = useTheme();
|
|
20966
|
-
const [isHovered, setIsHovered] =
|
|
20967
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
20968
|
-
|
|
21162
|
+
const [isHovered, setIsHovered] = React82.useState(false);
|
|
21163
|
+
const [isTouchDevice, setIsTouchDevice] = React82.useState(false);
|
|
21164
|
+
React82.useEffect(() => {
|
|
20969
21165
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
20970
21166
|
}, []);
|
|
20971
21167
|
return /* @__PURE__ */ jsxs18(
|
|
@@ -21044,9 +21240,9 @@ function PayWithExchangeButton({
|
|
|
21044
21240
|
loading = false
|
|
21045
21241
|
}) {
|
|
21046
21242
|
const { colors: colors2, fonts, components } = useTheme();
|
|
21047
|
-
const [isHovered, setIsHovered] =
|
|
21048
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
21049
|
-
|
|
21243
|
+
const [isHovered, setIsHovered] = React92.useState(false);
|
|
21244
|
+
const [isTouchDevice, setIsTouchDevice] = React92.useState(false);
|
|
21245
|
+
React92.useEffect(() => {
|
|
21050
21246
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
21051
21247
|
}, []);
|
|
21052
21248
|
if (loading) {
|
|
@@ -21148,11 +21344,11 @@ var buttonVariants = cva(
|
|
|
21148
21344
|
}
|
|
21149
21345
|
}
|
|
21150
21346
|
);
|
|
21151
|
-
var Button =
|
|
21347
|
+
var Button = React102.forwardRef(
|
|
21152
21348
|
({ className, variant, size: size4, asChild = false, style, ...props }, ref) => {
|
|
21153
21349
|
const Comp = asChild ? Slot2 : "button";
|
|
21154
21350
|
const { components, fonts } = useTheme();
|
|
21155
|
-
const themeStyle =
|
|
21351
|
+
const themeStyle = React102.useMemo(() => {
|
|
21156
21352
|
const baseStyle = { ...style };
|
|
21157
21353
|
if (variant === "default" || !variant) {
|
|
21158
21354
|
baseStyle.backgroundColor = components.button.primaryBackground;
|
|
@@ -21187,9 +21383,9 @@ function ConnectExchangeButton({
|
|
|
21187
21383
|
connectedExchange
|
|
21188
21384
|
}) {
|
|
21189
21385
|
const { colors: colors2, fonts, components } = useTheme();
|
|
21190
|
-
const [isHovered, setIsHovered] =
|
|
21191
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
21192
|
-
|
|
21386
|
+
const [isHovered, setIsHovered] = React112.useState(false);
|
|
21387
|
+
const [isTouchDevice, setIsTouchDevice] = React112.useState(false);
|
|
21388
|
+
React112.useEffect(() => {
|
|
21193
21389
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
21194
21390
|
}, []);
|
|
21195
21391
|
const isConnected = connectedExchange != null;
|
|
@@ -21334,9 +21530,9 @@ function DepositTrackerButton({
|
|
|
21334
21530
|
badge
|
|
21335
21531
|
}) {
|
|
21336
21532
|
const { colors: colors2, fonts, components } = useTheme();
|
|
21337
|
-
const [isHovered, setIsHovered] =
|
|
21338
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
21339
|
-
|
|
21533
|
+
const [isHovered, setIsHovered] = React122.useState(false);
|
|
21534
|
+
const [isTouchDevice, setIsTouchDevice] = React122.useState(false);
|
|
21535
|
+
React122.useEffect(() => {
|
|
21340
21536
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
21341
21537
|
}, []);
|
|
21342
21538
|
return /* @__PURE__ */ jsxs21(
|
|
@@ -21407,9 +21603,9 @@ function DepositTrackerButton({
|
|
|
21407
21603
|
}
|
|
21408
21604
|
function CashAppButton({ onClick, title, subtitle, iconUrl }) {
|
|
21409
21605
|
const { colors: colors2, fonts, components } = useTheme();
|
|
21410
|
-
const [isHovered, setIsHovered] =
|
|
21411
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
21412
|
-
|
|
21606
|
+
const [isHovered, setIsHovered] = React132.useState(false);
|
|
21607
|
+
const [isTouchDevice, setIsTouchDevice] = React132.useState(false);
|
|
21608
|
+
React132.useEffect(() => {
|
|
21413
21609
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
21414
21610
|
}, []);
|
|
21415
21611
|
return /* @__PURE__ */ jsxs222(
|
|
@@ -21493,9 +21689,9 @@ function AppleLogo({ className, style }) {
|
|
|
21493
21689
|
}
|
|
21494
21690
|
function ApplePayButton({ onClick, title, subtitle }) {
|
|
21495
21691
|
const { colors: colors2, fonts, components } = useTheme();
|
|
21496
|
-
const [isHovered, setIsHovered] =
|
|
21497
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
21498
|
-
|
|
21692
|
+
const [isHovered, setIsHovered] = React142.useState(false);
|
|
21693
|
+
const [isTouchDevice, setIsTouchDevice] = React142.useState(false);
|
|
21694
|
+
React142.useEffect(() => {
|
|
21499
21695
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
21500
21696
|
}, []);
|
|
21501
21697
|
return /* @__PURE__ */ jsxs23(
|
|
@@ -21557,9 +21753,9 @@ function BankTransferButton({
|
|
|
21557
21753
|
comingSoon = false
|
|
21558
21754
|
}) {
|
|
21559
21755
|
const { colors: colors2, fonts, components } = useTheme();
|
|
21560
|
-
const [isHovered, setIsHovered] =
|
|
21561
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
21562
|
-
|
|
21756
|
+
const [isHovered, setIsHovered] = React152.useState(false);
|
|
21757
|
+
const [isTouchDevice, setIsTouchDevice] = React152.useState(false);
|
|
21758
|
+
React152.useEffect(() => {
|
|
21563
21759
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
21564
21760
|
}, []);
|
|
21565
21761
|
return /* @__PURE__ */ jsxs24(
|
|
@@ -21808,18 +22004,18 @@ async function detectConnectedBrowserWallet(chainType) {
|
|
|
21808
22004
|
}
|
|
21809
22005
|
function useDetectedBrowserWallet(opts = {}) {
|
|
21810
22006
|
const { chainType, enabled = true, onDisconnect } = opts;
|
|
21811
|
-
const [wallet, setWallet] =
|
|
21812
|
-
const [isLoading, setIsLoading] =
|
|
21813
|
-
const [eip6963ProviderCount, setEip6963ProviderCount] =
|
|
21814
|
-
const onDisconnectRef =
|
|
22007
|
+
const [wallet, setWallet] = React162.useState(null);
|
|
22008
|
+
const [isLoading, setIsLoading] = React162.useState(enabled);
|
|
22009
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React162.useState(0);
|
|
22010
|
+
const onDisconnectRef = React162.useRef(onDisconnect);
|
|
21815
22011
|
onDisconnectRef.current = onDisconnect;
|
|
21816
|
-
|
|
22012
|
+
React162.useEffect(() => {
|
|
21817
22013
|
const store = getEip6963Store();
|
|
21818
22014
|
if (!store) return;
|
|
21819
22015
|
setEip6963ProviderCount(store.getProviders().length);
|
|
21820
22016
|
return store.subscribe((providers) => setEip6963ProviderCount(providers.length));
|
|
21821
22017
|
}, []);
|
|
21822
|
-
|
|
22018
|
+
React162.useEffect(() => {
|
|
21823
22019
|
if (!enabled) {
|
|
21824
22020
|
setWallet(null);
|
|
21825
22021
|
setIsLoading(false);
|
|
@@ -21960,7 +22156,7 @@ async function disconnectInjectedBrowserWallet(wallet) {
|
|
|
21960
22156
|
);
|
|
21961
22157
|
}
|
|
21962
22158
|
function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
21963
|
-
const id =
|
|
22159
|
+
const id = React172.useId();
|
|
21964
22160
|
if (variant === "light" || variant === "dark") {
|
|
21965
22161
|
return /* @__PURE__ */ jsxs25(
|
|
21966
22162
|
"svg",
|
|
@@ -22081,7 +22277,7 @@ function MetamaskIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
22081
22277
|
);
|
|
22082
22278
|
}
|
|
22083
22279
|
function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
22084
|
-
const id =
|
|
22280
|
+
const id = React182.useId();
|
|
22085
22281
|
if (variant === "light") {
|
|
22086
22282
|
return /* @__PURE__ */ jsx29(
|
|
22087
22283
|
"svg",
|
|
@@ -22148,7 +22344,7 @@ function PhantomIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
22148
22344
|
);
|
|
22149
22345
|
}
|
|
22150
22346
|
function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
22151
|
-
const id =
|
|
22347
|
+
const id = React192.useId();
|
|
22152
22348
|
if (variant === "light") {
|
|
22153
22349
|
return /* @__PURE__ */ jsxs27(
|
|
22154
22350
|
"svg",
|
|
@@ -22228,7 +22424,7 @@ function CoinbaseIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
22228
22424
|
);
|
|
22229
22425
|
}
|
|
22230
22426
|
function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
22231
|
-
const id =
|
|
22427
|
+
const id = React202.useId();
|
|
22232
22428
|
if (variant === "light") {
|
|
22233
22429
|
return /* @__PURE__ */ jsxs28(
|
|
22234
22430
|
"svg",
|
|
@@ -22575,7 +22771,7 @@ function RabbyIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
22575
22771
|
);
|
|
22576
22772
|
}
|
|
22577
22773
|
function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
22578
|
-
const id =
|
|
22774
|
+
const id = React212.useId();
|
|
22579
22775
|
if (variant === "light") {
|
|
22580
22776
|
return /* @__PURE__ */ jsxs29(
|
|
22581
22777
|
"svg",
|
|
@@ -22989,7 +23185,7 @@ function RainbowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
22989
23185
|
);
|
|
22990
23186
|
}
|
|
22991
23187
|
function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
22992
|
-
const id =
|
|
23188
|
+
const id = React222.useId();
|
|
22993
23189
|
if (variant === "light") {
|
|
22994
23190
|
return /* @__PURE__ */ jsx33(
|
|
22995
23191
|
"svg",
|
|
@@ -23072,7 +23268,7 @@ function TrustIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
23072
23268
|
);
|
|
23073
23269
|
}
|
|
23074
23270
|
function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
23075
|
-
const id =
|
|
23271
|
+
const id = React232.useId();
|
|
23076
23272
|
if (variant === "light") {
|
|
23077
23273
|
return /* @__PURE__ */ jsx34(
|
|
23078
23274
|
"svg",
|
|
@@ -23127,7 +23323,7 @@ function OkxIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
23127
23323
|
);
|
|
23128
23324
|
}
|
|
23129
23325
|
function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
23130
|
-
const id =
|
|
23326
|
+
const id = React242.useId();
|
|
23131
23327
|
if (variant === "light") {
|
|
23132
23328
|
return /* @__PURE__ */ jsx35(
|
|
23133
23329
|
"svg",
|
|
@@ -23228,7 +23424,7 @@ function GlowIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
23228
23424
|
);
|
|
23229
23425
|
}
|
|
23230
23426
|
function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
23231
|
-
const id =
|
|
23427
|
+
const id = React252.useId();
|
|
23232
23428
|
if (variant === "light") {
|
|
23233
23429
|
return /* @__PURE__ */ jsx36(
|
|
23234
23430
|
"svg",
|
|
@@ -23301,7 +23497,7 @@ function BackpackIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
23301
23497
|
);
|
|
23302
23498
|
}
|
|
23303
23499
|
function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
23304
|
-
const id =
|
|
23500
|
+
const id = React262.useId();
|
|
23305
23501
|
if (variant === "light") {
|
|
23306
23502
|
return /* @__PURE__ */ jsx37(
|
|
23307
23503
|
"svg",
|
|
@@ -23368,7 +23564,7 @@ function SolflareIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
23368
23564
|
);
|
|
23369
23565
|
}
|
|
23370
23566
|
function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
23371
|
-
const id =
|
|
23567
|
+
const id = React272.useId();
|
|
23372
23568
|
if (variant === "light") {
|
|
23373
23569
|
return /* @__PURE__ */ jsxs35(
|
|
23374
23570
|
"svg",
|
|
@@ -23492,7 +23688,7 @@ function EthereumIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
|
23492
23688
|
);
|
|
23493
23689
|
}
|
|
23494
23690
|
function SolanaIcon({ size: size4 = 24, className, variant = "color" }) {
|
|
23495
|
-
const id =
|
|
23691
|
+
const id = React282.useId();
|
|
23496
23692
|
if (variant === "light") {
|
|
23497
23693
|
return /* @__PURE__ */ jsx39(
|
|
23498
23694
|
"svg",
|
|
@@ -23737,19 +23933,19 @@ function BrowserWalletButton({
|
|
|
23737
23933
|
subtitle = i18n2.depositModal.browserWallet.subtitle
|
|
23738
23934
|
}) {
|
|
23739
23935
|
const { colors: colors2, fonts, components } = useTheme();
|
|
23740
|
-
const [isHovered, setIsHovered] =
|
|
23741
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
23936
|
+
const [isHovered, setIsHovered] = React292.useState(false);
|
|
23937
|
+
const [isTouchDevice, setIsTouchDevice] = React292.useState(false);
|
|
23742
23938
|
const { wallet, isLoading, setWallet } = useDetectedBrowserWallet({ chainType, onDisconnect });
|
|
23743
|
-
const [isConnecting, setIsConnecting] =
|
|
23744
|
-
const [balanceText, setBalanceText] =
|
|
23745
|
-
const [isLoadingBalance, setIsLoadingBalance] =
|
|
23746
|
-
const [isDisconnecting, setIsDisconnecting] =
|
|
23747
|
-
const onDisconnectRef =
|
|
23939
|
+
const [isConnecting, setIsConnecting] = React292.useState(false);
|
|
23940
|
+
const [balanceText, setBalanceText] = React292.useState(null);
|
|
23941
|
+
const [isLoadingBalance, setIsLoadingBalance] = React292.useState(false);
|
|
23942
|
+
const [isDisconnecting, setIsDisconnecting] = React292.useState(false);
|
|
23943
|
+
const onDisconnectRef = React292.useRef(onDisconnect);
|
|
23748
23944
|
onDisconnectRef.current = onDisconnect;
|
|
23749
|
-
|
|
23945
|
+
React292.useEffect(() => {
|
|
23750
23946
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
23751
23947
|
}, []);
|
|
23752
|
-
|
|
23948
|
+
React292.useEffect(() => {
|
|
23753
23949
|
if (!wallet || !publishableKey) {
|
|
23754
23950
|
setBalanceText(null);
|
|
23755
23951
|
return;
|
|
@@ -23876,7 +24072,7 @@ function BrowserWalletButton({
|
|
|
23876
24072
|
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`
|
|
23877
24073
|
};
|
|
23878
24074
|
const sortedWallets = featuredWallets ? [...featuredWallets].sort((a, b) => a.position - b.position) : [];
|
|
23879
|
-
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ?
|
|
24075
|
+
const walletIconBlock = wallet ? WALLET_ICON_COMPONENTS[wallet.icon] ? React292.createElement(WALLET_ICON_COMPONENTS[wallet.icon], {
|
|
23880
24076
|
size: 36,
|
|
23881
24077
|
className: "uf-rounded-lg",
|
|
23882
24078
|
variant: "color"
|
|
@@ -24027,9 +24223,9 @@ function StripeLinkButton({
|
|
|
24027
24223
|
iconUrl
|
|
24028
24224
|
}) {
|
|
24029
24225
|
const { colors: colors2, fonts, components } = useTheme();
|
|
24030
|
-
const [isHovered, setIsHovered] =
|
|
24031
|
-
const [isTouchDevice, setIsTouchDevice] =
|
|
24032
|
-
|
|
24226
|
+
const [isHovered, setIsHovered] = React302.useState(false);
|
|
24227
|
+
const [isTouchDevice, setIsTouchDevice] = React302.useState(false);
|
|
24228
|
+
React302.useEffect(() => {
|
|
24033
24229
|
setIsTouchDevice("ontouchstart" in window || navigator.maxTouchPoints > 0);
|
|
24034
24230
|
}, []);
|
|
24035
24231
|
return /* @__PURE__ */ jsxs39(
|
|
@@ -24302,12 +24498,12 @@ function useStripeOnramp(stripePublishableKey, isDark = false) {
|
|
|
24302
24498
|
const [coordinator, setCoordinator] = useState282(null);
|
|
24303
24499
|
const [isLoading, setIsLoading] = useState282(false);
|
|
24304
24500
|
const [error, setError] = useState282(null);
|
|
24305
|
-
const coordinatorRef =
|
|
24306
|
-
const coordinatorThemeRef =
|
|
24307
|
-
const initPromiseRef =
|
|
24308
|
-
const isDarkRef =
|
|
24501
|
+
const coordinatorRef = useRef82(null);
|
|
24502
|
+
const coordinatorThemeRef = useRef82(null);
|
|
24503
|
+
const initPromiseRef = useRef82(null);
|
|
24504
|
+
const isDarkRef = useRef82(isDark);
|
|
24309
24505
|
isDarkRef.current = isDark;
|
|
24310
|
-
const initialize =
|
|
24506
|
+
const initialize = useCallback52(() => {
|
|
24311
24507
|
if (coordinatorRef.current) return Promise.resolve(coordinatorRef.current);
|
|
24312
24508
|
if (initPromiseRef.current) return initPromiseRef.current;
|
|
24313
24509
|
if (!stripePublishableKey) return Promise.resolve(null);
|
|
@@ -24515,6 +24711,8 @@ function PayWithStripeLink({
|
|
|
24515
24711
|
destinationChainType,
|
|
24516
24712
|
destinationChainId,
|
|
24517
24713
|
destinationTokenAddress,
|
|
24714
|
+
countryCode,
|
|
24715
|
+
subdivisionCode,
|
|
24518
24716
|
wallets: externalWallets,
|
|
24519
24717
|
email: emailProp,
|
|
24520
24718
|
iconUrl,
|
|
@@ -24526,14 +24724,14 @@ function PayWithStripeLink({
|
|
|
24526
24724
|
}) {
|
|
24527
24725
|
const { colors: colors2, fonts, components, isDark } = useTheme();
|
|
24528
24726
|
const [step, setStepInternal] = useState292(controlledStep ?? "amount");
|
|
24529
|
-
const setStep =
|
|
24727
|
+
const setStep = useCallback62(
|
|
24530
24728
|
(s) => {
|
|
24531
24729
|
setStepInternal(s);
|
|
24532
24730
|
onStepChange?.(s);
|
|
24533
24731
|
},
|
|
24534
24732
|
[onStepChange]
|
|
24535
24733
|
);
|
|
24536
|
-
const stepRef =
|
|
24734
|
+
const stepRef = useRef92(step);
|
|
24537
24735
|
stepRef.current = step;
|
|
24538
24736
|
useEffect242(() => {
|
|
24539
24737
|
if (controlledStep && controlledStep !== step) {
|
|
@@ -24624,20 +24822,20 @@ function PayWithStripeLink({
|
|
|
24624
24822
|
const [restoring, setRestoring] = useState292(true);
|
|
24625
24823
|
const [errorReturnStep, setErrorReturnStep] = useState292("email");
|
|
24626
24824
|
const [authIntentId, setAuthIntentId] = useState292(null);
|
|
24627
|
-
const sdkAuthenticatedRef =
|
|
24628
|
-
const everAuthenticatedRef =
|
|
24629
|
-
const reauthReturnStepRef =
|
|
24630
|
-
const attemptedWalletReauthRef =
|
|
24631
|
-
const pendingAddPaymentRef =
|
|
24632
|
-
const autoOpenedAddPaymentRef =
|
|
24633
|
-
const checkoutGenRef =
|
|
24825
|
+
const sdkAuthenticatedRef = useRef92(false);
|
|
24826
|
+
const everAuthenticatedRef = useRef92(false);
|
|
24827
|
+
const reauthReturnStepRef = useRef92(null);
|
|
24828
|
+
const attemptedWalletReauthRef = useRef92(false);
|
|
24829
|
+
const pendingAddPaymentRef = useRef92(false);
|
|
24830
|
+
const autoOpenedAddPaymentRef = useRef92(false);
|
|
24831
|
+
const checkoutGenRef = useRef92(0);
|
|
24634
24832
|
const [stripePaymentUIReady, setStripePaymentUIReady] = useState292(false);
|
|
24635
24833
|
const [oauthToken, setOauthToken] = useState292(null);
|
|
24636
24834
|
const [refreshTokenValue, setRefreshTokenValue] = useState292(null);
|
|
24637
24835
|
const [customerId, setCustomerId] = useState292(null);
|
|
24638
|
-
const accessTokenRef =
|
|
24639
|
-
const refreshTokenRef =
|
|
24640
|
-
const persistSession =
|
|
24836
|
+
const accessTokenRef = useRef92("");
|
|
24837
|
+
const refreshTokenRef = useRef92("");
|
|
24838
|
+
const persistSession = useCallback62(
|
|
24641
24839
|
(cid, token, refresh, expiresIn, loginEmail) => {
|
|
24642
24840
|
accessTokenRef.current = token;
|
|
24643
24841
|
refreshTokenRef.current = refresh;
|
|
@@ -24651,8 +24849,8 @@ function PayWithStripeLink({
|
|
|
24651
24849
|
},
|
|
24652
24850
|
[userId, email]
|
|
24653
24851
|
);
|
|
24654
|
-
const refreshInFlightRef =
|
|
24655
|
-
const tryRefreshToken =
|
|
24852
|
+
const refreshInFlightRef = useRef92(null);
|
|
24853
|
+
const tryRefreshToken = useCallback62(async () => {
|
|
24656
24854
|
if (refreshInFlightRef.current) return refreshInFlightRef.current;
|
|
24657
24855
|
const rt = refreshTokenRef.current;
|
|
24658
24856
|
if (!rt) return null;
|
|
@@ -24682,7 +24880,7 @@ function PayWithStripeLink({
|
|
|
24682
24880
|
refreshInFlightRef.current = doRefresh();
|
|
24683
24881
|
return refreshInFlightRef.current;
|
|
24684
24882
|
}, [publishableKey, customerId, persistSession, userId]);
|
|
24685
|
-
const withTokenRefresh =
|
|
24883
|
+
const withTokenRefresh = useCallback62(
|
|
24686
24884
|
async (fn) => {
|
|
24687
24885
|
const token = accessTokenRef.current;
|
|
24688
24886
|
if (!token) {
|
|
@@ -24844,8 +25042,8 @@ function PayWithStripeLink({
|
|
|
24844
25042
|
);
|
|
24845
25043
|
const [selectedPaymentToken, setSelectedPaymentToken] = useState292(null);
|
|
24846
25044
|
const [paymentDisplay, setPaymentDisplay] = useState292(null);
|
|
24847
|
-
const selectedTokenSingleUseRef =
|
|
24848
|
-
const selectPaymentToken =
|
|
25045
|
+
const selectedTokenSingleUseRef = useRef92(false);
|
|
25046
|
+
const selectPaymentToken = useCallback62(
|
|
24849
25047
|
(token) => {
|
|
24850
25048
|
selectedTokenSingleUseRef.current = !!token.singleUse;
|
|
24851
25049
|
setSelectedPaymentToken(token.id);
|
|
@@ -24857,7 +25055,7 @@ function PayWithStripeLink({
|
|
|
24857
25055
|
},
|
|
24858
25056
|
[customerId]
|
|
24859
25057
|
);
|
|
24860
|
-
const clearSelectedPaymentToken =
|
|
25058
|
+
const clearSelectedPaymentToken = useCallback62(() => {
|
|
24861
25059
|
selectedTokenSingleUseRef.current = false;
|
|
24862
25060
|
const persisted = customerId ? getStoredSelectedToken(customerId) : null;
|
|
24863
25061
|
if (persisted && !persisted.singleUse) {
|
|
@@ -24909,7 +25107,9 @@ function PayWithStripeLink({
|
|
|
24909
25107
|
{
|
|
24910
25108
|
tokenAddress: destinationTokenAddress,
|
|
24911
25109
|
chainId: destinationChainId,
|
|
24912
|
-
chainType: destinationChainType
|
|
25110
|
+
chainType: destinationChainType,
|
|
25111
|
+
countryCode,
|
|
25112
|
+
subdivisionCode
|
|
24913
25113
|
},
|
|
24914
25114
|
publishableKey
|
|
24915
25115
|
).then((token) => {
|
|
@@ -24928,10 +25128,17 @@ function PayWithStripeLink({
|
|
|
24928
25128
|
return () => {
|
|
24929
25129
|
cancelled = true;
|
|
24930
25130
|
};
|
|
24931
|
-
}, [
|
|
25131
|
+
}, [
|
|
25132
|
+
publishableKey,
|
|
25133
|
+
destinationTokenAddress,
|
|
25134
|
+
destinationChainId,
|
|
25135
|
+
destinationChainType,
|
|
25136
|
+
countryCode,
|
|
25137
|
+
subdivisionCode
|
|
25138
|
+
]);
|
|
24932
25139
|
const destinationCurrency = stripeDestCurrency;
|
|
24933
|
-
const authInnerRef =
|
|
24934
|
-
const paymentInnerRef =
|
|
25140
|
+
const authInnerRef = useRef92(null);
|
|
25141
|
+
const paymentInnerRef = useRef92(null);
|
|
24935
25142
|
const [authReady, setAuthReady] = useState292(false);
|
|
24936
25143
|
if (typeof document !== "undefined" && !authInnerRef.current) {
|
|
24937
25144
|
authInnerRef.current = document.createElement("div");
|
|
@@ -24939,12 +25146,12 @@ function PayWithStripeLink({
|
|
|
24939
25146
|
if (typeof document !== "undefined" && !paymentInnerRef.current) {
|
|
24940
25147
|
paymentInnerRef.current = document.createElement("div");
|
|
24941
25148
|
}
|
|
24942
|
-
const authMountRef =
|
|
25149
|
+
const authMountRef = useCallback62((node) => {
|
|
24943
25150
|
if (node && !node.contains(authInnerRef.current)) {
|
|
24944
25151
|
node.appendChild(authInnerRef.current);
|
|
24945
25152
|
}
|
|
24946
25153
|
}, []);
|
|
24947
|
-
const paymentMountRef =
|
|
25154
|
+
const paymentMountRef = useCallback62((node) => {
|
|
24948
25155
|
if (node && !node.contains(paymentInnerRef.current)) {
|
|
24949
25156
|
node.appendChild(paymentInnerRef.current);
|
|
24950
25157
|
}
|
|
@@ -24995,8 +25202,8 @@ function PayWithStripeLink({
|
|
|
24995
25202
|
});
|
|
24996
25203
|
const [confirmedSessionId, setConfirmedSessionId] = useState292(null);
|
|
24997
25204
|
const [sessionStatus, setSessionStatus] = useState292(null);
|
|
24998
|
-
const handledTerminalSessionRef =
|
|
24999
|
-
const executionReconciledSessionRef =
|
|
25205
|
+
const handledTerminalSessionRef = useRef92(null);
|
|
25206
|
+
const executionReconciledSessionRef = useRef92(null);
|
|
25000
25207
|
const hasExecution = executions.length > 0;
|
|
25001
25208
|
const isSessionFulfilled = sessionStatus === STRIPE_SESSION_STATUS.FULFILLMENT_COMPLETE || hasExecution;
|
|
25002
25209
|
const isSessionFailed = !hasExecution && (sessionStatus === STRIPE_SESSION_STATUS.REJECTED || sessionStatus === STRIPE_SESSION_STATUS.EXPIRED);
|
|
@@ -25114,7 +25321,7 @@ function PayWithStripeLink({
|
|
|
25114
25321
|
sdkAuthenticatedRef.current = false;
|
|
25115
25322
|
attemptedWalletReauthRef.current = false;
|
|
25116
25323
|
}, [coordinator]);
|
|
25117
|
-
const handleAuthInterrupted =
|
|
25324
|
+
const handleAuthInterrupted = useCallback62(
|
|
25118
25325
|
(message) => {
|
|
25119
25326
|
const alreadySignedIn = !!accessTokenRef.current;
|
|
25120
25327
|
if (alreadySignedIn || emailProp) {
|
|
@@ -25127,7 +25334,7 @@ function PayWithStripeLink({
|
|
|
25127
25334
|
},
|
|
25128
25335
|
[emailProp, setStep]
|
|
25129
25336
|
);
|
|
25130
|
-
const reauthenticateSdk =
|
|
25337
|
+
const reauthenticateSdk = useCallback62(async () => {
|
|
25131
25338
|
const current = stepRef.current;
|
|
25132
25339
|
const preAuthSteps = ["email", "register", "auth"];
|
|
25133
25340
|
reauthReturnStepRef.current = preAuthSteps.includes(current) ? null : current;
|
|
@@ -25826,14 +26033,14 @@ function PayWithStripeLink({
|
|
|
25826
26033
|
};
|
|
25827
26034
|
const [quote, setQuote] = useState292(null);
|
|
25828
26035
|
const [quoteLoading, setQuoteLoading] = useState292(false);
|
|
25829
|
-
const quoteTimerRef =
|
|
26036
|
+
const quoteTimerRef = useRef92(null);
|
|
25830
26037
|
const [sessionForCheckout, setSessionForCheckoutState] = useState292(null);
|
|
25831
|
-
const sessionForCheckoutRef =
|
|
26038
|
+
const sessionForCheckoutRef = useRef92(sessionForCheckout);
|
|
25832
26039
|
const setSessionForCheckout = (s) => {
|
|
25833
26040
|
sessionForCheckoutRef.current = s;
|
|
25834
26041
|
setSessionForCheckoutState(s);
|
|
25835
26042
|
};
|
|
25836
|
-
const loadAndSelectPreferredToken =
|
|
26043
|
+
const loadAndSelectPreferredToken = useCallback62(async () => {
|
|
25837
26044
|
if (!customerId) return;
|
|
25838
26045
|
try {
|
|
25839
26046
|
const existing = await withTokenRefresh(
|
|
@@ -25863,7 +26070,7 @@ function PayWithStripeLink({
|
|
|
25863
26070
|
};
|
|
25864
26071
|
const [quoteError, setQuoteError] = useState292(null);
|
|
25865
26072
|
const [quoteNonce, setQuoteNonce] = useState292(0);
|
|
25866
|
-
const quoteNonceAtReviewRef =
|
|
26073
|
+
const quoteNonceAtReviewRef = useRef92(quoteNonce);
|
|
25867
26074
|
const [purchaseLimit, setPurchaseLimit] = useState292(null);
|
|
25868
26075
|
const [limitReachedAmount, setLimitReachedAmount] = useState292(null);
|
|
25869
26076
|
const [requiredStepUp, setRequiredStepUp] = useState292(null);
|
|
@@ -27786,7 +27993,7 @@ function useProjectConfig({
|
|
|
27786
27993
|
data: projectConfig,
|
|
27787
27994
|
isLoading,
|
|
27788
27995
|
error
|
|
27789
|
-
} =
|
|
27996
|
+
} = useQuery9({
|
|
27790
27997
|
// Country is part of the key so a region change refetches the region-aware
|
|
27791
27998
|
// config. Omitted when undefined so callers that don't pass a country keep
|
|
27792
27999
|
// sharing the base cache entry.
|
|
@@ -27814,7 +28021,7 @@ function useSupportedDepositTokens(publishableKey, options) {
|
|
|
27814
28021
|
...options?.product_type ? { product_type: options.product_type } : {}
|
|
27815
28022
|
};
|
|
27816
28023
|
const hasFilteredOptions = Object.keys(filteredOptions).length > 0;
|
|
27817
|
-
return
|
|
28024
|
+
return useQuery10({
|
|
27818
28025
|
queryKey: [
|
|
27819
28026
|
"unifold",
|
|
27820
28027
|
"supportedDepositTokens",
|
|
@@ -27838,7 +28045,7 @@ function useIntegrationTransferDefaultToken({
|
|
|
27838
28045
|
publishableKey,
|
|
27839
28046
|
enabled = true
|
|
27840
28047
|
}) {
|
|
27841
|
-
return
|
|
28048
|
+
return useQuery11({
|
|
27842
28049
|
queryKey: [
|
|
27843
28050
|
"unifold",
|
|
27844
28051
|
"integrationTransferDefaultToken",
|
|
@@ -27904,7 +28111,8 @@ function CoinbaseConnect({
|
|
|
27904
28111
|
defaultSourceChainType,
|
|
27905
28112
|
defaultSourceChainId,
|
|
27906
28113
|
defaultSourceTokenAddress,
|
|
27907
|
-
defaultSourceSymbol
|
|
28114
|
+
defaultSourceSymbol,
|
|
28115
|
+
prefilledAmountUsd
|
|
27908
28116
|
}) {
|
|
27909
28117
|
const { colors: colors2, fonts, components } = useTheme();
|
|
27910
28118
|
const { projectConfig } = useProjectConfig({ publishableKey });
|
|
@@ -27914,12 +28122,12 @@ function CoinbaseConnect({
|
|
|
27914
28122
|
destination_chain_id: destinationChainId,
|
|
27915
28123
|
destination_chain_type: destinationChainType
|
|
27916
28124
|
});
|
|
27917
|
-
const supportedSymbols =
|
|
28125
|
+
const supportedSymbols = useMemo82(() => {
|
|
27918
28126
|
const set = /* @__PURE__ */ new Set();
|
|
27919
28127
|
supportedTokensData?.data.forEach((token) => set.add(token.symbol.toLowerCase()));
|
|
27920
28128
|
return set;
|
|
27921
28129
|
}, [supportedTokensData]);
|
|
27922
|
-
const stablecoinSymbols =
|
|
28130
|
+
const stablecoinSymbols = useMemo82(() => {
|
|
27923
28131
|
const set = /* @__PURE__ */ new Set();
|
|
27924
28132
|
supportedTokensData?.data.forEach((token) => {
|
|
27925
28133
|
if (token.is_stablecoin) set.add(token.symbol.toLowerCase());
|
|
@@ -27952,12 +28160,12 @@ function CoinbaseConnect({
|
|
|
27952
28160
|
const [transferDepositWalletId, setTransferDepositWalletId] = useState30(
|
|
27953
28161
|
void 0
|
|
27954
28162
|
);
|
|
27955
|
-
const exchangeSupportedCurrencies =
|
|
28163
|
+
const exchangeSupportedCurrencies = useMemo82(() => {
|
|
27956
28164
|
const set = /* @__PURE__ */ new Set();
|
|
27957
28165
|
selectedExchange?.supported_currencies.forEach((c) => set.add(c.toLowerCase()));
|
|
27958
28166
|
return set;
|
|
27959
28167
|
}, [selectedExchange]);
|
|
27960
|
-
const defaultTokenParams =
|
|
28168
|
+
const defaultTokenParams = useMemo82(
|
|
27961
28169
|
() => selectedAsset ? {
|
|
27962
28170
|
integration_provider: IntegrationProvider.COINBASE,
|
|
27963
28171
|
source_currency: selectedAsset.currency.toLowerCase(),
|
|
@@ -27980,7 +28188,7 @@ function CoinbaseConnect({
|
|
|
27980
28188
|
params: defaultTokenParams,
|
|
27981
28189
|
publishableKey
|
|
27982
28190
|
});
|
|
27983
|
-
const defaultSourceCurrency =
|
|
28191
|
+
const defaultSourceCurrency = useMemo82(
|
|
27984
28192
|
() => resolveDefaultSourceSymbol(supportedTokensData?.data, {
|
|
27985
28193
|
defaultSourceChainType,
|
|
27986
28194
|
defaultSourceChainId,
|
|
@@ -27995,7 +28203,7 @@ function CoinbaseConnect({
|
|
|
27995
28203
|
defaultSourceSymbol
|
|
27996
28204
|
]
|
|
27997
28205
|
);
|
|
27998
|
-
const sortedHoldings =
|
|
28206
|
+
const sortedHoldings = useMemo82(() => {
|
|
27999
28207
|
const supported = [];
|
|
28000
28208
|
const unsupported = [];
|
|
28001
28209
|
holdings.forEach((account) => {
|
|
@@ -28015,7 +28223,7 @@ function CoinbaseConnect({
|
|
|
28015
28223
|
}
|
|
28016
28224
|
return [...supported, ...unsupported];
|
|
28017
28225
|
}, [holdings, supportedSymbols, exchangeSupportedCurrencies, defaultSourceCurrency]);
|
|
28018
|
-
const selectedHoldingIsSupported =
|
|
28226
|
+
const selectedHoldingIsSupported = useMemo82(() => {
|
|
28019
28227
|
if (!selectedHolding) return false;
|
|
28020
28228
|
const currencyLower = selectedHolding.currency.toLowerCase();
|
|
28021
28229
|
return (supportedSymbols.size === 0 || supportedSymbols.has(currencyLower)) && (exchangeSupportedCurrencies.size === 0 || exchangeSupportedCurrencies.has(currencyLower));
|
|
@@ -28059,10 +28267,10 @@ function CoinbaseConnect({
|
|
|
28059
28267
|
useEffect252(() => {
|
|
28060
28268
|
onExecutionsChange?.(depositExecutions);
|
|
28061
28269
|
}, [depositExecutions, onExecutionsChange]);
|
|
28062
|
-
const pollRef =
|
|
28063
|
-
const popupRef =
|
|
28064
|
-
const viewRef =
|
|
28065
|
-
const transitionTo =
|
|
28270
|
+
const pollRef = useRef102(null);
|
|
28271
|
+
const popupRef = useRef102(null);
|
|
28272
|
+
const viewRef = useRef102(initialView);
|
|
28273
|
+
const transitionTo = useCallback72((nextView) => {
|
|
28066
28274
|
if (nextView === viewRef.current) return;
|
|
28067
28275
|
setIsTransitioning(true);
|
|
28068
28276
|
setTimeout(() => {
|
|
@@ -28072,7 +28280,7 @@ function CoinbaseConnect({
|
|
|
28072
28280
|
setIsTransitioning(false);
|
|
28073
28281
|
}, 150);
|
|
28074
28282
|
}, []);
|
|
28075
|
-
const tryRefreshToken =
|
|
28283
|
+
const tryRefreshToken = useCallback72(
|
|
28076
28284
|
async (currentToken) => {
|
|
28077
28285
|
try {
|
|
28078
28286
|
const result = await refreshIntegrationToken(currentToken, publishableKey);
|
|
@@ -28110,7 +28318,7 @@ function CoinbaseConnect({
|
|
|
28110
28318
|
}
|
|
28111
28319
|
}
|
|
28112
28320
|
}, []);
|
|
28113
|
-
const loadHoldings =
|
|
28321
|
+
const loadHoldings = useCallback72(
|
|
28114
28322
|
async (token) => {
|
|
28115
28323
|
setIsLoading(true);
|
|
28116
28324
|
try {
|
|
@@ -28162,7 +28370,7 @@ function CoinbaseConnect({
|
|
|
28162
28370
|
if (pollRef.current) clearInterval(pollRef.current);
|
|
28163
28371
|
};
|
|
28164
28372
|
}, []);
|
|
28165
|
-
const minDepositUsd =
|
|
28373
|
+
const minDepositUsd = useMemo82(() => {
|
|
28166
28374
|
if (!selectedAsset || !defaultTokenData) return 0;
|
|
28167
28375
|
const supportedToken = supportedTokensData?.data.find(
|
|
28168
28376
|
(t14) => t14.symbol.toLowerCase() === selectedAsset.currency.toLowerCase()
|
|
@@ -28173,7 +28381,7 @@ function CoinbaseConnect({
|
|
|
28173
28381
|
);
|
|
28174
28382
|
return matchingChain?.minimum_deposit_amount_usd ?? Math.min(...supportedToken.chains.map((c) => c.minimum_deposit_amount_usd));
|
|
28175
28383
|
}, [selectedAsset, supportedTokensData, defaultTokenData]);
|
|
28176
|
-
const estimatedProcessingTime =
|
|
28384
|
+
const estimatedProcessingTime = useMemo82(() => {
|
|
28177
28385
|
if (!selectedAsset || !defaultTokenData) return null;
|
|
28178
28386
|
const supportedToken = supportedTokensData?.data.find(
|
|
28179
28387
|
(t14) => t14.symbol.toLowerCase() === selectedAsset.currency.toLowerCase()
|
|
@@ -28227,7 +28435,8 @@ function CoinbaseConnect({
|
|
|
28227
28435
|
};
|
|
28228
28436
|
const handleSelectAsset = (asset) => {
|
|
28229
28437
|
setSelectedAsset(asset);
|
|
28230
|
-
|
|
28438
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
28439
|
+
setSendAmount(cleanedPrefilled);
|
|
28231
28440
|
transitionTo("enter_amount");
|
|
28232
28441
|
};
|
|
28233
28442
|
const handleCreateTransfer = async () => {
|
|
@@ -29815,7 +30024,7 @@ function useExchanges({
|
|
|
29815
30024
|
publishableKey,
|
|
29816
30025
|
enabled = true
|
|
29817
30026
|
}) {
|
|
29818
|
-
const { data: exchanges = [], isLoading } =
|
|
30027
|
+
const { data: exchanges = [], isLoading } = useQuery12({
|
|
29819
30028
|
queryKey: ["unifold", "exchanges", publishableKey],
|
|
29820
30029
|
queryFn: () => getExchanges(void 0, publishableKey).then((res) => res.data),
|
|
29821
30030
|
enabled,
|
|
@@ -29829,7 +30038,7 @@ function useApplePayProviders({
|
|
|
29829
30038
|
publishableKey,
|
|
29830
30039
|
enabled = true
|
|
29831
30040
|
}) {
|
|
29832
|
-
const { data: providers, isLoading } =
|
|
30041
|
+
const { data: providers, isLoading } = useQuery13({
|
|
29833
30042
|
queryKey: ["unifold", "applePayProviders", publishableKey],
|
|
29834
30043
|
queryFn: () => getApplePayProviders(publishableKey),
|
|
29835
30044
|
enabled,
|
|
@@ -29889,7 +30098,7 @@ function useAddressValidation({
|
|
|
29889
30098
|
refetchOnMount = false
|
|
29890
30099
|
}) {
|
|
29891
30100
|
const shouldValidate = enabled && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
29892
|
-
const { data, isLoading, error } =
|
|
30101
|
+
const { data, isLoading, error } = useQuery14({
|
|
29893
30102
|
queryKey: [
|
|
29894
30103
|
"unifold",
|
|
29895
30104
|
"addressValidation",
|
|
@@ -29938,7 +30147,7 @@ function ThemeStyleInjector({
|
|
|
29938
30147
|
className
|
|
29939
30148
|
}) {
|
|
29940
30149
|
const { colors: colors2, fonts, mode } = useTheme();
|
|
29941
|
-
const cssVars =
|
|
30150
|
+
const cssVars = React322.useMemo(() => {
|
|
29942
30151
|
const hexToHSL = (hex) => {
|
|
29943
30152
|
hex = hex.replace("#", "");
|
|
29944
30153
|
const r2 = parseInt(hex.slice(0, 2), 16) / 255;
|
|
@@ -29998,7 +30207,7 @@ function ThemeStyleInjector({
|
|
|
29998
30207
|
...fonts.regular ? { "--uf-font-family": fonts.regular } : {}
|
|
29999
30208
|
};
|
|
30000
30209
|
}, [colors2, fonts.regular]);
|
|
30001
|
-
|
|
30210
|
+
React322.useEffect(() => {
|
|
30002
30211
|
if (typeof document === "undefined") return;
|
|
30003
30212
|
if (fonts.regular) {
|
|
30004
30213
|
document.documentElement.style.setProperty("--uf-font-family", fonts.regular);
|
|
@@ -30326,7 +30535,7 @@ function TokenSelectorSheet({
|
|
|
30326
30535
|
useEffect282(() => {
|
|
30327
30536
|
setRecentTokens(getRecentTokens());
|
|
30328
30537
|
}, []);
|
|
30329
|
-
const allOptions =
|
|
30538
|
+
const allOptions = useMemo102(() => {
|
|
30330
30539
|
const options = [];
|
|
30331
30540
|
tokens.forEach((token) => {
|
|
30332
30541
|
token.chains.forEach((chain) => {
|
|
@@ -30335,7 +30544,7 @@ function TokenSelectorSheet({
|
|
|
30335
30544
|
});
|
|
30336
30545
|
return options;
|
|
30337
30546
|
}, [tokens]);
|
|
30338
|
-
const quickSelectOptions =
|
|
30547
|
+
const quickSelectOptions = useMemo102(() => {
|
|
30339
30548
|
const result = [];
|
|
30340
30549
|
const seen = /* @__PURE__ */ new Set();
|
|
30341
30550
|
const addOption = (symbol, chainType, chainId, isRecent) => {
|
|
@@ -30367,7 +30576,7 @@ function TokenSelectorSheet({
|
|
|
30367
30576
|
});
|
|
30368
30577
|
setRecentTokens(updated);
|
|
30369
30578
|
};
|
|
30370
|
-
const fuse =
|
|
30579
|
+
const fuse = useMemo102(
|
|
30371
30580
|
() => new Fuse(allOptions, {
|
|
30372
30581
|
keys: [
|
|
30373
30582
|
{ name: "token.symbol", weight: 2 },
|
|
@@ -30380,7 +30589,7 @@ function TokenSelectorSheet({
|
|
|
30380
30589
|
}),
|
|
30381
30590
|
[allOptions]
|
|
30382
30591
|
);
|
|
30383
|
-
const filteredOptions =
|
|
30592
|
+
const filteredOptions = useMemo102(() => {
|
|
30384
30593
|
if (!searchQuery.trim()) return allOptions;
|
|
30385
30594
|
const query = searchQuery.trim();
|
|
30386
30595
|
const results = fuse.search(query);
|
|
@@ -30807,7 +31016,7 @@ function useDefaultToken({
|
|
|
30807
31016
|
const [token, setToken] = useState33(null);
|
|
30808
31017
|
const [chain, setChain] = useState33(null);
|
|
30809
31018
|
const [initialSelectionDone, setInitialSelectionDone] = useState33(false);
|
|
30810
|
-
const appliedDefaultsRef =
|
|
31019
|
+
const appliedDefaultsRef = useRef112("");
|
|
30811
31020
|
useEffect292(() => {
|
|
30812
31021
|
if (!tokens.length) return;
|
|
30813
31022
|
const defaultsKey = `${defaultTokenAddress ?? ""}|${defaultSymbol ?? ""}|${defaultChainType ?? ""}|${defaultChainId ?? ""}`;
|
|
@@ -31143,14 +31352,14 @@ function useCopyAddress() {
|
|
|
31143
31352
|
return { copied, handleCopy };
|
|
31144
31353
|
}
|
|
31145
31354
|
var TooltipProvider2 = Provider;
|
|
31146
|
-
var TooltipContext =
|
|
31355
|
+
var TooltipContext = React332.createContext({
|
|
31147
31356
|
open: false,
|
|
31148
31357
|
onOpenChange: () => {
|
|
31149
31358
|
}
|
|
31150
31359
|
});
|
|
31151
|
-
var TooltipTrigger2 =
|
|
31152
|
-
const { open, onOpenChange } =
|
|
31153
|
-
const handleClick =
|
|
31360
|
+
var TooltipTrigger2 = React332.forwardRef(({ onClick, ...props }, ref) => {
|
|
31361
|
+
const { open, onOpenChange } = React332.useContext(TooltipContext);
|
|
31362
|
+
const handleClick = React332.useCallback(
|
|
31154
31363
|
(e) => {
|
|
31155
31364
|
onOpenChange(!open);
|
|
31156
31365
|
onClick?.(e);
|
|
@@ -31160,7 +31369,7 @@ var TooltipTrigger2 = React322.forwardRef(({ onClick, ...props }, ref) => {
|
|
|
31160
31369
|
return /* @__PURE__ */ jsx522(Trigger, { ref, onClick: handleClick, ...props });
|
|
31161
31370
|
});
|
|
31162
31371
|
TooltipTrigger2.displayName = Trigger.displayName;
|
|
31163
|
-
var TooltipContent2 =
|
|
31372
|
+
var TooltipContent2 = React332.forwardRef(({ className, sideOffset = 4, ...props }, ref) => {
|
|
31164
31373
|
const { themeClass, colors: colors2 } = useTheme();
|
|
31165
31374
|
return /* @__PURE__ */ jsx522(Portal3, { children: /* @__PURE__ */ jsx522(
|
|
31166
31375
|
Content22,
|
|
@@ -31191,7 +31400,7 @@ function useHypercoreActivation(params) {
|
|
|
31191
31400
|
const recipient = recipientAddress?.trim() ?? "";
|
|
31192
31401
|
const source = sourceAddress?.trim() ?? "";
|
|
31193
31402
|
const hasAddresses = !!recipient && !!source;
|
|
31194
|
-
const { data, isLoading } =
|
|
31403
|
+
const { data, isLoading } = useQuery15({
|
|
31195
31404
|
queryKey: ["unifold", "hypercoreActivation", source, recipient, publishableKey],
|
|
31196
31405
|
queryFn: () => checkHypercoreActivation(
|
|
31197
31406
|
{
|
|
@@ -31270,6 +31479,7 @@ function TransferCryptoSingleInput({
|
|
|
31270
31479
|
onDepositError,
|
|
31271
31480
|
wallets: externalWallets,
|
|
31272
31481
|
onSourceTokenChange,
|
|
31482
|
+
prefilledAmountUsd,
|
|
31273
31483
|
checkoutQuote,
|
|
31274
31484
|
isCheckoutQuoteLoading = false,
|
|
31275
31485
|
persistCheckingIndicator = false,
|
|
@@ -31317,7 +31527,7 @@ function TransferCryptoSingleInput({
|
|
|
31317
31527
|
const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
|
|
31318
31528
|
const loading = externalWallets?.length ? false : walletsLoading;
|
|
31319
31529
|
const error = walletsError?.message ?? null;
|
|
31320
|
-
const allAvailableChains =
|
|
31530
|
+
const allAvailableChains = useMemo112(() => {
|
|
31321
31531
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
31322
31532
|
supportedTokens.forEach((t13) => {
|
|
31323
31533
|
t13.chains.forEach((c) => {
|
|
@@ -31413,6 +31623,22 @@ function TransferCryptoSingleInput({
|
|
|
31413
31623
|
const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
|
|
31414
31624
|
const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
|
|
31415
31625
|
const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
|
|
31626
|
+
const parsedPrefilledUsd = useMemo112(() => {
|
|
31627
|
+
const value = parseFloat(prefilledAmountUsd ?? "");
|
|
31628
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
31629
|
+
}, [prefilledAmountUsd]);
|
|
31630
|
+
const effectivePrefilledUsd = useMemo112(() => {
|
|
31631
|
+
if (parsedPrefilledUsd === null) return null;
|
|
31632
|
+
return Math.max(parsedPrefilledUsd, minDepositUsd);
|
|
31633
|
+
}, [parsedPrefilledUsd, minDepositUsd]);
|
|
31634
|
+
const prefillDisplay = useMemo112(() => {
|
|
31635
|
+
if (effectivePrefilledUsd === null) return null;
|
|
31636
|
+
const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
|
|
31637
|
+
if (selectedToken?.is_stablecoin) {
|
|
31638
|
+
return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
|
|
31639
|
+
}
|
|
31640
|
+
return `${usdLabel} USD`;
|
|
31641
|
+
}, [effectivePrefilledUsd, selectedToken]);
|
|
31416
31642
|
return /* @__PURE__ */ jsx54(TooltipProvider2, { delayDuration: 0, skipDelayDuration: 0, children: /* @__PURE__ */ jsxs49(
|
|
31417
31643
|
"div",
|
|
31418
31644
|
{
|
|
@@ -31539,7 +31765,7 @@ function TransferCryptoSingleInput({
|
|
|
31539
31765
|
/* @__PURE__ */ jsx54("span", { children: "Retrying automatically every 5 seconds..." })
|
|
31540
31766
|
] })
|
|
31541
31767
|
] }),
|
|
31542
|
-
(checkoutQuote || isCheckoutQuoteLoading) && /* @__PURE__ */ jsxs49(
|
|
31768
|
+
(checkoutQuote || isCheckoutQuoteLoading || prefillDisplay) && /* @__PURE__ */ jsxs49(
|
|
31543
31769
|
"div",
|
|
31544
31770
|
{
|
|
31545
31771
|
className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
|
|
@@ -31583,6 +31809,13 @@ function TransferCryptoSingleInput({
|
|
|
31583
31809
|
)
|
|
31584
31810
|
]
|
|
31585
31811
|
}
|
|
31812
|
+
) : prefillDisplay ? /* @__PURE__ */ jsx54(
|
|
31813
|
+
"span",
|
|
31814
|
+
{
|
|
31815
|
+
className: "uf-text-sm uf-font-semibold",
|
|
31816
|
+
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
31817
|
+
children: prefillDisplay
|
|
31818
|
+
}
|
|
31586
31819
|
) : /* @__PURE__ */ jsx54(
|
|
31587
31820
|
"div",
|
|
31588
31821
|
{
|
|
@@ -31912,7 +32145,7 @@ function TransferCryptoSingleInput({
|
|
|
31912
32145
|
}
|
|
31913
32146
|
var Select2 = Root23;
|
|
31914
32147
|
var SelectValue2 = Value;
|
|
31915
|
-
var SelectTrigger2 =
|
|
32148
|
+
var SelectTrigger2 = React342.forwardRef(({ className, style, children, ...props }, ref) => {
|
|
31916
32149
|
const { components } = useTheme();
|
|
31917
32150
|
return /* @__PURE__ */ jsxs50(
|
|
31918
32151
|
Trigger2,
|
|
@@ -31936,7 +32169,7 @@ var SelectTrigger2 = React332.forwardRef(({ className, style, children, ...props
|
|
|
31936
32169
|
);
|
|
31937
32170
|
});
|
|
31938
32171
|
SelectTrigger2.displayName = Trigger2.displayName;
|
|
31939
|
-
var SelectScrollUpButton2 =
|
|
32172
|
+
var SelectScrollUpButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
31940
32173
|
ScrollUpButton,
|
|
31941
32174
|
{
|
|
31942
32175
|
ref,
|
|
@@ -31946,7 +32179,7 @@ var SelectScrollUpButton2 = React332.forwardRef(({ className, ...props }, ref) =
|
|
|
31946
32179
|
}
|
|
31947
32180
|
));
|
|
31948
32181
|
SelectScrollUpButton2.displayName = ScrollUpButton.displayName;
|
|
31949
|
-
var SelectScrollDownButton2 =
|
|
32182
|
+
var SelectScrollDownButton2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
31950
32183
|
ScrollDownButton,
|
|
31951
32184
|
{
|
|
31952
32185
|
ref,
|
|
@@ -31956,7 +32189,7 @@ var SelectScrollDownButton2 = React332.forwardRef(({ className, ...props }, ref)
|
|
|
31956
32189
|
}
|
|
31957
32190
|
));
|
|
31958
32191
|
SelectScrollDownButton2.displayName = ScrollDownButton.displayName;
|
|
31959
|
-
var SelectContent2 =
|
|
32192
|
+
var SelectContent2 = React342.forwardRef(({ className, style, children, position = "popper", ...props }, ref) => {
|
|
31960
32193
|
const { themeClass, colors: colors2, components } = useTheme();
|
|
31961
32194
|
return /* @__PURE__ */ jsx55(Portal4, { children: /* @__PURE__ */ jsxs50(
|
|
31962
32195
|
Content23,
|
|
@@ -31994,7 +32227,7 @@ var SelectContent2 = React332.forwardRef(({ className, style, children, position
|
|
|
31994
32227
|
) });
|
|
31995
32228
|
});
|
|
31996
32229
|
SelectContent2.displayName = Content23.displayName;
|
|
31997
|
-
var SelectLabel2 =
|
|
32230
|
+
var SelectLabel2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
31998
32231
|
Label,
|
|
31999
32232
|
{
|
|
32000
32233
|
ref,
|
|
@@ -32003,7 +32236,7 @@ var SelectLabel2 = React332.forwardRef(({ className, ...props }, ref) => /* @__P
|
|
|
32003
32236
|
}
|
|
32004
32237
|
));
|
|
32005
32238
|
SelectLabel2.displayName = Label.displayName;
|
|
32006
|
-
var SelectItem2 =
|
|
32239
|
+
var SelectItem2 = React342.forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsxs50(
|
|
32007
32240
|
Item,
|
|
32008
32241
|
{
|
|
32009
32242
|
ref,
|
|
@@ -32019,7 +32252,7 @@ var SelectItem2 = React332.forwardRef(({ className, children, ...props }, ref) =
|
|
|
32019
32252
|
}
|
|
32020
32253
|
));
|
|
32021
32254
|
SelectItem2.displayName = Item.displayName;
|
|
32022
|
-
var SelectSeparator2 =
|
|
32255
|
+
var SelectSeparator2 = React342.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx55(
|
|
32023
32256
|
Separator,
|
|
32024
32257
|
{
|
|
32025
32258
|
ref,
|
|
@@ -32047,6 +32280,7 @@ function TransferCryptoDoubleInput({
|
|
|
32047
32280
|
defaultSourceChainId,
|
|
32048
32281
|
defaultSourceTokenAddress,
|
|
32049
32282
|
defaultSourceSymbol,
|
|
32283
|
+
prefilledAmountUsd,
|
|
32050
32284
|
depositConfirmationMode = "auto_ui",
|
|
32051
32285
|
onExecutionsChange,
|
|
32052
32286
|
onDepositSuccess,
|
|
@@ -32093,7 +32327,7 @@ function TransferCryptoDoubleInput({
|
|
|
32093
32327
|
const wallets = externalWallets?.length ? externalWallets : depositAddressResponse?.data ?? [];
|
|
32094
32328
|
const loading = externalWallets?.length ? false : walletsLoading;
|
|
32095
32329
|
const error = walletsError?.message ?? null;
|
|
32096
|
-
const allAvailableChains =
|
|
32330
|
+
const allAvailableChains = useMemo122(() => {
|
|
32097
32331
|
const chainsMap = /* @__PURE__ */ new Map();
|
|
32098
32332
|
supportedTokens.forEach((t13) => {
|
|
32099
32333
|
t13.chains.forEach((c) => {
|
|
@@ -32171,6 +32405,22 @@ function TransferCryptoDoubleInput({
|
|
|
32171
32405
|
const maxSlippage = currentChainFromBackend?.max_slippage_percent ?? 0.25;
|
|
32172
32406
|
const processingTime = currentChainFromBackend?.estimated_processing_time ?? null;
|
|
32173
32407
|
const minDepositUsd = currentChainFromBackend?.minimum_deposit_amount_usd ?? 3;
|
|
32408
|
+
const parsedPrefilledUsd = useMemo122(() => {
|
|
32409
|
+
const value = parseFloat(prefilledAmountUsd ?? "");
|
|
32410
|
+
return Number.isFinite(value) && value > 0 ? value : null;
|
|
32411
|
+
}, [prefilledAmountUsd]);
|
|
32412
|
+
const effectivePrefilledUsd = useMemo122(() => {
|
|
32413
|
+
if (parsedPrefilledUsd === null) return null;
|
|
32414
|
+
return Math.max(parsedPrefilledUsd, minDepositUsd);
|
|
32415
|
+
}, [parsedPrefilledUsd, minDepositUsd]);
|
|
32416
|
+
const prefillDisplay = useMemo122(() => {
|
|
32417
|
+
if (effectivePrefilledUsd === null) return null;
|
|
32418
|
+
const usdLabel = `$${effectivePrefilledUsd.toFixed(2)}`;
|
|
32419
|
+
if (selectedToken?.is_stablecoin) {
|
|
32420
|
+
return `${effectivePrefilledUsd.toFixed(2)} ${selectedToken.symbol} (${usdLabel})`;
|
|
32421
|
+
}
|
|
32422
|
+
return `${usdLabel} USD`;
|
|
32423
|
+
}, [effectivePrefilledUsd, selectedToken]);
|
|
32174
32424
|
const renderTokenItem = (tokenData) => {
|
|
32175
32425
|
return /* @__PURE__ */ jsxs51("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
|
|
32176
32426
|
/* @__PURE__ */ jsx56(
|
|
@@ -32351,6 +32601,35 @@ function TransferCryptoDoubleInput({
|
|
|
32351
32601
|
/* @__PURE__ */ jsx56("span", { children: "Retrying automatically every 5 seconds..." })
|
|
32352
32602
|
] })
|
|
32353
32603
|
] }),
|
|
32604
|
+
prefillDisplay && /* @__PURE__ */ jsxs51(
|
|
32605
|
+
"div",
|
|
32606
|
+
{
|
|
32607
|
+
className: "uf-rounded-xl uf-px-3 uf-py-2 uf-flex uf-items-center uf-justify-between",
|
|
32608
|
+
style: {
|
|
32609
|
+
backgroundColor: components.card.backgroundColor,
|
|
32610
|
+
border: `${components.card.borderWidth}px solid ${components.card.borderColor}`,
|
|
32611
|
+
borderRadius: components.card.borderRadius
|
|
32612
|
+
},
|
|
32613
|
+
children: [
|
|
32614
|
+
/* @__PURE__ */ jsx56(
|
|
32615
|
+
"span",
|
|
32616
|
+
{
|
|
32617
|
+
className: "uf-text-xs",
|
|
32618
|
+
style: { color: components.card.subtitleColor, fontFamily: fonts.regular },
|
|
32619
|
+
children: "You send"
|
|
32620
|
+
}
|
|
32621
|
+
),
|
|
32622
|
+
/* @__PURE__ */ jsx56(
|
|
32623
|
+
"span",
|
|
32624
|
+
{
|
|
32625
|
+
className: "uf-text-sm uf-font-semibold",
|
|
32626
|
+
style: { color: components.card.titleColor, fontFamily: fonts.semibold },
|
|
32627
|
+
children: prefillDisplay
|
|
32628
|
+
}
|
|
32629
|
+
)
|
|
32630
|
+
]
|
|
32631
|
+
}
|
|
32632
|
+
),
|
|
32354
32633
|
/* @__PURE__ */ jsxs51("div", { className: "uf-flex uf-flex-col uf-items-center uf-pt-2", children: [
|
|
32355
32634
|
/* @__PURE__ */ jsx56(
|
|
32356
32635
|
"div",
|
|
@@ -32689,7 +32968,7 @@ function useDepositQuote(params) {
|
|
|
32689
32968
|
...adjustForSlippage ? { adjust_for_slippage: true } : {},
|
|
32690
32969
|
...stablecoinParity ? { stablecoin_parity: true } : {}
|
|
32691
32970
|
};
|
|
32692
|
-
return
|
|
32971
|
+
return useQuery16({
|
|
32693
32972
|
queryKey: [
|
|
32694
32973
|
"unifold",
|
|
32695
32974
|
"depositQuote",
|
|
@@ -32719,7 +32998,7 @@ function useExternalWallets({
|
|
|
32719
32998
|
publishableKey,
|
|
32720
32999
|
enabled = true
|
|
32721
33000
|
}) {
|
|
32722
|
-
const { data: wallets = [], isLoading } =
|
|
33001
|
+
const { data: wallets = [], isLoading } = useQuery17({
|
|
32723
33002
|
queryKey: ["unifold", "external-wallets", publishableKey],
|
|
32724
33003
|
queryFn: () => getExternalWallets(publishableKey).then((res) => res.data),
|
|
32725
33004
|
enabled: enabled && !!publishableKey,
|
|
@@ -33938,7 +34217,7 @@ function WalletConnect({
|
|
|
33938
34217
|
amountQuickSelect = "percentage",
|
|
33939
34218
|
onWalletDisconnect,
|
|
33940
34219
|
onWalletConnected,
|
|
33941
|
-
|
|
34220
|
+
prefilledAmountUsd,
|
|
33942
34221
|
checkoutAmountUsd,
|
|
33943
34222
|
checkoutReceivedUsd,
|
|
33944
34223
|
onNewDeposit,
|
|
@@ -33960,28 +34239,28 @@ function WalletConnect({
|
|
|
33960
34239
|
onExecutionsChange
|
|
33961
34240
|
}) {
|
|
33962
34241
|
const { colors: colors2, fonts, components, mode } = useTheme();
|
|
33963
|
-
const walletProvidedAtMount =
|
|
33964
|
-
const [activeWalletInfo, setActiveWalletInfo] =
|
|
34242
|
+
const walletProvidedAtMount = React352.useRef(!!initialWalletInfo && !!initialDepositWallet);
|
|
34243
|
+
const [activeWalletInfo, setActiveWalletInfo] = React352.useState(
|
|
33965
34244
|
initialWalletInfo ?? null
|
|
33966
34245
|
);
|
|
33967
|
-
const [activeDepositWallet, setActiveDepositWallet] =
|
|
34246
|
+
const [activeDepositWallet, setActiveDepositWallet] = React352.useState(
|
|
33968
34247
|
initialDepositWallet ?? null
|
|
33969
34248
|
);
|
|
33970
34249
|
const initialView = initialWalletInfo && initialDepositWallet ? "select_token" : "select_wallet";
|
|
33971
|
-
const [view, setView] =
|
|
33972
|
-
const [isTransitioning, setIsTransitioning] =
|
|
33973
|
-
const viewRef =
|
|
34250
|
+
const [view, setView] = React352.useState(initialView);
|
|
34251
|
+
const [isTransitioning, setIsTransitioning] = React352.useState(false);
|
|
34252
|
+
const viewRef = React352.useRef(initialView);
|
|
33974
34253
|
const standalone = !canGoBack && !walletProvidedAtMount.current;
|
|
33975
34254
|
const { wallet: detectedWallet, isLoading: detectingWallet } = useDetectedBrowserWallet({
|
|
33976
34255
|
enabled: standalone
|
|
33977
34256
|
});
|
|
33978
|
-
const [autoResolved, setAutoResolved] =
|
|
33979
|
-
const [selectedWalletDef, setSelectedWalletDef] =
|
|
33980
|
-
const [connectingNetwork, setConnectingNetwork] =
|
|
33981
|
-
const [walletError, setWalletError] =
|
|
33982
|
-
const [isWalletConnecting, setIsWalletConnecting] =
|
|
33983
|
-
const [eip6963ProviderCount, setEip6963ProviderCount] =
|
|
33984
|
-
|
|
34257
|
+
const [autoResolved, setAutoResolved] = React352.useState(false);
|
|
34258
|
+
const [selectedWalletDef, setSelectedWalletDef] = React352.useState(null);
|
|
34259
|
+
const [connectingNetwork, setConnectingNetwork] = React352.useState(null);
|
|
34260
|
+
const [walletError, setWalletError] = React352.useState(null);
|
|
34261
|
+
const [isWalletConnecting, setIsWalletConnecting] = React352.useState(false);
|
|
34262
|
+
const [eip6963ProviderCount, setEip6963ProviderCount] = React352.useState(0);
|
|
34263
|
+
React352.useEffect(() => {
|
|
33985
34264
|
const store = getEip6963Store();
|
|
33986
34265
|
if (!store) return;
|
|
33987
34266
|
setEip6963ProviderCount(store.getProviders().length);
|
|
@@ -33990,7 +34269,7 @@ function WalletConnect({
|
|
|
33990
34269
|
});
|
|
33991
34270
|
}, []);
|
|
33992
34271
|
const { wallets: backendWallets } = useExternalWallets({ publishableKey });
|
|
33993
|
-
const walletDefinitions =
|
|
34272
|
+
const walletDefinitions = React352.useMemo(
|
|
33994
34273
|
() => backendWallets.length > 0 ? backendWallets.map((w) => ({
|
|
33995
34274
|
id: w.id,
|
|
33996
34275
|
name: w.name,
|
|
@@ -34001,32 +34280,32 @@ function WalletConnect({
|
|
|
34001
34280
|
})) : FALLBACK_WALLET_DEFINITIONS,
|
|
34002
34281
|
[backendWallets]
|
|
34003
34282
|
);
|
|
34004
|
-
const [recentWalletId, setRecentWalletIdState] =
|
|
34005
|
-
|
|
34283
|
+
const [recentWalletId, setRecentWalletIdState] = React352.useState(getLastOpenedWallet);
|
|
34284
|
+
React352.useEffect(() => {
|
|
34006
34285
|
if (view === "select_wallet") {
|
|
34007
34286
|
setRecentWalletIdState(getLastOpenedWallet());
|
|
34008
34287
|
}
|
|
34009
34288
|
}, [view]);
|
|
34010
|
-
const availableWallets =
|
|
34289
|
+
const availableWallets = React352.useMemo(
|
|
34011
34290
|
() => detectAvailableWallets(walletDefinitions, recentWalletId),
|
|
34012
34291
|
[walletDefinitions, eip6963ProviderCount, recentWalletId]
|
|
34013
34292
|
);
|
|
34014
|
-
const [isMobile, setIsMobile] =
|
|
34015
|
-
|
|
34293
|
+
const [isMobile, setIsMobile] = React352.useState(false);
|
|
34294
|
+
React352.useEffect(() => {
|
|
34016
34295
|
setIsMobile(isMobileDevice());
|
|
34017
34296
|
}, []);
|
|
34018
|
-
const mobileDepositAddresses =
|
|
34297
|
+
const mobileDepositAddresses = React352.useMemo(
|
|
34019
34298
|
() => (depositWallets ?? []).map((w) => ({ chain_type: w.chain_type, address: w.address })),
|
|
34020
34299
|
[depositWallets]
|
|
34021
34300
|
);
|
|
34022
|
-
const mobileDepositWalletIds =
|
|
34301
|
+
const mobileDepositWalletIds = React352.useMemo(
|
|
34023
34302
|
() => (depositWallets ?? []).filter((w) => w.chain_type === "ethereum" || w.chain_type === "solana").map((w) => w.id),
|
|
34024
34303
|
[depositWallets]
|
|
34025
34304
|
);
|
|
34026
|
-
const [mobileRedirect, setMobileRedirect] =
|
|
34027
|
-
const [pendingMobileWallet, setPendingMobileWallet] =
|
|
34028
|
-
const [awaitingMobileDeposit, setAwaitingMobileDeposit] =
|
|
34029
|
-
|
|
34305
|
+
const [mobileRedirect, setMobileRedirect] = React352.useState(null);
|
|
34306
|
+
const [pendingMobileWallet, setPendingMobileWallet] = React352.useState(null);
|
|
34307
|
+
const [awaitingMobileDeposit, setAwaitingMobileDeposit] = React352.useState(false);
|
|
34308
|
+
React352.useEffect(() => {
|
|
34030
34309
|
if (!standalone || autoResolved || detectingWallet) return;
|
|
34031
34310
|
if (!detectedWallet) {
|
|
34032
34311
|
setAutoResolved(true);
|
|
@@ -34052,32 +34331,36 @@ function WalletConnect({
|
|
|
34052
34331
|
depositWallets,
|
|
34053
34332
|
depositWalletsLoading
|
|
34054
34333
|
]);
|
|
34055
|
-
|
|
34334
|
+
React352.useEffect(() => {
|
|
34056
34335
|
if (!standalone || autoResolved) return;
|
|
34057
34336
|
const t13 = setTimeout(() => setAutoResolved(true), 5e3);
|
|
34058
34337
|
return () => clearTimeout(t13);
|
|
34059
34338
|
}, [standalone, autoResolved]);
|
|
34060
|
-
const [balances, setBalances] =
|
|
34061
|
-
const [isLoading, setIsLoading] =
|
|
34062
|
-
const [selectedBalance, setSelectedBalance] =
|
|
34063
|
-
const [totalBalanceUsd, setTotalBalanceUsd] =
|
|
34064
|
-
const [error, setError] =
|
|
34065
|
-
const [isDisconnectingWallet, setIsDisconnectingWallet] =
|
|
34066
|
-
const [amountUsd, setAmountUsd] =
|
|
34067
|
-
const [isConfirming, setIsConfirming] =
|
|
34068
|
-
const [hasSignedTransaction, setHasSignedTransaction] =
|
|
34069
|
-
const [tokenChainDetails, setTokenChainDetails] =
|
|
34070
|
-
const [loadingTokenDetails, setLoadingTokenDetails] =
|
|
34071
|
-
const [showTransactionDetails, setShowTransactionDetails] =
|
|
34072
|
-
const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] =
|
|
34339
|
+
const [balances, setBalances] = React352.useState([]);
|
|
34340
|
+
const [isLoading, setIsLoading] = React352.useState(false);
|
|
34341
|
+
const [selectedBalance, setSelectedBalance] = React352.useState(null);
|
|
34342
|
+
const [totalBalanceUsd, setTotalBalanceUsd] = React352.useState(null);
|
|
34343
|
+
const [error, setError] = React352.useState(null);
|
|
34344
|
+
const [isDisconnectingWallet, setIsDisconnectingWallet] = React352.useState(false);
|
|
34345
|
+
const [amountUsd, setAmountUsd] = React352.useState(prefilledAmountUsd ?? "");
|
|
34346
|
+
const [isConfirming, setIsConfirming] = React352.useState(false);
|
|
34347
|
+
const [hasSignedTransaction, setHasSignedTransaction] = React352.useState(false);
|
|
34348
|
+
const [tokenChainDetails, setTokenChainDetails] = React352.useState(null);
|
|
34349
|
+
const [loadingTokenDetails, setLoadingTokenDetails] = React352.useState(false);
|
|
34350
|
+
const [showTransactionDetails, setShowTransactionDetails] = React352.useState(false);
|
|
34351
|
+
const [receivedUsdAtSubmission, setReceivedUsdAtSubmission] = React352.useState(null);
|
|
34073
34352
|
const walletInfo = activeWalletInfo;
|
|
34074
34353
|
const depositWallet = activeDepositWallet;
|
|
34075
34354
|
const hasWallet = !!activeWalletInfo && !!activeDepositWallet;
|
|
34355
|
+
React352.useEffect(() => {
|
|
34356
|
+
const cleanedPrefilled = prefilledAmountUsd?.replace(/[^0-9.]/g, "") ?? "";
|
|
34357
|
+
setAmountUsd(cleanedPrefilled);
|
|
34358
|
+
}, [prefilledAmountUsd]);
|
|
34076
34359
|
const chainType = activeDepositWallet?.chain_type ?? "ethereum";
|
|
34077
34360
|
const recipientAddress = activeDepositWallet?.address ?? "";
|
|
34078
34361
|
const isCheckoutMode = !!checkoutAmountUsd;
|
|
34079
34362
|
const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
|
|
34080
|
-
const transitionTo =
|
|
34363
|
+
const transitionTo = React352.useCallback((nextView) => {
|
|
34081
34364
|
if (nextView === viewRef.current) return;
|
|
34082
34365
|
setIsTransitioning(true);
|
|
34083
34366
|
setTimeout(() => {
|
|
@@ -34142,7 +34425,7 @@ function WalletConnect({
|
|
|
34142
34425
|
if (!selectedWalletDef) return;
|
|
34143
34426
|
handleConnectWallet(selectedWalletDef, network);
|
|
34144
34427
|
};
|
|
34145
|
-
|
|
34428
|
+
React352.useEffect(() => {
|
|
34146
34429
|
if (!pendingMobileWallet) return;
|
|
34147
34430
|
if (mobileDepositAddresses.length > 0) {
|
|
34148
34431
|
const wallet = pendingMobileWallet;
|
|
@@ -34306,7 +34589,7 @@ function WalletConnect({
|
|
|
34306
34589
|
publishableKey,
|
|
34307
34590
|
enabled: !!activeWalletInfo && !!recipientAddress
|
|
34308
34591
|
});
|
|
34309
|
-
const effectiveDestinationAmount =
|
|
34592
|
+
const effectiveDestinationAmount = React352.useMemo(() => {
|
|
34310
34593
|
if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
|
|
34311
34594
|
if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
|
|
34312
34595
|
const remaining = BigInt(checkoutRemainingBaseUnits);
|
|
@@ -34334,7 +34617,7 @@ function WalletConnect({
|
|
|
34334
34617
|
stablecoinParity,
|
|
34335
34618
|
enabled: isCheckoutMode && !!selectedToken && !!checkoutDestination && effectiveDestinationAmount !== "0"
|
|
34336
34619
|
});
|
|
34337
|
-
const activeCheckoutQuote =
|
|
34620
|
+
const activeCheckoutQuote = React352.useMemo(() => {
|
|
34338
34621
|
if (!isCheckoutMode) return null;
|
|
34339
34622
|
if (walletCheckoutQuote)
|
|
34340
34623
|
return {
|
|
@@ -34364,10 +34647,10 @@ function WalletConnect({
|
|
|
34364
34647
|
onDepositSuccess,
|
|
34365
34648
|
onDepositError
|
|
34366
34649
|
});
|
|
34367
|
-
|
|
34650
|
+
React352.useEffect(() => {
|
|
34368
34651
|
onExecutionsChange?.(depositExecutions);
|
|
34369
34652
|
}, [depositExecutions, onExecutionsChange]);
|
|
34370
|
-
const latestDepositExecution =
|
|
34653
|
+
const latestDepositExecution = React352.useMemo(() => {
|
|
34371
34654
|
if (depositExecutions.length === 0) return null;
|
|
34372
34655
|
return [...depositExecutions].sort((a, b) => {
|
|
34373
34656
|
const ta = a.created_at ? new Date(a.created_at).getTime() : 0;
|
|
@@ -34375,21 +34658,21 @@ function WalletConnect({
|
|
|
34375
34658
|
return tb - ta;
|
|
34376
34659
|
})[0];
|
|
34377
34660
|
}, [depositExecutions]);
|
|
34378
|
-
|
|
34661
|
+
React352.useEffect(() => {
|
|
34379
34662
|
if (awaitingMobileDeposit && latestDepositExecution && (viewRef.current === "mobile_redirect" || viewRef.current === "connecting")) {
|
|
34380
34663
|
transitionTo("mobile_deposit_status");
|
|
34381
34664
|
}
|
|
34382
34665
|
}, [awaitingMobileDeposit, latestDepositExecution, transitionTo]);
|
|
34383
|
-
|
|
34384
|
-
if (!
|
|
34666
|
+
React352.useEffect(() => {
|
|
34667
|
+
if (!isCheckoutMode || !tokenChainDetails || view !== "enter_amount") return;
|
|
34385
34668
|
const minDeposit = tokenChainDetails.minimum_deposit_amount_usd || 0;
|
|
34386
34669
|
const currentAmount = parseFloat(amountUsd) || 0;
|
|
34387
34670
|
if (currentAmount > 0 && currentAmount < minDeposit) setAmountUsd(minDeposit.toFixed(2));
|
|
34388
|
-
}, [tokenChainDetails, view,
|
|
34389
|
-
|
|
34671
|
+
}, [isCheckoutMode, tokenChainDetails, view, amountUsd]);
|
|
34672
|
+
React352.useEffect(() => {
|
|
34390
34673
|
if (view === "review") setShowTransactionDetails(false);
|
|
34391
34674
|
}, [view]);
|
|
34392
|
-
|
|
34675
|
+
React352.useEffect(() => {
|
|
34393
34676
|
if (view !== "enter_amount" && view !== "review" || !selectedBalance || !activeDepositWallet)
|
|
34394
34677
|
return;
|
|
34395
34678
|
let cancelled = false;
|
|
@@ -34426,7 +34709,7 @@ function WalletConnect({
|
|
|
34426
34709
|
cancelled = true;
|
|
34427
34710
|
};
|
|
34428
34711
|
}, [view, selectedBalance, publishableKey, activeDepositWallet]);
|
|
34429
|
-
|
|
34712
|
+
React352.useEffect(() => {
|
|
34430
34713
|
if (!activeWalletInfo || !activeDepositWallet) return;
|
|
34431
34714
|
let cancelled = false;
|
|
34432
34715
|
setIsLoading(true);
|
|
@@ -34491,21 +34774,21 @@ function WalletConnect({
|
|
|
34491
34774
|
defaultSourceTokenAddress,
|
|
34492
34775
|
defaultSourceSymbol
|
|
34493
34776
|
]);
|
|
34494
|
-
const usdToTokenRate =
|
|
34777
|
+
const usdToTokenRate = React352.useMemo(() => {
|
|
34495
34778
|
if (!selectedBalance || !selectedBalance.amount_usd || !selectedToken) return 0;
|
|
34496
34779
|
const balanceAmount = Number(selectedBalance.amount) / 10 ** selectedToken.decimals;
|
|
34497
34780
|
const balanceUsd = parseFloat(selectedBalance.amount_usd);
|
|
34498
34781
|
if (balanceAmount === 0 || balanceUsd === 0) return 0;
|
|
34499
34782
|
return balanceAmount / balanceUsd;
|
|
34500
34783
|
}, [selectedBalance, selectedToken]);
|
|
34501
|
-
const tokenAmount =
|
|
34784
|
+
const tokenAmount = React352.useMemo(() => {
|
|
34502
34785
|
if (isCheckoutMode && activeCheckoutQuote && selectedToken)
|
|
34503
34786
|
return Number(activeCheckoutQuote.sourceAmount) / 10 ** activeCheckoutQuote.sourceTokenDecimals;
|
|
34504
34787
|
const usdNum = parseFloat(amountUsd) || 0;
|
|
34505
34788
|
if (usdNum === 0 || usdToTokenRate === 0) return 0;
|
|
34506
34789
|
return usdNum * usdToTokenRate;
|
|
34507
34790
|
}, [amountUsd, usdToTokenRate, isCheckoutMode, activeCheckoutQuote, selectedToken]);
|
|
34508
|
-
|
|
34791
|
+
React352.useEffect(() => {
|
|
34509
34792
|
if (isCheckoutMode && activeCheckoutQuote?.sourceAmountUsd && view === "enter_amount")
|
|
34510
34793
|
setAmountUsd(activeCheckoutQuote.sourceAmountUsd);
|
|
34511
34794
|
}, [isCheckoutMode, activeCheckoutQuote, view]);
|
|
@@ -34514,7 +34797,7 @@ function WalletConnect({
|
|
|
34514
34797
|
const inputUsdNum = parseFloat(amountUsd) || 0;
|
|
34515
34798
|
const minDepositUsd = tokenChainDetails?.minimum_deposit_amount_usd || 0;
|
|
34516
34799
|
const isValidAmount = isCheckoutMode && activeCheckoutQuote ? tokenAmount > 0 && tokenAmount <= maxTokenAmount : inputUsdNum > 0 && inputUsdNum <= maxUsdAmount && inputUsdNum >= minDepositUsd;
|
|
34517
|
-
const formattedTokenAmount =
|
|
34800
|
+
const formattedTokenAmount = React352.useMemo(() => {
|
|
34518
34801
|
if (tokenAmount === 0 || !selectedToken) return null;
|
|
34519
34802
|
return `${tokenAmount.toFixed(6)} ${selectedToken.symbol}`.replace(/\.?0+$/, "");
|
|
34520
34803
|
}, [tokenAmount, selectedToken]);
|
|
@@ -34547,7 +34830,7 @@ function WalletConnect({
|
|
|
34547
34830
|
break;
|
|
34548
34831
|
case "enter_amount":
|
|
34549
34832
|
transitionTo("select_token");
|
|
34550
|
-
setAmountUsd(
|
|
34833
|
+
setAmountUsd(prefilledAmountUsd ?? "");
|
|
34551
34834
|
setTokenChainDetails(null);
|
|
34552
34835
|
break;
|
|
34553
34836
|
case "review":
|
|
@@ -34579,7 +34862,7 @@ function WalletConnect({
|
|
|
34579
34862
|
setSelectedBalance(null);
|
|
34580
34863
|
setBalances([]);
|
|
34581
34864
|
setTotalBalanceUsd(null);
|
|
34582
|
-
setAmountUsd(
|
|
34865
|
+
setAmountUsd(prefilledAmountUsd ?? "");
|
|
34583
34866
|
setError(null);
|
|
34584
34867
|
};
|
|
34585
34868
|
if (standalone) {
|
|
@@ -35303,6 +35586,15 @@ function SkeletonButton({ variant = "default" }) {
|
|
|
35303
35586
|
] });
|
|
35304
35587
|
}
|
|
35305
35588
|
var t8 = i18n2.depositModal;
|
|
35589
|
+
function normalizePrefilledUsdAmount(value) {
|
|
35590
|
+
if (!value) return void 0;
|
|
35591
|
+
const cleaned = value.replace(/[^0-9.]/g, "");
|
|
35592
|
+
if (!cleaned) return void 0;
|
|
35593
|
+
const normalizedNumeric = cleaned.replace(/(\..*)\./g, "$1");
|
|
35594
|
+
const parsed = parseFloat(normalizedNumeric);
|
|
35595
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return void 0;
|
|
35596
|
+
return parseFloat(parsed.toFixed(2)).toString();
|
|
35597
|
+
}
|
|
35306
35598
|
function depositTabForScreen(screen) {
|
|
35307
35599
|
return screen === "card" || screen === "cashapp" || screen === "bank_transfer" || screen === "stripe_link" || screen === "apple_pay" ? "cash" : "crypto";
|
|
35308
35600
|
}
|
|
@@ -35322,6 +35614,7 @@ function DepositModal({
|
|
|
35322
35614
|
defaultSourceChainId,
|
|
35323
35615
|
defaultSourceTokenAddress,
|
|
35324
35616
|
defaultSourceSymbol,
|
|
35617
|
+
prefilledAmountUsd,
|
|
35325
35618
|
hideDepositTracker,
|
|
35326
35619
|
showBalanceHeader = false,
|
|
35327
35620
|
transferInputVariant = "double_input",
|
|
@@ -35357,7 +35650,11 @@ function DepositModal({
|
|
|
35357
35650
|
depositTrackerSubTitle = t8.depositTracker.subtitle
|
|
35358
35651
|
}) {
|
|
35359
35652
|
const { colors: colors2, fonts, components } = useTheme();
|
|
35360
|
-
const
|
|
35653
|
+
const normalizedPrefilledAmountUsd = useMemo14(
|
|
35654
|
+
() => normalizePrefilledUsdAmount(prefilledAmountUsd),
|
|
35655
|
+
[prefilledAmountUsd]
|
|
35656
|
+
);
|
|
35657
|
+
const onDepositSuccessFor = useCallback10(
|
|
35361
35658
|
(method) => onDepositSuccess || onEvent ? (data) => {
|
|
35362
35659
|
const payload = { ...data, method };
|
|
35363
35660
|
onDepositSuccess?.(payload);
|
|
@@ -35370,11 +35667,11 @@ function DepositModal({
|
|
|
35370
35667
|
} : void 0,
|
|
35371
35668
|
[onDepositSuccess, onEvent]
|
|
35372
35669
|
);
|
|
35373
|
-
const onDepositErrorFor =
|
|
35670
|
+
const onDepositErrorFor = useCallback10(
|
|
35374
35671
|
(method) => onDepositError ? (error) => onDepositError({ ...error, method }) : void 0,
|
|
35375
35672
|
[onDepositError]
|
|
35376
35673
|
);
|
|
35377
|
-
const effectiveInitialScreen =
|
|
35674
|
+
const effectiveInitialScreen = useMemo14(() => {
|
|
35378
35675
|
const s = initialScreen ?? "main";
|
|
35379
35676
|
if (s === "tracker" && hideDepositTracker === true) return "main";
|
|
35380
35677
|
if (s === "cashapp" && enableCashApp === false) return "main";
|
|
@@ -35400,7 +35697,7 @@ function DepositModal({
|
|
|
35400
35697
|
enableStripeLink
|
|
35401
35698
|
]);
|
|
35402
35699
|
const [containerEl, setContainerEl] = useState40(null);
|
|
35403
|
-
const containerCallbackRef =
|
|
35700
|
+
const containerCallbackRef = useCallback10((el) => {
|
|
35404
35701
|
setContainerEl(el);
|
|
35405
35702
|
}, []);
|
|
35406
35703
|
const [view, setView] = useState40(effectiveInitialScreen);
|
|
@@ -35409,7 +35706,7 @@ function DepositModal({
|
|
|
35409
35706
|
const [depositTab, setDepositTab] = useState40(
|
|
35410
35707
|
() => depositTabForScreen(effectiveInitialScreen)
|
|
35411
35708
|
);
|
|
35412
|
-
const resetViewTimeoutRef =
|
|
35709
|
+
const resetViewTimeoutRef = useRef132(null);
|
|
35413
35710
|
const [cardView, setCardView] = useState40("amount");
|
|
35414
35711
|
const [exchangeView, setExchangeView] = useState40("providers");
|
|
35415
35712
|
const [browserWalletModalOpen, setBrowserWalletModalOpen] = useState40(false);
|
|
@@ -35753,7 +36050,7 @@ function DepositModal({
|
|
|
35753
36050
|
);
|
|
35754
36051
|
const [cashAppView, setCashAppView] = useState40("amount");
|
|
35755
36052
|
const [stripeLinkStep, setStripeLinkStep] = useState40("amount");
|
|
35756
|
-
const stripeLinkBackRef =
|
|
36053
|
+
const stripeLinkBackRef = useRef132(null);
|
|
35757
36054
|
useEffect34(() => {
|
|
35758
36055
|
if (view === "stripe_link" && !showStripeLink && effectiveInitialScreen === "main") {
|
|
35759
36056
|
setView("main");
|
|
@@ -35762,7 +36059,7 @@ function DepositModal({
|
|
|
35762
36059
|
}, [view, showStripeLink, effectiveInitialScreen]);
|
|
35763
36060
|
const [cashAppAmount, setCashAppAmount] = useState40("");
|
|
35764
36061
|
const [applePayView, setApplePayView] = useState40("email_input");
|
|
35765
|
-
const applePayHandleRef =
|
|
36062
|
+
const applePayHandleRef = useRef132(null);
|
|
35766
36063
|
const applePayHeaderTitle = (() => {
|
|
35767
36064
|
switch (applePayView) {
|
|
35768
36065
|
case "email_input":
|
|
@@ -36222,6 +36519,7 @@ function DepositModal({
|
|
|
36222
36519
|
defaultSourceChainId,
|
|
36223
36520
|
defaultSourceTokenAddress,
|
|
36224
36521
|
defaultSourceSymbol,
|
|
36522
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
36225
36523
|
depositConfirmationMode,
|
|
36226
36524
|
onExecutionsChange: setDepositExecutions,
|
|
36227
36525
|
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
@@ -36241,6 +36539,7 @@ function DepositModal({
|
|
|
36241
36539
|
defaultSourceChainId,
|
|
36242
36540
|
defaultSourceTokenAddress,
|
|
36243
36541
|
defaultSourceSymbol,
|
|
36542
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
36244
36543
|
depositConfirmationMode,
|
|
36245
36544
|
onExecutionsChange: setDepositExecutions,
|
|
36246
36545
|
onDepositSuccess: onDepositSuccessFor("transfer"),
|
|
@@ -36325,7 +36624,8 @@ function DepositModal({
|
|
|
36325
36624
|
wallets,
|
|
36326
36625
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
36327
36626
|
hideDepositFlowInfo,
|
|
36328
|
-
hideDisplayDescription
|
|
36627
|
+
hideDisplayDescription,
|
|
36628
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
36329
36629
|
}
|
|
36330
36630
|
),
|
|
36331
36631
|
depositPoweredByFooter
|
|
@@ -36390,7 +36690,8 @@ function DepositModal({
|
|
|
36390
36690
|
defaultSourceChainType,
|
|
36391
36691
|
defaultSourceChainId,
|
|
36392
36692
|
defaultSourceTokenAddress,
|
|
36393
|
-
defaultSourceSymbol
|
|
36693
|
+
defaultSourceSymbol,
|
|
36694
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
36394
36695
|
}
|
|
36395
36696
|
),
|
|
36396
36697
|
depositPoweredByFooter
|
|
@@ -36422,6 +36723,7 @@ function DepositModal({
|
|
|
36422
36723
|
onDepositSuccess: onDepositSuccessFor("wallet_connect"),
|
|
36423
36724
|
onDepositError: onDepositErrorFor("wallet_connect"),
|
|
36424
36725
|
amountQuickSelect: browserWalletAmountQuickSelect,
|
|
36726
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
36425
36727
|
onWalletDisconnect: handleWalletDisconnect,
|
|
36426
36728
|
onWalletConnected: (info, dw) => {
|
|
36427
36729
|
setBrowserWalletInfo({ ...info, depositWallet: dw });
|
|
@@ -36470,7 +36772,8 @@ function DepositModal({
|
|
|
36470
36772
|
assetCdnUrl: projectConfig?.asset_cdn_url,
|
|
36471
36773
|
onEvent,
|
|
36472
36774
|
onDepositSuccess,
|
|
36473
|
-
onDepositError
|
|
36775
|
+
onDepositError,
|
|
36776
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd
|
|
36474
36777
|
}
|
|
36475
36778
|
),
|
|
36476
36779
|
depositPoweredByFooter
|
|
@@ -36482,7 +36785,7 @@ function DepositModal({
|
|
|
36482
36785
|
title: "Deposit with Link",
|
|
36483
36786
|
showBack: stripeLinkStep !== "checkout" && stripeLinkStep !== "success",
|
|
36484
36787
|
onBack: handleBack,
|
|
36485
|
-
showClose: stripeLinkStep !== "checkout",
|
|
36788
|
+
showClose: stripeLinkStep !== "checkout" && stripeLinkStep !== "auth",
|
|
36486
36789
|
onClose: handleClose
|
|
36487
36790
|
}
|
|
36488
36791
|
),
|
|
@@ -36513,6 +36816,8 @@ function DepositModal({
|
|
|
36513
36816
|
destinationChainType,
|
|
36514
36817
|
destinationChainId,
|
|
36515
36818
|
destinationTokenAddress,
|
|
36819
|
+
countryCode: userIpInfo?.alpha2,
|
|
36820
|
+
subdivisionCode: userIpInfo?.subdivisionCode ?? void 0,
|
|
36516
36821
|
wallets,
|
|
36517
36822
|
email: userEmail,
|
|
36518
36823
|
iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/link.svg` : void 0,
|
|
@@ -36552,6 +36857,7 @@ function DepositModal({
|
|
|
36552
36857
|
onEvent,
|
|
36553
36858
|
onDepositSuccess: onDepositSuccessFor("cashapp"),
|
|
36554
36859
|
onDepositError: onDepositErrorFor("cashapp"),
|
|
36860
|
+
prefilledAmountUsd: normalizedPrefilledAmountUsd,
|
|
36555
36861
|
wallets
|
|
36556
36862
|
}
|
|
36557
36863
|
),
|
|
@@ -36610,7 +36916,7 @@ function DepositModal({
|
|
|
36610
36916
|
var TERMINAL_STATUSES = /* @__PURE__ */ new Set(["succeeded", "expired", "refunded", "canceled"]);
|
|
36611
36917
|
function usePaymentIntent(params) {
|
|
36612
36918
|
const { clientSecret, publishableKey, enabled = true, pollingInterval = 3e3 } = params;
|
|
36613
|
-
return
|
|
36919
|
+
return useQuery18({
|
|
36614
36920
|
queryKey: ["unifold", "paymentIntent", clientSecret, publishableKey],
|
|
36615
36921
|
queryFn: () => retrievePaymentIntent(clientSecret, publishableKey),
|
|
36616
36922
|
enabled: enabled && !!clientSecret && !!publishableKey,
|
|
@@ -36693,11 +36999,11 @@ function CheckoutModal({
|
|
|
36693
36999
|
}) {
|
|
36694
37000
|
const { colors: colors2, fonts, components } = useTheme();
|
|
36695
37001
|
const [view, setView] = useState41("main");
|
|
36696
|
-
const resetViewTimeoutRef =
|
|
37002
|
+
const resetViewTimeoutRef = useRef142(null);
|
|
36697
37003
|
const [browserWalletInfo, setBrowserWalletInfo] = useState41(null);
|
|
36698
37004
|
const [browserWalletChainType, setBrowserWalletChainType] = useState41(() => getStoredWalletState()?.chainType);
|
|
36699
|
-
const lastCheckoutMethodRef =
|
|
36700
|
-
const emitCheckoutSuccess =
|
|
37005
|
+
const lastCheckoutMethodRef = useRef142(void 0);
|
|
37006
|
+
const emitCheckoutSuccess = useCallback112(
|
|
36701
37007
|
(data, method) => {
|
|
36702
37008
|
const isSucceeded = data.status === "succeeded";
|
|
36703
37009
|
const richIntent = isSucceeded && data.paymentIntent ? mapToCheckoutPaymentIntent(data.paymentIntent) : void 0;
|
|
@@ -36760,7 +37066,7 @@ function CheckoutModal({
|
|
|
36760
37066
|
setView("main");
|
|
36761
37067
|
}
|
|
36762
37068
|
}, [showConnectWallet, showTransferCrypto, view]);
|
|
36763
|
-
const prevStatusRef =
|
|
37069
|
+
const prevStatusRef = useRef142(null);
|
|
36764
37070
|
useEffect35(() => {
|
|
36765
37071
|
if (!paymentIntent) return;
|
|
36766
37072
|
const prev = prevStatusRef.current;
|
|
@@ -36779,11 +37085,11 @@ function CheckoutModal({
|
|
|
36779
37085
|
);
|
|
36780
37086
|
}
|
|
36781
37087
|
}, [emitCheckoutSuccess, paymentIntent, view]);
|
|
36782
|
-
const wallets =
|
|
37088
|
+
const wallets = useMemo152(() => {
|
|
36783
37089
|
if (!paymentIntent) return [];
|
|
36784
37090
|
return mapDepositAddressesToWallets(paymentIntent.deposit_addresses, paymentIntent);
|
|
36785
37091
|
}, [paymentIntent]);
|
|
36786
|
-
const formatCryptoAmount =
|
|
37092
|
+
const formatCryptoAmount = useMemo152(() => {
|
|
36787
37093
|
if (!paymentIntent) return (_) => "";
|
|
36788
37094
|
const decimals = paymentIntent.destination_token_decimals ?? 6;
|
|
36789
37095
|
const symbol = paymentIntent.currency.toUpperCase();
|
|
@@ -36793,7 +37099,7 @@ function CheckoutModal({
|
|
|
36793
37099
|
return `${formatted} ${symbol}`;
|
|
36794
37100
|
};
|
|
36795
37101
|
}, [paymentIntent]);
|
|
36796
|
-
const remainingAmountUsd =
|
|
37102
|
+
const remainingAmountUsd = useMemo152(() => {
|
|
36797
37103
|
if (!paymentIntent) return void 0;
|
|
36798
37104
|
const total = parseFloat(paymentIntent.destination_amount_usd || paymentIntent.amount_usd);
|
|
36799
37105
|
const received = parseFloat(
|
|
@@ -36805,7 +37111,7 @@ function CheckoutModal({
|
|
|
36805
37111
|
return remaining > 0 ? remaining.toFixed(2) : "0.00";
|
|
36806
37112
|
}, [paymentIntent]);
|
|
36807
37113
|
const [selectedSource, setSelectedSource] = useState41(null);
|
|
36808
|
-
const remainingDestinationAmount =
|
|
37114
|
+
const remainingDestinationAmount = useMemo152(() => {
|
|
36809
37115
|
if (!paymentIntent) return "0";
|
|
36810
37116
|
const remaining = BigInt(paymentIntent.destination_amount) - BigInt(paymentIntent.destination_amount_received);
|
|
36811
37117
|
return remaining > 0n ? remaining.toString() : "0";
|
|
@@ -36827,7 +37133,7 @@ function CheckoutModal({
|
|
|
36827
37133
|
stablecoinParity: paymentIntent?.stablecoin_parity ?? false,
|
|
36828
37134
|
enabled: open && view === "transfer" && !!paymentIntent && !!selectedSource && remainingDestinationAmount !== "0"
|
|
36829
37135
|
});
|
|
36830
|
-
const effectiveCheckoutQuote =
|
|
37136
|
+
const effectiveCheckoutQuote = useMemo152(() => {
|
|
36831
37137
|
if (!sourceQuote || !selectedSource) return null;
|
|
36832
37138
|
const baseQuote = {
|
|
36833
37139
|
sourceAmount: sourceQuote.source_amount,
|
|
@@ -36848,7 +37154,7 @@ function CheckoutModal({
|
|
|
36848
37154
|
sourceAmountUsd: minUsd.toFixed(2)
|
|
36849
37155
|
};
|
|
36850
37156
|
}, [sourceQuote, selectedSource]);
|
|
36851
|
-
const handleBrowserWalletClick =
|
|
37157
|
+
const handleBrowserWalletClick = useCallback112(
|
|
36852
37158
|
(walletInfo) => {
|
|
36853
37159
|
const walletChainType = walletInfo.type === "phantom-solana" || walletInfo.type === "solflare" || walletInfo.type === "backpack" || walletInfo.type === "glow" ? "solana" : "ethereum";
|
|
36854
37160
|
setStoredWalletState(walletInfo.type);
|
|
@@ -36871,19 +37177,19 @@ function CheckoutModal({
|
|
|
36871
37177
|
},
|
|
36872
37178
|
[wallets, onCheckoutError]
|
|
36873
37179
|
);
|
|
36874
|
-
const handleWalletConnectClick =
|
|
37180
|
+
const handleWalletConnectClick = useCallback112(() => {
|
|
36875
37181
|
setBrowserWalletInfo(null);
|
|
36876
37182
|
lastCheckoutMethodRef.current = "wallet_connect";
|
|
36877
37183
|
setView("wallet_connect");
|
|
36878
37184
|
}, []);
|
|
36879
|
-
const handleWalletDisconnect =
|
|
37185
|
+
const handleWalletDisconnect = useCallback112(() => {
|
|
36880
37186
|
setUserDisconnectedWallet(true);
|
|
36881
37187
|
clearStoredWalletState();
|
|
36882
37188
|
setBrowserWalletChainType(void 0);
|
|
36883
37189
|
setBrowserWalletInfo(null);
|
|
36884
37190
|
setView("main");
|
|
36885
37191
|
}, []);
|
|
36886
|
-
const handleClose =
|
|
37192
|
+
const handleClose = useCallback112(() => {
|
|
36887
37193
|
onOpenChange(false);
|
|
36888
37194
|
if (resetViewTimeoutRef.current) {
|
|
36889
37195
|
clearTimeout(resetViewTimeoutRef.current);
|
|
@@ -36913,7 +37219,7 @@ function CheckoutModal({
|
|
|
36913
37219
|
},
|
|
36914
37220
|
[]
|
|
36915
37221
|
);
|
|
36916
|
-
const handleBack =
|
|
37222
|
+
const handleBack = useCallback112(() => {
|
|
36917
37223
|
setView("main");
|
|
36918
37224
|
}, []);
|
|
36919
37225
|
const poweredByFooter = /* @__PURE__ */ jsx64("div", { className: "uf-pt-3", children: /* @__PURE__ */ jsx64(
|
|
@@ -37251,7 +37557,7 @@ function CheckoutModal({
|
|
|
37251
37557
|
userId: paymentIntent.user_id || "",
|
|
37252
37558
|
publishableKey,
|
|
37253
37559
|
clientSecret,
|
|
37254
|
-
|
|
37560
|
+
prefilledAmountUsd: remainingAmountUsd,
|
|
37255
37561
|
checkoutAmountUsd: paymentIntent.amount_usd,
|
|
37256
37562
|
checkoutReceivedUsd: paymentIntent.amount_received_usd,
|
|
37257
37563
|
checkoutDestination: {
|
|
@@ -37312,7 +37618,7 @@ function CheckoutModal({
|
|
|
37312
37618
|
) }) });
|
|
37313
37619
|
}
|
|
37314
37620
|
function useSupportedDestinationTokens(publishableKey, enabled = true) {
|
|
37315
|
-
return
|
|
37621
|
+
return useQuery19({
|
|
37316
37622
|
queryKey: ["unifold", "supportedDestinationTokens", publishableKey],
|
|
37317
37623
|
queryFn: () => getSupportedDestinationTokens(publishableKey),
|
|
37318
37624
|
staleTime: 1e3 * 60 * 5,
|
|
@@ -37347,7 +37653,7 @@ function useSourceTokenValidation(params) {
|
|
|
37347
37653
|
enabled = true
|
|
37348
37654
|
} = params;
|
|
37349
37655
|
const hasParams = !!sourceChainType && !!sourceChainId && !!sourceTokenAddress;
|
|
37350
|
-
return
|
|
37656
|
+
return useQuery20({
|
|
37351
37657
|
queryKey: [
|
|
37352
37658
|
"unifold",
|
|
37353
37659
|
"sourceTokenValidation",
|
|
@@ -37396,7 +37702,7 @@ function useSourceTokenValidation(params) {
|
|
|
37396
37702
|
function useAddressBalance(params) {
|
|
37397
37703
|
const { address, chainType, chainId, tokenAddress, publishableKey, enabled = true } = params;
|
|
37398
37704
|
const hasParams = !!address && !!chainType && !!chainId && !!tokenAddress;
|
|
37399
|
-
return
|
|
37705
|
+
return useQuery21({
|
|
37400
37706
|
queryKey: [
|
|
37401
37707
|
"unifold",
|
|
37402
37708
|
"addressBalance",
|
|
@@ -37452,7 +37758,7 @@ function useAddressBalance(params) {
|
|
|
37452
37758
|
}
|
|
37453
37759
|
function useExecutions(userId, publishableKey, options) {
|
|
37454
37760
|
const actionType = options?.actionType ?? ActionType.Deposit;
|
|
37455
|
-
return
|
|
37761
|
+
return useQuery222({
|
|
37456
37762
|
queryKey: ["unifold", "executions", actionType, userId, publishableKey],
|
|
37457
37763
|
queryFn: () => queryExecutions(userId, publishableKey, actionType),
|
|
37458
37764
|
enabled: (options?.enabled ?? true) && !!userId,
|
|
@@ -37500,11 +37806,11 @@ function useWithdrawPolling({
|
|
|
37500
37806
|
});
|
|
37501
37807
|
const [executions, setExecutions] = useState42([]);
|
|
37502
37808
|
const [isPolling, setIsPolling] = useState42(false);
|
|
37503
|
-
const enabledAtRef =
|
|
37504
|
-
const trackedRef =
|
|
37505
|
-
const prevEnabledRef =
|
|
37506
|
-
const onSuccessRef =
|
|
37507
|
-
const onErrorRef =
|
|
37809
|
+
const enabledAtRef = useRef152(/* @__PURE__ */ new Date());
|
|
37810
|
+
const trackedRef = useRef152(/* @__PURE__ */ new Map());
|
|
37811
|
+
const prevEnabledRef = useRef152(false);
|
|
37812
|
+
const onSuccessRef = useRef152(onWithdrawSuccess);
|
|
37813
|
+
const onErrorRef = useRef152(onWithdrawError);
|
|
37508
37814
|
useEffect36(() => {
|
|
37509
37815
|
onSuccessRef.current = onWithdrawSuccess;
|
|
37510
37816
|
}, [onWithdrawSuccess]);
|
|
@@ -37778,7 +38084,7 @@ function useVerifyRecipientAddress(params) {
|
|
|
37778
38084
|
} = params;
|
|
37779
38085
|
const trimmedAddress = recipientAddress?.trim() || "";
|
|
37780
38086
|
const hasAllParams = !!chainType && !!chainId && !!tokenAddress && trimmedAddress.length > 0;
|
|
37781
|
-
return
|
|
38087
|
+
return useQuery23({
|
|
37782
38088
|
queryKey: [
|
|
37783
38089
|
"unifold",
|
|
37784
38090
|
"verifyRecipientAddress",
|
|
@@ -37817,7 +38123,7 @@ function useGetDepositAddress(params) {
|
|
|
37817
38123
|
enabled = true
|
|
37818
38124
|
} = params;
|
|
37819
38125
|
const canFire = !!userId && !!recipientAddress && !!destinationChainType && !!destinationChainId && !!destinationTokenAddress;
|
|
37820
|
-
return
|
|
38126
|
+
return useQuery24({
|
|
37821
38127
|
queryKey: [
|
|
37822
38128
|
"unifold",
|
|
37823
38129
|
"getDepositAddress",
|
|
@@ -37884,7 +38190,7 @@ function useHypercoreWithdrawActivation(params) {
|
|
|
37884
38190
|
actionType: ActionType.Withdraw,
|
|
37885
38191
|
enabled: enabled && isHypercore(sourceChainId)
|
|
37886
38192
|
});
|
|
37887
|
-
const depositWalletAddress =
|
|
38193
|
+
const depositWalletAddress = useMemo16(() => {
|
|
37888
38194
|
const wallets = depositWalletLookup.data?.data ?? [];
|
|
37889
38195
|
return wallets.find((w) => w.chain_type === sourceChainType)?.address;
|
|
37890
38196
|
}, [depositWalletLookup.data, sourceChainType]);
|
|
@@ -38003,7 +38309,7 @@ function WithdrawForm({
|
|
|
38003
38309
|
enabled: debouncedAddress.length > 5 && !!selectedChain
|
|
38004
38310
|
});
|
|
38005
38311
|
const isDebouncing = trimmedAddress !== debouncedAddress;
|
|
38006
|
-
const addressError =
|
|
38312
|
+
const addressError = useMemo17(() => {
|
|
38007
38313
|
if (!trimmedAddress || trimmedAddress.length <= 5) return null;
|
|
38008
38314
|
if (isDebouncing || isVerifyingAddress) return null;
|
|
38009
38315
|
if (verifyError) return t10.invalidAddress;
|
|
@@ -38037,33 +38343,33 @@ function WithdrawForm({
|
|
|
38037
38343
|
destinationTokenAddress: selectedChain?.token_address,
|
|
38038
38344
|
enabled: isAddressValid
|
|
38039
38345
|
});
|
|
38040
|
-
const exchangeRate =
|
|
38346
|
+
const exchangeRate = useMemo17(() => {
|
|
38041
38347
|
if (!balanceData?.exchangeRate) return 0;
|
|
38042
38348
|
return parseFloat(balanceData.exchangeRate);
|
|
38043
38349
|
}, [balanceData]);
|
|
38044
|
-
const balanceCrypto =
|
|
38350
|
+
const balanceCrypto = useMemo17(() => {
|
|
38045
38351
|
if (!balanceData?.balanceHuman) return 0;
|
|
38046
38352
|
return parseFloat(balanceData.balanceHuman);
|
|
38047
38353
|
}, [balanceData]);
|
|
38048
|
-
const balanceUsdNum =
|
|
38354
|
+
const balanceUsdNum = useMemo17(() => {
|
|
38049
38355
|
if (!balanceData?.balanceUsd) return 0;
|
|
38050
38356
|
return parseFloat(balanceData.balanceUsd);
|
|
38051
38357
|
}, [balanceData]);
|
|
38052
38358
|
const tokenSymbol = sourceTokenSymbol || balanceData?.symbol || "TOKEN";
|
|
38053
38359
|
const sourceDecimals = balanceData?.decimals ?? 6;
|
|
38054
|
-
const cryptoAmountFromInput =
|
|
38360
|
+
const cryptoAmountFromInput = useMemo17(() => {
|
|
38055
38361
|
const val = parseFloat(amount);
|
|
38056
38362
|
if (!val || val <= 0) return 0;
|
|
38057
38363
|
if (inputUnit === "crypto") return val;
|
|
38058
38364
|
return exchangeRate > 0 ? val / exchangeRate : 0;
|
|
38059
38365
|
}, [amount, inputUnit, exchangeRate]);
|
|
38060
|
-
const fiatAmountFromInput =
|
|
38366
|
+
const fiatAmountFromInput = useMemo17(() => {
|
|
38061
38367
|
const val = parseFloat(amount);
|
|
38062
38368
|
if (!val || val <= 0) return 0;
|
|
38063
38369
|
if (inputUnit === "fiat") return val;
|
|
38064
38370
|
return val * exchangeRate;
|
|
38065
38371
|
}, [amount, inputUnit, exchangeRate]);
|
|
38066
|
-
const convertedDisplay =
|
|
38372
|
+
const convertedDisplay = useMemo17(() => {
|
|
38067
38373
|
if (!amount || parseFloat(amount) <= 0) return null;
|
|
38068
38374
|
if (inputUnit === "crypto") {
|
|
38069
38375
|
return `$${fiatAmountFromInput.toLocaleString(void 0, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
@@ -38082,7 +38388,7 @@ function WithdrawForm({
|
|
|
38082
38388
|
isMaxed,
|
|
38083
38389
|
isStablecoin
|
|
38084
38390
|
]);
|
|
38085
|
-
const balanceDisplay =
|
|
38391
|
+
const balanceDisplay = useMemo17(() => {
|
|
38086
38392
|
if (isLoadingBalance || !balanceData) return null;
|
|
38087
38393
|
if (inputUnit === "crypto") {
|
|
38088
38394
|
const displayDecimals = isStablecoin ? 2 : 6;
|
|
@@ -38105,7 +38411,7 @@ function WithdrawForm({
|
|
|
38105
38411
|
tokenSymbol,
|
|
38106
38412
|
isStablecoin
|
|
38107
38413
|
]);
|
|
38108
|
-
const handleSwitchUnit =
|
|
38414
|
+
const handleSwitchUnit = useCallback122(() => {
|
|
38109
38415
|
if (isMaxed && balanceData) {
|
|
38110
38416
|
if (inputUnit === "crypto") {
|
|
38111
38417
|
setAmount((Math.round(balanceUsdNum * 100) / 100).toFixed(2));
|
|
@@ -38132,7 +38438,7 @@ function WithdrawForm({
|
|
|
38132
38438
|
setInputUnit("crypto");
|
|
38133
38439
|
}
|
|
38134
38440
|
}, [amount, inputUnit, exchangeRate, sourceDecimals, isMaxed, balanceData, balanceUsdNum]);
|
|
38135
|
-
const handleMaxClick =
|
|
38441
|
+
const handleMaxClick = useCallback122(() => {
|
|
38136
38442
|
if (inputUnit === "crypto") {
|
|
38137
38443
|
if (balanceCrypto <= 0) return;
|
|
38138
38444
|
setAmount(balanceData?.balanceHuman ?? "0");
|
|
@@ -38146,7 +38452,7 @@ function WithdrawForm({
|
|
|
38146
38452
|
const isBelowMinimum = minimumWithdrawAmountUsd !== null && fiatAmountFromInput > 0 && Math.round(fiatAmountFromInput * 100) / 100 < minimumWithdrawAmountUsd;
|
|
38147
38453
|
const isOverBalance = inputUnit === "crypto" ? cryptoAmountFromInput > 0 && balanceCrypto > 0 && cryptoAmountFromInput > balanceCrypto : fiatAmountFromInput > 0 && balanceUsdNum > 0 && Math.round(fiatAmountFromInput * 100) / 100 > Math.round(balanceUsdNum * 100) / 100;
|
|
38148
38454
|
const isFormValid = trimmedAddress.length > 0 && amount.trim().length > 0 && cryptoAmountFromInput > 0 && isAddressValid && !isBelowMinimum && !isOverBalance && !isBalanceBelowMinimum && !!balanceData;
|
|
38149
|
-
const handleWithdraw =
|
|
38455
|
+
const handleWithdraw = useCallback122(async () => {
|
|
38150
38456
|
if (!selectedToken || !selectedChain) return;
|
|
38151
38457
|
if (!isFormValid) return;
|
|
38152
38458
|
setIsSubmitting(true);
|
|
@@ -38919,7 +39225,7 @@ function WithdrawModal({
|
|
|
38919
39225
|
theme = "dark",
|
|
38920
39226
|
hideOverlay = false
|
|
38921
39227
|
}) {
|
|
38922
|
-
const onWithdrawSuccessFor =
|
|
39228
|
+
const onWithdrawSuccessFor = useCallback132(
|
|
38923
39229
|
(data) => {
|
|
38924
39230
|
onWithdrawSuccess?.(data);
|
|
38925
39231
|
if (data.execution) {
|
|
@@ -38930,7 +39236,7 @@ function WithdrawModal({
|
|
|
38930
39236
|
);
|
|
38931
39237
|
const { colors: colors2, fonts, components } = useTheme();
|
|
38932
39238
|
const [containerEl, setContainerEl] = useState45(null);
|
|
38933
|
-
const containerCallbackRef =
|
|
39239
|
+
const containerCallbackRef = useCallback132((el) => {
|
|
38934
39240
|
setContainerEl(el);
|
|
38935
39241
|
}, []);
|
|
38936
39242
|
const [resolvedTheme, setResolvedTheme] = useState45(
|
|
@@ -39003,7 +39309,7 @@ function WithdrawModal({
|
|
|
39003
39309
|
refetchInterval: view === "tracker" || view === "detail" ? 5e3 : 15e3
|
|
39004
39310
|
});
|
|
39005
39311
|
const allWithdrawals = allWithdrawalsData?.data ?? [];
|
|
39006
|
-
const handleDepositWalletCreation =
|
|
39312
|
+
const handleDepositWalletCreation = useCallback132(
|
|
39007
39313
|
async (params) => {
|
|
39008
39314
|
const { data: wallets } = await createDepositAddress(
|
|
39009
39315
|
{
|
|
@@ -39026,12 +39332,12 @@ function WithdrawModal({
|
|
|
39026
39332
|
},
|
|
39027
39333
|
[externalUserId, publishableKey, sourceChainType]
|
|
39028
39334
|
);
|
|
39029
|
-
const handleWithdrawSubmitted =
|
|
39335
|
+
const handleWithdrawSubmitted = useCallback132((txInfo) => {
|
|
39030
39336
|
setSubmittedTxInfo(txInfo);
|
|
39031
39337
|
setView("confirming");
|
|
39032
39338
|
}, []);
|
|
39033
|
-
const resetViewTimeoutRef =
|
|
39034
|
-
const handleClose =
|
|
39339
|
+
const resetViewTimeoutRef = useRef162(null);
|
|
39340
|
+
const handleClose = useCallback132(() => {
|
|
39035
39341
|
onOpenChange(false);
|
|
39036
39342
|
if (resetViewTimeoutRef.current) clearTimeout(resetViewTimeoutRef.current);
|
|
39037
39343
|
resetViewTimeoutRef.current = setTimeout(() => {
|
|
@@ -39059,13 +39365,13 @@ function WithdrawModal({
|
|
|
39059
39365
|
},
|
|
39060
39366
|
[]
|
|
39061
39367
|
);
|
|
39062
|
-
const handleTokenSymbolChange =
|
|
39368
|
+
const handleTokenSymbolChange = useCallback132(
|
|
39063
39369
|
(symbol) => {
|
|
39064
39370
|
setSelectedTokenSymbol(symbol);
|
|
39065
39371
|
},
|
|
39066
39372
|
[setSelectedTokenSymbol]
|
|
39067
39373
|
);
|
|
39068
|
-
const handleChainKeyChange =
|
|
39374
|
+
const handleChainKeyChange = useCallback132(
|
|
39069
39375
|
(chainKey) => {
|
|
39070
39376
|
setSelectedChainKey(chainKey);
|
|
39071
39377
|
},
|
|
@@ -39297,7 +39603,7 @@ function UnifoldProvider2({
|
|
|
39297
39603
|
withdrawConfigRef.current = withdrawConfig;
|
|
39298
39604
|
const withdrawCloseTimeoutRef = React38.useRef(null);
|
|
39299
39605
|
const withdrawCloseGuardRef = React38.useRef(false);
|
|
39300
|
-
const beginDeposit =
|
|
39606
|
+
const beginDeposit = useCallback14((config2) => {
|
|
39301
39607
|
if (closeTimeoutRef.current) {
|
|
39302
39608
|
clearTimeout(closeTimeoutRef.current);
|
|
39303
39609
|
closeTimeoutRef.current = null;
|
|
@@ -39332,7 +39638,7 @@ function UnifoldProvider2({
|
|
|
39332
39638
|
setIsOpen(true);
|
|
39333
39639
|
return promise;
|
|
39334
39640
|
}, []);
|
|
39335
|
-
const closeDeposit =
|
|
39641
|
+
const closeDeposit = useCallback14(() => {
|
|
39336
39642
|
if (closeGuardRef.current) {
|
|
39337
39643
|
return;
|
|
39338
39644
|
}
|
|
@@ -39354,7 +39660,7 @@ function UnifoldProvider2({
|
|
|
39354
39660
|
closeTimeoutRef.current = null;
|
|
39355
39661
|
}, 200);
|
|
39356
39662
|
}, []);
|
|
39357
|
-
const handleDepositSuccess =
|
|
39663
|
+
const handleDepositSuccess = useCallback14(
|
|
39358
39664
|
(data) => {
|
|
39359
39665
|
if (depositConfig?.onSuccess) {
|
|
39360
39666
|
depositConfig.onSuccess(data);
|
|
@@ -39366,7 +39672,7 @@ function UnifoldProvider2({
|
|
|
39366
39672
|
},
|
|
39367
39673
|
[depositConfig]
|
|
39368
39674
|
);
|
|
39369
|
-
const handleDepositError =
|
|
39675
|
+
const handleDepositError = useCallback14(
|
|
39370
39676
|
(error) => {
|
|
39371
39677
|
console.error("[UnifoldProvider] Deposit error:", error);
|
|
39372
39678
|
if (depositConfig?.onError) {
|
|
@@ -39384,7 +39690,7 @@ function UnifoldProvider2({
|
|
|
39384
39690
|
checkoutConfigRef.current = checkoutConfig;
|
|
39385
39691
|
const checkoutCloseTimeoutRef = React38.useRef(null);
|
|
39386
39692
|
const checkoutCloseGuardRef = React38.useRef(false);
|
|
39387
|
-
const beginCheckout =
|
|
39693
|
+
const beginCheckout = useCallback14((config2) => {
|
|
39388
39694
|
if (checkoutCloseTimeoutRef.current) {
|
|
39389
39695
|
clearTimeout(checkoutCloseTimeoutRef.current);
|
|
39390
39696
|
checkoutCloseTimeoutRef.current = null;
|
|
@@ -39409,7 +39715,7 @@ function UnifoldProvider2({
|
|
|
39409
39715
|
setIsCheckoutOpen(true);
|
|
39410
39716
|
return promise;
|
|
39411
39717
|
}, []);
|
|
39412
|
-
const closeCheckout =
|
|
39718
|
+
const closeCheckout = useCallback14(() => {
|
|
39413
39719
|
if (checkoutCloseGuardRef.current) {
|
|
39414
39720
|
return;
|
|
39415
39721
|
}
|
|
@@ -39431,7 +39737,7 @@ function UnifoldProvider2({
|
|
|
39431
39737
|
checkoutCloseTimeoutRef.current = null;
|
|
39432
39738
|
}, 200);
|
|
39433
39739
|
}, []);
|
|
39434
|
-
const handleCheckoutSuccess =
|
|
39740
|
+
const handleCheckoutSuccess = useCallback14(
|
|
39435
39741
|
(data) => {
|
|
39436
39742
|
if (checkoutConfig?.onSuccess) {
|
|
39437
39743
|
checkoutConfig.onSuccess(data);
|
|
@@ -39443,7 +39749,7 @@ function UnifoldProvider2({
|
|
|
39443
39749
|
},
|
|
39444
39750
|
[checkoutConfig]
|
|
39445
39751
|
);
|
|
39446
|
-
const handleCheckoutError =
|
|
39752
|
+
const handleCheckoutError = useCallback14(
|
|
39447
39753
|
(error) => {
|
|
39448
39754
|
console.error("[UnifoldProvider] Checkout error:", error);
|
|
39449
39755
|
if (checkoutConfig?.onError) {
|
|
@@ -39456,7 +39762,7 @@ function UnifoldProvider2({
|
|
|
39456
39762
|
},
|
|
39457
39763
|
[checkoutConfig]
|
|
39458
39764
|
);
|
|
39459
|
-
const beginWithdraw =
|
|
39765
|
+
const beginWithdraw = useCallback14((config2) => {
|
|
39460
39766
|
if (withdrawCloseTimeoutRef.current) {
|
|
39461
39767
|
clearTimeout(withdrawCloseTimeoutRef.current);
|
|
39462
39768
|
withdrawCloseTimeoutRef.current = null;
|
|
@@ -39481,7 +39787,7 @@ function UnifoldProvider2({
|
|
|
39481
39787
|
setIsWithdrawOpen(true);
|
|
39482
39788
|
return promise;
|
|
39483
39789
|
}, []);
|
|
39484
|
-
const closeWithdraw =
|
|
39790
|
+
const closeWithdraw = useCallback14(() => {
|
|
39485
39791
|
if (withdrawCloseGuardRef.current) {
|
|
39486
39792
|
return;
|
|
39487
39793
|
}
|
|
@@ -39503,7 +39809,7 @@ function UnifoldProvider2({
|
|
|
39503
39809
|
withdrawCloseTimeoutRef.current = null;
|
|
39504
39810
|
}, 200);
|
|
39505
39811
|
}, []);
|
|
39506
|
-
const handleWithdrawSuccess =
|
|
39812
|
+
const handleWithdrawSuccess = useCallback14((data) => {
|
|
39507
39813
|
if (withdrawConfigRef.current?.onSuccess) {
|
|
39508
39814
|
withdrawConfigRef.current.onSuccess(data);
|
|
39509
39815
|
}
|
|
@@ -39512,7 +39818,7 @@ function UnifoldProvider2({
|
|
|
39512
39818
|
withdrawPromiseRef.current = null;
|
|
39513
39819
|
}
|
|
39514
39820
|
}, []);
|
|
39515
|
-
const handleWithdrawError =
|
|
39821
|
+
const handleWithdrawError = useCallback14((error) => {
|
|
39516
39822
|
console.error("[UnifoldProvider] Withdraw error:", error);
|
|
39517
39823
|
if (withdrawConfigRef.current?.onError) {
|
|
39518
39824
|
withdrawConfigRef.current.onError(error);
|
|
@@ -39522,7 +39828,7 @@ function UnifoldProvider2({
|
|
|
39522
39828
|
withdrawPromiseRef.current = null;
|
|
39523
39829
|
}
|
|
39524
39830
|
}, []);
|
|
39525
|
-
const contextValue =
|
|
39831
|
+
const contextValue = useMemo19(
|
|
39526
39832
|
() => ({
|
|
39527
39833
|
beginDeposit,
|
|
39528
39834
|
closeDeposit,
|
|
@@ -39617,6 +39923,7 @@ function UnifoldProvider2({
|
|
|
39617
39923
|
defaultSourceChainId: depositConfig.defaultSourceChainId,
|
|
39618
39924
|
defaultSourceTokenAddress: depositConfig.defaultSourceTokenAddress,
|
|
39619
39925
|
defaultSourceSymbol: depositConfig.defaultSourceSymbol,
|
|
39926
|
+
prefilledAmountUsd: depositConfig.prefilledAmountUsd,
|
|
39620
39927
|
userEmail: depositConfig.user?.email,
|
|
39621
39928
|
depositConfirmationMode: depositConfig.depositConfirmationMode ?? "auto_ui",
|
|
39622
39929
|
hideDepositTracker: config?.hideDepositTracker,
|