@funkit/connect 12.5.0 → 12.6.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 +36 -0
- package/dist/clients/{chunk-B7UU2ETA.js → chunk-4DBUYTEE.js} +1 -1
- package/dist/clients/{chunk-XOLUUA5B.js → chunk-F36IJA7V.js} +3 -3
- package/dist/clients/{chunk-WCQ6HJ27.js → chunk-I5VRAFH6.js} +1 -1
- package/dist/clients/internal/nado/withdrawalCallback.js +2 -2
- package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
- package/dist/clients/internal/nado/withdrawalForm.js +2 -2
- package/dist/clients/nado.js +2 -2
- package/dist/hooks/useSavedTokenChainSelection.d.ts +16 -0
- package/dist/index.js +323 -214
- package/dist/modals/CheckoutModal/TransferToken/useSavedTransferTokenSelection.d.ts +16 -0
- package/dist/modals/WithdrawalModal/useSavedWithdrawalChain.d.ts +13 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +61 -61
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +5 -5
- package/dist/modals/WithdrawalModal/useWithdrawalChainPreference.d.ts +0 -17
- package/dist/wallets/walletConnectors/chunk-53MYTA42.js +0 -94
- package/dist/wallets/walletConnectors/chunk-65ULY6OC.js +0 -70
- package/dist/wallets/walletConnectors/chunk-A5POD5SV.js +0 -103
- package/dist/wallets/walletConnectors/chunk-ANODOMIN.js +0 -218
- package/dist/wallets/walletConnectors/chunk-ASTCNVJC.js +0 -96
- package/dist/wallets/walletConnectors/chunk-F45CUFRR.js +0 -66
- package/dist/wallets/walletConnectors/chunk-FYPQ3HP4.js +0 -92
- package/dist/wallets/walletConnectors/chunk-IWPW26AL.js +0 -98
- package/dist/wallets/walletConnectors/chunk-JJBLW4IU.js +0 -87
- package/dist/wallets/walletConnectors/chunk-KE4CWI3A.js +0 -93
- package/dist/wallets/walletConnectors/chunk-MWB6LFSG.js +0 -110
- package/dist/wallets/walletConnectors/chunk-OVDCDVFX.js +0 -100
- package/dist/wallets/walletConnectors/chunk-PPQ6L4K2.js +0 -106
- package/dist/wallets/walletConnectors/chunk-RJF2YEZ5.js +0 -92
- package/dist/wallets/walletConnectors/chunk-RQYEGJKL.js +0 -96
- package/dist/wallets/walletConnectors/chunk-TIHTQ3OB.js +0 -95
- package/dist/wallets/walletConnectors/chunk-TM7UBV3Q.js +0 -69
- package/dist/wallets/walletConnectors/chunk-USLZMUJ3.js +0 -99
package/dist/index.js
CHANGED
|
@@ -5912,7 +5912,7 @@ import {
|
|
|
5912
5912
|
monadChain as monadChain2,
|
|
5913
5913
|
solanaChain as solanaChain7
|
|
5914
5914
|
} from "@funkit/chains";
|
|
5915
|
-
import {
|
|
5915
|
+
import { isAddressEquivalent as isAddressEquivalent7, isTokenEquivalent as isTokenEquivalent14 } from "@funkit/utils";
|
|
5916
5916
|
import { arbitrum as arbitrum5, base as base6, bsc as bsc2, mainnet as mainnet13, optimism as optimism2, polygon as polygon8 } from "viem/chains";
|
|
5917
5917
|
|
|
5918
5918
|
// src/utils/checkout.ts
|
|
@@ -5932,7 +5932,7 @@ import { getRelayAssetInfo } from "@funkit/fun-relay";
|
|
|
5932
5932
|
import {
|
|
5933
5933
|
formatCryptoAndStringify as formatCryptoAndStringify10,
|
|
5934
5934
|
isNumericString,
|
|
5935
|
-
|
|
5935
|
+
isAddressEquivalent as isAddressEquivalent6,
|
|
5936
5936
|
round as round4
|
|
5937
5937
|
} from "@funkit/utils";
|
|
5938
5938
|
import * as dnum11 from "dnum";
|
|
@@ -6002,14 +6002,14 @@ import {
|
|
|
6002
6002
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO10,
|
|
6003
6003
|
SOLANA_MAINNET_CHAIN_ID as SOLANA_MAINNET_CHAIN_ID2
|
|
6004
6004
|
} from "@funkit/chains";
|
|
6005
|
-
import {
|
|
6005
|
+
import { isAddressEquivalent as isAddressEquivalent5, isNotNullish as isNotNullish7 } from "@funkit/utils";
|
|
6006
6006
|
import React326, {
|
|
6007
6007
|
createContext as createContext23,
|
|
6008
|
-
useCallback as
|
|
6008
|
+
useCallback as useCallback71,
|
|
6009
6009
|
useContext as useContext23,
|
|
6010
6010
|
useEffect as useEffect100,
|
|
6011
6011
|
useMemo as useMemo74,
|
|
6012
|
-
useRef as
|
|
6012
|
+
useRef as useRef59,
|
|
6013
6013
|
useState as useState94
|
|
6014
6014
|
} from "react";
|
|
6015
6015
|
import { flushSync as flushSync2 } from "react-dom";
|
|
@@ -6814,11 +6814,11 @@ function useFunkitConfig() {
|
|
|
6814
6814
|
// src/providers/GeneralWalletProvider.tsx
|
|
6815
6815
|
import React325, {
|
|
6816
6816
|
createContext as createContext22,
|
|
6817
|
-
useCallback as
|
|
6817
|
+
useCallback as useCallback70,
|
|
6818
6818
|
useContext as useContext22,
|
|
6819
6819
|
useEffect as useEffect99,
|
|
6820
6820
|
useMemo as useMemo73,
|
|
6821
|
-
useRef as
|
|
6821
|
+
useRef as useRef58,
|
|
6822
6822
|
useState as useState93
|
|
6823
6823
|
} from "react";
|
|
6824
6824
|
|
|
@@ -7207,7 +7207,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
7207
7207
|
localStorage.setItem(storageKey, version);
|
|
7208
7208
|
}
|
|
7209
7209
|
function getCurrentSdkVersion() {
|
|
7210
|
-
return "12.
|
|
7210
|
+
return "12.6.0";
|
|
7211
7211
|
}
|
|
7212
7212
|
function useFingerprint() {
|
|
7213
7213
|
const fingerprint = useCallback3(() => {
|
|
@@ -7603,7 +7603,7 @@ function useFiatExchangeRates(enabled = true) {
|
|
|
7603
7603
|
import { useMemo as useMemo72 } from "react";
|
|
7604
7604
|
|
|
7605
7605
|
// src/providers/FunkitProvider.tsx
|
|
7606
|
-
import { useLogOnce as
|
|
7606
|
+
import { useLogOnce as useLogOnce5 } from "@funkit/connect-core";
|
|
7607
7607
|
import { LogLevel as LogLevel2, initializeRelayClient } from "@funkit/fun-relay";
|
|
7608
7608
|
import {
|
|
7609
7609
|
QueryClient,
|
|
@@ -7615,7 +7615,7 @@ import React324, {
|
|
|
7615
7615
|
useContext as useContext21,
|
|
7616
7616
|
useEffect as useEffect97,
|
|
7617
7617
|
useMemo as useMemo71,
|
|
7618
|
-
useRef as
|
|
7618
|
+
useRef as useRef57,
|
|
7619
7619
|
useState as useState91
|
|
7620
7620
|
} from "react";
|
|
7621
7621
|
|
|
@@ -10068,7 +10068,7 @@ import {
|
|
|
10068
10068
|
|
|
10069
10069
|
// src/utils/withdrawal.ts
|
|
10070
10070
|
import { chainMetadataById as chainMetadataById2 } from "@funkit/chains";
|
|
10071
|
-
import {
|
|
10071
|
+
import { isAddressEquivalent, isTokenEquivalent } from "@funkit/utils";
|
|
10072
10072
|
import { parseUnits as parseUnits2 } from "viem";
|
|
10073
10073
|
|
|
10074
10074
|
// src/domains/nado.ts
|
|
@@ -10092,7 +10092,7 @@ function isNoOpSelfWithdrawal({
|
|
|
10092
10092
|
if (!isWalletWithdrawalConfig(config) || recipientAddress === "" || !destinationTokenAddress) {
|
|
10093
10093
|
return false;
|
|
10094
10094
|
}
|
|
10095
|
-
return
|
|
10095
|
+
return isAddressEquivalent({
|
|
10096
10096
|
firstAddress: recipientAddress,
|
|
10097
10097
|
secondAddress: config.wallet.address()
|
|
10098
10098
|
}) && isTokenEquivalent({
|
|
@@ -12693,7 +12693,7 @@ function FunkitShadowHostProvider({
|
|
|
12693
12693
|
// src/providers/ModalContext.tsx
|
|
12694
12694
|
import React323, {
|
|
12695
12695
|
createContext as createContext20,
|
|
12696
|
-
useCallback as
|
|
12696
|
+
useCallback as useCallback68,
|
|
12697
12697
|
useContext as useContext20,
|
|
12698
12698
|
useEffect as useEffect94,
|
|
12699
12699
|
useMemo as useMemo70,
|
|
@@ -19299,7 +19299,7 @@ import { formatAddress as formatAddress4 } from "@funkit/utils";
|
|
|
19299
19299
|
import React123 from "react";
|
|
19300
19300
|
|
|
19301
19301
|
// src/hooks/useConnectedWallets.ts
|
|
19302
|
-
import {
|
|
19302
|
+
import { isAddressEquivalent as isAddressEquivalent2 } from "@funkit/utils";
|
|
19303
19303
|
import { useMemo as useMemo23 } from "react";
|
|
19304
19304
|
function useConnectedWallets() {
|
|
19305
19305
|
const {
|
|
@@ -19335,7 +19335,7 @@ function usePayerWallet(address) {
|
|
|
19335
19335
|
return void 0;
|
|
19336
19336
|
}
|
|
19337
19337
|
const connected = wallets.find(
|
|
19338
|
-
(wallet) =>
|
|
19338
|
+
(wallet) => isAddressEquivalent2({
|
|
19339
19339
|
firstAddress: wallet.address,
|
|
19340
19340
|
secondAddress: address
|
|
19341
19341
|
})
|
|
@@ -19545,24 +19545,39 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React90.createElement(
|
|
|
19545
19545
|
|
|
19546
19546
|
// src/hooks/useConnectedWalletIcons.tsx
|
|
19547
19547
|
var ICON_SIZE2 = 16;
|
|
19548
|
+
var METAMASK_ICON_SIZE = 13;
|
|
19548
19549
|
function useConnectedWalletIcons() {
|
|
19549
19550
|
const wallets = useConnectedWallets();
|
|
19550
19551
|
if (!wallets.length || soleWalletVendor(wallets)) {
|
|
19551
19552
|
return null;
|
|
19552
19553
|
}
|
|
19553
|
-
return /* @__PURE__ */ React91.createElement(Box, { display: "flex", alignItems: "center", gap: "4" }, wallets.map((wallet) =>
|
|
19554
|
-
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19554
|
+
return /* @__PURE__ */ React91.createElement(Box, { display: "flex", alignItems: "center", gap: "4" }, wallets.map((wallet) => {
|
|
19555
|
+
const isMetaMaskWallet = !!wallet.name && normalizeWalletName(wallet.name) === "metamask";
|
|
19556
|
+
const iconSize = isMetaMaskWallet ? METAMASK_ICON_SIZE : ICON_SIZE2;
|
|
19557
|
+
return /* @__PURE__ */ React91.createElement(
|
|
19558
|
+
Box,
|
|
19559
|
+
{
|
|
19560
|
+
key: wallet.address,
|
|
19561
|
+
display: "flex",
|
|
19562
|
+
alignItems: "center",
|
|
19563
|
+
justifyContent: "center",
|
|
19564
|
+
height: "16",
|
|
19565
|
+
width: "16"
|
|
19566
|
+
},
|
|
19567
|
+
/* @__PURE__ */ React91.createElement(
|
|
19568
|
+
AsyncImage,
|
|
19569
|
+
{
|
|
19570
|
+
useAsImage: true,
|
|
19571
|
+
alt: wallet.name,
|
|
19572
|
+
borderRadius: "4",
|
|
19573
|
+
fallbackElement: /* @__PURE__ */ React91.createElement(EvmWallet, { size: iconSize }),
|
|
19574
|
+
height: iconSize,
|
|
19575
|
+
src: wallet.icon,
|
|
19576
|
+
width: iconSize
|
|
19577
|
+
}
|
|
19578
|
+
)
|
|
19579
|
+
);
|
|
19580
|
+
}));
|
|
19566
19581
|
}
|
|
19567
19582
|
|
|
19568
19583
|
// src/hooks/useExchangeOptions.ts
|
|
@@ -25932,7 +25947,7 @@ import {
|
|
|
25932
25947
|
solanaChain as solanaChain4,
|
|
25933
25948
|
tronChain as tronChain4
|
|
25934
25949
|
} from "@funkit/chains";
|
|
25935
|
-
import {
|
|
25950
|
+
import { isAddressEquivalent as isAddressEquivalent3 } from "@funkit/utils";
|
|
25936
25951
|
|
|
25937
25952
|
// src/hooks/useFittedText.ts
|
|
25938
25953
|
import { useState as useState38 } from "react";
|
|
@@ -26451,7 +26466,7 @@ function WithdrawRecipientAddress({
|
|
|
26451
26466
|
const isPrefillConnectedAddressEnabled = useFeatureGate(
|
|
26452
26467
|
"enable-prefill-withdrawal-connected-address"
|
|
26453
26468
|
);
|
|
26454
|
-
const isShowingConnectedAddress = showUseConnected && !!connectedWalletAddress &&
|
|
26469
|
+
const isShowingConnectedAddress = showUseConnected && !!connectedWalletAddress && isAddressEquivalent3({
|
|
26455
26470
|
firstAddress: recipientAddress,
|
|
26456
26471
|
secondAddress: connectedWalletAddress
|
|
26457
26472
|
});
|
|
@@ -27203,8 +27218,7 @@ var useTokenAndChainDropdown = ({
|
|
|
27203
27218
|
defaultChainSymbols,
|
|
27204
27219
|
defaultValues?.token
|
|
27205
27220
|
);
|
|
27206
|
-
const
|
|
27207
|
-
const isValidSelectionOverride = !hasUserSelectedRef.current && selectionOverride !== void 0 && enabledChainSymbols[selectionOverride.chainId]?.includes(
|
|
27221
|
+
const isValidSelectionOverride = selectionOverride !== void 0 && enabledChainSymbols[selectionOverride.chainId]?.includes(
|
|
27208
27222
|
selectionOverride.token
|
|
27209
27223
|
);
|
|
27210
27224
|
const selectedDefaultChainId = resolveDefaultChainId(
|
|
@@ -27222,13 +27236,14 @@ var useTokenAndChainDropdown = ({
|
|
|
27222
27236
|
const [selectedToken, setSelectedToken] = useState41(
|
|
27223
27237
|
noDefaultSelection ? void 0 : selectedDefaultToken
|
|
27224
27238
|
);
|
|
27239
|
+
const hasUserSelectedRef = useRef23(false);
|
|
27225
27240
|
useEffect43(() => {
|
|
27226
|
-
if (!noDefaultSelection) {
|
|
27241
|
+
if (!noDefaultSelection && !hasUserSelectedRef.current) {
|
|
27227
27242
|
setSelectedChainId(selectedDefaultChainId);
|
|
27228
27243
|
}
|
|
27229
27244
|
}, [selectedDefaultChainId, noDefaultSelection]);
|
|
27230
27245
|
useEffect43(() => {
|
|
27231
|
-
if (!noDefaultSelection) {
|
|
27246
|
+
if (!noDefaultSelection && !hasUserSelectedRef.current) {
|
|
27232
27247
|
setSelectedToken(selectedDefaultToken);
|
|
27233
27248
|
}
|
|
27234
27249
|
}, [selectedDefaultToken, noDefaultSelection]);
|
|
@@ -27691,87 +27706,89 @@ function useTrackWithdrawalQuoteEvents({
|
|
|
27691
27706
|
return { trackQuoteConfirmed };
|
|
27692
27707
|
}
|
|
27693
27708
|
|
|
27694
|
-
// src/modals/WithdrawalModal/
|
|
27709
|
+
// src/modals/WithdrawalModal/useSavedWithdrawalChain.ts
|
|
27695
27710
|
import { useLogOnce as useLogOnce3 } from "@funkit/connect-core";
|
|
27711
|
+
|
|
27712
|
+
// src/hooks/useSavedTokenChainSelection.ts
|
|
27713
|
+
import {
|
|
27714
|
+
safeGetLocalStorage,
|
|
27715
|
+
safeParseJson as safeParseJson2,
|
|
27716
|
+
safeSetLocalStorage
|
|
27717
|
+
} from "@funkit/utils";
|
|
27696
27718
|
import { useCallback as useCallback32, useMemo as useMemo41 } from "react";
|
|
27697
|
-
var STORAGE_KEY_PREFIX = "
|
|
27698
|
-
function getStorageKey(
|
|
27699
|
-
return `${STORAGE_KEY_PREFIX}
|
|
27700
|
-
}
|
|
27701
|
-
function
|
|
27702
|
-
return
|
|
27719
|
+
var STORAGE_KEY_PREFIX = "fkc-selection-v1";
|
|
27720
|
+
function getStorageKey(scope, userId) {
|
|
27721
|
+
return `${STORAGE_KEY_PREFIX}-${scope}-${userId.toLowerCase()}`;
|
|
27722
|
+
}
|
|
27723
|
+
function logStorageFailure(scope) {
|
|
27724
|
+
return (error) => {
|
|
27725
|
+
logger.warn("selection-storage:unavailable", {
|
|
27726
|
+
scope,
|
|
27727
|
+
error: error instanceof Error ? error.message : String(error)
|
|
27728
|
+
});
|
|
27729
|
+
};
|
|
27703
27730
|
}
|
|
27704
|
-
function
|
|
27705
|
-
|
|
27731
|
+
function parseTokenChainSelection(value) {
|
|
27732
|
+
const stored = safeParseJson2(value);
|
|
27733
|
+
if (!stored) {
|
|
27706
27734
|
return void 0;
|
|
27707
27735
|
}
|
|
27708
|
-
|
|
27709
|
-
|
|
27710
|
-
getStorageKey(sourceChainId, accountAddress)
|
|
27711
|
-
);
|
|
27712
|
-
if (rawChainId === null) {
|
|
27713
|
-
return void 0;
|
|
27714
|
-
}
|
|
27715
|
-
const chainId2 = Number(rawChainId);
|
|
27716
|
-
return Number.isSafeInteger(chainId2) && chainId2 > 0 ? chainId2 : void 0;
|
|
27717
|
-
} catch {
|
|
27736
|
+
const { chainId: chainId2, token } = stored;
|
|
27737
|
+
if (typeof chainId2 !== "number" || !Number.isSafeInteger(chainId2) || chainId2 <= 0 || typeof token !== "string" || token === "") {
|
|
27718
27738
|
return void 0;
|
|
27719
27739
|
}
|
|
27740
|
+
return { chainId: chainId2, token };
|
|
27720
27741
|
}
|
|
27721
|
-
function
|
|
27722
|
-
|
|
27723
|
-
|
|
27724
|
-
|
|
27725
|
-
|
|
27726
|
-
|
|
27727
|
-
|
|
27728
|
-
|
|
27729
|
-
|
|
27730
|
-
} catch {
|
|
27731
|
-
}
|
|
27732
|
-
}
|
|
27733
|
-
function useWithdrawalChainPreference(config) {
|
|
27734
|
-
const isEnabled = useFeatureGate("remember-withdrawal-chain");
|
|
27735
|
-
const { address: userAddress } = useFunkitUserInfo();
|
|
27736
|
-
const { sourceChainId } = config;
|
|
27737
|
-
const selectionOverride = useMemo41(() => {
|
|
27742
|
+
function useSavedTokenChainSelection({
|
|
27743
|
+
scope,
|
|
27744
|
+
enabled
|
|
27745
|
+
}) {
|
|
27746
|
+
const { id: userId } = useFunkitUserInfo();
|
|
27747
|
+
const key = getStorageKey(scope, userId);
|
|
27748
|
+
const isGuestUser = !userId || userId === "0x";
|
|
27749
|
+
const isEnabled = enabled && !isGuestUser;
|
|
27750
|
+
const savedSelection = useMemo41(() => {
|
|
27738
27751
|
if (!isEnabled) {
|
|
27739
27752
|
return void 0;
|
|
27740
27753
|
}
|
|
27741
|
-
const
|
|
27742
|
-
|
|
27743
|
-
|
|
27744
|
-
|
|
27745
|
-
|
|
27746
|
-
|
|
27747
|
-
|
|
27748
|
-
|
|
27749
|
-
|
|
27750
|
-
|
|
27751
|
-
|
|
27752
|
-
isEnabled,
|
|
27753
|
-
|
|
27754
|
-
|
|
27755
|
-
|
|
27754
|
+
const value = safeGetLocalStorage(key, logStorageFailure(scope));
|
|
27755
|
+
return value === void 0 ? void 0 : parseTokenChainSelection(value);
|
|
27756
|
+
}, [isEnabled, key, scope]);
|
|
27757
|
+
const saveSelection = useCallback32(
|
|
27758
|
+
(selection) => {
|
|
27759
|
+
if (!isEnabled) {
|
|
27760
|
+
return void 0;
|
|
27761
|
+
}
|
|
27762
|
+
const value = JSON.stringify(selection);
|
|
27763
|
+
safeSetLocalStorage(key, value, logStorageFailure(scope));
|
|
27764
|
+
},
|
|
27765
|
+
[isEnabled, key, scope]
|
|
27766
|
+
);
|
|
27767
|
+
return { savedSelection, saveSelection };
|
|
27768
|
+
}
|
|
27769
|
+
|
|
27770
|
+
// src/modals/WithdrawalModal/useSavedWithdrawalChain.ts
|
|
27771
|
+
function useSavedWithdrawalChain(config) {
|
|
27772
|
+
const isGateEnabled = useFeatureGate("remember-withdrawal-chain");
|
|
27773
|
+
const { sourceChainId } = config;
|
|
27774
|
+
const { savedSelection, saveSelection } = useSavedTokenChainSelection({
|
|
27775
|
+
scope: `withdrawal-${sourceChainId}`,
|
|
27776
|
+
enabled: isGateEnabled
|
|
27777
|
+
});
|
|
27756
27778
|
useLogOnce3(
|
|
27757
|
-
|
|
27779
|
+
savedSelection ? `${sourceChainId}|${savedSelection.chainId}|${savedSelection.token}` : void 0,
|
|
27758
27780
|
() => {
|
|
27759
27781
|
logger.info("withdrawal:chain-preference:restored", {
|
|
27760
27782
|
sourceChainId,
|
|
27761
|
-
destinationChainId:
|
|
27762
|
-
token:
|
|
27783
|
+
destinationChainId: savedSelection?.chainId,
|
|
27784
|
+
token: savedSelection?.token
|
|
27763
27785
|
});
|
|
27764
27786
|
}
|
|
27765
27787
|
);
|
|
27766
|
-
|
|
27767
|
-
|
|
27768
|
-
|
|
27769
|
-
|
|
27770
|
-
}
|
|
27771
|
-
},
|
|
27772
|
-
[isEnabled, sourceChainId, userAddress]
|
|
27773
|
-
);
|
|
27774
|
-
return { selectionOverride, rememberSuccessfulChain };
|
|
27788
|
+
return {
|
|
27789
|
+
selectionOverride: savedSelection,
|
|
27790
|
+
saveWithdrawalDestination: saveSelection
|
|
27791
|
+
};
|
|
27775
27792
|
}
|
|
27776
27793
|
|
|
27777
27794
|
// src/modals/WithdrawalModal/WithdrawalContent.tsx
|
|
@@ -27792,7 +27809,7 @@ function useCommonWithdrawalFlow({
|
|
|
27792
27809
|
}) {
|
|
27793
27810
|
const { t } = useFunkitTranslation();
|
|
27794
27811
|
const { apiKey, uiCustomizations } = useFunkitConfig();
|
|
27795
|
-
const { selectionOverride,
|
|
27812
|
+
const { selectionOverride, saveWithdrawalDestination } = useSavedWithdrawalChain(config);
|
|
27796
27813
|
const withdrawalSourceTokenBalance = withdrawalItem?.withdrawalSourceTokenBalance;
|
|
27797
27814
|
const [selectedSourceToken, setSelectedSourceToken] = useState44(
|
|
27798
27815
|
config.sourceTokenSymbol
|
|
@@ -27839,13 +27856,13 @@ function useCommonWithdrawalFlow({
|
|
|
27839
27856
|
selectedChainName: dropdownChainName,
|
|
27840
27857
|
targetAssetAddress: dropdownTargetAddress
|
|
27841
27858
|
});
|
|
27842
|
-
const
|
|
27859
|
+
const saveDestination = useCallback33(
|
|
27843
27860
|
(chainId2) => {
|
|
27844
|
-
if (!isLocked) {
|
|
27845
|
-
|
|
27861
|
+
if (!isLocked && selectedToken) {
|
|
27862
|
+
saveWithdrawalDestination({ chainId: chainId2, token: selectedToken });
|
|
27846
27863
|
}
|
|
27847
27864
|
},
|
|
27848
|
-
[isLocked,
|
|
27865
|
+
[isLocked, selectedToken, saveWithdrawalDestination]
|
|
27849
27866
|
);
|
|
27850
27867
|
const {
|
|
27851
27868
|
data: isRisky,
|
|
@@ -27899,7 +27916,7 @@ function useCommonWithdrawalFlow({
|
|
|
27899
27916
|
selectedChainName,
|
|
27900
27917
|
selectedOption,
|
|
27901
27918
|
isLocked,
|
|
27902
|
-
|
|
27919
|
+
saveDestination,
|
|
27903
27920
|
chainIdSortOrder,
|
|
27904
27921
|
popularTokenSymbols,
|
|
27905
27922
|
priorityTokenSymbols,
|
|
@@ -28529,7 +28546,7 @@ var WithdrawContent = ({
|
|
|
28529
28546
|
targetAssetAddress,
|
|
28530
28547
|
selectedOption,
|
|
28531
28548
|
isLocked,
|
|
28532
|
-
|
|
28549
|
+
saveDestination,
|
|
28533
28550
|
chainIdSortOrder,
|
|
28534
28551
|
popularTokenSymbols,
|
|
28535
28552
|
priorityTokenSymbols,
|
|
@@ -28545,7 +28562,7 @@ var WithdrawContent = ({
|
|
|
28545
28562
|
config,
|
|
28546
28563
|
withdrawalItem,
|
|
28547
28564
|
onSuccess: (withdrawal, txHash) => {
|
|
28548
|
-
|
|
28565
|
+
saveDestination(withdrawal.chainId);
|
|
28549
28566
|
invalidateLighterAccount();
|
|
28550
28567
|
invalidateNadoMaxWithdrawable();
|
|
28551
28568
|
onContinue(withdrawal, txHash);
|
|
@@ -31114,16 +31131,16 @@ var useActivityTraversal = () => {
|
|
|
31114
31131
|
};
|
|
31115
31132
|
|
|
31116
31133
|
// src/modals/ProfileDetails/ProfileDetails.tsx
|
|
31117
|
-
import React299, { useCallback as
|
|
31134
|
+
import React299, { useCallback as useCallback64, useState as useState84 } from "react";
|
|
31118
31135
|
|
|
31119
31136
|
// src/components/ModalHeightAnimationLayer/FunCheckoutModalHeightAnimationWrapper.tsx
|
|
31120
31137
|
import React286 from "react";
|
|
31121
31138
|
|
|
31122
31139
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
31123
31140
|
import {
|
|
31124
|
-
useCallback as
|
|
31141
|
+
useCallback as useCallback62,
|
|
31125
31142
|
useEffect as useEffect81,
|
|
31126
|
-
useRef as
|
|
31143
|
+
useRef as useRef50,
|
|
31127
31144
|
useState as useState81
|
|
31128
31145
|
} from "react";
|
|
31129
31146
|
|
|
@@ -33547,20 +33564,24 @@ function usePerpsTransferForm({
|
|
|
33547
33564
|
|
|
33548
33565
|
// src/modals/PolymarketPerpsTransfer/PerpsTransferStep.tsx
|
|
33549
33566
|
var SUCCESS_RESET_MS = 2e3;
|
|
33550
|
-
|
|
33567
|
+
var SUCCESS_CLOSE_MS = 1e3;
|
|
33568
|
+
function PerpsTransferStepComponent({
|
|
33569
|
+
onClose
|
|
33570
|
+
}) {
|
|
33551
33571
|
const bottomSectionRef = useBottomSectionRef();
|
|
33552
33572
|
const queryClient = useQueryClient4();
|
|
33553
33573
|
const { checkoutItem } = useCheckoutContext();
|
|
33554
33574
|
const recordTransfer = useRecordPerpsTransfer();
|
|
33555
33575
|
const [status, setStatus] = useState52("idle");
|
|
33556
|
-
const
|
|
33557
|
-
const
|
|
33558
|
-
|
|
33559
|
-
|
|
33560
|
-
|
|
33576
|
+
const successTimerRef = useRef34(null);
|
|
33577
|
+
const isAutoCloseEnabled = useFeatureGate("enable-perps-transfer-auto-close");
|
|
33578
|
+
const clearSuccessTimer = () => {
|
|
33579
|
+
if (successTimerRef.current !== null) {
|
|
33580
|
+
window.clearTimeout(successTimerRef.current);
|
|
33581
|
+
successTimerRef.current = null;
|
|
33561
33582
|
}
|
|
33562
33583
|
};
|
|
33563
|
-
useEffect57(() =>
|
|
33584
|
+
useEffect57(() => clearSuccessTimer, []);
|
|
33564
33585
|
const perpsTransfer = checkoutItem?.initSettings.config.polymarketPerpsTransfer;
|
|
33565
33586
|
const balances = usePolymarketAccountBalances({
|
|
33566
33587
|
predictions: perpsTransfer?.predictions,
|
|
@@ -33577,7 +33598,7 @@ function PerpsTransferStepComponent() {
|
|
|
33577
33598
|
if (status === "processing") {
|
|
33578
33599
|
return;
|
|
33579
33600
|
}
|
|
33580
|
-
|
|
33601
|
+
clearSuccessTimer();
|
|
33581
33602
|
setStatus("processing");
|
|
33582
33603
|
try {
|
|
33583
33604
|
if (!perpsTransfer) {
|
|
@@ -33598,10 +33619,22 @@ function PerpsTransferStepComponent() {
|
|
|
33598
33619
|
destination.address
|
|
33599
33620
|
]);
|
|
33600
33621
|
setStatus("success");
|
|
33601
|
-
|
|
33602
|
-
|
|
33603
|
-
|
|
33604
|
-
|
|
33622
|
+
logger.info("polymarket:perpsTransfer:succeeded", {
|
|
33623
|
+
direction,
|
|
33624
|
+
amountUsd,
|
|
33625
|
+
autoClose: isAutoCloseEnabled
|
|
33626
|
+
});
|
|
33627
|
+
successTimerRef.current = window.setTimeout(
|
|
33628
|
+
() => {
|
|
33629
|
+
successTimerRef.current = null;
|
|
33630
|
+
if (isAutoCloseEnabled) {
|
|
33631
|
+
onClose();
|
|
33632
|
+
return;
|
|
33633
|
+
}
|
|
33634
|
+
setStatus("idle");
|
|
33635
|
+
},
|
|
33636
|
+
isAutoCloseEnabled ? SUCCESS_CLOSE_MS : SUCCESS_RESET_MS
|
|
33637
|
+
);
|
|
33605
33638
|
void recordTransfer({
|
|
33606
33639
|
direction,
|
|
33607
33640
|
sourceAddress: source.address,
|
|
@@ -35269,7 +35302,7 @@ var ChainInfoBanners = ({ chainId: chainId2 }) => {
|
|
|
35269
35302
|
// src/components/FunTransactionSummary/PaymentAmountSummary.tsx
|
|
35270
35303
|
import {
|
|
35271
35304
|
formatCurrencyAndStringify as formatCurrencyAndStringify7,
|
|
35272
|
-
|
|
35305
|
+
isAddressEquivalent as isAddressEquivalent4,
|
|
35273
35306
|
isTokenEquivalent as isTokenEquivalent7
|
|
35274
35307
|
} from "@funkit/utils";
|
|
35275
35308
|
import NumberFlow from "@number-flow/react";
|
|
@@ -35325,7 +35358,7 @@ function PaymentAmountSummary({
|
|
|
35325
35358
|
const sourceChainId = sourceAssetInfo?.chainId;
|
|
35326
35359
|
const areSameChains = sourceChainId === targetChainId;
|
|
35327
35360
|
const sourceIcon = sourceAssetInfo?.iconSrc ?? void 0;
|
|
35328
|
-
const isSameTokenAddress =
|
|
35361
|
+
const isSameTokenAddress = isAddressEquivalent4({
|
|
35329
35362
|
firstAddress: sourceTokenAddress,
|
|
35330
35363
|
secondAddress: targetTokenAddress
|
|
35331
35364
|
});
|
|
@@ -39623,7 +39656,7 @@ var useCheckoutAmountLimits = ({
|
|
|
39623
39656
|
import { useCallback as useCallback53, useMemo as useMemo54, useReducer as useReducer3, useRef as useRef42 } from "react";
|
|
39624
39657
|
|
|
39625
39658
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
39626
|
-
import {
|
|
39659
|
+
import { isTokenEquivalent as isTokenEquivalent10, round as round2 } from "@funkit/utils";
|
|
39627
39660
|
import * as dnum9 from "dnum";
|
|
39628
39661
|
import { mainnet as mainnet11 } from "viem/chains";
|
|
39629
39662
|
function resolveUnitPrice(isExactIn, sourceHolding, targetUnitPrice) {
|
|
@@ -39823,9 +39856,11 @@ function isEffectivelySameAsset(checkoutConfig, sourceToken, apiKey) {
|
|
|
39823
39856
|
return true;
|
|
39824
39857
|
}
|
|
39825
39858
|
const mainnetChainId = mainnet11.id.toString();
|
|
39826
|
-
return isLighterxyzCustomer(apiKey) && sourceToken.chainId === mainnetChainId && isNativeTokenAddress(sourceToken.address) &&
|
|
39827
|
-
|
|
39828
|
-
|
|
39859
|
+
return isLighterxyzCustomer(apiKey) && sourceToken.chainId === mainnetChainId && isNativeTokenAddress(sourceToken.address) && isTokenEquivalent10({
|
|
39860
|
+
firstTokenChainId: checkoutConfig.targetChain,
|
|
39861
|
+
firstTokenAddress: checkoutConfig.targetAsset,
|
|
39862
|
+
secondTokenChainId: mainnetChainId,
|
|
39863
|
+
secondTokenAddress: WETH_MAINNET_ADDRESS
|
|
39829
39864
|
});
|
|
39830
39865
|
}
|
|
39831
39866
|
function resolveDefaultIsInputInFiat({
|
|
@@ -46638,7 +46673,7 @@ function trackEventForFormOfPayment(fop, checkoutItem, eventName, extras) {
|
|
|
46638
46673
|
|
|
46639
46674
|
// src/modals/CheckoutModal/TransferToken/TransferToken.tsx
|
|
46640
46675
|
import { motion as motion18, useAnimationControls as useAnimationControls4 } from "motion/react";
|
|
46641
|
-
import React277, { useRef as
|
|
46676
|
+
import React277, { useRef as useRef49, useState as useState78 } from "react";
|
|
46642
46677
|
import { createPortal as createPortal24 } from "react-dom";
|
|
46643
46678
|
|
|
46644
46679
|
// src/components/BitcoinLightningBanner/BitcoinLightningBanner.tsx
|
|
@@ -47117,8 +47152,72 @@ var TransferTokenDetails = ({
|
|
|
47117
47152
|
);
|
|
47118
47153
|
};
|
|
47119
47154
|
|
|
47155
|
+
// src/modals/CheckoutModal/TransferToken/useSavedTransferTokenSelection.ts
|
|
47156
|
+
import { useLogOnce as useLogOnce4 } from "@funkit/connect-core";
|
|
47157
|
+
import { useCallback as useCallback59, useRef as useRef47 } from "react";
|
|
47158
|
+
function useTransferTokenSelectionStorage() {
|
|
47159
|
+
const isGateEnabled = useFeatureGate("remember-token-transfer-selection");
|
|
47160
|
+
return useSavedTokenChainSelection({
|
|
47161
|
+
scope: "transfer-token",
|
|
47162
|
+
enabled: isGateEnabled
|
|
47163
|
+
});
|
|
47164
|
+
}
|
|
47165
|
+
function findSymbolByAddress(addressBySymbol, address) {
|
|
47166
|
+
if (!addressBySymbol) {
|
|
47167
|
+
return void 0;
|
|
47168
|
+
}
|
|
47169
|
+
const target = address.toLowerCase();
|
|
47170
|
+
return Object.keys(addressBySymbol).find(
|
|
47171
|
+
(symbol) => addressBySymbol[symbol]?.toLowerCase() === target
|
|
47172
|
+
);
|
|
47173
|
+
}
|
|
47174
|
+
function useSavedTransferTokenSelection() {
|
|
47175
|
+
const { savedSelection } = useTransferTokenSelectionStorage();
|
|
47176
|
+
useLogOnce4(
|
|
47177
|
+
savedSelection ? `${savedSelection.chainId}|${savedSelection.token}` : void 0,
|
|
47178
|
+
() => {
|
|
47179
|
+
logger.info("transferToken_restoredSourceSelection", {
|
|
47180
|
+
chainId: savedSelection?.chainId,
|
|
47181
|
+
token: savedSelection?.token
|
|
47182
|
+
});
|
|
47183
|
+
}
|
|
47184
|
+
);
|
|
47185
|
+
return { selectionOverride: savedSelection };
|
|
47186
|
+
}
|
|
47187
|
+
function useSaveTransferTokenOnDeposit() {
|
|
47188
|
+
const { saveSelection } = useTransferTokenSelectionStorage();
|
|
47189
|
+
const { addressBySymbolByChainId } = useTokenTransferConfig(false);
|
|
47190
|
+
const latestDepositTimeMs = useRef47(0);
|
|
47191
|
+
const saveDetectedDeposit = useCallback59(
|
|
47192
|
+
(item) => {
|
|
47193
|
+
if (item.isDirectExecution && !isTokenTransferDirectExecution(item)) {
|
|
47194
|
+
return;
|
|
47195
|
+
}
|
|
47196
|
+
if (item.createdTimeMs < latestDepositTimeMs.current) {
|
|
47197
|
+
return;
|
|
47198
|
+
}
|
|
47199
|
+
const chainId2 = Number(item.fromChainId);
|
|
47200
|
+
if (!Number.isSafeInteger(chainId2) || chainId2 <= 0) {
|
|
47201
|
+
return;
|
|
47202
|
+
}
|
|
47203
|
+
const token = findSymbolByAddress(
|
|
47204
|
+
addressBySymbolByChainId[chainId2],
|
|
47205
|
+
item.fromTokenAddress
|
|
47206
|
+
);
|
|
47207
|
+
if (!token) {
|
|
47208
|
+
return;
|
|
47209
|
+
}
|
|
47210
|
+
latestDepositTimeMs.current = item.createdTimeMs;
|
|
47211
|
+
logger.info("transferToken_savedSourceSelection", { chainId: chainId2, token });
|
|
47212
|
+
saveSelection({ chainId: chainId2, token });
|
|
47213
|
+
},
|
|
47214
|
+
[addressBySymbolByChainId, saveSelection]
|
|
47215
|
+
);
|
|
47216
|
+
return { saveDetectedDeposit };
|
|
47217
|
+
}
|
|
47218
|
+
|
|
47120
47219
|
// src/modals/CheckoutModal/TransferToken/useTransferTokenTracking.ts
|
|
47121
|
-
import { useCallback as
|
|
47220
|
+
import { useCallback as useCallback60, useEffect as useEffect79, useRef as useRef48, useState as useState77 } from "react";
|
|
47122
47221
|
|
|
47123
47222
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.ts
|
|
47124
47223
|
function getNotificationId(item) {
|
|
@@ -47227,15 +47326,15 @@ function useTransferTokenTracking({
|
|
|
47227
47326
|
trackDepositTransferInteracted
|
|
47228
47327
|
} = useDepositAnalytics();
|
|
47229
47328
|
const [pendingInteraction, setPendingInteraction] = useState77(null);
|
|
47230
|
-
const nextInteractionIdRef =
|
|
47231
|
-
const lastEmittedInteractionIdRef =
|
|
47232
|
-
const interactionCountRef =
|
|
47329
|
+
const nextInteractionIdRef = useRef48(0);
|
|
47330
|
+
const lastEmittedInteractionIdRef = useRef48(0);
|
|
47331
|
+
const interactionCountRef = useRef48(0);
|
|
47233
47332
|
useEffect79(() => {
|
|
47234
47333
|
if (checkoutId && depositAddress) {
|
|
47235
47334
|
registerQrPaymentTarget(checkoutId, depositAddress);
|
|
47236
47335
|
}
|
|
47237
47336
|
}, [checkoutId, depositAddress]);
|
|
47238
|
-
const queueTransferInteraction =
|
|
47337
|
+
const queueTransferInteraction = useCallback60(
|
|
47239
47338
|
(interaction) => {
|
|
47240
47339
|
const id = nextInteractionIdRef.current + 1;
|
|
47241
47340
|
nextInteractionIdRef.current = id;
|
|
@@ -47291,7 +47390,7 @@ function useTransferTokenTracking({
|
|
|
47291
47390
|
});
|
|
47292
47391
|
}
|
|
47293
47392
|
}, [depositAddress, fromChainId, toChainId, toTokenAddress]);
|
|
47294
|
-
const trackAddressCopied =
|
|
47393
|
+
const trackAddressCopied = useCallback60(() => {
|
|
47295
47394
|
logEvent({
|
|
47296
47395
|
eventName: "fc::deposit::transfer::address::copied" /* DEPOSIT_TRANSFER_ADDRESS_COPIED */,
|
|
47297
47396
|
metadata: {
|
|
@@ -47308,7 +47407,7 @@ function useTransferTokenTracking({
|
|
|
47308
47407
|
});
|
|
47309
47408
|
}
|
|
47310
47409
|
}, [fromChainId, fromTokenSymbol, logEvent, queueTransferInteraction]);
|
|
47311
|
-
const trackImpactExpanded =
|
|
47410
|
+
const trackImpactExpanded = useCallback60(
|
|
47312
47411
|
({
|
|
47313
47412
|
maxSlippagePct,
|
|
47314
47413
|
priceImpactPct
|
|
@@ -47333,7 +47432,7 @@ function useTransferTokenTracking({
|
|
|
47333
47432
|
trackDepositTransferBreakdownClicked
|
|
47334
47433
|
]
|
|
47335
47434
|
);
|
|
47336
|
-
const trackSourceChainChange =
|
|
47435
|
+
const trackSourceChainChange = useCallback60(
|
|
47337
47436
|
(newChainId, newTokenSymbol, shouldQueueInteraction = true) => {
|
|
47338
47437
|
if (newChainId === fromChainId) {
|
|
47339
47438
|
return;
|
|
@@ -47367,7 +47466,7 @@ function useTransferTokenTracking({
|
|
|
47367
47466
|
queueTransferInteraction
|
|
47368
47467
|
]
|
|
47369
47468
|
);
|
|
47370
|
-
const trackSourceTokenChange =
|
|
47469
|
+
const trackSourceTokenChange = useCallback60(
|
|
47371
47470
|
(newTokenSymbol, newChainId, shouldQueueInteraction = true) => {
|
|
47372
47471
|
const isSameResolvedSource = newChainId !== void 0 && newTokenSymbol === fromTokenSymbol && String(newChainId) === fromChainId;
|
|
47373
47472
|
if (newTokenSymbol !== fromTokenSymbol) {
|
|
@@ -47416,7 +47515,7 @@ function useNotificationTracking({
|
|
|
47416
47515
|
const logEventV2 = useTrackV2();
|
|
47417
47516
|
const { logEvent } = useTrack();
|
|
47418
47517
|
const { connectorId } = useGeneralWallet();
|
|
47419
|
-
const depositNotificationDisplayRef =
|
|
47518
|
+
const depositNotificationDisplayRef = useRef48(null);
|
|
47420
47519
|
const trackDepositNotificationDisplayed = useEffectEvent(
|
|
47421
47520
|
(notification, notificationStatus) => {
|
|
47422
47521
|
const context = resolveExecutionProgressContext(notification, "deposit");
|
|
@@ -47445,10 +47544,10 @@ function useNotificationTracking({
|
|
|
47445
47544
|
}));
|
|
47446
47545
|
}
|
|
47447
47546
|
);
|
|
47448
|
-
const notificationDisplayedAtRef =
|
|
47449
|
-
const reasonRef =
|
|
47450
|
-
const itemRef =
|
|
47451
|
-
const statusRef =
|
|
47547
|
+
const notificationDisplayedAtRef = useRef48(null);
|
|
47548
|
+
const reasonRef = useRef48(null);
|
|
47549
|
+
const itemRef = useRef48(item);
|
|
47550
|
+
const statusRef = useRef48(status);
|
|
47452
47551
|
itemRef.current = item;
|
|
47453
47552
|
statusRef.current = status;
|
|
47454
47553
|
const id = item ? getNotificationId(item) : null;
|
|
@@ -47517,7 +47616,7 @@ function useNotificationTracking({
|
|
|
47517
47616
|
}
|
|
47518
47617
|
}
|
|
47519
47618
|
}, [logEvent, status]);
|
|
47520
|
-
const trackDismissal =
|
|
47619
|
+
const trackDismissal = useCallback60(() => {
|
|
47521
47620
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
47522
47621
|
return;
|
|
47523
47622
|
}
|
|
@@ -47538,7 +47637,7 @@ function useNotificationTracking({
|
|
|
47538
47637
|
}
|
|
47539
47638
|
reasonRef.current = "dismissed";
|
|
47540
47639
|
}, [logEvent, trackDepositNotificationInteracted]);
|
|
47541
|
-
const trackShowMore =
|
|
47640
|
+
const trackShowMore = useCallback60(() => {
|
|
47542
47641
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
47543
47642
|
return;
|
|
47544
47643
|
}
|
|
@@ -47672,9 +47771,10 @@ function TransferToken({
|
|
|
47672
47771
|
const { checkoutItem } = useCheckoutContext();
|
|
47673
47772
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
47674
47773
|
const { transferToken } = modalState;
|
|
47675
|
-
const disclaimerTextWrapperRef =
|
|
47774
|
+
const disclaimerTextWrapperRef = useRef49(null);
|
|
47676
47775
|
const { transferInit } = useCheckoutTransferInit();
|
|
47677
47776
|
const enabledChainSymbols = useEnabledTokenTransferChainTokens(transferInit);
|
|
47777
|
+
const { selectionOverride: savedSelection } = useSavedTransferTokenSelection();
|
|
47678
47778
|
const {
|
|
47679
47779
|
assets,
|
|
47680
47780
|
selectedChainId,
|
|
@@ -47831,7 +47931,7 @@ function TransferToken({
|
|
|
47831
47931
|
if (sourceAsset?.symbol === "BTC" && sourceAsset.chainId === String(lightningChain6.id) && enabledChainSymbols[bitcoinChain6.id]?.includes("BTC")) {
|
|
47832
47932
|
return { token: "BTC", chainId: bitcoinChain6.id };
|
|
47833
47933
|
}
|
|
47834
|
-
return void 0;
|
|
47934
|
+
return transferToken ? void 0 : savedSelection;
|
|
47835
47935
|
}
|
|
47836
47936
|
return (
|
|
47837
47937
|
// This ID is used in the DialogContent css to set the height of the modal
|
|
@@ -48430,9 +48530,9 @@ var FiatAccountDetail = {
|
|
|
48430
48530
|
|
|
48431
48531
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
48432
48532
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
48433
|
-
import React283, { useCallback as
|
|
48533
|
+
import React283, { useCallback as useCallback61, useEffect as useEffect80, useMemo as useMemo65, useState as useState80 } from "react";
|
|
48434
48534
|
function useIframeListener(listeners, expectedOrigin) {
|
|
48435
|
-
const handleMessage =
|
|
48535
|
+
const handleMessage = useCallback61(
|
|
48436
48536
|
(event) => {
|
|
48437
48537
|
if (!expectedOrigin || event.origin !== expectedOrigin) {
|
|
48438
48538
|
return;
|
|
@@ -48773,8 +48873,8 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48773
48873
|
const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
|
|
48774
48874
|
const logEventV2 = useTrackV2();
|
|
48775
48875
|
const [modalState, setModalState] = useState81(() => initialState(checkoutItem));
|
|
48776
|
-
const stepIndexRef =
|
|
48777
|
-
const lastViewedStepRef =
|
|
48876
|
+
const stepIndexRef = useRef50(1);
|
|
48877
|
+
const lastViewedStepRef = useRef50(null);
|
|
48778
48878
|
const { isStepReady, ensureStepQueries } = useStepQueryReadiness(
|
|
48779
48879
|
logEvent,
|
|
48780
48880
|
logMeasuredEvent
|
|
@@ -48787,7 +48887,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48787
48887
|
useEffect81(() => {
|
|
48788
48888
|
ensureLoadingAccountScreen();
|
|
48789
48889
|
}, [ensureLoadingAccountScreen]);
|
|
48790
|
-
const trackNextState =
|
|
48890
|
+
const trackNextState = useCallback62(
|
|
48791
48891
|
(nextState, metadata) => {
|
|
48792
48892
|
const trackEvent = trackEventFromNextState(nextState);
|
|
48793
48893
|
if (trackEvent) {
|
|
@@ -48814,7 +48914,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48814
48914
|
const { clearCheckoutQuoteMessages } = useCheckoutQuoteNotification();
|
|
48815
48915
|
const { getCheckoutProgress } = useCheckoutContext();
|
|
48816
48916
|
const { softHide } = useSoftHiddenCheckout();
|
|
48817
|
-
const onCloseWrapper =
|
|
48917
|
+
const onCloseWrapper = useCallback62(
|
|
48818
48918
|
(options) => {
|
|
48819
48919
|
const normalizedIsNewDeposit = !!options?.isNewDeposit;
|
|
48820
48920
|
const metadata = {
|
|
@@ -48869,9 +48969,9 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48869
48969
|
);
|
|
48870
48970
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
48871
48971
|
const [stateHistory, setHistory] = useState81([]);
|
|
48872
|
-
const prevStep =
|
|
48972
|
+
const prevStep = useRef50(null);
|
|
48873
48973
|
const hasHistoryEntry = stateHistory.length > 1;
|
|
48874
|
-
const onNext =
|
|
48974
|
+
const onNext = useCallback62(
|
|
48875
48975
|
(payload) => {
|
|
48876
48976
|
if (prevStep.current === modalState.step) {
|
|
48877
48977
|
return;
|
|
@@ -48932,7 +49032,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48932
49032
|
ensureStepQueries
|
|
48933
49033
|
]
|
|
48934
49034
|
);
|
|
48935
|
-
const onStepChange =
|
|
49035
|
+
const onStepChange = useCallback62(
|
|
48936
49036
|
(nextState) => {
|
|
48937
49037
|
if (prevStep.current === modalState.step) {
|
|
48938
49038
|
return;
|
|
@@ -48959,7 +49059,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48959
49059
|
},
|
|
48960
49060
|
[modalState, animate, trackNextState, ensureStepQueries]
|
|
48961
49061
|
);
|
|
48962
|
-
const onBack =
|
|
49062
|
+
const onBack = useCallback62(() => {
|
|
48963
49063
|
clearCheckoutQuoteMessages();
|
|
48964
49064
|
const backStepOverride = checkoutBackMap[modalState.step];
|
|
48965
49065
|
const prevEntry = [...stateHistory].reverse().find(({ state }) => state.step === backStepOverride) ?? stateHistory[stateHistory.length - 1];
|
|
@@ -49079,7 +49179,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
49079
49179
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
49080
49180
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
49081
49181
|
import clsx23 from "clsx";
|
|
49082
|
-
import React295, { useEffect as useEffect83, useMemo as useMemo66, useRef as
|
|
49182
|
+
import React295, { useEffect as useEffect83, useMemo as useMemo66, useRef as useRef52, useState as useState83 } from "react";
|
|
49083
49183
|
import { Virtuoso } from "react-virtuoso";
|
|
49084
49184
|
|
|
49085
49185
|
// src/consts/layout.ts
|
|
@@ -49438,16 +49538,16 @@ var HomeTokenBalanceDisplayRowSkeleton = () => {
|
|
|
49438
49538
|
|
|
49439
49539
|
// src/modals/ProfileDetails/FunProfileViews/Home/ProfileTitleSection.tsx
|
|
49440
49540
|
import React294 from "react";
|
|
49441
|
-
import { useCallback as
|
|
49541
|
+
import { useCallback as useCallback63, useState as useState82 } from "react";
|
|
49442
49542
|
|
|
49443
49543
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
49444
49544
|
import React291 from "react";
|
|
49445
|
-
import { useEffect as useEffect82, useRef as
|
|
49545
|
+
import { useEffect as useEffect82, useRef as useRef51 } from "react";
|
|
49446
49546
|
function FunClickOutside({
|
|
49447
49547
|
children,
|
|
49448
49548
|
onClick
|
|
49449
49549
|
}) {
|
|
49450
|
-
const wrapperRef =
|
|
49550
|
+
const wrapperRef = useRef51(null);
|
|
49451
49551
|
const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
|
|
49452
49552
|
useEffect82(() => {
|
|
49453
49553
|
const handleClickListener = (event) => {
|
|
@@ -49531,7 +49631,7 @@ var ProfileTitleSection = ({
|
|
|
49531
49631
|
}) => {
|
|
49532
49632
|
const { t } = useFunkitTranslation();
|
|
49533
49633
|
const [isDisconnectExpanded, setIsDisconnectExpanded] = useState82(false);
|
|
49534
|
-
const collapseDisconnect =
|
|
49634
|
+
const collapseDisconnect = useCallback63(
|
|
49535
49635
|
() => setIsDisconnectExpanded(false),
|
|
49536
49636
|
[]
|
|
49537
49637
|
);
|
|
@@ -49622,8 +49722,8 @@ function Home({
|
|
|
49622
49722
|
}) {
|
|
49623
49723
|
const { t } = useFunkitTranslation();
|
|
49624
49724
|
const [selectedView, setSelectedView] = useState83(defaultHomeTab);
|
|
49625
|
-
const checkoutsListRef =
|
|
49626
|
-
const virtuosoParentRef =
|
|
49725
|
+
const checkoutsListRef = useRef52(null);
|
|
49726
|
+
const virtuosoParentRef = useRef52(null);
|
|
49627
49727
|
const account = useAccount();
|
|
49628
49728
|
useCheckoutHistoryListener();
|
|
49629
49729
|
const { userInfo } = useGeneralWallet();
|
|
@@ -49926,13 +50026,13 @@ function ProfileDetails({ onClose, defaultTab }) {
|
|
|
49926
50026
|
DEFAULT_CHECKOUT_HISTORY_DETAIL_TITLE
|
|
49927
50027
|
);
|
|
49928
50028
|
const singleActivityPage = "detail" /* DETAIL */;
|
|
49929
|
-
const resetView =
|
|
50029
|
+
const resetView = useCallback64(() => {
|
|
49930
50030
|
setView(returnView ?? 0 /* HOME */);
|
|
49931
50031
|
setSelectedHomeTab("checkouts" /* CHECKOUTS */);
|
|
49932
50032
|
resetActivityTraversal();
|
|
49933
50033
|
}, [resetActivityTraversal, returnView]);
|
|
49934
50034
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
49935
|
-
const onSelectActivityWrapper =
|
|
50035
|
+
const onSelectActivityWrapper = useCallback64(
|
|
49936
50036
|
(activity) => {
|
|
49937
50037
|
onSelectActivity({
|
|
49938
50038
|
...activity,
|
|
@@ -49962,7 +50062,7 @@ function ProfileDetails({ onClose, defaultTab }) {
|
|
|
49962
50062
|
const isSingleActivityView = view === 3 /* SINGLE_ACTIVITY */;
|
|
49963
50063
|
const isCheckoutDetailView = isSingleActivityView && singleActivityPage === "detail" /* DETAIL */;
|
|
49964
50064
|
const withDivider = isSingleActivityView ? "always" : void 0;
|
|
49965
|
-
const handleHelp =
|
|
50065
|
+
const handleHelp = useCallback64(() => {
|
|
49966
50066
|
window.open(CONTACT_US_LINK, "_blank", "noopener");
|
|
49967
50067
|
}, []);
|
|
49968
50068
|
const { onScroll, topbar, withTopDivider } = useCustomStatusAnimationAboveTopbar({
|
|
@@ -50362,10 +50462,10 @@ function ChainModal({ onClose, open }) {
|
|
|
50362
50462
|
}
|
|
50363
50463
|
|
|
50364
50464
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
50365
|
-
import React321, { useEffect as useEffect93, useLayoutEffect as useLayoutEffect3, useRef as
|
|
50465
|
+
import React321, { useEffect as useEffect93, useLayoutEffect as useLayoutEffect3, useRef as useRef55 } from "react";
|
|
50366
50466
|
|
|
50367
50467
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
50368
|
-
import React311, { useCallback as
|
|
50468
|
+
import React311, { useCallback as useCallback65, useMemo as useMemo67, useState as useState87 } from "react";
|
|
50369
50469
|
|
|
50370
50470
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
50371
50471
|
import React306, { useEffect as useEffect84 } from "react";
|
|
@@ -50751,7 +50851,7 @@ function FunConnectOptions({
|
|
|
50751
50851
|
const [step, setStep] = useState87(INITIAL_STEP);
|
|
50752
50852
|
const [selectedWallet, setSelectedWallet] = useState87();
|
|
50753
50853
|
const [qrCodeUri, setQrCodeUri] = useState87("");
|
|
50754
|
-
const changeStep =
|
|
50854
|
+
const changeStep = useCallback65((newStep) => {
|
|
50755
50855
|
setStep(newStep);
|
|
50756
50856
|
if (isSignIn(newStep)) {
|
|
50757
50857
|
setSelectedWallet(void 0);
|
|
@@ -50762,7 +50862,7 @@ function FunConnectOptions({
|
|
|
50762
50862
|
navigateTo(0 /* SIGNIN_PRIMARY */, { reverse: true });
|
|
50763
50863
|
};
|
|
50764
50864
|
const walletConnectors = usePreparedWalletConnectors();
|
|
50765
|
-
const onRegenerateQrCode =
|
|
50865
|
+
const onRegenerateQrCode = useCallback65(
|
|
50766
50866
|
async (wallet) => {
|
|
50767
50867
|
const sWallet = walletConnectors.find((w) => wallet.id === w.id);
|
|
50768
50868
|
const uri = await sWallet?.getQrCodeUri?.();
|
|
@@ -50770,7 +50870,7 @@ function FunConnectOptions({
|
|
|
50770
50870
|
},
|
|
50771
50871
|
[walletConnectors]
|
|
50772
50872
|
);
|
|
50773
|
-
const connectToWallet =
|
|
50873
|
+
const connectToWallet = useCallback65(
|
|
50774
50874
|
async (wallet) => {
|
|
50775
50875
|
if (!wallet.ready) {
|
|
50776
50876
|
return;
|
|
@@ -50789,7 +50889,7 @@ function FunConnectOptions({
|
|
|
50789
50889
|
},
|
|
50790
50890
|
[changeStep, onRegenerateQrCode]
|
|
50791
50891
|
);
|
|
50792
|
-
const handleRetry =
|
|
50892
|
+
const handleRetry = useCallback65(() => {
|
|
50793
50893
|
if (selectedWallet) {
|
|
50794
50894
|
changeStep(1 /* PENDING_WALLET */);
|
|
50795
50895
|
connectToWallet(selectedWallet);
|
|
@@ -50985,7 +51085,7 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
50985
51085
|
|
|
50986
51086
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
50987
51087
|
import clsx26 from "clsx";
|
|
50988
|
-
import React320, { useCallback as
|
|
51088
|
+
import React320, { useCallback as useCallback67, useEffect as useEffect91, useMemo as useMemo69, useState as useState89 } from "react";
|
|
50989
51089
|
|
|
50990
51090
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
50991
51091
|
import React315 from "react";
|
|
@@ -51052,7 +51152,7 @@ var useRecentCheckouts = ({
|
|
|
51052
51152
|
};
|
|
51053
51153
|
|
|
51054
51154
|
// src/hooks/useOnNewNotification.ts
|
|
51055
|
-
import { safeParseJson as
|
|
51155
|
+
import { safeParseJson as safeParseJson3 } from "@funkit/utils";
|
|
51056
51156
|
import { useEffect as useEffect87 } from "react";
|
|
51057
51157
|
var storageKey5 = "fkc-processed-notifications";
|
|
51058
51158
|
var useOnNewNotification = (combinedNotifications, cb) => {
|
|
@@ -51082,7 +51182,7 @@ function isPlainObject(value) {
|
|
|
51082
51182
|
}
|
|
51083
51183
|
function safeParseJsonObject(src) {
|
|
51084
51184
|
try {
|
|
51085
|
-
const value = src ?
|
|
51185
|
+
const value = src ? safeParseJson3(src) : {};
|
|
51086
51186
|
if (!isPlainObject(value)) {
|
|
51087
51187
|
return {};
|
|
51088
51188
|
}
|
|
@@ -51103,7 +51203,7 @@ import React318 from "react";
|
|
|
51103
51203
|
|
|
51104
51204
|
// src/components/FunNotificationBanner/FunNotificationBanner.tsx
|
|
51105
51205
|
import { AnimatePresence as AnimatePresence6, motion as motion20 } from "motion/react";
|
|
51106
|
-
import React317, { useEffect as useEffect89, useRef as
|
|
51206
|
+
import React317, { useEffect as useEffect89, useRef as useRef54, useState as useState88 } from "react";
|
|
51107
51207
|
import clsx25 from "clsx";
|
|
51108
51208
|
|
|
51109
51209
|
// src/components/FunNotificationBanner/FunNotificationBanner.css.ts
|
|
@@ -51113,7 +51213,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f1rd _1rsrm2f1i _1rsrm2f1f _1rsrm2f11
|
|
|
51113
51213
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
51114
51214
|
import clsx24 from "clsx";
|
|
51115
51215
|
import { motion as motion19, useAnimate as useAnimate3 } from "motion/react";
|
|
51116
|
-
import React316, { useCallback as
|
|
51216
|
+
import React316, { useCallback as useCallback66, useEffect as useEffect88, useRef as useRef53 } from "react";
|
|
51117
51217
|
|
|
51118
51218
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
51119
51219
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -51362,7 +51462,7 @@ var FunNotificationBannerIcon = ({
|
|
|
51362
51462
|
fallbackIconUrl = FALLBACK_ASSET
|
|
51363
51463
|
}) => {
|
|
51364
51464
|
const [animationScope, animate] = useAnimate3();
|
|
51365
|
-
const triggerAnimationProcessingToCompleted =
|
|
51465
|
+
const triggerAnimationProcessingToCompleted = useCallback66(async () => {
|
|
51366
51466
|
const completedIconPath = animationScope.current?.querySelector(
|
|
51367
51467
|
`.${generateAnimationPrefixClassName("icon-wrapper-completed")} path`
|
|
51368
51468
|
);
|
|
@@ -51469,7 +51569,7 @@ var FunNotificationBannerIcon = ({
|
|
|
51469
51569
|
)
|
|
51470
51570
|
]);
|
|
51471
51571
|
}, [animate, animationScope]);
|
|
51472
|
-
const triggerAnimationDelayedToFailed =
|
|
51572
|
+
const triggerAnimationDelayedToFailed = useCallback66(async () => {
|
|
51473
51573
|
await Promise.all([
|
|
51474
51574
|
animate(
|
|
51475
51575
|
`.${generateAnimationPrefixClassName("icon-wrapper")}`,
|
|
@@ -51562,7 +51662,7 @@ var FunNotificationBannerIcon = ({
|
|
|
51562
51662
|
)
|
|
51563
51663
|
]);
|
|
51564
51664
|
}, [animate]);
|
|
51565
|
-
const statusRef =
|
|
51665
|
+
const statusRef = useRef53(status);
|
|
51566
51666
|
useEffect88(() => {
|
|
51567
51667
|
if (statusRef.current !== status) {
|
|
51568
51668
|
if (statusRef.current === "processing" && status === "completed") {
|
|
@@ -51661,7 +51761,7 @@ var FunNotificationBanner = ({
|
|
|
51661
51761
|
}) => {
|
|
51662
51762
|
const [showMore, setShowMore] = useState88(false);
|
|
51663
51763
|
const [isOpen, setIsOpen] = useState88(true);
|
|
51664
|
-
const prevStatusRef =
|
|
51764
|
+
const prevStatusRef = useRef54(status);
|
|
51665
51765
|
const prevStatus = prevStatusRef.current;
|
|
51666
51766
|
useEffect89(() => {
|
|
51667
51767
|
prevStatusRef.current = status;
|
|
@@ -52280,12 +52380,18 @@ var CheckoutNotifications = ({
|
|
|
52280
52380
|
}, [isExpanded, combinedNotifications]);
|
|
52281
52381
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
52282
52382
|
const { logEvent } = useTrack();
|
|
52283
|
-
const
|
|
52383
|
+
const { saveDetectedDeposit } = useSaveTransferTokenOnDeposit();
|
|
52384
|
+
const handleNewNotification = useCallback67(
|
|
52284
52385
|
(item) => {
|
|
52285
52386
|
const trackEvent = trackEventFromNotification(item);
|
|
52286
52387
|
logEvent(trackEvent);
|
|
52388
|
+
try {
|
|
52389
|
+
saveDetectedDeposit(item);
|
|
52390
|
+
} catch (error) {
|
|
52391
|
+
logger.warn("transferToken_saveSourceSelectionFailed", { error });
|
|
52392
|
+
}
|
|
52287
52393
|
},
|
|
52288
|
-
[logEvent]
|
|
52394
|
+
[logEvent, saveDetectedDeposit]
|
|
52289
52395
|
);
|
|
52290
52396
|
useOnNewNotification(combinedNotifications, handleNewNotification);
|
|
52291
52397
|
if (!isVisible) {
|
|
@@ -52479,8 +52585,8 @@ function FunCheckoutModalInner({
|
|
|
52479
52585
|
} = useTitleConfig(checkoutItem, modalState);
|
|
52480
52586
|
const notificationVariant = NOTIFICATION_STEP_VARIANTS[modalState.step];
|
|
52481
52587
|
const handleCheckoutHelp = () => window.open(CONTACT_US_LINK, "_blank", "noopener");
|
|
52482
|
-
const animationCallbackRef =
|
|
52483
|
-
const tooltipAnchorRef =
|
|
52588
|
+
const animationCallbackRef = useRef55(null);
|
|
52589
|
+
const tooltipAnchorRef = useRef55(null);
|
|
52484
52590
|
const handleAnimationCompleteRegister = (cb) => {
|
|
52485
52591
|
animationCallbackRef.current = cb;
|
|
52486
52592
|
};
|
|
@@ -52712,16 +52818,16 @@ function ConnectModal({ onClose, open }) {
|
|
|
52712
52818
|
function useModalStateValue() {
|
|
52713
52819
|
const [isModalOpen, setModalOpen] = useState90(false);
|
|
52714
52820
|
return {
|
|
52715
|
-
closeModal:
|
|
52821
|
+
closeModal: useCallback68(() => setModalOpen(false), []),
|
|
52716
52822
|
isModalOpen,
|
|
52717
|
-
openModal:
|
|
52823
|
+
openModal: useCallback68(() => setModalOpen(true), [])
|
|
52718
52824
|
};
|
|
52719
52825
|
}
|
|
52720
52826
|
function useModalStateValueWithProp() {
|
|
52721
52827
|
const [isModalOpen, setModalOpen] = useState90(false);
|
|
52722
52828
|
const [prop, setProp] = useState90(null);
|
|
52723
52829
|
return {
|
|
52724
|
-
closeModal:
|
|
52830
|
+
closeModal: useCallback68(() => {
|
|
52725
52831
|
setTimeout(
|
|
52726
52832
|
() => {
|
|
52727
52833
|
setProp(null);
|
|
@@ -52732,7 +52838,7 @@ function useModalStateValueWithProp() {
|
|
|
52732
52838
|
}, []),
|
|
52733
52839
|
isModalOpen,
|
|
52734
52840
|
prop,
|
|
52735
|
-
openModal:
|
|
52841
|
+
openModal: useCallback68((prop2) => {
|
|
52736
52842
|
if (prop2 != null) {
|
|
52737
52843
|
setProp(prop2);
|
|
52738
52844
|
}
|
|
@@ -52777,19 +52883,19 @@ function ModalProvider({ children }) {
|
|
|
52777
52883
|
prop: funCheckoutModalId
|
|
52778
52884
|
} = useModalStateValueWithProp();
|
|
52779
52885
|
const [softHiddenCheckoutId, setSoftHiddenCheckoutId] = useState90(null);
|
|
52780
|
-
const softHideFunCheckoutModal =
|
|
52886
|
+
const softHideFunCheckoutModal = useCallback68(() => {
|
|
52781
52887
|
if (funCheckoutModalId) {
|
|
52782
52888
|
setSoftHiddenCheckoutId(funCheckoutModalId);
|
|
52783
52889
|
}
|
|
52784
52890
|
closeFunCheckoutModal();
|
|
52785
52891
|
}, [funCheckoutModalId, closeFunCheckoutModal]);
|
|
52786
|
-
const resumeSoftHiddenCheckout =
|
|
52892
|
+
const resumeSoftHiddenCheckout = useCallback68(() => {
|
|
52787
52893
|
if (softHiddenCheckoutId) {
|
|
52788
52894
|
openFunCheckoutModal(softHiddenCheckoutId);
|
|
52789
52895
|
setSoftHiddenCheckoutId(null);
|
|
52790
52896
|
}
|
|
52791
52897
|
}, [softHiddenCheckoutId, openFunCheckoutModal]);
|
|
52792
|
-
const discardSoftHiddenCheckout =
|
|
52898
|
+
const discardSoftHiddenCheckout = useCallback68(() => {
|
|
52793
52899
|
setSoftHiddenCheckoutId(null);
|
|
52794
52900
|
}, []);
|
|
52795
52901
|
const {
|
|
@@ -52954,7 +53060,7 @@ function useSoftHiddenCheckout() {
|
|
|
52954
53060
|
}
|
|
52955
53061
|
|
|
52956
53062
|
// src/wallets/useWalletAdoption.ts
|
|
52957
|
-
import { useEffect as useEffect95, useRef as
|
|
53063
|
+
import { useEffect as useEffect95, useRef as useRef56 } from "react";
|
|
52958
53064
|
function useWalletAdoption({
|
|
52959
53065
|
connectorId,
|
|
52960
53066
|
onSettled
|
|
@@ -52963,7 +53069,7 @@ function useWalletAdoption({
|
|
|
52963
53069
|
const { connectAsync, connectors } = useConnect();
|
|
52964
53070
|
const initialChainId = useInitialChainId();
|
|
52965
53071
|
const funkitConnectChains = useFunkitConnectChains();
|
|
52966
|
-
const startedRef =
|
|
53072
|
+
const startedRef = useRef56(false);
|
|
52967
53073
|
useEffect95(() => {
|
|
52968
53074
|
if (startedRef.current) {
|
|
52969
53075
|
return;
|
|
@@ -53046,11 +53152,11 @@ function useWalletAdoption({
|
|
|
53046
53152
|
|
|
53047
53153
|
// src/providers/usePreloadImages.ts
|
|
53048
53154
|
import { isNotNullish as isNotNullish6 } from "@funkit/utils";
|
|
53049
|
-
import { useCallback as
|
|
53155
|
+
import { useCallback as useCallback69, useEffect as useEffect96 } from "react";
|
|
53050
53156
|
function usePreloadImages() {
|
|
53051
53157
|
const funkitConnectChains = useFunkitConnectChains();
|
|
53052
53158
|
const walletConnectors = useWalletConnectors();
|
|
53053
|
-
const preloadImages =
|
|
53159
|
+
const preloadImages = useCallback69(() => {
|
|
53054
53160
|
loadImages(
|
|
53055
53161
|
...walletConnectors.map((wallet) => wallet.iconUrl),
|
|
53056
53162
|
...funkitConnectChains.map((chain) => chain.iconUrl).filter(isNotNullish6)
|
|
@@ -53086,7 +53192,7 @@ function createConnectorlessWagmiConfig() {
|
|
|
53086
53192
|
});
|
|
53087
53193
|
}
|
|
53088
53194
|
function FunkitProvider(props) {
|
|
53089
|
-
const adoptWalletRef =
|
|
53195
|
+
const adoptWalletRef = useRef57(props.adoptWallet && { ...props.adoptWallet });
|
|
53090
53196
|
const adoptWallet = adoptWalletRef.current;
|
|
53091
53197
|
const adoptedWalletChanged = props.adoptWallet?.connectorId !== adoptWallet?.connectorId;
|
|
53092
53198
|
validateFunkitProviderProps({ ...props, adoptWallet });
|
|
@@ -53135,7 +53241,7 @@ function FunkitProvider(props) {
|
|
|
53135
53241
|
sdkVersion,
|
|
53136
53242
|
props.funkitConfig.disableLogging
|
|
53137
53243
|
]);
|
|
53138
|
-
|
|
53244
|
+
useLogOnce5(
|
|
53139
53245
|
adoptedWalletChanged ? "walletAdoption:runtimeChangeIgnored" : void 0,
|
|
53140
53246
|
() => {
|
|
53141
53247
|
logger.warn("walletAdoption:runtimeChangeIgnored", {
|
|
@@ -53182,7 +53288,7 @@ function getConfiguredHttpRpcUrl(config, chainId2) {
|
|
|
53182
53288
|
}
|
|
53183
53289
|
function useInitializeRelayClient(source) {
|
|
53184
53290
|
const config = useConfig();
|
|
53185
|
-
const initializedRef =
|
|
53291
|
+
const initializedRef = useRef57(false);
|
|
53186
53292
|
useEffect97(() => {
|
|
53187
53293
|
if (initializedRef.current) {
|
|
53188
53294
|
return;
|
|
@@ -53708,7 +53814,7 @@ var GeneralWalletContext = createContext22({
|
|
|
53708
53814
|
logoutSymbol: void 0
|
|
53709
53815
|
});
|
|
53710
53816
|
function useLoggingLogout(userId) {
|
|
53711
|
-
const prevIdRef =
|
|
53817
|
+
const prevIdRef = useRef58(userId);
|
|
53712
53818
|
useEffect99(() => {
|
|
53713
53819
|
const prevUserId = prevIdRef.current;
|
|
53714
53820
|
if (prevUserId && prevUserId !== "0x" && (!userId || userId === "0x")) {
|
|
@@ -53727,7 +53833,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
53727
53833
|
const ensAvatar = useMainnetEnsAvatar(ensName);
|
|
53728
53834
|
const { externalUserId, apiKey } = useFunkitConfig();
|
|
53729
53835
|
const { updateUserAsync } = useTrack();
|
|
53730
|
-
const prevApiKeyRef =
|
|
53836
|
+
const prevApiKeyRef = useRef58(apiKey);
|
|
53731
53837
|
const isExternalUserIdAddress = getIsExternalUserIdAddress(
|
|
53732
53838
|
apiKey,
|
|
53733
53839
|
externalUserId
|
|
@@ -53795,7 +53901,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
53795
53901
|
}
|
|
53796
53902
|
}, [userInfo, updateUserAsync, apiKey, l2Address]);
|
|
53797
53903
|
const [logoutSymbol, triggerLogoutSymbol] = useSymbolRefresh_default();
|
|
53798
|
-
const handleLogout =
|
|
53904
|
+
const handleLogout = useCallback70(async () => {
|
|
53799
53905
|
logger.log("handleLogout_called");
|
|
53800
53906
|
singletonAssetAbort.abort("Abort on logout");
|
|
53801
53907
|
singletonAssetAbort.setAbortController(new AbortController());
|
|
@@ -54084,18 +54190,18 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
54084
54190
|
const { logEvent, startMeasuredEvent } = useTrack();
|
|
54085
54191
|
const [activeCheckout, setActiveCheckout] = useState94(null);
|
|
54086
54192
|
const [activeWithdrawal, setActiveWithdrawal] = useState94(null);
|
|
54087
|
-
const preWithdrawalDepositSnapshotRef =
|
|
54193
|
+
const preWithdrawalDepositSnapshotRef = useRef59(null);
|
|
54088
54194
|
const udaParams = useUDAParams(
|
|
54089
54195
|
activeCheckout?.initSettings.config?.dynamicRoutingId
|
|
54090
54196
|
);
|
|
54091
54197
|
const [checkoutsProgress, setCheckoutsProgress] = useState94({});
|
|
54092
|
-
const getCheckoutProgress =
|
|
54198
|
+
const getCheckoutProgress = useCallback71(
|
|
54093
54199
|
(checkoutId) => {
|
|
54094
54200
|
return checkoutsProgress[checkoutId];
|
|
54095
54201
|
},
|
|
54096
54202
|
[checkoutsProgress]
|
|
54097
54203
|
);
|
|
54098
|
-
const setCheckoutProgress =
|
|
54204
|
+
const setCheckoutProgress = useCallback71(
|
|
54099
54205
|
(checkoutId, progress) => {
|
|
54100
54206
|
setCheckoutsProgress((data) => ({ ...data, [checkoutId]: progress }));
|
|
54101
54207
|
},
|
|
@@ -54117,7 +54223,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
54117
54223
|
});
|
|
54118
54224
|
}
|
|
54119
54225
|
);
|
|
54120
|
-
const initNewWithdrawal =
|
|
54226
|
+
const initNewWithdrawal = useCallback71(
|
|
54121
54227
|
(props, checkoutConfig) => {
|
|
54122
54228
|
const { onWithdrawalConfirmation, onWithdrawalError, onClose } = props;
|
|
54123
54229
|
const newWithdrawalId = uuid4();
|
|
@@ -54144,7 +54250,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
54144
54250
|
},
|
|
54145
54251
|
[logEvent, startMeasuredEvent]
|
|
54146
54252
|
);
|
|
54147
|
-
const initNewCheckout =
|
|
54253
|
+
const initNewCheckout = useCallback71(
|
|
54148
54254
|
({ config, ...initSettings }) => {
|
|
54149
54255
|
const newCheckoutId = uuid4();
|
|
54150
54256
|
const newActiveCheckoutItem = {
|
|
@@ -54166,7 +54272,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
54166
54272
|
config: {
|
|
54167
54273
|
...config,
|
|
54168
54274
|
// Solana is case-sensitive for SPL token addresses, so we should not lowercase the target asset address here
|
|
54169
|
-
targetAsset: config.targetChain.toString() === SOLANA_MAINNET_CHAIN_ID2.toString() && !
|
|
54275
|
+
targetAsset: config.targetChain.toString() === SOLANA_MAINNET_CHAIN_ID2.toString() && !isAddressEquivalent5({
|
|
54170
54276
|
firstAddress: NATIVE_TOKEN,
|
|
54171
54277
|
secondAddress: config.targetAsset
|
|
54172
54278
|
}) ? config.targetAsset : config.targetAsset.toLowerCase(),
|
|
@@ -54234,7 +54340,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
54234
54340
|
});
|
|
54235
54341
|
}
|
|
54236
54342
|
);
|
|
54237
|
-
const startDirectExecutionCheckout =
|
|
54343
|
+
const startDirectExecutionCheckout = useCallback71(
|
|
54238
54344
|
async ({
|
|
54239
54345
|
stepMessageSetter,
|
|
54240
54346
|
latestQuote,
|
|
@@ -54404,7 +54510,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
54404
54510
|
udaParams
|
|
54405
54511
|
]
|
|
54406
54512
|
);
|
|
54407
|
-
const startRegularCheckout =
|
|
54513
|
+
const startRegularCheckout = useCallback71(
|
|
54408
54514
|
async ({
|
|
54409
54515
|
stepMessageSetter,
|
|
54410
54516
|
latestQuote,
|
|
@@ -54826,14 +54932,14 @@ function useFunkitCheckout(props) {
|
|
|
54826
54932
|
resume: resumeSoftHiddenCheckout,
|
|
54827
54933
|
discard: discardSoftHiddenCheckout
|
|
54828
54934
|
} = useSoftHiddenCheckout();
|
|
54829
|
-
const onErrorWrapper =
|
|
54935
|
+
const onErrorWrapper = useCallback71(
|
|
54830
54936
|
(payload) => {
|
|
54831
54937
|
logger.warn(payload.message, payload);
|
|
54832
54938
|
onError?.(payload);
|
|
54833
54939
|
},
|
|
54834
54940
|
[onError]
|
|
54835
54941
|
);
|
|
54836
|
-
const onOpenWrapper =
|
|
54942
|
+
const onOpenWrapper = useCallback71(
|
|
54837
54943
|
(newId) => {
|
|
54838
54944
|
props?.onOpen?.();
|
|
54839
54945
|
openFunCheckoutModal?.(newId);
|
|
@@ -55077,7 +55183,7 @@ async function validateCheckoutConfig(config) {
|
|
|
55077
55183
|
};
|
|
55078
55184
|
}
|
|
55079
55185
|
var hasSufficientBalance = async (wagmiConfig, walletAddress, tokenAddress, tokenChainId, requiredAssetAmount) => {
|
|
55080
|
-
const finalTokenAddress =
|
|
55186
|
+
const finalTokenAddress = isAddressEquivalent6({
|
|
55081
55187
|
firstAddress: tokenAddress,
|
|
55082
55188
|
secondAddress: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS5
|
|
55083
55189
|
}) ? void 0 : tokenAddress;
|
|
@@ -55316,7 +55422,7 @@ function isPreferredChain(chainId2, additionalChains = []) {
|
|
|
55316
55422
|
return chains.has(chainId2);
|
|
55317
55423
|
}
|
|
55318
55424
|
function isNativeTokenAddress(address) {
|
|
55319
|
-
return
|
|
55425
|
+
return isAddressEquivalent7({
|
|
55320
55426
|
firstAddress: address,
|
|
55321
55427
|
secondAddress: NATIVE_TOKEN
|
|
55322
55428
|
});
|
|
@@ -55348,7 +55454,10 @@ var isAssetUsableToPayForCheckout = ({
|
|
|
55348
55454
|
if (isCheckoutPostActionRequired(config)) {
|
|
55349
55455
|
return false;
|
|
55350
55456
|
}
|
|
55351
|
-
const isPayingSelf = !!payerAddress &&
|
|
55457
|
+
const isPayingSelf = !!payerAddress && !!finalCheckoutRecipient && isAddressEquivalent7({
|
|
55458
|
+
firstAddress: payerAddress,
|
|
55459
|
+
secondAddress: finalCheckoutRecipient
|
|
55460
|
+
});
|
|
55352
55461
|
return paymentMethod === PaymentMethod.ACCOUNT_BALANCE && isPayingSelf && isTokenEquivalent14({
|
|
55353
55462
|
firstTokenChainId: targetChainId,
|
|
55354
55463
|
firstTokenAddress: targetTokenAddress,
|