@funkit/connect-rn 3.9.0 → 3.10.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 +22 -0
- package/dist/{chunk-PHUM52HD.js → chunk-4QKU6F5D.js} +49 -1
- package/dist/chunk-4QKU6F5D.js.map +7 -0
- package/dist/{chunk-FTD4HETU.js → chunk-THWTURYZ.js} +2 -2
- package/dist/clients/lighter.js +1 -1
- package/dist/clients/nado.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1907 -962
- package/dist/index.js.map +4 -4
- package/dist/src/components/v2/AccountBalanceChip.d.ts +19 -0
- package/dist/src/components/v2/AccountBalanceChip.d.ts.map +1 -0
- package/dist/src/components/v2/AmountDisplay.d.ts +28 -0
- package/dist/src/components/v2/AmountDisplay.d.ts.map +1 -0
- package/dist/src/components/v2/NumPad.d.ts +14 -0
- package/dist/src/components/v2/NumPad.d.ts.map +1 -0
- package/dist/src/components/v2/QuickAmountsRow.d.ts +17 -0
- package/dist/src/components/v2/QuickAmountsRow.d.ts.map +1 -0
- package/dist/src/components/v2/RollingAmount.d.ts +20 -0
- package/dist/src/components/v2/RollingAmount.d.ts.map +1 -0
- package/dist/src/flow/DepositAmountStep.d.ts +12 -0
- package/dist/src/flow/DepositAmountStep.d.ts.map +1 -0
- package/dist/src/flow/DepositFlowContent.d.ts.map +1 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts +1 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/depositFlowConfig.d.ts +42 -0
- package/dist/src/flow/depositFlowConfig.d.ts.map +1 -1
- package/dist/src/haptics/HapticsContext.d.ts +8 -3
- package/dist/src/haptics/HapticsContext.d.ts.map +1 -1
- package/dist/src/haptics/hapticTap.d.ts +7 -1
- package/dist/src/haptics/hapticTap.d.ts.map +1 -1
- package/dist/src/hooks/useGuardedAmountInput.d.ts +25 -0
- package/dist/src/hooks/useGuardedAmountInput.d.ts.map +1 -0
- package/dist/src/screens/DepositAmountScreen.d.ts +47 -0
- package/dist/src/screens/DepositAmountScreen.d.ts.map +1 -0
- package/dist/src/transfer/fops.d.ts +5 -0
- package/dist/src/transfer/fops.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useFops.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useWithdrawalFops.d.ts.map +1 -1
- package/dist/src/utils/motion.d.ts +13 -0
- package/dist/src/utils/motion.d.ts.map +1 -1
- package/dist/src/utils/v2/amountGlyphs.d.ts +21 -0
- package/dist/src/utils/v2/amountGlyphs.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/chunk-PHUM52HD.js.map +0 -7
- /package/dist/{chunk-FTD4HETU.js.map → chunk-THWTURYZ.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
useIsStablecoin,
|
|
4
4
|
useSourceTokenUsdPrice,
|
|
5
5
|
useUserIpInfo
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-THWTURYZ.js";
|
|
7
7
|
import {
|
|
8
8
|
FunkitI18nProvider,
|
|
9
9
|
FunkitIdentityProvider,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
resolveFunkitIdentity,
|
|
15
15
|
useFunkitIdentity,
|
|
16
16
|
useFunkitTranslation
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-4QKU6F5D.js";
|
|
18
18
|
|
|
19
19
|
// src/theme/tokens.ts
|
|
20
20
|
function fontFamilyForWeight(family, styleName) {
|
|
@@ -460,16 +460,17 @@ function useFunkitColorScheme() {
|
|
|
460
460
|
|
|
461
461
|
// src/providers/FunkitProvider.tsx
|
|
462
462
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
463
|
-
import { useEffect as
|
|
463
|
+
import { useEffect as useEffect25, useMemo as useMemo14, useRef as useRef19 } from "react";
|
|
464
464
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
465
465
|
|
|
466
466
|
// src/flow/FunkitFlowProvider.tsx
|
|
467
|
+
import { useFeatureGate as useFeatureGate3 } from "@funkit/connect-core";
|
|
467
468
|
import {
|
|
468
469
|
createContext as createContext3,
|
|
469
470
|
useCallback as useCallback15,
|
|
470
471
|
useContext as useContext3,
|
|
471
472
|
useMemo as useMemo12,
|
|
472
|
-
useState as
|
|
473
|
+
useState as useState25
|
|
473
474
|
} from "react";
|
|
474
475
|
import { View as View9 } from "react-native";
|
|
475
476
|
|
|
@@ -524,9 +525,9 @@ async function pasteFromClipboard() {
|
|
|
524
525
|
// src/flow/DepositFlowContent.tsx
|
|
525
526
|
import { BottomSheetModal as BottomSheetModal2, BottomSheetView as BottomSheetView2 } from "@gorhom/bottom-sheet";
|
|
526
527
|
import { useStatsigClient } from "@statsig/react-bindings";
|
|
527
|
-
import { useCallback as
|
|
528
|
+
import { useCallback as useCallback8, useEffect as useEffect19, useState as useState13 } from "react";
|
|
528
529
|
import { Share } from "react-native";
|
|
529
|
-
import { useSafeAreaInsets as
|
|
530
|
+
import { useSafeAreaInsets as useSafeAreaInsets6 } from "react-native-safe-area-context";
|
|
530
531
|
|
|
531
532
|
// src/geo/useCheckoutBlocked.ts
|
|
532
533
|
import { useEffect as useEffect2, useMemo as useMemo3 } from "react";
|
|
@@ -3545,6 +3546,13 @@ import {
|
|
|
3545
3546
|
FormOfPaymentType
|
|
3546
3547
|
} from "@funkit/api-base";
|
|
3547
3548
|
import { getFopsLimit, getFormOfPaymentDisplayName } from "@funkit/connect-core";
|
|
3549
|
+
import { Platform } from "react-native";
|
|
3550
|
+
function excludeUnsupportedPlatformFops(fops) {
|
|
3551
|
+
if (Platform.OS === "ios" || Platform.OS === "macos") {
|
|
3552
|
+
return fops;
|
|
3553
|
+
}
|
|
3554
|
+
return fops.filter((fop) => fop.fopType !== FormOfPaymentType.APPLE_PAY);
|
|
3555
|
+
}
|
|
3548
3556
|
function toFopRows(t, fops, exchangeRates) {
|
|
3549
3557
|
return fops.map((fop) => {
|
|
3550
3558
|
const limit = getFopsLimit(fop, exchangeRates);
|
|
@@ -3919,11 +3927,11 @@ function useDoFetchFops({
|
|
|
3919
3927
|
});
|
|
3920
3928
|
return {
|
|
3921
3929
|
genericFormsOfPayments: sortFops(
|
|
3922
|
-
response.genericFormsOfPayments,
|
|
3930
|
+
excludeUnsupportedPlatformFops(response.genericFormsOfPayments),
|
|
3923
3931
|
fopPriority
|
|
3924
3932
|
),
|
|
3925
3933
|
savedFormsOfPayments: sortFops(
|
|
3926
|
-
response.savedFormsOfPayments,
|
|
3934
|
+
excludeUnsupportedPlatformFops(response.savedFormsOfPayments),
|
|
3927
3935
|
fopPriority
|
|
3928
3936
|
)
|
|
3929
3937
|
};
|
|
@@ -4075,258 +4083,1343 @@ function QrCode({ value, size = 220, ecl = "H" }) {
|
|
|
4075
4083
|
);
|
|
4076
4084
|
}
|
|
4077
4085
|
|
|
4078
|
-
// src/flow/
|
|
4079
|
-
|
|
4080
|
-
if (!candidates?.length) {
|
|
4081
|
-
return void 0;
|
|
4082
|
-
}
|
|
4083
|
-
if (candidates.length === 1) {
|
|
4084
|
-
return candidates[0];
|
|
4085
|
-
}
|
|
4086
|
-
const routingId = dynamicRoutingId ?? "";
|
|
4087
|
-
return candidates.find((c) => c.dynamicRoutingId === routingId) ?? candidates.find((c) => c.isDefault) ?? candidates[0];
|
|
4088
|
-
}
|
|
4086
|
+
// src/flow/DepositAmountStep.tsx
|
|
4087
|
+
import { useEffect as useEffect15, useState as useState11 } from "react";
|
|
4089
4088
|
|
|
4090
|
-
// src/
|
|
4091
|
-
import {
|
|
4092
|
-
|
|
4093
|
-
useEffect as useEffect14,
|
|
4094
|
-
useRef as useRef9
|
|
4095
|
-
} from "react";
|
|
4096
|
-
import { StyleSheet as StyleSheet9, View as View4 } from "react-native";
|
|
4097
|
-
import {
|
|
4098
|
-
BottomSheetBackdrop as BottomSheetBackdrop2,
|
|
4099
|
-
BottomSheetModal,
|
|
4100
|
-
BottomSheetModalProvider,
|
|
4101
|
-
BottomSheetView,
|
|
4102
|
-
useBottomSheetTimingConfigs
|
|
4103
|
-
} from "@gorhom/bottom-sheet";
|
|
4104
|
-
import { Easing as Easing2 } from "react-native-reanimated";
|
|
4089
|
+
// src/screens/DepositAmountScreen.tsx
|
|
4090
|
+
import { StyleSheet as StyleSheet15, useWindowDimensions as useWindowDimensions4 } from "react-native";
|
|
4091
|
+
import Animated7, { Keyframe as Keyframe4 } from "react-native-reanimated";
|
|
4105
4092
|
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
4106
4093
|
|
|
4107
|
-
// src/
|
|
4108
|
-
import {
|
|
4109
|
-
var FULL_HEIGHT_DETENT = ["100%"];
|
|
4110
|
-
function sheetSizing({ fullHeight }) {
|
|
4111
|
-
return fullHeight ? { enableDynamicSizing: false, snapPoints: FULL_HEIGHT_DETENT } : { enableDynamicSizing: true };
|
|
4112
|
-
}
|
|
4113
|
-
var noop = () => {
|
|
4114
|
-
};
|
|
4115
|
-
function useInertScrollableFocus(_register) {
|
|
4116
|
-
useEffect12(noop);
|
|
4117
|
-
}
|
|
4118
|
-
|
|
4119
|
-
// src/flow/useKeyboardHeight.ts
|
|
4120
|
-
import { useEffect as useEffect13, useState as useState10 } from "react";
|
|
4121
|
-
import { Keyboard, Platform } from "react-native";
|
|
4122
|
-
function useKeyboardHeight(enabled) {
|
|
4123
|
-
const [height, setHeight] = useState10(0);
|
|
4124
|
-
useEffect13(() => {
|
|
4125
|
-
if (!enabled) {
|
|
4126
|
-
setHeight(0);
|
|
4127
|
-
return;
|
|
4128
|
-
}
|
|
4129
|
-
const showEvent = Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
4130
|
-
const hideEvent = Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
4131
|
-
const show = Keyboard.addListener(
|
|
4132
|
-
showEvent,
|
|
4133
|
-
(e) => setHeight(e.endCoordinates.height)
|
|
4134
|
-
);
|
|
4135
|
-
const hide = Keyboard.addListener(hideEvent, () => setHeight(0));
|
|
4136
|
-
return () => {
|
|
4137
|
-
show.remove();
|
|
4138
|
-
hide.remove();
|
|
4139
|
-
};
|
|
4140
|
-
}, [enabled]);
|
|
4141
|
-
return height;
|
|
4142
|
-
}
|
|
4143
|
-
|
|
4144
|
-
// src/flow/FlowSheet.tsx
|
|
4094
|
+
// src/components/v2/AccountBalanceChip.tsx
|
|
4095
|
+
import { Pressable as Pressable7, StyleSheet as StyleSheet9 } from "react-native";
|
|
4145
4096
|
import { jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
enableSwipeToDismiss = true,
|
|
4154
|
-
fullHeight = false,
|
|
4155
|
-
renderBackdropBlur
|
|
4097
|
+
var AVATAR_SIZE = 32;
|
|
4098
|
+
function AccountBalanceChip({
|
|
4099
|
+
label,
|
|
4100
|
+
value,
|
|
4101
|
+
avatar,
|
|
4102
|
+
onPress,
|
|
4103
|
+
accessibilityLabel
|
|
4156
4104
|
}) {
|
|
4157
|
-
const ref = useRef9(null);
|
|
4158
|
-
const setRef = useCallback6((instance) => {
|
|
4159
|
-
ref.current = instance;
|
|
4160
|
-
}, []);
|
|
4161
|
-
const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled);
|
|
4162
|
-
const insets = useSafeAreaInsets4();
|
|
4163
4105
|
const theme = useTheme();
|
|
4164
|
-
const
|
|
4165
|
-
const
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
}
|
|
4181
|
-
ref.current?.dismiss();
|
|
4182
|
-
}, [isOpen, session]);
|
|
4183
|
-
const handleDismiss = useCallback6(() => {
|
|
4184
|
-
sheetSelfDismissed.current = true;
|
|
4185
|
-
onClose();
|
|
4186
|
-
}, [onClose]);
|
|
4187
|
-
const animationConfigs = useBottomSheetTimingConfigs({
|
|
4188
|
-
duration: 300,
|
|
4189
|
-
easing: Easing2.bezier(0.22, 1, 0.36, 1)
|
|
4190
|
-
});
|
|
4191
|
-
const renderBackdrop = useCallback6(
|
|
4192
|
-
(props) => /* @__PURE__ */ jsxs11(
|
|
4193
|
-
BottomSheetBackdrop2,
|
|
4194
|
-
{
|
|
4195
|
-
...props,
|
|
4196
|
-
appearsOnIndex: 0,
|
|
4197
|
-
disappearsOnIndex: -1,
|
|
4198
|
-
pressBehavior: "close",
|
|
4199
|
-
opacity: 1,
|
|
4200
|
-
style: backdropContainer,
|
|
4201
|
-
children: [
|
|
4202
|
-
renderBackdropBlur ? /* @__PURE__ */ jsx26(View4, { style: StyleSheet9.absoluteFill, pointerEvents: "none", children: renderBackdropBlur() }) : null,
|
|
4203
|
-
/* @__PURE__ */ jsx26(
|
|
4204
|
-
View4,
|
|
4205
|
-
{
|
|
4206
|
-
style: [scrim2, { backgroundColor: theme.background.overlay }],
|
|
4207
|
-
pointerEvents: "none"
|
|
4208
|
-
}
|
|
4209
|
-
)
|
|
4210
|
-
]
|
|
4211
|
-
}
|
|
4212
|
-
),
|
|
4213
|
-
[renderBackdropBlur, theme.background.overlay]
|
|
4214
|
-
);
|
|
4215
|
-
return /* @__PURE__ */ jsxs11(BottomSheetModalProvider, { children: [
|
|
4216
|
-
children,
|
|
4217
|
-
/* @__PURE__ */ jsx26(
|
|
4218
|
-
BottomSheetModal,
|
|
4219
|
-
{
|
|
4220
|
-
ref: setRef,
|
|
4221
|
-
keyboardBehavior: "extend",
|
|
4222
|
-
enableOverDrag: keyboardHeight === 0,
|
|
4223
|
-
...sheetSizing({ fullHeight }),
|
|
4224
|
-
topInset: fullHeight ? 0 : insets.top,
|
|
4225
|
-
enablePanDownToClose: enableSwipeToDismiss,
|
|
4226
|
-
animationConfigs,
|
|
4227
|
-
onDismiss: handleDismiss,
|
|
4228
|
-
backdropComponent: renderBackdrop,
|
|
4229
|
-
handleComponent: null,
|
|
4230
|
-
backgroundComponent: FlowSheetBackground,
|
|
4231
|
-
children: /* @__PURE__ */ jsxs11(
|
|
4232
|
-
BottomSheetView,
|
|
4106
|
+
const [whole, cents] = splitCents(value);
|
|
4107
|
+
const content2 = /* @__PURE__ */ jsxs11(Box, { flexDirection: "row", alignItems: "center", style: styles9.row, children: [
|
|
4108
|
+
/* @__PURE__ */ jsxs11(Box, { alignItems: "flex-end", children: [
|
|
4109
|
+
/* @__PURE__ */ jsx26(
|
|
4110
|
+
Text,
|
|
4111
|
+
{
|
|
4112
|
+
variant: "detail",
|
|
4113
|
+
numberOfLines: 1,
|
|
4114
|
+
style: { color: theme.content.elements.secondary },
|
|
4115
|
+
children: label
|
|
4116
|
+
}
|
|
4117
|
+
),
|
|
4118
|
+
/* @__PURE__ */ jsxs11(Text, { weight: "medium", numberOfLines: 1, style: styles9.value, children: [
|
|
4119
|
+
whole,
|
|
4120
|
+
cents ? /* @__PURE__ */ jsx26(
|
|
4121
|
+
Text,
|
|
4233
4122
|
{
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
]
|
|
4123
|
+
weight: "medium",
|
|
4124
|
+
style: [
|
|
4125
|
+
styles9.cents,
|
|
4126
|
+
{ color: theme.content.elements.secondary }
|
|
4127
|
+
],
|
|
4128
|
+
children: cents
|
|
4239
4129
|
}
|
|
4240
|
-
)
|
|
4241
|
-
}
|
|
4242
|
-
)
|
|
4130
|
+
) : null
|
|
4131
|
+
] })
|
|
4132
|
+
] }),
|
|
4133
|
+
avatar ? /* @__PURE__ */ jsx26(Box, { style: styles9.avatar, children: avatar }) : null
|
|
4243
4134
|
] });
|
|
4135
|
+
if (!onPress) {
|
|
4136
|
+
return content2;
|
|
4137
|
+
}
|
|
4138
|
+
return /* @__PURE__ */ jsx26(
|
|
4139
|
+
Pressable7,
|
|
4140
|
+
{
|
|
4141
|
+
onPress,
|
|
4142
|
+
accessibilityRole: "button",
|
|
4143
|
+
accessibilityLabel: accessibilityLabel ?? `${label} ${value}`,
|
|
4144
|
+
hitSlop: 8,
|
|
4145
|
+
children: content2
|
|
4146
|
+
}
|
|
4147
|
+
);
|
|
4244
4148
|
}
|
|
4245
|
-
function
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
}
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
var backdropContainer = { backgroundColor: "transparent" };
|
|
4262
|
-
var scrim2 = StyleSheet9.absoluteFill;
|
|
4263
|
-
var bottomExtension = {
|
|
4264
|
-
position: "absolute",
|
|
4265
|
-
top: "100%",
|
|
4266
|
-
left: 0,
|
|
4267
|
-
right: 0,
|
|
4268
|
-
height: 1e3
|
|
4269
|
-
};
|
|
4270
|
-
|
|
4271
|
-
// src/flow/selectedChainStorage.ts
|
|
4272
|
-
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
4273
|
-
var storageKey = (userId) => `funkit.selectedChain.${userId}`;
|
|
4274
|
-
async function readSelectedChainId(userId) {
|
|
4275
|
-
try {
|
|
4276
|
-
return await AsyncStorage.getItem(storageKey(userId));
|
|
4277
|
-
} catch (error) {
|
|
4278
|
-
logger.warn("connect-rn:deposit:chain_read_failed", {
|
|
4279
|
-
error: error instanceof Error ? error.message : String(error)
|
|
4280
|
-
});
|
|
4281
|
-
return null;
|
|
4149
|
+
function splitCents(value) {
|
|
4150
|
+
const point = value.lastIndexOf(".");
|
|
4151
|
+
if (point < 0) {
|
|
4152
|
+
return [value, ""];
|
|
4153
|
+
}
|
|
4154
|
+
return [value.slice(0, point), value.slice(point)];
|
|
4155
|
+
}
|
|
4156
|
+
var styles9 = StyleSheet9.create({
|
|
4157
|
+
row: { gap: 8 },
|
|
4158
|
+
value: { fontSize: 15, lineHeight: 18 },
|
|
4159
|
+
cents: { fontSize: 11, lineHeight: 18 },
|
|
4160
|
+
avatar: {
|
|
4161
|
+
width: AVATAR_SIZE,
|
|
4162
|
+
height: AVATAR_SIZE,
|
|
4163
|
+
borderRadius: 999,
|
|
4164
|
+
overflow: "hidden"
|
|
4282
4165
|
}
|
|
4166
|
+
});
|
|
4167
|
+
|
|
4168
|
+
// src/components/v2/QuickAmountsRow.tsx
|
|
4169
|
+
import { Pressable as Pressable8, StyleSheet as StyleSheet10 } from "react-native";
|
|
4170
|
+
|
|
4171
|
+
// src/haptics/HapticsContext.tsx
|
|
4172
|
+
import { createContext as createContext2, useCallback as useCallback6, useContext as useContext2 } from "react";
|
|
4173
|
+
|
|
4174
|
+
// src/haptics/hapticTap.ts
|
|
4175
|
+
var loading;
|
|
4176
|
+
async function hapticTap(kind = "tap") {
|
|
4177
|
+
loading ??= loadTap();
|
|
4178
|
+
const trigger = await loading;
|
|
4179
|
+
trigger?.(kind);
|
|
4283
4180
|
}
|
|
4284
|
-
async function
|
|
4181
|
+
async function loadTap() {
|
|
4285
4182
|
try {
|
|
4286
|
-
await
|
|
4183
|
+
const { trigger } = await import("react-native-haptic-feedback");
|
|
4184
|
+
return (kind) => trigger(kind === "error" ? "notificationError" : "impactLight");
|
|
4287
4185
|
} catch (error) {
|
|
4288
|
-
logger.
|
|
4289
|
-
|
|
4290
|
-
error: error instanceof Error ? error.message : String(error)
|
|
4291
|
-
|
|
4186
|
+
logger.info(
|
|
4187
|
+
"connect-rn: taps are silent \u2014 install react-native-haptic-feedback, or pass FunkitProvider `hapticFeedback` to use your own haptics module (e.g. expo-haptics in Expo Go).",
|
|
4188
|
+
{ error: error instanceof Error ? error.message : String(error) }
|
|
4189
|
+
);
|
|
4190
|
+
return null;
|
|
4292
4191
|
}
|
|
4293
4192
|
}
|
|
4294
4193
|
|
|
4295
|
-
// src/
|
|
4296
|
-
import {
|
|
4297
|
-
var
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
};
|
|
4302
|
-
var CRYPTO_METHOD_ID = "crypto";
|
|
4303
|
-
function FlowContent({
|
|
4304
|
-
config,
|
|
4305
|
-
current,
|
|
4306
|
-
nav,
|
|
4307
|
-
copyToClipboard: copyToClipboard2,
|
|
4308
|
-
onCopySuccess,
|
|
4309
|
-
callbacks
|
|
4194
|
+
// src/haptics/HapticsContext.tsx
|
|
4195
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
4196
|
+
var HapticsContext = createContext2(hapticTap);
|
|
4197
|
+
function FunkitHapticsProvider({
|
|
4198
|
+
hapticFeedback = hapticTap,
|
|
4199
|
+
children
|
|
4310
4200
|
}) {
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
|
|
4325
|
-
|
|
4326
|
-
|
|
4327
|
-
|
|
4328
|
-
|
|
4329
|
-
|
|
4201
|
+
return /* @__PURE__ */ jsx27(HapticsContext.Provider, { value: hapticFeedback, children });
|
|
4202
|
+
}
|
|
4203
|
+
var hasWarned = false;
|
|
4204
|
+
function useHapticFeedback() {
|
|
4205
|
+
const haptic = useContext2(HapticsContext);
|
|
4206
|
+
return useCallback6(
|
|
4207
|
+
(kind) => {
|
|
4208
|
+
const warn2 = (error) => {
|
|
4209
|
+
if (hasWarned) {
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
hasWarned = true;
|
|
4213
|
+
logger.warn("connect-rn: haptic feedback failed; taps will be silent", {
|
|
4214
|
+
error: error.message
|
|
4215
|
+
});
|
|
4216
|
+
};
|
|
4217
|
+
try {
|
|
4218
|
+
Promise.resolve(haptic(kind)).catch(
|
|
4219
|
+
(error) => warn2(error instanceof Error ? error : new Error(String(error)))
|
|
4220
|
+
);
|
|
4221
|
+
} catch (error) {
|
|
4222
|
+
warn2(error instanceof Error ? error : new Error(String(error)));
|
|
4223
|
+
}
|
|
4224
|
+
},
|
|
4225
|
+
[haptic]
|
|
4226
|
+
);
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
// src/components/v2/QuickAmountsRow.tsx
|
|
4230
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4231
|
+
function QuickAmountsRow({ options, onSelect }) {
|
|
4232
|
+
const theme = useTheme();
|
|
4233
|
+
const haptic = useHapticFeedback();
|
|
4234
|
+
return /* @__PURE__ */ jsx28(Box, { flexDirection: "row", style: styles10.row, children: options.map(({ value, label }) => /* @__PURE__ */ jsx28(
|
|
4235
|
+
Pressable8,
|
|
4236
|
+
{
|
|
4237
|
+
accessibilityRole: "button",
|
|
4238
|
+
accessibilityLabel: label,
|
|
4239
|
+
onPress: () => {
|
|
4240
|
+
haptic();
|
|
4241
|
+
onSelect(value);
|
|
4242
|
+
},
|
|
4243
|
+
style: styles10.share,
|
|
4244
|
+
children: /* @__PURE__ */ jsx28(
|
|
4245
|
+
Box,
|
|
4246
|
+
{
|
|
4247
|
+
borderRadius: "element",
|
|
4248
|
+
style: [
|
|
4249
|
+
styles10.chip,
|
|
4250
|
+
{ backgroundColor: theme.background.button.secondary.default }
|
|
4251
|
+
],
|
|
4252
|
+
children: /* @__PURE__ */ jsx28(Text, { variant: "bodyMedium", numberOfLines: 1, children: label })
|
|
4253
|
+
}
|
|
4254
|
+
)
|
|
4255
|
+
},
|
|
4256
|
+
value
|
|
4257
|
+
)) });
|
|
4258
|
+
}
|
|
4259
|
+
var styles10 = StyleSheet10.create({
|
|
4260
|
+
row: { gap: 12 },
|
|
4261
|
+
share: { flex: 1 },
|
|
4262
|
+
chip: {
|
|
4263
|
+
height: 48,
|
|
4264
|
+
alignItems: "center",
|
|
4265
|
+
justifyContent: "center",
|
|
4266
|
+
paddingHorizontal: 4
|
|
4267
|
+
}
|
|
4268
|
+
});
|
|
4269
|
+
|
|
4270
|
+
// src/components/v2/AmountDisplay.tsx
|
|
4271
|
+
import { useEffect as useEffect12, useRef as useRef9 } from "react";
|
|
4272
|
+
import {
|
|
4273
|
+
StyleSheet as StyleSheet11,
|
|
4274
|
+
useWindowDimensions as useWindowDimensions3
|
|
4275
|
+
} from "react-native";
|
|
4276
|
+
import Animated4, {
|
|
4277
|
+
Easing as Easing3,
|
|
4278
|
+
Keyframe as Keyframe3,
|
|
4279
|
+
useAnimatedStyle as useAnimatedStyle2,
|
|
4280
|
+
useSharedValue as useSharedValue2,
|
|
4281
|
+
withTiming as withTiming2
|
|
4282
|
+
} from "react-native-reanimated";
|
|
4283
|
+
|
|
4284
|
+
// src/utils/v2/amountGlyphs.ts
|
|
4285
|
+
var GROUP_SEPARATOR = ",";
|
|
4286
|
+
function amountGlyphs(value, prefix) {
|
|
4287
|
+
const glyphs = [];
|
|
4288
|
+
if (prefix) {
|
|
4289
|
+
glyphs.push({ key: "prefix", char: prefix, kind: "prefix" });
|
|
4290
|
+
}
|
|
4291
|
+
if (value === "") {
|
|
4292
|
+
glyphs.push({ key: "placeholder", char: "0", kind: "placeholder" });
|
|
4293
|
+
return glyphs;
|
|
4294
|
+
}
|
|
4295
|
+
const chars = [...value];
|
|
4296
|
+
const totalDigits = chars.filter((c) => c !== GROUP_SEPARATOR).length;
|
|
4297
|
+
let digitIndex = 0;
|
|
4298
|
+
for (const [index, char] of chars.entries()) {
|
|
4299
|
+
if (char === GROUP_SEPARATOR) {
|
|
4300
|
+
glyphs.push({
|
|
4301
|
+
key: `separator-${integerDigitsRightOf(chars, index)}-${totalDigits}`,
|
|
4302
|
+
char,
|
|
4303
|
+
kind: "separator"
|
|
4304
|
+
});
|
|
4305
|
+
continue;
|
|
4306
|
+
}
|
|
4307
|
+
glyphs.push({ key: `digit-${digitIndex}`, char, kind: "digit" });
|
|
4308
|
+
digitIndex += 1;
|
|
4309
|
+
}
|
|
4310
|
+
return glyphs;
|
|
4311
|
+
}
|
|
4312
|
+
function integerDigitsRightOf(chars, index) {
|
|
4313
|
+
let count = 0;
|
|
4314
|
+
for (let i = index + 1; i < chars.length; i += 1) {
|
|
4315
|
+
if (chars[i] === ".") {
|
|
4316
|
+
break;
|
|
4317
|
+
}
|
|
4318
|
+
if (chars[i] !== GROUP_SEPARATOR) {
|
|
4319
|
+
count += 1;
|
|
4320
|
+
}
|
|
4321
|
+
}
|
|
4322
|
+
return count;
|
|
4323
|
+
}
|
|
4324
|
+
|
|
4325
|
+
// src/utils/motion.ts
|
|
4326
|
+
import { Easing as Easing2, Keyframe as Keyframe2, LinearTransition } from "react-native-reanimated";
|
|
4327
|
+
var MOTION_DURATION = 180;
|
|
4328
|
+
var MOTION_EASING = Easing2.bezier(0.33, 1, 0.68, 1);
|
|
4329
|
+
var GLYPH_LAYOUT = LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING);
|
|
4330
|
+
var DIGIT_ENTER_SCALE = 0.5;
|
|
4331
|
+
var DIGIT_TRAVEL_RATIO = 0.4;
|
|
4332
|
+
var DIGIT_STAGGER = 40;
|
|
4333
|
+
function digitKeyframes(travel, delay = 0) {
|
|
4334
|
+
return {
|
|
4335
|
+
entering: new Keyframe2({
|
|
4336
|
+
0: {
|
|
4337
|
+
opacity: 0,
|
|
4338
|
+
transform: [{ translateY: travel }, { scale: DIGIT_ENTER_SCALE }]
|
|
4339
|
+
},
|
|
4340
|
+
100: {
|
|
4341
|
+
opacity: 1,
|
|
4342
|
+
transform: [{ translateY: 0 }, { scale: 1 }],
|
|
4343
|
+
easing: MOTION_EASING
|
|
4344
|
+
}
|
|
4345
|
+
}).duration(MOTION_DURATION).delay(delay),
|
|
4346
|
+
exiting: new Keyframe2({
|
|
4347
|
+
0: { opacity: 1, transform: [{ translateY: 0 }, { scale: 1 }] },
|
|
4348
|
+
100: {
|
|
4349
|
+
opacity: 0,
|
|
4350
|
+
transform: [{ translateY: travel }, { scale: DIGIT_ENTER_SCALE }],
|
|
4351
|
+
easing: MOTION_EASING
|
|
4352
|
+
}
|
|
4353
|
+
}).duration(MOTION_DURATION)
|
|
4354
|
+
};
|
|
4355
|
+
}
|
|
4356
|
+
|
|
4357
|
+
// src/components/v2/AmountDisplay.tsx
|
|
4358
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
4359
|
+
var AMOUNT_FONT_SIZE = 96;
|
|
4360
|
+
var PLACEHOLDER_OPACITY = 0.2;
|
|
4361
|
+
var LINE_HEIGHT = 120;
|
|
4362
|
+
var LETTER_SPACING = -1.44;
|
|
4363
|
+
var CAP_BOX = 68;
|
|
4364
|
+
var GUTTER = 48;
|
|
4365
|
+
var NARROW_GUTTER = 32;
|
|
4366
|
+
var NARROW_DEVICE_WIDTH = 380;
|
|
4367
|
+
var MIN_SCALE = 12 / 96;
|
|
4368
|
+
var WARNING_COLOR = "#FFF530";
|
|
4369
|
+
var WARNING_GLOW = {
|
|
4370
|
+
textShadowColor: "rgba(255, 132, 0, 0.4)",
|
|
4371
|
+
textShadowOffset: { width: 0, height: 0 },
|
|
4372
|
+
textShadowRadius: 19.5
|
|
4373
|
+
};
|
|
4374
|
+
var AnimatedBox = Animated4.createAnimatedComponent(Box);
|
|
4375
|
+
var AnimatedText = Animated4.createAnimatedComponent(Text);
|
|
4376
|
+
var DIGIT_TRAVEL = LINE_HEIGHT * DIGIT_TRAVEL_RATIO;
|
|
4377
|
+
var SEPARATOR_ENTER_EASING = Easing3.bezier(0.65, 0, 0.35, 1);
|
|
4378
|
+
var MOTIONS = {
|
|
4379
|
+
digit: digitKeyframes(DIGIT_TRAVEL),
|
|
4380
|
+
separator: {
|
|
4381
|
+
entering: new Keyframe3({
|
|
4382
|
+
0: { opacity: 0, transform: [{ translateY: DIGIT_TRAVEL }] },
|
|
4383
|
+
100: {
|
|
4384
|
+
opacity: 1,
|
|
4385
|
+
transform: [{ translateY: 0 }],
|
|
4386
|
+
easing: SEPARATOR_ENTER_EASING
|
|
4387
|
+
}
|
|
4388
|
+
}).duration(MOTION_DURATION),
|
|
4389
|
+
exiting: new Keyframe3({
|
|
4390
|
+
0: { opacity: 1, transform: [{ translateY: 0 }] },
|
|
4391
|
+
100: {
|
|
4392
|
+
opacity: 0,
|
|
4393
|
+
transform: [{ translateY: DIGIT_TRAVEL }],
|
|
4394
|
+
easing: MOTION_EASING
|
|
4395
|
+
}
|
|
4396
|
+
}).duration(MOTION_DURATION)
|
|
4397
|
+
},
|
|
4398
|
+
above: slideKeyframes(-LINE_HEIGHT)
|
|
4399
|
+
};
|
|
4400
|
+
function fitScale(measured, available) {
|
|
4401
|
+
if (measured <= 0) {
|
|
4402
|
+
return 1;
|
|
4403
|
+
}
|
|
4404
|
+
return Math.max(MIN_SCALE, Math.min(1, available / measured));
|
|
4405
|
+
}
|
|
4406
|
+
function AmountDisplay({
|
|
4407
|
+
value,
|
|
4408
|
+
prefix = "$",
|
|
4409
|
+
hasError = false,
|
|
4410
|
+
hasWarning = false,
|
|
4411
|
+
accessibilityLabel
|
|
4412
|
+
}) {
|
|
4413
|
+
const theme = useTheme();
|
|
4414
|
+
const { width } = useWindowDimensions3();
|
|
4415
|
+
const isEmpty = value === "";
|
|
4416
|
+
const hasEverTyped = useRef9(false);
|
|
4417
|
+
if (!isEmpty) {
|
|
4418
|
+
hasEverTyped.current = true;
|
|
4419
|
+
}
|
|
4420
|
+
const placeholderOpacity = hasEverTyped.current ? 1 : PLACEHOLDER_OPACITY;
|
|
4421
|
+
const glyphs = amountGlyphs(value, prefix);
|
|
4422
|
+
const text = glyphs.map((glyph) => glyph.char).join("");
|
|
4423
|
+
const staggerOf = useMountStagger(glyphs);
|
|
4424
|
+
const { onRowLayout, rowScaling } = useFittedRowScale(width);
|
|
4425
|
+
const prefixDimming = usePrefixDimming(isEmpty ? placeholderOpacity : 1);
|
|
4426
|
+
const color = amountColor(theme, { hasError, hasWarning });
|
|
4427
|
+
return (
|
|
4428
|
+
// The window the characters slide through. What it clips is the dead space
|
|
4429
|
+
// the margin takes back, never the glyphs.
|
|
4430
|
+
/* @__PURE__ */ jsx29(
|
|
4431
|
+
Box,
|
|
4432
|
+
{
|
|
4433
|
+
accessible: true,
|
|
4434
|
+
accessibilityLabel,
|
|
4435
|
+
accessibilityValue: { text },
|
|
4436
|
+
style: [styles11.row, { marginVertical: -(LINE_HEIGHT - CAP_BOX) / 2 }],
|
|
4437
|
+
children: /* @__PURE__ */ jsx29(AnimatedBox, { layout: GLYPH_LAYOUT, onLayout: onRowLayout, children: /* @__PURE__ */ jsx29(AnimatedBox, { style: [styles11.measuredRow, rowScaling], children: glyphs.map(({ key, char, kind }) => /* @__PURE__ */ jsx29(
|
|
4438
|
+
AnimatedBox,
|
|
4439
|
+
{
|
|
4440
|
+
entering: glyphMotion(kind, isEmpty) === "digit" ? digitKeyframes(DIGIT_TRAVEL, staggerOf(key)).entering : MOTIONS[glyphMotion(kind, isEmpty)].entering,
|
|
4441
|
+
exiting: MOTIONS[glyphMotion(kind, isEmpty)].exiting,
|
|
4442
|
+
layout: GLYPH_LAYOUT,
|
|
4443
|
+
children: /* @__PURE__ */ jsx29(
|
|
4444
|
+
AnimatedText,
|
|
4445
|
+
{
|
|
4446
|
+
weight: "medium",
|
|
4447
|
+
numberOfLines: 1,
|
|
4448
|
+
style: [
|
|
4449
|
+
styles11.glyph,
|
|
4450
|
+
{
|
|
4451
|
+
color,
|
|
4452
|
+
opacity: kind === "placeholder" ? placeholderOpacity : 1
|
|
4453
|
+
},
|
|
4454
|
+
hasWarning ? WARNING_GLOW : null,
|
|
4455
|
+
kind === "prefix" ? prefixDimming : null
|
|
4456
|
+
],
|
|
4457
|
+
children: char
|
|
4458
|
+
}
|
|
4459
|
+
)
|
|
4460
|
+
},
|
|
4461
|
+
key
|
|
4462
|
+
)) }) })
|
|
4463
|
+
}
|
|
4464
|
+
)
|
|
4465
|
+
);
|
|
4466
|
+
}
|
|
4467
|
+
function useMountStagger(glyphs) {
|
|
4468
|
+
const previousKeys = useRef9(/* @__PURE__ */ new Set());
|
|
4469
|
+
const mountingKeys = glyphs.filter(({ key }) => !previousKeys.current.has(key)).map(({ key }) => key);
|
|
4470
|
+
useEffect12(() => {
|
|
4471
|
+
previousKeys.current = new Set(glyphs.map(({ key }) => key));
|
|
4472
|
+
});
|
|
4473
|
+
return (key) => mountingKeys.length > 1 ? Math.max(0, mountingKeys.indexOf(key)) * DIGIT_STAGGER : 0;
|
|
4474
|
+
}
|
|
4475
|
+
function useFittedRowScale(windowWidth) {
|
|
4476
|
+
const gutter = windowWidth <= NARROW_DEVICE_WIDTH ? NARROW_GUTTER : GUTTER;
|
|
4477
|
+
const available = windowWidth - gutter * 2;
|
|
4478
|
+
const scale = useSharedValue2(1);
|
|
4479
|
+
const onRowLayout = (event) => {
|
|
4480
|
+
scale.value = withTiming2(
|
|
4481
|
+
fitScale(event.nativeEvent.layout.width, available),
|
|
4482
|
+
{ duration: MOTION_DURATION, easing: MOTION_EASING }
|
|
4483
|
+
);
|
|
4484
|
+
};
|
|
4485
|
+
const rowScaling = useAnimatedStyle2(() => {
|
|
4486
|
+
"worklet";
|
|
4487
|
+
return { transform: [{ scale: scale.value }] };
|
|
4488
|
+
});
|
|
4489
|
+
return { onRowLayout, rowScaling };
|
|
4490
|
+
}
|
|
4491
|
+
function usePrefixDimming(targetOpacity) {
|
|
4492
|
+
return useAnimatedStyle2(() => {
|
|
4493
|
+
"worklet";
|
|
4494
|
+
return {
|
|
4495
|
+
opacity: withTiming2(targetOpacity, {
|
|
4496
|
+
duration: MOTION_DURATION,
|
|
4497
|
+
easing: MOTION_EASING
|
|
4498
|
+
})
|
|
4499
|
+
};
|
|
4500
|
+
});
|
|
4501
|
+
}
|
|
4502
|
+
function amountColor(theme, { hasError, hasWarning }) {
|
|
4503
|
+
if (hasWarning) {
|
|
4504
|
+
return WARNING_COLOR;
|
|
4505
|
+
}
|
|
4506
|
+
if (hasError) {
|
|
4507
|
+
return theme.content.elements.error;
|
|
4508
|
+
}
|
|
4509
|
+
return theme.content.elements.primary;
|
|
4510
|
+
}
|
|
4511
|
+
function glyphMotion(kind, isEmpty) {
|
|
4512
|
+
if (kind === "placeholder") {
|
|
4513
|
+
return "above";
|
|
4514
|
+
}
|
|
4515
|
+
if (kind === "prefix" && isEmpty) {
|
|
4516
|
+
return "above";
|
|
4517
|
+
}
|
|
4518
|
+
if (kind === "separator") {
|
|
4519
|
+
return "separator";
|
|
4520
|
+
}
|
|
4521
|
+
return "digit";
|
|
4522
|
+
}
|
|
4523
|
+
function slideKeyframes(offset) {
|
|
4524
|
+
return {
|
|
4525
|
+
entering: new Keyframe3({
|
|
4526
|
+
0: { transform: [{ translateY: offset }] },
|
|
4527
|
+
100: { transform: [{ translateY: 0 }], easing: MOTION_EASING }
|
|
4528
|
+
}).duration(MOTION_DURATION),
|
|
4529
|
+
exiting: new Keyframe3({
|
|
4530
|
+
0: { transform: [{ translateY: 0 }] },
|
|
4531
|
+
100: { transform: [{ translateY: offset }], easing: MOTION_EASING }
|
|
4532
|
+
}).duration(MOTION_DURATION)
|
|
4533
|
+
};
|
|
4534
|
+
}
|
|
4535
|
+
var styles11 = StyleSheet11.create({
|
|
4536
|
+
row: {
|
|
4537
|
+
flexDirection: "row",
|
|
4538
|
+
justifyContent: "center",
|
|
4539
|
+
alignSelf: "stretch",
|
|
4540
|
+
overflow: "hidden"
|
|
4541
|
+
},
|
|
4542
|
+
measuredRow: { flexDirection: "row" },
|
|
4543
|
+
glyph: {
|
|
4544
|
+
fontSize: AMOUNT_FONT_SIZE,
|
|
4545
|
+
lineHeight: LINE_HEIGHT,
|
|
4546
|
+
letterSpacing: LETTER_SPACING
|
|
4547
|
+
}
|
|
4548
|
+
});
|
|
4549
|
+
|
|
4550
|
+
// src/components/v2/NumPad.tsx
|
|
4551
|
+
import { Pressable as Pressable9, StyleSheet as StyleSheet12 } from "react-native";
|
|
4552
|
+
import Animated5, {
|
|
4553
|
+
useAnimatedStyle as useAnimatedStyle3,
|
|
4554
|
+
useSharedValue as useSharedValue3,
|
|
4555
|
+
withSpring,
|
|
4556
|
+
withTiming as withTiming3
|
|
4557
|
+
} from "react-native-reanimated";
|
|
4558
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
4559
|
+
var KEY_FONT_SIZE = 24;
|
|
4560
|
+
var COLUMN_ALIGNMENT = ["flex-start", "center", "flex-end"];
|
|
4561
|
+
var KEY_PRESS_SCALE = 2.3;
|
|
4562
|
+
var KEY_PRESS_IN_DURATION = 80;
|
|
4563
|
+
var KEY_RELEASE_SPRING = {
|
|
4564
|
+
damping: 14,
|
|
4565
|
+
stiffness: 320,
|
|
4566
|
+
mass: 0.5
|
|
4567
|
+
};
|
|
4568
|
+
var ROWS = [
|
|
4569
|
+
["1", "2", "3"],
|
|
4570
|
+
["4", "5", "6"],
|
|
4571
|
+
["7", "8", "9"],
|
|
4572
|
+
[".", "0", "backspace"]
|
|
4573
|
+
];
|
|
4574
|
+
var OUTER_HIT_SLOP = 16;
|
|
4575
|
+
function keyHitSlop(row2, column, lastRow) {
|
|
4576
|
+
return {
|
|
4577
|
+
top: row2 === 0 ? OUTER_HIT_SLOP : 0,
|
|
4578
|
+
bottom: row2 === lastRow ? OUTER_HIT_SLOP : 0,
|
|
4579
|
+
left: column === 0 ? OUTER_HIT_SLOP : 0,
|
|
4580
|
+
right: column === 2 ? OUTER_HIT_SLOP : 0
|
|
4581
|
+
};
|
|
4582
|
+
}
|
|
4583
|
+
var AnimatedBox2 = Animated5.createAnimatedComponent(Box);
|
|
4584
|
+
function NumPad({
|
|
4585
|
+
onPressKey,
|
|
4586
|
+
backspaceAccessibilityLabel
|
|
4587
|
+
}) {
|
|
4588
|
+
const theme = useTheme();
|
|
4589
|
+
const haptic = useHapticFeedback();
|
|
4590
|
+
return /* @__PURE__ */ jsx30(Box, { flex: 1, children: ROWS.map((row2, rowIndex) => /* @__PURE__ */ jsx30(Box, { flexDirection: "row", flex: 1, children: row2.map((key, column) => /* @__PURE__ */ jsx30(
|
|
4591
|
+
NumPadKey,
|
|
4592
|
+
{
|
|
4593
|
+
numpadKey: key,
|
|
4594
|
+
hitSlop: keyHitSlop(rowIndex, column, ROWS.length - 1),
|
|
4595
|
+
alignment: COLUMN_ALIGNMENT[column],
|
|
4596
|
+
deleteColor: theme.content.elements.primary,
|
|
4597
|
+
accessibilityLabel: key === "backspace" ? backspaceAccessibilityLabel : key,
|
|
4598
|
+
onPress: () => {
|
|
4599
|
+
haptic();
|
|
4600
|
+
onPressKey(key);
|
|
4601
|
+
}
|
|
4602
|
+
},
|
|
4603
|
+
key
|
|
4604
|
+
)) }, row2.join(""))) });
|
|
4605
|
+
}
|
|
4606
|
+
function NumPadKey({
|
|
4607
|
+
numpadKey,
|
|
4608
|
+
hitSlop,
|
|
4609
|
+
alignment,
|
|
4610
|
+
deleteColor,
|
|
4611
|
+
accessibilityLabel,
|
|
4612
|
+
onPress
|
|
4613
|
+
}) {
|
|
4614
|
+
const scale = useSharedValue3(1);
|
|
4615
|
+
const pressScaling = useAnimatedStyle3(() => {
|
|
4616
|
+
"worklet";
|
|
4617
|
+
return { transform: [{ scale: scale.value }] };
|
|
4618
|
+
});
|
|
4619
|
+
const handlePressIn = () => {
|
|
4620
|
+
scale.value = withTiming3(KEY_PRESS_SCALE, {
|
|
4621
|
+
duration: KEY_PRESS_IN_DURATION
|
|
4622
|
+
});
|
|
4623
|
+
};
|
|
4624
|
+
const handlePressOut = () => {
|
|
4625
|
+
scale.value = withSpring(1, KEY_RELEASE_SPRING);
|
|
4626
|
+
};
|
|
4627
|
+
return /* @__PURE__ */ jsx30(
|
|
4628
|
+
Pressable9,
|
|
4629
|
+
{
|
|
4630
|
+
onPressIn: handlePressIn,
|
|
4631
|
+
onPressOut: handlePressOut,
|
|
4632
|
+
onPress,
|
|
4633
|
+
hitSlop,
|
|
4634
|
+
accessibilityRole: "button",
|
|
4635
|
+
accessibilityLabel,
|
|
4636
|
+
style: [styles12.key, { alignItems: alignment }],
|
|
4637
|
+
children: /* @__PURE__ */ jsx30(AnimatedBox2, { style: pressScaling, children: numpadKey === "backspace" ? /* @__PURE__ */ jsx30(FigmaChevronLeftIcon, { size: KEY_FONT_SIZE, color: deleteColor }) : /* @__PURE__ */ jsx30(
|
|
4638
|
+
Text,
|
|
4639
|
+
{
|
|
4640
|
+
weight: "medium",
|
|
4641
|
+
style: [
|
|
4642
|
+
styles12.label,
|
|
4643
|
+
numpadKey === "." ? styles12.decimalLabel : null
|
|
4644
|
+
],
|
|
4645
|
+
children: numpadKey
|
|
4646
|
+
}
|
|
4647
|
+
) })
|
|
4648
|
+
}
|
|
4649
|
+
);
|
|
4650
|
+
}
|
|
4651
|
+
var styles12 = StyleSheet12.create({
|
|
4652
|
+
key: { flex: 1, justifyContent: "center" },
|
|
4653
|
+
label: {
|
|
4654
|
+
fontSize: KEY_FONT_SIZE,
|
|
4655
|
+
minWidth: KEY_FONT_SIZE,
|
|
4656
|
+
lineHeight: 32,
|
|
4657
|
+
letterSpacing: -0.36,
|
|
4658
|
+
textAlign: "center"
|
|
4659
|
+
},
|
|
4660
|
+
decimalLabel: {
|
|
4661
|
+
fontSize: 48,
|
|
4662
|
+
lineHeight: 56,
|
|
4663
|
+
transform: [{ translateY: -14 }]
|
|
4664
|
+
}
|
|
4665
|
+
});
|
|
4666
|
+
|
|
4667
|
+
// src/components/PillButton.tsx
|
|
4668
|
+
import { Pressable as Pressable10, StyleSheet as StyleSheet13 } from "react-native";
|
|
4669
|
+
import { jsx as jsx31, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4670
|
+
function PillButton2({
|
|
4671
|
+
label,
|
|
4672
|
+
onPress,
|
|
4673
|
+
icon,
|
|
4674
|
+
size = "buttonLg",
|
|
4675
|
+
variant = "primary",
|
|
4676
|
+
radius = "button",
|
|
4677
|
+
disabled = false,
|
|
4678
|
+
accessibilityLabel
|
|
4679
|
+
}) {
|
|
4680
|
+
const theme = useTheme();
|
|
4681
|
+
const surface = theme.background.button[variant];
|
|
4682
|
+
const labelColor = theme.content.button[variant].default;
|
|
4683
|
+
return /* @__PURE__ */ jsx31(
|
|
4684
|
+
Pressable10,
|
|
4685
|
+
{
|
|
4686
|
+
onPress,
|
|
4687
|
+
disabled,
|
|
4688
|
+
accessibilityRole: "button",
|
|
4689
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
4690
|
+
accessibilityState: { disabled },
|
|
4691
|
+
children: /* @__PURE__ */ jsx31(
|
|
4692
|
+
Box,
|
|
4693
|
+
{
|
|
4694
|
+
borderRadius: radius,
|
|
4695
|
+
style: { backgroundColor: theme.background.modal },
|
|
4696
|
+
children: /* @__PURE__ */ jsxs12(
|
|
4697
|
+
Box,
|
|
4698
|
+
{
|
|
4699
|
+
flexDirection: "row",
|
|
4700
|
+
alignItems: "center",
|
|
4701
|
+
justifyContent: "center",
|
|
4702
|
+
borderRadius: radius,
|
|
4703
|
+
style: [
|
|
4704
|
+
styles13.pill,
|
|
4705
|
+
variant === "secondary" ? styles13.secondaryPill : null,
|
|
4706
|
+
{
|
|
4707
|
+
height: theme.sizes[size],
|
|
4708
|
+
backgroundColor: surface.default,
|
|
4709
|
+
opacity: disabled ? theme.opacity.disabled / 100 : 1
|
|
4710
|
+
}
|
|
4711
|
+
],
|
|
4712
|
+
children: [
|
|
4713
|
+
icon,
|
|
4714
|
+
/* @__PURE__ */ jsx31(
|
|
4715
|
+
Text,
|
|
4716
|
+
{
|
|
4717
|
+
variant: "bodyMedium",
|
|
4718
|
+
numberOfLines: 1,
|
|
4719
|
+
style: { color: labelColor },
|
|
4720
|
+
children: label
|
|
4721
|
+
}
|
|
4722
|
+
)
|
|
4723
|
+
]
|
|
4724
|
+
}
|
|
4725
|
+
)
|
|
4726
|
+
}
|
|
4727
|
+
)
|
|
4728
|
+
}
|
|
4729
|
+
);
|
|
4730
|
+
}
|
|
4731
|
+
var styles13 = StyleSheet13.create({
|
|
4732
|
+
pill: { paddingHorizontal: 24, gap: 8 },
|
|
4733
|
+
// The design's own inset for these (`px-10` vs the primary's `px-24`): they
|
|
4734
|
+
// sit several-across, where 24 leaves no room for the label and it ellipsises.
|
|
4735
|
+
secondaryPill: { paddingHorizontal: 10 }
|
|
4736
|
+
});
|
|
4737
|
+
|
|
4738
|
+
// src/components/v2/RollingAmount.tsx
|
|
4739
|
+
import { useEffect as useEffect13, useRef as useRef10 } from "react";
|
|
4740
|
+
import { StyleSheet as StyleSheet14 } from "react-native";
|
|
4741
|
+
import Animated6, {
|
|
4742
|
+
Easing as Easing4,
|
|
4743
|
+
FadeOut as FadeOut2,
|
|
4744
|
+
useAnimatedStyle as useAnimatedStyle4,
|
|
4745
|
+
useReducedMotion,
|
|
4746
|
+
useSharedValue as useSharedValue4,
|
|
4747
|
+
withDelay,
|
|
4748
|
+
withTiming as withTiming4
|
|
4749
|
+
} from "react-native-reanimated";
|
|
4750
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
4751
|
+
var AnimatedBox3 = Animated6.createAnimatedComponent(Box);
|
|
4752
|
+
var AnimatedText2 = Animated6.createAnimatedComponent(Text);
|
|
4753
|
+
var POP_DURATION = 500;
|
|
4754
|
+
var POP_EASING = Easing4.bezier(0.34, 1.45, 0.64, 1);
|
|
4755
|
+
var POP_TRAVEL = 8;
|
|
4756
|
+
var POP_BLUR = 2;
|
|
4757
|
+
var POP_STAGGER = 70;
|
|
4758
|
+
var POP_STAGGER_CAP = 2;
|
|
4759
|
+
var EXIT_DURATION = 150;
|
|
4760
|
+
var GLYPH_EXIT = FadeOut2.duration(EXIT_DURATION);
|
|
4761
|
+
function RollingAmount({ value, style }) {
|
|
4762
|
+
const glyphs = amountGlyphs(value, "");
|
|
4763
|
+
const previousKeys = useRef10(/* @__PURE__ */ new Set());
|
|
4764
|
+
const keyOf = (key, char) => `${key}-${char}`;
|
|
4765
|
+
const mountingKeys = glyphs.map(({ key, char }) => keyOf(key, char)).filter((key) => !previousKeys.current.has(key));
|
|
4766
|
+
useEffect13(() => {
|
|
4767
|
+
previousKeys.current = new Set(
|
|
4768
|
+
glyphs.map(({ key, char }) => keyOf(key, char))
|
|
4769
|
+
);
|
|
4770
|
+
});
|
|
4771
|
+
const delayOf = (glyphKey) => Math.min(Math.max(0, mountingKeys.indexOf(glyphKey)), POP_STAGGER_CAP) * POP_STAGGER;
|
|
4772
|
+
return /* @__PURE__ */ jsx32(Box, { style: styles14.row, children: glyphs.map(({ key, char }) => {
|
|
4773
|
+
const glyphKey = keyOf(key, char);
|
|
4774
|
+
return /* @__PURE__ */ jsx32(
|
|
4775
|
+
RollingGlyph,
|
|
4776
|
+
{
|
|
4777
|
+
char,
|
|
4778
|
+
delay: delayOf(glyphKey),
|
|
4779
|
+
style
|
|
4780
|
+
},
|
|
4781
|
+
glyphKey
|
|
4782
|
+
);
|
|
4783
|
+
}) });
|
|
4784
|
+
}
|
|
4785
|
+
function RollingGlyph({
|
|
4786
|
+
char,
|
|
4787
|
+
delay,
|
|
4788
|
+
style
|
|
4789
|
+
}) {
|
|
4790
|
+
const reduceMotion = useReducedMotion();
|
|
4791
|
+
const progress = useSharedValue4(reduceMotion ? 1 : 0);
|
|
4792
|
+
useEffect13(() => {
|
|
4793
|
+
if (!reduceMotion) {
|
|
4794
|
+
progress.value = withDelay(
|
|
4795
|
+
delay,
|
|
4796
|
+
withTiming4(1, { duration: POP_DURATION, easing: POP_EASING })
|
|
4797
|
+
);
|
|
4798
|
+
}
|
|
4799
|
+
}, [progress, delay, reduceMotion]);
|
|
4800
|
+
const popIn = useAnimatedStyle4(() => {
|
|
4801
|
+
"worklet";
|
|
4802
|
+
return {
|
|
4803
|
+
opacity: Math.min(1, progress.value),
|
|
4804
|
+
transform: [{ translateY: (1 - progress.value) * POP_TRAVEL }],
|
|
4805
|
+
textShadowRadius: Math.max(0, 1 - progress.value) * POP_BLUR
|
|
4806
|
+
};
|
|
4807
|
+
});
|
|
4808
|
+
return /* @__PURE__ */ jsx32(AnimatedBox3, { exiting: GLYPH_EXIT, layout: GLYPH_LAYOUT, children: /* @__PURE__ */ jsx32(
|
|
4809
|
+
AnimatedText2,
|
|
4810
|
+
{
|
|
4811
|
+
variant: "detail",
|
|
4812
|
+
weight: "medium",
|
|
4813
|
+
style: [
|
|
4814
|
+
style,
|
|
4815
|
+
{ textShadowColor: style.color, textShadowOffset: NO_OFFSET },
|
|
4816
|
+
popIn
|
|
4817
|
+
],
|
|
4818
|
+
children: char
|
|
4819
|
+
}
|
|
4820
|
+
) });
|
|
4821
|
+
}
|
|
4822
|
+
var NO_OFFSET = { width: 0, height: 0 };
|
|
4823
|
+
var styles14 = StyleSheet14.create({
|
|
4824
|
+
row: { flexDirection: "row" }
|
|
4825
|
+
});
|
|
4826
|
+
|
|
4827
|
+
// src/hooks/useGuardedAmountInput.ts
|
|
4828
|
+
import { USD_DECIMALS } from "@funkit/connect-core";
|
|
4829
|
+
import { useEffect as useEffect14, useRef as useRef11, useState as useState10 } from "react";
|
|
4830
|
+
import {
|
|
4831
|
+
useAnimatedStyle as useAnimatedStyle5,
|
|
4832
|
+
useSharedValue as useSharedValue5,
|
|
4833
|
+
withSequence,
|
|
4834
|
+
withTiming as withTiming5
|
|
4835
|
+
} from "react-native-reanimated";
|
|
4836
|
+
|
|
4837
|
+
// src/utils/numpadInput.ts
|
|
4838
|
+
var DECIMAL_POINT = ".";
|
|
4839
|
+
function applyNumpadKey(value, key, maxDecimals) {
|
|
4840
|
+
if (key === "backspace") {
|
|
4841
|
+
return value.slice(0, -1);
|
|
4842
|
+
}
|
|
4843
|
+
if (key === DECIMAL_POINT) {
|
|
4844
|
+
if (value.includes(DECIMAL_POINT) || maxDecimals === 0) {
|
|
4845
|
+
return value;
|
|
4846
|
+
}
|
|
4847
|
+
return value === "" ? `0${DECIMAL_POINT}` : `${value}${DECIMAL_POINT}`;
|
|
4848
|
+
}
|
|
4849
|
+
const fraction = value.split(DECIMAL_POINT)[1];
|
|
4850
|
+
if (fraction !== void 0 && maxDecimals !== void 0 && fraction.length >= maxDecimals) {
|
|
4851
|
+
return value;
|
|
4852
|
+
}
|
|
4853
|
+
if (value === "0") {
|
|
4854
|
+
return key === "0" ? value : key;
|
|
4855
|
+
}
|
|
4856
|
+
return `${value}${key}`;
|
|
4857
|
+
}
|
|
4858
|
+
|
|
4859
|
+
// src/hooks/useGuardedAmountInput.ts
|
|
4860
|
+
var SHAKE_TRAVEL = 8;
|
|
4861
|
+
var SHAKE_STEP_DURATION = 50;
|
|
4862
|
+
var WARNING_DURATION = SHAKE_STEP_DURATION * 4 * 2;
|
|
4863
|
+
function useGuardedAmountInput({
|
|
4864
|
+
input,
|
|
4865
|
+
onChangeInput,
|
|
4866
|
+
limitUsd
|
|
4867
|
+
}) {
|
|
4868
|
+
const haptic = useHapticFeedback();
|
|
4869
|
+
const [hasWarning, setHasWarning] = useState10(false);
|
|
4870
|
+
const warningTimer = useRef11(void 0);
|
|
4871
|
+
useEffect14(() => () => clearTimeout(warningTimer.current), []);
|
|
4872
|
+
const shake = useSharedValue5(0);
|
|
4873
|
+
const shakeStyle = useAnimatedStyle5(() => {
|
|
4874
|
+
"worklet";
|
|
4875
|
+
return { transform: [{ translateX: shake.value }] };
|
|
4876
|
+
});
|
|
4877
|
+
const rejectInput = () => {
|
|
4878
|
+
haptic("error");
|
|
4879
|
+
shake.value = withSequence(
|
|
4880
|
+
withTiming5(-SHAKE_TRAVEL, { duration: SHAKE_STEP_DURATION }),
|
|
4881
|
+
withTiming5(SHAKE_TRAVEL, { duration: SHAKE_STEP_DURATION }),
|
|
4882
|
+
withTiming5(-SHAKE_TRAVEL / 2, { duration: SHAKE_STEP_DURATION }),
|
|
4883
|
+
withTiming5(0, { duration: SHAKE_STEP_DURATION })
|
|
4884
|
+
);
|
|
4885
|
+
setHasWarning(true);
|
|
4886
|
+
clearTimeout(warningTimer.current);
|
|
4887
|
+
warningTimer.current = setTimeout(
|
|
4888
|
+
() => setHasWarning(false),
|
|
4889
|
+
WARNING_DURATION
|
|
4890
|
+
);
|
|
4891
|
+
};
|
|
4892
|
+
const commitInput = (next) => {
|
|
4893
|
+
if (limitUsd !== void 0 && Number(next) > Number(limitUsd)) {
|
|
4894
|
+
rejectInput();
|
|
4895
|
+
return;
|
|
4896
|
+
}
|
|
4897
|
+
onChangeInput(next);
|
|
4898
|
+
};
|
|
4899
|
+
const handleNumpadKey = (key) => {
|
|
4900
|
+
if (key === "backspace" && input === "") {
|
|
4901
|
+
rejectInput();
|
|
4902
|
+
return;
|
|
4903
|
+
}
|
|
4904
|
+
commitInput(applyNumpadKey(input, key, USD_DECIMALS));
|
|
4905
|
+
};
|
|
4906
|
+
return { hasWarning, shakeStyle, commitInput, handleNumpadKey };
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
// src/utils/formatAmount.ts
|
|
4910
|
+
function groupThousands(amount) {
|
|
4911
|
+
const [whole, ...fraction] = amount.split(".");
|
|
4912
|
+
const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
4913
|
+
return fraction.length > 0 ? `${grouped}.${fraction.join(".")}` : grouped;
|
|
4914
|
+
}
|
|
4915
|
+
var ASSET_DECIMALS = 5;
|
|
4916
|
+
function formatTokenAmount(amount, maxDecimals = ASSET_DECIMALS) {
|
|
4917
|
+
const [whole, fraction = ""] = amount.split(".");
|
|
4918
|
+
const capped = fraction.slice(0, maxDecimals).replace(/0+$/, "");
|
|
4919
|
+
const grouped = groupThousands(whole);
|
|
4920
|
+
return capped ? `${grouped}.${capped}` : grouped;
|
|
4921
|
+
}
|
|
4922
|
+
function formatUsd(value) {
|
|
4923
|
+
return `$${groupThousands(value.toFixed(2))}`;
|
|
4924
|
+
}
|
|
4925
|
+
|
|
4926
|
+
// src/screens/DepositAmountScreen.tsx
|
|
4927
|
+
import { jsx as jsx33, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
4928
|
+
var NUMPAD_BOTTOM_MARGIN = 25;
|
|
4929
|
+
var NUMPAD_MIN_BOTTOM_MARGIN = 40;
|
|
4930
|
+
var AnimatedBox4 = Animated7.createAnimatedComponent(Box);
|
|
4931
|
+
var SWAP_TRAVEL = 24;
|
|
4932
|
+
var SWAP_ENTERING = new Keyframe4({
|
|
4933
|
+
0: { opacity: 0, transform: [{ translateY: SWAP_TRAVEL }] },
|
|
4934
|
+
100: { opacity: 1, transform: [{ translateY: 0 }], easing: MOTION_EASING }
|
|
4935
|
+
}).duration(MOTION_DURATION);
|
|
4936
|
+
var SWAP_EXITING = new Keyframe4({
|
|
4937
|
+
0: { opacity: 1, transform: [{ translateY: 0 }] },
|
|
4938
|
+
100: {
|
|
4939
|
+
opacity: 0,
|
|
4940
|
+
transform: [{ translateY: SWAP_TRAVEL }],
|
|
4941
|
+
easing: MOTION_EASING
|
|
4942
|
+
}
|
|
4943
|
+
}).duration(MOTION_DURATION);
|
|
4944
|
+
function DepositAmountScreen({
|
|
4945
|
+
title,
|
|
4946
|
+
brandIcon,
|
|
4947
|
+
accountContext,
|
|
4948
|
+
input,
|
|
4949
|
+
onChangeInput,
|
|
4950
|
+
quickAmounts,
|
|
4951
|
+
limitUsd,
|
|
4952
|
+
fee,
|
|
4953
|
+
methodBadge,
|
|
4954
|
+
submitLabel,
|
|
4955
|
+
canSubmit,
|
|
4956
|
+
onSubmit,
|
|
4957
|
+
amountAccessibilityLabel,
|
|
4958
|
+
backspaceAccessibilityLabel
|
|
4959
|
+
}) {
|
|
4960
|
+
const theme = useTheme();
|
|
4961
|
+
const { height } = useWindowDimensions4();
|
|
4962
|
+
const insets = useSafeAreaInsets4();
|
|
4963
|
+
const { hasWarning, shakeStyle, commitInput, handleNumpadKey } = useGuardedAmountInput({ input, onChangeInput, limitUsd });
|
|
4964
|
+
const isZeroInput = input === "" || Number(input) === 0;
|
|
4965
|
+
const showChips = isZeroInput && !!quickAmounts?.length;
|
|
4966
|
+
const feeTextColor = { color: theme.content.elements.secondary };
|
|
4967
|
+
return /* @__PURE__ */ jsxs13(
|
|
4968
|
+
Box,
|
|
4969
|
+
{
|
|
4970
|
+
style: {
|
|
4971
|
+
height,
|
|
4972
|
+
paddingTop: insets.top,
|
|
4973
|
+
backgroundColor: theme.background.modal
|
|
4974
|
+
},
|
|
4975
|
+
children: [
|
|
4976
|
+
/* @__PURE__ */ jsx33(Grabber, {}),
|
|
4977
|
+
/* @__PURE__ */ jsxs13(
|
|
4978
|
+
Box,
|
|
4979
|
+
{
|
|
4980
|
+
flexDirection: "row",
|
|
4981
|
+
alignItems: "center",
|
|
4982
|
+
justifyContent: "space-between",
|
|
4983
|
+
style: styles15.header,
|
|
4984
|
+
children: [
|
|
4985
|
+
/* @__PURE__ */ jsxs13(Box, { flexDirection: "row", alignItems: "center", style: styles15.brand, children: [
|
|
4986
|
+
brandIcon,
|
|
4987
|
+
/* @__PURE__ */ jsx33(Text, { variant: "headerTitle", numberOfLines: 1, children: title })
|
|
4988
|
+
] }),
|
|
4989
|
+
accountContext ? /* @__PURE__ */ jsx33(AccountBalanceChip, { ...accountContext }) : null
|
|
4990
|
+
]
|
|
4991
|
+
}
|
|
4992
|
+
),
|
|
4993
|
+
/* @__PURE__ */ jsx33(AnimatedBox4, { style: [styles15.amount, shakeStyle], children: /* @__PURE__ */ jsx33(
|
|
4994
|
+
AmountDisplay,
|
|
4995
|
+
{
|
|
4996
|
+
value: groupThousands(input),
|
|
4997
|
+
hasWarning,
|
|
4998
|
+
accessibilityLabel: amountAccessibilityLabel
|
|
4999
|
+
}
|
|
5000
|
+
) }),
|
|
5001
|
+
/* @__PURE__ */ jsx33(Box, { flex: 1 }),
|
|
5002
|
+
/* @__PURE__ */ jsx33(Box, { style: styles15.actions, children: showChips ? /* @__PURE__ */ jsx33(
|
|
5003
|
+
AnimatedBox4,
|
|
5004
|
+
{
|
|
5005
|
+
entering: SWAP_ENTERING,
|
|
5006
|
+
exiting: SWAP_EXITING,
|
|
5007
|
+
children: /* @__PURE__ */ jsx33(QuickAmountsRow, { options: quickAmounts, onSelect: commitInput })
|
|
5008
|
+
},
|
|
5009
|
+
"chips"
|
|
5010
|
+
) : /* @__PURE__ */ jsxs13(
|
|
5011
|
+
AnimatedBox4,
|
|
5012
|
+
{
|
|
5013
|
+
entering: SWAP_ENTERING,
|
|
5014
|
+
exiting: SWAP_EXITING,
|
|
5015
|
+
children: [
|
|
5016
|
+
/* @__PURE__ */ jsxs13(
|
|
5017
|
+
Box,
|
|
5018
|
+
{
|
|
5019
|
+
flexDirection: "row",
|
|
5020
|
+
alignItems: "center",
|
|
5021
|
+
justifyContent: "space-between",
|
|
5022
|
+
style: styles15.feeRow,
|
|
5023
|
+
children: [
|
|
5024
|
+
/* @__PURE__ */ jsx33(Box, { children: methodBadge }),
|
|
5025
|
+
fee ? /* @__PURE__ */ jsx33(FeeLine, { fee, color: feeTextColor.color }) : null
|
|
5026
|
+
]
|
|
5027
|
+
}
|
|
5028
|
+
),
|
|
5029
|
+
/* @__PURE__ */ jsx33(
|
|
5030
|
+
PillButton2,
|
|
5031
|
+
{
|
|
5032
|
+
label: submitLabel,
|
|
5033
|
+
disabled: !canSubmit,
|
|
5034
|
+
onPress: onSubmit
|
|
5035
|
+
}
|
|
5036
|
+
)
|
|
5037
|
+
]
|
|
5038
|
+
},
|
|
5039
|
+
"submit"
|
|
5040
|
+
) }),
|
|
5041
|
+
/* @__PURE__ */ jsx33(
|
|
5042
|
+
Box,
|
|
5043
|
+
{
|
|
5044
|
+
style: [
|
|
5045
|
+
styles15.numpad,
|
|
5046
|
+
{
|
|
5047
|
+
marginBottom: Math.max(
|
|
5048
|
+
NUMPAD_BOTTOM_MARGIN + insets.bottom,
|
|
5049
|
+
NUMPAD_MIN_BOTTOM_MARGIN
|
|
5050
|
+
)
|
|
5051
|
+
}
|
|
5052
|
+
],
|
|
5053
|
+
children: /* @__PURE__ */ jsx33(
|
|
5054
|
+
NumPad,
|
|
5055
|
+
{
|
|
5056
|
+
backspaceAccessibilityLabel,
|
|
5057
|
+
onPressKey: handleNumpadKey
|
|
5058
|
+
}
|
|
5059
|
+
)
|
|
5060
|
+
}
|
|
5061
|
+
)
|
|
5062
|
+
]
|
|
5063
|
+
}
|
|
5064
|
+
);
|
|
5065
|
+
}
|
|
5066
|
+
function FeeLine({ fee, color }) {
|
|
5067
|
+
const textColor = { color };
|
|
5068
|
+
return /* @__PURE__ */ jsxs13(Box, { flexDirection: "row", alignItems: "center", style: styles15.fee, children: [
|
|
5069
|
+
fee.before ? /* @__PURE__ */ jsx33(Text, { variant: "detail", weight: "medium", style: textColor, children: fee.before }) : null,
|
|
5070
|
+
/* @__PURE__ */ jsx33(RollingAmount, { value: fee.amount, style: textColor }),
|
|
5071
|
+
fee.after ? /* @__PURE__ */ jsx33(Text, { variant: "detail", weight: "medium", style: textColor, children: fee.after }) : null,
|
|
5072
|
+
/* @__PURE__ */ jsx33(FigmaInfoCircleIcon, { size: 14, color })
|
|
5073
|
+
] });
|
|
5074
|
+
}
|
|
5075
|
+
var styles15 = StyleSheet15.create({
|
|
5076
|
+
header: { paddingHorizontal: 24, paddingTop: 44 },
|
|
5077
|
+
brand: { gap: 12, flexShrink: 1 },
|
|
5078
|
+
amount: { alignItems: "center", paddingTop: 90 },
|
|
5079
|
+
actions: { marginHorizontal: 24, height: 104, justifyContent: "flex-end" },
|
|
5080
|
+
feeRow: { paddingHorizontal: 8, paddingBottom: 12 },
|
|
5081
|
+
fee: { gap: 4 },
|
|
5082
|
+
numpad: {
|
|
5083
|
+
marginHorizontal: 64,
|
|
5084
|
+
marginTop: 30,
|
|
5085
|
+
height: 240,
|
|
5086
|
+
minHeight: 176,
|
|
5087
|
+
flexShrink: 1
|
|
5088
|
+
}
|
|
5089
|
+
});
|
|
5090
|
+
|
|
5091
|
+
// src/flow/DepositAmountStep.tsx
|
|
5092
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
5093
|
+
var DEFAULT_QUICK_AMOUNTS = ["10", "20", "50", "100"];
|
|
5094
|
+
function DepositAmountStep({
|
|
5095
|
+
config,
|
|
5096
|
+
callbacks
|
|
5097
|
+
}) {
|
|
5098
|
+
const { t } = useFunkitTranslation();
|
|
5099
|
+
const [input, setInput] = useState11("");
|
|
5100
|
+
const amountUsd = input === "" ? 0 : Number(input);
|
|
5101
|
+
const feeUsd = amountUsd * config.feeRate;
|
|
5102
|
+
const fee = (() => {
|
|
5103
|
+
if (amountUsd <= 0) {
|
|
5104
|
+
return void 0;
|
|
5105
|
+
}
|
|
5106
|
+
const sentinel = "\0";
|
|
5107
|
+
const [before = "", after = ""] = t("depositAmount.fee", {
|
|
5108
|
+
amount: sentinel,
|
|
5109
|
+
interpolation: { escapeValue: false }
|
|
5110
|
+
}).split(sentinel);
|
|
5111
|
+
return { before, amount: formatUsd(feeUsd), after };
|
|
5112
|
+
})();
|
|
5113
|
+
const quickAmounts = (config.quickAmountsUsd ?? DEFAULT_QUICK_AMOUNTS).map(
|
|
5114
|
+
(value) => ({ value, label: `$${groupThousands(value)}` })
|
|
5115
|
+
);
|
|
5116
|
+
const title = t("depositAmount.title");
|
|
5117
|
+
const hasSubmitHandler = !!callbacks.onSubmitAmount;
|
|
5118
|
+
useEffect15(() => {
|
|
5119
|
+
if (!hasSubmitHandler) {
|
|
5120
|
+
logger.warn(
|
|
5121
|
+
"connect-rn: amountEntry is configured without onSubmitAmount; the submit CTA stays disabled"
|
|
5122
|
+
);
|
|
5123
|
+
}
|
|
5124
|
+
}, [hasSubmitHandler]);
|
|
5125
|
+
const canSubmit = amountUsd > 0 && hasSubmitHandler;
|
|
5126
|
+
const handleSubmit = () => {
|
|
5127
|
+
if (!canSubmit) {
|
|
5128
|
+
return;
|
|
5129
|
+
}
|
|
5130
|
+
logger.info("depositAmountSubmit", { amountUsd: input, feeUsd });
|
|
5131
|
+
callbacks.onSubmitAmount?.(input);
|
|
5132
|
+
};
|
|
5133
|
+
return /* @__PURE__ */ jsx34(
|
|
5134
|
+
DepositAmountScreen,
|
|
5135
|
+
{
|
|
5136
|
+
title,
|
|
5137
|
+
brandIcon: config.brandIcon,
|
|
5138
|
+
accountContext: config.accountContext,
|
|
5139
|
+
input,
|
|
5140
|
+
onChangeInput: setInput,
|
|
5141
|
+
quickAmounts,
|
|
5142
|
+
limitUsd: config.limitUsd,
|
|
5143
|
+
fee,
|
|
5144
|
+
methodBadge: config.methodBadge,
|
|
5145
|
+
submitLabel: config.submitLabel,
|
|
5146
|
+
canSubmit,
|
|
5147
|
+
onSubmit: handleSubmit,
|
|
5148
|
+
amountAccessibilityLabel: t("depositAmount.amountLabel"),
|
|
5149
|
+
backspaceAccessibilityLabel: t("depositAmount.delete")
|
|
5150
|
+
}
|
|
5151
|
+
);
|
|
5152
|
+
}
|
|
5153
|
+
|
|
5154
|
+
// src/flow/depositFlowConfig.ts
|
|
5155
|
+
function getDefaultDynamicTargetAsset(candidates, dynamicRoutingId) {
|
|
5156
|
+
if (!candidates?.length) {
|
|
5157
|
+
return void 0;
|
|
5158
|
+
}
|
|
5159
|
+
if (candidates.length === 1) {
|
|
5160
|
+
return candidates[0];
|
|
5161
|
+
}
|
|
5162
|
+
const routingId = dynamicRoutingId ?? "";
|
|
5163
|
+
return candidates.find((c) => c.dynamicRoutingId === routingId) ?? candidates.find((c) => c.isDefault) ?? candidates[0];
|
|
5164
|
+
}
|
|
5165
|
+
|
|
5166
|
+
// src/flow/FlowSheet.tsx
|
|
5167
|
+
import {
|
|
5168
|
+
useCallback as useCallback7,
|
|
5169
|
+
useEffect as useEffect18,
|
|
5170
|
+
useRef as useRef12
|
|
5171
|
+
} from "react";
|
|
5172
|
+
import { StyleSheet as StyleSheet16, View as View4 } from "react-native";
|
|
5173
|
+
import {
|
|
5174
|
+
BottomSheetBackdrop as BottomSheetBackdrop2,
|
|
5175
|
+
BottomSheetModal,
|
|
5176
|
+
BottomSheetModalProvider,
|
|
5177
|
+
BottomSheetView,
|
|
5178
|
+
useBottomSheetTimingConfigs
|
|
5179
|
+
} from "@gorhom/bottom-sheet";
|
|
5180
|
+
import { Easing as Easing5 } from "react-native-reanimated";
|
|
5181
|
+
import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
|
|
5182
|
+
|
|
5183
|
+
// src/flow/sheetSizing.ts
|
|
5184
|
+
import { useEffect as useEffect16 } from "react";
|
|
5185
|
+
var FULL_HEIGHT_DETENT = ["100%"];
|
|
5186
|
+
function sheetSizing({ fullHeight }) {
|
|
5187
|
+
return fullHeight ? { enableDynamicSizing: false, snapPoints: FULL_HEIGHT_DETENT } : { enableDynamicSizing: true };
|
|
5188
|
+
}
|
|
5189
|
+
var noop = () => {
|
|
5190
|
+
};
|
|
5191
|
+
function useInertScrollableFocus(_register) {
|
|
5192
|
+
useEffect16(noop);
|
|
5193
|
+
}
|
|
5194
|
+
|
|
5195
|
+
// src/flow/useKeyboardHeight.ts
|
|
5196
|
+
import { useEffect as useEffect17, useState as useState12 } from "react";
|
|
5197
|
+
import { Keyboard, Platform as Platform2 } from "react-native";
|
|
5198
|
+
function useKeyboardHeight(enabled) {
|
|
5199
|
+
const [height, setHeight] = useState12(0);
|
|
5200
|
+
useEffect17(() => {
|
|
5201
|
+
if (!enabled) {
|
|
5202
|
+
setHeight(0);
|
|
5203
|
+
return;
|
|
5204
|
+
}
|
|
5205
|
+
const showEvent = Platform2.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
|
|
5206
|
+
const hideEvent = Platform2.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
|
|
5207
|
+
const show = Keyboard.addListener(
|
|
5208
|
+
showEvent,
|
|
5209
|
+
(e) => setHeight(e.endCoordinates.height)
|
|
5210
|
+
);
|
|
5211
|
+
const hide = Keyboard.addListener(hideEvent, () => setHeight(0));
|
|
5212
|
+
return () => {
|
|
5213
|
+
show.remove();
|
|
5214
|
+
hide.remove();
|
|
5215
|
+
};
|
|
5216
|
+
}, [enabled]);
|
|
5217
|
+
return height;
|
|
5218
|
+
}
|
|
5219
|
+
|
|
5220
|
+
// src/flow/FlowSheet.tsx
|
|
5221
|
+
import { jsx as jsx35, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5222
|
+
function FlowSheet({
|
|
5223
|
+
isOpen,
|
|
5224
|
+
session,
|
|
5225
|
+
onClose,
|
|
5226
|
+
content: content2,
|
|
5227
|
+
children,
|
|
5228
|
+
keyboardAvoidEnabled = false,
|
|
5229
|
+
enableSwipeToDismiss = true,
|
|
5230
|
+
fullHeight = false,
|
|
5231
|
+
renderBackdropBlur
|
|
5232
|
+
}) {
|
|
5233
|
+
const ref = useRef12(null);
|
|
5234
|
+
const setRef = useCallback7((instance) => {
|
|
5235
|
+
ref.current = instance;
|
|
5236
|
+
}, []);
|
|
5237
|
+
const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled);
|
|
5238
|
+
const insets = useSafeAreaInsets5();
|
|
5239
|
+
const theme = useTheme();
|
|
5240
|
+
const hasPresented = useRef12(false);
|
|
5241
|
+
const sheetSelfDismissed = useRef12(false);
|
|
5242
|
+
useEffect18(() => {
|
|
5243
|
+
if (isOpen) {
|
|
5244
|
+
sheetSelfDismissed.current = false;
|
|
5245
|
+
ref.current?.present();
|
|
5246
|
+
hasPresented.current = true;
|
|
5247
|
+
return;
|
|
5248
|
+
}
|
|
5249
|
+
if (!hasPresented.current) {
|
|
5250
|
+
return;
|
|
5251
|
+
}
|
|
5252
|
+
hasPresented.current = false;
|
|
5253
|
+
if (sheetSelfDismissed.current) {
|
|
5254
|
+
sheetSelfDismissed.current = false;
|
|
5255
|
+
return;
|
|
5256
|
+
}
|
|
5257
|
+
ref.current?.dismiss();
|
|
5258
|
+
}, [isOpen, session]);
|
|
5259
|
+
const handleDismiss = useCallback7(() => {
|
|
5260
|
+
sheetSelfDismissed.current = true;
|
|
5261
|
+
onClose();
|
|
5262
|
+
}, [onClose]);
|
|
5263
|
+
const animationConfigs = useBottomSheetTimingConfigs({
|
|
5264
|
+
duration: 300,
|
|
5265
|
+
easing: Easing5.bezier(0.22, 1, 0.36, 1)
|
|
5266
|
+
});
|
|
5267
|
+
const renderBackdrop = useCallback7(
|
|
5268
|
+
(props) => /* @__PURE__ */ jsxs14(
|
|
5269
|
+
BottomSheetBackdrop2,
|
|
5270
|
+
{
|
|
5271
|
+
...props,
|
|
5272
|
+
appearsOnIndex: 0,
|
|
5273
|
+
disappearsOnIndex: -1,
|
|
5274
|
+
pressBehavior: "close",
|
|
5275
|
+
opacity: 1,
|
|
5276
|
+
style: backdropContainer,
|
|
5277
|
+
children: [
|
|
5278
|
+
renderBackdropBlur ? /* @__PURE__ */ jsx35(View4, { style: StyleSheet16.absoluteFill, pointerEvents: "none", children: renderBackdropBlur() }) : null,
|
|
5279
|
+
/* @__PURE__ */ jsx35(
|
|
5280
|
+
View4,
|
|
5281
|
+
{
|
|
5282
|
+
style: [scrim2, { backgroundColor: theme.background.overlay }],
|
|
5283
|
+
pointerEvents: "none"
|
|
5284
|
+
}
|
|
5285
|
+
)
|
|
5286
|
+
]
|
|
5287
|
+
}
|
|
5288
|
+
),
|
|
5289
|
+
[renderBackdropBlur, theme.background.overlay]
|
|
5290
|
+
);
|
|
5291
|
+
return /* @__PURE__ */ jsxs14(BottomSheetModalProvider, { children: [
|
|
5292
|
+
children,
|
|
5293
|
+
/* @__PURE__ */ jsx35(
|
|
5294
|
+
BottomSheetModal,
|
|
5295
|
+
{
|
|
5296
|
+
ref: setRef,
|
|
5297
|
+
keyboardBehavior: "extend",
|
|
5298
|
+
enableOverDrag: keyboardHeight === 0,
|
|
5299
|
+
...sheetSizing({ fullHeight }),
|
|
5300
|
+
topInset: fullHeight ? 0 : insets.top,
|
|
5301
|
+
enablePanDownToClose: enableSwipeToDismiss,
|
|
5302
|
+
animationConfigs,
|
|
5303
|
+
onDismiss: handleDismiss,
|
|
5304
|
+
backdropComponent: renderBackdrop,
|
|
5305
|
+
handleComponent: null,
|
|
5306
|
+
backgroundComponent: FlowSheetBackground,
|
|
5307
|
+
children: /* @__PURE__ */ jsxs14(
|
|
5308
|
+
BottomSheetView,
|
|
5309
|
+
{
|
|
5310
|
+
focusHook: fullHeight ? useInertScrollableFocus : void 0,
|
|
5311
|
+
children: [
|
|
5312
|
+
content2,
|
|
5313
|
+
keyboardHeight > 0 ? /* @__PURE__ */ jsx35(View4, { style: { height: keyboardHeight } }) : null
|
|
5314
|
+
]
|
|
5315
|
+
}
|
|
5316
|
+
)
|
|
5317
|
+
}
|
|
5318
|
+
)
|
|
5319
|
+
] });
|
|
5320
|
+
}
|
|
5321
|
+
function FlowSheetBackground({
|
|
5322
|
+
pointerEvents,
|
|
5323
|
+
style
|
|
5324
|
+
}) {
|
|
5325
|
+
const theme = useTheme();
|
|
5326
|
+
const surface = {
|
|
5327
|
+
backgroundColor: theme.background.modal,
|
|
5328
|
+
borderTopLeftRadius: theme.borderRadii.modal,
|
|
5329
|
+
borderTopRightRadius: theme.borderRadii.modal
|
|
5330
|
+
};
|
|
5331
|
+
const extension = {
|
|
5332
|
+
...bottomExtension,
|
|
5333
|
+
backgroundColor: theme.background.modal
|
|
5334
|
+
};
|
|
5335
|
+
return /* @__PURE__ */ jsx35(View4, { pointerEvents, style: [style, surface], children: /* @__PURE__ */ jsx35(View4, { style: extension }) });
|
|
5336
|
+
}
|
|
5337
|
+
var backdropContainer = { backgroundColor: "transparent" };
|
|
5338
|
+
var scrim2 = StyleSheet16.absoluteFill;
|
|
5339
|
+
var bottomExtension = {
|
|
5340
|
+
position: "absolute",
|
|
5341
|
+
top: "100%",
|
|
5342
|
+
left: 0,
|
|
5343
|
+
right: 0,
|
|
5344
|
+
height: 1e3
|
|
5345
|
+
};
|
|
5346
|
+
|
|
5347
|
+
// src/flow/selectedChainStorage.ts
|
|
5348
|
+
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
5349
|
+
var storageKey = (userId) => `funkit.selectedChain.${userId}`;
|
|
5350
|
+
async function readSelectedChainId(userId) {
|
|
5351
|
+
try {
|
|
5352
|
+
return await AsyncStorage.getItem(storageKey(userId));
|
|
5353
|
+
} catch (error) {
|
|
5354
|
+
logger.warn("connect-rn:deposit:chain_read_failed", {
|
|
5355
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5356
|
+
});
|
|
5357
|
+
return null;
|
|
5358
|
+
}
|
|
5359
|
+
}
|
|
5360
|
+
async function writeSelectedChainId(userId, chainId) {
|
|
5361
|
+
try {
|
|
5362
|
+
await AsyncStorage.setItem(storageKey(userId), chainId);
|
|
5363
|
+
} catch (error) {
|
|
5364
|
+
logger.warn("connect-rn:deposit:chain_write_failed", {
|
|
5365
|
+
chainId,
|
|
5366
|
+
error: error instanceof Error ? error.message : String(error)
|
|
5367
|
+
});
|
|
5368
|
+
}
|
|
5369
|
+
}
|
|
5370
|
+
|
|
5371
|
+
// src/flow/DepositFlowContent.tsx
|
|
5372
|
+
import { Fragment as Fragment2, jsx as jsx36, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5373
|
+
var FULL_HEIGHT_SCREENS = {
|
|
5374
|
+
selectChain: true,
|
|
5375
|
+
changeChain: true,
|
|
5376
|
+
qrCode: false
|
|
5377
|
+
};
|
|
5378
|
+
var CRYPTO_METHOD_ID = "crypto";
|
|
5379
|
+
function addMoneyGates({
|
|
5380
|
+
isLoadingGeoCheck,
|
|
5381
|
+
isAddressLoading,
|
|
5382
|
+
isStatsigLoading,
|
|
5383
|
+
isChainListLoading,
|
|
5384
|
+
fops,
|
|
5385
|
+
methodCount
|
|
5386
|
+
}) {
|
|
5387
|
+
const isLoading = isLoadingGeoCheck || isAddressLoading || isStatsigLoading || isChainListLoading || fops.isSwappedEnabled && fops.isLoading;
|
|
5388
|
+
const isFetchError = fops.isSwappedEnabled && fops.isError;
|
|
5389
|
+
const isEmpty = !isLoading && methodCount === 0;
|
|
5390
|
+
return {
|
|
5391
|
+
isLoading,
|
|
5392
|
+
isError: isFetchError || isEmpty,
|
|
5393
|
+
canRetry: fops.canRefetch
|
|
5394
|
+
};
|
|
5395
|
+
}
|
|
5396
|
+
function FlowContent({
|
|
5397
|
+
config,
|
|
5398
|
+
current,
|
|
5399
|
+
nav,
|
|
5400
|
+
copyToClipboard: copyToClipboard2,
|
|
5401
|
+
onCopySuccess,
|
|
5402
|
+
callbacks
|
|
5403
|
+
}) {
|
|
5404
|
+
const { t } = useFunkitTranslation();
|
|
5405
|
+
const insets = useSafeAreaInsets6();
|
|
5406
|
+
const { userId, hideCryptoDeposit } = useFunkitIdentity();
|
|
5407
|
+
const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({
|
|
5408
|
+
onCheckoutBlocked: callbacks.onCheckoutBlocked
|
|
5409
|
+
});
|
|
5410
|
+
const { selectedChainId, rememberChainId } = useRememberedChain(userId);
|
|
5411
|
+
const targetAsset = useDepositTargetAsset(config);
|
|
5412
|
+
const {
|
|
5413
|
+
depositAddress: generatedAddress,
|
|
5414
|
+
qrCodeUri,
|
|
5415
|
+
transferInit,
|
|
5416
|
+
isLoading: isAddressLoading
|
|
5417
|
+
} = useTokenTransfer({
|
|
5418
|
+
checkoutConfig: targetAsset.activeCheckoutConfig,
|
|
5419
|
+
selectedChainId: selectedChainId ? Number(selectedChainId) : void 0,
|
|
5420
|
+
dynamicRoutingId: targetAsset.activeDynamicRoutingId,
|
|
5421
|
+
enabled: true
|
|
5422
|
+
});
|
|
4330
5423
|
const fetched = useSupportedTokens({ transferInit });
|
|
4331
5424
|
const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters;
|
|
4332
5425
|
const isChainListLoading = !config.tokenChainFilters && fetched.isLoading;
|
|
@@ -4336,7 +5429,7 @@ function FlowContent({
|
|
|
4336
5429
|
dynamicRoutingId: targetAsset.activeDynamicRoutingId
|
|
4337
5430
|
});
|
|
4338
5431
|
const { isLoading: isStatsigLoading } = useStatsigClient();
|
|
4339
|
-
const [selectedSwappedUrl, setSelectedSwappedUrl] =
|
|
5432
|
+
const [selectedSwappedUrl, setSelectedSwappedUrl] = useState13();
|
|
4340
5433
|
const minDepositTarget = {
|
|
4341
5434
|
targetChain: targetAsset.activeCheckoutConfig?.targetChain,
|
|
4342
5435
|
targetAsset: targetAsset.activeCheckoutConfig?.targetAsset,
|
|
@@ -4350,7 +5443,7 @@ function FlowContent({
|
|
|
4350
5443
|
target: minDepositTarget
|
|
4351
5444
|
});
|
|
4352
5445
|
const selectedChain = allChains.find((chain) => chain.id === selectedChainId);
|
|
4353
|
-
|
|
5446
|
+
useEffect19(() => {
|
|
4354
5447
|
if (current === "transfer" && allChains.length && !selectedChain) {
|
|
4355
5448
|
nav.back();
|
|
4356
5449
|
}
|
|
@@ -4395,12 +5488,26 @@ function FlowContent({
|
|
|
4395
5488
|
});
|
|
4396
5489
|
const screen = (() => {
|
|
4397
5490
|
switch (current) {
|
|
5491
|
+
// Only reachable when `beginDeposit` opened on it, which requires the
|
|
5492
|
+
// config; the guard keeps the types honest.
|
|
5493
|
+
case "depositAmount":
|
|
5494
|
+
return config.amountEntry ? /* @__PURE__ */ jsx36(
|
|
5495
|
+
DepositAmountStep,
|
|
5496
|
+
{
|
|
5497
|
+
config: config.amountEntry,
|
|
5498
|
+
callbacks
|
|
5499
|
+
}
|
|
5500
|
+
) : null;
|
|
4398
5501
|
case "addMoney": {
|
|
4399
|
-
const isLoading
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
5502
|
+
const { isLoading, isError, canRetry } = addMoneyGates({
|
|
5503
|
+
isLoadingGeoCheck,
|
|
5504
|
+
isAddressLoading,
|
|
5505
|
+
isStatsigLoading,
|
|
5506
|
+
isChainListLoading,
|
|
5507
|
+
fops,
|
|
5508
|
+
methodCount: addMoneyMethods.methods.length
|
|
5509
|
+
});
|
|
5510
|
+
return /* @__PURE__ */ jsx36(
|
|
4404
5511
|
SelectMethodScreen,
|
|
4405
5512
|
{
|
|
4406
5513
|
...addMoneyMethods,
|
|
@@ -4408,13 +5515,13 @@ function FlowContent({
|
|
|
4408
5515
|
errorTitle: t("selectMethod.errorTitle"),
|
|
4409
5516
|
errorMessage: t("selectMethod.errorMessage"),
|
|
4410
5517
|
loading: isLoading,
|
|
4411
|
-
error:
|
|
5518
|
+
error: isError,
|
|
4412
5519
|
onRetry: canRetry ? fops.refetch : void 0
|
|
4413
5520
|
}
|
|
4414
5521
|
);
|
|
4415
5522
|
}
|
|
4416
5523
|
case "transfer":
|
|
4417
|
-
return selectedChain ? /* @__PURE__ */
|
|
5524
|
+
return selectedChain ? /* @__PURE__ */ jsx36(
|
|
4418
5525
|
TransferCryptoScreen,
|
|
4419
5526
|
{
|
|
4420
5527
|
depositAddress: displayAddress,
|
|
@@ -4427,7 +5534,7 @@ function FlowContent({
|
|
|
4427
5534
|
}
|
|
4428
5535
|
) : null;
|
|
4429
5536
|
case "swapped":
|
|
4430
|
-
return selectedSwappedUrl ? /* @__PURE__ */
|
|
5537
|
+
return selectedSwappedUrl ? /* @__PURE__ */ jsx36(
|
|
4431
5538
|
SwappedScreen,
|
|
4432
5539
|
{
|
|
4433
5540
|
url: selectedSwappedUrl,
|
|
@@ -4440,11 +5547,11 @@ function FlowContent({
|
|
|
4440
5547
|
}
|
|
4441
5548
|
})();
|
|
4442
5549
|
if (isGeoblocked) {
|
|
4443
|
-
return /* @__PURE__ */
|
|
5550
|
+
return /* @__PURE__ */ jsx36(CheckoutBlockedScreen, {});
|
|
4444
5551
|
}
|
|
4445
|
-
return /* @__PURE__ */
|
|
5552
|
+
return /* @__PURE__ */ jsxs15(Fragment2, { children: [
|
|
4446
5553
|
screen,
|
|
4447
|
-
/* @__PURE__ */
|
|
5554
|
+
/* @__PURE__ */ jsx36(
|
|
4448
5555
|
BottomSheetModal2,
|
|
4449
5556
|
{
|
|
4450
5557
|
ref: nestedSheetRef,
|
|
@@ -4454,11 +5561,11 @@ function FlowContent({
|
|
|
4454
5561
|
backgroundComponent: FlowSheetBackground,
|
|
4455
5562
|
backdropComponent: renderNestedBackdrop,
|
|
4456
5563
|
onDismiss: () => setNestedScreen(null),
|
|
4457
|
-
children: /* @__PURE__ */
|
|
5564
|
+
children: /* @__PURE__ */ jsx36(
|
|
4458
5565
|
BottomSheetView2,
|
|
4459
5566
|
{
|
|
4460
5567
|
focusHook: isFullHeightScreen ? useInertScrollableFocus : void 0,
|
|
4461
|
-
children: /* @__PURE__ */
|
|
5568
|
+
children: /* @__PURE__ */ jsx36(
|
|
4462
5569
|
DepositNestedSheet,
|
|
4463
5570
|
{
|
|
4464
5571
|
nestedScreen,
|
|
@@ -4500,22 +5607,22 @@ function useAddMoneyMethods({
|
|
|
4500
5607
|
id: CRYPTO_METHOD_ID,
|
|
4501
5608
|
title: t("selectMethod.crypto"),
|
|
4502
5609
|
subtitle: t("selectMethod.noLimit"),
|
|
4503
|
-
icon: /* @__PURE__ */
|
|
4504
|
-
trailing: cryptoSourceIcons.length ? /* @__PURE__ */
|
|
5610
|
+
icon: /* @__PURE__ */ jsx36(CryptoBitcoinIcon, {}),
|
|
5611
|
+
trailing: cryptoSourceIcons.length ? /* @__PURE__ */ jsx36(SourceTokenCluster, { icons: cryptoSourceIcons, overflowMode: "plus" }) : void 0
|
|
4505
5612
|
}
|
|
4506
5613
|
];
|
|
4507
5614
|
const toCashRows = (fops2) => toFopRows(t, fops2, exchangeRates).map((row2, i) => ({
|
|
4508
5615
|
id: row2.id,
|
|
4509
5616
|
title: row2.name,
|
|
4510
5617
|
subtitle: row2.subtitle,
|
|
4511
|
-
icon: /* @__PURE__ */
|
|
5618
|
+
icon: /* @__PURE__ */ jsx36(PaymentMethodIcon, { fop: fops2[i] })
|
|
4512
5619
|
}));
|
|
4513
5620
|
const methods = isSwappedEnabled ? [...toCashRows(savedFops), ...cryptoMethod, ...toCashRows(genericFops)] : cryptoMethod;
|
|
4514
5621
|
const receiveTokens = candidates?.map(
|
|
4515
5622
|
(c, i) => ({
|
|
4516
5623
|
id: String(i),
|
|
4517
5624
|
label: c.badgeText ? `${c.tokenSymbol} (${c.badgeText})` : c.tokenSymbol,
|
|
4518
|
-
icon: /* @__PURE__ */
|
|
5625
|
+
icon: /* @__PURE__ */ jsx36(TokenChainIcon, { symbol: c.tokenSymbol, iconSrc: c.iconSrc })
|
|
4519
5626
|
})
|
|
4520
5627
|
);
|
|
4521
5628
|
const selectedReceiveTokenId = selectedCandidate && candidates ? String(candidates.indexOf(selectedCandidate)) : void 0;
|
|
@@ -4565,7 +5672,7 @@ function DepositNestedSheet({
|
|
|
4565
5672
|
}) {
|
|
4566
5673
|
switch (nestedScreen) {
|
|
4567
5674
|
case "selectChain":
|
|
4568
|
-
return /* @__PURE__ */
|
|
5675
|
+
return /* @__PURE__ */ jsx36(
|
|
4569
5676
|
SelectChainScreen,
|
|
4570
5677
|
{
|
|
4571
5678
|
chains: allChains,
|
|
@@ -4580,7 +5687,7 @@ function DepositNestedSheet({
|
|
|
4580
5687
|
}
|
|
4581
5688
|
);
|
|
4582
5689
|
case "changeChain":
|
|
4583
|
-
return /* @__PURE__ */
|
|
5690
|
+
return /* @__PURE__ */ jsx36(
|
|
4584
5691
|
ChangeChainScreen,
|
|
4585
5692
|
{
|
|
4586
5693
|
chains: allChains,
|
|
@@ -4593,11 +5700,11 @@ function DepositNestedSheet({
|
|
|
4593
5700
|
}
|
|
4594
5701
|
);
|
|
4595
5702
|
case "qrCode":
|
|
4596
|
-
return /* @__PURE__ */
|
|
5703
|
+
return /* @__PURE__ */ jsx36(
|
|
4597
5704
|
QrCodeScreen,
|
|
4598
5705
|
{
|
|
4599
|
-
qrCode: qrCode ?? (qrCodeUri ? /* @__PURE__ */
|
|
4600
|
-
centerIcon: /* @__PURE__ */
|
|
5706
|
+
qrCode: qrCode ?? (qrCodeUri ? /* @__PURE__ */ jsx36(QrCode, { value: qrCodeUri, size: 235 }) : null),
|
|
5707
|
+
centerIcon: /* @__PURE__ */ jsx36(
|
|
4601
5708
|
QrChainCluster,
|
|
4602
5709
|
{
|
|
4603
5710
|
iconKeys: selectedChain ? [selectedChain.iconUri] : []
|
|
@@ -4613,7 +5720,7 @@ function DepositNestedSheet({
|
|
|
4613
5720
|
}
|
|
4614
5721
|
}
|
|
4615
5722
|
function useDepositTargetAsset(config) {
|
|
4616
|
-
const [selectedCandidate, setSelectedCandidate] =
|
|
5723
|
+
const [selectedCandidate, setSelectedCandidate] = useState13(
|
|
4617
5724
|
() => getDefaultDynamicTargetAsset(
|
|
4618
5725
|
config.dynamicTargetAssetCandidates,
|
|
4619
5726
|
config.dynamicRoutingId
|
|
@@ -4634,8 +5741,8 @@ function useDepositTargetAsset(config) {
|
|
|
4634
5741
|
};
|
|
4635
5742
|
}
|
|
4636
5743
|
function useRememberedChain(userId) {
|
|
4637
|
-
const [selectedChainId, setSelectedChainId] =
|
|
4638
|
-
|
|
5744
|
+
const [selectedChainId, setSelectedChainId] = useState13();
|
|
5745
|
+
useEffect19(() => {
|
|
4639
5746
|
let active = true;
|
|
4640
5747
|
setSelectedChainId(void 0);
|
|
4641
5748
|
void readSelectedChainId(userId).then((storedId) => {
|
|
@@ -4647,7 +5754,7 @@ function useRememberedChain(userId) {
|
|
|
4647
5754
|
active = false;
|
|
4648
5755
|
};
|
|
4649
5756
|
}, [userId]);
|
|
4650
|
-
const rememberChainId =
|
|
5757
|
+
const rememberChainId = useCallback8(
|
|
4651
5758
|
(chainId) => {
|
|
4652
5759
|
setSelectedChainId(chainId);
|
|
4653
5760
|
void writeSelectedChainId(userId, chainId);
|
|
@@ -4687,15 +5794,15 @@ function warn(name, error) {
|
|
|
4687
5794
|
}
|
|
4688
5795
|
|
|
4689
5796
|
// src/flow/useCopiedToast.tsx
|
|
4690
|
-
import { useCallback as
|
|
4691
|
-
import { StyleSheet as
|
|
4692
|
-
import { useSafeAreaInsets as
|
|
5797
|
+
import { useCallback as useCallback9, useEffect as useEffect20, useRef as useRef13, useState as useState14 } from "react";
|
|
5798
|
+
import { StyleSheet as StyleSheet18, View as View5 } from "react-native";
|
|
5799
|
+
import { useSafeAreaInsets as useSafeAreaInsets7 } from "react-native-safe-area-context";
|
|
4693
5800
|
|
|
4694
5801
|
// src/flow/AddressCopiedToast.tsx
|
|
4695
|
-
import { StyleSheet as
|
|
4696
|
-
import
|
|
4697
|
-
import { jsx as
|
|
4698
|
-
var enterAnimation = new
|
|
5802
|
+
import { StyleSheet as StyleSheet17 } from "react-native";
|
|
5803
|
+
import Animated8, { Easing as Easing6, FadeOutUp, Keyframe as Keyframe5 } from "react-native-reanimated";
|
|
5804
|
+
import { jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5805
|
+
var enterAnimation = new Keyframe5({
|
|
4699
5806
|
0: {
|
|
4700
5807
|
opacity: 0,
|
|
4701
5808
|
transform: [{ translateY: 8 }, { scale: 0.96 }]
|
|
@@ -4703,7 +5810,7 @@ var enterAnimation = new Keyframe2({
|
|
|
4703
5810
|
100: {
|
|
4704
5811
|
opacity: 1,
|
|
4705
5812
|
transform: [{ translateY: 0 }, { scale: 1 }],
|
|
4706
|
-
easing:
|
|
5813
|
+
easing: Easing6.bezier(0.34, 1.36, 0.64, 1)
|
|
4707
5814
|
}
|
|
4708
5815
|
}).duration(450);
|
|
4709
5816
|
var exitAnimation = FadeOutUp.duration(350);
|
|
@@ -4711,17 +5818,17 @@ function AddressCopiedToast() {
|
|
|
4711
5818
|
const { t } = useFunkitTranslation();
|
|
4712
5819
|
const label = t("common.addressCopied");
|
|
4713
5820
|
const theme = useTheme();
|
|
4714
|
-
return /* @__PURE__ */
|
|
4715
|
-
|
|
5821
|
+
return /* @__PURE__ */ jsxs16(
|
|
5822
|
+
Animated8.View,
|
|
4716
5823
|
{
|
|
4717
5824
|
entering: enterAnimation,
|
|
4718
5825
|
exiting: exitAnimation,
|
|
4719
|
-
style: [
|
|
5826
|
+
style: [styles16.pill, { backgroundColor: theme.background.pill.default }],
|
|
4720
5827
|
accessibilityRole: "alert",
|
|
4721
5828
|
accessibilityLabel: label,
|
|
4722
5829
|
children: [
|
|
4723
|
-
/* @__PURE__ */
|
|
4724
|
-
/* @__PURE__ */
|
|
5830
|
+
/* @__PURE__ */ jsx37(Text, { variant: "bodyMedium", children: label }),
|
|
5831
|
+
/* @__PURE__ */ jsx37(FigmaSuccessCheckIcon, { size: 16 })
|
|
4725
5832
|
]
|
|
4726
5833
|
}
|
|
4727
5834
|
);
|
|
@@ -4738,29 +5845,29 @@ var pill = {
|
|
|
4738
5845
|
shadowOffset: { width: 0, height: 4 },
|
|
4739
5846
|
shadowRadius: 12
|
|
4740
5847
|
};
|
|
4741
|
-
var
|
|
5848
|
+
var styles16 = StyleSheet17.create({ pill });
|
|
4742
5849
|
|
|
4743
5850
|
// src/flow/useCopiedToast.tsx
|
|
4744
|
-
import { jsx as
|
|
5851
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
4745
5852
|
var TOAST_VISIBLE_MS = 1800;
|
|
4746
5853
|
var TOAST_EXIT_MS = 350;
|
|
4747
5854
|
var TOAST_INSET_OFFSET = 20;
|
|
4748
5855
|
var toastOverlay = {
|
|
4749
|
-
...
|
|
5856
|
+
...StyleSheet18.absoluteFill,
|
|
4750
5857
|
zIndex: 1,
|
|
4751
5858
|
alignItems: "center"
|
|
4752
5859
|
};
|
|
4753
5860
|
function useCopiedToast() {
|
|
4754
|
-
const insets =
|
|
4755
|
-
const [toastMounted, setToastMounted] =
|
|
4756
|
-
const [copiedToastShown, setCopiedToastShown] =
|
|
4757
|
-
const hideTimerRef =
|
|
5861
|
+
const insets = useSafeAreaInsets7();
|
|
5862
|
+
const [toastMounted, setToastMounted] = useState14(false);
|
|
5863
|
+
const [copiedToastShown, setCopiedToastShown] = useState14(false);
|
|
5864
|
+
const hideTimerRef = useRef13(
|
|
4758
5865
|
void 0
|
|
4759
5866
|
);
|
|
4760
|
-
const unmountTimerRef =
|
|
5867
|
+
const unmountTimerRef = useRef13(
|
|
4761
5868
|
void 0
|
|
4762
5869
|
);
|
|
4763
|
-
const clearToast =
|
|
5870
|
+
const clearToast = useCallback9(() => {
|
|
4764
5871
|
if (hideTimerRef.current) {
|
|
4765
5872
|
clearTimeout(hideTimerRef.current);
|
|
4766
5873
|
}
|
|
@@ -4770,7 +5877,7 @@ function useCopiedToast() {
|
|
|
4770
5877
|
setCopiedToastShown(false);
|
|
4771
5878
|
setToastMounted(false);
|
|
4772
5879
|
}, []);
|
|
4773
|
-
const showCopiedToast =
|
|
5880
|
+
const showCopiedToast = useCallback9(() => {
|
|
4774
5881
|
if (hideTimerRef.current) {
|
|
4775
5882
|
clearTimeout(hideTimerRef.current);
|
|
4776
5883
|
}
|
|
@@ -4787,13 +5894,13 @@ function useCopiedToast() {
|
|
|
4787
5894
|
);
|
|
4788
5895
|
}, TOAST_VISIBLE_MS);
|
|
4789
5896
|
}, []);
|
|
4790
|
-
|
|
4791
|
-
const toast = toastMounted ? /* @__PURE__ */
|
|
5897
|
+
useEffect20(() => () => clearToast(), [clearToast]);
|
|
5898
|
+
const toast = toastMounted ? /* @__PURE__ */ jsx38(
|
|
4792
5899
|
View5,
|
|
4793
5900
|
{
|
|
4794
5901
|
style: [toastOverlay, { paddingTop: insets.top + TOAST_INSET_OFFSET }],
|
|
4795
5902
|
pointerEvents: "none",
|
|
4796
|
-
children: copiedToastShown ? /* @__PURE__ */
|
|
5903
|
+
children: copiedToastShown ? /* @__PURE__ */ jsx38(AddressCopiedToast, {}) : null
|
|
4797
5904
|
}
|
|
4798
5905
|
) : null;
|
|
4799
5906
|
return { toast, showCopiedToast, clearToast };
|
|
@@ -4801,10 +5908,10 @@ function useCopiedToast() {
|
|
|
4801
5908
|
|
|
4802
5909
|
// src/flow/WithdrawalFlowContent.tsx
|
|
4803
5910
|
import { useQueryClient } from "@tanstack/react-query";
|
|
4804
|
-
import { useCallback as useCallback14, useState as
|
|
5911
|
+
import { useCallback as useCallback14, useState as useState24 } from "react";
|
|
4805
5912
|
|
|
4806
5913
|
// src/screens/WithdrawCryptoComplete.tsx
|
|
4807
|
-
import { useEffect as
|
|
5914
|
+
import { useEffect as useEffect22, useRef as useRef15 } from "react";
|
|
4808
5915
|
|
|
4809
5916
|
// src/withdrawal/useDepositAddressWithdrawalStatus.ts
|
|
4810
5917
|
import {
|
|
@@ -4812,7 +5919,7 @@ import {
|
|
|
4812
5919
|
resolveOnChainCompletionTxHash,
|
|
4813
5920
|
useDirectExecutionForDepositAddress
|
|
4814
5921
|
} from "@funkit/connect-core";
|
|
4815
|
-
import { useEffect as
|
|
5922
|
+
import { useEffect as useEffect21, useState as useState15 } from "react";
|
|
4816
5923
|
|
|
4817
5924
|
// src/withdrawal/useWithdrawalStatus.ts
|
|
4818
5925
|
import {
|
|
@@ -4826,7 +5933,7 @@ import {
|
|
|
4826
5933
|
mapRelayExecutionStatusToCheckoutState
|
|
4827
5934
|
} from "@funkit/connect-core";
|
|
4828
5935
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
4829
|
-
import { useRef as
|
|
5936
|
+
import { useRef as useRef14 } from "react";
|
|
4830
5937
|
var WITHDRAWAL_STATUS_QUERY_KEY = "withdrawalStatus";
|
|
4831
5938
|
var POLL_INTERVAL_MS = 1500;
|
|
4832
5939
|
var MAX_FETCHES_WITHOUT_RECORD = 10;
|
|
@@ -4842,8 +5949,8 @@ function shouldKeepPollingStatus({
|
|
|
4842
5949
|
}
|
|
4843
5950
|
function useWithdrawalStatus(txHash) {
|
|
4844
5951
|
const { apiKey } = useFunkitIdentity();
|
|
4845
|
-
const notFoundFetches =
|
|
4846
|
-
const countedFor =
|
|
5952
|
+
const notFoundFetches = useRef14(0);
|
|
5953
|
+
const countedFor = useRef14(txHash);
|
|
4847
5954
|
if (countedFor.current !== txHash) {
|
|
4848
5955
|
countedFor.current = txHash;
|
|
4849
5956
|
notFoundFetches.current = 0;
|
|
@@ -4892,130 +5999,59 @@ function useWithdrawalStatus(txHash) {
|
|
|
4892
5999
|
isCompleted: state === CheckoutState.COMPLETED,
|
|
4893
6000
|
isFailed: state === CheckoutState.CHECKOUT_ERROR,
|
|
4894
6001
|
isRefunded: status === RelayExecutionStatus.REFUND
|
|
4895
|
-
};
|
|
4896
|
-
}
|
|
4897
|
-
|
|
4898
|
-
// src/withdrawal/useDepositAddressWithdrawalStatus.ts
|
|
4899
|
-
var DEFAULT_POLL_INTERVAL_MS = 1e4;
|
|
4900
|
-
function useDepositAddressWithdrawalStatus(depositAddress, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS) {
|
|
4901
|
-
const { apiKey, walletAddress } = useFunkitIdentity();
|
|
4902
|
-
const [hasSettled, setHasSettled] =
|
|
4903
|
-
const { latestStep, isFinalStep } = useDirectExecutionForDepositAddress({
|
|
4904
|
-
depositAddress,
|
|
4905
|
-
apiKey,
|
|
4906
|
-
// The wallet, not the host's `userId`: the deposit address is registered
|
|
4907
|
-
// under the owner wallet, and the scanner records the arrival there.
|
|
4908
|
-
// The unset sentinel is truthy, so the finder needs it mapped away or it
|
|
4909
|
-
// polls for a user that does not exist.
|
|
4910
|
-
walletAddress: walletAddress === UNSET_WALLET_ADDRESS ? "" : walletAddress,
|
|
4911
|
-
pollIntervalMs,
|
|
4912
|
-
hasSettled,
|
|
4913
|
-
logger
|
|
4914
|
-
});
|
|
4915
|
-
const arrivalStatus = useWithdrawalStatus(latestStep?.txHash);
|
|
4916
|
-
const isCompleted = arrivalStatus.isCompleted && isFinalStep;
|
|
4917
|
-
const completionTxHash = latestStep ? resolveOnChainCompletionTxHash(
|
|
4918
|
-
latestStep,
|
|
4919
|
-
getCompletionTxInfo(latestStep).txHash
|
|
4920
|
-
) : void 0;
|
|
4921
|
-
|
|
4922
|
-
if (isCompleted || arrivalStatus.isFailed) {
|
|
4923
|
-
setHasSettled(true);
|
|
4924
|
-
}
|
|
4925
|
-
}, [isCompleted, arrivalStatus.isFailed]);
|
|
4926
|
-
return { ...arrivalStatus, isCompleted, txHash: completionTxHash };
|
|
4927
|
-
}
|
|
4928
|
-
|
|
4929
|
-
// src/screens/WithdrawCompleteScreen.tsx
|
|
4930
|
-
import {
|
|
4931
|
-
ActivityIndicator as ActivityIndicator2,
|
|
4932
|
-
StyleSheet as StyleSheet14,
|
|
4933
|
-
useWindowDimensions as useWindowDimensions3
|
|
4934
|
-
} from "react-native";
|
|
4935
|
-
import { useSafeAreaInsets as useSafeAreaInsets7 } from "react-native-safe-area-context";
|
|
4936
|
-
|
|
4937
|
-
// src/components/PillButton.tsx
|
|
4938
|
-
import { Pressable as Pressable7, StyleSheet as StyleSheet12 } from "react-native";
|
|
4939
|
-
import { jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4940
|
-
function PillButton2({
|
|
4941
|
-
label,
|
|
4942
|
-
onPress,
|
|
4943
|
-
icon,
|
|
4944
|
-
size = "buttonLg",
|
|
4945
|
-
variant = "primary",
|
|
4946
|
-
radius = "button",
|
|
4947
|
-
disabled = false,
|
|
4948
|
-
accessibilityLabel
|
|
4949
|
-
}) {
|
|
4950
|
-
const theme = useTheme();
|
|
4951
|
-
const surface = theme.background.button[variant];
|
|
4952
|
-
const labelColor = theme.content.button[variant].default;
|
|
4953
|
-
return /* @__PURE__ */ jsx30(
|
|
4954
|
-
Pressable7,
|
|
4955
|
-
{
|
|
4956
|
-
onPress,
|
|
4957
|
-
disabled,
|
|
4958
|
-
accessibilityRole: "button",
|
|
4959
|
-
accessibilityLabel: accessibilityLabel ?? label,
|
|
4960
|
-
accessibilityState: { disabled },
|
|
4961
|
-
children: /* @__PURE__ */ jsx30(
|
|
4962
|
-
Box,
|
|
4963
|
-
{
|
|
4964
|
-
borderRadius: radius,
|
|
4965
|
-
style: { backgroundColor: theme.background.modal },
|
|
4966
|
-
children: /* @__PURE__ */ jsxs14(
|
|
4967
|
-
Box,
|
|
4968
|
-
{
|
|
4969
|
-
flexDirection: "row",
|
|
4970
|
-
alignItems: "center",
|
|
4971
|
-
justifyContent: "center",
|
|
4972
|
-
borderRadius: radius,
|
|
4973
|
-
style: [
|
|
4974
|
-
styles10.pill,
|
|
4975
|
-
variant === "secondary" ? styles10.secondaryPill : null,
|
|
4976
|
-
{
|
|
4977
|
-
height: theme.sizes[size],
|
|
4978
|
-
backgroundColor: surface.default,
|
|
4979
|
-
opacity: disabled ? theme.opacity.disabled / 100 : 1
|
|
4980
|
-
}
|
|
4981
|
-
],
|
|
4982
|
-
children: [
|
|
4983
|
-
icon,
|
|
4984
|
-
/* @__PURE__ */ jsx30(
|
|
4985
|
-
Text,
|
|
4986
|
-
{
|
|
4987
|
-
variant: "bodyMedium",
|
|
4988
|
-
numberOfLines: 1,
|
|
4989
|
-
style: { color: labelColor },
|
|
4990
|
-
children: label
|
|
4991
|
-
}
|
|
4992
|
-
)
|
|
4993
|
-
]
|
|
4994
|
-
}
|
|
4995
|
-
)
|
|
4996
|
-
}
|
|
4997
|
-
)
|
|
6002
|
+
};
|
|
6003
|
+
}
|
|
6004
|
+
|
|
6005
|
+
// src/withdrawal/useDepositAddressWithdrawalStatus.ts
|
|
6006
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e4;
|
|
6007
|
+
function useDepositAddressWithdrawalStatus(depositAddress, pollIntervalMs = DEFAULT_POLL_INTERVAL_MS) {
|
|
6008
|
+
const { apiKey, walletAddress } = useFunkitIdentity();
|
|
6009
|
+
const [hasSettled, setHasSettled] = useState15(false);
|
|
6010
|
+
const { latestStep, isFinalStep } = useDirectExecutionForDepositAddress({
|
|
6011
|
+
depositAddress,
|
|
6012
|
+
apiKey,
|
|
6013
|
+
// The wallet, not the host's `userId`: the deposit address is registered
|
|
6014
|
+
// under the owner wallet, and the scanner records the arrival there.
|
|
6015
|
+
// The unset sentinel is truthy, so the finder needs it mapped away or it
|
|
6016
|
+
// polls for a user that does not exist.
|
|
6017
|
+
walletAddress: walletAddress === UNSET_WALLET_ADDRESS ? "" : walletAddress,
|
|
6018
|
+
pollIntervalMs,
|
|
6019
|
+
hasSettled,
|
|
6020
|
+
logger
|
|
6021
|
+
});
|
|
6022
|
+
const arrivalStatus = useWithdrawalStatus(latestStep?.txHash);
|
|
6023
|
+
const isCompleted = arrivalStatus.isCompleted && isFinalStep;
|
|
6024
|
+
const completionTxHash = latestStep ? resolveOnChainCompletionTxHash(
|
|
6025
|
+
latestStep,
|
|
6026
|
+
getCompletionTxInfo(latestStep).txHash
|
|
6027
|
+
) : void 0;
|
|
6028
|
+
useEffect21(() => {
|
|
6029
|
+
if (isCompleted || arrivalStatus.isFailed) {
|
|
6030
|
+
setHasSettled(true);
|
|
4998
6031
|
}
|
|
4999
|
-
);
|
|
6032
|
+
}, [isCompleted, arrivalStatus.isFailed]);
|
|
6033
|
+
return { ...arrivalStatus, isCompleted, txHash: completionTxHash };
|
|
5000
6034
|
}
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
6035
|
+
|
|
6036
|
+
// src/screens/WithdrawCompleteScreen.tsx
|
|
6037
|
+
import {
|
|
6038
|
+
ActivityIndicator as ActivityIndicator2,
|
|
6039
|
+
StyleSheet as StyleSheet20,
|
|
6040
|
+
useWindowDimensions as useWindowDimensions5
|
|
6041
|
+
} from "react-native";
|
|
6042
|
+
import { useSafeAreaInsets as useSafeAreaInsets8 } from "react-native-safe-area-context";
|
|
5007
6043
|
|
|
5008
6044
|
// src/components/ReceiveAmountSummary.tsx
|
|
5009
|
-
import { Pressable as
|
|
5010
|
-
import
|
|
5011
|
-
Easing as
|
|
6045
|
+
import { Pressable as Pressable11, StyleSheet as StyleSheet19 } from "react-native";
|
|
6046
|
+
import Animated10, {
|
|
6047
|
+
Easing as Easing7,
|
|
5012
6048
|
FadeIn,
|
|
5013
|
-
LinearTransition
|
|
6049
|
+
LinearTransition as LinearTransition2
|
|
5014
6050
|
} from "react-native-reanimated";
|
|
5015
6051
|
|
|
5016
6052
|
// src/components/SkeletonBar.tsx
|
|
5017
|
-
import { Animated as
|
|
5018
|
-
import { jsx as
|
|
6053
|
+
import { Animated as Animated9 } from "react-native";
|
|
6054
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
5019
6055
|
function SkeletonBar({
|
|
5020
6056
|
width,
|
|
5021
6057
|
height,
|
|
@@ -5023,8 +6059,8 @@ function SkeletonBar({
|
|
|
5023
6059
|
}) {
|
|
5024
6060
|
const theme = useTheme();
|
|
5025
6061
|
const opacity = usePulse();
|
|
5026
|
-
return /* @__PURE__ */
|
|
5027
|
-
|
|
6062
|
+
return /* @__PURE__ */ jsx39(
|
|
6063
|
+
Animated9.View,
|
|
5028
6064
|
{
|
|
5029
6065
|
accessibilityRole: "progressbar",
|
|
5030
6066
|
style: {
|
|
@@ -5039,18 +6075,18 @@ function SkeletonBar({
|
|
|
5039
6075
|
}
|
|
5040
6076
|
|
|
5041
6077
|
// src/components/ReceiveAmountSummary.tsx
|
|
5042
|
-
import { jsx as
|
|
5043
|
-
var
|
|
6078
|
+
import { jsx as jsx40, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
6079
|
+
var AnimatedBox5 = Animated10.createAnimatedComponent(Box);
|
|
5044
6080
|
var ICON_ENTERING = FadeIn.duration(420);
|
|
5045
|
-
var DISPLACED_TRANSITION =
|
|
5046
|
-
|
|
6081
|
+
var DISPLACED_TRANSITION = LinearTransition2.duration(420).easing(
|
|
6082
|
+
Easing7.bezier(0.34, 1.56, 0.64, 1)
|
|
5047
6083
|
);
|
|
5048
|
-
var
|
|
6084
|
+
var AMOUNT_FONT_SIZE2 = 64;
|
|
5049
6085
|
var LETTER_SPACING_RATIO = -0.96 / 64;
|
|
5050
6086
|
var LINE_HEIGHT_RATIO = 1.25;
|
|
5051
6087
|
var CAP_BOX_RATIO = 45 / 64;
|
|
5052
|
-
var AMOUNT_LINE_HEIGHT =
|
|
5053
|
-
var AMOUNT_OVERHANG =
|
|
6088
|
+
var AMOUNT_LINE_HEIGHT = AMOUNT_FONT_SIZE2 * LINE_HEIGHT_RATIO;
|
|
6089
|
+
var AMOUNT_OVERHANG = AMOUNT_FONT_SIZE2 * (LINE_HEIGHT_RATIO - CAP_BOX_RATIO) / 2;
|
|
5054
6090
|
var AMOUNT_SKELETON_WIDTH = 200;
|
|
5055
6091
|
var TOKEN_SKELETON_WIDTH = 96;
|
|
5056
6092
|
function ReceiveAmountSummary({
|
|
@@ -5063,24 +6099,24 @@ function ReceiveAmountSummary({
|
|
|
5063
6099
|
}) {
|
|
5064
6100
|
const { t } = useFunkitTranslation();
|
|
5065
6101
|
const theme = useTheme();
|
|
5066
|
-
return /* @__PURE__ */
|
|
5067
|
-
|
|
6102
|
+
return /* @__PURE__ */ jsxs17(
|
|
6103
|
+
AnimatedBox5,
|
|
5068
6104
|
{
|
|
5069
6105
|
alignItems: "center",
|
|
5070
6106
|
justifyContent: "center",
|
|
5071
6107
|
layout: DISPLACED_TRANSITION,
|
|
5072
|
-
style:
|
|
6108
|
+
style: styles17.root,
|
|
5073
6109
|
children: [
|
|
5074
|
-
icon ? /* @__PURE__ */
|
|
5075
|
-
/* @__PURE__ */
|
|
5076
|
-
|
|
6110
|
+
icon ? /* @__PURE__ */ jsx40(AnimatedBox5, { entering: ICON_ENTERING, children: icon }) : null,
|
|
6111
|
+
/* @__PURE__ */ jsxs17(
|
|
6112
|
+
AnimatedBox5,
|
|
5077
6113
|
{
|
|
5078
6114
|
alignItems: "center",
|
|
5079
6115
|
alignSelf: "stretch",
|
|
5080
6116
|
layout: DISPLACED_TRANSITION,
|
|
5081
|
-
style:
|
|
6117
|
+
style: styles17.figure,
|
|
5082
6118
|
children: [
|
|
5083
|
-
/* @__PURE__ */
|
|
6119
|
+
/* @__PURE__ */ jsx40(
|
|
5084
6120
|
Text,
|
|
5085
6121
|
{
|
|
5086
6122
|
variant: "detail",
|
|
@@ -5089,45 +6125,45 @@ function ReceiveAmountSummary({
|
|
|
5089
6125
|
children: label
|
|
5090
6126
|
}
|
|
5091
6127
|
),
|
|
5092
|
-
usdLabel === void 0 ? null : /* @__PURE__ */
|
|
6128
|
+
usdLabel === void 0 ? null : /* @__PURE__ */ jsx40(
|
|
5093
6129
|
Text,
|
|
5094
6130
|
{
|
|
5095
6131
|
weight: "medium",
|
|
5096
6132
|
numberOfLines: 1,
|
|
5097
|
-
style: [
|
|
6133
|
+
style: [styles17.amount, { color: theme.content.elements.primary }],
|
|
5098
6134
|
children: usdLabel
|
|
5099
6135
|
}
|
|
5100
6136
|
),
|
|
5101
|
-
usdLabel === void 0 && isQuotePending ? /* @__PURE__ */
|
|
6137
|
+
usdLabel === void 0 && isQuotePending ? /* @__PURE__ */ jsx40(
|
|
5102
6138
|
SkeletonBar,
|
|
5103
6139
|
{
|
|
5104
6140
|
width: AMOUNT_SKELETON_WIDTH,
|
|
5105
|
-
height:
|
|
6141
|
+
height: AMOUNT_FONT_SIZE2 * CAP_BOX_RATIO,
|
|
5106
6142
|
borderRadius: theme.borderRadii.element
|
|
5107
6143
|
}
|
|
5108
6144
|
) : null,
|
|
5109
|
-
tokenLabel === void 0 && isQuotePending ? /* @__PURE__ */
|
|
6145
|
+
tokenLabel === void 0 && isQuotePending ? /* @__PURE__ */ jsx40(
|
|
5110
6146
|
SkeletonBar,
|
|
5111
6147
|
{
|
|
5112
6148
|
width: TOKEN_SKELETON_WIDTH,
|
|
5113
6149
|
height: theme.textVariants.bodyMedium.lineHeight
|
|
5114
6150
|
}
|
|
5115
6151
|
) : null,
|
|
5116
|
-
tokenLabel === void 0 ? null : /* @__PURE__ */
|
|
5117
|
-
|
|
6152
|
+
tokenLabel === void 0 ? null : /* @__PURE__ */ jsx40(
|
|
6153
|
+
Pressable11,
|
|
5118
6154
|
{
|
|
5119
6155
|
onPress: onPressBreakdown,
|
|
5120
6156
|
disabled: !onPressBreakdown,
|
|
5121
6157
|
accessibilityRole: onPressBreakdown ? "button" : void 0,
|
|
5122
6158
|
accessibilityLabel: onPressBreakdown ? t("withdrawAddress.breakdownTitle") : tokenLabel,
|
|
5123
|
-
children: /* @__PURE__ */
|
|
6159
|
+
children: /* @__PURE__ */ jsxs17(
|
|
5124
6160
|
Box,
|
|
5125
6161
|
{
|
|
5126
6162
|
flexDirection: "row",
|
|
5127
6163
|
alignItems: "center",
|
|
5128
|
-
style:
|
|
6164
|
+
style: styles17.tokenRow,
|
|
5129
6165
|
children: [
|
|
5130
|
-
/* @__PURE__ */
|
|
6166
|
+
/* @__PURE__ */ jsx40(
|
|
5131
6167
|
Text,
|
|
5132
6168
|
{
|
|
5133
6169
|
variant: "bodyMedium",
|
|
@@ -5135,7 +6171,7 @@ function ReceiveAmountSummary({
|
|
|
5135
6171
|
children: tokenLabel
|
|
5136
6172
|
}
|
|
5137
6173
|
),
|
|
5138
|
-
onPressBreakdown ? /* @__PURE__ */
|
|
6174
|
+
onPressBreakdown ? /* @__PURE__ */ jsx40(
|
|
5139
6175
|
FigmaInfoCircleIcon,
|
|
5140
6176
|
{
|
|
5141
6177
|
size: 16,
|
|
@@ -5154,13 +6190,13 @@ function ReceiveAmountSummary({
|
|
|
5154
6190
|
}
|
|
5155
6191
|
);
|
|
5156
6192
|
}
|
|
5157
|
-
var
|
|
6193
|
+
var styles17 = StyleSheet19.create({
|
|
5158
6194
|
root: { gap: 24 },
|
|
5159
6195
|
figure: { gap: 24 },
|
|
5160
6196
|
amount: {
|
|
5161
|
-
fontSize:
|
|
6197
|
+
fontSize: AMOUNT_FONT_SIZE2,
|
|
5162
6198
|
lineHeight: AMOUNT_LINE_HEIGHT,
|
|
5163
|
-
letterSpacing:
|
|
6199
|
+
letterSpacing: AMOUNT_FONT_SIZE2 * LETTER_SPACING_RATIO,
|
|
5164
6200
|
marginVertical: -AMOUNT_OVERHANG
|
|
5165
6201
|
},
|
|
5166
6202
|
tokenRow: { gap: 6 }
|
|
@@ -5174,7 +6210,7 @@ function footerBottomMargin(bottomInset2) {
|
|
|
5174
6210
|
}
|
|
5175
6211
|
|
|
5176
6212
|
// src/screens/WithdrawCompleteScreen.tsx
|
|
5177
|
-
import { jsx as
|
|
6213
|
+
import { jsx as jsx41, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5178
6214
|
var OUTCOME_ICON_SIZE = 46;
|
|
5179
6215
|
function WithdrawCompleteScreen({
|
|
5180
6216
|
status,
|
|
@@ -5185,13 +6221,13 @@ function WithdrawCompleteScreen({
|
|
|
5185
6221
|
}) {
|
|
5186
6222
|
const { t } = useFunkitTranslation();
|
|
5187
6223
|
const theme = useTheme();
|
|
5188
|
-
const { height } =
|
|
5189
|
-
const insets =
|
|
6224
|
+
const { height } = useWindowDimensions5();
|
|
6225
|
+
const insets = useSafeAreaInsets8();
|
|
5190
6226
|
const leadLabel = usdLabel ?? tokenLabel ?? amountLabel;
|
|
5191
6227
|
const secondaryLabel = usdLabel === void 0 ? void 0 : tokenLabel;
|
|
5192
6228
|
const isFailed = status === "failed" || status === "refunded";
|
|
5193
6229
|
const isSettling = status === "settling";
|
|
5194
|
-
return /* @__PURE__ */
|
|
6230
|
+
return /* @__PURE__ */ jsxs18(
|
|
5195
6231
|
Box,
|
|
5196
6232
|
{
|
|
5197
6233
|
style: {
|
|
@@ -5200,8 +6236,8 @@ function WithdrawCompleteScreen({
|
|
|
5200
6236
|
backgroundColor: theme.background.modal
|
|
5201
6237
|
},
|
|
5202
6238
|
children: [
|
|
5203
|
-
/* @__PURE__ */
|
|
5204
|
-
/* @__PURE__ */
|
|
6239
|
+
/* @__PURE__ */ jsxs18(Box, { flex: 1, justifyContent: "center", style: styles18.summary, children: [
|
|
6240
|
+
/* @__PURE__ */ jsx41(
|
|
5205
6241
|
ReceiveAmountSummary,
|
|
5206
6242
|
{
|
|
5207
6243
|
icon: resolveIcon({ theme, status }),
|
|
@@ -5211,27 +6247,27 @@ function WithdrawCompleteScreen({
|
|
|
5211
6247
|
isQuotePending: false
|
|
5212
6248
|
}
|
|
5213
6249
|
),
|
|
5214
|
-
isFailed ? /* @__PURE__ */
|
|
6250
|
+
isFailed ? /* @__PURE__ */ jsx41(
|
|
5215
6251
|
Text,
|
|
5216
6252
|
{
|
|
5217
6253
|
variant: "detail",
|
|
5218
|
-
style: [
|
|
6254
|
+
style: [styles18.detail, { color: theme.content.elements.secondary }],
|
|
5219
6255
|
children: status === "refunded" ? t("withdrawCrypto.refundedMessage", { amount: amountLabel }) : t("withdrawCrypto.failedMessage", { amount: amountLabel })
|
|
5220
6256
|
}
|
|
5221
6257
|
) : null
|
|
5222
6258
|
] }),
|
|
5223
|
-
/* @__PURE__ */
|
|
6259
|
+
/* @__PURE__ */ jsx41(
|
|
5224
6260
|
Box,
|
|
5225
6261
|
{
|
|
5226
6262
|
style: [
|
|
5227
|
-
|
|
6263
|
+
styles18.footer,
|
|
5228
6264
|
{ marginBottom: footerBottomMargin(insets.bottom) }
|
|
5229
6265
|
],
|
|
5230
|
-
children: isSettling ? /* @__PURE__ */
|
|
6266
|
+
children: isSettling ? /* @__PURE__ */ jsx41(
|
|
5231
6267
|
PillButton2,
|
|
5232
6268
|
{
|
|
5233
6269
|
label: t("withdrawAddress.withdrawing"),
|
|
5234
|
-
icon: /* @__PURE__ */
|
|
6270
|
+
icon: /* @__PURE__ */ jsx41(
|
|
5235
6271
|
ActivityIndicator2,
|
|
5236
6272
|
{
|
|
5237
6273
|
size: "small",
|
|
@@ -5241,7 +6277,7 @@ function WithdrawCompleteScreen({
|
|
|
5241
6277
|
disabled: true,
|
|
5242
6278
|
onPress: onDone
|
|
5243
6279
|
}
|
|
5244
|
-
) : /* @__PURE__ */
|
|
6280
|
+
) : /* @__PURE__ */ jsx41(PillButton2, { label: t("common.close"), onPress: onDone })
|
|
5245
6281
|
}
|
|
5246
6282
|
)
|
|
5247
6283
|
]
|
|
@@ -5255,7 +6291,7 @@ function resolveIcon({
|
|
|
5255
6291
|
switch (status) {
|
|
5256
6292
|
case "failed":
|
|
5257
6293
|
case "refunded":
|
|
5258
|
-
return /* @__PURE__ */
|
|
6294
|
+
return /* @__PURE__ */ jsx41(
|
|
5259
6295
|
FigmaAlertCircleIcon,
|
|
5260
6296
|
{
|
|
5261
6297
|
size: OUTCOME_ICON_SIZE,
|
|
@@ -5266,7 +6302,7 @@ function resolveIcon({
|
|
|
5266
6302
|
case "settling":
|
|
5267
6303
|
return void 0;
|
|
5268
6304
|
default:
|
|
5269
|
-
return /* @__PURE__ */
|
|
6305
|
+
return /* @__PURE__ */ jsx41(FigmaSuccessCheckIcon, { size: OUTCOME_ICON_SIZE });
|
|
5270
6306
|
}
|
|
5271
6307
|
}
|
|
5272
6308
|
function resolveLabel({
|
|
@@ -5287,7 +6323,7 @@ function resolveLabel({
|
|
|
5287
6323
|
return t("withdrawAddress.withdrew");
|
|
5288
6324
|
}
|
|
5289
6325
|
}
|
|
5290
|
-
var
|
|
6326
|
+
var styles18 = StyleSheet20.create({
|
|
5291
6327
|
// The band the figure is centred in, matching the recipient step's own, so the
|
|
5292
6328
|
// amount doesn't move when this screen replaces it.
|
|
5293
6329
|
summary: { paddingHorizontal: 20, paddingVertical: 12, gap: 16 },
|
|
@@ -5296,7 +6332,7 @@ var styles12 = StyleSheet14.create({
|
|
|
5296
6332
|
});
|
|
5297
6333
|
|
|
5298
6334
|
// src/screens/WithdrawCryptoComplete.tsx
|
|
5299
|
-
import { jsx as
|
|
6335
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
5300
6336
|
function WithdrawCryptoComplete({
|
|
5301
6337
|
depositAddressOrHash,
|
|
5302
6338
|
amountLabel,
|
|
@@ -5314,8 +6350,8 @@ function WithdrawCryptoComplete({
|
|
|
5314
6350
|
);
|
|
5315
6351
|
const { isCompleted, isFailed, isRefunded } = isVenueSubmitted ? byDepositAddress : byTransaction;
|
|
5316
6352
|
const txHash = isVenueSubmitted ? byDepositAddress.txHash : depositAddressOrHash.txHash;
|
|
5317
|
-
const notifiedRef =
|
|
5318
|
-
|
|
6353
|
+
const notifiedRef = useRef15(false);
|
|
6354
|
+
useEffect22(() => {
|
|
5319
6355
|
if (notifiedRef.current) {
|
|
5320
6356
|
return;
|
|
5321
6357
|
}
|
|
@@ -5331,7 +6367,7 @@ function WithdrawCryptoComplete({
|
|
|
5331
6367
|
});
|
|
5332
6368
|
}
|
|
5333
6369
|
}, [isCompleted, isFailed, isRefunded, callbacks, txHash]);
|
|
5334
|
-
|
|
6370
|
+
useEffect22(
|
|
5335
6371
|
() => () => {
|
|
5336
6372
|
if (notifiedRef.current) {
|
|
5337
6373
|
return;
|
|
@@ -5348,7 +6384,7 @@ function WithdrawCryptoComplete({
|
|
|
5348
6384
|
},
|
|
5349
6385
|
[depositAddressOrHash, isVenueSubmitted]
|
|
5350
6386
|
);
|
|
5351
|
-
return /* @__PURE__ */
|
|
6387
|
+
return /* @__PURE__ */ jsx42(
|
|
5352
6388
|
WithdrawCompleteScreen,
|
|
5353
6389
|
{
|
|
5354
6390
|
status: resolveStatus({
|
|
@@ -5385,25 +6421,8 @@ function resolveStatus({
|
|
|
5385
6421
|
// src/screens/WithdrawCryptoSteps.tsx
|
|
5386
6422
|
import { BottomSheetModal as BottomSheetModal4, BottomSheetView as BottomSheetView4 } from "@gorhom/bottom-sheet";
|
|
5387
6423
|
import { useFeatureGate as useFeatureGate2 } from "@funkit/connect-core";
|
|
5388
|
-
import { useState as
|
|
5389
|
-
import { useSafeAreaInsets as
|
|
5390
|
-
|
|
5391
|
-
// src/utils/formatAmount.ts
|
|
5392
|
-
function groupThousands(amount) {
|
|
5393
|
-
const [whole, ...fraction] = amount.split(".");
|
|
5394
|
-
const grouped = whole.replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
5395
|
-
return fraction.length > 0 ? `${grouped}.${fraction.join(".")}` : grouped;
|
|
5396
|
-
}
|
|
5397
|
-
var ASSET_DECIMALS = 5;
|
|
5398
|
-
function formatTokenAmount(amount, maxDecimals = ASSET_DECIMALS) {
|
|
5399
|
-
const [whole, fraction = ""] = amount.split(".");
|
|
5400
|
-
const capped = fraction.slice(0, maxDecimals).replace(/0+$/, "");
|
|
5401
|
-
const grouped = groupThousands(whole);
|
|
5402
|
-
return capped ? `${grouped}.${capped}` : grouped;
|
|
5403
|
-
}
|
|
5404
|
-
function formatUsd(value) {
|
|
5405
|
-
return `$${groupThousands(value.toFixed(2))}`;
|
|
5406
|
-
}
|
|
6424
|
+
import { useState as useState23 } from "react";
|
|
6425
|
+
import { useSafeAreaInsets as useSafeAreaInsets15 } from "react-native-safe-area-context";
|
|
5407
6426
|
|
|
5408
6427
|
// src/withdrawal/useCryptoWithdrawalForm.ts
|
|
5409
6428
|
import {
|
|
@@ -5412,7 +6431,7 @@ import {
|
|
|
5412
6431
|
resolveWithdrawalSourceTokenBalance,
|
|
5413
6432
|
useDebouncedValue
|
|
5414
6433
|
} from "@funkit/connect-core";
|
|
5415
|
-
import { useState as
|
|
6434
|
+
import { useState as useState18 } from "react";
|
|
5416
6435
|
|
|
5417
6436
|
// src/withdrawal/sourceToken.ts
|
|
5418
6437
|
function resolveWithdrawalSourceTokens(config) {
|
|
@@ -5689,7 +6708,7 @@ function useCryptoWithdrawalValidation({
|
|
|
5689
6708
|
|
|
5690
6709
|
// src/withdrawal/useWithdrawalAmountInput.ts
|
|
5691
6710
|
import { tokenAmountToUsd, usdToTokenAmount } from "@funkit/connect-core";
|
|
5692
|
-
import { useCallback as
|
|
6711
|
+
import { useCallback as useCallback10, useState as useState16 } from "react";
|
|
5693
6712
|
function withoutTrailingDot(value) {
|
|
5694
6713
|
return value.endsWith(".") ? value.slice(0, -1) : value;
|
|
5695
6714
|
}
|
|
@@ -5715,11 +6734,11 @@ function useWithdrawalAmountInput({
|
|
|
5715
6734
|
sourceUsdPrice,
|
|
5716
6735
|
sourceDecimals
|
|
5717
6736
|
}) {
|
|
5718
|
-
const [usdInput, setUsdInput] =
|
|
6737
|
+
const [usdInput, setUsdInput] = useState16("");
|
|
5719
6738
|
const canPriceInUsd = sourceUsdPrice > 0 && sourceDecimals !== void 0;
|
|
5720
|
-
const [prefersUsd, setPrefersUsd] =
|
|
6739
|
+
const [prefersUsd, setPrefersUsd] = useState16(true);
|
|
5721
6740
|
const inUsd = prefersUsd && canPriceInUsd;
|
|
5722
|
-
const [derivedFrom, setDerivedFrom] =
|
|
6741
|
+
const [derivedFrom, setDerivedFrom] = useState16({
|
|
5723
6742
|
amount: "",
|
|
5724
6743
|
isPriced: false
|
|
5725
6744
|
});
|
|
@@ -5732,7 +6751,7 @@ function useWithdrawalAmountInput({
|
|
|
5732
6751
|
amount === "" || !canPriceInUsd ? "" : tokenAmountToUsd(withoutTrailingDot(amount), sourceUsdPrice)
|
|
5733
6752
|
);
|
|
5734
6753
|
}
|
|
5735
|
-
const setInput =
|
|
6754
|
+
const setInput = useCallback10(
|
|
5736
6755
|
(next) => {
|
|
5737
6756
|
if (!inUsd) {
|
|
5738
6757
|
setAmount(next);
|
|
@@ -5760,7 +6779,7 @@ function useWithdrawalAmountInput({
|
|
|
5760
6779
|
* - The staleness is bounded by refreshing the price on the way into this
|
|
5761
6780
|
* screen rather than while it is open.
|
|
5762
6781
|
*/
|
|
5763
|
-
swapDenomination:
|
|
6782
|
+
swapDenomination: useCallback10(() => setPrefersUsd((was) => !was), []),
|
|
5764
6783
|
/** Offering the swap without a rate would promise one we don't have. */
|
|
5765
6784
|
canSwapDenomination: canPriceInUsd,
|
|
5766
6785
|
/** What the amount is worth, or `undefined` when nothing prices it. */
|
|
@@ -5778,7 +6797,7 @@ function useWithdrawalAmountInput({
|
|
|
5778
6797
|
import { getSupportedAssets as getSupportedAssets2 } from "@funkit/api-base";
|
|
5779
6798
|
import { resolveTokenTransferConfig as resolveTokenTransferConfig2 } from "@funkit/connect-core";
|
|
5780
6799
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
5781
|
-
import { useMemo as useMemo8, useState as
|
|
6800
|
+
import { useMemo as useMemo8, useState as useState17 } from "react";
|
|
5782
6801
|
var WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY = "withdrawalDestinations";
|
|
5783
6802
|
function useWithdrawalDestinationTokens({
|
|
5784
6803
|
sourceToken,
|
|
@@ -5816,7 +6835,7 @@ function useWithdrawalDestinationTokens({
|
|
|
5816
6835
|
symbols: resolved.symbolsByChainId[chainId] ?? []
|
|
5817
6836
|
}));
|
|
5818
6837
|
}, [resolved]);
|
|
5819
|
-
const [picked, setPicked] =
|
|
6838
|
+
const [picked, setPicked] = useState17();
|
|
5820
6839
|
const destinationToken = useMemo8(() => {
|
|
5821
6840
|
if (!resolved) {
|
|
5822
6841
|
return void 0;
|
|
@@ -5904,10 +6923,10 @@ function useCryptoWithdrawalForm({
|
|
|
5904
6923
|
quoteInputFeeSettled = true
|
|
5905
6924
|
}) {
|
|
5906
6925
|
const { t } = useFunkitTranslation();
|
|
5907
|
-
const [amount, setAmount] =
|
|
5908
|
-
const [recipient, setRecipient] =
|
|
6926
|
+
const [amount, setAmount] = useState18("");
|
|
6927
|
+
const [recipient, setRecipient] = useState18("");
|
|
5909
6928
|
const sourceOptions = resolveWithdrawalSourceTokens(config);
|
|
5910
|
-
const [sourceIndex, setSourceIndex] =
|
|
6929
|
+
const [sourceIndex, setSourceIndex] = useState18(0);
|
|
5911
6930
|
const selectedSourceIndex = sourceIndex < sourceOptions.length ? sourceIndex : 0;
|
|
5912
6931
|
const sourceOption = sourceOptions[selectedSourceIndex];
|
|
5913
6932
|
const sourceToken = sourceOption.token;
|
|
@@ -6109,7 +7128,7 @@ function resolveAmountErrorText({
|
|
|
6109
7128
|
|
|
6110
7129
|
// src/withdrawal/useCryptoWithdrawalSubmit.ts
|
|
6111
7130
|
import { useEffectEvent as useEffectEvent2 } from "@funkit/connect-core";
|
|
6112
|
-
import { useEffect as
|
|
7131
|
+
import { useEffect as useEffect23, useRef as useRef17 } from "react";
|
|
6113
7132
|
|
|
6114
7133
|
// src/utils/executionErrorMessage.ts
|
|
6115
7134
|
var MAX_ERROR_DETAIL_CHARS = 160;
|
|
@@ -6135,7 +7154,7 @@ import {
|
|
|
6135
7154
|
processCryptoWithdrawalOrder,
|
|
6136
7155
|
toWalletExecutionErrorCode
|
|
6137
7156
|
} from "@funkit/connect-core";
|
|
6138
|
-
import { useCallback as
|
|
7157
|
+
import { useCallback as useCallback11, useRef as useRef16, useState as useState19 } from "react";
|
|
6139
7158
|
var inFlightWithdrawals = /* @__PURE__ */ new Set();
|
|
6140
7159
|
function withdrawalKey({
|
|
6141
7160
|
walletAddress,
|
|
@@ -6162,11 +7181,11 @@ function useCryptoWithdrawalExecution({
|
|
|
6162
7181
|
callbacks
|
|
6163
7182
|
}) {
|
|
6164
7183
|
const { apiKey, userId } = useFunkitIdentity();
|
|
6165
|
-
const isSubmittingRef =
|
|
6166
|
-
const [submission, setSubmission] =
|
|
7184
|
+
const isSubmittingRef = useRef16(false);
|
|
7185
|
+
const [submission, setSubmission] = useState19({
|
|
6167
7186
|
status: "idle"
|
|
6168
7187
|
});
|
|
6169
|
-
const submit =
|
|
7188
|
+
const submit = useCallback11(
|
|
6170
7189
|
async ({
|
|
6171
7190
|
quote,
|
|
6172
7191
|
recipientAddress,
|
|
@@ -6271,7 +7290,7 @@ function useCryptoWithdrawalExecution({
|
|
|
6271
7290
|
},
|
|
6272
7291
|
[apiKey, userId, config, sourceToken, destinationToken, callbacks]
|
|
6273
7292
|
);
|
|
6274
|
-
const reset =
|
|
7293
|
+
const reset = useCallback11(() => setSubmission({ status: "idle" }), []);
|
|
6275
7294
|
return { submission, submit, reset };
|
|
6276
7295
|
}
|
|
6277
7296
|
|
|
@@ -6290,14 +7309,14 @@ function useCryptoWithdrawalSubmit({
|
|
|
6290
7309
|
destinationToken: form.destinationToken ?? form.sourceToken,
|
|
6291
7310
|
callbacks
|
|
6292
7311
|
});
|
|
6293
|
-
const handedOffRef =
|
|
6294
|
-
const submittedSourceLabel =
|
|
6295
|
-
const submittedFigures =
|
|
7312
|
+
const handedOffRef = useRef17(false);
|
|
7313
|
+
const submittedSourceLabel = useRef17(void 0);
|
|
7314
|
+
const submittedFigures = useRef17({
|
|
6296
7315
|
usdLabel: void 0,
|
|
6297
7316
|
tokenLabel: void 0
|
|
6298
7317
|
});
|
|
6299
7318
|
const onSubmittedEvent = useEffectEvent2(onSubmitted);
|
|
6300
|
-
|
|
7319
|
+
useEffect23(() => {
|
|
6301
7320
|
if (submission.status !== "submitted" || handedOffRef.current) {
|
|
6302
7321
|
return;
|
|
6303
7322
|
}
|
|
@@ -6343,12 +7362,12 @@ import {
|
|
|
6343
7362
|
BottomSheetScrollView as BottomSheetScrollView3,
|
|
6344
7363
|
BottomSheetView as BottomSheetView3
|
|
6345
7364
|
} from "@gorhom/bottom-sheet";
|
|
6346
|
-
import { useMemo as useMemo9, useState as
|
|
6347
|
-
import { StyleSheet as
|
|
6348
|
-
import { useSafeAreaInsets as
|
|
7365
|
+
import { useMemo as useMemo9, useState as useState22 } from "react";
|
|
7366
|
+
import { StyleSheet as StyleSheet26, View as View7, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
7367
|
+
import { useSafeAreaInsets as useSafeAreaInsets10 } from "react-native-safe-area-context";
|
|
6349
7368
|
|
|
6350
7369
|
// src/components/AssetGrid.tsx
|
|
6351
|
-
import { Pressable as
|
|
7370
|
+
import { Pressable as Pressable12, StyleSheet as StyleSheet21 } from "react-native";
|
|
6352
7371
|
|
|
6353
7372
|
// src/utils/assetGrid.ts
|
|
6354
7373
|
var ASSET_GRID_COLUMNS = 5;
|
|
@@ -6377,26 +7396,26 @@ function chunk(items, size) {
|
|
|
6377
7396
|
}
|
|
6378
7397
|
|
|
6379
7398
|
// src/components/AssetGrid.tsx
|
|
6380
|
-
import { Fragment as Fragment3, jsx as
|
|
7399
|
+
import { Fragment as Fragment3, jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6381
7400
|
function AssetGrid({ title, items, overflow }) {
|
|
6382
7401
|
const theme = useTheme();
|
|
6383
|
-
return /* @__PURE__ */
|
|
6384
|
-
/* @__PURE__ */
|
|
6385
|
-
/* @__PURE__ */
|
|
6386
|
-
row2.map((item) => /* @__PURE__ */
|
|
7402
|
+
return /* @__PURE__ */ jsxs19(Box, { style: styles19.section, children: [
|
|
7403
|
+
/* @__PURE__ */ jsx43(Text, { variant: "bodyMedium", numberOfLines: 1, style: styles19.title, children: title }),
|
|
7404
|
+
/* @__PURE__ */ jsx43(Box, { style: styles19.grid, children: chunk(items, ASSET_GRID_COLUMNS).map((row2, rowIndex) => /* @__PURE__ */ jsxs19(Box, { flexDirection: "row", style: styles19.row, children: [
|
|
7405
|
+
row2.map((item) => /* @__PURE__ */ jsx43(AssetGridItem, { ...item }, item.id)),
|
|
6387
7406
|
Array.from(
|
|
6388
7407
|
{ length: ASSET_GRID_COLUMNS - row2.length },
|
|
6389
|
-
(_, slot) => /* @__PURE__ */
|
|
7408
|
+
(_, slot) => /* @__PURE__ */ jsx43(Box, { style: styles19.filler }, `filler-${slot}`)
|
|
6390
7409
|
)
|
|
6391
7410
|
] }, rowIndex)) }),
|
|
6392
|
-
overflow ? /* @__PURE__ */
|
|
6393
|
-
|
|
7411
|
+
overflow ? /* @__PURE__ */ jsx43(
|
|
7412
|
+
Pressable12,
|
|
6394
7413
|
{
|
|
6395
7414
|
onPress: overflow.onPress,
|
|
6396
7415
|
accessibilityRole: "button",
|
|
6397
7416
|
accessibilityLabel: overflow.accessibilityLabel,
|
|
6398
|
-
children: /* @__PURE__ */
|
|
6399
|
-
/* @__PURE__ */
|
|
7417
|
+
children: /* @__PURE__ */ jsxs19(Box, { flexDirection: "row", alignItems: "center", style: styles19.overflow, children: [
|
|
7418
|
+
/* @__PURE__ */ jsx43(Box, { flex: 1, children: /* @__PURE__ */ jsx43(
|
|
6400
7419
|
Text,
|
|
6401
7420
|
{
|
|
6402
7421
|
variant: "bodyMedium",
|
|
@@ -6405,7 +7424,7 @@ function AssetGrid({ title, items, overflow }) {
|
|
|
6405
7424
|
children: overflow.label
|
|
6406
7425
|
}
|
|
6407
7426
|
) }),
|
|
6408
|
-
/* @__PURE__ */
|
|
7427
|
+
/* @__PURE__ */ jsx43(
|
|
6409
7428
|
FigmaChevronRightIcon,
|
|
6410
7429
|
{
|
|
6411
7430
|
size: 20,
|
|
@@ -6427,58 +7446,58 @@ function AssetGridItem({
|
|
|
6427
7446
|
}) {
|
|
6428
7447
|
const theme = useTheme();
|
|
6429
7448
|
const isMarked = selected && !unsupported;
|
|
6430
|
-
return /* @__PURE__ */
|
|
6431
|
-
|
|
7449
|
+
return /* @__PURE__ */ jsx43(
|
|
7450
|
+
Pressable12,
|
|
6432
7451
|
{
|
|
6433
7452
|
onPress,
|
|
6434
7453
|
disabled: unsupported,
|
|
6435
7454
|
accessibilityRole: "button",
|
|
6436
7455
|
accessibilityLabel: accessibilityLabel ?? label,
|
|
6437
7456
|
accessibilityState: { selected: isMarked, disabled: unsupported },
|
|
6438
|
-
style:
|
|
6439
|
-
children: /* @__PURE__ */
|
|
6440
|
-
/* @__PURE__ */
|
|
6441
|
-
/* @__PURE__ */
|
|
7457
|
+
style: styles19.cell,
|
|
7458
|
+
children: /* @__PURE__ */ jsxs19(Box, { alignItems: "center", style: styles19.stack, children: [
|
|
7459
|
+
/* @__PURE__ */ jsxs19(Box, { style: styles19.avatar, children: [
|
|
7460
|
+
/* @__PURE__ */ jsx43(
|
|
6442
7461
|
Box,
|
|
6443
7462
|
{
|
|
6444
7463
|
style: unsupported ? { opacity: theme.opacity.disabled / 100 } : void 0,
|
|
6445
7464
|
children: icon
|
|
6446
7465
|
}
|
|
6447
7466
|
),
|
|
6448
|
-
isMarked ? /* @__PURE__ */
|
|
6449
|
-
/* @__PURE__ */
|
|
7467
|
+
isMarked ? /* @__PURE__ */ jsxs19(Fragment3, { children: [
|
|
7468
|
+
/* @__PURE__ */ jsx43(
|
|
6450
7469
|
Box,
|
|
6451
7470
|
{
|
|
6452
7471
|
pointerEvents: "none",
|
|
6453
7472
|
style: [
|
|
6454
|
-
|
|
7473
|
+
styles19.ringGap,
|
|
6455
7474
|
{ borderColor: theme.background.modal }
|
|
6456
7475
|
]
|
|
6457
7476
|
}
|
|
6458
7477
|
),
|
|
6459
|
-
/* @__PURE__ */
|
|
7478
|
+
/* @__PURE__ */ jsx43(
|
|
6460
7479
|
Box,
|
|
6461
7480
|
{
|
|
6462
7481
|
pointerEvents: "none",
|
|
6463
7482
|
style: [
|
|
6464
|
-
|
|
7483
|
+
styles19.ring,
|
|
6465
7484
|
{ borderColor: theme.content.elements.primary }
|
|
6466
7485
|
]
|
|
6467
7486
|
}
|
|
6468
7487
|
),
|
|
6469
|
-
/* @__PURE__ */
|
|
7488
|
+
/* @__PURE__ */ jsx43(
|
|
6470
7489
|
Box,
|
|
6471
7490
|
{
|
|
6472
7491
|
alignItems: "center",
|
|
6473
7492
|
justifyContent: "center",
|
|
6474
7493
|
style: [
|
|
6475
|
-
|
|
7494
|
+
styles19.badge,
|
|
6476
7495
|
{
|
|
6477
7496
|
backgroundColor: theme.content.elements.primary,
|
|
6478
7497
|
borderColor: theme.background.modal
|
|
6479
7498
|
}
|
|
6480
7499
|
],
|
|
6481
|
-
children: /* @__PURE__ */
|
|
7500
|
+
children: /* @__PURE__ */ jsx43(
|
|
6482
7501
|
FigmaCheckIcon,
|
|
6483
7502
|
{
|
|
6484
7503
|
size: 12,
|
|
@@ -6489,14 +7508,14 @@ function AssetGridItem({
|
|
|
6489
7508
|
)
|
|
6490
7509
|
] }) : null
|
|
6491
7510
|
] }),
|
|
6492
|
-
/* @__PURE__ */
|
|
7511
|
+
/* @__PURE__ */ jsx43(
|
|
6493
7512
|
Text,
|
|
6494
7513
|
{
|
|
6495
7514
|
variant: "detail",
|
|
6496
7515
|
weight: "medium",
|
|
6497
7516
|
numberOfLines: 1,
|
|
6498
7517
|
style: [
|
|
6499
|
-
|
|
7518
|
+
styles19.label,
|
|
6500
7519
|
unsupported ? {
|
|
6501
7520
|
color: theme.content.elements.secondary,
|
|
6502
7521
|
textDecorationLine: "line-through"
|
|
@@ -6510,7 +7529,7 @@ function AssetGridItem({
|
|
|
6510
7529
|
);
|
|
6511
7530
|
}
|
|
6512
7531
|
var BADGE_SIZE = 24;
|
|
6513
|
-
var
|
|
7532
|
+
var styles19 = StyleSheet21.create({
|
|
6514
7533
|
section: { gap: 4 },
|
|
6515
7534
|
title: { paddingBottom: 12 },
|
|
6516
7535
|
grid: { gap: ASSET_GRID_GAP },
|
|
@@ -6522,11 +7541,11 @@ var styles13 = StyleSheet15.create({
|
|
|
6522
7541
|
stack: { gap: 6 },
|
|
6523
7542
|
avatar: { width: ASSET_GRID_AVATAR_SIZE, height: ASSET_GRID_AVATAR_SIZE },
|
|
6524
7543
|
ringGap: {
|
|
6525
|
-
...
|
|
7544
|
+
...StyleSheet21.absoluteFill,
|
|
6526
7545
|
borderRadius: 999,
|
|
6527
7546
|
borderWidth: 4
|
|
6528
7547
|
},
|
|
6529
|
-
ring: { ...
|
|
7548
|
+
ring: { ...StyleSheet21.absoluteFill, borderRadius: 999, borderWidth: 2 },
|
|
6530
7549
|
badge: {
|
|
6531
7550
|
position: "absolute",
|
|
6532
7551
|
right: 0,
|
|
@@ -6546,19 +7565,19 @@ var styles13 = StyleSheet15.create({
|
|
|
6546
7565
|
});
|
|
6547
7566
|
|
|
6548
7567
|
// src/components/TopBar.tsx
|
|
6549
|
-
import { Pressable as
|
|
6550
|
-
import { jsx as
|
|
7568
|
+
import { Pressable as Pressable13, StyleSheet as StyleSheet22 } from "react-native";
|
|
7569
|
+
import { jsx as jsx44, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6551
7570
|
var ICON_SIZE = 20;
|
|
6552
7571
|
function TopBar({ title, onBack, onClose }) {
|
|
6553
7572
|
const { t } = useFunkitTranslation();
|
|
6554
7573
|
const theme = useTheme();
|
|
6555
|
-
return /* @__PURE__ */
|
|
6556
|
-
/* @__PURE__ */
|
|
7574
|
+
return /* @__PURE__ */ jsxs20(Box, { flexDirection: "row", alignItems: "center", style: styles20.bar, children: [
|
|
7575
|
+
/* @__PURE__ */ jsx44(
|
|
6557
7576
|
IconSlot,
|
|
6558
7577
|
{
|
|
6559
7578
|
onPress: onBack,
|
|
6560
7579
|
label: t("common.back"),
|
|
6561
|
-
icon: /* @__PURE__ */
|
|
7580
|
+
icon: /* @__PURE__ */ jsx44(
|
|
6562
7581
|
FigmaChevronLeftIcon,
|
|
6563
7582
|
{
|
|
6564
7583
|
size: ICON_SIZE,
|
|
@@ -6567,24 +7586,24 @@ function TopBar({ title, onBack, onClose }) {
|
|
|
6567
7586
|
)
|
|
6568
7587
|
}
|
|
6569
7588
|
),
|
|
6570
|
-
/* @__PURE__ */
|
|
7589
|
+
/* @__PURE__ */ jsx44(
|
|
6571
7590
|
Text,
|
|
6572
7591
|
{
|
|
6573
7592
|
variant: "headerTitle",
|
|
6574
7593
|
numberOfLines: 1,
|
|
6575
7594
|
style: [
|
|
6576
|
-
|
|
7595
|
+
styles20.title,
|
|
6577
7596
|
{ lineHeight: theme.textVariants.bodyMedium.lineHeight }
|
|
6578
7597
|
],
|
|
6579
7598
|
children: title
|
|
6580
7599
|
}
|
|
6581
7600
|
),
|
|
6582
|
-
/* @__PURE__ */
|
|
7601
|
+
/* @__PURE__ */ jsx44(
|
|
6583
7602
|
IconSlot,
|
|
6584
7603
|
{
|
|
6585
7604
|
onPress: onClose,
|
|
6586
7605
|
label: t("common.close"),
|
|
6587
|
-
icon: /* @__PURE__ */
|
|
7606
|
+
icon: /* @__PURE__ */ jsx44(
|
|
6588
7607
|
FigmaCloseIcon,
|
|
6589
7608
|
{
|
|
6590
7609
|
size: ICON_SIZE,
|
|
@@ -6601,21 +7620,21 @@ function IconSlot({
|
|
|
6601
7620
|
icon
|
|
6602
7621
|
}) {
|
|
6603
7622
|
if (!onPress) {
|
|
6604
|
-
return /* @__PURE__ */
|
|
7623
|
+
return /* @__PURE__ */ jsx44(Box, { style: styles20.slot });
|
|
6605
7624
|
}
|
|
6606
|
-
return /* @__PURE__ */
|
|
6607
|
-
|
|
7625
|
+
return /* @__PURE__ */ jsx44(
|
|
7626
|
+
Pressable13,
|
|
6608
7627
|
{
|
|
6609
7628
|
onPress,
|
|
6610
7629
|
accessibilityRole: "button",
|
|
6611
7630
|
accessibilityLabel: label,
|
|
6612
7631
|
hitSlop: 6,
|
|
6613
|
-
style:
|
|
7632
|
+
style: styles20.slot,
|
|
6614
7633
|
children: icon
|
|
6615
7634
|
}
|
|
6616
7635
|
);
|
|
6617
7636
|
}
|
|
6618
|
-
var
|
|
7637
|
+
var styles20 = StyleSheet22.create({
|
|
6619
7638
|
bar: { paddingTop: 20, paddingBottom: 12, paddingHorizontal: 12, gap: 4 },
|
|
6620
7639
|
slot: {
|
|
6621
7640
|
width: 32,
|
|
@@ -6643,15 +7662,15 @@ function receivableTokens(chains) {
|
|
|
6643
7662
|
|
|
6644
7663
|
// src/screens/SelectReceiveTokenScreen.tsx
|
|
6645
7664
|
import { BottomSheetScrollView as BottomSheetScrollView2 } from "@gorhom/bottom-sheet";
|
|
6646
|
-
import { useState as
|
|
6647
|
-
import { StyleSheet as
|
|
6648
|
-
import { useSafeAreaInsets as
|
|
7665
|
+
import { useState as useState21 } from "react";
|
|
7666
|
+
import { StyleSheet as StyleSheet25, View as View6 } from "react-native";
|
|
7667
|
+
import { useSafeAreaInsets as useSafeAreaInsets9 } from "react-native-safe-area-context";
|
|
6649
7668
|
|
|
6650
7669
|
// src/components/SearchInput.tsx
|
|
6651
7670
|
import { BottomSheetTextInput } from "@gorhom/bottom-sheet";
|
|
6652
|
-
import { useState as
|
|
6653
|
-
import { StyleSheet as
|
|
6654
|
-
import { jsx as
|
|
7671
|
+
import { useState as useState20 } from "react";
|
|
7672
|
+
import { StyleSheet as StyleSheet23 } from "react-native";
|
|
7673
|
+
import { jsx as jsx45, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6655
7674
|
function SearchInput({
|
|
6656
7675
|
value,
|
|
6657
7676
|
onChangeValue,
|
|
@@ -6659,15 +7678,15 @@ function SearchInput({
|
|
|
6659
7678
|
accessibilityLabel
|
|
6660
7679
|
}) {
|
|
6661
7680
|
const theme = useTheme();
|
|
6662
|
-
const [isFocused, setIsFocused] =
|
|
6663
|
-
return /* @__PURE__ */
|
|
7681
|
+
const [isFocused, setIsFocused] = useState20(false);
|
|
7682
|
+
return /* @__PURE__ */ jsxs21(
|
|
6664
7683
|
Box,
|
|
6665
7684
|
{
|
|
6666
7685
|
flexDirection: "row",
|
|
6667
7686
|
alignItems: "center",
|
|
6668
7687
|
borderRadius: "element",
|
|
6669
7688
|
style: [
|
|
6670
|
-
|
|
7689
|
+
styles21.field,
|
|
6671
7690
|
{
|
|
6672
7691
|
backgroundColor: theme.background.modal,
|
|
6673
7692
|
borderColor: isFocused ? theme.border.elements.selected.color : theme.border.elements.default.color,
|
|
@@ -6675,8 +7694,8 @@ function SearchInput({
|
|
|
6675
7694
|
}
|
|
6676
7695
|
],
|
|
6677
7696
|
children: [
|
|
6678
|
-
/* @__PURE__ */
|
|
6679
|
-
/* @__PURE__ */
|
|
7697
|
+
/* @__PURE__ */ jsx45(FigmaSearchIcon, { size: 16, color: theme.content.elements.secondary }),
|
|
7698
|
+
/* @__PURE__ */ jsx45(
|
|
6680
7699
|
BottomSheetTextInput,
|
|
6681
7700
|
{
|
|
6682
7701
|
value,
|
|
@@ -6691,7 +7710,7 @@ function SearchInput({
|
|
|
6691
7710
|
spellCheck: false,
|
|
6692
7711
|
returnKeyType: "search",
|
|
6693
7712
|
style: [
|
|
6694
|
-
|
|
7713
|
+
styles21.input,
|
|
6695
7714
|
theme.textVariants.body,
|
|
6696
7715
|
{ color: theme.content.elements.primary }
|
|
6697
7716
|
]
|
|
@@ -6701,15 +7720,15 @@ function SearchInput({
|
|
|
6701
7720
|
}
|
|
6702
7721
|
);
|
|
6703
7722
|
}
|
|
6704
|
-
var
|
|
7723
|
+
var styles21 = StyleSheet23.create({
|
|
6705
7724
|
field: { height: 48, paddingLeft: 16, paddingRight: 8, gap: 8 },
|
|
6706
7725
|
// Undo the platform's own padding so the field's height is the box's.
|
|
6707
7726
|
input: { flex: 1, padding: 0 }
|
|
6708
7727
|
});
|
|
6709
7728
|
|
|
6710
7729
|
// src/components/SelectableAssetRow.tsx
|
|
6711
|
-
import { Pressable as
|
|
6712
|
-
import { jsx as
|
|
7730
|
+
import { Pressable as Pressable14, StyleSheet as StyleSheet24 } from "react-native";
|
|
7731
|
+
import { jsx as jsx46, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6713
7732
|
function SelectableAssetRow({
|
|
6714
7733
|
name,
|
|
6715
7734
|
icon,
|
|
@@ -6719,28 +7738,28 @@ function SelectableAssetRow({
|
|
|
6719
7738
|
accessibilityLabel
|
|
6720
7739
|
}) {
|
|
6721
7740
|
const theme = useTheme();
|
|
6722
|
-
return /* @__PURE__ */
|
|
6723
|
-
|
|
7741
|
+
return /* @__PURE__ */ jsx46(
|
|
7742
|
+
Pressable14,
|
|
6724
7743
|
{
|
|
6725
7744
|
onPress,
|
|
6726
7745
|
disabled,
|
|
6727
7746
|
accessibilityRole: "button",
|
|
6728
7747
|
accessibilityLabel,
|
|
6729
7748
|
accessibilityState: { selected, disabled },
|
|
6730
|
-
children: /* @__PURE__ */
|
|
7749
|
+
children: /* @__PURE__ */ jsxs22(
|
|
6731
7750
|
Box,
|
|
6732
7751
|
{
|
|
6733
7752
|
flexDirection: "row",
|
|
6734
7753
|
alignItems: "center",
|
|
6735
7754
|
borderRadius: "element",
|
|
6736
7755
|
style: [
|
|
6737
|
-
|
|
7756
|
+
styles22.row,
|
|
6738
7757
|
selected ? { backgroundColor: theme.background.secondary } : null,
|
|
6739
7758
|
disabled ? { opacity: theme.opacity.disabled / 100 } : null
|
|
6740
7759
|
],
|
|
6741
7760
|
children: [
|
|
6742
7761
|
icon,
|
|
6743
|
-
/* @__PURE__ */
|
|
7762
|
+
/* @__PURE__ */ jsx46(Box, { flex: 1, children: /* @__PURE__ */ jsx46(
|
|
6744
7763
|
Text,
|
|
6745
7764
|
{
|
|
6746
7765
|
variant: "bodyMedium",
|
|
@@ -6749,19 +7768,19 @@ function SelectableAssetRow({
|
|
|
6749
7768
|
children: name
|
|
6750
7769
|
}
|
|
6751
7770
|
) }),
|
|
6752
|
-
selected ? /* @__PURE__ */
|
|
7771
|
+
selected ? /* @__PURE__ */ jsx46(FigmaCheckIcon, { size: 20, color: theme.content.elements.secondary }) : null
|
|
6753
7772
|
]
|
|
6754
7773
|
}
|
|
6755
7774
|
)
|
|
6756
7775
|
}
|
|
6757
7776
|
);
|
|
6758
7777
|
}
|
|
6759
|
-
var
|
|
7778
|
+
var styles22 = StyleSheet24.create({
|
|
6760
7779
|
row: { gap: 12, paddingHorizontal: 12, paddingVertical: 10 }
|
|
6761
7780
|
});
|
|
6762
7781
|
|
|
6763
7782
|
// src/screens/SelectReceiveTokenScreen.tsx
|
|
6764
|
-
import { jsx as
|
|
7783
|
+
import { jsx as jsx47, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6765
7784
|
var ROW_AVATAR_SIZE = 36;
|
|
6766
7785
|
function SelectReceiveTokenScreen({
|
|
6767
7786
|
tokens,
|
|
@@ -6772,16 +7791,16 @@ function SelectReceiveTokenScreen({
|
|
|
6772
7791
|
const { t } = useFunkitTranslation();
|
|
6773
7792
|
const theme = useTheme();
|
|
6774
7793
|
const sheetHeight = useNestedSheetHeight();
|
|
6775
|
-
const insets =
|
|
7794
|
+
const insets = useSafeAreaInsets9();
|
|
6776
7795
|
const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades();
|
|
6777
|
-
const [query, setQuery] =
|
|
7796
|
+
const [query, setQuery] = useState21("");
|
|
6778
7797
|
const needle = query.trim().toLowerCase();
|
|
6779
7798
|
const orderedTokens = selectedToken && tokens.includes(selectedToken) ? [selectedToken, ...tokens.filter((token) => token !== selectedToken)] : tokens;
|
|
6780
7799
|
const matches = orderedTokens.filter(
|
|
6781
7800
|
(token) => token.toLowerCase().includes(needle)
|
|
6782
7801
|
);
|
|
6783
7802
|
const searchPlaceholder = t("selectReceiveToken.searchTokens");
|
|
6784
|
-
return /* @__PURE__ */
|
|
7803
|
+
return /* @__PURE__ */ jsxs23(
|
|
6785
7804
|
Box,
|
|
6786
7805
|
{
|
|
6787
7806
|
borderTopLeftRadius: "modal",
|
|
@@ -6791,14 +7810,14 @@ function SelectReceiveTokenScreen({
|
|
|
6791
7810
|
backgroundColor: theme.background.modal
|
|
6792
7811
|
},
|
|
6793
7812
|
children: [
|
|
6794
|
-
/* @__PURE__ */
|
|
7813
|
+
/* @__PURE__ */ jsx47(
|
|
6795
7814
|
TopBar,
|
|
6796
7815
|
{
|
|
6797
7816
|
title: t("selectReceiveToken.availableTokens"),
|
|
6798
7817
|
onClose
|
|
6799
7818
|
}
|
|
6800
7819
|
),
|
|
6801
|
-
/* @__PURE__ */
|
|
7820
|
+
/* @__PURE__ */ jsx47(Box, { style: styles23.search, children: /* @__PURE__ */ jsx47(
|
|
6802
7821
|
SearchInput,
|
|
6803
7822
|
{
|
|
6804
7823
|
value: query,
|
|
@@ -6807,23 +7826,23 @@ function SelectReceiveTokenScreen({
|
|
|
6807
7826
|
accessibilityLabel: searchPlaceholder
|
|
6808
7827
|
}
|
|
6809
7828
|
) }),
|
|
6810
|
-
/* @__PURE__ */
|
|
6811
|
-
/* @__PURE__ */
|
|
7829
|
+
/* @__PURE__ */ jsxs23(View6, { style: styles23.scrollArea, children: [
|
|
7830
|
+
/* @__PURE__ */ jsx47(
|
|
6812
7831
|
BottomSheetScrollView2,
|
|
6813
7832
|
{
|
|
6814
|
-
style:
|
|
7833
|
+
style: styles23.scroll,
|
|
6815
7834
|
contentContainerStyle: [
|
|
6816
|
-
|
|
7835
|
+
styles23.list,
|
|
6817
7836
|
{ paddingBottom: insets.bottom + LIST_BOTTOM_GAP }
|
|
6818
7837
|
],
|
|
6819
7838
|
showsVerticalScrollIndicator: false,
|
|
6820
7839
|
keyboardShouldPersistTaps: "handled",
|
|
6821
7840
|
...scrollProps,
|
|
6822
|
-
children: matches.map((token) => /* @__PURE__ */
|
|
7841
|
+
children: matches.map((token) => /* @__PURE__ */ jsx47(
|
|
6823
7842
|
SelectableAssetRow,
|
|
6824
7843
|
{
|
|
6825
7844
|
name: token,
|
|
6826
|
-
icon: /* @__PURE__ */
|
|
7845
|
+
icon: /* @__PURE__ */ jsx47(TokenChainIcon, { symbol: token, size: ROW_AVATAR_SIZE }),
|
|
6827
7846
|
selected: token === selectedToken,
|
|
6828
7847
|
onPress: () => onSelectToken(token),
|
|
6829
7848
|
accessibilityLabel: token
|
|
@@ -6832,7 +7851,7 @@ function SelectReceiveTokenScreen({
|
|
|
6832
7851
|
))
|
|
6833
7852
|
}
|
|
6834
7853
|
),
|
|
6835
|
-
showTopFade ? /* @__PURE__ */
|
|
7854
|
+
showTopFade ? /* @__PURE__ */ jsx47(
|
|
6836
7855
|
ScrollFade,
|
|
6837
7856
|
{
|
|
6838
7857
|
edge: "top",
|
|
@@ -6840,7 +7859,7 @@ function SelectReceiveTokenScreen({
|
|
|
6840
7859
|
id: "receive-token-list"
|
|
6841
7860
|
}
|
|
6842
7861
|
) : null,
|
|
6843
|
-
showBottomFade ? /* @__PURE__ */
|
|
7862
|
+
showBottomFade ? /* @__PURE__ */ jsx47(
|
|
6844
7863
|
ScrollFade,
|
|
6845
7864
|
{
|
|
6846
7865
|
edge: "bottom",
|
|
@@ -6854,7 +7873,7 @@ function SelectReceiveTokenScreen({
|
|
|
6854
7873
|
);
|
|
6855
7874
|
}
|
|
6856
7875
|
var LIST_BOTTOM_GAP = 16;
|
|
6857
|
-
var
|
|
7876
|
+
var styles23 = StyleSheet25.create({
|
|
6858
7877
|
search: { paddingHorizontal: 24, paddingBottom: 12 },
|
|
6859
7878
|
scrollArea: { position: "relative", flex: 1 },
|
|
6860
7879
|
scroll: { flex: 1 },
|
|
@@ -6862,7 +7881,7 @@ var styles17 = StyleSheet19.create({
|
|
|
6862
7881
|
});
|
|
6863
7882
|
|
|
6864
7883
|
// src/screens/SelectReceiveTokenAndChainScreen.tsx
|
|
6865
|
-
import { jsx as
|
|
7884
|
+
import { jsx as jsx48, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6866
7885
|
function SelectReceiveTokenAndChainScreen({
|
|
6867
7886
|
chains,
|
|
6868
7887
|
committed,
|
|
@@ -6871,8 +7890,8 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6871
7890
|
}) {
|
|
6872
7891
|
const { t } = useFunkitTranslation();
|
|
6873
7892
|
const theme = useTheme();
|
|
6874
|
-
const { height } =
|
|
6875
|
-
const insets =
|
|
7893
|
+
const { height } = useWindowDimensions6();
|
|
7894
|
+
const insets = useSafeAreaInsets10();
|
|
6876
7895
|
const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades();
|
|
6877
7896
|
const {
|
|
6878
7897
|
nestedSheetRef,
|
|
@@ -6882,11 +7901,11 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6882
7901
|
closeNestedScreen,
|
|
6883
7902
|
renderNestedBackdrop
|
|
6884
7903
|
} = useNestedSheet();
|
|
6885
|
-
const [token, setToken] =
|
|
6886
|
-
const [chainId, setChainId] =
|
|
7904
|
+
const [token, setToken] = useState22(committed?.symbol);
|
|
7905
|
+
const [chainId, setChainId] = useState22(
|
|
6887
7906
|
committed ? Number(committed.chainId) : void 0
|
|
6888
7907
|
);
|
|
6889
|
-
const [pinnedToken, setPinnedToken] =
|
|
7908
|
+
const [pinnedToken, setPinnedToken] = useState22(committed?.symbol);
|
|
6890
7909
|
const tokens = useMemo9(() => receivableTokens(chains), [chains]);
|
|
6891
7910
|
const { cells, overflowCount } = gridCells(tokens, TOKEN_CELLS, pinnedToken);
|
|
6892
7911
|
const draftToken = (next) => {
|
|
@@ -6898,7 +7917,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6898
7917
|
const moreLabel = t("selectReceiveToken.moreTokens", {
|
|
6899
7918
|
count: overflowCount
|
|
6900
7919
|
});
|
|
6901
|
-
return /* @__PURE__ */
|
|
7920
|
+
return /* @__PURE__ */ jsxs24(
|
|
6902
7921
|
Box,
|
|
6903
7922
|
{
|
|
6904
7923
|
style: {
|
|
@@ -6907,14 +7926,14 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6907
7926
|
backgroundColor: theme.background.modal
|
|
6908
7927
|
},
|
|
6909
7928
|
children: [
|
|
6910
|
-
/* @__PURE__ */
|
|
6911
|
-
/* @__PURE__ */
|
|
6912
|
-
/* @__PURE__ */
|
|
7929
|
+
/* @__PURE__ */ jsx48(TopBar, { title: t("selectReceiveToken.title"), onBack }),
|
|
7930
|
+
/* @__PURE__ */ jsxs24(View7, { style: styles24.scrollArea, children: [
|
|
7931
|
+
/* @__PURE__ */ jsxs24(
|
|
6913
7932
|
BottomSheetScrollView3,
|
|
6914
7933
|
{
|
|
6915
|
-
style:
|
|
7934
|
+
style: styles24.scroll,
|
|
6916
7935
|
contentContainerStyle: [
|
|
6917
|
-
|
|
7936
|
+
styles24.content,
|
|
6918
7937
|
{
|
|
6919
7938
|
paddingBottom: theme.sizes.buttonLg + CONFIRM_SCROLL_GAP + footerBottom
|
|
6920
7939
|
}
|
|
@@ -6922,14 +7941,14 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6922
7941
|
showsVerticalScrollIndicator: false,
|
|
6923
7942
|
...scrollProps,
|
|
6924
7943
|
children: [
|
|
6925
|
-
/* @__PURE__ */
|
|
7944
|
+
/* @__PURE__ */ jsx48(
|
|
6926
7945
|
AssetGrid,
|
|
6927
7946
|
{
|
|
6928
7947
|
title: t("selectReceiveToken.selectToken"),
|
|
6929
7948
|
items: cells.map((symbol) => ({
|
|
6930
7949
|
id: symbol,
|
|
6931
7950
|
label: symbol,
|
|
6932
|
-
icon: /* @__PURE__ */
|
|
7951
|
+
icon: /* @__PURE__ */ jsx48(TokenChainIcon, { symbol, size: ASSET_GRID_AVATAR_SIZE }),
|
|
6933
7952
|
selected: symbol === token,
|
|
6934
7953
|
onPress: () => draftToken(symbol)
|
|
6935
7954
|
})),
|
|
@@ -6940,14 +7959,14 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6940
7959
|
} : void 0
|
|
6941
7960
|
}
|
|
6942
7961
|
),
|
|
6943
|
-
/* @__PURE__ */
|
|
7962
|
+
/* @__PURE__ */ jsx48(
|
|
6944
7963
|
AssetGrid,
|
|
6945
7964
|
{
|
|
6946
7965
|
title: t("selectReceiveToken.selectChain"),
|
|
6947
7966
|
items: chains.map((chain) => ({
|
|
6948
7967
|
id: String(chain.chainId),
|
|
6949
7968
|
label: chainLabel(chain),
|
|
6950
|
-
icon: /* @__PURE__ */
|
|
7969
|
+
icon: /* @__PURE__ */ jsx48(
|
|
6951
7970
|
ChainAvatar,
|
|
6952
7971
|
{
|
|
6953
7972
|
uri: chainIconUri2(chain.chainId),
|
|
@@ -6963,7 +7982,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6963
7982
|
]
|
|
6964
7983
|
}
|
|
6965
7984
|
),
|
|
6966
|
-
showTopFade ? /* @__PURE__ */
|
|
7985
|
+
showTopFade ? /* @__PURE__ */ jsx48(
|
|
6967
7986
|
ScrollFade,
|
|
6968
7987
|
{
|
|
6969
7988
|
edge: "top",
|
|
@@ -6971,7 +7990,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6971
7990
|
id: "receive-token-chain-grid"
|
|
6972
7991
|
}
|
|
6973
7992
|
) : null,
|
|
6974
|
-
showBottomFade ? /* @__PURE__ */
|
|
7993
|
+
showBottomFade ? /* @__PURE__ */ jsx48(
|
|
6975
7994
|
ScrollFade,
|
|
6976
7995
|
{
|
|
6977
7996
|
edge: "bottom",
|
|
@@ -6979,7 +7998,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6979
7998
|
id: "receive-token-chain-grid"
|
|
6980
7999
|
}
|
|
6981
8000
|
) : null,
|
|
6982
|
-
/* @__PURE__ */
|
|
8001
|
+
/* @__PURE__ */ jsx48(Box, { style: [styles24.footer, { bottom: footerBottom }], children: /* @__PURE__ */ jsx48(
|
|
6983
8002
|
PillButton2,
|
|
6984
8003
|
{
|
|
6985
8004
|
label: t("common.confirm"),
|
|
@@ -6992,7 +8011,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
6992
8011
|
}
|
|
6993
8012
|
) })
|
|
6994
8013
|
] }),
|
|
6995
|
-
/* @__PURE__ */
|
|
8014
|
+
/* @__PURE__ */ jsx48(
|
|
6996
8015
|
BottomSheetModal3,
|
|
6997
8016
|
{
|
|
6998
8017
|
ref: nestedSheetRef,
|
|
@@ -7003,7 +8022,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
7003
8022
|
backgroundComponent: FlowSheetBackground,
|
|
7004
8023
|
backdropComponent: renderNestedBackdrop,
|
|
7005
8024
|
onDismiss: () => setNestedScreen(null),
|
|
7006
|
-
children: /* @__PURE__ */
|
|
8025
|
+
children: /* @__PURE__ */ jsx48(BottomSheetView3, { focusHook: useInertScrollableFocus, children: nestedScreen === "availableTokens" ? /* @__PURE__ */ jsx48(
|
|
7007
8026
|
SelectReceiveTokenScreen,
|
|
7008
8027
|
{
|
|
7009
8028
|
tokens,
|
|
@@ -7024,7 +8043,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
7024
8043
|
}
|
|
7025
8044
|
var TOKEN_CELLS = ASSET_GRID_COLUMNS * 2;
|
|
7026
8045
|
var CONFIRM_SCROLL_GAP = 8;
|
|
7027
|
-
var
|
|
8046
|
+
var styles24 = StyleSheet26.create({
|
|
7028
8047
|
scrollArea: { position: "relative", flex: 1 },
|
|
7029
8048
|
scroll: { flex: 1 },
|
|
7030
8049
|
content: { paddingHorizontal: 24, paddingTop: 13, gap: 40 },
|
|
@@ -7033,9 +8052,9 @@ var styles18 = StyleSheet20.create({
|
|
|
7033
8052
|
|
|
7034
8053
|
// src/screens/SelectSourceTokenScreen.tsx
|
|
7035
8054
|
import { BottomSheetScrollView as BottomSheetScrollView4 } from "@gorhom/bottom-sheet";
|
|
7036
|
-
import { Pressable as
|
|
7037
|
-
import { useSafeAreaInsets as
|
|
7038
|
-
import { jsx as
|
|
8055
|
+
import { Pressable as Pressable15, StyleSheet as StyleSheet27, View as View8, useWindowDimensions as useWindowDimensions7 } from "react-native";
|
|
8056
|
+
import { useSafeAreaInsets as useSafeAreaInsets11 } from "react-native-safe-area-context";
|
|
8057
|
+
import { jsx as jsx49, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
7039
8058
|
function SelectSourceTokenScreen({
|
|
7040
8059
|
options,
|
|
7041
8060
|
selectedIndex,
|
|
@@ -7044,43 +8063,43 @@ function SelectSourceTokenScreen({
|
|
|
7044
8063
|
}) {
|
|
7045
8064
|
const { t } = useFunkitTranslation();
|
|
7046
8065
|
const theme = useTheme();
|
|
7047
|
-
const { height } =
|
|
7048
|
-
const insets =
|
|
8066
|
+
const { height } = useWindowDimensions7();
|
|
8067
|
+
const insets = useSafeAreaInsets11();
|
|
7049
8068
|
const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades();
|
|
7050
8069
|
return (
|
|
7051
8070
|
// A full window tall, like the step it replaces — the flow sheet is pinned
|
|
7052
8071
|
// to a fixed detent while a crypto withdrawal step is up (see sheetSizing).
|
|
7053
|
-
/* @__PURE__ */
|
|
7054
|
-
/* @__PURE__ */
|
|
7055
|
-
/* @__PURE__ */
|
|
8072
|
+
/* @__PURE__ */ jsxs25(Box, { style: { height, paddingTop: insets.top }, children: [
|
|
8073
|
+
/* @__PURE__ */ jsx49(Grabber, {}),
|
|
8074
|
+
/* @__PURE__ */ jsxs25(
|
|
7056
8075
|
Box,
|
|
7057
8076
|
{
|
|
7058
8077
|
flexDirection: "row",
|
|
7059
8078
|
alignItems: "center",
|
|
7060
|
-
style: [
|
|
8079
|
+
style: [styles25.topBar, { height: theme.sizes.topBar }],
|
|
7061
8080
|
children: [
|
|
7062
|
-
/* @__PURE__ */
|
|
7063
|
-
|
|
8081
|
+
/* @__PURE__ */ jsx49(
|
|
8082
|
+
Pressable15,
|
|
7064
8083
|
{
|
|
7065
8084
|
onPress: onBack,
|
|
7066
8085
|
accessibilityRole: "button",
|
|
7067
8086
|
accessibilityLabel: t("common.back"),
|
|
7068
8087
|
hitSlop: 8,
|
|
7069
|
-
children: /* @__PURE__ */
|
|
8088
|
+
children: /* @__PURE__ */ jsx49(Text, { variant: "bodyMedium", children: t("common.back") })
|
|
7070
8089
|
}
|
|
7071
8090
|
),
|
|
7072
|
-
/* @__PURE__ */
|
|
7073
|
-
/* @__PURE__ */
|
|
8091
|
+
/* @__PURE__ */ jsx49(Text, { variant: "headerTitle", style: styles25.title, children: t("withdrawCrypto.selectSource") }),
|
|
8092
|
+
/* @__PURE__ */ jsx49(Box, { style: styles25.spacer })
|
|
7074
8093
|
]
|
|
7075
8094
|
}
|
|
7076
8095
|
),
|
|
7077
|
-
/* @__PURE__ */
|
|
7078
|
-
/* @__PURE__ */
|
|
8096
|
+
/* @__PURE__ */ jsxs25(View8, { style: styles25.scrollArea, children: [
|
|
8097
|
+
/* @__PURE__ */ jsx49(
|
|
7079
8098
|
BottomSheetScrollView4,
|
|
7080
8099
|
{
|
|
7081
|
-
style:
|
|
8100
|
+
style: styles25.scroll,
|
|
7082
8101
|
contentContainerStyle: [
|
|
7083
|
-
|
|
8102
|
+
styles25.list,
|
|
7084
8103
|
{ paddingBottom: LIST_BOTTOM_GAP2 + insets.bottom }
|
|
7085
8104
|
],
|
|
7086
8105
|
showsVerticalScrollIndicator: false,
|
|
@@ -7088,14 +8107,14 @@ function SelectSourceTokenScreen({
|
|
|
7088
8107
|
children: options.map((option, index) => {
|
|
7089
8108
|
const label = option.label ?? option.token.symbol;
|
|
7090
8109
|
const isSelected = index === selectedIndex;
|
|
7091
|
-
return /* @__PURE__ */
|
|
7092
|
-
|
|
8110
|
+
return /* @__PURE__ */ jsx49(
|
|
8111
|
+
Pressable15,
|
|
7093
8112
|
{
|
|
7094
8113
|
onPress: () => onSelect(index),
|
|
7095
8114
|
accessibilityRole: "button",
|
|
7096
8115
|
accessibilityLabel: label,
|
|
7097
8116
|
accessibilityState: { selected: isSelected },
|
|
7098
|
-
children: /* @__PURE__ */
|
|
8117
|
+
children: /* @__PURE__ */ jsxs25(
|
|
7099
8118
|
Box,
|
|
7100
8119
|
{
|
|
7101
8120
|
flexDirection: "row",
|
|
@@ -7103,25 +8122,25 @@ function SelectSourceTokenScreen({
|
|
|
7103
8122
|
justifyContent: "space-between",
|
|
7104
8123
|
borderRadius: "element",
|
|
7105
8124
|
style: [
|
|
7106
|
-
|
|
8125
|
+
styles25.row,
|
|
7107
8126
|
isSelected ? { backgroundColor: theme.background.secondary } : void 0
|
|
7108
8127
|
],
|
|
7109
8128
|
children: [
|
|
7110
|
-
/* @__PURE__ */
|
|
8129
|
+
/* @__PURE__ */ jsxs25(
|
|
7111
8130
|
Box,
|
|
7112
8131
|
{
|
|
7113
8132
|
flexDirection: "row",
|
|
7114
8133
|
alignItems: "center",
|
|
7115
|
-
style:
|
|
8134
|
+
style: styles25.token,
|
|
7116
8135
|
children: [
|
|
7117
|
-
/* @__PURE__ */
|
|
8136
|
+
/* @__PURE__ */ jsx49(
|
|
7118
8137
|
TokenChainIcon,
|
|
7119
8138
|
{
|
|
7120
8139
|
symbol: option.token.symbol,
|
|
7121
8140
|
iconSrc: option.iconSrc
|
|
7122
8141
|
}
|
|
7123
8142
|
),
|
|
7124
|
-
/* @__PURE__ */
|
|
8143
|
+
/* @__PURE__ */ jsx49(
|
|
7125
8144
|
Text,
|
|
7126
8145
|
{
|
|
7127
8146
|
variant: "bodyMedium",
|
|
@@ -7132,7 +8151,7 @@ function SelectSourceTokenScreen({
|
|
|
7132
8151
|
]
|
|
7133
8152
|
}
|
|
7134
8153
|
),
|
|
7135
|
-
isSelected ? /* @__PURE__ */
|
|
8154
|
+
isSelected ? /* @__PURE__ */ jsx49(FigmaSuccessCheckIcon, { size: 16 }) : null
|
|
7136
8155
|
]
|
|
7137
8156
|
}
|
|
7138
8157
|
)
|
|
@@ -7142,7 +8161,7 @@ function SelectSourceTokenScreen({
|
|
|
7142
8161
|
})
|
|
7143
8162
|
}
|
|
7144
8163
|
),
|
|
7145
|
-
showTopFade ? /* @__PURE__ */
|
|
8164
|
+
showTopFade ? /* @__PURE__ */ jsx49(
|
|
7146
8165
|
ScrollFade,
|
|
7147
8166
|
{
|
|
7148
8167
|
edge: "top",
|
|
@@ -7150,7 +8169,7 @@ function SelectSourceTokenScreen({
|
|
|
7150
8169
|
id: "source-token-list"
|
|
7151
8170
|
}
|
|
7152
8171
|
) : null,
|
|
7153
|
-
showBottomFade ? /* @__PURE__ */
|
|
8172
|
+
showBottomFade ? /* @__PURE__ */ jsx49(
|
|
7154
8173
|
ScrollFade,
|
|
7155
8174
|
{
|
|
7156
8175
|
edge: "bottom",
|
|
@@ -7163,7 +8182,7 @@ function SelectSourceTokenScreen({
|
|
|
7163
8182
|
);
|
|
7164
8183
|
}
|
|
7165
8184
|
var LIST_BOTTOM_GAP2 = 24;
|
|
7166
|
-
var
|
|
8185
|
+
var styles25 = StyleSheet27.create({
|
|
7167
8186
|
topBar: { paddingHorizontal: 16, gap: 12 },
|
|
7168
8187
|
title: { flex: 1 },
|
|
7169
8188
|
spacer: { width: 20 },
|
|
@@ -7175,24 +8194,24 @@ var styles19 = StyleSheet21.create({
|
|
|
7175
8194
|
});
|
|
7176
8195
|
|
|
7177
8196
|
// src/screens/TransactionBreakdownScreen.tsx
|
|
7178
|
-
import { StyleSheet as
|
|
7179
|
-
import { useSafeAreaInsets as
|
|
7180
|
-
import { jsx as
|
|
8197
|
+
import { StyleSheet as StyleSheet28 } from "react-native";
|
|
8198
|
+
import { useSafeAreaInsets as useSafeAreaInsets12 } from "react-native-safe-area-context";
|
|
8199
|
+
import { jsx as jsx50, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
7181
8200
|
function TransactionBreakdownScreen({
|
|
7182
8201
|
usdLabel,
|
|
7183
8202
|
floorLabel
|
|
7184
8203
|
}) {
|
|
7185
8204
|
const { t } = useFunkitTranslation();
|
|
7186
8205
|
const theme = useTheme();
|
|
7187
|
-
const insets =
|
|
7188
|
-
return /* @__PURE__ */
|
|
7189
|
-
/* @__PURE__ */
|
|
7190
|
-
/* @__PURE__ */
|
|
7191
|
-
/* @__PURE__ */
|
|
8206
|
+
const insets = useSafeAreaInsets12();
|
|
8207
|
+
return /* @__PURE__ */ jsxs26(Box, { children: [
|
|
8208
|
+
/* @__PURE__ */ jsx50(Grabber, {}),
|
|
8209
|
+
/* @__PURE__ */ jsx50(TopBar, { title: t("withdrawAddress.breakdownTitle") }),
|
|
8210
|
+
/* @__PURE__ */ jsx50(
|
|
7192
8211
|
Box,
|
|
7193
8212
|
{
|
|
7194
|
-
style: [
|
|
7195
|
-
children: /* @__PURE__ */
|
|
8213
|
+
style: [styles26.body, { paddingBottom: BODY_PADDING + insets.bottom }],
|
|
8214
|
+
children: /* @__PURE__ */ jsx50(
|
|
7196
8215
|
Text,
|
|
7197
8216
|
{
|
|
7198
8217
|
variant: "detail",
|
|
@@ -7220,13 +8239,13 @@ function emphasise(sentence, values, color) {
|
|
|
7220
8239
|
(part, index) => values.includes(part) ? (
|
|
7221
8240
|
// Index-keyed: a figure can legitimately appear twice, so the value is
|
|
7222
8241
|
// not a key.
|
|
7223
|
-
/* @__PURE__ */
|
|
8242
|
+
/* @__PURE__ */ jsx50(Text, { variant: "detail", weight: "medium", style: { color }, children: part }, index)
|
|
7224
8243
|
) : part
|
|
7225
8244
|
);
|
|
7226
8245
|
}
|
|
7227
8246
|
var escapeForRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
7228
8247
|
var BODY_PADDING = 16;
|
|
7229
|
-
var
|
|
8248
|
+
var styles26 = StyleSheet28.create({
|
|
7230
8249
|
body: { paddingHorizontal: 20, paddingTop: BODY_PADDING }
|
|
7231
8250
|
});
|
|
7232
8251
|
|
|
@@ -7234,22 +8253,22 @@ var styles20 = StyleSheet22.create({
|
|
|
7234
8253
|
import {
|
|
7235
8254
|
ActivityIndicator as ActivityIndicator3,
|
|
7236
8255
|
Keyboard as Keyboard2,
|
|
7237
|
-
StyleSheet as
|
|
7238
|
-
useWindowDimensions as
|
|
8256
|
+
StyleSheet as StyleSheet30,
|
|
8257
|
+
useWindowDimensions as useWindowDimensions8
|
|
7239
8258
|
} from "react-native";
|
|
7240
|
-
import
|
|
7241
|
-
Easing as
|
|
7242
|
-
Keyframe as
|
|
7243
|
-
LinearTransition as
|
|
8259
|
+
import Animated11, {
|
|
8260
|
+
Easing as Easing8,
|
|
8261
|
+
Keyframe as Keyframe6,
|
|
8262
|
+
LinearTransition as LinearTransition3
|
|
7244
8263
|
} from "react-native-reanimated";
|
|
7245
|
-
import { useSafeAreaInsets as
|
|
8264
|
+
import { useSafeAreaInsets as useSafeAreaInsets13 } from "react-native-safe-area-context";
|
|
7246
8265
|
|
|
7247
8266
|
// src/components/ReceiveAsRow.tsx
|
|
7248
|
-
import { jsx as
|
|
8267
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
7249
8268
|
function ReceiveAsRow({ destinationToken, onPress }) {
|
|
7250
8269
|
const { t } = useFunkitTranslation();
|
|
7251
8270
|
const label = t("withdrawCrypto.receiveAs");
|
|
7252
|
-
return /* @__PURE__ */
|
|
8271
|
+
return /* @__PURE__ */ jsx51(
|
|
7253
8272
|
SelectedChainRow,
|
|
7254
8273
|
{
|
|
7255
8274
|
label,
|
|
@@ -7267,8 +8286,8 @@ function ReceiveAsRow({ destinationToken, onPress }) {
|
|
|
7267
8286
|
|
|
7268
8287
|
// src/components/WalletAddressInput.tsx
|
|
7269
8288
|
import { BottomSheetTextInput as BottomSheetTextInput2 } from "@gorhom/bottom-sheet";
|
|
7270
|
-
import { StyleSheet as
|
|
7271
|
-
import { jsx as
|
|
8289
|
+
import { StyleSheet as StyleSheet29 } from "react-native";
|
|
8290
|
+
import { jsx as jsx52, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7272
8291
|
var STATUS_ICON_SIZE = 16;
|
|
7273
8292
|
function WalletAddressInput({
|
|
7274
8293
|
value,
|
|
@@ -7285,34 +8304,34 @@ function WalletAddressInput({
|
|
|
7285
8304
|
const label = t("withdrawCrypto.addressPlaceholder");
|
|
7286
8305
|
const isEmpty = value === "";
|
|
7287
8306
|
const helperText = errorText2 ?? warningText;
|
|
7288
|
-
return /* @__PURE__ */
|
|
7289
|
-
/* @__PURE__ */
|
|
8307
|
+
return /* @__PURE__ */ jsxs27(Box, { style: styles27.root, children: [
|
|
8308
|
+
/* @__PURE__ */ jsxs27(
|
|
7290
8309
|
Box,
|
|
7291
8310
|
{
|
|
7292
8311
|
flexDirection: "row",
|
|
7293
8312
|
alignItems: "center",
|
|
7294
8313
|
justifyContent: "space-between",
|
|
7295
|
-
style:
|
|
8314
|
+
style: styles27.header,
|
|
7296
8315
|
children: [
|
|
7297
|
-
/* @__PURE__ */
|
|
8316
|
+
/* @__PURE__ */ jsx52(
|
|
7298
8317
|
Text,
|
|
7299
8318
|
{
|
|
7300
8319
|
variant: "detail",
|
|
7301
8320
|
weight: "medium",
|
|
7302
8321
|
numberOfLines: 1,
|
|
7303
|
-
style: [
|
|
8322
|
+
style: [styles27.label, { color: theme.content.elements.secondary }],
|
|
7304
8323
|
children: label
|
|
7305
8324
|
}
|
|
7306
8325
|
),
|
|
7307
|
-
isAddress === void 0 ? null : /* @__PURE__ */
|
|
7308
|
-
isAddress ? /* @__PURE__ */
|
|
8326
|
+
isAddress === void 0 ? null : /* @__PURE__ */ jsxs27(Box, { flexDirection: "row", alignItems: "center", style: styles27.status, children: [
|
|
8327
|
+
isAddress ? /* @__PURE__ */ jsx52(FigmaSuccessCheckIcon, { size: STATUS_ICON_SIZE }) : /* @__PURE__ */ jsx52(
|
|
7309
8328
|
FigmaAlertCircleIcon,
|
|
7310
8329
|
{
|
|
7311
8330
|
size: STATUS_ICON_SIZE,
|
|
7312
8331
|
color: theme.content.elements.error
|
|
7313
8332
|
}
|
|
7314
8333
|
),
|
|
7315
|
-
/* @__PURE__ */
|
|
8334
|
+
/* @__PURE__ */ jsx52(
|
|
7316
8335
|
Text,
|
|
7317
8336
|
{
|
|
7318
8337
|
variant: "detail",
|
|
@@ -7327,12 +8346,12 @@ function WalletAddressInput({
|
|
|
7327
8346
|
]
|
|
7328
8347
|
}
|
|
7329
8348
|
),
|
|
7330
|
-
/* @__PURE__ */
|
|
8349
|
+
/* @__PURE__ */ jsx52(
|
|
7331
8350
|
Box,
|
|
7332
8351
|
{
|
|
7333
8352
|
borderRadius: "element",
|
|
7334
8353
|
style: [
|
|
7335
|
-
|
|
8354
|
+
styles27.field,
|
|
7336
8355
|
{
|
|
7337
8356
|
height: theme.sizes.buttonLg,
|
|
7338
8357
|
borderColor: theme.border.elements.default.color,
|
|
@@ -7340,7 +8359,7 @@ function WalletAddressInput({
|
|
|
7340
8359
|
backgroundColor: theme.background.modal
|
|
7341
8360
|
}
|
|
7342
8361
|
],
|
|
7343
|
-
children: /* @__PURE__ */
|
|
8362
|
+
children: /* @__PURE__ */ jsx52(
|
|
7344
8363
|
BottomSheetTextInput2,
|
|
7345
8364
|
{
|
|
7346
8365
|
value,
|
|
@@ -7352,7 +8371,7 @@ function WalletAddressInput({
|
|
|
7352
8371
|
autoCorrect: false,
|
|
7353
8372
|
spellCheck: false,
|
|
7354
8373
|
style: [
|
|
7355
|
-
|
|
8374
|
+
styles27.input,
|
|
7356
8375
|
theme.textVariants.bodyMedium,
|
|
7357
8376
|
{ color: theme.content.elements.primary }
|
|
7358
8377
|
]
|
|
@@ -7360,8 +8379,8 @@ function WalletAddressInput({
|
|
|
7360
8379
|
)
|
|
7361
8380
|
}
|
|
7362
8381
|
),
|
|
7363
|
-
/* @__PURE__ */
|
|
7364
|
-
/* @__PURE__ */
|
|
8382
|
+
/* @__PURE__ */ jsxs27(Box, { flexDirection: "row", style: styles27.buttonRow, children: [
|
|
8383
|
+
/* @__PURE__ */ jsx52(Box, { style: styles27.button, children: /* @__PURE__ */ jsx52(
|
|
7365
8384
|
PillButton2,
|
|
7366
8385
|
{
|
|
7367
8386
|
label: t("withdrawAddress.paste"),
|
|
@@ -7371,7 +8390,7 @@ function WalletAddressInput({
|
|
|
7371
8390
|
disabled: isPasting
|
|
7372
8391
|
}
|
|
7373
8392
|
) }),
|
|
7374
|
-
/* @__PURE__ */
|
|
8393
|
+
/* @__PURE__ */ jsx52(Box, { style: styles27.button, children: isEmpty ? onUseConnected ? /* @__PURE__ */ jsx52(
|
|
7375
8394
|
PillButton2,
|
|
7376
8395
|
{
|
|
7377
8396
|
label: t("withdrawAddress.useConnected"),
|
|
@@ -7379,7 +8398,7 @@ function WalletAddressInput({
|
|
|
7379
8398
|
variant: "secondary",
|
|
7380
8399
|
onPress: onUseConnected
|
|
7381
8400
|
}
|
|
7382
|
-
) : null : /* @__PURE__ */
|
|
8401
|
+
) : null : /* @__PURE__ */ jsx52(
|
|
7383
8402
|
PillButton2,
|
|
7384
8403
|
{
|
|
7385
8404
|
label: t("withdrawAddress.clear"),
|
|
@@ -7389,7 +8408,7 @@ function WalletAddressInput({
|
|
|
7389
8408
|
}
|
|
7390
8409
|
) })
|
|
7391
8410
|
] }),
|
|
7392
|
-
helperText ? /* @__PURE__ */
|
|
8411
|
+
helperText ? /* @__PURE__ */ jsx52(
|
|
7393
8412
|
Text,
|
|
7394
8413
|
{
|
|
7395
8414
|
variant: "detail",
|
|
@@ -7401,7 +8420,7 @@ function WalletAddressInput({
|
|
|
7401
8420
|
) : null
|
|
7402
8421
|
] });
|
|
7403
8422
|
}
|
|
7404
|
-
var
|
|
8423
|
+
var styles27 = StyleSheet29.create({
|
|
7405
8424
|
root: { gap: 8 },
|
|
7406
8425
|
header: { gap: 8 },
|
|
7407
8426
|
label: { flexShrink: 1 },
|
|
@@ -7417,12 +8436,12 @@ var styles21 = StyleSheet23.create({
|
|
|
7417
8436
|
});
|
|
7418
8437
|
|
|
7419
8438
|
// src/screens/WithdrawAddressScreen.tsx
|
|
7420
|
-
import { jsx as
|
|
7421
|
-
var
|
|
8439
|
+
import { jsx as jsx53, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8440
|
+
var AnimatedBox6 = Animated11.createAnimatedComponent(Box);
|
|
7422
8441
|
var SUBMIT_TRANSITION_DURATION = 380;
|
|
7423
|
-
var SUBMIT_TRANSITION_EASING =
|
|
8442
|
+
var SUBMIT_TRANSITION_EASING = Easing8.bezier(0.16, 1, 0.3, 1);
|
|
7424
8443
|
var SUBMIT_TRAVEL = 24;
|
|
7425
|
-
var FADE_SLIDE_UP_EXITING = new
|
|
8444
|
+
var FADE_SLIDE_UP_EXITING = new Keyframe6({
|
|
7426
8445
|
0: { opacity: 1, transform: [{ translateY: 0 }] },
|
|
7427
8446
|
100: {
|
|
7428
8447
|
opacity: 0,
|
|
@@ -7430,7 +8449,7 @@ var FADE_SLIDE_UP_EXITING = new Keyframe3({
|
|
|
7430
8449
|
easing: SUBMIT_TRANSITION_EASING
|
|
7431
8450
|
}
|
|
7432
8451
|
}).duration(SUBMIT_TRANSITION_DURATION);
|
|
7433
|
-
var SUBMIT_TRANSITION =
|
|
8452
|
+
var SUBMIT_TRANSITION = LinearTransition3.duration(
|
|
7434
8453
|
SUBMIT_TRANSITION_DURATION
|
|
7435
8454
|
).easing(SUBMIT_TRANSITION_EASING);
|
|
7436
8455
|
function WithdrawAddressScreen({
|
|
@@ -7459,11 +8478,11 @@ function WithdrawAddressScreen({
|
|
|
7459
8478
|
}) {
|
|
7460
8479
|
const { t } = useFunkitTranslation();
|
|
7461
8480
|
const theme = useTheme();
|
|
7462
|
-
const { height } =
|
|
7463
|
-
const insets =
|
|
8481
|
+
const { height } = useWindowDimensions8();
|
|
8482
|
+
const insets = useSafeAreaInsets13();
|
|
7464
8483
|
const keyboardHeight = useKeyboardHeight(true);
|
|
7465
8484
|
const footerErrorText = executionErrorText ?? quoteErrorText;
|
|
7466
|
-
return /* @__PURE__ */
|
|
8485
|
+
return /* @__PURE__ */ jsxs28(
|
|
7467
8486
|
Box,
|
|
7468
8487
|
{
|
|
7469
8488
|
style: {
|
|
@@ -7472,16 +8491,16 @@ function WithdrawAddressScreen({
|
|
|
7472
8491
|
backgroundColor: theme.background.modal
|
|
7473
8492
|
},
|
|
7474
8493
|
children: [
|
|
7475
|
-
isSubmitting ? null : /* @__PURE__ */
|
|
7476
|
-
isSubmitting ? null : /* @__PURE__ */
|
|
7477
|
-
/* @__PURE__ */
|
|
8494
|
+
isSubmitting ? null : /* @__PURE__ */ jsx53(AnimatedBox6, { exiting: FADE_SLIDE_UP_EXITING, children: /* @__PURE__ */ jsx53(TopBar, { title, onBack, onClose }) }),
|
|
8495
|
+
isSubmitting ? null : /* @__PURE__ */ jsxs28(AnimatedBox6, { exiting: FADE_SLIDE_UP_EXITING, style: styles28.body, children: [
|
|
8496
|
+
/* @__PURE__ */ jsx53(
|
|
7478
8497
|
ReceiveAsRow,
|
|
7479
8498
|
{
|
|
7480
8499
|
destinationToken,
|
|
7481
8500
|
onPress: onPressReceive
|
|
7482
8501
|
}
|
|
7483
8502
|
),
|
|
7484
|
-
/* @__PURE__ */
|
|
8503
|
+
/* @__PURE__ */ jsx53(
|
|
7485
8504
|
WalletAddressInput,
|
|
7486
8505
|
{
|
|
7487
8506
|
value: recipient,
|
|
@@ -7495,14 +8514,14 @@ function WithdrawAddressScreen({
|
|
|
7495
8514
|
}
|
|
7496
8515
|
)
|
|
7497
8516
|
] }),
|
|
7498
|
-
/* @__PURE__ */
|
|
7499
|
-
|
|
8517
|
+
/* @__PURE__ */ jsx53(
|
|
8518
|
+
AnimatedBox6,
|
|
7500
8519
|
{
|
|
7501
8520
|
layout: SUBMIT_TRANSITION,
|
|
7502
8521
|
flex: 1,
|
|
7503
8522
|
justifyContent: "center",
|
|
7504
|
-
style:
|
|
7505
|
-
children: isAddress ? /* @__PURE__ */
|
|
8523
|
+
style: styles28.summary,
|
|
8524
|
+
children: isAddress ? /* @__PURE__ */ jsx53(AnimatedBox6, { layout: SUBMIT_TRANSITION, children: /* @__PURE__ */ jsx53(
|
|
7506
8525
|
ReceiveAmountSummary,
|
|
7507
8526
|
{
|
|
7508
8527
|
label: t("withdrawAddress.youllReceive"),
|
|
@@ -7513,12 +8532,12 @@ function WithdrawAddressScreen({
|
|
|
7513
8532
|
) }) : null
|
|
7514
8533
|
}
|
|
7515
8534
|
),
|
|
7516
|
-
recipient === "" ? null : /* @__PURE__ */
|
|
7517
|
-
|
|
8535
|
+
recipient === "" ? null : /* @__PURE__ */ jsxs28(
|
|
8536
|
+
AnimatedBox6,
|
|
7518
8537
|
{
|
|
7519
8538
|
layout: SUBMIT_TRANSITION,
|
|
7520
8539
|
style: [
|
|
7521
|
-
|
|
8540
|
+
styles28.footer,
|
|
7522
8541
|
{
|
|
7523
8542
|
// Withdrawing drops the keyboard, so stop clearing it in the same
|
|
7524
8543
|
// commit that frees the space above: waiting for the hide event
|
|
@@ -7527,22 +8546,22 @@ function WithdrawAddressScreen({
|
|
|
7527
8546
|
}
|
|
7528
8547
|
],
|
|
7529
8548
|
children: [
|
|
7530
|
-
footerErrorText ? /* @__PURE__ */
|
|
8549
|
+
footerErrorText ? /* @__PURE__ */ jsx53(
|
|
7531
8550
|
Text,
|
|
7532
8551
|
{
|
|
7533
8552
|
variant: "detail",
|
|
7534
8553
|
style: [
|
|
7535
|
-
|
|
8554
|
+
styles28.footerError,
|
|
7536
8555
|
{ color: theme.content.elements.error }
|
|
7537
8556
|
],
|
|
7538
8557
|
children: footerErrorText
|
|
7539
8558
|
}
|
|
7540
8559
|
) : null,
|
|
7541
|
-
/* @__PURE__ */
|
|
8560
|
+
/* @__PURE__ */ jsx53(
|
|
7542
8561
|
PillButton2,
|
|
7543
8562
|
{
|
|
7544
8563
|
label: isSubmitting ? t("withdrawAddress.withdrawing") : t("withdrawAddress.withdrawNow"),
|
|
7545
|
-
icon: isSubmitting ? /* @__PURE__ */
|
|
8564
|
+
icon: isSubmitting ? /* @__PURE__ */ jsx53(
|
|
7546
8565
|
ActivityIndicator3,
|
|
7547
8566
|
{
|
|
7548
8567
|
size: "small",
|
|
@@ -7565,7 +8584,7 @@ function WithdrawAddressScreen({
|
|
|
7565
8584
|
}
|
|
7566
8585
|
var BODY_HORIZONTAL_MARGIN = 20;
|
|
7567
8586
|
var FOOTER_KEYBOARD_GAP = 12;
|
|
7568
|
-
var
|
|
8587
|
+
var styles28 = StyleSheet30.create({
|
|
7569
8588
|
body: {
|
|
7570
8589
|
marginHorizontal: BODY_HORIZONTAL_MARGIN,
|
|
7571
8590
|
paddingTop: 12,
|
|
@@ -7577,23 +8596,23 @@ var styles22 = StyleSheet24.create({
|
|
|
7577
8596
|
});
|
|
7578
8597
|
|
|
7579
8598
|
// src/screens/WithdrawAmountScreen.tsx
|
|
7580
|
-
import { USD_DECIMALS, percentOfAmount } from "@funkit/connect-core";
|
|
7581
|
-
import { Pressable as
|
|
7582
|
-
import
|
|
7583
|
-
import { useSafeAreaInsets as
|
|
8599
|
+
import { USD_DECIMALS as USD_DECIMALS2, percentOfAmount } from "@funkit/connect-core";
|
|
8600
|
+
import { Pressable as Pressable18, StyleSheet as StyleSheet34, useWindowDimensions as useWindowDimensions10 } from "react-native";
|
|
8601
|
+
import Animated14, { Keyframe as Keyframe8, LinearTransition as LinearTransition6 } from "react-native-reanimated";
|
|
8602
|
+
import { useSafeAreaInsets as useSafeAreaInsets14 } from "react-native-safe-area-context";
|
|
7584
8603
|
|
|
7585
8604
|
// src/components/AmountDisplay.tsx
|
|
7586
8605
|
import { useMemo as useMemo10 } from "react";
|
|
7587
|
-
import { StyleSheet as
|
|
7588
|
-
import
|
|
7589
|
-
Keyframe as
|
|
7590
|
-
LinearTransition as
|
|
7591
|
-
useAnimatedStyle as
|
|
7592
|
-
withTiming as
|
|
8606
|
+
import { StyleSheet as StyleSheet31, useWindowDimensions as useWindowDimensions9 } from "react-native";
|
|
8607
|
+
import Animated12, {
|
|
8608
|
+
Keyframe as Keyframe7,
|
|
8609
|
+
LinearTransition as LinearTransition4,
|
|
8610
|
+
useAnimatedStyle as useAnimatedStyle6,
|
|
8611
|
+
withTiming as withTiming6
|
|
7593
8612
|
} from "react-native-reanimated";
|
|
7594
8613
|
|
|
7595
8614
|
// src/utils/amountGlyphs.ts
|
|
7596
|
-
function
|
|
8615
|
+
function amountGlyphs2(value, prefix) {
|
|
7597
8616
|
const glyphs = [];
|
|
7598
8617
|
if (prefix) {
|
|
7599
8618
|
glyphs.push({ key: "prefix", char: prefix, kind: "prefix" });
|
|
@@ -7608,49 +8627,44 @@ function amountGlyphs(value, prefix) {
|
|
|
7608
8627
|
return glyphs;
|
|
7609
8628
|
}
|
|
7610
8629
|
|
|
7611
|
-
// src/utils/motion.ts
|
|
7612
|
-
import { Easing as Easing6 } from "react-native-reanimated";
|
|
7613
|
-
var MOTION_DURATION = 180;
|
|
7614
|
-
var MOTION_EASING = Easing6.bezier(0.33, 1, 0.68, 1);
|
|
7615
|
-
|
|
7616
8630
|
// src/components/AmountDisplay.tsx
|
|
7617
|
-
import { jsx as
|
|
7618
|
-
var
|
|
7619
|
-
var
|
|
8631
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
8632
|
+
var AMOUNT_FONT_SIZE3 = 96;
|
|
8633
|
+
var PLACEHOLDER_OPACITY2 = 0.2;
|
|
7620
8634
|
var LINE_HEIGHT_RATIO2 = 1.25;
|
|
7621
8635
|
var LETTER_SPACING_RATIO2 = -1.44 / 96;
|
|
7622
8636
|
var CAP_BOX_RATIO2 = 68 / 96;
|
|
7623
8637
|
var CHARACTER_ADVANCE_RATIO = 0.6;
|
|
7624
8638
|
var HORIZONTAL_INSET = 16;
|
|
7625
8639
|
var MIN_FONT_SIZE = 40;
|
|
7626
|
-
var
|
|
7627
|
-
var
|
|
7628
|
-
var
|
|
7629
|
-
function
|
|
8640
|
+
var AnimatedBox7 = Animated12.createAnimatedComponent(Box);
|
|
8641
|
+
var AnimatedText3 = Animated12.createAnimatedComponent(Text);
|
|
8642
|
+
var GLYPH_LAYOUT2 = LinearTransition4.duration(MOTION_DURATION).easing(MOTION_EASING);
|
|
8643
|
+
function AmountDisplay2({
|
|
7630
8644
|
value,
|
|
7631
8645
|
prefix = "$",
|
|
7632
8646
|
hasError = false,
|
|
7633
8647
|
accessibilityLabel
|
|
7634
8648
|
}) {
|
|
7635
8649
|
const theme = useTheme();
|
|
7636
|
-
const { width } =
|
|
8650
|
+
const { width } = useWindowDimensions9();
|
|
7637
8651
|
const isEmpty = value === "";
|
|
7638
|
-
const glyphs =
|
|
8652
|
+
const glyphs = amountGlyphs2(value, prefix);
|
|
7639
8653
|
const text = glyphs.map((glyph) => glyph.char).join("");
|
|
7640
8654
|
const fontSize = fitAmountFontSize(text, width - HORIZONTAL_INSET * 2);
|
|
7641
8655
|
const overhang = fontSize * (LINE_HEIGHT_RATIO2 - CAP_BOX_RATIO2) / 2;
|
|
7642
8656
|
const lineHeight = fontSize * LINE_HEIGHT_RATIO2;
|
|
7643
8657
|
const slides = useMemo10(
|
|
7644
8658
|
() => ({
|
|
7645
|
-
below:
|
|
7646
|
-
above:
|
|
8659
|
+
below: slideKeyframes2(lineHeight),
|
|
8660
|
+
above: slideKeyframes2(-lineHeight)
|
|
7647
8661
|
}),
|
|
7648
8662
|
[lineHeight]
|
|
7649
8663
|
);
|
|
7650
|
-
const prefixDimming =
|
|
8664
|
+
const prefixDimming = useAnimatedStyle6(() => {
|
|
7651
8665
|
"worklet";
|
|
7652
8666
|
return {
|
|
7653
|
-
opacity:
|
|
8667
|
+
opacity: withTiming6(isEmpty ? PLACEHOLDER_OPACITY2 : 1, {
|
|
7654
8668
|
duration: MOTION_DURATION,
|
|
7655
8669
|
easing: MOTION_EASING
|
|
7656
8670
|
})
|
|
@@ -7659,21 +8673,21 @@ function AmountDisplay({
|
|
|
7659
8673
|
return (
|
|
7660
8674
|
// The window the characters slide through. What it clips is the dead space
|
|
7661
8675
|
// the margin takes back, never the glyphs.
|
|
7662
|
-
/* @__PURE__ */
|
|
8676
|
+
/* @__PURE__ */ jsx54(
|
|
7663
8677
|
Box,
|
|
7664
8678
|
{
|
|
7665
8679
|
accessible: true,
|
|
7666
8680
|
accessibilityLabel,
|
|
7667
8681
|
accessibilityValue: { text },
|
|
7668
|
-
style: [
|
|
7669
|
-
children: glyphs.map(({ key, char, kind }) => /* @__PURE__ */
|
|
7670
|
-
|
|
8682
|
+
style: [styles29.row, { marginVertical: -overhang }],
|
|
8683
|
+
children: glyphs.map(({ key, char, kind }) => /* @__PURE__ */ jsx54(
|
|
8684
|
+
AnimatedBox7,
|
|
7671
8685
|
{
|
|
7672
8686
|
entering: slides[glyphSide(kind, isEmpty)].entering,
|
|
7673
8687
|
exiting: slides[glyphSide(kind, isEmpty)].exiting,
|
|
7674
|
-
layout:
|
|
7675
|
-
children: /* @__PURE__ */
|
|
7676
|
-
|
|
8688
|
+
layout: GLYPH_LAYOUT2,
|
|
8689
|
+
children: /* @__PURE__ */ jsx54(
|
|
8690
|
+
AnimatedText3,
|
|
7677
8691
|
{
|
|
7678
8692
|
weight: "medium",
|
|
7679
8693
|
numberOfLines: 1,
|
|
@@ -7683,7 +8697,7 @@ function AmountDisplay({
|
|
|
7683
8697
|
lineHeight,
|
|
7684
8698
|
letterSpacing: fontSize * LETTER_SPACING_RATIO2,
|
|
7685
8699
|
color: hasError ? theme.content.elements.error : theme.content.elements.primary,
|
|
7686
|
-
opacity: kind === "placeholder" ?
|
|
8700
|
+
opacity: kind === "placeholder" ? PLACEHOLDER_OPACITY2 : 1
|
|
7687
8701
|
},
|
|
7688
8702
|
kind === "prefix" ? prefixDimming : null
|
|
7689
8703
|
],
|
|
@@ -7706,13 +8720,13 @@ function glyphSide(kind, isEmpty) {
|
|
|
7706
8720
|
}
|
|
7707
8721
|
return "below";
|
|
7708
8722
|
}
|
|
7709
|
-
function
|
|
8723
|
+
function slideKeyframes2(offset) {
|
|
7710
8724
|
return {
|
|
7711
|
-
entering: new
|
|
8725
|
+
entering: new Keyframe7({
|
|
7712
8726
|
0: { transform: [{ translateY: offset }] },
|
|
7713
8727
|
100: { transform: [{ translateY: 0 }], easing: MOTION_EASING }
|
|
7714
8728
|
}).duration(MOTION_DURATION),
|
|
7715
|
-
exiting: new
|
|
8729
|
+
exiting: new Keyframe7({
|
|
7716
8730
|
0: { transform: [{ translateY: 0 }] },
|
|
7717
8731
|
100: { transform: [{ translateY: offset }], easing: MOTION_EASING }
|
|
7718
8732
|
}).duration(MOTION_DURATION)
|
|
@@ -7720,9 +8734,9 @@ function slideKeyframes(offset) {
|
|
|
7720
8734
|
}
|
|
7721
8735
|
function fitAmountFontSize(text, available) {
|
|
7722
8736
|
const fitted = available / (text.length * CHARACTER_ADVANCE_RATIO);
|
|
7723
|
-
return Math.max(MIN_FONT_SIZE, Math.min(
|
|
8737
|
+
return Math.max(MIN_FONT_SIZE, Math.min(AMOUNT_FONT_SIZE3, fitted));
|
|
7724
8738
|
}
|
|
7725
|
-
var
|
|
8739
|
+
var styles29 = StyleSheet31.create({
|
|
7726
8740
|
row: {
|
|
7727
8741
|
flexDirection: "row",
|
|
7728
8742
|
justifyContent: "center",
|
|
@@ -7732,79 +8746,24 @@ var styles23 = StyleSheet25.create({
|
|
|
7732
8746
|
});
|
|
7733
8747
|
|
|
7734
8748
|
// src/components/NumPad.tsx
|
|
7735
|
-
import { Pressable as
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
// src/haptics/hapticTap.ts
|
|
7741
|
-
var loading;
|
|
7742
|
-
async function hapticTap() {
|
|
7743
|
-
loading ??= loadTap();
|
|
7744
|
-
const tap = await loading;
|
|
7745
|
-
tap?.();
|
|
7746
|
-
}
|
|
7747
|
-
async function loadTap() {
|
|
7748
|
-
try {
|
|
7749
|
-
const { trigger } = await import("react-native-haptic-feedback");
|
|
7750
|
-
return () => trigger("impactLight");
|
|
7751
|
-
} catch (error) {
|
|
7752
|
-
logger.info(
|
|
7753
|
-
"connect-rn: taps are silent \u2014 install react-native-haptic-feedback, or pass FunkitProvider `hapticFeedback` to use your own haptics module (e.g. expo-haptics in Expo Go).",
|
|
7754
|
-
{ error: error instanceof Error ? error.message : String(error) }
|
|
7755
|
-
);
|
|
7756
|
-
return null;
|
|
7757
|
-
}
|
|
7758
|
-
}
|
|
7759
|
-
|
|
7760
|
-
// src/haptics/HapticsContext.tsx
|
|
7761
|
-
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
7762
|
-
var HapticsContext = createContext2(hapticTap);
|
|
7763
|
-
function FunkitHapticsProvider({
|
|
7764
|
-
hapticFeedback = hapticTap,
|
|
7765
|
-
children
|
|
7766
|
-
}) {
|
|
7767
|
-
return /* @__PURE__ */ jsx47(HapticsContext.Provider, { value: hapticFeedback, children });
|
|
7768
|
-
}
|
|
7769
|
-
var hasWarned = false;
|
|
7770
|
-
function useHapticFeedback() {
|
|
7771
|
-
const haptic = useContext2(HapticsContext);
|
|
7772
|
-
return useCallback11(() => {
|
|
7773
|
-
const warn2 = (error) => {
|
|
7774
|
-
if (hasWarned) {
|
|
7775
|
-
return;
|
|
7776
|
-
}
|
|
7777
|
-
hasWarned = true;
|
|
7778
|
-
logger.warn("connect-rn: haptic feedback failed; taps will be silent", {
|
|
7779
|
-
error: error instanceof Error ? error.message : String(error)
|
|
7780
|
-
});
|
|
7781
|
-
};
|
|
7782
|
-
try {
|
|
7783
|
-
Promise.resolve(haptic()).catch(warn2);
|
|
7784
|
-
} catch (error) {
|
|
7785
|
-
warn2(error);
|
|
7786
|
-
}
|
|
7787
|
-
}, [haptic]);
|
|
7788
|
-
}
|
|
7789
|
-
|
|
7790
|
-
// src/components/NumPad.tsx
|
|
7791
|
-
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
7792
|
-
var KEY_FONT_SIZE = 24;
|
|
7793
|
-
var COLUMN_ALIGNMENT = ["flex-start", "center", "flex-end"];
|
|
7794
|
-
var ROWS = [
|
|
8749
|
+
import { Pressable as Pressable16, StyleSheet as StyleSheet32 } from "react-native";
|
|
8750
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
8751
|
+
var KEY_FONT_SIZE2 = 24;
|
|
8752
|
+
var COLUMN_ALIGNMENT2 = ["flex-start", "center", "flex-end"];
|
|
8753
|
+
var ROWS2 = [
|
|
7795
8754
|
["1", "2", "3"],
|
|
7796
8755
|
["4", "5", "6"],
|
|
7797
8756
|
["7", "8", "9"],
|
|
7798
8757
|
[".", "0", "backspace"]
|
|
7799
8758
|
];
|
|
7800
|
-
function
|
|
8759
|
+
function NumPad2({
|
|
7801
8760
|
onPressKey,
|
|
7802
8761
|
backspaceAccessibilityLabel
|
|
7803
8762
|
}) {
|
|
7804
8763
|
const theme = useTheme();
|
|
7805
8764
|
const haptic = useHapticFeedback();
|
|
7806
|
-
return /* @__PURE__ */
|
|
7807
|
-
|
|
8765
|
+
return /* @__PURE__ */ jsx55(Box, { flex: 1, children: ROWS2.map((row2) => /* @__PURE__ */ jsx55(Box, { flexDirection: "row", flex: 1, children: row2.map((key, column) => /* @__PURE__ */ jsx55(
|
|
8766
|
+
Pressable16,
|
|
7808
8767
|
{
|
|
7809
8768
|
onPress: () => {
|
|
7810
8769
|
haptic();
|
|
@@ -7812,20 +8771,20 @@ function NumPad({
|
|
|
7812
8771
|
},
|
|
7813
8772
|
accessibilityRole: "button",
|
|
7814
8773
|
accessibilityLabel: key === "backspace" ? backspaceAccessibilityLabel : key,
|
|
7815
|
-
style: [
|
|
7816
|
-
children: key === "backspace" ? /* @__PURE__ */
|
|
8774
|
+
style: [styles30.key, { alignItems: COLUMN_ALIGNMENT2[column] }],
|
|
8775
|
+
children: key === "backspace" ? /* @__PURE__ */ jsx55(
|
|
7817
8776
|
FigmaChevronLeftIcon,
|
|
7818
8777
|
{
|
|
7819
|
-
size:
|
|
8778
|
+
size: KEY_FONT_SIZE2,
|
|
7820
8779
|
color: theme.content.elements.primary
|
|
7821
8780
|
}
|
|
7822
|
-
) : /* @__PURE__ */
|
|
8781
|
+
) : /* @__PURE__ */ jsx55(
|
|
7823
8782
|
Text,
|
|
7824
8783
|
{
|
|
7825
8784
|
weight: "medium",
|
|
7826
8785
|
style: [
|
|
7827
|
-
|
|
7828
|
-
key === "." ?
|
|
8786
|
+
styles30.label,
|
|
8787
|
+
key === "." ? styles30.decimalLabel : null
|
|
7829
8788
|
],
|
|
7830
8789
|
children: key
|
|
7831
8790
|
}
|
|
@@ -7834,11 +8793,11 @@ function NumPad({
|
|
|
7834
8793
|
key
|
|
7835
8794
|
)) }, row2.join(""))) });
|
|
7836
8795
|
}
|
|
7837
|
-
var
|
|
8796
|
+
var styles30 = StyleSheet32.create({
|
|
7838
8797
|
key: { flex: 1, justifyContent: "center" },
|
|
7839
8798
|
label: {
|
|
7840
|
-
fontSize:
|
|
7841
|
-
minWidth:
|
|
8799
|
+
fontSize: KEY_FONT_SIZE2,
|
|
8800
|
+
minWidth: KEY_FONT_SIZE2,
|
|
7842
8801
|
lineHeight: 32,
|
|
7843
8802
|
letterSpacing: -0.36,
|
|
7844
8803
|
textAlign: "center"
|
|
@@ -7851,11 +8810,11 @@ var styles24 = StyleSheet26.create({
|
|
|
7851
8810
|
});
|
|
7852
8811
|
|
|
7853
8812
|
// src/components/WithdrawSourceCard.tsx
|
|
7854
|
-
import { Pressable as
|
|
7855
|
-
import
|
|
7856
|
-
import { jsx as
|
|
7857
|
-
var
|
|
7858
|
-
var FOOT_TRANSITION =
|
|
8813
|
+
import { Pressable as Pressable17, StyleSheet as StyleSheet33 } from "react-native";
|
|
8814
|
+
import Animated13, { LinearTransition as LinearTransition5 } from "react-native-reanimated";
|
|
8815
|
+
import { jsx as jsx56, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
8816
|
+
var AnimatedBox8 = Animated13.createAnimatedComponent(Box);
|
|
8817
|
+
var FOOT_TRANSITION = LinearTransition5.duration(MOTION_DURATION).easing(MOTION_EASING);
|
|
7859
8818
|
var HORIZONTAL_PADDING = 12;
|
|
7860
8819
|
var VERTICAL_PADDING = 13;
|
|
7861
8820
|
var ATTACHED_BOTTOM_PADDING = 40;
|
|
@@ -7870,14 +8829,14 @@ function WithdrawSourceCard({
|
|
|
7870
8829
|
attachedToButton = false
|
|
7871
8830
|
}) {
|
|
7872
8831
|
const theme = useTheme();
|
|
7873
|
-
const card2 = /* @__PURE__ */
|
|
7874
|
-
|
|
8832
|
+
const card2 = /* @__PURE__ */ jsxs29(
|
|
8833
|
+
AnimatedBox8,
|
|
7875
8834
|
{
|
|
7876
8835
|
flexDirection: "row",
|
|
7877
8836
|
alignItems: "center",
|
|
7878
8837
|
layout: FOOT_TRANSITION,
|
|
7879
8838
|
style: [
|
|
7880
|
-
|
|
8839
|
+
styles31.card,
|
|
7881
8840
|
{
|
|
7882
8841
|
backgroundColor: theme.background.secondary,
|
|
7883
8842
|
borderTopLeftRadius: theme.borderRadii.element,
|
|
@@ -7888,18 +8847,18 @@ function WithdrawSourceCard({
|
|
|
7888
8847
|
}
|
|
7889
8848
|
],
|
|
7890
8849
|
children: [
|
|
7891
|
-
/* @__PURE__ */
|
|
8850
|
+
/* @__PURE__ */ jsxs29(
|
|
7892
8851
|
Box,
|
|
7893
8852
|
{
|
|
7894
8853
|
flex: 1,
|
|
7895
8854
|
flexDirection: "row",
|
|
7896
8855
|
alignItems: "center",
|
|
7897
|
-
style:
|
|
8856
|
+
style: styles31.token,
|
|
7898
8857
|
children: [
|
|
7899
8858
|
icon,
|
|
7900
|
-
/* @__PURE__ */
|
|
7901
|
-
/* @__PURE__ */
|
|
7902
|
-
subtitle ? /* @__PURE__ */
|
|
8859
|
+
/* @__PURE__ */ jsxs29(Box, { flex: 1, style: styles31.details, children: [
|
|
8860
|
+
/* @__PURE__ */ jsx56(Text, { variant: "bodyMedium", numberOfLines: 1, children: title }),
|
|
8861
|
+
subtitle ? /* @__PURE__ */ jsx56(
|
|
7903
8862
|
Text,
|
|
7904
8863
|
{
|
|
7905
8864
|
variant: "detail",
|
|
@@ -7912,26 +8871,26 @@ function WithdrawSourceCard({
|
|
|
7912
8871
|
]
|
|
7913
8872
|
}
|
|
7914
8873
|
),
|
|
7915
|
-
onUseMax ? /* @__PURE__ */
|
|
7916
|
-
|
|
8874
|
+
onUseMax ? /* @__PURE__ */ jsx56(
|
|
8875
|
+
Pressable17,
|
|
7917
8876
|
{
|
|
7918
8877
|
onPress: onUseMax,
|
|
7919
8878
|
accessibilityRole: "button",
|
|
7920
8879
|
accessibilityLabel: useMaxLabel,
|
|
7921
|
-
children: /* @__PURE__ */
|
|
8880
|
+
children: /* @__PURE__ */ jsx56(
|
|
7922
8881
|
Box,
|
|
7923
8882
|
{
|
|
7924
8883
|
borderRadius: "button",
|
|
7925
8884
|
alignItems: "center",
|
|
7926
8885
|
justifyContent: "center",
|
|
7927
8886
|
style: [
|
|
7928
|
-
|
|
8887
|
+
styles31.useMax,
|
|
7929
8888
|
{
|
|
7930
8889
|
height: theme.sizes.buttonXs,
|
|
7931
8890
|
backgroundColor: theme.border.elements.default.color
|
|
7932
8891
|
}
|
|
7933
8892
|
],
|
|
7934
|
-
children: /* @__PURE__ */
|
|
8893
|
+
children: /* @__PURE__ */ jsx56(
|
|
7935
8894
|
Text,
|
|
7936
8895
|
{
|
|
7937
8896
|
variant: "bodyMedium",
|
|
@@ -7944,7 +8903,7 @@ function WithdrawSourceCard({
|
|
|
7944
8903
|
)
|
|
7945
8904
|
}
|
|
7946
8905
|
) : null,
|
|
7947
|
-
onPress ? /* @__PURE__ */
|
|
8906
|
+
onPress ? /* @__PURE__ */ jsx56(
|
|
7948
8907
|
FigmaChevronRightIcon,
|
|
7949
8908
|
{
|
|
7950
8909
|
size: 16,
|
|
@@ -7957,8 +8916,8 @@ function WithdrawSourceCard({
|
|
|
7957
8916
|
if (!onPress) {
|
|
7958
8917
|
return card2;
|
|
7959
8918
|
}
|
|
7960
|
-
return /* @__PURE__ */
|
|
7961
|
-
|
|
8919
|
+
return /* @__PURE__ */ jsx56(
|
|
8920
|
+
Pressable17,
|
|
7962
8921
|
{
|
|
7963
8922
|
onPress,
|
|
7964
8923
|
accessibilityRole: "button",
|
|
@@ -7967,7 +8926,7 @@ function WithdrawSourceCard({
|
|
|
7967
8926
|
}
|
|
7968
8927
|
);
|
|
7969
8928
|
}
|
|
7970
|
-
var
|
|
8929
|
+
var styles31 = StyleSheet33.create({
|
|
7971
8930
|
card: {
|
|
7972
8931
|
gap: 8,
|
|
7973
8932
|
paddingHorizontal: HORIZONTAL_PADDING,
|
|
@@ -7978,40 +8937,18 @@ var styles25 = StyleSheet27.create({
|
|
|
7978
8937
|
useMax: { paddingHorizontal: 16 }
|
|
7979
8938
|
});
|
|
7980
8939
|
|
|
7981
|
-
// src/utils/numpadInput.ts
|
|
7982
|
-
var DECIMAL_POINT = ".";
|
|
7983
|
-
function applyNumpadKey(value, key, maxDecimals) {
|
|
7984
|
-
if (key === "backspace") {
|
|
7985
|
-
return value.slice(0, -1);
|
|
7986
|
-
}
|
|
7987
|
-
if (key === DECIMAL_POINT) {
|
|
7988
|
-
if (value.includes(DECIMAL_POINT) || maxDecimals === 0) {
|
|
7989
|
-
return value;
|
|
7990
|
-
}
|
|
7991
|
-
return value === "" ? `0${DECIMAL_POINT}` : `${value}${DECIMAL_POINT}`;
|
|
7992
|
-
}
|
|
7993
|
-
const fraction = value.split(DECIMAL_POINT)[1];
|
|
7994
|
-
if (fraction !== void 0 && maxDecimals !== void 0 && fraction.length >= maxDecimals) {
|
|
7995
|
-
return value;
|
|
7996
|
-
}
|
|
7997
|
-
if (value === "0") {
|
|
7998
|
-
return key === "0" ? value : key;
|
|
7999
|
-
}
|
|
8000
|
-
return `${value}${key}`;
|
|
8001
|
-
}
|
|
8002
|
-
|
|
8003
8940
|
// src/screens/WithdrawAmountScreen.tsx
|
|
8004
|
-
import { jsx as
|
|
8005
|
-
var
|
|
8006
|
-
var
|
|
8007
|
-
var
|
|
8008
|
-
var CARD_TRANSITION =
|
|
8941
|
+
import { jsx as jsx57, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
8942
|
+
var NUMPAD_BOTTOM_MARGIN2 = 25;
|
|
8943
|
+
var NUMPAD_MIN_BOTTOM_MARGIN2 = 40;
|
|
8944
|
+
var AnimatedBox9 = Animated14.createAnimatedComponent(Box);
|
|
8945
|
+
var CARD_TRANSITION = LinearTransition6.duration(MOTION_DURATION).easing(MOTION_EASING);
|
|
8009
8946
|
var BUTTON_TRAVEL = 24;
|
|
8010
|
-
var BUTTON_ENTERING = new
|
|
8947
|
+
var BUTTON_ENTERING = new Keyframe8({
|
|
8011
8948
|
0: { opacity: 0, transform: [{ translateY: BUTTON_TRAVEL }] },
|
|
8012
8949
|
100: { opacity: 1, transform: [{ translateY: 0 }], easing: MOTION_EASING }
|
|
8013
8950
|
}).duration(MOTION_DURATION);
|
|
8014
|
-
var BUTTON_EXITING = new
|
|
8951
|
+
var BUTTON_EXITING = new Keyframe8({
|
|
8015
8952
|
0: { opacity: 1, transform: [{ translateY: 0 }] },
|
|
8016
8953
|
100: {
|
|
8017
8954
|
opacity: 0,
|
|
@@ -8040,14 +8977,14 @@ function WithdrawAmountScreen({
|
|
|
8040
8977
|
}) {
|
|
8041
8978
|
const { t } = useFunkitTranslation();
|
|
8042
8979
|
const theme = useTheme();
|
|
8043
|
-
const { height } =
|
|
8044
|
-
const insets =
|
|
8980
|
+
const { height } = useWindowDimensions10();
|
|
8981
|
+
const insets = useSafeAreaInsets14();
|
|
8045
8982
|
const showUseMax = input === "" && balance !== void 0;
|
|
8046
8983
|
const tokenLabel = `${formatTokenAmount(amount === "" ? "0" : amount)} ${source.symbol}`;
|
|
8047
8984
|
const convertedLabel = inUsd ? tokenLabel : usdLabel ?? tokenLabel;
|
|
8048
8985
|
const canSwap = !!onSwapDenomination && !errorText2;
|
|
8049
|
-
const convertedLine = /* @__PURE__ */
|
|
8050
|
-
/* @__PURE__ */
|
|
8986
|
+
const convertedLine = /* @__PURE__ */ jsxs30(Box, { flexDirection: "row", alignItems: "center", style: styles32.convertedRow, children: [
|
|
8987
|
+
/* @__PURE__ */ jsx57(
|
|
8051
8988
|
Text,
|
|
8052
8989
|
{
|
|
8053
8990
|
variant: "bodyMedium",
|
|
@@ -8059,9 +8996,9 @@ function WithdrawAmountScreen({
|
|
|
8059
8996
|
children: errorText2 ?? convertedLabel
|
|
8060
8997
|
}
|
|
8061
8998
|
),
|
|
8062
|
-
canSwap ? /* @__PURE__ */
|
|
8999
|
+
canSwap ? /* @__PURE__ */ jsx57(FigmaSwapIcon, { size: 16, color: theme.content.elements.secondary }) : null
|
|
8063
9000
|
] });
|
|
8064
|
-
return /* @__PURE__ */
|
|
9001
|
+
return /* @__PURE__ */ jsxs30(
|
|
8065
9002
|
Box,
|
|
8066
9003
|
{
|
|
8067
9004
|
style: {
|
|
@@ -8070,10 +9007,10 @@ function WithdrawAmountScreen({
|
|
|
8070
9007
|
backgroundColor: theme.background.modal
|
|
8071
9008
|
},
|
|
8072
9009
|
children: [
|
|
8073
|
-
/* @__PURE__ */
|
|
8074
|
-
/* @__PURE__ */
|
|
8075
|
-
/* @__PURE__ */
|
|
8076
|
-
|
|
9010
|
+
/* @__PURE__ */ jsx57(TopBar, { title, onBack, onClose }),
|
|
9011
|
+
/* @__PURE__ */ jsxs30(Box, { style: styles32.amount, children: [
|
|
9012
|
+
/* @__PURE__ */ jsx57(
|
|
9013
|
+
AmountDisplay2,
|
|
8077
9014
|
{
|
|
8078
9015
|
value: groupThousands(input),
|
|
8079
9016
|
prefix: inUsd ? "$" : "",
|
|
@@ -8081,8 +9018,8 @@ function WithdrawAmountScreen({
|
|
|
8081
9018
|
accessibilityLabel: t("withdrawAmount.amountLabel")
|
|
8082
9019
|
}
|
|
8083
9020
|
),
|
|
8084
|
-
/* @__PURE__ */
|
|
8085
|
-
|
|
9021
|
+
/* @__PURE__ */ jsx57(Box, { style: styles32.converted, children: canSwap ? /* @__PURE__ */ jsx57(
|
|
9022
|
+
Pressable18,
|
|
8086
9023
|
{
|
|
8087
9024
|
onPress: onSwapDenomination,
|
|
8088
9025
|
accessibilityRole: "button",
|
|
@@ -8092,12 +9029,12 @@ function WithdrawAmountScreen({
|
|
|
8092
9029
|
}
|
|
8093
9030
|
) : convertedLine })
|
|
8094
9031
|
] }),
|
|
8095
|
-
/* @__PURE__ */
|
|
8096
|
-
/* @__PURE__ */
|
|
8097
|
-
/* @__PURE__ */
|
|
9032
|
+
/* @__PURE__ */ jsx57(Box, { flex: 1 }),
|
|
9033
|
+
/* @__PURE__ */ jsxs30(AnimatedBox9, { layout: CARD_TRANSITION, style: styles32.card, children: [
|
|
9034
|
+
/* @__PURE__ */ jsx57(
|
|
8098
9035
|
WithdrawSourceCard,
|
|
8099
9036
|
{
|
|
8100
|
-
icon: /* @__PURE__ */
|
|
9037
|
+
icon: /* @__PURE__ */ jsx57(
|
|
8101
9038
|
TokenChainIcon,
|
|
8102
9039
|
{
|
|
8103
9040
|
symbol: source.symbol,
|
|
@@ -8115,12 +9052,12 @@ function WithdrawAmountScreen({
|
|
|
8115
9052
|
attachedToButton: !showUseMax
|
|
8116
9053
|
}
|
|
8117
9054
|
),
|
|
8118
|
-
/* @__PURE__ */
|
|
8119
|
-
|
|
9055
|
+
/* @__PURE__ */ jsx57(
|
|
9056
|
+
AnimatedBox9,
|
|
8120
9057
|
{
|
|
8121
9058
|
layout: CARD_TRANSITION,
|
|
8122
|
-
style: [
|
|
8123
|
-
children: showUseMax ? null : /* @__PURE__ */
|
|
9059
|
+
style: [styles32.buttonClip, showUseMax ? null : styles32.buttonSlot],
|
|
9060
|
+
children: showUseMax ? null : /* @__PURE__ */ jsx57(AnimatedBox9, { entering: BUTTON_ENTERING, exiting: BUTTON_EXITING, children: /* @__PURE__ */ jsx57(
|
|
8124
9061
|
PillButton2,
|
|
8125
9062
|
{
|
|
8126
9063
|
label: t("common.continue"),
|
|
@@ -8132,24 +9069,24 @@ function WithdrawAmountScreen({
|
|
|
8132
9069
|
}
|
|
8133
9070
|
)
|
|
8134
9071
|
] }),
|
|
8135
|
-
/* @__PURE__ */
|
|
9072
|
+
/* @__PURE__ */ jsx57(
|
|
8136
9073
|
Box,
|
|
8137
9074
|
{
|
|
8138
9075
|
style: [
|
|
8139
|
-
|
|
9076
|
+
styles32.numpad,
|
|
8140
9077
|
{
|
|
8141
9078
|
marginBottom: Math.max(
|
|
8142
|
-
|
|
8143
|
-
|
|
9079
|
+
NUMPAD_BOTTOM_MARGIN2 + insets.bottom,
|
|
9080
|
+
NUMPAD_MIN_BOTTOM_MARGIN2
|
|
8144
9081
|
)
|
|
8145
9082
|
}
|
|
8146
9083
|
],
|
|
8147
|
-
children: /* @__PURE__ */
|
|
8148
|
-
|
|
9084
|
+
children: /* @__PURE__ */ jsx57(
|
|
9085
|
+
NumPad2,
|
|
8149
9086
|
{
|
|
8150
9087
|
backspaceAccessibilityLabel: t("withdrawAmount.delete"),
|
|
8151
9088
|
onPressKey: (key) => onChangeInput(
|
|
8152
|
-
applyNumpadKey(input, key, inUsd ?
|
|
9089
|
+
applyNumpadKey(input, key, inUsd ? USD_DECIMALS2 : sourceDecimals)
|
|
8153
9090
|
)
|
|
8154
9091
|
}
|
|
8155
9092
|
)
|
|
@@ -8159,7 +9096,7 @@ function WithdrawAmountScreen({
|
|
|
8159
9096
|
}
|
|
8160
9097
|
);
|
|
8161
9098
|
}
|
|
8162
|
-
var
|
|
9099
|
+
var styles32 = StyleSheet34.create({
|
|
8163
9100
|
amount: { alignItems: "center", paddingTop: 78 },
|
|
8164
9101
|
converted: { paddingTop: 32 },
|
|
8165
9102
|
convertedRow: { gap: 6 },
|
|
@@ -8176,7 +9113,7 @@ var styles26 = StyleSheet28.create({
|
|
|
8176
9113
|
});
|
|
8177
9114
|
|
|
8178
9115
|
// src/screens/WithdrawCryptoSteps.tsx
|
|
8179
|
-
import { Fragment as Fragment4, jsx as
|
|
9116
|
+
import { Fragment as Fragment4, jsx as jsx58, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
8180
9117
|
function WithdrawCryptoSteps({
|
|
8181
9118
|
config,
|
|
8182
9119
|
callbacks,
|
|
@@ -8189,7 +9126,7 @@ function WithdrawCryptoSteps({
|
|
|
8189
9126
|
onSubmitted
|
|
8190
9127
|
}) {
|
|
8191
9128
|
const { t } = useFunkitTranslation();
|
|
8192
|
-
const insets =
|
|
9129
|
+
const insets = useSafeAreaInsets15();
|
|
8193
9130
|
const formOptions = { config, quoteInputFeeTokens, quoteInputFeeSettled };
|
|
8194
9131
|
const form = useCryptoWithdrawalForm(formOptions);
|
|
8195
9132
|
const {
|
|
@@ -8218,10 +9155,10 @@ function WithdrawCryptoSteps({
|
|
|
8218
9155
|
},
|
|
8219
9156
|
onSubmitted
|
|
8220
9157
|
});
|
|
8221
|
-
const [isPickingSource, setIsPickingSource] =
|
|
8222
|
-
const [isPasting, setIsPasting] =
|
|
9158
|
+
const [isPickingSource, setIsPickingSource] = useState23(false);
|
|
9159
|
+
const [isPasting, setIsPasting] = useState23(false);
|
|
8223
9160
|
if (isPickingSource) {
|
|
8224
|
-
return /* @__PURE__ */
|
|
9161
|
+
return /* @__PURE__ */ jsx58(
|
|
8225
9162
|
SelectSourceTokenScreen,
|
|
8226
9163
|
{
|
|
8227
9164
|
options: form.sourceOptions,
|
|
@@ -8237,7 +9174,7 @@ function WithdrawCryptoSteps({
|
|
|
8237
9174
|
);
|
|
8238
9175
|
}
|
|
8239
9176
|
if (current === "withdrawReceiveToken") {
|
|
8240
|
-
return /* @__PURE__ */
|
|
9177
|
+
return /* @__PURE__ */ jsx58(
|
|
8241
9178
|
SelectReceiveTokenAndChainScreen,
|
|
8242
9179
|
{
|
|
8243
9180
|
chains: form.destinationChains,
|
|
@@ -8255,7 +9192,7 @@ function WithdrawCryptoSteps({
|
|
|
8255
9192
|
);
|
|
8256
9193
|
}
|
|
8257
9194
|
if (current === "withdrawAmount") {
|
|
8258
|
-
return /* @__PURE__ */
|
|
9195
|
+
return /* @__PURE__ */ jsx58(
|
|
8259
9196
|
WithdrawAmountScreen,
|
|
8260
9197
|
{
|
|
8261
9198
|
title: t("withdrawCrypto.title"),
|
|
@@ -8291,8 +9228,8 @@ function WithdrawCryptoSteps({
|
|
|
8291
9228
|
}
|
|
8292
9229
|
);
|
|
8293
9230
|
}
|
|
8294
|
-
return /* @__PURE__ */
|
|
8295
|
-
/* @__PURE__ */
|
|
9231
|
+
return /* @__PURE__ */ jsxs31(Fragment4, { children: [
|
|
9232
|
+
/* @__PURE__ */ jsx58(
|
|
8296
9233
|
WithdrawAddressScreen,
|
|
8297
9234
|
{
|
|
8298
9235
|
title: t("withdrawAddress.title", {
|
|
@@ -8331,7 +9268,7 @@ function WithdrawCryptoSteps({
|
|
|
8331
9268
|
onClose: nav.closeFlow
|
|
8332
9269
|
}
|
|
8333
9270
|
),
|
|
8334
|
-
/* @__PURE__ */
|
|
9271
|
+
/* @__PURE__ */ jsx58(
|
|
8335
9272
|
BottomSheetModal4,
|
|
8336
9273
|
{
|
|
8337
9274
|
ref: nestedSheetRef,
|
|
@@ -8341,7 +9278,7 @@ function WithdrawCryptoSteps({
|
|
|
8341
9278
|
backgroundComponent: FlowSheetBackground,
|
|
8342
9279
|
backdropComponent: renderNestedBackdrop,
|
|
8343
9280
|
onDismiss: () => setNestedScreen(null),
|
|
8344
|
-
children: /* @__PURE__ */
|
|
9281
|
+
children: /* @__PURE__ */ jsx58(BottomSheetView4, { children: nestedScreen === "transactionBreakdown" ? /* @__PURE__ */ jsx58(
|
|
8345
9282
|
TransactionBreakdownScreen,
|
|
8346
9283
|
{
|
|
8347
9284
|
usdLabel: receiveUsdLabel ?? "",
|
|
@@ -8361,7 +9298,7 @@ function useConnectedRecipientAddress(config) {
|
|
|
8361
9298
|
}
|
|
8362
9299
|
|
|
8363
9300
|
// src/screens/WithdrawMethodScreen.tsx
|
|
8364
|
-
import { jsx as
|
|
9301
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
8365
9302
|
function getTerminalError(t, isBelowMinimum, isEmpty) {
|
|
8366
9303
|
if (isBelowMinimum) {
|
|
8367
9304
|
return {
|
|
@@ -8392,7 +9329,7 @@ function WithdrawMethodScreen(props) {
|
|
|
8392
9329
|
} = props;
|
|
8393
9330
|
const terminalError = getTerminalError(t, isBelowMinimum, isEmpty);
|
|
8394
9331
|
if (terminalError && !hasError && !loading2) {
|
|
8395
|
-
return /* @__PURE__ */
|
|
9332
|
+
return /* @__PURE__ */ jsx59(
|
|
8396
9333
|
SelectMethodScreen,
|
|
8397
9334
|
{
|
|
8398
9335
|
title,
|
|
@@ -8404,7 +9341,7 @@ function WithdrawMethodScreen(props) {
|
|
|
8404
9341
|
}
|
|
8405
9342
|
);
|
|
8406
9343
|
}
|
|
8407
|
-
return /* @__PURE__ */
|
|
9344
|
+
return /* @__PURE__ */ jsx59(
|
|
8408
9345
|
SelectMethodScreen,
|
|
8409
9346
|
{
|
|
8410
9347
|
title,
|
|
@@ -8425,7 +9362,7 @@ import {
|
|
|
8425
9362
|
isValidOrderData
|
|
8426
9363
|
} from "@funkit/connect-core";
|
|
8427
9364
|
import { useCallback as useCallback12 } from "react";
|
|
8428
|
-
import { jsx as
|
|
9365
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
8429
9366
|
function SwappedWithdrawScreen({
|
|
8430
9367
|
url,
|
|
8431
9368
|
onClose,
|
|
@@ -8471,7 +9408,7 @@ function SwappedWithdrawScreen({
|
|
|
8471
9408
|
},
|
|
8472
9409
|
[onBack, onClose, onNewWithdrawal, onWithdrawalSuccess, onOrderData]
|
|
8473
9410
|
);
|
|
8474
|
-
return /* @__PURE__ */
|
|
9411
|
+
return /* @__PURE__ */ jsx60(SwappedScreenShell, { url, onMessage: handleMessage });
|
|
8475
9412
|
}
|
|
8476
9413
|
|
|
8477
9414
|
// src/transfer/hooks/useWithdrawalFops.ts
|
|
@@ -8704,7 +9641,7 @@ import {
|
|
|
8704
9641
|
processFiatWithdrawalOrder,
|
|
8705
9642
|
toFiatWithdrawalOrder
|
|
8706
9643
|
} from "@funkit/connect-core";
|
|
8707
|
-
import { useCallback as useCallback13, useRef as
|
|
9644
|
+
import { useCallback as useCallback13, useRef as useRef18 } from "react";
|
|
8708
9645
|
var submittedOrderIds = /* @__PURE__ */ new Set();
|
|
8709
9646
|
function useWithdrawalExecution({
|
|
8710
9647
|
config,
|
|
@@ -8713,7 +9650,7 @@ function useWithdrawalExecution({
|
|
|
8713
9650
|
onError
|
|
8714
9651
|
}) {
|
|
8715
9652
|
const { apiKey, userId } = useFunkitIdentity();
|
|
8716
|
-
const isProcessingRef =
|
|
9653
|
+
const isProcessingRef = useRef18(false);
|
|
8717
9654
|
const executeOrder = useCallback13(
|
|
8718
9655
|
async (data) => {
|
|
8719
9656
|
const order = toFiatWithdrawalOrder(data);
|
|
@@ -8790,7 +9727,7 @@ function useWithdrawalExecution({
|
|
|
8790
9727
|
}
|
|
8791
9728
|
|
|
8792
9729
|
// src/flow/WithdrawalFlowContent.tsx
|
|
8793
|
-
import { jsx as
|
|
9730
|
+
import { jsx as jsx61 } from "react/jsx-runtime";
|
|
8794
9731
|
var CRYPTO_WITHDRAWAL_METHOD_ID = "crypto-withdrawal";
|
|
8795
9732
|
var HOST_METHOD_ID_PREFIX = "method:";
|
|
8796
9733
|
function WithdrawalFlowContent({
|
|
@@ -8807,13 +9744,13 @@ function WithdrawalFlowContent({
|
|
|
8807
9744
|
const queryClient = useQueryClient();
|
|
8808
9745
|
const { fops, isLoading, isBelowMinimumBalance, isError, route } = useWithdrawalFops({ config });
|
|
8809
9746
|
const methodOptions = config.methods ?? [];
|
|
8810
|
-
const [selectedMethodId, setSelectedMethodId] =
|
|
9747
|
+
const [selectedMethodId, setSelectedMethodId] = useState24();
|
|
8811
9748
|
const selectedMethodConfig = methodOptions.find(
|
|
8812
9749
|
(method) => method.id === selectedMethodId
|
|
8813
9750
|
)?.config;
|
|
8814
|
-
const [selectedFop, setSelectedFop] =
|
|
8815
|
-
const [hasExecutionError, setHasExecutionError] =
|
|
8816
|
-
const [submittedWithdrawal, setSubmittedWithdrawal] =
|
|
9751
|
+
const [selectedFop, setSelectedFop] = useState24();
|
|
9752
|
+
const [hasExecutionError, setHasExecutionError] = useState24(false);
|
|
9753
|
+
const [submittedWithdrawal, setSubmittedWithdrawal] = useState24();
|
|
8817
9754
|
const onExecutionError = useCallback14(() => setHasExecutionError(true), []);
|
|
8818
9755
|
const { executeOrder } = useWithdrawalExecution({
|
|
8819
9756
|
config,
|
|
@@ -8825,7 +9762,7 @@ function WithdrawalFlowContent({
|
|
|
8825
9762
|
void queryClient.invalidateQueries({ queryKey: [WITHDRAW_FOPS_QUERY_KEY] });
|
|
8826
9763
|
}, [queryClient]);
|
|
8827
9764
|
if (hasExecutionError) {
|
|
8828
|
-
return /* @__PURE__ */
|
|
9765
|
+
return /* @__PURE__ */ jsx61(
|
|
8829
9766
|
WithdrawMethodScreen,
|
|
8830
9767
|
{
|
|
8831
9768
|
title: config.title ?? t("withdraw.title"),
|
|
@@ -8847,7 +9784,7 @@ function WithdrawalFlowContent({
|
|
|
8847
9784
|
id: String(i),
|
|
8848
9785
|
title: row2.name,
|
|
8849
9786
|
subtitle: row2.subtitle,
|
|
8850
|
-
icon: /* @__PURE__ */
|
|
9787
|
+
icon: /* @__PURE__ */ jsx61(PaymentMethodIcon, { fop: fops[i] })
|
|
8851
9788
|
})
|
|
8852
9789
|
);
|
|
8853
9790
|
const showCashList = isLoading || cashMethods.length > 0;
|
|
@@ -8855,13 +9792,13 @@ function WithdrawalFlowContent({
|
|
|
8855
9792
|
id: CRYPTO_WITHDRAWAL_METHOD_ID,
|
|
8856
9793
|
title: t("withdrawCrypto.methodTitle"),
|
|
8857
9794
|
subtitle: t("withdrawCrypto.methodSubtitle"),
|
|
8858
|
-
icon: /* @__PURE__ */
|
|
9795
|
+
icon: /* @__PURE__ */ jsx61(CryptoBitcoinIcon, {})
|
|
8859
9796
|
};
|
|
8860
9797
|
const cryptoMethods = methodOptions.length ? methodOptions.map((method) => ({
|
|
8861
9798
|
id: `${HOST_METHOD_ID_PREFIX}${method.id}`,
|
|
8862
9799
|
title: method.title,
|
|
8863
9800
|
subtitle: method.subtitle,
|
|
8864
|
-
icon: method.icon ?? /* @__PURE__ */
|
|
9801
|
+
icon: method.icon ?? /* @__PURE__ */ jsx61(CryptoBitcoinIcon, {})
|
|
8865
9802
|
})) : [genericCryptoRow];
|
|
8866
9803
|
const methods = [
|
|
8867
9804
|
...cryptoMethods,
|
|
@@ -8873,7 +9810,7 @@ function WithdrawalFlowContent({
|
|
|
8873
9810
|
})) : []
|
|
8874
9811
|
];
|
|
8875
9812
|
const cashNote = showCashList ? void 0 : isError ? t("withdraw.cashMethodsError") : t("withdraw.noCashMethods");
|
|
8876
|
-
return /* @__PURE__ */
|
|
9813
|
+
return /* @__PURE__ */ jsx61(
|
|
8877
9814
|
WithdrawMethodScreen,
|
|
8878
9815
|
{
|
|
8879
9816
|
title: config.title ?? t("withdraw.title"),
|
|
@@ -8907,7 +9844,7 @@ function WithdrawalFlowContent({
|
|
|
8907
9844
|
case "withdrawAmount":
|
|
8908
9845
|
case "withdrawAddress":
|
|
8909
9846
|
case "withdrawReceiveToken":
|
|
8910
|
-
return /* @__PURE__ */
|
|
9847
|
+
return /* @__PURE__ */ jsx61(
|
|
8911
9848
|
WithdrawCryptoSteps,
|
|
8912
9849
|
{
|
|
8913
9850
|
config: selectedMethodConfig ?? config,
|
|
@@ -8925,7 +9862,7 @@ function WithdrawalFlowContent({
|
|
|
8925
9862
|
}
|
|
8926
9863
|
);
|
|
8927
9864
|
case "withdrawComplete":
|
|
8928
|
-
return submittedWithdrawal ? /* @__PURE__ */
|
|
9865
|
+
return submittedWithdrawal ? /* @__PURE__ */ jsx61(
|
|
8929
9866
|
WithdrawCryptoComplete,
|
|
8930
9867
|
{
|
|
8931
9868
|
depositAddressOrHash: submittedWithdrawal.depositAddressOrHash,
|
|
@@ -8937,7 +9874,7 @@ function WithdrawalFlowContent({
|
|
|
8937
9874
|
}
|
|
8938
9875
|
) : null;
|
|
8939
9876
|
case "swapped":
|
|
8940
|
-
return selectedFop?.embeddedFlowUrl ? /* @__PURE__ */
|
|
9877
|
+
return selectedFop?.embeddedFlowUrl ? /* @__PURE__ */ jsx61(
|
|
8941
9878
|
SwappedWithdrawScreen,
|
|
8942
9879
|
{
|
|
8943
9880
|
url: selectedFop.embeddedFlowUrl,
|
|
@@ -8976,7 +9913,7 @@ function WithdrawalFlowContent({
|
|
|
8976
9913
|
}
|
|
8977
9914
|
|
|
8978
9915
|
// src/flow/FunkitFlowProvider.tsx
|
|
8979
|
-
import { jsx as
|
|
9916
|
+
import { jsx as jsx62, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8980
9917
|
var CRYPTO_WITHDRAWAL_STEPS = /* @__PURE__ */ new Set([
|
|
8981
9918
|
"withdrawAmount",
|
|
8982
9919
|
"withdrawAddress",
|
|
@@ -8989,6 +9926,7 @@ var CLOSED = {
|
|
|
8989
9926
|
flow: null,
|
|
8990
9927
|
session: 0
|
|
8991
9928
|
};
|
|
9929
|
+
var RN_V2_DEPOSIT_GATE = "enable-rn-v2-deposit";
|
|
8992
9930
|
var FunkitFlowContext = createContext3(null);
|
|
8993
9931
|
function FunkitFlowProvider({
|
|
8994
9932
|
children,
|
|
@@ -8996,25 +9934,32 @@ function FunkitFlowProvider({
|
|
|
8996
9934
|
pasteFromClipboard: pasteFromClipboard2 = pasteFromClipboard,
|
|
8997
9935
|
renderBackdropBlur
|
|
8998
9936
|
}) {
|
|
8999
|
-
const [state, setState] =
|
|
9937
|
+
const [state, setState] = useState25(CLOSED);
|
|
9000
9938
|
const { hideCryptoDeposit } = useFunkitIdentity();
|
|
9939
|
+
const isV2DepositEnabled = useFeatureGate3(RN_V2_DEPOSIT_GATE);
|
|
9001
9940
|
const readClipboard = useMemo12(
|
|
9002
9941
|
() => guardClipboardReader(pasteFromClipboard2),
|
|
9003
9942
|
[pasteFromClipboard2]
|
|
9004
9943
|
);
|
|
9005
9944
|
const beginDeposit = useCallback15(
|
|
9006
9945
|
(config, hostCallbacks = {}) => {
|
|
9007
|
-
|
|
9946
|
+
const useAmountEntry = !!config.amountEntry && isV2DepositEnabled;
|
|
9947
|
+
logger.info("beginDeposit", {
|
|
9948
|
+
...config,
|
|
9949
|
+
hideCryptoDeposit,
|
|
9950
|
+
isV2DepositEnabled,
|
|
9951
|
+
useAmountEntry
|
|
9952
|
+
});
|
|
9008
9953
|
const callbacks = guardHostCallbacks(hostCallbacks);
|
|
9009
9954
|
callbacks.onOpen?.();
|
|
9010
9955
|
setState((prev) => ({
|
|
9011
9956
|
isOpen: true,
|
|
9012
|
-
stack: ["addMoney"],
|
|
9957
|
+
stack: [useAmountEntry ? "depositAmount" : "addMoney"],
|
|
9013
9958
|
flow: { mode: "deposit", config, callbacks },
|
|
9014
9959
|
session: prev.session + 1
|
|
9015
9960
|
}));
|
|
9016
9961
|
},
|
|
9017
|
-
[hideCryptoDeposit]
|
|
9962
|
+
[hideCryptoDeposit, isV2DepositEnabled]
|
|
9018
9963
|
);
|
|
9019
9964
|
const beginWithdrawal = useCallback15(
|
|
9020
9965
|
(config, hostCallbacks = {}) => {
|
|
@@ -9079,8 +10024,8 @@ function FunkitFlowProvider({
|
|
|
9079
10024
|
() => ({ navigate, back, reset, popTo, closeFlow }),
|
|
9080
10025
|
[navigate, back, reset, popTo, closeFlow]
|
|
9081
10026
|
);
|
|
9082
|
-
return /* @__PURE__ */
|
|
9083
|
-
/* @__PURE__ */
|
|
10027
|
+
return /* @__PURE__ */ jsx62(FunkitFlowContext.Provider, { value, children: /* @__PURE__ */ jsxs32(View9, { style: rootContainer, children: [
|
|
10028
|
+
/* @__PURE__ */ jsx62(
|
|
9084
10029
|
FlowSheet,
|
|
9085
10030
|
{
|
|
9086
10031
|
isOpen: state.isOpen,
|
|
@@ -9088,11 +10033,11 @@ function FunkitFlowProvider({
|
|
|
9088
10033
|
onClose: closeFlow,
|
|
9089
10034
|
keyboardAvoidEnabled: current === "swapped",
|
|
9090
10035
|
enableSwipeToDismiss: isHomeScreen || current === "transfer" || current === "withdrawComplete",
|
|
9091
|
-
fullHeight: isCryptoWithdrawalStep,
|
|
10036
|
+
fullHeight: isCryptoWithdrawalStep || current === "depositAmount",
|
|
9092
10037
|
renderBackdropBlur,
|
|
9093
10038
|
content: (
|
|
9094
10039
|
// Mounted only while open so the flow queries run only then.
|
|
9095
|
-
state.isOpen && state.flow ? state.flow.mode === "deposit" ? /* @__PURE__ */
|
|
10040
|
+
state.isOpen && state.flow ? state.flow.mode === "deposit" ? /* @__PURE__ */ jsx62(
|
|
9096
10041
|
FlowContent,
|
|
9097
10042
|
{
|
|
9098
10043
|
config: state.flow.config,
|
|
@@ -9102,7 +10047,7 @@ function FunkitFlowProvider({
|
|
|
9102
10047
|
onCopySuccess: showCopiedToast,
|
|
9103
10048
|
callbacks: state.flow.callbacks
|
|
9104
10049
|
}
|
|
9105
|
-
) : /* @__PURE__ */
|
|
10050
|
+
) : /* @__PURE__ */ jsx62(
|
|
9106
10051
|
WithdrawalFlowContent,
|
|
9107
10052
|
{
|
|
9108
10053
|
config: state.flow.config,
|
|
@@ -9129,7 +10074,7 @@ function useFunkitFlow() {
|
|
|
9129
10074
|
}
|
|
9130
10075
|
|
|
9131
10076
|
// src/version.ts
|
|
9132
|
-
var CONNECT_RN_VERSION = true ? "3.
|
|
10077
|
+
var CONNECT_RN_VERSION = true ? "3.10.0" : "0.0.0-dev";
|
|
9133
10078
|
|
|
9134
10079
|
// src/providers/FunkitStatsigProvider.tsx
|
|
9135
10080
|
import {
|
|
@@ -9137,7 +10082,7 @@ import {
|
|
|
9137
10082
|
LogLevel,
|
|
9138
10083
|
StatsigProvider
|
|
9139
10084
|
} from "@statsig/react-bindings";
|
|
9140
|
-
import { useEffect as
|
|
10085
|
+
import { useEffect as useEffect24, useMemo as useMemo13 } from "react";
|
|
9141
10086
|
|
|
9142
10087
|
// src/statsig/useClientAsyncInitRN.ts
|
|
9143
10088
|
import {
|
|
@@ -9274,13 +10219,13 @@ function applyNetworkFix(options) {
|
|
|
9274
10219
|
}
|
|
9275
10220
|
|
|
9276
10221
|
// src/statsig/statsigMetadata.ts
|
|
9277
|
-
import { NativeModules, Platform as
|
|
10222
|
+
import { NativeModules, Platform as Platform3 } from "react-native";
|
|
9278
10223
|
function resolveLocale() {
|
|
9279
|
-
if (
|
|
10224
|
+
if (Platform3.OS === "android") {
|
|
9280
10225
|
const i18nManager = NativeModules.I18nManager;
|
|
9281
10226
|
return i18nManager?.localeIdentifier ?? void 0;
|
|
9282
10227
|
}
|
|
9283
|
-
if (
|
|
10228
|
+
if (Platform3.OS === "ios") {
|
|
9284
10229
|
const settings = NativeModules.SettingsManager?.settings;
|
|
9285
10230
|
return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? void 0;
|
|
9286
10231
|
}
|
|
@@ -9294,7 +10239,7 @@ function getStatsigMetadataAdditions() {
|
|
|
9294
10239
|
deviceModelName: void 0,
|
|
9295
10240
|
deviceModel: void 0,
|
|
9296
10241
|
// Available without any native module:
|
|
9297
|
-
systemName:
|
|
10242
|
+
systemName: Platform3.OS,
|
|
9298
10243
|
locale: resolveLocale()
|
|
9299
10244
|
};
|
|
9300
10245
|
}
|
|
@@ -9322,7 +10267,7 @@ function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
|
|
|
9322
10267
|
}
|
|
9323
10268
|
|
|
9324
10269
|
// src/providers/FunkitStatsigProvider.tsx
|
|
9325
|
-
import { jsx as
|
|
10270
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
9326
10271
|
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
9327
10272
|
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
9328
10273
|
var STATSIG_SDK_TYPE = "react-native";
|
|
@@ -9358,7 +10303,7 @@ function FunkitStatsigProvider({
|
|
|
9358
10303
|
tier: isDevelopment ? "development" : "production"
|
|
9359
10304
|
}
|
|
9360
10305
|
});
|
|
9361
|
-
|
|
10306
|
+
useEffect24(() => {
|
|
9362
10307
|
if (isLoading) {
|
|
9363
10308
|
return;
|
|
9364
10309
|
}
|
|
@@ -9370,11 +10315,11 @@ function FunkitStatsigProvider({
|
|
|
9370
10315
|
client.updateUserAsync(user).catch((error) => logger.error("statsig:updateUser:error", error));
|
|
9371
10316
|
}
|
|
9372
10317
|
}, [client, isLoading, user, apiKey, userId]);
|
|
9373
|
-
return /* @__PURE__ */
|
|
10318
|
+
return /* @__PURE__ */ jsx63(StatsigProvider, { client, children });
|
|
9374
10319
|
}
|
|
9375
10320
|
|
|
9376
10321
|
// src/providers/FunkitProvider.tsx
|
|
9377
|
-
import { jsx as
|
|
10322
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
9378
10323
|
var ANONYMOUS_CONFIG = { apiKey: "" };
|
|
9379
10324
|
var IS_DEV_BUILD = typeof __DEV__ !== "undefined" && !!__DEV__;
|
|
9380
10325
|
function createFallbackQueryClient() {
|
|
@@ -9400,20 +10345,20 @@ function FunkitProvider({
|
|
|
9400
10345
|
renderBackdropBlur,
|
|
9401
10346
|
hapticFeedback
|
|
9402
10347
|
}) {
|
|
9403
|
-
const fallbackClient =
|
|
10348
|
+
const fallbackClient = useRef19(void 0);
|
|
9404
10349
|
fallbackClient.current ??= createFallbackQueryClient();
|
|
9405
10350
|
const client = queryClient ?? fallbackClient.current;
|
|
9406
10351
|
const identity = useMemo14(
|
|
9407
10352
|
() => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
|
|
9408
10353
|
[config, walletAddress]
|
|
9409
10354
|
);
|
|
9410
|
-
|
|
10355
|
+
useEffect25(() => {
|
|
9411
10356
|
if (!config?.apiKey) {
|
|
9412
10357
|
return;
|
|
9413
10358
|
}
|
|
9414
10359
|
logger.configure(config.apiKey, debug, CONNECT_RN_VERSION);
|
|
9415
10360
|
}, [config?.apiKey, debug]);
|
|
9416
|
-
|
|
10361
|
+
useEffect25(() => {
|
|
9417
10362
|
logger.setUserInfo(
|
|
9418
10363
|
identity.userId,
|
|
9419
10364
|
identity.walletAddress,
|
|
@@ -9422,13 +10367,13 @@ function FunkitProvider({
|
|
|
9422
10367
|
""
|
|
9423
10368
|
);
|
|
9424
10369
|
}, [identity]);
|
|
9425
|
-
return /* @__PURE__ */
|
|
10370
|
+
return /* @__PURE__ */ jsx64(SafeAreaProvider, { children: /* @__PURE__ */ jsx64(
|
|
9426
10371
|
FunkitStatsigProvider,
|
|
9427
10372
|
{
|
|
9428
10373
|
apiKey: identity.apiKey,
|
|
9429
10374
|
userId: identity.userId,
|
|
9430
10375
|
isDevelopment: debug,
|
|
9431
|
-
children: /* @__PURE__ */
|
|
10376
|
+
children: /* @__PURE__ */ jsx64(QueryClientProvider, { client, children: /* @__PURE__ */ jsx64(FunkitIdentityProvider, { identity, children: /* @__PURE__ */ jsx64(FunkitThemeProvider, { themes, colorScheme, children: /* @__PURE__ */ jsx64(FunkitI18nProvider, { locale, children: /* @__PURE__ */ jsx64(FunkitHapticsProvider, { hapticFeedback, children: /* @__PURE__ */ jsx64(
|
|
9432
10377
|
FunkitFlowProvider,
|
|
9433
10378
|
{
|
|
9434
10379
|
copyToClipboard: copyToClipboard2,
|