@funkit/connect-rn 2.0.0 → 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 +21 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1033 -276
- 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/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/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 +1 -1
package/dist/index.js
CHANGED
|
@@ -70,7 +70,7 @@ var lightTokens = {
|
|
|
70
70
|
modal: 24,
|
|
71
71
|
element: 12,
|
|
72
72
|
elementInner: 8,
|
|
73
|
-
button:
|
|
73
|
+
button: 999,
|
|
74
74
|
rounded: 999
|
|
75
75
|
},
|
|
76
76
|
borderWidths: {
|
|
@@ -171,7 +171,7 @@ var darkTokens = {
|
|
|
171
171
|
modal: 24,
|
|
172
172
|
element: 12,
|
|
173
173
|
elementInner: 8,
|
|
174
|
-
button:
|
|
174
|
+
button: 999,
|
|
175
175
|
rounded: 999
|
|
176
176
|
},
|
|
177
177
|
borderWidths: {
|
|
@@ -334,12 +334,12 @@ var DEFAULT_THEME_SET = {
|
|
|
334
334
|
};
|
|
335
335
|
function selectTheme(themeSet, scheme) {
|
|
336
336
|
const primary = scheme === "dark" ? themeSet.dark : themeSet.light;
|
|
337
|
-
const
|
|
337
|
+
const fallback2 = scheme === "dark" ? themeSet.light : themeSet.dark;
|
|
338
338
|
if (primary) {
|
|
339
339
|
return primary;
|
|
340
340
|
}
|
|
341
|
-
if (
|
|
342
|
-
return
|
|
341
|
+
if (fallback2) {
|
|
342
|
+
return fallback2;
|
|
343
343
|
}
|
|
344
344
|
throw new Error(
|
|
345
345
|
"FunkitProvider: `themes` must include at least one of { light, dark }"
|
|
@@ -399,7 +399,6 @@ function renderIcon(svg, size, color) {
|
|
|
399
399
|
}
|
|
400
400
|
);
|
|
401
401
|
}
|
|
402
|
-
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>';
|
|
403
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>';
|
|
404
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>';
|
|
405
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>';
|
|
@@ -408,9 +407,6 @@ var CHEVRON_LEFT_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="no
|
|
|
408
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>';
|
|
409
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>';
|
|
410
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>';
|
|
411
|
-
function FigmaCloseIcon({ size = 20, color }) {
|
|
412
|
-
return renderIcon(CLOSE_SVG, size, useIconColor(color));
|
|
413
|
-
}
|
|
414
410
|
function FigmaQrScanIcon({ size = 20, color }) {
|
|
415
411
|
return renderIcon(QR_SCAN_SVG, size, useIconColor(color));
|
|
416
412
|
}
|
|
@@ -435,14 +431,14 @@ function FigmaChevronDownIcon({ size = 16, color }) {
|
|
|
435
431
|
function FigmaCheckIcon({ size = 16, color }) {
|
|
436
432
|
return renderIcon(CHECK_SVG, size, useIconColor(color));
|
|
437
433
|
}
|
|
438
|
-
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>';
|
|
439
|
-
function FigmaInfoCircleIcon({ size = 20, color }) {
|
|
440
|
-
return renderIcon(INFO_CIRCLE_SVG, size, useIconColor(color));
|
|
441
|
-
}
|
|
442
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>';
|
|
443
435
|
function FigmaPlusIcon({ size = 16, color }) {
|
|
444
436
|
return renderIcon(PLUS_SVG, size, useIconColor(color));
|
|
445
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
|
+
}
|
|
446
442
|
|
|
447
443
|
// src/flow/AddressCopiedToast.tsx
|
|
448
444
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
@@ -554,18 +550,24 @@ function useFunkitColorScheme() {
|
|
|
554
550
|
|
|
555
551
|
// src/providers/FunkitProvider.tsx
|
|
556
552
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
557
|
-
import { useEffect as useEffect12, useMemo as
|
|
553
|
+
import { useEffect as useEffect12, useMemo as useMemo11, useRef as useRef8 } from "react";
|
|
558
554
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
559
555
|
|
|
560
556
|
// src/flow/FunkitFlowProvider.tsx
|
|
561
|
-
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";
|
|
562
564
|
import {
|
|
563
565
|
createContext as createContext3,
|
|
564
|
-
useCallback as
|
|
566
|
+
useCallback as useCallback8,
|
|
565
567
|
useContext as useContext3,
|
|
566
568
|
useEffect as useEffect11,
|
|
567
|
-
useMemo as
|
|
568
|
-
useRef as
|
|
569
|
+
useMemo as useMemo9,
|
|
570
|
+
useRef as useRef7,
|
|
569
571
|
useState as useState9
|
|
570
572
|
} from "react";
|
|
571
573
|
import { Share, StyleSheet as StyleSheet3, View as View3 } from "react-native";
|
|
@@ -649,7 +651,13 @@ var DatadogHttpLogTransport = class {
|
|
|
649
651
|
fetch(this.intakeUrl, {
|
|
650
652
|
method: "POST",
|
|
651
653
|
headers: { "Content-Type": "application/json" },
|
|
652
|
-
|
|
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
|
+
)
|
|
653
661
|
}).catch(() => {
|
|
654
662
|
});
|
|
655
663
|
}
|
|
@@ -1365,7 +1373,7 @@ function SelectMethodError({
|
|
|
1365
1373
|
Box,
|
|
1366
1374
|
{
|
|
1367
1375
|
backgroundColor: "btnPrimary",
|
|
1368
|
-
borderRadius: "
|
|
1376
|
+
borderRadius: "button",
|
|
1369
1377
|
alignItems: "center",
|
|
1370
1378
|
justifyContent: "center",
|
|
1371
1379
|
style: retryButton,
|
|
@@ -1747,6 +1755,7 @@ function AvailableChainsScreen({
|
|
|
1747
1755
|
networkLabel,
|
|
1748
1756
|
chains,
|
|
1749
1757
|
title = `Available ${networkLabel}`,
|
|
1758
|
+
gotItLabel = "Got it",
|
|
1750
1759
|
loading = false,
|
|
1751
1760
|
skeletonCount = 8,
|
|
1752
1761
|
onClose
|
|
@@ -1761,16 +1770,7 @@ function AvailableChainsScreen({
|
|
|
1761
1770
|
style: sheet,
|
|
1762
1771
|
children: [
|
|
1763
1772
|
/* @__PURE__ */ jsxs5(Box, { flexDirection: "row", alignItems: "center", style: topBar2, children: [
|
|
1764
|
-
/* @__PURE__ */ jsx10(
|
|
1765
|
-
Pressable2,
|
|
1766
|
-
{
|
|
1767
|
-
onPress: onClose,
|
|
1768
|
-
hitSlop: 12,
|
|
1769
|
-
accessibilityRole: "button",
|
|
1770
|
-
accessibilityLabel: "Close",
|
|
1771
|
-
children: /* @__PURE__ */ jsx10(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx10(FigmaCloseIcon, {}) })
|
|
1772
|
-
}
|
|
1773
|
-
),
|
|
1773
|
+
/* @__PURE__ */ jsx10(Box, { style: topBarSpacer }),
|
|
1774
1774
|
/* @__PURE__ */ jsx10(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx10(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
1775
1775
|
/* @__PURE__ */ jsx10(Box, { style: topBarSpacer })
|
|
1776
1776
|
] }),
|
|
@@ -1779,7 +1779,7 @@ function AvailableChainsScreen({
|
|
|
1779
1779
|
{
|
|
1780
1780
|
style: [list, { maxHeight: height * 0.72 }],
|
|
1781
1781
|
showsVerticalScrollIndicator: false,
|
|
1782
|
-
contentContainerStyle:
|
|
1782
|
+
contentContainerStyle: listContent2,
|
|
1783
1783
|
children: loading ? Array.from({ length: skeletonCount }, (_, index) => /* @__PURE__ */ jsx10(AvailableChainSkeleton, {}, index)) : chains.map((chain) => /* @__PURE__ */ jsxs5(
|
|
1784
1784
|
Box,
|
|
1785
1785
|
{
|
|
@@ -1802,7 +1802,27 @@ function AvailableChainsScreen({
|
|
|
1802
1802
|
chain.id
|
|
1803
1803
|
))
|
|
1804
1804
|
}
|
|
1805
|
-
)
|
|
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
|
+
) })
|
|
1806
1826
|
]
|
|
1807
1827
|
}
|
|
1808
1828
|
);
|
|
@@ -1814,16 +1834,17 @@ function AvailableChainSkeleton() {
|
|
|
1814
1834
|
/* @__PURE__ */ jsx10(Box, { backgroundColor: "pillPressed", style: skeletonMin })
|
|
1815
1835
|
] });
|
|
1816
1836
|
}
|
|
1817
|
-
var sheet = { paddingBottom:
|
|
1837
|
+
var sheet = { paddingBottom: 34 };
|
|
1818
1838
|
var topBar2 = {
|
|
1819
|
-
|
|
1839
|
+
paddingBottom: 12,
|
|
1820
1840
|
paddingHorizontal: 24,
|
|
1821
1841
|
gap: 4
|
|
1822
1842
|
};
|
|
1823
|
-
var iconButton = { width: 32, height: 32 };
|
|
1824
1843
|
var topBarSpacer = { width: 32, height: 32 };
|
|
1825
1844
|
var list = { width: "100%" };
|
|
1826
|
-
var
|
|
1845
|
+
var listContent2 = { paddingHorizontal: 20 };
|
|
1846
|
+
var buttonContainer = { paddingHorizontal: 20, paddingTop: 16 };
|
|
1847
|
+
var gotItButton = { height: 56, paddingHorizontal: 24 };
|
|
1827
1848
|
var row2 = { gap: 12, paddingVertical: 10 };
|
|
1828
1849
|
var skeletonIcon = { width: 36, height: 36, borderRadius: 999 };
|
|
1829
1850
|
var skeletonName = { width: 157, height: 16, borderRadius: 4 };
|
|
@@ -1840,8 +1861,9 @@ var iconRing2 = {
|
|
|
1840
1861
|
};
|
|
1841
1862
|
|
|
1842
1863
|
// src/screens/CheckoutBlockedScreen.tsx
|
|
1843
|
-
import { StyleSheet as StyleSheet2 } from "react-native";
|
|
1864
|
+
import { Linking, Pressable as Pressable3, StyleSheet as StyleSheet2 } from "react-native";
|
|
1844
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";
|
|
1845
1867
|
function CheckoutBlockedScreen() {
|
|
1846
1868
|
return /* @__PURE__ */ jsxs6(
|
|
1847
1869
|
Box,
|
|
@@ -1850,7 +1872,10 @@ function CheckoutBlockedScreen() {
|
|
|
1850
1872
|
borderTopLeftRadius: "modal",
|
|
1851
1873
|
borderTopRightRadius: "modal",
|
|
1852
1874
|
children: [
|
|
1853
|
-
/* @__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
|
+
] }),
|
|
1854
1879
|
/* @__PURE__ */ jsxs6(Box, { alignItems: "center", justifyContent: "center", style: styles2.content, children: [
|
|
1855
1880
|
/* @__PURE__ */ jsx11(
|
|
1856
1881
|
Box,
|
|
@@ -1860,20 +1885,37 @@ function CheckoutBlockedScreen() {
|
|
|
1860
1885
|
alignItems: "center",
|
|
1861
1886
|
justifyContent: "center",
|
|
1862
1887
|
style: styles2.iconCircle,
|
|
1863
|
-
children: /* @__PURE__ */ jsx11(
|
|
1888
|
+
children: /* @__PURE__ */ jsx11(FigmaAlertCircleIcon, { size: 20 })
|
|
1864
1889
|
}
|
|
1865
1890
|
),
|
|
1866
1891
|
/* @__PURE__ */ jsxs6(Box, { alignItems: "center", style: styles2.textGroup, children: [
|
|
1867
1892
|
/* @__PURE__ */ jsx11(Text, { variant: "bodyMedium", color: "textPrimary", children: "Not available" }),
|
|
1868
|
-
/* @__PURE__ */
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
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
|
+
] })
|
|
1877
1919
|
] })
|
|
1878
1920
|
] })
|
|
1879
1921
|
]
|
|
@@ -1881,7 +1923,7 @@ function CheckoutBlockedScreen() {
|
|
|
1881
1923
|
);
|
|
1882
1924
|
}
|
|
1883
1925
|
var styles2 = StyleSheet2.create({
|
|
1884
|
-
topBar: { paddingTop:
|
|
1926
|
+
topBar: { height: 64, paddingTop: 25, paddingBottom: 12 },
|
|
1885
1927
|
grabber: {
|
|
1886
1928
|
position: "absolute",
|
|
1887
1929
|
top: 8,
|
|
@@ -1890,21 +1932,28 @@ var styles2 = StyleSheet2.create({
|
|
|
1890
1932
|
borderRadius: 999
|
|
1891
1933
|
},
|
|
1892
1934
|
content: {
|
|
1893
|
-
height:
|
|
1894
|
-
gap:
|
|
1895
|
-
paddingHorizontal: 16
|
|
1935
|
+
height: 390,
|
|
1936
|
+
gap: 24,
|
|
1937
|
+
paddingHorizontal: 16,
|
|
1938
|
+
paddingBottom: 34
|
|
1896
1939
|
},
|
|
1897
1940
|
iconCircle: { width: 48, height: 48 },
|
|
1898
1941
|
textGroup: { gap: 8 },
|
|
1899
|
-
descriptionText: { textAlign: "center" }
|
|
1942
|
+
descriptionText: { textAlign: "center" },
|
|
1943
|
+
linkText: { textAlign: "center", textDecorationLine: "underline" }
|
|
1900
1944
|
});
|
|
1901
1945
|
|
|
1902
1946
|
// src/screens/QrCodeScreen.tsx
|
|
1903
1947
|
import { useEffect as useEffect5, useRef as useRef2, useState as useState5 } from "react";
|
|
1904
|
-
import {
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
} 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
|
+
}
|
|
1908
1957
|
|
|
1909
1958
|
// src/icons/CopyAddressIcon.tsx
|
|
1910
1959
|
import { SvgXml as SvgXml4 } from "react-native-svg";
|
|
@@ -1930,13 +1979,14 @@ function QrCodeScreen({
|
|
|
1930
1979
|
centerIcon,
|
|
1931
1980
|
address,
|
|
1932
1981
|
title = "QR Code",
|
|
1982
|
+
doneLabel = "Done",
|
|
1933
1983
|
copyLabel = "Copy address",
|
|
1934
1984
|
copiedLabel = "Copied!",
|
|
1935
1985
|
copiedFeedbackMs = 1800,
|
|
1936
1986
|
onClose,
|
|
1937
1987
|
onCopyAddress
|
|
1938
1988
|
}) {
|
|
1939
|
-
const {
|
|
1989
|
+
const { isShort } = useScreenSize();
|
|
1940
1990
|
const [copied, setCopied] = useState5(false);
|
|
1941
1991
|
const copyTimer = useRef2(void 0);
|
|
1942
1992
|
useEffect5(() => () => clearTimeout(copyTimer.current), []);
|
|
@@ -1956,100 +2006,106 @@ function QrCodeScreen({
|
|
|
1956
2006
|
style: sheet2,
|
|
1957
2007
|
children: [
|
|
1958
2008
|
/* @__PURE__ */ jsxs7(Box, { flexDirection: "row", alignItems: "center", style: topBar3, children: [
|
|
1959
|
-
/* @__PURE__ */ jsx13(
|
|
1960
|
-
Pressable3,
|
|
1961
|
-
{
|
|
1962
|
-
onPress: onClose,
|
|
1963
|
-
hitSlop: 12,
|
|
1964
|
-
accessibilityRole: "button",
|
|
1965
|
-
accessibilityLabel: "Close",
|
|
1966
|
-
children: /* @__PURE__ */ jsx13(Text, { color: "textPrimary", style: closeGlyph, children: "\u2715" })
|
|
1967
|
-
}
|
|
1968
|
-
),
|
|
2009
|
+
/* @__PURE__ */ jsx13(Box, { style: topBarSpacer2 }),
|
|
1969
2010
|
/* @__PURE__ */ jsx13(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
1970
2011
|
/* @__PURE__ */ jsx13(Box, { style: topBarSpacer2 })
|
|
1971
2012
|
] }),
|
|
1972
|
-
/* @__PURE__ */ jsxs7(
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
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(
|
|
1980
2082
|
Box,
|
|
1981
2083
|
{
|
|
1982
|
-
|
|
1983
|
-
borderColor: "borderDefault",
|
|
1984
|
-
borderWidth: 1.5,
|
|
2084
|
+
flexDirection: "row",
|
|
1985
2085
|
alignItems: "center",
|
|
1986
2086
|
justifyContent: "center",
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
Box,
|
|
1992
|
-
{
|
|
1993
|
-
alignItems: "center",
|
|
1994
|
-
justifyContent: "center",
|
|
1995
|
-
style: centerOverlay,
|
|
1996
|
-
children: centerIcon
|
|
1997
|
-
}
|
|
1998
|
-
) : null
|
|
1999
|
-
]
|
|
2087
|
+
backgroundColor: "btnPrimary",
|
|
2088
|
+
borderRadius: "button",
|
|
2089
|
+
style: doneButton,
|
|
2090
|
+
children: /* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "onBtnPrimary", children: doneLabel })
|
|
2000
2091
|
}
|
|
2001
|
-
)
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
Pressable3,
|
|
2006
|
-
{
|
|
2007
|
-
onPress: handleCopy,
|
|
2008
|
-
accessibilityRole: "button",
|
|
2009
|
-
accessibilityLabel: copied ? "Address copied" : "Copy address",
|
|
2010
|
-
children: /* @__PURE__ */ jsxs7(
|
|
2011
|
-
Box,
|
|
2012
|
-
{
|
|
2013
|
-
flexDirection: "row",
|
|
2014
|
-
alignItems: "center",
|
|
2015
|
-
justifyContent: "center",
|
|
2016
|
-
backgroundColor: "btnSecondary",
|
|
2017
|
-
borderColor: "btnSecondary",
|
|
2018
|
-
borderWidth: 1,
|
|
2019
|
-
borderRadius: "element",
|
|
2020
|
-
style: copyButton,
|
|
2021
|
-
children: [
|
|
2022
|
-
/* @__PURE__ */ jsx13(CopyAddressIcon, {}),
|
|
2023
|
-
/* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "onBtnSecondary", children: copied ? copiedLabel : copyLabel })
|
|
2024
|
-
]
|
|
2025
|
-
}
|
|
2026
|
-
)
|
|
2027
|
-
}
|
|
2028
|
-
) : null
|
|
2029
|
-
] }) : null
|
|
2030
|
-
]
|
|
2031
|
-
}
|
|
2032
|
-
)
|
|
2092
|
+
)
|
|
2093
|
+
}
|
|
2094
|
+
) })
|
|
2095
|
+
] })
|
|
2033
2096
|
]
|
|
2034
2097
|
}
|
|
2035
2098
|
);
|
|
2036
2099
|
}
|
|
2037
|
-
var sheet2 = { paddingBottom:
|
|
2100
|
+
var sheet2 = { paddingBottom: 34 };
|
|
2038
2101
|
var topBar3 = {
|
|
2039
|
-
|
|
2102
|
+
paddingBottom: 12,
|
|
2040
2103
|
paddingHorizontal: 24,
|
|
2041
2104
|
gap: 4
|
|
2042
2105
|
};
|
|
2043
|
-
var closeGlyph = {
|
|
2044
|
-
fontSize: 20,
|
|
2045
|
-
lineHeight: 24,
|
|
2046
|
-
width: 32,
|
|
2047
|
-
textAlign: "center"
|
|
2048
|
-
};
|
|
2049
2106
|
var topBarSpacer2 = { width: 32, height: 32 };
|
|
2050
|
-
var
|
|
2107
|
+
var content = {
|
|
2051
2108
|
paddingHorizontal: 20,
|
|
2052
|
-
paddingVertical: 45,
|
|
2053
2109
|
gap: 40
|
|
2054
2110
|
};
|
|
2055
2111
|
var qrFrame = {
|
|
@@ -2079,14 +2135,16 @@ var copyButton = {
|
|
|
2079
2135
|
paddingHorizontal: 20,
|
|
2080
2136
|
gap: 8
|
|
2081
2137
|
};
|
|
2138
|
+
var buttonContainer2 = { paddingHorizontal: 20 };
|
|
2139
|
+
var doneButton = { height: 56, paddingHorizontal: 24 };
|
|
2082
2140
|
|
|
2083
2141
|
// src/screens/TransferCryptoScreen.tsx
|
|
2084
2142
|
import { useEffect as useEffect7, useRef as useRef3, useState as useState7 } from "react";
|
|
2085
|
-
import { Pressable as
|
|
2143
|
+
import { Pressable as Pressable6 } from "react-native";
|
|
2086
2144
|
|
|
2087
2145
|
// src/screens/NetworkSelector.tsx
|
|
2088
2146
|
import { useEffect as useEffect6, useState as useState6 } from "react";
|
|
2089
|
-
import { Pressable as
|
|
2147
|
+
import { Pressable as Pressable5 } from "react-native";
|
|
2090
2148
|
import Animated3, {
|
|
2091
2149
|
Easing as Easing3,
|
|
2092
2150
|
FadeIn,
|
|
@@ -2157,7 +2215,7 @@ function NetworkSelector({
|
|
|
2157
2215
|
}
|
|
2158
2216
|
);
|
|
2159
2217
|
}
|
|
2160
|
-
var AnimatedPressable2 = Animated3.createAnimatedComponent(
|
|
2218
|
+
var AnimatedPressable2 = Animated3.createAnimatedComponent(Pressable5);
|
|
2161
2219
|
var SLIDE_MS = 250;
|
|
2162
2220
|
var COLLAPSE_MS = 150;
|
|
2163
2221
|
var segmentLayout = LinearTransition.duration(SLIDE_MS).easing(
|
|
@@ -2244,28 +2302,28 @@ function TransferCryptoScreen({
|
|
|
2244
2302
|
children: [
|
|
2245
2303
|
/* @__PURE__ */ jsxs9(Box, { flexDirection: "row", alignItems: "center", style: topBar4, children: [
|
|
2246
2304
|
/* @__PURE__ */ jsx15(
|
|
2247
|
-
|
|
2305
|
+
Pressable6,
|
|
2248
2306
|
{
|
|
2249
2307
|
onPress: onBack,
|
|
2250
2308
|
hitSlop: 12,
|
|
2251
2309
|
accessibilityRole: "button",
|
|
2252
2310
|
accessibilityLabel: "Back",
|
|
2253
|
-
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style:
|
|
2311
|
+
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx15(FigmaChevronLeftIcon, {}) })
|
|
2254
2312
|
}
|
|
2255
2313
|
),
|
|
2256
2314
|
/* @__PURE__ */ jsx15(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
2257
2315
|
/* @__PURE__ */ jsx15(
|
|
2258
|
-
|
|
2316
|
+
Pressable6,
|
|
2259
2317
|
{
|
|
2260
2318
|
onPress: onShowQrCode,
|
|
2261
2319
|
hitSlop: 12,
|
|
2262
2320
|
accessibilityRole: "button",
|
|
2263
2321
|
accessibilityLabel: "Show QR code",
|
|
2264
|
-
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style:
|
|
2322
|
+
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx15(FigmaQrScanIcon, {}) })
|
|
2265
2323
|
}
|
|
2266
2324
|
)
|
|
2267
2325
|
] }),
|
|
2268
|
-
/* @__PURE__ */ jsxs9(Box, { style:
|
|
2326
|
+
/* @__PURE__ */ jsxs9(Box, { style: content2, children: [
|
|
2269
2327
|
/* @__PURE__ */ jsx15(
|
|
2270
2328
|
NetworkSelector,
|
|
2271
2329
|
{
|
|
@@ -2306,7 +2364,7 @@ function TransferCryptoScreen({
|
|
|
2306
2364
|
)
|
|
2307
2365
|
] }),
|
|
2308
2366
|
showPreview ? /* @__PURE__ */ jsx15(
|
|
2309
|
-
|
|
2367
|
+
Pressable6,
|
|
2310
2368
|
{
|
|
2311
2369
|
onPress: onShowChains,
|
|
2312
2370
|
accessibilityRole: "button",
|
|
@@ -2399,7 +2457,7 @@ function PillButton({
|
|
|
2399
2457
|
onPress
|
|
2400
2458
|
}) {
|
|
2401
2459
|
return /* @__PURE__ */ jsx15(
|
|
2402
|
-
|
|
2460
|
+
Pressable6,
|
|
2403
2461
|
{
|
|
2404
2462
|
onPress,
|
|
2405
2463
|
accessibilityRole: "button",
|
|
@@ -2412,7 +2470,7 @@ function PillButton({
|
|
|
2412
2470
|
alignItems: "center",
|
|
2413
2471
|
justifyContent: "center",
|
|
2414
2472
|
backgroundColor: "btnPrimary",
|
|
2415
|
-
borderRadius: "
|
|
2473
|
+
borderRadius: "button",
|
|
2416
2474
|
style: pillButton,
|
|
2417
2475
|
children: [
|
|
2418
2476
|
icon,
|
|
@@ -2429,8 +2487,8 @@ var topBar4 = {
|
|
|
2429
2487
|
paddingHorizontal: 24,
|
|
2430
2488
|
gap: 4
|
|
2431
2489
|
};
|
|
2432
|
-
var
|
|
2433
|
-
var
|
|
2490
|
+
var iconButton = { width: 32, height: 32 };
|
|
2491
|
+
var content2 = {
|
|
2434
2492
|
paddingHorizontal: 20,
|
|
2435
2493
|
// pb-16 in Figma + the iOS home-indicator space below the buttons, so the
|
|
2436
2494
|
// sheet bottom sits flush with the 874px frame bottom.
|
|
@@ -2468,14 +2526,71 @@ var buttonsRow = { gap: 10, width: "100%" };
|
|
|
2468
2526
|
var pillButtonPress = { flex: 1 };
|
|
2469
2527
|
var pillButton = { height: 56, paddingHorizontal: 24, gap: 8 };
|
|
2470
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
|
+
|
|
2471
2581
|
// src/swapped/SwappedScreen.tsx
|
|
2582
|
+
import { useCallback as useCallback4 } from "react";
|
|
2583
|
+
|
|
2584
|
+
// src/swapped/SwappedScreenShell.tsx
|
|
2472
2585
|
import { useCallback as useCallback3 } from "react";
|
|
2473
2586
|
|
|
2474
2587
|
// src/swapped/SwappedWebView.tsx
|
|
2475
2588
|
import { useTheme as useTheme2 } from "@shopify/restyle";
|
|
2476
2589
|
import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo4, useRef as useRef4 } from "react";
|
|
2477
2590
|
import { ActivityIndicator, View } from "react-native";
|
|
2478
|
-
import {
|
|
2591
|
+
import {
|
|
2592
|
+
WebView
|
|
2593
|
+
} from "react-native-webview";
|
|
2479
2594
|
|
|
2480
2595
|
// src/swapped/buildSwappedTheme.ts
|
|
2481
2596
|
var px = (value) => `${value}px`;
|
|
@@ -2632,10 +2747,32 @@ var SWAPPED_WEBVIEW_INJECTED_JS = `(function () {
|
|
|
2632
2747
|
// Anything else is the embed talking to its host \u2192 forward to native.
|
|
2633
2748
|
forwardToNative(message);
|
|
2634
2749
|
}
|
|
2635
|
-
// The embed posts to window.parent (and sometimes window) \u2014 both are this
|
|
2636
|
-
// window at the top level, so both assignments install the same bridge.
|
|
2637
|
-
try { if (window.parent) { window.parent.postMessage = bridged; } } catch (e) {}
|
|
2638
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) {}
|
|
2639
2776
|
// No parent frame \u2192 the widget posts lifecycle messages to window.opener.
|
|
2640
2777
|
try { if (!window.opener) { window.opener = { postMessage: forwardToNative }; } } catch (e) {}
|
|
2641
2778
|
true;
|
|
@@ -2649,7 +2786,7 @@ function buildSwappedSendScript(msg) {
|
|
|
2649
2786
|
true;`;
|
|
2650
2787
|
}
|
|
2651
2788
|
function handleWebViewMessage(rawData, url) {
|
|
2652
|
-
if (url
|
|
2789
|
+
if (!url || getSwappedOrigin(url) == null) {
|
|
2653
2790
|
return null;
|
|
2654
2791
|
}
|
|
2655
2792
|
let parsed;
|
|
@@ -2700,9 +2837,10 @@ function createWebViewSwappedTransport({
|
|
|
2700
2837
|
}
|
|
2701
2838
|
|
|
2702
2839
|
// src/swapped/SwappedWebView.tsx
|
|
2703
|
-
import { jsx as
|
|
2840
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
2704
2841
|
function SwappedWebView({ url, onMessage, style }) {
|
|
2705
2842
|
const webViewRef = useRef4(null);
|
|
2843
|
+
const lastCommittedUrlRef = useRef4(url);
|
|
2706
2844
|
const { transport, dispatch } = useMemo4(
|
|
2707
2845
|
() => createWebViewSwappedTransport({
|
|
2708
2846
|
getWebView: () => webViewRef.current
|
|
@@ -2736,11 +2874,19 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
2736
2874
|
}),
|
|
2737
2875
|
[transport]
|
|
2738
2876
|
);
|
|
2877
|
+
const handleNavigationStateChange = (navState) => {
|
|
2878
|
+
if (navState.url) {
|
|
2879
|
+
lastCommittedUrlRef.current = navState.url;
|
|
2880
|
+
}
|
|
2881
|
+
};
|
|
2739
2882
|
const handleMessage = (event) => {
|
|
2740
|
-
dispatch(
|
|
2883
|
+
dispatch(
|
|
2884
|
+
event.nativeEvent.data,
|
|
2885
|
+
event.nativeEvent.url || lastCommittedUrlRef.current
|
|
2886
|
+
);
|
|
2741
2887
|
};
|
|
2742
2888
|
const renderLoading = useCallback2(
|
|
2743
|
-
() => /* @__PURE__ */
|
|
2889
|
+
() => /* @__PURE__ */ jsx17(View, { style: [loadingOverlay, { backgroundColor: theme.colors.bgModal }], children: /* @__PURE__ */ jsx17(ActivityIndicator, { color: theme.colors.textSecondary }) }),
|
|
2744
2890
|
[theme.colors.bgModal, theme.colors.textSecondary]
|
|
2745
2891
|
);
|
|
2746
2892
|
const handleError = (event) => {
|
|
@@ -2756,12 +2902,13 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
2756
2902
|
url: event.nativeEvent.url
|
|
2757
2903
|
});
|
|
2758
2904
|
};
|
|
2759
|
-
return /* @__PURE__ */
|
|
2905
|
+
return /* @__PURE__ */ jsx17(
|
|
2760
2906
|
WebView,
|
|
2761
2907
|
{
|
|
2762
2908
|
ref: webViewRef,
|
|
2763
2909
|
source: { uri: url },
|
|
2764
2910
|
onMessage: handleMessage,
|
|
2911
|
+
onNavigationStateChange: handleNavigationStateChange,
|
|
2765
2912
|
onError: handleError,
|
|
2766
2913
|
onHttpError: handleHttpError,
|
|
2767
2914
|
scrollEnabled: false,
|
|
@@ -2793,15 +2940,47 @@ var loadingOverlay = {
|
|
|
2793
2940
|
justifyContent: "center"
|
|
2794
2941
|
};
|
|
2795
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
|
+
|
|
2796
2975
|
// src/swapped/SwappedScreen.tsx
|
|
2797
|
-
import { jsx as
|
|
2976
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2798
2977
|
function SwappedScreen({
|
|
2799
2978
|
url,
|
|
2800
2979
|
onClose,
|
|
2801
2980
|
onBack,
|
|
2802
2981
|
onSuccess
|
|
2803
2982
|
}) {
|
|
2804
|
-
const handleMessage =
|
|
2983
|
+
const handleMessage = useCallback4(
|
|
2805
2984
|
(msg) => {
|
|
2806
2985
|
switch (msg.type) {
|
|
2807
2986
|
case "SWAPPED_GO_BACK":
|
|
@@ -2815,31 +2994,66 @@ function SwappedScreen({
|
|
|
2815
2994
|
logger.info("connect-rn:swapped:transaction_successful");
|
|
2816
2995
|
onSuccess?.();
|
|
2817
2996
|
break;
|
|
2818
|
-
case "SWAPPED_ERROR":
|
|
2819
|
-
logger.warn("connect-rn:swapped:error", {
|
|
2820
|
-
data: JSON.stringify(msg.data ?? {})
|
|
2821
|
-
});
|
|
2822
|
-
break;
|
|
2823
2997
|
default:
|
|
2824
2998
|
break;
|
|
2825
2999
|
}
|
|
2826
3000
|
},
|
|
2827
3001
|
[onBack, onClose, onSuccess]
|
|
2828
3002
|
);
|
|
2829
|
-
return /* @__PURE__ */
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
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]
|
|
2838
3054
|
);
|
|
3055
|
+
return /* @__PURE__ */ jsx20(SwappedScreenShell, { url, onMessage: handleMessage });
|
|
2839
3056
|
}
|
|
2840
|
-
var SHEET_HEIGHT = 550;
|
|
2841
|
-
var sheet3 = { height: SHEET_HEIGHT, overflow: "hidden" };
|
|
2842
|
-
var fill = { flex: 1 };
|
|
2843
3057
|
|
|
2844
3058
|
// src/transfer/availableChains.ts
|
|
2845
3059
|
import {
|
|
@@ -2951,6 +3165,15 @@ function toFopRows(fops, exchangeRates) {
|
|
|
2951
3165
|
};
|
|
2952
3166
|
});
|
|
2953
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
|
+
}
|
|
2954
3177
|
|
|
2955
3178
|
// src/transfer/formatDepositAddress.ts
|
|
2956
3179
|
function formatDepositAddress(address, leading = 6, trailing = 6) {
|
|
@@ -2985,7 +3208,7 @@ import { useMemo as useMemo6 } from "react";
|
|
|
2985
3208
|
|
|
2986
3209
|
// src/identity/IdentityContext.tsx
|
|
2987
3210
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
2988
|
-
import { jsx as
|
|
3211
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
2989
3212
|
function generateSyntheticUserId(apiKey, externalUserId) {
|
|
2990
3213
|
return `${apiKey}|${externalUserId}`;
|
|
2991
3214
|
}
|
|
@@ -3004,7 +3227,7 @@ function FunkitIdentityProvider({
|
|
|
3004
3227
|
identity,
|
|
3005
3228
|
children
|
|
3006
3229
|
}) {
|
|
3007
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsx21(FunkitIdentityContext.Provider, { value: identity, children });
|
|
3008
3231
|
}
|
|
3009
3232
|
function useFunkitIdentity() {
|
|
3010
3233
|
const identity = useContext2(FunkitIdentityContext);
|
|
@@ -3180,15 +3403,358 @@ function useFops({
|
|
|
3180
3403
|
};
|
|
3181
3404
|
}
|
|
3182
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
|
+
|
|
3183
3749
|
// src/transfer/hooks/useSupportedTokens.ts
|
|
3184
3750
|
import { getSupportedAssets } from "@funkit/api-base";
|
|
3185
3751
|
import {
|
|
3186
3752
|
isTransferChainEnabled,
|
|
3187
3753
|
resolveTokenTransferConfig,
|
|
3188
|
-
useDynamicConfig as
|
|
3754
|
+
useDynamicConfig as useDynamicConfig5
|
|
3189
3755
|
} from "@funkit/connect-core";
|
|
3190
|
-
import { useQuery as
|
|
3191
|
-
import { useMemo as
|
|
3756
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
3757
|
+
import { useMemo as useMemo8 } from "react";
|
|
3192
3758
|
|
|
3193
3759
|
// src/transfer/supportedTokens.ts
|
|
3194
3760
|
function buildSupportedTokenList(resolved) {
|
|
@@ -3224,18 +3790,18 @@ function useSupportedTokens({
|
|
|
3224
3790
|
transferInit
|
|
3225
3791
|
} = {}) {
|
|
3226
3792
|
const { apiKey } = useFunkitIdentity();
|
|
3227
|
-
const tokenTransferConfig =
|
|
3228
|
-
const disabledChainAssets =
|
|
3793
|
+
const tokenTransferConfig = useDynamicConfig5("tokentransferconfig");
|
|
3794
|
+
const disabledChainAssets = useDynamicConfig5(
|
|
3229
3795
|
"disabletokentransferchainsandassets"
|
|
3230
3796
|
);
|
|
3231
|
-
const { data, isLoading } =
|
|
3797
|
+
const { data, isLoading } = useQuery6({
|
|
3232
3798
|
queryKey: ["getSupportedAssets", apiKey],
|
|
3233
3799
|
queryFn: ({ queryKey: [, key] }) => getSupportedAssets({ apiKey: key, logger }),
|
|
3234
3800
|
enabled: enabled && !!apiKey,
|
|
3235
3801
|
staleTime: 5 * 6e4,
|
|
3236
3802
|
refetchOnWindowFocus: false
|
|
3237
3803
|
});
|
|
3238
|
-
const { tokens, chainFilters } =
|
|
3804
|
+
const { tokens, chainFilters } = useMemo8(() => {
|
|
3239
3805
|
if (!data) {
|
|
3240
3806
|
return { tokens: [], chainFilters: [{ id: "all", label: "All" }] };
|
|
3241
3807
|
}
|
|
@@ -3264,7 +3830,7 @@ import {
|
|
|
3264
3830
|
getDepositAddressForChain as getDepositAddressForChain2,
|
|
3265
3831
|
getMinTransferValueForChain as getMinTransferValueForChain2,
|
|
3266
3832
|
getTransferTokenQrCodeUri,
|
|
3267
|
-
useDynamicConfig as
|
|
3833
|
+
useDynamicConfig as useDynamicConfig6
|
|
3268
3834
|
} from "@funkit/connect-core";
|
|
3269
3835
|
var DEFAULT_MAX_SLIPPAGE_PERCENT = 0.25;
|
|
3270
3836
|
function resolveBlockchain(chainId) {
|
|
@@ -3290,7 +3856,7 @@ function useTokenTransfer({
|
|
|
3290
3856
|
dynamicRoutingId,
|
|
3291
3857
|
enabled
|
|
3292
3858
|
});
|
|
3293
|
-
const minTransferLimits =
|
|
3859
|
+
const minTransferLimits = useDynamicConfig6("mintokentransfervalue");
|
|
3294
3860
|
const minTransferUsd = selectedChainId !== void 0 ? Math.ceil(
|
|
3295
3861
|
getMinTransferValueForChain2(selectedChainId, minTransferLimits)
|
|
3296
3862
|
) : 0;
|
|
@@ -3311,9 +3877,9 @@ function useTokenTransfer({
|
|
|
3311
3877
|
|
|
3312
3878
|
// src/transfer/QrCode.tsx
|
|
3313
3879
|
import QRCode from "react-native-qrcode-svg";
|
|
3314
|
-
import { jsx as
|
|
3880
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3315
3881
|
function QrCode({ value, size = 220, ecl = "H" }) {
|
|
3316
|
-
return /* @__PURE__ */
|
|
3882
|
+
return /* @__PURE__ */ jsx22(
|
|
3317
3883
|
QRCode,
|
|
3318
3884
|
{
|
|
3319
3885
|
value,
|
|
@@ -3335,9 +3901,9 @@ function getDefaultDynamicTargetAsset(candidates, dynamicRoutingId) {
|
|
|
3335
3901
|
|
|
3336
3902
|
// src/flow/FlowSheet.tsx
|
|
3337
3903
|
import {
|
|
3338
|
-
useCallback as
|
|
3904
|
+
useCallback as useCallback7,
|
|
3339
3905
|
useEffect as useEffect10,
|
|
3340
|
-
useRef as
|
|
3906
|
+
useRef as useRef6
|
|
3341
3907
|
} from "react";
|
|
3342
3908
|
import { View as View2 } from "react-native";
|
|
3343
3909
|
import {
|
|
@@ -3375,22 +3941,22 @@ function useKeyboardHeight(enabled) {
|
|
|
3375
3941
|
}
|
|
3376
3942
|
|
|
3377
3943
|
// src/flow/FlowSheet.tsx
|
|
3378
|
-
import { jsx as
|
|
3944
|
+
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3379
3945
|
function FlowSheet({
|
|
3380
3946
|
isOpen,
|
|
3381
3947
|
session,
|
|
3382
3948
|
onClose,
|
|
3383
|
-
content:
|
|
3949
|
+
content: content3,
|
|
3384
3950
|
children,
|
|
3385
3951
|
keyboardAvoidEnabled = false
|
|
3386
3952
|
}) {
|
|
3387
|
-
const ref =
|
|
3388
|
-
const setRef =
|
|
3953
|
+
const ref = useRef6(null);
|
|
3954
|
+
const setRef = useCallback7((instance) => {
|
|
3389
3955
|
ref.current = instance;
|
|
3390
3956
|
}, []);
|
|
3391
3957
|
const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled);
|
|
3392
|
-
const hasPresented =
|
|
3393
|
-
const sheetSelfDismissed =
|
|
3958
|
+
const hasPresented = useRef6(false);
|
|
3959
|
+
const sheetSelfDismissed = useRef6(false);
|
|
3394
3960
|
useEffect10(() => {
|
|
3395
3961
|
if (isOpen) {
|
|
3396
3962
|
sheetSelfDismissed.current = false;
|
|
@@ -3406,7 +3972,7 @@ function FlowSheet({
|
|
|
3406
3972
|
}
|
|
3407
3973
|
ref.current?.dismiss();
|
|
3408
3974
|
}, [isOpen, session]);
|
|
3409
|
-
const handleDismiss =
|
|
3975
|
+
const handleDismiss = useCallback7(() => {
|
|
3410
3976
|
sheetSelfDismissed.current = true;
|
|
3411
3977
|
onClose();
|
|
3412
3978
|
}, [onClose]);
|
|
@@ -3414,8 +3980,8 @@ function FlowSheet({
|
|
|
3414
3980
|
duration: 300,
|
|
3415
3981
|
easing: Easing4.bezier(0.22, 1, 0.36, 1)
|
|
3416
3982
|
});
|
|
3417
|
-
const renderBackdrop =
|
|
3418
|
-
(props) => /* @__PURE__ */
|
|
3983
|
+
const renderBackdrop = useCallback7(
|
|
3984
|
+
(props) => /* @__PURE__ */ jsx23(
|
|
3419
3985
|
BottomSheetBackdrop,
|
|
3420
3986
|
{
|
|
3421
3987
|
...props,
|
|
@@ -3428,7 +3994,7 @@ function FlowSheet({
|
|
|
3428
3994
|
);
|
|
3429
3995
|
return /* @__PURE__ */ jsxs10(BottomSheetModalProvider, { children: [
|
|
3430
3996
|
children,
|
|
3431
|
-
/* @__PURE__ */
|
|
3997
|
+
/* @__PURE__ */ jsx23(
|
|
3432
3998
|
BottomSheetModal,
|
|
3433
3999
|
{
|
|
3434
4000
|
ref: setRef,
|
|
@@ -3441,8 +4007,8 @@ function FlowSheet({
|
|
|
3441
4007
|
handleComponent: null,
|
|
3442
4008
|
backgroundComponent: FlowSheetBackground,
|
|
3443
4009
|
children: /* @__PURE__ */ jsxs10(BottomSheetView, { children: [
|
|
3444
|
-
|
|
3445
|
-
keyboardHeight > 0 ? /* @__PURE__ */
|
|
4010
|
+
content3,
|
|
4011
|
+
keyboardHeight > 0 ? /* @__PURE__ */ jsx23(View2, { style: { height: keyboardHeight } }) : null
|
|
3446
4012
|
] })
|
|
3447
4013
|
}
|
|
3448
4014
|
)
|
|
@@ -3462,7 +4028,7 @@ function FlowSheetBackground({
|
|
|
3462
4028
|
...bottomExtension,
|
|
3463
4029
|
backgroundColor: theme.colors.bgModal
|
|
3464
4030
|
};
|
|
3465
|
-
return /* @__PURE__ */
|
|
4031
|
+
return /* @__PURE__ */ jsx23(View2, { pointerEvents, style: [style, surface], children: /* @__PURE__ */ jsx23(View2, { style: extension }) });
|
|
3466
4032
|
}
|
|
3467
4033
|
var bottomExtension = {
|
|
3468
4034
|
position: "absolute",
|
|
@@ -3473,12 +4039,11 @@ var bottomExtension = {
|
|
|
3473
4039
|
};
|
|
3474
4040
|
|
|
3475
4041
|
// src/flow/FunkitFlowProvider.tsx
|
|
3476
|
-
import { jsx as
|
|
4042
|
+
import { Fragment as Fragment2, jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3477
4043
|
var CLOSED = {
|
|
3478
4044
|
isOpen: false,
|
|
3479
4045
|
stack: [],
|
|
3480
|
-
|
|
3481
|
-
callbacks: {},
|
|
4046
|
+
flow: null,
|
|
3482
4047
|
session: 0
|
|
3483
4048
|
};
|
|
3484
4049
|
var FunkitFlowContext = createContext3(null);
|
|
@@ -3488,64 +4053,78 @@ function FunkitFlowProvider({
|
|
|
3488
4053
|
}) {
|
|
3489
4054
|
const insets = useSafeAreaInsets();
|
|
3490
4055
|
const [state, setState] = useState9(CLOSED);
|
|
3491
|
-
const beginDeposit =
|
|
4056
|
+
const beginDeposit = useCallback8(
|
|
3492
4057
|
(config, callbacks = {}) => {
|
|
3493
4058
|
callbacks.onOpen?.();
|
|
3494
4059
|
setState((prev) => ({
|
|
3495
4060
|
isOpen: true,
|
|
3496
4061
|
stack: ["addMoney"],
|
|
3497
|
-
config,
|
|
3498
|
-
callbacks,
|
|
4062
|
+
flow: { mode: "deposit", config, callbacks },
|
|
3499
4063
|
session: prev.session + 1
|
|
3500
4064
|
}));
|
|
3501
4065
|
},
|
|
3502
4066
|
[]
|
|
3503
4067
|
);
|
|
3504
|
-
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(() => {
|
|
3505
4081
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3506
4082
|
if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
|
|
3507
4083
|
setCopiedToastShown(false);
|
|
3508
4084
|
setToastMounted(false);
|
|
3509
4085
|
}, []);
|
|
3510
|
-
const closeFlow =
|
|
4086
|
+
const closeFlow = useCallback8(() => {
|
|
3511
4087
|
setState((prev) => {
|
|
3512
4088
|
if (!prev.isOpen) return prev;
|
|
3513
|
-
prev.callbacks.onClose?.();
|
|
4089
|
+
prev.flow?.callbacks.onClose?.();
|
|
3514
4090
|
return CLOSED;
|
|
3515
4091
|
});
|
|
3516
4092
|
clearToast();
|
|
3517
4093
|
}, [clearToast]);
|
|
3518
|
-
const navigate =
|
|
4094
|
+
const navigate = useCallback8((screen) => {
|
|
3519
4095
|
setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }));
|
|
3520
4096
|
}, []);
|
|
3521
|
-
const
|
|
4097
|
+
const reset = useCallback8((screen) => {
|
|
4098
|
+
setState((prev) => prev.isOpen ? { ...prev, stack: [screen] } : prev);
|
|
4099
|
+
}, []);
|
|
4100
|
+
const back = useCallback8(() => {
|
|
3522
4101
|
setState((prev) => {
|
|
3523
4102
|
if (!prev.isOpen) return prev;
|
|
3524
4103
|
if (prev.stack.length <= 1) {
|
|
3525
|
-
prev.callbacks.onClose?.();
|
|
4104
|
+
prev.flow?.callbacks.onClose?.();
|
|
3526
4105
|
return CLOSED;
|
|
3527
4106
|
}
|
|
3528
4107
|
return { ...prev, stack: prev.stack.slice(0, -1) };
|
|
3529
4108
|
});
|
|
3530
4109
|
}, []);
|
|
3531
|
-
const value =
|
|
3532
|
-
() => ({ beginDeposit, closeFlow }),
|
|
3533
|
-
[beginDeposit, closeFlow]
|
|
4110
|
+
const value = useMemo9(
|
|
4111
|
+
() => ({ beginDeposit, beginWithdrawal, closeFlow }),
|
|
4112
|
+
[beginDeposit, beginWithdrawal, closeFlow]
|
|
3534
4113
|
);
|
|
3535
4114
|
const current = state.stack[state.stack.length - 1];
|
|
3536
|
-
const nav =
|
|
3537
|
-
() => ({ navigate, back, closeFlow }),
|
|
3538
|
-
[navigate, back, closeFlow]
|
|
4115
|
+
const nav = useMemo9(
|
|
4116
|
+
() => ({ navigate, back, reset, closeFlow }),
|
|
4117
|
+
[navigate, back, reset, closeFlow]
|
|
3539
4118
|
);
|
|
3540
4119
|
const [toastMounted, setToastMounted] = useState9(false);
|
|
3541
4120
|
const [copiedToastShown, setCopiedToastShown] = useState9(false);
|
|
3542
|
-
const hideTimerRef =
|
|
4121
|
+
const hideTimerRef = useRef7(
|
|
3543
4122
|
void 0
|
|
3544
4123
|
);
|
|
3545
|
-
const unmountTimerRef =
|
|
4124
|
+
const unmountTimerRef = useRef7(
|
|
3546
4125
|
void 0
|
|
3547
4126
|
);
|
|
3548
|
-
const showCopiedToast =
|
|
4127
|
+
const showCopiedToast = useCallback8(() => {
|
|
3549
4128
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
3550
4129
|
if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
|
|
3551
4130
|
setToastMounted(true);
|
|
@@ -3559,8 +4138,8 @@ function FunkitFlowProvider({
|
|
|
3559
4138
|
}, TOAST_VISIBLE_MS);
|
|
3560
4139
|
}, []);
|
|
3561
4140
|
useEffect11(() => () => clearToast(), [clearToast]);
|
|
3562
|
-
return /* @__PURE__ */
|
|
3563
|
-
/* @__PURE__ */
|
|
4141
|
+
return /* @__PURE__ */ jsx24(FunkitFlowContext.Provider, { value, children: /* @__PURE__ */ jsxs11(View3, { style: rootContainer, children: [
|
|
4142
|
+
/* @__PURE__ */ jsx24(
|
|
3564
4143
|
FlowSheet,
|
|
3565
4144
|
{
|
|
3566
4145
|
isOpen: state.isOpen,
|
|
@@ -3568,23 +4147,31 @@ function FunkitFlowProvider({
|
|
|
3568
4147
|
onClose: closeFlow,
|
|
3569
4148
|
keyboardAvoidEnabled: current === "swapped",
|
|
3570
4149
|
content: (
|
|
3571
|
-
// Mounted only while open so the
|
|
3572
|
-
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(
|
|
3573
4152
|
FlowContent,
|
|
3574
4153
|
{
|
|
3575
|
-
config: state.config,
|
|
4154
|
+
config: state.flow.config,
|
|
3576
4155
|
current,
|
|
3577
4156
|
nav,
|
|
3578
4157
|
copyToClipboard: copyToClipboard2,
|
|
3579
4158
|
onCopySuccess: showCopiedToast,
|
|
3580
|
-
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
|
|
3581
4168
|
}
|
|
3582
4169
|
) : null
|
|
3583
4170
|
),
|
|
3584
4171
|
children
|
|
3585
4172
|
}
|
|
3586
4173
|
),
|
|
3587
|
-
toastMounted ? /* @__PURE__ */
|
|
4174
|
+
toastMounted ? /* @__PURE__ */ jsx24(
|
|
3588
4175
|
View3,
|
|
3589
4176
|
{
|
|
3590
4177
|
style: [
|
|
@@ -3592,7 +4179,7 @@ function FunkitFlowProvider({
|
|
|
3592
4179
|
{ paddingTop: insets.top + TOAST_INSET_OFFSET }
|
|
3593
4180
|
],
|
|
3594
4181
|
pointerEvents: "none",
|
|
3595
|
-
children: copiedToastShown ? /* @__PURE__ */
|
|
4182
|
+
children: copiedToastShown ? /* @__PURE__ */ jsx24(AddressCopiedToast, {}) : null
|
|
3596
4183
|
}
|
|
3597
4184
|
) : null
|
|
3598
4185
|
] }) });
|
|
@@ -3650,7 +4237,7 @@ function FlowContent({
|
|
|
3650
4237
|
});
|
|
3651
4238
|
const fetched = useSupportedTokens({ transferInit });
|
|
3652
4239
|
const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters;
|
|
3653
|
-
const depositNetworks =
|
|
4240
|
+
const depositNetworks = useMemo9(
|
|
3654
4241
|
() => buildDepositNetworks(tokenChainFilters),
|
|
3655
4242
|
[tokenChainFilters]
|
|
3656
4243
|
);
|
|
@@ -3658,7 +4245,7 @@ function FlowContent({
|
|
|
3658
4245
|
(n) => n.chainId != null && belongsToNetwork(initialChainId, n.chainId)
|
|
3659
4246
|
);
|
|
3660
4247
|
const selectedChain = depositNetworks.find((n) => n.id === selectedNetworkId) ?? initialNetwork ?? depositNetworks[0];
|
|
3661
|
-
const minTransferLimits =
|
|
4248
|
+
const minTransferLimits = useDynamicConfig7("mintokentransfervalue");
|
|
3662
4249
|
const {
|
|
3663
4250
|
savedFops,
|
|
3664
4251
|
genericFops,
|
|
@@ -3685,7 +4272,7 @@ function FlowContent({
|
|
|
3685
4272
|
const singleChain = availableChains.length === 1 ? availableChains[0] : void 0;
|
|
3686
4273
|
const rawAddress = generatedAddress ?? config.depositAddress;
|
|
3687
4274
|
const displayAddress = rawAddress ? formatDepositAddress(rawAddress) : "Generating\u2026";
|
|
3688
|
-
const copyAddressAndToast =
|
|
4275
|
+
const copyAddressAndToast = useCallback8(
|
|
3689
4276
|
async (value) => {
|
|
3690
4277
|
const ok = await copyToClipboard2(value) !== false;
|
|
3691
4278
|
if (ok) onCopySuccess();
|
|
@@ -3693,6 +4280,31 @@ function FlowContent({
|
|
|
3693
4280
|
},
|
|
3694
4281
|
[copyToClipboard2, onCopySuccess]
|
|
3695
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
|
+
);
|
|
3696
4308
|
const screen = (() => {
|
|
3697
4309
|
switch (current) {
|
|
3698
4310
|
case "addMoney": {
|
|
@@ -3704,8 +4316,8 @@ function FlowContent({
|
|
|
3704
4316
|
id: CRYPTO_METHOD_ID,
|
|
3705
4317
|
title: "Crypto",
|
|
3706
4318
|
subtitle: "No limit",
|
|
3707
|
-
icon: /* @__PURE__ */
|
|
3708
|
-
trailing: cryptoSourceIcons.length ? /* @__PURE__ */
|
|
4319
|
+
icon: /* @__PURE__ */ jsx24(CryptoBitcoinIcon, {}),
|
|
4320
|
+
trailing: cryptoSourceIcons.length ? /* @__PURE__ */ jsx24(
|
|
3709
4321
|
SourceTokenCluster,
|
|
3710
4322
|
{
|
|
3711
4323
|
icons: cryptoSourceIcons,
|
|
@@ -3718,7 +4330,7 @@ function FlowContent({
|
|
|
3718
4330
|
id: row3.id,
|
|
3719
4331
|
title: row3.name,
|
|
3720
4332
|
subtitle: row3.subtitle,
|
|
3721
|
-
icon: /* @__PURE__ */
|
|
4333
|
+
icon: /* @__PURE__ */ jsx24(FunIcon, { uri: row3.iconUri, fallbackUri: FALLBACK_ASSET_LOGO })
|
|
3722
4334
|
}));
|
|
3723
4335
|
const methods = isSwappedEnabled ? [
|
|
3724
4336
|
...toCashRows(savedFops),
|
|
@@ -3730,11 +4342,11 @@ function FlowContent({
|
|
|
3730
4342
|
(c, i) => ({
|
|
3731
4343
|
id: String(i),
|
|
3732
4344
|
label: c.badgeText ? `${c.tokenSymbol} (${c.badgeText})` : c.tokenSymbol,
|
|
3733
|
-
icon: /* @__PURE__ */
|
|
4345
|
+
icon: /* @__PURE__ */ jsx24(TokenChainIcon, { symbol: c.tokenSymbol, iconSrc: c.iconSrc })
|
|
3734
4346
|
})
|
|
3735
4347
|
);
|
|
3736
4348
|
const selectedReceiveTokenId = selectedCandidate && candidates ? String(candidates.indexOf(selectedCandidate)) : void 0;
|
|
3737
|
-
return /* @__PURE__ */
|
|
4349
|
+
return /* @__PURE__ */ jsx24(
|
|
3738
4350
|
SelectMethodScreen,
|
|
3739
4351
|
{
|
|
3740
4352
|
methods,
|
|
@@ -3774,7 +4386,7 @@ function FlowContent({
|
|
|
3774
4386
|
label: chain.label,
|
|
3775
4387
|
iconKeys: chain.iconKeys ?? []
|
|
3776
4388
|
}));
|
|
3777
|
-
return /* @__PURE__ */
|
|
4389
|
+
return /* @__PURE__ */ jsx24(
|
|
3778
4390
|
TransferCryptoScreen,
|
|
3779
4391
|
{
|
|
3780
4392
|
depositAddress: displayAddress,
|
|
@@ -3784,50 +4396,191 @@ function FlowContent({
|
|
|
3784
4396
|
supportedTokenIcons: singleChain ? void 0 : availableChains.length ? availableChains.map((c) => c.iconUri) : selectedChain?.iconKeys ?? [],
|
|
3785
4397
|
minimumDepositLabel: singleChain?.minLabel,
|
|
3786
4398
|
onBack: nav.back,
|
|
3787
|
-
onShowChains: availableChains.length > 1 ? () =>
|
|
3788
|
-
onShowQrCode: () =>
|
|
4399
|
+
onShowChains: availableChains.length > 1 ? () => openNestedScreen("availableChains") : void 0,
|
|
4400
|
+
onShowQrCode: () => openNestedScreen("qrCode"),
|
|
3789
4401
|
onCopyAddress: rawAddress ? () => void copyAddressAndToast(rawAddress) : void 0,
|
|
3790
4402
|
onShareAddress: rawAddress ? () => void Share.share({ message: rawAddress }) : void 0
|
|
3791
4403
|
}
|
|
3792
4404
|
);
|
|
3793
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) {
|
|
3794
4421
|
case "availableChains":
|
|
3795
|
-
return /* @__PURE__ */
|
|
4422
|
+
return /* @__PURE__ */ jsx24(
|
|
3796
4423
|
AvailableChainsScreen,
|
|
3797
4424
|
{
|
|
3798
4425
|
networkLabel: selectedChain?.label ?? "",
|
|
3799
4426
|
chains: availableChains,
|
|
3800
|
-
onClose:
|
|
4427
|
+
onClose: closeNestedScreen
|
|
3801
4428
|
}
|
|
3802
4429
|
);
|
|
3803
4430
|
case "qrCode":
|
|
3804
|
-
return /* @__PURE__ */
|
|
4431
|
+
return /* @__PURE__ */ jsx24(
|
|
3805
4432
|
QrCodeScreen,
|
|
3806
4433
|
{
|
|
3807
|
-
qrCode: config.qrCode ?? (qrCodeUri ? /* @__PURE__ */
|
|
3808
|
-
centerIcon: /* @__PURE__ */
|
|
4434
|
+
qrCode: config.qrCode ?? (qrCodeUri ? /* @__PURE__ */ jsx24(QrCode, { value: qrCodeUri, size: 235 }) : null),
|
|
4435
|
+
centerIcon: /* @__PURE__ */ jsx24(QrChainCluster, { iconKeys: selectedChain?.iconKeys ?? [] }),
|
|
3809
4436
|
address: rawAddress,
|
|
3810
4437
|
onCopyAddress: rawAddress ? () => copyAddressAndToast(rawAddress) : void 0,
|
|
3811
|
-
onClose:
|
|
4438
|
+
onClose: closeNestedScreen
|
|
3812
4439
|
}
|
|
3813
4440
|
);
|
|
3814
|
-
case "swapped":
|
|
3815
|
-
return selectedSwappedUrl ? /* @__PURE__ */ jsx21(
|
|
3816
|
-
SwappedScreen,
|
|
3817
|
-
{
|
|
3818
|
-
url: selectedSwappedUrl,
|
|
3819
|
-
onBack: nav.back,
|
|
3820
|
-
onClose: nav.closeFlow
|
|
3821
|
-
}
|
|
3822
|
-
) : null;
|
|
3823
4441
|
default:
|
|
3824
4442
|
return null;
|
|
3825
4443
|
}
|
|
3826
4444
|
})();
|
|
3827
4445
|
if (isGeoblocked) {
|
|
3828
|
-
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;
|
|
3829
4583
|
}
|
|
3830
|
-
return screen;
|
|
3831
4584
|
}
|
|
3832
4585
|
var TOAST_VISIBLE_MS = 1800;
|
|
3833
4586
|
var TOAST_EXIT_MS = 350;
|
|
@@ -3847,7 +4600,7 @@ function useFunkitFlow() {
|
|
|
3847
4600
|
}
|
|
3848
4601
|
|
|
3849
4602
|
// src/version.ts
|
|
3850
|
-
var CONNECT_RN_VERSION = true ? "2.
|
|
4603
|
+
var CONNECT_RN_VERSION = true ? "2.1.0" : "0.0.0-dev";
|
|
3851
4604
|
|
|
3852
4605
|
// src/providers/FunkitStatsigProvider.tsx
|
|
3853
4606
|
import {
|
|
@@ -3855,7 +4608,7 @@ import {
|
|
|
3855
4608
|
LogLevel,
|
|
3856
4609
|
StatsigProvider
|
|
3857
4610
|
} from "@statsig/react-bindings";
|
|
3858
|
-
import { useMemo as
|
|
4611
|
+
import { useMemo as useMemo10 } from "react";
|
|
3859
4612
|
|
|
3860
4613
|
// src/statsig/useClientAsyncInitRN.ts
|
|
3861
4614
|
import {
|
|
@@ -4040,7 +4793,7 @@ function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
|
|
|
4040
4793
|
}
|
|
4041
4794
|
|
|
4042
4795
|
// src/providers/FunkitStatsigProvider.tsx
|
|
4043
|
-
import { jsx as
|
|
4796
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
4044
4797
|
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
4045
4798
|
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
4046
4799
|
var STATSIG_SDK_TYPE = "react-native";
|
|
@@ -4057,7 +4810,7 @@ function FunkitStatsigProvider({
|
|
|
4057
4810
|
userId,
|
|
4058
4811
|
isDevelopment = false
|
|
4059
4812
|
}) {
|
|
4060
|
-
const user =
|
|
4813
|
+
const user = useMemo10(
|
|
4061
4814
|
() => buildFunkitStatsigUser(userId, apiKey),
|
|
4062
4815
|
[userId, apiKey]
|
|
4063
4816
|
);
|
|
@@ -4076,11 +4829,11 @@ function FunkitStatsigProvider({
|
|
|
4076
4829
|
tier: isDevelopment ? "development" : "production"
|
|
4077
4830
|
}
|
|
4078
4831
|
});
|
|
4079
|
-
return /* @__PURE__ */
|
|
4832
|
+
return /* @__PURE__ */ jsx25(StatsigProvider, { client, children });
|
|
4080
4833
|
}
|
|
4081
4834
|
|
|
4082
4835
|
// src/providers/FunkitProvider.tsx
|
|
4083
|
-
import { jsx as
|
|
4836
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4084
4837
|
var ANONYMOUS_CONFIG = { apiKey: "" };
|
|
4085
4838
|
function createFallbackQueryClient() {
|
|
4086
4839
|
return new QueryClient({
|
|
@@ -4101,10 +4854,10 @@ function FunkitProvider({
|
|
|
4101
4854
|
debug = false,
|
|
4102
4855
|
copyToClipboard: copyToClipboard2
|
|
4103
4856
|
}) {
|
|
4104
|
-
const fallbackClient =
|
|
4857
|
+
const fallbackClient = useRef8(void 0);
|
|
4105
4858
|
fallbackClient.current ??= createFallbackQueryClient();
|
|
4106
4859
|
const client = queryClient ?? fallbackClient.current;
|
|
4107
|
-
const identity =
|
|
4860
|
+
const identity = useMemo11(
|
|
4108
4861
|
() => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
|
|
4109
4862
|
[config, walletAddress]
|
|
4110
4863
|
);
|
|
@@ -4123,26 +4876,30 @@ function FunkitProvider({
|
|
|
4123
4876
|
""
|
|
4124
4877
|
);
|
|
4125
4878
|
}, [identity]);
|
|
4126
|
-
return /* @__PURE__ */
|
|
4879
|
+
return /* @__PURE__ */ jsx26(SafeAreaProvider, { children: /* @__PURE__ */ jsx26(
|
|
4127
4880
|
FunkitStatsigProvider,
|
|
4128
4881
|
{
|
|
4129
4882
|
apiKey: identity.apiKey,
|
|
4130
4883
|
userId: identity.userId,
|
|
4131
4884
|
isDevelopment: debug,
|
|
4132
|
-
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 }) }) }) })
|
|
4133
4886
|
}
|
|
4134
4887
|
) });
|
|
4135
4888
|
}
|
|
4136
4889
|
|
|
4137
4890
|
// src/providers/useFunkitCheckout.ts
|
|
4138
|
-
import { useCallback as
|
|
4891
|
+
import { useCallback as useCallback9 } from "react";
|
|
4139
4892
|
function useFunkitCheckout(callbacks = {}) {
|
|
4140
|
-
const { beginDeposit:
|
|
4141
|
-
const beginDeposit =
|
|
4142
|
-
(config) =>
|
|
4143
|
-
[
|
|
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]
|
|
4144
4901
|
);
|
|
4145
|
-
return { beginDeposit };
|
|
4902
|
+
return { beginDeposit, beginWithdrawal };
|
|
4146
4903
|
}
|
|
4147
4904
|
export {
|
|
4148
4905
|
AddressCopiedToast,
|