@funkit/connect-rn 3.4.0 → 3.5.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 +37 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2261 -387
- package/dist/index.js.map +4 -4
- package/dist/src/components/AmountInput.d.ts +40 -0
- package/dist/src/components/AmountInput.d.ts.map +1 -0
- package/dist/src/components/RecipientAddressInput.d.ts +28 -0
- package/dist/src/components/RecipientAddressInput.d.ts.map +1 -0
- package/dist/src/components/WithdrawFeeSummary.d.ts +17 -0
- package/dist/src/components/WithdrawFeeSummary.d.ts.map +1 -0
- package/dist/src/flow/FlowSheet.d.ts +10 -1
- package/dist/src/flow/FlowSheet.d.ts.map +1 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts +4 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/guardHostCallbacks.d.ts +11 -0
- package/dist/src/flow/guardHostCallbacks.d.ts.map +1 -0
- package/dist/src/flow/useKeyboardHeight.d.ts +4 -10
- package/dist/src/flow/useKeyboardHeight.d.ts.map +1 -1
- package/dist/src/flow/withdrawalFlowConfig.d.ts +61 -9
- package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -1
- package/dist/src/geo/useUserIpInfo.d.ts.map +1 -1
- package/dist/src/identity/IdentityContext.d.ts.map +1 -1
- package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
- package/dist/src/logging/serializeLogBatch.d.ts +9 -0
- package/dist/src/logging/serializeLogBatch.d.ts.map +1 -0
- package/dist/src/providers/FunkitProvider.d.ts +9 -1
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/screens/SelectDestinationScreen.d.ts +19 -0
- package/dist/src/screens/SelectDestinationScreen.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCompleteScreen.d.ts +17 -0
- package/dist/src/screens/WithdrawCompleteScreen.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoComplete.d.ts +16 -0
- package/dist/src/screens/WithdrawCryptoComplete.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoCta.d.ts +20 -0
- package/dist/src/screens/WithdrawCryptoCta.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoForm.d.ts +17 -0
- package/dist/src/screens/WithdrawCryptoForm.d.ts.map +1 -0
- package/dist/src/screens/WithdrawCryptoScreen.d.ts +3 -1
- package/dist/src/screens/WithdrawCryptoScreen.d.ts.map +1 -1
- package/dist/src/theme/buildFunkitTheme.d.ts +1 -0
- package/dist/src/theme/buildFunkitTheme.d.ts.map +1 -1
- package/dist/src/theme/restyle.d.ts +33 -0
- package/dist/src/theme/restyle.d.ts.map +1 -1
- package/dist/src/theme/toRestyleTheme.d.ts +3 -0
- package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
- package/dist/src/theme/tokens.d.ts +6 -0
- package/dist/src/theme/tokens.d.ts.map +1 -1
- package/dist/src/transfer/availableChains.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useLighterDepositRecipientOverride.d.ts +23 -0
- package/dist/src/transfer/hooks/useLighterDepositRecipientOverride.d.ts.map +1 -0
- package/dist/src/transfer/hooks/useTransferInit.d.ts +3 -2
- package/dist/src/transfer/hooks/useTransferInit.d.ts.map +1 -1
- package/dist/src/utils/chainDisplay.d.ts +8 -0
- package/dist/src/utils/chainDisplay.d.ts.map +1 -0
- package/dist/src/utils/customers.d.ts +1 -0
- package/dist/src/utils/customers.d.ts.map +1 -1
- package/dist/src/withdrawal/sourceToken.d.ts +17 -0
- package/dist/src/withdrawal/sourceToken.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts +44 -0
- package/dist/src/withdrawal/useCryptoWithdrawalExecution.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalQuote.d.ts +42 -0
- package/dist/src/withdrawal/useCryptoWithdrawalQuote.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalValidation.d.ts +24 -0
- package/dist/src/withdrawal/useCryptoWithdrawalValidation.d.ts.map +1 -0
- package/dist/src/withdrawal/useSourceTokenDecimals.d.ts +13 -0
- package/dist/src/withdrawal/useSourceTokenDecimals.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalDestinationTokens.d.ts +32 -0
- package/dist/src/withdrawal/useWithdrawalDestinationTokens.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalExecution.d.ts.map +1 -1
- package/dist/src/withdrawal/useWithdrawalRisk.d.ts +16 -0
- package/dist/src/withdrawal/useWithdrawalRisk.d.ts.map +1 -0
- package/dist/src/withdrawal/useWithdrawalStatus.d.ts +31 -0
- package/dist/src/withdrawal/useWithdrawalStatus.d.ts.map +1 -0
- package/dist/src/withdrawal/validation.d.ts +48 -0
- package/dist/src/withdrawal/validation.d.ts.map +1 -0
- package/package.json +3 -3
- package/dist/src/withdrawal/publicClient.d.ts +0 -10
- package/dist/src/withdrawal/publicClient.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -21,7 +21,8 @@ var lightTokens = {
|
|
|
21
21
|
disabled: "#F34126"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
pill: { default: "#FFFFFF", pressed: "#EFEFEF", disabled: "#FFFFFF" }
|
|
24
|
+
pill: { default: "#FFFFFF", pressed: "#EFEFEF", disabled: "#FFFFFF" },
|
|
25
|
+
overlay: "#131313CC"
|
|
25
26
|
},
|
|
26
27
|
opacity: {
|
|
27
28
|
disabled: 40
|
|
@@ -96,7 +97,8 @@ var darkTokens = {
|
|
|
96
97
|
disabled: "#DB3B22"
|
|
97
98
|
}
|
|
98
99
|
},
|
|
99
|
-
pill: { default: "#0F0F0F", pressed: "#1B1B1B", disabled: "#0F0F0F" }
|
|
100
|
+
pill: { default: "#0F0F0F", pressed: "#1B1B1B", disabled: "#0F0F0F" },
|
|
101
|
+
overlay: "#131313CC"
|
|
100
102
|
},
|
|
101
103
|
opacity: {
|
|
102
104
|
disabled: 40
|
|
@@ -334,12 +336,12 @@ var DEFAULT_THEME_SET = {
|
|
|
334
336
|
};
|
|
335
337
|
function selectTheme(themeSet, scheme) {
|
|
336
338
|
const primary = scheme === "dark" ? themeSet.dark : themeSet.light;
|
|
337
|
-
const
|
|
339
|
+
const fallback = scheme === "dark" ? themeSet.light : themeSet.dark;
|
|
338
340
|
if (primary) {
|
|
339
341
|
return primary;
|
|
340
342
|
}
|
|
341
|
-
if (
|
|
342
|
-
return
|
|
343
|
+
if (fallback) {
|
|
344
|
+
return fallback;
|
|
343
345
|
}
|
|
344
346
|
throw new Error(
|
|
345
347
|
"FunkitProvider: `themes` must include at least one of { light, dark }"
|
|
@@ -440,7 +442,7 @@ function useFunkitColorScheme() {
|
|
|
440
442
|
|
|
441
443
|
// src/providers/FunkitProvider.tsx
|
|
442
444
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
443
|
-
import { useEffect as
|
|
445
|
+
import { useEffect as useEffect16, useMemo as useMemo13, useRef as useRef13 } from "react";
|
|
444
446
|
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
445
447
|
|
|
446
448
|
// src/flow/FunkitFlowProvider.tsx
|
|
@@ -458,9 +460,101 @@ import {
|
|
|
458
460
|
// src/geo/useUserIpInfo.ts
|
|
459
461
|
import { useUserIpInfo as useCoreUserIpInfo } from "@funkit/connect-core";
|
|
460
462
|
|
|
463
|
+
// src/identity/IdentityContext.tsx
|
|
464
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
465
|
+
|
|
466
|
+
// src/utils/customers.ts
|
|
467
|
+
import { LIGHTERXYZ_API_KEY, MALLARD_API_KEY } from "@funkit/api-base";
|
|
468
|
+
function isMallardApiKey(apiKey) {
|
|
469
|
+
return apiKey === MALLARD_API_KEY;
|
|
470
|
+
}
|
|
471
|
+
function isLighterxyzApiKey(apiKey) {
|
|
472
|
+
return apiKey === LIGHTERXYZ_API_KEY;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
// src/identity/IdentityContext.tsx
|
|
476
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
477
|
+
function generateSyntheticUserId(apiKey, externalUserId) {
|
|
478
|
+
if (isMallardApiKey(apiKey) || isLighterxyzApiKey(apiKey)) {
|
|
479
|
+
return externalUserId;
|
|
480
|
+
}
|
|
481
|
+
return `${apiKey}|${externalUserId}`;
|
|
482
|
+
}
|
|
483
|
+
function resolveFunkitIdentity(config, walletAddress) {
|
|
484
|
+
const address = walletAddress || "0x";
|
|
485
|
+
const userId = config.externalUserId ? generateSyntheticUserId(config.apiKey, config.externalUserId) : address;
|
|
486
|
+
return {
|
|
487
|
+
apiKey: config.apiKey,
|
|
488
|
+
userId,
|
|
489
|
+
walletAddress: address,
|
|
490
|
+
loginType: config.loginType,
|
|
491
|
+
prefillFiatEmail: config.prefillFiatEmail
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
var FunkitIdentityContext = createContext2(null);
|
|
495
|
+
function FunkitIdentityProvider({
|
|
496
|
+
identity,
|
|
497
|
+
children
|
|
498
|
+
}) {
|
|
499
|
+
return /* @__PURE__ */ jsx2(FunkitIdentityContext.Provider, { value: identity, children });
|
|
500
|
+
}
|
|
501
|
+
function useFunkitIdentity() {
|
|
502
|
+
const identity = useContext2(FunkitIdentityContext);
|
|
503
|
+
if (identity == null) {
|
|
504
|
+
throw new Error(
|
|
505
|
+
"useFunkitIdentity must be used within a <FunkitIdentityProvider> (mounted by <FunkitProvider>)"
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
return identity;
|
|
509
|
+
}
|
|
510
|
+
|
|
461
511
|
// src/logging/logger.ts
|
|
462
512
|
import { FunLogger } from "@funkit/connect-core";
|
|
463
513
|
|
|
514
|
+
// src/logging/serializeLogBatch.ts
|
|
515
|
+
var UNSERIALIZABLE_DATA = "[Unserializable]";
|
|
516
|
+
function serializeLogBatch(batch) {
|
|
517
|
+
try {
|
|
518
|
+
return JSON.stringify(batch, createSafeJsonReplacer());
|
|
519
|
+
} catch {
|
|
520
|
+
return `[${batch.map(serializeRecord).join(",")}]`;
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function serializeRecord(record) {
|
|
524
|
+
const attributes = Object.entries(record).flatMap(([key, value]) => {
|
|
525
|
+
const serialized = serializeValue(value);
|
|
526
|
+
return serialized === void 0 ? [] : [`${JSON.stringify(key)}:${serialized}`];
|
|
527
|
+
});
|
|
528
|
+
return `{${attributes.join(",")}}`;
|
|
529
|
+
}
|
|
530
|
+
function serializeValue(value) {
|
|
531
|
+
try {
|
|
532
|
+
return JSON.stringify(value, createSafeJsonReplacer());
|
|
533
|
+
} catch {
|
|
534
|
+
return JSON.stringify(UNSERIALIZABLE_DATA);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
function createSafeJsonReplacer() {
|
|
538
|
+
const ancestors = [];
|
|
539
|
+
return function(_key, value) {
|
|
540
|
+
if (typeof value === "bigint") return value.toString();
|
|
541
|
+
if (typeof value === "function") {
|
|
542
|
+
return `[Function] ${value.name || "anonymous"}`;
|
|
543
|
+
}
|
|
544
|
+
if (typeof value === "symbol") {
|
|
545
|
+
return `[Symbol] ${value.description ?? ""}`;
|
|
546
|
+
}
|
|
547
|
+
if (value === null || typeof value !== "object") return value;
|
|
548
|
+
if ("$$typeof" in value) return "[React]";
|
|
549
|
+
while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
|
|
550
|
+
ancestors.pop();
|
|
551
|
+
}
|
|
552
|
+
if (ancestors.includes(value)) return "[Circular]";
|
|
553
|
+
ancestors.push(value);
|
|
554
|
+
return value;
|
|
555
|
+
};
|
|
556
|
+
}
|
|
557
|
+
|
|
464
558
|
// src/logging/datadogHttpLogTransport.ts
|
|
465
559
|
var DEFAULT_SERVICE = "connect-rn";
|
|
466
560
|
var DEFAULT_SITE = "datadoghq.com";
|
|
@@ -532,13 +626,7 @@ var DatadogHttpLogTransport = class {
|
|
|
532
626
|
fetch(this.intakeUrl, {
|
|
533
627
|
method: "POST",
|
|
534
628
|
headers: { "Content-Type": "application/json" },
|
|
535
|
-
|
|
536
|
-
// amounts) that plain JSON.stringify throws on — and flush() can run
|
|
537
|
-
// synchronously inside a caller's log(). Coerce bigints to strings.
|
|
538
|
-
body: JSON.stringify(
|
|
539
|
-
batch,
|
|
540
|
-
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
541
|
-
)
|
|
629
|
+
body: serializeLogBatch(batch)
|
|
542
630
|
}).catch(() => {
|
|
543
631
|
});
|
|
544
632
|
}
|
|
@@ -570,8 +658,10 @@ var logger = new FunLogger(
|
|
|
570
658
|
|
|
571
659
|
// src/geo/useUserIpInfo.ts
|
|
572
660
|
function useUserIpInfo() {
|
|
661
|
+
const { apiKey } = useFunkitIdentity();
|
|
573
662
|
return useCoreUserIpInfo({
|
|
574
663
|
logger,
|
|
664
|
+
apiKey,
|
|
575
665
|
enabled: true,
|
|
576
666
|
staleTime: Number.POSITIVE_INFINITY
|
|
577
667
|
});
|
|
@@ -591,15 +681,15 @@ import { useStatsigClient as useStatsigClient2 } from "@statsig/react-bindings";
|
|
|
591
681
|
import { useQueryClient } from "@tanstack/react-query";
|
|
592
682
|
import {
|
|
593
683
|
createContext as createContext4,
|
|
594
|
-
useCallback as
|
|
684
|
+
useCallback as useCallback10,
|
|
595
685
|
useContext as useContext4,
|
|
596
|
-
useEffect as
|
|
597
|
-
useMemo as
|
|
598
|
-
useRef as
|
|
599
|
-
useState as
|
|
686
|
+
useEffect as useEffect15,
|
|
687
|
+
useMemo as useMemo11,
|
|
688
|
+
useRef as useRef12,
|
|
689
|
+
useState as useState14
|
|
600
690
|
} from "react";
|
|
601
|
-
import { Share, StyleSheet as
|
|
602
|
-
import { useSafeAreaInsets as
|
|
691
|
+
import { Share, StyleSheet as StyleSheet18, View as View6 } from "react-native";
|
|
692
|
+
import { useSafeAreaInsets as useSafeAreaInsets5 } from "react-native-safe-area-context";
|
|
603
693
|
|
|
604
694
|
// src/geo/useCheckoutBlocked.ts
|
|
605
695
|
import { useEffect as useEffect2, useMemo as useMemo3 } from "react";
|
|
@@ -645,51 +735,6 @@ function useCheckoutBlocked(params) {
|
|
|
645
735
|
return { isGeoblocked, isLoadingGeoCheck };
|
|
646
736
|
}
|
|
647
737
|
|
|
648
|
-
// src/identity/IdentityContext.tsx
|
|
649
|
-
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
650
|
-
|
|
651
|
-
// src/utils/customers.ts
|
|
652
|
-
import { MALLARD_API_KEY } from "@funkit/api-base";
|
|
653
|
-
function isMallardApiKey(apiKey) {
|
|
654
|
-
return apiKey === MALLARD_API_KEY;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
// src/identity/IdentityContext.tsx
|
|
658
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
659
|
-
function generateSyntheticUserId(apiKey, externalUserId) {
|
|
660
|
-
if (isMallardApiKey(apiKey)) {
|
|
661
|
-
return externalUserId;
|
|
662
|
-
}
|
|
663
|
-
return `${apiKey}|${externalUserId}`;
|
|
664
|
-
}
|
|
665
|
-
function resolveFunkitIdentity(config, walletAddress) {
|
|
666
|
-
const address = walletAddress || "0x";
|
|
667
|
-
const userId = config.externalUserId ? generateSyntheticUserId(config.apiKey, config.externalUserId) : address;
|
|
668
|
-
return {
|
|
669
|
-
apiKey: config.apiKey,
|
|
670
|
-
userId,
|
|
671
|
-
walletAddress: address,
|
|
672
|
-
loginType: config.loginType,
|
|
673
|
-
prefillFiatEmail: config.prefillFiatEmail
|
|
674
|
-
};
|
|
675
|
-
}
|
|
676
|
-
var FunkitIdentityContext = createContext2(null);
|
|
677
|
-
function FunkitIdentityProvider({
|
|
678
|
-
identity,
|
|
679
|
-
children
|
|
680
|
-
}) {
|
|
681
|
-
return /* @__PURE__ */ jsx2(FunkitIdentityContext.Provider, { value: identity, children });
|
|
682
|
-
}
|
|
683
|
-
function useFunkitIdentity() {
|
|
684
|
-
const identity = useContext2(FunkitIdentityContext);
|
|
685
|
-
if (identity == null) {
|
|
686
|
-
throw new Error(
|
|
687
|
-
"useFunkitIdentity must be used within a <FunkitIdentityProvider> (mounted by <FunkitProvider>)"
|
|
688
|
-
);
|
|
689
|
-
}
|
|
690
|
-
return identity;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
738
|
// src/icons/PaymentMethodIcon.tsx
|
|
694
739
|
import { getSwappedIcon, isSavedFormOfPaymentType } from "@funkit/connect-core";
|
|
695
740
|
|
|
@@ -971,6 +1016,7 @@ var en_default = {
|
|
|
971
1016
|
copy: "Copy",
|
|
972
1017
|
copyAddress: "Copy address",
|
|
973
1018
|
done: "Done",
|
|
1019
|
+
loading: "Loading\u2026",
|
|
974
1020
|
tryAgain: "Try again"
|
|
975
1021
|
},
|
|
976
1022
|
fops: {
|
|
@@ -1020,9 +1066,42 @@ var en_default = {
|
|
|
1020
1066
|
unavailableTitle: "Withdrawals unavailable"
|
|
1021
1067
|
},
|
|
1022
1068
|
withdrawCrypto: {
|
|
1069
|
+
aboveBalance: "Insufficient balance",
|
|
1070
|
+
addressPlaceholder: "Wallet address",
|
|
1071
|
+
available: "{{amount}} {{symbol}} available",
|
|
1072
|
+
belowMinimum: "Minimum Amount is {{amount}}",
|
|
1073
|
+
ctaEnterAmount: "Enter an amount",
|
|
1074
|
+
ctaEnterRecipient: "Enter a wallet address",
|
|
1075
|
+
ctaInvalidForChain: "Address isn't valid for this network",
|
|
1076
|
+
ctaMaxExceeded: "Max amount exceeded",
|
|
1077
|
+
ctaRecipientSameAsSource: "Choose a different address",
|
|
1078
|
+
ctaSelectDestination: "Select a destination",
|
|
1079
|
+
ctaWithdraw: "Withdraw",
|
|
1080
|
+
errorGeneric: "Withdrawal failed. Please try again.",
|
|
1081
|
+
errorInsufficientGas: "Insufficient gas to complete the transaction.",
|
|
1082
|
+
errorSwitchChain: "Unable to switch networks. Please ensure your wallet supports the network.",
|
|
1083
|
+
failedMessage: "{{amount}} didn't reach the recipient. Contact support if the funds don't come back.",
|
|
1084
|
+
failedTitle: "Withdrawal didn't complete",
|
|
1085
|
+
max: "Max",
|
|
1086
|
+
maxSlippage: "Max slippage",
|
|
1023
1087
|
methodSubtitle: "No limit",
|
|
1024
1088
|
methodTitle: "Crypto address",
|
|
1025
|
-
|
|
1089
|
+
networkCost: "Network cost",
|
|
1090
|
+
priceImpact: "Price impact",
|
|
1091
|
+
quoteFailed: "Failed fetching the swap quote. Please try again.",
|
|
1092
|
+
receiveAs: "Receive as",
|
|
1093
|
+
refundedMessage: "{{amount}} was returned to your wallet.",
|
|
1094
|
+
riskyAddress: "This wallet address cannot be used due to restrictions.",
|
|
1095
|
+
selectDestination: "Receive as",
|
|
1096
|
+
sendTo: "Send to",
|
|
1097
|
+
successMessage: "{{amount}} is on its way.",
|
|
1098
|
+
successPendingMessage: "{{amount}} is settling on-chain. You can close this.",
|
|
1099
|
+
successPendingTitle: "Withdrawal sent",
|
|
1100
|
+
successTitle: "Withdrawal complete",
|
|
1101
|
+
title: "Withdraw crypto",
|
|
1102
|
+
unsupportedRecipient: "Unsupported recipient address",
|
|
1103
|
+
useMyWallet: "Use my wallet",
|
|
1104
|
+
youReceive: "You receive"
|
|
1026
1105
|
}
|
|
1027
1106
|
};
|
|
1028
1107
|
|
|
@@ -1045,6 +1124,7 @@ var es_default = {
|
|
|
1045
1124
|
copy: "Copiar",
|
|
1046
1125
|
copyAddress: "Copiar direcci\xF3n",
|
|
1047
1126
|
done: "Listo",
|
|
1127
|
+
loading: "Cargando\u2026",
|
|
1048
1128
|
tryAgain: "Intentar nuevamente"
|
|
1049
1129
|
},
|
|
1050
1130
|
fops: {
|
|
@@ -1094,9 +1174,42 @@ var es_default = {
|
|
|
1094
1174
|
unavailableTitle: "Retiros no disponibles"
|
|
1095
1175
|
},
|
|
1096
1176
|
withdrawCrypto: {
|
|
1177
|
+
aboveBalance: "Saldo insuficiente",
|
|
1178
|
+
addressPlaceholder: "Direcci\xF3n de la cartera",
|
|
1179
|
+
available: "{{amount}} {{symbol}} disponibles",
|
|
1180
|
+
belowMinimum: "El Monto M\xEDnimo es {{amount}}",
|
|
1181
|
+
ctaEnterAmount: "Introduce un importe",
|
|
1182
|
+
ctaEnterRecipient: "Introduce una direcci\xF3n",
|
|
1183
|
+
ctaInvalidForChain: "La direcci\xF3n no es v\xE1lida en esta red",
|
|
1184
|
+
ctaMaxExceeded: "Monto m\xE1ximo excedido",
|
|
1185
|
+
ctaRecipientSameAsSource: "Elige otra direcci\xF3n",
|
|
1186
|
+
ctaSelectDestination: "Selecciona un destino",
|
|
1187
|
+
ctaWithdraw: "Retirar",
|
|
1188
|
+
errorGeneric: "El retiro fall\xF3. Int\xE9ntalo nuevamente.",
|
|
1189
|
+
errorInsufficientGas: "Gas insuficiente para esta transacci\xF3n.",
|
|
1190
|
+
errorSwitchChain: "No se puede cambiar de red. Aseg\xFArate de que tu billetera soporte la red.",
|
|
1191
|
+
failedMessage: "{{amount}} no lleg\xF3 al destinatario. Contacta con soporte si los fondos no regresan.",
|
|
1192
|
+
failedTitle: "La retirada no se complet\xF3",
|
|
1193
|
+
max: "M\xE1x.",
|
|
1194
|
+
maxSlippage: "Deslizamiento m\xE1x.",
|
|
1097
1195
|
methodSubtitle: "Sin l\xEDmite",
|
|
1098
1196
|
methodTitle: "Direcci\xF3n cripto",
|
|
1099
|
-
|
|
1197
|
+
networkCost: "Coste de red",
|
|
1198
|
+
priceImpact: "Impacto en el precio",
|
|
1199
|
+
quoteFailed: "Error al obtener la cotizaci\xF3n de intercambio. Por favor intenta nuevamente.",
|
|
1200
|
+
receiveAs: "Recibir como",
|
|
1201
|
+
refundedMessage: "{{amount}} se devolvi\xF3 a tu monedero.",
|
|
1202
|
+
riskyAddress: "Esta direcci\xF3n de billetera no puede ser usada debido a restricciones.",
|
|
1203
|
+
selectDestination: "Recibir como",
|
|
1204
|
+
sendTo: "Enviar a",
|
|
1205
|
+
successMessage: "{{amount}} est\xE1 en camino.",
|
|
1206
|
+
successPendingMessage: "{{amount}} se est\xE1 liquidando en la cadena. Puedes cerrar esto.",
|
|
1207
|
+
successPendingTitle: "Retiro enviado",
|
|
1208
|
+
successTitle: "Retiro completado",
|
|
1209
|
+
title: "Retirar cripto",
|
|
1210
|
+
unsupportedRecipient: "Direcci\xF3n de destinatario no soportada",
|
|
1211
|
+
useMyWallet: "Usar mi cartera",
|
|
1212
|
+
youReceive: "Recibes"
|
|
1100
1213
|
}
|
|
1101
1214
|
};
|
|
1102
1215
|
|
|
@@ -1119,6 +1232,7 @@ var fr_default = {
|
|
|
1119
1232
|
copy: "Copier",
|
|
1120
1233
|
copyAddress: "Copier l'adresse",
|
|
1121
1234
|
done: "Termin\xE9",
|
|
1235
|
+
loading: "Chargement\u2026",
|
|
1122
1236
|
tryAgain: "R\xE9essayer"
|
|
1123
1237
|
},
|
|
1124
1238
|
fops: {
|
|
@@ -1168,9 +1282,42 @@ var fr_default = {
|
|
|
1168
1282
|
unavailableTitle: "Retraits indisponibles"
|
|
1169
1283
|
},
|
|
1170
1284
|
withdrawCrypto: {
|
|
1285
|
+
aboveBalance: "Solde insuffisant",
|
|
1286
|
+
addressPlaceholder: "Adresse du portefeuille",
|
|
1287
|
+
available: "{{amount}} {{symbol}} disponibles",
|
|
1288
|
+
belowMinimum: "Le montant minimum est de {{amount}}",
|
|
1289
|
+
ctaEnterAmount: "Saisissez un montant",
|
|
1290
|
+
ctaEnterRecipient: "Saisissez une adresse",
|
|
1291
|
+
ctaInvalidForChain: "Adresse non valide sur ce r\xE9seau",
|
|
1292
|
+
ctaMaxExceeded: "Montant maximum d\xE9pass\xE9",
|
|
1293
|
+
ctaRecipientSameAsSource: "Choisissez une autre adresse",
|
|
1294
|
+
ctaSelectDestination: "S\xE9lectionnez une destination",
|
|
1295
|
+
ctaWithdraw: "Retirer",
|
|
1296
|
+
errorGeneric: "Le retrait a \xE9chou\xE9. Veuillez r\xE9essayer.",
|
|
1297
|
+
errorInsufficientGas: "Gas insuffisant pour cette transaction.",
|
|
1298
|
+
errorSwitchChain: "Impossible de changer de r\xE9seau. Assurez-vous que votre portefeuille prend en charge le r\xE9seau.",
|
|
1299
|
+
failedMessage: "{{amount}} n'est pas parvenu au destinataire. Contactez le support si les fonds ne reviennent pas.",
|
|
1300
|
+
failedTitle: "Le retrait n'a pas abouti",
|
|
1301
|
+
max: "Max",
|
|
1302
|
+
maxSlippage: "Slippage max.",
|
|
1171
1303
|
methodSubtitle: "Aucune limite",
|
|
1172
1304
|
methodTitle: "Adresse crypto",
|
|
1173
|
-
|
|
1305
|
+
networkCost: "Frais de r\xE9seau",
|
|
1306
|
+
priceImpact: "Impact sur le prix",
|
|
1307
|
+
quoteFailed: "\xC9chec de la g\xE9n\xE9ration de la cotation. Veuillez r\xE9essayer.",
|
|
1308
|
+
receiveAs: "Recevoir en",
|
|
1309
|
+
refundedMessage: "{{amount}} a \xE9t\xE9 renvoy\xE9 vers votre portefeuille.",
|
|
1310
|
+
riskyAddress: "Cette adresse de portefeuille ne peut pas \xEAtre utilis\xE9e en raison de restrictions.",
|
|
1311
|
+
selectDestination: "Recevoir en",
|
|
1312
|
+
sendTo: "Envoyer \xE0",
|
|
1313
|
+
successMessage: "{{amount}} est en route.",
|
|
1314
|
+
successPendingMessage: "{{amount}} est en cours de r\xE8glement on-chain. Vous pouvez fermer.",
|
|
1315
|
+
successPendingTitle: "Retrait envoy\xE9",
|
|
1316
|
+
successTitle: "Retrait termin\xE9",
|
|
1317
|
+
title: "Retirer des cryptos",
|
|
1318
|
+
unsupportedRecipient: "Adresse du destinataire non prise en charge",
|
|
1319
|
+
useMyWallet: "Utiliser mon portefeuille",
|
|
1320
|
+
youReceive: "Vous recevez"
|
|
1174
1321
|
}
|
|
1175
1322
|
};
|
|
1176
1323
|
|
|
@@ -1193,6 +1340,7 @@ var ja_default = {
|
|
|
1193
1340
|
copy: "\u30B3\u30D4\u30FC",
|
|
1194
1341
|
copyAddress: "\u30A2\u30C9\u30EC\u30B9\u3092\u30B3\u30D4\u30FC",
|
|
1195
1342
|
done: "\u5B8C\u4E86",
|
|
1343
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D\u2026",
|
|
1196
1344
|
tryAgain: "\u518D\u8A66\u884C"
|
|
1197
1345
|
},
|
|
1198
1346
|
fops: {
|
|
@@ -1242,9 +1390,42 @@ var ja_default = {
|
|
|
1242
1390
|
unavailableTitle: "\u51FA\u91D1\u306F\u3054\u5229\u7528\u3044\u305F\u3060\u3051\u307E\u305B\u3093"
|
|
1243
1391
|
},
|
|
1244
1392
|
withdrawCrypto: {
|
|
1393
|
+
aboveBalance: "\u6B8B\u9AD8\u4E0D\u8DB3",
|
|
1394
|
+
addressPlaceholder: "\u30A6\u30A9\u30EC\u30C3\u30C8\u30A2\u30C9\u30EC\u30B9",
|
|
1395
|
+
available: "\u5229\u7528\u53EF\u80FD: {{amount}} {{symbol}}",
|
|
1396
|
+
belowMinimum: "\u6700\u5C0F\u91D1\u984D\u306F{{amount}}\u3067\u3059",
|
|
1397
|
+
ctaEnterAmount: "\u91D1\u984D\u3092\u5165\u529B",
|
|
1398
|
+
ctaEnterRecipient: "\u30A6\u30A9\u30EC\u30C3\u30C8\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B",
|
|
1399
|
+
ctaInvalidForChain: "\u3053\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u3067\u306F\u7121\u52B9\u306A\u30A2\u30C9\u30EC\u30B9\u3067\u3059",
|
|
1400
|
+
ctaMaxExceeded: "\u4E0A\u9650\u91D1\u984D\u3092\u8D85\u3048\u3066\u3044\u307E\u3059",
|
|
1401
|
+
ctaRecipientSameAsSource: "\u5225\u306E\u30A2\u30C9\u30EC\u30B9\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
1402
|
+
ctaSelectDestination: "\u9001\u91D1\u5148\u3092\u9078\u629E",
|
|
1403
|
+
ctaWithdraw: "\u51FA\u91D1",
|
|
1404
|
+
errorGeneric: "\u51FA\u91D1\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
1405
|
+
errorInsufficientGas: "\u30AC\u30B9\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u307E\u3059\u3002",
|
|
1406
|
+
errorSwitchChain: "\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u3092\u5207\u308A\u66FF\u3048\u3089\u308C\u307E\u305B\u3093\u3002\u30A6\u30A9\u30EC\u30C3\u30C8\u304C\u305D\u306E\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u306B\u5BFE\u5FDC\u3057\u3066\u3044\u308B\u304B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
1407
|
+
failedMessage: "{{amount}} \u306F\u53D7\u53D6\u4EBA\u306B\u5C4A\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u8CC7\u91D1\u304C\u623B\u3089\u306A\u3044\u5834\u5408\u306F\u30B5\u30DD\u30FC\u30C8\u306B\u3054\u9023\u7D61\u304F\u3060\u3055\u3044\u3002",
|
|
1408
|
+
failedTitle: "\u51FA\u91D1\u304C\u5B8C\u4E86\u3057\u307E\u305B\u3093\u3067\u3057\u305F",
|
|
1409
|
+
max: "\u6700\u5927",
|
|
1410
|
+
maxSlippage: "\u6700\u5927\u30B9\u30EA\u30C3\u30DA\u30FC\u30B8",
|
|
1245
1411
|
methodSubtitle: "\u4E0A\u9650\u306A\u3057",
|
|
1246
1412
|
methodTitle: "\u6697\u53F7\u8CC7\u7523\u30A2\u30C9\u30EC\u30B9",
|
|
1247
|
-
|
|
1413
|
+
networkCost: "\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u624B\u6570\u6599",
|
|
1414
|
+
priceImpact: "\u4FA1\u683C\u30A4\u30F3\u30D1\u30AF\u30C8",
|
|
1415
|
+
quoteFailed: "\u30B9\u30EF\u30C3\u30D7\u898B\u7A4D\u3082\u308A\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
|
|
1416
|
+
receiveAs: "\u53D7\u53D6\u901A\u8CA8",
|
|
1417
|
+
refundedMessage: "{{amount}} \u306F\u30A6\u30A9\u30EC\u30C3\u30C8\u306B\u8FD4\u91D1\u3055\u308C\u307E\u3057\u305F\u3002",
|
|
1418
|
+
riskyAddress: "\u5236\u9650\u306B\u3088\u308A\u3001\u3053\u306E\u30A6\u30A9\u30EC\u30C3\u30C8\u30A2\u30C9\u30EC\u30B9\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002",
|
|
1419
|
+
selectDestination: "\u53D7\u53D6\u901A\u8CA8",
|
|
1420
|
+
sendTo: "\u9001\u91D1\u5148",
|
|
1421
|
+
successMessage: "{{amount}} \u3092\u9001\u91D1\u3057\u307E\u3057\u305F\u3002",
|
|
1422
|
+
successPendingMessage: "{{amount}} \u306F\u30AA\u30F3\u30C1\u30A7\u30FC\u30F3\u3067\u51E6\u7406\u4E2D\u3067\u3059\u3002\u9589\u3058\u3066\u3082\u554F\u984C\u3042\u308A\u307E\u305B\u3093\u3002",
|
|
1423
|
+
successPendingTitle: "\u51FA\u91D1\u3092\u9001\u4FE1\u3057\u307E\u3057\u305F",
|
|
1424
|
+
successTitle: "\u51FA\u91D1\u5B8C\u4E86",
|
|
1425
|
+
title: "\u6697\u53F7\u8CC7\u7523\u3092\u51FA\u91D1",
|
|
1426
|
+
unsupportedRecipient: "\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u53D7\u53D6\u30A2\u30C9\u30EC\u30B9",
|
|
1427
|
+
useMyWallet: "\u81EA\u5206\u306E\u30A6\u30A9\u30EC\u30C3\u30C8\u3092\u4F7F\u7528",
|
|
1428
|
+
youReceive: "\u53D7\u53D6\u984D"
|
|
1248
1429
|
}
|
|
1249
1430
|
};
|
|
1250
1431
|
|
|
@@ -1267,6 +1448,7 @@ var ko_default = {
|
|
|
1267
1448
|
copy: "\uBCF5\uC0AC",
|
|
1268
1449
|
copyAddress: "\uC8FC\uC18C \uBCF5\uC0AC",
|
|
1269
1450
|
done: "\uC644\uB8CC",
|
|
1451
|
+
loading: "\uBD88\uB7EC\uC624\uB294 \uC911\u2026",
|
|
1270
1452
|
tryAgain: "\uB2E4\uC2DC \uC2DC\uB3C4"
|
|
1271
1453
|
},
|
|
1272
1454
|
fops: {
|
|
@@ -1316,9 +1498,42 @@ var ko_default = {
|
|
|
1316
1498
|
unavailableTitle: "\uCD9C\uAE08 \uBD88\uAC00"
|
|
1317
1499
|
},
|
|
1318
1500
|
withdrawCrypto: {
|
|
1501
|
+
aboveBalance: "\uC794\uC561 \uBD80\uC871",
|
|
1502
|
+
addressPlaceholder: "\uC9C0\uAC11 \uC8FC\uC18C",
|
|
1503
|
+
available: "{{amount}} {{symbol}} \uC0AC\uC6A9 \uAC00\uB2A5",
|
|
1504
|
+
belowMinimum: "\uCD5C\uC18C \uAE08\uC561\uC740 {{amount}}\uC785\uB2C8\uB2E4",
|
|
1505
|
+
ctaEnterAmount: "\uAE08\uC561\uC744 \uC785\uB825\uD558\uC138\uC694",
|
|
1506
|
+
ctaEnterRecipient: "\uC9C0\uAC11 \uC8FC\uC18C\uB97C \uC785\uB825\uD558\uC138\uC694",
|
|
1507
|
+
ctaInvalidForChain: "\uC774 \uB124\uD2B8\uC6CC\uD06C\uC5D0\uC11C \uC720\uD6A8\uD558\uC9C0 \uC54A\uC740 \uC8FC\uC18C\uC785\uB2C8\uB2E4",
|
|
1508
|
+
ctaMaxExceeded: "\uCD5C\uB300 \uAE08\uC561 \uCD08\uACFC",
|
|
1509
|
+
ctaRecipientSameAsSource: "\uB2E4\uB978 \uC8FC\uC18C\uB97C \uC120\uD0DD\uD558\uC138\uC694",
|
|
1510
|
+
ctaSelectDestination: "\uBC1B\uC744 \uB300\uC0C1\uC744 \uC120\uD0DD\uD558\uC138\uC694",
|
|
1511
|
+
ctaWithdraw: "\uCD9C\uAE08",
|
|
1512
|
+
errorGeneric: "\uCD9C\uAE08\uC5D0 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.",
|
|
1513
|
+
errorInsufficientGas: "\uAC00\uC2A4\uAC00 \uBD80\uC871\uD569\uB2C8\uB2E4.",
|
|
1514
|
+
errorSwitchChain: "\uB124\uD2B8\uC6CC\uD06C\uB97C \uC804\uD658\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC9C0\uAC11\uC774 \uD574\uB2F9 \uB124\uD2B8\uC6CC\uD06C\uB97C \uC9C0\uC6D0\uD558\uB294\uC9C0 \uD655\uC778\uD574 \uC8FC\uC138\uC694.",
|
|
1515
|
+
failedMessage: "{{amount}}\uC774(\uAC00) \uC218\uCDE8\uC778\uC5D0\uAC8C \uB3C4\uB2EC\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uC790\uAE08\uC774 \uB3CC\uC544\uC624\uC9C0 \uC54A\uC73C\uBA74 \uACE0\uAC1D\uC9C0\uC6D0\uC5D0 \uBB38\uC758\uD558\uC138\uC694.",
|
|
1516
|
+
failedTitle: "\uCD9C\uAE08\uC774 \uC644\uB8CC\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4",
|
|
1517
|
+
max: "\uCD5C\uB300",
|
|
1518
|
+
maxSlippage: "\uCD5C\uB300 \uC2AC\uB9AC\uD53C\uC9C0",
|
|
1319
1519
|
methodSubtitle: "\uD55C\uB3C4 \uC5C6\uC74C",
|
|
1320
1520
|
methodTitle: "\uC554\uD638\uD654\uD3D0 \uC8FC\uC18C",
|
|
1321
|
-
|
|
1521
|
+
networkCost: "\uB124\uD2B8\uC6CC\uD06C \uC218\uC218\uB8CC",
|
|
1522
|
+
priceImpact: "\uAC00\uACA9 \uC601\uD5A5",
|
|
1523
|
+
quoteFailed: "\uC2A4\uC651 \uACAC\uC801\uC744 \uAC00\uC838\uC624\uB294 \uB370 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.",
|
|
1524
|
+
receiveAs: "\uBC1B\uC744 \uC790\uC0B0",
|
|
1525
|
+
refundedMessage: "{{amount}}\uC774(\uAC00) \uC9C0\uAC11\uC73C\uB85C \uBC18\uD658\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
1526
|
+
riskyAddress: "\uC81C\uD55C\uC73C\uB85C \uC778\uD574 \uC774 \uC9C0\uAC11 \uC8FC\uC18C\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
1527
|
+
selectDestination: "\uBC1B\uC744 \uC790\uC0B0",
|
|
1528
|
+
sendTo: "\uBC1B\uB294 \uC8FC\uC18C",
|
|
1529
|
+
successMessage: "{{amount}} \uC804\uC1A1\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.",
|
|
1530
|
+
successPendingMessage: "{{amount}} \uC740(\uB294) \uC628\uCCB4\uC778\uC5D0\uC11C \uCC98\uB9AC \uC911\uC785\uB2C8\uB2E4. \uB2EB\uC73C\uC154\uB3C4 \uB429\uB2C8\uB2E4.",
|
|
1531
|
+
successPendingTitle: "\uCD9C\uAE08 \uC804\uC1A1\uB428",
|
|
1532
|
+
successTitle: "\uCD9C\uAE08 \uC644\uB8CC",
|
|
1533
|
+
title: "\uC554\uD638\uD654\uD3D0 \uCD9C\uAE08",
|
|
1534
|
+
unsupportedRecipient: "\uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 \uC218\uC2E0\uC790 \uC8FC\uC18C",
|
|
1535
|
+
useMyWallet: "\uB0B4 \uC9C0\uAC11 \uC0AC\uC6A9",
|
|
1536
|
+
youReceive: "\uBC1B\uB294 \uAE08\uC561"
|
|
1322
1537
|
}
|
|
1323
1538
|
};
|
|
1324
1539
|
|
|
@@ -1341,6 +1556,7 @@ var ru_default = {
|
|
|
1341
1556
|
copy: "\u041A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",
|
|
1342
1557
|
copyAddress: "\u0421\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C \u0430\u0434\u0440\u0435\u0441",
|
|
1343
1558
|
done: "\u0413\u043E\u0442\u043E\u0432\u043E",
|
|
1559
|
+
loading: "\u0417\u0430\u0433\u0440\u0443\u0437\u043A\u0430\u2026",
|
|
1344
1560
|
tryAgain: "\u041F\u043E\u043F\u0440\u043E\u0431\u043E\u0432\u0430\u0442\u044C \u0441\u043D\u043E\u0432\u0430"
|
|
1345
1561
|
},
|
|
1346
1562
|
fops: {
|
|
@@ -1390,9 +1606,42 @@ var ru_default = {
|
|
|
1390
1606
|
unavailableTitle: "\u0412\u044B\u0432\u043E\u0434 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D"
|
|
1391
1607
|
},
|
|
1392
1608
|
withdrawCrypto: {
|
|
1609
|
+
aboveBalance: "\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u0441\u0440\u0435\u0434\u0441\u0442\u0432",
|
|
1610
|
+
addressPlaceholder: "\u0410\u0434\u0440\u0435\u0441 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430",
|
|
1611
|
+
available: "\u0414\u043E\u0441\u0442\u0443\u043F\u043D\u043E: {{amount}} {{symbol}}",
|
|
1612
|
+
belowMinimum: "\u041C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u0443\u043C\u043C\u0430 \u0441\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442 {{amount}}",
|
|
1613
|
+
ctaEnterAmount: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0441\u0443\u043C\u043C\u0443",
|
|
1614
|
+
ctaEnterRecipient: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0430\u0434\u0440\u0435\u0441 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430",
|
|
1615
|
+
ctaInvalidForChain: "\u0410\u0434\u0440\u0435\u0441 \u043D\u0435\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043B\u0435\u043D \u0434\u043B\u044F \u044D\u0442\u043E\u0439 \u0441\u0435\u0442\u0438",
|
|
1616
|
+
ctaMaxExceeded: "\u041F\u0440\u0435\u0432\u044B\u0448\u0435\u043D\u0430 \u043C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u0430\u044F \u0441\u0443\u043C\u043C\u0430",
|
|
1617
|
+
ctaRecipientSameAsSource: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0440\u0443\u0433\u043E\u0439 \u0430\u0434\u0440\u0435\u0441",
|
|
1618
|
+
ctaSelectDestination: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F",
|
|
1619
|
+
ctaWithdraw: "\u0412\u044B\u0432\u0435\u0441\u0442\u0438",
|
|
1620
|
+
errorGeneric: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u0432\u044B\u043F\u043E\u043B\u043D\u0438\u0442\u044C \u0432\u044B\u0432\u043E\u0434. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.",
|
|
1621
|
+
errorInsufficientGas: "\u041D\u0435\u0434\u043E\u0441\u0442\u0430\u0442\u043E\u0447\u043D\u043E \u0433\u0430\u0437\u0430 \u0434\u043B\u044F \u044D\u0442\u043E\u0439 \u0442\u0440\u0430\u043D\u0437\u0430\u043A\u0446\u0438\u0438",
|
|
1622
|
+
errorSwitchChain: "\u041D\u0435 \u0443\u0434\u0430\u0451\u0442\u0441\u044F \u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u0441\u0435\u0442\u0438. \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044C, \u0447\u0442\u043E \u0432\u0430\u0448 \u043A\u043E\u0448\u0435\u043B\u0451\u043A \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u044D\u0442\u0443 \u0441\u0435\u0442\u044C.",
|
|
1623
|
+
failedMessage: "{{amount}} \u043D\u0435 \u0434\u043E\u0448\u043B\u0438 \u0434\u043E \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F. \u0421\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043F\u043E\u0434\u0434\u0435\u0440\u0436\u043A\u043E\u0439, \u0435\u0441\u043B\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430 \u043D\u0435 \u0432\u0435\u0440\u043D\u0443\u0442\u0441\u044F.",
|
|
1624
|
+
failedTitle: "\u0412\u044B\u0432\u043E\u0434 \u043D\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D",
|
|
1625
|
+
max: "\u041C\u0430\u043A\u0441.",
|
|
1626
|
+
maxSlippage: "\u041C\u0430\u043A\u0441. \u0441\u043B\u0438\u043F\u043F\u0435\u0434\u0436",
|
|
1393
1627
|
methodSubtitle: "\u0411\u0435\u0437 \u043B\u0438\u043C\u0438\u0442\u0430",
|
|
1394
1628
|
methodTitle: "\u041A\u0440\u0438\u043F\u0442\u043E-\u0430\u0434\u0440\u0435\u0441",
|
|
1395
|
-
|
|
1629
|
+
networkCost: "\u0421\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C \u0441\u0435\u0442\u0438",
|
|
1630
|
+
priceImpact: "\u0412\u043B\u0438\u044F\u043D\u0438\u0435 \u043D\u0430 \u0446\u0435\u043D\u0443",
|
|
1631
|
+
quoteFailed: "\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u043A\u043E\u0442\u0438\u0440\u043E\u0432\u043A\u0443 \u043E\u0431\u043C\u0435\u043D\u0430. \u041F\u043E\u0436\u0430\u043B\u0443\u0439\u0441\u0442\u0430, \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.",
|
|
1632
|
+
receiveAs: "\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0432",
|
|
1633
|
+
refundedMessage: "{{amount}} \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0435\u043D\u044B \u0432 \u0432\u0430\u0448 \u043A\u043E\u0448\u0435\u043B\u0451\u043A.",
|
|
1634
|
+
riskyAddress: "\u042D\u0442\u043E\u0442 \u0430\u0434\u0440\u0435\u0441 \u043A\u043E\u0448\u0435\u043B\u044C\u043A\u0430 \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u0431\u044B\u0442\u044C \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D \u0438\u0437-\u0437\u0430 \u043E\u0433\u0440\u0430\u043D\u0438\u0447\u0435\u043D\u0438\u0439.",
|
|
1635
|
+
selectDestination: "\u041F\u043E\u043B\u0443\u0447\u0438\u0442\u044C \u0432",
|
|
1636
|
+
sendTo: "\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u043D\u0430",
|
|
1637
|
+
successMessage: "{{amount}} \u0443\u0436\u0435 \u0432 \u043F\u0443\u0442\u0438.",
|
|
1638
|
+
successPendingMessage: "{{amount}} \u043E\u0431\u0440\u0430\u0431\u0430\u0442\u044B\u0432\u0430\u0435\u0442\u0441\u044F \u0432 \u0441\u0435\u0442\u0438. \u041C\u043E\u0436\u043D\u043E \u0437\u0430\u043A\u0440\u044B\u0442\u044C \u044D\u0442\u043E \u043E\u043A\u043D\u043E.",
|
|
1639
|
+
successPendingTitle: "\u0412\u044B\u0432\u043E\u0434 \u043E\u0442\u043F\u0440\u0430\u0432\u043B\u0435\u043D",
|
|
1640
|
+
successTitle: "\u0412\u044B\u0432\u043E\u0434 \u0437\u0430\u0432\u0435\u0440\u0448\u0451\u043D",
|
|
1641
|
+
title: "\u0412\u044B\u0432\u043E\u0434 \u043A\u0440\u0438\u043F\u0442\u043E\u0432\u0430\u043B\u044E\u0442\u044B",
|
|
1642
|
+
unsupportedRecipient: "\u041D\u0435\u043F\u043E\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043C\u044B\u0439 \u0430\u0434\u0440\u0435\u0441 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u0435\u043B\u044F",
|
|
1643
|
+
useMyWallet: "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043C\u043E\u0439 \u043A\u043E\u0448\u0435\u043B\u0451\u043A",
|
|
1644
|
+
youReceive: "\u0412\u044B \u043F\u043E\u043B\u0443\u0447\u0438\u0442\u0435"
|
|
1396
1645
|
}
|
|
1397
1646
|
};
|
|
1398
1647
|
|
|
@@ -1415,6 +1664,7 @@ var tr_default = {
|
|
|
1415
1664
|
copy: "Kopyala",
|
|
1416
1665
|
copyAddress: "Adresi kopyala",
|
|
1417
1666
|
done: "Tamam",
|
|
1667
|
+
loading: "Y\xFCkleniyor\u2026",
|
|
1418
1668
|
tryAgain: "Tekrar dene"
|
|
1419
1669
|
},
|
|
1420
1670
|
fops: {
|
|
@@ -1464,9 +1714,42 @@ var tr_default = {
|
|
|
1464
1714
|
unavailableTitle: "\xC7ekimler kullan\u0131lam\u0131yor"
|
|
1465
1715
|
},
|
|
1466
1716
|
withdrawCrypto: {
|
|
1717
|
+
aboveBalance: "Yetersiz bakiye",
|
|
1718
|
+
addressPlaceholder: "C\xFCzdan adresi",
|
|
1719
|
+
available: "{{amount}} {{symbol}} kullan\u0131labilir",
|
|
1720
|
+
belowMinimum: "Minimum Tutar: {{amount}}",
|
|
1721
|
+
ctaEnterAmount: "Bir tutar girin",
|
|
1722
|
+
ctaEnterRecipient: "C\xFCzdan adresi girin",
|
|
1723
|
+
ctaInvalidForChain: "Adres bu a\u011F i\xE7in ge\xE7erli de\u011Fil",
|
|
1724
|
+
ctaMaxExceeded: "Maksimum tutar a\u015F\u0131ld\u0131",
|
|
1725
|
+
ctaRecipientSameAsSource: "Farkl\u0131 bir adres se\xE7in",
|
|
1726
|
+
ctaSelectDestination: "Bir hedef se\xE7in",
|
|
1727
|
+
ctaWithdraw: "\xC7ek",
|
|
1728
|
+
errorGeneric: "Para \xE7ekme ba\u015Far\u0131s\u0131z oldu. L\xFCtfen tekrar deneyin.",
|
|
1729
|
+
errorInsufficientGas: "Bu i\u015Flem i\xE7in yeterli gaz yok.",
|
|
1730
|
+
errorSwitchChain: "A\u011F de\u011Fi\u015Ftirilemiyor. L\xFCtfen c\xFCzdan\u0131n\u0131z\u0131n a\u011F\u0131 destekledi\u011Finden emin olun.",
|
|
1731
|
+
failedMessage: "{{amount}} al\u0131c\u0131ya ula\u015Fmad\u0131. Fonlar geri gelmezse destek ekibiyle ileti\u015Fime ge\xE7in.",
|
|
1732
|
+
failedTitle: "Para \xE7ekme tamamlanmad\u0131",
|
|
1733
|
+
max: "Maks.",
|
|
1734
|
+
maxSlippage: "Maks. kayma",
|
|
1467
1735
|
methodSubtitle: "Limit yok",
|
|
1468
1736
|
methodTitle: "Kripto adresi",
|
|
1469
|
-
|
|
1737
|
+
networkCost: "A\u011F \xFCcreti",
|
|
1738
|
+
priceImpact: "Fiyat etkisi",
|
|
1739
|
+
quoteFailed: "Takas teklifi al\u0131n\u0131rken hata olu\u015Ftu. L\xFCtfen tekrar deneyin.",
|
|
1740
|
+
receiveAs: "\u015Eu \u015Fekilde al",
|
|
1741
|
+
refundedMessage: "{{amount}} c\xFCzdan\u0131n\u0131za geri g\xF6nderildi.",
|
|
1742
|
+
riskyAddress: "Bu c\xFCzdan adresi k\u0131s\u0131tlamalar nedeniyle kullan\u0131lamaz.",
|
|
1743
|
+
selectDestination: "\u015Eu \u015Fekilde al",
|
|
1744
|
+
sendTo: "G\xF6nderilecek adres",
|
|
1745
|
+
successMessage: "{{amount}} yolda.",
|
|
1746
|
+
successPendingMessage: "{{amount}} zincir \xFCzerinde i\u015Fleniyor. Bu ekran\u0131 kapatabilirsiniz.",
|
|
1747
|
+
successPendingTitle: "\xC7ekim g\xF6nderildi",
|
|
1748
|
+
successTitle: "\xC7ekim tamamland\u0131",
|
|
1749
|
+
title: "Kripto \xE7ek",
|
|
1750
|
+
unsupportedRecipient: "Desteklenmeyen al\u0131c\u0131 adresi",
|
|
1751
|
+
useMyWallet: "C\xFCzdan\u0131m\u0131 kullan",
|
|
1752
|
+
youReceive: "Alaca\u011F\u0131n\u0131z"
|
|
1470
1753
|
}
|
|
1471
1754
|
};
|
|
1472
1755
|
|
|
@@ -1489,6 +1772,7 @@ var zh_default = {
|
|
|
1489
1772
|
copy: "\u590D\u5236",
|
|
1490
1773
|
copyAddress: "\u590D\u5236\u5730\u5740",
|
|
1491
1774
|
done: "\u5B8C\u6210",
|
|
1775
|
+
loading: "\u52A0\u8F7D\u4E2D\u2026",
|
|
1492
1776
|
tryAgain: "\u91CD\u8BD5"
|
|
1493
1777
|
},
|
|
1494
1778
|
fops: {
|
|
@@ -1538,9 +1822,42 @@ var zh_default = {
|
|
|
1538
1822
|
unavailableTitle: "\u63D0\u6B3E\u4E0D\u53EF\u7528"
|
|
1539
1823
|
},
|
|
1540
1824
|
withdrawCrypto: {
|
|
1825
|
+
aboveBalance: "\u4F59\u989D\u4E0D\u8DB3",
|
|
1826
|
+
addressPlaceholder: "\u94B1\u5305\u5730\u5740",
|
|
1827
|
+
available: "\u53EF\u7528 {{amount}} {{symbol}}",
|
|
1828
|
+
belowMinimum: "\u6700\u4F4E\u91D1\u989D\u4E3A {{amount}}",
|
|
1829
|
+
ctaEnterAmount: "\u8BF7\u8F93\u5165\u91D1\u989D",
|
|
1830
|
+
ctaEnterRecipient: "\u8BF7\u8F93\u5165\u94B1\u5305\u5730\u5740",
|
|
1831
|
+
ctaInvalidForChain: "\u8BE5\u5730\u5740\u5728\u6B64\u7F51\u7EDC\u4E0A\u65E0\u6548",
|
|
1832
|
+
ctaMaxExceeded: "\u8D85\u51FA\u6700\u5927\u91D1\u989D",
|
|
1833
|
+
ctaRecipientSameAsSource: "\u8BF7\u9009\u62E9\u5176\u4ED6\u5730\u5740",
|
|
1834
|
+
ctaSelectDestination: "\u8BF7\u9009\u62E9\u76EE\u6807",
|
|
1835
|
+
ctaWithdraw: "\u63D0\u53D6",
|
|
1836
|
+
errorGeneric: "\u63D0\u73B0\u5931\u8D25\u3002\u8BF7\u91CD\u8BD5\u3002",
|
|
1837
|
+
errorInsufficientGas: "\u71C3\u6599\u4E0D\u8DB3\uFF0C\u65E0\u6CD5\u5B8C\u6210\u6B64\u4EA4\u6613\u3002",
|
|
1838
|
+
errorSwitchChain: "\u65E0\u6CD5\u5207\u6362\u7F51\u7EDC\u3002\u8BF7\u786E\u4FDD\u60A8\u7684\u94B1\u5305\u652F\u6301\u8BE5\u7F51\u7EDC\u3002",
|
|
1839
|
+
failedMessage: "{{amount}} \u672A\u9001\u8FBE\u6536\u6B3E\u65B9\u3002\u82E5\u8D44\u91D1\u672A\u9000\u56DE\uFF0C\u8BF7\u8054\u7CFB\u5BA2\u670D\u3002",
|
|
1840
|
+
failedTitle: "\u63D0\u73B0\u672A\u5B8C\u6210",
|
|
1841
|
+
max: "\u6700\u5927",
|
|
1842
|
+
maxSlippage: "\u6700\u5927\u6ED1\u70B9",
|
|
1541
1843
|
methodSubtitle: "\u65E0\u9650\u989D",
|
|
1542
1844
|
methodTitle: "\u52A0\u5BC6\u8D27\u5E01\u5730\u5740",
|
|
1543
|
-
|
|
1845
|
+
networkCost: "\u7F51\u7EDC\u8D39\u7528",
|
|
1846
|
+
priceImpact: "\u4EF7\u683C\u5F71\u54CD",
|
|
1847
|
+
quoteFailed: "\u83B7\u53D6\u5151\u6362\u62A5\u4EF7\u5931\u8D25\u3002\u8BF7\u91CD\u8BD5\u3002",
|
|
1848
|
+
receiveAs: "\u63A5\u6536\u5E01\u79CD",
|
|
1849
|
+
refundedMessage: "{{amount}} \u5DF2\u9000\u56DE\u60A8\u7684\u94B1\u5305\u3002",
|
|
1850
|
+
riskyAddress: "\u7531\u4E8E\u9650\u5236\uFF0C\u6B64\u94B1\u5305\u5730\u5740\u65E0\u6CD5\u4F7F\u7528\u3002",
|
|
1851
|
+
selectDestination: "\u63A5\u6536\u5E01\u79CD",
|
|
1852
|
+
sendTo: "\u8F6C\u8D26\u81F3",
|
|
1853
|
+
successMessage: "{{amount}} \u5DF2\u5728\u9014\u4E2D\u3002",
|
|
1854
|
+
successPendingMessage: "{{amount}} \u6B63\u5728\u94FE\u4E0A\u7ED3\u7B97\u3002\u4F60\u53EF\u4EE5\u5173\u95ED\u6B64\u9875\u9762\u3002",
|
|
1855
|
+
successPendingTitle: "\u63D0\u6B3E\u5DF2\u53D1\u9001",
|
|
1856
|
+
successTitle: "\u63D0\u6B3E\u5B8C\u6210",
|
|
1857
|
+
title: "\u63D0\u53D6\u52A0\u5BC6\u8D27\u5E01",
|
|
1858
|
+
unsupportedRecipient: "\u4E0D\u652F\u6301\u7684\u63A5\u6536\u5730\u5740",
|
|
1859
|
+
useMyWallet: "\u4F7F\u7528\u6211\u7684\u94B1\u5305",
|
|
1860
|
+
youReceive: "\u4F60\u5C06\u6536\u5230"
|
|
1544
1861
|
}
|
|
1545
1862
|
};
|
|
1546
1863
|
|
|
@@ -3732,126 +4049,1570 @@ var styles8 = StyleSheet8.create({
|
|
|
3732
4049
|
pillButton: { height: 56, paddingHorizontal: 24, gap: 8 }
|
|
3733
4050
|
});
|
|
3734
4051
|
|
|
3735
|
-
// src/screens/
|
|
4052
|
+
// src/screens/WithdrawCryptoForm.tsx
|
|
4053
|
+
import {
|
|
4054
|
+
useDebouncedValue,
|
|
4055
|
+
useEffectEvent as useEffectEvent2
|
|
4056
|
+
} from "@funkit/connect-core";
|
|
4057
|
+
import { useEffect as useEffect8, useRef as useRef6, useState as useState12 } from "react";
|
|
4058
|
+
|
|
4059
|
+
// src/components/AmountInput.tsx
|
|
4060
|
+
import { BottomSheetTextInput } from "@gorhom/bottom-sheet";
|
|
3736
4061
|
import { Pressable as Pressable7, StyleSheet as StyleSheet9 } from "react-native";
|
|
3737
4062
|
import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3738
|
-
function
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
|
|
3742
|
-
|
|
4063
|
+
function sanitizeDecimalInput(raw) {
|
|
4064
|
+
const cleaned = raw.replace(/[^0-9.,]/g, "");
|
|
4065
|
+
const groups = cleaned.split(/[.,]/);
|
|
4066
|
+
if (groups.length === 1) return groups[0];
|
|
4067
|
+
if (groups.length === 2) return `${groups[0]}.${groups[1]}`;
|
|
4068
|
+
if (!groups.slice(1, -1).every((group) => group.length === 3)) {
|
|
4069
|
+
return `${groups[0]}.${groups.slice(1).join("")}`;
|
|
4070
|
+
}
|
|
4071
|
+
const separators = cleaned.match(/[.,]/g) ?? [];
|
|
4072
|
+
const last = groups[groups.length - 1];
|
|
4073
|
+
const isTrailingGroup = last.length === 3 && separators.every((s) => s === separators[0]);
|
|
4074
|
+
return isTrailingGroup ? groups.join("") : `${groups.slice(0, -1).join("")}.${last}`;
|
|
4075
|
+
}
|
|
4076
|
+
var AMOUNT_LINE_HEIGHT = 58;
|
|
4077
|
+
function AmountInput({
|
|
4078
|
+
value,
|
|
4079
|
+
onChangeValue,
|
|
4080
|
+
tokenSymbol,
|
|
4081
|
+
balanceLabel,
|
|
4082
|
+
onPressMax,
|
|
4083
|
+
maxLabel,
|
|
4084
|
+
errorText: errorText2,
|
|
4085
|
+
autoFocus
|
|
3743
4086
|
}) {
|
|
3744
4087
|
const theme = useTheme();
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
4088
|
+
const amountColor = errorText2 ? theme.content.elements.error : theme.content.elements.primary;
|
|
4089
|
+
const footerText = errorText2 ?? balanceLabel;
|
|
4090
|
+
const footerColor = errorText2 ? theme.content.elements.error : theme.content.elements.secondary;
|
|
4091
|
+
return /* @__PURE__ */ jsxs10(Box, { alignItems: "center", style: styles9.root, children: [
|
|
4092
|
+
/* @__PURE__ */ jsxs10(Box, { flexDirection: "row", alignItems: "center", style: styles9.amountRow, children: [
|
|
4093
|
+
/* @__PURE__ */ jsx23(
|
|
4094
|
+
BottomSheetTextInput,
|
|
4095
|
+
{
|
|
4096
|
+
value,
|
|
4097
|
+
onChangeText: (raw) => onChangeValue(sanitizeDecimalInput(raw)),
|
|
4098
|
+
keyboardType: "decimal-pad",
|
|
4099
|
+
inputMode: "decimal",
|
|
4100
|
+
placeholder: "0",
|
|
4101
|
+
placeholderTextColor: theme.content.elements.secondary,
|
|
4102
|
+
autoFocus,
|
|
4103
|
+
accessibilityLabel: tokenSymbol,
|
|
4104
|
+
style: [
|
|
4105
|
+
styles9.amount,
|
|
4106
|
+
theme.textVariants.amountInput,
|
|
4107
|
+
{ color: amountColor, lineHeight: AMOUNT_LINE_HEIGHT }
|
|
4108
|
+
]
|
|
4109
|
+
}
|
|
4110
|
+
),
|
|
4111
|
+
/* @__PURE__ */ jsx23(
|
|
4112
|
+
Text,
|
|
4113
|
+
{
|
|
4114
|
+
variant: "amountInput",
|
|
4115
|
+
style: { color: amountColor, lineHeight: AMOUNT_LINE_HEIGHT },
|
|
4116
|
+
children: tokenSymbol
|
|
4117
|
+
}
|
|
4118
|
+
)
|
|
4119
|
+
] }),
|
|
4120
|
+
/* @__PURE__ */ jsxs10(Box, { flexDirection: "row", alignItems: "center", style: styles9.footer, children: [
|
|
4121
|
+
footerText ? /* @__PURE__ */ jsx23(Text, { variant: "detail", style: { color: footerColor }, children: footerText }) : null,
|
|
4122
|
+
onPressMax && maxLabel ? /* @__PURE__ */ jsx23(
|
|
4123
|
+
Pressable7,
|
|
4124
|
+
{
|
|
4125
|
+
onPress: onPressMax,
|
|
4126
|
+
accessibilityRole: "button",
|
|
4127
|
+
accessibilityLabel: maxLabel,
|
|
4128
|
+
children: /* @__PURE__ */ jsx23(
|
|
4129
|
+
Box,
|
|
3756
4130
|
{
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
4131
|
+
borderRadius: "button",
|
|
4132
|
+
style: [
|
|
4133
|
+
styles9.max,
|
|
4134
|
+
{ backgroundColor: theme.background.secondary }
|
|
4135
|
+
],
|
|
3761
4136
|
children: /* @__PURE__ */ jsx23(
|
|
3762
|
-
|
|
4137
|
+
Text,
|
|
3763
4138
|
{
|
|
3764
|
-
|
|
3765
|
-
|
|
4139
|
+
variant: "detail",
|
|
4140
|
+
weight: "medium",
|
|
4141
|
+
style: { color: theme.content.elements.primary },
|
|
4142
|
+
children: maxLabel
|
|
3766
4143
|
}
|
|
3767
4144
|
)
|
|
3768
4145
|
}
|
|
3769
|
-
)
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
}
|
|
3774
|
-
),
|
|
3775
|
-
/* @__PURE__ */ jsx23(Box, { style: styles9.body, children })
|
|
4146
|
+
)
|
|
4147
|
+
}
|
|
4148
|
+
) : null
|
|
4149
|
+
] })
|
|
3776
4150
|
] });
|
|
3777
4151
|
}
|
|
3778
4152
|
var styles9 = StyleSheet9.create({
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
4153
|
+
root: { gap: 8 },
|
|
4154
|
+
amountRow: { gap: 6 },
|
|
4155
|
+
// Strips the platform chrome so the input reads as text, not a form field.
|
|
4156
|
+
amount: {
|
|
4157
|
+
padding: 0,
|
|
4158
|
+
minWidth: 40,
|
|
4159
|
+
textAlign: "center",
|
|
4160
|
+
height: AMOUNT_LINE_HEIGHT
|
|
4161
|
+
},
|
|
4162
|
+
footer: { gap: 8 },
|
|
4163
|
+
max: { paddingHorizontal: 10, paddingVertical: 4 }
|
|
3783
4164
|
});
|
|
3784
4165
|
|
|
3785
|
-
// src/
|
|
3786
|
-
import {
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
4166
|
+
// src/components/RecipientAddressInput.tsx
|
|
4167
|
+
import { BottomSheetTextInput as BottomSheetTextInput2 } from "@gorhom/bottom-sheet";
|
|
4168
|
+
import { useState as useState9 } from "react";
|
|
4169
|
+
import { Pressable as Pressable8, StyleSheet as StyleSheet10 } from "react-native";
|
|
4170
|
+
import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
4171
|
+
function RecipientAddressInput({
|
|
4172
|
+
label,
|
|
4173
|
+
value,
|
|
4174
|
+
onChangeText,
|
|
4175
|
+
placeholder,
|
|
4176
|
+
onUseConnectedWallet,
|
|
4177
|
+
useConnectedWalletLabel,
|
|
4178
|
+
errorText: errorText2,
|
|
4179
|
+
warningText
|
|
4180
|
+
}) {
|
|
4181
|
+
const theme = useTheme();
|
|
4182
|
+
const [isFocused, setIsFocused] = useState9(false);
|
|
4183
|
+
const borderColor = resolveBorderColor({
|
|
4184
|
+
theme,
|
|
4185
|
+
hasError: !!errorText2,
|
|
4186
|
+
isFocused
|
|
4187
|
+
});
|
|
4188
|
+
const helperText = errorText2 ?? warningText;
|
|
4189
|
+
const helperColor = errorText2 ? theme.content.elements.error : theme.content.elements.warning;
|
|
4190
|
+
return /* @__PURE__ */ jsxs11(Box, { style: styles10.root, children: [
|
|
4191
|
+
/* @__PURE__ */ jsxs11(Box, { flexDirection: "row", alignItems: "center", style: styles10.header, children: [
|
|
4192
|
+
/* @__PURE__ */ jsx24(
|
|
4193
|
+
Text,
|
|
4194
|
+
{
|
|
4195
|
+
variant: "detail",
|
|
4196
|
+
style: [styles10.label, { color: theme.content.elements.secondary }],
|
|
4197
|
+
children: label
|
|
4198
|
+
}
|
|
4199
|
+
),
|
|
4200
|
+
onUseConnectedWallet && useConnectedWalletLabel ? /* @__PURE__ */ jsx24(
|
|
4201
|
+
Pressable8,
|
|
4202
|
+
{
|
|
4203
|
+
onPress: onUseConnectedWallet,
|
|
4204
|
+
accessibilityRole: "button",
|
|
4205
|
+
accessibilityLabel: useConnectedWalletLabel,
|
|
4206
|
+
children: /* @__PURE__ */ jsx24(
|
|
4207
|
+
Text,
|
|
4208
|
+
{
|
|
4209
|
+
variant: "detail",
|
|
4210
|
+
weight: "medium",
|
|
4211
|
+
style: { color: theme.content.elements.hyperlink },
|
|
4212
|
+
children: useConnectedWalletLabel
|
|
4213
|
+
}
|
|
4214
|
+
)
|
|
4215
|
+
}
|
|
4216
|
+
) : null
|
|
4217
|
+
] }),
|
|
4218
|
+
/* @__PURE__ */ jsx24(
|
|
4219
|
+
Box,
|
|
3819
4220
|
{
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
4221
|
+
borderRadius: "element",
|
|
4222
|
+
style: [
|
|
4223
|
+
styles10.field,
|
|
4224
|
+
{
|
|
4225
|
+
borderColor,
|
|
4226
|
+
borderWidth: theme.border.elements.default.weight,
|
|
4227
|
+
backgroundColor: theme.background.secondary
|
|
4228
|
+
}
|
|
4229
|
+
],
|
|
4230
|
+
children: /* @__PURE__ */ jsx24(
|
|
4231
|
+
BottomSheetTextInput2,
|
|
4232
|
+
{
|
|
4233
|
+
value,
|
|
4234
|
+
onChangeText,
|
|
4235
|
+
onFocus: () => setIsFocused(true),
|
|
4236
|
+
onBlur: () => setIsFocused(false),
|
|
4237
|
+
placeholder,
|
|
4238
|
+
placeholderTextColor: theme.content.elements.secondary,
|
|
4239
|
+
accessibilityLabel: label,
|
|
4240
|
+
multiline: true,
|
|
4241
|
+
autoCapitalize: "none",
|
|
4242
|
+
autoCorrect: false,
|
|
4243
|
+
spellCheck: false,
|
|
4244
|
+
style: [
|
|
4245
|
+
styles10.input,
|
|
4246
|
+
theme.textVariants.body,
|
|
4247
|
+
{ color: theme.content.elements.primary }
|
|
4248
|
+
]
|
|
4249
|
+
}
|
|
4250
|
+
)
|
|
3826
4251
|
}
|
|
3827
|
-
)
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
SelectMethodScreen,
|
|
3831
|
-
{
|
|
3832
|
-
title,
|
|
3833
|
-
methods,
|
|
3834
|
-
onSelectMethod,
|
|
3835
|
-
loading,
|
|
3836
|
-
error: hasError,
|
|
3837
|
-
onRetry,
|
|
3838
|
-
errorTitle: t("selectMethod.errorTitle"),
|
|
3839
|
-
errorMessage: t("selectMethod.errorMessage"),
|
|
3840
|
-
note
|
|
3841
|
-
}
|
|
3842
|
-
);
|
|
4252
|
+
),
|
|
4253
|
+
helperText ? /* @__PURE__ */ jsx24(Text, { variant: "detail", style: { color: helperColor }, children: helperText }) : null
|
|
4254
|
+
] });
|
|
3843
4255
|
}
|
|
4256
|
+
function resolveBorderColor({
|
|
4257
|
+
theme,
|
|
4258
|
+
hasError,
|
|
4259
|
+
isFocused
|
|
4260
|
+
}) {
|
|
4261
|
+
if (hasError) return theme.content.elements.error;
|
|
4262
|
+
if (isFocused) return theme.border.elements.selected.color;
|
|
4263
|
+
return theme.border.elements.default.color;
|
|
4264
|
+
}
|
|
4265
|
+
var styles10 = StyleSheet10.create({
|
|
4266
|
+
root: { gap: 8 },
|
|
4267
|
+
header: { justifyContent: "space-between" },
|
|
4268
|
+
label: { flexShrink: 1 },
|
|
4269
|
+
field: { paddingHorizontal: 12, paddingVertical: 10 },
|
|
4270
|
+
// Undo the platform's own padding so the box controls the spacing, and keep
|
|
4271
|
+
// a two-line minimum so a wrapped address doesn't resize the sheet.
|
|
4272
|
+
input: { padding: 0, minHeight: 44, textAlignVertical: "top" }
|
|
4273
|
+
});
|
|
3844
4274
|
|
|
3845
|
-
// src/
|
|
3846
|
-
import {
|
|
4275
|
+
// src/utils/chainDisplay.ts
|
|
4276
|
+
import { chainMetadataById } from "@funkit/chains";
|
|
4277
|
+
function chainIconUri2(chainId) {
|
|
4278
|
+
return chainMetadataById[chainId]?.iconUrl ?? FALLBACK_ASSET_LOGO;
|
|
4279
|
+
}
|
|
4280
|
+
function chainName(chainId) {
|
|
4281
|
+
return chainMetadataById[chainId]?.name;
|
|
4282
|
+
}
|
|
3847
4283
|
|
|
3848
|
-
// src/
|
|
3849
|
-
|
|
4284
|
+
// src/withdrawal/sourceToken.ts
|
|
4285
|
+
var NUMERIC_RE = /^\d*\.?\d+(e[+-]?\d+)?$/i;
|
|
4286
|
+
function resolveWithdrawalSourceTokens(config) {
|
|
4287
|
+
const options = config.sourceTokens ?? [];
|
|
4288
|
+
return options.length > 0 ? options : [{ token: config.sourceToken }];
|
|
4289
|
+
}
|
|
4290
|
+
function resolveWithdrawalSourceBalance(config, sourceToken) {
|
|
4291
|
+
const fn = config.withdrawalSourceTokenBalance;
|
|
4292
|
+
if (!fn) return void 0;
|
|
4293
|
+
let raw;
|
|
4294
|
+
try {
|
|
4295
|
+
raw = fn({ sourceToken });
|
|
4296
|
+
} catch (error) {
|
|
4297
|
+
logger.warn("connect-rn:withdrawal:sourceTokenBalanceThrew", {
|
|
4298
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4299
|
+
});
|
|
4300
|
+
return "0";
|
|
4301
|
+
}
|
|
4302
|
+
if (raw == null) return "0";
|
|
4303
|
+
const value = String(raw);
|
|
4304
|
+
if (!NUMERIC_RE.test(value) || !Number.isFinite(Number(value))) {
|
|
4305
|
+
logger.warn("connect-rn:withdrawal:invalidSourceTokenBalance", { raw });
|
|
4306
|
+
return "0";
|
|
4307
|
+
}
|
|
4308
|
+
return value;
|
|
4309
|
+
}
|
|
3850
4310
|
|
|
3851
|
-
// src/
|
|
3852
|
-
import {
|
|
3853
|
-
|
|
3854
|
-
|
|
4311
|
+
// src/withdrawal/useCryptoWithdrawalExecution.ts
|
|
4312
|
+
import {
|
|
4313
|
+
createWithdrawalSubmissionId,
|
|
4314
|
+
ensureRelayClientInitialized,
|
|
4315
|
+
isUserRejectedError,
|
|
4316
|
+
processCryptoWithdrawalOrder,
|
|
4317
|
+
toWithdrawalExecutionErrorCode
|
|
4318
|
+
} from "@funkit/connect-core";
|
|
4319
|
+
import { useCallback as useCallback2, useRef as useRef5, useState as useState10 } from "react";
|
|
4320
|
+
var inFlightWithdrawals = /* @__PURE__ */ new Set();
|
|
4321
|
+
function withdrawalKey({
|
|
4322
|
+
walletAddress,
|
|
4323
|
+
recipientAddress,
|
|
4324
|
+
amount,
|
|
4325
|
+
sourceToken,
|
|
4326
|
+
destinationToken
|
|
4327
|
+
}) {
|
|
4328
|
+
return [
|
|
4329
|
+
walletAddress,
|
|
4330
|
+
recipientAddress,
|
|
4331
|
+
amount,
|
|
4332
|
+
sourceToken.chainId,
|
|
4333
|
+
sourceToken.address,
|
|
4334
|
+
destinationToken.chainId,
|
|
4335
|
+
destinationToken.address
|
|
4336
|
+
].join("|").toLowerCase();
|
|
4337
|
+
}
|
|
4338
|
+
function useCryptoWithdrawalExecution({
|
|
4339
|
+
config,
|
|
4340
|
+
sourceToken,
|
|
4341
|
+
destinationToken,
|
|
4342
|
+
callbacks
|
|
4343
|
+
}) {
|
|
4344
|
+
const { apiKey, userId } = useFunkitIdentity();
|
|
4345
|
+
const isSubmittingRef = useRef5(false);
|
|
4346
|
+
const [submission, setSubmission] = useState10({
|
|
4347
|
+
status: "idle"
|
|
4348
|
+
});
|
|
4349
|
+
const submit = useCallback2(
|
|
4350
|
+
async ({
|
|
4351
|
+
quote,
|
|
4352
|
+
recipientAddress,
|
|
4353
|
+
amount
|
|
4354
|
+
}) => {
|
|
4355
|
+
if (isSubmittingRef.current) {
|
|
4356
|
+
logger.warn("connect-rn:crypto-withdrawal:already_submitting");
|
|
4357
|
+
return;
|
|
4358
|
+
}
|
|
4359
|
+
const key = withdrawalKey({
|
|
4360
|
+
walletAddress: config.withdrawalWallet.address(),
|
|
4361
|
+
recipientAddress,
|
|
4362
|
+
amount,
|
|
4363
|
+
sourceToken,
|
|
4364
|
+
destinationToken
|
|
4365
|
+
});
|
|
4366
|
+
if (inFlightWithdrawals.has(key)) {
|
|
4367
|
+
logger.warn("connect-rn:crypto-withdrawal:already_in_flight");
|
|
4368
|
+
return;
|
|
4369
|
+
}
|
|
4370
|
+
isSubmittingRef.current = true;
|
|
4371
|
+
inFlightWithdrawals.add(key);
|
|
4372
|
+
const order = {
|
|
4373
|
+
submissionId: createWithdrawalSubmissionId(),
|
|
4374
|
+
recipientAddress,
|
|
4375
|
+
sourceAmountHumanUnit: amount,
|
|
4376
|
+
sourceToken,
|
|
4377
|
+
destinationToken
|
|
4378
|
+
};
|
|
4379
|
+
setSubmission({ status: "submitting" });
|
|
4380
|
+
let txHash;
|
|
4381
|
+
try {
|
|
4382
|
+
ensureRelayClientInitialized(logger, "funkit-connect-rn");
|
|
4383
|
+
({ txHash } = await processCryptoWithdrawalOrder({
|
|
4384
|
+
order,
|
|
4385
|
+
quote,
|
|
4386
|
+
wallet: config.withdrawalWallet,
|
|
4387
|
+
apiKey,
|
|
4388
|
+
userId,
|
|
4389
|
+
logger,
|
|
4390
|
+
onStepMessage: (stepMessage) => setSubmission({ status: "submitting", stepMessage })
|
|
4391
|
+
}));
|
|
4392
|
+
} catch (error) {
|
|
4393
|
+
if (isUserRejectedError(error)) {
|
|
4394
|
+
logger.warn("connect-rn:crypto-withdrawal:user_rejected", {
|
|
4395
|
+
submission_id: order.submissionId
|
|
4396
|
+
});
|
|
4397
|
+
setSubmission({ status: "idle" });
|
|
4398
|
+
return;
|
|
4399
|
+
}
|
|
4400
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
4401
|
+
logger.error(
|
|
4402
|
+
"connect-rn:crypto-withdrawal:execution_failed",
|
|
4403
|
+
error,
|
|
4404
|
+
{ submission_id: order.submissionId }
|
|
4405
|
+
);
|
|
4406
|
+
setSubmission({
|
|
4407
|
+
status: "failed",
|
|
4408
|
+
code: toWithdrawalExecutionErrorCode(error)
|
|
4409
|
+
});
|
|
4410
|
+
callbacks.onWithdrawalError?.({ message });
|
|
4411
|
+
return;
|
|
4412
|
+
} finally {
|
|
4413
|
+
isSubmittingRef.current = false;
|
|
4414
|
+
inFlightWithdrawals.delete(key);
|
|
4415
|
+
}
|
|
4416
|
+
setSubmission({
|
|
4417
|
+
status: "submitted",
|
|
4418
|
+
txHash,
|
|
4419
|
+
submissionId: order.submissionId,
|
|
4420
|
+
amount
|
|
4421
|
+
});
|
|
4422
|
+
callbacks.onWithdrawalSubmitted?.(order.submissionId, txHash);
|
|
4423
|
+
},
|
|
4424
|
+
[apiKey, userId, config, sourceToken, destinationToken, callbacks]
|
|
4425
|
+
);
|
|
4426
|
+
const reset = useCallback2(() => setSubmission({ status: "idle" }), []);
|
|
4427
|
+
return { submission, submit, reset };
|
|
4428
|
+
}
|
|
4429
|
+
|
|
4430
|
+
// src/withdrawal/useCryptoWithdrawalQuote.ts
|
|
4431
|
+
import {
|
|
4432
|
+
extractRelayFeeInfo,
|
|
4433
|
+
extractRelayReceiveAmount,
|
|
4434
|
+
fetchExactInQuote,
|
|
4435
|
+
toWithdrawalAmountBaseUnit
|
|
4436
|
+
} from "@funkit/connect-core";
|
|
4437
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
4438
|
+
|
|
4439
|
+
// src/withdrawal/useSourceTokenDecimals.ts
|
|
4440
|
+
import { getPublicClientFor } from "@funkit/connect-core";
|
|
4441
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4442
|
+
import { erc20Abi } from "viem";
|
|
4443
|
+
var SOURCE_TOKEN_DECIMALS_QUERY_KEY = "sourceTokenDecimals";
|
|
4444
|
+
function useSourceTokenDecimals(sourceToken) {
|
|
4445
|
+
const query = useQuery({
|
|
4446
|
+
queryKey: [
|
|
4447
|
+
SOURCE_TOKEN_DECIMALS_QUERY_KEY,
|
|
4448
|
+
sourceToken.chainId,
|
|
4449
|
+
sourceToken.address
|
|
4450
|
+
],
|
|
4451
|
+
queryFn: async () => {
|
|
4452
|
+
const client = getPublicClientFor(Number(sourceToken.chainId));
|
|
4453
|
+
if (!client) {
|
|
4454
|
+
throw new Error(
|
|
4455
|
+
`No RPC client for chain ${sourceToken.chainId} \u2014 cannot read token decimals`
|
|
4456
|
+
);
|
|
4457
|
+
}
|
|
4458
|
+
return client.readContract({
|
|
4459
|
+
address: sourceToken.address,
|
|
4460
|
+
abi: erc20Abi,
|
|
4461
|
+
functionName: "decimals"
|
|
4462
|
+
});
|
|
4463
|
+
},
|
|
4464
|
+
enabled: sourceToken.decimals == null,
|
|
4465
|
+
// A token's decimals never change, so one read lasts the session.
|
|
4466
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
4467
|
+
retry: 1
|
|
4468
|
+
});
|
|
4469
|
+
return sourceToken.decimals ?? query.data;
|
|
4470
|
+
}
|
|
4471
|
+
|
|
4472
|
+
// src/withdrawal/useCryptoWithdrawalQuote.ts
|
|
4473
|
+
var CRYPTO_WITHDRAWAL_QUOTE_QUERY_KEY = "cryptoWithdrawalQuote";
|
|
4474
|
+
var QUOTE_REFRESH_INTERVAL_MS = 25e3;
|
|
4475
|
+
function useCryptoWithdrawalQuote({
|
|
4476
|
+
sourceToken,
|
|
4477
|
+
destinationToken,
|
|
4478
|
+
recipientAddress,
|
|
4479
|
+
amount,
|
|
4480
|
+
walletAddress,
|
|
4481
|
+
enabled
|
|
4482
|
+
}) {
|
|
4483
|
+
const { apiKey } = useFunkitIdentity();
|
|
4484
|
+
const decimals = useSourceTokenDecimals(sourceToken);
|
|
4485
|
+
const query = useQuery2({
|
|
4486
|
+
queryKey: [
|
|
4487
|
+
CRYPTO_WITHDRAWAL_QUOTE_QUERY_KEY,
|
|
4488
|
+
apiKey,
|
|
4489
|
+
sourceToken.chainId,
|
|
4490
|
+
sourceToken.address,
|
|
4491
|
+
destinationToken?.chainId,
|
|
4492
|
+
destinationToken?.address,
|
|
4493
|
+
recipientAddress,
|
|
4494
|
+
amount,
|
|
4495
|
+
// The quote is signed for one sender, so a wallet switch must not read a
|
|
4496
|
+
// cached quote built for the previous one.
|
|
4497
|
+
walletAddress,
|
|
4498
|
+
decimals
|
|
4499
|
+
],
|
|
4500
|
+
queryFn: async () => {
|
|
4501
|
+
if (!destinationToken) {
|
|
4502
|
+
throw new Error("Quote requested without a destination token");
|
|
4503
|
+
}
|
|
4504
|
+
if (decimals == null) {
|
|
4505
|
+
throw new Error("Quote requested before the source decimals resolved");
|
|
4506
|
+
}
|
|
4507
|
+
const raw = await fetchExactInQuote({
|
|
4508
|
+
apiKey,
|
|
4509
|
+
logger,
|
|
4510
|
+
fromChainId: sourceToken.chainId,
|
|
4511
|
+
fromTokenAddress: sourceToken.address,
|
|
4512
|
+
toChainId: destinationToken.chainId,
|
|
4513
|
+
toTokenAddress: destinationToken.address,
|
|
4514
|
+
recipientAddress,
|
|
4515
|
+
userAddress: walletAddress,
|
|
4516
|
+
fromAmountBaseUnit: toWithdrawalAmountBaseUnit(amount, decimals)
|
|
4517
|
+
});
|
|
4518
|
+
return {
|
|
4519
|
+
raw,
|
|
4520
|
+
receiveAmount: extractRelayReceiveAmount(raw.metadata, logger),
|
|
4521
|
+
fees: extractRelayFeeInfo(raw.metadata, logger)
|
|
4522
|
+
};
|
|
4523
|
+
},
|
|
4524
|
+
enabled: enabled && !!apiKey && !!destinationToken && !!recipientAddress && Number(amount) > 0 && decimals != null,
|
|
4525
|
+
staleTime: QUOTE_REFRESH_INTERVAL_MS,
|
|
4526
|
+
refetchInterval: QUOTE_REFRESH_INTERVAL_MS,
|
|
4527
|
+
refetchIntervalInBackground: true,
|
|
4528
|
+
// A failed quote is shown, not retried behind the user's back: the inputs
|
|
4529
|
+
// usually need changing, and a silent retry would delay that feedback.
|
|
4530
|
+
retry: false
|
|
4531
|
+
});
|
|
4532
|
+
return {
|
|
4533
|
+
quote: query.data,
|
|
4534
|
+
// Only the first fetch — `isFetching` would blank the rows and disable the
|
|
4535
|
+
// CTA on every background refresh.
|
|
4536
|
+
isLoading: query.isLoading,
|
|
4537
|
+
isError: query.isError
|
|
4538
|
+
};
|
|
4539
|
+
}
|
|
4540
|
+
|
|
4541
|
+
// src/withdrawal/useCryptoWithdrawalValidation.ts
|
|
4542
|
+
import {
|
|
4543
|
+
isBlacklistedWithdrawalAddress
|
|
4544
|
+
} from "@funkit/connect-core";
|
|
4545
|
+
|
|
4546
|
+
// src/withdrawal/validation.ts
|
|
4547
|
+
import {
|
|
4548
|
+
isAddressCompatibleWithChain,
|
|
4549
|
+
isWithdrawalAddressSupported,
|
|
4550
|
+
validateWithdrawalAmount
|
|
4551
|
+
} from "@funkit/connect-core";
|
|
4552
|
+
function validateAmount({
|
|
4553
|
+
config,
|
|
4554
|
+
sourceToken,
|
|
4555
|
+
amount,
|
|
4556
|
+
balance
|
|
4557
|
+
}) {
|
|
4558
|
+
const result = validateWithdrawalAmount({
|
|
4559
|
+
withdrawalInputAmount: amount,
|
|
4560
|
+
sourceTokenUsdPrice: 0,
|
|
4561
|
+
sourceTokenBalance: balance ?? "0",
|
|
4562
|
+
perTokenMin: config.getMinWithdrawalAmount?.({ sourceToken }),
|
|
4563
|
+
usdMin: config.getMinWithdrawalUSD?.({ sourceToken }) ?? 0.01,
|
|
4564
|
+
usdMax: config.getMaxWithdrawalUSD?.({ sourceToken })
|
|
4565
|
+
});
|
|
4566
|
+
const parsed = Number(amount);
|
|
4567
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
4568
|
+
return { ...result, isWithdrawAmountValid: false };
|
|
4569
|
+
}
|
|
4570
|
+
if (balance == null) {
|
|
4571
|
+
return {
|
|
4572
|
+
...result,
|
|
4573
|
+
isWithdrawAmountAboveBalance: false,
|
|
4574
|
+
isWithdrawAmountValid: !result.isWithdrawAmountTooLow && !result.isWithdrawAmountTooHigh
|
|
4575
|
+
};
|
|
4576
|
+
}
|
|
4577
|
+
return result;
|
|
4578
|
+
}
|
|
4579
|
+
function isNoOpSelfWithdrawal({
|
|
4580
|
+
recipientAddress,
|
|
4581
|
+
walletAddress,
|
|
4582
|
+
sourceToken,
|
|
4583
|
+
destinationToken
|
|
4584
|
+
}) {
|
|
4585
|
+
if (!destinationToken) return false;
|
|
4586
|
+
return recipientAddress.toLowerCase() === walletAddress.toLowerCase() && sourceToken.chainId === destinationToken.chainId && sourceToken.address.toLowerCase() === destinationToken.address.toLowerCase();
|
|
4587
|
+
}
|
|
4588
|
+
function getWithdrawCtaBlocker({
|
|
4589
|
+
recipientAddress,
|
|
4590
|
+
isRecipientBlacklisted,
|
|
4591
|
+
isRecipientSameAsSource,
|
|
4592
|
+
amount,
|
|
4593
|
+
amountValidation,
|
|
4594
|
+
destinationToken
|
|
4595
|
+
}) {
|
|
4596
|
+
if (!isWithdrawalAddressSupported(recipientAddress)) return "enter-recipient";
|
|
4597
|
+
if (isRecipientBlacklisted) return "unsupported-recipient";
|
|
4598
|
+
if (isRecipientSameAsSource) return "recipient-same-as-source";
|
|
4599
|
+
if (amountValidation.isWithdrawAmountTooHigh) return "max-exceeded";
|
|
4600
|
+
if (!amount || !amountValidation.isWithdrawAmountValid) return "enter-amount";
|
|
4601
|
+
if (!destinationToken) return "select-destination";
|
|
4602
|
+
if (!isAddressCompatibleWithChain(
|
|
4603
|
+
recipientAddress,
|
|
4604
|
+
Number(destinationToken.chainId)
|
|
4605
|
+
)) {
|
|
4606
|
+
return "invalid-for-chain";
|
|
4607
|
+
}
|
|
4608
|
+
return void 0;
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
// src/withdrawal/useCryptoWithdrawalValidation.ts
|
|
4612
|
+
function useCryptoWithdrawalValidation({
|
|
4613
|
+
config,
|
|
4614
|
+
sourceToken,
|
|
4615
|
+
destinationToken,
|
|
4616
|
+
amount,
|
|
4617
|
+
recipient,
|
|
4618
|
+
balance
|
|
4619
|
+
}) {
|
|
4620
|
+
const blacklist = useDynamicConfig("blacklistedwithdrawaladdress");
|
|
4621
|
+
const withdrawalConfig = useDynamicConfig("withdrawalconfig");
|
|
4622
|
+
const isRecipientBlacklisted = isBlacklistedWithdrawalAddress({
|
|
4623
|
+
address: recipient,
|
|
4624
|
+
blacklist,
|
|
4625
|
+
withdrawalConfig
|
|
4626
|
+
});
|
|
4627
|
+
const amountValidation = validateAmount({
|
|
4628
|
+
config,
|
|
4629
|
+
sourceToken,
|
|
4630
|
+
amount,
|
|
4631
|
+
balance
|
|
4632
|
+
});
|
|
4633
|
+
return {
|
|
4634
|
+
isRecipientBlacklisted,
|
|
4635
|
+
amountValidation,
|
|
4636
|
+
ctaBlocker: getWithdrawCtaBlocker({
|
|
4637
|
+
recipientAddress: recipient,
|
|
4638
|
+
isRecipientBlacklisted,
|
|
4639
|
+
isRecipientSameAsSource: isNoOpSelfWithdrawal({
|
|
4640
|
+
recipientAddress: recipient,
|
|
4641
|
+
walletAddress: config.withdrawalWallet.address(),
|
|
4642
|
+
sourceToken,
|
|
4643
|
+
destinationToken
|
|
4644
|
+
}),
|
|
4645
|
+
amount,
|
|
4646
|
+
amountValidation,
|
|
4647
|
+
destinationToken
|
|
4648
|
+
})
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4652
|
+
// src/withdrawal/useWithdrawalDestinationTokens.ts
|
|
4653
|
+
import { getSupportedAssets } from "@funkit/api-base";
|
|
4654
|
+
import { resolveTokenTransferConfig } from "@funkit/connect-core";
|
|
4655
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4656
|
+
import { useMemo as useMemo5, useState as useState11 } from "react";
|
|
4657
|
+
var WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY = "withdrawalDestinations";
|
|
4658
|
+
function useWithdrawalDestinationTokens({
|
|
4659
|
+
sourceToken,
|
|
4660
|
+
defaultReceiveToken
|
|
4661
|
+
}) {
|
|
4662
|
+
const { apiKey } = useFunkitIdentity();
|
|
4663
|
+
const withdrawalConfig = useDynamicConfig("withdrawalconfig");
|
|
4664
|
+
const disabledChainAssets = useDynamicConfig(
|
|
4665
|
+
"disablewithdrawalchainsandassets"
|
|
4666
|
+
);
|
|
4667
|
+
const { data: supportedAssets, isLoading } = useQuery3({
|
|
4668
|
+
queryKey: [WITHDRAWAL_DESTINATION_TOKENS_QUERY_KEY, apiKey],
|
|
4669
|
+
queryFn: () => getSupportedAssets({ apiKey, logger }),
|
|
4670
|
+
enabled: !!apiKey,
|
|
4671
|
+
staleTime: Number.POSITIVE_INFINITY
|
|
4672
|
+
});
|
|
4673
|
+
const resolved = useMemo5(() => {
|
|
4674
|
+
if (!supportedAssets) return void 0;
|
|
4675
|
+
return resolveTokenTransferConfig({
|
|
4676
|
+
chainConfigs: withdrawalConfig.chains ?? [],
|
|
4677
|
+
priorityTokens: withdrawalConfig.priorityTokens ?? [],
|
|
4678
|
+
disabledChainAssets: disabledChainAssets ?? {},
|
|
4679
|
+
supportedAssets,
|
|
4680
|
+
logger
|
|
4681
|
+
});
|
|
4682
|
+
}, [supportedAssets, withdrawalConfig, disabledChainAssets]);
|
|
4683
|
+
const chains = useMemo5(() => {
|
|
4684
|
+
if (!resolved) return [];
|
|
4685
|
+
return resolved.chainIdSortOrder.map((chainId) => ({
|
|
4686
|
+
chainId,
|
|
4687
|
+
symbols: resolved.symbolsByChainId[chainId] ?? []
|
|
4688
|
+
}));
|
|
4689
|
+
}, [resolved]);
|
|
4690
|
+
const [picked, setPicked] = useState11();
|
|
4691
|
+
const destinationToken = useMemo5(() => {
|
|
4692
|
+
if (!resolved) return void 0;
|
|
4693
|
+
const candidates = picked ? [picked] : [
|
|
4694
|
+
...defaultReceiveToken ? chains.map((c) => ({
|
|
4695
|
+
chainId: c.chainId,
|
|
4696
|
+
symbol: defaultReceiveToken
|
|
4697
|
+
})) : [],
|
|
4698
|
+
...chains.map((c) => ({
|
|
4699
|
+
chainId: c.chainId,
|
|
4700
|
+
symbol: sourceToken.symbol
|
|
4701
|
+
}))
|
|
4702
|
+
];
|
|
4703
|
+
for (const candidate of candidates) {
|
|
4704
|
+
const address = resolved.addressBySymbolByChainId[candidate.chainId]?.[candidate.symbol];
|
|
4705
|
+
if (address) {
|
|
4706
|
+
return {
|
|
4707
|
+
chainId: String(candidate.chainId),
|
|
4708
|
+
address,
|
|
4709
|
+
symbol: candidate.symbol
|
|
4710
|
+
};
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
return void 0;
|
|
4714
|
+
}, [resolved, picked, chains, defaultReceiveToken, sourceToken.symbol]);
|
|
4715
|
+
return {
|
|
4716
|
+
chains,
|
|
4717
|
+
destinationToken,
|
|
4718
|
+
selectDestinationToken: (chainId, symbol) => setPicked({ chainId, symbol }),
|
|
4719
|
+
isLoading
|
|
4720
|
+
};
|
|
4721
|
+
}
|
|
4722
|
+
|
|
4723
|
+
// src/withdrawal/useWithdrawalRisk.ts
|
|
4724
|
+
import {
|
|
4725
|
+
isAddressCompatibleWithChain as isAddressCompatibleWithChain2,
|
|
4726
|
+
isWithdrawalRisky,
|
|
4727
|
+
useFeatureGate
|
|
4728
|
+
} from "@funkit/connect-core";
|
|
4729
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
4730
|
+
var WITHDRAWAL_RISK_QUERY_KEY = "withdrawalRisk";
|
|
4731
|
+
function useWithdrawalRisk(address, chainId) {
|
|
4732
|
+
const { apiKey } = useFunkitIdentity();
|
|
4733
|
+
const screeningDisabled = useFeatureGate("disable-frontend-chainalysis");
|
|
4734
|
+
const query = useQuery4({
|
|
4735
|
+
queryKey: [WITHDRAWAL_RISK_QUERY_KEY, apiKey, address],
|
|
4736
|
+
queryFn: () => isWithdrawalRisky({
|
|
4737
|
+
address,
|
|
4738
|
+
apiKey,
|
|
4739
|
+
logger,
|
|
4740
|
+
screeningDisabled
|
|
4741
|
+
}),
|
|
4742
|
+
// Only screen an address that could actually exist on the destination
|
|
4743
|
+
// chain. Without this the query fires on every keystroke of a
|
|
4744
|
+
// half-typed address, one Chainalysis call per character.
|
|
4745
|
+
enabled: !!apiKey && !!address && chainId !== void 0 && isAddressCompatibleWithChain2(address, chainId),
|
|
4746
|
+
// api-base already retries the request; one more attempt before the error
|
|
4747
|
+
// state blocks the CTA is enough.
|
|
4748
|
+
retry: 1,
|
|
4749
|
+
refetchOnMount: false,
|
|
4750
|
+
refetchOnReconnect: false,
|
|
4751
|
+
refetchOnWindowFocus: false
|
|
4752
|
+
});
|
|
4753
|
+
return {
|
|
4754
|
+
isRisky: query.data,
|
|
4755
|
+
isChecking: query.isFetching,
|
|
4756
|
+
isError: query.isError
|
|
4757
|
+
};
|
|
4758
|
+
}
|
|
4759
|
+
|
|
4760
|
+
// src/screens/SelectDestinationScreen.tsx
|
|
4761
|
+
import {
|
|
4762
|
+
Pressable as Pressable9,
|
|
4763
|
+
ScrollView as ScrollView3,
|
|
4764
|
+
StyleSheet as StyleSheet11,
|
|
4765
|
+
View as View3,
|
|
4766
|
+
useWindowDimensions as useWindowDimensions3
|
|
4767
|
+
} from "react-native";
|
|
4768
|
+
import { useSafeAreaInsets as useSafeAreaInsets3 } from "react-native-safe-area-context";
|
|
4769
|
+
import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4770
|
+
function SelectDestinationScreen({
|
|
4771
|
+
chains,
|
|
4772
|
+
chainIconUri: chainIconUri3,
|
|
4773
|
+
chainName: chainName2,
|
|
4774
|
+
selectedChainId,
|
|
4775
|
+
selectedSymbol,
|
|
4776
|
+
onSelect,
|
|
4777
|
+
onBack,
|
|
4778
|
+
loading
|
|
4779
|
+
}) {
|
|
4780
|
+
const { t } = useFunkitTranslation();
|
|
4781
|
+
const theme = useTheme();
|
|
4782
|
+
const { height } = useWindowDimensions3();
|
|
4783
|
+
const insets = useSafeAreaInsets3();
|
|
4784
|
+
const { showTopFade, showBottomFade, scrollProps } = useScrollEdgeFades();
|
|
4785
|
+
const maxHeight = height - insets.top - insets.bottom - theme.sizes.topBar - LIST_BOTTOM_GAP;
|
|
4786
|
+
return /* @__PURE__ */ jsxs12(Box, { children: [
|
|
4787
|
+
/* @__PURE__ */ jsx25(Grabber, {}),
|
|
4788
|
+
/* @__PURE__ */ jsxs12(
|
|
4789
|
+
Box,
|
|
4790
|
+
{
|
|
4791
|
+
flexDirection: "row",
|
|
4792
|
+
alignItems: "center",
|
|
4793
|
+
style: [styles11.topBar, { height: theme.sizes.topBar }],
|
|
4794
|
+
children: [
|
|
4795
|
+
/* @__PURE__ */ jsx25(
|
|
4796
|
+
Pressable9,
|
|
4797
|
+
{
|
|
4798
|
+
onPress: onBack,
|
|
4799
|
+
accessibilityRole: "button",
|
|
4800
|
+
accessibilityLabel: t("common.back"),
|
|
4801
|
+
hitSlop: 8,
|
|
4802
|
+
children: /* @__PURE__ */ jsx25(Text, { variant: "bodyMedium", children: t("common.back") })
|
|
4803
|
+
}
|
|
4804
|
+
),
|
|
4805
|
+
/* @__PURE__ */ jsx25(Text, { variant: "headerTitle", style: styles11.title, children: t("withdrawCrypto.selectDestination") }),
|
|
4806
|
+
/* @__PURE__ */ jsx25(Box, { style: styles11.spacer })
|
|
4807
|
+
]
|
|
4808
|
+
}
|
|
4809
|
+
),
|
|
4810
|
+
/* @__PURE__ */ jsxs12(View3, { style: styles11.scrollArea, children: [
|
|
4811
|
+
/* @__PURE__ */ jsxs12(
|
|
4812
|
+
ScrollView3,
|
|
4813
|
+
{
|
|
4814
|
+
style: { maxHeight },
|
|
4815
|
+
contentContainerStyle: [
|
|
4816
|
+
styles11.list,
|
|
4817
|
+
{ paddingBottom: LIST_BOTTOM_GAP + insets.bottom }
|
|
4818
|
+
],
|
|
4819
|
+
showsVerticalScrollIndicator: false,
|
|
4820
|
+
scrollEventThrottle: 16,
|
|
4821
|
+
...scrollProps,
|
|
4822
|
+
children: [
|
|
4823
|
+
loading && chains.length === 0 ? /* @__PURE__ */ jsx25(
|
|
4824
|
+
Text,
|
|
4825
|
+
{
|
|
4826
|
+
variant: "detail",
|
|
4827
|
+
style: { color: theme.content.elements.secondary },
|
|
4828
|
+
children: t("common.loading")
|
|
4829
|
+
}
|
|
4830
|
+
) : null,
|
|
4831
|
+
chains.map((chain) => /* @__PURE__ */ jsxs12(Box, { style: styles11.group, children: [
|
|
4832
|
+
/* @__PURE__ */ jsxs12(Box, { flexDirection: "row", alignItems: "center", style: styles11.chain, children: [
|
|
4833
|
+
/* @__PURE__ */ jsx25(ChainAvatar, { uri: chainIconUri3(chain.chainId), size: 20 }),
|
|
4834
|
+
/* @__PURE__ */ jsx25(
|
|
4835
|
+
Text,
|
|
4836
|
+
{
|
|
4837
|
+
variant: "detail",
|
|
4838
|
+
style: { color: theme.content.elements.secondary },
|
|
4839
|
+
children: chainName2(chain.chainId)
|
|
4840
|
+
}
|
|
4841
|
+
)
|
|
4842
|
+
] }),
|
|
4843
|
+
chain.symbols.map((symbol) => {
|
|
4844
|
+
const isSelected = selectedSymbol === symbol && selectedChainId === String(chain.chainId);
|
|
4845
|
+
return /* @__PURE__ */ jsx25(
|
|
4846
|
+
Pressable9,
|
|
4847
|
+
{
|
|
4848
|
+
onPress: () => onSelect(chain.chainId, symbol),
|
|
4849
|
+
accessibilityRole: "button",
|
|
4850
|
+
accessibilityLabel: `${symbol} ${chainName2(chain.chainId)}`,
|
|
4851
|
+
accessibilityState: { selected: isSelected },
|
|
4852
|
+
children: /* @__PURE__ */ jsxs12(
|
|
4853
|
+
Box,
|
|
4854
|
+
{
|
|
4855
|
+
flexDirection: "row",
|
|
4856
|
+
alignItems: "center",
|
|
4857
|
+
justifyContent: "space-between",
|
|
4858
|
+
borderRadius: "element",
|
|
4859
|
+
style: [
|
|
4860
|
+
styles11.row,
|
|
4861
|
+
isSelected ? { backgroundColor: theme.background.secondary } : void 0
|
|
4862
|
+
],
|
|
4863
|
+
children: [
|
|
4864
|
+
/* @__PURE__ */ jsxs12(
|
|
4865
|
+
Box,
|
|
4866
|
+
{
|
|
4867
|
+
flexDirection: "row",
|
|
4868
|
+
alignItems: "center",
|
|
4869
|
+
style: styles11.token,
|
|
4870
|
+
children: [
|
|
4871
|
+
/* @__PURE__ */ jsx25(TokenChainIcon, { symbol }),
|
|
4872
|
+
/* @__PURE__ */ jsx25(
|
|
4873
|
+
Text,
|
|
4874
|
+
{
|
|
4875
|
+
variant: "bodyMedium",
|
|
4876
|
+
style: { color: theme.content.elements.primary },
|
|
4877
|
+
children: symbol
|
|
4878
|
+
}
|
|
4879
|
+
)
|
|
4880
|
+
]
|
|
4881
|
+
}
|
|
4882
|
+
),
|
|
4883
|
+
isSelected ? /* @__PURE__ */ jsx25(FigmaSuccessCheckIcon, { size: 16 }) : null
|
|
4884
|
+
]
|
|
4885
|
+
}
|
|
4886
|
+
)
|
|
4887
|
+
},
|
|
4888
|
+
`${chain.chainId}:${symbol}`
|
|
4889
|
+
);
|
|
4890
|
+
})
|
|
4891
|
+
] }, chain.chainId))
|
|
4892
|
+
]
|
|
4893
|
+
}
|
|
4894
|
+
),
|
|
4895
|
+
showTopFade ? /* @__PURE__ */ jsx25(
|
|
4896
|
+
ScrollFade,
|
|
4897
|
+
{
|
|
4898
|
+
edge: "top",
|
|
4899
|
+
color: theme.background.modal,
|
|
4900
|
+
id: "destination-list"
|
|
4901
|
+
}
|
|
4902
|
+
) : null,
|
|
4903
|
+
showBottomFade ? /* @__PURE__ */ jsx25(
|
|
4904
|
+
ScrollFade,
|
|
4905
|
+
{
|
|
4906
|
+
edge: "bottom",
|
|
4907
|
+
color: theme.background.modal,
|
|
4908
|
+
id: "destination-list"
|
|
4909
|
+
}
|
|
4910
|
+
) : null
|
|
4911
|
+
] })
|
|
4912
|
+
] });
|
|
4913
|
+
}
|
|
4914
|
+
var LIST_BOTTOM_GAP = 24;
|
|
4915
|
+
var styles11 = StyleSheet11.create({
|
|
4916
|
+
topBar: { paddingHorizontal: 16, gap: 12 },
|
|
4917
|
+
title: { flex: 1 },
|
|
4918
|
+
spacer: { width: 20 },
|
|
4919
|
+
scrollArea: { position: "relative" },
|
|
4920
|
+
list: { paddingHorizontal: 16, gap: 16 },
|
|
4921
|
+
group: { gap: 4 },
|
|
4922
|
+
chain: { gap: 8, paddingVertical: 4 },
|
|
4923
|
+
row: { paddingHorizontal: 12, paddingVertical: 10 },
|
|
4924
|
+
token: { gap: 10 }
|
|
4925
|
+
});
|
|
4926
|
+
|
|
4927
|
+
// src/screens/WithdrawCryptoCta.tsx
|
|
4928
|
+
import { Pressable as Pressable10, StyleSheet as StyleSheet12 } from "react-native";
|
|
4929
|
+
import { jsx as jsx26 } from "react/jsx-runtime";
|
|
4930
|
+
function WithdrawCryptoCta({
|
|
4931
|
+
blocker,
|
|
4932
|
+
canSubmit,
|
|
4933
|
+
isLoading,
|
|
4934
|
+
onPress
|
|
4935
|
+
}) {
|
|
4936
|
+
const theme = useTheme();
|
|
4937
|
+
const isReady = canSubmit && !isLoading;
|
|
4938
|
+
const label = useCtaLabel(blocker);
|
|
4939
|
+
return /* @__PURE__ */ jsx26(
|
|
4940
|
+
Pressable10,
|
|
4941
|
+
{
|
|
4942
|
+
onPress: isReady ? onPress : void 0,
|
|
4943
|
+
disabled: !isReady,
|
|
4944
|
+
accessibilityRole: "button",
|
|
4945
|
+
accessibilityLabel: label,
|
|
4946
|
+
accessibilityState: { disabled: !isReady },
|
|
4947
|
+
children: /* @__PURE__ */ jsx26(
|
|
4948
|
+
Box,
|
|
4949
|
+
{
|
|
4950
|
+
alignItems: "center",
|
|
4951
|
+
justifyContent: "center",
|
|
4952
|
+
borderRadius: "button",
|
|
4953
|
+
style: [
|
|
4954
|
+
styles12.button,
|
|
4955
|
+
{
|
|
4956
|
+
height: theme.sizes.buttonHeight,
|
|
4957
|
+
backgroundColor: theme.background.button.primary.default,
|
|
4958
|
+
opacity: isReady ? 1 : theme.opacity.disabled / 100
|
|
4959
|
+
}
|
|
4960
|
+
],
|
|
4961
|
+
children: /* @__PURE__ */ jsx26(
|
|
4962
|
+
Text,
|
|
4963
|
+
{
|
|
4964
|
+
variant: "bodyMedium",
|
|
4965
|
+
numberOfLines: 1,
|
|
4966
|
+
style: { color: theme.content.button.primary.default },
|
|
4967
|
+
children: label
|
|
4968
|
+
}
|
|
4969
|
+
)
|
|
4970
|
+
}
|
|
4971
|
+
)
|
|
4972
|
+
}
|
|
4973
|
+
);
|
|
4974
|
+
}
|
|
4975
|
+
function useCtaLabel(blocker) {
|
|
4976
|
+
const { t } = useFunkitTranslation();
|
|
4977
|
+
switch (blocker) {
|
|
4978
|
+
case "enter-recipient":
|
|
4979
|
+
return t("withdrawCrypto.ctaEnterRecipient");
|
|
4980
|
+
case "unsupported-recipient":
|
|
4981
|
+
return t("withdrawCrypto.unsupportedRecipient");
|
|
4982
|
+
case "recipient-same-as-source":
|
|
4983
|
+
return t("withdrawCrypto.ctaRecipientSameAsSource");
|
|
4984
|
+
case "max-exceeded":
|
|
4985
|
+
return t("withdrawCrypto.ctaMaxExceeded");
|
|
4986
|
+
case "enter-amount":
|
|
4987
|
+
return t("withdrawCrypto.ctaEnterAmount");
|
|
4988
|
+
case "select-destination":
|
|
4989
|
+
return t("withdrawCrypto.ctaSelectDestination");
|
|
4990
|
+
case "invalid-for-chain":
|
|
4991
|
+
return t("withdrawCrypto.ctaInvalidForChain");
|
|
4992
|
+
case void 0:
|
|
4993
|
+
return t("withdrawCrypto.ctaWithdraw");
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
var styles12 = StyleSheet12.create({
|
|
4997
|
+
button: { paddingHorizontal: 16 }
|
|
4998
|
+
});
|
|
4999
|
+
|
|
5000
|
+
// src/screens/WithdrawCryptoScreen.tsx
|
|
5001
|
+
import { Pressable as Pressable11, StyleSheet as StyleSheet13 } from "react-native";
|
|
5002
|
+
import { jsx as jsx27, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
5003
|
+
function WithdrawCryptoScreen({
|
|
5004
|
+
title,
|
|
5005
|
+
backAccessibilityLabel,
|
|
5006
|
+
onBack,
|
|
5007
|
+
children,
|
|
5008
|
+
cta
|
|
5009
|
+
}) {
|
|
5010
|
+
const theme = useTheme();
|
|
5011
|
+
return /* @__PURE__ */ jsxs13(Box, { children: [
|
|
5012
|
+
/* @__PURE__ */ jsx27(Grabber, {}),
|
|
5013
|
+
/* @__PURE__ */ jsxs13(
|
|
5014
|
+
Box,
|
|
5015
|
+
{
|
|
5016
|
+
flexDirection: "row",
|
|
5017
|
+
alignItems: "center",
|
|
5018
|
+
style: [styles13.topBar, { height: theme.sizes.topBar }],
|
|
5019
|
+
children: [
|
|
5020
|
+
/* @__PURE__ */ jsx27(
|
|
5021
|
+
Pressable11,
|
|
5022
|
+
{
|
|
5023
|
+
onPress: onBack,
|
|
5024
|
+
accessibilityRole: "button",
|
|
5025
|
+
accessibilityLabel: backAccessibilityLabel,
|
|
5026
|
+
hitSlop: 8,
|
|
5027
|
+
children: /* @__PURE__ */ jsx27(
|
|
5028
|
+
FigmaChevronLeftIcon,
|
|
5029
|
+
{
|
|
5030
|
+
size: 20,
|
|
5031
|
+
color: theme.content.button.icon.default
|
|
5032
|
+
}
|
|
5033
|
+
)
|
|
5034
|
+
}
|
|
5035
|
+
),
|
|
5036
|
+
/* @__PURE__ */ jsx27(Text, { variant: "headerTitle", style: styles13.title, children: title }),
|
|
5037
|
+
/* @__PURE__ */ jsx27(Box, { style: styles13.spacer })
|
|
5038
|
+
]
|
|
5039
|
+
}
|
|
5040
|
+
),
|
|
5041
|
+
/* @__PURE__ */ jsxs13(Box, { style: styles13.body, children: [
|
|
5042
|
+
children,
|
|
5043
|
+
cta
|
|
5044
|
+
] })
|
|
5045
|
+
] });
|
|
5046
|
+
}
|
|
5047
|
+
var styles13 = StyleSheet13.create({
|
|
5048
|
+
topBar: { paddingHorizontal: 16, gap: 12 },
|
|
5049
|
+
title: { flex: 1 },
|
|
5050
|
+
spacer: { width: 20 },
|
|
5051
|
+
body: { paddingHorizontal: 16, paddingBottom: 24, gap: 24 }
|
|
5052
|
+
});
|
|
5053
|
+
|
|
5054
|
+
// src/components/WithdrawFeeSummary.tsx
|
|
5055
|
+
import { StyleSheet as StyleSheet14 } from "react-native";
|
|
5056
|
+
import { jsx as jsx28, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
5057
|
+
var toUsd = (value) => `$${value.toFixed(2)}`;
|
|
5058
|
+
var toPercent = (value) => `${value.toFixed(2)}%`;
|
|
5059
|
+
var UNKNOWN = "\u2014";
|
|
5060
|
+
function WithdrawFeeSummary({
|
|
5061
|
+
fees,
|
|
5062
|
+
receiveAmount,
|
|
5063
|
+
destinationSymbol,
|
|
5064
|
+
isLoading,
|
|
5065
|
+
errorText: errorText2
|
|
5066
|
+
}) {
|
|
5067
|
+
const { t } = useFunkitTranslation();
|
|
5068
|
+
const theme = useTheme();
|
|
5069
|
+
if (errorText2) {
|
|
5070
|
+
return /* @__PURE__ */ jsx28(Text, { variant: "detail", style: { color: theme.content.elements.error }, children: errorText2 });
|
|
5071
|
+
}
|
|
5072
|
+
const quoted = isLoading ? void 0 : fees;
|
|
5073
|
+
const rows = [
|
|
5074
|
+
{
|
|
5075
|
+
label: t("withdrawCrypto.youReceive"),
|
|
5076
|
+
value: quoted && receiveAmount ? `${receiveAmount} ${destinationSymbol}` : UNKNOWN
|
|
5077
|
+
},
|
|
5078
|
+
{
|
|
5079
|
+
label: t("withdrawCrypto.networkCost"),
|
|
5080
|
+
// Web adds `extraSourceChainGasUsd` here — a host fee billed as source
|
|
5081
|
+
// gas (Nado, Lighter fast). No RN config field feeds it, so it is 0.
|
|
5082
|
+
value: quoted ? toUsd(quoted.fillCostUsd + quoted.gasUsd) : UNKNOWN
|
|
5083
|
+
},
|
|
5084
|
+
{
|
|
5085
|
+
label: t("withdrawCrypto.priceImpact"),
|
|
5086
|
+
value: quoted ? toUsd(quoted.swapImpactUsd + quoted.appFeeUsd) : UNKNOWN
|
|
5087
|
+
},
|
|
5088
|
+
{
|
|
5089
|
+
label: t("withdrawCrypto.maxSlippage"),
|
|
5090
|
+
value: quoted ? toPercent(quoted.maxSlippage) : UNKNOWN
|
|
5091
|
+
}
|
|
5092
|
+
];
|
|
5093
|
+
return /* @__PURE__ */ jsx28(Box, { style: styles14.root, children: rows.map((row2) => /* @__PURE__ */ jsxs14(
|
|
5094
|
+
Box,
|
|
5095
|
+
{
|
|
5096
|
+
flexDirection: "row",
|
|
5097
|
+
justifyContent: "space-between",
|
|
5098
|
+
alignItems: "center",
|
|
5099
|
+
children: [
|
|
5100
|
+
/* @__PURE__ */ jsx28(
|
|
5101
|
+
Text,
|
|
5102
|
+
{
|
|
5103
|
+
variant: "detail",
|
|
5104
|
+
style: { color: theme.content.elements.secondary },
|
|
5105
|
+
children: row2.label
|
|
5106
|
+
}
|
|
5107
|
+
),
|
|
5108
|
+
/* @__PURE__ */ jsx28(
|
|
5109
|
+
Text,
|
|
5110
|
+
{
|
|
5111
|
+
variant: "detail",
|
|
5112
|
+
weight: "medium",
|
|
5113
|
+
style: { color: theme.content.elements.primary },
|
|
5114
|
+
children: row2.value
|
|
5115
|
+
}
|
|
5116
|
+
)
|
|
5117
|
+
]
|
|
5118
|
+
},
|
|
5119
|
+
row2.label
|
|
5120
|
+
)) });
|
|
5121
|
+
}
|
|
5122
|
+
var styles14 = StyleSheet14.create({
|
|
5123
|
+
root: { gap: 8 }
|
|
5124
|
+
});
|
|
5125
|
+
|
|
5126
|
+
// src/screens/WithdrawCryptoForm.tsx
|
|
5127
|
+
import { jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
5128
|
+
var AMOUNT_DEBOUNCE_MS = 300;
|
|
5129
|
+
function WithdrawCryptoForm({
|
|
5130
|
+
config,
|
|
5131
|
+
callbacks,
|
|
5132
|
+
title,
|
|
5133
|
+
onBack,
|
|
5134
|
+
onSubmitted
|
|
5135
|
+
}) {
|
|
5136
|
+
const { t } = useFunkitTranslation();
|
|
5137
|
+
const [amount, setAmount] = useState12("");
|
|
5138
|
+
const [recipient, setRecipient] = useState12("");
|
|
5139
|
+
const sourceToken = resolveWithdrawalSourceTokens(config)[0].token;
|
|
5140
|
+
const balance = resolveWithdrawalSourceBalance(config, sourceToken);
|
|
5141
|
+
const {
|
|
5142
|
+
chains: destinationChains,
|
|
5143
|
+
destinationToken,
|
|
5144
|
+
selectDestinationToken,
|
|
5145
|
+
isLoading: isLoadingDestinations
|
|
5146
|
+
} = useWithdrawalDestinationTokens({
|
|
5147
|
+
sourceToken,
|
|
5148
|
+
defaultReceiveToken: config.defaultReceiveToken
|
|
5149
|
+
});
|
|
5150
|
+
const [isPickingDestination, setIsPickingDestination] = useState12(false);
|
|
5151
|
+
const { isRecipientBlacklisted, amountValidation, ctaBlocker } = useCryptoWithdrawalValidation({
|
|
5152
|
+
config,
|
|
5153
|
+
sourceToken,
|
|
5154
|
+
destinationToken,
|
|
5155
|
+
amount,
|
|
5156
|
+
recipient,
|
|
5157
|
+
balance
|
|
5158
|
+
});
|
|
5159
|
+
const risk = useWithdrawalRisk(
|
|
5160
|
+
recipient,
|
|
5161
|
+
destinationToken ? Number(destinationToken.chainId) : void 0
|
|
5162
|
+
);
|
|
5163
|
+
const { debounced: debouncedAmount, isSettled } = useDebouncedValue(
|
|
5164
|
+
amount,
|
|
5165
|
+
AMOUNT_DEBOUNCE_MS
|
|
5166
|
+
);
|
|
5167
|
+
const {
|
|
5168
|
+
quote,
|
|
5169
|
+
isLoading: isQuoteLoading,
|
|
5170
|
+
isError: isQuoteError
|
|
5171
|
+
} = useCryptoWithdrawalQuote({
|
|
5172
|
+
sourceToken,
|
|
5173
|
+
destinationToken,
|
|
5174
|
+
recipientAddress: recipient,
|
|
5175
|
+
amount: debouncedAmount,
|
|
5176
|
+
walletAddress: config.withdrawalWallet.address(),
|
|
5177
|
+
// Everything the form already knows is wrong, plus the async verdict:
|
|
5178
|
+
// `isRisky === false` is required, so in-flight and errored both hold.
|
|
5179
|
+
enabled: !ctaBlocker && isSettled && risk.isRisky === false
|
|
5180
|
+
});
|
|
5181
|
+
const { submission, submit } = useCryptoWithdrawalExecution({
|
|
5182
|
+
config,
|
|
5183
|
+
sourceToken,
|
|
5184
|
+
destinationToken: destinationToken ?? sourceToken,
|
|
5185
|
+
callbacks
|
|
5186
|
+
});
|
|
5187
|
+
const canSubmit = !ctaBlocker && isSettled && risk.isRisky === false && !!quote;
|
|
5188
|
+
const isBusy = isQuoteLoading || risk.isChecking || submission.status === "submitting";
|
|
5189
|
+
const handedOffRef = useRef6(false);
|
|
5190
|
+
const onSubmittedEvent = useEffectEvent2(onSubmitted);
|
|
5191
|
+
useEffect8(() => {
|
|
5192
|
+
if (submission.status !== "submitted" || handedOffRef.current) return;
|
|
5193
|
+
handedOffRef.current = true;
|
|
5194
|
+
onSubmittedEvent({
|
|
5195
|
+
txHash: submission.txHash,
|
|
5196
|
+
amountLabel: `${submission.amount} ${sourceToken.symbol}`
|
|
5197
|
+
});
|
|
5198
|
+
}, [submission, sourceToken.symbol]);
|
|
5199
|
+
if (isPickingDestination) {
|
|
5200
|
+
return /* @__PURE__ */ jsx29(
|
|
5201
|
+
SelectDestinationScreen,
|
|
5202
|
+
{
|
|
5203
|
+
chains: destinationChains,
|
|
5204
|
+
chainIconUri: chainIconUri2,
|
|
5205
|
+
chainName: (chainId) => chainName(chainId) ?? t("networks.chainFallback", { chainId }),
|
|
5206
|
+
selectedChainId: destinationToken?.chainId,
|
|
5207
|
+
selectedSymbol: destinationToken?.symbol,
|
|
5208
|
+
loading: isLoadingDestinations,
|
|
5209
|
+
onSelect: (chainId, symbol) => {
|
|
5210
|
+
selectDestinationToken(chainId, symbol);
|
|
5211
|
+
setIsPickingDestination(false);
|
|
5212
|
+
},
|
|
5213
|
+
onBack: () => setIsPickingDestination(false)
|
|
5214
|
+
}
|
|
5215
|
+
);
|
|
5216
|
+
}
|
|
5217
|
+
return /* @__PURE__ */ jsxs15(
|
|
5218
|
+
WithdrawCryptoScreen,
|
|
5219
|
+
{
|
|
5220
|
+
title,
|
|
5221
|
+
backAccessibilityLabel: t("common.back"),
|
|
5222
|
+
onBack,
|
|
5223
|
+
cta: /* @__PURE__ */ jsx29(
|
|
5224
|
+
WithdrawCryptoCta,
|
|
5225
|
+
{
|
|
5226
|
+
blocker: ctaBlocker,
|
|
5227
|
+
canSubmit,
|
|
5228
|
+
isLoading: isBusy,
|
|
5229
|
+
onPress: () => {
|
|
5230
|
+
if (!quote) return;
|
|
5231
|
+
logger.info("connect-rn:withdrawal:crypto_submit", {
|
|
5232
|
+
fromChainId: sourceToken.chainId,
|
|
5233
|
+
fromToken: sourceToken.address,
|
|
5234
|
+
toChainId: destinationToken?.chainId,
|
|
5235
|
+
toToken: destinationToken?.address
|
|
5236
|
+
});
|
|
5237
|
+
void submit({
|
|
5238
|
+
quote: quote.raw,
|
|
5239
|
+
recipientAddress: recipient,
|
|
5240
|
+
amount: debouncedAmount
|
|
5241
|
+
});
|
|
5242
|
+
}
|
|
5243
|
+
}
|
|
5244
|
+
),
|
|
5245
|
+
children: [
|
|
5246
|
+
/* @__PURE__ */ jsx29(
|
|
5247
|
+
AmountInput,
|
|
5248
|
+
{
|
|
5249
|
+
value: amount,
|
|
5250
|
+
onChangeValue: setAmount,
|
|
5251
|
+
tokenSymbol: sourceToken.symbol,
|
|
5252
|
+
balanceLabel: balance ? t("withdrawCrypto.available", {
|
|
5253
|
+
amount: balance,
|
|
5254
|
+
symbol: sourceToken.symbol
|
|
5255
|
+
}) : void 0,
|
|
5256
|
+
maxLabel: t("withdrawCrypto.max"),
|
|
5257
|
+
onPressMax: balance ? () => setAmount(balance) : void 0,
|
|
5258
|
+
errorText: resolveAmountErrorText({
|
|
5259
|
+
t,
|
|
5260
|
+
amount,
|
|
5261
|
+
amountValidation,
|
|
5262
|
+
tokenSymbol: sourceToken.symbol
|
|
5263
|
+
})
|
|
5264
|
+
}
|
|
5265
|
+
),
|
|
5266
|
+
/* @__PURE__ */ jsx29(
|
|
5267
|
+
SelectedChainRow,
|
|
5268
|
+
{
|
|
5269
|
+
label: t("withdrawCrypto.receiveAs"),
|
|
5270
|
+
name: destinationToken ? `${destinationToken.symbol} \xB7 ${chainName(Number(destinationToken.chainId)) ?? t("networks.chainFallback", {
|
|
5271
|
+
chainId: destinationToken.chainId
|
|
5272
|
+
})}` : t("common.loading"),
|
|
5273
|
+
iconUri: chainIconUri2(
|
|
5274
|
+
destinationToken ? Number(destinationToken.chainId) : 0
|
|
5275
|
+
),
|
|
5276
|
+
accessibilityLabel: t("withdrawCrypto.receiveAs"),
|
|
5277
|
+
onPress: () => setIsPickingDestination(true)
|
|
5278
|
+
}
|
|
5279
|
+
),
|
|
5280
|
+
/* @__PURE__ */ jsx29(
|
|
5281
|
+
RecipientAddressInput,
|
|
5282
|
+
{
|
|
5283
|
+
label: t("withdrawCrypto.sendTo"),
|
|
5284
|
+
value: recipient,
|
|
5285
|
+
onChangeText: setRecipient,
|
|
5286
|
+
placeholder: t("withdrawCrypto.addressPlaceholder"),
|
|
5287
|
+
useConnectedWalletLabel: t("withdrawCrypto.useMyWallet"),
|
|
5288
|
+
onUseConnectedWallet: config.disableConnectedWallet ? void 0 : () => setRecipient(config.withdrawalWallet.address()),
|
|
5289
|
+
errorText: isRecipientBlacklisted ? t("withdrawCrypto.unsupportedRecipient") : void 0,
|
|
5290
|
+
warningText: risk.isRisky ? t("withdrawCrypto.riskyAddress") : void 0
|
|
5291
|
+
}
|
|
5292
|
+
),
|
|
5293
|
+
submission.status === "failed" ? /* @__PURE__ */ jsx29(
|
|
5294
|
+
WithdrawExecutionError,
|
|
5295
|
+
{
|
|
5296
|
+
message: executionErrorMessage(t, submission.code)
|
|
5297
|
+
}
|
|
5298
|
+
) : null,
|
|
5299
|
+
!ctaBlocker ? /* @__PURE__ */ jsx29(
|
|
5300
|
+
WithdrawFeeSummary,
|
|
5301
|
+
{
|
|
5302
|
+
fees: quote?.fees,
|
|
5303
|
+
receiveAmount: quote?.receiveAmount,
|
|
5304
|
+
destinationSymbol: destinationToken?.symbol ?? "",
|
|
5305
|
+
isLoading: !isSettled || isQuoteLoading,
|
|
5306
|
+
errorText: isQuoteError ? t("withdrawCrypto.quoteFailed") : void 0
|
|
5307
|
+
}
|
|
5308
|
+
) : null
|
|
5309
|
+
]
|
|
5310
|
+
}
|
|
5311
|
+
);
|
|
5312
|
+
}
|
|
5313
|
+
function executionErrorMessage(t, code) {
|
|
5314
|
+
switch (code) {
|
|
5315
|
+
case "insufficient-gas":
|
|
5316
|
+
return t("withdrawCrypto.errorInsufficientGas");
|
|
5317
|
+
case "switch-chain":
|
|
5318
|
+
return t("withdrawCrypto.errorSwitchChain");
|
|
5319
|
+
case "generic":
|
|
5320
|
+
return t("withdrawCrypto.errorGeneric");
|
|
5321
|
+
}
|
|
5322
|
+
return t("withdrawCrypto.errorGeneric");
|
|
5323
|
+
}
|
|
5324
|
+
function resolveAmountErrorText({
|
|
5325
|
+
t,
|
|
5326
|
+
amount,
|
|
5327
|
+
amountValidation,
|
|
5328
|
+
tokenSymbol
|
|
5329
|
+
}) {
|
|
5330
|
+
if (!amount) return void 0;
|
|
5331
|
+
if (amountValidation.isWithdrawAmountTooLow) {
|
|
5332
|
+
return t("withdrawCrypto.belowMinimum", {
|
|
5333
|
+
amount: `${amountValidation.minWithdrawalDisplayValue} ${tokenSymbol}`
|
|
5334
|
+
});
|
|
5335
|
+
}
|
|
5336
|
+
if (amountValidation.isWithdrawAmountAboveBalance) {
|
|
5337
|
+
return t("withdrawCrypto.aboveBalance");
|
|
5338
|
+
}
|
|
5339
|
+
return void 0;
|
|
5340
|
+
}
|
|
5341
|
+
function WithdrawExecutionError({ message }) {
|
|
5342
|
+
const theme = useTheme();
|
|
5343
|
+
return /* @__PURE__ */ jsx29(Text, { variant: "detail", style: { color: theme.content.elements.error }, children: message });
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
// src/screens/WithdrawCryptoComplete.tsx
|
|
5347
|
+
import { useEffect as useEffect9, useRef as useRef7 } from "react";
|
|
5348
|
+
|
|
5349
|
+
// src/withdrawal/useWithdrawalStatus.ts
|
|
5350
|
+
import {
|
|
5351
|
+
CheckoutState,
|
|
5352
|
+
RelayExecutionStatus,
|
|
5353
|
+
getDirectExecutionByTxHash
|
|
5354
|
+
} from "@funkit/api-base";
|
|
5355
|
+
import {
|
|
5356
|
+
isTerminalRelayStatus,
|
|
5357
|
+
mapRelayExecutionStatusToCheckoutState
|
|
5358
|
+
} from "@funkit/connect-core";
|
|
5359
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
5360
|
+
var WITHDRAWAL_STATUS_QUERY_KEY = "withdrawalStatus";
|
|
5361
|
+
var POLL_INTERVAL_MS = 1500;
|
|
5362
|
+
var MAX_FETCHES_WITHOUT_RECORD = 10;
|
|
5363
|
+
function shouldKeepPollingStatus({
|
|
5364
|
+
status,
|
|
5365
|
+
hasRecord,
|
|
5366
|
+
failedFetches
|
|
5367
|
+
}) {
|
|
5368
|
+
if (isTerminalRelayStatus(status)) return false;
|
|
5369
|
+
return hasRecord || failedFetches < MAX_FETCHES_WITHOUT_RECORD;
|
|
5370
|
+
}
|
|
5371
|
+
function useWithdrawalStatus(txHash) {
|
|
5372
|
+
const { apiKey } = useFunkitIdentity();
|
|
5373
|
+
const query = useQuery5({
|
|
5374
|
+
queryKey: [WITHDRAWAL_STATUS_QUERY_KEY, apiKey, txHash],
|
|
5375
|
+
queryFn: () => getDirectExecutionByTxHash({
|
|
5376
|
+
txHash,
|
|
5377
|
+
apiKey,
|
|
5378
|
+
logger
|
|
5379
|
+
}),
|
|
5380
|
+
enabled: !!apiKey && !!txHash,
|
|
5381
|
+
refetchInterval: (query2) => {
|
|
5382
|
+
const hasRecord = query2.state.data !== void 0;
|
|
5383
|
+
const keepPolling = shouldKeepPollingStatus({
|
|
5384
|
+
status: query2.state.data?.listenerInfo?.status,
|
|
5385
|
+
hasRecord,
|
|
5386
|
+
failedFetches: query2.state.errorUpdateCount
|
|
5387
|
+
});
|
|
5388
|
+
if (keepPolling) return POLL_INTERVAL_MS;
|
|
5389
|
+
if (!hasRecord) {
|
|
5390
|
+
logger.warn("connect-rn:crypto-withdrawal:status_record_never_appeared");
|
|
5391
|
+
}
|
|
5392
|
+
return false;
|
|
5393
|
+
},
|
|
5394
|
+
refetchOnWindowFocus: false,
|
|
5395
|
+
// The record lands slightly after the tx, so early 404s are expected.
|
|
5396
|
+
retry: 3
|
|
5397
|
+
});
|
|
5398
|
+
const status = query.data?.listenerInfo?.status;
|
|
5399
|
+
const state = status ? mapRelayExecutionStatusToCheckoutState(status) : void 0;
|
|
5400
|
+
return {
|
|
5401
|
+
status,
|
|
5402
|
+
isCompleted: state === CheckoutState.COMPLETED,
|
|
5403
|
+
isFailed: state === CheckoutState.CHECKOUT_ERROR,
|
|
5404
|
+
isRefunded: status === RelayExecutionStatus.REFUND
|
|
5405
|
+
};
|
|
5406
|
+
}
|
|
5407
|
+
|
|
5408
|
+
// src/screens/WithdrawCompleteScreen.tsx
|
|
5409
|
+
import { Pressable as Pressable12, StyleSheet as StyleSheet15 } from "react-native";
|
|
5410
|
+
import { jsx as jsx30, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5411
|
+
function WithdrawCompleteScreen({
|
|
5412
|
+
isPending,
|
|
5413
|
+
isFailed = false,
|
|
5414
|
+
isRefunded = false,
|
|
5415
|
+
amountLabel,
|
|
5416
|
+
onDone
|
|
5417
|
+
}) {
|
|
5418
|
+
const { t } = useFunkitTranslation();
|
|
5419
|
+
const theme = useTheme();
|
|
5420
|
+
return /* @__PURE__ */ jsxs16(Box, { children: [
|
|
5421
|
+
/* @__PURE__ */ jsx30(Grabber, {}),
|
|
5422
|
+
/* @__PURE__ */ jsxs16(Box, { alignItems: "center", style: styles15.body, children: [
|
|
5423
|
+
isFailed ? /* @__PURE__ */ jsx30(
|
|
5424
|
+
FigmaAlertCircleIcon,
|
|
5425
|
+
{
|
|
5426
|
+
size: 48,
|
|
5427
|
+
color: theme.content.elements.error
|
|
5428
|
+
}
|
|
5429
|
+
) : /* @__PURE__ */ jsx30(FigmaSuccessCheckIcon, { size: 48 }),
|
|
5430
|
+
/* @__PURE__ */ jsx30(
|
|
5431
|
+
Text,
|
|
5432
|
+
{
|
|
5433
|
+
variant: "headerTitle",
|
|
5434
|
+
style: { color: theme.content.elements.primary },
|
|
5435
|
+
children: resolveTitle({ t, isPending, isFailed })
|
|
5436
|
+
}
|
|
5437
|
+
),
|
|
5438
|
+
/* @__PURE__ */ jsx30(
|
|
5439
|
+
Text,
|
|
5440
|
+
{
|
|
5441
|
+
variant: "detail",
|
|
5442
|
+
style: [styles15.detail, { color: theme.content.elements.secondary }],
|
|
5443
|
+
children: resolveMessage({ t, isPending, isFailed, isRefunded, amountLabel })
|
|
5444
|
+
}
|
|
5445
|
+
),
|
|
5446
|
+
/* @__PURE__ */ jsx30(
|
|
5447
|
+
Pressable12,
|
|
5448
|
+
{
|
|
5449
|
+
onPress: onDone,
|
|
5450
|
+
accessibilityRole: "button",
|
|
5451
|
+
accessibilityLabel: t("common.done"),
|
|
5452
|
+
children: /* @__PURE__ */ jsx30(
|
|
5453
|
+
Box,
|
|
5454
|
+
{
|
|
5455
|
+
alignItems: "center",
|
|
5456
|
+
justifyContent: "center",
|
|
5457
|
+
borderRadius: "button",
|
|
5458
|
+
style: [
|
|
5459
|
+
styles15.done,
|
|
5460
|
+
{
|
|
5461
|
+
height: theme.sizes.buttonHeight,
|
|
5462
|
+
backgroundColor: theme.background.button.primary.default
|
|
5463
|
+
}
|
|
5464
|
+
],
|
|
5465
|
+
children: /* @__PURE__ */ jsx30(
|
|
5466
|
+
Text,
|
|
5467
|
+
{
|
|
5468
|
+
variant: "bodyMedium",
|
|
5469
|
+
style: { color: theme.content.button.primary.default },
|
|
5470
|
+
children: t("common.done")
|
|
5471
|
+
}
|
|
5472
|
+
)
|
|
5473
|
+
}
|
|
5474
|
+
)
|
|
5475
|
+
}
|
|
5476
|
+
)
|
|
5477
|
+
] })
|
|
5478
|
+
] });
|
|
5479
|
+
}
|
|
5480
|
+
function resolveTitle({
|
|
5481
|
+
t,
|
|
5482
|
+
isPending,
|
|
5483
|
+
isFailed
|
|
5484
|
+
}) {
|
|
5485
|
+
if (isFailed) return t("withdrawCrypto.failedTitle");
|
|
5486
|
+
if (isPending) return t("withdrawCrypto.successPendingTitle");
|
|
5487
|
+
return t("withdrawCrypto.successTitle");
|
|
5488
|
+
}
|
|
5489
|
+
function resolveMessage({
|
|
5490
|
+
t,
|
|
5491
|
+
isPending,
|
|
5492
|
+
isFailed,
|
|
5493
|
+
isRefunded,
|
|
5494
|
+
amountLabel
|
|
5495
|
+
}) {
|
|
5496
|
+
if (isRefunded)
|
|
5497
|
+
return t("withdrawCrypto.refundedMessage", { amount: amountLabel });
|
|
5498
|
+
if (isFailed)
|
|
5499
|
+
return t("withdrawCrypto.failedMessage", { amount: amountLabel });
|
|
5500
|
+
if (isPending)
|
|
5501
|
+
return t("withdrawCrypto.successPendingMessage", { amount: amountLabel });
|
|
5502
|
+
return t("withdrawCrypto.successMessage", { amount: amountLabel });
|
|
5503
|
+
}
|
|
5504
|
+
var styles15 = StyleSheet15.create({
|
|
5505
|
+
body: { paddingHorizontal: 16, paddingTop: 32, paddingBottom: 24, gap: 12 },
|
|
5506
|
+
detail: { textAlign: "center" },
|
|
5507
|
+
done: { alignSelf: "stretch", marginTop: 12, paddingHorizontal: 16 }
|
|
5508
|
+
});
|
|
5509
|
+
|
|
5510
|
+
// src/screens/WithdrawCryptoComplete.tsx
|
|
5511
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
5512
|
+
function WithdrawCryptoComplete({
|
|
5513
|
+
txHash,
|
|
5514
|
+
amountLabel,
|
|
5515
|
+
callbacks,
|
|
5516
|
+
onDone
|
|
5517
|
+
}) {
|
|
5518
|
+
const { isCompleted, isFailed, isRefunded } = useWithdrawalStatus(txHash);
|
|
5519
|
+
const notifiedRef = useRef7(false);
|
|
5520
|
+
useEffect9(() => {
|
|
5521
|
+
if (notifiedRef.current) return;
|
|
5522
|
+
if (isCompleted) {
|
|
5523
|
+
notifiedRef.current = true;
|
|
5524
|
+
callbacks.onWithdrawalSuccess?.({ txHash });
|
|
5525
|
+
return;
|
|
5526
|
+
}
|
|
5527
|
+
if (isFailed) {
|
|
5528
|
+
notifiedRef.current = true;
|
|
5529
|
+
callbacks.onWithdrawalError?.({
|
|
5530
|
+
message: isRefunded ? "Withdrawal was refunded" : "Withdrawal failed on-chain"
|
|
5531
|
+
});
|
|
5532
|
+
}
|
|
5533
|
+
}, [isCompleted, isFailed, isRefunded, callbacks, txHash]);
|
|
5534
|
+
return /* @__PURE__ */ jsx31(
|
|
5535
|
+
WithdrawCompleteScreen,
|
|
5536
|
+
{
|
|
5537
|
+
isPending: !isCompleted && !isFailed,
|
|
5538
|
+
isFailed,
|
|
5539
|
+
isRefunded,
|
|
5540
|
+
amountLabel,
|
|
5541
|
+
onDone
|
|
5542
|
+
}
|
|
5543
|
+
);
|
|
5544
|
+
}
|
|
5545
|
+
|
|
5546
|
+
// src/screens/WithdrawMethodScreen.tsx
|
|
5547
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
5548
|
+
function getTerminalError(t, isBelowMinimum, isEmpty) {
|
|
5549
|
+
if (isBelowMinimum) {
|
|
5550
|
+
return {
|
|
5551
|
+
title: t("withdraw.belowMinimumTitle"),
|
|
5552
|
+
message: t("withdraw.belowMinimumMessage")
|
|
5553
|
+
};
|
|
5554
|
+
}
|
|
5555
|
+
if (isEmpty) {
|
|
5556
|
+
return {
|
|
5557
|
+
title: t("withdraw.unavailableTitle"),
|
|
5558
|
+
message: t("withdraw.unavailableMessage")
|
|
5559
|
+
};
|
|
5560
|
+
}
|
|
5561
|
+
return null;
|
|
5562
|
+
}
|
|
5563
|
+
function WithdrawMethodScreen(props) {
|
|
5564
|
+
const { t } = useFunkitTranslation();
|
|
5565
|
+
const {
|
|
5566
|
+
methods,
|
|
5567
|
+
onSelectMethod,
|
|
5568
|
+
title,
|
|
5569
|
+
loading = false,
|
|
5570
|
+
hasError = false,
|
|
5571
|
+
onRetry,
|
|
5572
|
+
isEmpty = false,
|
|
5573
|
+
isBelowMinimum = false,
|
|
5574
|
+
note
|
|
5575
|
+
} = props;
|
|
5576
|
+
const terminalError = getTerminalError(t, isBelowMinimum, isEmpty);
|
|
5577
|
+
if (terminalError && !hasError && !loading) {
|
|
5578
|
+
return /* @__PURE__ */ jsx32(
|
|
5579
|
+
SelectMethodScreen,
|
|
5580
|
+
{
|
|
5581
|
+
title,
|
|
5582
|
+
methods: [],
|
|
5583
|
+
onSelectMethod,
|
|
5584
|
+
error: true,
|
|
5585
|
+
errorTitle: terminalError.title,
|
|
5586
|
+
errorMessage: terminalError.message
|
|
5587
|
+
}
|
|
5588
|
+
);
|
|
5589
|
+
}
|
|
5590
|
+
return /* @__PURE__ */ jsx32(
|
|
5591
|
+
SelectMethodScreen,
|
|
5592
|
+
{
|
|
5593
|
+
title,
|
|
5594
|
+
methods,
|
|
5595
|
+
onSelectMethod,
|
|
5596
|
+
loading,
|
|
5597
|
+
error: hasError,
|
|
5598
|
+
onRetry,
|
|
5599
|
+
errorTitle: t("selectMethod.errorTitle"),
|
|
5600
|
+
errorMessage: t("selectMethod.errorMessage"),
|
|
5601
|
+
note
|
|
5602
|
+
}
|
|
5603
|
+
);
|
|
5604
|
+
}
|
|
5605
|
+
|
|
5606
|
+
// src/swapped/SwappedScreen.tsx
|
|
5607
|
+
import { useCallback as useCallback5 } from "react";
|
|
5608
|
+
|
|
5609
|
+
// src/swapped/SwappedScreenShell.tsx
|
|
5610
|
+
import { useCallback as useCallback4 } from "react";
|
|
5611
|
+
|
|
5612
|
+
// src/swapped/SwappedWebView.tsx
|
|
5613
|
+
import { useTheme as useTheme2 } from "@shopify/restyle";
|
|
5614
|
+
import { useCallback as useCallback3, useEffect as useEffect10, useMemo as useMemo6, useRef as useRef8 } from "react";
|
|
5615
|
+
import { ActivityIndicator, View as View4 } from "react-native";
|
|
3855
5616
|
import {
|
|
3856
5617
|
WebView
|
|
3857
5618
|
} from "react-native-webview";
|
|
@@ -4110,11 +5871,11 @@ function createWebViewSwappedTransport({
|
|
|
4110
5871
|
}
|
|
4111
5872
|
|
|
4112
5873
|
// src/swapped/SwappedWebView.tsx
|
|
4113
|
-
import { jsx as
|
|
5874
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
4114
5875
|
function SwappedWebView({ url, onMessage, style }) {
|
|
4115
|
-
const webViewRef =
|
|
4116
|
-
const lastCommittedUrlRef =
|
|
4117
|
-
const { transport, dispatch } =
|
|
5876
|
+
const webViewRef = useRef8(null);
|
|
5877
|
+
const lastCommittedUrlRef = useRef8(url);
|
|
5878
|
+
const { transport, dispatch } = useMemo6(
|
|
4118
5879
|
() => createWebViewSwappedTransport({
|
|
4119
5880
|
getWebView: () => webViewRef.current
|
|
4120
5881
|
}),
|
|
@@ -4122,17 +5883,17 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
4122
5883
|
);
|
|
4123
5884
|
const theme = useTheme2();
|
|
4124
5885
|
const { colorScheme } = useFunkitColorScheme();
|
|
4125
|
-
const swappedTheme =
|
|
5886
|
+
const swappedTheme = useMemo6(
|
|
4126
5887
|
() => buildSwappedThemeRN(theme, colorScheme === "dark"),
|
|
4127
5888
|
[theme, colorScheme]
|
|
4128
5889
|
);
|
|
4129
|
-
const swappedThemeRef =
|
|
5890
|
+
const swappedThemeRef = useRef8(swappedTheme);
|
|
4130
5891
|
swappedThemeRef.current = swappedTheme;
|
|
4131
|
-
const colorSchemeRef =
|
|
5892
|
+
const colorSchemeRef = useRef8(colorScheme);
|
|
4132
5893
|
colorSchemeRef.current = colorScheme;
|
|
4133
|
-
const handlerRef =
|
|
5894
|
+
const handlerRef = useRef8(onMessage);
|
|
4134
5895
|
handlerRef.current = onMessage;
|
|
4135
|
-
|
|
5896
|
+
useEffect10(
|
|
4136
5897
|
() => transport.onMessage((msg) => {
|
|
4137
5898
|
if (msg.type === "SWAPPED_READY") {
|
|
4138
5899
|
transport.send({
|
|
@@ -4158,12 +5919,12 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
4158
5919
|
event.nativeEvent.url || lastCommittedUrlRef.current
|
|
4159
5920
|
);
|
|
4160
5921
|
};
|
|
4161
|
-
const renderLoading =
|
|
4162
|
-
() => /* @__PURE__ */
|
|
4163
|
-
|
|
5922
|
+
const renderLoading = useCallback3(
|
|
5923
|
+
() => /* @__PURE__ */ jsx33(
|
|
5924
|
+
View4,
|
|
4164
5925
|
{
|
|
4165
5926
|
style: [loadingOverlay, { backgroundColor: theme.background.modal }],
|
|
4166
|
-
children: /* @__PURE__ */
|
|
5927
|
+
children: /* @__PURE__ */ jsx33(ActivityIndicator, { color: theme.content.elements.secondary })
|
|
4167
5928
|
}
|
|
4168
5929
|
),
|
|
4169
5930
|
[theme.background.modal, theme.content.elements.secondary]
|
|
@@ -4181,7 +5942,7 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
4181
5942
|
url: event.nativeEvent.url
|
|
4182
5943
|
});
|
|
4183
5944
|
};
|
|
4184
|
-
return /* @__PURE__ */
|
|
5945
|
+
return /* @__PURE__ */ jsx33(
|
|
4185
5946
|
WebView,
|
|
4186
5947
|
{
|
|
4187
5948
|
ref: webViewRef,
|
|
@@ -4220,13 +5981,13 @@ var loadingOverlay = {
|
|
|
4220
5981
|
};
|
|
4221
5982
|
|
|
4222
5983
|
// src/swapped/SwappedScreenShell.tsx
|
|
4223
|
-
import { jsx as
|
|
5984
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
4224
5985
|
function SwappedScreenShell({
|
|
4225
5986
|
url,
|
|
4226
5987
|
onMessage
|
|
4227
5988
|
}) {
|
|
4228
5989
|
const theme = useTheme();
|
|
4229
|
-
const handleMessage =
|
|
5990
|
+
const handleMessage = useCallback4(
|
|
4230
5991
|
(msg) => {
|
|
4231
5992
|
if (msg.type === "SWAPPED_ERROR") {
|
|
4232
5993
|
logger.warn("connect-rn:swapped:error", {
|
|
@@ -4237,13 +5998,13 @@ function SwappedScreenShell({
|
|
|
4237
5998
|
},
|
|
4238
5999
|
[onMessage]
|
|
4239
6000
|
);
|
|
4240
|
-
return /* @__PURE__ */
|
|
6001
|
+
return /* @__PURE__ */ jsx34(
|
|
4241
6002
|
Box,
|
|
4242
6003
|
{
|
|
4243
6004
|
borderTopLeftRadius: "modal",
|
|
4244
6005
|
borderTopRightRadius: "modal",
|
|
4245
6006
|
style: [sheet2, { backgroundColor: theme.background.modal }],
|
|
4246
|
-
children: /* @__PURE__ */
|
|
6007
|
+
children: /* @__PURE__ */ jsx34(SwappedWebView, { url, onMessage: handleMessage, style: fill })
|
|
4247
6008
|
}
|
|
4248
6009
|
);
|
|
4249
6010
|
}
|
|
@@ -4252,14 +6013,14 @@ var sheet2 = { height: SHEET_HEIGHT, overflow: "hidden" };
|
|
|
4252
6013
|
var fill = { flex: 1 };
|
|
4253
6014
|
|
|
4254
6015
|
// src/swapped/SwappedScreen.tsx
|
|
4255
|
-
import { jsx as
|
|
6016
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
4256
6017
|
function SwappedScreen({
|
|
4257
6018
|
url,
|
|
4258
6019
|
onClose,
|
|
4259
6020
|
onBack,
|
|
4260
6021
|
onSuccess
|
|
4261
6022
|
}) {
|
|
4262
|
-
const handleMessage =
|
|
6023
|
+
const handleMessage = useCallback5(
|
|
4263
6024
|
(msg) => {
|
|
4264
6025
|
switch (msg.type) {
|
|
4265
6026
|
case "SWAPPED_GO_BACK":
|
|
@@ -4279,15 +6040,15 @@ function SwappedScreen({
|
|
|
4279
6040
|
},
|
|
4280
6041
|
[onBack, onClose, onSuccess]
|
|
4281
6042
|
);
|
|
4282
|
-
return /* @__PURE__ */
|
|
6043
|
+
return /* @__PURE__ */ jsx35(SwappedScreenShell, { url, onMessage: handleMessage });
|
|
4283
6044
|
}
|
|
4284
6045
|
|
|
4285
6046
|
// src/swapped/SwappedWithdrawScreen.tsx
|
|
4286
6047
|
import {
|
|
4287
6048
|
isValidOrderData
|
|
4288
6049
|
} from "@funkit/connect-core";
|
|
4289
|
-
import { useCallback as
|
|
4290
|
-
import { jsx as
|
|
6050
|
+
import { useCallback as useCallback6 } from "react";
|
|
6051
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
4291
6052
|
function SwappedWithdrawScreen({
|
|
4292
6053
|
url,
|
|
4293
6054
|
onClose,
|
|
@@ -4296,7 +6057,7 @@ function SwappedWithdrawScreen({
|
|
|
4296
6057
|
onWithdrawalSuccess,
|
|
4297
6058
|
onOrderData
|
|
4298
6059
|
}) {
|
|
4299
|
-
const handleMessage =
|
|
6060
|
+
const handleMessage = useCallback6(
|
|
4300
6061
|
(msg) => {
|
|
4301
6062
|
switch (msg.type) {
|
|
4302
6063
|
case "SWAPPED_GO_BACK":
|
|
@@ -4331,11 +6092,10 @@ function SwappedWithdrawScreen({
|
|
|
4331
6092
|
},
|
|
4332
6093
|
[onBack, onClose, onNewWithdrawal, onWithdrawalSuccess, onOrderData]
|
|
4333
6094
|
);
|
|
4334
|
-
return /* @__PURE__ */
|
|
6095
|
+
return /* @__PURE__ */ jsx36(SwappedScreenShell, { url, onMessage: handleMessage });
|
|
4335
6096
|
}
|
|
4336
6097
|
|
|
4337
6098
|
// src/transfer/availableChains.ts
|
|
4338
|
-
import { chainMetadataById } from "@funkit/chains";
|
|
4339
6099
|
import {
|
|
4340
6100
|
getConfiguredMinDepositUsd,
|
|
4341
6101
|
getMinTransferValueUsd
|
|
@@ -4348,7 +6108,6 @@ function buildAvailableChains({
|
|
|
4348
6108
|
}) {
|
|
4349
6109
|
const minDepositAddOn = getConfiguredMinDepositUsd(target);
|
|
4350
6110
|
return chainFilters.filter((f) => f.id !== "all").map((f) => ({ chainId: Number(f.id), name: f.label })).map(({ chainId, name }) => {
|
|
4351
|
-
const meta = chainMetadataById[chainId];
|
|
4352
6111
|
const min = getMinTransferValueUsd(
|
|
4353
6112
|
chainId,
|
|
4354
6113
|
minTransferLimits,
|
|
@@ -4356,8 +6115,8 @@ function buildAvailableChains({
|
|
|
4356
6115
|
);
|
|
4357
6116
|
return {
|
|
4358
6117
|
id: String(chainId),
|
|
4359
|
-
name: name ||
|
|
4360
|
-
iconUri:
|
|
6118
|
+
name: name || chainName(chainId) || t("networks.chainFallback", { chainId }),
|
|
6119
|
+
iconUri: chainIconUri2(chainId),
|
|
4361
6120
|
minLabel: t("networks.minimum", { min })
|
|
4362
6121
|
};
|
|
4363
6122
|
});
|
|
@@ -4417,9 +6176,9 @@ function formatDepositAddress(address, leading = 6, trailing = 6) {
|
|
|
4417
6176
|
|
|
4418
6177
|
// src/transfer/hooks/useFiatExchangeRates.ts
|
|
4419
6178
|
import { getFiatExchangeRates } from "@funkit/api-base";
|
|
4420
|
-
import { useQuery } from "@tanstack/react-query";
|
|
6179
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
4421
6180
|
function useFiatExchangeRates(enabled = true) {
|
|
4422
|
-
const { data, isLoading, error } =
|
|
6181
|
+
const { data, isLoading, error } = useQuery6({
|
|
4423
6182
|
queryKey: ["fiatExchangeRates"],
|
|
4424
6183
|
queryFn: () => getFiatExchangeRates({ logger }),
|
|
4425
6184
|
refetchOnMount: false,
|
|
@@ -4451,8 +6210,8 @@ import {
|
|
|
4451
6210
|
useSwappedDefaultCurrencyQuery
|
|
4452
6211
|
} from "@funkit/connect-core";
|
|
4453
6212
|
import { useTheme as useTheme3 } from "@shopify/restyle";
|
|
4454
|
-
import { useQuery as
|
|
4455
|
-
import { useMemo as
|
|
6213
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
6214
|
+
import { useMemo as useMemo8 } from "react";
|
|
4456
6215
|
|
|
4457
6216
|
// src/transfer/hooks/useTransferInit.ts
|
|
4458
6217
|
import {
|
|
@@ -4461,13 +6220,34 @@ import {
|
|
|
4461
6220
|
import {
|
|
4462
6221
|
getCheckoutTokenTransferParams
|
|
4463
6222
|
} from "@funkit/connect-core";
|
|
4464
|
-
import { useQuery as
|
|
6223
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
6224
|
+
import { useEffect as useEffect11 } from "react";
|
|
6225
|
+
|
|
6226
|
+
// src/transfer/hooks/useLighterDepositRecipientOverride.ts
|
|
6227
|
+
import { LIGHTER_CHAIN_ID } from "@funkit/chains";
|
|
6228
|
+
import { useLighterAccountsQuery } from "@funkit/connect-core";
|
|
6229
|
+
function useLighterDepositRecipientOverride({
|
|
6230
|
+
apiKey,
|
|
6231
|
+
targetChain,
|
|
6232
|
+
walletAddress
|
|
6233
|
+
}) {
|
|
6234
|
+
const isLighterDeposit = isLighterxyzApiKey(apiKey) && targetChain === LIGHTER_CHAIN_ID.toString();
|
|
6235
|
+
const { mainAccountIndex, isFetching, status } = useLighterAccountsQuery({
|
|
6236
|
+
address: isLighterDeposit ? walletAddress : void 0
|
|
6237
|
+
});
|
|
6238
|
+
return {
|
|
6239
|
+
isLighterDeposit,
|
|
6240
|
+
recipientOverride: mainAccountIndex,
|
|
6241
|
+
isLookupFetching: isFetching,
|
|
6242
|
+
lookupStatus: status
|
|
6243
|
+
};
|
|
6244
|
+
}
|
|
4465
6245
|
|
|
4466
6246
|
// src/transfer/hooks/useUDAParams.ts
|
|
4467
|
-
import { useMemo as
|
|
6247
|
+
import { useMemo as useMemo7 } from "react";
|
|
4468
6248
|
function useUDAParams(dynamicRoutingId) {
|
|
4469
6249
|
const udaParams = useDynamicConfig("uda_params");
|
|
4470
|
-
return
|
|
6250
|
+
return useMemo7(
|
|
4471
6251
|
() => udaParams.find((param) => param.dynamicRoutingId === dynamicRoutingId)?.params,
|
|
4472
6252
|
[udaParams, dynamicRoutingId]
|
|
4473
6253
|
);
|
|
@@ -4483,7 +6263,44 @@ function useTransferInit({
|
|
|
4483
6263
|
}) {
|
|
4484
6264
|
const { apiKey, userId, walletAddress } = useFunkitIdentity();
|
|
4485
6265
|
const udaParams = useUDAParams(dynamicRoutingId);
|
|
4486
|
-
const
|
|
6266
|
+
const {
|
|
6267
|
+
isLighterDeposit,
|
|
6268
|
+
recipientOverride: lighterRecipientOverride,
|
|
6269
|
+
isLookupFetching,
|
|
6270
|
+
lookupStatus
|
|
6271
|
+
} = useLighterDepositRecipientOverride({
|
|
6272
|
+
apiKey,
|
|
6273
|
+
targetChain: udaParams?.targetChain,
|
|
6274
|
+
walletAddress
|
|
6275
|
+
});
|
|
6276
|
+
const resolvedRecipient = (() => {
|
|
6277
|
+
if (isLighterDeposit && lighterRecipientOverride) {
|
|
6278
|
+
return lighterRecipientOverride;
|
|
6279
|
+
}
|
|
6280
|
+
return recipientAddr || walletAddress || "0x";
|
|
6281
|
+
})();
|
|
6282
|
+
const isLighterWalletFallback = isLighterDeposit && !lighterRecipientOverride && !recipientAddr;
|
|
6283
|
+
useEffect11(() => {
|
|
6284
|
+
if (isLighterDeposit && lighterRecipientOverride) {
|
|
6285
|
+
logger.info("checkout:recipient:lighterMainAccount", {
|
|
6286
|
+
mainAccountIndex: lighterRecipientOverride,
|
|
6287
|
+
targetChain: udaParams?.targetChain
|
|
6288
|
+
});
|
|
6289
|
+
}
|
|
6290
|
+
}, [isLighterDeposit, lighterRecipientOverride, udaParams?.targetChain]);
|
|
6291
|
+
useEffect11(() => {
|
|
6292
|
+
if (isLighterWalletFallback && !isLookupFetching) {
|
|
6293
|
+
logger.warn("checkout:recipient:lighterMainAccountUnresolved", {
|
|
6294
|
+
targetChain: udaParams?.targetChain,
|
|
6295
|
+
lookupStatus
|
|
6296
|
+
});
|
|
6297
|
+
}
|
|
6298
|
+
}, [
|
|
6299
|
+
isLighterWalletFallback,
|
|
6300
|
+
isLookupFetching,
|
|
6301
|
+
lookupStatus,
|
|
6302
|
+
udaParams?.targetChain
|
|
6303
|
+
]);
|
|
4487
6304
|
const params = getCheckoutTokenTransferParams({
|
|
4488
6305
|
checkoutConfig,
|
|
4489
6306
|
userId,
|
|
@@ -4491,14 +6308,14 @@ function useTransferInit({
|
|
|
4491
6308
|
recipientAddr: resolvedRecipient,
|
|
4492
6309
|
udaParams
|
|
4493
6310
|
});
|
|
4494
|
-
const { data, isLoading, isFetching } =
|
|
6311
|
+
const { data, isLoading, isFetching } = useQuery7({
|
|
4495
6312
|
queryKey: ["initializeCheckoutTokenTransferAddress", params],
|
|
4496
6313
|
queryFn: ({ queryKey: [, queryParams] }) => queryParams ? initializeCheckoutTokenTransferAddress({
|
|
4497
6314
|
...queryParams,
|
|
4498
6315
|
logger,
|
|
4499
6316
|
clientMetadata: TRANSFER_CLIENT_METADATA
|
|
4500
6317
|
}) : void 0,
|
|
4501
|
-
enabled: enabled && !!params,
|
|
6318
|
+
enabled: enabled && !!params && !isLighterWalletFallback,
|
|
4502
6319
|
refetchOnWindowFocus: false,
|
|
4503
6320
|
refetchOnMount: false
|
|
4504
6321
|
});
|
|
@@ -4552,7 +6369,7 @@ function useFopsQueryInput({
|
|
|
4552
6369
|
logger
|
|
4553
6370
|
});
|
|
4554
6371
|
const theme = useTheme3();
|
|
4555
|
-
const themeConfig =
|
|
6372
|
+
const themeConfig = useMemo8(
|
|
4556
6373
|
() => buildSwappedThemeQueryParamsRN(theme),
|
|
4557
6374
|
[theme]
|
|
4558
6375
|
);
|
|
@@ -4617,7 +6434,7 @@ function useDoFetchFops({
|
|
|
4617
6434
|
prefillFiatEmail,
|
|
4618
6435
|
enabled
|
|
4619
6436
|
}) {
|
|
4620
|
-
return
|
|
6437
|
+
return useQuery8({
|
|
4621
6438
|
queryKey,
|
|
4622
6439
|
queryFn: async ({ queryKey: [_, params] }) => {
|
|
4623
6440
|
const { recipientAddress, targetAsset, targetChain, fopPriority } = params;
|
|
@@ -4693,12 +6510,12 @@ import {
|
|
|
4693
6510
|
} from "@funkit/connect-core";
|
|
4694
6511
|
import { useTheme as useTheme4 } from "@shopify/restyle";
|
|
4695
6512
|
import { useStatsigClient } from "@statsig/react-bindings";
|
|
4696
|
-
import { useQuery as
|
|
4697
|
-
import { useMemo as
|
|
6513
|
+
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
6514
|
+
import { useMemo as useMemo9 } from "react";
|
|
4698
6515
|
var WITHDRAW_FOPS_QUERY_KEY = "withdrawFops";
|
|
4699
6516
|
function useWithdrawalRoute(config) {
|
|
4700
6517
|
const sourceOverrides = useDynamicConfig("swappedwithdrawalsourceoverrides");
|
|
4701
|
-
return
|
|
6518
|
+
return useMemo9(
|
|
4702
6519
|
() => resolveSwappedWithdrawalLegs({
|
|
4703
6520
|
source: config.sourceToken,
|
|
4704
6521
|
target: config.swappedAcceptedToken,
|
|
@@ -4714,7 +6531,7 @@ function useWithdrawalSellCap(config, walletAddress) {
|
|
|
4714
6531
|
const { sourceUsdBalance } = config;
|
|
4715
6532
|
const isBalanceCallback = typeof sourceUsdBalance === "function";
|
|
4716
6533
|
const hasBalanceInfo = sourceUsdBalance != null;
|
|
4717
|
-
const balanceQuery =
|
|
6534
|
+
const balanceQuery = useQuery9({
|
|
4718
6535
|
queryKey: [
|
|
4719
6536
|
"withdrawSourceUsdBalance",
|
|
4720
6537
|
walletAddress,
|
|
@@ -4831,13 +6648,13 @@ function useWithdrawalFops({
|
|
|
4831
6648
|
logger
|
|
4832
6649
|
});
|
|
4833
6650
|
const theme = useTheme4();
|
|
4834
|
-
const themeConfig =
|
|
6651
|
+
const themeConfig = useMemo9(
|
|
4835
6652
|
() => buildSwappedThemeQueryParamsRN(theme),
|
|
4836
6653
|
[theme]
|
|
4837
6654
|
);
|
|
4838
6655
|
const { usdBalance, eurMax, isBelowMinimumBalance, isAwaitingCap } = useWithdrawalSellCap(config, walletAddress);
|
|
4839
6656
|
const isEnabled = enabled && isWithdrawalEnabled && !!apiKey && !!userId && !!walletAddress && walletAddress !== "0x" && !!countryCode && !isSwappedCurrencyCodeLoading && !isAwaitingCap;
|
|
4840
|
-
const query =
|
|
6657
|
+
const query = useQuery9({
|
|
4841
6658
|
// `prefillFiatEmail` is intentionally NOT in the queryKey (web parity): it's
|
|
4842
6659
|
// read at fetch time, so post-mount changes don't trigger a refetch.
|
|
4843
6660
|
queryKey: [
|
|
@@ -4895,31 +6712,13 @@ function useWithdrawalFops({
|
|
|
4895
6712
|
|
|
4896
6713
|
// src/withdrawal/useWithdrawalExecution.ts
|
|
4897
6714
|
import {
|
|
4898
|
-
ensureRelayClientInitialized,
|
|
4899
|
-
|
|
6715
|
+
ensureRelayClientInitialized as ensureRelayClientInitialized2,
|
|
6716
|
+
getPublicClientFor as getPublicClientFor2,
|
|
6717
|
+
isUserRejectedError as isUserRejectedError2,
|
|
4900
6718
|
processFiatWithdrawalOrder,
|
|
4901
6719
|
toFiatWithdrawalOrder
|
|
4902
6720
|
} from "@funkit/connect-core";
|
|
4903
|
-
import { useCallback as
|
|
4904
|
-
|
|
4905
|
-
// src/withdrawal/publicClient.ts
|
|
4906
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO } from "@funkit/chains";
|
|
4907
|
-
import { createPublicClient, fallback, http } from "viem";
|
|
4908
|
-
var clients = /* @__PURE__ */ new Map();
|
|
4909
|
-
function getPublicClientFor(chainId) {
|
|
4910
|
-
const cached = clients.get(chainId);
|
|
4911
|
-
if (cached) return cached;
|
|
4912
|
-
const info = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[chainId];
|
|
4913
|
-
if (!info) return void 0;
|
|
4914
|
-
const client = createPublicClient({
|
|
4915
|
-
chain: info.chainInfo,
|
|
4916
|
-
transport: info.fallbackRpcUrls.length ? fallback(info.fallbackRpcUrls.map((url) => http(url))) : http()
|
|
4917
|
-
});
|
|
4918
|
-
clients.set(chainId, client);
|
|
4919
|
-
return client;
|
|
4920
|
-
}
|
|
4921
|
-
|
|
4922
|
-
// src/withdrawal/useWithdrawalExecution.ts
|
|
6721
|
+
import { useCallback as useCallback7, useRef as useRef9 } from "react";
|
|
4923
6722
|
var submittedOrderIds = /* @__PURE__ */ new Set();
|
|
4924
6723
|
function useWithdrawalExecution({
|
|
4925
6724
|
config,
|
|
@@ -4928,8 +6727,8 @@ function useWithdrawalExecution({
|
|
|
4928
6727
|
onError
|
|
4929
6728
|
}) {
|
|
4930
6729
|
const { apiKey, userId } = useFunkitIdentity();
|
|
4931
|
-
const isProcessingRef =
|
|
4932
|
-
const executeOrder =
|
|
6730
|
+
const isProcessingRef = useRef9(false);
|
|
6731
|
+
const executeOrder = useCallback7(
|
|
4933
6732
|
async (data) => {
|
|
4934
6733
|
const order = toFiatWithdrawalOrder(data);
|
|
4935
6734
|
if (isProcessingRef.current) {
|
|
@@ -4958,7 +6757,7 @@ function useWithdrawalExecution({
|
|
|
4958
6757
|
});
|
|
4959
6758
|
let txHash;
|
|
4960
6759
|
try {
|
|
4961
|
-
|
|
6760
|
+
ensureRelayClientInitialized2(logger, "funkit-connect-rn");
|
|
4962
6761
|
({ txHash } = await processFiatWithdrawalOrder({
|
|
4963
6762
|
order,
|
|
4964
6763
|
wallet: config.withdrawalWallet,
|
|
@@ -4969,10 +6768,10 @@ function useWithdrawalExecution({
|
|
|
4969
6768
|
// Read the target token's decimals on-chain (via publicClient) rather
|
|
4970
6769
|
// than trusting host-config `decimals` — a stale/wrong value would
|
|
4971
6770
|
// mis-scale the amount transferred to Swapped's deposit address.
|
|
4972
|
-
publicClient:
|
|
6771
|
+
publicClient: getPublicClientFor2(Number(route.targetChainId))
|
|
4973
6772
|
}));
|
|
4974
6773
|
} catch (error) {
|
|
4975
|
-
if (
|
|
6774
|
+
if (isUserRejectedError2(error)) {
|
|
4976
6775
|
logger.warn("connect-rn:withdrawal:user_rejected", {
|
|
4977
6776
|
order_id: order.orderId
|
|
4978
6777
|
});
|
|
@@ -5005,14 +6804,14 @@ function useWithdrawalExecution({
|
|
|
5005
6804
|
}
|
|
5006
6805
|
|
|
5007
6806
|
// src/transfer/hooks/useCopyDepositAddress.ts
|
|
5008
|
-
import { useCallback as
|
|
6807
|
+
import { useCallback as useCallback8, useEffect as useEffect12, useRef as useRef10 } from "react";
|
|
5009
6808
|
function useCopyDepositAddress({
|
|
5010
6809
|
copyToClipboard: copyToClipboard2,
|
|
5011
6810
|
onCopySuccess,
|
|
5012
6811
|
isTransferOpen,
|
|
5013
6812
|
address
|
|
5014
6813
|
}) {
|
|
5015
|
-
const copyAddress =
|
|
6814
|
+
const copyAddress = useCallback8(
|
|
5016
6815
|
async (value) => {
|
|
5017
6816
|
try {
|
|
5018
6817
|
const ok = await copyToClipboard2(value) !== false;
|
|
@@ -5029,8 +6828,8 @@ function useCopyDepositAddress({
|
|
|
5029
6828
|
},
|
|
5030
6829
|
[copyToClipboard2, onCopySuccess]
|
|
5031
6830
|
);
|
|
5032
|
-
const copiedAddressRef =
|
|
5033
|
-
|
|
6831
|
+
const copiedAddressRef = useRef10(void 0);
|
|
6832
|
+
useEffect12(() => {
|
|
5034
6833
|
if (!isTransferOpen) {
|
|
5035
6834
|
copiedAddressRef.current = void 0;
|
|
5036
6835
|
return;
|
|
@@ -5045,13 +6844,13 @@ function useCopyDepositAddress({
|
|
|
5045
6844
|
}
|
|
5046
6845
|
|
|
5047
6846
|
// src/transfer/hooks/useSupportedTokens.ts
|
|
5048
|
-
import { getSupportedAssets } from "@funkit/api-base";
|
|
6847
|
+
import { getSupportedAssets as getSupportedAssets2 } from "@funkit/api-base";
|
|
5049
6848
|
import {
|
|
5050
6849
|
isTransferChainEnabled,
|
|
5051
|
-
resolveTokenTransferConfig
|
|
6850
|
+
resolveTokenTransferConfig as resolveTokenTransferConfig2
|
|
5052
6851
|
} from "@funkit/connect-core";
|
|
5053
|
-
import { useQuery as
|
|
5054
|
-
import { useMemo as
|
|
6852
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
6853
|
+
import { useMemo as useMemo10 } from "react";
|
|
5055
6854
|
|
|
5056
6855
|
// src/transfer/supportedTokens.ts
|
|
5057
6856
|
function buildSupportedTokenList(resolved) {
|
|
@@ -5091,18 +6890,18 @@ function useSupportedTokens({
|
|
|
5091
6890
|
const disabledChainAssets = useDynamicConfig(
|
|
5092
6891
|
"disabletokentransferchainsandassets"
|
|
5093
6892
|
);
|
|
5094
|
-
const { data, isLoading } =
|
|
6893
|
+
const { data, isLoading } = useQuery10({
|
|
5095
6894
|
queryKey: ["getSupportedAssets", apiKey],
|
|
5096
|
-
queryFn: ({ queryKey: [, key] }) =>
|
|
6895
|
+
queryFn: ({ queryKey: [, key] }) => getSupportedAssets2({ apiKey: key, logger }),
|
|
5097
6896
|
enabled: enabled && !!apiKey,
|
|
5098
6897
|
staleTime: 5 * 6e4,
|
|
5099
6898
|
refetchOnWindowFocus: false
|
|
5100
6899
|
});
|
|
5101
|
-
const { tokens, chainFilters } =
|
|
6900
|
+
const { tokens, chainFilters } = useMemo10(() => {
|
|
5102
6901
|
if (!data) {
|
|
5103
6902
|
return { tokens: [], chainFilters: [{ id: "all", label: "All" }] };
|
|
5104
6903
|
}
|
|
5105
|
-
const resolved =
|
|
6904
|
+
const resolved = resolveTokenTransferConfig2({
|
|
5106
6905
|
chainConfigs: tokenTransferConfig.chains ?? [],
|
|
5107
6906
|
priorityTokens: tokenTransferConfig.priorityTokens ?? [],
|
|
5108
6907
|
disabledChainAssets,
|
|
@@ -5167,9 +6966,9 @@ function useTokenTransfer({
|
|
|
5167
6966
|
|
|
5168
6967
|
// src/transfer/QrCode.tsx
|
|
5169
6968
|
import QRCode from "react-native-qrcode-svg";
|
|
5170
|
-
import { jsx as
|
|
6969
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
5171
6970
|
function QrCode({ value, size = 220, ecl = "H" }) {
|
|
5172
|
-
return /* @__PURE__ */
|
|
6971
|
+
return /* @__PURE__ */ jsx37(
|
|
5173
6972
|
QRCode,
|
|
5174
6973
|
{
|
|
5175
6974
|
value,
|
|
@@ -5182,9 +6981,9 @@ function QrCode({ value, size = 220, ecl = "H" }) {
|
|
|
5182
6981
|
}
|
|
5183
6982
|
|
|
5184
6983
|
// src/flow/AddressCopiedToast.tsx
|
|
5185
|
-
import { StyleSheet as
|
|
6984
|
+
import { StyleSheet as StyleSheet16 } from "react-native";
|
|
5186
6985
|
import Animated2, { Easing as Easing2, FadeOutUp, Keyframe as Keyframe2 } from "react-native-reanimated";
|
|
5187
|
-
import { jsx as
|
|
6986
|
+
import { jsx as jsx38, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5188
6987
|
var enterAnimation = new Keyframe2({
|
|
5189
6988
|
0: {
|
|
5190
6989
|
opacity: 0,
|
|
@@ -5201,17 +7000,17 @@ function AddressCopiedToast() {
|
|
|
5201
7000
|
const { t } = useFunkitTranslation();
|
|
5202
7001
|
const label = t("common.addressCopied");
|
|
5203
7002
|
const theme = useTheme();
|
|
5204
|
-
return /* @__PURE__ */
|
|
7003
|
+
return /* @__PURE__ */ jsxs17(
|
|
5205
7004
|
Animated2.View,
|
|
5206
7005
|
{
|
|
5207
7006
|
entering: enterAnimation,
|
|
5208
7007
|
exiting: exitAnimation,
|
|
5209
|
-
style: [
|
|
7008
|
+
style: [styles16.pill, { backgroundColor: theme.background.pill.default }],
|
|
5210
7009
|
accessibilityRole: "alert",
|
|
5211
7010
|
accessibilityLabel: label,
|
|
5212
7011
|
children: [
|
|
5213
|
-
/* @__PURE__ */
|
|
5214
|
-
/* @__PURE__ */
|
|
7012
|
+
/* @__PURE__ */ jsx38(Text, { variant: "bodyMedium", children: label }),
|
|
7013
|
+
/* @__PURE__ */ jsx38(FigmaSuccessCheckIcon, { size: 16 })
|
|
5215
7014
|
]
|
|
5216
7015
|
}
|
|
5217
7016
|
);
|
|
@@ -5228,7 +7027,7 @@ var pill = {
|
|
|
5228
7027
|
shadowOffset: { width: 0, height: 4 },
|
|
5229
7028
|
shadowRadius: 12
|
|
5230
7029
|
};
|
|
5231
|
-
var
|
|
7030
|
+
var styles16 = StyleSheet16.create({ pill });
|
|
5232
7031
|
|
|
5233
7032
|
// src/flow/depositFlowConfig.ts
|
|
5234
7033
|
function getDefaultDynamicTargetAsset(candidates, dynamicRoutingId) {
|
|
@@ -5240,11 +7039,11 @@ function getDefaultDynamicTargetAsset(candidates, dynamicRoutingId) {
|
|
|
5240
7039
|
|
|
5241
7040
|
// src/flow/FlowSheet.tsx
|
|
5242
7041
|
import {
|
|
5243
|
-
useCallback as
|
|
5244
|
-
useEffect as
|
|
5245
|
-
useRef as
|
|
7042
|
+
useCallback as useCallback9,
|
|
7043
|
+
useEffect as useEffect14,
|
|
7044
|
+
useRef as useRef11
|
|
5246
7045
|
} from "react";
|
|
5247
|
-
import { View as
|
|
7046
|
+
import { StyleSheet as StyleSheet17, View as View5 } from "react-native";
|
|
5248
7047
|
import {
|
|
5249
7048
|
BottomSheetBackdrop,
|
|
5250
7049
|
BottomSheetModal,
|
|
@@ -5253,14 +7052,14 @@ import {
|
|
|
5253
7052
|
useBottomSheetTimingConfigs
|
|
5254
7053
|
} from "@gorhom/bottom-sheet";
|
|
5255
7054
|
import { Easing as Easing3 } from "react-native-reanimated";
|
|
5256
|
-
import { useSafeAreaInsets as
|
|
7055
|
+
import { useSafeAreaInsets as useSafeAreaInsets4 } from "react-native-safe-area-context";
|
|
5257
7056
|
|
|
5258
7057
|
// src/flow/useKeyboardHeight.ts
|
|
5259
|
-
import { useEffect as
|
|
7058
|
+
import { useEffect as useEffect13, useState as useState13 } from "react";
|
|
5260
7059
|
import { Keyboard, Platform } from "react-native";
|
|
5261
7060
|
function useKeyboardHeight(enabled) {
|
|
5262
|
-
const [height, setHeight] =
|
|
5263
|
-
|
|
7061
|
+
const [height, setHeight] = useState13(0);
|
|
7062
|
+
useEffect13(() => {
|
|
5264
7063
|
if (!enabled) {
|
|
5265
7064
|
setHeight(0);
|
|
5266
7065
|
return;
|
|
@@ -5281,7 +7080,7 @@ function useKeyboardHeight(enabled) {
|
|
|
5281
7080
|
}
|
|
5282
7081
|
|
|
5283
7082
|
// src/flow/FlowSheet.tsx
|
|
5284
|
-
import { jsx as
|
|
7083
|
+
import { jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5285
7084
|
function FlowSheet({
|
|
5286
7085
|
isOpen,
|
|
5287
7086
|
session,
|
|
@@ -5289,17 +7088,19 @@ function FlowSheet({
|
|
|
5289
7088
|
content: content2,
|
|
5290
7089
|
children,
|
|
5291
7090
|
keyboardAvoidEnabled = false,
|
|
5292
|
-
enableSwipeToDismiss = true
|
|
7091
|
+
enableSwipeToDismiss = true,
|
|
7092
|
+
renderBackdropBlur
|
|
5293
7093
|
}) {
|
|
5294
|
-
const ref =
|
|
5295
|
-
const setRef =
|
|
7094
|
+
const ref = useRef11(null);
|
|
7095
|
+
const setRef = useCallback9((instance) => {
|
|
5296
7096
|
ref.current = instance;
|
|
5297
7097
|
}, []);
|
|
5298
7098
|
const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled);
|
|
5299
|
-
const insets =
|
|
5300
|
-
const
|
|
5301
|
-
const
|
|
5302
|
-
|
|
7099
|
+
const insets = useSafeAreaInsets4();
|
|
7100
|
+
const theme = useTheme();
|
|
7101
|
+
const hasPresented = useRef11(false);
|
|
7102
|
+
const sheetSelfDismissed = useRef11(false);
|
|
7103
|
+
useEffect14(() => {
|
|
5303
7104
|
if (isOpen) {
|
|
5304
7105
|
sheetSelfDismissed.current = false;
|
|
5305
7106
|
ref.current?.present();
|
|
@@ -5314,7 +7115,7 @@ function FlowSheet({
|
|
|
5314
7115
|
}
|
|
5315
7116
|
ref.current?.dismiss();
|
|
5316
7117
|
}, [isOpen, session]);
|
|
5317
|
-
const handleDismiss =
|
|
7118
|
+
const handleDismiss = useCallback9(() => {
|
|
5318
7119
|
sheetSelfDismissed.current = true;
|
|
5319
7120
|
onClose();
|
|
5320
7121
|
}, [onClose]);
|
|
@@ -5322,21 +7123,33 @@ function FlowSheet({
|
|
|
5322
7123
|
duration: 300,
|
|
5323
7124
|
easing: Easing3.bezier(0.22, 1, 0.36, 1)
|
|
5324
7125
|
});
|
|
5325
|
-
const renderBackdrop =
|
|
5326
|
-
(props) => /* @__PURE__ */
|
|
7126
|
+
const renderBackdrop = useCallback9(
|
|
7127
|
+
(props) => /* @__PURE__ */ jsxs18(
|
|
5327
7128
|
BottomSheetBackdrop,
|
|
5328
7129
|
{
|
|
5329
7130
|
...props,
|
|
5330
7131
|
appearsOnIndex: 0,
|
|
5331
7132
|
disappearsOnIndex: -1,
|
|
5332
|
-
pressBehavior: "close"
|
|
7133
|
+
pressBehavior: "close",
|
|
7134
|
+
opacity: 1,
|
|
7135
|
+
style: backdropContainer,
|
|
7136
|
+
children: [
|
|
7137
|
+
renderBackdropBlur ? /* @__PURE__ */ jsx39(View5, { style: StyleSheet17.absoluteFill, pointerEvents: "none", children: renderBackdropBlur() }) : null,
|
|
7138
|
+
/* @__PURE__ */ jsx39(
|
|
7139
|
+
View5,
|
|
7140
|
+
{
|
|
7141
|
+
style: [scrim2, { backgroundColor: theme.background.overlay }],
|
|
7142
|
+
pointerEvents: "none"
|
|
7143
|
+
}
|
|
7144
|
+
)
|
|
7145
|
+
]
|
|
5333
7146
|
}
|
|
5334
7147
|
),
|
|
5335
|
-
[]
|
|
7148
|
+
[renderBackdropBlur, theme.background.overlay]
|
|
5336
7149
|
);
|
|
5337
|
-
return /* @__PURE__ */
|
|
7150
|
+
return /* @__PURE__ */ jsxs18(BottomSheetModalProvider, { children: [
|
|
5338
7151
|
children,
|
|
5339
|
-
/* @__PURE__ */
|
|
7152
|
+
/* @__PURE__ */ jsx39(
|
|
5340
7153
|
BottomSheetModal,
|
|
5341
7154
|
{
|
|
5342
7155
|
ref: setRef,
|
|
@@ -5350,9 +7163,9 @@ function FlowSheet({
|
|
|
5350
7163
|
backdropComponent: renderBackdrop,
|
|
5351
7164
|
handleComponent: null,
|
|
5352
7165
|
backgroundComponent: FlowSheetBackground,
|
|
5353
|
-
children: /* @__PURE__ */
|
|
7166
|
+
children: /* @__PURE__ */ jsxs18(BottomSheetView, { children: [
|
|
5354
7167
|
content2,
|
|
5355
|
-
keyboardHeight > 0 ? /* @__PURE__ */
|
|
7168
|
+
keyboardHeight > 0 ? /* @__PURE__ */ jsx39(View5, { style: { height: keyboardHeight } }) : null
|
|
5356
7169
|
] })
|
|
5357
7170
|
}
|
|
5358
7171
|
)
|
|
@@ -5372,8 +7185,10 @@ function FlowSheetBackground({
|
|
|
5372
7185
|
...bottomExtension,
|
|
5373
7186
|
backgroundColor: theme.background.modal
|
|
5374
7187
|
};
|
|
5375
|
-
return /* @__PURE__ */
|
|
7188
|
+
return /* @__PURE__ */ jsx39(View5, { pointerEvents, style: [style, surface], children: /* @__PURE__ */ jsx39(View5, { style: extension }) });
|
|
5376
7189
|
}
|
|
7190
|
+
var backdropContainer = { backgroundColor: "transparent" };
|
|
7191
|
+
var scrim2 = StyleSheet17.absoluteFill;
|
|
5377
7192
|
var bottomExtension = {
|
|
5378
7193
|
position: "absolute",
|
|
5379
7194
|
top: "100%",
|
|
@@ -5382,6 +7197,35 @@ var bottomExtension = {
|
|
|
5382
7197
|
height: 1e3
|
|
5383
7198
|
};
|
|
5384
7199
|
|
|
7200
|
+
// src/flow/guardHostCallbacks.ts
|
|
7201
|
+
function guardHostCallbacks(callbacks) {
|
|
7202
|
+
const guarded = {};
|
|
7203
|
+
for (const [name, value] of Object.entries(callbacks)) {
|
|
7204
|
+
guarded[name] = typeof value === "function" ? guardOne(name, value) : value;
|
|
7205
|
+
}
|
|
7206
|
+
return guarded;
|
|
7207
|
+
}
|
|
7208
|
+
function guardOne(name, callback) {
|
|
7209
|
+
return (...args) => {
|
|
7210
|
+
try {
|
|
7211
|
+
const result = callback(...args);
|
|
7212
|
+
if (result instanceof Promise) {
|
|
7213
|
+
return result.catch((error) => warn(name, error));
|
|
7214
|
+
}
|
|
7215
|
+
return result;
|
|
7216
|
+
} catch (error) {
|
|
7217
|
+
warn(name, error);
|
|
7218
|
+
return void 0;
|
|
7219
|
+
}
|
|
7220
|
+
};
|
|
7221
|
+
}
|
|
7222
|
+
function warn(name, error) {
|
|
7223
|
+
logger.warn("connect-rn:host_callback_threw", {
|
|
7224
|
+
callback: name,
|
|
7225
|
+
error: error instanceof Error ? error.message : String(error)
|
|
7226
|
+
});
|
|
7227
|
+
}
|
|
7228
|
+
|
|
5385
7229
|
// src/flow/selectedChainStorage.ts
|
|
5386
7230
|
import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
5387
7231
|
var storageKey = (userId) => `funkit.selectedChain.${userId}`;
|
|
@@ -5407,7 +7251,7 @@ async function writeSelectedChainId(userId, chainId) {
|
|
|
5407
7251
|
}
|
|
5408
7252
|
|
|
5409
7253
|
// src/flow/FunkitFlowProvider.tsx
|
|
5410
|
-
import { Fragment as Fragment2, jsx as
|
|
7254
|
+
import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
5411
7255
|
var CLOSED = {
|
|
5412
7256
|
isOpen: false,
|
|
5413
7257
|
stack: [],
|
|
@@ -5417,12 +7261,15 @@ var CLOSED = {
|
|
|
5417
7261
|
var FunkitFlowContext = createContext4(null);
|
|
5418
7262
|
function FunkitFlowProvider({
|
|
5419
7263
|
children,
|
|
5420
|
-
copyToClipboard: copyToClipboard2 = copyToClipboard
|
|
7264
|
+
copyToClipboard: copyToClipboard2 = copyToClipboard,
|
|
7265
|
+
renderBackdropBlur
|
|
5421
7266
|
}) {
|
|
5422
|
-
const insets =
|
|
5423
|
-
const [state, setState] =
|
|
5424
|
-
const beginDeposit =
|
|
5425
|
-
(config,
|
|
7267
|
+
const insets = useSafeAreaInsets5();
|
|
7268
|
+
const [state, setState] = useState14(CLOSED);
|
|
7269
|
+
const beginDeposit = useCallback10(
|
|
7270
|
+
(config, hostCallbacks = {}) => {
|
|
7271
|
+
logger.info("beginDeposit", config);
|
|
7272
|
+
const callbacks = guardHostCallbacks(hostCallbacks);
|
|
5426
7273
|
callbacks.onOpen?.();
|
|
5427
7274
|
setState((prev) => ({
|
|
5428
7275
|
isOpen: true,
|
|
@@ -5433,8 +7280,10 @@ function FunkitFlowProvider({
|
|
|
5433
7280
|
},
|
|
5434
7281
|
[]
|
|
5435
7282
|
);
|
|
5436
|
-
const beginWithdrawal =
|
|
5437
|
-
(config,
|
|
7283
|
+
const beginWithdrawal = useCallback10(
|
|
7284
|
+
(config, hostCallbacks = {}) => {
|
|
7285
|
+
logger.info("beginWithdrawal", config);
|
|
7286
|
+
const callbacks = guardHostCallbacks(hostCallbacks);
|
|
5438
7287
|
callbacks.onOpen?.();
|
|
5439
7288
|
setState((prev) => ({
|
|
5440
7289
|
isOpen: true,
|
|
@@ -5445,13 +7294,13 @@ function FunkitFlowProvider({
|
|
|
5445
7294
|
},
|
|
5446
7295
|
[]
|
|
5447
7296
|
);
|
|
5448
|
-
const clearToast =
|
|
7297
|
+
const clearToast = useCallback10(() => {
|
|
5449
7298
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
5450
7299
|
if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
|
|
5451
7300
|
setCopiedToastShown(false);
|
|
5452
7301
|
setToastMounted(false);
|
|
5453
7302
|
}, []);
|
|
5454
|
-
const closeFlow =
|
|
7303
|
+
const closeFlow = useCallback10(() => {
|
|
5455
7304
|
setState((prev) => {
|
|
5456
7305
|
if (!prev.isOpen) return prev;
|
|
5457
7306
|
prev.flow?.callbacks.onClose?.();
|
|
@@ -5459,13 +7308,13 @@ function FunkitFlowProvider({
|
|
|
5459
7308
|
});
|
|
5460
7309
|
clearToast();
|
|
5461
7310
|
}, [clearToast]);
|
|
5462
|
-
const navigate =
|
|
7311
|
+
const navigate = useCallback10((screen) => {
|
|
5463
7312
|
setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }));
|
|
5464
7313
|
}, []);
|
|
5465
|
-
const reset =
|
|
7314
|
+
const reset = useCallback10((screen) => {
|
|
5466
7315
|
setState((prev) => prev.isOpen ? { ...prev, stack: [screen] } : prev);
|
|
5467
7316
|
}, []);
|
|
5468
|
-
const back =
|
|
7317
|
+
const back = useCallback10(() => {
|
|
5469
7318
|
setState((prev) => {
|
|
5470
7319
|
if (!prev.isOpen) return prev;
|
|
5471
7320
|
if (prev.stack.length <= 1) {
|
|
@@ -5475,25 +7324,25 @@ function FunkitFlowProvider({
|
|
|
5475
7324
|
return { ...prev, stack: prev.stack.slice(0, -1) };
|
|
5476
7325
|
});
|
|
5477
7326
|
}, []);
|
|
5478
|
-
const value =
|
|
7327
|
+
const value = useMemo11(
|
|
5479
7328
|
() => ({ beginDeposit, beginWithdrawal, closeFlow }),
|
|
5480
7329
|
[beginDeposit, beginWithdrawal, closeFlow]
|
|
5481
7330
|
);
|
|
5482
7331
|
const current = state.stack[state.stack.length - 1];
|
|
5483
7332
|
const isHomeScreen = state.stack.length <= 1;
|
|
5484
|
-
const nav =
|
|
7333
|
+
const nav = useMemo11(
|
|
5485
7334
|
() => ({ navigate, back, reset, closeFlow }),
|
|
5486
7335
|
[navigate, back, reset, closeFlow]
|
|
5487
7336
|
);
|
|
5488
|
-
const [toastMounted, setToastMounted] =
|
|
5489
|
-
const [copiedToastShown, setCopiedToastShown] =
|
|
5490
|
-
const hideTimerRef =
|
|
7337
|
+
const [toastMounted, setToastMounted] = useState14(false);
|
|
7338
|
+
const [copiedToastShown, setCopiedToastShown] = useState14(false);
|
|
7339
|
+
const hideTimerRef = useRef12(
|
|
5491
7340
|
void 0
|
|
5492
7341
|
);
|
|
5493
|
-
const unmountTimerRef =
|
|
7342
|
+
const unmountTimerRef = useRef12(
|
|
5494
7343
|
void 0
|
|
5495
7344
|
);
|
|
5496
|
-
const showCopiedToast =
|
|
7345
|
+
const showCopiedToast = useCallback10(() => {
|
|
5497
7346
|
if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
|
|
5498
7347
|
if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
|
|
5499
7348
|
setToastMounted(true);
|
|
@@ -5506,19 +7355,20 @@ function FunkitFlowProvider({
|
|
|
5506
7355
|
);
|
|
5507
7356
|
}, TOAST_VISIBLE_MS);
|
|
5508
7357
|
}, []);
|
|
5509
|
-
|
|
5510
|
-
return /* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
7358
|
+
useEffect15(() => () => clearToast(), [clearToast]);
|
|
7359
|
+
return /* @__PURE__ */ jsx40(FunkitFlowContext.Provider, { value, children: /* @__PURE__ */ jsxs19(View6, { style: rootContainer, children: [
|
|
7360
|
+
/* @__PURE__ */ jsx40(
|
|
5512
7361
|
FlowSheet,
|
|
5513
7362
|
{
|
|
5514
7363
|
isOpen: state.isOpen,
|
|
5515
7364
|
session: state.session,
|
|
5516
7365
|
onClose: closeFlow,
|
|
5517
|
-
keyboardAvoidEnabled: current === "swapped",
|
|
7366
|
+
keyboardAvoidEnabled: current === "swapped" || current === "withdrawCrypto",
|
|
5518
7367
|
enableSwipeToDismiss: isHomeScreen || current === "transfer",
|
|
7368
|
+
renderBackdropBlur,
|
|
5519
7369
|
content: (
|
|
5520
7370
|
// Mounted only while open so the flow queries run only then.
|
|
5521
|
-
state.isOpen && state.flow ? state.flow.mode === "deposit" ? /* @__PURE__ */
|
|
7371
|
+
state.isOpen && state.flow ? state.flow.mode === "deposit" ? /* @__PURE__ */ jsx40(
|
|
5522
7372
|
FlowContent,
|
|
5523
7373
|
{
|
|
5524
7374
|
config: state.flow.config,
|
|
@@ -5528,7 +7378,7 @@ function FunkitFlowProvider({
|
|
|
5528
7378
|
onCopySuccess: showCopiedToast,
|
|
5529
7379
|
callbacks: state.flow.callbacks
|
|
5530
7380
|
}
|
|
5531
|
-
) : /* @__PURE__ */
|
|
7381
|
+
) : /* @__PURE__ */ jsx40(
|
|
5532
7382
|
WithdrawalFlowContent,
|
|
5533
7383
|
{
|
|
5534
7384
|
config: state.flow.config,
|
|
@@ -5541,15 +7391,15 @@ function FunkitFlowProvider({
|
|
|
5541
7391
|
children
|
|
5542
7392
|
}
|
|
5543
7393
|
),
|
|
5544
|
-
toastMounted ? /* @__PURE__ */
|
|
5545
|
-
|
|
7394
|
+
toastMounted ? /* @__PURE__ */ jsx40(
|
|
7395
|
+
View6,
|
|
5546
7396
|
{
|
|
5547
7397
|
style: [
|
|
5548
7398
|
toastOverlay,
|
|
5549
7399
|
{ paddingTop: insets.top + TOAST_INSET_OFFSET }
|
|
5550
7400
|
],
|
|
5551
7401
|
pointerEvents: "none",
|
|
5552
|
-
children: copiedToastShown ? /* @__PURE__ */
|
|
7402
|
+
children: copiedToastShown ? /* @__PURE__ */ jsx40(AddressCopiedToast, {}) : null
|
|
5553
7403
|
}
|
|
5554
7404
|
) : null
|
|
5555
7405
|
] }) });
|
|
@@ -5565,7 +7415,7 @@ function FlowContent({
|
|
|
5565
7415
|
callbacks
|
|
5566
7416
|
}) {
|
|
5567
7417
|
const { t } = useFunkitTranslation();
|
|
5568
|
-
const insets =
|
|
7418
|
+
const insets = useSafeAreaInsets5();
|
|
5569
7419
|
const { userId } = useFunkitIdentity();
|
|
5570
7420
|
const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({
|
|
5571
7421
|
onCheckoutBlocked: callbacks.onCheckoutBlocked
|
|
@@ -5592,7 +7442,7 @@ function FlowContent({
|
|
|
5592
7442
|
dynamicRoutingId: targetAsset.activeDynamicRoutingId
|
|
5593
7443
|
});
|
|
5594
7444
|
const { isLoading: isStatsigLoading } = useStatsigClient2();
|
|
5595
|
-
const [selectedSwappedUrl, setSelectedSwappedUrl] =
|
|
7445
|
+
const [selectedSwappedUrl, setSelectedSwappedUrl] = useState14();
|
|
5596
7446
|
const minDepositTarget = {
|
|
5597
7447
|
targetChain: targetAsset.activeCheckoutConfig?.targetChain,
|
|
5598
7448
|
targetAsset: targetAsset.activeCheckoutConfig?.targetAsset,
|
|
@@ -5606,7 +7456,7 @@ function FlowContent({
|
|
|
5606
7456
|
target: minDepositTarget
|
|
5607
7457
|
});
|
|
5608
7458
|
const selectedChain = allChains.find((chain) => chain.id === selectedChainId);
|
|
5609
|
-
|
|
7459
|
+
useEffect15(() => {
|
|
5610
7460
|
if (current === "transfer" && allChains.length && !selectedChain) {
|
|
5611
7461
|
nav.back();
|
|
5612
7462
|
}
|
|
@@ -5651,7 +7501,7 @@ function FlowContent({
|
|
|
5651
7501
|
switch (current) {
|
|
5652
7502
|
case "addMoney": {
|
|
5653
7503
|
const isLoading = isLoadingGeoCheck || isAddressLoading || isStatsigLoading || isChainListLoading || fops.isSwappedEnabled && fops.isLoading;
|
|
5654
|
-
return /* @__PURE__ */
|
|
7504
|
+
return /* @__PURE__ */ jsx40(
|
|
5655
7505
|
SelectMethodScreen,
|
|
5656
7506
|
{
|
|
5657
7507
|
...addMoneyMethods,
|
|
@@ -5665,7 +7515,7 @@ function FlowContent({
|
|
|
5665
7515
|
);
|
|
5666
7516
|
}
|
|
5667
7517
|
case "transfer":
|
|
5668
|
-
return selectedChain ? /* @__PURE__ */
|
|
7518
|
+
return selectedChain ? /* @__PURE__ */ jsx40(
|
|
5669
7519
|
TransferCryptoScreen,
|
|
5670
7520
|
{
|
|
5671
7521
|
depositAddress: displayAddress,
|
|
@@ -5678,7 +7528,7 @@ function FlowContent({
|
|
|
5678
7528
|
}
|
|
5679
7529
|
) : null;
|
|
5680
7530
|
case "swapped":
|
|
5681
|
-
return selectedSwappedUrl ? /* @__PURE__ */
|
|
7531
|
+
return selectedSwappedUrl ? /* @__PURE__ */ jsx40(
|
|
5682
7532
|
SwappedScreen,
|
|
5683
7533
|
{
|
|
5684
7534
|
url: selectedSwappedUrl,
|
|
@@ -5691,11 +7541,11 @@ function FlowContent({
|
|
|
5691
7541
|
}
|
|
5692
7542
|
})();
|
|
5693
7543
|
if (isGeoblocked) {
|
|
5694
|
-
return /* @__PURE__ */
|
|
7544
|
+
return /* @__PURE__ */ jsx40(CheckoutBlockedScreen, {});
|
|
5695
7545
|
}
|
|
5696
|
-
return /* @__PURE__ */
|
|
7546
|
+
return /* @__PURE__ */ jsxs19(Fragment2, { children: [
|
|
5697
7547
|
screen,
|
|
5698
|
-
/* @__PURE__ */
|
|
7548
|
+
/* @__PURE__ */ jsx40(
|
|
5699
7549
|
BottomSheetModal2,
|
|
5700
7550
|
{
|
|
5701
7551
|
ref: nestedSheetRef,
|
|
@@ -5705,7 +7555,7 @@ function FlowContent({
|
|
|
5705
7555
|
backgroundComponent: FlowSheetBackground,
|
|
5706
7556
|
backdropComponent: renderNestedBackdrop,
|
|
5707
7557
|
onDismiss: () => setNestedScreen(null),
|
|
5708
|
-
children: /* @__PURE__ */
|
|
7558
|
+
children: /* @__PURE__ */ jsx40(BottomSheetView2, { children: /* @__PURE__ */ jsx40(
|
|
5709
7559
|
DepositNestedSheet,
|
|
5710
7560
|
{
|
|
5711
7561
|
nestedScreen,
|
|
@@ -5737,20 +7587,21 @@ function WithdrawalFlowContent({
|
|
|
5737
7587
|
});
|
|
5738
7588
|
const queryClient = useQueryClient();
|
|
5739
7589
|
const { fops, isLoading, isBelowMinimumBalance, isError, route } = useWithdrawalFops({ config });
|
|
5740
|
-
const [selectedFop, setSelectedFop] =
|
|
5741
|
-
const [hasExecutionError, setHasExecutionError] =
|
|
5742
|
-
const
|
|
7590
|
+
const [selectedFop, setSelectedFop] = useState14();
|
|
7591
|
+
const [hasExecutionError, setHasExecutionError] = useState14(false);
|
|
7592
|
+
const [submittedWithdrawal, setSubmittedWithdrawal] = useState14();
|
|
7593
|
+
const onExecutionError = useCallback10(() => setHasExecutionError(true), []);
|
|
5743
7594
|
const { executeOrder } = useWithdrawalExecution({
|
|
5744
7595
|
config,
|
|
5745
7596
|
route,
|
|
5746
7597
|
callbacks,
|
|
5747
7598
|
onError: onExecutionError
|
|
5748
7599
|
});
|
|
5749
|
-
const invalidateWithdrawFops =
|
|
7600
|
+
const invalidateWithdrawFops = useCallback10(() => {
|
|
5750
7601
|
void queryClient.invalidateQueries({ queryKey: [WITHDRAW_FOPS_QUERY_KEY] });
|
|
5751
7602
|
}, [queryClient]);
|
|
5752
7603
|
if (hasExecutionError) {
|
|
5753
|
-
return /* @__PURE__ */
|
|
7604
|
+
return /* @__PURE__ */ jsx40(
|
|
5754
7605
|
WithdrawMethodScreen,
|
|
5755
7606
|
{
|
|
5756
7607
|
title: config.title ?? t("withdraw.title"),
|
|
@@ -5772,7 +7623,7 @@ function WithdrawalFlowContent({
|
|
|
5772
7623
|
id: String(i),
|
|
5773
7624
|
title: row2.name,
|
|
5774
7625
|
subtitle: row2.subtitle,
|
|
5775
|
-
icon: /* @__PURE__ */
|
|
7626
|
+
icon: /* @__PURE__ */ jsx40(PaymentMethodIcon, { fop: fops[i] })
|
|
5776
7627
|
})
|
|
5777
7628
|
);
|
|
5778
7629
|
const showCashList = isLoading || cashMethods.length > 0;
|
|
@@ -5781,7 +7632,7 @@ function WithdrawalFlowContent({
|
|
|
5781
7632
|
id: CRYPTO_WITHDRAWAL_METHOD_ID,
|
|
5782
7633
|
title: t("withdrawCrypto.methodTitle"),
|
|
5783
7634
|
subtitle: t("withdrawCrypto.methodSubtitle"),
|
|
5784
|
-
icon: /* @__PURE__ */
|
|
7635
|
+
icon: /* @__PURE__ */ jsx40(CryptoBitcoinIcon, {})
|
|
5785
7636
|
},
|
|
5786
7637
|
// Below Swapped's minimum sell, cash stays visible but unselectable —
|
|
5787
7638
|
// dimming explains more than hiding would.
|
|
@@ -5791,7 +7642,7 @@ function WithdrawalFlowContent({
|
|
|
5791
7642
|
})) : []
|
|
5792
7643
|
];
|
|
5793
7644
|
const cashNote = showCashList ? void 0 : isError ? t("withdraw.cashMethodsError") : t("withdraw.noCashMethods");
|
|
5794
|
-
return /* @__PURE__ */
|
|
7645
|
+
return /* @__PURE__ */ jsx40(
|
|
5795
7646
|
WithdrawMethodScreen,
|
|
5796
7647
|
{
|
|
5797
7648
|
title: config.title ?? t("withdraw.title"),
|
|
@@ -5817,16 +7668,31 @@ function WithdrawalFlowContent({
|
|
|
5817
7668
|
);
|
|
5818
7669
|
}
|
|
5819
7670
|
case "withdrawCrypto":
|
|
5820
|
-
return /* @__PURE__ */
|
|
5821
|
-
|
|
7671
|
+
return /* @__PURE__ */ jsx40(
|
|
7672
|
+
WithdrawCryptoForm,
|
|
5822
7673
|
{
|
|
7674
|
+
config,
|
|
7675
|
+
callbacks,
|
|
5823
7676
|
title: t("withdrawCrypto.title"),
|
|
5824
|
-
|
|
5825
|
-
|
|
7677
|
+
onBack: nav.back,
|
|
7678
|
+
onSubmitted: (result) => {
|
|
7679
|
+
setSubmittedWithdrawal(result);
|
|
7680
|
+
nav.reset("withdrawComplete");
|
|
7681
|
+
}
|
|
5826
7682
|
}
|
|
5827
7683
|
);
|
|
7684
|
+
case "withdrawComplete":
|
|
7685
|
+
return submittedWithdrawal ? /* @__PURE__ */ jsx40(
|
|
7686
|
+
WithdrawCryptoComplete,
|
|
7687
|
+
{
|
|
7688
|
+
txHash: submittedWithdrawal.txHash,
|
|
7689
|
+
amountLabel: submittedWithdrawal.amountLabel,
|
|
7690
|
+
callbacks,
|
|
7691
|
+
onDone: nav.closeFlow
|
|
7692
|
+
}
|
|
7693
|
+
) : null;
|
|
5828
7694
|
case "swapped":
|
|
5829
|
-
return selectedFop?.embeddedFlowUrl ? /* @__PURE__ */
|
|
7695
|
+
return selectedFop?.embeddedFlowUrl ? /* @__PURE__ */ jsx40(
|
|
5830
7696
|
SwappedWithdrawScreen,
|
|
5831
7697
|
{
|
|
5832
7698
|
url: selectedFop.embeddedFlowUrl,
|
|
@@ -5868,7 +7734,7 @@ var TOAST_EXIT_MS = 350;
|
|
|
5868
7734
|
var TOAST_INSET_OFFSET = 20;
|
|
5869
7735
|
var rootContainer = { flex: 1 };
|
|
5870
7736
|
var toastOverlay = {
|
|
5871
|
-
...
|
|
7737
|
+
...StyleSheet18.absoluteFill,
|
|
5872
7738
|
zIndex: 1,
|
|
5873
7739
|
alignItems: "center"
|
|
5874
7740
|
};
|
|
@@ -5898,22 +7764,22 @@ function useAddMoneyMethods({
|
|
|
5898
7764
|
id: CRYPTO_METHOD_ID,
|
|
5899
7765
|
title: t("selectMethod.crypto"),
|
|
5900
7766
|
subtitle: t("selectMethod.noLimit"),
|
|
5901
|
-
icon: /* @__PURE__ */
|
|
5902
|
-
trailing: cryptoSourceIcons.length ? /* @__PURE__ */
|
|
7767
|
+
icon: /* @__PURE__ */ jsx40(CryptoBitcoinIcon, {}),
|
|
7768
|
+
trailing: cryptoSourceIcons.length ? /* @__PURE__ */ jsx40(SourceTokenCluster, { icons: cryptoSourceIcons, overflowMode: "plus" }) : void 0
|
|
5903
7769
|
}
|
|
5904
7770
|
];
|
|
5905
7771
|
const toCashRows = (fops2) => toFopRows(t, fops2, exchangeRates).map((row2, i) => ({
|
|
5906
7772
|
id: row2.id,
|
|
5907
7773
|
title: row2.name,
|
|
5908
7774
|
subtitle: row2.subtitle,
|
|
5909
|
-
icon: /* @__PURE__ */
|
|
7775
|
+
icon: /* @__PURE__ */ jsx40(PaymentMethodIcon, { fop: fops2[i] })
|
|
5910
7776
|
}));
|
|
5911
7777
|
const methods = isSwappedEnabled ? [...toCashRows(savedFops), ...cryptoMethod, ...toCashRows(genericFops)] : cryptoMethod;
|
|
5912
7778
|
const receiveTokens = candidates?.map(
|
|
5913
7779
|
(c, i) => ({
|
|
5914
7780
|
id: String(i),
|
|
5915
7781
|
label: c.badgeText ? `${c.tokenSymbol} (${c.badgeText})` : c.tokenSymbol,
|
|
5916
|
-
icon: /* @__PURE__ */
|
|
7782
|
+
icon: /* @__PURE__ */ jsx40(TokenChainIcon, { symbol: c.tokenSymbol, iconSrc: c.iconSrc })
|
|
5917
7783
|
})
|
|
5918
7784
|
);
|
|
5919
7785
|
const selectedReceiveTokenId = selectedCandidate && candidates ? String(candidates.indexOf(selectedCandidate)) : void 0;
|
|
@@ -5963,7 +7829,7 @@ function DepositNestedSheet({
|
|
|
5963
7829
|
}) {
|
|
5964
7830
|
switch (nestedScreen) {
|
|
5965
7831
|
case "selectChain":
|
|
5966
|
-
return /* @__PURE__ */
|
|
7832
|
+
return /* @__PURE__ */ jsx40(
|
|
5967
7833
|
SelectChainScreen,
|
|
5968
7834
|
{
|
|
5969
7835
|
chains: allChains,
|
|
@@ -5978,7 +7844,7 @@ function DepositNestedSheet({
|
|
|
5978
7844
|
}
|
|
5979
7845
|
);
|
|
5980
7846
|
case "changeChain":
|
|
5981
|
-
return /* @__PURE__ */
|
|
7847
|
+
return /* @__PURE__ */ jsx40(
|
|
5982
7848
|
ChangeChainScreen,
|
|
5983
7849
|
{
|
|
5984
7850
|
chains: allChains,
|
|
@@ -5991,11 +7857,11 @@ function DepositNestedSheet({
|
|
|
5991
7857
|
}
|
|
5992
7858
|
);
|
|
5993
7859
|
case "qrCode":
|
|
5994
|
-
return /* @__PURE__ */
|
|
7860
|
+
return /* @__PURE__ */ jsx40(
|
|
5995
7861
|
QrCodeScreen,
|
|
5996
7862
|
{
|
|
5997
|
-
qrCode: qrCode ?? (qrCodeUri ? /* @__PURE__ */
|
|
5998
|
-
centerIcon: /* @__PURE__ */
|
|
7863
|
+
qrCode: qrCode ?? (qrCodeUri ? /* @__PURE__ */ jsx40(QrCode, { value: qrCodeUri, size: 235 }) : null),
|
|
7864
|
+
centerIcon: /* @__PURE__ */ jsx40(
|
|
5999
7865
|
QrChainCluster,
|
|
6000
7866
|
{
|
|
6001
7867
|
iconKeys: selectedChain ? [selectedChain.iconUri] : []
|
|
@@ -6011,21 +7877,21 @@ function DepositNestedSheet({
|
|
|
6011
7877
|
}
|
|
6012
7878
|
}
|
|
6013
7879
|
function useNestedSheet() {
|
|
6014
|
-
const nestedSheetRef =
|
|
6015
|
-
const [nestedScreen, setNestedScreen] =
|
|
6016
|
-
const openNestedScreen =
|
|
7880
|
+
const nestedSheetRef = useRef12(null);
|
|
7881
|
+
const [nestedScreen, setNestedScreen] = useState14(null);
|
|
7882
|
+
const openNestedScreen = useCallback10((screen) => {
|
|
6017
7883
|
setNestedScreen(screen);
|
|
6018
7884
|
}, []);
|
|
6019
|
-
|
|
7885
|
+
useEffect15(() => {
|
|
6020
7886
|
if (nestedScreen) {
|
|
6021
7887
|
nestedSheetRef.current?.present();
|
|
6022
7888
|
}
|
|
6023
7889
|
}, [nestedScreen]);
|
|
6024
|
-
const closeNestedScreen =
|
|
7890
|
+
const closeNestedScreen = useCallback10(() => {
|
|
6025
7891
|
nestedSheetRef.current?.dismiss();
|
|
6026
7892
|
}, []);
|
|
6027
|
-
const renderNestedBackdrop =
|
|
6028
|
-
(props) => /* @__PURE__ */
|
|
7893
|
+
const renderNestedBackdrop = useCallback10(
|
|
7894
|
+
(props) => /* @__PURE__ */ jsx40(
|
|
6029
7895
|
BottomSheetBackdrop2,
|
|
6030
7896
|
{
|
|
6031
7897
|
...props,
|
|
@@ -6046,7 +7912,7 @@ function useNestedSheet() {
|
|
|
6046
7912
|
};
|
|
6047
7913
|
}
|
|
6048
7914
|
function useDepositTargetAsset(config) {
|
|
6049
|
-
const [selectedCandidate, setSelectedCandidate] =
|
|
7915
|
+
const [selectedCandidate, setSelectedCandidate] = useState14(
|
|
6050
7916
|
() => getDefaultDynamicTargetAsset(
|
|
6051
7917
|
config.dynamicTargetAssetCandidates,
|
|
6052
7918
|
config.dynamicRoutingId
|
|
@@ -6067,8 +7933,8 @@ function useDepositTargetAsset(config) {
|
|
|
6067
7933
|
};
|
|
6068
7934
|
}
|
|
6069
7935
|
function useRememberedChain(userId) {
|
|
6070
|
-
const [selectedChainId, setSelectedChainId] =
|
|
6071
|
-
|
|
7936
|
+
const [selectedChainId, setSelectedChainId] = useState14();
|
|
7937
|
+
useEffect15(() => {
|
|
6072
7938
|
let active = true;
|
|
6073
7939
|
setSelectedChainId(void 0);
|
|
6074
7940
|
void readSelectedChainId(userId).then((storedId) => {
|
|
@@ -6080,7 +7946,7 @@ function useRememberedChain(userId) {
|
|
|
6080
7946
|
active = false;
|
|
6081
7947
|
};
|
|
6082
7948
|
}, [userId]);
|
|
6083
|
-
const rememberChainId =
|
|
7949
|
+
const rememberChainId = useCallback10(
|
|
6084
7950
|
(chainId) => {
|
|
6085
7951
|
setSelectedChainId(chainId);
|
|
6086
7952
|
void writeSelectedChainId(userId, chainId);
|
|
@@ -6091,7 +7957,7 @@ function useRememberedChain(userId) {
|
|
|
6091
7957
|
}
|
|
6092
7958
|
|
|
6093
7959
|
// src/version.ts
|
|
6094
|
-
var CONNECT_RN_VERSION = true ? "3.
|
|
7960
|
+
var CONNECT_RN_VERSION = true ? "3.5.0" : "0.0.0-dev";
|
|
6095
7961
|
|
|
6096
7962
|
// src/providers/FunkitStatsigProvider.tsx
|
|
6097
7963
|
import {
|
|
@@ -6099,7 +7965,7 @@ import {
|
|
|
6099
7965
|
LogLevel,
|
|
6100
7966
|
StatsigProvider
|
|
6101
7967
|
} from "@statsig/react-bindings";
|
|
6102
|
-
import { useMemo as
|
|
7968
|
+
import { useMemo as useMemo12 } from "react";
|
|
6103
7969
|
|
|
6104
7970
|
// src/statsig/useClientAsyncInitRN.ts
|
|
6105
7971
|
import {
|
|
@@ -6284,7 +8150,7 @@ function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
|
|
|
6284
8150
|
}
|
|
6285
8151
|
|
|
6286
8152
|
// src/providers/FunkitStatsigProvider.tsx
|
|
6287
|
-
import { jsx as
|
|
8153
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
6288
8154
|
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
6289
8155
|
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
6290
8156
|
var STATSIG_SDK_TYPE = "react-native";
|
|
@@ -6301,7 +8167,7 @@ function FunkitStatsigProvider({
|
|
|
6301
8167
|
userId,
|
|
6302
8168
|
isDevelopment = false
|
|
6303
8169
|
}) {
|
|
6304
|
-
const user =
|
|
8170
|
+
const user = useMemo12(
|
|
6305
8171
|
() => buildFunkitStatsigUser(userId, apiKey),
|
|
6306
8172
|
[userId, apiKey]
|
|
6307
8173
|
);
|
|
@@ -6320,11 +8186,11 @@ function FunkitStatsigProvider({
|
|
|
6320
8186
|
tier: isDevelopment ? "development" : "production"
|
|
6321
8187
|
}
|
|
6322
8188
|
});
|
|
6323
|
-
return /* @__PURE__ */
|
|
8189
|
+
return /* @__PURE__ */ jsx41(StatsigProvider, { client, children });
|
|
6324
8190
|
}
|
|
6325
8191
|
|
|
6326
8192
|
// src/providers/FunkitProvider.tsx
|
|
6327
|
-
import { jsx as
|
|
8193
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
6328
8194
|
var ANONYMOUS_CONFIG = { apiKey: "" };
|
|
6329
8195
|
var IS_DEV_BUILD = typeof __DEV__ !== "undefined" && !!__DEV__;
|
|
6330
8196
|
function createFallbackQueryClient() {
|
|
@@ -6345,22 +8211,23 @@ function FunkitProvider({
|
|
|
6345
8211
|
colorScheme,
|
|
6346
8212
|
debug = IS_DEV_BUILD,
|
|
6347
8213
|
locale,
|
|
6348
|
-
copyToClipboard: copyToClipboard2
|
|
8214
|
+
copyToClipboard: copyToClipboard2,
|
|
8215
|
+
renderBackdropBlur
|
|
6349
8216
|
}) {
|
|
6350
|
-
const fallbackClient =
|
|
8217
|
+
const fallbackClient = useRef13(void 0);
|
|
6351
8218
|
fallbackClient.current ??= createFallbackQueryClient();
|
|
6352
8219
|
const client = queryClient ?? fallbackClient.current;
|
|
6353
|
-
const identity =
|
|
8220
|
+
const identity = useMemo13(
|
|
6354
8221
|
() => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
|
|
6355
8222
|
[config, walletAddress]
|
|
6356
8223
|
);
|
|
6357
|
-
|
|
8224
|
+
useEffect16(() => {
|
|
6358
8225
|
if (!config?.apiKey) {
|
|
6359
8226
|
return;
|
|
6360
8227
|
}
|
|
6361
8228
|
logger.configure(config.apiKey, debug, CONNECT_RN_VERSION);
|
|
6362
8229
|
}, [config?.apiKey, debug]);
|
|
6363
|
-
|
|
8230
|
+
useEffect16(() => {
|
|
6364
8231
|
logger.setUserInfo(
|
|
6365
8232
|
identity.userId,
|
|
6366
8233
|
identity.walletAddress,
|
|
@@ -6369,26 +8236,33 @@ function FunkitProvider({
|
|
|
6369
8236
|
""
|
|
6370
8237
|
);
|
|
6371
8238
|
}, [identity]);
|
|
6372
|
-
return /* @__PURE__ */
|
|
8239
|
+
return /* @__PURE__ */ jsx42(SafeAreaProvider, { children: /* @__PURE__ */ jsx42(
|
|
6373
8240
|
FunkitStatsigProvider,
|
|
6374
8241
|
{
|
|
6375
8242
|
apiKey: identity.apiKey,
|
|
6376
8243
|
userId: identity.userId,
|
|
6377
8244
|
isDevelopment: debug,
|
|
6378
|
-
children: /* @__PURE__ */
|
|
8245
|
+
children: /* @__PURE__ */ jsx42(QueryClientProvider, { client, children: /* @__PURE__ */ jsx42(FunkitIdentityProvider, { identity, children: /* @__PURE__ */ jsx42(FunkitThemeProvider, { themes, colorScheme, children: /* @__PURE__ */ jsx42(FunkitI18nProvider, { locale, children: /* @__PURE__ */ jsx42(
|
|
8246
|
+
FunkitFlowProvider,
|
|
8247
|
+
{
|
|
8248
|
+
copyToClipboard: copyToClipboard2,
|
|
8249
|
+
renderBackdropBlur,
|
|
8250
|
+
children
|
|
8251
|
+
}
|
|
8252
|
+
) }) }) }) })
|
|
6379
8253
|
}
|
|
6380
8254
|
) });
|
|
6381
8255
|
}
|
|
6382
8256
|
|
|
6383
8257
|
// src/providers/useFunkitCheckout.ts
|
|
6384
|
-
import { useCallback as
|
|
8258
|
+
import { useCallback as useCallback11 } from "react";
|
|
6385
8259
|
function useFunkitCheckout(callbacks = {}) {
|
|
6386
8260
|
const { beginDeposit: openDepositFlow, beginWithdrawal: openWithdrawalFlow } = useFunkitFlow();
|
|
6387
|
-
const beginDeposit =
|
|
8261
|
+
const beginDeposit = useCallback11(
|
|
6388
8262
|
(config) => openDepositFlow(config, callbacks),
|
|
6389
8263
|
[openDepositFlow, callbacks]
|
|
6390
8264
|
);
|
|
6391
|
-
const beginWithdrawal =
|
|
8265
|
+
const beginWithdrawal = useCallback11(
|
|
6392
8266
|
(config) => openWithdrawalFlow(config, callbacks),
|
|
6393
8267
|
[openWithdrawalFlow, callbacks]
|
|
6394
8268
|
);
|
|
@@ -6401,7 +8275,7 @@ import {
|
|
|
6401
8275
|
purifyCheckoutHistoryItem,
|
|
6402
8276
|
useRecentDepositsApiQuery
|
|
6403
8277
|
} from "@funkit/connect-core";
|
|
6404
|
-
import { useMemo as
|
|
8278
|
+
import { useMemo as useMemo14 } from "react";
|
|
6405
8279
|
function useFunkitRecentDeposits(query) {
|
|
6406
8280
|
const { apiKey, userId } = useFunkitIdentity();
|
|
6407
8281
|
const { listRefresh } = useDynamicConfig(
|
|
@@ -6433,14 +8307,14 @@ function useFunkitRecentDepositsImpl({
|
|
|
6433
8307
|
// over-fetch to account for merging
|
|
6434
8308
|
logger
|
|
6435
8309
|
});
|
|
6436
|
-
const mergedDirectExecutions =
|
|
8310
|
+
const mergedDirectExecutions = useMemo14(
|
|
6437
8311
|
() => processRecentDepositsForNotifications(
|
|
6438
8312
|
memoizedFilterFunc ? directExecutions?.filter(memoizedFilterFunc) : directExecutions,
|
|
6439
8313
|
{ cutOffTimeMs }
|
|
6440
8314
|
),
|
|
6441
8315
|
[directExecutions, cutOffTimeMs, memoizedFilterFunc]
|
|
6442
8316
|
);
|
|
6443
|
-
return
|
|
8317
|
+
return useMemo14(
|
|
6444
8318
|
() => ({
|
|
6445
8319
|
data: mergedDirectExecutions?.map((de) => purifyCheckoutHistoryItem(de)).slice(0, fetchSize)
|
|
6446
8320
|
}),
|
|
@@ -6456,7 +8330,7 @@ import {
|
|
|
6456
8330
|
import {
|
|
6457
8331
|
purifyCheckoutHistoryItem as purifyCheckoutHistoryItem2
|
|
6458
8332
|
} from "@funkit/connect-core";
|
|
6459
|
-
import { useQuery as
|
|
8333
|
+
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
6460
8334
|
var CHECKOUT_HISTORY_HOOK_LIMIT = 100;
|
|
6461
8335
|
function useCheckoutsListenerByUserId(userId) {
|
|
6462
8336
|
const { apiKey, userId: identityUserId } = useFunkitIdentity();
|
|
@@ -6465,7 +8339,7 @@ function useCheckoutsListenerByUserId(userId) {
|
|
|
6465
8339
|
);
|
|
6466
8340
|
const resolvedUserId = userId ?? identityUserId;
|
|
6467
8341
|
const effectiveUserId = resolvedUserId === "0x" ? "" : resolvedUserId;
|
|
6468
|
-
const { data, isLoading } =
|
|
8342
|
+
const { data, isLoading } = useQuery11({
|
|
6469
8343
|
enabled: !!effectiveUserId,
|
|
6470
8344
|
queryKey: ["getPurifiedCheckoutsByUserId", effectiveUserId],
|
|
6471
8345
|
queryFn: async () => {
|