@funkit/connect-rn 3.10.0 → 3.10.1
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 +13 -0
- package/dist/clients/nado/withdrawalSubmit.d.ts.map +1 -1
- package/dist/clients/nado.js +6 -4
- package/dist/clients/nado.js.map +2 -2
- package/dist/index.js +235 -134
- package/dist/index.js.map +3 -3
- package/dist/src/components/v2/AmountDisplay.d.ts.map +1 -1
- package/dist/src/components/v2/NumPad.d.ts +1 -1
- package/dist/src/components/v2/NumPad.d.ts.map +1 -1
- package/dist/src/components/v2/QuickAmountsRow.d.ts +1 -1
- package/dist/src/components/v2/QuickAmountsRow.d.ts.map +1 -1
- package/dist/src/flow/DepositAmountStep.d.ts.map +1 -1
- package/dist/src/hooks/useGuardedAmountInput.d.ts +9 -5
- package/dist/src/hooks/useGuardedAmountInput.d.ts.map +1 -1
- package/dist/src/screens/DepositAmountScreen.d.ts.map +1 -1
- package/dist/src/utils/motion.d.ts +5 -0
- package/dist/src/utils/motion.d.ts.map +1 -1
- package/dist/src/utils/v2/amountGlyphs.d.ts +5 -4
- package/dist/src/utils/v2/amountGlyphs.d.ts.map +1 -1
- package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts.map +1 -1
- package/dist/src/withdrawal/useCryptoWithdrawalValidation.d.ts.map +1 -1
- package/dist/src/withdrawal/validation.d.ts +5 -1
- package/dist/src/withdrawal/validation.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -460,16 +460,16 @@ function useFunkitColorScheme() {
|
|
|
460
460
|
|
|
461
461
|
// src/providers/FunkitProvider.tsx
|
|
462
462
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
463
|
-
import { useEffect as useEffect25, useMemo as
|
|
463
|
+
import { useEffect as useEffect25, useMemo as useMemo16, useRef as useRef19 } from "react";
|
|
464
464
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
465
465
|
|
|
466
466
|
// src/flow/FunkitFlowProvider.tsx
|
|
467
467
|
import { useFeatureGate as useFeatureGate3 } from "@funkit/connect-core";
|
|
468
468
|
import {
|
|
469
469
|
createContext as createContext3,
|
|
470
|
-
useCallback as
|
|
470
|
+
useCallback as useCallback16,
|
|
471
471
|
useContext as useContext3,
|
|
472
|
-
useMemo as
|
|
472
|
+
useMemo as useMemo14,
|
|
473
473
|
useState as useState25
|
|
474
474
|
} from "react";
|
|
475
475
|
import { View as View9 } from "react-native";
|
|
@@ -525,7 +525,7 @@ async function pasteFromClipboard() {
|
|
|
525
525
|
// src/flow/DepositFlowContent.tsx
|
|
526
526
|
import { BottomSheetModal as BottomSheetModal2, BottomSheetView as BottomSheetView2 } from "@gorhom/bottom-sheet";
|
|
527
527
|
import { useStatsigClient } from "@statsig/react-bindings";
|
|
528
|
-
import { useCallback as
|
|
528
|
+
import { useCallback as useCallback9, useEffect as useEffect19, useState as useState13 } from "react";
|
|
529
529
|
import { Share } from "react-native";
|
|
530
530
|
import { useSafeAreaInsets as useSafeAreaInsets6 } from "react-native-safe-area-context";
|
|
531
531
|
|
|
@@ -4084,9 +4084,10 @@ function QrCode({ value, size = 220, ecl = "H" }) {
|
|
|
4084
4084
|
}
|
|
4085
4085
|
|
|
4086
4086
|
// src/flow/DepositAmountStep.tsx
|
|
4087
|
-
import { useEffect as useEffect15, useState as useState11 } from "react";
|
|
4087
|
+
import { useEffect as useEffect15, useMemo as useMemo9, useState as useState11 } from "react";
|
|
4088
4088
|
|
|
4089
4089
|
// src/screens/DepositAmountScreen.tsx
|
|
4090
|
+
import { useMemo as useMemo8 } from "react";
|
|
4090
4091
|
import { StyleSheet as StyleSheet15, useWindowDimensions as useWindowDimensions4 } from "react-native";
|
|
4091
4092
|
import Animated7, { Keyframe as Keyframe4 } from "react-native-reanimated";
|
|
4092
4093
|
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
@@ -4166,6 +4167,7 @@ var styles9 = StyleSheet9.create({
|
|
|
4166
4167
|
});
|
|
4167
4168
|
|
|
4168
4169
|
// src/components/v2/QuickAmountsRow.tsx
|
|
4170
|
+
import { memo } from "react";
|
|
4169
4171
|
import { Pressable as Pressable8, StyleSheet as StyleSheet10 } from "react-native";
|
|
4170
4172
|
|
|
4171
4173
|
// src/haptics/HapticsContext.tsx
|
|
@@ -4228,7 +4230,10 @@ function useHapticFeedback() {
|
|
|
4228
4230
|
|
|
4229
4231
|
// src/components/v2/QuickAmountsRow.tsx
|
|
4230
4232
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
4231
|
-
|
|
4233
|
+
var QuickAmountsRow = memo(function QuickAmountsRow2({
|
|
4234
|
+
options,
|
|
4235
|
+
onSelect
|
|
4236
|
+
}) {
|
|
4232
4237
|
const theme = useTheme();
|
|
4233
4238
|
const haptic = useHapticFeedback();
|
|
4234
4239
|
return /* @__PURE__ */ jsx28(Box, { flexDirection: "row", style: styles10.row, children: options.map(({ value, label }) => /* @__PURE__ */ jsx28(
|
|
@@ -4255,7 +4260,7 @@ function QuickAmountsRow({ options, onSelect }) {
|
|
|
4255
4260
|
},
|
|
4256
4261
|
value
|
|
4257
4262
|
)) });
|
|
4258
|
-
}
|
|
4263
|
+
});
|
|
4259
4264
|
var styles10 = StyleSheet10.create({
|
|
4260
4265
|
row: { gap: 12 },
|
|
4261
4266
|
share: { flex: 1 },
|
|
@@ -4268,7 +4273,7 @@ var styles10 = StyleSheet10.create({
|
|
|
4268
4273
|
});
|
|
4269
4274
|
|
|
4270
4275
|
// src/components/v2/AmountDisplay.tsx
|
|
4271
|
-
import { useEffect as useEffect12, useRef as useRef9 } from "react";
|
|
4276
|
+
import { memo as memo2, useEffect as useEffect12, useRef as useRef9 } from "react";
|
|
4272
4277
|
import {
|
|
4273
4278
|
StyleSheet as StyleSheet11,
|
|
4274
4279
|
useWindowDimensions as useWindowDimensions3
|
|
@@ -4293,22 +4298,30 @@ function amountGlyphs(value, prefix) {
|
|
|
4293
4298
|
return glyphs;
|
|
4294
4299
|
}
|
|
4295
4300
|
const chars = [...value];
|
|
4296
|
-
const
|
|
4301
|
+
const integerDigits = integerDigitsRightOf(chars, -1);
|
|
4297
4302
|
let digitIndex = 0;
|
|
4298
4303
|
for (const [index, char] of chars.entries()) {
|
|
4299
4304
|
if (char === GROUP_SEPARATOR) {
|
|
4300
4305
|
glyphs.push({
|
|
4301
|
-
key: `separator-${integerDigitsRightOf(chars, index)}-${
|
|
4306
|
+
key: `separator-${integerDigitsRightOf(chars, index)}-${integerDigits}`,
|
|
4302
4307
|
char,
|
|
4303
4308
|
kind: "separator"
|
|
4304
4309
|
});
|
|
4305
4310
|
continue;
|
|
4306
4311
|
}
|
|
4312
|
+
if (digitIndex === 0 && isLeadingZero(chars)) {
|
|
4313
|
+
glyphs.push({ key: "placeholder", char, kind: "placeholder" });
|
|
4314
|
+
digitIndex += 1;
|
|
4315
|
+
continue;
|
|
4316
|
+
}
|
|
4307
4317
|
glyphs.push({ key: `digit-${digitIndex}`, char, kind: "digit" });
|
|
4308
4318
|
digitIndex += 1;
|
|
4309
4319
|
}
|
|
4310
4320
|
return glyphs;
|
|
4311
4321
|
}
|
|
4322
|
+
function isLeadingZero(chars) {
|
|
4323
|
+
return chars[0] === "0" && (chars.length === 1 || chars[1] === ".");
|
|
4324
|
+
}
|
|
4312
4325
|
function integerDigitsRightOf(chars, index) {
|
|
4313
4326
|
let count = 0;
|
|
4314
4327
|
for (let i = index + 1; i < chars.length; i += 1) {
|
|
@@ -4326,6 +4339,10 @@ function integerDigitsRightOf(chars, index) {
|
|
|
4326
4339
|
import { Easing as Easing2, Keyframe as Keyframe2, LinearTransition } from "react-native-reanimated";
|
|
4327
4340
|
var MOTION_DURATION = 180;
|
|
4328
4341
|
var MOTION_EASING = Easing2.bezier(0.33, 1, 0.68, 1);
|
|
4342
|
+
var MOTION_TIMING = {
|
|
4343
|
+
duration: MOTION_DURATION,
|
|
4344
|
+
easing: MOTION_EASING
|
|
4345
|
+
};
|
|
4329
4346
|
var GLYPH_LAYOUT = LinearTransition.duration(MOTION_DURATION).easing(MOTION_EASING);
|
|
4330
4347
|
var DIGIT_ENTER_SCALE = 0.5;
|
|
4331
4348
|
var DIGIT_TRAVEL_RATIO = 0.4;
|
|
@@ -4397,6 +4414,15 @@ var MOTIONS = {
|
|
|
4397
4414
|
},
|
|
4398
4415
|
above: slideKeyframes(-LINE_HEIGHT)
|
|
4399
4416
|
};
|
|
4417
|
+
var DIGIT_MOTIONS = /* @__PURE__ */ new Map();
|
|
4418
|
+
function digitMotion(delay) {
|
|
4419
|
+
let motion = DIGIT_MOTIONS.get(delay);
|
|
4420
|
+
if (!motion) {
|
|
4421
|
+
motion = digitKeyframes(DIGIT_TRAVEL, delay);
|
|
4422
|
+
DIGIT_MOTIONS.set(delay, motion);
|
|
4423
|
+
}
|
|
4424
|
+
return motion;
|
|
4425
|
+
}
|
|
4400
4426
|
function fitScale(measured, available) {
|
|
4401
4427
|
if (measured <= 0) {
|
|
4402
4428
|
return 1;
|
|
@@ -4422,7 +4448,8 @@ function AmountDisplay({
|
|
|
4422
4448
|
const text = glyphs.map((glyph) => glyph.char).join("");
|
|
4423
4449
|
const staggerOf = useMountStagger(glyphs);
|
|
4424
4450
|
const { onRowLayout, rowScaling } = useFittedRowScale(width);
|
|
4425
|
-
const prefixDimming =
|
|
4451
|
+
const prefixDimming = useDimming(isEmpty ? placeholderOpacity : 1);
|
|
4452
|
+
const placeholderDimming = useDimming(placeholderOpacity);
|
|
4426
4453
|
const color = amountColor(theme, { hasError, hasWarning });
|
|
4427
4454
|
return (
|
|
4428
4455
|
// The window the characters slide through. What it clips is the dead space
|
|
@@ -4435,28 +4462,14 @@ function AmountDisplay({
|
|
|
4435
4462
|
accessibilityValue: { text },
|
|
4436
4463
|
style: [styles11.row, { marginVertical: -(LINE_HEIGHT - CAP_BOX) / 2 }],
|
|
4437
4464
|
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
|
-
|
|
4465
|
+
Glyph,
|
|
4439
4466
|
{
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
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
|
-
)
|
|
4467
|
+
char,
|
|
4468
|
+
motion: glyphMotion(kind, isEmpty),
|
|
4469
|
+
delay: staggerOf(key),
|
|
4470
|
+
color,
|
|
4471
|
+
hasWarning,
|
|
4472
|
+
dimming: dimmingFor(kind, prefixDimming, placeholderDimming)
|
|
4460
4473
|
},
|
|
4461
4474
|
key
|
|
4462
4475
|
)) }) })
|
|
@@ -4464,6 +4477,38 @@ function AmountDisplay({
|
|
|
4464
4477
|
)
|
|
4465
4478
|
);
|
|
4466
4479
|
}
|
|
4480
|
+
var Glyph = memo2(function Glyph2({
|
|
4481
|
+
char,
|
|
4482
|
+
motion,
|
|
4483
|
+
delay,
|
|
4484
|
+
color,
|
|
4485
|
+
hasWarning,
|
|
4486
|
+
dimming
|
|
4487
|
+
}) {
|
|
4488
|
+
const entering = motion === "digit" ? digitMotion(delay).entering : MOTIONS[motion].entering;
|
|
4489
|
+
return /* @__PURE__ */ jsx29(
|
|
4490
|
+
AnimatedBox,
|
|
4491
|
+
{
|
|
4492
|
+
entering,
|
|
4493
|
+
exiting: MOTIONS[motion].exiting,
|
|
4494
|
+
layout: GLYPH_LAYOUT,
|
|
4495
|
+
children: /* @__PURE__ */ jsx29(
|
|
4496
|
+
AnimatedText,
|
|
4497
|
+
{
|
|
4498
|
+
weight: "medium",
|
|
4499
|
+
numberOfLines: 1,
|
|
4500
|
+
style: [
|
|
4501
|
+
styles11.glyph,
|
|
4502
|
+
{ color },
|
|
4503
|
+
hasWarning ? WARNING_GLOW : null,
|
|
4504
|
+
dimming ?? null
|
|
4505
|
+
],
|
|
4506
|
+
children: char
|
|
4507
|
+
}
|
|
4508
|
+
)
|
|
4509
|
+
}
|
|
4510
|
+
);
|
|
4511
|
+
});
|
|
4467
4512
|
function useMountStagger(glyphs) {
|
|
4468
4513
|
const previousKeys = useRef9(/* @__PURE__ */ new Set());
|
|
4469
4514
|
const mountingKeys = glyphs.filter(({ key }) => !previousKeys.current.has(key)).map(({ key }) => key);
|
|
@@ -4488,15 +4533,14 @@ function useFittedRowScale(windowWidth) {
|
|
|
4488
4533
|
});
|
|
4489
4534
|
return { onRowLayout, rowScaling };
|
|
4490
4535
|
}
|
|
4491
|
-
function
|
|
4536
|
+
function useDimming(targetOpacity) {
|
|
4537
|
+
const opacity = useSharedValue2(targetOpacity);
|
|
4538
|
+
useEffect12(() => {
|
|
4539
|
+
opacity.value = withTiming2(targetOpacity, MOTION_TIMING);
|
|
4540
|
+
}, [opacity, targetOpacity]);
|
|
4492
4541
|
return useAnimatedStyle2(() => {
|
|
4493
4542
|
"worklet";
|
|
4494
|
-
return {
|
|
4495
|
-
opacity: withTiming2(targetOpacity, {
|
|
4496
|
-
duration: MOTION_DURATION,
|
|
4497
|
-
easing: MOTION_EASING
|
|
4498
|
-
})
|
|
4499
|
-
};
|
|
4543
|
+
return { opacity: opacity.value };
|
|
4500
4544
|
});
|
|
4501
4545
|
}
|
|
4502
4546
|
function amountColor(theme, { hasError, hasWarning }) {
|
|
@@ -4508,6 +4552,15 @@ function amountColor(theme, { hasError, hasWarning }) {
|
|
|
4508
4552
|
}
|
|
4509
4553
|
return theme.content.elements.primary;
|
|
4510
4554
|
}
|
|
4555
|
+
function dimmingFor(kind, prefix, placeholder) {
|
|
4556
|
+
if (kind === "prefix") {
|
|
4557
|
+
return prefix;
|
|
4558
|
+
}
|
|
4559
|
+
if (kind === "placeholder") {
|
|
4560
|
+
return placeholder;
|
|
4561
|
+
}
|
|
4562
|
+
return void 0;
|
|
4563
|
+
}
|
|
4511
4564
|
function glyphMotion(kind, isEmpty) {
|
|
4512
4565
|
if (kind === "placeholder") {
|
|
4513
4566
|
return "above";
|
|
@@ -4543,11 +4596,15 @@ var styles11 = StyleSheet11.create({
|
|
|
4543
4596
|
glyph: {
|
|
4544
4597
|
fontSize: AMOUNT_FONT_SIZE,
|
|
4545
4598
|
lineHeight: LINE_HEIGHT,
|
|
4546
|
-
letterSpacing: LETTER_SPACING
|
|
4599
|
+
letterSpacing: LETTER_SPACING,
|
|
4600
|
+
// Every digit the same advance, so `$0` → `$1` swaps in place instead of
|
|
4601
|
+
// re-centring the prefix around a narrower glyph.
|
|
4602
|
+
fontVariant: ["tabular-nums"]
|
|
4547
4603
|
}
|
|
4548
4604
|
});
|
|
4549
4605
|
|
|
4550
4606
|
// src/components/v2/NumPad.tsx
|
|
4607
|
+
import { memo as memo3 } from "react";
|
|
4551
4608
|
import { Pressable as Pressable9, StyleSheet as StyleSheet12 } from "react-native";
|
|
4552
4609
|
import Animated5, {
|
|
4553
4610
|
useAnimatedStyle as useAnimatedStyle3,
|
|
@@ -4581,7 +4638,7 @@ function keyHitSlop(row2, column, lastRow) {
|
|
|
4581
4638
|
};
|
|
4582
4639
|
}
|
|
4583
4640
|
var AnimatedBox2 = Animated5.createAnimatedComponent(Box);
|
|
4584
|
-
|
|
4641
|
+
var NumPad = memo3(function NumPad2({
|
|
4585
4642
|
onPressKey,
|
|
4586
4643
|
backspaceAccessibilityLabel
|
|
4587
4644
|
}) {
|
|
@@ -4602,8 +4659,8 @@ function NumPad({
|
|
|
4602
4659
|
},
|
|
4603
4660
|
key
|
|
4604
4661
|
)) }, row2.join(""))) });
|
|
4605
|
-
}
|
|
4606
|
-
|
|
4662
|
+
});
|
|
4663
|
+
var NumPadKey = memo3(function NumPadKey2({
|
|
4607
4664
|
numpadKey,
|
|
4608
4665
|
hitSlop,
|
|
4609
4666
|
alignment,
|
|
@@ -4647,7 +4704,7 @@ function NumPadKey({
|
|
|
4647
4704
|
) })
|
|
4648
4705
|
}
|
|
4649
4706
|
);
|
|
4650
|
-
}
|
|
4707
|
+
});
|
|
4651
4708
|
var styles12 = StyleSheet12.create({
|
|
4652
4709
|
key: { flex: 1, justifyContent: "center" },
|
|
4653
4710
|
label: {
|
|
@@ -4736,7 +4793,7 @@ var styles13 = StyleSheet13.create({
|
|
|
4736
4793
|
});
|
|
4737
4794
|
|
|
4738
4795
|
// src/components/v2/RollingAmount.tsx
|
|
4739
|
-
import { useEffect as useEffect13, useRef as useRef10 } from "react";
|
|
4796
|
+
import { memo as memo4, useEffect as useEffect13, useRef as useRef10 } from "react";
|
|
4740
4797
|
import { StyleSheet as StyleSheet14 } from "react-native";
|
|
4741
4798
|
import Animated6, {
|
|
4742
4799
|
Easing as Easing4,
|
|
@@ -4782,7 +4839,7 @@ function RollingAmount({ value, style }) {
|
|
|
4782
4839
|
);
|
|
4783
4840
|
}) });
|
|
4784
4841
|
}
|
|
4785
|
-
|
|
4842
|
+
var RollingGlyph = memo4(function RollingGlyph2({
|
|
4786
4843
|
char,
|
|
4787
4844
|
delay,
|
|
4788
4845
|
style
|
|
@@ -4818,7 +4875,7 @@ function RollingGlyph({
|
|
|
4818
4875
|
children: char
|
|
4819
4876
|
}
|
|
4820
4877
|
) });
|
|
4821
|
-
}
|
|
4878
|
+
});
|
|
4822
4879
|
var NO_OFFSET = { width: 0, height: 0 };
|
|
4823
4880
|
var styles14 = StyleSheet14.create({
|
|
4824
4881
|
row: { flexDirection: "row" }
|
|
@@ -4826,7 +4883,7 @@ var styles14 = StyleSheet14.create({
|
|
|
4826
4883
|
|
|
4827
4884
|
// src/hooks/useGuardedAmountInput.ts
|
|
4828
4885
|
import { USD_DECIMALS } from "@funkit/connect-core";
|
|
4829
|
-
import { useEffect as useEffect14, useRef as useRef11, useState as useState10 } from "react";
|
|
4886
|
+
import { useCallback as useCallback7, useEffect as useEffect14, useRef as useRef11, useState as useState10 } from "react";
|
|
4830
4887
|
import {
|
|
4831
4888
|
useAnimatedStyle as useAnimatedStyle5,
|
|
4832
4889
|
useSharedValue as useSharedValue5,
|
|
@@ -4859,7 +4916,14 @@ function applyNumpadKey(value, key, maxDecimals) {
|
|
|
4859
4916
|
// src/hooks/useGuardedAmountInput.ts
|
|
4860
4917
|
var SHAKE_TRAVEL = 8;
|
|
4861
4918
|
var SHAKE_STEP_DURATION = 50;
|
|
4919
|
+
var SHAKE_STEP = { duration: SHAKE_STEP_DURATION };
|
|
4862
4920
|
var WARNING_DURATION = SHAKE_STEP_DURATION * 4 * 2;
|
|
4921
|
+
var PULSE_SCALE = 1.08;
|
|
4922
|
+
var PULSE_UP = { duration: 50, easing: MOTION_EASING };
|
|
4923
|
+
var PULSE_DOWN = { duration: 130, easing: MOTION_EASING };
|
|
4924
|
+
function isZero(value) {
|
|
4925
|
+
return value === "" || value === "0";
|
|
4926
|
+
}
|
|
4863
4927
|
function useGuardedAmountInput({
|
|
4864
4928
|
input,
|
|
4865
4929
|
onChangeInput,
|
|
@@ -4870,17 +4934,28 @@ function useGuardedAmountInput({
|
|
|
4870
4934
|
const warningTimer = useRef11(void 0);
|
|
4871
4935
|
useEffect14(() => () => clearTimeout(warningTimer.current), []);
|
|
4872
4936
|
const shake = useSharedValue5(0);
|
|
4873
|
-
const
|
|
4937
|
+
const pulse = useSharedValue5(1);
|
|
4938
|
+
const feedbackStyle = useAnimatedStyle5(() => {
|
|
4874
4939
|
"worklet";
|
|
4875
|
-
return {
|
|
4940
|
+
return {
|
|
4941
|
+
transform: [{ translateX: shake.value }, { scale: pulse.value }]
|
|
4942
|
+
};
|
|
4876
4943
|
});
|
|
4877
|
-
const
|
|
4944
|
+
const pulseZero = useCallback7(() => {
|
|
4945
|
+
pulse.value = withSequence(
|
|
4946
|
+
withTiming5(PULSE_SCALE, PULSE_UP),
|
|
4947
|
+
withTiming5(1, PULSE_DOWN)
|
|
4948
|
+
);
|
|
4949
|
+
}, [pulse]);
|
|
4950
|
+
const latest = useRef11({ input, onChangeInput, limitUsd });
|
|
4951
|
+
latest.current = { input, onChangeInput, limitUsd };
|
|
4952
|
+
const rejectInput = useCallback7(() => {
|
|
4878
4953
|
haptic("error");
|
|
4879
4954
|
shake.value = withSequence(
|
|
4880
|
-
withTiming5(-SHAKE_TRAVEL,
|
|
4881
|
-
withTiming5(SHAKE_TRAVEL,
|
|
4882
|
-
withTiming5(-SHAKE_TRAVEL / 2,
|
|
4883
|
-
withTiming5(0,
|
|
4955
|
+
withTiming5(-SHAKE_TRAVEL, SHAKE_STEP),
|
|
4956
|
+
withTiming5(SHAKE_TRAVEL, SHAKE_STEP),
|
|
4957
|
+
withTiming5(-SHAKE_TRAVEL / 2, SHAKE_STEP),
|
|
4958
|
+
withTiming5(0, SHAKE_STEP)
|
|
4884
4959
|
);
|
|
4885
4960
|
setHasWarning(true);
|
|
4886
4961
|
clearTimeout(warningTimer.current);
|
|
@@ -4888,22 +4963,37 @@ function useGuardedAmountInput({
|
|
|
4888
4963
|
() => setHasWarning(false),
|
|
4889
4964
|
WARNING_DURATION
|
|
4890
4965
|
);
|
|
4891
|
-
};
|
|
4892
|
-
const commitInput = (
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4966
|
+
}, [haptic, shake]);
|
|
4967
|
+
const commitInput = useCallback7(
|
|
4968
|
+
(next) => {
|
|
4969
|
+
const { limitUsd: limit, onChangeInput: onChange } = latest.current;
|
|
4970
|
+
if (limit !== void 0 && Number(next) > Number(limit)) {
|
|
4971
|
+
rejectInput();
|
|
4972
|
+
return;
|
|
4973
|
+
}
|
|
4974
|
+
onChange(next);
|
|
4975
|
+
},
|
|
4976
|
+
[rejectInput]
|
|
4977
|
+
);
|
|
4978
|
+
const handleNumpadKey = useCallback7(
|
|
4979
|
+
(key) => {
|
|
4980
|
+
const current = latest.current.input;
|
|
4981
|
+
if (key === "backspace" && isZero(current)) {
|
|
4982
|
+
rejectInput();
|
|
4983
|
+
return;
|
|
4984
|
+
}
|
|
4985
|
+
if (key === "0" && isZero(current)) {
|
|
4986
|
+
pulseZero();
|
|
4987
|
+
if (current === "") {
|
|
4988
|
+
latest.current.onChangeInput("0");
|
|
4989
|
+
}
|
|
4990
|
+
return;
|
|
4991
|
+
}
|
|
4992
|
+
commitInput(applyNumpadKey(current, key, USD_DECIMALS));
|
|
4993
|
+
},
|
|
4994
|
+
[commitInput, rejectInput, pulseZero]
|
|
4995
|
+
);
|
|
4996
|
+
return { hasWarning, feedbackStyle, commitInput, handleNumpadKey };
|
|
4907
4997
|
}
|
|
4908
4998
|
|
|
4909
4999
|
// src/utils/formatAmount.ts
|
|
@@ -4960,10 +5050,11 @@ function DepositAmountScreen({
|
|
|
4960
5050
|
const theme = useTheme();
|
|
4961
5051
|
const { height } = useWindowDimensions4();
|
|
4962
5052
|
const insets = useSafeAreaInsets4();
|
|
4963
|
-
const { hasWarning,
|
|
5053
|
+
const { hasWarning, feedbackStyle, commitInput, handleNumpadKey } = useGuardedAmountInput({ input, onChangeInput, limitUsd });
|
|
4964
5054
|
const isZeroInput = input === "" || Number(input) === 0;
|
|
4965
5055
|
const showChips = isZeroInput && !!quickAmounts?.length;
|
|
4966
|
-
const
|
|
5056
|
+
const secondary = theme.content.elements.secondary;
|
|
5057
|
+
const feeTextColor = useMemo8(() => ({ color: secondary }), [secondary]);
|
|
4967
5058
|
return /* @__PURE__ */ jsxs13(
|
|
4968
5059
|
Box,
|
|
4969
5060
|
{
|
|
@@ -4990,7 +5081,7 @@ function DepositAmountScreen({
|
|
|
4990
5081
|
]
|
|
4991
5082
|
}
|
|
4992
5083
|
),
|
|
4993
|
-
/* @__PURE__ */ jsx33(AnimatedBox4, { style: [styles15.amount,
|
|
5084
|
+
/* @__PURE__ */ jsx33(AnimatedBox4, { style: [styles15.amount, feedbackStyle], children: /* @__PURE__ */ jsx33(
|
|
4994
5085
|
AmountDisplay,
|
|
4995
5086
|
{
|
|
4996
5087
|
value: groupThousands(input),
|
|
@@ -5110,8 +5201,13 @@ function DepositAmountStep({
|
|
|
5110
5201
|
}).split(sentinel);
|
|
5111
5202
|
return { before, amount: formatUsd(feeUsd), after };
|
|
5112
5203
|
})();
|
|
5113
|
-
const
|
|
5114
|
-
|
|
5204
|
+
const quickAmountsUsd = config.quickAmountsUsd;
|
|
5205
|
+
const quickAmounts = useMemo9(
|
|
5206
|
+
() => (quickAmountsUsd ?? DEFAULT_QUICK_AMOUNTS).map((value) => ({
|
|
5207
|
+
value,
|
|
5208
|
+
label: `$${groupThousands(value)}`
|
|
5209
|
+
})),
|
|
5210
|
+
[quickAmountsUsd]
|
|
5115
5211
|
);
|
|
5116
5212
|
const title = t("depositAmount.title");
|
|
5117
5213
|
const hasSubmitHandler = !!callbacks.onSubmitAmount;
|
|
@@ -5165,7 +5261,7 @@ function getDefaultDynamicTargetAsset(candidates, dynamicRoutingId) {
|
|
|
5165
5261
|
|
|
5166
5262
|
// src/flow/FlowSheet.tsx
|
|
5167
5263
|
import {
|
|
5168
|
-
useCallback as
|
|
5264
|
+
useCallback as useCallback8,
|
|
5169
5265
|
useEffect as useEffect18,
|
|
5170
5266
|
useRef as useRef12
|
|
5171
5267
|
} from "react";
|
|
@@ -5231,7 +5327,7 @@ function FlowSheet({
|
|
|
5231
5327
|
renderBackdropBlur
|
|
5232
5328
|
}) {
|
|
5233
5329
|
const ref = useRef12(null);
|
|
5234
|
-
const setRef =
|
|
5330
|
+
const setRef = useCallback8((instance) => {
|
|
5235
5331
|
ref.current = instance;
|
|
5236
5332
|
}, []);
|
|
5237
5333
|
const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled);
|
|
@@ -5256,7 +5352,7 @@ function FlowSheet({
|
|
|
5256
5352
|
}
|
|
5257
5353
|
ref.current?.dismiss();
|
|
5258
5354
|
}, [isOpen, session]);
|
|
5259
|
-
const handleDismiss =
|
|
5355
|
+
const handleDismiss = useCallback8(() => {
|
|
5260
5356
|
sheetSelfDismissed.current = true;
|
|
5261
5357
|
onClose();
|
|
5262
5358
|
}, [onClose]);
|
|
@@ -5264,7 +5360,7 @@ function FlowSheet({
|
|
|
5264
5360
|
duration: 300,
|
|
5265
5361
|
easing: Easing5.bezier(0.22, 1, 0.36, 1)
|
|
5266
5362
|
});
|
|
5267
|
-
const renderBackdrop =
|
|
5363
|
+
const renderBackdrop = useCallback8(
|
|
5268
5364
|
(props) => /* @__PURE__ */ jsxs14(
|
|
5269
5365
|
BottomSheetBackdrop2,
|
|
5270
5366
|
{
|
|
@@ -5754,7 +5850,7 @@ function useRememberedChain(userId) {
|
|
|
5754
5850
|
active = false;
|
|
5755
5851
|
};
|
|
5756
5852
|
}, [userId]);
|
|
5757
|
-
const rememberChainId =
|
|
5853
|
+
const rememberChainId = useCallback9(
|
|
5758
5854
|
(chainId) => {
|
|
5759
5855
|
setSelectedChainId(chainId);
|
|
5760
5856
|
void writeSelectedChainId(userId, chainId);
|
|
@@ -5794,7 +5890,7 @@ function warn(name, error) {
|
|
|
5794
5890
|
}
|
|
5795
5891
|
|
|
5796
5892
|
// src/flow/useCopiedToast.tsx
|
|
5797
|
-
import { useCallback as
|
|
5893
|
+
import { useCallback as useCallback10, useEffect as useEffect20, useRef as useRef13, useState as useState14 } from "react";
|
|
5798
5894
|
import { StyleSheet as StyleSheet18, View as View5 } from "react-native";
|
|
5799
5895
|
import { useSafeAreaInsets as useSafeAreaInsets7 } from "react-native-safe-area-context";
|
|
5800
5896
|
|
|
@@ -5867,7 +5963,7 @@ function useCopiedToast() {
|
|
|
5867
5963
|
const unmountTimerRef = useRef13(
|
|
5868
5964
|
void 0
|
|
5869
5965
|
);
|
|
5870
|
-
const clearToast =
|
|
5966
|
+
const clearToast = useCallback10(() => {
|
|
5871
5967
|
if (hideTimerRef.current) {
|
|
5872
5968
|
clearTimeout(hideTimerRef.current);
|
|
5873
5969
|
}
|
|
@@ -5877,7 +5973,7 @@ function useCopiedToast() {
|
|
|
5877
5973
|
setCopiedToastShown(false);
|
|
5878
5974
|
setToastMounted(false);
|
|
5879
5975
|
}, []);
|
|
5880
|
-
const showCopiedToast =
|
|
5976
|
+
const showCopiedToast = useCallback10(() => {
|
|
5881
5977
|
if (hideTimerRef.current) {
|
|
5882
5978
|
clearTimeout(hideTimerRef.current);
|
|
5883
5979
|
}
|
|
@@ -5908,7 +6004,7 @@ function useCopiedToast() {
|
|
|
5908
6004
|
|
|
5909
6005
|
// src/flow/WithdrawalFlowContent.tsx
|
|
5910
6006
|
import { useQueryClient } from "@tanstack/react-query";
|
|
5911
|
-
import { useCallback as
|
|
6007
|
+
import { useCallback as useCallback15, useState as useState24 } from "react";
|
|
5912
6008
|
|
|
5913
6009
|
// src/screens/WithdrawCryptoComplete.tsx
|
|
5914
6010
|
import { useEffect as useEffect22, useRef as useRef15 } from "react";
|
|
@@ -6432,6 +6528,7 @@ import {
|
|
|
6432
6528
|
useDebouncedValue
|
|
6433
6529
|
} from "@funkit/connect-core";
|
|
6434
6530
|
import { useState as useState18 } from "react";
|
|
6531
|
+
import { zeroAddress } from "viem";
|
|
6435
6532
|
|
|
6436
6533
|
// src/withdrawal/sourceToken.ts
|
|
6437
6534
|
function resolveWithdrawalSourceTokens(config) {
|
|
@@ -6598,9 +6695,10 @@ function isNoOpSelfWithdrawal({
|
|
|
6598
6695
|
recipientAddress,
|
|
6599
6696
|
walletAddress,
|
|
6600
6697
|
sourceToken,
|
|
6601
|
-
destinationToken
|
|
6698
|
+
destinationToken,
|
|
6699
|
+
isVenueRail
|
|
6602
6700
|
}) {
|
|
6603
|
-
if (!destinationToken) {
|
|
6701
|
+
if (isVenueRail || !destinationToken) {
|
|
6604
6702
|
return false;
|
|
6605
6703
|
}
|
|
6606
6704
|
return recipientAddress.toLowerCase() === walletAddress.toLowerCase() && sourceToken.chainId === destinationToken.chainId && sourceToken.address.toLowerCase() === destinationToken.address.toLowerCase();
|
|
@@ -6697,7 +6795,8 @@ function useCryptoWithdrawalValidation({
|
|
|
6697
6795
|
recipientAddress: recipient,
|
|
6698
6796
|
walletAddress: config.withdrawalWallet.address(),
|
|
6699
6797
|
sourceToken,
|
|
6700
|
-
destinationToken
|
|
6798
|
+
destinationToken,
|
|
6799
|
+
isVenueRail: Boolean(config.submitWithdrawal)
|
|
6701
6800
|
}),
|
|
6702
6801
|
amount,
|
|
6703
6802
|
amountValidation,
|
|
@@ -6708,7 +6807,7 @@ function useCryptoWithdrawalValidation({
|
|
|
6708
6807
|
|
|
6709
6808
|
// src/withdrawal/useWithdrawalAmountInput.ts
|
|
6710
6809
|
import { tokenAmountToUsd, usdToTokenAmount } from "@funkit/connect-core";
|
|
6711
|
-
import { useCallback as
|
|
6810
|
+
import { useCallback as useCallback11, useState as useState16 } from "react";
|
|
6712
6811
|
function withoutTrailingDot(value) {
|
|
6713
6812
|
return value.endsWith(".") ? value.slice(0, -1) : value;
|
|
6714
6813
|
}
|
|
@@ -6751,7 +6850,7 @@ function useWithdrawalAmountInput({
|
|
|
6751
6850
|
amount === "" || !canPriceInUsd ? "" : tokenAmountToUsd(withoutTrailingDot(amount), sourceUsdPrice)
|
|
6752
6851
|
);
|
|
6753
6852
|
}
|
|
6754
|
-
const setInput =
|
|
6853
|
+
const setInput = useCallback11(
|
|
6755
6854
|
(next) => {
|
|
6756
6855
|
if (!inUsd) {
|
|
6757
6856
|
setAmount(next);
|
|
@@ -6779,7 +6878,7 @@ function useWithdrawalAmountInput({
|
|
|
6779
6878
|
* - The staleness is bounded by refreshing the price on the way into this
|
|
6780
6879
|
* screen rather than while it is open.
|
|
6781
6880
|
*/
|
|
6782
|
-
swapDenomination:
|
|
6881
|
+
swapDenomination: useCallback11(() => setPrefersUsd((was) => !was), []),
|
|
6783
6882
|
/** Offering the swap without a rate would promise one we don't have. */
|
|
6784
6883
|
canSwapDenomination: canPriceInUsd,
|
|
6785
6884
|
/** What the amount is worth, or `undefined` when nothing prices it. */
|
|
@@ -6797,7 +6896,7 @@ function useWithdrawalAmountInput({
|
|
|
6797
6896
|
import { getSupportedAssets as getSupportedAssets2 } from "@funkit/api-base";
|
|
6798
6897
|
import { resolveTokenTransferConfig as resolveTokenTransferConfig2 } from "@funkit/connect-core";
|
|
6799
6898
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
6800
|
-
import { useMemo as
|
|
6899
|
+
import { useMemo as useMemo10, useState as useState17 } from "react";
|
|
6801
6900
|
var WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY = "withdrawalDestinations";
|
|
6802
6901
|
function useWithdrawalDestinationTokens({
|
|
6803
6902
|
sourceToken,
|
|
@@ -6814,7 +6913,7 @@ function useWithdrawalDestinationTokens({
|
|
|
6814
6913
|
enabled: !!apiKey,
|
|
6815
6914
|
staleTime: Number.POSITIVE_INFINITY
|
|
6816
6915
|
});
|
|
6817
|
-
const resolved =
|
|
6916
|
+
const resolved = useMemo10(() => {
|
|
6818
6917
|
if (!supportedAssets) {
|
|
6819
6918
|
return void 0;
|
|
6820
6919
|
}
|
|
@@ -6826,7 +6925,7 @@ function useWithdrawalDestinationTokens({
|
|
|
6826
6925
|
logger
|
|
6827
6926
|
});
|
|
6828
6927
|
}, [supportedAssets, withdrawalConfig, disabledChainAssets]);
|
|
6829
|
-
const chains =
|
|
6928
|
+
const chains = useMemo10(() => {
|
|
6830
6929
|
if (!resolved) {
|
|
6831
6930
|
return [];
|
|
6832
6931
|
}
|
|
@@ -6836,7 +6935,7 @@ function useWithdrawalDestinationTokens({
|
|
|
6836
6935
|
}));
|
|
6837
6936
|
}, [resolved]);
|
|
6838
6937
|
const [picked, setPicked] = useState17();
|
|
6839
|
-
const destinationToken =
|
|
6938
|
+
const destinationToken = useMemo10(() => {
|
|
6840
6939
|
if (!resolved) {
|
|
6841
6940
|
return void 0;
|
|
6842
6941
|
}
|
|
@@ -6984,7 +7083,9 @@ function useCryptoWithdrawalForm({
|
|
|
6984
7083
|
destinationToken,
|
|
6985
7084
|
recipientAddress: recipient,
|
|
6986
7085
|
amount: quoteAmount,
|
|
6987
|
-
|
|
7086
|
+
// The wallet doesn't spend on a venue rail, and the address that does isn't
|
|
7087
|
+
// minted until submit — a placeholder keeps Relay off a wallet-to-itself route.
|
|
7088
|
+
walletAddress: config.submitWithdrawal ? zeroAddress : config.withdrawalWallet.address(),
|
|
6988
7089
|
// Everything the form already knows is wrong, plus the async verdict:
|
|
6989
7090
|
// `isRisky === false` is required, so in-flight and errored both hold. A
|
|
6990
7091
|
// venue fee that hasn't settled yet would move `quoteAmount` underneath
|
|
@@ -7154,7 +7255,7 @@ import {
|
|
|
7154
7255
|
processCryptoWithdrawalOrder,
|
|
7155
7256
|
toWalletExecutionErrorCode
|
|
7156
7257
|
} from "@funkit/connect-core";
|
|
7157
|
-
import { useCallback as
|
|
7258
|
+
import { useCallback as useCallback12, useRef as useRef16, useState as useState19 } from "react";
|
|
7158
7259
|
var inFlightWithdrawals = /* @__PURE__ */ new Set();
|
|
7159
7260
|
function withdrawalKey({
|
|
7160
7261
|
walletAddress,
|
|
@@ -7185,7 +7286,7 @@ function useCryptoWithdrawalExecution({
|
|
|
7185
7286
|
const [submission, setSubmission] = useState19({
|
|
7186
7287
|
status: "idle"
|
|
7187
7288
|
});
|
|
7188
|
-
const submit =
|
|
7289
|
+
const submit = useCallback12(
|
|
7189
7290
|
async ({
|
|
7190
7291
|
quote,
|
|
7191
7292
|
recipientAddress,
|
|
@@ -7290,7 +7391,7 @@ function useCryptoWithdrawalExecution({
|
|
|
7290
7391
|
},
|
|
7291
7392
|
[apiKey, userId, config, sourceToken, destinationToken, callbacks]
|
|
7292
7393
|
);
|
|
7293
|
-
const reset =
|
|
7394
|
+
const reset = useCallback12(() => setSubmission({ status: "idle" }), []);
|
|
7294
7395
|
return { submission, submit, reset };
|
|
7295
7396
|
}
|
|
7296
7397
|
|
|
@@ -7362,7 +7463,7 @@ import {
|
|
|
7362
7463
|
BottomSheetScrollView as BottomSheetScrollView3,
|
|
7363
7464
|
BottomSheetView as BottomSheetView3
|
|
7364
7465
|
} from "@gorhom/bottom-sheet";
|
|
7365
|
-
import { useMemo as
|
|
7466
|
+
import { useMemo as useMemo11, useState as useState22 } from "react";
|
|
7366
7467
|
import { StyleSheet as StyleSheet26, View as View7, useWindowDimensions as useWindowDimensions6 } from "react-native";
|
|
7367
7468
|
import { useSafeAreaInsets as useSafeAreaInsets10 } from "react-native-safe-area-context";
|
|
7368
7469
|
|
|
@@ -7906,7 +8007,7 @@ function SelectReceiveTokenAndChainScreen({
|
|
|
7906
8007
|
committed ? Number(committed.chainId) : void 0
|
|
7907
8008
|
);
|
|
7908
8009
|
const [pinnedToken, setPinnedToken] = useState22(committed?.symbol);
|
|
7909
|
-
const tokens =
|
|
8010
|
+
const tokens = useMemo11(() => receivableTokens(chains), [chains]);
|
|
7910
8011
|
const { cells, overflowCount } = gridCells(tokens, TOKEN_CELLS, pinnedToken);
|
|
7911
8012
|
const draftToken = (next) => {
|
|
7912
8013
|
setToken(next);
|
|
@@ -8602,7 +8703,7 @@ import Animated14, { Keyframe as Keyframe8, LinearTransition as LinearTransition
|
|
|
8602
8703
|
import { useSafeAreaInsets as useSafeAreaInsets14 } from "react-native-safe-area-context";
|
|
8603
8704
|
|
|
8604
8705
|
// src/components/AmountDisplay.tsx
|
|
8605
|
-
import { useMemo as
|
|
8706
|
+
import { useMemo as useMemo12 } from "react";
|
|
8606
8707
|
import { StyleSheet as StyleSheet31, useWindowDimensions as useWindowDimensions9 } from "react-native";
|
|
8607
8708
|
import Animated12, {
|
|
8608
8709
|
Keyframe as Keyframe7,
|
|
@@ -8654,7 +8755,7 @@ function AmountDisplay2({
|
|
|
8654
8755
|
const fontSize = fitAmountFontSize(text, width - HORIZONTAL_INSET * 2);
|
|
8655
8756
|
const overhang = fontSize * (LINE_HEIGHT_RATIO2 - CAP_BOX_RATIO2) / 2;
|
|
8656
8757
|
const lineHeight = fontSize * LINE_HEIGHT_RATIO2;
|
|
8657
|
-
const slides =
|
|
8758
|
+
const slides = useMemo12(
|
|
8658
8759
|
() => ({
|
|
8659
8760
|
below: slideKeyframes2(lineHeight),
|
|
8660
8761
|
above: slideKeyframes2(-lineHeight)
|
|
@@ -8756,7 +8857,7 @@ var ROWS2 = [
|
|
|
8756
8857
|
["7", "8", "9"],
|
|
8757
8858
|
[".", "0", "backspace"]
|
|
8758
8859
|
];
|
|
8759
|
-
function
|
|
8860
|
+
function NumPad3({
|
|
8760
8861
|
onPressKey,
|
|
8761
8862
|
backspaceAccessibilityLabel
|
|
8762
8863
|
}) {
|
|
@@ -9082,7 +9183,7 @@ function WithdrawAmountScreen({
|
|
|
9082
9183
|
}
|
|
9083
9184
|
],
|
|
9084
9185
|
children: /* @__PURE__ */ jsx57(
|
|
9085
|
-
|
|
9186
|
+
NumPad3,
|
|
9086
9187
|
{
|
|
9087
9188
|
backspaceAccessibilityLabel: t("withdrawAmount.delete"),
|
|
9088
9189
|
onPressKey: (key) => onChangeInput(
|
|
@@ -9361,7 +9462,7 @@ function WithdrawMethodScreen(props) {
|
|
|
9361
9462
|
import {
|
|
9362
9463
|
isValidOrderData
|
|
9363
9464
|
} from "@funkit/connect-core";
|
|
9364
|
-
import { useCallback as
|
|
9465
|
+
import { useCallback as useCallback13 } from "react";
|
|
9365
9466
|
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
9366
9467
|
function SwappedWithdrawScreen({
|
|
9367
9468
|
url,
|
|
@@ -9371,7 +9472,7 @@ function SwappedWithdrawScreen({
|
|
|
9371
9472
|
onWithdrawalSuccess,
|
|
9372
9473
|
onOrderData
|
|
9373
9474
|
}) {
|
|
9374
|
-
const handleMessage =
|
|
9475
|
+
const handleMessage = useCallback13(
|
|
9375
9476
|
(msg) => {
|
|
9376
9477
|
switch (msg.type) {
|
|
9377
9478
|
case "SWAPPED_GO_BACK":
|
|
@@ -9432,11 +9533,11 @@ import {
|
|
|
9432
9533
|
import { useTheme as useTheme4 } from "@shopify/restyle";
|
|
9433
9534
|
import { useStatsigClient as useStatsigClient2 } from "@statsig/react-bindings";
|
|
9434
9535
|
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
9435
|
-
import { useMemo as
|
|
9536
|
+
import { useMemo as useMemo13 } from "react";
|
|
9436
9537
|
var WITHDRAW_FOPS_QUERY_KEY = "withdrawFops";
|
|
9437
9538
|
function useWithdrawalRoute(config) {
|
|
9438
9539
|
const sourceOverrides = useDynamicConfig("swappedwithdrawalsourceoverrides");
|
|
9439
|
-
return
|
|
9540
|
+
return useMemo13(
|
|
9440
9541
|
() => resolveSwappedWithdrawalLegs({
|
|
9441
9542
|
source: config.sourceToken,
|
|
9442
9543
|
target: config.swappedAcceptedToken,
|
|
@@ -9569,7 +9670,7 @@ function useWithdrawalFops({
|
|
|
9569
9670
|
logger
|
|
9570
9671
|
});
|
|
9571
9672
|
const theme = useTheme4();
|
|
9572
|
-
const themeConfig =
|
|
9673
|
+
const themeConfig = useMemo13(
|
|
9573
9674
|
() => buildSwappedThemeQueryParamsRN(theme),
|
|
9574
9675
|
[theme]
|
|
9575
9676
|
);
|
|
@@ -9641,7 +9742,7 @@ import {
|
|
|
9641
9742
|
processFiatWithdrawalOrder,
|
|
9642
9743
|
toFiatWithdrawalOrder
|
|
9643
9744
|
} from "@funkit/connect-core";
|
|
9644
|
-
import { useCallback as
|
|
9745
|
+
import { useCallback as useCallback14, useRef as useRef18 } from "react";
|
|
9645
9746
|
var submittedOrderIds = /* @__PURE__ */ new Set();
|
|
9646
9747
|
function useWithdrawalExecution({
|
|
9647
9748
|
config,
|
|
@@ -9651,7 +9752,7 @@ function useWithdrawalExecution({
|
|
|
9651
9752
|
}) {
|
|
9652
9753
|
const { apiKey, userId } = useFunkitIdentity();
|
|
9653
9754
|
const isProcessingRef = useRef18(false);
|
|
9654
|
-
const executeOrder =
|
|
9755
|
+
const executeOrder = useCallback14(
|
|
9655
9756
|
async (data) => {
|
|
9656
9757
|
const order = toFiatWithdrawalOrder(data);
|
|
9657
9758
|
if (isProcessingRef.current) {
|
|
@@ -9751,14 +9852,14 @@ function WithdrawalFlowContent({
|
|
|
9751
9852
|
const [selectedFop, setSelectedFop] = useState24();
|
|
9752
9853
|
const [hasExecutionError, setHasExecutionError] = useState24(false);
|
|
9753
9854
|
const [submittedWithdrawal, setSubmittedWithdrawal] = useState24();
|
|
9754
|
-
const onExecutionError =
|
|
9855
|
+
const onExecutionError = useCallback15(() => setHasExecutionError(true), []);
|
|
9755
9856
|
const { executeOrder } = useWithdrawalExecution({
|
|
9756
9857
|
config,
|
|
9757
9858
|
route,
|
|
9758
9859
|
callbacks,
|
|
9759
9860
|
onError: onExecutionError
|
|
9760
9861
|
});
|
|
9761
|
-
const invalidateWithdrawFops =
|
|
9862
|
+
const invalidateWithdrawFops = useCallback15(() => {
|
|
9762
9863
|
void queryClient.invalidateQueries({ queryKey: [WITHDRAW_FOPS_QUERY_KEY] });
|
|
9763
9864
|
}, [queryClient]);
|
|
9764
9865
|
if (hasExecutionError) {
|
|
@@ -9937,11 +10038,11 @@ function FunkitFlowProvider({
|
|
|
9937
10038
|
const [state, setState] = useState25(CLOSED);
|
|
9938
10039
|
const { hideCryptoDeposit } = useFunkitIdentity();
|
|
9939
10040
|
const isV2DepositEnabled = useFeatureGate3(RN_V2_DEPOSIT_GATE);
|
|
9940
|
-
const readClipboard =
|
|
10041
|
+
const readClipboard = useMemo14(
|
|
9941
10042
|
() => guardClipboardReader(pasteFromClipboard2),
|
|
9942
10043
|
[pasteFromClipboard2]
|
|
9943
10044
|
);
|
|
9944
|
-
const beginDeposit =
|
|
10045
|
+
const beginDeposit = useCallback16(
|
|
9945
10046
|
(config, hostCallbacks = {}) => {
|
|
9946
10047
|
const useAmountEntry = !!config.amountEntry && isV2DepositEnabled;
|
|
9947
10048
|
logger.info("beginDeposit", {
|
|
@@ -9961,7 +10062,7 @@ function FunkitFlowProvider({
|
|
|
9961
10062
|
},
|
|
9962
10063
|
[hideCryptoDeposit, isV2DepositEnabled]
|
|
9963
10064
|
);
|
|
9964
|
-
const beginWithdrawal =
|
|
10065
|
+
const beginWithdrawal = useCallback16(
|
|
9965
10066
|
(config, hostCallbacks = {}) => {
|
|
9966
10067
|
logger.info("beginWithdrawal", config);
|
|
9967
10068
|
const callbacks = guardHostCallbacks(hostCallbacks);
|
|
@@ -9976,7 +10077,7 @@ function FunkitFlowProvider({
|
|
|
9976
10077
|
[]
|
|
9977
10078
|
);
|
|
9978
10079
|
const { toast, showCopiedToast, clearToast } = useCopiedToast();
|
|
9979
|
-
const closeFlow =
|
|
10080
|
+
const closeFlow = useCallback16(() => {
|
|
9980
10081
|
setState((prev) => {
|
|
9981
10082
|
if (!prev.isOpen) {
|
|
9982
10083
|
return prev;
|
|
@@ -9986,13 +10087,13 @@ function FunkitFlowProvider({
|
|
|
9986
10087
|
});
|
|
9987
10088
|
clearToast();
|
|
9988
10089
|
}, [clearToast]);
|
|
9989
|
-
const navigate =
|
|
10090
|
+
const navigate = useCallback16((screen) => {
|
|
9990
10091
|
setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }));
|
|
9991
10092
|
}, []);
|
|
9992
|
-
const reset =
|
|
10093
|
+
const reset = useCallback16((screen) => {
|
|
9993
10094
|
setState((prev) => prev.isOpen ? { ...prev, stack: [screen] } : prev);
|
|
9994
10095
|
}, []);
|
|
9995
|
-
const popTo =
|
|
10096
|
+
const popTo = useCallback16((screen) => {
|
|
9996
10097
|
setState((prev) => {
|
|
9997
10098
|
const index = prev.stack.lastIndexOf(screen);
|
|
9998
10099
|
if (!prev.isOpen || index < 0) {
|
|
@@ -10001,7 +10102,7 @@ function FunkitFlowProvider({
|
|
|
10001
10102
|
return { ...prev, stack: prev.stack.slice(0, index + 1) };
|
|
10002
10103
|
});
|
|
10003
10104
|
}, []);
|
|
10004
|
-
const back =
|
|
10105
|
+
const back = useCallback16(() => {
|
|
10005
10106
|
setState((prev) => {
|
|
10006
10107
|
if (!prev.isOpen) {
|
|
10007
10108
|
return prev;
|
|
@@ -10013,14 +10114,14 @@ function FunkitFlowProvider({
|
|
|
10013
10114
|
return { ...prev, stack: prev.stack.slice(0, -1) };
|
|
10014
10115
|
});
|
|
10015
10116
|
}, []);
|
|
10016
|
-
const value =
|
|
10117
|
+
const value = useMemo14(
|
|
10017
10118
|
() => ({ beginDeposit, beginWithdrawal, closeFlow }),
|
|
10018
10119
|
[beginDeposit, beginWithdrawal, closeFlow]
|
|
10019
10120
|
);
|
|
10020
10121
|
const current = state.stack[state.stack.length - 1];
|
|
10021
10122
|
const isHomeScreen = state.stack.length <= 1;
|
|
10022
10123
|
const isCryptoWithdrawalStep = !!current && CRYPTO_WITHDRAWAL_STEPS.has(current);
|
|
10023
|
-
const nav =
|
|
10124
|
+
const nav = useMemo14(
|
|
10024
10125
|
() => ({ navigate, back, reset, popTo, closeFlow }),
|
|
10025
10126
|
[navigate, back, reset, popTo, closeFlow]
|
|
10026
10127
|
);
|
|
@@ -10074,7 +10175,7 @@ function useFunkitFlow() {
|
|
|
10074
10175
|
}
|
|
10075
10176
|
|
|
10076
10177
|
// src/version.ts
|
|
10077
|
-
var CONNECT_RN_VERSION = true ? "3.10.
|
|
10178
|
+
var CONNECT_RN_VERSION = true ? "3.10.1" : "0.0.0-dev";
|
|
10078
10179
|
|
|
10079
10180
|
// src/providers/FunkitStatsigProvider.tsx
|
|
10080
10181
|
import {
|
|
@@ -10082,7 +10183,7 @@ import {
|
|
|
10082
10183
|
LogLevel,
|
|
10083
10184
|
StatsigProvider
|
|
10084
10185
|
} from "@statsig/react-bindings";
|
|
10085
|
-
import { useEffect as useEffect24, useMemo as
|
|
10186
|
+
import { useEffect as useEffect24, useMemo as useMemo15 } from "react";
|
|
10086
10187
|
|
|
10087
10188
|
// src/statsig/useClientAsyncInitRN.ts
|
|
10088
10189
|
import {
|
|
@@ -10284,7 +10385,7 @@ function FunkitStatsigProvider({
|
|
|
10284
10385
|
userId,
|
|
10285
10386
|
isDevelopment = false
|
|
10286
10387
|
}) {
|
|
10287
|
-
const user =
|
|
10388
|
+
const user = useMemo15(
|
|
10288
10389
|
() => buildFunkitStatsigUser(userId, apiKey),
|
|
10289
10390
|
[userId, apiKey]
|
|
10290
10391
|
);
|
|
@@ -10348,7 +10449,7 @@ function FunkitProvider({
|
|
|
10348
10449
|
const fallbackClient = useRef19(void 0);
|
|
10349
10450
|
fallbackClient.current ??= createFallbackQueryClient();
|
|
10350
10451
|
const client = queryClient ?? fallbackClient.current;
|
|
10351
|
-
const identity =
|
|
10452
|
+
const identity = useMemo16(
|
|
10352
10453
|
() => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
|
|
10353
10454
|
[config, walletAddress]
|
|
10354
10455
|
);
|
|
@@ -10387,14 +10488,14 @@ function FunkitProvider({
|
|
|
10387
10488
|
}
|
|
10388
10489
|
|
|
10389
10490
|
// src/providers/useFunkitCheckout.ts
|
|
10390
|
-
import { useCallback as
|
|
10491
|
+
import { useCallback as useCallback17 } from "react";
|
|
10391
10492
|
function useFunkitCheckout(callbacks = {}) {
|
|
10392
10493
|
const { beginDeposit: openDepositFlow, beginWithdrawal: openWithdrawalFlow } = useFunkitFlow();
|
|
10393
|
-
const beginDeposit =
|
|
10494
|
+
const beginDeposit = useCallback17(
|
|
10394
10495
|
(config) => openDepositFlow(config, callbacks),
|
|
10395
10496
|
[openDepositFlow, callbacks]
|
|
10396
10497
|
);
|
|
10397
|
-
const beginWithdrawal =
|
|
10498
|
+
const beginWithdrawal = useCallback17(
|
|
10398
10499
|
(config) => openWithdrawalFlow(config, callbacks),
|
|
10399
10500
|
[openWithdrawalFlow, callbacks]
|
|
10400
10501
|
);
|
|
@@ -10407,7 +10508,7 @@ import {
|
|
|
10407
10508
|
purifyCheckoutHistoryItem,
|
|
10408
10509
|
useRecentDepositsApiQuery
|
|
10409
10510
|
} from "@funkit/connect-core";
|
|
10410
|
-
import { useMemo as
|
|
10511
|
+
import { useMemo as useMemo17 } from "react";
|
|
10411
10512
|
function useFunkitRecentDeposits(query) {
|
|
10412
10513
|
const { apiKey, userId } = useFunkitIdentity();
|
|
10413
10514
|
const { listRefresh } = useDynamicConfig(
|
|
@@ -10439,14 +10540,14 @@ function useFunkitRecentDepositsImpl({
|
|
|
10439
10540
|
// over-fetch to account for merging
|
|
10440
10541
|
logger
|
|
10441
10542
|
});
|
|
10442
|
-
const mergedDirectExecutions =
|
|
10543
|
+
const mergedDirectExecutions = useMemo17(
|
|
10443
10544
|
() => processRecentDepositsForNotifications(
|
|
10444
10545
|
memoizedFilterFunc ? directExecutions?.filter(memoizedFilterFunc) : directExecutions,
|
|
10445
10546
|
{ cutOffTimeMs }
|
|
10446
10547
|
),
|
|
10447
10548
|
[directExecutions, cutOffTimeMs, memoizedFilterFunc]
|
|
10448
10549
|
);
|
|
10449
|
-
return
|
|
10550
|
+
return useMemo17(
|
|
10450
10551
|
() => ({
|
|
10451
10552
|
data: mergedDirectExecutions?.map((de) => purifyCheckoutHistoryItem(de)).slice(0, fetchSize)
|
|
10452
10553
|
}),
|