@funkit/connect 1.0.26 → 1.0.27
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 +16 -0
- package/dist/components/FunTransactionSummary/FunTransactionSummary.d.ts +3 -1
- package/dist/components/FunkitProvider/FunkitConfigContext.d.ts +4 -2
- package/dist/components/FunkitProvider/FunkitConnectChainContext.d.ts +1 -5
- package/dist/components/FunkitProvider/provideFunkitConnectChains.d.ts +8 -0
- package/dist/config/getDefaultConfig.d.ts +3649 -0
- package/dist/hooks/useCheckoutChains.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +149 -115
- package/dist/utils/assets.d.ts +1 -1
- package/dist/utils/formatNumber.d.ts +1 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/chunk-4FQLUQNA.js +96 -0
- package/dist/wallets/walletConnectors/chunk-JLQ5HJYV.js +94 -0
- package/dist/wallets/walletConnectors/chunk-LVRXH33E.js +92 -0
- package/dist/wallets/walletConnectors/chunk-MIWCKFYE.js +87 -0
- package/dist/wallets/walletConnectors/chunk-Q4RLUJJD.js +66 -0
- package/dist/wallets/walletConnectors/chunk-SYELB4QO.js +107 -0
- package/dist/wallets/walletConnectors/chunk-ZBAQFL6G.js +102 -0
- package/dist/wallets/walletConnectors/chunk-ZUAHWUEL.js +98 -0
- 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 +79 -79
- 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 +3 -3
- package/dist/wallets/walletConnectors/chunk-VWZEDVW6.js +0 -27
- package/dist/wallets/walletConnectors/chunk-YC7XNS7C.js +0 -98
- package/dist/wallets/walletConnectors/{chunk-OR3PU2W4.js → chunk-2UXZAUWT.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-X255T3C4.js → chunk-3WZRNEZH.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-SL4VH23R.js → chunk-6LTLPR2Q.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-SQGFKNNZ.js → chunk-7CQPABJG.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-N3VZE65M.js → chunk-AM4SSLAP.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-XSSD5ZVD.js → chunk-NGXIHASN.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-FDIIMYTB.js → chunk-O5NKWWEG.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-2PC2XXUH.js → chunk-V45EXW7A.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-OAEJQOAV.js → chunk-Z2DGDHHZ.js} +4 -4
- package/dist/wallets/walletConnectors/{chunk-75A2U7T7.js → chunk-ZNXQ4V6G.js} +4 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useFunkitCheckoutChainsById: () => Record<number, import("..").Chain>;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { FunkitProvider } from './components/FunkitProvider/FunkitProvider';
|
|
|
5
5
|
export { useActiveTheme } from './components/FunkitProvider/FunkitThemeProvider';
|
|
6
6
|
export { FunkitSocialLoginMethod } from './components/FunkitProvider/FunkitWeb2Provider';
|
|
7
7
|
export { WalletButton } from './components/WalletButton/WalletButton';
|
|
8
|
+
export { getDefaultChains, getDefaultTransports, } from './config/getDefaultConfig';
|
|
8
9
|
export { getDefaultWallets } from './wallets/getDefaultWallets';
|
|
9
10
|
export { __private__ } from './__private__';
|
|
10
11
|
export type { DisclaimerComponent } from './components/FunkitProvider/AppContext';
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
en_US_default
|
|
4
4
|
} from "./chunk-SW6GAS7K.js";
|
|
5
|
-
import {
|
|
6
|
-
lightTheme
|
|
7
|
-
} from "./chunk-EYTYHIPM.js";
|
|
8
5
|
import {
|
|
9
6
|
darkTheme
|
|
10
7
|
} from "./chunk-4SROXH24.js";
|
|
8
|
+
import {
|
|
9
|
+
lightTheme
|
|
10
|
+
} from "./chunk-EYTYHIPM.js";
|
|
11
11
|
import "./chunk-UK5FXGK3.js";
|
|
12
12
|
|
|
13
13
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
@@ -310,7 +310,6 @@ var removeURLParameters = () => {
|
|
|
310
310
|
import { useConnect } from "wagmi";
|
|
311
311
|
|
|
312
312
|
// src/components/FunkitProvider/FunkitConnectChainContext.tsx
|
|
313
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO_LIST } from "@funkit/core";
|
|
314
313
|
import React2, { createContext as createContext2, useContext as useContext2, useMemo as useMemo2 } from "react";
|
|
315
314
|
import { useConfig } from "wagmi";
|
|
316
315
|
|
|
@@ -433,6 +432,13 @@ var provideFunkitConnectChains = (chains) => chains.map((chain) => {
|
|
|
433
432
|
iconBackground: (_d = chain.iconBackground) != null ? _d : defaultMetadata.iconBackground
|
|
434
433
|
};
|
|
435
434
|
});
|
|
435
|
+
var groupChainsById = (chains) => {
|
|
436
|
+
const chainsById = {};
|
|
437
|
+
chains.forEach((chainItem) => {
|
|
438
|
+
chainsById[chainItem.id] = chainItem;
|
|
439
|
+
});
|
|
440
|
+
return chainsById;
|
|
441
|
+
};
|
|
436
442
|
|
|
437
443
|
// src/components/FunkitProvider/FunkitConnectChainContext.tsx
|
|
438
444
|
var FunkitConnectChainContext = createContext2(
|
|
@@ -456,31 +462,8 @@ function FunkitConnectChainProvider({
|
|
|
456
462
|
}, children);
|
|
457
463
|
}
|
|
458
464
|
var useFunkitConnectChains = () => useContext2(FunkitConnectChainContext).chains;
|
|
465
|
+
var useFunkitConnectChainsById = () => groupChainsById(useFunkitConnectChains());
|
|
459
466
|
var useInitialChainId = () => useContext2(FunkitConnectChainContext).initialChainId;
|
|
460
|
-
var useAllPossibleFunkitConnectChains = () => provideFunkitConnectChains(
|
|
461
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO_LIST
|
|
462
|
-
);
|
|
463
|
-
function groupChainsById(chains) {
|
|
464
|
-
const chainsById = {};
|
|
465
|
-
chains.forEach((chainItem) => {
|
|
466
|
-
chainsById[chainItem.id] = chainItem;
|
|
467
|
-
});
|
|
468
|
-
return chainsById;
|
|
469
|
-
}
|
|
470
|
-
var useFunkitConnectChainsById = () => {
|
|
471
|
-
const funkitConnectChains = useFunkitConnectChains();
|
|
472
|
-
const enabledFunkitConnectChainsById = useMemo2(() => {
|
|
473
|
-
return groupChainsById(funkitConnectChains);
|
|
474
|
-
}, [funkitConnectChains]);
|
|
475
|
-
const allPossibleFunkitConnectChains = useAllPossibleFunkitConnectChains();
|
|
476
|
-
const allPossibleFunkitConnectChainsById = useMemo2(() => {
|
|
477
|
-
return groupChainsById(allPossibleFunkitConnectChains);
|
|
478
|
-
}, [allPossibleFunkitConnectChains]);
|
|
479
|
-
return {
|
|
480
|
-
enabledFunkitConnectChainsById,
|
|
481
|
-
allPossibleFunkitConnectChainsById
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
467
|
|
|
485
468
|
// src/components/FunkitProvider/ModalContext.tsx
|
|
486
469
|
import React150, {
|
|
@@ -602,9 +585,10 @@ var DEFAULT_TEXT_CUSTOMIZATIONS = {
|
|
|
602
585
|
payWith: "Pay With",
|
|
603
586
|
enterPaymentInfo: "Enter Payment Information"
|
|
604
587
|
};
|
|
588
|
+
var DEFAULT_PRIVY_APP_ID = "clnatprpv00sfmi0fv3qc185b";
|
|
605
589
|
var DEFAULT_FUNKIT_CONFIG = {
|
|
606
590
|
apiKey: "",
|
|
607
|
-
privyAppId:
|
|
591
|
+
privyAppId: DEFAULT_PRIVY_APP_ID,
|
|
608
592
|
appName: "",
|
|
609
593
|
appLogoSrc: "https://media.licdn.com/dms/image/D560BAQG0hO3xnlKy7Q/company-logo_200_200/0/1664326073952/funxyz_logo?e=2147483647&v=beta&t=MaS4CK29tMHkN3GSFqKWCb1DubIE-kBDYYfoiQJSed8",
|
|
610
594
|
appLogoBackgroundColor: "transparent",
|
|
@@ -1265,10 +1249,11 @@ function combineChainSymbolOrAddress({
|
|
|
1265
1249
|
var getNormalizedTokenBalance = (tokenBalance, decimals) => {
|
|
1266
1250
|
return Number(formatUnits(BigInt(tokenBalance), decimals));
|
|
1267
1251
|
};
|
|
1268
|
-
var isAssetUsableToPayForCheckout = (checkoutItem, paymentMethod, assetChainId, assetTokenAddress) => {
|
|
1252
|
+
var isAssetUsableToPayForCheckout = (checkoutItem, paymentMethod, assetChainId, assetTokenAddress, isWeb2Login, isWeb3Login) => {
|
|
1269
1253
|
const { isCheckoutPostActionRequired } = getCheckoutType(checkoutItem);
|
|
1270
1254
|
const isSameAsPurchasingToken = !isCheckoutPostActionRequired && paymentMethod === "balance" /* ACCOUNT_BALANCE */ && checkoutItem.initSettings.config.targetChain === assetChainId && checkoutItem.initSettings.config.targetAsset.toLowerCase() === assetTokenAddress.toLowerCase();
|
|
1271
|
-
const
|
|
1255
|
+
const isConnectedAccountSupported = isWeb2Login && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId].isFunWalletSupported || isWeb3Login || !isWeb2Login && !isWeb3Login;
|
|
1256
|
+
const isPickedChainSupportedForCheckout = isConnectedAccountSupported && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId].isCheckoutSupported;
|
|
1272
1257
|
const isUsable = !isSameAsPurchasingToken && isPickedChainSupportedForCheckout;
|
|
1273
1258
|
return {
|
|
1274
1259
|
isUsable,
|
|
@@ -1623,7 +1608,7 @@ var useFunkitSwitchChains = ({
|
|
|
1623
1608
|
});
|
|
1624
1609
|
const canSwitchChain = useCallback5(
|
|
1625
1610
|
(params) => {
|
|
1626
|
-
if (isWeb2Login && !FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO2[params.chainId]) {
|
|
1611
|
+
if (isWeb2Login && !FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO2[params.chainId].isFunWalletSupported) {
|
|
1627
1612
|
logger.warn(
|
|
1628
1613
|
`Unsupported chainId ${params.chainId} for funkit social logins`
|
|
1629
1614
|
);
|
|
@@ -1731,7 +1716,6 @@ import {
|
|
|
1731
1716
|
getAssetPriceInfoForCheckout as getAssetPriceInfoForCheckout2,
|
|
1732
1717
|
getCheckoutByDepositAddress,
|
|
1733
1718
|
getCheckoutQuote as getApiCheckoutQuote,
|
|
1734
|
-
getCheckoutsByFunWalletAddress,
|
|
1735
1719
|
getCheckoutsByRecipientAddress,
|
|
1736
1720
|
getMoonpayBuyQuoteForCreditCard,
|
|
1737
1721
|
HashZero,
|
|
@@ -2073,6 +2057,15 @@ function roundUpToXDecimalPlaces(inputNumber, decimalPlaces) {
|
|
|
2073
2057
|
const roundedNumber = parseFloat(roundedString);
|
|
2074
2058
|
return roundedNumber;
|
|
2075
2059
|
}
|
|
2060
|
+
var MIN_NUMBER = 0.01;
|
|
2061
|
+
function normalizeSmallUsdNumber(usdNumber) {
|
|
2062
|
+
if (!isNotNullish(usdNumber))
|
|
2063
|
+
return 0;
|
|
2064
|
+
const parsedNumber = parseFloat(usdNumber.toString());
|
|
2065
|
+
if (parsedNumber > 0 && parsedNumber < MIN_NUMBER)
|
|
2066
|
+
return MIN_NUMBER;
|
|
2067
|
+
return parsedNumber;
|
|
2068
|
+
}
|
|
2076
2069
|
|
|
2077
2070
|
// src/utils/checkout.ts
|
|
2078
2071
|
var CHECKOUT_EXPIRATION_TIMESTAMP_UPPERBOUND = 36e5;
|
|
@@ -2421,16 +2414,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2421
2414
|
try {
|
|
2422
2415
|
let newCheckoutHistoryList = [];
|
|
2423
2416
|
setIsRefreshingCheckoutHistory(true);
|
|
2424
|
-
if (
|
|
2425
|
-
const funWalletAddress = await (funWallet == null ? void 0 : funWallet.getAddress());
|
|
2426
|
-
if (funWalletAddress) {
|
|
2427
|
-
logger.log("getCheckoutsByFunWalletAddress");
|
|
2428
|
-
newCheckoutHistoryList = await getCheckoutsByFunWalletAddress({
|
|
2429
|
-
funWalletAddress,
|
|
2430
|
-
apiKey: funkitConfig.apiKey
|
|
2431
|
-
});
|
|
2432
|
-
}
|
|
2433
|
-
} else if (isWeb3Login) {
|
|
2417
|
+
if (isUserLoggedIn) {
|
|
2434
2418
|
logger.log("getCheckoutsByRecipientAddress");
|
|
2435
2419
|
newCheckoutHistoryList = await getCheckoutsByRecipientAddress({
|
|
2436
2420
|
recipientAddress: walletAddress,
|
|
@@ -2707,7 +2691,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2707
2691
|
toChainId: checkoutItem.initSettings.config.targetChain,
|
|
2708
2692
|
toTokenAddress: checkoutItem.initSettings.config.targetAsset,
|
|
2709
2693
|
toTokenAmount: checkoutItem.initSettings.config.targetAssetAmount,
|
|
2710
|
-
recipientAddr: inputCustomRecipient ? inputCustomRecipient :
|
|
2694
|
+
recipientAddr: inputCustomRecipient ? inputCustomRecipient : walletAddress,
|
|
2711
2695
|
expirationTimestampMs: parseInt(
|
|
2712
2696
|
checkoutItem.initSettings.config.expirationTimestampMs.toString()
|
|
2713
2697
|
),
|
|
@@ -2832,12 +2816,18 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2832
2816
|
) + parseFloat(dummyPreviewTransfer.previewResult.customClientFee.fee);
|
|
2833
2817
|
additionalTimeMs += MESH_TIME_ESTIMATE_MS;
|
|
2834
2818
|
}
|
|
2835
|
-
const totalNetworkFeesUsd =
|
|
2836
|
-
networkFeesUsdBreakdown
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
)
|
|
2819
|
+
const totalNetworkFeesUsd = normalizeSmallUsdNumber(
|
|
2820
|
+
Object.values(networkFeesUsdBreakdown).reduce(
|
|
2821
|
+
(acc, cur) => acc += cur,
|
|
2822
|
+
0
|
|
2823
|
+
)
|
|
2824
|
+
);
|
|
2825
|
+
const totalPlatformFeesUsd = normalizeSmallUsdNumber(
|
|
2826
|
+
Object.values(platformFeesUsdBreakdown).reduce(
|
|
2827
|
+
(acc, cur) => acc += cur,
|
|
2828
|
+
0
|
|
2829
|
+
)
|
|
2830
|
+
);
|
|
2841
2831
|
const finalFeesBreakdown = {
|
|
2842
2832
|
networkFeesUsd: totalNetworkFeesUsd,
|
|
2843
2833
|
networkFeesUsdBreakdown,
|
|
@@ -2864,8 +2854,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2864
2854
|
finalTimeEstimationMs,
|
|
2865
2855
|
finalTotalUsd: (newFinalDollarValue + finalFeesBreakdown.totalFeesUsd).toString()
|
|
2866
2856
|
};
|
|
2867
|
-
|
|
2868
|
-
logger.log("finalQuote", { finalEstimation, finalTotalUsdAlt });
|
|
2857
|
+
logger.log("finalQuote", finalEstimation);
|
|
2869
2858
|
(_g = (_f = checkoutItem == null ? void 0 : checkoutItem.initSettings) == null ? void 0 : _f.onEstimation) == null ? void 0 : _g.call(_f, finalEstimation);
|
|
2870
2859
|
if (newPaymentMethodInfo.paymentMethod === "balance" /* ACCOUNT_BALANCE */) {
|
|
2871
2860
|
const { result } = await hasSufficientBalance(
|
|
@@ -3047,13 +3036,9 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
3047
3036
|
}
|
|
3048
3037
|
logger.log("shouldbatchOpBypassInit", { shouldbatchOpBypassInit });
|
|
3049
3038
|
let batchUserOp = null;
|
|
3050
|
-
const {
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
isEoaWithNoActions,
|
|
3054
|
-
isCheckoutCrFlow
|
|
3055
|
-
});
|
|
3056
|
-
if (!isCheckoutCrFlow && !isEoaWithNoActions) {
|
|
3039
|
+
const { isCheckoutPostActionRequired } = getCheckoutType(checkoutItem);
|
|
3040
|
+
logger.log("beforeSignatureChecks", { isCheckoutPostActionRequired });
|
|
3041
|
+
if (isCheckoutPostActionRequired) {
|
|
3057
3042
|
const signedBatchOperation = await _generateSignedBatchOperation(
|
|
3058
3043
|
checkoutItem.initSettings.config.actionsParams,
|
|
3059
3044
|
checkoutItem.initSettings.config.targetChain,
|
|
@@ -3247,11 +3232,10 @@ var useFunkitAllPostCheckoutsInternal = () => {
|
|
|
3247
3232
|
var useFunkitCheckout = (props) => {
|
|
3248
3233
|
const { onValidation, onError } = props;
|
|
3249
3234
|
const propsConfig = useMemo5(() => (props == null ? void 0 : props.config) || {}, [props == null ? void 0 : props.config]);
|
|
3250
|
-
const actualWagmiConfig = useConfig2();
|
|
3251
3235
|
const { _initNewCheckout } = useContext10(FunkitCheckoutContext);
|
|
3252
3236
|
const { openFunCheckoutModal } = useFunCheckoutModal();
|
|
3253
3237
|
const { openConnectModal } = useConnectModal();
|
|
3254
|
-
const {
|
|
3238
|
+
const { isUserLoggedIn } = useGeneralWallet();
|
|
3255
3239
|
const onErrorWrapper = useCallback7(
|
|
3256
3240
|
(payload) => {
|
|
3257
3241
|
logger.warn(payload.message, payload);
|
|
@@ -3288,7 +3272,7 @@ var useFunkitCheckout = (props) => {
|
|
|
3288
3272
|
if (isUserLoggedIn || !!finalConfig.customRecipient) {
|
|
3289
3273
|
setPendingCheckoutConfig(void 0);
|
|
3290
3274
|
if (isUserLoggedIn) {
|
|
3291
|
-
if (!FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5[finalConfig.targetChain].
|
|
3275
|
+
if (!FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5[finalConfig.targetChain].isMainnet) {
|
|
3292
3276
|
onErrorWrapper == null ? void 0 : onErrorWrapper({
|
|
3293
3277
|
type: "error",
|
|
3294
3278
|
message: "Unable to begin a new checkout: Insufficient funds on testnet account",
|
|
@@ -3821,8 +3805,7 @@ function FunAssetAvatar({
|
|
|
3821
3805
|
prioritizeDefaults = true,
|
|
3822
3806
|
hideIfUnknown = false
|
|
3823
3807
|
}) {
|
|
3824
|
-
const
|
|
3825
|
-
const chainInfo = allPossibleFunkitConnectChainsById[parseInt((chainId || "").toString())] || null;
|
|
3808
|
+
const chainMetadata = chainMetadataById[parseInt((chainId || "").toString())] || null;
|
|
3826
3809
|
const finalAssetSrc = useMemo7(() => {
|
|
3827
3810
|
var _a;
|
|
3828
3811
|
const normalizedTicker = (assetTicker == null ? void 0 : assetTicker.toUpperCase()) || "";
|
|
@@ -3853,18 +3836,18 @@ function FunAssetAvatar({
|
|
|
3853
3836
|
height: assetIconSize,
|
|
3854
3837
|
width: assetIconSize,
|
|
3855
3838
|
testId: `fun-asset-${assetTicker}-icon`
|
|
3856
|
-
})), isNotNullish(
|
|
3839
|
+
})), isNotNullish(chainMetadata) ? /* @__PURE__ */ React26.createElement(Box, {
|
|
3857
3840
|
width: chainIconSize,
|
|
3858
3841
|
height: chainIconSize,
|
|
3859
3842
|
className: chainContainerStyle
|
|
3860
3843
|
}, /* @__PURE__ */ React26.createElement(AsyncImage, {
|
|
3861
|
-
alt:
|
|
3862
|
-
src:
|
|
3863
|
-
background:
|
|
3844
|
+
alt: chainMetadata.name,
|
|
3845
|
+
src: chainMetadata.iconUrl || "",
|
|
3846
|
+
background: chainMetadata.iconBackground,
|
|
3864
3847
|
borderRadius: "full",
|
|
3865
3848
|
height: chainIconSize,
|
|
3866
3849
|
width: chainIconSize,
|
|
3867
|
-
testId: `fun-asset-chain-${
|
|
3850
|
+
testId: `fun-asset-chain-${chainId}-icon`
|
|
3868
3851
|
})) : null);
|
|
3869
3852
|
}
|
|
3870
3853
|
|
|
@@ -4237,7 +4220,7 @@ import {
|
|
|
4237
4220
|
getTokenInfo as getTokenInfo2
|
|
4238
4221
|
} from "@funkit/core";
|
|
4239
4222
|
import React79, { useCallback as useCallback20, useEffect as useEffect19, useMemo as useMemo20, useState as useState24 } from "react";
|
|
4240
|
-
import { mainnet as mainnet3 } from "viem/chains";
|
|
4223
|
+
import { arbitrum, mainnet as mainnet3, zkSync } from "viem/chains";
|
|
4241
4224
|
|
|
4242
4225
|
// src/hooks/useCheckoutAccountBalanceTransfer.ts
|
|
4243
4226
|
import { useCallback as useCallback9 } from "react";
|
|
@@ -6878,7 +6861,7 @@ function FunPaymentMethods({
|
|
|
6878
6861
|
);
|
|
6879
6862
|
const [isContinuing, setIsContinuing] = useState19(false);
|
|
6880
6863
|
useWalletAssetsListener();
|
|
6881
|
-
const { walletAssets } = useGeneralWallet();
|
|
6864
|
+
const { walletAssets, isWeb3Login, isWeb2Login } = useGeneralWallet();
|
|
6882
6865
|
const {
|
|
6883
6866
|
checkoutItem,
|
|
6884
6867
|
reDraftSymbol,
|
|
@@ -6906,7 +6889,9 @@ function FunPaymentMethods({
|
|
|
6906
6889
|
checkoutItem,
|
|
6907
6890
|
"balance" /* ACCOUNT_BALANCE */,
|
|
6908
6891
|
asset.chainId,
|
|
6909
|
-
asset.contractAddress
|
|
6892
|
+
asset.contractAddress,
|
|
6893
|
+
isWeb2Login,
|
|
6894
|
+
isWeb3Login
|
|
6910
6895
|
);
|
|
6911
6896
|
return isUsable && asset.totalUsdValue >= parseFloat(depositInfo == null ? void 0 : depositInfo.amount);
|
|
6912
6897
|
});
|
|
@@ -7229,7 +7214,8 @@ function FunTxSummaryDivider() {
|
|
|
7229
7214
|
// src/components/FunTransactionSummary/FunTransactionSummary.tsx
|
|
7230
7215
|
function FeesLineItem({
|
|
7231
7216
|
feesItem,
|
|
7232
|
-
isLoading
|
|
7217
|
+
isLoading,
|
|
7218
|
+
paymentMethod
|
|
7233
7219
|
}) {
|
|
7234
7220
|
const [isExpanded, setIsExpanded] = useState20(false);
|
|
7235
7221
|
const toggle = () => setIsExpanded(!isExpanded);
|
|
@@ -7283,7 +7269,7 @@ function FeesLineItem({
|
|
|
7283
7269
|
}, formatCurrencyAndStringify(
|
|
7284
7270
|
parseFloat(feesItem.transactionFeesUsd.toString())
|
|
7285
7271
|
))) : null), /* @__PURE__ */ React71.createElement(FunTxSummaryLineItem, null, /* @__PURE__ */ React71.createElement(FunTxSummaryLineItemKeyText, {
|
|
7286
|
-
text: "Platform Fees"
|
|
7272
|
+
text: paymentMethod === "card" /* CARD */ ? "Card Processing Fees" : "Platform Fees"
|
|
7287
7273
|
}), isLoading ? /* @__PURE__ */ React71.createElement(Box, {
|
|
7288
7274
|
color: "modalTextSecondary"
|
|
7289
7275
|
}, /* @__PURE__ */ React71.createElement(SpinnerIcon, {
|
|
@@ -7317,7 +7303,8 @@ function FunTransactionSummary({
|
|
|
7317
7303
|
symbol = "",
|
|
7318
7304
|
paymentTokenString,
|
|
7319
7305
|
suffixComponent,
|
|
7320
|
-
errorMessage = ""
|
|
7306
|
+
errorMessage = "",
|
|
7307
|
+
paymentMethod
|
|
7321
7308
|
}) {
|
|
7322
7309
|
return /* @__PURE__ */ React71.createElement(Box, null, /* @__PURE__ */ React71.createElement(Box, {
|
|
7323
7310
|
paddingBottom: "8"
|
|
@@ -7357,7 +7344,8 @@ function FunTransactionSummary({
|
|
|
7357
7344
|
style: { textAlign: "end" }
|
|
7358
7345
|
}, paymentTokenString))), /* @__PURE__ */ React71.createElement(FunTxSummaryDivider, null)) : null, /* @__PURE__ */ React71.createElement(FeesLineItem, {
|
|
7359
7346
|
feesItem: estFees,
|
|
7360
|
-
isLoading
|
|
7347
|
+
isLoading,
|
|
7348
|
+
paymentMethod
|
|
7361
7349
|
}), /* @__PURE__ */ React71.createElement(FunTxSummaryDivider, null), /* @__PURE__ */ React71.createElement(FunTxSummaryLineItem, null, /* @__PURE__ */ React71.createElement(FunTxSummaryLineItemKeyText, {
|
|
7362
7350
|
text: "Est. Processing Time"
|
|
7363
7351
|
}), isLoading ? /* @__PURE__ */ React71.createElement(Box, {
|
|
@@ -7395,7 +7383,7 @@ function FunCheckoutConfirmationStep({
|
|
|
7395
7383
|
onFinish,
|
|
7396
7384
|
animateOut
|
|
7397
7385
|
}) {
|
|
7398
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
7386
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
7399
7387
|
const { writeContractAsync } = useWriteContract();
|
|
7400
7388
|
const { sendTransactionAsync } = useSendTransaction();
|
|
7401
7389
|
const { checkoutItem, updateSelectedPaymentMethodInfo, confirmCheckout } = useFunkitPreCheckoutInternal(checkoutId);
|
|
@@ -7746,13 +7734,14 @@ function FunCheckoutConfirmationStep({
|
|
|
7746
7734
|
(_t = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _t.finalFeesBreakdown.platformFeesUsd
|
|
7747
7735
|
)
|
|
7748
7736
|
},
|
|
7749
|
-
|
|
7737
|
+
paymentMethod: (_u = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _u.paymentMethod,
|
|
7738
|
+
estTime: (((_v = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _v.finalTimeEstimationMs) || 0) / 1e3 || 0,
|
|
7750
7739
|
hasTotal: true,
|
|
7751
|
-
total: parseInputToNumber((
|
|
7740
|
+
total: parseInputToNumber((_w = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _w.finalTotalUsd),
|
|
7752
7741
|
isLoading: (checkoutItem == null ? void 0 : checkoutItem.isQuoting) || (checkoutItem == null ? void 0 : checkoutItem.isDrafting),
|
|
7753
7742
|
hasPaymentToken: true,
|
|
7754
7743
|
paymentTokenString,
|
|
7755
|
-
symbol: (
|
|
7744
|
+
symbol: (_x = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _x.symbol,
|
|
7756
7745
|
errorMessage: hasDraftValueAndMethodError ? generateInsufficientAmountForMoonpayError(
|
|
7757
7746
|
1 /* CHECKOUT */,
|
|
7758
7747
|
false
|
|
@@ -7815,12 +7804,11 @@ function FunCheckoutInputAmountStep({
|
|
|
7815
7804
|
}) {
|
|
7816
7805
|
const { active: active2 } = useActiveTheme();
|
|
7817
7806
|
const { checkoutItem, updateTargetAssetAmount, getCheckoutDraftDollarValue } = useFunkitPreCheckoutInternal(checkoutId);
|
|
7818
|
-
const
|
|
7819
|
-
const [
|
|
7820
|
-
|
|
7821
|
-
);
|
|
7822
|
-
const [
|
|
7823
|
-
const [unitPrice, setUnitPrice] = useState22(0);
|
|
7807
|
+
const [isAmountInAbsolute, setIsAmountInAbsolute] = useState22(false);
|
|
7808
|
+
const [isInited, setIsInited] = useState22(false);
|
|
7809
|
+
const initialAssetAmount = (checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetAssetAmount) || 0;
|
|
7810
|
+
const [amountInput, setAmountInput] = useState22("");
|
|
7811
|
+
const [unitPrice, setUnitPrice] = useState22(null);
|
|
7824
7812
|
const [errorMessage, setErrorMessage] = useState22("");
|
|
7825
7813
|
const [rotateIconAnimation, setRotateIconAnimation] = useState22(false);
|
|
7826
7814
|
useEffect17(() => {
|
|
@@ -7843,10 +7831,32 @@ function FunCheckoutInputAmountStep({
|
|
|
7843
7831
|
const id = setInterval(fetchPrice, 5e3);
|
|
7844
7832
|
return () => clearInterval(id);
|
|
7845
7833
|
}, []);
|
|
7834
|
+
useEffect17(() => {
|
|
7835
|
+
if (unitPrice == null || isInited)
|
|
7836
|
+
return;
|
|
7837
|
+
if (isAmountInAbsolute) {
|
|
7838
|
+
setAmountInput(
|
|
7839
|
+
initialAssetAmount === 0 ? "" : initialAssetAmount.toFixed(5)
|
|
7840
|
+
);
|
|
7841
|
+
} else {
|
|
7842
|
+
const initialUsdAmount = unitPrice * Number(initialAssetAmount);
|
|
7843
|
+
setAmountInput(initialUsdAmount === 0 ? "" : initialUsdAmount.toFixed(2));
|
|
7844
|
+
}
|
|
7845
|
+
setIsInited(true);
|
|
7846
|
+
}, [initialAssetAmount, isAmountInAbsolute, isInited, unitPrice]);
|
|
7846
7847
|
const finalAmounts = useMemo18(() => {
|
|
7848
|
+
if (unitPrice == null) {
|
|
7849
|
+
return {
|
|
7850
|
+
usdEquivalent: 0,
|
|
7851
|
+
absoluteEquivalent: 0
|
|
7852
|
+
};
|
|
7853
|
+
}
|
|
7847
7854
|
const usdEquivalent = isAmountInAbsolute ? unitPrice * Number(amountInput) : Number(amountInput);
|
|
7848
7855
|
const absoluteEquivalent = isAmountInAbsolute ? Number(amountInput) : Number(amountInput) / unitPrice;
|
|
7849
|
-
return {
|
|
7856
|
+
return {
|
|
7857
|
+
usdEquivalent: parseFloat(usdEquivalent.toFixed(2)),
|
|
7858
|
+
absoluteEquivalent: parseFloat(absoluteEquivalent.toFixed(5))
|
|
7859
|
+
};
|
|
7850
7860
|
}, [amountInput, isAmountInAbsolute, unitPrice]);
|
|
7851
7861
|
const [isContinuing, setIsContinuing] = useState22(false);
|
|
7852
7862
|
const onClickContinue = useCallback18(async () => {
|
|
@@ -7868,7 +7878,14 @@ function FunCheckoutInputAmountStep({
|
|
|
7868
7878
|
paddingY: "24",
|
|
7869
7879
|
width: "full",
|
|
7870
7880
|
className: animateOut ? animateContentOutClass : animateContentInClass
|
|
7871
|
-
}, /* @__PURE__ */ React74.createElement(Box, {
|
|
7881
|
+
}, unitPrice == null && !errorMessage ? /* @__PURE__ */ React74.createElement(Box, {
|
|
7882
|
+
display: "flex",
|
|
7883
|
+
flexDirection: "column",
|
|
7884
|
+
justifyContent: "center",
|
|
7885
|
+
alignItems: "center",
|
|
7886
|
+
width: "full",
|
|
7887
|
+
style: { height: 130 }
|
|
7888
|
+
}, /* @__PURE__ */ React74.createElement(SpinnerIcon, null)) : /* @__PURE__ */ React74.createElement(Box, {
|
|
7872
7889
|
display: "flex",
|
|
7873
7890
|
flexDirection: "column",
|
|
7874
7891
|
justifyContent: "center",
|
|
@@ -7876,18 +7893,23 @@ function FunCheckoutInputAmountStep({
|
|
|
7876
7893
|
gap: "8",
|
|
7877
7894
|
width: "full"
|
|
7878
7895
|
}, /* @__PURE__ */ React74.createElement(FunInput, {
|
|
7879
|
-
value: isAmountInAbsolute ? amountInput : `$${amountInput}`,
|
|
7880
|
-
placeholder: isAmountInAbsolute ? "0" : "$0.00",
|
|
7896
|
+
value: amountInput === "" ? void 0 : isAmountInAbsolute ? amountInput : `$${amountInput}`,
|
|
7897
|
+
placeholder: isAmountInAbsolute ? "0.00000" : "$0.00",
|
|
7881
7898
|
onChange: (newAmount) => {
|
|
7882
7899
|
let newValue = newAmount.target.value;
|
|
7883
|
-
if (!isAmountInAbsolute) {
|
|
7884
|
-
newValue
|
|
7900
|
+
if (!isAmountInAbsolute && newValue.startsWith("$")) {
|
|
7901
|
+
if (newValue === "$") {
|
|
7902
|
+
newValue = "";
|
|
7903
|
+
} else if (newValue.length > 0) {
|
|
7904
|
+
newValue = newValue.slice(1);
|
|
7905
|
+
}
|
|
7885
7906
|
}
|
|
7886
7907
|
setAmountInput(newValue);
|
|
7887
7908
|
},
|
|
7888
7909
|
inputProps: {
|
|
7889
7910
|
type: isAmountInAbsolute ? "number" : "text",
|
|
7890
|
-
autoFocus: true
|
|
7911
|
+
autoFocus: true,
|
|
7912
|
+
disabled: isContinuing || unitPrice == null
|
|
7891
7913
|
},
|
|
7892
7914
|
inputStyle: {
|
|
7893
7915
|
textAlign: "center",
|
|
@@ -7909,14 +7931,16 @@ function FunCheckoutInputAmountStep({
|
|
|
7909
7931
|
gap: "4"
|
|
7910
7932
|
}, /* @__PURE__ */ React74.createElement(Text, {
|
|
7911
7933
|
color: "modalTextSecondary"
|
|
7912
|
-
}, isAmountInAbsolute ?
|
|
7934
|
+
}, isAmountInAbsolute ? formatCurrencyAndStringify(finalAmounts.usdEquivalent) : formatCryptoAndStringify(finalAmounts.absoluteEquivalent)), /* @__PURE__ */ React74.createElement(FunIconButton, {
|
|
7913
7935
|
size: "20",
|
|
7914
7936
|
showBorder: false,
|
|
7915
7937
|
icon: /* @__PURE__ */ React74.createElement(SwitchIcon, null),
|
|
7916
7938
|
onClick: () => {
|
|
7917
7939
|
setRotateIconAnimation(true);
|
|
7918
7940
|
setAmountInput(
|
|
7919
|
-
isAmountInAbsolute ? finalAmounts.usdEquivalent
|
|
7941
|
+
isAmountInAbsolute ? finalAmounts.usdEquivalent === 0 ? "" : formatCurrencyAndStringify(
|
|
7942
|
+
finalAmounts.usdEquivalent
|
|
7943
|
+
).slice(1) : finalAmounts.absoluteEquivalent === 0 ? "" : formatCryptoAndStringify(finalAmounts.absoluteEquivalent)
|
|
7920
7944
|
);
|
|
7921
7945
|
setIsAmountInAbsolute(!isAmountInAbsolute);
|
|
7922
7946
|
setTimeout(() => {
|
|
@@ -7937,7 +7961,7 @@ function FunCheckoutInputAmountStep({
|
|
|
7937
7961
|
}
|
|
7938
7962
|
})), /* @__PURE__ */ React74.createElement(FunButton, {
|
|
7939
7963
|
title: "Continue",
|
|
7940
|
-
isDisabled: isContinuing || (finalAmounts.absoluteEquivalent || 0) <= 0 || finalAmounts.usdEquivalent <= 0,
|
|
7964
|
+
isDisabled: unitPrice == null || isContinuing || (finalAmounts.absoluteEquivalent || 0) <= 0 || finalAmounts.usdEquivalent <= 0,
|
|
7941
7965
|
titleSuffix: isContinuing ? /* @__PURE__ */ React74.createElement(Box, {
|
|
7942
7966
|
display: "flex",
|
|
7943
7967
|
alignItems: "center",
|
|
@@ -8084,7 +8108,7 @@ function MeshOrAccountSelectAsset({
|
|
|
8084
8108
|
useWalletAssetsListener(
|
|
8085
8109
|
((_d = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _d.paymentMethod) === "balance" /* ACCOUNT_BALANCE */
|
|
8086
8110
|
);
|
|
8087
|
-
const { walletAssets } = useGeneralWallet();
|
|
8111
|
+
const { walletAssets, isWeb2Login, isWeb3Login } = useGeneralWallet();
|
|
8088
8112
|
const generateAccountHoldingsMapForMesh = useCallback19(async () => {
|
|
8089
8113
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
8090
8114
|
if (funkitConfig == null ? void 0 : funkitConfig.apiKey) {
|
|
@@ -8165,12 +8189,12 @@ function MeshOrAccountSelectAsset({
|
|
|
8165
8189
|
const generateAccountHoldingsMapForBalance = useCallback19(async () => {
|
|
8166
8190
|
const itemMap = {};
|
|
8167
8191
|
const checkoutTargetChainId = checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain;
|
|
8168
|
-
const isCheckoutOnMainnet = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[checkoutTargetChainId || ""].
|
|
8192
|
+
const isCheckoutOnMainnet = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[checkoutTargetChainId || ""].isMainnet;
|
|
8169
8193
|
Object.values(walletAssets || {}).forEach((fwAsset) => {
|
|
8170
8194
|
var _a2, _b2, _c2, _d2;
|
|
8171
8195
|
if (!fwAsset.symbol || !fwAsset.contractAddress)
|
|
8172
8196
|
return;
|
|
8173
|
-
const isAssetOnMainnet = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[fwAsset.chainId].
|
|
8197
|
+
const isAssetOnMainnet = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[fwAsset.chainId].isMainnet;
|
|
8174
8198
|
if (isCheckoutOnMainnet && !isAssetOnMainnet)
|
|
8175
8199
|
return;
|
|
8176
8200
|
if (!isCheckoutOnMainnet && checkoutTargetChainId !== fwAsset.chainId)
|
|
@@ -8234,7 +8258,9 @@ function MeshOrAccountSelectAsset({
|
|
|
8234
8258
|
checkoutItem,
|
|
8235
8259
|
(_a3 = checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _a3.paymentMethod,
|
|
8236
8260
|
item.pickedChainId,
|
|
8237
|
-
item.tokenAddress
|
|
8261
|
+
item.tokenAddress,
|
|
8262
|
+
isWeb2Login,
|
|
8263
|
+
isWeb3Login
|
|
8238
8264
|
);
|
|
8239
8265
|
const isKnownToken = !!item.usdAmount;
|
|
8240
8266
|
const isTokenDisabled = !isUsable || !isKnownToken;
|
|
@@ -8683,20 +8709,21 @@ function FunCheckoutModal({
|
|
|
8683
8709
|
);
|
|
8684
8710
|
const isNyOrTxOrVi = userIpInfo ? userIpInfo.alpha2 === "US" && ["NY", "TX", "VI"].includes(userIpInfo.state) : false;
|
|
8685
8711
|
const isCanada = userIpInfo ? userIpInfo.alpha2 === "CA" : false;
|
|
8686
|
-
const
|
|
8687
|
-
const
|
|
8712
|
+
const originalTargetChainId = checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain.toString();
|
|
8713
|
+
const moonpayChainId = originalTargetChainId === zkSync.id.toString() ? arbitrum.id.toString() : originalTargetChainId;
|
|
8714
|
+
const wethAddrOnTargetChain = (await getTokenInfo2("weth", moonpayChainId)).toLowerCase();
|
|
8688
8715
|
const isTargetAssetEthOrWeth = [NATIVE_TOKEN, wethAddrOnTargetChain].includes(
|
|
8689
8716
|
(_a2 = checkoutItem == null ? void 0 : checkoutItem.initSettings) == null ? void 0 : _a2.config.targetAsset
|
|
8690
|
-
) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[
|
|
8717
|
+
) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[moonpayChainId].nativeCurrency.symbol === "ETH" /* ETH */;
|
|
8691
8718
|
let sourceTokenAddress;
|
|
8692
8719
|
let sourceTokenTicker;
|
|
8693
8720
|
let sourceTokenChainId;
|
|
8694
8721
|
if (isCanada) {
|
|
8695
8722
|
sourceTokenTicker = "ETH" /* ETH */;
|
|
8696
8723
|
sourceTokenAddress = NATIVE_TOKEN;
|
|
8697
|
-
sourceTokenChainId =
|
|
8724
|
+
sourceTokenChainId = moonpayChainId;
|
|
8698
8725
|
} else {
|
|
8699
|
-
sourceTokenChainId = isNyOrTxOrVi ? mainnet3.id.toString() :
|
|
8726
|
+
sourceTokenChainId = isNyOrTxOrVi ? mainnet3.id.toString() : moonpayChainId;
|
|
8700
8727
|
if (isTargetAssetEthOrWeth) {
|
|
8701
8728
|
sourceTokenTicker = "ETH" /* ETH */;
|
|
8702
8729
|
sourceTokenAddress = NATIVE_TOKEN;
|
|
@@ -9308,8 +9335,8 @@ function ChainLineItem({
|
|
|
9308
9335
|
chainIconSize,
|
|
9309
9336
|
gap = "12"
|
|
9310
9337
|
}) {
|
|
9311
|
-
const
|
|
9312
|
-
const chainItem =
|
|
9338
|
+
const enabledChainMap = useFunkitConnectChainsById();
|
|
9339
|
+
const chainItem = enabledChainMap[chainId];
|
|
9313
9340
|
if (!chainItem)
|
|
9314
9341
|
return null;
|
|
9315
9342
|
return /* @__PURE__ */ React83.createElement(Box, {
|
|
@@ -10580,7 +10607,8 @@ function FunOnrampConfirmationStep({
|
|
|
10580
10607
|
hasTotal: true,
|
|
10581
10608
|
total: totalAmountUsd,
|
|
10582
10609
|
isLoading: isFetchingEstimatedFees,
|
|
10583
|
-
errorMessage: estimationError
|
|
10610
|
+
errorMessage: estimationError,
|
|
10611
|
+
paymentMethod: paymentMethodInfo.paymentMethod
|
|
10584
10612
|
})), /* @__PURE__ */ React99.createElement(Box, {
|
|
10585
10613
|
display: "flex",
|
|
10586
10614
|
flexDirection: "column",
|
|
@@ -16237,7 +16265,7 @@ function ConnectButtonRenderer({
|
|
|
16237
16265
|
const isCurrentChainSupported = wagmiChains.some(
|
|
16238
16266
|
(chain) => chain.id === chainId
|
|
16239
16267
|
);
|
|
16240
|
-
const funkitConnectChainsById = useFunkitConnectChainsById()
|
|
16268
|
+
const funkitConnectChainsById = useFunkitConnectChainsById();
|
|
16241
16269
|
const authenticationStatus = (_a = useAuthenticationStatus()) != null ? _a : void 0;
|
|
16242
16270
|
const funkitConnectChain = chainId ? funkitConnectChainsById[chainId] : void 0;
|
|
16243
16271
|
const chainName = (_b = funkitConnectChain == null ? void 0 : funkitConnectChain.name) != null ? _b : void 0;
|
|
@@ -16549,6 +16577,7 @@ function cssStringFromTheme(theme, options = {}) {
|
|
|
16549
16577
|
}
|
|
16550
16578
|
|
|
16551
16579
|
// src/config/getDefaultConfig.ts
|
|
16580
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST } from "@funkit/core";
|
|
16552
16581
|
import { http } from "wagmi";
|
|
16553
16582
|
import { createConfig } from "wagmi";
|
|
16554
16583
|
|
|
@@ -17201,6 +17230,14 @@ var getDefaultConfig = ({
|
|
|
17201
17230
|
...restWagmiParameters
|
|
17202
17231
|
});
|
|
17203
17232
|
};
|
|
17233
|
+
var getDefaultChains = () => FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST;
|
|
17234
|
+
var getDefaultTransports = () => {
|
|
17235
|
+
const chains = getDefaultChains();
|
|
17236
|
+
return chains.reduce((acc, chain) => {
|
|
17237
|
+
acc[chain.id] = chain.rpcUrls.default.http[0];
|
|
17238
|
+
return acc;
|
|
17239
|
+
}, {});
|
|
17240
|
+
};
|
|
17204
17241
|
|
|
17205
17242
|
// src/wallets/walletConnectors/funkitConnectWallet/funkitConnectWallet.ts
|
|
17206
17243
|
import { funkitWagmiConnectorWallet } from "@funkit/wagmi-tools";
|
|
@@ -17261,11 +17298,6 @@ function validateFunkitConfig(props) {
|
|
|
17261
17298
|
if (!funkitConfig.apiKey) {
|
|
17262
17299
|
throw new Error("Invalid funkitConfig: Missing apiKey.");
|
|
17263
17300
|
}
|
|
17264
|
-
if (!funkitConfig.privyAppId && funkitConfig.loginModalConfig.web2) {
|
|
17265
|
-
throw new Error(
|
|
17266
|
-
"Invalid funkitConfig: Web2 login option enabled but missing privyAppId."
|
|
17267
|
-
);
|
|
17268
|
-
}
|
|
17269
17301
|
if (!funkitConfig.appName) {
|
|
17270
17302
|
throw new Error("Invalid funkitConfig: Missing appName.");
|
|
17271
17303
|
}
|
|
@@ -17325,7 +17357,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
17325
17357
|
localStorage.setItem(storageKey6, version);
|
|
17326
17358
|
}
|
|
17327
17359
|
function getCurrentSdkVersion() {
|
|
17328
|
-
return "1.0.
|
|
17360
|
+
return "1.0.27";
|
|
17329
17361
|
}
|
|
17330
17362
|
function useFingerprint() {
|
|
17331
17363
|
const fingerprint = useCallback34(() => {
|
|
@@ -18079,6 +18111,8 @@ export {
|
|
|
18079
18111
|
cssObjectFromTheme,
|
|
18080
18112
|
cssStringFromTheme,
|
|
18081
18113
|
darkTheme,
|
|
18114
|
+
getDefaultChains,
|
|
18115
|
+
getDefaultTransports,
|
|
18082
18116
|
getDefaultWallets,
|
|
18083
18117
|
lightTheme,
|
|
18084
18118
|
useAccountModal,
|
package/dist/utils/assets.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare function combineChainSymbolOrAddress({ chainId, symbolOrAddress,
|
|
|
5
5
|
symbolOrAddress: string;
|
|
6
6
|
}): string | null;
|
|
7
7
|
export declare const getNormalizedTokenBalance: (tokenBalance: number, decimals: number) => number;
|
|
8
|
-
export declare const isAssetUsableToPayForCheckout: (checkoutItem: FunkitActiveCheckoutItem, paymentMethod: PaymentMethod, assetChainId: string, assetTokenAddress: string) => {
|
|
8
|
+
export declare const isAssetUsableToPayForCheckout: (checkoutItem: FunkitActiveCheckoutItem, paymentMethod: PaymentMethod, assetChainId: string, assetTokenAddress: string, isWeb2Login: boolean, isWeb3Login: boolean) => {
|
|
9
9
|
isUsable: boolean;
|
|
10
10
|
reason: string;
|
|
11
11
|
};
|
|
@@ -52,4 +52,5 @@ useCurrencyAbbreviation?: boolean,
|
|
|
52
52
|
options?: FormatNumberOptions): string;
|
|
53
53
|
export declare function parseInputToNumber(input: string | number | undefined): number;
|
|
54
54
|
export declare function roundUpToXDecimalPlaces(inputNumber: string, decimalPlaces: number): number;
|
|
55
|
+
export declare function normalizeSmallUsdNumber(usdNumber: string | number | null): number;
|
|
55
56
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
bifrostWallet
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-6LTLPR2Q.js";
|
|
5
5
|
import "../chunk-ZOLACFTK.js";
|
|
6
|
-
import "../chunk-QII6PY2D.js";
|
|
7
6
|
import "../chunk-ZDU3JFGR.js";
|
|
7
|
+
import "../chunk-QII6PY2D.js";
|
|
8
8
|
export {
|
|
9
9
|
bifrostWallet
|
|
10
10
|
};
|