@funkit/connect 9.17.0 → 9.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/__generated__/default_configs.d.ts +42 -0
- package/dist/components/AnimatedDollarValue/AnimatedDollarValue.d.ts +1 -1
- package/dist/components/Icons/StatusIcons.d.ts +1 -1
- package/dist/domains/checkoutErrors.d.ts +22 -0
- package/dist/domains/dynamicRouting.d.ts +24 -0
- package/dist/index.css +5 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +311 -211
- package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +1 -22
- package/dist/modals/CheckoutModal/InputAmount/useAaveNativeSupply.d.ts +6 -2
- package/dist/modals/WithdrawalModal/ErrorMessage.d.ts +1 -1
- package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +1 -1
- package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -6
- package/dist/providers/FunkitCheckoutContext/types.d.ts +14 -2
- package/dist/wagmi/actions.d.ts +1 -1
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +33 -33
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +9 -9
- package/dist/wallets/walletConnectors/{chunk-RB3HR4R2.js → chunk-4NV5BYRP.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YEZM4CK4.js → chunk-AVDUNQUW.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-MIQTHJ6X.js → chunk-GUQM4QSL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4T6ZSRJF.js → chunk-IULPZP2Q.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HNRB7KJU.js → chunk-JPN6TWIT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZNX4EMPB.js → chunk-KCRO2AGO.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-STVVP43G.js → chunk-KI5Y2BBF.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-X6CGV36L.js → chunk-NR2OGDHQ.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-UK7C2JXW.js → chunk-OEEGYENV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-F5XEEVG6.js → chunk-OX37G4YT.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-RVOY537T.js → chunk-SWFF3TWJ.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-CPI4TD43.js → chunk-TKB2OY6G.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-2VP2F6EK.js → chunk-W2LCLDPX.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-6BW3HLBG.js → chunk-WAHGI5L7.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HTHAK6XB.js → chunk-WKNQMP4A.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VTM6EECM.js → chunk-XCNHV3HS.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-CCQV2ZET.js → chunk-YO2K4MBH.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VAPGUPHO.js → chunk-YQFGVZGR.js} +3 -3
package/dist/index.js
CHANGED
|
@@ -1252,7 +1252,8 @@ import {
|
|
|
1252
1252
|
getTransaction,
|
|
1253
1253
|
getWalletClient,
|
|
1254
1254
|
multicall,
|
|
1255
|
-
readContract
|
|
1255
|
+
readContract,
|
|
1256
|
+
waitForTransactionReceipt
|
|
1256
1257
|
} from "wagmi/actions";
|
|
1257
1258
|
async function getBalance(config, params) {
|
|
1258
1259
|
const { token, ...rest } = params;
|
|
@@ -1764,6 +1765,21 @@ function generateClientMetadataForTokenTransfer() {
|
|
|
1764
1765
|
};
|
|
1765
1766
|
}
|
|
1766
1767
|
|
|
1768
|
+
// src/domains/dynamicRouting.ts
|
|
1769
|
+
function mergeDynamicRoutingIntoConfig(config, path) {
|
|
1770
|
+
return {
|
|
1771
|
+
...config,
|
|
1772
|
+
targetAsset: path.targetAsset,
|
|
1773
|
+
targetChain: path.targetChain,
|
|
1774
|
+
targetAssetTicker: path.targetAssetTicker ?? config.targetAssetTicker,
|
|
1775
|
+
iconSrc: path.iconSrc ?? config.iconSrc,
|
|
1776
|
+
generateActionsParams: path.generateActionsParams,
|
|
1777
|
+
customRecipient: path.customRecipient,
|
|
1778
|
+
bridgeOverride: path.bridgeOverride,
|
|
1779
|
+
dynamicRoutingId: path.dynamicRoutingId ?? config.dynamicRoutingId
|
|
1780
|
+
};
|
|
1781
|
+
}
|
|
1782
|
+
|
|
1767
1783
|
// src/hooks/statsig/useDynamicConfig.ts
|
|
1768
1784
|
import { useDynamicConfig as useStatsigDynamicConfig } from "@statsig/react-bindings";
|
|
1769
1785
|
import { useMemo as useMemo15 } from "react";
|
|
@@ -1957,6 +1973,36 @@ var default_configs_default = {
|
|
|
1957
1973
|
}
|
|
1958
1974
|
]
|
|
1959
1975
|
},
|
|
1976
|
+
{
|
|
1977
|
+
routeId: "LIGHTER_USDC_SPOT",
|
|
1978
|
+
rules: [
|
|
1979
|
+
{
|
|
1980
|
+
when: {
|
|
1981
|
+
chainId: "1",
|
|
1982
|
+
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
1983
|
+
},
|
|
1984
|
+
use: {
|
|
1985
|
+
path: "FUN_MAINNET_DEPOSIT",
|
|
1986
|
+
badge: "NATIVE"
|
|
1987
|
+
}
|
|
1988
|
+
},
|
|
1989
|
+
{
|
|
1990
|
+
when: {
|
|
1991
|
+
chainId: "1",
|
|
1992
|
+
tokenAddress: "*"
|
|
1993
|
+
},
|
|
1994
|
+
use: {
|
|
1995
|
+
path: "FUN_MAINNET_DEPOSIT"
|
|
1996
|
+
}
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
when: "*",
|
|
2000
|
+
use: {
|
|
2001
|
+
path: "RL_TRANSFER"
|
|
2002
|
+
}
|
|
2003
|
+
}
|
|
2004
|
+
]
|
|
2005
|
+
},
|
|
1960
2006
|
{
|
|
1961
2007
|
routeId: "LIGHTER_USDC_PERPS_NEW_USER",
|
|
1962
2008
|
rules: [
|
|
@@ -1978,6 +2024,27 @@ var default_configs_default = {
|
|
|
1978
2024
|
}
|
|
1979
2025
|
]
|
|
1980
2026
|
},
|
|
2027
|
+
{
|
|
2028
|
+
routeId: "LIGHTER_USDC_SPOT_NEW_USER",
|
|
2029
|
+
rules: [
|
|
2030
|
+
{
|
|
2031
|
+
when: {
|
|
2032
|
+
chainId: "1",
|
|
2033
|
+
tokenAddress: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
|
|
2034
|
+
},
|
|
2035
|
+
use: {
|
|
2036
|
+
path: "FUN_MAINNET_DEPOSIT",
|
|
2037
|
+
badge: "NATIVE"
|
|
2038
|
+
}
|
|
2039
|
+
},
|
|
2040
|
+
{
|
|
2041
|
+
when: "*",
|
|
2042
|
+
use: {
|
|
2043
|
+
path: "FUN_MAINNET_DEPOSIT"
|
|
2044
|
+
}
|
|
2045
|
+
}
|
|
2046
|
+
]
|
|
2047
|
+
},
|
|
1981
2048
|
{
|
|
1982
2049
|
routeId: "LIGHTER_ETH_SPOT_NEW_USER",
|
|
1983
2050
|
rules: [
|
|
@@ -3089,7 +3156,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
3089
3156
|
localStorage.setItem(storageKey, version);
|
|
3090
3157
|
}
|
|
3091
3158
|
function getCurrentSdkVersion() {
|
|
3092
|
-
return "9.
|
|
3159
|
+
return "9.18.0";
|
|
3093
3160
|
}
|
|
3094
3161
|
function useFingerprint() {
|
|
3095
3162
|
const fingerprint = useCallback3(() => {
|
|
@@ -6119,7 +6186,8 @@ function getModalTitle(checkoutConfig, fallbackTitle = "Checkout") {
|
|
|
6119
6186
|
}
|
|
6120
6187
|
const modalTitleArgs = {
|
|
6121
6188
|
tokenChainId: checkoutConfig.targetChain,
|
|
6122
|
-
tokenAddress: checkoutConfig.targetAsset
|
|
6189
|
+
tokenAddress: checkoutConfig.targetAsset,
|
|
6190
|
+
dynamicRoutingId: checkoutConfig.dynamicRoutingId
|
|
6123
6191
|
};
|
|
6124
6192
|
const modalTitle = typeof checkoutConfig.modalTitle === "function" ? checkoutConfig.modalTitle(modalTitleArgs) : checkoutConfig.modalTitle;
|
|
6125
6193
|
return modalTitle || fallbackTitle;
|
|
@@ -7639,7 +7707,7 @@ var topbarFadeWrapper = "_1r8f577";
|
|
|
7639
7707
|
var topbarOverflowContent = "_1r8f576 _1rsrm2fpw _1rsrm2frw";
|
|
7640
7708
|
|
|
7641
7709
|
// src/modals/WithdrawalModal/WithdrawalModal.tsx
|
|
7642
|
-
import React145, { useCallback as useCallback27, useEffect as useEffect45, useState as
|
|
7710
|
+
import React145, { useCallback as useCallback27, useEffect as useEffect45, useState as useState42 } from "react";
|
|
7643
7711
|
import { mainnet as mainnet9 } from "viem/chains";
|
|
7644
7712
|
|
|
7645
7713
|
// src/components/FreeUsdcBanner/FreeUsdcBanner.tsx
|
|
@@ -23778,7 +23846,7 @@ function AddTokenToWalletButton({
|
|
|
23778
23846
|
import { CheckoutState as CheckoutState3 } from "@funkit/api-base";
|
|
23779
23847
|
import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
23780
23848
|
import { formatAddress as formatAddress5, formatTimestamp } from "@funkit/utils";
|
|
23781
|
-
import React108, {
|
|
23849
|
+
import React108, { useEffect as useEffect34, useRef as useRef13, useState as useState27 } from "react";
|
|
23782
23850
|
|
|
23783
23851
|
// src/utils/checkoutHistory.ts
|
|
23784
23852
|
var storageKey4 = "fkc-last-report-submit-time";
|
|
@@ -24631,7 +24699,7 @@ import {
|
|
|
24631
24699
|
formatCryptoAndStringify as formatCryptoAndStringify4,
|
|
24632
24700
|
formatCurrencyAndStringify as formatCurrencyAndStringify6
|
|
24633
24701
|
} from "@funkit/utils";
|
|
24634
|
-
import React130, { useEffect as useEffect42, useMemo as useMemo39, useRef as useRef19, useState as
|
|
24702
|
+
import React130, { useEffect as useEffect42, useMemo as useMemo39, useRef as useRef19, useState as useState38 } from "react";
|
|
24635
24703
|
import { createPortal as createPortal4 } from "react-dom";
|
|
24636
24704
|
import { useDebounce } from "use-debounce";
|
|
24637
24705
|
import { mainnet as mainnet8 } from "viem/chains";
|
|
@@ -27233,51 +27301,14 @@ function LighterSourceTokenDropdown({
|
|
|
27233
27301
|
}
|
|
27234
27302
|
|
|
27235
27303
|
// src/modals/WithdrawalModal/useWithdrawal.ts
|
|
27236
|
-
import { useState as
|
|
27304
|
+
import { useState as useState37 } from "react";
|
|
27237
27305
|
|
|
27238
|
-
// src/
|
|
27239
|
-
import { useCallback as useCallback25, useEffect as useEffect41, useRef as useRef18, useState as useState36 } from "react";
|
|
27240
|
-
function useAutoClearState(initialValue = null) {
|
|
27241
|
-
const [state, setState] = useState36(initialValue);
|
|
27242
|
-
const timeoutRef = useRef18(void 0);
|
|
27243
|
-
useEffect41(() => {
|
|
27244
|
-
return () => {
|
|
27245
|
-
if (timeoutRef.current !== void 0) {
|
|
27246
|
-
clearTimeout(timeoutRef.current);
|
|
27247
|
-
}
|
|
27248
|
-
};
|
|
27249
|
-
}, []);
|
|
27250
|
-
return [
|
|
27251
|
-
state,
|
|
27252
|
-
useCallback25((newState, durationMs) => {
|
|
27253
|
-
if (timeoutRef.current) {
|
|
27254
|
-
clearTimeout(timeoutRef.current);
|
|
27255
|
-
timeoutRef.current = void 0;
|
|
27256
|
-
}
|
|
27257
|
-
setState(newState);
|
|
27258
|
-
if (durationMs !== void 0) {
|
|
27259
|
-
timeoutRef.current = setTimeout(() => setState(null), durationMs);
|
|
27260
|
-
}
|
|
27261
|
-
}, [])
|
|
27262
|
-
];
|
|
27263
|
-
}
|
|
27264
|
-
|
|
27265
|
-
// src/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.tsx
|
|
27306
|
+
// src/domains/checkoutErrors.tsx
|
|
27266
27307
|
import { BluvoWithdrawalError as BluvoWithdrawalError2 } from "@funkit/api-base";
|
|
27267
27308
|
import { ClientError as ClientError2, ErrorCode } from "@funkit/utils";
|
|
27268
|
-
import React129
|
|
27309
|
+
import React129 from "react";
|
|
27269
27310
|
import { Trans as Trans5 } from "react-i18next";
|
|
27270
27311
|
|
|
27271
|
-
// src/hooks/useIsBlacklisted.ts
|
|
27272
|
-
var useIsBlacklisted = (walletAddress, customRecipient) => {
|
|
27273
|
-
const addressblacklist = useDynamicConfig("addressblacklist");
|
|
27274
|
-
const blacklist = addressblacklist.map((addr) => addr.toLowerCase());
|
|
27275
|
-
return {
|
|
27276
|
-
isWalletBlacklisted: walletAddress ? blacklist.includes(walletAddress.toLowerCase()) : false,
|
|
27277
|
-
isCustomRecipientBlacklisted: customRecipient ? blacklist.includes(customRecipient.toLowerCase()) : false
|
|
27278
|
-
};
|
|
27279
|
-
};
|
|
27280
|
-
|
|
27281
27312
|
// src/utils/polygonRpcCheck.ts
|
|
27282
27313
|
var POLYGON_CHAIN_ID = 137;
|
|
27283
27314
|
async function isPolygonRpcDown(fromChainId, connector) {
|
|
@@ -27315,7 +27346,7 @@ function isSwitchChainError(error) {
|
|
|
27315
27346
|
return regex.test(error.name) || regex.test(error.message);
|
|
27316
27347
|
}
|
|
27317
27348
|
|
|
27318
|
-
// src/
|
|
27349
|
+
// src/domains/checkoutErrors.tsx
|
|
27319
27350
|
var POLYGON_RPC_DOCS_URL = "https://docs.polygon.technology/pos/reference/rpc-endpoints/#mainnet";
|
|
27320
27351
|
function PolygonDocsLink({ children }) {
|
|
27321
27352
|
return /* @__PURE__ */ React129.createElement(
|
|
@@ -27478,72 +27509,32 @@ async function toCheckoutConfirmationError(t, error, wagmiConfig, options) {
|
|
|
27478
27509
|
}
|
|
27479
27510
|
return CHECKOUT_CONFIRMATION_UI_ERRORS.GENERIC_ERROR;
|
|
27480
27511
|
}
|
|
27481
|
-
|
|
27482
|
-
|
|
27483
|
-
|
|
27484
|
-
|
|
27485
|
-
const
|
|
27486
|
-
const
|
|
27487
|
-
|
|
27488
|
-
|
|
27489
|
-
|
|
27490
|
-
|
|
27491
|
-
const { walletAddress } = useGeneralWallet();
|
|
27492
|
-
const { connector } = useFunkitAccount();
|
|
27493
|
-
const { isCustomRecipientBlacklisted, isWalletBlacklisted } = useIsBlacklisted(walletAddress, customRecipient);
|
|
27494
|
-
const [error, setError] = useAutoClearState();
|
|
27495
|
-
const [isLoading, setIsLoading] = useState37(false);
|
|
27496
|
-
const [step, setStep] = useState37(null);
|
|
27497
|
-
const handleCheckoutConfirmation = async () => {
|
|
27498
|
-
try {
|
|
27499
|
-
if (!checkoutItem?.selectedPaymentMethodInfo || !latestQuote) {
|
|
27500
|
-
return;
|
|
27501
|
-
}
|
|
27502
|
-
setIsLoading(true);
|
|
27503
|
-
logger.log("riskAssessment_isBlacklisted", {
|
|
27504
|
-
isWalletBlacklisted,
|
|
27505
|
-
isCustomRecipientBlacklisted,
|
|
27506
|
-
walletAddress,
|
|
27507
|
-
customRecipient
|
|
27508
|
-
});
|
|
27509
|
-
const isRisky = await hasRisk(apiKey, walletAddress, customRecipient);
|
|
27510
|
-
const isCheckoutRisky = isRisky || isWalletBlacklisted || isCustomRecipientBlacklisted;
|
|
27511
|
-
if (isCheckoutRisky) {
|
|
27512
|
-
throw new Error("RISK_ERROR" /* RISK_ERROR */);
|
|
27512
|
+
|
|
27513
|
+
// src/hooks/useAutoClearState.ts
|
|
27514
|
+
import { useCallback as useCallback25, useEffect as useEffect41, useRef as useRef18, useState as useState36 } from "react";
|
|
27515
|
+
function useAutoClearState(initialValue = null) {
|
|
27516
|
+
const [state, setState] = useState36(initialValue);
|
|
27517
|
+
const timeoutRef = useRef18(void 0);
|
|
27518
|
+
useEffect41(() => {
|
|
27519
|
+
return () => {
|
|
27520
|
+
if (timeoutRef.current !== void 0) {
|
|
27521
|
+
clearTimeout(timeoutRef.current);
|
|
27513
27522
|
}
|
|
27514
|
-
|
|
27515
|
-
|
|
27516
|
-
|
|
27517
|
-
|
|
27518
|
-
|
|
27523
|
+
};
|
|
27524
|
+
}, []);
|
|
27525
|
+
return [
|
|
27526
|
+
state,
|
|
27527
|
+
useCallback25((newState, durationMs) => {
|
|
27528
|
+
if (timeoutRef.current) {
|
|
27529
|
+
clearTimeout(timeoutRef.current);
|
|
27530
|
+
timeoutRef.current = void 0;
|
|
27519
27531
|
}
|
|
27520
|
-
|
|
27521
|
-
|
|
27522
|
-
|
|
27523
|
-
const logTitle = "handleCheckoutConfirmation_error";
|
|
27524
|
-
if (isUserRejectedError(err)) {
|
|
27525
|
-
logger.warn(logTitle, { error: err });
|
|
27526
|
-
} else {
|
|
27527
|
-
logger.error(logTitle, err);
|
|
27532
|
+
setState(newState);
|
|
27533
|
+
if (durationMs !== void 0) {
|
|
27534
|
+
timeoutRef.current = setTimeout(() => setState(null), durationMs);
|
|
27528
27535
|
}
|
|
27529
|
-
|
|
27530
|
-
|
|
27531
|
-
connector
|
|
27532
|
-
});
|
|
27533
|
-
logger.info("toCheckoutConfirmationError:resulting_error", error2);
|
|
27534
|
-
setError(error2, error2.durationMs);
|
|
27535
|
-
onError(error2);
|
|
27536
|
-
} finally {
|
|
27537
|
-
setIsLoading(false);
|
|
27538
|
-
setStep(null);
|
|
27539
|
-
}
|
|
27540
|
-
};
|
|
27541
|
-
return {
|
|
27542
|
-
confirmationError: error,
|
|
27543
|
-
confirmationStepMessage: step,
|
|
27544
|
-
handleCheckoutConfirmation,
|
|
27545
|
-
isConfirming: isLoading
|
|
27546
|
-
};
|
|
27536
|
+
}, [])
|
|
27537
|
+
];
|
|
27547
27538
|
}
|
|
27548
27539
|
|
|
27549
27540
|
// src/modals/WithdrawalModal/useWithdrawal.ts
|
|
@@ -27560,8 +27551,8 @@ function useWithdrawal({
|
|
|
27560
27551
|
const { confirmCheckout, checkoutItem } = useCheckoutContext();
|
|
27561
27552
|
const { refreshCheckoutHistory } = useCheckoutHistoryContext();
|
|
27562
27553
|
const [error, setError] = useAutoClearState();
|
|
27563
|
-
const [isWithdrawing, setIsWithdrawing] =
|
|
27564
|
-
const [step, setStep] =
|
|
27554
|
+
const [isWithdrawing, setIsWithdrawing] = useState37(false);
|
|
27555
|
+
const [step, setStep] = useState37(null);
|
|
27565
27556
|
const wagmiConfig = useConfig();
|
|
27566
27557
|
const configType = isWalletWithdrawalConfig(config) ? "wallet" : isCustomWithdrawalConfig(config) ? "custom" : "unknown";
|
|
27567
27558
|
const handleWithdrawal = useEffectEvent(
|
|
@@ -27863,12 +27854,12 @@ var WithdrawContent = ({
|
|
|
27863
27854
|
const fallbackBalance = safeEvaluateWithdrawalSourceTokenBalance(
|
|
27864
27855
|
withdrawalItem?.withdrawalSourceTokenBalance
|
|
27865
27856
|
);
|
|
27866
|
-
const [selectedSourceToken, setSelectedSourceToken] =
|
|
27857
|
+
const [selectedSourceToken, setSelectedSourceToken] = useState38(
|
|
27867
27858
|
config.sourceTokenSymbol
|
|
27868
27859
|
);
|
|
27869
27860
|
const token = config.sourceTokenSymbol;
|
|
27870
|
-
const [recipientAddress, setRecipientAddress] =
|
|
27871
|
-
const [withdrawalInputAmount, setWithdrawalInputAmount] =
|
|
27861
|
+
const [recipientAddress, setRecipientAddress] = useState38("");
|
|
27862
|
+
const [withdrawalInputAmount, setWithdrawalInputAmount] = useState38("");
|
|
27872
27863
|
const { isLighterSecure, connectedAddress, lighterBalances, lighterAssets } = useLighterWithdrawal(config, setRecipientAddress);
|
|
27873
27864
|
const { address: connectedWalletAddress } = useAccount();
|
|
27874
27865
|
const sourceTokenBalance = lighterBalances[selectedSourceToken.toUpperCase()] ?? fallbackBalance;
|
|
@@ -28472,7 +28463,7 @@ var useWithdrawFops = (params) => {
|
|
|
28472
28463
|
};
|
|
28473
28464
|
|
|
28474
28465
|
// src/modals/CheckoutModal/SourceChange/FormOfPaymentsList.tsx
|
|
28475
|
-
import React135, { useRef as useRef20, useState as
|
|
28466
|
+
import React135, { useRef as useRef20, useState as useState39 } from "react";
|
|
28476
28467
|
import { Trans as Trans7 } from "react-i18next";
|
|
28477
28468
|
|
|
28478
28469
|
// src/components/Icons/GlobeIcon.tsx
|
|
@@ -28673,7 +28664,7 @@ function FormOfPaymentsContent({
|
|
|
28673
28664
|
isDisabled
|
|
28674
28665
|
}) {
|
|
28675
28666
|
const { t } = useFunkitTranslation();
|
|
28676
|
-
const [isExpanded, setIsExpanded] =
|
|
28667
|
+
const [isExpanded, setIsExpanded] = useState39(false);
|
|
28677
28668
|
const toggleRef = useRef20(null);
|
|
28678
28669
|
const { primary, secondary } = getFormOfPaymentSections(fopsData, fopPriority);
|
|
28679
28670
|
const totalItems = primary.items.length + secondary.items.length;
|
|
@@ -28859,7 +28850,7 @@ import React143 from "react";
|
|
|
28859
28850
|
import React142 from "react";
|
|
28860
28851
|
|
|
28861
28852
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
28862
|
-
import React137, { useCallback as useCallback26, useMemo as useMemo41, useState as
|
|
28853
|
+
import React137, { useCallback as useCallback26, useMemo as useMemo41, useState as useState40 } from "react";
|
|
28863
28854
|
import { createPortal as createPortal5 } from "react-dom";
|
|
28864
28855
|
|
|
28865
28856
|
// src/hooks/useFunListeners.ts
|
|
@@ -28893,7 +28884,7 @@ function FunCheckoutHistoryDetail({
|
|
|
28893
28884
|
}) {
|
|
28894
28885
|
const { t } = useFunkitTranslation();
|
|
28895
28886
|
const { uiCustomizations } = useFunkitConfig();
|
|
28896
|
-
const [isDelayed2, setIsDelayed] =
|
|
28887
|
+
const [isDelayed2, setIsDelayed] = useState40(false);
|
|
28897
28888
|
const isCheckoutLoaded = checkoutHistoryInfo !== void 0;
|
|
28898
28889
|
const { checkoutItem } = useCheckoutContext();
|
|
28899
28890
|
const {
|
|
@@ -29010,7 +29001,7 @@ var CheckoutAlert = ({ state, refundState, onHelp }) => {
|
|
|
29010
29001
|
|
|
29011
29002
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryHelp.tsx
|
|
29012
29003
|
import { sendSupportMessage } from "@funkit/api-base";
|
|
29013
|
-
import React141, { useEffect as useEffect44, useMemo as useMemo42, useRef as useRef22, useState as
|
|
29004
|
+
import React141, { useEffect as useEffect44, useMemo as useMemo42, useRef as useRef22, useState as useState41 } from "react";
|
|
29014
29005
|
import { createPortal as createPortal6 } from "react-dom";
|
|
29015
29006
|
|
|
29016
29007
|
// src/components/FunInput/FunTextAreaInput.tsx
|
|
@@ -29186,18 +29177,18 @@ function FunCheckoutHistoryHelp({
|
|
|
29186
29177
|
const { t } = useFunkitTranslation();
|
|
29187
29178
|
const { appName, apiKey } = useFunkitConfig();
|
|
29188
29179
|
const { userInfo } = useGeneralWallet();
|
|
29189
|
-
const [isSubmitting, setIsSubmitting] =
|
|
29190
|
-
const [emailInput, setEmailInput] =
|
|
29191
|
-
const [subjectInput, setSubjectInput] =
|
|
29192
|
-
const [resolutionInput, setResolutionInput] =
|
|
29180
|
+
const [isSubmitting, setIsSubmitting] = useState41(false);
|
|
29181
|
+
const [emailInput, setEmailInput] = useState41("");
|
|
29182
|
+
const [subjectInput, setSubjectInput] = useState41("");
|
|
29183
|
+
const [resolutionInput, setResolutionInput] = useState41(
|
|
29193
29184
|
RESOLUTION_OPTIONS[0]?.value ?? "0"
|
|
29194
29185
|
);
|
|
29195
|
-
const [descriptionInput, setDescriptionInput] =
|
|
29196
|
-
const [errorMessage, setErrorMessage] =
|
|
29186
|
+
const [descriptionInput, setDescriptionInput] = useState41("");
|
|
29187
|
+
const [errorMessage, setErrorMessage] = useState41();
|
|
29197
29188
|
const isEmailInputValid = useMemo42(() => {
|
|
29198
29189
|
return validateEmailString(emailInput);
|
|
29199
29190
|
}, [emailInput]);
|
|
29200
|
-
const [processStage, setProcessStage] =
|
|
29191
|
+
const [processStage, setProcessStage] = useState41(
|
|
29201
29192
|
0 /* INPUT */
|
|
29202
29193
|
);
|
|
29203
29194
|
const wrapperRef = useRef22(null);
|
|
@@ -29501,7 +29492,7 @@ function WithdrawalModal({
|
|
|
29501
29492
|
const isFreeUsdcBannerEnabled = useFeatureGate("enable-free-usdc-banner");
|
|
29502
29493
|
const titleId = "rk_withdrawal_modal_title";
|
|
29503
29494
|
const isMultiMethod = isMultiMethodWithdrawalConfig(config);
|
|
29504
|
-
const [selectedMethod, setSelectedMethod] =
|
|
29495
|
+
const [selectedMethod, setSelectedMethod] = useState42(null);
|
|
29505
29496
|
const activeConfig = isMultiMethod ? selectedMethod?.config ?? null : config;
|
|
29506
29497
|
const isInitialStepSelectMethod = isMultiMethod || isSwappedWithdrawalEnabled;
|
|
29507
29498
|
const getInitialStep = () => {
|
|
@@ -29510,12 +29501,12 @@ function WithdrawalModal({
|
|
|
29510
29501
|
}
|
|
29511
29502
|
return "ENTER_AMOUNT" /* ENTER_AMOUNT */;
|
|
29512
29503
|
};
|
|
29513
|
-
const [step, setStep] =
|
|
29504
|
+
const [step, setStep] = useState42(getInitialStep);
|
|
29514
29505
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
29515
|
-
const [confirmedHash, setConfirmedHash] =
|
|
29516
|
-
const [withdrawnAmount, setWithdrawnAmount] =
|
|
29517
|
-
const [quote, setQuote] =
|
|
29518
|
-
const [selectedTokenSymbol, setSelectedTokenSymbol] =
|
|
29506
|
+
const [confirmedHash, setConfirmedHash] = useState42("0x");
|
|
29507
|
+
const [withdrawnAmount, setWithdrawnAmount] = useState42("");
|
|
29508
|
+
const [quote, setQuote] = useState42();
|
|
29509
|
+
const [selectedTokenSymbol, setSelectedTokenSymbol] = useState42("");
|
|
29519
29510
|
const { logEvent } = useTrack();
|
|
29520
29511
|
useEffect45(() => {
|
|
29521
29512
|
setStep(
|
|
@@ -29708,7 +29699,7 @@ import React146, {
|
|
|
29708
29699
|
useCallback as useCallback28,
|
|
29709
29700
|
useContext as useContext18,
|
|
29710
29701
|
useMemo as useMemo43,
|
|
29711
|
-
useState as
|
|
29702
|
+
useState as useState43
|
|
29712
29703
|
} from "react";
|
|
29713
29704
|
var ActivityTraversalContext = createContext18({
|
|
29714
29705
|
selectedPurchaseId: void 0,
|
|
@@ -29721,10 +29712,10 @@ var ActivityTraversalContext = createContext18({
|
|
|
29721
29712
|
var ActivityTraversalProvider = ({
|
|
29722
29713
|
children
|
|
29723
29714
|
}) => {
|
|
29724
|
-
const [selectedPurchaseId, setSelectedPurchaseId] =
|
|
29725
|
-
const [selectedPurchaseInitView, setSelectedPurchaseInitView] =
|
|
29726
|
-
const [returnView, setReturnView] =
|
|
29727
|
-
const [returnViewPresets, setReturnViewPresets] =
|
|
29715
|
+
const [selectedPurchaseId, setSelectedPurchaseId] = useState43();
|
|
29716
|
+
const [selectedPurchaseInitView, setSelectedPurchaseInitView] = useState43();
|
|
29717
|
+
const [returnView, setReturnView] = useState43();
|
|
29718
|
+
const [returnViewPresets, setReturnViewPresets] = useState43(
|
|
29728
29719
|
{}
|
|
29729
29720
|
);
|
|
29730
29721
|
const onSelectActivity = useCallback28(
|
|
@@ -29826,7 +29817,7 @@ import {
|
|
|
29826
29817
|
createBridgeCustomer,
|
|
29827
29818
|
createFrogAccount
|
|
29828
29819
|
} from "@funkit/api-base";
|
|
29829
|
-
import React148, { useState as
|
|
29820
|
+
import React148, { useState as useState44 } from "react";
|
|
29830
29821
|
import { createPortal as createPortal7 } from "react-dom";
|
|
29831
29822
|
import { Trans as Trans8 } from "react-i18next";
|
|
29832
29823
|
|
|
@@ -29886,12 +29877,12 @@ function CreateAccountScreen({
|
|
|
29886
29877
|
const { userInfo, isUserLoggedIn } = useGeneralWallet();
|
|
29887
29878
|
const { apiKey } = useFunkitConfig();
|
|
29888
29879
|
const { clearFrogAccounts, clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
29889
|
-
const [firstName, setFirstName] =
|
|
29890
|
-
const [lastName, setLastName] =
|
|
29891
|
-
const [email, setEmail] =
|
|
29892
|
-
const [emailError, setEmailError] =
|
|
29893
|
-
const [consentChecked, setConsentChecked] =
|
|
29894
|
-
const [isSubmitting, setIsSubmitting] =
|
|
29880
|
+
const [firstName, setFirstName] = useState44("");
|
|
29881
|
+
const [lastName, setLastName] = useState44("");
|
|
29882
|
+
const [email, setEmail] = useState44("");
|
|
29883
|
+
const [emailError, setEmailError] = useState44("");
|
|
29884
|
+
const [consentChecked, setConsentChecked] = useState44(false);
|
|
29885
|
+
const [isSubmitting, setIsSubmitting] = useState44(false);
|
|
29895
29886
|
const userId = userInfo.id;
|
|
29896
29887
|
const handleCreateBridgeCustomer = async (data) => {
|
|
29897
29888
|
try {
|
|
@@ -30090,7 +30081,7 @@ import {
|
|
|
30090
30081
|
BridgeCustomerStatus as BridgeCustomerStatus4
|
|
30091
30082
|
} from "@funkit/api-base";
|
|
30092
30083
|
import { exhaustiveCheck as exhaustiveCheck4 } from "@funkit/utils";
|
|
30093
|
-
import React157, { useCallback as useCallback29, useState as
|
|
30084
|
+
import React157, { useCallback as useCallback29, useState as useState45 } from "react";
|
|
30094
30085
|
import { createPortal as createPortal8 } from "react-dom";
|
|
30095
30086
|
import { Trans as Trans9 } from "react-i18next";
|
|
30096
30087
|
|
|
@@ -30715,7 +30706,7 @@ var VerifyAccountScreen = ({
|
|
|
30715
30706
|
onBack
|
|
30716
30707
|
}) => {
|
|
30717
30708
|
const { t } = useFunkitTranslation();
|
|
30718
|
-
const [creating, setCreating] =
|
|
30709
|
+
const [creating, setCreating] = useState45(false);
|
|
30719
30710
|
const bottomSectionRef = useBottomSectionRef();
|
|
30720
30711
|
const statusContent = getCustomerStatusContent(
|
|
30721
30712
|
t,
|
|
@@ -31321,7 +31312,7 @@ function BrokerageSuccessModal({
|
|
|
31321
31312
|
|
|
31322
31313
|
// src/modals/CheckoutModal/Brokerage/BrokerageTwoFA.tsx
|
|
31323
31314
|
import { ClientError as ClientError3 } from "@funkit/utils";
|
|
31324
|
-
import React171, { useState as
|
|
31315
|
+
import React171, { useState as useState47 } from "react";
|
|
31325
31316
|
import { createPortal as createPortal10 } from "react-dom";
|
|
31326
31317
|
import { Trans as Trans11 } from "react-i18next";
|
|
31327
31318
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -31333,7 +31324,7 @@ import React170, {
|
|
|
31333
31324
|
useCallback as useCallback30,
|
|
31334
31325
|
useEffect as useEffect46,
|
|
31335
31326
|
useRef as useRef23,
|
|
31336
|
-
useState as
|
|
31327
|
+
useState as useState46
|
|
31337
31328
|
} from "react";
|
|
31338
31329
|
var FunTwoFaInput = ({
|
|
31339
31330
|
value,
|
|
@@ -31349,9 +31340,9 @@ var FunTwoFaInput = ({
|
|
|
31349
31340
|
const inputRefs = useRef23(
|
|
31350
31341
|
Array.from({ length: initialInputLength }, () => null)
|
|
31351
31342
|
);
|
|
31352
|
-
const [currentLength, setCurrentLength] =
|
|
31353
|
-
const [focusIndex, setFocusIndex] =
|
|
31354
|
-
const [isFocused, setIsFocused] =
|
|
31343
|
+
const [currentLength, setCurrentLength] = useState46(initialInputLength);
|
|
31344
|
+
const [focusIndex, setFocusIndex] = useState46(0);
|
|
31345
|
+
const [isFocused, setIsFocused] = useState46(false);
|
|
31355
31346
|
useEffect46(() => {
|
|
31356
31347
|
if (!value) {
|
|
31357
31348
|
setFocusIndex(0);
|
|
@@ -31560,15 +31551,15 @@ function BrokerageTwoFA({
|
|
|
31560
31551
|
const { bluvoClient, exchangeType } = useBluvo();
|
|
31561
31552
|
const { getBluvoCheckoutQuote } = useBluvoCheckoutQuote();
|
|
31562
31553
|
const requiresValid2FAMethod = bluvoClient?.requiresValid2FAMethod;
|
|
31563
|
-
const [twoFactorCode, setTwoFactorCode] =
|
|
31564
|
-
const [verificationTitle, setVerificationTitle] =
|
|
31565
|
-
const [verificationDescription, setVerificationDescription] =
|
|
31566
|
-
const [screen, setScreen] =
|
|
31567
|
-
const [isExecuting, setIsExecuting] =
|
|
31568
|
-
const [executionError, setExecutionError] =
|
|
31569
|
-
const [isQuoteExpired, setIsQuoteExpired] =
|
|
31554
|
+
const [twoFactorCode, setTwoFactorCode] = useState47("");
|
|
31555
|
+
const [verificationTitle, setVerificationTitle] = useState47("");
|
|
31556
|
+
const [verificationDescription, setVerificationDescription] = useState47("");
|
|
31557
|
+
const [screen, setScreen] = useState47(0 /* INITIAL */);
|
|
31558
|
+
const [isExecuting, setIsExecuting] = useState47(false);
|
|
31559
|
+
const [executionError, setExecutionError] = useState47("");
|
|
31560
|
+
const [isQuoteExpired, setIsQuoteExpired] = useState47(false);
|
|
31570
31561
|
const bluvoRequires2FA = bluvoClient?.requires2FA;
|
|
31571
|
-
const [kycRequired, setKycRequired] =
|
|
31562
|
+
const [kycRequired, setKycRequired] = useState47(false);
|
|
31572
31563
|
const exchange = bluvoClient?.context?.exchange;
|
|
31573
31564
|
const brokerName = capitalize(exchange || "Brokerage");
|
|
31574
31565
|
useIsomorphicLayoutEffect(() => {
|
|
@@ -31931,7 +31922,7 @@ var TwoFactorIcon = () => /* @__PURE__ */ React171.createElement(
|
|
|
31931
31922
|
);
|
|
31932
31923
|
|
|
31933
31924
|
// src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
|
|
31934
|
-
import React174, { useCallback as useCallback31, useEffect as useEffect47, useState as
|
|
31925
|
+
import React174, { useCallback as useCallback31, useEffect as useEffect47, useState as useState48 } from "react";
|
|
31935
31926
|
import { createPortal as createPortal11 } from "react-dom";
|
|
31936
31927
|
|
|
31937
31928
|
// src/components/Icons/HandIcon.tsx
|
|
@@ -32015,9 +32006,9 @@ function ConnectExchange({
|
|
|
32015
32006
|
const { t } = useFunkitTranslation();
|
|
32016
32007
|
const { appName, uiCustomizations } = useFunkitConfig();
|
|
32017
32008
|
const { updateSelectedPaymentMethodInfo } = useCheckoutContext();
|
|
32018
|
-
const [authError, setAuthError] =
|
|
32009
|
+
const [authError, setAuthError] = useState48("");
|
|
32019
32010
|
const { exchangeType, walletId, isConnected, handleStartWithdrawal } = useBluvo();
|
|
32020
|
-
const [isLoadingBluvoModal, setIsLoadingBluvoModal] =
|
|
32011
|
+
const [isLoadingBluvoModal, setIsLoadingBluvoModal] = useState48(false);
|
|
32021
32012
|
const icon = getExchangeIcon(brokerType, iconSize);
|
|
32022
32013
|
const isLoading = isLoadingBluvoModal;
|
|
32023
32014
|
const exchangeName = getExchangeName(brokerType);
|
|
@@ -32100,7 +32091,7 @@ function ConnectExchange({
|
|
|
32100
32091
|
}
|
|
32101
32092
|
|
|
32102
32093
|
// src/modals/CheckoutModal/Brokerage/SelectBrokerage.tsx
|
|
32103
|
-
import React177, { useCallback as useCallback32, useState as
|
|
32094
|
+
import React177, { useCallback as useCallback32, useState as useState49 } from "react";
|
|
32104
32095
|
import { createPortal as createPortal12 } from "react-dom";
|
|
32105
32096
|
|
|
32106
32097
|
// src/components/FunSelectBrokerage/FunSelectBrokerage.tsx
|
|
@@ -32319,7 +32310,7 @@ function SelectBrokerage({
|
|
|
32319
32310
|
const { uiCustomizations } = useFunkitConfig();
|
|
32320
32311
|
const iconSize = uiCustomizations.enableCompactList ? COMPACT_FOP_ICON_SIZE : FOP_ICON_SIZE;
|
|
32321
32312
|
const options = useExchangeOptions({ iconSize });
|
|
32322
|
-
const [selectedKey, setSelectedKey] =
|
|
32313
|
+
const [selectedKey, setSelectedKey] = useState49();
|
|
32323
32314
|
const bottomSectionRef = useBottomSectionRef();
|
|
32324
32315
|
const handleSelect = useCallback32(
|
|
32325
32316
|
async (option) => {
|
|
@@ -33117,6 +33108,88 @@ function useCardDisclaimer(checkoutItem, finalConvertedAssetName) {
|
|
|
33117
33108
|
return cardDisclaimer;
|
|
33118
33109
|
}
|
|
33119
33110
|
|
|
33111
|
+
// src/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.tsx
|
|
33112
|
+
import { useState as useState50 } from "react";
|
|
33113
|
+
|
|
33114
|
+
// src/hooks/useIsBlacklisted.ts
|
|
33115
|
+
var useIsBlacklisted = (walletAddress, customRecipient) => {
|
|
33116
|
+
const addressblacklist = useDynamicConfig("addressblacklist");
|
|
33117
|
+
const blacklist = addressblacklist.map((addr) => addr.toLowerCase());
|
|
33118
|
+
return {
|
|
33119
|
+
isWalletBlacklisted: walletAddress ? blacklist.includes(walletAddress.toLowerCase()) : false,
|
|
33120
|
+
isCustomRecipientBlacklisted: customRecipient ? blacklist.includes(customRecipient.toLowerCase()) : false
|
|
33121
|
+
};
|
|
33122
|
+
};
|
|
33123
|
+
|
|
33124
|
+
// src/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.tsx
|
|
33125
|
+
function useCheckoutConfirmation({
|
|
33126
|
+
onError,
|
|
33127
|
+
onSuccess
|
|
33128
|
+
}) {
|
|
33129
|
+
const { t } = useFunkitTranslation();
|
|
33130
|
+
const { checkoutItem, confirmCheckout } = useCheckoutContext();
|
|
33131
|
+
const customRecipient = checkoutItem?.initSettings.config.customRecipient;
|
|
33132
|
+
const wagmiConfig = useConfig();
|
|
33133
|
+
const { apiKey } = useFunkitConfig();
|
|
33134
|
+
const { latestQuote } = useQuoteContext();
|
|
33135
|
+
const { walletAddress } = useGeneralWallet();
|
|
33136
|
+
const { connector } = useFunkitAccount();
|
|
33137
|
+
const { isCustomRecipientBlacklisted, isWalletBlacklisted } = useIsBlacklisted(walletAddress, customRecipient);
|
|
33138
|
+
const [error, setError] = useAutoClearState();
|
|
33139
|
+
const [isLoading, setIsLoading] = useState50(false);
|
|
33140
|
+
const [step, setStep] = useState50(null);
|
|
33141
|
+
const handleCheckoutConfirmation = async () => {
|
|
33142
|
+
try {
|
|
33143
|
+
if (!checkoutItem?.selectedPaymentMethodInfo || !latestQuote) {
|
|
33144
|
+
return;
|
|
33145
|
+
}
|
|
33146
|
+
setIsLoading(true);
|
|
33147
|
+
logger.log("riskAssessment_isBlacklisted", {
|
|
33148
|
+
isWalletBlacklisted,
|
|
33149
|
+
isCustomRecipientBlacklisted,
|
|
33150
|
+
walletAddress,
|
|
33151
|
+
customRecipient
|
|
33152
|
+
});
|
|
33153
|
+
const isRisky = await hasRisk(apiKey, walletAddress, customRecipient);
|
|
33154
|
+
const isCheckoutRisky = isRisky || isWalletBlacklisted || isCustomRecipientBlacklisted;
|
|
33155
|
+
if (isCheckoutRisky) {
|
|
33156
|
+
throw new Error("RISK_ERROR" /* RISK_ERROR */);
|
|
33157
|
+
}
|
|
33158
|
+
const depositAddress = await confirmCheckout(latestQuote, setStep);
|
|
33159
|
+
if (!depositAddress) {
|
|
33160
|
+
throw new Error(
|
|
33161
|
+
"Invalid depositAddress - unable to proceed with checkout"
|
|
33162
|
+
);
|
|
33163
|
+
}
|
|
33164
|
+
setError(null);
|
|
33165
|
+
onSuccess(depositAddress);
|
|
33166
|
+
} catch (err) {
|
|
33167
|
+
const logTitle = "handleCheckoutConfirmation_error";
|
|
33168
|
+
if (isUserRejectedError(err)) {
|
|
33169
|
+
logger.warn(logTitle, { error: err });
|
|
33170
|
+
} else {
|
|
33171
|
+
logger.error(logTitle, err);
|
|
33172
|
+
}
|
|
33173
|
+
const error2 = await toCheckoutConfirmationError(t, err, wagmiConfig, {
|
|
33174
|
+
fromChainId: checkoutItem?.selectedSourceAssetInfo.chainId,
|
|
33175
|
+
connector
|
|
33176
|
+
});
|
|
33177
|
+
logger.info("toCheckoutConfirmationError:resulting_error", error2);
|
|
33178
|
+
setError(error2, error2.durationMs);
|
|
33179
|
+
onError(error2);
|
|
33180
|
+
} finally {
|
|
33181
|
+
setIsLoading(false);
|
|
33182
|
+
setStep(null);
|
|
33183
|
+
}
|
|
33184
|
+
};
|
|
33185
|
+
return {
|
|
33186
|
+
confirmationError: error,
|
|
33187
|
+
confirmationStepMessage: step,
|
|
33188
|
+
handleCheckoutConfirmation,
|
|
33189
|
+
isConfirming: isLoading
|
|
33190
|
+
};
|
|
33191
|
+
}
|
|
33192
|
+
|
|
33120
33193
|
// src/modals/CheckoutModal/ConfirmationStep/useCheckoutQuote.ts
|
|
33121
33194
|
import { useState as useState52 } from "react";
|
|
33122
33195
|
|
|
@@ -35713,7 +35786,6 @@ import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
|
35713
35786
|
import * as dnum7 from "dnum";
|
|
35714
35787
|
import { useCallback as useCallback39, useState as useState59 } from "react";
|
|
35715
35788
|
import { erc20Abi as erc20Abi5 } from "viem";
|
|
35716
|
-
import { readContract as readContract3 } from "viem/actions";
|
|
35717
35789
|
|
|
35718
35790
|
// src/modals/CheckoutModal/InputAmount/aaveClient.ts
|
|
35719
35791
|
import { AaveV3Ethereum } from "@aave-dao/aave-address-book";
|
|
@@ -35819,7 +35891,8 @@ async function signSupplyPermit(walletClient, {
|
|
|
35819
35891
|
}
|
|
35820
35892
|
return result.value;
|
|
35821
35893
|
}
|
|
35822
|
-
|
|
35894
|
+
var USDT_RESET_RECEIPT_TIMEOUT_MS = 9e4;
|
|
35895
|
+
async function resetUsdtAllowanceIfNeeded(wagmiConfig, walletClient, {
|
|
35823
35896
|
owner,
|
|
35824
35897
|
market,
|
|
35825
35898
|
currency,
|
|
@@ -35828,17 +35901,18 @@ async function resetUsdtAllowanceIfNeeded(walletClient, {
|
|
|
35828
35901
|
if (!isMainnetUsdt(targetChainNum, currency)) {
|
|
35829
35902
|
return;
|
|
35830
35903
|
}
|
|
35831
|
-
const allowance = await
|
|
35904
|
+
const allowance = await readContract(wagmiConfig, {
|
|
35832
35905
|
address: currency,
|
|
35833
35906
|
abi: erc20Abi5,
|
|
35834
35907
|
functionName: "allowance",
|
|
35835
|
-
args: [owner, market]
|
|
35908
|
+
args: [owner, market],
|
|
35909
|
+
chainId: targetChainNum
|
|
35836
35910
|
});
|
|
35837
35911
|
if (allowance > 0n) {
|
|
35838
35912
|
logger.info("aaveNativeSupply:usdtAllowanceReset", {
|
|
35839
35913
|
allowance: allowance.toString()
|
|
35840
35914
|
});
|
|
35841
|
-
await walletClient.writeContract({
|
|
35915
|
+
const resetTxHash = await walletClient.writeContract({
|
|
35842
35916
|
address: currency,
|
|
35843
35917
|
abi: erc20Abi5,
|
|
35844
35918
|
functionName: "approve",
|
|
@@ -35846,6 +35920,11 @@ async function resetUsdtAllowanceIfNeeded(walletClient, {
|
|
|
35846
35920
|
account: owner,
|
|
35847
35921
|
chain: walletClient.chain
|
|
35848
35922
|
});
|
|
35923
|
+
await waitForTransactionReceipt(wagmiConfig, {
|
|
35924
|
+
hash: resetTxHash,
|
|
35925
|
+
chainId: targetChainNum,
|
|
35926
|
+
timeout: USDT_RESET_RECEIPT_TIMEOUT_MS
|
|
35927
|
+
});
|
|
35849
35928
|
}
|
|
35850
35929
|
}
|
|
35851
35930
|
function shouldUsePermitForSupply(userPreference, reservePermitSupported, allowanceCoversAmount) {
|
|
@@ -36005,6 +36084,7 @@ function useAaveTargetReservePermit(checkoutItem) {
|
|
|
36005
36084
|
return data;
|
|
36006
36085
|
}
|
|
36007
36086
|
function useAaveNativeSupply() {
|
|
36087
|
+
const { t } = useFunkitTranslation();
|
|
36008
36088
|
const { address: walletAddress, connector } = useAccount();
|
|
36009
36089
|
const { apiKey } = useFunkitConfig();
|
|
36010
36090
|
const userInfo = useFunkitUserInfo();
|
|
@@ -36022,22 +36102,27 @@ function useAaveNativeSupply() {
|
|
|
36022
36102
|
const submit = useCallback39(
|
|
36023
36103
|
async (amount) => {
|
|
36024
36104
|
setError(null);
|
|
36025
|
-
|
|
36026
|
-
|
|
36027
|
-
|
|
36105
|
+
const fail = async (err) => {
|
|
36106
|
+
setError(
|
|
36107
|
+
await toCheckoutConfirmationError(t, err, wagmiConfig, {
|
|
36108
|
+
fromChainId: checkoutItem?.initSettings.config.targetChain,
|
|
36109
|
+
connector: connector ?? void 0
|
|
36110
|
+
})
|
|
36111
|
+
);
|
|
36028
36112
|
return null;
|
|
36113
|
+
};
|
|
36114
|
+
if (!walletAddress || !connector) {
|
|
36115
|
+
return fail(new Error("Wallet not connected"));
|
|
36029
36116
|
}
|
|
36030
36117
|
if (!checkoutItem) {
|
|
36031
|
-
|
|
36032
|
-
setError(err);
|
|
36033
|
-
return null;
|
|
36118
|
+
return fail(new Error("No active checkout"));
|
|
36034
36119
|
}
|
|
36035
36120
|
if (!market || !targetAsset || !targetChainStr) {
|
|
36036
|
-
|
|
36037
|
-
|
|
36121
|
+
return fail(
|
|
36122
|
+
new Error(
|
|
36123
|
+
`Aave native supply not configured for chain ${targetChainStr}`
|
|
36124
|
+
)
|
|
36038
36125
|
);
|
|
36039
|
-
setError(err);
|
|
36040
|
-
return null;
|
|
36041
36126
|
}
|
|
36042
36127
|
const targetChainNum = Number.parseInt(targetChainStr, 10);
|
|
36043
36128
|
setIsPending(true);
|
|
@@ -36100,7 +36185,7 @@ function useAaveNativeSupply() {
|
|
|
36100
36185
|
const supplyTxHash = await executeAaveSupplyPlan(
|
|
36101
36186
|
walletClient,
|
|
36102
36187
|
supplyRequest,
|
|
36103
|
-
() => resetUsdtAllowanceIfNeeded(walletClient, {
|
|
36188
|
+
() => resetUsdtAllowanceIfNeeded(wagmiConfig, walletClient, {
|
|
36104
36189
|
owner: walletAddress,
|
|
36105
36190
|
market,
|
|
36106
36191
|
currency: targetAsset,
|
|
@@ -36133,13 +36218,13 @@ function useAaveNativeSupply() {
|
|
|
36133
36218
|
checkoutId: checkoutItem.id,
|
|
36134
36219
|
errorMessage: e.message
|
|
36135
36220
|
});
|
|
36136
|
-
|
|
36137
|
-
return null;
|
|
36221
|
+
return fail(err);
|
|
36138
36222
|
} finally {
|
|
36139
36223
|
setIsPending(false);
|
|
36140
36224
|
}
|
|
36141
36225
|
},
|
|
36142
36226
|
[
|
|
36227
|
+
t,
|
|
36143
36228
|
walletAddress,
|
|
36144
36229
|
connector,
|
|
36145
36230
|
apiKey,
|
|
@@ -37514,6 +37599,9 @@ function InputAmountLoaded({
|
|
|
37514
37599
|
const { t } = useFunkitTranslation();
|
|
37515
37600
|
const { apiKey } = useFunkitConfig();
|
|
37516
37601
|
const maxCheckoutUsd = useDynamicConfig("maxcheckoutusd");
|
|
37602
|
+
const minUdaTransferLimit = useMinTransferValueUsd(
|
|
37603
|
+
Number(checkoutConfig.targetChain)
|
|
37604
|
+
);
|
|
37517
37605
|
const gasUnits = safeBigInt(
|
|
37518
37606
|
useDynamicConfig("checkoutgasbufferunits"),
|
|
37519
37607
|
BigInt(default_configs_default.checkoutgasbufferunits.value)
|
|
@@ -37524,7 +37612,6 @@ function InputAmountLoaded({
|
|
|
37524
37612
|
const isCardCheckout = paymentMethodInfo.paymentMethod === "card" /* CARD */;
|
|
37525
37613
|
const isBrokerageCheckout = paymentMethodInfo.paymentMethod === "brokerage" /* BROKERAGE */;
|
|
37526
37614
|
const meldEnabled = useIsMeldEnabled() && isCardCheckout;
|
|
37527
|
-
const { getMinDepositUSD } = checkoutConfig;
|
|
37528
37615
|
const { updateTargetAssetAmount } = useCheckoutContext();
|
|
37529
37616
|
const { brokerageMinMax } = useFunkitBrokerageContext();
|
|
37530
37617
|
const quoteBuilder = useQuoteBuilder();
|
|
@@ -37545,11 +37632,20 @@ function InputAmountLoaded({
|
|
|
37545
37632
|
const isExactIn = quoteBuilder.isExactIn();
|
|
37546
37633
|
const sourceTokenKey = sourceHolding?.chainSymbolKey;
|
|
37547
37634
|
const sourceTokenChanged = modalState.sourceTokenKey != null && modalState.sourceTokenKey !== sourceTokenKey;
|
|
37548
|
-
const
|
|
37549
|
-
|
|
37550
|
-
|
|
37551
|
-
|
|
37552
|
-
|
|
37635
|
+
const getMinUsd = () => {
|
|
37636
|
+
const minUsd = checkoutConfig.getMinDepositUSD?.({
|
|
37637
|
+
tokenChainId: checkoutConfig.targetChain,
|
|
37638
|
+
tokenAddress: checkoutConfig.targetAsset
|
|
37639
|
+
});
|
|
37640
|
+
const brokerageMinUsd = Math.max(brokerageMinMax?.minUsd ?? 0, minUsd ?? 0);
|
|
37641
|
+
if (paymentMethodInfo.paymentMethod === "bitcoin_lightning" /* BITCOIN_LIGHTNING */) {
|
|
37642
|
+
return minUdaTransferLimit;
|
|
37643
|
+
}
|
|
37644
|
+
if (isBrokerageCheckout) {
|
|
37645
|
+
return brokerageMinUsd;
|
|
37646
|
+
}
|
|
37647
|
+
return minUsd;
|
|
37648
|
+
};
|
|
37553
37649
|
const fiatCurrency = modalState.fiatCurrency ?? defaultFiatCurrency ?? "USD";
|
|
37554
37650
|
const quickOptions = useFiatAmountOptions(fiatCurrency);
|
|
37555
37651
|
const isNativeToken = sourceHolding?.tokenAddress ? isNativeTokenAddress(sourceHolding.tokenAddress) : false;
|
|
@@ -37562,7 +37658,7 @@ function InputAmountLoaded({
|
|
|
37562
37658
|
locale: void 0,
|
|
37563
37659
|
// browser default
|
|
37564
37660
|
maxUsd: maxCheckoutUsd,
|
|
37565
|
-
minUsd:
|
|
37661
|
+
minUsd: getMinUsd(),
|
|
37566
37662
|
paymentMethodInfo,
|
|
37567
37663
|
quickOptions,
|
|
37568
37664
|
sourceHolding,
|
|
@@ -37638,7 +37734,7 @@ function InputAmountLoaded({
|
|
|
37638
37734
|
}
|
|
37639
37735
|
}
|
|
37640
37736
|
if (aaveSupply.error) {
|
|
37641
|
-
return
|
|
37737
|
+
return aaveSupply.error;
|
|
37642
37738
|
}
|
|
37643
37739
|
if (usdAvailableAmount === 0) {
|
|
37644
37740
|
return {
|
|
@@ -37720,6 +37816,7 @@ function InputAmountLoaded({
|
|
|
37720
37816
|
autoConfirm(newState);
|
|
37721
37817
|
}
|
|
37722
37818
|
};
|
|
37819
|
+
const isInputDisabled = aaveSupply.isPending;
|
|
37723
37820
|
const { amountInput, amountInputSwitch } = useAmountInputUI(
|
|
37724
37821
|
amountInputResult,
|
|
37725
37822
|
{
|
|
@@ -37727,7 +37824,8 @@ function InputAmountLoaded({
|
|
|
37727
37824
|
meldEnabled,
|
|
37728
37825
|
fiatCurrency,
|
|
37729
37826
|
handleSubmit,
|
|
37730
|
-
previousStep: modalState.previousStep
|
|
37827
|
+
previousStep: modalState.previousStep,
|
|
37828
|
+
isInputDisabled
|
|
37731
37829
|
}
|
|
37732
37830
|
);
|
|
37733
37831
|
return /* @__PURE__ */ React206.createElement(
|
|
@@ -37770,7 +37868,8 @@ function InputAmountLoaded({
|
|
|
37770
37868
|
currency: fiatCurrency,
|
|
37771
37869
|
onSelect: selectQuickOption,
|
|
37772
37870
|
options: quickOptions,
|
|
37773
|
-
percentMode: !isCardCheckout
|
|
37871
|
+
percentMode: !isCardCheckout,
|
|
37872
|
+
disabled: isInputDisabled
|
|
37774
37873
|
}
|
|
37775
37874
|
),
|
|
37776
37875
|
footer: meldEnabled ? getMeldFooter() : /* @__PURE__ */ React206.createElement(React206.Fragment, null, /* @__PURE__ */ React206.createElement(
|
|
@@ -37824,7 +37923,8 @@ function useAmountInputUI({
|
|
|
37824
37923
|
meldEnabled,
|
|
37825
37924
|
fiatCurrency,
|
|
37826
37925
|
handleSubmit,
|
|
37827
|
-
previousStep
|
|
37926
|
+
previousStep,
|
|
37927
|
+
isInputDisabled
|
|
37828
37928
|
}) {
|
|
37829
37929
|
const [isLayoutAnimating, setIsLayoutAnimating] = React206.useState(
|
|
37830
37930
|
previousStep === "confirmation" /* CONFIRMATION */
|
|
@@ -37839,12 +37939,19 @@ function useAmountInputUI({
|
|
|
37839
37939
|
}, []);
|
|
37840
37940
|
const { targetAssetTicker, finalizedToken } = checkoutConfig;
|
|
37841
37941
|
const handleIsAmountInAbsoluteToggle = () => {
|
|
37942
|
+
if (isInputDisabled) {
|
|
37943
|
+
return;
|
|
37944
|
+
}
|
|
37842
37945
|
setIsLayoutAnimating(true);
|
|
37843
37946
|
if (!finalizedToken) {
|
|
37844
37947
|
toggleInputInFiat();
|
|
37845
37948
|
}
|
|
37846
37949
|
};
|
|
37847
37950
|
const handleKeyDown = (event) => {
|
|
37951
|
+
if (isInputDisabled) {
|
|
37952
|
+
event.preventDefault();
|
|
37953
|
+
return;
|
|
37954
|
+
}
|
|
37848
37955
|
setIsLayoutAnimating(false);
|
|
37849
37956
|
if (event.key !== "Enter") {
|
|
37850
37957
|
return;
|
|
@@ -37859,11 +37966,11 @@ function useAmountInputUI({
|
|
|
37859
37966
|
/* @__PURE__ */ React206.createElement(
|
|
37860
37967
|
Box,
|
|
37861
37968
|
{
|
|
37862
|
-
color: "primaryText",
|
|
37969
|
+
color: isInputDisabled ? "actionColorDisabled" : "primaryText",
|
|
37863
37970
|
fontFamily: "inputAmount",
|
|
37864
37971
|
fontSize: "inherit",
|
|
37865
37972
|
fontWeight: "inputAmount",
|
|
37866
|
-
style: { whiteSpace: "pre" }
|
|
37973
|
+
style: { whiteSpace: "pre", opacity: isInputDisabled ? 0.5 : void 0 }
|
|
37867
37974
|
},
|
|
37868
37975
|
inputAffix.content
|
|
37869
37976
|
);
|
|
@@ -37875,7 +37982,8 @@ function useAmountInputUI({
|
|
|
37875
37982
|
autoFocus: true,
|
|
37876
37983
|
inputMode: "decimal",
|
|
37877
37984
|
spellCheck: false,
|
|
37878
|
-
type: "text"
|
|
37985
|
+
type: "text",
|
|
37986
|
+
disabled: isInputDisabled
|
|
37879
37987
|
},
|
|
37880
37988
|
inputStyle: {
|
|
37881
37989
|
fontSize: "inherit",
|
|
@@ -38052,7 +38160,7 @@ function useAmountInputUI({
|
|
|
38052
38160
|
color: { base: "secondaryText", hover: "actionColorHover" },
|
|
38053
38161
|
onClick: handleIsAmountInAbsoluteToggle,
|
|
38054
38162
|
borderRadius: "inputAmountSwitcher",
|
|
38055
|
-
isDisabled: meldEnabled
|
|
38163
|
+
isDisabled: meldEnabled || isInputDisabled
|
|
38056
38164
|
},
|
|
38057
38165
|
/* @__PURE__ */ React206.createElement(AnimatedWidthWrapper, null, /* @__PURE__ */ React206.createElement(Box, { display: "flex", alignItems: "center", gap: "0" }, !isInputInFiat ? /* @__PURE__ */ React206.createElement(motion10.div, { key: "fiat", layoutId: "fiat", ...motionProps.switch }, fiatDisplay, /* @__PURE__ */ React206.createElement(Backdrop, null)) : /* @__PURE__ */ React206.createElement(
|
|
38058
38166
|
motion10.div,
|
|
@@ -39260,8 +39368,8 @@ function LightningInvoiceQrCode({
|
|
|
39260
39368
|
QRCode,
|
|
39261
39369
|
{
|
|
39262
39370
|
withShadow: true,
|
|
39263
|
-
ecl: "
|
|
39264
|
-
logoSize:
|
|
39371
|
+
ecl: "M",
|
|
39372
|
+
logoSize: 20,
|
|
39265
39373
|
logoUrl: chainMetadataById2[lightningChain2.id]?.iconUrl,
|
|
39266
39374
|
size: 152,
|
|
39267
39375
|
uri: qrCodeUri,
|
|
@@ -40830,7 +40938,8 @@ function AccountSelectAsset({
|
|
|
40830
40938
|
address: walletAddress,
|
|
40831
40939
|
l2Address: mainAccountIndex
|
|
40832
40940
|
}),
|
|
40833
|
-
bridgeOverride: dynamicPath.bridgeOverride
|
|
40941
|
+
bridgeOverride: dynamicPath.bridgeOverride,
|
|
40942
|
+
dynamicRoutingId: checkoutConfig?.dynamicRoutingId
|
|
40834
40943
|
});
|
|
40835
40944
|
}
|
|
40836
40945
|
};
|
|
@@ -48598,16 +48707,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
48598
48707
|
return {
|
|
48599
48708
|
initSettings: {
|
|
48600
48709
|
...checkoutItem.initSettings,
|
|
48601
|
-
config:
|
|
48602
|
-
...config,
|
|
48603
|
-
targetAsset: path.targetAsset,
|
|
48604
|
-
targetChain: path.targetChain,
|
|
48605
|
-
targetAssetTicker: path.targetAssetTicker ?? config.targetAssetTicker,
|
|
48606
|
-
iconSrc: path.iconSrc ?? config.iconSrc,
|
|
48607
|
-
generateActionsParams: path.generateActionsParams,
|
|
48608
|
-
customRecipient: path.customRecipient,
|
|
48609
|
-
bridgeOverride: path.bridgeOverride
|
|
48610
|
-
}
|
|
48710
|
+
config: mergeDynamicRoutingIntoConfig(config, path)
|
|
48611
48711
|
}
|
|
48612
48712
|
};
|
|
48613
48713
|
});
|