@funkit/connect-rn 1.0.11 → 2.1.0
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/CHANGELOG.md +374 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1051 -289
- package/dist/index.js.map +4 -4
- package/dist/src/flow/FunkitFlowProvider.d.ts +3 -0
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/withdrawalFlowConfig.d.ts +68 -0
- package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -0
- package/dist/src/hooks/useScreenSize.d.ts +4 -0
- package/dist/src/hooks/useScreenSize.d.ts.map +1 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts +1 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts.map +1 -1
- package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
- package/dist/src/providers/FunkitStatsigProvider.d.ts +7 -0
- package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -1
- package/dist/src/providers/useFunkitCheckout.d.ts +9 -3
- package/dist/src/providers/useFunkitCheckout.d.ts.map +1 -1
- package/dist/src/screens/AvailableChainsScreen.d.ts +2 -1
- package/dist/src/screens/AvailableChainsScreen.d.ts.map +1 -1
- package/dist/src/screens/CheckoutBlockedScreen.d.ts.map +1 -1
- package/dist/src/screens/QrCodeScreen.d.ts +10 -10
- package/dist/src/screens/QrCodeScreen.d.ts.map +1 -1
- package/dist/src/screens/{AddMoneyScreen.d.ts → SelectMethodScreen.d.ts} +4 -4
- package/dist/src/screens/SelectMethodScreen.d.ts.map +1 -0
- package/dist/src/screens/WithdrawMethodScreen.d.ts +30 -0
- package/dist/src/screens/WithdrawMethodScreen.d.ts.map +1 -0
- package/dist/src/swapped/SwappedScreen.d.ts +6 -14
- package/dist/src/swapped/SwappedScreen.d.ts.map +1 -1
- package/dist/src/swapped/SwappedScreenShell.d.ts +24 -0
- package/dist/src/swapped/SwappedScreenShell.d.ts.map +1 -0
- package/dist/src/swapped/SwappedWebView.d.ts.map +1 -1
- package/dist/src/swapped/SwappedWithdrawScreen.d.ts +20 -0
- package/dist/src/swapped/SwappedWithdrawScreen.d.ts.map +1 -0
- package/dist/src/swapped/webViewSwappedTransport.d.ts +8 -7
- package/dist/src/swapped/webViewSwappedTransport.d.ts.map +1 -1
- package/dist/src/transfer/fops.d.ts +8 -0
- package/dist/src/transfer/fops.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useFiatExchangeRates.d.ts +11 -0
- package/dist/src/transfer/hooks/useFiatExchangeRates.d.ts.map +1 -0
- package/dist/src/transfer/hooks/useWithdrawalFops.d.ts +39 -0
- package/dist/src/transfer/hooks/useWithdrawalFops.d.ts.map +1 -0
- package/dist/src/withdrawal/publicClient.d.ts +10 -0
- package/dist/src/withdrawal/publicClient.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalExecution.d.ts +21 -0
- package/dist/src/withdrawal/useWithdrawalExecution.d.ts.map +1 -0
- package/package.json +11 -3
- package/dist/src/screens/AddMoneyScreen.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// index.ts
|
|
2
|
-
export * from "@funkit/connect-core";
|
|
3
|
-
|
|
4
1
|
// src/theme/tokens.ts
|
|
5
2
|
var systemFontTokens = {
|
|
6
3
|
family: "System",
|
|
@@ -73,7 +70,7 @@ var lightTokens = {
|
|
|
73
70
|
modal: 24,
|
|
74
71
|
element: 12,
|
|
75
72
|
elementInner: 8,
|
|
76
|
-
button:
|
|
73
|
+
button: 999,
|
|
77
74
|
rounded: 999
|
|
78
75
|
},
|
|
79
76
|
borderWidths: {
|
|
@@ -174,7 +171,7 @@ var darkTokens = {
|
|
|
174
171
|
modal: 24,
|
|
175
172
|
element: 12,
|
|
176
173
|
elementInner: 8,
|
|
177
|
-
button:
|
|
174
|
+
button: 999,
|
|
178
175
|
rounded: 999
|
|
179
176
|
},
|
|
180
177
|
borderWidths: {
|
|
@@ -337,12 +334,12 @@ var DEFAULT_THEME_SET = {
|
|
|
337
334
|
};
|
|
338
335
|
function selectTheme(themeSet, scheme) {
|
|
339
336
|
const primary = scheme === "dark" ? themeSet.dark : themeSet.light;
|
|
340
|
-
const
|
|
337
|
+
const fallback2 = scheme === "dark" ? themeSet.light : themeSet.dark;
|
|
341
338
|
if (primary) {
|
|
342
339
|
return primary;
|
|
343
340
|
}
|
|
344
|
-
if (
|
|
345
|
-
return
|
|
341
|
+
if (fallback2) {
|
|
342
|
+
return fallback2;
|
|
346
343
|
}
|
|
347
344
|
throw new Error(
|
|
348
345
|
"FunkitProvider: `themes` must include at least one of { light, dark }"
|
|
@@ -402,7 +399,6 @@ function renderIcon(svg, size, color) {
|
|
|
402
399
|
}
|
|
403
400
|
);
|
|
404
401
|
}
|
|
405
|
-
var CLOSE_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.41291 3.08709C4.0468 2.72097 3.4532 2.72097 3.08709 3.08709C2.72097 3.4532 2.72097 4.0468 3.08709 4.41291L8.67417 10L3.08709 15.5871C2.72097 15.9532 2.72097 16.5468 3.08709 16.9129C3.4532 17.279 4.0468 17.279 4.41291 16.9129L10 11.3258L15.5871 16.9129C15.9532 17.279 16.5468 17.279 16.9129 16.9129C17.279 16.5468 17.279 15.9532 16.9129 15.5871L11.3258 10L16.9129 4.41291C17.279 4.0468 17.279 3.4532 16.9129 3.08709C16.5468 2.72097 15.9532 2.72097 15.5871 3.08709L10 8.67417L4.41291 3.08709Z" fill="currentColor"/></svg>';
|
|
406
402
|
var QR_SCAN_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.83333 9.99935H10V14.166M2.50833 9.99935H2.5M6.675 14.166H6.66667M10.0083 17.4993H10M17.5083 9.99935H17.5M2.5 14.166H3.75M12.9167 9.99935H14.5833M2.5 17.4993H6.66667M10 1.66602V6.66602M14.6667 17.4993H16.1667C16.6334 17.4993 16.8667 17.4993 17.045 17.4085C17.2018 17.3286 17.3293 17.2011 17.4092 17.0443C17.5 16.8661 17.5 16.6327 17.5 16.166V14.666C17.5 14.1993 17.5 13.966 17.4092 13.7877C17.3293 13.6309 17.2018 13.5034 17.045 13.4235C16.8667 13.3327 16.6334 13.3327 16.1667 13.3327H14.6667C14.2 13.3327 13.9666 13.3327 13.7883 13.4235C13.6315 13.5034 13.5041 13.6309 13.4242 13.7877C13.3333 13.966 13.3333 14.1993 13.3333 14.666V16.166C13.3333 16.6327 13.3333 16.8661 13.4242 17.0443C13.5041 17.2011 13.6315 17.3286 13.7883 17.4085C13.9666 17.4993 14.2 17.4993 14.6667 17.4993ZM14.6667 6.66602H16.1667C16.6334 6.66602 16.8667 6.66602 17.045 6.57519C17.2018 6.49529 17.3293 6.36781 17.4092 6.21101C17.5 6.03275 17.5 5.79939 17.5 5.33268V3.83268C17.5 3.36597 17.5 3.13262 17.4092 2.95436C17.3293 2.79756 17.2018 2.67007 17.045 2.59018C16.8667 2.49935 16.6334 2.49935 16.1667 2.49935H14.6667C14.2 2.49935 13.9666 2.49935 13.7883 2.59018C13.6315 2.67007 13.5041 2.79756 13.4242 2.95436C13.3333 3.13262 13.3333 3.36597 13.3333 3.83268V5.33268C13.3333 5.79939 13.3333 6.03275 13.4242 6.21101C13.5041 6.36781 13.6315 6.49529 13.7883 6.57519C13.9666 6.66602 14.2 6.66602 14.6667 6.66602ZM3.83333 6.66602H5.33333C5.80004 6.66602 6.0334 6.66602 6.21166 6.57519C6.36846 6.49529 6.49594 6.36781 6.57584 6.21101C6.66667 6.03275 6.66667 5.79939 6.66667 5.33268V3.83268C6.66667 3.36597 6.66667 3.13262 6.57584 2.95436C6.49594 2.79756 6.36846 2.67007 6.21166 2.59018C6.0334 2.49935 5.80004 2.49935 5.33333 2.49935H3.83333C3.36662 2.49935 3.13327 2.49935 2.95501 2.59018C2.79821 2.67007 2.67072 2.79756 2.59083 2.95436C2.5 3.13262 2.5 3.36597 2.5 3.83268V5.33268C2.5 5.79939 2.5 6.03275 2.59083 6.21101C2.67072 6.36781 2.79821 6.49529 2.95501 6.57519C3.13327 6.66602 3.36662 6.66602 3.83333 6.66602Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
407
403
|
var COPY_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.6 10.4V12.08C5.6 12.7521 5.6 13.0881 5.73079 13.3448C5.84584 13.5706 6.02942 13.7542 6.25521 13.8692C6.51191 14 6.84794 14 7.52 14H12.08C12.7521 14 13.0881 14 13.3448 13.8692C13.5706 13.7542 13.7542 13.5706 13.8692 13.3448C14 13.0881 14 12.7521 14 12.08V7.52C14 6.84794 14 6.51191 13.8692 6.25521C13.7542 6.02942 13.5706 5.84584 13.3448 5.73079C13.0881 5.6 12.7521 5.6 12.08 5.6H10.4M3.92 10.4H8.48C9.15206 10.4 9.48809 10.4 9.74479 10.2692C9.97058 10.1542 10.1542 9.97058 10.2692 9.74479C10.4 9.48809 10.4 9.15206 10.4 8.48V3.92C10.4 3.24794 10.4 2.91191 10.2692 2.65521C10.1542 2.42942 9.97058 2.24584 9.74479 2.13079C9.48809 2 9.15206 2 8.48 2H3.92C3.24794 2 2.91191 2 2.65521 2.13079C2.42942 2.24584 2.24584 2.42942 2.13079 2.65521C2 2.91191 2 3.24794 2 3.92V8.48C2 9.15206 2 9.48809 2.13079 9.74479C2.24584 9.97058 2.42942 10.1542 2.65521 10.2692C2.91191 10.4 3.24794 10.4 3.92 10.4Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
408
404
|
var SHARE_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14 8V10.8C14 11.9201 14 12.4802 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.4802 14 11.9201 14 10.8 14H5.2C4.07989 14 3.51984 14 3.09202 13.782C2.71569 13.5903 2.40973 13.2843 2.21799 12.908C2 12.4802 2 11.9201 2 10.8V8M5.33333 4.66667L8 2L10.6667 4.66667M8 2V10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
@@ -411,9 +407,6 @@ var CHEVRON_LEFT_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="no
|
|
|
411
407
|
var SUCCESS_CHECK_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 8.5L7 10L10.5 6.5M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z" stroke="#52A300" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
412
408
|
var CHEVRON_DOWN_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.46967 5.71967C3.76256 5.42678 4.23744 5.42678 4.53033 5.71967L8 9.18934L11.4697 5.71967C11.7626 5.42678 12.2374 5.42678 12.5303 5.71967C12.8232 6.01256 12.8232 6.48744 12.5303 6.78033L8.53033 10.7803C8.23744 11.0732 7.76256 11.0732 7.46967 10.7803L3.46967 6.78033C3.17678 6.48744 3.17678 6.01256 3.46967 5.71967Z" fill="currentColor"/></svg>';
|
|
413
409
|
var CHECK_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 4.19526C14.0651 4.45561 14.0651 4.87772 13.8047 5.13807L6.80474 12.1381C6.54439 12.3984 6.12228 12.3984 5.86193 12.1381L2.5286 8.80474C2.26825 8.54439 2.26825 8.12228 2.5286 7.86193C2.78895 7.60158 3.21106 7.60158 3.4714 7.86193L6.33333 10.7239L12.8619 4.19526C13.1223 3.93491 13.5444 3.93491 13.8047 4.19526Z" fill="currentColor"/></svg>';
|
|
414
|
-
function FigmaCloseIcon({ size = 20, color }) {
|
|
415
|
-
return renderIcon(CLOSE_SVG, size, useIconColor(color));
|
|
416
|
-
}
|
|
417
410
|
function FigmaQrScanIcon({ size = 20, color }) {
|
|
418
411
|
return renderIcon(QR_SCAN_SVG, size, useIconColor(color));
|
|
419
412
|
}
|
|
@@ -438,14 +431,14 @@ function FigmaChevronDownIcon({ size = 16, color }) {
|
|
|
438
431
|
function FigmaCheckIcon({ size = 16, color }) {
|
|
439
432
|
return renderIcon(CHECK_SVG, size, useIconColor(color));
|
|
440
433
|
}
|
|
441
|
-
var INFO_CIRCLE_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 9.16667V13.3333M10 6.66667H10.0083M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
442
|
-
function FigmaInfoCircleIcon({ size = 20, color }) {
|
|
443
|
-
return renderIcon(INFO_CIRCLE_SVG, size, useIconColor(color));
|
|
444
|
-
}
|
|
445
434
|
var PLUS_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.20833 5V11.4167M5 8.20833H11.4167" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
446
435
|
function FigmaPlusIcon({ size = 16, color }) {
|
|
447
436
|
return renderIcon(PLUS_SVG, size, useIconColor(color));
|
|
448
437
|
}
|
|
438
|
+
var ALERT_CIRCLE_SVG = '<svg width="20" height="20" viewBox="0 0 22.21 22.19" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11.0993 22.1908C9.5667 22.1908 8.1308 21.9008 6.7916 21.3207C5.4524 20.7478 4.2744 19.9529 3.2575 18.9359C2.2405 17.919 1.442 16.741 0.862 15.4018C0.289 14.0626 0.0026 12.6267 0.0026 11.0941C0.0026 9.5616 0.289 8.1257 0.862 6.7865C1.442 5.4402 2.2405 4.2621 3.2575 3.2523C4.2744 2.2354 5.4524 1.4405 6.7916 0.8676C8.1308 0.2875 9.5667 -0.0025 11.0993 -0.0025C12.6318 -0.0025 14.0677 0.2875 15.4069 0.8676C16.7532 1.4405 17.9349 2.2354 18.9518 3.2523C19.9687 4.2621 20.7636 5.4402 21.3366 6.7865C21.9166 8.1257 22.2067 9.5616 22.2067 11.0941C22.2067 12.6267 21.9166 14.0626 21.3366 15.4018C20.7636 16.741 19.9687 17.919 18.9518 18.9359C17.9349 19.9529 16.7532 20.7478 15.4069 21.3207C14.0677 21.9008 12.6318 22.1908 11.0993 22.1908ZM11.11 12.9525C11.7474 12.9525 12.0732 12.6195 12.0875 11.9535L12.2594 6.5609C12.2737 6.2315 12.1699 5.963 11.9479 5.7553C11.7259 5.5404 11.443 5.433 11.0993 5.433C10.7483 5.433 10.4655 5.5404 10.2506 5.7553C10.0358 5.963 9.9355 6.2279 9.9498 6.5502L10.1002 11.9643C10.1217 12.6231 10.4583 12.9525 11.11 12.9525ZM11.11 16.6479C11.4681 16.6479 11.776 16.5333 12.0338 16.3041C12.2916 16.0749 12.4205 15.7813 12.4205 15.4232C12.4205 15.0723 12.2916 14.7787 12.0338 14.5424C11.776 14.3061 11.4681 14.1879 11.11 14.1879C10.7448 14.1879 10.4332 14.3061 10.1754 14.5424C9.9176 14.7787 9.7887 15.0723 9.7887 15.4232C9.7887 15.7813 9.9176 16.0749 10.1754 16.3041C10.4404 16.5333 10.7519 16.6479 11.11 16.6479Z" fill="currentColor"/></svg>';
|
|
439
|
+
function FigmaAlertCircleIcon({ size = 22, color }) {
|
|
440
|
+
return renderIcon(ALERT_CIRCLE_SVG, size, useIconColor(color));
|
|
441
|
+
}
|
|
449
442
|
|
|
450
443
|
// src/flow/AddressCopiedToast.tsx
|
|
451
444
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -557,18 +550,24 @@ function useFunkitColorScheme() {
|
|
|
557
550
|
|
|
558
551
|
// src/providers/FunkitProvider.tsx
|
|
559
552
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
560
|
-
import { useEffect as useEffect12, useMemo as
|
|
553
|
+
import { useEffect as useEffect12, useMemo as useMemo11, useRef as useRef8 } from "react";
|
|
561
554
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
562
555
|
|
|
563
556
|
// src/flow/FunkitFlowProvider.tsx
|
|
564
|
-
import {
|
|
557
|
+
import {
|
|
558
|
+
BottomSheetBackdrop as BottomSheetBackdrop2,
|
|
559
|
+
BottomSheetModal as BottomSheetModal2,
|
|
560
|
+
BottomSheetView as BottomSheetView2
|
|
561
|
+
} from "@gorhom/bottom-sheet";
|
|
562
|
+
import { useDynamicConfig as useDynamicConfig7 } from "@funkit/connect-core";
|
|
563
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
565
564
|
import {
|
|
566
565
|
createContext as createContext3,
|
|
567
|
-
useCallback as
|
|
566
|
+
useCallback as useCallback8,
|
|
568
567
|
useContext as useContext3,
|
|
569
568
|
useEffect as useEffect11,
|
|
570
|
-
useMemo as
|
|
571
|
-
useRef as
|
|
569
|
+
useMemo as useMemo9,
|
|
570
|
+
useRef as useRef7,
|
|
572
571
|
useState as useState9
|
|
573
572
|
} from "react";
|
|
574
573
|
import { Share, StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
@@ -652,7 +651,13 @@ var DatadogHttpLogTransport = class {
|
|
|
652
651
|
fetch(this.intakeUrl, {
|
|
653
652
|
method: "POST",
|
|
654
653
|
headers: { "Content-Type": "application/json" },
|
|
655
|
-
|
|
654
|
+
// BigInt-safe: log context may carry bigints (relay-sdk quote/step
|
|
655
|
+
// amounts) that plain JSON.stringify throws on — and flush() can run
|
|
656
|
+
// synchronously inside a caller's log(). Coerce bigints to strings.
|
|
657
|
+
body: JSON.stringify(
|
|
658
|
+
batch,
|
|
659
|
+
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
660
|
+
)
|
|
656
661
|
}).catch(() => {
|
|
657
662
|
});
|
|
658
663
|
}
|
|
@@ -1158,7 +1163,7 @@ var badgeRing = (badge) => ({
|
|
|
1158
1163
|
height: badge + 2
|
|
1159
1164
|
});
|
|
1160
1165
|
|
|
1161
|
-
// src/screens/
|
|
1166
|
+
// src/screens/SelectMethodScreen.tsx
|
|
1162
1167
|
import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
|
|
1163
1168
|
import { Animated as Animated2, Pressable, ScrollView } from "react-native";
|
|
1164
1169
|
import Reanimated, {
|
|
@@ -1214,7 +1219,7 @@ var scrimExit = new Keyframe2({
|
|
|
1214
1219
|
var DEFAULT_ERROR_TITLE = "Something went wrong";
|
|
1215
1220
|
var DEFAULT_ERROR_MESSAGE = "There was a problem loading data.\nCheck your internet and try again.";
|
|
1216
1221
|
var DEFAULT_RETRY_LABEL = "Try again";
|
|
1217
|
-
function
|
|
1222
|
+
function SelectMethodScreen({
|
|
1218
1223
|
methods,
|
|
1219
1224
|
onSelectMethod,
|
|
1220
1225
|
title = "Add money",
|
|
@@ -1248,7 +1253,7 @@ function AddMoneyScreen({
|
|
|
1248
1253
|
/* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: title })
|
|
1249
1254
|
] }),
|
|
1250
1255
|
error ? /* @__PURE__ */ jsx9(
|
|
1251
|
-
|
|
1256
|
+
SelectMethodError,
|
|
1252
1257
|
{
|
|
1253
1258
|
title: errorTitle,
|
|
1254
1259
|
message: errorMessage,
|
|
@@ -1256,7 +1261,7 @@ function AddMoneyScreen({
|
|
|
1256
1261
|
onRetry
|
|
1257
1262
|
}
|
|
1258
1263
|
) : loading ? /* @__PURE__ */ jsx9(
|
|
1259
|
-
|
|
1264
|
+
SelectMethodLoading,
|
|
1260
1265
|
{
|
|
1261
1266
|
count: skeletonCount,
|
|
1262
1267
|
showDropdown: Boolean(showDropdown),
|
|
@@ -1347,7 +1352,7 @@ function AddMoneyScreen({
|
|
|
1347
1352
|
}
|
|
1348
1353
|
);
|
|
1349
1354
|
}
|
|
1350
|
-
function
|
|
1355
|
+
function SelectMethodError({
|
|
1351
1356
|
title,
|
|
1352
1357
|
message,
|
|
1353
1358
|
retryLabel,
|
|
@@ -1358,7 +1363,7 @@ function AddMoneyError({
|
|
|
1358
1363
|
/* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: title }),
|
|
1359
1364
|
/* @__PURE__ */ jsx9(Text, { variant: "detail", color: "textSecondary", style: errorMessageText, children: message })
|
|
1360
1365
|
] }),
|
|
1361
|
-
/* @__PURE__ */ jsx9(
|
|
1366
|
+
onRetry ? /* @__PURE__ */ jsx9(
|
|
1362
1367
|
Pressable,
|
|
1363
1368
|
{
|
|
1364
1369
|
onPress: onRetry,
|
|
@@ -1368,7 +1373,7 @@ function AddMoneyError({
|
|
|
1368
1373
|
Box,
|
|
1369
1374
|
{
|
|
1370
1375
|
backgroundColor: "btnPrimary",
|
|
1371
|
-
borderRadius: "
|
|
1376
|
+
borderRadius: "button",
|
|
1372
1377
|
alignItems: "center",
|
|
1373
1378
|
justifyContent: "center",
|
|
1374
1379
|
style: retryButton,
|
|
@@ -1376,7 +1381,7 @@ function AddMoneyError({
|
|
|
1376
1381
|
}
|
|
1377
1382
|
)
|
|
1378
1383
|
}
|
|
1379
|
-
)
|
|
1384
|
+
) : null
|
|
1380
1385
|
] });
|
|
1381
1386
|
}
|
|
1382
1387
|
function PaymentMethodRow({ method }) {
|
|
@@ -1539,7 +1544,7 @@ function AnimatedChevron({ open }) {
|
|
|
1539
1544
|
function CheckIcon() {
|
|
1540
1545
|
return /* @__PURE__ */ jsx9(FigmaCheckIcon, { size: 16 });
|
|
1541
1546
|
}
|
|
1542
|
-
function
|
|
1547
|
+
function SelectMethodLoading({
|
|
1543
1548
|
count,
|
|
1544
1549
|
showDropdown,
|
|
1545
1550
|
depositToLabel,
|
|
@@ -1750,6 +1755,7 @@ function AvailableChainsScreen({
|
|
|
1750
1755
|
networkLabel,
|
|
1751
1756
|
chains,
|
|
1752
1757
|
title = `Available ${networkLabel}`,
|
|
1758
|
+
gotItLabel = "Got it",
|
|
1753
1759
|
loading = false,
|
|
1754
1760
|
skeletonCount = 8,
|
|
1755
1761
|
onClose
|
|
@@ -1764,16 +1770,7 @@ function AvailableChainsScreen({
|
|
|
1764
1770
|
style: sheet,
|
|
1765
1771
|
children: [
|
|
1766
1772
|
/* @__PURE__ */ jsxs5(Box, { flexDirection: "row", alignItems: "center", style: topBar2, children: [
|
|
1767
|
-
/* @__PURE__ */ jsx10(
|
|
1768
|
-
Pressable2,
|
|
1769
|
-
{
|
|
1770
|
-
onPress: onClose,
|
|
1771
|
-
hitSlop: 12,
|
|
1772
|
-
accessibilityRole: "button",
|
|
1773
|
-
accessibilityLabel: "Close",
|
|
1774
|
-
children: /* @__PURE__ */ jsx10(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx10(FigmaCloseIcon, {}) })
|
|
1775
|
-
}
|
|
1776
|
-
),
|
|
1773
|
+
/* @__PURE__ */ jsx10(Box, { style: topBarSpacer }),
|
|
1777
1774
|
/* @__PURE__ */ jsx10(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx10(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
1778
1775
|
/* @__PURE__ */ jsx10(Box, { style: topBarSpacer })
|
|
1779
1776
|
] }),
|
|
@@ -1782,7 +1779,7 @@ function AvailableChainsScreen({
|
|
|
1782
1779
|
{
|
|
1783
1780
|
style: [list, { maxHeight: height * 0.72 }],
|
|
1784
1781
|
showsVerticalScrollIndicator: false,
|
|
1785
|
-
contentContainerStyle:
|
|
1782
|
+
contentContainerStyle: listContent2,
|
|
1786
1783
|
children: loading ? Array.from({ length: skeletonCount }, (_, index) => /* @__PURE__ */ jsx10(AvailableChainSkeleton, {}, index)) : chains.map((chain) => /* @__PURE__ */ jsxs5(
|
|
1787
1784
|
Box,
|
|
1788
1785
|
{
|
|
@@ -1805,7 +1802,27 @@ function AvailableChainsScreen({
|
|
|
1805
1802
|
chain.id
|
|
1806
1803
|
))
|
|
1807
1804
|
}
|
|
1808
|
-
)
|
|
1805
|
+
),
|
|
1806
|
+
/* @__PURE__ */ jsx10(Box, { style: buttonContainer, children: /* @__PURE__ */ jsx10(
|
|
1807
|
+
Pressable2,
|
|
1808
|
+
{
|
|
1809
|
+
onPress: onClose,
|
|
1810
|
+
accessibilityRole: "button",
|
|
1811
|
+
accessibilityLabel: gotItLabel,
|
|
1812
|
+
children: /* @__PURE__ */ jsx10(
|
|
1813
|
+
Box,
|
|
1814
|
+
{
|
|
1815
|
+
flexDirection: "row",
|
|
1816
|
+
alignItems: "center",
|
|
1817
|
+
justifyContent: "center",
|
|
1818
|
+
backgroundColor: "btnPrimary",
|
|
1819
|
+
borderRadius: "button",
|
|
1820
|
+
style: gotItButton,
|
|
1821
|
+
children: /* @__PURE__ */ jsx10(Text, { variant: "bodyMedium", color: "onBtnPrimary", children: gotItLabel })
|
|
1822
|
+
}
|
|
1823
|
+
)
|
|
1824
|
+
}
|
|
1825
|
+
) })
|
|
1809
1826
|
]
|
|
1810
1827
|
}
|
|
1811
1828
|
);
|
|
@@ -1817,16 +1834,17 @@ function AvailableChainSkeleton() {
|
|
|
1817
1834
|
/* @__PURE__ */ jsx10(Box, { backgroundColor: "pillPressed", style: skeletonMin })
|
|
1818
1835
|
] });
|
|
1819
1836
|
}
|
|
1820
|
-
var sheet = { paddingBottom:
|
|
1837
|
+
var sheet = { paddingBottom: 34 };
|
|
1821
1838
|
var topBar2 = {
|
|
1822
|
-
|
|
1839
|
+
paddingBottom: 12,
|
|
1823
1840
|
paddingHorizontal: 24,
|
|
1824
1841
|
gap: 4
|
|
1825
1842
|
};
|
|
1826
|
-
var iconButton = { width: 32, height: 32 };
|
|
1827
1843
|
var topBarSpacer = { width: 32, height: 32 };
|
|
1828
1844
|
var list = { width: "100%" };
|
|
1829
|
-
var
|
|
1845
|
+
var listContent2 = { paddingHorizontal: 20 };
|
|
1846
|
+
var buttonContainer = { paddingHorizontal: 20, paddingTop: 16 };
|
|
1847
|
+
var gotItButton = { height: 56, paddingHorizontal: 24 };
|
|
1830
1848
|
var row2 = { gap: 12, paddingVertical: 10 };
|
|
1831
1849
|
var skeletonIcon = { width: 36, height: 36, borderRadius: 999 };
|
|
1832
1850
|
var skeletonName = { width: 157, height: 16, borderRadius: 4 };
|
|
@@ -1843,8 +1861,9 @@ var iconRing2 = {
|
|
|
1843
1861
|
};
|
|
1844
1862
|
|
|
1845
1863
|
// src/screens/CheckoutBlockedScreen.tsx
|
|
1846
|
-
import { StyleSheet as StyleSheet2 } from "react-native";
|
|
1864
|
+
import { Linking, Pressable as Pressable3, StyleSheet as StyleSheet2 } from "react-native";
|
|
1847
1865
|
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1866
|
+
var FUN_REGIONAL_RESTRICTIONS_URL = "https://intercom.help/funxyz/en/articles/9827689-regional-restrictions";
|
|
1848
1867
|
function CheckoutBlockedScreen() {
|
|
1849
1868
|
return /* @__PURE__ */ jsxs6(
|
|
1850
1869
|
Box,
|
|
@@ -1853,7 +1872,10 @@ function CheckoutBlockedScreen() {
|
|
|
1853
1872
|
borderTopLeftRadius: "modal",
|
|
1854
1873
|
borderTopRightRadius: "modal",
|
|
1855
1874
|
children: [
|
|
1856
|
-
/* @__PURE__ */
|
|
1875
|
+
/* @__PURE__ */ jsxs6(Box, { alignItems: "center", style: styles2.topBar, children: [
|
|
1876
|
+
/* @__PURE__ */ jsx11(Box, { backgroundColor: "borderFocused", style: styles2.grabber }),
|
|
1877
|
+
/* @__PURE__ */ jsx11(Text, { variant: "bodyMedium", color: "textPrimary", children: "Add money" })
|
|
1878
|
+
] }),
|
|
1857
1879
|
/* @__PURE__ */ jsxs6(Box, { alignItems: "center", justifyContent: "center", style: styles2.content, children: [
|
|
1858
1880
|
/* @__PURE__ */ jsx11(
|
|
1859
1881
|
Box,
|
|
@@ -1863,20 +1885,37 @@ function CheckoutBlockedScreen() {
|
|
|
1863
1885
|
alignItems: "center",
|
|
1864
1886
|
justifyContent: "center",
|
|
1865
1887
|
style: styles2.iconCircle,
|
|
1866
|
-
children: /* @__PURE__ */ jsx11(
|
|
1888
|
+
children: /* @__PURE__ */ jsx11(FigmaAlertCircleIcon, { size: 20 })
|
|
1867
1889
|
}
|
|
1868
1890
|
),
|
|
1869
1891
|
/* @__PURE__ */ jsxs6(Box, { alignItems: "center", style: styles2.textGroup, children: [
|
|
1870
1892
|
/* @__PURE__ */ jsx11(Text, { variant: "bodyMedium", color: "textPrimary", children: "Not available" }),
|
|
1871
|
-
/* @__PURE__ */
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1893
|
+
/* @__PURE__ */ jsxs6(Box, { alignItems: "center", children: [
|
|
1894
|
+
/* @__PURE__ */ jsx11(
|
|
1895
|
+
Text,
|
|
1896
|
+
{
|
|
1897
|
+
variant: "detail",
|
|
1898
|
+
color: "textSecondary",
|
|
1899
|
+
style: styles2.descriptionText,
|
|
1900
|
+
children: "This service is not available in your region."
|
|
1901
|
+
}
|
|
1902
|
+
),
|
|
1903
|
+
/* @__PURE__ */ jsx11(
|
|
1904
|
+
Pressable3,
|
|
1905
|
+
{
|
|
1906
|
+
onPress: () => Linking.openURL(FUN_REGIONAL_RESTRICTIONS_URL),
|
|
1907
|
+
children: /* @__PURE__ */ jsx11(
|
|
1908
|
+
Text,
|
|
1909
|
+
{
|
|
1910
|
+
variant: "detail",
|
|
1911
|
+
color: "textSecondary",
|
|
1912
|
+
style: styles2.linkText,
|
|
1913
|
+
children: "View available regions."
|
|
1914
|
+
}
|
|
1915
|
+
)
|
|
1916
|
+
}
|
|
1917
|
+
)
|
|
1918
|
+
] })
|
|
1880
1919
|
] })
|
|
1881
1920
|
] })
|
|
1882
1921
|
]
|
|
@@ -1884,7 +1923,7 @@ function CheckoutBlockedScreen() {
|
|
|
1884
1923
|
);
|
|
1885
1924
|
}
|
|
1886
1925
|
var styles2 = StyleSheet2.create({
|
|
1887
|
-
topBar: { paddingTop:
|
|
1926
|
+
topBar: { height: 64, paddingTop: 25, paddingBottom: 12 },
|
|
1888
1927
|
grabber: {
|
|
1889
1928
|
position: "absolute",
|
|
1890
1929
|
top: 8,
|
|
@@ -1893,21 +1932,28 @@ var styles2 = StyleSheet2.create({
|
|
|
1893
1932
|
borderRadius: 999
|
|
1894
1933
|
},
|
|
1895
1934
|
content: {
|
|
1896
|
-
height:
|
|
1897
|
-
gap:
|
|
1898
|
-
paddingHorizontal: 16
|
|
1935
|
+
height: 390,
|
|
1936
|
+
gap: 24,
|
|
1937
|
+
paddingHorizontal: 16,
|
|
1938
|
+
paddingBottom: 34
|
|
1899
1939
|
},
|
|
1900
1940
|
iconCircle: { width: 48, height: 48 },
|
|
1901
1941
|
textGroup: { gap: 8 },
|
|
1902
|
-
descriptionText: { textAlign: "center" }
|
|
1942
|
+
descriptionText: { textAlign: "center" },
|
|
1943
|
+
linkText: { textAlign: "center", textDecorationLine: "underline" }
|
|
1903
1944
|
});
|
|
1904
1945
|
|
|
1905
1946
|
// src/screens/QrCodeScreen.tsx
|
|
1906
1947
|
import { useEffect as useEffect5, useRef as useRef2, useState as useState5 } from "react";
|
|
1907
|
-
import {
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
} from "react-native";
|
|
1948
|
+
import { Pressable as Pressable4 } from "react-native";
|
|
1949
|
+
|
|
1950
|
+
// src/hooks/useScreenSize.ts
|
|
1951
|
+
import { useWindowDimensions as useWindowDimensions2 } from "react-native";
|
|
1952
|
+
function useScreenSize() {
|
|
1953
|
+
const { height } = useWindowDimensions2();
|
|
1954
|
+
const isShort = height < 700;
|
|
1955
|
+
return { isShort };
|
|
1956
|
+
}
|
|
1911
1957
|
|
|
1912
1958
|
// src/icons/CopyAddressIcon.tsx
|
|
1913
1959
|
import { SvgXml as SvgXml4 } from "react-native-svg";
|
|
@@ -1933,13 +1979,14 @@ function QrCodeScreen({
|
|
|
1933
1979
|
centerIcon,
|
|
1934
1980
|
address,
|
|
1935
1981
|
title = "QR Code",
|
|
1982
|
+
doneLabel = "Done",
|
|
1936
1983
|
copyLabel = "Copy address",
|
|
1937
1984
|
copiedLabel = "Copied!",
|
|
1938
1985
|
copiedFeedbackMs = 1800,
|
|
1939
1986
|
onClose,
|
|
1940
1987
|
onCopyAddress
|
|
1941
1988
|
}) {
|
|
1942
|
-
const {
|
|
1989
|
+
const { isShort } = useScreenSize();
|
|
1943
1990
|
const [copied, setCopied] = useState5(false);
|
|
1944
1991
|
const copyTimer = useRef2(void 0);
|
|
1945
1992
|
useEffect5(() => () => clearTimeout(copyTimer.current), []);
|
|
@@ -1959,100 +2006,106 @@ function QrCodeScreen({
|
|
|
1959
2006
|
style: sheet2,
|
|
1960
2007
|
children: [
|
|
1961
2008
|
/* @__PURE__ */ jsxs7(Box, { flexDirection: "row", alignItems: "center", style: topBar3, children: [
|
|
1962
|
-
/* @__PURE__ */ jsx13(
|
|
1963
|
-
Pressable3,
|
|
1964
|
-
{
|
|
1965
|
-
onPress: onClose,
|
|
1966
|
-
hitSlop: 12,
|
|
1967
|
-
accessibilityRole: "button",
|
|
1968
|
-
accessibilityLabel: "Close",
|
|
1969
|
-
children: /* @__PURE__ */ jsx13(Text, { color: "textPrimary", style: closeGlyph, children: "\u2715" })
|
|
1970
|
-
}
|
|
1971
|
-
),
|
|
2009
|
+
/* @__PURE__ */ jsx13(Box, { style: topBarSpacer2 }),
|
|
1972
2010
|
/* @__PURE__ */ jsx13(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
1973
2011
|
/* @__PURE__ */ jsx13(Box, { style: topBarSpacer2 })
|
|
1974
2012
|
] }),
|
|
1975
|
-
/* @__PURE__ */ jsxs7(
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
2013
|
+
/* @__PURE__ */ jsxs7(Box, { style: { paddingVertical: isShort ? 0 : 16 }, children: [
|
|
2014
|
+
/* @__PURE__ */ jsxs7(
|
|
2015
|
+
Box,
|
|
2016
|
+
{
|
|
2017
|
+
alignItems: "center",
|
|
2018
|
+
justifyContent: "center",
|
|
2019
|
+
style: [content, { paddingVertical: isShort ? 24 : 82 }],
|
|
2020
|
+
children: [
|
|
2021
|
+
/* @__PURE__ */ jsxs7(
|
|
2022
|
+
Box,
|
|
2023
|
+
{
|
|
2024
|
+
backgroundColor: "bgModal",
|
|
2025
|
+
borderColor: "borderDefault",
|
|
2026
|
+
borderWidth: 1.5,
|
|
2027
|
+
alignItems: "center",
|
|
2028
|
+
justifyContent: "center",
|
|
2029
|
+
style: qrFrame,
|
|
2030
|
+
children: [
|
|
2031
|
+
qrCode,
|
|
2032
|
+
centerIcon ? /* @__PURE__ */ jsx13(
|
|
2033
|
+
Box,
|
|
2034
|
+
{
|
|
2035
|
+
alignItems: "center",
|
|
2036
|
+
justifyContent: "center",
|
|
2037
|
+
style: centerOverlay,
|
|
2038
|
+
children: centerIcon
|
|
2039
|
+
}
|
|
2040
|
+
) : null
|
|
2041
|
+
]
|
|
2042
|
+
}
|
|
2043
|
+
),
|
|
2044
|
+
address ? /* @__PURE__ */ jsxs7(Box, { alignItems: "center", style: addressGroup, children: [
|
|
2045
|
+
/* @__PURE__ */ jsx13(Text, { variant: "body", color: "textSecondary", style: addressText, children: address }),
|
|
2046
|
+
onCopyAddress ? /* @__PURE__ */ jsx13(
|
|
2047
|
+
Pressable4,
|
|
2048
|
+
{
|
|
2049
|
+
onPress: handleCopy,
|
|
2050
|
+
accessibilityRole: "button",
|
|
2051
|
+
accessibilityLabel: copied ? "Address copied" : "Copy address",
|
|
2052
|
+
children: /* @__PURE__ */ jsxs7(
|
|
2053
|
+
Box,
|
|
2054
|
+
{
|
|
2055
|
+
flexDirection: "row",
|
|
2056
|
+
alignItems: "center",
|
|
2057
|
+
justifyContent: "center",
|
|
2058
|
+
backgroundColor: "btnSecondary",
|
|
2059
|
+
borderColor: "btnSecondary",
|
|
2060
|
+
borderWidth: 1,
|
|
2061
|
+
borderRadius: "element",
|
|
2062
|
+
style: copyButton,
|
|
2063
|
+
children: [
|
|
2064
|
+
/* @__PURE__ */ jsx13(CopyAddressIcon, {}),
|
|
2065
|
+
/* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "onBtnSecondary", children: copied ? copiedLabel : copyLabel })
|
|
2066
|
+
]
|
|
2067
|
+
}
|
|
2068
|
+
)
|
|
2069
|
+
}
|
|
2070
|
+
) : null
|
|
2071
|
+
] }) : null
|
|
2072
|
+
]
|
|
2073
|
+
}
|
|
2074
|
+
),
|
|
2075
|
+
/* @__PURE__ */ jsx13(Box, { style: buttonContainer2, children: /* @__PURE__ */ jsx13(
|
|
2076
|
+
Pressable4,
|
|
2077
|
+
{
|
|
2078
|
+
onPress: onClose,
|
|
2079
|
+
accessibilityRole: "button",
|
|
2080
|
+
accessibilityLabel: doneLabel,
|
|
2081
|
+
children: /* @__PURE__ */ jsx13(
|
|
1983
2082
|
Box,
|
|
1984
2083
|
{
|
|
1985
|
-
|
|
1986
|
-
borderColor: "borderDefault",
|
|
1987
|
-
borderWidth: 1.5,
|
|
2084
|
+
flexDirection: "row",
|
|
1988
2085
|
alignItems: "center",
|
|
1989
2086
|
justifyContent: "center",
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
Box,
|
|
1995
|
-
{
|
|
1996
|
-
alignItems: "center",
|
|
1997
|
-
justifyContent: "center",
|
|
1998
|
-
style: centerOverlay,
|
|
1999
|
-
children: centerIcon
|
|
2000
|
-
}
|
|
2001
|
-
) : null
|
|
2002
|
-
]
|
|
2087
|
+
backgroundColor: "btnPrimary",
|
|
2088
|
+
borderRadius: "button",
|
|
2089
|
+
style: doneButton,
|
|
2090
|
+
children: /* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "onBtnPrimary", children: doneLabel })
|
|
2003
2091
|
}
|
|
2004
|
-
)
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
Pressable3,
|
|
2009
|
-
{
|
|
2010
|
-
onPress: handleCopy,
|
|
2011
|
-
accessibilityRole: "button",
|
|
2012
|
-
accessibilityLabel: copied ? "Address copied" : "Copy address",
|
|
2013
|
-
children: /* @__PURE__ */ jsxs7(
|
|
2014
|
-
Box,
|
|
2015
|
-
{
|
|
2016
|
-
flexDirection: "row",
|
|
2017
|
-
alignItems: "center",
|
|
2018
|
-
justifyContent: "center",
|
|
2019
|
-
backgroundColor: "btnSecondary",
|
|
2020
|
-
borderColor: "btnSecondary",
|
|
2021
|
-
borderWidth: 1,
|
|
2022
|
-
borderRadius: "element",
|
|
2023
|
-
style: copyButton,
|
|
2024
|
-
children: [
|
|
2025
|
-
/* @__PURE__ */ jsx13(CopyAddressIcon, {}),
|
|
2026
|
-
/* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "onBtnSecondary", children: copied ? copiedLabel : copyLabel })
|
|
2027
|
-
]
|
|
2028
|
-
}
|
|
2029
|
-
)
|
|
2030
|
-
}
|
|
2031
|
-
) : null
|
|
2032
|
-
] }) : null
|
|
2033
|
-
]
|
|
2034
|
-
}
|
|
2035
|
-
)
|
|
2092
|
+
)
|
|
2093
|
+
}
|
|
2094
|
+
) })
|
|
2095
|
+
] })
|
|
2036
2096
|
]
|
|
2037
2097
|
}
|
|
2038
2098
|
);
|
|
2039
2099
|
}
|
|
2040
|
-
var sheet2 = { paddingBottom:
|
|
2100
|
+
var sheet2 = { paddingBottom: 34 };
|
|
2041
2101
|
var topBar3 = {
|
|
2042
|
-
|
|
2102
|
+
paddingBottom: 12,
|
|
2043
2103
|
paddingHorizontal: 24,
|
|
2044
2104
|
gap: 4
|
|
2045
2105
|
};
|
|
2046
|
-
var closeGlyph = {
|
|
2047
|
-
fontSize: 20,
|
|
2048
|
-
lineHeight: 24,
|
|
2049
|
-
width: 32,
|
|
2050
|
-
textAlign: "center"
|
|
2051
|
-
};
|
|
2052
2106
|
var topBarSpacer2 = { width: 32, height: 32 };
|
|
2053
|
-
var
|
|
2107
|
+
var content = {
|
|
2054
2108
|
paddingHorizontal: 20,
|
|
2055
|
-
paddingVertical: 45,
|
|
2056
2109
|
gap: 40
|
|
2057
2110
|
};
|
|
2058
2111
|
var qrFrame = {
|
|
@@ -2082,14 +2135,16 @@ var copyButton = {
|
|
|
2082
2135
|
paddingHorizontal: 20,
|
|
2083
2136
|
gap: 8
|
|
2084
2137
|
};
|
|
2138
|
+
var buttonContainer2 = { paddingHorizontal: 20 };
|
|
2139
|
+
var doneButton = { height: 56, paddingHorizontal: 24 };
|
|
2085
2140
|
|
|
2086
2141
|
// src/screens/TransferCryptoScreen.tsx
|
|
2087
2142
|
import { useEffect as useEffect7, useRef as useRef3, useState as useState7 } from "react";
|
|
2088
|
-
import { Pressable as
|
|
2143
|
+
import { Pressable as Pressable6 } from "react-native";
|
|
2089
2144
|
|
|
2090
2145
|
// src/screens/NetworkSelector.tsx
|
|
2091
2146
|
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
2092
|
-
import { Pressable as
|
|
2147
|
+
import { Pressable as Pressable5 } from "react-native";
|
|
2093
2148
|
import Animated3, {
|
|
2094
2149
|
Easing as Easing3,
|
|
2095
2150
|
FadeIn,
|
|
@@ -2160,7 +2215,7 @@ function NetworkSelector({
|
|
|
2160
2215
|
}
|
|
2161
2216
|
);
|
|
2162
2217
|
}
|
|
2163
|
-
var AnimatedPressable2 = Animated3.createAnimatedComponent(
|
|
2218
|
+
var AnimatedPressable2 = Animated3.createAnimatedComponent(Pressable5);
|
|
2164
2219
|
var SLIDE_MS = 250;
|
|
2165
2220
|
var COLLAPSE_MS = 150;
|
|
2166
2221
|
var segmentLayout = LinearTransition.duration(SLIDE_MS).easing(
|
|
@@ -2247,28 +2302,28 @@ function TransferCryptoScreen({
|
|
|
2247
2302
|
children: [
|
|
2248
2303
|
/* @__PURE__ */ jsxs9(Box, { flexDirection: "row", alignItems: "center", style: topBar4, children: [
|
|
2249
2304
|
/* @__PURE__ */ jsx15(
|
|
2250
|
-
|
|
2305
|
+
Pressable6,
|
|
2251
2306
|
{
|
|
2252
2307
|
onPress: onBack,
|
|
2253
2308
|
hitSlop: 12,
|
|
2254
2309
|
accessibilityRole: "button",
|
|
2255
2310
|
accessibilityLabel: "Back",
|
|
2256
|
-
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style:
|
|
2311
|
+
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx15(FigmaChevronLeftIcon, {}) })
|
|
2257
2312
|
}
|
|
2258
2313
|
),
|
|
2259
2314
|
/* @__PURE__ */ jsx15(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
2260
2315
|
/* @__PURE__ */ jsx15(
|
|
2261
|
-
|
|
2316
|
+
Pressable6,
|
|
2262
2317
|
{
|
|
2263
2318
|
onPress: onShowQrCode,
|
|
2264
2319
|
hitSlop: 12,
|
|
2265
2320
|
accessibilityRole: "button",
|
|
2266
2321
|
accessibilityLabel: "Show QR code",
|
|
2267
|
-
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style:
|
|
2322
|
+
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx15(FigmaQrScanIcon, {}) })
|
|
2268
2323
|
}
|
|
2269
2324
|
)
|
|
2270
2325
|
] }),
|
|
2271
|
-
/* @__PURE__ */ jsxs9(Box, { style:
|
|
2326
|
+
/* @__PURE__ */ jsxs9(Box, { style: content2, children: [
|
|
2272
2327
|
/* @__PURE__ */ jsx15(
|
|
2273
2328
|
NetworkSelector,
|
|
2274
2329
|
{
|
|
@@ -2309,7 +2364,7 @@ function TransferCryptoScreen({
|
|
|
2309
2364
|
)
|
|
2310
2365
|
] }),
|
|
2311
2366
|
showPreview ? /* @__PURE__ */ jsx15(
|
|
2312
|
-
|
|
2367
|
+
Pressable6,
|
|
2313
2368
|
{
|
|
2314
2369
|
onPress: onShowChains,
|
|
2315
2370
|
accessibilityRole: "button",
|
|
@@ -2402,7 +2457,7 @@ function PillButton({
|
|
|
2402
2457
|
onPress
|
|
2403
2458
|
}) {
|
|
2404
2459
|
return /* @__PURE__ */ jsx15(
|
|
2405
|
-
|
|
2460
|
+
Pressable6,
|
|
2406
2461
|
{
|
|
2407
2462
|
onPress,
|
|
2408
2463
|
accessibilityRole: "button",
|
|
@@ -2415,7 +2470,7 @@ function PillButton({
|
|
|
2415
2470
|
alignItems: "center",
|
|
2416
2471
|
justifyContent: "center",
|
|
2417
2472
|
backgroundColor: "btnPrimary",
|
|
2418
|
-
borderRadius: "
|
|
2473
|
+
borderRadius: "button",
|
|
2419
2474
|
style: pillButton,
|
|
2420
2475
|
children: [
|
|
2421
2476
|
icon,
|
|
@@ -2432,8 +2487,8 @@ var topBar4 = {
|
|
|
2432
2487
|
paddingHorizontal: 24,
|
|
2433
2488
|
gap: 4
|
|
2434
2489
|
};
|
|
2435
|
-
var
|
|
2436
|
-
var
|
|
2490
|
+
var iconButton = { width: 32, height: 32 };
|
|
2491
|
+
var content2 = {
|
|
2437
2492
|
paddingHorizontal: 20,
|
|
2438
2493
|
// pb-16 in Figma + the iOS home-indicator space below the buttons, so the
|
|
2439
2494
|
// sheet bottom sits flush with the 874px frame bottom.
|
|
@@ -2471,14 +2526,71 @@ var buttonsRow = { gap: 10, width: "100%" };
|
|
|
2471
2526
|
var pillButtonPress = { flex: 1 };
|
|
2472
2527
|
var pillButton = { height: 56, paddingHorizontal: 24, gap: 8 };
|
|
2473
2528
|
|
|
2529
|
+
// src/screens/WithdrawMethodScreen.tsx
|
|
2530
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
2531
|
+
var EMPTY_TITLE = "Withdrawals unavailable";
|
|
2532
|
+
var EMPTY_MESSAGE = "Cash withdrawals aren't available in your region right now.";
|
|
2533
|
+
var BELOW_MIN_TITLE = "Balance too low";
|
|
2534
|
+
var BELOW_MIN_MESSAGE = "Your balance is below the minimum for a cash withdrawal.";
|
|
2535
|
+
function getTerminalError(isBelowMinimum, isEmpty) {
|
|
2536
|
+
if (isBelowMinimum) {
|
|
2537
|
+
return { title: BELOW_MIN_TITLE, message: BELOW_MIN_MESSAGE };
|
|
2538
|
+
}
|
|
2539
|
+
if (isEmpty) {
|
|
2540
|
+
return { title: EMPTY_TITLE, message: EMPTY_MESSAGE };
|
|
2541
|
+
}
|
|
2542
|
+
return null;
|
|
2543
|
+
}
|
|
2544
|
+
function WithdrawMethodScreen({
|
|
2545
|
+
methods,
|
|
2546
|
+
onSelectMethod,
|
|
2547
|
+
title = "Withdraw",
|
|
2548
|
+
loading = false,
|
|
2549
|
+
hasError = false,
|
|
2550
|
+
onRetry,
|
|
2551
|
+
isEmpty = false,
|
|
2552
|
+
isBelowMinimum = false
|
|
2553
|
+
}) {
|
|
2554
|
+
const terminalError = getTerminalError(isBelowMinimum, isEmpty);
|
|
2555
|
+
if (terminalError && !hasError && !loading) {
|
|
2556
|
+
return /* @__PURE__ */ jsx16(
|
|
2557
|
+
SelectMethodScreen,
|
|
2558
|
+
{
|
|
2559
|
+
title,
|
|
2560
|
+
methods: [],
|
|
2561
|
+
onSelectMethod,
|
|
2562
|
+
error: true,
|
|
2563
|
+
errorTitle: terminalError.title,
|
|
2564
|
+
errorMessage: terminalError.message
|
|
2565
|
+
}
|
|
2566
|
+
);
|
|
2567
|
+
}
|
|
2568
|
+
return /* @__PURE__ */ jsx16(
|
|
2569
|
+
SelectMethodScreen,
|
|
2570
|
+
{
|
|
2571
|
+
title,
|
|
2572
|
+
methods,
|
|
2573
|
+
onSelectMethod,
|
|
2574
|
+
loading,
|
|
2575
|
+
error: hasError,
|
|
2576
|
+
onRetry
|
|
2577
|
+
}
|
|
2578
|
+
);
|
|
2579
|
+
}
|
|
2580
|
+
|
|
2474
2581
|
// src/swapped/SwappedScreen.tsx
|
|
2582
|
+
import { useCallback as useCallback4 } from "react";
|
|
2583
|
+
|
|
2584
|
+
// src/swapped/SwappedScreenShell.tsx
|
|
2475
2585
|
import { useCallback as useCallback3 } from "react";
|
|
2476
2586
|
|
|
2477
2587
|
// src/swapped/SwappedWebView.tsx
|
|
2478
2588
|
import { useTheme as useTheme2 } from "@shopify/restyle";
|
|
2479
2589
|
import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo4, useRef as useRef4 } from "react";
|
|
2480
2590
|
import { ActivityIndicator, View } from "react-native";
|
|
2481
|
-
import {
|
|
2591
|
+
import {
|
|
2592
|
+
WebView
|
|
2593
|
+
} from "react-native-webview";
|
|
2482
2594
|
|
|
2483
2595
|
// src/swapped/buildSwappedTheme.ts
|
|
2484
2596
|
var px = (value) => `${value}px`;
|
|
@@ -2635,10 +2747,32 @@ var SWAPPED_WEBVIEW_INJECTED_JS = `(function () {
|
|
|
2635
2747
|
// Anything else is the embed talking to its host \u2192 forward to native.
|
|
2636
2748
|
forwardToNative(message);
|
|
2637
2749
|
}
|
|
2638
|
-
// The embed posts to window.parent (and sometimes window) \u2014 both are this
|
|
2639
|
-
// window at the top level, so both assignments install the same bridge.
|
|
2640
|
-
try { if (window.parent) { window.parent.postMessage = bridged; } } catch (e) {}
|
|
2641
2750
|
try { window.postMessage = bridged; } catch (e) {}
|
|
2751
|
+
// The widget only emits some messages (notably SWAPPED_ORDER_DATA, the sell
|
|
2752
|
+
// deposit address) when it believes it is embedded in a parent frame \u2014 on web
|
|
2753
|
+
// that's a real <iframe> so window.parent !== window. A top-level WebView has
|
|
2754
|
+
// window.parent === window, so present a DISTINCT parent/top (a proxy over
|
|
2755
|
+
// window) whose postMessage forwards to native; the get-trap delegates every
|
|
2756
|
+
// other property to the real window so the widget's other parent.* access works.
|
|
2757
|
+
var frameProxy = window;
|
|
2758
|
+
try {
|
|
2759
|
+
frameProxy = new Proxy(window, {
|
|
2760
|
+
get: function (target, prop) {
|
|
2761
|
+
if (prop === 'postMessage') { return bridged; }
|
|
2762
|
+
var value = target[prop];
|
|
2763
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
2764
|
+
},
|
|
2765
|
+
});
|
|
2766
|
+
} catch (e) {
|
|
2767
|
+
// Proxy unavailable \u2192 fall back to bridging the real parent.
|
|
2768
|
+
try { if (window.parent) { window.parent.postMessage = bridged; } } catch (e2) {}
|
|
2769
|
+
}
|
|
2770
|
+
// Guard parent/top independently: parent is [Replaceable] so it sticks, but
|
|
2771
|
+
// top is [LegacyUnforgeable] (HTML spec) and throws on conforming engines
|
|
2772
|
+
// while succeeding on the WebView builds that gate embed detection on it \u2014
|
|
2773
|
+
// isolating them means a throw on one never skips the other.
|
|
2774
|
+
try { Object.defineProperty(window, 'parent', { configurable: true, get: function () { return frameProxy; } }); } catch (e) {}
|
|
2775
|
+
try { Object.defineProperty(window, 'top', { configurable: true, get: function () { return frameProxy; } }); } catch (e) {}
|
|
2642
2776
|
// No parent frame \u2192 the widget posts lifecycle messages to window.opener.
|
|
2643
2777
|
try { if (!window.opener) { window.opener = { postMessage: forwardToNative }; } } catch (e) {}
|
|
2644
2778
|
true;
|
|
@@ -2652,7 +2786,7 @@ function buildSwappedSendScript(msg) {
|
|
|
2652
2786
|
true;`;
|
|
2653
2787
|
}
|
|
2654
2788
|
function handleWebViewMessage(rawData, url) {
|
|
2655
|
-
if (url
|
|
2789
|
+
if (!url || getSwappedOrigin(url) == null) {
|
|
2656
2790
|
return null;
|
|
2657
2791
|
}
|
|
2658
2792
|
let parsed;
|
|
@@ -2703,9 +2837,10 @@ function createWebViewSwappedTransport({
|
|
|
2703
2837
|
}
|
|
2704
2838
|
|
|
2705
2839
|
// src/swapped/SwappedWebView.tsx
|
|
2706
|
-
import { jsx as
|
|
2840
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2707
2841
|
function SwappedWebView({ url, onMessage, style }) {
|
|
2708
2842
|
const webViewRef = useRef4(null);
|
|
2843
|
+
const lastCommittedUrlRef = useRef4(url);
|
|
2709
2844
|
const { transport, dispatch } = useMemo4(
|
|
2710
2845
|
() => createWebViewSwappedTransport({
|
|
2711
2846
|
getWebView: () => webViewRef.current
|
|
@@ -2739,11 +2874,19 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
2739
2874
|
}),
|
|
2740
2875
|
[transport]
|
|
2741
2876
|
);
|
|
2877
|
+
const handleNavigationStateChange = (navState) => {
|
|
2878
|
+
if (navState.url) {
|
|
2879
|
+
lastCommittedUrlRef.current = navState.url;
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2742
2882
|
const handleMessage = (event) => {
|
|
2743
|
-
dispatch(
|
|
2883
|
+
dispatch(
|
|
2884
|
+
event.nativeEvent.data,
|
|
2885
|
+
event.nativeEvent.url || lastCommittedUrlRef.current
|
|
2886
|
+
);
|
|
2744
2887
|
};
|
|
2745
2888
|
const renderLoading = useCallback2(
|
|
2746
|
-
() => /* @__PURE__ */
|
|
2889
|
+
() => /* @__PURE__ */ jsx17(View, { style: [loadingOverlay, { backgroundColor: theme.colors.bgModal }], children: /* @__PURE__ */ jsx17(ActivityIndicator, { color: theme.colors.textSecondary }) }),
|
|
2747
2890
|
[theme.colors.bgModal, theme.colors.textSecondary]
|
|
2748
2891
|
);
|
|
2749
2892
|
const handleError = (event) => {
|
|
@@ -2759,12 +2902,13 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
2759
2902
|
url: event.nativeEvent.url
|
|
2760
2903
|
});
|
|
2761
2904
|
};
|
|
2762
|
-
return /* @__PURE__ */
|
|
2905
|
+
return /* @__PURE__ */ jsx17(
|
|
2763
2906
|
WebView,
|
|
2764
2907
|
{
|
|
2765
2908
|
ref: webViewRef,
|
|
2766
2909
|
source: { uri: url },
|
|
2767
2910
|
onMessage: handleMessage,
|
|
2911
|
+
onNavigationStateChange: handleNavigationStateChange,
|
|
2768
2912
|
onError: handleError,
|
|
2769
2913
|
onHttpError: handleHttpError,
|
|
2770
2914
|
scrollEnabled: false,
|
|
@@ -2796,15 +2940,47 @@ var loadingOverlay = {
|
|
|
2796
2940
|
justifyContent: "center"
|
|
2797
2941
|
};
|
|
2798
2942
|
|
|
2943
|
+
// src/swapped/SwappedScreenShell.tsx
|
|
2944
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2945
|
+
function SwappedScreenShell({
|
|
2946
|
+
url,
|
|
2947
|
+
onMessage
|
|
2948
|
+
}) {
|
|
2949
|
+
const handleMessage = useCallback3(
|
|
2950
|
+
(msg) => {
|
|
2951
|
+
if (msg.type === "SWAPPED_ERROR") {
|
|
2952
|
+
logger.warn("connect-rn:swapped:error", {
|
|
2953
|
+
data: msg.data ?? {}
|
|
2954
|
+
});
|
|
2955
|
+
}
|
|
2956
|
+
onMessage(msg);
|
|
2957
|
+
},
|
|
2958
|
+
[onMessage]
|
|
2959
|
+
);
|
|
2960
|
+
return /* @__PURE__ */ jsx18(
|
|
2961
|
+
Box,
|
|
2962
|
+
{
|
|
2963
|
+
backgroundColor: "bgModal",
|
|
2964
|
+
borderTopLeftRadius: "modal",
|
|
2965
|
+
borderTopRightRadius: "modal",
|
|
2966
|
+
style: sheet3,
|
|
2967
|
+
children: /* @__PURE__ */ jsx18(SwappedWebView, { url, onMessage: handleMessage, style: fill })
|
|
2968
|
+
}
|
|
2969
|
+
);
|
|
2970
|
+
}
|
|
2971
|
+
var SHEET_HEIGHT = 550;
|
|
2972
|
+
var sheet3 = { height: SHEET_HEIGHT, overflow: "hidden" };
|
|
2973
|
+
var fill = { flex: 1 };
|
|
2974
|
+
|
|
2799
2975
|
// src/swapped/SwappedScreen.tsx
|
|
2800
|
-
import { jsx as
|
|
2976
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2801
2977
|
function SwappedScreen({
|
|
2802
2978
|
url,
|
|
2803
2979
|
onClose,
|
|
2804
2980
|
onBack,
|
|
2805
2981
|
onSuccess
|
|
2806
2982
|
}) {
|
|
2807
|
-
const handleMessage =
|
|
2983
|
+
const handleMessage = useCallback4(
|
|
2808
2984
|
(msg) => {
|
|
2809
2985
|
switch (msg.type) {
|
|
2810
2986
|
case "SWAPPED_GO_BACK":
|
|
@@ -2818,31 +2994,66 @@ function SwappedScreen({
|
|
|
2818
2994
|
logger.info("connect-rn:swapped:transaction_successful");
|
|
2819
2995
|
onSuccess?.();
|
|
2820
2996
|
break;
|
|
2821
|
-
case "SWAPPED_ERROR":
|
|
2822
|
-
logger.warn("connect-rn:swapped:error", {
|
|
2823
|
-
data: JSON.stringify(msg.data ?? {})
|
|
2824
|
-
});
|
|
2825
|
-
break;
|
|
2826
2997
|
default:
|
|
2827
2998
|
break;
|
|
2828
2999
|
}
|
|
2829
3000
|
},
|
|
2830
3001
|
[onBack, onClose, onSuccess]
|
|
2831
3002
|
);
|
|
2832
|
-
return /* @__PURE__ */
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
3003
|
+
return /* @__PURE__ */ jsx19(SwappedScreenShell, { url, onMessage: handleMessage });
|
|
3004
|
+
}
|
|
3005
|
+
|
|
3006
|
+
// src/swapped/SwappedWithdrawScreen.tsx
|
|
3007
|
+
import {
|
|
3008
|
+
isValidOrderData
|
|
3009
|
+
} from "@funkit/connect-core";
|
|
3010
|
+
import { useCallback as useCallback5 } from "react";
|
|
3011
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
3012
|
+
function SwappedWithdrawScreen({
|
|
3013
|
+
url,
|
|
3014
|
+
onClose,
|
|
3015
|
+
onBack,
|
|
3016
|
+
onNewWithdrawal,
|
|
3017
|
+
onWithdrawalSuccess,
|
|
3018
|
+
onOrderData
|
|
3019
|
+
}) {
|
|
3020
|
+
const handleMessage = useCallback5(
|
|
3021
|
+
(msg) => {
|
|
3022
|
+
switch (msg.type) {
|
|
3023
|
+
case "SWAPPED_GO_BACK":
|
|
3024
|
+
onBack();
|
|
3025
|
+
break;
|
|
3026
|
+
case "SWAPPED_CLOSE":
|
|
3027
|
+
onClose();
|
|
3028
|
+
break;
|
|
3029
|
+
case "SWAPPED_NEW_WITHDRAWAL":
|
|
3030
|
+
logger.info("connect-rn:swapped:new_withdrawal");
|
|
3031
|
+
onNewWithdrawal?.();
|
|
3032
|
+
break;
|
|
3033
|
+
case "SWAPPED_WITHDRAWAL_SUCCESSFUL":
|
|
3034
|
+
logger.info("connect-rn:swapped:withdrawal_successful");
|
|
3035
|
+
onWithdrawalSuccess?.(msg.data);
|
|
3036
|
+
break;
|
|
3037
|
+
case "SWAPPED_ORDER_DATA":
|
|
3038
|
+
if (!isValidOrderData(msg.data)) {
|
|
3039
|
+
logger.warn("connect-rn:swapped:order_data:invalid", {
|
|
3040
|
+
data: msg.data ?? {}
|
|
3041
|
+
});
|
|
3042
|
+
break;
|
|
3043
|
+
}
|
|
3044
|
+
logger.info("connect-rn:swapped:order_data", {
|
|
3045
|
+
order_id: msg.data.order_id
|
|
3046
|
+
});
|
|
3047
|
+
onOrderData?.(msg.data);
|
|
3048
|
+
break;
|
|
3049
|
+
default:
|
|
3050
|
+
break;
|
|
3051
|
+
}
|
|
3052
|
+
},
|
|
3053
|
+
[onBack, onClose, onNewWithdrawal, onWithdrawalSuccess, onOrderData]
|
|
2841
3054
|
);
|
|
3055
|
+
return /* @__PURE__ */ jsx20(SwappedScreenShell, { url, onMessage: handleMessage });
|
|
2842
3056
|
}
|
|
2843
|
-
var SHEET_HEIGHT = 550;
|
|
2844
|
-
var sheet3 = { height: SHEET_HEIGHT, overflow: "hidden" };
|
|
2845
|
-
var fill = { flex: 1 };
|
|
2846
3057
|
|
|
2847
3058
|
// src/transfer/availableChains.ts
|
|
2848
3059
|
import {
|
|
@@ -2954,6 +3165,15 @@ function toFopRows(fops, exchangeRates) {
|
|
|
2954
3165
|
};
|
|
2955
3166
|
});
|
|
2956
3167
|
}
|
|
3168
|
+
function toWithdrawFopRows(fops) {
|
|
3169
|
+
return fops.map((fop) => ({
|
|
3170
|
+
id: `${fop.fopType}:${fop.name}`,
|
|
3171
|
+
name: fop.name,
|
|
3172
|
+
iconUri: fop.iconImageUrl,
|
|
3173
|
+
subtitle: fop.fopType === FormOfPaymentType.BANK_TRANSFER ? BANK_TRANSFER_TIME : "Instant",
|
|
3174
|
+
disabled: !fop.embeddedFlowUrl
|
|
3175
|
+
}));
|
|
3176
|
+
}
|
|
2957
3177
|
|
|
2958
3178
|
// src/transfer/formatDepositAddress.ts
|
|
2959
3179
|
function formatDepositAddress(address, leading = 6, trailing = 6) {
|
|
@@ -2988,7 +3208,7 @@ import { useMemo as useMemo6 } from "react";
|
|
|
2988
3208
|
|
|
2989
3209
|
// src/identity/IdentityContext.tsx
|
|
2990
3210
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
2991
|
-
import { jsx as
|
|
3211
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2992
3212
|
function generateSyntheticUserId(apiKey, externalUserId) {
|
|
2993
3213
|
return `${apiKey}|${externalUserId}`;
|
|
2994
3214
|
}
|
|
@@ -3007,7 +3227,7 @@ function FunkitIdentityProvider({
|
|
|
3007
3227
|
identity,
|
|
3008
3228
|
children
|
|
3009
3229
|
}) {
|
|
3010
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsx21(FunkitIdentityContext.Provider, { value: identity, children });
|
|
3011
3231
|
}
|
|
3012
3232
|
function useFunkitIdentity() {
|
|
3013
3233
|
const identity = useContext2(FunkitIdentityContext);
|
|
@@ -3183,15 +3403,358 @@ function useFops({
|
|
|
3183
3403
|
};
|
|
3184
3404
|
}
|
|
3185
3405
|
|
|
3406
|
+
// src/transfer/hooks/useWithdrawalFops.ts
|
|
3407
|
+
import {
|
|
3408
|
+
RailConfigType,
|
|
3409
|
+
getFops as getFops2
|
|
3410
|
+
} from "@funkit/api-base";
|
|
3411
|
+
import {
|
|
3412
|
+
DEFAULT_FIAT_CURRENCY as DEFAULT_FIAT_CURRENCY2,
|
|
3413
|
+
FOPS_STALE_TIME as FOPS_STALE_TIME2,
|
|
3414
|
+
SWAPPED_MIN_SELL_EUR,
|
|
3415
|
+
findSwappedSourceOverride,
|
|
3416
|
+
getExchangeRate,
|
|
3417
|
+
resolveSwappedWithdrawalLegs,
|
|
3418
|
+
sortFops as sortFops2,
|
|
3419
|
+
useDynamicConfig as useDynamicConfig4,
|
|
3420
|
+
useSwappedDefaultCurrencyQuery as useSwappedDefaultCurrencyQuery2
|
|
3421
|
+
} from "@funkit/connect-core";
|
|
3422
|
+
import { useTheme as useTheme4 } from "@shopify/restyle";
|
|
3423
|
+
import { useStatsigClient } from "@statsig/react-bindings";
|
|
3424
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3425
|
+
import { useMemo as useMemo7 } from "react";
|
|
3426
|
+
|
|
3427
|
+
// src/transfer/hooks/useFiatExchangeRates.ts
|
|
3428
|
+
import { getFiatExchangeRates } from "@funkit/api-base";
|
|
3429
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
3430
|
+
function useFiatExchangeRates(enabled = true) {
|
|
3431
|
+
const { data, isLoading, error } = useQuery4({
|
|
3432
|
+
queryKey: ["fiatExchangeRates"],
|
|
3433
|
+
queryFn: () => getFiatExchangeRates({ logger }),
|
|
3434
|
+
refetchOnMount: false,
|
|
3435
|
+
refetchOnReconnect: false,
|
|
3436
|
+
refetchOnWindowFocus: false,
|
|
3437
|
+
gcTime: 1e3 * 60 * 60,
|
|
3438
|
+
// 1 hour
|
|
3439
|
+
enabled
|
|
3440
|
+
});
|
|
3441
|
+
return { data, isLoading, error };
|
|
3442
|
+
}
|
|
3443
|
+
|
|
3444
|
+
// src/transfer/hooks/useWithdrawalFops.ts
|
|
3445
|
+
var WITHDRAW_FOPS_QUERY_KEY = "withdrawFops";
|
|
3446
|
+
function useWithdrawalRoute(config) {
|
|
3447
|
+
const sourceOverrides = useDynamicConfig4("swappedwithdrawalsourceoverrides");
|
|
3448
|
+
return useMemo7(
|
|
3449
|
+
() => resolveSwappedWithdrawalLegs({
|
|
3450
|
+
source: config.sourceToken,
|
|
3451
|
+
target: config.swappedAcceptedToken,
|
|
3452
|
+
override: findSwappedSourceOverride(sourceOverrides, {
|
|
3453
|
+
chainId: config.sourceToken.chainId,
|
|
3454
|
+
tokenAddress: config.sourceToken.address
|
|
3455
|
+
})
|
|
3456
|
+
}),
|
|
3457
|
+
[config.sourceToken, config.swappedAcceptedToken, sourceOverrides]
|
|
3458
|
+
);
|
|
3459
|
+
}
|
|
3460
|
+
function useWithdrawalSellCap(config, walletAddress) {
|
|
3461
|
+
const { sourceUsdBalance } = config;
|
|
3462
|
+
const isBalanceCallback = typeof sourceUsdBalance === "function";
|
|
3463
|
+
const hasBalanceInfo = sourceUsdBalance != null;
|
|
3464
|
+
const balanceQuery = useQuery5({
|
|
3465
|
+
queryKey: [
|
|
3466
|
+
"withdrawSourceUsdBalance",
|
|
3467
|
+
walletAddress,
|
|
3468
|
+
config.sourceToken.chainId,
|
|
3469
|
+
config.sourceToken.address
|
|
3470
|
+
],
|
|
3471
|
+
queryFn: async () => {
|
|
3472
|
+
const value = isBalanceCallback ? await sourceUsdBalance() : 0;
|
|
3473
|
+
return Number.isFinite(value) && value > 0 ? value : 0;
|
|
3474
|
+
},
|
|
3475
|
+
enabled: isBalanceCallback && !!walletAddress && walletAddress !== "0x",
|
|
3476
|
+
staleTime: 3e4,
|
|
3477
|
+
refetchOnWindowFocus: false
|
|
3478
|
+
});
|
|
3479
|
+
const isLoadingBalance = isBalanceCallback && balanceQuery.isLoading;
|
|
3480
|
+
const rawUsdBalance = isBalanceCallback ? balanceQuery.data ?? 0 : sourceUsdBalance ?? 0;
|
|
3481
|
+
const usdBalance = Number.isFinite(rawUsdBalance) && rawUsdBalance > 0 ? rawUsdBalance : 0;
|
|
3482
|
+
const { data: exchangeRates, isLoading: isLoadingRates } = useFiatExchangeRates(hasBalanceInfo);
|
|
3483
|
+
const eurRate = getExchangeRate("EUR", exchangeRates, 0);
|
|
3484
|
+
const eurMax = eurRate && usdBalance > 0 ? Math.floor(usdBalance * eurRate) : void 0;
|
|
3485
|
+
const cashMinUsd = eurRate ? SWAPPED_MIN_SELL_EUR / eurRate : void 0;
|
|
3486
|
+
const isBelowMinimumBalance = hasBalanceInfo && !isLoadingBalance && cashMinUsd != null && usdBalance < cashMinUsd;
|
|
3487
|
+
const isAwaitingCap = hasBalanceInfo && (isLoadingBalance || usdBalance > 0 && isLoadingRates);
|
|
3488
|
+
return { usdBalance, eurMax, isBelowMinimumBalance, isAwaitingCap };
|
|
3489
|
+
}
|
|
3490
|
+
async function fetchWithdrawalFops({
|
|
3491
|
+
apiKey,
|
|
3492
|
+
userId,
|
|
3493
|
+
walletAddress,
|
|
3494
|
+
countryCode,
|
|
3495
|
+
swappedCurrencyCode,
|
|
3496
|
+
fopPriority,
|
|
3497
|
+
themeConfig,
|
|
3498
|
+
route,
|
|
3499
|
+
eurMax,
|
|
3500
|
+
usdBalance,
|
|
3501
|
+
sourceToken
|
|
3502
|
+
}) {
|
|
3503
|
+
const acceptedToken = {
|
|
3504
|
+
chainId: route.targetChainId,
|
|
3505
|
+
address: route.targetTokenAddress
|
|
3506
|
+
};
|
|
3507
|
+
logger.info("connect-rn:withdrawFops:source_override", {
|
|
3508
|
+
overrideApplied: route.overrideApplied,
|
|
3509
|
+
sourceChainId: sourceToken.chainId,
|
|
3510
|
+
sourceTokenAddress: sourceToken.address,
|
|
3511
|
+
acceptedChainId: route.targetChainId,
|
|
3512
|
+
acceptedTokenAddress: route.targetTokenAddress,
|
|
3513
|
+
acceptedTokenSymbol: route.targetTokenSymbol
|
|
3514
|
+
});
|
|
3515
|
+
const capForwarded = eurMax != null && eurMax > SWAPPED_MIN_SELL_EUR;
|
|
3516
|
+
logger.info("connect-rn:withdrawFops:sellLimits", {
|
|
3517
|
+
defaultMinAmount: SWAPPED_MIN_SELL_EUR,
|
|
3518
|
+
usdBalance,
|
|
3519
|
+
eurMax,
|
|
3520
|
+
capForwarded
|
|
3521
|
+
});
|
|
3522
|
+
const response = await getFops2({
|
|
3523
|
+
apiKey,
|
|
3524
|
+
logger,
|
|
3525
|
+
params: {
|
|
3526
|
+
recipientAddress: walletAddress,
|
|
3527
|
+
userId,
|
|
3528
|
+
destinationToken: acceptedToken,
|
|
3529
|
+
fiatCurrencyCode: swappedCurrencyCode,
|
|
3530
|
+
countryCode,
|
|
3531
|
+
railConfigs: [
|
|
3532
|
+
{
|
|
3533
|
+
type: RailConfigType.CRYPTO_TO_FIAT,
|
|
3534
|
+
userId,
|
|
3535
|
+
countryCode,
|
|
3536
|
+
fiatCurrencyCode: swappedCurrencyCode,
|
|
3537
|
+
sourceToken: acceptedToken,
|
|
3538
|
+
thirdPartyPaymentConfigs: { swapped: { themeConfig } },
|
|
3539
|
+
checkoutLimitsCriteria: {
|
|
3540
|
+
defaultMinAmount: SWAPPED_MIN_SELL_EUR,
|
|
3541
|
+
// Balance-derived cap; only meaningful above the minimum.
|
|
3542
|
+
...capForwarded ? { defaultMaxAmount: eurMax } : {}
|
|
3543
|
+
}
|
|
3544
|
+
}
|
|
3545
|
+
]
|
|
3546
|
+
}
|
|
3547
|
+
});
|
|
3548
|
+
const fops = sortFops2(response.genericFormsOfPayments, fopPriority);
|
|
3549
|
+
if (fops.length === 0) {
|
|
3550
|
+
logger.info("connect-rn:withdrawFops:empty", {
|
|
3551
|
+
countryCode,
|
|
3552
|
+
targetChainId: route.targetChainId,
|
|
3553
|
+
targetTokenAddress: route.targetTokenAddress
|
|
3554
|
+
});
|
|
3555
|
+
}
|
|
3556
|
+
return fops;
|
|
3557
|
+
}
|
|
3558
|
+
function useWithdrawalFops({
|
|
3559
|
+
config,
|
|
3560
|
+
enabled = true
|
|
3561
|
+
}) {
|
|
3562
|
+
const { apiKey, userId } = useFunkitIdentity();
|
|
3563
|
+
const { isLoading: isStatsigLoading } = useStatsigClient();
|
|
3564
|
+
const isWithdrawalEnabled = !!useDynamicConfig4("enableswappedwithdrawal");
|
|
3565
|
+
const fopPriority = useDynamicConfig4("foppriority");
|
|
3566
|
+
const walletAddress = config.withdrawalWallet.address();
|
|
3567
|
+
const route = useWithdrawalRoute(config);
|
|
3568
|
+
const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo();
|
|
3569
|
+
const countryCode = userIpInfo?.alpha2;
|
|
3570
|
+
const {
|
|
3571
|
+
data: swappedCurrencyCode = DEFAULT_FIAT_CURRENCY2,
|
|
3572
|
+
isLoading: isSwappedCurrencyCodeLoading
|
|
3573
|
+
} = useSwappedDefaultCurrencyQuery2({
|
|
3574
|
+
apiKey,
|
|
3575
|
+
countryCode: userIpInfo?.alpha2,
|
|
3576
|
+
logger
|
|
3577
|
+
});
|
|
3578
|
+
const theme = useTheme4();
|
|
3579
|
+
const themeConfig = useMemo7(
|
|
3580
|
+
() => buildSwappedThemeQueryParamsRN(theme),
|
|
3581
|
+
[theme]
|
|
3582
|
+
);
|
|
3583
|
+
const { usdBalance, eurMax, isBelowMinimumBalance, isAwaitingCap } = useWithdrawalSellCap(config, walletAddress);
|
|
3584
|
+
const isEnabled = enabled && isWithdrawalEnabled && !!apiKey && !!userId && !!walletAddress && walletAddress !== "0x" && !!countryCode && !isSwappedCurrencyCodeLoading && !isAwaitingCap;
|
|
3585
|
+
const query = useQuery5({
|
|
3586
|
+
queryKey: [
|
|
3587
|
+
WITHDRAW_FOPS_QUERY_KEY,
|
|
3588
|
+
userId,
|
|
3589
|
+
walletAddress,
|
|
3590
|
+
apiKey,
|
|
3591
|
+
countryCode,
|
|
3592
|
+
swappedCurrencyCode,
|
|
3593
|
+
fopPriority,
|
|
3594
|
+
themeConfig,
|
|
3595
|
+
route.targetChainId,
|
|
3596
|
+
route.targetTokenAddress,
|
|
3597
|
+
eurMax
|
|
3598
|
+
],
|
|
3599
|
+
// `countryCode` is guaranteed by `isEnabled` (query stays disabled until it
|
|
3600
|
+
// resolves); the guard just narrows the type — the empty fallback is unreachable.
|
|
3601
|
+
queryFn: () => countryCode ? fetchWithdrawalFops({
|
|
3602
|
+
apiKey,
|
|
3603
|
+
userId,
|
|
3604
|
+
walletAddress,
|
|
3605
|
+
countryCode,
|
|
3606
|
+
swappedCurrencyCode,
|
|
3607
|
+
fopPriority,
|
|
3608
|
+
themeConfig,
|
|
3609
|
+
route,
|
|
3610
|
+
eurMax,
|
|
3611
|
+
usdBalance,
|
|
3612
|
+
sourceToken: config.sourceToken
|
|
3613
|
+
}) : Promise.resolve([]),
|
|
3614
|
+
enabled: isEnabled,
|
|
3615
|
+
staleTime: FOPS_STALE_TIME2,
|
|
3616
|
+
refetchOnWindowFocus: false
|
|
3617
|
+
});
|
|
3618
|
+
const isLoading = isStatsigLoading || isLoadingGeoCheck || isSwappedCurrencyCodeLoading || isAwaitingCap || isEnabled && query.isLoading;
|
|
3619
|
+
const noPaymentMethodsAvailable = !isLoading && (!isWithdrawalEnabled || query.isSuccess && (query.data?.length ?? 0) === 0);
|
|
3620
|
+
return {
|
|
3621
|
+
fops: query.data ?? [],
|
|
3622
|
+
isLoading,
|
|
3623
|
+
noPaymentMethodsAvailable,
|
|
3624
|
+
isBelowMinimumBalance,
|
|
3625
|
+
// Tie the query error to isEnabled ("gate off ⇒ no error"), plus web's
|
|
3626
|
+
// no-country case: geo settled without a country is unrecoverable here.
|
|
3627
|
+
isError: isEnabled && query.isError || !isLoadingGeoCheck && !countryCode,
|
|
3628
|
+
// Respect the enabled gate — refetch() would otherwise force a fetch even
|
|
3629
|
+
// when disabled (e.g. no resolved country).
|
|
3630
|
+
refetch: () => {
|
|
3631
|
+
if (isEnabled) void query.refetch();
|
|
3632
|
+
},
|
|
3633
|
+
isWithdrawalEnabled,
|
|
3634
|
+
route
|
|
3635
|
+
};
|
|
3636
|
+
}
|
|
3637
|
+
|
|
3638
|
+
// src/withdrawal/useWithdrawalExecution.ts
|
|
3639
|
+
import {
|
|
3640
|
+
ensureRelayClientInitialized,
|
|
3641
|
+
isUserRejectedError,
|
|
3642
|
+
processFiatWithdrawalOrder,
|
|
3643
|
+
toFiatWithdrawalOrder
|
|
3644
|
+
} from "@funkit/connect-core";
|
|
3645
|
+
import { useCallback as useCallback6, useRef as useRef5 } from "react";
|
|
3646
|
+
|
|
3647
|
+
// src/withdrawal/publicClient.ts
|
|
3648
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO } from "@funkit/chains";
|
|
3649
|
+
import { createPublicClient, fallback, http } from "viem";
|
|
3650
|
+
var clients = /* @__PURE__ */ new Map();
|
|
3651
|
+
function getPublicClientFor(chainId) {
|
|
3652
|
+
const cached = clients.get(chainId);
|
|
3653
|
+
if (cached) return cached;
|
|
3654
|
+
const info = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[chainId];
|
|
3655
|
+
if (!info) return void 0;
|
|
3656
|
+
const client = createPublicClient({
|
|
3657
|
+
chain: info.chainInfo,
|
|
3658
|
+
transport: info.fallbackRpcUrls.length ? fallback(info.fallbackRpcUrls.map((url) => http(url))) : http()
|
|
3659
|
+
});
|
|
3660
|
+
clients.set(chainId, client);
|
|
3661
|
+
return client;
|
|
3662
|
+
}
|
|
3663
|
+
|
|
3664
|
+
// src/withdrawal/useWithdrawalExecution.ts
|
|
3665
|
+
var submittedOrderIds = /* @__PURE__ */ new Set();
|
|
3666
|
+
function useWithdrawalExecution({
|
|
3667
|
+
config,
|
|
3668
|
+
route,
|
|
3669
|
+
callbacks,
|
|
3670
|
+
onError
|
|
3671
|
+
}) {
|
|
3672
|
+
const { apiKey, userId } = useFunkitIdentity();
|
|
3673
|
+
const isProcessingRef = useRef5(false);
|
|
3674
|
+
const executeOrder = useCallback6(
|
|
3675
|
+
async (data) => {
|
|
3676
|
+
const order = toFiatWithdrawalOrder(data);
|
|
3677
|
+
if (isProcessingRef.current) {
|
|
3678
|
+
logger.warn("connect-rn:withdrawal:already_processing", {
|
|
3679
|
+
order_id: order.orderId
|
|
3680
|
+
});
|
|
3681
|
+
return;
|
|
3682
|
+
}
|
|
3683
|
+
if (submittedOrderIds.has(order.orderId)) {
|
|
3684
|
+
logger.warn("connect-rn:withdrawal:duplicate", {
|
|
3685
|
+
order_id: order.orderId
|
|
3686
|
+
});
|
|
3687
|
+
return;
|
|
3688
|
+
}
|
|
3689
|
+
isProcessingRef.current = true;
|
|
3690
|
+
logger.info("connect-rn:withdrawal:route_decision", {
|
|
3691
|
+
order_id: order.orderId,
|
|
3692
|
+
overrideApplied: route.overrideApplied,
|
|
3693
|
+
requestedTargetChainId: config.swappedAcceptedToken?.chainId,
|
|
3694
|
+
requestedTargetTokenAddress: config.swappedAcceptedToken?.address,
|
|
3695
|
+
enforcedTargetChainId: route.targetChainId,
|
|
3696
|
+
enforcedTargetTokenAddress: route.targetTokenAddress,
|
|
3697
|
+
enforcedTargetTokenSymbol: route.targetTokenSymbol,
|
|
3698
|
+
providerCrypto: order.providerCrypto,
|
|
3699
|
+
providerNetwork: order.providerNetwork
|
|
3700
|
+
});
|
|
3701
|
+
let txHash;
|
|
3702
|
+
try {
|
|
3703
|
+
ensureRelayClientInitialized(logger, "funkit-connect-rn");
|
|
3704
|
+
({ txHash } = await processFiatWithdrawalOrder({
|
|
3705
|
+
order,
|
|
3706
|
+
wallet: config.withdrawalWallet,
|
|
3707
|
+
legs: route,
|
|
3708
|
+
apiKey,
|
|
3709
|
+
userId,
|
|
3710
|
+
logger,
|
|
3711
|
+
// Read the target token's decimals on-chain (via publicClient) rather
|
|
3712
|
+
// than trusting host-config `decimals` — a stale/wrong value would
|
|
3713
|
+
// mis-scale the amount transferred to Swapped's deposit address.
|
|
3714
|
+
publicClient: getPublicClientFor(Number(route.targetChainId))
|
|
3715
|
+
}));
|
|
3716
|
+
} catch (error) {
|
|
3717
|
+
if (isUserRejectedError(error)) {
|
|
3718
|
+
logger.warn("connect-rn:withdrawal:user_rejected", {
|
|
3719
|
+
order_id: order.orderId
|
|
3720
|
+
});
|
|
3721
|
+
return;
|
|
3722
|
+
}
|
|
3723
|
+
logger.error("connect-rn:withdrawal:execution_failed", error, {
|
|
3724
|
+
order_id: order.orderId
|
|
3725
|
+
});
|
|
3726
|
+
callbacks.onWithdrawalError?.({
|
|
3727
|
+
message: error instanceof Error ? error.message : String(error)
|
|
3728
|
+
});
|
|
3729
|
+
onError();
|
|
3730
|
+
return;
|
|
3731
|
+
} finally {
|
|
3732
|
+
isProcessingRef.current = false;
|
|
3733
|
+
}
|
|
3734
|
+
submittedOrderIds.add(order.orderId);
|
|
3735
|
+
try {
|
|
3736
|
+
callbacks.onWithdrawalSubmitted?.(order.orderId, txHash);
|
|
3737
|
+
} catch (error) {
|
|
3738
|
+
logger.warn("connect-rn:withdrawal:submitted_callback_threw", {
|
|
3739
|
+
order_id: order.orderId,
|
|
3740
|
+
error: error instanceof Error ? error.message : String(error)
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
},
|
|
3744
|
+
[apiKey, userId, config, route, callbacks, onError]
|
|
3745
|
+
);
|
|
3746
|
+
return { executeOrder };
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3186
3749
|
// src/transfer/hooks/useSupportedTokens.ts
|
|
3187
3750
|
import { getSupportedAssets } from "@funkit/api-base";
|
|
3188
3751
|
import {
|
|
3189
3752
|
isTransferChainEnabled,
|
|
3190
3753
|
resolveTokenTransferConfig,
|
|
3191
|
-
useDynamicConfig as
|
|
3754
|
+
useDynamicConfig as useDynamicConfig5
|
|
3192
3755
|
} from "@funkit/connect-core";
|
|
3193
|
-
import { useQuery as
|
|
3194
|
-
import { useMemo as
|
|
3756
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
3757
|
+
import { useMemo as useMemo8 } from "react";
|
|
3195
3758
|
|
|
3196
3759
|
// src/transfer/supportedTokens.ts
|
|
3197
3760
|
function buildSupportedTokenList(resolved) {
|
|
@@ -3227,18 +3790,18 @@ function useSupportedTokens({
|
|
|
3227
3790
|
transferInit
|
|
3228
3791
|
} = {}) {
|
|
3229
3792
|
const { apiKey } = useFunkitIdentity();
|
|
3230
|
-
const tokenTransferConfig =
|
|
3231
|
-
const disabledChainAssets =
|
|
3793
|
+
const tokenTransferConfig = useDynamicConfig5("tokentransferconfig");
|
|
3794
|
+
const disabledChainAssets = useDynamicConfig5(
|
|
3232
3795
|
"disabletokentransferchainsandassets"
|
|
3233
3796
|
);
|
|
3234
|
-
const { data, isLoading } =
|
|
3797
|
+
const { data, isLoading } = useQuery6({
|
|
3235
3798
|
queryKey: ["getSupportedAssets", apiKey],
|
|
3236
3799
|
queryFn: ({ queryKey: [, key] }) => getSupportedAssets({ apiKey: key, logger }),
|
|
3237
3800
|
enabled: enabled && !!apiKey,
|
|
3238
3801
|
staleTime: 5 * 6e4,
|
|
3239
3802
|
refetchOnWindowFocus: false
|
|
3240
3803
|
});
|
|
3241
|
-
const { tokens, chainFilters } =
|
|
3804
|
+
const { tokens, chainFilters } = useMemo8(() => {
|
|
3242
3805
|
if (!data) {
|
|
3243
3806
|
return { tokens: [], chainFilters: [{ id: "all", label: "All" }] };
|
|
3244
3807
|
}
|
|
@@ -3267,7 +3830,7 @@ import {
|
|
|
3267
3830
|
getDepositAddressForChain as getDepositAddressForChain2,
|
|
3268
3831
|
getMinTransferValueForChain as getMinTransferValueForChain2,
|
|
3269
3832
|
getTransferTokenQrCodeUri,
|
|
3270
|
-
useDynamicConfig as
|
|
3833
|
+
useDynamicConfig as useDynamicConfig6
|
|
3271
3834
|
} from "@funkit/connect-core";
|
|
3272
3835
|
var DEFAULT_MAX_SLIPPAGE_PERCENT = 0.25;
|
|
3273
3836
|
function resolveBlockchain(chainId) {
|
|
@@ -3293,7 +3856,7 @@ function useTokenTransfer({
|
|
|
3293
3856
|
dynamicRoutingId,
|
|
3294
3857
|
enabled
|
|
3295
3858
|
});
|
|
3296
|
-
const minTransferLimits =
|
|
3859
|
+
const minTransferLimits = useDynamicConfig6("mintokentransfervalue");
|
|
3297
3860
|
const minTransferUsd = selectedChainId !== void 0 ? Math.ceil(
|
|
3298
3861
|
getMinTransferValueForChain2(selectedChainId, minTransferLimits)
|
|
3299
3862
|
) : 0;
|
|
@@ -3314,9 +3877,9 @@ function useTokenTransfer({
|
|
|
3314
3877
|
|
|
3315
3878
|
// src/transfer/QrCode.tsx
|
|
3316
3879
|
import QRCode from "react-native-qrcode-svg";
|
|
3317
|
-
import { jsx as
|
|
3880
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3318
3881
|
function QrCode({ value, size = 220, ecl = "H" }) {
|
|
3319
|
-
return /* @__PURE__ */
|
|
3882
|
+
return /* @__PURE__ */ jsx22(
|
|
3320
3883
|
QRCode,
|
|
3321
3884
|
{
|
|
3322
3885
|
value,
|
|
@@ -3338,9 +3901,9 @@ function getDefaultDynamicTargetAsset(candidates, dynamicRoutingId) {
|
|
|
3338
3901
|
|
|
3339
3902
|
// src/flow/FlowSheet.tsx
|
|
3340
3903
|
import {
|
|
3341
|
-
useCallback as
|
|
3904
|
+
useCallback as useCallback7,
|
|
3342
3905
|
useEffect as useEffect10,
|
|
3343
|
-
useRef as
|
|
3906
|
+
useRef as useRef6
|
|
3344
3907
|
} from "react";
|
|
3345
3908
|
import { View as View2 } from "react-native";
|
|
3346
3909
|
import {
|
|
@@ -3378,22 +3941,22 @@ function useKeyboardHeight(enabled) {
|
|
|
3378
3941
|
}
|
|
3379
3942
|
|
|
3380
3943
|
// src/flow/FlowSheet.tsx
|
|
3381
|
-
import { jsx as
|
|
3944
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3382
3945
|
function FlowSheet({
|
|
3383
3946
|
isOpen,
|
|
3384
3947
|
session,
|
|
3385
3948
|
onClose,
|
|
3386
|
-
content:
|
|
3949
|
+
content: content3,
|
|
3387
3950
|
children,
|
|
3388
3951
|
keyboardAvoidEnabled = false
|
|
3389
3952
|
}) {
|
|
3390
|
-
const ref =
|
|
3391
|
-
const setRef =
|
|
3953
|
+
const ref = useRef6(null);
|
|
3954
|
+
const setRef = useCallback7((instance) => {
|
|
3392
3955
|
ref.current = instance;
|
|
3393
3956
|
}, []);
|
|
3394
3957
|
const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled);
|
|
3395
|
-
const hasPresented =
|
|
3396
|
-
const sheetSelfDismissed =
|
|
3958
|
+
const hasPresented = useRef6(false);
|
|
3959
|
+
const sheetSelfDismissed = useRef6(false);
|
|
3397
3960
|
useEffect10(() => {
|
|
3398
3961
|
if (isOpen) {
|
|
3399
3962
|
sheetSelfDismissed.current = false;
|
|
@@ -3409,7 +3972,7 @@ function FlowSheet({
|
|
|
3409
3972
|
}
|
|
3410
3973
|
ref.current?.dismiss();
|
|
3411
3974
|
}, [isOpen, session]);
|
|
3412
|
-
const handleDismiss =
|
|
3975
|
+
const handleDismiss = useCallback7(() => {
|
|
3413
3976
|
sheetSelfDismissed.current = true;
|
|
3414
3977
|
onClose();
|
|
3415
3978
|
}, [onClose]);
|
|
@@ -3417,8 +3980,8 @@ function FlowSheet({
|
|
|
3417
3980
|
duration: 300,
|
|
3418
3981
|
easing: Easing4.bezier(0.22, 1, 0.36, 1)
|
|
3419
3982
|
});
|
|
3420
|
-
const renderBackdrop =
|
|
3421
|
-
(props) => /* @__PURE__ */
|
|
3983
|
+
const renderBackdrop = useCallback7(
|
|
3984
|
+
(props) => /* @__PURE__ */ jsx23(
|
|
3422
3985
|
BottomSheetBackdrop,
|
|
3423
3986
|
{
|
|
3424
3987
|
...props,
|
|
@@ -3431,7 +3994,7 @@ function FlowSheet({
|
|
|
3431
3994
|
);
|
|
3432
3995
|
return /* @__PURE__ */ jsxs10(BottomSheetModalProvider, { children: [
|
|
3433
3996
|
children,
|
|
3434
|
-
/* @__PURE__ */
|
|
3997
|
+
/* @__PURE__ */ jsx23(
|
|
3435
3998
|
BottomSheetModal,
|
|
3436
3999
|
{
|
|
3437
4000
|
ref: setRef,
|
|
@@ -3444,8 +4007,8 @@ function FlowSheet({
|
|
|
3444
4007
|
handleComponent: null,
|
|
3445
4008
|
backgroundComponent: FlowSheetBackground,
|
|
3446
4009
|
children: /* @__PURE__ */ jsxs10(BottomSheetView, { children: [
|
|
3447
|
-
|
|
3448
|
-
keyboardHeight > 0 ? /* @__PURE__ */
|
|
4010
|
+
content3,
|
|
4011
|
+
keyboardHeight > 0 ? /* @__PURE__ */ jsx23(View2, { style: { height: keyboardHeight } }) : null
|
|
3449
4012
|
] })
|
|
3450
4013
|
}
|
|
3451
4014
|
)
|
|
@@ -3465,7 +4028,7 @@ function FlowSheetBackground({
|
|
|
3465
4028
|
...bottomExtension,
|
|
3466
4029
|
backgroundColor: theme.colors.bgModal
|
|
3467
4030
|
};
|
|
3468
|
-
return /* @__PURE__ */
|
|
4031
|
+
return /* @__PURE__ */ jsx23(View2, { pointerEvents, style: [style, surface], children: /* @__PURE__ */ jsx23(View2, { style: extension }) });
|
|
3469
4032
|
}
|
|
3470
4033
|
var bottomExtension = {
|
|
3471
4034
|
position: "absolute",
|
|
@@ -3476,12 +4039,11 @@ var bottomExtension = {
|
|
|
3476
4039
|
};
|
|
3477
4040
|
|
|
3478
4041
|
// src/flow/FunkitFlowProvider.tsx
|
|
3479
|
-
import { jsx as
|
|
4042
|
+
import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3480
4043
|
var CLOSED = {
|
|
3481
4044
|
isOpen: false,
|
|
3482
4045
|
stack: [],
|
|
3483
|
-
|
|
3484
|
-
callbacks: {},
|
|
4046
|
+
flow: null,
|
|
3485
4047
|
session: 0
|
|
3486
4048
|
};
|
|
3487
4049
|
var FunkitFlowContext = createContext3(null);
|
|
@@ -3491,64 +4053,78 @@ function FunkitFlowProvider({
|
|
|
3491
4053
|
}) {
|
|
3492
4054
|
const insets = useSafeAreaInsets();
|
|
3493
4055
|
const [state, setState] = useState9(CLOSED);
|
|
3494
|
-
const beginDeposit =
|
|
4056
|
+
const beginDeposit = useCallback8(
|
|
3495
4057
|
(config, callbacks = {}) => {
|
|
3496
4058
|
callbacks.onOpen?.();
|
|
3497
4059
|
setState((prev) => ({
|
|
3498
4060
|
isOpen: true,
|
|
3499
4061
|
stack: ["addMoney"],
|
|
3500
|
-
config,
|
|
3501
|
-
callbacks,
|
|
4062
|
+
flow: { mode: "deposit", config, callbacks },
|
|
3502
4063
|
session: prev.session + 1
|
|
3503
4064
|
}));
|
|
3504
4065
|
},
|
|
3505
4066
|
[]
|
|
3506
4067
|
);
|
|
3507
|
-
const
|
|
4068
|
+
const beginWithdrawal = useCallback8(
|
|
4069
|
+
(config, callbacks = {}) => {
|
|
4070
|
+
callbacks.onOpen?.();
|
|
4071
|
+
setState((prev) => ({
|
|
4072
|
+
isOpen: true,
|
|
4073
|
+
stack: ["withdrawMethod"],
|
|
4074
|
+
flow: { mode: "withdrawal", config, callbacks },
|
|
4075
|
+
session: prev.session + 1
|
|
4076
|
+
}));
|
|
4077
|
+
},
|
|
4078
|
+
[]
|
|
4079
|
+
);
|
|
4080
|
+
const clearToast = useCallback8(() => {
|
|
3508
4081
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3509
4082
|
if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
|
|
3510
4083
|
setCopiedToastShown(false);
|
|
3511
4084
|
setToastMounted(false);
|
|
3512
4085
|
}, []);
|
|
3513
|
-
const closeFlow =
|
|
4086
|
+
const closeFlow = useCallback8(() => {
|
|
3514
4087
|
setState((prev) => {
|
|
3515
4088
|
if (!prev.isOpen) return prev;
|
|
3516
|
-
prev.callbacks.onClose?.();
|
|
4089
|
+
prev.flow?.callbacks.onClose?.();
|
|
3517
4090
|
return CLOSED;
|
|
3518
4091
|
});
|
|
3519
4092
|
clearToast();
|
|
3520
4093
|
}, [clearToast]);
|
|
3521
|
-
const navigate =
|
|
4094
|
+
const navigate = useCallback8((screen) => {
|
|
3522
4095
|
setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }));
|
|
3523
4096
|
}, []);
|
|
3524
|
-
const
|
|
4097
|
+
const reset = useCallback8((screen) => {
|
|
4098
|
+
setState((prev) => prev.isOpen ? { ...prev, stack: [screen] } : prev);
|
|
4099
|
+
}, []);
|
|
4100
|
+
const back = useCallback8(() => {
|
|
3525
4101
|
setState((prev) => {
|
|
3526
4102
|
if (!prev.isOpen) return prev;
|
|
3527
4103
|
if (prev.stack.length <= 1) {
|
|
3528
|
-
prev.callbacks.onClose?.();
|
|
4104
|
+
prev.flow?.callbacks.onClose?.();
|
|
3529
4105
|
return CLOSED;
|
|
3530
4106
|
}
|
|
3531
4107
|
return { ...prev, stack: prev.stack.slice(0, -1) };
|
|
3532
4108
|
});
|
|
3533
4109
|
}, []);
|
|
3534
|
-
const value =
|
|
3535
|
-
() => ({ beginDeposit, closeFlow }),
|
|
3536
|
-
[beginDeposit, closeFlow]
|
|
4110
|
+
const value = useMemo9(
|
|
4111
|
+
() => ({ beginDeposit, beginWithdrawal, closeFlow }),
|
|
4112
|
+
[beginDeposit, beginWithdrawal, closeFlow]
|
|
3537
4113
|
);
|
|
3538
4114
|
const current = state.stack[state.stack.length - 1];
|
|
3539
|
-
const nav =
|
|
3540
|
-
() => ({ navigate, back, closeFlow }),
|
|
3541
|
-
[navigate, back, closeFlow]
|
|
4115
|
+
const nav = useMemo9(
|
|
4116
|
+
() => ({ navigate, back, reset, closeFlow }),
|
|
4117
|
+
[navigate, back, reset, closeFlow]
|
|
3542
4118
|
);
|
|
3543
4119
|
const [toastMounted, setToastMounted] = useState9(false);
|
|
3544
4120
|
const [copiedToastShown, setCopiedToastShown] = useState9(false);
|
|
3545
|
-
const hideTimerRef =
|
|
4121
|
+
const hideTimerRef = useRef7(
|
|
3546
4122
|
void 0
|
|
3547
4123
|
);
|
|
3548
|
-
const unmountTimerRef =
|
|
4124
|
+
const unmountTimerRef = useRef7(
|
|
3549
4125
|
void 0
|
|
3550
4126
|
);
|
|
3551
|
-
const showCopiedToast =
|
|
4127
|
+
const showCopiedToast = useCallback8(() => {
|
|
3552
4128
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3553
4129
|
if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
|
|
3554
4130
|
setToastMounted(true);
|
|
@@ -3562,8 +4138,8 @@ function FunkitFlowProvider({
|
|
|
3562
4138
|
}, TOAST_VISIBLE_MS);
|
|
3563
4139
|
}, []);
|
|
3564
4140
|
useEffect11(() => () => clearToast(), [clearToast]);
|
|
3565
|
-
return /* @__PURE__ */
|
|
3566
|
-
/* @__PURE__ */
|
|
4141
|
+
return /* @__PURE__ */ jsx24(FunkitFlowContext.Provider, { value, children: /* @__PURE__ */ jsxs11(View3, { style: rootContainer, children: [
|
|
4142
|
+
/* @__PURE__ */ jsx24(
|
|
3567
4143
|
FlowSheet,
|
|
3568
4144
|
{
|
|
3569
4145
|
isOpen: state.isOpen,
|
|
@@ -3571,23 +4147,31 @@ function FunkitFlowProvider({
|
|
|
3571
4147
|
onClose: closeFlow,
|
|
3572
4148
|
keyboardAvoidEnabled: current === "swapped",
|
|
3573
4149
|
content: (
|
|
3574
|
-
// Mounted only while open so the
|
|
3575
|
-
state.isOpen && state.
|
|
4150
|
+
// Mounted only while open so the flow queries run only then.
|
|
4151
|
+
state.isOpen && state.flow ? state.flow.mode === "deposit" ? /* @__PURE__ */ jsx24(
|
|
3576
4152
|
FlowContent,
|
|
3577
4153
|
{
|
|
3578
|
-
config: state.config,
|
|
4154
|
+
config: state.flow.config,
|
|
3579
4155
|
current,
|
|
3580
4156
|
nav,
|
|
3581
4157
|
copyToClipboard: copyToClipboard2,
|
|
3582
4158
|
onCopySuccess: showCopiedToast,
|
|
3583
|
-
callbacks: state.callbacks
|
|
4159
|
+
callbacks: state.flow.callbacks
|
|
4160
|
+
}
|
|
4161
|
+
) : /* @__PURE__ */ jsx24(
|
|
4162
|
+
WithdrawalFlowContent,
|
|
4163
|
+
{
|
|
4164
|
+
config: state.flow.config,
|
|
4165
|
+
callbacks: state.flow.callbacks,
|
|
4166
|
+
current,
|
|
4167
|
+
nav
|
|
3584
4168
|
}
|
|
3585
4169
|
) : null
|
|
3586
4170
|
),
|
|
3587
4171
|
children
|
|
3588
4172
|
}
|
|
3589
4173
|
),
|
|
3590
|
-
toastMounted ? /* @__PURE__ */
|
|
4174
|
+
toastMounted ? /* @__PURE__ */ jsx24(
|
|
3591
4175
|
View3,
|
|
3592
4176
|
{
|
|
3593
4177
|
style: [
|
|
@@ -3595,7 +4179,7 @@ function FunkitFlowProvider({
|
|
|
3595
4179
|
{ paddingTop: insets.top + TOAST_INSET_OFFSET }
|
|
3596
4180
|
],
|
|
3597
4181
|
pointerEvents: "none",
|
|
3598
|
-
children: copiedToastShown ? /* @__PURE__ */
|
|
4182
|
+
children: copiedToastShown ? /* @__PURE__ */ jsx24(AddressCopiedToast, {}) : null
|
|
3599
4183
|
}
|
|
3600
4184
|
) : null
|
|
3601
4185
|
] }) });
|
|
@@ -3653,7 +4237,7 @@ function FlowContent({
|
|
|
3653
4237
|
});
|
|
3654
4238
|
const fetched = useSupportedTokens({ transferInit });
|
|
3655
4239
|
const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters;
|
|
3656
|
-
const depositNetworks =
|
|
4240
|
+
const depositNetworks = useMemo9(
|
|
3657
4241
|
() => buildDepositNetworks(tokenChainFilters),
|
|
3658
4242
|
[tokenChainFilters]
|
|
3659
4243
|
);
|
|
@@ -3661,7 +4245,7 @@ function FlowContent({
|
|
|
3661
4245
|
(n) => n.chainId != null && belongsToNetwork(initialChainId, n.chainId)
|
|
3662
4246
|
);
|
|
3663
4247
|
const selectedChain = depositNetworks.find((n) => n.id === selectedNetworkId) ?? initialNetwork ?? depositNetworks[0];
|
|
3664
|
-
const minTransferLimits =
|
|
4248
|
+
const minTransferLimits = useDynamicConfig7("mintokentransfervalue");
|
|
3665
4249
|
const {
|
|
3666
4250
|
savedFops,
|
|
3667
4251
|
genericFops,
|
|
@@ -3688,7 +4272,7 @@ function FlowContent({
|
|
|
3688
4272
|
const singleChain = availableChains.length === 1 ? availableChains[0] : void 0;
|
|
3689
4273
|
const rawAddress = generatedAddress ?? config.depositAddress;
|
|
3690
4274
|
const displayAddress = rawAddress ? formatDepositAddress(rawAddress) : "Generating\u2026";
|
|
3691
|
-
const copyAddressAndToast =
|
|
4275
|
+
const copyAddressAndToast = useCallback8(
|
|
3692
4276
|
async (value) => {
|
|
3693
4277
|
const ok = await copyToClipboard2(value) !== false;
|
|
3694
4278
|
if (ok) onCopySuccess();
|
|
@@ -3696,6 +4280,31 @@ function FlowContent({
|
|
|
3696
4280
|
},
|
|
3697
4281
|
[copyToClipboard2, onCopySuccess]
|
|
3698
4282
|
);
|
|
4283
|
+
const nestedSheetRef = useRef7(null);
|
|
4284
|
+
const [nestedScreen, setNestedScreen] = useState9(null);
|
|
4285
|
+
const openNestedScreen = useCallback8((screen2) => {
|
|
4286
|
+
setNestedScreen(screen2);
|
|
4287
|
+
}, []);
|
|
4288
|
+
useEffect11(() => {
|
|
4289
|
+
if (nestedScreen) {
|
|
4290
|
+
nestedSheetRef.current?.present();
|
|
4291
|
+
}
|
|
4292
|
+
}, [nestedScreen]);
|
|
4293
|
+
const closeNestedScreen = useCallback8(() => {
|
|
4294
|
+
nestedSheetRef.current?.dismiss();
|
|
4295
|
+
}, []);
|
|
4296
|
+
const renderNestedBackdrop = useCallback8(
|
|
4297
|
+
(props) => /* @__PURE__ */ jsx24(
|
|
4298
|
+
BottomSheetBackdrop2,
|
|
4299
|
+
{
|
|
4300
|
+
...props,
|
|
4301
|
+
appearsOnIndex: 0,
|
|
4302
|
+
disappearsOnIndex: -1,
|
|
4303
|
+
pressBehavior: "close"
|
|
4304
|
+
}
|
|
4305
|
+
),
|
|
4306
|
+
[]
|
|
4307
|
+
);
|
|
3699
4308
|
const screen = (() => {
|
|
3700
4309
|
switch (current) {
|
|
3701
4310
|
case "addMoney": {
|
|
@@ -3707,8 +4316,8 @@ function FlowContent({
|
|
|
3707
4316
|
id: CRYPTO_METHOD_ID,
|
|
3708
4317
|
title: "Crypto",
|
|
3709
4318
|
subtitle: "No limit",
|
|
3710
|
-
icon: /* @__PURE__ */
|
|
3711
|
-
trailing: cryptoSourceIcons.length ? /* @__PURE__ */
|
|
4319
|
+
icon: /* @__PURE__ */ jsx24(CryptoBitcoinIcon, {}),
|
|
4320
|
+
trailing: cryptoSourceIcons.length ? /* @__PURE__ */ jsx24(
|
|
3712
4321
|
SourceTokenCluster,
|
|
3713
4322
|
{
|
|
3714
4323
|
icons: cryptoSourceIcons,
|
|
@@ -3721,7 +4330,7 @@ function FlowContent({
|
|
|
3721
4330
|
id: row3.id,
|
|
3722
4331
|
title: row3.name,
|
|
3723
4332
|
subtitle: row3.subtitle,
|
|
3724
|
-
icon: /* @__PURE__ */
|
|
4333
|
+
icon: /* @__PURE__ */ jsx24(FunIcon, { uri: row3.iconUri, fallbackUri: FALLBACK_ASSET_LOGO })
|
|
3725
4334
|
}));
|
|
3726
4335
|
const methods = isSwappedEnabled ? [
|
|
3727
4336
|
...toCashRows(savedFops),
|
|
@@ -3733,12 +4342,12 @@ function FlowContent({
|
|
|
3733
4342
|
(c, i) => ({
|
|
3734
4343
|
id: String(i),
|
|
3735
4344
|
label: c.badgeText ? `${c.tokenSymbol} (${c.badgeText})` : c.tokenSymbol,
|
|
3736
|
-
icon: /* @__PURE__ */
|
|
4345
|
+
icon: /* @__PURE__ */ jsx24(TokenChainIcon, { symbol: c.tokenSymbol, iconSrc: c.iconSrc })
|
|
3737
4346
|
})
|
|
3738
4347
|
);
|
|
3739
4348
|
const selectedReceiveTokenId = selectedCandidate && candidates ? String(candidates.indexOf(selectedCandidate)) : void 0;
|
|
3740
|
-
return /* @__PURE__ */
|
|
3741
|
-
|
|
4349
|
+
return /* @__PURE__ */ jsx24(
|
|
4350
|
+
SelectMethodScreen,
|
|
3742
4351
|
{
|
|
3743
4352
|
methods,
|
|
3744
4353
|
receiveTokens,
|
|
@@ -3777,7 +4386,7 @@ function FlowContent({
|
|
|
3777
4386
|
label: chain.label,
|
|
3778
4387
|
iconKeys: chain.iconKeys ?? []
|
|
3779
4388
|
}));
|
|
3780
|
-
return /* @__PURE__ */
|
|
4389
|
+
return /* @__PURE__ */ jsx24(
|
|
3781
4390
|
TransferCryptoScreen,
|
|
3782
4391
|
{
|
|
3783
4392
|
depositAddress: displayAddress,
|
|
@@ -3787,50 +4396,191 @@ function FlowContent({
|
|
|
3787
4396
|
supportedTokenIcons: singleChain ? void 0 : availableChains.length ? availableChains.map((c) => c.iconUri) : selectedChain?.iconKeys ?? [],
|
|
3788
4397
|
minimumDepositLabel: singleChain?.minLabel,
|
|
3789
4398
|
onBack: nav.back,
|
|
3790
|
-
onShowChains: availableChains.length > 1 ? () =>
|
|
3791
|
-
onShowQrCode: () =>
|
|
4399
|
+
onShowChains: availableChains.length > 1 ? () => openNestedScreen("availableChains") : void 0,
|
|
4400
|
+
onShowQrCode: () => openNestedScreen("qrCode"),
|
|
3792
4401
|
onCopyAddress: rawAddress ? () => void copyAddressAndToast(rawAddress) : void 0,
|
|
3793
4402
|
onShareAddress: rawAddress ? () => void Share.share({ message: rawAddress }) : void 0
|
|
3794
4403
|
}
|
|
3795
4404
|
);
|
|
3796
4405
|
}
|
|
4406
|
+
case "swapped":
|
|
4407
|
+
return selectedSwappedUrl ? /* @__PURE__ */ jsx24(
|
|
4408
|
+
SwappedScreen,
|
|
4409
|
+
{
|
|
4410
|
+
url: selectedSwappedUrl,
|
|
4411
|
+
onBack: nav.back,
|
|
4412
|
+
onClose: nav.closeFlow
|
|
4413
|
+
}
|
|
4414
|
+
) : null;
|
|
4415
|
+
default:
|
|
4416
|
+
return null;
|
|
4417
|
+
}
|
|
4418
|
+
})();
|
|
4419
|
+
const bottomSheetScreen = (() => {
|
|
4420
|
+
switch (nestedScreen) {
|
|
3797
4421
|
case "availableChains":
|
|
3798
|
-
return /* @__PURE__ */
|
|
4422
|
+
return /* @__PURE__ */ jsx24(
|
|
3799
4423
|
AvailableChainsScreen,
|
|
3800
4424
|
{
|
|
3801
4425
|
networkLabel: selectedChain?.label ?? "",
|
|
3802
4426
|
chains: availableChains,
|
|
3803
|
-
onClose:
|
|
4427
|
+
onClose: closeNestedScreen
|
|
3804
4428
|
}
|
|
3805
4429
|
);
|
|
3806
4430
|
case "qrCode":
|
|
3807
|
-
return /* @__PURE__ */
|
|
4431
|
+
return /* @__PURE__ */ jsx24(
|
|
3808
4432
|
QrCodeScreen,
|
|
3809
4433
|
{
|
|
3810
|
-
qrCode: config.qrCode ?? (qrCodeUri ? /* @__PURE__ */
|
|
3811
|
-
centerIcon: /* @__PURE__ */
|
|
4434
|
+
qrCode: config.qrCode ?? (qrCodeUri ? /* @__PURE__ */ jsx24(QrCode, { value: qrCodeUri, size: 235 }) : null),
|
|
4435
|
+
centerIcon: /* @__PURE__ */ jsx24(QrChainCluster, { iconKeys: selectedChain?.iconKeys ?? [] }),
|
|
3812
4436
|
address: rawAddress,
|
|
3813
4437
|
onCopyAddress: rawAddress ? () => copyAddressAndToast(rawAddress) : void 0,
|
|
3814
|
-
onClose:
|
|
4438
|
+
onClose: closeNestedScreen
|
|
3815
4439
|
}
|
|
3816
4440
|
);
|
|
3817
|
-
case "swapped":
|
|
3818
|
-
return selectedSwappedUrl ? /* @__PURE__ */ jsx21(
|
|
3819
|
-
SwappedScreen,
|
|
3820
|
-
{
|
|
3821
|
-
url: selectedSwappedUrl,
|
|
3822
|
-
onBack: nav.back,
|
|
3823
|
-
onClose: nav.closeFlow
|
|
3824
|
-
}
|
|
3825
|
-
) : null;
|
|
3826
4441
|
default:
|
|
3827
4442
|
return null;
|
|
3828
4443
|
}
|
|
3829
4444
|
})();
|
|
3830
4445
|
if (isGeoblocked) {
|
|
3831
|
-
return /* @__PURE__ */
|
|
4446
|
+
return /* @__PURE__ */ jsx24(CheckoutBlockedScreen, {});
|
|
4447
|
+
}
|
|
4448
|
+
return /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
4449
|
+
screen,
|
|
4450
|
+
/* @__PURE__ */ jsx24(
|
|
4451
|
+
BottomSheetModal2,
|
|
4452
|
+
{
|
|
4453
|
+
ref: nestedSheetRef,
|
|
4454
|
+
enableDynamicSizing: true,
|
|
4455
|
+
handleComponent: void 0,
|
|
4456
|
+
backgroundComponent: FlowSheetBackground,
|
|
4457
|
+
backdropComponent: renderNestedBackdrop,
|
|
4458
|
+
onDismiss: () => setNestedScreen(null),
|
|
4459
|
+
children: /* @__PURE__ */ jsx24(BottomSheetView2, { children: bottomSheetScreen })
|
|
4460
|
+
}
|
|
4461
|
+
)
|
|
4462
|
+
] });
|
|
4463
|
+
}
|
|
4464
|
+
function WithdrawalFlowContent({
|
|
4465
|
+
config,
|
|
4466
|
+
callbacks,
|
|
4467
|
+
current,
|
|
4468
|
+
nav
|
|
4469
|
+
}) {
|
|
4470
|
+
const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({
|
|
4471
|
+
onCheckoutBlocked: callbacks.onCheckoutBlocked
|
|
4472
|
+
});
|
|
4473
|
+
const queryClient = useQueryClient();
|
|
4474
|
+
const {
|
|
4475
|
+
fops,
|
|
4476
|
+
isLoading,
|
|
4477
|
+
noPaymentMethodsAvailable,
|
|
4478
|
+
isBelowMinimumBalance,
|
|
4479
|
+
isError,
|
|
4480
|
+
refetch,
|
|
4481
|
+
route
|
|
4482
|
+
} = useWithdrawalFops({ config });
|
|
4483
|
+
const [selectedFop, setSelectedFop] = useState9();
|
|
4484
|
+
const [hasExecutionError, setHasExecutionError] = useState9(false);
|
|
4485
|
+
const onExecutionError = useCallback8(() => setHasExecutionError(true), []);
|
|
4486
|
+
const { executeOrder } = useWithdrawalExecution({
|
|
4487
|
+
config,
|
|
4488
|
+
route,
|
|
4489
|
+
callbacks,
|
|
4490
|
+
onError: onExecutionError
|
|
4491
|
+
});
|
|
4492
|
+
const invalidateWithdrawFops = useCallback8(() => {
|
|
4493
|
+
void queryClient.invalidateQueries({ queryKey: [WITHDRAW_FOPS_QUERY_KEY] });
|
|
4494
|
+
}, [queryClient]);
|
|
4495
|
+
if (isGeoblocked) {
|
|
4496
|
+
return /* @__PURE__ */ jsx24(CheckoutBlockedScreen, {});
|
|
4497
|
+
}
|
|
4498
|
+
if (hasExecutionError) {
|
|
4499
|
+
return /* @__PURE__ */ jsx24(
|
|
4500
|
+
WithdrawMethodScreen,
|
|
4501
|
+
{
|
|
4502
|
+
title: config.title,
|
|
4503
|
+
methods: [],
|
|
4504
|
+
hasError: true,
|
|
4505
|
+
onRetry: () => {
|
|
4506
|
+
setHasExecutionError(false);
|
|
4507
|
+
invalidateWithdrawFops();
|
|
4508
|
+
nav.reset("withdrawMethod");
|
|
4509
|
+
},
|
|
4510
|
+
onSelectMethod: () => void 0
|
|
4511
|
+
}
|
|
4512
|
+
);
|
|
4513
|
+
}
|
|
4514
|
+
switch (current) {
|
|
4515
|
+
case "withdrawMethod": {
|
|
4516
|
+
const methods = toWithdrawFopRows(fops).map(
|
|
4517
|
+
(row3, i) => ({
|
|
4518
|
+
id: String(i),
|
|
4519
|
+
title: row3.name,
|
|
4520
|
+
subtitle: row3.subtitle,
|
|
4521
|
+
icon: /* @__PURE__ */ jsx24(FunIcon, { uri: row3.iconUri, fallbackUri: FALLBACK_ASSET_LOGO })
|
|
4522
|
+
})
|
|
4523
|
+
);
|
|
4524
|
+
return /* @__PURE__ */ jsx24(
|
|
4525
|
+
WithdrawMethodScreen,
|
|
4526
|
+
{
|
|
4527
|
+
title: config.title,
|
|
4528
|
+
methods,
|
|
4529
|
+
loading: isLoadingGeoCheck || isLoading,
|
|
4530
|
+
hasError: isError,
|
|
4531
|
+
onRetry: refetch,
|
|
4532
|
+
isEmpty: noPaymentMethodsAvailable,
|
|
4533
|
+
isBelowMinimum: isBelowMinimumBalance,
|
|
4534
|
+
onSelectMethod: (id) => {
|
|
4535
|
+
const fop = fops[Number(id)];
|
|
4536
|
+
if (!fop?.embeddedFlowUrl) return;
|
|
4537
|
+
logger.info("connect-rn:withdrawal:method_selected", {
|
|
4538
|
+
fopType: fop.fopType,
|
|
4539
|
+
fopName: fop.name
|
|
4540
|
+
});
|
|
4541
|
+
setSelectedFop(fop);
|
|
4542
|
+
nav.navigate("swapped");
|
|
4543
|
+
}
|
|
4544
|
+
}
|
|
4545
|
+
);
|
|
4546
|
+
}
|
|
4547
|
+
case "swapped":
|
|
4548
|
+
return selectedFop?.embeddedFlowUrl ? /* @__PURE__ */ jsx24(
|
|
4549
|
+
SwappedWithdrawScreen,
|
|
4550
|
+
{
|
|
4551
|
+
url: selectedFop.embeddedFlowUrl,
|
|
4552
|
+
onBack: () => {
|
|
4553
|
+
invalidateWithdrawFops();
|
|
4554
|
+
nav.back();
|
|
4555
|
+
},
|
|
4556
|
+
onClose: () => {
|
|
4557
|
+
invalidateWithdrawFops();
|
|
4558
|
+
nav.closeFlow();
|
|
4559
|
+
},
|
|
4560
|
+
onNewWithdrawal: () => {
|
|
4561
|
+
invalidateWithdrawFops();
|
|
4562
|
+
nav.back();
|
|
4563
|
+
},
|
|
4564
|
+
onWithdrawalSuccess: (data) => {
|
|
4565
|
+
invalidateWithdrawFops();
|
|
4566
|
+
callbacks.onWithdrawalSuccess?.(data);
|
|
4567
|
+
},
|
|
4568
|
+
onOrderData: (order) => {
|
|
4569
|
+
try {
|
|
4570
|
+
callbacks.onWithdrawalOrder?.(order);
|
|
4571
|
+
} catch (error) {
|
|
4572
|
+
logger.warn("connect-rn:withdrawal:order_callback_threw", {
|
|
4573
|
+
order_id: order.order_id,
|
|
4574
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4575
|
+
});
|
|
4576
|
+
}
|
|
4577
|
+
void executeOrder(order);
|
|
4578
|
+
}
|
|
4579
|
+
}
|
|
4580
|
+
) : null;
|
|
4581
|
+
default:
|
|
4582
|
+
return null;
|
|
3832
4583
|
}
|
|
3833
|
-
return screen;
|
|
3834
4584
|
}
|
|
3835
4585
|
var TOAST_VISIBLE_MS = 1800;
|
|
3836
4586
|
var TOAST_EXIT_MS = 350;
|
|
@@ -3850,7 +4600,7 @@ function useFunkitFlow() {
|
|
|
3850
4600
|
}
|
|
3851
4601
|
|
|
3852
4602
|
// src/version.ts
|
|
3853
|
-
var CONNECT_RN_VERSION = true ? "1.0
|
|
4603
|
+
var CONNECT_RN_VERSION = true ? "2.1.0" : "0.0.0-dev";
|
|
3854
4604
|
|
|
3855
4605
|
// src/providers/FunkitStatsigProvider.tsx
|
|
3856
4606
|
import {
|
|
@@ -3858,7 +4608,7 @@ import {
|
|
|
3858
4608
|
LogLevel,
|
|
3859
4609
|
StatsigProvider
|
|
3860
4610
|
} from "@statsig/react-bindings";
|
|
3861
|
-
import { useMemo as
|
|
4611
|
+
import { useMemo as useMemo10 } from "react";
|
|
3862
4612
|
|
|
3863
4613
|
// src/statsig/useClientAsyncInitRN.ts
|
|
3864
4614
|
import {
|
|
@@ -4043,17 +4793,25 @@ function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
|
|
|
4043
4793
|
}
|
|
4044
4794
|
|
|
4045
4795
|
// src/providers/FunkitStatsigProvider.tsx
|
|
4046
|
-
import { jsx as
|
|
4796
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4047
4797
|
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
4048
4798
|
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
4799
|
+
var STATSIG_SDK_TYPE = "react-native";
|
|
4800
|
+
function buildFunkitStatsigUser(userId, apiKey) {
|
|
4801
|
+
return {
|
|
4802
|
+
userID: userId,
|
|
4803
|
+
customIDs: { apiKey },
|
|
4804
|
+
custom: { sdkType: STATSIG_SDK_TYPE }
|
|
4805
|
+
};
|
|
4806
|
+
}
|
|
4049
4807
|
function FunkitStatsigProvider({
|
|
4050
4808
|
children,
|
|
4051
4809
|
apiKey,
|
|
4052
4810
|
userId,
|
|
4053
4811
|
isDevelopment = false
|
|
4054
4812
|
}) {
|
|
4055
|
-
const user =
|
|
4056
|
-
() => (
|
|
4813
|
+
const user = useMemo10(
|
|
4814
|
+
() => buildFunkitStatsigUser(userId, apiKey),
|
|
4057
4815
|
[userId, apiKey]
|
|
4058
4816
|
);
|
|
4059
4817
|
const { client } = useClientAsyncInitRN(STATSIG_CLIENT_KEY, user, {
|
|
@@ -4071,11 +4829,11 @@ function FunkitStatsigProvider({
|
|
|
4071
4829
|
tier: isDevelopment ? "development" : "production"
|
|
4072
4830
|
}
|
|
4073
4831
|
});
|
|
4074
|
-
return /* @__PURE__ */
|
|
4832
|
+
return /* @__PURE__ */ jsx25(StatsigProvider, { client, children });
|
|
4075
4833
|
}
|
|
4076
4834
|
|
|
4077
4835
|
// src/providers/FunkitProvider.tsx
|
|
4078
|
-
import { jsx as
|
|
4836
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4079
4837
|
var ANONYMOUS_CONFIG = { apiKey: "" };
|
|
4080
4838
|
function createFallbackQueryClient() {
|
|
4081
4839
|
return new QueryClient({
|
|
@@ -4096,10 +4854,10 @@ function FunkitProvider({
|
|
|
4096
4854
|
debug = false,
|
|
4097
4855
|
copyToClipboard: copyToClipboard2
|
|
4098
4856
|
}) {
|
|
4099
|
-
const fallbackClient =
|
|
4857
|
+
const fallbackClient = useRef8(void 0);
|
|
4100
4858
|
fallbackClient.current ??= createFallbackQueryClient();
|
|
4101
4859
|
const client = queryClient ?? fallbackClient.current;
|
|
4102
|
-
const identity =
|
|
4860
|
+
const identity = useMemo11(
|
|
4103
4861
|
() => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
|
|
4104
4862
|
[config, walletAddress]
|
|
4105
4863
|
);
|
|
@@ -4118,26 +4876,30 @@ function FunkitProvider({
|
|
|
4118
4876
|
""
|
|
4119
4877
|
);
|
|
4120
4878
|
}, [identity]);
|
|
4121
|
-
return /* @__PURE__ */
|
|
4879
|
+
return /* @__PURE__ */ jsx26(SafeAreaProvider, { children: /* @__PURE__ */ jsx26(
|
|
4122
4880
|
FunkitStatsigProvider,
|
|
4123
4881
|
{
|
|
4124
4882
|
apiKey: identity.apiKey,
|
|
4125
4883
|
userId: identity.userId,
|
|
4126
4884
|
isDevelopment: debug,
|
|
4127
|
-
children: /* @__PURE__ */
|
|
4885
|
+
children: /* @__PURE__ */ jsx26(QueryClientProvider, { client, children: /* @__PURE__ */ jsx26(FunkitIdentityProvider, { identity, children: /* @__PURE__ */ jsx26(FunkitThemeProvider, { themes, colorScheme, children: /* @__PURE__ */ jsx26(FunkitFlowProvider, { copyToClipboard: copyToClipboard2, children }) }) }) })
|
|
4128
4886
|
}
|
|
4129
4887
|
) });
|
|
4130
4888
|
}
|
|
4131
4889
|
|
|
4132
4890
|
// src/providers/useFunkitCheckout.ts
|
|
4133
|
-
import { useCallback as
|
|
4891
|
+
import { useCallback as useCallback9 } from "react";
|
|
4134
4892
|
function useFunkitCheckout(callbacks = {}) {
|
|
4135
|
-
const { beginDeposit:
|
|
4136
|
-
const beginDeposit =
|
|
4137
|
-
(config) =>
|
|
4138
|
-
[
|
|
4893
|
+
const { beginDeposit: openDepositFlow, beginWithdrawal: openWithdrawalFlow } = useFunkitFlow();
|
|
4894
|
+
const beginDeposit = useCallback9(
|
|
4895
|
+
(config) => openDepositFlow(config, callbacks),
|
|
4896
|
+
[openDepositFlow, callbacks]
|
|
4897
|
+
);
|
|
4898
|
+
const beginWithdrawal = useCallback9(
|
|
4899
|
+
(config) => openWithdrawalFlow(config, callbacks),
|
|
4900
|
+
[openWithdrawalFlow, callbacks]
|
|
4139
4901
|
);
|
|
4140
|
-
return { beginDeposit };
|
|
4902
|
+
return { beginDeposit, beginWithdrawal };
|
|
4141
4903
|
}
|
|
4142
4904
|
export {
|
|
4143
4905
|
AddressCopiedToast,
|