@funkit/connect 7.0.3-next.0 → 7.1.0-next.2
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 +47 -0
- package/dist/__generated__/default_configs.d.ts +163 -3
- package/dist/components/Dropdown/TokenAndChainDropdown.css.d.ts +1 -0
- package/dist/components/FunCheckoutHistory/useCustomStatusAnimationAboveTopbar.d.ts +3 -1
- package/dist/components/FunTransactionSummary/PaymentAmountSummary.d.ts +1 -1
- package/dist/components/TransactionStatus/TransactionStatus.d.ts +2 -2
- package/dist/consts/customers.d.ts +1 -0
- package/dist/domains/asset.d.ts +2 -2
- package/dist/hooks/queries/useWithdrawalQuote.d.ts +1 -2
- package/dist/hooks/statsig/useDynamicConfig.d.ts +1 -1
- package/dist/hooks/track/useTrack.d.ts +3 -1
- package/dist/hooks/useBluvo.d.ts +0 -1
- package/dist/hooks/useCheckoutDirectExecution.d.ts +0 -1
- package/dist/hooks/useCheckoutTransferInit.d.ts +4 -2
- package/dist/hooks/useDynamicRoutes.d.ts +4 -0
- package/dist/hooks/useIsDynamicRoutingEnabled.d.ts +4 -0
- package/dist/hooks/useUDAParams.d.ts +9 -0
- package/dist/index.css +7 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1119 -664
- package/dist/modals/CheckoutModal/FunCheckoutModal.d.ts +3 -1
- package/dist/providers/FunkitCheckoutContext/index.d.ts +6 -0
- package/dist/providers/FunkitCheckoutContext/types.d.ts +17 -0
- package/dist/providers/ModalContext.d.ts +7 -0
- package/dist/utils/checkout.d.ts +0 -1
- package/dist/utils/customer.d.ts +192 -0
- package/dist/utils/flags/config.d.ts +17 -43
- package/dist/utils/funLogger.d.ts +3 -1
- package/dist/utils/lighter.d.ts +3 -3
- package/dist/wallets/walletConnectors/index.js +9 -9
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -844,7 +844,7 @@ function useMainnetEnsName(address) {
|
|
|
844
844
|
import {
|
|
845
845
|
getAllWalletTokens
|
|
846
846
|
} from "@funkit/api-base";
|
|
847
|
-
import { keepPreviousData as keepPreviousData2, useQuery as
|
|
847
|
+
import { keepPreviousData as keepPreviousData2, useQuery as useQuery22 } from "@tanstack/react-query";
|
|
848
848
|
import { arbitrum as arbitrum6, polygon as polygon7 } from "viem/chains";
|
|
849
849
|
import { useAccount as useAccount11 } from "wagmi";
|
|
850
850
|
|
|
@@ -859,56 +859,7 @@ import {
|
|
|
859
859
|
isTokenEquivalent as isTokenEquivalent7,
|
|
860
860
|
round as round4
|
|
861
861
|
} from "@funkit/utils";
|
|
862
|
-
import { arbitrum as arbitrum5, base as base7, mainnet as
|
|
863
|
-
|
|
864
|
-
// src/consts/customers.ts
|
|
865
|
-
import {
|
|
866
|
-
AVANTIS_API_KEY,
|
|
867
|
-
BANKR_API_KEY,
|
|
868
|
-
BASED_API_KEY,
|
|
869
|
-
BSX_API_KEY,
|
|
870
|
-
ETHEREAL_API_KEY,
|
|
871
|
-
HYENA_API_KEY,
|
|
872
|
-
HYPERBEAT_API_KEY,
|
|
873
|
-
HYPERDASH_API_KEY,
|
|
874
|
-
KATANA_API_KEY,
|
|
875
|
-
LIGHTERXYZ_API_KEY,
|
|
876
|
-
MONAD_API_KEY,
|
|
877
|
-
MONKEY_TILT_API_KEY,
|
|
878
|
-
OSTIUM_API_KEY,
|
|
879
|
-
PERPL_API_KEY,
|
|
880
|
-
POLYMARKET_API_KEY
|
|
881
|
-
} from "@funkit/api-base";
|
|
882
|
-
function isPolymarketCustomer(apiKey) {
|
|
883
|
-
return apiKey === POLYMARKET_API_KEY;
|
|
884
|
-
}
|
|
885
|
-
function isOstiumCustomer(apiKey) {
|
|
886
|
-
return apiKey === OSTIUM_API_KEY;
|
|
887
|
-
}
|
|
888
|
-
function isBankrCustomer(apiKey) {
|
|
889
|
-
return apiKey === BANKR_API_KEY;
|
|
890
|
-
}
|
|
891
|
-
function isEtherealCustomer(apiKey) {
|
|
892
|
-
return apiKey === ETHEREAL_API_KEY;
|
|
893
|
-
}
|
|
894
|
-
function isKatanaCustomer(apiKey) {
|
|
895
|
-
return apiKey === KATANA_API_KEY;
|
|
896
|
-
}
|
|
897
|
-
function isMonadCustomer(apiKey) {
|
|
898
|
-
return apiKey === MONAD_API_KEY;
|
|
899
|
-
}
|
|
900
|
-
function isBasedCustomer(apiKey) {
|
|
901
|
-
return apiKey === BASED_API_KEY;
|
|
902
|
-
}
|
|
903
|
-
function isHyenaCustomer(apiKey) {
|
|
904
|
-
return apiKey === HYENA_API_KEY;
|
|
905
|
-
}
|
|
906
|
-
function isLighterxyzCustomer(apiKey) {
|
|
907
|
-
return apiKey === LIGHTERXYZ_API_KEY;
|
|
908
|
-
}
|
|
909
|
-
function isLighterEthSpot(apiKey, checkoutConfig) {
|
|
910
|
-
return checkoutConfig && isLighterxyzCustomer(apiKey) && checkoutConfig.qrcodeActionType === "LIGHTER_ETH_SPOT_DEPOSIT";
|
|
911
|
-
}
|
|
862
|
+
import { arbitrum as arbitrum5, base as base7, mainnet as mainnet13, optimism, polygon as polygon6 } from "viem/chains";
|
|
912
863
|
|
|
913
864
|
// src/modals/CheckoutModal/InputAmount/utils.ts
|
|
914
865
|
import { formatCurrencyAndStringify } from "@funkit/utils";
|
|
@@ -1114,7 +1065,7 @@ import {
|
|
|
1114
1065
|
initializeCheckout as postApiInitializeCheckout
|
|
1115
1066
|
} from "@funkit/api-base";
|
|
1116
1067
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12 } from "@funkit/chains";
|
|
1117
|
-
import { FlagKey as
|
|
1068
|
+
import { FlagKey as FlagKey21, isNotNullish as isNotNullish8 } from "@funkit/utils";
|
|
1118
1069
|
import React234, {
|
|
1119
1070
|
createContext as createContext17,
|
|
1120
1071
|
useCallback as useCallback49,
|
|
@@ -1125,6 +1076,61 @@ import React234, {
|
|
|
1125
1076
|
import { flushSync } from "react-dom";
|
|
1126
1077
|
import { v4 as uuid2 } from "uuid";
|
|
1127
1078
|
|
|
1079
|
+
// src/consts/customers.ts
|
|
1080
|
+
import {
|
|
1081
|
+
AVANTIS_API_KEY,
|
|
1082
|
+
BANKR_API_KEY,
|
|
1083
|
+
BASED_API_KEY,
|
|
1084
|
+
BSX_API_KEY,
|
|
1085
|
+
ETHEREAL_API_KEY,
|
|
1086
|
+
HYENA_API_KEY,
|
|
1087
|
+
HYPERBEAT_API_KEY,
|
|
1088
|
+
HYPERDASH_API_KEY,
|
|
1089
|
+
KATANA_API_KEY,
|
|
1090
|
+
LIGHTERXYZ_API_KEY,
|
|
1091
|
+
MONAD_API_KEY,
|
|
1092
|
+
MONKEY_TILT_API_KEY,
|
|
1093
|
+
OSTIUM_API_KEY,
|
|
1094
|
+
PERPL_API_KEY,
|
|
1095
|
+
POLYMARKET_API_KEY
|
|
1096
|
+
} from "@funkit/api-base";
|
|
1097
|
+
import { mainnet as mainnet4 } from "viem/chains";
|
|
1098
|
+
function isPolymarketCustomer(apiKey) {
|
|
1099
|
+
return apiKey === POLYMARKET_API_KEY;
|
|
1100
|
+
}
|
|
1101
|
+
function isOstiumCustomer(apiKey) {
|
|
1102
|
+
return apiKey === OSTIUM_API_KEY;
|
|
1103
|
+
}
|
|
1104
|
+
function isBankrCustomer(apiKey) {
|
|
1105
|
+
return apiKey === BANKR_API_KEY;
|
|
1106
|
+
}
|
|
1107
|
+
function isEtherealCustomer(apiKey) {
|
|
1108
|
+
return apiKey === ETHEREAL_API_KEY;
|
|
1109
|
+
}
|
|
1110
|
+
function isKatanaCustomer(apiKey) {
|
|
1111
|
+
return apiKey === KATANA_API_KEY;
|
|
1112
|
+
}
|
|
1113
|
+
function isMonadCustomer(apiKey) {
|
|
1114
|
+
return apiKey === MONAD_API_KEY;
|
|
1115
|
+
}
|
|
1116
|
+
function isBasedCustomer(apiKey) {
|
|
1117
|
+
return apiKey === BASED_API_KEY;
|
|
1118
|
+
}
|
|
1119
|
+
function isHyenaCustomer(apiKey) {
|
|
1120
|
+
return apiKey === HYENA_API_KEY;
|
|
1121
|
+
}
|
|
1122
|
+
function isLighterxyzCustomer(apiKey) {
|
|
1123
|
+
return apiKey === LIGHTERXYZ_API_KEY;
|
|
1124
|
+
}
|
|
1125
|
+
function isLighterEthSpot(apiKey, checkoutConfig) {
|
|
1126
|
+
return checkoutConfig && isLighterxyzCustomer(apiKey) && ["LIGHTER_ETH_SPOT_NEW_USER", "LIGHTER_ETH_SPOT"].includes(
|
|
1127
|
+
checkoutConfig.dynamicRoutingId || ""
|
|
1128
|
+
);
|
|
1129
|
+
}
|
|
1130
|
+
function isLighterNativeFlow(apiKey, checkoutConfig) {
|
|
1131
|
+
return !!checkoutConfig && isLighterxyzCustomer(apiKey) && checkoutConfig.targetChain === mainnet4.id.toString();
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1128
1134
|
// src/domains/checkoutRecipient.ts
|
|
1129
1135
|
function getCheckoutRecipient({
|
|
1130
1136
|
walletAddress,
|
|
@@ -1426,7 +1432,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
1426
1432
|
localStorage.setItem(storageKey, version);
|
|
1427
1433
|
}
|
|
1428
1434
|
function getCurrentSdkVersion() {
|
|
1429
|
-
return "7.0
|
|
1435
|
+
return "7.1.0-next.2";
|
|
1430
1436
|
}
|
|
1431
1437
|
function useFingerprint() {
|
|
1432
1438
|
const fingerprint = useCallback3(() => {
|
|
@@ -1459,6 +1465,7 @@ var FunLogger = class {
|
|
|
1459
1465
|
this.userName = null;
|
|
1460
1466
|
this.userLoginType = null;
|
|
1461
1467
|
this.sdkVersion = null;
|
|
1468
|
+
this.l2Address = null;
|
|
1462
1469
|
}
|
|
1463
1470
|
getFunLogEnv() {
|
|
1464
1471
|
if (!this.apiKey || FUN_DEV_API_KEYS.includes(this.apiKey)) {
|
|
@@ -1584,11 +1591,15 @@ var FunLogger = class {
|
|
|
1584
1591
|
getUserLoginType() {
|
|
1585
1592
|
return this.userLoginType;
|
|
1586
1593
|
}
|
|
1587
|
-
|
|
1594
|
+
getL2Address() {
|
|
1595
|
+
return this.l2Address;
|
|
1596
|
+
}
|
|
1597
|
+
setUserInfo(userId, userAddress, userName, userLoginType, l2Address) {
|
|
1588
1598
|
this.userId = userId;
|
|
1589
1599
|
this.userAddress = userAddress;
|
|
1590
1600
|
this.userName = userName;
|
|
1591
1601
|
this.userLoginType = userLoginType;
|
|
1602
|
+
this.l2Address = l2Address ?? null;
|
|
1592
1603
|
}
|
|
1593
1604
|
};
|
|
1594
1605
|
datadogLogs.init({
|
|
@@ -1648,7 +1659,8 @@ var useTrack = () => {
|
|
|
1648
1659
|
userAgent,
|
|
1649
1660
|
appVersion,
|
|
1650
1661
|
customIDs: {
|
|
1651
|
-
apiKey
|
|
1662
|
+
apiKey,
|
|
1663
|
+
l2Address: userInfo.l2Address
|
|
1652
1664
|
},
|
|
1653
1665
|
custom: {
|
|
1654
1666
|
name: userInfo.name,
|
|
@@ -1813,6 +1825,7 @@ import React17, {
|
|
|
1813
1825
|
useContext as useContext6,
|
|
1814
1826
|
useEffect as useEffect6,
|
|
1815
1827
|
useMemo as useMemo6,
|
|
1828
|
+
useRef,
|
|
1816
1829
|
useState as useState7
|
|
1817
1830
|
} from "react";
|
|
1818
1831
|
import {
|
|
@@ -1822,6 +1835,46 @@ import {
|
|
|
1822
1835
|
useSwitchChain
|
|
1823
1836
|
} from "wagmi";
|
|
1824
1837
|
|
|
1838
|
+
// src/utils/customer.ts
|
|
1839
|
+
import { useQuery } from "@tanstack/react-query";
|
|
1840
|
+
function isKatanaEarnFlow({
|
|
1841
|
+
apiKey,
|
|
1842
|
+
checkoutConfig
|
|
1843
|
+
}) {
|
|
1844
|
+
return isKatanaCustomer(apiKey) && !!checkoutConfig && isCheckoutPostActionRequired(checkoutConfig);
|
|
1845
|
+
}
|
|
1846
|
+
async function getLighterAccountsByL1Address(address) {
|
|
1847
|
+
const response = await fetch(
|
|
1848
|
+
`https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${address}`
|
|
1849
|
+
);
|
|
1850
|
+
if (!response.ok) {
|
|
1851
|
+
throw new Error(`Failed to fetch lighter accounts: ${response.statusText}`);
|
|
1852
|
+
}
|
|
1853
|
+
const data = await response.json();
|
|
1854
|
+
return data;
|
|
1855
|
+
}
|
|
1856
|
+
function useLighterAccounts({
|
|
1857
|
+
address,
|
|
1858
|
+
isEnabled = true
|
|
1859
|
+
}) {
|
|
1860
|
+
const enabled = !!address && address !== "0x" && isEnabled;
|
|
1861
|
+
const query = useQuery({
|
|
1862
|
+
queryKey: ["lighterAccounts", address],
|
|
1863
|
+
queryFn: () => getLighterAccountsByL1Address(address),
|
|
1864
|
+
enabled,
|
|
1865
|
+
staleTime: Number.POSITIVE_INFINITY,
|
|
1866
|
+
gcTime: Number.POSITIVE_INFINITY,
|
|
1867
|
+
retry: false,
|
|
1868
|
+
// allows us to always refetch the data but return the previous data until the new data is fetched
|
|
1869
|
+
refetchOnMount: "always"
|
|
1870
|
+
});
|
|
1871
|
+
return {
|
|
1872
|
+
...query,
|
|
1873
|
+
mainAccountIndex: query.data?.sub_accounts?.[0]?.index?.toString(),
|
|
1874
|
+
subAccounts: query.data?.sub_accounts
|
|
1875
|
+
};
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1825
1878
|
// src/utils/funkitProvider.ts
|
|
1826
1879
|
function getInitialChainIdFromFunkitProviderProps(props) {
|
|
1827
1880
|
if (!props.wagmiConfig) {
|
|
@@ -1973,6 +2026,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
1973
2026
|
const ensAvatar = useMainnetEnsAvatar(ensName);
|
|
1974
2027
|
const { externalUserId, apiKey } = useFunkitConfig();
|
|
1975
2028
|
const { updateUserAsync } = useTrack();
|
|
2029
|
+
const prevApiKeyRef = useRef(apiKey);
|
|
1976
2030
|
const loginType = !connector ? "guest" /* Guest */ : "web3" /* Web3 */;
|
|
1977
2031
|
const isUserLoggedIn = loginType !== "guest" /* Guest */ || !!externalUserId;
|
|
1978
2032
|
const userInfo = useMemo6(() => {
|
|
@@ -2005,20 +2059,28 @@ function GeneralWalletProvider({ children }) {
|
|
|
2005
2059
|
apiKey,
|
|
2006
2060
|
externalUserId
|
|
2007
2061
|
]);
|
|
2062
|
+
const { mainAccountIndex: l2Address } = useLighterAccounts({
|
|
2063
|
+
address
|
|
2064
|
+
});
|
|
2008
2065
|
useEffect6(() => {
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2066
|
+
const apiKeyChanged = prevApiKeyRef.current !== apiKey;
|
|
2067
|
+
const userInfoChanged = userInfo.id !== logger.getUserId() || userInfo.address !== logger.getUserAddress() || userInfo.name !== logger.getUserName() || userInfo.type !== logger.getUserLoginType() || l2Address !== logger.getL2Address();
|
|
2068
|
+
if (apiKeyChanged || userInfoChanged) {
|
|
2069
|
+
const userInfoWithL2Address = { ...userInfo, l2Address };
|
|
2070
|
+
logger.log("settingUserInfo", userInfoWithL2Address);
|
|
2071
|
+
updateUserAsync(userInfoWithL2Address, apiKey).catch(
|
|
2012
2072
|
(error) => logger.error("updateUserAsync:error", error)
|
|
2013
2073
|
);
|
|
2014
2074
|
logger.setUserInfo(
|
|
2015
2075
|
userInfo.id,
|
|
2016
2076
|
userInfo.address,
|
|
2017
2077
|
userInfo.name,
|
|
2018
|
-
userInfo.type
|
|
2078
|
+
userInfo.type,
|
|
2079
|
+
userInfoWithL2Address.l2Address
|
|
2019
2080
|
);
|
|
2081
|
+
prevApiKeyRef.current = apiKey;
|
|
2020
2082
|
}
|
|
2021
|
-
}, [userInfo, updateUserAsync, apiKey]);
|
|
2083
|
+
}, [userInfo, updateUserAsync, apiKey, l2Address]);
|
|
2022
2084
|
const [logoutSymbol, triggerLogoutSymbol] = useSymbolRefresh_default();
|
|
2023
2085
|
const handleLogout = useCallback5(async () => {
|
|
2024
2086
|
logger.log("handleLogout_called");
|
|
@@ -2167,69 +2229,13 @@ async function disableAtomicBatchIfSupported(wallet, chainId) {
|
|
|
2167
2229
|
});
|
|
2168
2230
|
}
|
|
2169
2231
|
|
|
2170
|
-
// src/utils/lighter.ts
|
|
2171
|
-
import { getAddress } from "viem";
|
|
2172
|
-
var LIGHTER_DEPOSIT_ABI = [
|
|
2173
|
-
{
|
|
2174
|
-
inputs: [
|
|
2175
|
-
{ internalType: "address", name: "_to", type: "address" },
|
|
2176
|
-
{ internalType: "uint16", name: "_assetIndex", type: "uint16" },
|
|
2177
|
-
{
|
|
2178
|
-
internalType: "enum TxTypes.RouteType",
|
|
2179
|
-
name: "_routeType",
|
|
2180
|
-
type: "uint8"
|
|
2181
|
-
},
|
|
2182
|
-
{ internalType: "uint256", name: "_amount", type: "uint256" }
|
|
2183
|
-
],
|
|
2184
|
-
name: "deposit",
|
|
2185
|
-
outputs: [],
|
|
2186
|
-
stateMutability: "payable",
|
|
2187
|
-
type: "function"
|
|
2188
|
-
},
|
|
2189
|
-
{
|
|
2190
|
-
inputs: [{ internalType: "address", name: "", type: "address" }],
|
|
2191
|
-
name: "addressToAccountIndex",
|
|
2192
|
-
outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
|
|
2193
|
-
stateMutability: "view",
|
|
2194
|
-
type: "function"
|
|
2195
|
-
},
|
|
2196
|
-
{
|
|
2197
|
-
inputs: [{ internalType: "uint16", name: "assetIndex", type: "uint16" }],
|
|
2198
|
-
name: "assetConfigs",
|
|
2199
|
-
outputs: [
|
|
2200
|
-
{ internalType: "address", name: "tokenAddress", type: "address" },
|
|
2201
|
-
{
|
|
2202
|
-
internalType: "uint8",
|
|
2203
|
-
name: "withdrawalsEnabled",
|
|
2204
|
-
type: "uint8"
|
|
2205
|
-
},
|
|
2206
|
-
{
|
|
2207
|
-
internalType: "uint56",
|
|
2208
|
-
name: "extensionMultiplier",
|
|
2209
|
-
type: "uint56"
|
|
2210
|
-
},
|
|
2211
|
-
{ internalType: "uint128", name: "tickSize", type: "uint128" },
|
|
2212
|
-
{ internalType: "uint64", name: "depositCapTicks", type: "uint64" },
|
|
2213
|
-
{ internalType: "uint64", name: "minDepositTicks", type: "uint64" }
|
|
2214
|
-
],
|
|
2215
|
-
stateMutability: "view",
|
|
2216
|
-
type: "function"
|
|
2217
|
-
}
|
|
2218
|
-
];
|
|
2219
|
-
var LIGHTER_DEPOSIT_ADDRESS = getAddress(
|
|
2220
|
-
"0x3b4d794a66304f130a4db8f2551b0070dfcf5ca7"
|
|
2221
|
-
);
|
|
2222
|
-
var roundDownToTick = (amount, tickSize) => {
|
|
2223
|
-
return amount - amount % tickSize;
|
|
2224
|
-
};
|
|
2225
|
-
|
|
2226
2232
|
// src/hooks/useRelayBypass.ts
|
|
2227
2233
|
import { FlagKey as FlagKey3, isTokenAddressEquivalent } from "@funkit/utils";
|
|
2228
2234
|
import { useCallback as useCallback6, useMemo as useMemo10 } from "react";
|
|
2229
2235
|
|
|
2230
2236
|
// src/providers/FunkitFlagsProvider.tsx
|
|
2231
2237
|
import { datadogLogs as datadogLogs2 } from "@datadog/browser-logs";
|
|
2232
|
-
import { useQuery as
|
|
2238
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
2233
2239
|
import React18, {
|
|
2234
2240
|
createContext as createContext7,
|
|
2235
2241
|
useContext as useContext7,
|
|
@@ -2243,10 +2249,8 @@ import {
|
|
|
2243
2249
|
BANKR_API_KEY as BANKR_API_KEY2,
|
|
2244
2250
|
BASED_API_KEY as BASED_API_KEY2,
|
|
2245
2251
|
BULLPEN_API_KEY,
|
|
2246
|
-
CAMBRIA_API_KEY,
|
|
2247
2252
|
ETHEREAL_API_KEY as ETHEREAL_API_KEY3,
|
|
2248
2253
|
FELIX_API_KEY,
|
|
2249
|
-
GINZA_API_KEY,
|
|
2250
2254
|
HYENA_API_KEY as HYENA_API_KEY2,
|
|
2251
2255
|
HYPERBEAT_API_KEY as HYPERBEAT_API_KEY2,
|
|
2252
2256
|
HYPERDASH_API_KEY as HYPERDASH_API_KEY2,
|
|
@@ -2256,18 +2260,16 @@ import {
|
|
|
2256
2260
|
LIGHTERXYZ_API_KEY as LIGHTERXYZ_API_KEY2,
|
|
2257
2261
|
MEGAPOT_API_KEY,
|
|
2258
2262
|
MONAD_API_KEY as MONAD_API_KEY2,
|
|
2259
|
-
MONKEY_TILT_API_KEY as MONKEY_TILT_API_KEY2,
|
|
2260
2263
|
OSTIUM_API_KEY as OSTIUM_API_KEY2,
|
|
2261
2264
|
PERPL_API_KEY as PERPL_API_KEY2,
|
|
2262
2265
|
POLYMARKET_API_KEY as POLYMARKET_API_KEY2,
|
|
2263
2266
|
RAREBETSPORTS_API_KEY,
|
|
2264
2267
|
SUSHI_API_KEY,
|
|
2265
|
-
TRADEFOX_API_KEY,
|
|
2266
2268
|
VENTUALS_API_KEY
|
|
2267
2269
|
} from "@funkit/api-base";
|
|
2268
|
-
import { MONAD_CHAIN_ID
|
|
2270
|
+
import { MONAD_CHAIN_ID } from "@funkit/chains";
|
|
2269
2271
|
import { FlagKey } from "@funkit/utils";
|
|
2270
|
-
import { arbitrum, base as base3, polygon } from "viem/chains";
|
|
2272
|
+
import { arbitrum, base as base3, mainnet as mainnet5, polygon } from "viem/chains";
|
|
2271
2273
|
var FUN_INTERNAL_USERS = [
|
|
2272
2274
|
"0x6ec0c2f25d323e7779925Cc20c3740101f990d9F",
|
|
2273
2275
|
// Chloe
|
|
@@ -2367,8 +2369,9 @@ var QR_CODE_WITH_SOLANA = {
|
|
|
2367
2369
|
1151111081099710: ["SOL", "USDC", "USDT", "TRUMP", "USDe"]
|
|
2368
2370
|
};
|
|
2369
2371
|
var QR_CODE_WITH_BITCOIN = {
|
|
2370
|
-
...QR_CODE_WITH_SOLANA
|
|
2371
|
-
|
|
2372
|
+
...QR_CODE_WITH_SOLANA
|
|
2373
|
+
// uncomment to re-enable bitcoin
|
|
2374
|
+
// [bitcoinChain.id]: ['BTC'],
|
|
2372
2375
|
};
|
|
2373
2376
|
var QR_CODE_WITH_MONAD = {
|
|
2374
2377
|
...QR_CODE_WITH_BITCOIN,
|
|
@@ -2445,7 +2448,7 @@ var flagConfig = {
|
|
|
2445
2448
|
},
|
|
2446
2449
|
[FlagKey.EnableTokenTransfer]: {
|
|
2447
2450
|
type: "boolean",
|
|
2448
|
-
default_value:
|
|
2451
|
+
default_value: true,
|
|
2449
2452
|
overrides: [
|
|
2450
2453
|
{
|
|
2451
2454
|
if_any: [
|
|
@@ -2457,59 +2460,12 @@ var flagConfig = {
|
|
|
2457
2460
|
],
|
|
2458
2461
|
value: true
|
|
2459
2462
|
},
|
|
2460
|
-
|
|
2461
|
-
if_any: [
|
|
2462
|
-
{
|
|
2463
|
-
key: "userId",
|
|
2464
|
-
type: "isAnyOf",
|
|
2465
|
-
values: FUN_INTERNAL_USERS
|
|
2466
|
-
}
|
|
2467
|
-
],
|
|
2468
|
-
value: true
|
|
2469
|
-
},
|
|
2470
|
-
disableFlagForCountries(US_COUNTRY_CODES),
|
|
2471
|
-
{
|
|
2472
|
-
if_any: [
|
|
2473
|
-
{
|
|
2474
|
-
key: "apiKey",
|
|
2475
|
-
type: "isAnyOf",
|
|
2476
|
-
values: [
|
|
2477
|
-
AVANTIS_API_KEY2,
|
|
2478
|
-
BANKR_API_KEY2,
|
|
2479
|
-
BASED_API_KEY2,
|
|
2480
|
-
BULLPEN_API_KEY,
|
|
2481
|
-
CAMBRIA_API_KEY,
|
|
2482
|
-
ETHEREAL_API_KEY3,
|
|
2483
|
-
FELIX_API_KEY,
|
|
2484
|
-
GINZA_API_KEY,
|
|
2485
|
-
HYENA_API_KEY2,
|
|
2486
|
-
HYPERBEAT_API_KEY2,
|
|
2487
|
-
HYPERDASH_API_KEY2,
|
|
2488
|
-
HYPEREDGE_API_KEY,
|
|
2489
|
-
HYPERSWAP_API_KEY,
|
|
2490
|
-
KATANA_API_KEY2,
|
|
2491
|
-
LIGHTERXYZ_API_KEY2,
|
|
2492
|
-
LIGHTERXYZ_API_KEY2,
|
|
2493
|
-
MEGAPOT_API_KEY,
|
|
2494
|
-
MONAD_API_KEY2,
|
|
2495
|
-
MONKEY_TILT_API_KEY2,
|
|
2496
|
-
OSTIUM_API_KEY2,
|
|
2497
|
-
PERPL_API_KEY2,
|
|
2498
|
-
POLYMARKET_API_KEY2,
|
|
2499
|
-
RAREBETSPORTS_API_KEY,
|
|
2500
|
-
SUSHI_API_KEY,
|
|
2501
|
-
VENTUALS_API_KEY,
|
|
2502
|
-
TRADEFOX_API_KEY
|
|
2503
|
-
]
|
|
2504
|
-
}
|
|
2505
|
-
],
|
|
2506
|
-
value: true
|
|
2507
|
-
}
|
|
2463
|
+
disableFlagForCountries(US_COUNTRY_CODES)
|
|
2508
2464
|
]
|
|
2509
2465
|
},
|
|
2510
2466
|
[FlagKey.EnableFiatDeposit]: {
|
|
2511
2467
|
type: "boolean",
|
|
2512
|
-
default_value:
|
|
2468
|
+
default_value: true,
|
|
2513
2469
|
overrides: [
|
|
2514
2470
|
{
|
|
2515
2471
|
if_any: [
|
|
@@ -2521,17 +2477,7 @@ var flagConfig = {
|
|
|
2521
2477
|
],
|
|
2522
2478
|
value: true
|
|
2523
2479
|
},
|
|
2524
|
-
disableFlagForCountries(US_COUNTRY_CODES)
|
|
2525
|
-
{
|
|
2526
|
-
if_any: [
|
|
2527
|
-
{
|
|
2528
|
-
key: "userId",
|
|
2529
|
-
type: "pctRollout",
|
|
2530
|
-
pct: 100
|
|
2531
|
-
}
|
|
2532
|
-
],
|
|
2533
|
-
value: true
|
|
2534
|
-
}
|
|
2480
|
+
disableFlagForCountries(US_COUNTRY_CODES)
|
|
2535
2481
|
]
|
|
2536
2482
|
},
|
|
2537
2483
|
[FlagKey.TokenTransferSourceChainsAndAssets]: {
|
|
@@ -2557,6 +2503,24 @@ var flagConfig = {
|
|
|
2557
2503
|
5064014: void 0
|
|
2558
2504
|
})
|
|
2559
2505
|
},
|
|
2506
|
+
{
|
|
2507
|
+
if_any: [
|
|
2508
|
+
{
|
|
2509
|
+
key: "apiKey",
|
|
2510
|
+
type: "isAnyOf",
|
|
2511
|
+
values: [KATANA_API_KEY2]
|
|
2512
|
+
}
|
|
2513
|
+
],
|
|
2514
|
+
value: JSON.stringify({
|
|
2515
|
+
...COMMON_SUPPORT_CHAINS_AND_ASSETS,
|
|
2516
|
+
// abstract
|
|
2517
|
+
2741: ["USDC.e", "ETH", "WETH", "USDT"],
|
|
2518
|
+
// hyperevm.
|
|
2519
|
+
999: ["USDC", "HYPE", "WETH", "USDT", "UBTC", "USDe"],
|
|
2520
|
+
// solana - only enable once customers are on v5.0.11, anything prior will break
|
|
2521
|
+
1151111081099710: ["SOL", "USDC", "USDT", "TRUMP", "USDe"]
|
|
2522
|
+
})
|
|
2523
|
+
},
|
|
2560
2524
|
// Omit MON as a source asset for Monad
|
|
2561
2525
|
{
|
|
2562
2526
|
if_any: [
|
|
@@ -2635,7 +2599,7 @@ var flagConfig = {
|
|
|
2635
2599
|
{
|
|
2636
2600
|
key: "apiKey",
|
|
2637
2601
|
type: "isAnyOf",
|
|
2638
|
-
values: [OSTIUM_API_KEY2, ETHEREAL_API_KEY3]
|
|
2602
|
+
values: [OSTIUM_API_KEY2, ETHEREAL_API_KEY3, LIGHTERXYZ_API_KEY2]
|
|
2639
2603
|
}
|
|
2640
2604
|
],
|
|
2641
2605
|
value: arbitrum.id.toString()
|
|
@@ -2651,6 +2615,17 @@ var flagConfig = {
|
|
|
2651
2615
|
value: base3.id.toString()
|
|
2652
2616
|
},
|
|
2653
2617
|
// Oct 20 - Default to Bitcoin chain on transfer crypto for Polymarket
|
|
2618
|
+
// {
|
|
2619
|
+
// if_any: [
|
|
2620
|
+
// {
|
|
2621
|
+
// key: 'apiKey',
|
|
2622
|
+
// type: 'isAnyOf',
|
|
2623
|
+
// values: [POLYMARKET_API_KEY],
|
|
2624
|
+
// },
|
|
2625
|
+
// ],
|
|
2626
|
+
// value: bitcoinChain.id.toString(),
|
|
2627
|
+
// },
|
|
2628
|
+
// December 11 - Default to ethereum since bitcoin is disabled
|
|
2654
2629
|
{
|
|
2655
2630
|
if_any: [
|
|
2656
2631
|
{
|
|
@@ -2659,7 +2634,7 @@ var flagConfig = {
|
|
|
2659
2634
|
values: [POLYMARKET_API_KEY2]
|
|
2660
2635
|
}
|
|
2661
2636
|
],
|
|
2662
|
-
value:
|
|
2637
|
+
value: mainnet5.id.toString()
|
|
2663
2638
|
}
|
|
2664
2639
|
]
|
|
2665
2640
|
},
|
|
@@ -2771,32 +2746,15 @@ var flagConfig = {
|
|
|
2771
2746
|
]
|
|
2772
2747
|
})
|
|
2773
2748
|
},
|
|
2774
|
-
[FlagKey.HelpTutorialUrl]: {
|
|
2775
|
-
type: "string",
|
|
2776
|
-
default_value: ""
|
|
2777
|
-
},
|
|
2778
2749
|
[FlagKey.EnableCard]: {
|
|
2779
2750
|
type: "boolean",
|
|
2780
|
-
default_value:
|
|
2781
|
-
overrides: [
|
|
2782
|
-
disableFlagForCountries(US_COUNTRY_CODES),
|
|
2783
|
-
{
|
|
2784
|
-
if_any: [
|
|
2785
|
-
{
|
|
2786
|
-
key: "apiKey",
|
|
2787
|
-
type: "isAnyOf",
|
|
2788
|
-
values: [KATANA_API_KEY2]
|
|
2789
|
-
}
|
|
2790
|
-
],
|
|
2791
|
-
value: false
|
|
2792
|
-
}
|
|
2793
|
-
]
|
|
2751
|
+
default_value: false,
|
|
2752
|
+
overrides: []
|
|
2794
2753
|
},
|
|
2795
2754
|
// cannot re-use this flag for brokerage flow or clients that are using older versions of the SDK will be impacted
|
|
2796
2755
|
[FlagKey.EnableBrokerage]: {
|
|
2797
2756
|
type: "boolean",
|
|
2798
|
-
default_value: false
|
|
2799
|
-
overrides: [disableFlagForCountries(US_COUNTRY_CODES)]
|
|
2757
|
+
default_value: false
|
|
2800
2758
|
},
|
|
2801
2759
|
[FlagKey.EnableBluvoBrokerage]: {
|
|
2802
2760
|
type: "boolean",
|
|
@@ -2830,6 +2788,7 @@ var flagConfig = {
|
|
|
2830
2788
|
HYPEREDGE_API_KEY,
|
|
2831
2789
|
HYPERSWAP_API_KEY,
|
|
2832
2790
|
MEGAPOT_API_KEY,
|
|
2791
|
+
LIGHTERXYZ_API_KEY2,
|
|
2833
2792
|
MONAD_API_KEY2,
|
|
2834
2793
|
OSTIUM_API_KEY2,
|
|
2835
2794
|
PERPL_API_KEY2,
|
|
@@ -2874,6 +2833,7 @@ var flagConfig = {
|
|
|
2874
2833
|
HYPERBEAT_API_KEY2,
|
|
2875
2834
|
HYPEREDGE_API_KEY,
|
|
2876
2835
|
HYPERSWAP_API_KEY,
|
|
2836
|
+
LIGHTERXYZ_API_KEY2,
|
|
2877
2837
|
MEGAPOT_API_KEY,
|
|
2878
2838
|
MONAD_API_KEY2,
|
|
2879
2839
|
OSTIUM_API_KEY2,
|
|
@@ -2970,7 +2930,8 @@ var flagConfig = {
|
|
|
2970
2930
|
},
|
|
2971
2931
|
[FlagKey.EnableBitcoin]: {
|
|
2972
2932
|
type: "boolean",
|
|
2973
|
-
|
|
2933
|
+
// uncomment to re-enable bitcoin
|
|
2934
|
+
default_value: false,
|
|
2974
2935
|
overrides: [
|
|
2975
2936
|
// Actually disable bitcoin for Ethereal
|
|
2976
2937
|
{
|
|
@@ -3149,7 +3110,7 @@ function evalCondition(flagKey, condition, context) {
|
|
|
3149
3110
|
}
|
|
3150
3111
|
|
|
3151
3112
|
// src/providers/FunkitMoonpayProvider.tsx
|
|
3152
|
-
import { useQuery } from "@tanstack/react-query";
|
|
3113
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
3153
3114
|
import { useMemo as useMemo7 } from "react";
|
|
3154
3115
|
import { FlagKey as FlagKey2 } from "@funkit/utils";
|
|
3155
3116
|
var MOONPAY_LIVE_API_KEY = "pk_live_IxayBRQuBC3RzpPZkbGPrwUsRWAaeO";
|
|
@@ -3196,7 +3157,7 @@ function useFunkitUserIp() {
|
|
|
3196
3157
|
const { apiKey } = useFunkitConfig();
|
|
3197
3158
|
const isPolymarket = isPolymarketCustomer(apiKey);
|
|
3198
3159
|
const { isUserLoggedIn } = useGeneralWallet();
|
|
3199
|
-
const { data: userIpInfo, isLoading: isLoadingGeoCheck } =
|
|
3160
|
+
const { data: userIpInfo, isLoading: isLoadingGeoCheck } = useQuery2({
|
|
3200
3161
|
queryKey: ["getUserIpInfo"],
|
|
3201
3162
|
queryFn: async () => {
|
|
3202
3163
|
try {
|
|
@@ -3260,7 +3221,7 @@ function FunkitFlagsProvider({ children }) {
|
|
|
3260
3221
|
data: onlineConfig,
|
|
3261
3222
|
error,
|
|
3262
3223
|
isLoading
|
|
3263
|
-
} =
|
|
3224
|
+
} = useQuery3({
|
|
3264
3225
|
queryKey: ["flags"],
|
|
3265
3226
|
queryFn: fetchConfigFromServer,
|
|
3266
3227
|
refetchOnMount: false,
|
|
@@ -3468,19 +3429,17 @@ function useCheckoutDirectExecution() {
|
|
|
3468
3429
|
const fromAmountBaseUnit = BigInt(
|
|
3469
3430
|
Math.floor(fromTokenAmount * multiplier2)
|
|
3470
3431
|
);
|
|
3471
|
-
const roundedFromAmountBaseUnit = params.tickSize ? roundDownToTick(fromAmountBaseUnit, params.tickSize) : fromAmountBaseUnit;
|
|
3472
3432
|
return await getCheckoutQuoteV2({
|
|
3473
3433
|
...getCheckoutQuoteParams,
|
|
3474
|
-
fromAmountBaseUnit
|
|
3434
|
+
fromAmountBaseUnit
|
|
3475
3435
|
});
|
|
3476
3436
|
}
|
|
3477
3437
|
const { toTokenAmount, toTokenDecimals } = params;
|
|
3478
3438
|
const multiplier = 10 ** toTokenDecimals;
|
|
3479
3439
|
const toAmountBaseUnit = BigInt(Math.floor(toTokenAmount * multiplier));
|
|
3480
|
-
const roundedToAmountBaseUnit = params.tickSize ? roundDownToTick(toAmountBaseUnit, params.tickSize) : toAmountBaseUnit;
|
|
3481
3440
|
return await getCheckoutQuoteV2({
|
|
3482
3441
|
...getCheckoutQuoteParams,
|
|
3483
|
-
toAmountBaseUnit
|
|
3442
|
+
toAmountBaseUnit
|
|
3484
3443
|
});
|
|
3485
3444
|
},
|
|
3486
3445
|
[address, apiKey]
|
|
@@ -3659,8 +3618,290 @@ function useCheckoutDirectExecution() {
|
|
|
3659
3618
|
import {
|
|
3660
3619
|
initializeCheckoutTokenTransferAddress
|
|
3661
3620
|
} from "@funkit/api-base";
|
|
3621
|
+
import { lighterChain } from "@funkit/chains";
|
|
3662
3622
|
import { FlagKey as FlagKey4 } from "@funkit/utils";
|
|
3663
|
-
import { useQuery as
|
|
3623
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
3624
|
+
|
|
3625
|
+
// src/hooks/useIsDynamicRoutingEnabled.ts
|
|
3626
|
+
var useIsDynamicRoutingEnabled = ({
|
|
3627
|
+
checkoutConfig: _checkoutConfig
|
|
3628
|
+
} = {}) => {
|
|
3629
|
+
const { checkoutItem } = useCheckoutContext();
|
|
3630
|
+
const checkoutConfig = _checkoutConfig || checkoutItem?.initSettings.config;
|
|
3631
|
+
return checkoutConfig?.dynamicRoutingId !== void 0;
|
|
3632
|
+
};
|
|
3633
|
+
|
|
3634
|
+
// src/hooks/useUDAParams.ts
|
|
3635
|
+
import { useMemo as useMemo12 } from "react";
|
|
3636
|
+
|
|
3637
|
+
// src/hooks/statsig/useDynamicConfig.ts
|
|
3638
|
+
import { useDynamicConfig as useStatsigDynamicConfig } from "@statsig/react-bindings";
|
|
3639
|
+
import { useMemo as useMemo11 } from "react";
|
|
3640
|
+
|
|
3641
|
+
// src/__generated__/default_configs.ts
|
|
3642
|
+
var default_configs_default = {
|
|
3643
|
+
addressblacklist: {
|
|
3644
|
+
value: [
|
|
3645
|
+
"0x7b97b46D35a28B561d47F50CFB9a2735E506e59d",
|
|
3646
|
+
"0x409ad08cc6CA757f69Fb80250a424B9eFeB99807",
|
|
3647
|
+
"0x02A86f51aA7B8b1c17c30364748d5Ae4a0727E23",
|
|
3648
|
+
"0x64131b60502C01362639CC5cfE1a1efB6Be1165A"
|
|
3649
|
+
]
|
|
3650
|
+
},
|
|
3651
|
+
array_of_strings: {
|
|
3652
|
+
value: []
|
|
3653
|
+
},
|
|
3654
|
+
blockedcountries: {
|
|
3655
|
+
value: [
|
|
3656
|
+
"AF",
|
|
3657
|
+
"BY",
|
|
3658
|
+
"MM",
|
|
3659
|
+
"CF",
|
|
3660
|
+
"CU",
|
|
3661
|
+
"CD",
|
|
3662
|
+
"IR",
|
|
3663
|
+
"LB",
|
|
3664
|
+
"LY",
|
|
3665
|
+
"NI",
|
|
3666
|
+
"KP",
|
|
3667
|
+
"UA",
|
|
3668
|
+
"SO",
|
|
3669
|
+
"SS",
|
|
3670
|
+
"SY",
|
|
3671
|
+
"VE"
|
|
3672
|
+
]
|
|
3673
|
+
},
|
|
3674
|
+
boolean: {
|
|
3675
|
+
value: false
|
|
3676
|
+
},
|
|
3677
|
+
brokerage_hide_you_receive: {
|
|
3678
|
+
value: false
|
|
3679
|
+
},
|
|
3680
|
+
chainidsortorder: {
|
|
3681
|
+
value: ["1", "1151111081099710", "8453", "56", "137", "42161", "10"]
|
|
3682
|
+
},
|
|
3683
|
+
checkoutnotificationsrefreshinterval: {
|
|
3684
|
+
value: {
|
|
3685
|
+
listRefresh: 5e3,
|
|
3686
|
+
itemRefresh: 2e3
|
|
3687
|
+
}
|
|
3688
|
+
},
|
|
3689
|
+
checkouttimeestimateoverrides: {
|
|
3690
|
+
value: {
|
|
3691
|
+
balance: 60,
|
|
3692
|
+
brokerage: 120,
|
|
3693
|
+
card: 300,
|
|
3694
|
+
token_transfer: 60
|
|
3695
|
+
}
|
|
3696
|
+
},
|
|
3697
|
+
dynamicrouting: {
|
|
3698
|
+
value: [
|
|
3699
|
+
{
|
|
3700
|
+
routeId: "LIGHTER_ETH_SPOT",
|
|
3701
|
+
rules: [
|
|
3702
|
+
{
|
|
3703
|
+
when: {
|
|
3704
|
+
chainId: "1",
|
|
3705
|
+
tokenAddress: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
|
3706
|
+
},
|
|
3707
|
+
use: {
|
|
3708
|
+
path: "FUN_MAINNET_DEPOSIT",
|
|
3709
|
+
badge: "NATIVE"
|
|
3710
|
+
}
|
|
3711
|
+
},
|
|
3712
|
+
{
|
|
3713
|
+
when: {
|
|
3714
|
+
chainId: "1",
|
|
3715
|
+
tokenAddress: "*"
|
|
3716
|
+
},
|
|
3717
|
+
use: {
|
|
3718
|
+
path: "FUN_MAINNET_DEPOSIT"
|
|
3719
|
+
}
|
|
3720
|
+
},
|
|
3721
|
+
{
|
|
3722
|
+
when: "*",
|
|
3723
|
+
use: {
|
|
3724
|
+
path: "RL_TRANSFER"
|
|
3725
|
+
}
|
|
3726
|
+
}
|
|
3727
|
+
]
|
|
3728
|
+
},
|
|
3729
|
+
{
|
|
3730
|
+
routeId: "LIGHTER_USDC_PERPS",
|
|
3731
|
+
rules: [
|
|
3732
|
+
{
|
|
3733
|
+
when: {
|
|
3734
|
+
chainId: "1",
|
|
3735
|
+
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
3736
|
+
},
|
|
3737
|
+
use: {
|
|
3738
|
+
path: "FUN_MAINNET_DEPOSIT",
|
|
3739
|
+
badge: "NATIVE"
|
|
3740
|
+
}
|
|
3741
|
+
},
|
|
3742
|
+
{
|
|
3743
|
+
when: {
|
|
3744
|
+
chainId: "1",
|
|
3745
|
+
tokenAddress: "*"
|
|
3746
|
+
},
|
|
3747
|
+
use: {
|
|
3748
|
+
path: "FUN_MAINNET_DEPOSIT"
|
|
3749
|
+
}
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
when: "*",
|
|
3753
|
+
use: {
|
|
3754
|
+
path: "RL_TRANSFER"
|
|
3755
|
+
}
|
|
3756
|
+
}
|
|
3757
|
+
]
|
|
3758
|
+
},
|
|
3759
|
+
{
|
|
3760
|
+
routeId: "LIGHTER_USDC_PERPS_NEW_USER",
|
|
3761
|
+
rules: [
|
|
3762
|
+
{
|
|
3763
|
+
when: {
|
|
3764
|
+
chainId: "1",
|
|
3765
|
+
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
3766
|
+
},
|
|
3767
|
+
use: {
|
|
3768
|
+
path: "FUN_MAINNET_DEPOSIT",
|
|
3769
|
+
badge: "NATIVE"
|
|
3770
|
+
}
|
|
3771
|
+
},
|
|
3772
|
+
{
|
|
3773
|
+
when: "*",
|
|
3774
|
+
use: {
|
|
3775
|
+
path: "FUN_MAINNET_DEPOSIT"
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
]
|
|
3779
|
+
},
|
|
3780
|
+
{
|
|
3781
|
+
routeId: "LIGHTER_ETH_SPOT_NEW_USER",
|
|
3782
|
+
rules: [
|
|
3783
|
+
{
|
|
3784
|
+
when: {
|
|
3785
|
+
chainId: "1",
|
|
3786
|
+
tokenAddress: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
|
3787
|
+
},
|
|
3788
|
+
use: {
|
|
3789
|
+
path: "FUN_MAINNET_DEPOSIT",
|
|
3790
|
+
badge: "NATIVE"
|
|
3791
|
+
}
|
|
3792
|
+
},
|
|
3793
|
+
{
|
|
3794
|
+
when: "*",
|
|
3795
|
+
use: {
|
|
3796
|
+
path: "FUN_MAINNET_DEPOSIT"
|
|
3797
|
+
}
|
|
3798
|
+
}
|
|
3799
|
+
]
|
|
3800
|
+
}
|
|
3801
|
+
]
|
|
3802
|
+
},
|
|
3803
|
+
enablebitcoin: {
|
|
3804
|
+
value: true
|
|
3805
|
+
},
|
|
3806
|
+
enablebluvobrokerage: {
|
|
3807
|
+
value: false
|
|
3808
|
+
},
|
|
3809
|
+
enablefiatdeposit: {
|
|
3810
|
+
value: true
|
|
3811
|
+
},
|
|
3812
|
+
enablemeldpayment: {
|
|
3813
|
+
value: false
|
|
3814
|
+
},
|
|
3815
|
+
enabletokentransfer: {
|
|
3816
|
+
value: true
|
|
3817
|
+
},
|
|
3818
|
+
isrelaybypassenabled: {
|
|
3819
|
+
value: true
|
|
3820
|
+
},
|
|
3821
|
+
meldquickoptions: {
|
|
3822
|
+
value: {
|
|
3823
|
+
USD: [100, 500, 1e3],
|
|
3824
|
+
EUR: [90, 435, 870],
|
|
3825
|
+
JPY: [14500, 72500, 145e3],
|
|
3826
|
+
KRW: [137500, 69e4, 138e4],
|
|
3827
|
+
GBP: [75, 375, 745],
|
|
3828
|
+
CAD: [135, 685, 1365],
|
|
3829
|
+
AUD: [155, 770, 1540],
|
|
3830
|
+
CHF: [80, 410, 820],
|
|
3831
|
+
BRL: [550, 2750, 5500],
|
|
3832
|
+
INR: [8600, 43e3, 86e3],
|
|
3833
|
+
PHP: [5700, 28500, 57e3],
|
|
3834
|
+
TRY: [3950, 19800, 39500],
|
|
3835
|
+
RUB: [7850, 39300, 78600],
|
|
3836
|
+
PLN: [370, 1860, 3715],
|
|
3837
|
+
SGD: [130, 645, 1285]
|
|
3838
|
+
}
|
|
3839
|
+
},
|
|
3840
|
+
showinfobanner: {
|
|
3841
|
+
value: {
|
|
3842
|
+
message: "",
|
|
3843
|
+
expireAtMs: 0,
|
|
3844
|
+
type: "alert"
|
|
3845
|
+
}
|
|
3846
|
+
},
|
|
3847
|
+
showpoweredtagline: {
|
|
3848
|
+
value: false
|
|
3849
|
+
},
|
|
3850
|
+
supportedexchangesv2: {
|
|
3851
|
+
value: []
|
|
3852
|
+
},
|
|
3853
|
+
uda_params: {
|
|
3854
|
+
value: [
|
|
3855
|
+
{
|
|
3856
|
+
dynamicRoutingId: "LIGHTER_ETH_SPOT",
|
|
3857
|
+
params: {
|
|
3858
|
+
targetChain: "3586256",
|
|
3859
|
+
targetAsset: "0x0000000000000000000000000000000000000001",
|
|
3860
|
+
targetAssetTicker: "ETH (Spot)",
|
|
3861
|
+
iconSrc: "https://sdk-cdn.fun.xyz/images/eth.svg"
|
|
3862
|
+
}
|
|
3863
|
+
},
|
|
3864
|
+
{
|
|
3865
|
+
dynamicRoutingId: "LIGHTER_USDC_PERPS",
|
|
3866
|
+
params: {
|
|
3867
|
+
targetChain: "3586256",
|
|
3868
|
+
targetAsset: "0x0000000000000000000000000000000000000000",
|
|
3869
|
+
targetAssetTicker: "USDC (Perps)",
|
|
3870
|
+
iconSrc: "https://sdk-cdn.fun.xyz/images/usdc.svg"
|
|
3871
|
+
}
|
|
3872
|
+
}
|
|
3873
|
+
]
|
|
3874
|
+
}
|
|
3875
|
+
};
|
|
3876
|
+
|
|
3877
|
+
// src/hooks/statsig/useDynamicConfig.ts
|
|
3878
|
+
var useDynamicConfig = (name) => {
|
|
3879
|
+
const config = useStatsigDynamicConfig(name);
|
|
3880
|
+
const fallback2 = useMemo11(() => default_configs_default[name], [name]);
|
|
3881
|
+
const value = useMemo11(
|
|
3882
|
+
() => config.get("value", fallback2.value),
|
|
3883
|
+
// confirmed that config is stable (https://cdn.jsdelivr.net/npm/@statsig/react-bindings@3.30.2/src/useDynamicConfig.js)
|
|
3884
|
+
// but .get might not be so we memoize it ourselves
|
|
3885
|
+
[config, fallback2]
|
|
3886
|
+
);
|
|
3887
|
+
return value;
|
|
3888
|
+
};
|
|
3889
|
+
|
|
3890
|
+
// src/hooks/useUDAParams.ts
|
|
3891
|
+
var useUDAParams = (_dynamicRoutingId) => {
|
|
3892
|
+
const { checkoutItem } = useCheckoutContext();
|
|
3893
|
+
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
3894
|
+
const dynamicRoutingId = _dynamicRoutingId || checkoutConfig?.dynamicRoutingId;
|
|
3895
|
+
const udaParams = useDynamicConfig("uda_params");
|
|
3896
|
+
const currentParams = useMemo12(() => {
|
|
3897
|
+
return udaParams.find(
|
|
3898
|
+
(param) => param.dynamicRoutingId === dynamicRoutingId
|
|
3899
|
+
)?.params;
|
|
3900
|
+
}, [udaParams, dynamicRoutingId]);
|
|
3901
|
+
return currentParams;
|
|
3902
|
+
};
|
|
3903
|
+
|
|
3904
|
+
// src/hooks/useCheckoutTransferInit.ts
|
|
3664
3905
|
var COMMON_CLIENT_METADATA = generateClientMetadataForTokenTransfer();
|
|
3665
3906
|
async function checkoutTransferFetch(params) {
|
|
3666
3907
|
return await initializeCheckoutTokenTransferAddress({
|
|
@@ -3673,7 +3914,8 @@ function getCheckoutTokenTransferParams({
|
|
|
3673
3914
|
checkoutConfig,
|
|
3674
3915
|
userId,
|
|
3675
3916
|
recipientAddr,
|
|
3676
|
-
apiKey
|
|
3917
|
+
apiKey,
|
|
3918
|
+
udaParams
|
|
3677
3919
|
}) {
|
|
3678
3920
|
if (!checkoutConfig) {
|
|
3679
3921
|
return;
|
|
@@ -3687,6 +3929,14 @@ function getCheckoutTokenTransferParams({
|
|
|
3687
3929
|
recipientAddr,
|
|
3688
3930
|
actionType: checkoutConfig.qrcodeActionType
|
|
3689
3931
|
};
|
|
3932
|
+
if (udaParams) {
|
|
3933
|
+
return {
|
|
3934
|
+
...commonParams,
|
|
3935
|
+
toChainId: udaParams.targetChain,
|
|
3936
|
+
toTokenAddress: udaParams.targetAsset,
|
|
3937
|
+
actionType: udaParams.qrcodeActionType
|
|
3938
|
+
};
|
|
3939
|
+
}
|
|
3690
3940
|
const dynamicTargetAssetCandidates = checkoutConfig.dynamicTargetAssetCandidates;
|
|
3691
3941
|
if (dynamicTargetAssetCandidates?.[0]) {
|
|
3692
3942
|
const defaultCandidate = dynamicTargetAssetCandidates.find((candidate) => candidate.isDefault) || dynamicTargetAssetCandidates[0];
|
|
@@ -3713,10 +3963,19 @@ function getCheckoutTokenTransferParams({
|
|
|
3713
3963
|
}
|
|
3714
3964
|
function useIsQRCodeTransferEnabled() {
|
|
3715
3965
|
const { checkoutItem } = useCheckoutContext();
|
|
3716
|
-
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
3717
3966
|
const isQrCodeEnabled = useFlag(FlagKey4.EnableTokenTransfer, false);
|
|
3718
|
-
const
|
|
3719
|
-
|
|
3967
|
+
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
3968
|
+
const isDynamicRoutingEnabled = useIsDynamicRoutingEnabled({
|
|
3969
|
+
checkoutConfig
|
|
3970
|
+
});
|
|
3971
|
+
const udaParams = useUDAParams();
|
|
3972
|
+
if (!isQrCodeEnabled) {
|
|
3973
|
+
return false;
|
|
3974
|
+
}
|
|
3975
|
+
if (isDynamicRoutingEnabled) {
|
|
3976
|
+
return !!udaParams;
|
|
3977
|
+
}
|
|
3978
|
+
return true;
|
|
3720
3979
|
}
|
|
3721
3980
|
var useCheckoutTransferInit = (enabled = true) => {
|
|
3722
3981
|
const { checkoutItem } = useCheckoutContext();
|
|
@@ -3724,19 +3983,31 @@ var useCheckoutTransferInit = (enabled = true) => {
|
|
|
3724
3983
|
const isQrCodeEnabled = useIsQRCodeTransferEnabled();
|
|
3725
3984
|
const { walletAddress, userInfo } = useGeneralWallet();
|
|
3726
3985
|
const { apiKey } = useFunkitConfig();
|
|
3727
|
-
const
|
|
3986
|
+
const udaParams = useUDAParams();
|
|
3987
|
+
const isLighter = isLighterxyzCustomer(apiKey);
|
|
3988
|
+
const { mainAccountIndex } = useLighterAccounts({
|
|
3989
|
+
address: walletAddress || "0x",
|
|
3990
|
+
isEnabled: isLighter && !!walletAddress && walletAddress !== "0x"
|
|
3991
|
+
});
|
|
3992
|
+
const recipientAddr = (() => {
|
|
3993
|
+
if (udaParams && udaParams.targetChain === lighterChain.id.toString() && !!mainAccountIndex) {
|
|
3994
|
+
return mainAccountIndex;
|
|
3995
|
+
}
|
|
3996
|
+
return checkoutConfig?.customRecipient || walletAddress || "0x";
|
|
3997
|
+
})();
|
|
3728
3998
|
const userId = userInfo.id || "";
|
|
3729
3999
|
const queryKey = getCheckoutTokenTransferParams({
|
|
3730
4000
|
checkoutConfig,
|
|
3731
4001
|
userId,
|
|
3732
4002
|
apiKey,
|
|
3733
|
-
recipientAddr
|
|
4003
|
+
recipientAddr,
|
|
4004
|
+
udaParams
|
|
3734
4005
|
});
|
|
3735
4006
|
const postActionOverride = isHyenaCustomer(apiKey);
|
|
3736
4007
|
const isQRCodeEnabledWithPostAction = !!checkoutConfig && // either no post action required
|
|
3737
4008
|
(!isCheckoutPostActionRequired(checkoutConfig) || // or action type is set
|
|
3738
|
-
!!checkoutConfig?.qrcodeActionType || postActionOverride);
|
|
3739
|
-
const { data, isFetching } =
|
|
4009
|
+
!!checkoutConfig?.qrcodeActionType || postActionOverride || !!queryKey?.actionType);
|
|
4010
|
+
const { data, isFetching } = useQuery4({
|
|
3740
4011
|
queryKey: ["initializeCheckoutTokenTransferAddress", queryKey],
|
|
3741
4012
|
queryFn: ({ queryKey: [_, queryKey2] }) => queryKey2 ? checkoutTransferFetch(queryKey2) : void 0,
|
|
3742
4013
|
refetchOnWindowFocus: false,
|
|
@@ -3752,9 +4023,9 @@ var useCheckoutTransferInit = (enabled = true) => {
|
|
|
3752
4023
|
};
|
|
3753
4024
|
|
|
3754
4025
|
// src/hooks/useEffectEvent.ts
|
|
3755
|
-
import { useCallback as useCallback8, useInsertionEffect, useRef } from "react";
|
|
4026
|
+
import { useCallback as useCallback8, useInsertionEffect, useRef as useRef2 } from "react";
|
|
3756
4027
|
function useEffectEvent(fn) {
|
|
3757
|
-
const savedCallback =
|
|
4028
|
+
const savedCallback = useRef2(fn);
|
|
3758
4029
|
useInsertionEffect(() => {
|
|
3759
4030
|
savedCallback.current = fn;
|
|
3760
4031
|
}, [fn]);
|
|
@@ -3800,11 +4071,11 @@ import React19, {
|
|
|
3800
4071
|
useCallback as useCallback9,
|
|
3801
4072
|
useContext as useContext8,
|
|
3802
4073
|
useEffect as useEffect8,
|
|
3803
|
-
useRef as
|
|
4074
|
+
useRef as useRef3,
|
|
3804
4075
|
useState as useState8
|
|
3805
4076
|
} from "react";
|
|
3806
4077
|
import { isHex } from "viem";
|
|
3807
|
-
import { useQuery as
|
|
4078
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
3808
4079
|
|
|
3809
4080
|
// src/utils/purifyCheckoutHistoryItem.ts
|
|
3810
4081
|
import {
|
|
@@ -3823,7 +4094,7 @@ import {
|
|
|
3823
4094
|
getDirectExecutionByTxHash
|
|
3824
4095
|
} from "@funkit/api-base";
|
|
3825
4096
|
import { RELAY_TERMINAL_STATUSES } from "@funkit/fun-relay";
|
|
3826
|
-
import { useQuery as
|
|
4097
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
3827
4098
|
var RELAY_FETCH_INTERVAL = 1500;
|
|
3828
4099
|
var logPrefix = "useDirectExecutionInfoPolling";
|
|
3829
4100
|
function useDirectExecutionInfoPolling({
|
|
@@ -3831,7 +4102,7 @@ function useDirectExecutionInfoPolling({
|
|
|
3831
4102
|
disabled = false
|
|
3832
4103
|
}) {
|
|
3833
4104
|
const { apiKey } = useFunkitConfig();
|
|
3834
|
-
const { data: directExecution, isLoading } =
|
|
4105
|
+
const { data: directExecution, isLoading } = useQuery5({
|
|
3835
4106
|
queryKey: [logPrefix, initDirectExecution?.txHash],
|
|
3836
4107
|
queryFn: async () => {
|
|
3837
4108
|
try {
|
|
@@ -3987,7 +4258,7 @@ function FunkitCheckoutHistoryProvider({
|
|
|
3987
4258
|
const { logoutSymbol, isUserLoggedIn, userInfo } = useGeneralWallet();
|
|
3988
4259
|
const funkitConfig = useFunkitConfig();
|
|
3989
4260
|
const [checkoutHistoryList, setCheckoutHistoryList] = useState8([]);
|
|
3990
|
-
const intervalRef =
|
|
4261
|
+
const intervalRef = useRef3();
|
|
3991
4262
|
const [refreshSymbol, triggerRefreshSymbol] = useSymbolRefresh_default();
|
|
3992
4263
|
const [historyDepositAddress, setHistoryDepositAddress] = useState8();
|
|
3993
4264
|
const [isInited, setIsInited] = useState8(false);
|
|
@@ -4113,7 +4384,7 @@ function useCheckoutHistoryContext() {
|
|
|
4113
4384
|
}
|
|
4114
4385
|
function useCheckoutsListenerByUserId(userId) {
|
|
4115
4386
|
const { apiKey } = useFunkitConfig();
|
|
4116
|
-
const { data, isLoading } =
|
|
4387
|
+
const { data, isLoading } = useQuery6({
|
|
4117
4388
|
enabled: !!userId,
|
|
4118
4389
|
queryKey: ["getPurifiedCheckoutsByUserId", userId],
|
|
4119
4390
|
queryFn: async () => {
|
|
@@ -4142,7 +4413,7 @@ function useCheckoutsListenerByUserId(userId) {
|
|
|
4142
4413
|
}
|
|
4143
4414
|
function useCheckoutListenerByCheckoutId(checkoutId) {
|
|
4144
4415
|
const { apiKey } = useFunkitConfig();
|
|
4145
|
-
const { data, isLoading } =
|
|
4416
|
+
const { data, isLoading } = useQuery6({
|
|
4146
4417
|
enabled: !!checkoutId,
|
|
4147
4418
|
queryKey: ["getPurifiedCheckoutById", checkoutId],
|
|
4148
4419
|
queryFn: async () => {
|
|
@@ -4240,7 +4511,7 @@ import React233, {
|
|
|
4240
4511
|
useCallback as useCallback48,
|
|
4241
4512
|
useContext as useContext16,
|
|
4242
4513
|
useEffect as useEffect54,
|
|
4243
|
-
useMemo as
|
|
4514
|
+
useMemo as useMemo49,
|
|
4244
4515
|
useState as useState73
|
|
4245
4516
|
} from "react";
|
|
4246
4517
|
import { useAccount as useAccount10, useAccountEffect as useAccountEffect2, useConfig as useConfig5 } from "wagmi";
|
|
@@ -4263,7 +4534,7 @@ import React107, { useCallback as useCallback23, useState as useState34 } from "
|
|
|
4263
4534
|
|
|
4264
4535
|
// src/components/FunCheckoutHistory/useCustomStatusAnimationAboveTopbar.tsx
|
|
4265
4536
|
import { clamp } from "@funkit/utils";
|
|
4266
|
-
import React29, { useRef as
|
|
4537
|
+
import React29, { useRef as useRef5, useState as useState13 } from "react";
|
|
4267
4538
|
|
|
4268
4539
|
// src/domains/checkout.ts
|
|
4269
4540
|
import {
|
|
@@ -4319,8 +4590,16 @@ function getCheckoutStateBooleans(checkoutState, refundState) {
|
|
|
4319
4590
|
};
|
|
4320
4591
|
}
|
|
4321
4592
|
|
|
4593
|
+
// src/utils/lighter.ts
|
|
4594
|
+
import { getAddress } from "viem";
|
|
4595
|
+
var LIGHTER_DEPOSIT_ADDRESS = getAddress(
|
|
4596
|
+
"0x3b4d794a66304f130a4db8f2551b0070dfcf5ca7"
|
|
4597
|
+
);
|
|
4598
|
+
var LIGHTER_NATIVE_FLOW_TIME_ESTIMATE_SECONDS = 60 * 2;
|
|
4599
|
+
var LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF = 60 * 5;
|
|
4600
|
+
|
|
4322
4601
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.tsx
|
|
4323
|
-
import React27, { useEffect as useEffect11, useMemo as
|
|
4602
|
+
import React27, { useEffect as useEffect11, useMemo as useMemo14, useState as useState11 } from "react";
|
|
4324
4603
|
|
|
4325
4604
|
// src/components/TransactionStatus/TransactionStatus.tsx
|
|
4326
4605
|
import {
|
|
@@ -4331,8 +4610,8 @@ import {
|
|
|
4331
4610
|
import React26, {
|
|
4332
4611
|
useCallback as useCallback10,
|
|
4333
4612
|
useEffect as useEffect10,
|
|
4334
|
-
useMemo as
|
|
4335
|
-
useRef as
|
|
4613
|
+
useMemo as useMemo13,
|
|
4614
|
+
useRef as useRef4,
|
|
4336
4615
|
useState as useState10
|
|
4337
4616
|
} from "react";
|
|
4338
4617
|
import { Trans } from "react-i18next";
|
|
@@ -5073,7 +5352,7 @@ function TransactionStatusLoading({
|
|
|
5073
5352
|
)));
|
|
5074
5353
|
}
|
|
5075
5354
|
function TransactionStatus({
|
|
5076
|
-
|
|
5355
|
+
isSlowTransaction,
|
|
5077
5356
|
isWithdrawal,
|
|
5078
5357
|
status,
|
|
5079
5358
|
step,
|
|
@@ -5081,10 +5360,10 @@ function TransactionStatus({
|
|
|
5081
5360
|
textConfigSteps
|
|
5082
5361
|
}) {
|
|
5083
5362
|
const { t } = useFunkitTranslation();
|
|
5084
|
-
const finalTextConfigStatus =
|
|
5363
|
+
const finalTextConfigStatus = useMemo13(() => {
|
|
5085
5364
|
return textConfigStatus || getDefaultTextConfigStatus(t);
|
|
5086
5365
|
}, [t, textConfigStatus]);
|
|
5087
|
-
const finalTextConfigSteps =
|
|
5366
|
+
const finalTextConfigSteps = useMemo13(() => {
|
|
5088
5367
|
return textConfigSteps || getDefaultTextConfigSteps(t);
|
|
5089
5368
|
}, [t, textConfigSteps]);
|
|
5090
5369
|
const [initialStatus] = useState10(status);
|
|
@@ -5095,7 +5374,7 @@ function TransactionStatus({
|
|
|
5095
5374
|
const [isDelayed2, setDelayed] = useState10(status === "delayed");
|
|
5096
5375
|
const [transitioningToStatus, setTransitioningToStatus] = useState10(status);
|
|
5097
5376
|
const [transitioningToStep, setTransitioningToStep] = useState10(step);
|
|
5098
|
-
const spinAnimationRef =
|
|
5377
|
+
const spinAnimationRef = useRef4();
|
|
5099
5378
|
const stopSpinning = useCallback10(() => {
|
|
5100
5379
|
spinAnimationRef.current?.cancel();
|
|
5101
5380
|
spinAnimationRef.current = void 0;
|
|
@@ -5375,18 +5654,18 @@ function TransactionStatus({
|
|
|
5375
5654
|
transitioningToStep
|
|
5376
5655
|
]);
|
|
5377
5656
|
const textConfig = currentStatus === "progress" ? isDelayed2 ? finalTextConfigStatus.progress_delayed : finalTextConfigSteps[currentStep] : finalTextConfigStatus[currentStatus];
|
|
5378
|
-
const { description, descriptionKey, title } =
|
|
5379
|
-
const translatedDurationUnits =
|
|
5657
|
+
const { description, descriptionKey, title } = useMemo13(() => {
|
|
5658
|
+
const translatedDurationUnits = isSlowTransaction ? t("transaction.minutes") : t("transaction.seconds");
|
|
5380
5659
|
const config = typeof textConfig === "function" ? textConfig({
|
|
5381
5660
|
durationUnits: translatedDurationUnits,
|
|
5382
5661
|
isWithdrawal,
|
|
5383
|
-
finalizeVerb:
|
|
5662
|
+
finalizeVerb: isSlowTransaction ? t("transaction.credit") : t("transaction.finalize")
|
|
5384
5663
|
}) : textConfig;
|
|
5385
5664
|
return {
|
|
5386
5665
|
...config,
|
|
5387
5666
|
descriptionKey: config.descriptionKey ?? config.description
|
|
5388
5667
|
};
|
|
5389
|
-
}, [
|
|
5668
|
+
}, [isSlowTransaction, isWithdrawal, textConfig, t]);
|
|
5390
5669
|
return /* @__PURE__ */ React26.createElement(
|
|
5391
5670
|
Box,
|
|
5392
5671
|
{
|
|
@@ -5524,7 +5803,7 @@ function FunCheckoutStatusLoaded({
|
|
|
5524
5803
|
checkoutHistoryItem.state,
|
|
5525
5804
|
checkoutHistoryItem.refundState
|
|
5526
5805
|
);
|
|
5527
|
-
const startTimeMs =
|
|
5806
|
+
const startTimeMs = useMemo14(
|
|
5528
5807
|
() => extractStartTimeMs(
|
|
5529
5808
|
checkoutHistoryItem.clientMetadata.id,
|
|
5530
5809
|
activeCheckoutItem,
|
|
@@ -5551,7 +5830,7 @@ function FunCheckoutStatusLoaded({
|
|
|
5551
5830
|
return /* @__PURE__ */ React27.createElement(
|
|
5552
5831
|
TransactionStatus,
|
|
5553
5832
|
{
|
|
5554
|
-
|
|
5833
|
+
isSlowTransaction: false,
|
|
5555
5834
|
isWithdrawal: false,
|
|
5556
5835
|
key: checkoutHistoryItem.clientMetadata.id,
|
|
5557
5836
|
onOrderDelayed,
|
|
@@ -5593,10 +5872,22 @@ function formatSecondsTranslated(seconds, t, specifyUnderMinute = false, omitSec
|
|
|
5593
5872
|
var LAYERZEO_OFT_TIME_ESTIMATE_SECONDS = 180;
|
|
5594
5873
|
function useCheckoutTimeEstimate(latestQuote, originalTimeEstimationMs, paymentMethod, bypassFlag) {
|
|
5595
5874
|
const { t } = useFunkitTranslation();
|
|
5875
|
+
const { apiKey } = useFunkitConfig();
|
|
5876
|
+
const { checkoutItem } = useCheckoutContext();
|
|
5877
|
+
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
5878
|
+
const lighterNativeFlow = isLighterNativeFlow(apiKey, checkoutConfig);
|
|
5596
5879
|
const timeEstimatesJsonString = useFlag(FlagKey5.CheckoutTimeEstimateOverrides);
|
|
5597
5880
|
const timeEstimates = safeJSONParse(
|
|
5598
5881
|
timeEstimatesJsonString
|
|
5599
5882
|
);
|
|
5883
|
+
if (lighterNativeFlow) {
|
|
5884
|
+
const estimatedTime2 = LIGHTER_NATIVE_FLOW_TIME_ESTIMATE_SECONDS;
|
|
5885
|
+
const estimatedTimeText2 = formatSecondsTranslated(estimatedTime2, t, true);
|
|
5886
|
+
return {
|
|
5887
|
+
estimatedTime: estimatedTime2,
|
|
5888
|
+
estimatedTimeText: estimatedTimeText2
|
|
5889
|
+
};
|
|
5890
|
+
}
|
|
5600
5891
|
if (latestQuote?.baseQuote.metadata?.oftEnabled) {
|
|
5601
5892
|
return {
|
|
5602
5893
|
estimatedTime: LAYERZEO_OFT_TIME_ESTIMATE_SECONDS,
|
|
@@ -5652,6 +5943,9 @@ function FunDirectExecutionStatusLoaded({
|
|
|
5652
5943
|
disabled: disableAutoUpdate
|
|
5653
5944
|
});
|
|
5654
5945
|
const { getCheckoutProgress } = useCheckoutContext();
|
|
5946
|
+
const { apiKey } = useFunkitConfig();
|
|
5947
|
+
const { checkoutItem } = useCheckoutContext();
|
|
5948
|
+
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
5655
5949
|
const progress = getCheckoutProgress(directExecution.clientMetadata.id);
|
|
5656
5950
|
const startTimeMs = directExecution.createdTimeMs;
|
|
5657
5951
|
const [currentTimeMs, setCurrentTimeMs] = useState12(Date.now());
|
|
@@ -5664,11 +5958,12 @@ function FunDirectExecutionStatusLoaded({
|
|
|
5664
5958
|
if (isRefunded) {
|
|
5665
5959
|
return null;
|
|
5666
5960
|
}
|
|
5961
|
+
const isSlowTransaction = !!isLayerZero || isLighterNativeFlow(apiKey, checkoutConfig);
|
|
5667
5962
|
const { clientMetadata } = directExecution;
|
|
5668
5963
|
return /* @__PURE__ */ React28.createElement(
|
|
5669
5964
|
TransactionStatus,
|
|
5670
5965
|
{
|
|
5671
|
-
|
|
5966
|
+
isSlowTransaction,
|
|
5672
5967
|
isWithdrawal: !!clientMetadata.isWithdrawal,
|
|
5673
5968
|
key: clientMetadata.id,
|
|
5674
5969
|
startTimeMs,
|
|
@@ -5691,10 +5986,11 @@ function useCustomStatusAnimationAboveTopbar({
|
|
|
5691
5986
|
paddingTop,
|
|
5692
5987
|
topbar,
|
|
5693
5988
|
withTopDivider,
|
|
5694
|
-
scrollableContent
|
|
5989
|
+
scrollableContent,
|
|
5990
|
+
isLighterNativeDeposit
|
|
5695
5991
|
}) {
|
|
5696
5992
|
const [scrollPos, setScrollPos] = useState13(0);
|
|
5697
|
-
const lastY =
|
|
5993
|
+
const lastY = useRef5(0);
|
|
5698
5994
|
const { checkoutHistoryInfo, directExecutionInfo } = useFunkitPostCheckoutInternal(
|
|
5699
5995
|
isCheckoutDetailView && depositAddress ? depositAddress : "0x"
|
|
5700
5996
|
);
|
|
@@ -5751,7 +6047,8 @@ function useCustomStatusAnimationAboveTopbar({
|
|
|
5751
6047
|
FunDirectExecutionStatus,
|
|
5752
6048
|
{
|
|
5753
6049
|
directExecution: directExecutionInfo,
|
|
5754
|
-
isActiveCheckout
|
|
6050
|
+
isActiveCheckout,
|
|
6051
|
+
dangerousCustomDelayedAutoTriggerCutoff: isLighterNativeDeposit ? LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF : void 0
|
|
5755
6052
|
}
|
|
5756
6053
|
) : /* @__PURE__ */ React29.createElement(
|
|
5757
6054
|
FunCheckoutStatus,
|
|
@@ -5915,16 +6212,16 @@ import React45, {
|
|
|
5915
6212
|
useCallback as useCallback12,
|
|
5916
6213
|
useContext as useContext10,
|
|
5917
6214
|
useEffect as useEffect17,
|
|
5918
|
-
useRef as
|
|
6215
|
+
useRef as useRef8
|
|
5919
6216
|
} from "react";
|
|
5920
6217
|
import { createPortal } from "react-dom";
|
|
5921
6218
|
import { RemoveScroll } from "react-remove-scroll";
|
|
5922
6219
|
import { AnimatePresence as AnimatePresence2, motion as motion3 } from "motion/react";
|
|
5923
6220
|
|
|
5924
6221
|
// src/hooks/useScrollDivider.ts
|
|
5925
|
-
import { useEffect as useEffect13, useRef as
|
|
6222
|
+
import { useEffect as useEffect13, useRef as useRef6, useState as useState14 } from "react";
|
|
5926
6223
|
var useScrollDivider = () => {
|
|
5927
|
-
const ref =
|
|
6224
|
+
const ref = useRef6(null);
|
|
5928
6225
|
const [isTop, setIsTop] = useState14(true);
|
|
5929
6226
|
const [isScrollable, setIsScrollable] = useState14(false);
|
|
5930
6227
|
const [isScrolling, setIsScrolling] = useState14(false);
|
|
@@ -6246,72 +6543,6 @@ var ErrorBoundary_default = ErrorBoundary;
|
|
|
6246
6543
|
import { isMobile as isMobile2 } from "@funkit/utils";
|
|
6247
6544
|
import React40 from "react";
|
|
6248
6545
|
|
|
6249
|
-
// src/hooks/statsig/useDynamicConfig.ts
|
|
6250
|
-
import { useDynamicConfig as useStatsigDynamicConfig } from "@statsig/react-bindings";
|
|
6251
|
-
|
|
6252
|
-
// src/__generated__/default_configs.ts
|
|
6253
|
-
var default_configs_default = {
|
|
6254
|
-
addressblacklist: {
|
|
6255
|
-
value: [
|
|
6256
|
-
"0x7b97b46D35a28B561d47F50CFB9a2735E506e59d",
|
|
6257
|
-
"0x409ad08cc6CA757f69Fb80250a424B9eFeB99807",
|
|
6258
|
-
"0x02A86f51aA7B8b1c17c30364748d5Ae4a0727E23",
|
|
6259
|
-
"0x64131b60502C01362639CC5cfE1a1efB6Be1165A",
|
|
6260
|
-
"0xb84440Ee8BAD69c14755bBb7093f861c3512E3D1"
|
|
6261
|
-
]
|
|
6262
|
-
},
|
|
6263
|
-
array_of_strings: {
|
|
6264
|
-
value: []
|
|
6265
|
-
},
|
|
6266
|
-
blockedcountries: {
|
|
6267
|
-
value: [
|
|
6268
|
-
"AF",
|
|
6269
|
-
"BY",
|
|
6270
|
-
"MM",
|
|
6271
|
-
"CF",
|
|
6272
|
-
"CU",
|
|
6273
|
-
"CD",
|
|
6274
|
-
"IR",
|
|
6275
|
-
"LB",
|
|
6276
|
-
"LY",
|
|
6277
|
-
"NI",
|
|
6278
|
-
"KP",
|
|
6279
|
-
"UA",
|
|
6280
|
-
"SO",
|
|
6281
|
-
"SS",
|
|
6282
|
-
"SY",
|
|
6283
|
-
"VE"
|
|
6284
|
-
]
|
|
6285
|
-
},
|
|
6286
|
-
boolean: {
|
|
6287
|
-
value: false
|
|
6288
|
-
},
|
|
6289
|
-
brokerage_hide_you_receive: {
|
|
6290
|
-
value: false
|
|
6291
|
-
},
|
|
6292
|
-
showinfobanner: {
|
|
6293
|
-
value: {
|
|
6294
|
-
message: "",
|
|
6295
|
-
expireAtMs: 1,
|
|
6296
|
-
type: "announcement"
|
|
6297
|
-
}
|
|
6298
|
-
},
|
|
6299
|
-
showpoweredtagline: {
|
|
6300
|
-
value: false
|
|
6301
|
-
},
|
|
6302
|
-
supportedexchangesv2: {
|
|
6303
|
-
value: []
|
|
6304
|
-
}
|
|
6305
|
-
};
|
|
6306
|
-
|
|
6307
|
-
// src/hooks/statsig/useDynamicConfig.ts
|
|
6308
|
-
var useDynamicConfig = (name) => {
|
|
6309
|
-
const config = useStatsigDynamicConfig(name);
|
|
6310
|
-
const fallback2 = default_configs_default[name];
|
|
6311
|
-
const value = config.get("value", fallback2.value);
|
|
6312
|
-
return value;
|
|
6313
|
-
};
|
|
6314
|
-
|
|
6315
6546
|
// src/components/FunButton/FunButton.tsx
|
|
6316
6547
|
import clsx6 from "clsx";
|
|
6317
6548
|
import React37 from "react";
|
|
@@ -6797,7 +7028,7 @@ function FunDivider({
|
|
|
6797
7028
|
}
|
|
6798
7029
|
|
|
6799
7030
|
// src/components/Dialog/FocusTrap.tsx
|
|
6800
|
-
import React44, { useCallback as useCallback11, useEffect as useEffect14, useRef as
|
|
7031
|
+
import React44, { useCallback as useCallback11, useEffect as useEffect14, useRef as useRef7 } from "react";
|
|
6801
7032
|
var moveFocusWithin = (element2, position) => {
|
|
6802
7033
|
const focusableElements = element2.querySelectorAll(
|
|
6803
7034
|
"button:not(:disabled), a[href]"
|
|
@@ -6808,7 +7039,7 @@ var moveFocusWithin = (element2, position) => {
|
|
|
6808
7039
|
focusableElements[position === "end" ? focusableElements.length - 1 : 0].focus();
|
|
6809
7040
|
};
|
|
6810
7041
|
function FocusTrap(props) {
|
|
6811
|
-
const contentRef =
|
|
7042
|
+
const contentRef = useRef7(null);
|
|
6812
7043
|
useEffect14(() => {
|
|
6813
7044
|
const previouslyActiveElement = document.activeElement;
|
|
6814
7045
|
return () => {
|
|
@@ -7042,7 +7273,7 @@ function Dialog({
|
|
|
7042
7273
|
return null;
|
|
7043
7274
|
}
|
|
7044
7275
|
return createPortal(
|
|
7045
|
-
/* @__PURE__ */ React45.createElement(AnimatePresence2, null, open && /* @__PURE__ */ React45.createElement(RemoveScroll, { enabled:
|
|
7276
|
+
/* @__PURE__ */ React45.createElement(AnimatePresence2, null, open && /* @__PURE__ */ React45.createElement(RemoveScroll, { enabled: !isHidden, allowPinchZoom: true }, /* @__PURE__ */ React45.createElement(
|
|
7046
7277
|
Box,
|
|
7047
7278
|
{
|
|
7048
7279
|
...themeRootProps,
|
|
@@ -7184,7 +7415,7 @@ var DialogBottom = ({
|
|
|
7184
7415
|
...boxProps
|
|
7185
7416
|
}) => {
|
|
7186
7417
|
const { activeTheme } = useActiveTheme();
|
|
7187
|
-
const ref =
|
|
7418
|
+
const ref = useRef8(null);
|
|
7188
7419
|
const extraBottomPadding = getValueFromPxString(activeTheme.spacing.modalBaseHorizontalPadding) * 2 - getValueFromPxString(activeTheme.spacing.modalPaddingBottomLower);
|
|
7189
7420
|
const hasNoChildren = useBottomBarHasNoChildren();
|
|
7190
7421
|
const paddingBottom = (() => {
|
|
@@ -7350,7 +7581,7 @@ import {
|
|
|
7350
7581
|
formatCryptoAndStringify as formatCryptoAndStringify2,
|
|
7351
7582
|
formatCurrencyAndStringify as formatCurrencyAndStringify3
|
|
7352
7583
|
} from "@funkit/utils";
|
|
7353
|
-
import React72, { useEffect as useEffect28, useMemo as
|
|
7584
|
+
import React72, { useEffect as useEffect28, useMemo as useMemo21, useRef as useRef15, useState as useState27 } from "react";
|
|
7354
7585
|
import { createPortal as createPortal2 } from "react-dom";
|
|
7355
7586
|
import { useDebounce } from "use-debounce";
|
|
7356
7587
|
import { useAccount as useAccount4 } from "wagmi";
|
|
@@ -7366,7 +7597,7 @@ import React59 from "react";
|
|
|
7366
7597
|
import React47, {
|
|
7367
7598
|
useCallback as useCallback13,
|
|
7368
7599
|
useEffect as useEffect18,
|
|
7369
|
-
useRef as
|
|
7600
|
+
useRef as useRef9,
|
|
7370
7601
|
useState as useState16
|
|
7371
7602
|
} from "react";
|
|
7372
7603
|
import clsx8 from "clsx";
|
|
@@ -7452,9 +7683,9 @@ var FunTooltip = ({
|
|
|
7452
7683
|
const [isDisplayed, setIsDisplayed] = useState16(false);
|
|
7453
7684
|
const [isSafeToRenderInCenter, setIsSafeToRenderInCenter] = useState16(false);
|
|
7454
7685
|
const [isSafeToRenderInRight, setIsSafeToRenderInRight] = useState16(false);
|
|
7455
|
-
const startDelayRef =
|
|
7456
|
-
const delayRef =
|
|
7457
|
-
const tooltipRef =
|
|
7686
|
+
const startDelayRef = useRef9();
|
|
7687
|
+
const delayRef = useRef9();
|
|
7688
|
+
const tooltipRef = useRef9(null);
|
|
7458
7689
|
const show = useCallback13(
|
|
7459
7690
|
(startHiding) => {
|
|
7460
7691
|
startDelayRef.current = setTimeout(() => {
|
|
@@ -7546,7 +7777,7 @@ var FunTooltip = ({
|
|
|
7546
7777
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
7547
7778
|
import { isMobile as isMobile4, noop as noop2 } from "@funkit/utils";
|
|
7548
7779
|
import { AnimatePresence as AnimatePresence4, motion as motion5 } from "motion/react";
|
|
7549
|
-
import React56, { useCallback as useCallback14, useEffect as useEffect21, useMemo as
|
|
7780
|
+
import React56, { useCallback as useCallback14, useEffect as useEffect21, useMemo as useMemo15, useRef as useRef11, useState as useState18 } from "react";
|
|
7550
7781
|
|
|
7551
7782
|
// src/consts/layout.ts
|
|
7552
7783
|
var VERTICAL_SECTION_GAP = "18";
|
|
@@ -7973,12 +8204,12 @@ var FunNoResults = ({
|
|
|
7973
8204
|
|
|
7974
8205
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
7975
8206
|
import React53 from "react";
|
|
7976
|
-
import { useEffect as useEffect20, useRef as
|
|
8207
|
+
import { useEffect as useEffect20, useRef as useRef10 } from "react";
|
|
7977
8208
|
function FunClickOutside({
|
|
7978
8209
|
children,
|
|
7979
8210
|
onClick
|
|
7980
8211
|
}) {
|
|
7981
|
-
const wrapperRef =
|
|
8212
|
+
const wrapperRef = useRef10(null);
|
|
7982
8213
|
useEffect20(() => {
|
|
7983
8214
|
const handleClickListener = (event) => {
|
|
7984
8215
|
const clickedInside = wrapperRef.current?.contains(
|
|
@@ -8176,11 +8407,11 @@ function BaseDropdown({
|
|
|
8176
8407
|
const [isOpened, setIsOpened] = useState18();
|
|
8177
8408
|
const [searchInput, setSearchInput] = useState18("");
|
|
8178
8409
|
const selectedOption = options.find((option) => option.value === value);
|
|
8179
|
-
const prevIsOpenedRef =
|
|
8410
|
+
const prevIsOpenedRef = useRef11(false);
|
|
8180
8411
|
const handleSearch = (event) => {
|
|
8181
8412
|
setSearchInput(event.target.value);
|
|
8182
8413
|
};
|
|
8183
|
-
const filteredOptions =
|
|
8414
|
+
const filteredOptions = useMemo15(
|
|
8184
8415
|
() => options.filter(
|
|
8185
8416
|
(singleOption) => singleOption.label.toLowerCase().includes(searchInput?.toLowerCase())
|
|
8186
8417
|
),
|
|
@@ -8564,6 +8795,9 @@ var ChainDropdown = ({
|
|
|
8564
8795
|
);
|
|
8565
8796
|
};
|
|
8566
8797
|
|
|
8798
|
+
// src/components/Dropdown/TokenAndChainDropdown.css.ts
|
|
8799
|
+
var hideOnXsmallScreenSize = "_6yd4t20";
|
|
8800
|
+
|
|
8567
8801
|
// src/components/Dropdown/TokenDropdown.tsx
|
|
8568
8802
|
import { FlagKey as FlagKey7 } from "@funkit/utils";
|
|
8569
8803
|
import React61, { useState as useState19 } from "react";
|
|
@@ -8629,7 +8863,7 @@ var getTokenIconUrl = (symbol, tokens) => {
|
|
|
8629
8863
|
|
|
8630
8864
|
// src/components/FunBadge/FunBadge.tsx
|
|
8631
8865
|
import clsx12 from "clsx";
|
|
8632
|
-
import React60, { useMemo as
|
|
8866
|
+
import React60, { useMemo as useMemo16 } from "react";
|
|
8633
8867
|
|
|
8634
8868
|
// src/components/FunBadge/FunBadge.css.ts
|
|
8635
8869
|
var badgeShineStyle = "bc2uzy2";
|
|
@@ -8653,7 +8887,7 @@ function FunBadge({
|
|
|
8653
8887
|
hasShine = false
|
|
8654
8888
|
}) {
|
|
8655
8889
|
const { t } = useFunkitTranslation();
|
|
8656
|
-
const borderStyle =
|
|
8890
|
+
const borderStyle = useMemo16(() => {
|
|
8657
8891
|
return borderColor ? { borderStyle: "solid", borderColor, borderWidth: "1" } : {};
|
|
8658
8892
|
}, [borderColor]);
|
|
8659
8893
|
return /* @__PURE__ */ React60.createElement(
|
|
@@ -8845,6 +9079,7 @@ var TokenAndChainDropdown = ({
|
|
|
8845
9079
|
hideNewTokenBadge
|
|
8846
9080
|
}) => {
|
|
8847
9081
|
const { t } = useFunkitTranslation();
|
|
9082
|
+
const { apiKey } = useFunkitConfig();
|
|
8848
9083
|
const finalTokenLabel = tokenLabel ?? t("transferToken.supportedToken");
|
|
8849
9084
|
const finalChainLabel = chainLabel ?? t("transferToken.supportedChain");
|
|
8850
9085
|
return /* @__PURE__ */ React62.createElement(
|
|
@@ -8879,7 +9114,18 @@ var TokenAndChainDropdown = ({
|
|
|
8879
9114
|
gap: "4"
|
|
8880
9115
|
},
|
|
8881
9116
|
/* @__PURE__ */ React62.createElement(Text, { size: "12", weight: "medium", testId: "chain-selector-label" }, finalChainLabel),
|
|
8882
|
-
|
|
9117
|
+
/* @__PURE__ */ React62.createElement(
|
|
9118
|
+
Box,
|
|
9119
|
+
{
|
|
9120
|
+
display: {
|
|
9121
|
+
// PM ui breaks at <768px
|
|
9122
|
+
smallScreen: isPolymarketCustomer(apiKey) ? "none" : "block",
|
|
9123
|
+
largeScreen: "block"
|
|
9124
|
+
},
|
|
9125
|
+
className: hideOnXsmallScreenSize
|
|
9126
|
+
},
|
|
9127
|
+
chainLabelAddon
|
|
9128
|
+
)
|
|
8883
9129
|
), /* @__PURE__ */ React62.createElement(
|
|
8884
9130
|
ChainDropdown,
|
|
8885
9131
|
{
|
|
@@ -9158,10 +9404,10 @@ import {
|
|
|
9158
9404
|
formatPercent,
|
|
9159
9405
|
noop as noop4
|
|
9160
9406
|
} from "@funkit/utils";
|
|
9161
|
-
import React67, { useEffect as useEffect22, useMemo as
|
|
9407
|
+
import React67, { useEffect as useEffect22, useMemo as useMemo17, useState as useState20 } from "react";
|
|
9162
9408
|
import clsx14 from "clsx";
|
|
9163
9409
|
import { motion as motion6, useAnimationControls } from "motion/react";
|
|
9164
|
-
import { mainnet as
|
|
9410
|
+
import { mainnet as mainnet6 } from "viem/chains";
|
|
9165
9411
|
|
|
9166
9412
|
// src/domains/relay.ts
|
|
9167
9413
|
var KATANA_BRIDGE_ALERT_THRESHOLD_PERCENT = 0.5;
|
|
@@ -9358,7 +9604,7 @@ function computeDigest(relayQuoteMetadata, uiCustomizations, totalPriceImpactPer
|
|
|
9358
9604
|
value: void 0
|
|
9359
9605
|
};
|
|
9360
9606
|
}
|
|
9361
|
-
const isMainnet = details?.currencyIn?.currency?.chainId ===
|
|
9607
|
+
const isMainnet = details?.currencyIn?.currency?.chainId === mainnet6.id || details?.currencyOut?.currency?.chainId === mainnet6.id;
|
|
9362
9608
|
const percent = formatPercent(totalPriceImpactPercent);
|
|
9363
9609
|
return {
|
|
9364
9610
|
isMainnet,
|
|
@@ -9644,7 +9890,7 @@ function PaymentFeesSummary({
|
|
|
9644
9890
|
setIsExpanded(false);
|
|
9645
9891
|
}
|
|
9646
9892
|
}, [valuesNotAvailable, isExpanded]);
|
|
9647
|
-
const { collapsed: collapsedItem, expanded: expandedItems } =
|
|
9893
|
+
const { collapsed: collapsedItem, expanded: expandedItems } = useMemo17(() => {
|
|
9648
9894
|
const fees = quote?.finalFeesBreakdown ?? fallbackFees;
|
|
9649
9895
|
if (!fees) {
|
|
9650
9896
|
return NO_DATA;
|
|
@@ -9808,7 +10054,7 @@ var EvmWallet = ({ size = 20 }) => /* @__PURE__ */ React68.createElement(
|
|
|
9808
10054
|
);
|
|
9809
10055
|
|
|
9810
10056
|
// src/hooks/queries/useWithdrawalQuote.ts
|
|
9811
|
-
import { useQuery as
|
|
10057
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
9812
10058
|
import { useConfig as useConfig2 } from "wagmi";
|
|
9813
10059
|
|
|
9814
10060
|
// src/domains/quote.ts
|
|
@@ -9962,11 +10208,9 @@ async function getCheckoutBaseQuote(checkoutItem, userId, walletAddress, apiKey,
|
|
|
9962
10208
|
const toTokenAddress = config.targetAsset;
|
|
9963
10209
|
const fromChainId = selectedSourceAssetInfo.chainId;
|
|
9964
10210
|
const fromTokenAddress = selectedSourceAssetInfo.address;
|
|
9965
|
-
const
|
|
9966
|
-
const [toTokenDecimals, fromTokenDecimals, lighterTickSize] = await Promise.all([
|
|
10211
|
+
const [toTokenDecimals, fromTokenDecimals] = await Promise.all([
|
|
9967
10212
|
getTokenDecimals(wagmiConfig, toChainId, toTokenAddress),
|
|
9968
|
-
getTokenDecimals(wagmiConfig, fromChainId, fromTokenAddress)
|
|
9969
|
-
isLighterSpot ? getLighterTickSize(wagmiConfig, toChainId, 1) : Promise.resolve(void 0)
|
|
10213
|
+
getTokenDecimals(wagmiConfig, fromChainId, fromTokenAddress)
|
|
9970
10214
|
]);
|
|
9971
10215
|
const toTokenAmount = config.targetAssetAmount ?? 0;
|
|
9972
10216
|
const fromTokenAmount = checkoutItem.sourceAssetAmount ?? 0;
|
|
@@ -9986,8 +10230,7 @@ async function getCheckoutBaseQuote(checkoutItem, userId, walletAddress, apiKey,
|
|
|
9986
10230
|
senderAddress,
|
|
9987
10231
|
fromTokenAmount,
|
|
9988
10232
|
fromTokenDecimals,
|
|
9989
|
-
isExactIn: isWithdrawal
|
|
9990
|
-
tickSize: lighterTickSize
|
|
10233
|
+
isExactIn: isWithdrawal
|
|
9991
10234
|
}) : await getApiCheckoutQuote({
|
|
9992
10235
|
userId,
|
|
9993
10236
|
fromChainId,
|
|
@@ -10238,7 +10481,6 @@ function isAddressCompatibleWithChain(address, chainId) {
|
|
|
10238
10481
|
var QUOTE_REFRESH_INTERVAL_MS = 25e3;
|
|
10239
10482
|
function useWithdrawalQuote({
|
|
10240
10483
|
recipientAddress,
|
|
10241
|
-
sourceAmount,
|
|
10242
10484
|
chainId,
|
|
10243
10485
|
symbol,
|
|
10244
10486
|
targetAsset,
|
|
@@ -10259,13 +10501,12 @@ function useWithdrawalQuote({
|
|
|
10259
10501
|
recipientAddress,
|
|
10260
10502
|
Number(chainId)
|
|
10261
10503
|
);
|
|
10262
|
-
const enabled = !!apiKey && !!targetAsset && !!
|
|
10504
|
+
const enabled = !!apiKey && !!targetAsset && !!checkoutItem?.sourceAssetAmount && !!recipientAddress && !!chainId && !!symbol && !!isValidAddress && !!checkoutItem;
|
|
10263
10505
|
const { logEvent } = useTrack();
|
|
10264
|
-
const query =
|
|
10506
|
+
const query = useQuery7({
|
|
10265
10507
|
queryKey: [
|
|
10266
10508
|
"withdrawal",
|
|
10267
10509
|
"quote",
|
|
10268
|
-
sourceAmount,
|
|
10269
10510
|
targetAsset,
|
|
10270
10511
|
recipientAddress,
|
|
10271
10512
|
chainId,
|
|
@@ -10274,7 +10515,7 @@ function useWithdrawalQuote({
|
|
|
10274
10515
|
withdrawalWalletAddress
|
|
10275
10516
|
],
|
|
10276
10517
|
queryFn: async () => {
|
|
10277
|
-
if (!apiKey || !targetAsset
|
|
10518
|
+
if (!apiKey || !targetAsset) {
|
|
10278
10519
|
return null;
|
|
10279
10520
|
}
|
|
10280
10521
|
const directExecutionInfo = getWithdrawalDirectExecution();
|
|
@@ -10295,7 +10536,7 @@ function useWithdrawalQuote({
|
|
|
10295
10536
|
recipientAddress,
|
|
10296
10537
|
chainId,
|
|
10297
10538
|
tokenSymbol: symbol,
|
|
10298
|
-
sourceAmountUSD:
|
|
10539
|
+
sourceAmountUSD: checkoutItem?.sourceAssetAmount,
|
|
10299
10540
|
targetAsset,
|
|
10300
10541
|
withdrawalWalletAddress
|
|
10301
10542
|
});
|
|
@@ -10337,12 +10578,12 @@ function useWithdrawalQuote({
|
|
|
10337
10578
|
}
|
|
10338
10579
|
|
|
10339
10580
|
// src/hooks/queries/useWithdrawalRisk.ts
|
|
10340
|
-
import { useQuery as
|
|
10341
|
-
import { useEffect as useEffect23, useRef as
|
|
10581
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
10582
|
+
import { useEffect as useEffect23, useRef as useRef12 } from "react";
|
|
10342
10583
|
import { isAddress as isAddress2 } from "viem";
|
|
10343
10584
|
var useWithdrawalRisk = (apiKey, receiveAddress) => {
|
|
10344
|
-
const lastRiskyAddressRef =
|
|
10345
|
-
const query =
|
|
10585
|
+
const lastRiskyAddressRef = useRef12(null);
|
|
10586
|
+
const query = useQuery8({
|
|
10346
10587
|
queryKey: ["withdrawal", "addressRisk", apiKey, receiveAddress],
|
|
10347
10588
|
queryFn: async () => {
|
|
10348
10589
|
try {
|
|
@@ -10382,17 +10623,17 @@ import {
|
|
|
10382
10623
|
convertFunToRelayTokenAddress,
|
|
10383
10624
|
getRelayAssetPriceInfo
|
|
10384
10625
|
} from "@funkit/fun-relay";
|
|
10385
|
-
import { skipToken, useQuery as
|
|
10626
|
+
import { skipToken, useQuery as useQuery10 } from "@tanstack/react-query";
|
|
10386
10627
|
|
|
10387
10628
|
// src/hooks/queries/useErc20Asset.ts
|
|
10388
10629
|
import { getAssetErc20ByChainAndSymbol } from "@funkit/api-base";
|
|
10389
|
-
import { useQuery as
|
|
10630
|
+
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
10390
10631
|
var useErc20Asset = ({
|
|
10391
10632
|
chainId,
|
|
10392
10633
|
symbol
|
|
10393
10634
|
}) => {
|
|
10394
10635
|
const { apiKey } = useFunkitConfig();
|
|
10395
|
-
const query =
|
|
10636
|
+
const query = useQuery9({
|
|
10396
10637
|
queryKey: ["erc20Asset", chainId, symbol],
|
|
10397
10638
|
queryFn: async () => {
|
|
10398
10639
|
if (!apiKey || !chainId || !symbol) {
|
|
@@ -10444,7 +10685,7 @@ function useAssetAddressPrice({
|
|
|
10444
10685
|
refetchInterval = 1e4
|
|
10445
10686
|
}) {
|
|
10446
10687
|
const { apiKey } = useFunkitConfig();
|
|
10447
|
-
const { data, error, isLoading } =
|
|
10688
|
+
const { data, error, isLoading } = useQuery10({
|
|
10448
10689
|
queryKey: ["getAssetPriceInfo", chainId, assetTokenAddress],
|
|
10449
10690
|
queryFn: chainId && assetTokenAddress ? async () => {
|
|
10450
10691
|
const isRelayPrimary = RELAY_SHORT_CIRCUIT_CHAIN_IDS.includes(chainId);
|
|
@@ -10507,7 +10748,7 @@ import { useEffect as useEffect24, useState as useState21 } from "react";
|
|
|
10507
10748
|
import { polygon as polygon2 } from "viem/chains";
|
|
10508
10749
|
|
|
10509
10750
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
10510
|
-
import { bitcoinChain
|
|
10751
|
+
import { bitcoinChain, solanaChain as solanaChain2 } from "@funkit/chains";
|
|
10511
10752
|
import { FlagKey as FlagKey8 } from "@funkit/utils";
|
|
10512
10753
|
import { base as base4 } from "viem/chains";
|
|
10513
10754
|
|
|
@@ -10547,7 +10788,7 @@ function useEnabledTokenTransferChainTokens(transferInit, isWithdrawal) {
|
|
|
10547
10788
|
if (isSolana && !hasSolanaAddress && !isWithdrawal) {
|
|
10548
10789
|
return acc;
|
|
10549
10790
|
}
|
|
10550
|
-
const isBitcoin = chainId ===
|
|
10791
|
+
const isBitcoin = chainId === bitcoinChain.id;
|
|
10551
10792
|
if (isBitcoin && !hasBitcoinAddress && !isWithdrawal) {
|
|
10552
10793
|
return acc;
|
|
10553
10794
|
}
|
|
@@ -10868,10 +11109,10 @@ function usePreparedWalletConnectors() {
|
|
|
10868
11109
|
import { useState as useState26 } from "react";
|
|
10869
11110
|
|
|
10870
11111
|
// src/hooks/useAutoClearState.ts
|
|
10871
|
-
import { useCallback as useCallback15, useEffect as useEffect25, useRef as
|
|
11112
|
+
import { useCallback as useCallback15, useEffect as useEffect25, useRef as useRef13, useState as useState22 } from "react";
|
|
10872
11113
|
function useAutoClearState(initialValue = null) {
|
|
10873
11114
|
const [state, setState] = useState22(initialValue);
|
|
10874
|
-
const timeoutRef =
|
|
11115
|
+
const timeoutRef = useRef13();
|
|
10875
11116
|
useEffect25(() => {
|
|
10876
11117
|
return () => {
|
|
10877
11118
|
if (timeoutRef.current !== void 0) {
|
|
@@ -10922,13 +11163,13 @@ import { useConfig as useConfig3 } from "wagmi";
|
|
|
10922
11163
|
// src/hooks/useBluvo.ts
|
|
10923
11164
|
import { bluvoGetWithdrawableBalanceById as bluvoGetWithdrawableBalanceById2 } from "@funkit/api-base";
|
|
10924
11165
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO4 } from "@funkit/chains";
|
|
10925
|
-
import { keepPreviousData, useQuery as
|
|
10926
|
-
import { useCallback as useCallback16, useMemo as
|
|
11166
|
+
import { keepPreviousData, useQuery as useQuery11 } from "@tanstack/react-query";
|
|
11167
|
+
import { useCallback as useCallback16, useMemo as useMemo20 } from "react";
|
|
10927
11168
|
|
|
10928
11169
|
// src/domains/wallet.ts
|
|
10929
11170
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO2 } from "@funkit/chains";
|
|
10930
11171
|
import { isNotNullish as isNotNullish2 } from "@funkit/utils";
|
|
10931
|
-
import { mainnet as
|
|
11172
|
+
import { mainnet as mainnet7, polygon as polygon3 } from "viem/chains";
|
|
10932
11173
|
|
|
10933
11174
|
// src/utils/assets.ts
|
|
10934
11175
|
import { formatUnits } from "viem";
|
|
@@ -10974,14 +11215,14 @@ import { arbitrum as arbitrum3 } from "viem/chains";
|
|
|
10974
11215
|
|
|
10975
11216
|
// src/hooks/useTokenTransfer.ts
|
|
10976
11217
|
import {
|
|
10977
|
-
bitcoinChain as
|
|
11218
|
+
bitcoinChain as bitcoinChain2,
|
|
10978
11219
|
hyperEvmChain,
|
|
10979
11220
|
monadChain,
|
|
10980
11221
|
solanaChain as solanaChain3
|
|
10981
11222
|
} from "@funkit/chains";
|
|
10982
11223
|
import { FlagKey as FlagKey10 } from "@funkit/utils";
|
|
10983
|
-
import { useMemo as
|
|
10984
|
-
import { arbitrum as arbitrum2, mainnet as
|
|
11224
|
+
import { useMemo as useMemo18 } from "react";
|
|
11225
|
+
import { arbitrum as arbitrum2, mainnet as mainnet8, polygon as polygon4 } from "viem/chains";
|
|
10985
11226
|
|
|
10986
11227
|
// src/utils/transfer.ts
|
|
10987
11228
|
var getTransferTokenQrCodeUri = (props) => {
|
|
@@ -11026,12 +11267,12 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
|
11026
11267
|
const isUsdceOnPolygon = isPolygon && selectedToken === "USDC.e";
|
|
11027
11268
|
const isUsdcOnPolygon = isPolygon && selectedToken === "USDC";
|
|
11028
11269
|
const showOriginalRecipient = isBankrUsUser || !enableUniversal && (isUsdceOnPolygon || isUsdcOnPolygon);
|
|
11029
|
-
const funDepositAddress = selectedChainId === solanaChain3.id ? transferInit?.solanaAddr : selectedChainId ===
|
|
11270
|
+
const funDepositAddress = selectedChainId === solanaChain3.id ? transferInit?.solanaAddr : selectedChainId === bitcoinChain2.id ? transferInit?.btcAddrSegwit : transferInit?.depositAddr;
|
|
11030
11271
|
const blockchainType = (() => {
|
|
11031
11272
|
if (selectedChainId === solanaChain3.id) {
|
|
11032
11273
|
return "solana";
|
|
11033
11274
|
}
|
|
11034
|
-
if (selectedChainId ===
|
|
11275
|
+
if (selectedChainId === bitcoinChain2.id) {
|
|
11035
11276
|
return "bitcoin";
|
|
11036
11277
|
}
|
|
11037
11278
|
return "ethereum";
|
|
@@ -11070,7 +11311,7 @@ var useMinTransferLimits = () => {
|
|
|
11070
11311
|
return limits;
|
|
11071
11312
|
};
|
|
11072
11313
|
function getMinTransferValueForChain(chainId, limits) {
|
|
11073
|
-
const MAINNET_IDS = [
|
|
11314
|
+
const MAINNET_IDS = [mainnet8.id, bitcoinChain2.id];
|
|
11074
11315
|
return MAINNET_IDS.includes(chainId) ? limits.mainnet : limits.nonMainnet;
|
|
11075
11316
|
}
|
|
11076
11317
|
var useMinTransferValue = (selectedChainId) => {
|
|
@@ -11088,7 +11329,7 @@ var useMinTransferValue = (selectedChainId) => {
|
|
|
11088
11329
|
};
|
|
11089
11330
|
var useMinTransferValues = (chainIds) => {
|
|
11090
11331
|
const limits = useMinTransferLimits();
|
|
11091
|
-
return
|
|
11332
|
+
return useMemo18(() => {
|
|
11092
11333
|
return chainIds.reduce(
|
|
11093
11334
|
(acc, id) => {
|
|
11094
11335
|
const limit = getMinTransferValueForChain(id, limits);
|
|
@@ -11359,8 +11600,8 @@ import { safeParseJson as safeParseJson3 } from "@funkit/utils";
|
|
|
11359
11600
|
import React69, {
|
|
11360
11601
|
useContext as useContext12,
|
|
11361
11602
|
useEffect as useEffect26,
|
|
11362
|
-
useMemo as
|
|
11363
|
-
useRef as
|
|
11603
|
+
useMemo as useMemo19,
|
|
11604
|
+
useRef as useRef14,
|
|
11364
11605
|
useState as useState23
|
|
11365
11606
|
} from "react";
|
|
11366
11607
|
import { createContext as createContext12 } from "react";
|
|
@@ -11382,9 +11623,10 @@ var FunkitBrokerageProvider = ({
|
|
|
11382
11623
|
}) => {
|
|
11383
11624
|
const { apiKey } = useFunkitConfig();
|
|
11384
11625
|
const isSandboxMode = useIsFunkitSandboxMode();
|
|
11385
|
-
const minTransferRef =
|
|
11626
|
+
const minTransferRef = useRef14(useMinTransferLimits());
|
|
11386
11627
|
const ORG_ID = isSandboxMode ? STAGE_ORG_ID : PROD_ORG_ID;
|
|
11387
11628
|
const PROJECT_ID = isSandboxMode ? STAGE_PROJECT_ID : PROD_PROJECT_ID;
|
|
11629
|
+
const apiBaseConfig = { apiKey, logger };
|
|
11388
11630
|
const [authConnections, setAuthConnections] = useState23(
|
|
11389
11631
|
{}
|
|
11390
11632
|
);
|
|
@@ -11392,15 +11634,21 @@ var FunkitBrokerageProvider = ({
|
|
|
11392
11634
|
const bluvoClient = useBluvoFlow({
|
|
11393
11635
|
orgId: ORG_ID,
|
|
11394
11636
|
projectId: PROJECT_ID,
|
|
11395
|
-
listExchangesFn: (status) => bluvoListExchanges({ status
|
|
11396
|
-
fetchWithdrawableBalanceFn: (id) => bluvoGetWithdrawableBalanceById({ id,
|
|
11637
|
+
listExchangesFn: (status = "live") => bluvoListExchanges({ status, ...apiBaseConfig }),
|
|
11638
|
+
fetchWithdrawableBalanceFn: (id) => bluvoGetWithdrawableBalanceById({ id, ...apiBaseConfig }),
|
|
11397
11639
|
pingWalletByIdFn: () => {
|
|
11398
11640
|
throw new Error("Not implemented");
|
|
11399
11641
|
},
|
|
11400
|
-
requestQuotationFn: (id, params) => bluvoRequestQuotation({ id, params,
|
|
11401
|
-
executeWithdrawalFn: (id, idempotencyKey, quoteId, params) => bluvoExecuteWithdrawal({
|
|
11642
|
+
requestQuotationFn: (id, params) => bluvoRequestQuotation({ id, params, ...apiBaseConfig }),
|
|
11643
|
+
executeWithdrawalFn: (id, idempotencyKey, quoteId, params) => bluvoExecuteWithdrawal({
|
|
11644
|
+
id,
|
|
11645
|
+
idempotencyKey,
|
|
11646
|
+
quoteId,
|
|
11647
|
+
params,
|
|
11648
|
+
...apiBaseConfig
|
|
11649
|
+
}),
|
|
11402
11650
|
onWalletConnectedFn: (id, exchange) => handleOnWalletConnected(id, exchange),
|
|
11403
|
-
getWalletByIdFn: (id) => bluvoGetWalletById({ id,
|
|
11651
|
+
getWalletByIdFn: (id) => bluvoGetWalletById({ id, ...apiBaseConfig }),
|
|
11404
11652
|
options: {
|
|
11405
11653
|
customDomain: "bluvo.fun.xyz",
|
|
11406
11654
|
autoRefreshQuotation: false
|
|
@@ -11419,7 +11667,7 @@ var FunkitBrokerageProvider = ({
|
|
|
11419
11667
|
setSelectedBrokerageAsset(null);
|
|
11420
11668
|
}
|
|
11421
11669
|
}, [bluvoClient.withdrawal?.status]);
|
|
11422
|
-
const brokerageMinMax =
|
|
11670
|
+
const brokerageMinMax = useMemo19(() => {
|
|
11423
11671
|
if (!selectedBrokerageAsset || !isBrokerageAsset(selectedBrokerageAsset)) {
|
|
11424
11672
|
return null;
|
|
11425
11673
|
}
|
|
@@ -11488,12 +11736,13 @@ var useBluvoExchangeBalance = ({
|
|
|
11488
11736
|
exchange,
|
|
11489
11737
|
refetchOnMount = false
|
|
11490
11738
|
}) => {
|
|
11739
|
+
const { apiKey } = useFunkitConfig();
|
|
11491
11740
|
const { checkoutItem } = useCheckoutContext();
|
|
11492
11741
|
const { authorizedConnections, purgeAuthConnectedExchange } = useFunkitBrokerageContext();
|
|
11493
11742
|
const deviceId = exchange && authorizedConnections?.[exchange] || "";
|
|
11494
11743
|
const isEnabled = !!exchange && !!deviceId;
|
|
11495
11744
|
const preferredChainId = checkoutItem?.initSettings.config.targetChain;
|
|
11496
|
-
const { data, isLoading, isError } =
|
|
11745
|
+
const { data, isLoading, isError } = useQuery11({
|
|
11497
11746
|
queryKey: ["bluvo-exchange-balance", deviceId, preferredChainId],
|
|
11498
11747
|
queryFn: async () => {
|
|
11499
11748
|
if (!exchange) {
|
|
@@ -11501,7 +11750,8 @@ var useBluvoExchangeBalance = ({
|
|
|
11501
11750
|
}
|
|
11502
11751
|
const response = await bluvoGetWithdrawableBalanceById2({
|
|
11503
11752
|
id: deviceId,
|
|
11504
|
-
logger
|
|
11753
|
+
logger,
|
|
11754
|
+
apiKey
|
|
11505
11755
|
});
|
|
11506
11756
|
if (response.error && response.error.type === "WALLET_NOT_FOUND") {
|
|
11507
11757
|
purgeAuthConnectedExchange(exchange);
|
|
@@ -11585,7 +11835,7 @@ var useBluvoSupportedExchanges = ({
|
|
|
11585
11835
|
filterBy = ["live" /* Live */]
|
|
11586
11836
|
}) => {
|
|
11587
11837
|
const { authorizedConnections } = useFunkitBrokerageContext();
|
|
11588
|
-
const exchangeOptions =
|
|
11838
|
+
const exchangeOptions = useMemo20(
|
|
11589
11839
|
() => SUPPORTED_EXCHANGES.filter(
|
|
11590
11840
|
({ status: exchangeStatus }) => filterBy.includes(exchangeStatus)
|
|
11591
11841
|
).map(({ exchange, status }) => {
|
|
@@ -12498,7 +12748,6 @@ var WithdrawContent = ({
|
|
|
12498
12748
|
} = useWithdrawalQuote({
|
|
12499
12749
|
config,
|
|
12500
12750
|
recipientAddress,
|
|
12501
|
-
sourceAmount: Number(debouncedUSD),
|
|
12502
12751
|
chainId: selectedChainId.toString(),
|
|
12503
12752
|
symbol: selectedToken,
|
|
12504
12753
|
targetAsset: targetAssetInfo?.address
|
|
@@ -12590,10 +12839,10 @@ var WithdrawContent = ({
|
|
|
12590
12839
|
recipientAddress
|
|
12591
12840
|
);
|
|
12592
12841
|
const isReceipentBlacklisted = isBlacklistedWithdrawAddress(recipientAddress);
|
|
12593
|
-
const lastTargetAssetErrorRef =
|
|
12594
|
-
const lastQuoteErrorRef =
|
|
12595
|
-
const lastRiskyRecipientRef =
|
|
12596
|
-
const lastBlacklistedRecipientRef =
|
|
12842
|
+
const lastTargetAssetErrorRef = useRef15(null);
|
|
12843
|
+
const lastQuoteErrorRef = useRef15(null);
|
|
12844
|
+
const lastRiskyRecipientRef = useRef15(null);
|
|
12845
|
+
const lastBlacklistedRecipientRef = useRef15(null);
|
|
12597
12846
|
useEffect28(() => {
|
|
12598
12847
|
if (!targetAssetFetchError) {
|
|
12599
12848
|
return;
|
|
@@ -12689,7 +12938,7 @@ var WithdrawContent = ({
|
|
|
12689
12938
|
selectedChainName,
|
|
12690
12939
|
t
|
|
12691
12940
|
});
|
|
12692
|
-
const errorNotification =
|
|
12941
|
+
const errorNotification = useMemo21(
|
|
12693
12942
|
() => getErrorNotification(
|
|
12694
12943
|
quoteErrorObject,
|
|
12695
12944
|
withdrawalError,
|
|
@@ -13122,7 +13371,7 @@ import {
|
|
|
13122
13371
|
getBridgeKycLink
|
|
13123
13372
|
} from "@funkit/api-base";
|
|
13124
13373
|
import { FlagKey as FlagKey12 } from "@funkit/utils";
|
|
13125
|
-
import { useQuery as
|
|
13374
|
+
import { useQuery as useQuery12, useQueryClient } from "@tanstack/react-query";
|
|
13126
13375
|
import { useCallback as useCallback18 } from "react";
|
|
13127
13376
|
var sepaCountryCode = [
|
|
13128
13377
|
// EU countries that are part of SEPA
|
|
@@ -13209,7 +13458,7 @@ function useFrogAccounts() {
|
|
|
13209
13458
|
const { apiKey } = useFunkitConfig();
|
|
13210
13459
|
const { userInfo, isUserLoggedIn } = useGeneralWallet();
|
|
13211
13460
|
const userId = userInfo.id;
|
|
13212
|
-
const query =
|
|
13461
|
+
const query = useQuery12({
|
|
13213
13462
|
queryKey: ["frogSubAccounts", userId],
|
|
13214
13463
|
queryFn: () => fetchFrogAccounts(userId, { apiKey, logger }),
|
|
13215
13464
|
enabled: userId !== "0x" && isUserLoggedIn,
|
|
@@ -13245,7 +13494,7 @@ function useVirtualFiatAccounts() {
|
|
|
13245
13494
|
const bridgeSubAccount = frogSubAccounts?.find(
|
|
13246
13495
|
(subAccount) => subAccount.subAccountType === "bridge"
|
|
13247
13496
|
);
|
|
13248
|
-
const query =
|
|
13497
|
+
const query = useQuery12({
|
|
13249
13498
|
queryKey: ["useVirtualFiatAccounts", bridgeSubAccount?.guid],
|
|
13250
13499
|
queryFn: () => fetchAllFiatAccounts(bridgeSubAccount, { apiKey, logger }),
|
|
13251
13500
|
enabled: !!bridgeSubAccount,
|
|
@@ -13272,7 +13521,7 @@ function useMatchingVirtualFiatAccount(accounts) {
|
|
|
13272
13521
|
}
|
|
13273
13522
|
function useLoadKycLink(linkLoad) {
|
|
13274
13523
|
const { apiKey } = useFunkitConfig();
|
|
13275
|
-
const query =
|
|
13524
|
+
const query = useQuery12({
|
|
13276
13525
|
queryKey: ["kycLink", linkLoad.guid],
|
|
13277
13526
|
queryFn: async () => {
|
|
13278
13527
|
if (linkLoad.kycLink) {
|
|
@@ -13355,7 +13604,7 @@ import {
|
|
|
13355
13604
|
FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3,
|
|
13356
13605
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7
|
|
13357
13606
|
} from "@funkit/chains";
|
|
13358
|
-
import { useMemo as
|
|
13607
|
+
import { useMemo as useMemo22 } from "react";
|
|
13359
13608
|
var processWalletAssets = (walletAssets, targetChain) => {
|
|
13360
13609
|
if (!walletAssets) {
|
|
13361
13610
|
return;
|
|
@@ -13404,7 +13653,7 @@ var processWalletAssets = (walletAssets, targetChain) => {
|
|
|
13404
13653
|
};
|
|
13405
13654
|
function useWalletAssetHoldings(targetChain) {
|
|
13406
13655
|
const { walletAssets, isLoading, totalWalletAssetsUsd } = useWalletAssets();
|
|
13407
|
-
const processedAssets =
|
|
13656
|
+
const processedAssets = useMemo22(
|
|
13408
13657
|
() => processWalletAssets(walletAssets, targetChain),
|
|
13409
13658
|
[targetChain, walletAssets]
|
|
13410
13659
|
);
|
|
@@ -14243,7 +14492,7 @@ import React76 from "react";
|
|
|
14243
14492
|
|
|
14244
14493
|
// src/components/FunOptionBox/FunOptionBox.tsx
|
|
14245
14494
|
import clsx15 from "clsx";
|
|
14246
|
-
import React75, { useRef as
|
|
14495
|
+
import React75, { useRef as useRef16 } from "react";
|
|
14247
14496
|
|
|
14248
14497
|
// src/components/FunOptionBox/FunOptionBox.css.ts
|
|
14249
14498
|
var funOptionBoxStyle = { baseStyle: "_1rfcluh0", defaultBorder: "_1rsrm2f15a _1rsrm2f13f", transparentBorder: "_1rsrm2f18s _1rsrm2f13f _1rsrm2f1k", activeBorder: "_1rsrm2f13a", disabledOptionBorder: "_1rsrm2f154", defaultBackground: "_1rsrm2fzy _1rsrm2fmh", activeBackground: "_1rsrm2fzy _1rsrm2fqn _1rsrm2fqo" };
|
|
@@ -14269,7 +14518,7 @@ function FunOptionBox({
|
|
|
14269
14518
|
...boxProps
|
|
14270
14519
|
}) {
|
|
14271
14520
|
const isClickable = !!onClick && !disabled;
|
|
14272
|
-
const ref =
|
|
14521
|
+
const ref = useRef16(null);
|
|
14273
14522
|
return /* @__PURE__ */ React75.createElement(
|
|
14274
14523
|
Box,
|
|
14275
14524
|
{
|
|
@@ -15270,7 +15519,7 @@ var HelpAlert = ({ onHelp: onHelp2 }) => {
|
|
|
15270
15519
|
|
|
15271
15520
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
15272
15521
|
import clsx18 from "clsx";
|
|
15273
|
-
import React98, { useCallback as useCallback21, useEffect as useEffect33, useMemo as
|
|
15522
|
+
import React98, { useCallback as useCallback21, useEffect as useEffect33, useMemo as useMemo25, useState as useState31 } from "react";
|
|
15274
15523
|
|
|
15275
15524
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
15276
15525
|
import React88 from "react";
|
|
@@ -15323,7 +15572,7 @@ import {
|
|
|
15323
15572
|
getCheckoutsByUserId as getCheckoutsByUserId2
|
|
15324
15573
|
} from "@funkit/api-base";
|
|
15325
15574
|
import { FlagKey as FlagKey14 } from "@funkit/utils";
|
|
15326
|
-
import { useQuery as
|
|
15575
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
15327
15576
|
var hasCorrectPaymentMethod = (checkout, paymentMethod) => !paymentMethod || checkout.clientMetadata.selectedPaymentMethodInfo?.paymentMethod === paymentMethod;
|
|
15328
15577
|
var isRecent = (checkout, timestampCutoff) => checkout.createdTimeMs > timestampCutoff;
|
|
15329
15578
|
var DEFAULT_NOTIF_CUTOFF = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -15338,7 +15587,7 @@ var useRecentCheckouts = ({
|
|
|
15338
15587
|
const { isUserLoggedIn, userInfo } = useGeneralWallet();
|
|
15339
15588
|
const { apiKey } = useFunkitConfig();
|
|
15340
15589
|
const { listRefresh } = useCheckoutRefreshInterval();
|
|
15341
|
-
const query =
|
|
15590
|
+
const query = useQuery13({
|
|
15342
15591
|
queryKey: ["checkouts", userInfo.id],
|
|
15343
15592
|
queryFn: async () => {
|
|
15344
15593
|
const checkouts = await getCheckoutsByUserId2({
|
|
@@ -15361,8 +15610,8 @@ var useRecentCheckouts = ({
|
|
|
15361
15610
|
import {
|
|
15362
15611
|
getDirectExecutionsByUserId as getDirectExecutionsByUserId2
|
|
15363
15612
|
} from "@funkit/api-base";
|
|
15364
|
-
import { useQuery as
|
|
15365
|
-
import { useMemo as
|
|
15613
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
15614
|
+
import { useMemo as useMemo23 } from "react";
|
|
15366
15615
|
var isRecent2 = (de, timestampCutoff) => de.createdTimeMs > timestampCutoff;
|
|
15367
15616
|
function mergeMultiStepDirectExecutions(directExecutions) {
|
|
15368
15617
|
const directExecutionsByToTxId = {};
|
|
@@ -15406,7 +15655,7 @@ var useRecentDirectExecutions = ({
|
|
|
15406
15655
|
const { userInfo, isUserLoggedIn } = useGeneralWallet();
|
|
15407
15656
|
const { apiKey } = useFunkitConfig();
|
|
15408
15657
|
const { listRefresh } = useCheckoutRefreshInterval();
|
|
15409
|
-
const { data: directExecutions } =
|
|
15658
|
+
const { data: directExecutions } = useQuery14({
|
|
15410
15659
|
queryKey: ["directExecutions", userInfo.id],
|
|
15411
15660
|
queryFn: async () => {
|
|
15412
15661
|
const directExecutions2 = await getDirectExecutionsByUserId2({
|
|
@@ -15419,7 +15668,7 @@ var useRecentDirectExecutions = ({
|
|
|
15419
15668
|
refetchInterval: listRefresh,
|
|
15420
15669
|
enabled: isUserLoggedIn && isVisible
|
|
15421
15670
|
});
|
|
15422
|
-
const data =
|
|
15671
|
+
const data = useMemo23(() => {
|
|
15423
15672
|
if (!directExecutions) {
|
|
15424
15673
|
return directExecutions;
|
|
15425
15674
|
}
|
|
@@ -15491,7 +15740,7 @@ import { Trans as Trans3 } from "react-i18next";
|
|
|
15491
15740
|
import { CheckoutState as CheckoutState3 } from "@funkit/api-base";
|
|
15492
15741
|
import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
15493
15742
|
import { formatAddress as formatAddress4, formatTimestamp } from "@funkit/utils";
|
|
15494
|
-
import React92, { useState as useState28, useRef as
|
|
15743
|
+
import React92, { useState as useState28, useRef as useRef17, useEffect as useEffect31 } from "react";
|
|
15495
15744
|
|
|
15496
15745
|
// src/utils/checkoutHistory.ts
|
|
15497
15746
|
var storageKey4 = "fkc-last-report-submit-time";
|
|
@@ -15725,7 +15974,7 @@ function OrderDetail({
|
|
|
15725
15974
|
}) {
|
|
15726
15975
|
const { t } = useFunkitTranslation();
|
|
15727
15976
|
const [isExpanded, setIsExpanded] = useState28(false);
|
|
15728
|
-
const contentRef =
|
|
15977
|
+
const contentRef = useRef17(null);
|
|
15729
15978
|
const isCheckoutItemLoaded = checkoutHistoryItem !== void 0;
|
|
15730
15979
|
return /* @__PURE__ */ React92.createElement(Box, { ref: contentRef, paddingX: "12" }, /* @__PURE__ */ React92.createElement(
|
|
15731
15980
|
Box,
|
|
@@ -15793,7 +16042,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f12m _1rsrm2f1f _1rsrm2f1c _1rsrm2fm4
|
|
|
15793
16042
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
15794
16043
|
import clsx16 from "clsx";
|
|
15795
16044
|
import { motion as motion7, useAnimate as useAnimate2 } from "motion/react";
|
|
15796
|
-
import React93, { useCallback as useCallback19, useEffect as useEffect32, useRef as
|
|
16045
|
+
import React93, { useCallback as useCallback19, useEffect as useEffect32, useRef as useRef18 } from "react";
|
|
15797
16046
|
|
|
15798
16047
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
15799
16048
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -16242,7 +16491,7 @@ var FunNotificationBannerIcon = ({
|
|
|
16242
16491
|
)
|
|
16243
16492
|
]);
|
|
16244
16493
|
}, [animate]);
|
|
16245
|
-
const statusRef =
|
|
16494
|
+
const statusRef = useRef18(status);
|
|
16246
16495
|
useEffect32(() => {
|
|
16247
16496
|
if (statusRef.current !== status) {
|
|
16248
16497
|
if (statusRef.current === "processing" && status === "completed") {
|
|
@@ -16474,11 +16723,11 @@ var FunNotificationBanner = ({
|
|
|
16474
16723
|
import {
|
|
16475
16724
|
getCheckoutByDepositAddress as getCheckoutByDepositAddress2
|
|
16476
16725
|
} from "@funkit/api-base";
|
|
16477
|
-
import { useQuery as
|
|
16726
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
16478
16727
|
var useCheckout = (depositAddress, initial) => {
|
|
16479
16728
|
const { apiKey } = useFunkitConfig();
|
|
16480
16729
|
const { itemRefresh } = useCheckoutRefreshInterval();
|
|
16481
|
-
const query =
|
|
16730
|
+
const query = useQuery15({
|
|
16482
16731
|
queryKey: ["checkouts", "checkout", depositAddress],
|
|
16483
16732
|
queryFn: () => (
|
|
16484
16733
|
// biome-ignore lint/style/noNonNullAssertion: already checked for null
|
|
@@ -16683,7 +16932,7 @@ import {
|
|
|
16683
16932
|
formatTimestamp as formatTimestamp2,
|
|
16684
16933
|
isTokenEquivalent
|
|
16685
16934
|
} from "@funkit/utils";
|
|
16686
|
-
import React96, { useCallback as useCallback20, useMemo as
|
|
16935
|
+
import React96, { useCallback as useCallback20, useMemo as useMemo24, useRef as useRef19, useState as useState30 } from "react";
|
|
16687
16936
|
import { createPortal as createPortal3 } from "react-dom";
|
|
16688
16937
|
|
|
16689
16938
|
// src/hooks/useReceiveAmountLabel.ts
|
|
@@ -16744,7 +16993,7 @@ function FunDirectExecutionHistoryDetail({
|
|
|
16744
16993
|
]
|
|
16745
16994
|
);
|
|
16746
16995
|
const isWithdrawal = directExecution?.clientMetadata?.isWithdrawal;
|
|
16747
|
-
const buttonProps =
|
|
16996
|
+
const buttonProps = useMemo24(() => {
|
|
16748
16997
|
if (!isLoaded) {
|
|
16749
16998
|
return void 0;
|
|
16750
16999
|
}
|
|
@@ -16890,7 +17139,7 @@ function DirectExecutionOrderDetail({
|
|
|
16890
17139
|
}) {
|
|
16891
17140
|
const { t } = useFunkitTranslation();
|
|
16892
17141
|
const [isExpanded, setIsExpanded] = useState30(false);
|
|
16893
|
-
const contentRef =
|
|
17142
|
+
const contentRef = useRef19(null);
|
|
16894
17143
|
return /* @__PURE__ */ React96.createElement(Box, { ref: contentRef, paddingX: "12" }, /* @__PURE__ */ React96.createElement(
|
|
16895
17144
|
Box,
|
|
16896
17145
|
{
|
|
@@ -17123,7 +17372,7 @@ var CheckoutNotifications = ({
|
|
|
17123
17372
|
const [initialDirectExecutions, setInitialDirectExecutions] = useState31();
|
|
17124
17373
|
const [closedNotifications, setClosedNotifications] = useState31([]);
|
|
17125
17374
|
const { data: checkouts } = useRecentCheckouts({ isVisible });
|
|
17126
|
-
const filterFunc =
|
|
17375
|
+
const filterFunc = useMemo25(() => {
|
|
17127
17376
|
return variant && {
|
|
17128
17377
|
token_transfer: isTokenTransferDirectExecution,
|
|
17129
17378
|
withdrawal: isWithdrawalDirectExecution
|
|
@@ -17145,19 +17394,19 @@ var CheckoutNotifications = ({
|
|
|
17145
17394
|
}
|
|
17146
17395
|
setInitialDirectExecutions(directExecutions);
|
|
17147
17396
|
}, [initialDirectExecutions, directExecutions]);
|
|
17148
|
-
const displayedDirectExecutions =
|
|
17397
|
+
const displayedDirectExecutions = useMemo25(() => {
|
|
17149
17398
|
if (!directExecutions) {
|
|
17150
17399
|
return [];
|
|
17151
17400
|
}
|
|
17152
17401
|
return getUpdatedDirectExecutions(directExecutions, initialDirectExecutions).filter(({ txHash }) => !closedNotifications.includes(txHash)).slice(0, MAX_COUNT);
|
|
17153
17402
|
}, [initialDirectExecutions, directExecutions, closedNotifications]);
|
|
17154
|
-
const displayedCheckouts =
|
|
17403
|
+
const displayedCheckouts = useMemo25(() => {
|
|
17155
17404
|
if (!checkouts) {
|
|
17156
17405
|
return [];
|
|
17157
17406
|
}
|
|
17158
17407
|
return getUpdatedCheckouts(checkouts, initialCheckouts).filter(({ depositAddr }) => !closedNotifications.includes(depositAddr)).slice(0, MAX_COUNT);
|
|
17159
17408
|
}, [initialCheckouts, checkouts, closedNotifications]);
|
|
17160
|
-
const combinedNotifications =
|
|
17409
|
+
const combinedNotifications = useMemo25(() => {
|
|
17161
17410
|
return [
|
|
17162
17411
|
...displayedDirectExecutions.map(
|
|
17163
17412
|
(item) => ({ ...item, isDirectExecution: true })
|
|
@@ -17167,7 +17416,7 @@ var CheckoutNotifications = ({
|
|
|
17167
17416
|
)
|
|
17168
17417
|
].sort((a, b) => b.createdTimeMs - a.createdTimeMs);
|
|
17169
17418
|
}, [displayedDirectExecutions, displayedCheckouts]);
|
|
17170
|
-
const displayedNotifications =
|
|
17419
|
+
const displayedNotifications = useMemo25(() => {
|
|
17171
17420
|
return isExpanded ? combinedNotifications : combinedNotifications.slice(0, COLLAPSED_COUNT);
|
|
17172
17421
|
}, [isExpanded, combinedNotifications]);
|
|
17173
17422
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
@@ -17324,13 +17573,13 @@ import React106 from "react";
|
|
|
17324
17573
|
import React105 from "react";
|
|
17325
17574
|
|
|
17326
17575
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
17327
|
-
import React100, { useCallback as useCallback22, useMemo as
|
|
17576
|
+
import React100, { useCallback as useCallback22, useMemo as useMemo26, useState as useState32 } from "react";
|
|
17328
17577
|
import { createPortal as createPortal5 } from "react-dom";
|
|
17329
17578
|
|
|
17330
17579
|
// src/hooks/useFunListeners.ts
|
|
17331
|
-
import { useEffect as useEffect34, useRef as
|
|
17580
|
+
import { useEffect as useEffect34, useRef as useRef20 } from "react";
|
|
17332
17581
|
function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
|
|
17333
|
-
const activeIntervalRef =
|
|
17582
|
+
const activeIntervalRef = useRef20();
|
|
17334
17583
|
const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useCheckoutHistoryContext();
|
|
17335
17584
|
useEffect34(() => {
|
|
17336
17585
|
if (activate) {
|
|
@@ -17391,7 +17640,7 @@ function FunCheckoutHistoryDetail({
|
|
|
17391
17640
|
isActiveCheckout
|
|
17392
17641
|
]
|
|
17393
17642
|
);
|
|
17394
|
-
const primaryButtonProps =
|
|
17643
|
+
const primaryButtonProps = useMemo26(() => {
|
|
17395
17644
|
if (!isCheckoutLoaded) {
|
|
17396
17645
|
return void 0;
|
|
17397
17646
|
}
|
|
@@ -17478,7 +17727,7 @@ var CheckoutAlert = ({ state, refundState, onHelp: onHelp2 }) => {
|
|
|
17478
17727
|
|
|
17479
17728
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryHelp.tsx
|
|
17480
17729
|
import { sendSupportMessage } from "@funkit/api-base";
|
|
17481
|
-
import React104, { useEffect as useEffect35, useMemo as
|
|
17730
|
+
import React104, { useEffect as useEffect35, useMemo as useMemo27, useRef as useRef21, useState as useState33 } from "react";
|
|
17482
17731
|
import { createPortal as createPortal6 } from "react-dom";
|
|
17483
17732
|
|
|
17484
17733
|
// src/components/FunInput/FunTextAreaInput.tsx
|
|
@@ -17662,13 +17911,13 @@ function FunCheckoutHistoryHelp({
|
|
|
17662
17911
|
);
|
|
17663
17912
|
const [descriptionInput, setDescriptionInput] = useState33("");
|
|
17664
17913
|
const [errorMessage, setErrorMessage] = useState33();
|
|
17665
|
-
const isEmailInputValid =
|
|
17914
|
+
const isEmailInputValid = useMemo27(() => {
|
|
17666
17915
|
return validateEmailString(emailInput);
|
|
17667
17916
|
}, [emailInput]);
|
|
17668
17917
|
const [processStage, setProcessStage] = useState33(
|
|
17669
17918
|
0 /* INPUT */
|
|
17670
17919
|
);
|
|
17671
|
-
const wrapperRef =
|
|
17920
|
+
const wrapperRef = useRef21(null);
|
|
17672
17921
|
useEffect35(() => wrapperRef.current?.scrollIntoView(), []);
|
|
17673
17922
|
const handleShowErrorMessage = (message, timeMs = FIVE_SECONDS_MS) => {
|
|
17674
17923
|
setErrorMessage(message);
|
|
@@ -17860,6 +18109,12 @@ function FunCheckoutHistoryContent({
|
|
|
17860
18109
|
onHelp: onHelp2
|
|
17861
18110
|
}) {
|
|
17862
18111
|
const { checkoutHistoryInfo, directExecutionInfo } = useFunkitPostCheckoutInternal(depositAddress);
|
|
18112
|
+
const { apiKey } = useFunkitConfig();
|
|
18113
|
+
const { checkoutItem } = useCheckoutContext();
|
|
18114
|
+
const lighterNativeDeposit = isLighterNativeFlow(
|
|
18115
|
+
apiKey,
|
|
18116
|
+
checkoutItem?.initSettings.config
|
|
18117
|
+
);
|
|
17863
18118
|
const { directExecution } = useDirectExecutionInfoPolling({
|
|
17864
18119
|
initDirectExecution: directExecutionInfo
|
|
17865
18120
|
});
|
|
@@ -17872,6 +18127,7 @@ function FunCheckoutHistoryContent({
|
|
|
17872
18127
|
directExecution,
|
|
17873
18128
|
isActiveCheckout,
|
|
17874
18129
|
onClose,
|
|
18130
|
+
dangerousCustomDelayedAutoTriggerCutoff: lighterNativeDeposit ? LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF : void 0,
|
|
17875
18131
|
onAnimationComplete
|
|
17876
18132
|
}
|
|
17877
18133
|
);
|
|
@@ -18058,7 +18314,7 @@ import React108, {
|
|
|
18058
18314
|
createContext as createContext14,
|
|
18059
18315
|
useCallback as useCallback24,
|
|
18060
18316
|
useContext as useContext14,
|
|
18061
|
-
useMemo as
|
|
18317
|
+
useMemo as useMemo28,
|
|
18062
18318
|
useState as useState35
|
|
18063
18319
|
} from "react";
|
|
18064
18320
|
var ActivityTraversalContext = createContext14({
|
|
@@ -18101,7 +18357,7 @@ var ActivityTraversalProvider = ({
|
|
|
18101
18357
|
setSelectedPurchaseInitView(void 0);
|
|
18102
18358
|
setReturnView(void 0);
|
|
18103
18359
|
}, []);
|
|
18104
|
-
const contextValue =
|
|
18360
|
+
const contextValue = useMemo28(
|
|
18105
18361
|
() => ({
|
|
18106
18362
|
selectedPurchaseId,
|
|
18107
18363
|
selectedPurchaseInitView,
|
|
@@ -18130,12 +18386,12 @@ import React217, { useCallback as useCallback46, useState as useState69 } from "
|
|
|
18130
18386
|
|
|
18131
18387
|
// src/components/FunCheckoutModalHeightAnimationWrapper/FunCheckoutModalHeightAnimationWrapper.tsx
|
|
18132
18388
|
import { motion as motion15 } from "motion/react";
|
|
18133
|
-
import React204, { useEffect as useEffect51, useRef as
|
|
18389
|
+
import React204, { useEffect as useEffect51, useRef as useRef28, useState as useState66 } from "react";
|
|
18134
18390
|
|
|
18135
18391
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
18136
18392
|
import {
|
|
18137
18393
|
useCallback as useCallback44,
|
|
18138
|
-
useRef as
|
|
18394
|
+
useRef as useRef27,
|
|
18139
18395
|
useState as useState65
|
|
18140
18396
|
} from "react";
|
|
18141
18397
|
|
|
@@ -18206,11 +18462,11 @@ function useAnimatedNavigation(callback) {
|
|
|
18206
18462
|
}
|
|
18207
18463
|
|
|
18208
18464
|
// src/hooks/useCheckoutQuoteNotification.ts
|
|
18209
|
-
import { useMemo as
|
|
18465
|
+
import { useMemo as useMemo29 } from "react";
|
|
18210
18466
|
function useCheckoutQuoteNotification() {
|
|
18211
18467
|
const { clearCheckoutQuoteMessages } = useQuoteContext();
|
|
18212
18468
|
const { quoteErrorMessage, quoteStepMessage } = useQuoteContext();
|
|
18213
|
-
const quoteNotification =
|
|
18469
|
+
const quoteNotification = useMemo29(() => {
|
|
18214
18470
|
if (quoteErrorMessage !== "") {
|
|
18215
18471
|
return {
|
|
18216
18472
|
messageType: "error",
|
|
@@ -19648,7 +19904,7 @@ import {
|
|
|
19648
19904
|
DirectExecutionType as DirectExecutionType2,
|
|
19649
19905
|
RelayExecutionStatus as RelayExecutionStatus3
|
|
19650
19906
|
} from "@funkit/api-base";
|
|
19651
|
-
import React130, { useCallback as useCallback27, useEffect as useEffect36, useMemo as
|
|
19907
|
+
import React130, { useCallback as useCallback27, useEffect as useEffect36, useMemo as useMemo30, useState as useState39 } from "react";
|
|
19652
19908
|
var overrideAssetsData = (de, checkoutItem) => {
|
|
19653
19909
|
return {
|
|
19654
19910
|
...de,
|
|
@@ -19723,7 +19979,7 @@ var BrokerageSuccess = ({
|
|
|
19723
19979
|
}) => {
|
|
19724
19980
|
const { t } = useFunkitTranslation();
|
|
19725
19981
|
const [startTime] = useState39(() => Date.now());
|
|
19726
|
-
const filterFunc =
|
|
19982
|
+
const filterFunc = useMemo30(() => {
|
|
19727
19983
|
return (execution) => execution.createdTimeMs > startTime && execution.listenerInfo?.status === RelayExecutionStatus3.SUCCESS;
|
|
19728
19984
|
}, [startTime]);
|
|
19729
19985
|
const { data: directExecutions } = useRecentDirectExecutions({
|
|
@@ -19743,7 +19999,7 @@ var BrokerageSuccess = ({
|
|
|
19743
19999
|
setDirectExecution(getFakeDirectExecution(checkoutItem, walletAddress));
|
|
19744
20000
|
}
|
|
19745
20001
|
}, [directExecution, checkoutItem, setCheckoutProgress]);
|
|
19746
|
-
const latestDirectExecution =
|
|
20002
|
+
const latestDirectExecution = useMemo30(() => {
|
|
19747
20003
|
return directExecutions?.[0];
|
|
19748
20004
|
}, [directExecutions?.[0]?.txHash]);
|
|
19749
20005
|
useEffect36(() => {
|
|
@@ -19798,7 +20054,7 @@ var BrokerageSuccess = ({
|
|
|
19798
20054
|
// string
|
|
19799
20055
|
directExecution?.txHash
|
|
19800
20056
|
]);
|
|
19801
|
-
const customTextConfigSteps =
|
|
20057
|
+
const customTextConfigSteps = useMemo30(() => {
|
|
19802
20058
|
if (exchangeType) {
|
|
19803
20059
|
return {
|
|
19804
20060
|
...getDefaultTextConfigSteps(t),
|
|
@@ -19968,6 +20224,7 @@ function BrokerageTwoFA({
|
|
|
19968
20224
|
setModalState
|
|
19969
20225
|
}) {
|
|
19970
20226
|
const { t } = useFunkitTranslation();
|
|
20227
|
+
const { apiKey } = useFunkitConfig();
|
|
19971
20228
|
const { bluvoClient, exchangeType } = useBluvo();
|
|
19972
20229
|
const { getBluvoCheckoutQuote } = useBluvoCheckoutQuote();
|
|
19973
20230
|
const requiresValid2FAMethod = bluvoClient?.requiresValid2FAMethod;
|
|
@@ -20082,7 +20339,8 @@ function BrokerageTwoFA({
|
|
|
20082
20339
|
quoteId,
|
|
20083
20340
|
params: {
|
|
20084
20341
|
twofa: finalOtpInput
|
|
20085
|
-
}
|
|
20342
|
+
},
|
|
20343
|
+
apiKey
|
|
20086
20344
|
});
|
|
20087
20345
|
logger.info(`${logPrefix2}handleEnterTwoFactor:submit2FAResponse`, {
|
|
20088
20346
|
response: _response
|
|
@@ -20136,7 +20394,8 @@ function BrokerageTwoFA({
|
|
|
20136
20394
|
id: walletId,
|
|
20137
20395
|
idempotencyKey: uuidv4(),
|
|
20138
20396
|
quoteId: quote.id,
|
|
20139
|
-
params: {}
|
|
20397
|
+
params: {},
|
|
20398
|
+
apiKey
|
|
20140
20399
|
});
|
|
20141
20400
|
if (newResponse.success && newResponse.data?.type?.startsWith("WITHDRAWAL_2FA_REQUIRED")) {
|
|
20142
20401
|
return await handleEnterTwoFactor(
|
|
@@ -20855,7 +21114,7 @@ function CheckoutHelp({
|
|
|
20855
21114
|
}
|
|
20856
21115
|
|
|
20857
21116
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
20858
|
-
import React156, { useEffect as useEffect43, useMemo as
|
|
21117
|
+
import React156, { useEffect as useEffect43, useMemo as useMemo36, useState as useState51 } from "react";
|
|
20859
21118
|
import { createPortal as createPortal14 } from "react-dom";
|
|
20860
21119
|
|
|
20861
21120
|
// src/providers/UserPresenceContext.tsx
|
|
@@ -20901,9 +21160,9 @@ import React145 from "react";
|
|
|
20901
21160
|
import React144, { useState as useState44 } from "react";
|
|
20902
21161
|
|
|
20903
21162
|
// src/hooks/useInterval.ts
|
|
20904
|
-
import { useEffect as useEffect39, useRef as
|
|
21163
|
+
import { useEffect as useEffect39, useRef as useRef22 } from "react";
|
|
20905
21164
|
function useInterval(callback, delay) {
|
|
20906
|
-
const savedCallback =
|
|
21165
|
+
const savedCallback = useRef22(callback);
|
|
20907
21166
|
useIsomorphicLayoutEffect(() => {
|
|
20908
21167
|
savedCallback.current = callback;
|
|
20909
21168
|
}, [callback]);
|
|
@@ -20961,7 +21220,8 @@ import {
|
|
|
20961
21220
|
} from "@funkit/utils";
|
|
20962
21221
|
import NumberFlow from "@number-flow/react";
|
|
20963
21222
|
import { motion as motion9 } from "motion/react";
|
|
20964
|
-
import React147, { useMemo as
|
|
21223
|
+
import React147, { useMemo as useMemo32 } from "react";
|
|
21224
|
+
import { LIGHTER_CHAIN_ID } from "@funkit/chains";
|
|
20965
21225
|
|
|
20966
21226
|
// src/consts/design.ts
|
|
20967
21227
|
var mapFontLineHeightToNumberFlowHeight = {
|
|
@@ -20974,7 +21234,7 @@ var defaultTransition = "all 150ms cubic-bezier(0.3, 0, 0.06, 1)";
|
|
|
20974
21234
|
// src/components/FunAssetAvatar/FunAssetAvatar.tsx
|
|
20975
21235
|
import { isNotNullish as isNotNullish4 } from "@funkit/utils";
|
|
20976
21236
|
import clsx20 from "clsx";
|
|
20977
|
-
import React146, { useMemo as
|
|
21237
|
+
import React146, { useMemo as useMemo31 } from "react";
|
|
20978
21238
|
|
|
20979
21239
|
// src/components/FunAssetAvatar/FunAssetAvatar.css.ts
|
|
20980
21240
|
var chainContainerStyle = "uwrdc22 _1rsrm2f19 _1rsrm2fa _1rsrm2f4 _1rsrm2f4o";
|
|
@@ -20995,7 +21255,7 @@ function FunAssetAvatar({
|
|
|
20995
21255
|
isChainIconHidden = false
|
|
20996
21256
|
}) {
|
|
20997
21257
|
const chainMetadata = chainMetadataById[Number.parseInt((chainId || "").toString())] || null;
|
|
20998
|
-
const finalAssetSrc =
|
|
21258
|
+
const finalAssetSrc = useMemo31(() => {
|
|
20999
21259
|
const normalizedTicker = assetTicker?.toUpperCase() || "";
|
|
21000
21260
|
const defaultSrc = ASSET_LOGO_SRCS[normalizedTicker];
|
|
21001
21261
|
if (prioritizeDefaults) {
|
|
@@ -21071,11 +21331,13 @@ function FunAssetAvatar({
|
|
|
21071
21331
|
// src/components/FunTransactionSummary/PaymentAmountSummary.tsx
|
|
21072
21332
|
function PaymentAmountSummary({
|
|
21073
21333
|
isLoading,
|
|
21074
|
-
targetChainId,
|
|
21334
|
+
targetChainId: originalChainId,
|
|
21075
21335
|
quote,
|
|
21076
21336
|
checkoutItem,
|
|
21077
21337
|
directExecutionType = null
|
|
21078
21338
|
}) {
|
|
21339
|
+
const { apiKey } = useFunkitConfig();
|
|
21340
|
+
const targetChainId = isLighterxyzCustomer(apiKey) ? String(LIGHTER_CHAIN_ID) : originalChainId;
|
|
21079
21341
|
const { textCustomizations, uiCustomizations } = useFunkitConfig();
|
|
21080
21342
|
const paymentMethod = checkoutItem?.selectedPaymentMethodInfo?.paymentMethod;
|
|
21081
21343
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
@@ -21114,7 +21376,7 @@ function PaymentAmountSummary({
|
|
|
21114
21376
|
const showYouWillPaySummary = !isExactSameToken && !isCardPayment || hasStakingToken;
|
|
21115
21377
|
const feeBreakdown = quote?.baseQuote.metadata?.feeBreakdown;
|
|
21116
21378
|
const swapImpactPct = checkoutConfig?.generateActionsParams ? feeBreakdown?.swapImpact + feeBreakdown?.appFeePercent || 0 : 0;
|
|
21117
|
-
const receiveTokenUsdAmount =
|
|
21379
|
+
const receiveTokenUsdAmount = useMemo32(() => {
|
|
21118
21380
|
if (!quote) {
|
|
21119
21381
|
return void 0;
|
|
21120
21382
|
}
|
|
@@ -21246,24 +21508,16 @@ function useCheckoutItemDisplay({
|
|
|
21246
21508
|
});
|
|
21247
21509
|
}
|
|
21248
21510
|
|
|
21249
|
-
// src/utils/customer.ts
|
|
21250
|
-
function isKatanaEarnFlow({
|
|
21251
|
-
apiKey,
|
|
21252
|
-
checkoutConfig
|
|
21253
|
-
}) {
|
|
21254
|
-
return isKatanaCustomer(apiKey) && !!checkoutConfig && isCheckoutPostActionRequired(checkoutConfig);
|
|
21255
|
-
}
|
|
21256
|
-
|
|
21257
21511
|
// src/modals/CheckoutModal/ConfirmationStep/CheckoutPrimaryInfo.tsx
|
|
21258
21512
|
import React150 from "react";
|
|
21259
21513
|
|
|
21260
21514
|
// src/components/AnimatedDollarValue/AnimatedDollarValue.tsx
|
|
21261
21515
|
import NumberFlow2 from "@number-flow/react";
|
|
21262
|
-
import React148, { forwardRef as forwardRef4, useMemo as
|
|
21516
|
+
import React148, { forwardRef as forwardRef4, useMemo as useMemo33 } from "react";
|
|
21263
21517
|
var AnimatedDollarValue = forwardRef4((props, ref) => {
|
|
21264
21518
|
const { value, dynamicMinFractionDigits, ...restProps } = props;
|
|
21265
21519
|
const minimumFractionDigits = typeof value === "number" && !Number.isInteger(value) || !dynamicMinFractionDigits ? 2 : 0;
|
|
21266
|
-
const formatOptions =
|
|
21520
|
+
const formatOptions = useMemo33(
|
|
21267
21521
|
() => ({
|
|
21268
21522
|
style: "currency",
|
|
21269
21523
|
currency: "USD",
|
|
@@ -21412,7 +21666,7 @@ function CheckoutPrimaryInfo({
|
|
|
21412
21666
|
}
|
|
21413
21667
|
|
|
21414
21668
|
// src/modals/CheckoutModal/ConfirmationStep/DisclaimerText.tsx
|
|
21415
|
-
import React151, { useMemo as
|
|
21669
|
+
import React151, { useMemo as useMemo34 } from "react";
|
|
21416
21670
|
import { Trans as Trans8 } from "react-i18next";
|
|
21417
21671
|
var FunLinkButtonComponent = ({
|
|
21418
21672
|
children,
|
|
@@ -21487,7 +21741,7 @@ var DisclaimerText = ({
|
|
|
21487
21741
|
};
|
|
21488
21742
|
function useCardDisclaimer(checkoutItem, finalConvertedAssetName) {
|
|
21489
21743
|
const { t } = useFunkitTranslation();
|
|
21490
|
-
const cardDisclaimer =
|
|
21744
|
+
const cardDisclaimer = useMemo34(() => {
|
|
21491
21745
|
if (!checkoutItem || !finalConvertedAssetName) {
|
|
21492
21746
|
return null;
|
|
21493
21747
|
}
|
|
@@ -21694,14 +21948,14 @@ import { useAccount as useAccount6, useSendTransaction, useWriteContract } from
|
|
|
21694
21948
|
|
|
21695
21949
|
// src/utils/isMainnetUsdt.ts
|
|
21696
21950
|
import { isTokenEquivalent as isTokenEquivalent3 } from "@funkit/utils";
|
|
21697
|
-
import { mainnet as
|
|
21951
|
+
import { mainnet as mainnet9 } from "viem/chains";
|
|
21698
21952
|
var USDT_MAINNET_ADDRESS = "0xdAC17F958D2ee523a2206206994597C13D831ec7";
|
|
21699
21953
|
function isMainnetUsdt(chainId, address) {
|
|
21700
21954
|
return isTokenEquivalent3({
|
|
21701
21955
|
firstTokenAddress: address,
|
|
21702
21956
|
firstTokenChainId: chainId.toString(),
|
|
21703
21957
|
secondTokenAddress: USDT_MAINNET_ADDRESS,
|
|
21704
|
-
secondTokenChainId:
|
|
21958
|
+
secondTokenChainId: mainnet9.id.toString()
|
|
21705
21959
|
});
|
|
21706
21960
|
}
|
|
21707
21961
|
|
|
@@ -21974,7 +22228,7 @@ function usePostCheckout({
|
|
|
21974
22228
|
}
|
|
21975
22229
|
|
|
21976
22230
|
// src/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.ts
|
|
21977
|
-
import { useCallback as useCallback34, useEffect as useEffect42, useMemo as
|
|
22231
|
+
import { useCallback as useCallback34, useEffect as useEffect42, useMemo as useMemo35, useRef as useRef23, useState as useState50 } from "react";
|
|
21978
22232
|
|
|
21979
22233
|
// src/hooks/useCountdown.tsx
|
|
21980
22234
|
import React155 from "react";
|
|
@@ -22172,8 +22426,8 @@ function useQuoteRefresh({
|
|
|
22172
22426
|
refreshIntervalSeconds
|
|
22173
22427
|
}) {
|
|
22174
22428
|
const { setCheckoutQuote, isQuoting, quoteErrorMessage, quoteStepMessage } = useQuoteContext();
|
|
22175
|
-
const preloadedQuoteRef =
|
|
22176
|
-
const quoteCallbackRef =
|
|
22429
|
+
const preloadedQuoteRef = useRef23();
|
|
22430
|
+
const quoteCallbackRef = useRef23();
|
|
22177
22431
|
const [isPendingRefresh, setIsPendingRefresh] = useState50(false);
|
|
22178
22432
|
const {
|
|
22179
22433
|
isSourceAssetConfirming,
|
|
@@ -22237,7 +22491,7 @@ function useQuoteRefresh({
|
|
|
22237
22491
|
},
|
|
22238
22492
|
[isOnHold, restartCountdown, setCheckoutQuote, triggerAssetConfirm]
|
|
22239
22493
|
);
|
|
22240
|
-
const quoteError =
|
|
22494
|
+
const quoteError = useMemo35(() => {
|
|
22241
22495
|
if (quoteErrorMessage && !isQuoting) {
|
|
22242
22496
|
return {
|
|
22243
22497
|
message: quoteErrorMessage,
|
|
@@ -22375,7 +22629,7 @@ function ConfirmationStep({
|
|
|
22375
22629
|
})
|
|
22376
22630
|
);
|
|
22377
22631
|
const error = confirmationError ?? postCheckoutError ?? quoteError;
|
|
22378
|
-
const stepMessage =
|
|
22632
|
+
const stepMessage = useMemo36(() => {
|
|
22379
22633
|
if (initialQuoteStep) {
|
|
22380
22634
|
return initialQuoteStep;
|
|
22381
22635
|
}
|
|
@@ -22433,7 +22687,7 @@ function ConfirmationStep({
|
|
|
22433
22687
|
const isQuoteLoading = isInitialQuoting || isQuoting;
|
|
22434
22688
|
const isStepLoading = isInitialQuoting || isContinuing || isRefreshing;
|
|
22435
22689
|
const customRecipient = checkoutItem?.initSettings.config.customRecipient;
|
|
22436
|
-
const showKatanaBridgeAlert =
|
|
22690
|
+
const showKatanaBridgeAlert = useMemo36(() => {
|
|
22437
22691
|
const relayQuoteMetadata = latestQuote?.baseQuote?.metadata;
|
|
22438
22692
|
if (!relayQuoteMetadata) {
|
|
22439
22693
|
return false;
|
|
@@ -22664,7 +22918,7 @@ import React173, { useEffect as useEffect45 } from "react";
|
|
|
22664
22918
|
|
|
22665
22919
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
22666
22920
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
22667
|
-
import { useQuery as
|
|
22921
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
22668
22922
|
var getPriority = (currencyCode) => {
|
|
22669
22923
|
if (currencyCode === "USD") {
|
|
22670
22924
|
return 0;
|
|
@@ -22676,7 +22930,7 @@ var getPriority = (currencyCode) => {
|
|
|
22676
22930
|
};
|
|
22677
22931
|
var useMeldCurrencies = (isEnabled = true) => {
|
|
22678
22932
|
const { apiKey } = useFunkitConfig();
|
|
22679
|
-
const query =
|
|
22933
|
+
const query = useQuery16({
|
|
22680
22934
|
queryKey: ["meld", "currencies"],
|
|
22681
22935
|
queryFn: async () => {
|
|
22682
22936
|
if (!apiKey) {
|
|
@@ -22702,7 +22956,7 @@ var useMeldCurrencies = (isEnabled = true) => {
|
|
|
22702
22956
|
|
|
22703
22957
|
// src/hooks/queries/useMeldDefaultCurrency.ts
|
|
22704
22958
|
import { getMeldDefaultFiat } from "@funkit/api-base";
|
|
22705
|
-
import { useQuery as
|
|
22959
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
22706
22960
|
|
|
22707
22961
|
// src/hooks/queries/useMeldCryptoCurrencyCode.ts
|
|
22708
22962
|
import { FlagKey as FlagKey15 } from "@funkit/utils";
|
|
@@ -22748,7 +23002,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
22748
23002
|
const { apiKey } = useFunkitConfig();
|
|
22749
23003
|
const { userIpInfo } = useFunkitUserIp();
|
|
22750
23004
|
const enableMeld = useIsMeldEnabled();
|
|
22751
|
-
const query =
|
|
23005
|
+
const query = useQuery17({
|
|
22752
23006
|
queryKey: ["meld", "defaultCurrency", paymentMethod],
|
|
22753
23007
|
queryFn: async () => {
|
|
22754
23008
|
if (!apiKey) {
|
|
@@ -22773,7 +23027,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
22773
23027
|
// src/hooks/queries/useMeldLimits.ts
|
|
22774
23028
|
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
22775
23029
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify6 } from "@funkit/utils";
|
|
22776
|
-
import { useQuery as
|
|
23030
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
22777
23031
|
|
|
22778
23032
|
// src/consts/meld.ts
|
|
22779
23033
|
var MELD_MIN_LIMIT_BUFFER = 5;
|
|
@@ -22805,9 +23059,9 @@ var getExchangeRate = (currency, currencyExchangeRates, bipsMarkup = DEFAULT_BIP
|
|
|
22805
23059
|
|
|
22806
23060
|
// src/hooks/useFiatExchangeRates.ts
|
|
22807
23061
|
import { getFiatExchangeRates } from "@funkit/api-base";
|
|
22808
|
-
import { useQuery as
|
|
23062
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
22809
23063
|
function useFiatExchangeRates(enabled = true) {
|
|
22810
|
-
const { data, isLoading, error } =
|
|
23064
|
+
const { data, isLoading, error } = useQuery18({
|
|
22811
23065
|
queryKey: ["fiatExchangeRates"],
|
|
22812
23066
|
queryFn: () => getFiatExchangeRates(),
|
|
22813
23067
|
refetchOnMount: false,
|
|
@@ -22852,7 +23106,7 @@ var useMeldLimits = (isEnabled = true) => {
|
|
|
22852
23106
|
const { userIpInfo } = useFunkitUserIp();
|
|
22853
23107
|
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
22854
23108
|
const countryCode = userIpInfo?.alpha2;
|
|
22855
|
-
const query =
|
|
23109
|
+
const query = useQuery19({
|
|
22856
23110
|
queryKey: ["meld", "limits", countryCode, cryptoCurrency],
|
|
22857
23111
|
queryFn: async () => {
|
|
22858
23112
|
if (!apiKey || !countryCode) {
|
|
@@ -22935,23 +23189,23 @@ var useMeldLimitError = (amount, fiatCurrency) => {
|
|
|
22935
23189
|
|
|
22936
23190
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoaded.tsx
|
|
22937
23191
|
import {
|
|
22938
|
-
FlagKey as
|
|
23192
|
+
FlagKey as FlagKey17,
|
|
22939
23193
|
formatCryptoAndStringify as formatCryptoAndStringify5,
|
|
22940
23194
|
formatCurrencyAndStringify as formatCurrencyAndStringify9,
|
|
22941
23195
|
isTokenEquivalent as isTokenEquivalent4,
|
|
22942
23196
|
round as round2
|
|
22943
23197
|
} from "@funkit/utils";
|
|
22944
23198
|
import { motion as motion11 } from "motion/react";
|
|
22945
|
-
import React171, { useMemo as
|
|
23199
|
+
import React171, { useMemo as useMemo38 } from "react";
|
|
22946
23200
|
|
|
22947
23201
|
// src/components/AnimatedWidthWrapper/AnimatedWidthWrapper.tsx
|
|
22948
23202
|
import { motion as motion10 } from "motion/react";
|
|
22949
23203
|
import React159 from "react";
|
|
22950
|
-
import { useEffect as useEffect44, useRef as
|
|
23204
|
+
import { useEffect as useEffect44, useRef as useRef24, useState as useState52 } from "react";
|
|
22951
23205
|
function AnimatedWidthWrapper({ children }) {
|
|
22952
|
-
const containerRef =
|
|
22953
|
-
const animationFrameRef =
|
|
22954
|
-
const resizeObserverRef =
|
|
23206
|
+
const containerRef = useRef24(null);
|
|
23207
|
+
const animationFrameRef = useRef24(null);
|
|
23208
|
+
const resizeObserverRef = useRef24(null);
|
|
22955
23209
|
const [width, setWidth] = useState52("auto");
|
|
22956
23210
|
useEffect44(() => {
|
|
22957
23211
|
if (containerRef.current) {
|
|
@@ -23701,6 +23955,7 @@ var SourcePaymentMethodItem = ({
|
|
|
23701
23955
|
};
|
|
23702
23956
|
|
|
23703
23957
|
// src/components/YouPayYouReceive/YouPayYouReceive.tsx
|
|
23958
|
+
import { LIGHTER_CHAIN_ID as LIGHTER_CHAIN_ID2 } from "@funkit/chains";
|
|
23704
23959
|
import { isMobile as isMobile5 } from "@funkit/utils";
|
|
23705
23960
|
import React164 from "react";
|
|
23706
23961
|
|
|
@@ -23746,6 +24001,8 @@ var YouPayYouReceive = ({
|
|
|
23746
24001
|
prioritizeDefaults = true,
|
|
23747
24002
|
isYouPayChainIconHidden
|
|
23748
24003
|
}) => {
|
|
24004
|
+
const { apiKey } = useFunkitConfig();
|
|
24005
|
+
const patchedReceiveChainId = isLighterxyzCustomer(apiKey) ? LIGHTER_CHAIN_ID2 : receiveTokenChainId;
|
|
23749
24006
|
return /* @__PURE__ */ React164.createElement(
|
|
23750
24007
|
Box,
|
|
23751
24008
|
{
|
|
@@ -23835,7 +24092,7 @@ var YouPayYouReceive = ({
|
|
|
23835
24092
|
assetTicker: receiveTokenSymbol,
|
|
23836
24093
|
assetName: receiveTokenSymbol,
|
|
23837
24094
|
assetSrc: receiveTokenIconSrc,
|
|
23838
|
-
chainId:
|
|
24095
|
+
chainId: patchedReceiveChainId,
|
|
23839
24096
|
prioritizeDefaults
|
|
23840
24097
|
}
|
|
23841
24098
|
), /* @__PURE__ */ React164.createElement(Box, { display: "flex", flexDirection: "column" }, /* @__PURE__ */ React164.createElement(Text, { size: "10", color: "youPayYouReceiveSecondaryText" }, receiveLabel), /* @__PURE__ */ React164.createElement(Text, { size: "12", color: "youPayYouReceivePrimaryText" }, receiveTokenSymbol)))
|
|
@@ -23988,7 +24245,7 @@ function InputAmountLayout({
|
|
|
23988
24245
|
}
|
|
23989
24246
|
|
|
23990
24247
|
// src/modals/CheckoutModal/InputAmount/QuickOptions.tsx
|
|
23991
|
-
import {
|
|
24248
|
+
import { clamp as clamp2, formatCurrencyAndStringify as formatCurrencyAndStringify7 } from "@funkit/utils";
|
|
23992
24249
|
import React167 from "react";
|
|
23993
24250
|
var USD_AMOUNT_OPTIONS_PCT = [25, 50, 75, 100];
|
|
23994
24251
|
function deduplicateArray(arr) {
|
|
@@ -23996,10 +24253,7 @@ function deduplicateArray(arr) {
|
|
|
23996
24253
|
}
|
|
23997
24254
|
function useFiatAmountOptions(currency) {
|
|
23998
24255
|
const isMeldEnabled = useIsMeldEnabled();
|
|
23999
|
-
const
|
|
24000
|
-
const currencyQuickOption = safeJSONParse(
|
|
24001
|
-
currencyQuickOptionStr
|
|
24002
|
-
);
|
|
24256
|
+
const currencyQuickOption = useDynamicConfig("meldquickoptions");
|
|
24003
24257
|
const { data: meldLimit, isPending } = useMeldLimit(currency);
|
|
24004
24258
|
if (isPending || !meldLimit || !isMeldEnabled) {
|
|
24005
24259
|
return [];
|
|
@@ -24007,9 +24261,7 @@ function useFiatAmountOptions(currency) {
|
|
|
24007
24261
|
const minimumAmount = meldLimit.minimumAmount;
|
|
24008
24262
|
const maximumAmount = meldLimit.maximumAmount;
|
|
24009
24263
|
return deduplicateArray(
|
|
24010
|
-
currencyQuickOption?.[currency ?? "USD"]?.map(
|
|
24011
|
-
(val) => clamp2(val, minimumAmount, maximumAmount)
|
|
24012
|
-
) || []
|
|
24264
|
+
currencyQuickOption?.[currency ?? "USD"]?.map((val) => clamp2(val, minimumAmount, maximumAmount)) || []
|
|
24013
24265
|
);
|
|
24014
24266
|
}
|
|
24015
24267
|
var QuickOptions = ({
|
|
@@ -24058,9 +24310,9 @@ var QuickOptions = ({
|
|
|
24058
24310
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
24059
24311
|
import {
|
|
24060
24312
|
useCallback as useCallback36,
|
|
24061
|
-
useMemo as
|
|
24313
|
+
useMemo as useMemo37,
|
|
24062
24314
|
useReducer as useReducer3,
|
|
24063
|
-
useRef as
|
|
24315
|
+
useRef as useRef25,
|
|
24064
24316
|
useState as useState54
|
|
24065
24317
|
} from "react";
|
|
24066
24318
|
|
|
@@ -24373,11 +24625,11 @@ function useAmountInput(options) {
|
|
|
24373
24625
|
quickOptions,
|
|
24374
24626
|
paymentMethodInfo
|
|
24375
24627
|
} = options;
|
|
24376
|
-
const derivedState =
|
|
24628
|
+
const derivedState = useMemo37(
|
|
24377
24629
|
() => getDerivedState(state, checkoutConfig.targetAssetTicker),
|
|
24378
24630
|
[state, checkoutConfig]
|
|
24379
24631
|
);
|
|
24380
|
-
const inputRef =
|
|
24632
|
+
const inputRef = useRef25(null);
|
|
24381
24633
|
const { inputValue, locale } = state;
|
|
24382
24634
|
const { inputDecimals, inputAffix, placeholder } = derivedState;
|
|
24383
24635
|
const { measureText } = useTextMeasurer(inputRef);
|
|
@@ -24937,6 +25189,12 @@ function withMoonpayMeldQuote(quotes) {
|
|
|
24937
25189
|
if (!quotes) {
|
|
24938
25190
|
return quotes;
|
|
24939
25191
|
}
|
|
25192
|
+
if (quotes.length === 0) {
|
|
25193
|
+
logger.error("withMoonpayMeldQuote:error", {
|
|
25194
|
+
message: "No quotes could be found."
|
|
25195
|
+
});
|
|
25196
|
+
return quotes;
|
|
25197
|
+
}
|
|
24940
25198
|
const topQuote = quotes[0];
|
|
24941
25199
|
const moonpay = createMoonpayMeldQuote(topQuote);
|
|
24942
25200
|
return [moonpay, ...quotes].sort(
|
|
@@ -24978,7 +25236,7 @@ var useMeldLink = (sourceAmount, sourceCurrencyCode = "USD") => {
|
|
|
24978
25236
|
|
|
24979
25237
|
// src/modals/CheckoutModal/MeldQuotes/useMeldQuotes.tsx
|
|
24980
25238
|
import { getMeldQuotes } from "@funkit/api-base";
|
|
24981
|
-
import { useQuery as
|
|
25239
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
24982
25240
|
import { useDebounce as useDebounce2 } from "use-debounce";
|
|
24983
25241
|
var DEBOUNCE_DELAY = 500;
|
|
24984
25242
|
var COUNTDOWN_INTERVAL_SEC = 60;
|
|
@@ -24991,7 +25249,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
24991
25249
|
const destinationCurrencyCode = useMeldCryptoCurrencyCode();
|
|
24992
25250
|
const isPolymarket = isPolymarketCustomer(apiKey);
|
|
24993
25251
|
const sourceCurrencyCode = fiatCurrency || "USD";
|
|
24994
|
-
const query =
|
|
25252
|
+
const query = useQuery20({
|
|
24995
25253
|
queryKey: [
|
|
24996
25254
|
"meld",
|
|
24997
25255
|
"quotes",
|
|
@@ -25051,7 +25309,7 @@ import {
|
|
|
25051
25309
|
katanaChain
|
|
25052
25310
|
} from "@funkit/chains";
|
|
25053
25311
|
import { useCallback as useCallback37, useState as useState55 } from "react";
|
|
25054
|
-
import { mainnet as
|
|
25312
|
+
import { mainnet as mainnet10, mantle, zksync as zksync2 } from "viem/chains";
|
|
25055
25313
|
import { getAssetErc20ByChainAndSymbol as getAssetErc20ByChainAndSymbol2 } from "@funkit/api-base";
|
|
25056
25314
|
var pickSourceAssetForCard = async (checkoutItem, userIpInfo, apiKey) => {
|
|
25057
25315
|
if (!checkoutItem?.initSettings.config.targetChain) {
|
|
@@ -25085,7 +25343,7 @@ var pickSourceAssetForCard = async (checkoutItem, userIpInfo, apiKey) => {
|
|
|
25085
25343
|
sourceTokenAddress = NATIVE_TOKEN;
|
|
25086
25344
|
sourceTokenChainId = moonpayChainId;
|
|
25087
25345
|
} else {
|
|
25088
|
-
sourceTokenChainId = isNyOrTxOrVi ?
|
|
25346
|
+
sourceTokenChainId = isNyOrTxOrVi ? mainnet10.id.toString() : moonpayChainId;
|
|
25089
25347
|
if (isTargetAssetEthOrWeth) {
|
|
25090
25348
|
sourceTokenTicker = "ETH" /* ETH */;
|
|
25091
25349
|
sourceTokenAddress = NATIVE_TOKEN;
|
|
@@ -25299,7 +25557,7 @@ function InputAmountLoaded({
|
|
|
25299
25557
|
textCustomizations
|
|
25300
25558
|
}) {
|
|
25301
25559
|
const { t } = useFunkitTranslation();
|
|
25302
|
-
const maxCheckoutUsdString = useFlag(
|
|
25560
|
+
const maxCheckoutUsdString = useFlag(FlagKey17.MaxCheckoutUsd);
|
|
25303
25561
|
const isSourceNavWidgetEnabled = modalState.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
25304
25562
|
const paymentMethodInfo = modalState.paymentMethodInfo;
|
|
25305
25563
|
const { quote: manuallySelectedQuote } = modalState;
|
|
@@ -25358,7 +25616,7 @@ function InputAmountLoaded({
|
|
|
25358
25616
|
onNext,
|
|
25359
25617
|
onClose
|
|
25360
25618
|
});
|
|
25361
|
-
const error =
|
|
25619
|
+
const error = useMemo38(() => {
|
|
25362
25620
|
if (isCardCheckout) {
|
|
25363
25621
|
const meldError = getMeldError();
|
|
25364
25622
|
if (meldError) {
|
|
@@ -25760,7 +26018,7 @@ function YouPayYouReceiveWrapper({
|
|
|
25760
26018
|
|
|
25761
26019
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoading.tsx
|
|
25762
26020
|
import { formatCryptoAndStringify as formatCryptoAndStringify6 } from "@funkit/utils";
|
|
25763
|
-
import React172, { useMemo as
|
|
26021
|
+
import React172, { useMemo as useMemo39 } from "react";
|
|
25764
26022
|
function InputAmountLoading({
|
|
25765
26023
|
modalState,
|
|
25766
26024
|
sourceHoldingError,
|
|
@@ -25773,7 +26031,7 @@ function InputAmountLoading({
|
|
|
25773
26031
|
const isSourceNavWidgetEnabled = modalState.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
25774
26032
|
const targetAssetAmount = checkoutItem?.initSettings.config.targetAssetAmount;
|
|
25775
26033
|
const targetAssetTicker = checkoutItem?.initSettings.config.targetAssetTicker;
|
|
25776
|
-
const error =
|
|
26034
|
+
const error = useMemo39(() => {
|
|
25777
26035
|
if (sourceHoldingError) {
|
|
25778
26036
|
return {
|
|
25779
26037
|
message: /* @__PURE__ */ React172.createElement("div", null, t("inputAmount.unableToRetrieveBalance"), " "),
|
|
@@ -25827,7 +26085,7 @@ function InputAmountLoading({
|
|
|
25827
26085
|
icon: /* @__PURE__ */ React172.createElement(SwitchIcon, null),
|
|
25828
26086
|
paddingY: "1",
|
|
25829
26087
|
paddingX: "6",
|
|
25830
|
-
color: { base: "
|
|
26088
|
+
color: { base: "secondaryText" }
|
|
25831
26089
|
},
|
|
25832
26090
|
targetAssetAmount !== void 0 ? /* @__PURE__ */ React172.createElement(Text, { color: "secondaryText", size: "14" }, formatCryptoAndStringify6(
|
|
25833
26091
|
targetAssetAmount,
|
|
@@ -25853,7 +26111,7 @@ function InputAmountLoading({
|
|
|
25853
26111
|
}
|
|
25854
26112
|
|
|
25855
26113
|
// src/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.ts
|
|
25856
|
-
import { useMemo as
|
|
26114
|
+
import { useMemo as useMemo40 } from "react";
|
|
25857
26115
|
function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetChainId, assetSymbol) {
|
|
25858
26116
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
25859
26117
|
const isBrokerage = paymentMethod === "brokerage" /* BROKERAGE */;
|
|
@@ -25868,7 +26126,7 @@ function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetC
|
|
|
25868
26126
|
["virtual_bank" /* VIRTUAL_BANK */]: null
|
|
25869
26127
|
}[paymentMethod];
|
|
25870
26128
|
const isLoading = isBrokerage ? isLoadingBrokerageBalance : isLoadingWalletAssetHoldings;
|
|
25871
|
-
const holdingItem =
|
|
26129
|
+
const holdingItem = useMemo40(() => {
|
|
25872
26130
|
if (!assetSymbol || !holdings) {
|
|
25873
26131
|
return;
|
|
25874
26132
|
}
|
|
@@ -25995,7 +26253,7 @@ function InputAmount(props) {
|
|
|
25995
26253
|
import React176, { useEffect as useEffect46 } from "react";
|
|
25996
26254
|
|
|
25997
26255
|
// src/hooks/usePaymentSources.ts
|
|
25998
|
-
import { FlagKey as
|
|
26256
|
+
import { FlagKey as FlagKey18, isNotNullish as isNotNullish5 } from "@funkit/utils";
|
|
25999
26257
|
function usePaymentMethodEnablement({
|
|
26000
26258
|
checkoutConfig
|
|
26001
26259
|
}) {
|
|
@@ -26003,7 +26261,7 @@ function usePaymentMethodEnablement({
|
|
|
26003
26261
|
const isTokenTransferFlagEnabled = useIsQRCodeTransferEnabled();
|
|
26004
26262
|
const isFiatFlagEnabled = useFiatEnabled();
|
|
26005
26263
|
const isMeldFlagEnabled = useIsMeldEnabled();
|
|
26006
|
-
const isBrokerageFlagEnabled = useFlag(
|
|
26264
|
+
const isBrokerageFlagEnabled = useFlag(FlagKey18.EnableBluvoBrokerage);
|
|
26007
26265
|
const isKatanaEarnFlowAction = isKatanaEarnFlow({ apiKey, checkoutConfig });
|
|
26008
26266
|
const isFiatEnabled = isFiatFlagEnabled && !isKatanaEarnFlowAction;
|
|
26009
26267
|
const isTokenTransferEnabled = isTokenTransferFlagEnabled && !isKatanaEarnFlowAction;
|
|
@@ -26400,7 +26658,7 @@ function LoadingAccount({
|
|
|
26400
26658
|
|
|
26401
26659
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
26402
26660
|
import clsx22 from "clsx";
|
|
26403
|
-
import React177, { useMemo as
|
|
26661
|
+
import React177, { useMemo as useMemo41, useState as useState56 } from "react";
|
|
26404
26662
|
|
|
26405
26663
|
// src/modals/CheckoutModal/MeldCurrencySelect/currenciesWithMultipleCountries.ts
|
|
26406
26664
|
var currenciesWithMultipleCountries = {
|
|
@@ -26460,7 +26718,7 @@ function MeldCurrencySelect({
|
|
|
26460
26718
|
const [selectedCurrency, setSelectedCurrency] = useState56(
|
|
26461
26719
|
defaultCurrency
|
|
26462
26720
|
);
|
|
26463
|
-
const filteredOptions =
|
|
26721
|
+
const filteredOptions = useMemo41(() => {
|
|
26464
26722
|
const newOptions = data?.filter(
|
|
26465
26723
|
({ name, currencyCode }) => currencyCode.toLowerCase().includes(query.toLowerCase()) || name.toLowerCase().includes(query.toLowerCase())
|
|
26466
26724
|
) ?? [];
|
|
@@ -26678,9 +26936,9 @@ import {
|
|
|
26678
26936
|
hyperEvmChain as hyperEvmChain5
|
|
26679
26937
|
} from "@funkit/chains";
|
|
26680
26938
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify11, isTokenEquivalent as isTokenEquivalent5 } from "@funkit/utils";
|
|
26681
|
-
import React182, { useEffect as useEffect47, useMemo as
|
|
26939
|
+
import React182, { useEffect as useEffect47, useMemo as useMemo44, useState as useState57 } from "react";
|
|
26682
26940
|
import { createPortal as createPortal18 } from "react-dom";
|
|
26683
|
-
import { mainnet as
|
|
26941
|
+
import { mainnet as mainnet11 } from "viem/chains";
|
|
26684
26942
|
|
|
26685
26943
|
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
26686
26944
|
import React180 from "react";
|
|
@@ -26776,7 +27034,7 @@ var ReceiveTokenDropdown = ({
|
|
|
26776
27034
|
// src/components/NewTokenDepositAlert/NewTokenDepositAlert.tsx
|
|
26777
27035
|
import React181 from "react";
|
|
26778
27036
|
import { Trans as Trans11 } from "react-i18next";
|
|
26779
|
-
import { FlagKey as
|
|
27037
|
+
import { FlagKey as FlagKey19 } from "@funkit/utils";
|
|
26780
27038
|
var FunLinkButtonComponent2 = ({
|
|
26781
27039
|
children,
|
|
26782
27040
|
onClick,
|
|
@@ -26796,7 +27054,7 @@ var NewTokenDepositAlert = ({
|
|
|
26796
27054
|
onClick
|
|
26797
27055
|
}) => {
|
|
26798
27056
|
const { t } = useFunkitTranslation();
|
|
26799
|
-
const alertJson = useFlag(
|
|
27057
|
+
const alertJson = useFlag(FlagKey19.NewTokenAssetSelectionBanner);
|
|
26800
27058
|
const alertData = useSafeJSONParse(alertJson);
|
|
26801
27059
|
const isTokenTransferEnabled = useIsQRCodeTransferEnabled();
|
|
26802
27060
|
if (!alertData || !isTokenTransferEnabled) {
|
|
@@ -26833,13 +27091,13 @@ var NewTokenDepositAlert = ({
|
|
|
26833
27091
|
|
|
26834
27092
|
// src/hooks/useAllowedAssets.ts
|
|
26835
27093
|
import { getAllowedAssets } from "@funkit/api-base";
|
|
26836
|
-
import { useQuery as
|
|
26837
|
-
import { useCallback as useCallback39, useMemo as
|
|
27094
|
+
import { useQuery as useQuery21 } from "@tanstack/react-query";
|
|
27095
|
+
import { useCallback as useCallback39, useMemo as useMemo42 } from "react";
|
|
26838
27096
|
function useAllowedAssets() {
|
|
26839
27097
|
const { apiKey } = useFunkitConfig();
|
|
26840
27098
|
const { checkoutItem } = useCheckoutContext();
|
|
26841
27099
|
const isRelayEnabled = useSourceTokenRelayEnabled();
|
|
26842
|
-
const { data: allowedAssets, isLoading } =
|
|
27100
|
+
const { data: allowedAssets, isLoading } = useQuery21({
|
|
26843
27101
|
queryKey: ["getAllowedAssets", apiKey],
|
|
26844
27102
|
queryFn: () => getAllowedAssets({ apiKey, logger }),
|
|
26845
27103
|
refetchOnMount: false,
|
|
@@ -26848,7 +27106,7 @@ function useAllowedAssets() {
|
|
|
26848
27106
|
staleTime: 5 * 60 * 1e3,
|
|
26849
27107
|
gcTime: Number.POSITIVE_INFINITY
|
|
26850
27108
|
});
|
|
26851
|
-
const tokens =
|
|
27109
|
+
const tokens = useMemo42(() => {
|
|
26852
27110
|
if (!allowedAssets) {
|
|
26853
27111
|
return {};
|
|
26854
27112
|
}
|
|
@@ -26881,6 +27139,32 @@ function useAllowedAssets() {
|
|
|
26881
27139
|
};
|
|
26882
27140
|
}
|
|
26883
27141
|
|
|
27142
|
+
// src/hooks/useDynamicRoutes.ts
|
|
27143
|
+
import { useMemo as useMemo43 } from "react";
|
|
27144
|
+
import { DYNAMIC_ROUTES, initDynamicRouting } from "@funkit/fun-relay";
|
|
27145
|
+
var toMutable = (obj) => {
|
|
27146
|
+
return obj;
|
|
27147
|
+
};
|
|
27148
|
+
var useDynamicRoutes = (_dynamicRoutingId) => {
|
|
27149
|
+
const dynamicRoutingConfig = useDynamicConfig("dynamicrouting");
|
|
27150
|
+
const { checkoutItem } = useCheckoutContext();
|
|
27151
|
+
const config = checkoutItem?.initSettings.config;
|
|
27152
|
+
const dynamicRoutingId = _dynamicRoutingId || config?.dynamicRoutingId;
|
|
27153
|
+
const findPath = useMemo43(() => {
|
|
27154
|
+
if (!dynamicRoutingId) {
|
|
27155
|
+
return () => null;
|
|
27156
|
+
}
|
|
27157
|
+
const indexedDynamicRoutes = initDynamicRouting(
|
|
27158
|
+
DYNAMIC_ROUTES,
|
|
27159
|
+
toMutable(dynamicRoutingConfig)
|
|
27160
|
+
);
|
|
27161
|
+
return indexedDynamicRoutes[dynamicRoutingId].findPath;
|
|
27162
|
+
}, [dynamicRoutingId, dynamicRoutingConfig]);
|
|
27163
|
+
return {
|
|
27164
|
+
findPath
|
|
27165
|
+
};
|
|
27166
|
+
};
|
|
27167
|
+
|
|
26884
27168
|
// src/modals/CheckoutModal/SelectAsset.tsx
|
|
26885
27169
|
var ASSET_ITEM_HEIGHT = 52;
|
|
26886
27170
|
var VISIBLE_ITEMS_COUNT = 5;
|
|
@@ -26923,12 +27207,12 @@ function useEnrichedAccountHoldings({
|
|
|
26923
27207
|
accountHoldings,
|
|
26924
27208
|
targetAssetInfo
|
|
26925
27209
|
}) {
|
|
26926
|
-
const { apiKey } = useFunkitConfig();
|
|
26927
27210
|
const { t } = useFunkitTranslation();
|
|
26928
27211
|
const { isAllowed, isLoading } = useAllowedAssets();
|
|
26929
27212
|
const { walletAddress } = useGeneralWallet();
|
|
26930
27213
|
const minTransferLimits = useMinTransferLimits();
|
|
26931
|
-
const
|
|
27214
|
+
const isDynamicRoutingEnabled = useIsDynamicRoutingEnabled();
|
|
27215
|
+
const enrichedAccountHoldings = useMemo44(() => {
|
|
26932
27216
|
if (!checkoutConfig) {
|
|
26933
27217
|
return [];
|
|
26934
27218
|
}
|
|
@@ -26940,7 +27224,6 @@ function useEnrichedAccountHoldings({
|
|
|
26940
27224
|
minUsdRequired = minUsd;
|
|
26941
27225
|
}
|
|
26942
27226
|
const usableForCheckout = isAssetUsableToPayForCheckout({
|
|
26943
|
-
apiKey,
|
|
26944
27227
|
config: checkoutConfig,
|
|
26945
27228
|
targetTokenAddress: targetAssetInfo.tokenAddress,
|
|
26946
27229
|
targetChainId: targetAssetInfo.tokenChainId,
|
|
@@ -26954,12 +27237,12 @@ function useEnrichedAccountHoldings({
|
|
|
26954
27237
|
asset.pickedChainId,
|
|
26955
27238
|
asset.tokenAddress
|
|
26956
27239
|
),
|
|
27240
|
+
isDynamicRoutingEnabled,
|
|
26957
27241
|
t
|
|
26958
27242
|
});
|
|
26959
27243
|
return { asset, usableForCheckout };
|
|
26960
27244
|
});
|
|
26961
27245
|
}, [
|
|
26962
|
-
apiKey,
|
|
26963
27246
|
accountHoldings,
|
|
26964
27247
|
checkoutConfig,
|
|
26965
27248
|
isAllowed,
|
|
@@ -26967,6 +27250,7 @@ function useEnrichedAccountHoldings({
|
|
|
26967
27250
|
walletAddress,
|
|
26968
27251
|
targetAssetInfo,
|
|
26969
27252
|
minTransferLimits,
|
|
27253
|
+
isDynamicRoutingEnabled,
|
|
26970
27254
|
t
|
|
26971
27255
|
]);
|
|
26972
27256
|
return { enrichedAccountHoldings, isLoading };
|
|
@@ -26979,7 +27263,8 @@ function useAssetOptions({
|
|
|
26979
27263
|
}) {
|
|
26980
27264
|
const { apiKey } = useFunkitConfig();
|
|
26981
27265
|
const { t } = useFunkitTranslation();
|
|
26982
|
-
const
|
|
27266
|
+
const { findPath } = useDynamicRoutes();
|
|
27267
|
+
const assetOptions = useMemo44(() => {
|
|
26983
27268
|
return enrichedAccountHoldings.filter(
|
|
26984
27269
|
({ asset }) => chainId !== void 0 ? asset.pickedChainId === chainId.toString() : true
|
|
26985
27270
|
).map(({ asset, usableForCheckout }) => {
|
|
@@ -27001,7 +27286,12 @@ function useAssetOptions({
|
|
|
27001
27286
|
badgeText = reason;
|
|
27002
27287
|
} else if (!isKnown) {
|
|
27003
27288
|
badgeText = t("badge.unknown");
|
|
27004
|
-
} else if (isTreatedAsNativeToken(
|
|
27289
|
+
} else if (isTreatedAsNativeToken(
|
|
27290
|
+
apiKey,
|
|
27291
|
+
asset,
|
|
27292
|
+
dynamicTargetAssetCandidates,
|
|
27293
|
+
findPath
|
|
27294
|
+
)) {
|
|
27005
27295
|
badgeText = "Native";
|
|
27006
27296
|
if (showsNativeTokensOnTop(apiKey)) {
|
|
27007
27297
|
priority = 1e3;
|
|
@@ -27030,7 +27320,8 @@ function useAssetOptions({
|
|
|
27030
27320
|
enrichedAccountHoldings,
|
|
27031
27321
|
chainId,
|
|
27032
27322
|
userSelectedTargetAsset,
|
|
27033
|
-
dynamicTargetAssetCandidates
|
|
27323
|
+
dynamicTargetAssetCandidates,
|
|
27324
|
+
findPath
|
|
27034
27325
|
]);
|
|
27035
27326
|
return assetOptions;
|
|
27036
27327
|
}
|
|
@@ -27076,7 +27367,19 @@ function AccountSelectAsset({
|
|
|
27076
27367
|
const { t } = useFunkitTranslation();
|
|
27077
27368
|
const [selectedChainId, setSelectedChainId] = useState57();
|
|
27078
27369
|
const { apiKey, textCustomizations, uiCustomizations } = useFunkitConfig();
|
|
27079
|
-
const {
|
|
27370
|
+
const {
|
|
27371
|
+
checkoutItem,
|
|
27372
|
+
updateSourceAsset,
|
|
27373
|
+
updateTargetAsset,
|
|
27374
|
+
applyDynamicRouting
|
|
27375
|
+
} = useCheckoutContext();
|
|
27376
|
+
const { walletAddress } = useGeneralWallet();
|
|
27377
|
+
const isLighter = isLighterxyzCustomer(apiKey);
|
|
27378
|
+
const { mainAccountIndex } = useLighterAccounts({
|
|
27379
|
+
address: walletAddress || "0x",
|
|
27380
|
+
isEnabled: isLighter && !!walletAddress && walletAddress !== "0x"
|
|
27381
|
+
});
|
|
27382
|
+
const { findPath } = useDynamicRoutes();
|
|
27080
27383
|
const { setSelectedBrokerageAsset } = useFunkitBrokerageContext();
|
|
27081
27384
|
const [explicitlySelectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState57("");
|
|
27082
27385
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
@@ -27099,6 +27402,37 @@ function AccountSelectAsset({
|
|
|
27099
27402
|
});
|
|
27100
27403
|
const showTargetAssetSelection = isTargetAssetSelectable && uiCustomizations.selectAssetScreen.showTargetAssetSelection;
|
|
27101
27404
|
const handleTargetAssetUpdate = (tokenItem) => {
|
|
27405
|
+
const dynamicPath = findPath({
|
|
27406
|
+
chainId: tokenItem.pickedChainId,
|
|
27407
|
+
tokenAddress: tokenItem.tokenAddress
|
|
27408
|
+
});
|
|
27409
|
+
if (dynamicPath) {
|
|
27410
|
+
if (!walletAddress) {
|
|
27411
|
+
logger.error("handleTargetAssetUpdate_missingWalletAddress", {
|
|
27412
|
+
tokenItem,
|
|
27413
|
+
dynamicPath
|
|
27414
|
+
});
|
|
27415
|
+
return;
|
|
27416
|
+
}
|
|
27417
|
+
if (!mainAccountIndex) {
|
|
27418
|
+
logger.error("handleTargetAssetUpdate_missingMainAccountIndex", {
|
|
27419
|
+
tokenItem,
|
|
27420
|
+
dynamicPath
|
|
27421
|
+
});
|
|
27422
|
+
}
|
|
27423
|
+
applyDynamicRouting({
|
|
27424
|
+
targetAsset: dynamicPath.path.targetAsset,
|
|
27425
|
+
targetChain: dynamicPath.path.targetChain,
|
|
27426
|
+
targetAssetTicker: dynamicPath.path.targetAssetTicker,
|
|
27427
|
+
iconSrc: dynamicPath.path.iconSrc,
|
|
27428
|
+
generateActionsParams: walletAddress ? dynamicPath.path.generateActionsParams?.(walletAddress) : void 0,
|
|
27429
|
+
customRecipient: dynamicPath.path.getCustomRecipient?.({
|
|
27430
|
+
address: walletAddress,
|
|
27431
|
+
l2Address: mainAccountIndex
|
|
27432
|
+
})
|
|
27433
|
+
});
|
|
27434
|
+
return;
|
|
27435
|
+
}
|
|
27102
27436
|
if (!isTargetAssetSelectable) {
|
|
27103
27437
|
return;
|
|
27104
27438
|
}
|
|
@@ -27145,7 +27479,7 @@ function AccountSelectAsset({
|
|
|
27145
27479
|
handleTargetAssetUpdate(tokenItem);
|
|
27146
27480
|
onFinish();
|
|
27147
27481
|
});
|
|
27148
|
-
const selectedChainTokenSymbol =
|
|
27482
|
+
const selectedChainTokenSymbol = useMemo44(() => {
|
|
27149
27483
|
if (explicitlySelectedChainTokenSymbol) {
|
|
27150
27484
|
const assetExists = assetOptions.find(
|
|
27151
27485
|
({ asset }) => asset.chainSymbolKey === explicitlySelectedChainTokenSymbol
|
|
@@ -27429,10 +27763,17 @@ function SelectAsset({
|
|
|
27429
27763
|
}
|
|
27430
27764
|
));
|
|
27431
27765
|
}
|
|
27432
|
-
function isTreatedAsNativeToken(apiKey, asset, dynamicTargetAssetCandidates) {
|
|
27766
|
+
function isTreatedAsNativeToken(apiKey, asset, dynamicTargetAssetCandidates, findDynamicPath) {
|
|
27767
|
+
const dynamicPath = findDynamicPath({
|
|
27768
|
+
chainId: asset.pickedChainId,
|
|
27769
|
+
tokenAddress: asset.tokenAddress
|
|
27770
|
+
});
|
|
27771
|
+
if (dynamicPath) {
|
|
27772
|
+
return dynamicPath.badge === "NATIVE";
|
|
27773
|
+
}
|
|
27433
27774
|
if (isEtherealCustomer(apiKey)) {
|
|
27434
27775
|
if (isTokenEquivalent5({
|
|
27435
|
-
firstTokenChainId:
|
|
27776
|
+
firstTokenChainId: mainnet11.id.toString(),
|
|
27436
27777
|
firstTokenAddress: "0x90d2af7d622ca3141efa4d8f1f24d86e5974cc8f",
|
|
27437
27778
|
// eUSDe (Ethereum)
|
|
27438
27779
|
secondTokenChainId: asset.pickedChainId,
|
|
@@ -27858,7 +28199,7 @@ function SourceChange({
|
|
|
27858
28199
|
|
|
27859
28200
|
// src/modals/CheckoutModal/TransferToken/TransferToken.tsx
|
|
27860
28201
|
import { motion as motion13, useAnimationControls as useAnimationControls3 } from "motion/react";
|
|
27861
|
-
import React196, { useRef as
|
|
28202
|
+
import React196, { useRef as useRef26, useState as useState62 } from "react";
|
|
27862
28203
|
import { createPortal as createPortal20 } from "react-dom";
|
|
27863
28204
|
|
|
27864
28205
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
@@ -27975,12 +28316,12 @@ function CopyInputDisplayedAddress(props) {
|
|
|
27975
28316
|
}
|
|
27976
28317
|
|
|
27977
28318
|
// src/components/FunInfoBanner/ChainInfoBanners.tsx
|
|
27978
|
-
import { FlagKey as
|
|
28319
|
+
import { FlagKey as FlagKey20 } from "@funkit/utils";
|
|
27979
28320
|
import React186 from "react";
|
|
27980
28321
|
var ChainInfoBanners = ({
|
|
27981
28322
|
chainId
|
|
27982
28323
|
}) => {
|
|
27983
|
-
const chainInfoBanners = useFlag(
|
|
28324
|
+
const chainInfoBanners = useFlag(FlagKey20.ChainInfoBanners);
|
|
27984
28325
|
const chainInfoBannersData = useSafeJSONParse(chainInfoBanners) ?? {};
|
|
27985
28326
|
try {
|
|
27986
28327
|
const chainBanners = chainInfoBannersData[chainId] ?? [];
|
|
@@ -28002,7 +28343,7 @@ var ChainInfoBanners = ({
|
|
|
28002
28343
|
|
|
28003
28344
|
// src/components/QRCode/QRCode.tsx
|
|
28004
28345
|
import QRCodeUtil from "qrcode";
|
|
28005
|
-
import React187, { useMemo as
|
|
28346
|
+
import React187, { useMemo as useMemo45 } from "react";
|
|
28006
28347
|
var generateMatrix = (value, errorCorrectionLevel) => {
|
|
28007
28348
|
const { data } = QRCodeUtil.create(value, { errorCorrectionLevel }).modules;
|
|
28008
28349
|
const sqrt = Math.sqrt(data.length);
|
|
@@ -28030,7 +28371,7 @@ function QRCode({
|
|
|
28030
28371
|
}) {
|
|
28031
28372
|
const { activeTheme } = useActiveTheme();
|
|
28032
28373
|
const size = sizeProp - Number.parseInt(outsidePadding, 10) * 2;
|
|
28033
|
-
const dots =
|
|
28374
|
+
const dots = useMemo45(() => {
|
|
28034
28375
|
const dots2 = [];
|
|
28035
28376
|
const matrix = generateMatrix(uri, ecl);
|
|
28036
28377
|
const cellSize = size / matrix.length;
|
|
@@ -28596,7 +28937,7 @@ function TransferToken({
|
|
|
28596
28937
|
const { checkoutItem } = useCheckoutContext();
|
|
28597
28938
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
28598
28939
|
const { transferToken } = modalState;
|
|
28599
|
-
const disclaimerTextWrapperRef =
|
|
28940
|
+
const disclaimerTextWrapperRef = useRef26(null);
|
|
28600
28941
|
const { transferInit } = useCheckoutTransferInit();
|
|
28601
28942
|
const {
|
|
28602
28943
|
assets,
|
|
@@ -29264,7 +29605,7 @@ var FiatAccountDetail = {
|
|
|
29264
29605
|
|
|
29265
29606
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
29266
29607
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
29267
|
-
import React203, { useCallback as useCallback43, useEffect as useEffect50, useMemo as
|
|
29608
|
+
import React203, { useCallback as useCallback43, useEffect as useEffect50, useMemo as useMemo46, useState as useState64 } from "react";
|
|
29268
29609
|
function useIframeListener(listeners) {
|
|
29269
29610
|
const handleMessage = useCallback43(
|
|
29270
29611
|
(event) => {
|
|
@@ -29318,7 +29659,7 @@ function KycIframe({
|
|
|
29318
29659
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
29319
29660
|
const { data: kycLink, isLoading: isLinkLoading } = useLoadKycLink(modalState);
|
|
29320
29661
|
const [iframeLoading, setIframeLoading] = useState64(true);
|
|
29321
|
-
const listeners =
|
|
29662
|
+
const listeners = useMemo46(
|
|
29322
29663
|
() => ({
|
|
29323
29664
|
load: () => {
|
|
29324
29665
|
logger.info("KYC iframe loaded");
|
|
@@ -29512,30 +29853,51 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
29512
29853
|
[logEvent]
|
|
29513
29854
|
);
|
|
29514
29855
|
const { clearCheckoutQuoteMessages } = useCheckoutQuoteNotification();
|
|
29856
|
+
const { getCheckoutProgress } = useCheckoutContext();
|
|
29857
|
+
const { softHide } = useSoftHiddenCheckout();
|
|
29515
29858
|
const onCloseWrapper = useCallback44(
|
|
29516
29859
|
(options) => {
|
|
29517
29860
|
const normalizedIsNewDeposit = !!options?.isNewDeposit;
|
|
29518
|
-
checkoutItem.initSettings.onClose?.({
|
|
29519
|
-
isNewDeposit: normalizedIsNewDeposit
|
|
29520
|
-
});
|
|
29521
29861
|
const metadata = {
|
|
29522
29862
|
checkoutStep: modalState.step,
|
|
29523
29863
|
checkoutId: checkoutItem.id,
|
|
29524
29864
|
checkoutItem,
|
|
29525
29865
|
isNewDeposit: normalizedIsNewDeposit
|
|
29526
29866
|
};
|
|
29527
|
-
|
|
29867
|
+
const checkoutProgress = getCheckoutProgress(checkoutItem.id);
|
|
29868
|
+
const isTransactionInProgress = checkoutProgress && checkoutProgress.step >= 1;
|
|
29869
|
+
const isSoftHidden = isTransactionInProgress && !normalizedIsNewDeposit;
|
|
29870
|
+
checkoutItem.initSettings.onClose?.({
|
|
29871
|
+
isNewDeposit: normalizedIsNewDeposit,
|
|
29872
|
+
isSoftHidden
|
|
29873
|
+
});
|
|
29874
|
+
if (isSoftHidden) {
|
|
29875
|
+
softHide();
|
|
29876
|
+
} else {
|
|
29877
|
+
onClose();
|
|
29878
|
+
}
|
|
29879
|
+
logger.log("closingCheckoutModal", {
|
|
29880
|
+
...metadata,
|
|
29881
|
+
checkoutProgress,
|
|
29882
|
+
isSoftHidden: isTransactionInProgress
|
|
29883
|
+
});
|
|
29528
29884
|
logEvent({
|
|
29529
29885
|
eventName: "fc::modal_closed" /* MODAL_CLOSED */,
|
|
29530
|
-
metadata
|
|
29886
|
+
metadata: { ...metadata, checkoutProgress }
|
|
29531
29887
|
});
|
|
29532
|
-
onClose();
|
|
29533
29888
|
},
|
|
29534
|
-
[
|
|
29889
|
+
[
|
|
29890
|
+
checkoutItem,
|
|
29891
|
+
modalState.step,
|
|
29892
|
+
onClose,
|
|
29893
|
+
logEvent,
|
|
29894
|
+
getCheckoutProgress,
|
|
29895
|
+
softHide
|
|
29896
|
+
]
|
|
29535
29897
|
);
|
|
29536
29898
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
29537
29899
|
const [stateHistory, setHistory] = useState65([]);
|
|
29538
|
-
const prevStep =
|
|
29900
|
+
const prevStep = useRef27(null);
|
|
29539
29901
|
const hasHistoryEntry = stateHistory.length > 1;
|
|
29540
29902
|
const onNext = useCallback44(
|
|
29541
29903
|
(payload) => {
|
|
@@ -29673,9 +30035,9 @@ function FunCheckoutModalHeightAnimationWrapper({
|
|
|
29673
30035
|
children,
|
|
29674
30036
|
checkoutStep
|
|
29675
30037
|
}) {
|
|
29676
|
-
const containerRef =
|
|
29677
|
-
const animationFrameRef =
|
|
29678
|
-
const resizeObserverRef =
|
|
30038
|
+
const containerRef = useRef28(null);
|
|
30039
|
+
const animationFrameRef = useRef28(null);
|
|
30040
|
+
const resizeObserverRef = useRef28(null);
|
|
29679
30041
|
const [height, setHeight] = useState66("auto");
|
|
29680
30042
|
useEffect51(() => {
|
|
29681
30043
|
if (containerRef.current) {
|
|
@@ -29735,7 +30097,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
29735
30097
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
29736
30098
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
29737
30099
|
import clsx24 from "clsx";
|
|
29738
|
-
import React213, { useEffect as useEffect52, useMemo as
|
|
30100
|
+
import React213, { useEffect as useEffect52, useMemo as useMemo47, useRef as useRef29, useState as useState68 } from "react";
|
|
29739
30101
|
import { Virtuoso } from "react-virtuoso";
|
|
29740
30102
|
import { useAccount as useAccount7 } from "wagmi";
|
|
29741
30103
|
|
|
@@ -30269,8 +30631,8 @@ function Home({
|
|
|
30269
30631
|
}) {
|
|
30270
30632
|
const { t } = useFunkitTranslation();
|
|
30271
30633
|
const [selectedView, setSelectedView] = useState68(defaultHomeTab);
|
|
30272
|
-
const checkoutsListRef =
|
|
30273
|
-
const virtuosoParentRef =
|
|
30634
|
+
const checkoutsListRef = useRef29(null);
|
|
30635
|
+
const virtuosoParentRef = useRef29(null);
|
|
30274
30636
|
const account = useAccount7();
|
|
30275
30637
|
useCheckoutHistoryListener();
|
|
30276
30638
|
const { userInfo, handleLogout } = useGeneralWallet();
|
|
@@ -30282,7 +30644,7 @@ function Home({
|
|
|
30282
30644
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
30283
30645
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
30284
30646
|
}, []);
|
|
30285
|
-
const AssetsList =
|
|
30647
|
+
const AssetsList = useMemo47(() => {
|
|
30286
30648
|
if (walletAssets && !Object.keys(walletAssets).length) {
|
|
30287
30649
|
return /* @__PURE__ */ React213.createElement(EmptyTabAlert, null);
|
|
30288
30650
|
}
|
|
@@ -30309,7 +30671,7 @@ function Home({
|
|
|
30309
30671
|
}
|
|
30310
30672
|
));
|
|
30311
30673
|
}, [walletAssets]);
|
|
30312
|
-
const CheckoutsList =
|
|
30674
|
+
const CheckoutsList = useMemo47(() => {
|
|
30313
30675
|
if (checkoutHistoryList.length === 0 && isCheckoutHistoryInited) {
|
|
30314
30676
|
return /* @__PURE__ */ React213.createElement(EmptyTabAlert, null);
|
|
30315
30677
|
}
|
|
@@ -31029,10 +31391,10 @@ function ChainModal({ onClose, open }) {
|
|
|
31029
31391
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
31030
31392
|
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST3 } from "@funkit/chains";
|
|
31031
31393
|
import { LogLevel, initializeRelayClient } from "@funkit/fun-relay";
|
|
31032
|
-
import React231, { useRef as
|
|
31394
|
+
import React231, { useRef as useRef30 } from "react";
|
|
31033
31395
|
|
|
31034
31396
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
31035
|
-
import React229, { useCallback as useCallback47, useMemo as
|
|
31397
|
+
import React229, { useCallback as useCallback47, useMemo as useMemo48, useState as useState72 } from "react";
|
|
31036
31398
|
|
|
31037
31399
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
31038
31400
|
import React224, { useEffect as useEffect53 } from "react";
|
|
@@ -31492,7 +31854,7 @@ function FunConnectOptions({
|
|
|
31492
31854
|
}
|
|
31493
31855
|
}
|
|
31494
31856
|
};
|
|
31495
|
-
const stepComponent =
|
|
31857
|
+
const stepComponent = useMemo48(() => {
|
|
31496
31858
|
switch (step) {
|
|
31497
31859
|
case 0 /* SIGNIN_PRIMARY */:
|
|
31498
31860
|
return /* @__PURE__ */ React229.createElement(
|
|
@@ -31609,7 +31971,8 @@ function FunCheckoutModalStepComponent(props) {
|
|
|
31609
31971
|
function FunCheckoutModalInner({
|
|
31610
31972
|
checkoutItem,
|
|
31611
31973
|
onClose,
|
|
31612
|
-
open
|
|
31974
|
+
open,
|
|
31975
|
+
isSoftHidden: externalSoftHidden
|
|
31613
31976
|
}) {
|
|
31614
31977
|
const { isUserGeoblocked } = useFunkitUserIp();
|
|
31615
31978
|
const {
|
|
@@ -31636,7 +31999,7 @@ function FunCheckoutModalInner({
|
|
|
31636
31999
|
depositAddress
|
|
31637
32000
|
});
|
|
31638
32001
|
};
|
|
31639
|
-
const animationCallbackRef =
|
|
32002
|
+
const animationCallbackRef = useRef30(null);
|
|
31640
32003
|
const handleAnimationCompleteRegister = (cb) => {
|
|
31641
32004
|
animationCallbackRef.current = cb;
|
|
31642
32005
|
};
|
|
@@ -31657,12 +32020,18 @@ function FunCheckoutModalInner({
|
|
|
31657
32020
|
const isInitialStep = modalState.step === "loading_account" /* LOADING_ACCOUNT */;
|
|
31658
32021
|
const isBlocked = isUserGeoblocked || modalState.isBlocked;
|
|
31659
32022
|
const hasBack = hasHistoryEntry && !disableBack;
|
|
32023
|
+
const { apiKey } = useFunkitConfig();
|
|
32024
|
+
const lighterNativeDeposit = isLighterNativeFlow(
|
|
32025
|
+
apiKey,
|
|
32026
|
+
checkoutItem.initSettings.config
|
|
32027
|
+
);
|
|
31660
32028
|
const checkoutConfig = hideModalTitleMetaIfTrue(
|
|
31661
32029
|
checkoutItem.initSettings.config,
|
|
31662
32030
|
HIDE_MODAL_META_TITLE_AND_DIVIDER.includes(modalState.step)
|
|
31663
32031
|
);
|
|
31664
32032
|
const { onScroll, topbar, withTopDivider } = useCustomStatusAnimationAboveTopbar({
|
|
31665
32033
|
depositAddress: checkoutItem.depositAddress ?? void 0,
|
|
32034
|
+
isLighterNativeDeposit: lighterNativeDeposit,
|
|
31666
32035
|
isActiveCheckout: true,
|
|
31667
32036
|
isCheckoutDetailView: modalState.step === "checkout_complete" /* CHECKOUT_COMPLETE */,
|
|
31668
32037
|
paddingTop: 0,
|
|
@@ -31688,7 +32057,7 @@ function FunCheckoutModalInner({
|
|
|
31688
32057
|
onClose: onCloseWrapper,
|
|
31689
32058
|
onAnimationComplete: handleAnimationComplete,
|
|
31690
32059
|
titleId: "fun-checkout-modal",
|
|
31691
|
-
isHidden: modalState.isSoftHidden,
|
|
32060
|
+
isHidden: modalState.isSoftHidden || externalSoftHidden,
|
|
31692
32061
|
withoutBottomPadding: modalState.step === "meld_currency_select" /* MELD_CURRENCY_SELECT */,
|
|
31693
32062
|
testId: "checkout-modal"
|
|
31694
32063
|
},
|
|
@@ -31735,7 +32104,11 @@ function FunCheckoutModalInner({
|
|
|
31735
32104
|
))
|
|
31736
32105
|
);
|
|
31737
32106
|
}
|
|
31738
|
-
function FunCheckoutModal({
|
|
32107
|
+
function FunCheckoutModal({
|
|
32108
|
+
onClose,
|
|
32109
|
+
open,
|
|
32110
|
+
isSoftHidden
|
|
32111
|
+
}) {
|
|
31739
32112
|
const { checkoutItem } = useCheckoutContext();
|
|
31740
32113
|
if (!checkoutItem) {
|
|
31741
32114
|
return null;
|
|
@@ -31745,7 +32118,8 @@ function FunCheckoutModal({ onClose, open }) {
|
|
|
31745
32118
|
{
|
|
31746
32119
|
checkoutItem,
|
|
31747
32120
|
onClose,
|
|
31748
|
-
open
|
|
32121
|
+
open,
|
|
32122
|
+
isSoftHidden
|
|
31749
32123
|
}
|
|
31750
32124
|
);
|
|
31751
32125
|
}
|
|
@@ -31825,7 +32199,11 @@ var ModalContext = createContext16({
|
|
|
31825
32199
|
connectModalOpen: false,
|
|
31826
32200
|
isWalletConnectModalOpen: false,
|
|
31827
32201
|
setIsWalletConnectModalOpen: () => void {},
|
|
31828
|
-
funCheckoutModalOpen: false
|
|
32202
|
+
funCheckoutModalOpen: false,
|
|
32203
|
+
softHiddenCheckoutId: null,
|
|
32204
|
+
softHideFunCheckoutModal: () => void {},
|
|
32205
|
+
resumeSoftHiddenCheckout: () => void {},
|
|
32206
|
+
discardSoftHiddenCheckout: () => void {}
|
|
31829
32207
|
});
|
|
31830
32208
|
function ModalProvider({ children }) {
|
|
31831
32209
|
const {
|
|
@@ -31851,6 +32229,22 @@ function ModalProvider({ children }) {
|
|
|
31851
32229
|
openModal: openFunCheckoutModal,
|
|
31852
32230
|
prop: funCheckoutModalId
|
|
31853
32231
|
} = useModalStateValueWithProp();
|
|
32232
|
+
const [softHiddenCheckoutId, setSoftHiddenCheckoutId] = useState73(null);
|
|
32233
|
+
const softHideFunCheckoutModal = useCallback48(() => {
|
|
32234
|
+
if (funCheckoutModalId) {
|
|
32235
|
+
setSoftHiddenCheckoutId(funCheckoutModalId);
|
|
32236
|
+
}
|
|
32237
|
+
closeFunCheckoutModal();
|
|
32238
|
+
}, [funCheckoutModalId, closeFunCheckoutModal]);
|
|
32239
|
+
const resumeSoftHiddenCheckout = useCallback48(() => {
|
|
32240
|
+
if (softHiddenCheckoutId) {
|
|
32241
|
+
openFunCheckoutModal(softHiddenCheckoutId);
|
|
32242
|
+
setSoftHiddenCheckoutId(null);
|
|
32243
|
+
}
|
|
32244
|
+
}, [softHiddenCheckoutId, openFunCheckoutModal]);
|
|
32245
|
+
const discardSoftHiddenCheckout = useCallback48(() => {
|
|
32246
|
+
setSoftHiddenCheckoutId(null);
|
|
32247
|
+
}, []);
|
|
31854
32248
|
const {
|
|
31855
32249
|
closeModal: closeWithdrawalModal,
|
|
31856
32250
|
isModalOpen: withdrawalModalOpen,
|
|
@@ -31881,7 +32275,7 @@ function ModalProvider({ children }) {
|
|
|
31881
32275
|
return /* @__PURE__ */ React233.createElement(
|
|
31882
32276
|
ModalContext.Provider,
|
|
31883
32277
|
{
|
|
31884
|
-
value:
|
|
32278
|
+
value: useMemo49(
|
|
31885
32279
|
() => ({
|
|
31886
32280
|
accountModalOpen,
|
|
31887
32281
|
accountModalTab,
|
|
@@ -31895,7 +32289,11 @@ function ModalProvider({ children }) {
|
|
|
31895
32289
|
funCheckoutModalOpen,
|
|
31896
32290
|
funCheckoutModalId,
|
|
31897
32291
|
openFunCheckoutModal,
|
|
31898
|
-
openWithdrawalModal
|
|
32292
|
+
openWithdrawalModal,
|
|
32293
|
+
softHiddenCheckoutId,
|
|
32294
|
+
softHideFunCheckoutModal,
|
|
32295
|
+
resumeSoftHiddenCheckout,
|
|
32296
|
+
discardSoftHiddenCheckout
|
|
31899
32297
|
}),
|
|
31900
32298
|
[
|
|
31901
32299
|
accountModalOpen,
|
|
@@ -31911,7 +32309,11 @@ function ModalProvider({ children }) {
|
|
|
31911
32309
|
funCheckoutModalOpen,
|
|
31912
32310
|
funCheckoutModalId,
|
|
31913
32311
|
openFunCheckoutModal,
|
|
31914
|
-
openWithdrawalModal
|
|
32312
|
+
openWithdrawalModal,
|
|
32313
|
+
softHiddenCheckoutId,
|
|
32314
|
+
softHideFunCheckoutModal,
|
|
32315
|
+
resumeSoftHiddenCheckout,
|
|
32316
|
+
discardSoftHiddenCheckout
|
|
31915
32317
|
]
|
|
31916
32318
|
)
|
|
31917
32319
|
},
|
|
@@ -31930,8 +32332,9 @@ function ModalProvider({ children }) {
|
|
|
31930
32332
|
FunCheckoutModal,
|
|
31931
32333
|
{
|
|
31932
32334
|
onClose: closeFunCheckoutModal,
|
|
31933
|
-
open: funCheckoutModalOpen,
|
|
31934
|
-
|
|
32335
|
+
open: funCheckoutModalOpen || !!softHiddenCheckoutId,
|
|
32336
|
+
isSoftHidden: !!softHiddenCheckoutId,
|
|
32337
|
+
key: softHiddenCheckoutId ?? funCheckoutModalId
|
|
31935
32338
|
}
|
|
31936
32339
|
),
|
|
31937
32340
|
withdrawalModalConfig && /* @__PURE__ */ React233.createElement(
|
|
@@ -31987,6 +32390,21 @@ function useWithdrawalModal() {
|
|
|
31987
32390
|
const { openWithdrawalModal } = useContext16(ModalContext);
|
|
31988
32391
|
return { openWithdrawalModal };
|
|
31989
32392
|
}
|
|
32393
|
+
function useSoftHiddenCheckout() {
|
|
32394
|
+
const {
|
|
32395
|
+
softHiddenCheckoutId,
|
|
32396
|
+
softHideFunCheckoutModal,
|
|
32397
|
+
resumeSoftHiddenCheckout,
|
|
32398
|
+
discardSoftHiddenCheckout
|
|
32399
|
+
} = useContext16(ModalContext);
|
|
32400
|
+
return {
|
|
32401
|
+
hasSoftHiddenCheckout: !!softHiddenCheckoutId,
|
|
32402
|
+
softHiddenCheckoutId,
|
|
32403
|
+
softHide: softHideFunCheckoutModal,
|
|
32404
|
+
resume: resumeSoftHiddenCheckout,
|
|
32405
|
+
discard: discardSoftHiddenCheckout
|
|
32406
|
+
};
|
|
32407
|
+
}
|
|
31990
32408
|
|
|
31991
32409
|
// src/providers/FunkitCheckoutContext/types.ts
|
|
31992
32410
|
var FunCheckoutStartingStep = /* @__PURE__ */ ((FunCheckoutStartingStep2) => {
|
|
@@ -32014,7 +32432,8 @@ var FunkitCheckoutContext = createContext17({
|
|
|
32014
32432
|
setCompletedTimestamp: () => void 0,
|
|
32015
32433
|
withdrawalItem: null,
|
|
32016
32434
|
initNewWithdrawal: () => "",
|
|
32017
|
-
updateWithdrawalSourceAssetAmount: () => void 0
|
|
32435
|
+
updateWithdrawalSourceAssetAmount: () => void 0,
|
|
32436
|
+
applyDynamicRouting: () => void 0
|
|
32018
32437
|
});
|
|
32019
32438
|
function assertCheckoutItem(checkoutItem) {
|
|
32020
32439
|
if (!checkoutItem) {
|
|
@@ -32031,6 +32450,9 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
32031
32450
|
const { logEvent } = useTrack();
|
|
32032
32451
|
const [activeCheckout, setActiveCheckout] = useState74(null);
|
|
32033
32452
|
const [activeWithdrawal, setActiveWithdrawal] = useState74(null);
|
|
32453
|
+
const udaParams = useUDAParams(
|
|
32454
|
+
activeCheckout?.initSettings.config?.dynamicRoutingId
|
|
32455
|
+
);
|
|
32034
32456
|
const [checkoutsProgress, setCheckoutsProgress] = useState74({});
|
|
32035
32457
|
const getCheckoutProgress = useCallback49(
|
|
32036
32458
|
(checkoutId) => {
|
|
@@ -32278,7 +32700,8 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
32278
32700
|
config: checkoutItem.initSettings.config,
|
|
32279
32701
|
walletAddress
|
|
32280
32702
|
}),
|
|
32281
|
-
apiKey: funkitConfig.apiKey
|
|
32703
|
+
apiKey: funkitConfig.apiKey,
|
|
32704
|
+
udaParams
|
|
32282
32705
|
});
|
|
32283
32706
|
if (!queryParams) {
|
|
32284
32707
|
const missingQueryParamsError = new Error(
|
|
@@ -32324,7 +32747,8 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
32324
32747
|
updateActiveCheckout,
|
|
32325
32748
|
walletAddress,
|
|
32326
32749
|
getWithdrawalDirectExecution,
|
|
32327
|
-
logEvent
|
|
32750
|
+
logEvent,
|
|
32751
|
+
udaParams
|
|
32328
32752
|
]
|
|
32329
32753
|
);
|
|
32330
32754
|
const startRegularCheckout = useCallback49(
|
|
@@ -32469,6 +32893,27 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
32469
32893
|
});
|
|
32470
32894
|
}
|
|
32471
32895
|
);
|
|
32896
|
+
const applyDynamicRouting = useEffectEvent(
|
|
32897
|
+
(path) => {
|
|
32898
|
+
updateActiveCheckout((checkoutItem) => {
|
|
32899
|
+
const config = checkoutItem.initSettings.config;
|
|
32900
|
+
return {
|
|
32901
|
+
initSettings: {
|
|
32902
|
+
...checkoutItem.initSettings,
|
|
32903
|
+
config: {
|
|
32904
|
+
...config,
|
|
32905
|
+
targetAsset: path.targetAsset,
|
|
32906
|
+
targetChain: path.targetChain,
|
|
32907
|
+
targetAssetTicker: path.targetAssetTicker ?? config.targetAssetTicker,
|
|
32908
|
+
iconSrc: path.iconSrc ?? config.iconSrc,
|
|
32909
|
+
generateActionsParams: path.generateActionsParams,
|
|
32910
|
+
customRecipient: path.customRecipient
|
|
32911
|
+
}
|
|
32912
|
+
}
|
|
32913
|
+
};
|
|
32914
|
+
});
|
|
32915
|
+
}
|
|
32916
|
+
);
|
|
32472
32917
|
const updateModalTitleMeta = useEffectEvent((newMeta) => {
|
|
32473
32918
|
updateActiveCheckout((checkoutItem) => {
|
|
32474
32919
|
const config = checkoutItem.initSettings.config;
|
|
@@ -32525,7 +32970,8 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
32525
32970
|
withdrawalItem: activeWithdrawal,
|
|
32526
32971
|
initNewWithdrawal,
|
|
32527
32972
|
updateCustomRecipient,
|
|
32528
|
-
updateWithdrawalSourceAssetAmount
|
|
32973
|
+
updateWithdrawalSourceAssetAmount,
|
|
32974
|
+
applyDynamicRouting
|
|
32529
32975
|
};
|
|
32530
32976
|
return /* @__PURE__ */ React234.createElement(FunkitCheckoutContext.Provider, { value: contextValue }, children);
|
|
32531
32977
|
}
|
|
@@ -32538,13 +32984,21 @@ function useFunkitCheckout(props) {
|
|
|
32538
32984
|
initNewCheckout,
|
|
32539
32985
|
initNewWithdrawal,
|
|
32540
32986
|
updateSourceAsset,
|
|
32541
|
-
updateSelectedPaymentMethodInfo
|
|
32987
|
+
updateSelectedPaymentMethodInfo,
|
|
32988
|
+
checkoutItem
|
|
32542
32989
|
} = useContext17(FunkitCheckoutContext);
|
|
32543
32990
|
const { openFunCheckoutModal } = useFunCheckoutModal();
|
|
32544
32991
|
const { openWithdrawalModal } = useWithdrawalModal();
|
|
32545
32992
|
const { connectModalOpen, openConnectModal } = useConnectModal();
|
|
32546
32993
|
const { isUserLoggedIn } = useGeneralWallet();
|
|
32547
|
-
const isCheckoutActivated = useFlag(
|
|
32994
|
+
const isCheckoutActivated = useFlag(FlagKey21.IsCheckoutActivated);
|
|
32995
|
+
const { apiKey } = useFunkitConfig();
|
|
32996
|
+
const {
|
|
32997
|
+
hasSoftHiddenCheckout,
|
|
32998
|
+
softHiddenCheckoutId,
|
|
32999
|
+
resume: resumeSoftHiddenCheckout,
|
|
33000
|
+
discard: discardSoftHiddenCheckout
|
|
33001
|
+
} = useSoftHiddenCheckout();
|
|
32548
33002
|
const onErrorWrapper = useCallback49(
|
|
32549
33003
|
(payload) => {
|
|
32550
33004
|
logger.warn(payload.message, payload);
|
|
@@ -32560,6 +33014,53 @@ function useFunkitCheckout(props) {
|
|
|
32560
33014
|
[openFunCheckoutModal, props]
|
|
32561
33015
|
);
|
|
32562
33016
|
const [pendingCheckoutConfig, setPendingCheckoutConfig] = useState74();
|
|
33017
|
+
const onCheckoutConflict = ({
|
|
33018
|
+
newConfig,
|
|
33019
|
+
resume,
|
|
33020
|
+
replace
|
|
33021
|
+
}) => {
|
|
33022
|
+
const lastConfig = checkoutItem?.initSettings.config;
|
|
33023
|
+
if (lastConfig?.targetAsset === newConfig.targetAsset && isLighterxyzCustomer(apiKey)) {
|
|
33024
|
+
resume();
|
|
33025
|
+
return false;
|
|
33026
|
+
}
|
|
33027
|
+
replace();
|
|
33028
|
+
return true;
|
|
33029
|
+
};
|
|
33030
|
+
const maybeUpdateSourceAsset = (config) => {
|
|
33031
|
+
if (config.sourceTokenAddress && config.sourceTokenSymbol && config.sourceChain) {
|
|
33032
|
+
updateSourceAsset({
|
|
33033
|
+
tokenAddress: config.sourceTokenAddress,
|
|
33034
|
+
symbol: config.sourceTokenSymbol,
|
|
33035
|
+
pickedChainId: config.sourceChain,
|
|
33036
|
+
iconSrc: config.iconSrc ?? void 0
|
|
33037
|
+
});
|
|
33038
|
+
}
|
|
33039
|
+
};
|
|
33040
|
+
const isTestnetCheckoutBlocked = (config) => {
|
|
33041
|
+
return isUserLoggedIn && !FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12?.[config.targetChain]?.isMainnet;
|
|
33042
|
+
};
|
|
33043
|
+
const handleLoggedInCheckout = (config, checkoutId) => {
|
|
33044
|
+
setPendingCheckoutConfig(void 0);
|
|
33045
|
+
if (isTestnetCheckoutBlocked(config)) {
|
|
33046
|
+
onErrorWrapper?.({
|
|
33047
|
+
type: "error",
|
|
33048
|
+
message: "Unable to begin a new checkout: Insufficient funds on testnet account",
|
|
33049
|
+
metadata: {}
|
|
33050
|
+
});
|
|
33051
|
+
return false;
|
|
33052
|
+
}
|
|
33053
|
+
onOpenWrapper?.(checkoutId);
|
|
33054
|
+
return true;
|
|
33055
|
+
};
|
|
33056
|
+
const handleNotLoggedInCheckout = (config) => {
|
|
33057
|
+
if (props.onLoginRequired) {
|
|
33058
|
+
props.onLoginRequired({});
|
|
33059
|
+
} else {
|
|
33060
|
+
openConnectModal?.();
|
|
33061
|
+
}
|
|
33062
|
+
setPendingCheckoutConfig(config);
|
|
33063
|
+
};
|
|
32563
33064
|
const beginCheckout = useEffectEvent(
|
|
32564
33065
|
async (inputConfig) => {
|
|
32565
33066
|
if (!props.config && !inputConfig) {
|
|
@@ -32571,57 +33072,41 @@ function useFunkitCheckout(props) {
|
|
|
32571
33072
|
return { isActivated: isCheckoutActivated };
|
|
32572
33073
|
}
|
|
32573
33074
|
if (!isCheckoutActivated) {
|
|
32574
|
-
return {
|
|
32575
|
-
isActivated: false
|
|
32576
|
-
};
|
|
33075
|
+
return { isActivated: false };
|
|
32577
33076
|
}
|
|
32578
33077
|
const validationResult = await validateCheckoutConfig({
|
|
32579
33078
|
...props.config,
|
|
32580
33079
|
...inputConfig
|
|
32581
33080
|
});
|
|
32582
33081
|
onValidation?.(validationResult);
|
|
32583
|
-
if (validationResult.isValid) {
|
|
32584
|
-
const finalConfig = validationResult.config;
|
|
32585
|
-
const newId = initNewCheckout({ ...props, config: finalConfig });
|
|
32586
|
-
if (finalConfig.sourceTokenAddress && finalConfig.sourceTokenSymbol && finalConfig.sourceChain) {
|
|
32587
|
-
updateSourceAsset({
|
|
32588
|
-
tokenAddress: finalConfig.sourceTokenAddress,
|
|
32589
|
-
symbol: finalConfig.sourceTokenSymbol,
|
|
32590
|
-
pickedChainId: finalConfig.sourceChain,
|
|
32591
|
-
iconSrc: finalConfig.iconSrc ?? void 0
|
|
32592
|
-
});
|
|
32593
|
-
}
|
|
32594
|
-
if (isUserLoggedIn || !!finalConfig.customRecipient) {
|
|
32595
|
-
setPendingCheckoutConfig(void 0);
|
|
32596
|
-
if (isUserLoggedIn && !FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO12?.[finalConfig.targetChain]?.isMainnet) {
|
|
32597
|
-
onErrorWrapper?.({
|
|
32598
|
-
type: "error",
|
|
32599
|
-
message: "Unable to begin a new checkout: Insufficient funds on testnet account",
|
|
32600
|
-
metadata: {}
|
|
32601
|
-
});
|
|
32602
|
-
return {
|
|
32603
|
-
isActivated: isCheckoutActivated
|
|
32604
|
-
};
|
|
32605
|
-
}
|
|
32606
|
-
onOpenWrapper?.(newId);
|
|
32607
|
-
} else {
|
|
32608
|
-
if (props.onLoginRequired) {
|
|
32609
|
-
props.onLoginRequired({});
|
|
32610
|
-
} else {
|
|
32611
|
-
openConnectModal?.();
|
|
32612
|
-
}
|
|
32613
|
-
setPendingCheckoutConfig(finalConfig);
|
|
32614
|
-
}
|
|
32615
|
-
} else {
|
|
33082
|
+
if (!validationResult.isValid) {
|
|
32616
33083
|
onErrorWrapper?.({
|
|
32617
33084
|
type: "error",
|
|
32618
33085
|
message: `Unable to begin a new checkout: ${validationResult.message}`,
|
|
32619
33086
|
metadata: {}
|
|
32620
33087
|
});
|
|
33088
|
+
return { isActivated: isCheckoutActivated };
|
|
32621
33089
|
}
|
|
32622
|
-
|
|
32623
|
-
|
|
32624
|
-
|
|
33090
|
+
if (hasSoftHiddenCheckout && softHiddenCheckoutId) {
|
|
33091
|
+
const shouldContinue = onCheckoutConflict({
|
|
33092
|
+
newConfig: validationResult.config,
|
|
33093
|
+
hiddenCheckoutId: softHiddenCheckoutId,
|
|
33094
|
+
resume: resumeSoftHiddenCheckout,
|
|
33095
|
+
replace: discardSoftHiddenCheckout
|
|
33096
|
+
});
|
|
33097
|
+
if (!shouldContinue) {
|
|
33098
|
+
return { isActivated: isCheckoutActivated };
|
|
33099
|
+
}
|
|
33100
|
+
}
|
|
33101
|
+
const finalConfig = validationResult.config;
|
|
33102
|
+
const newId = initNewCheckout({ ...props, config: finalConfig });
|
|
33103
|
+
maybeUpdateSourceAsset(finalConfig);
|
|
33104
|
+
if (isUserLoggedIn || finalConfig.customRecipient) {
|
|
33105
|
+
handleLoggedInCheckout(finalConfig, newId);
|
|
33106
|
+
} else {
|
|
33107
|
+
handleNotLoggedInCheckout(finalConfig);
|
|
33108
|
+
}
|
|
33109
|
+
return { isActivated: isCheckoutActivated };
|
|
32625
33110
|
}
|
|
32626
33111
|
);
|
|
32627
33112
|
const beginWithdrawal = useEffectEvent((config) => {
|
|
@@ -32715,21 +33200,6 @@ async function validateCheckoutConfig(config) {
|
|
|
32715
33200
|
message: "Invalid generateActionsParams configuration: Must be a function."
|
|
32716
33201
|
};
|
|
32717
33202
|
}
|
|
32718
|
-
if (parsedTargetAssetAmount === 0) {
|
|
32719
|
-
return {
|
|
32720
|
-
isValid: false,
|
|
32721
|
-
message: "Invalid targetAssetAmount configuration: Has to be a number greater than 0"
|
|
32722
|
-
};
|
|
32723
|
-
}
|
|
32724
|
-
const initialActionsParams = await config.generateActionsParams(
|
|
32725
|
-
parsedTargetAssetAmount
|
|
32726
|
-
);
|
|
32727
|
-
if (!Array.isArray(initialActionsParams)) {
|
|
32728
|
-
return {
|
|
32729
|
-
isValid: false,
|
|
32730
|
-
message: "Invalid generateActionsParams configuration: Must return an array. If no actions are required, please specify an empty array ([]) instead."
|
|
32731
|
-
};
|
|
32732
|
-
}
|
|
32733
33203
|
}
|
|
32734
33204
|
if (!config.targetAssetTicker) {
|
|
32735
33205
|
return {
|
|
@@ -32892,16 +33362,6 @@ async function getTokenDecimals(wagmiConfig, chainId, tokenAddress) {
|
|
|
32892
33362
|
}
|
|
32893
33363
|
}
|
|
32894
33364
|
}
|
|
32895
|
-
async function getLighterTickSize(wagmiConfig, chainId, assetIndex) {
|
|
32896
|
-
const assetConfig = await readContract(wagmiConfig, {
|
|
32897
|
-
address: LIGHTER_DEPOSIT_ADDRESS,
|
|
32898
|
-
abi: LIGHTER_DEPOSIT_ABI,
|
|
32899
|
-
functionName: "assetConfigs",
|
|
32900
|
-
args: [assetIndex],
|
|
32901
|
-
chainId: Number.parseInt(chainId)
|
|
32902
|
-
});
|
|
32903
|
-
return assetConfig[3];
|
|
32904
|
-
}
|
|
32905
33365
|
async function evaluateCheckoutGenerateActionsParams(config) {
|
|
32906
33366
|
if (!config.generateActionsParams) {
|
|
32907
33367
|
return [];
|
|
@@ -32988,12 +33448,12 @@ function computeDisplayDestinationToken(checkoutConfig, displayAssetAmount) {
|
|
|
32988
33448
|
}
|
|
32989
33449
|
|
|
32990
33450
|
// src/domains/feeEstimate.ts
|
|
32991
|
-
import { mainnet as
|
|
33451
|
+
import { mainnet as mainnet12 } from "viem/chains";
|
|
32992
33452
|
var L1_FEES_ESTIMATE = 1;
|
|
32993
33453
|
var L2_FEES_ESTIMATE = 1;
|
|
32994
33454
|
var BROKERAGE_FEES_ESTIMATE = 0;
|
|
32995
33455
|
var getBaseFeeUsdEstimate = (targetChainId, assetChainId) => {
|
|
32996
|
-
if (targetChainId !==
|
|
33456
|
+
if (targetChainId !== mainnet12.id.toString() && assetChainId !== mainnet12.id.toString()) {
|
|
32997
33457
|
return L2_FEES_ESTIMATE;
|
|
32998
33458
|
}
|
|
32999
33459
|
return L1_FEES_ESTIMATE;
|
|
@@ -33009,7 +33469,7 @@ var getFeesUsdEstimate = (targetChainId, assetChainId, paymentMethod) => {
|
|
|
33009
33469
|
var isStablecoin = (symbol) => STABLECOIN_SYMBOLS.find((s) => symbol.toLowerCase().includes(s.toLowerCase()));
|
|
33010
33470
|
function isPreferredChain(chainId, additionalChains = []) {
|
|
33011
33471
|
const chains = /* @__PURE__ */ new Set([
|
|
33012
|
-
|
|
33472
|
+
mainnet13.id,
|
|
33013
33473
|
polygon6.id,
|
|
33014
33474
|
base7.id,
|
|
33015
33475
|
arbitrum5.id,
|
|
@@ -33027,7 +33487,6 @@ function isNativeTokenAddress(address) {
|
|
|
33027
33487
|
}
|
|
33028
33488
|
var isPolygonEcosystemToken = (chainId, tokenAddress) => chainId === polygon6.id.toString() && tokenAddress === "0x0000000000000000000000000000000000001010";
|
|
33029
33489
|
var isAssetUsableToPayForCheckout = ({
|
|
33030
|
-
apiKey,
|
|
33031
33490
|
config,
|
|
33032
33491
|
payerAddress,
|
|
33033
33492
|
paymentMethod,
|
|
@@ -33038,6 +33497,7 @@ var isAssetUsableToPayForCheckout = ({
|
|
|
33038
33497
|
assetUsdAmount,
|
|
33039
33498
|
isAllowedForCheckout,
|
|
33040
33499
|
minUsdRequired,
|
|
33500
|
+
isDynamicRoutingEnabled,
|
|
33041
33501
|
t
|
|
33042
33502
|
}) => {
|
|
33043
33503
|
const finalCheckoutRecipient = getCheckoutRecipient({
|
|
@@ -33054,6 +33514,9 @@ var isAssetUsableToPayForCheckout = ({
|
|
|
33054
33514
|
minUsdRequired ?? 0
|
|
33055
33515
|
);
|
|
33056
33516
|
const isSameAsPurchasingToken = (() => {
|
|
33517
|
+
if (isDynamicRoutingEnabled) {
|
|
33518
|
+
return false;
|
|
33519
|
+
}
|
|
33057
33520
|
if (isCheckoutPostActionRequired(config)) {
|
|
33058
33521
|
const vaultToken = config.stakingToken;
|
|
33059
33522
|
return vaultToken && isTokenEquivalent7({
|
|
@@ -33092,16 +33555,7 @@ var isAssetUsableToPayForCheckout = ({
|
|
|
33092
33555
|
minUsdRequired: minValueThreshold + feeEstimate
|
|
33093
33556
|
};
|
|
33094
33557
|
}
|
|
33095
|
-
|
|
33096
|
-
const isLighterEth = isLighterEthSpot(apiKey, config);
|
|
33097
|
-
if (isSupported && isLighterEth) {
|
|
33098
|
-
isSupported = isTokenEquivalent7({
|
|
33099
|
-
firstTokenChainId: assetChainId,
|
|
33100
|
-
firstTokenAddress: assetTokenAddress,
|
|
33101
|
-
secondTokenChainId: mainnet11.id.toString(),
|
|
33102
|
-
secondTokenAddress: NATIVE_TOKEN
|
|
33103
|
-
});
|
|
33104
|
-
}
|
|
33558
|
+
const isSupported = isAllowedForCheckout && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14[assetChainId]?.isCheckoutSupported;
|
|
33105
33559
|
return {
|
|
33106
33560
|
isUsable: !!isSupported,
|
|
33107
33561
|
reason: !isSupported ? t("payment.unsupported") : ""
|
|
@@ -33233,7 +33687,7 @@ var useWalletAssets = ({
|
|
|
33233
33687
|
} = {}) => {
|
|
33234
33688
|
const { address, isConnected } = useAccount11();
|
|
33235
33689
|
const { apiKey } = useFunkitConfig();
|
|
33236
|
-
const { data, isLoading, isFetching } =
|
|
33690
|
+
const { data, isLoading, isFetching } = useQuery22({
|
|
33237
33691
|
queryKey: ["getWalletAssets", address, apiKey],
|
|
33238
33692
|
queryFn: ({ queryKey: [_, addr, key] }) => fetchAssets(addr, key),
|
|
33239
33693
|
placeholderData: keepPreviousData2,
|
|
@@ -34031,9 +34485,9 @@ function cssStringFromTheme(theme, options = {}) {
|
|
|
34031
34485
|
}
|
|
34032
34486
|
|
|
34033
34487
|
// src/hooks/useFunkitMaxCheckoutUsdInfo.ts
|
|
34034
|
-
import { FlagKey as
|
|
34488
|
+
import { FlagKey as FlagKey22, formatCurrencyAndStringify as formatCurrencyAndStringify16 } from "@funkit/utils";
|
|
34035
34489
|
var useFunkitMaxCheckoutUsdInfo = () => {
|
|
34036
|
-
const maxCheckoutUsd = Number(useFlag(
|
|
34490
|
+
const maxCheckoutUsd = Number(useFlag(FlagKey22.MaxCheckoutUsd));
|
|
34037
34491
|
const limitText = maxCheckoutUsd === Number.MAX_VALUE ? "no" : formatCurrencyAndStringify16(maxCheckoutUsd, {
|
|
34038
34492
|
decimalPrecisionForSuffix: 0,
|
|
34039
34493
|
minimumSignificantDigits: 0,
|
|
@@ -38195,7 +38649,7 @@ import React240, {
|
|
|
38195
38649
|
createContext as createContext18,
|
|
38196
38650
|
useContext as useContext18,
|
|
38197
38651
|
useEffect as useEffect59,
|
|
38198
|
-
useMemo as
|
|
38652
|
+
useMemo as useMemo50
|
|
38199
38653
|
} from "react";
|
|
38200
38654
|
import { WagmiProvider, useAccountEffect as useAccountEffect3 } from "wagmi";
|
|
38201
38655
|
|
|
@@ -38281,7 +38735,7 @@ var createThemeRootSelector = (id) => {
|
|
|
38281
38735
|
function FunkitProvider(props) {
|
|
38282
38736
|
validateFunkitProviderProps(props);
|
|
38283
38737
|
const initialChainId = getInitialChainIdFromFunkitProviderProps(props);
|
|
38284
|
-
const finalWagmiConfig =
|
|
38738
|
+
const finalWagmiConfig = useMemo50(() => {
|
|
38285
38739
|
if (!props.wagmiConfig || !initialChainId) {
|
|
38286
38740
|
return void 0;
|
|
38287
38741
|
}
|
|
@@ -38291,7 +38745,7 @@ function FunkitProvider(props) {
|
|
|
38291
38745
|
});
|
|
38292
38746
|
}, [initialChainId, props.wagmiConfig, props.funkitConfig.appName]);
|
|
38293
38747
|
const finalQueryClient = props.queryClient;
|
|
38294
|
-
const sdkVersion =
|
|
38748
|
+
const sdkVersion = useMemo50(() => getCurrentSdkVersion(), []);
|
|
38295
38749
|
useEffect59(() => {
|
|
38296
38750
|
logger.configure(props.funkitConfig.apiKey, !!props.debug, sdkVersion);
|
|
38297
38751
|
}, [props.funkitConfig.apiKey, props.debug, sdkVersion]);
|
|
@@ -38326,9 +38780,9 @@ function FunkitProviderInner({
|
|
|
38326
38780
|
useFingerprint();
|
|
38327
38781
|
useAccountEffect3({ onDisconnect: clearWalletConnectDeepLink });
|
|
38328
38782
|
const { activeTheme } = useActiveTheme();
|
|
38329
|
-
const selector =
|
|
38330
|
-
const themeRootProps =
|
|
38331
|
-
const themeStyles =
|
|
38783
|
+
const selector = useMemo50(() => createThemeRootSelector(id), [id]);
|
|
38784
|
+
const themeRootProps = useMemo50(() => createThemeRootProps2(id), [id]);
|
|
38785
|
+
const themeStyles = useMemo50(() => {
|
|
38332
38786
|
if (!activeTheme) {
|
|
38333
38787
|
return "";
|
|
38334
38788
|
}
|
|
@@ -38423,5 +38877,6 @@ export {
|
|
|
38423
38877
|
useFunkitSwitchChains,
|
|
38424
38878
|
useFunkitTranslation,
|
|
38425
38879
|
useFunkitUserInfo,
|
|
38880
|
+
useSoftHiddenCheckout,
|
|
38426
38881
|
useUpdateActiveFunkitCheckout
|
|
38427
38882
|
};
|