@funkit/connect 3.2.0 → 3.2.1
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 +7 -0
- package/README.md +0 -10
- package/dist/consts/customers.d.ts +1 -0
- package/dist/index.js +121 -90
- package/dist/utils/checkout.d.ts +3 -1
- package/dist/wallets/walletConnectors/index.js +35 -35
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -13,13 +13,3 @@ The `@funkit/connect` package elevates decentralize applications via web2 & web3
|
|
|
13
13
|
### 📝 Note
|
|
14
14
|
|
|
15
15
|
This package is currently in closed beta. To learn more, reach out to [developers@fun.xyz](mailto:developers@fun.xyz).
|
|
16
|
-
|
|
17
|
-
### Dialog Composition
|
|
18
|
-
|
|
19
|
-
The `Dialog` component has a predefined structure for easy management of modal dialogs. It includes:
|
|
20
|
-
|
|
21
|
-
- **`Dialog.Title`**: Handles back navigation. Must be defined once in the root component of the modal with configuration of all screens.
|
|
22
|
-
- **`Dialog.Content`**: Wraps content with auto-scrolling behavior and consistent animations. Use this for the main body of the dialog.
|
|
23
|
-
- **`Dialog.BottomBar`**: Displays screen related information (e.g. CTA button, errors). Ideally rendered in the root, but for more complex cases, `Dialog.BottomSection` can be used as a placeholder to render the bar from deeply nested screens via `createPortal`.
|
|
24
|
-
|
|
25
|
-
These components should be direct children of the `Dialog`.
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export declare const DYDX_API_KEY = "NJq0CGrsE19xBbP1vHyBOp8xJvzYo9kayJHqDFP5";
|
|
2
2
|
export declare const POLYMARKET_API_KEY = "Y53dikxXdT4E3afI1l8BMBSWgyhKvf65k6Dut1k6";
|
|
3
|
+
export declare function isImportantCustomer(apiKey: string): apiKey is "NJq0CGrsE19xBbP1vHyBOp8xJvzYo9kayJHqDFP5" | "Y53dikxXdT4E3afI1l8BMBSWgyhKvf65k6Dut1k6";
|
package/dist/index.js
CHANGED
|
@@ -1052,6 +1052,9 @@ import { RemoveScroll } from "react-remove-scroll";
|
|
|
1052
1052
|
// src/consts/customers.ts
|
|
1053
1053
|
var DYDX_API_KEY = "NJq0CGrsE19xBbP1vHyBOp8xJvzYo9kayJHqDFP5";
|
|
1054
1054
|
var POLYMARKET_API_KEY = "Y53dikxXdT4E3afI1l8BMBSWgyhKvf65k6Dut1k6";
|
|
1055
|
+
function isImportantCustomer(apiKey) {
|
|
1056
|
+
return apiKey === DYDX_API_KEY || apiKey === POLYMARKET_API_KEY;
|
|
1057
|
+
}
|
|
1055
1058
|
|
|
1056
1059
|
// src/hooks/useScrollDivider.ts
|
|
1057
1060
|
import { useEffect as useEffect4, useRef, useState as useState3 } from "react";
|
|
@@ -1724,6 +1727,23 @@ var MOONPAY_TOKENS_SUPPORTED_REGIONS = {
|
|
|
1724
1727
|
}
|
|
1725
1728
|
};
|
|
1726
1729
|
|
|
1730
|
+
// src/consts/payment.ts
|
|
1731
|
+
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
1732
|
+
PaymentMethod2["CARD"] = "card";
|
|
1733
|
+
PaymentMethod2["TRANSFER"] = "transfer";
|
|
1734
|
+
PaymentMethod2["ACCOUNT_BALANCE"] = "balance";
|
|
1735
|
+
PaymentMethod2["BROKERAGE"] = "brokerage";
|
|
1736
|
+
return PaymentMethod2;
|
|
1737
|
+
})(PaymentMethod || {});
|
|
1738
|
+
var getPartialPaymentMethodInfo = (paymentMethod) => ({
|
|
1739
|
+
paymentMethod,
|
|
1740
|
+
title: "",
|
|
1741
|
+
titleIcon: null,
|
|
1742
|
+
description: "",
|
|
1743
|
+
descriptionIcon: null,
|
|
1744
|
+
meta: {}
|
|
1745
|
+
});
|
|
1746
|
+
|
|
1727
1747
|
// src/hooks/useCheckoutType.ts
|
|
1728
1748
|
function evaluateCheckoutGenerateActionsParams(config) {
|
|
1729
1749
|
return config.generateActionsParams?.(config.targetAssetAmount ?? 0) ?? [];
|
|
@@ -1740,6 +1760,13 @@ function isCheckoutPostActionRequired(config) {
|
|
|
1740
1760
|
return false;
|
|
1741
1761
|
}
|
|
1742
1762
|
|
|
1763
|
+
// src/utils/exhaustiveCheck.ts
|
|
1764
|
+
function exhaustiveCheck(_value) {
|
|
1765
|
+
if (false) {
|
|
1766
|
+
throw new Error("exhaustiveCheck: should not reach this point");
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1743
1770
|
// src/utils/formatNumber.ts
|
|
1744
1771
|
var FORMAT_NUMBER_DEFAULT = {
|
|
1745
1772
|
minBeforeUseScientific: 1e-5,
|
|
@@ -2196,8 +2223,30 @@ function formatTokenAmountForMoonpay(amount, mpCurrencyCode) {
|
|
|
2196
2223
|
const formattedNumber = roundUpToXDecimalPlaces(amount.toString(), precision);
|
|
2197
2224
|
return formattedNumber.toString();
|
|
2198
2225
|
}
|
|
2199
|
-
function
|
|
2200
|
-
|
|
2226
|
+
function hackTimeEstimationForImportantCustomer(originalTimeEstimation, paymentMethod, apiKey) {
|
|
2227
|
+
if (!isImportantCustomer(apiKey)) {
|
|
2228
|
+
return originalTimeEstimation;
|
|
2229
|
+
}
|
|
2230
|
+
switch (paymentMethod) {
|
|
2231
|
+
case "balance" /* ACCOUNT_BALANCE */:
|
|
2232
|
+
return 2 * 60;
|
|
2233
|
+
case "brokerage" /* BROKERAGE */:
|
|
2234
|
+
return 4 * 60;
|
|
2235
|
+
case "card" /* CARD */:
|
|
2236
|
+
return 5 * 60;
|
|
2237
|
+
case "transfer" /* TRANSFER */:
|
|
2238
|
+
return originalTimeEstimation;
|
|
2239
|
+
default:
|
|
2240
|
+
return exhaustiveCheck(paymentMethod);
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
function getEstimateEndTimeInfo(createdTimeMs, checkoutItem, apiKey) {
|
|
2244
|
+
const hackedTimeEstimation = hackTimeEstimationForImportantCustomer(
|
|
2245
|
+
(checkoutItem?.latestQuote?.finalTimeEstimationMs || 0) / 1e3,
|
|
2246
|
+
checkoutItem.selectedPaymentMethodInfo?.paymentMethod || "card" /* CARD */,
|
|
2247
|
+
apiKey
|
|
2248
|
+
);
|
|
2249
|
+
const estimatedEndTimeMs = hackedTimeEstimation * 1e3 + createdTimeMs;
|
|
2201
2250
|
const estimatedEndTimeFromNowMs = estimatedEndTimeMs - Date.now();
|
|
2202
2251
|
const isExceededEstimation = estimatedEndTimeFromNowMs <= 0;
|
|
2203
2252
|
return {
|
|
@@ -4242,23 +4291,6 @@ var WEB3_ACCOUNT_BALANCE_MESSAGE = {
|
|
|
4242
4291
|
// src/consts/checkoutFees.ts
|
|
4243
4292
|
var GAS_ESTIMATE_MULTIPLER = 1.2;
|
|
4244
4293
|
|
|
4245
|
-
// src/consts/payment.ts
|
|
4246
|
-
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
4247
|
-
PaymentMethod2["CARD"] = "card";
|
|
4248
|
-
PaymentMethod2["TRANSFER"] = "transfer";
|
|
4249
|
-
PaymentMethod2["ACCOUNT_BALANCE"] = "balance";
|
|
4250
|
-
PaymentMethod2["BROKERAGE"] = "brokerage";
|
|
4251
|
-
return PaymentMethod2;
|
|
4252
|
-
})(PaymentMethod || {});
|
|
4253
|
-
var getPartialPaymentMethodInfo = (paymentMethod) => ({
|
|
4254
|
-
paymentMethod,
|
|
4255
|
-
title: "",
|
|
4256
|
-
titleIcon: null,
|
|
4257
|
-
description: "",
|
|
4258
|
-
descriptionIcon: null,
|
|
4259
|
-
meta: {}
|
|
4260
|
-
});
|
|
4261
|
-
|
|
4262
4294
|
// src/consts/quote.ts
|
|
4263
4295
|
import { ClientError } from "@funkit/api-base";
|
|
4264
4296
|
var PENDING_QUOTE_MESSAGE_GENERATOR = {
|
|
@@ -7361,16 +7393,11 @@ var FunBottomBar = ({
|
|
|
7361
7393
|
const showTagline = useFlag("show_powered_tagline" /* ShowPoweredTagline */, false);
|
|
7362
7394
|
const defaultBottomSection = showTagline ? /* @__PURE__ */ React61.createElement(FunPoweredTagline, null) : void 0;
|
|
7363
7395
|
const bottomSectionComponent = bottomSection ?? defaultBottomSection;
|
|
7396
|
+
const buttonRadius = showTagline ? void 0 : isMobile() ? "modal" : "modalMobile";
|
|
7364
7397
|
return (
|
|
7365
7398
|
// TODO: make this more disciplined
|
|
7366
7399
|
// if there is no tagline, the bottom bar padding is 12px
|
|
7367
|
-
/* @__PURE__ */ React61.createElement(Box, { style: showTagline ? {} : { margin: "0 -6px" } }, /* @__PURE__ */ React61.createElement(Box, { className: topSectionDynamicPadding }, topSection), /* @__PURE__ */ React61.createElement(Box, null, /* @__PURE__ */ React61.createElement(
|
|
7368
|
-
FunButton,
|
|
7369
|
-
{
|
|
7370
|
-
...actionButtonProps,
|
|
7371
|
-
borderRadius: showTagline ? void 0 : "24"
|
|
7372
|
-
}
|
|
7373
|
-
)), bottomSectionComponent && /* @__PURE__ */ React61.createElement(Box, { paddingTop: "8" }, bottomSectionComponent))
|
|
7400
|
+
/* @__PURE__ */ React61.createElement(Box, { style: showTagline ? {} : { margin: "0 -6px" } }, /* @__PURE__ */ React61.createElement(Box, { className: topSectionDynamicPadding }, topSection), /* @__PURE__ */ React61.createElement(Box, null, /* @__PURE__ */ React61.createElement(FunButton, { ...actionButtonProps, borderRadius: buttonRadius })), bottomSectionComponent && /* @__PURE__ */ React61.createElement(Box, { paddingTop: "8" }, bottomSectionComponent))
|
|
7374
7401
|
);
|
|
7375
7402
|
};
|
|
7376
7403
|
|
|
@@ -7993,51 +8020,51 @@ import React68, { useMemo as useMemo12 } from "react";
|
|
|
7993
8020
|
|
|
7994
8021
|
// src/consts/assets.ts
|
|
7995
8022
|
var ASSET_LOGO_SRCS = {
|
|
7996
|
-
ETH: "https://
|
|
7997
|
-
MATIC: "https://
|
|
7998
|
-
ARB: "https://
|
|
7999
|
-
LDO: "https://
|
|
8000
|
-
AARBUSDCN: "https://
|
|
8001
|
-
CRV: "https://
|
|
8002
|
-
USDC: "https://
|
|
8003
|
-
USDT: "https://
|
|
8004
|
-
DAI: "https://
|
|
8005
|
-
WBTC: "https://
|
|
8006
|
-
GRT: "https://
|
|
8007
|
-
SHIB: "https://
|
|
8008
|
-
QNT: "https://
|
|
8009
|
-
AAVE: "https://
|
|
8010
|
-
UNI: "https://
|
|
8011
|
-
SNX: "https://
|
|
8012
|
-
CRO: "https://
|
|
8013
|
-
RNDR: "https://
|
|
8014
|
-
SAND: "https://
|
|
8015
|
-
APE: "https://
|
|
8016
|
-
IMX: "https://
|
|
8017
|
-
INJ: "https://
|
|
8018
|
-
MKR: "https://
|
|
8019
|
-
LINK: "https://
|
|
8020
|
-
PYUSD: "https://
|
|
8021
|
-
DEGEN: "https://
|
|
8022
|
-
AERO: "https://
|
|
8023
|
-
APOLWMATIC: "https://
|
|
8024
|
-
MFER: "https://
|
|
8025
|
-
$MFER: "https://
|
|
8026
|
-
ROOST: "https://
|
|
8027
|
-
BSHIB: "https://
|
|
8028
|
-
BRETT: "https://
|
|
8029
|
-
BLERF: "https://
|
|
8030
|
-
BENTO: "https://
|
|
8031
|
-
CBETH: "https://
|
|
8032
|
-
PENDLE: "https://
|
|
8033
|
-
WEETH: "https://
|
|
8034
|
-
GMX: "https://
|
|
8035
|
-
TYBG: "https://
|
|
8036
|
-
LUCK: "https://
|
|
8037
|
-
WSTETH: "https://
|
|
8038
|
-
WETH: "https://
|
|
8039
|
-
MNT: "https://
|
|
8040
|
-
USDE: "https://
|
|
8023
|
+
ETH: "https://sdk-cdn.fun.xyz/images/ETH.png",
|
|
8024
|
+
MATIC: "https://sdk-cdn.fun.xyz/images/MATIC.webp",
|
|
8025
|
+
ARB: "https://sdk-cdn.fun.xyz/images/ARB.png",
|
|
8026
|
+
LDO: "https://sdk-cdn.fun.xyz/images/LDO.png",
|
|
8027
|
+
AARBUSDCN: "https://sdk-cdn.fun.xyz/images/AARBUSDCN.png",
|
|
8028
|
+
CRV: "https://sdk-cdn.fun.xyz/images/CRV.png",
|
|
8029
|
+
USDC: "https://sdk-cdn.fun.xyz/images/USDC.png",
|
|
8030
|
+
USDT: "https://sdk-cdn.fun.xyz/images/USDT.png",
|
|
8031
|
+
DAI: "https://sdk-cdn.fun.xyz/images/DAI.png",
|
|
8032
|
+
WBTC: "https://sdk-cdn.fun.xyz/images/WBTC.png",
|
|
8033
|
+
GRT: "https://sdk-cdn.fun.xyz/images/GRT.png",
|
|
8034
|
+
SHIB: "https://sdk-cdn.fun.xyz/images/SHIB.png",
|
|
8035
|
+
QNT: "https://sdk-cdn.fun.xyz/images/QNT.png",
|
|
8036
|
+
AAVE: "https://sdk-cdn.fun.xyz/images/AAVE.png",
|
|
8037
|
+
UNI: "https://sdk-cdn.fun.xyz/images/UNI.png",
|
|
8038
|
+
SNX: "https://sdk-cdn.fun.xyz/images/SNX.png",
|
|
8039
|
+
CRO: "https://sdk-cdn.fun.xyz/images/CRO.png",
|
|
8040
|
+
RNDR: "https://sdk-cdn.fun.xyz/images/RNDR.webp",
|
|
8041
|
+
SAND: "https://sdk-cdn.fun.xyz/images/SAND.png",
|
|
8042
|
+
APE: "https://sdk-cdn.fun.xyz/images/APE.png",
|
|
8043
|
+
IMX: "https://sdk-cdn.fun.xyz/images/IMX.png",
|
|
8044
|
+
INJ: "https://sdk-cdn.fun.xyz/images/INJ.png",
|
|
8045
|
+
MKR: "https://sdk-cdn.fun.xyz/images/MKR.png",
|
|
8046
|
+
LINK: "https://sdk-cdn.fun.xyz/images/LINK.png",
|
|
8047
|
+
PYUSD: "https://sdk-cdn.fun.xyz/images/PYUSD.png",
|
|
8048
|
+
DEGEN: "https://sdk-cdn.fun.xyz/images/DEGEN.png",
|
|
8049
|
+
AERO: "https://sdk-cdn.fun.xyz/images/AERO.png",
|
|
8050
|
+
APOLWMATIC: "https://sdk-cdn.fun.xyz/images/APOLWMATIC.png",
|
|
8051
|
+
MFER: "https://sdk-cdn.fun.xyz/images/MFER.png",
|
|
8052
|
+
$MFER: "https://sdk-cdn.fun.xyz/images/MFER.png",
|
|
8053
|
+
ROOST: "https://sdk-cdn.fun.xyz/images/ROOST.jpeg",
|
|
8054
|
+
BSHIB: "https://sdk-cdn.fun.xyz/images/BSHIB.png",
|
|
8055
|
+
BRETT: "https://sdk-cdn.fun.xyz/images/BRETT.png",
|
|
8056
|
+
BLERF: "https://sdk-cdn.fun.xyz/images/BLERF.png",
|
|
8057
|
+
BENTO: "https://sdk-cdn.fun.xyz/images/BENTO.png",
|
|
8058
|
+
CBETH: "https://sdk-cdn.fun.xyz/images/CBETH.png",
|
|
8059
|
+
PENDLE: "https://sdk-cdn.fun.xyz/images/PENDLE.png",
|
|
8060
|
+
WEETH: "https://sdk-cdn.fun.xyz/images/WEETH.png",
|
|
8061
|
+
GMX: "https://sdk-cdn.fun.xyz/images/GMX.png",
|
|
8062
|
+
TYBG: "https://sdk-cdn.fun.xyz/images/TYBG.png",
|
|
8063
|
+
LUCK: "https://sdk-cdn.fun.xyz/images/LUCK.jpg",
|
|
8064
|
+
WSTETH: "https://sdk-cdn.fun.xyz/images/WSTETH.png",
|
|
8065
|
+
WETH: "https://sdk-cdn.fun.xyz/images/WETH.png",
|
|
8066
|
+
MNT: "https://sdk-cdn.fun.xyz/images/MNT.png",
|
|
8067
|
+
USDE: "https://sdk-cdn.fun.xyz/images/USDE.png"
|
|
8041
8068
|
};
|
|
8042
8069
|
|
|
8043
8070
|
// src/components/FunAssetAvatar/FunAssetAvatar.css.ts
|
|
@@ -8046,7 +8073,7 @@ var chainContainerStyle = "uwrdc23 _1rsrm2fk0 _1rsrm2fu6 _1rsrm2f11 _1rsrm2fi _1
|
|
|
8046
8073
|
var containerStyle = "uwrdc20";
|
|
8047
8074
|
|
|
8048
8075
|
// src/components/FunAssetAvatar/FunAssetAvatar.tsx
|
|
8049
|
-
var fallbackAssetSrc = "https://
|
|
8076
|
+
var fallbackAssetSrc = "https://sdk-cdn.fun.xyz/images/dollar_circle.png";
|
|
8050
8077
|
function FunAssetAvatar({
|
|
8051
8078
|
assetSrc,
|
|
8052
8079
|
assetTicker,
|
|
@@ -8400,7 +8427,7 @@ var ContentExpandedTransition = "_8v3zsz1";
|
|
|
8400
8427
|
var Divider = "_8v3zsz3";
|
|
8401
8428
|
|
|
8402
8429
|
// src/modals/FunCheckoutHistoryModal/FunCheckoutHistoryTransaction.tsx
|
|
8403
|
-
var fallbackAssetSrc2 = "https://
|
|
8430
|
+
var fallbackAssetSrc2 = "https://sdk-cdn.fun.xyz/images/dollar_circle.png";
|
|
8404
8431
|
function FunTxSummaryBox({ children }) {
|
|
8405
8432
|
return /* @__PURE__ */ React72.createElement(
|
|
8406
8433
|
Box,
|
|
@@ -8533,6 +8560,7 @@ function FunTxSummaryHistory({
|
|
|
8533
8560
|
function OrderDetail({
|
|
8534
8561
|
checkoutHistoryItem
|
|
8535
8562
|
}) {
|
|
8563
|
+
const { apiKey } = useFunkitConfig();
|
|
8536
8564
|
const [isExpanded, setIsExpanded] = useState21(false);
|
|
8537
8565
|
const [hasScrolled, setHasScrolled] = useState21(false);
|
|
8538
8566
|
const contentRef = useRef6(null);
|
|
@@ -8548,9 +8576,10 @@ function OrderDetail({
|
|
|
8548
8576
|
const estimatedEndTimeInfo = useMemo13(() => {
|
|
8549
8577
|
return getEstimateEndTimeInfo(
|
|
8550
8578
|
checkoutHistoryItem.createdTimeMs,
|
|
8551
|
-
checkoutItem
|
|
8579
|
+
checkoutItem,
|
|
8580
|
+
apiKey
|
|
8552
8581
|
);
|
|
8553
|
-
}, [checkoutHistoryItem.createdTimeMs, checkoutItem]);
|
|
8582
|
+
}, [checkoutHistoryItem.createdTimeMs, checkoutItem, apiKey]);
|
|
8554
8583
|
const performScrollInsteadOfAnimation = isFailed;
|
|
8555
8584
|
useEffect20(() => {
|
|
8556
8585
|
if (!performScrollInsteadOfAnimation) return;
|
|
@@ -8932,17 +8961,21 @@ function FunCheckoutStatus({
|
|
|
8932
8961
|
}
|
|
8933
8962
|
function PendingStatus({ checkoutHistoryItem }) {
|
|
8934
8963
|
const checkoutItem = checkoutHistoryItem.clientMetadata;
|
|
8935
|
-
const
|
|
8936
|
-
|
|
8964
|
+
const { apiKey } = useFunkitConfig();
|
|
8965
|
+
const totalSeconds = hackTimeEstimationForImportantCustomer(
|
|
8966
|
+
Math.ceil((checkoutItem?.latestQuote?.finalTimeEstimationMs || 0) / 1e3),
|
|
8967
|
+
checkoutItem.selectedPaymentMethodInfo?.paymentMethod || "card" /* CARD */,
|
|
8968
|
+
apiKey
|
|
8937
8969
|
);
|
|
8938
8970
|
const estimatedRemainingSeconds = useMemo14(() => {
|
|
8939
8971
|
const endTimeInfo = getEstimateEndTimeInfo(
|
|
8940
8972
|
// FIXME: Replace with `submittedTimeMs` when BE API is updated
|
|
8941
8973
|
checkoutHistoryItem.createdTimeMs,
|
|
8942
|
-
checkoutItem
|
|
8974
|
+
checkoutItem,
|
|
8975
|
+
apiKey
|
|
8943
8976
|
);
|
|
8944
8977
|
return Math.ceil(endTimeInfo.estimatedEndTimeFromNowMs / 1e3);
|
|
8945
|
-
}, [checkoutItem, checkoutHistoryItem.createdTimeMs]);
|
|
8978
|
+
}, [checkoutItem, checkoutHistoryItem.createdTimeMs, apiKey]);
|
|
8946
8979
|
return /* @__PURE__ */ React74.createElement(
|
|
8947
8980
|
FunCountdown,
|
|
8948
8981
|
{
|
|
@@ -11496,13 +11529,6 @@ function useFunkitUserIp() {
|
|
|
11496
11529
|
};
|
|
11497
11530
|
}
|
|
11498
11531
|
|
|
11499
|
-
// src/utils/exhaustiveCheck.ts
|
|
11500
|
-
function exhaustiveCheck(_value) {
|
|
11501
|
-
if (false) {
|
|
11502
|
-
throw new Error("exhaustiveCheck: should not reach this point");
|
|
11503
|
-
}
|
|
11504
|
-
}
|
|
11505
|
-
|
|
11506
11532
|
// src/modals/CheckoutModal/useRedirectToCheckoutHistory.ts
|
|
11507
11533
|
import { useCallback as useCallback19 } from "react";
|
|
11508
11534
|
function useRedirectToCheckoutHistory(checkoutItem, onClose) {
|
|
@@ -14315,7 +14341,7 @@ function FunPaymentMethods({
|
|
|
14315
14341
|
]);
|
|
14316
14342
|
const isLoading = !notificationConfig.showNotification && isContinuing;
|
|
14317
14343
|
const bottomSectionRef = useBottomSectionRef();
|
|
14318
|
-
const showConnectWalletOption =
|
|
14344
|
+
const showConnectWalletOption = false;
|
|
14319
14345
|
return /* @__PURE__ */ React139.createElement(Box, null, /* @__PURE__ */ React139.createElement(Box, { display: "flex", flexDirection: "column", gap: "18" }, /* @__PURE__ */ React139.createElement(
|
|
14320
14346
|
Box,
|
|
14321
14347
|
{
|
|
@@ -14664,6 +14690,7 @@ function FunTransactionSummary({
|
|
|
14664
14690
|
errorMessage = ""
|
|
14665
14691
|
}) {
|
|
14666
14692
|
const { checkoutItem } = useFunkitPreCheckoutInternal(checkoutId);
|
|
14693
|
+
const { apiKey } = useFunkitConfig();
|
|
14667
14694
|
const estFees = {
|
|
14668
14695
|
totalUsd: parseInputToNumber(
|
|
14669
14696
|
checkoutItem?.latestQuote?.finalFeesBreakdown.totalFeesUsd
|
|
@@ -14675,7 +14702,12 @@ function FunTransactionSummary({
|
|
|
14675
14702
|
checkoutItem?.latestQuote?.finalFeesBreakdown.platformFeesUsd
|
|
14676
14703
|
)
|
|
14677
14704
|
};
|
|
14678
|
-
const
|
|
14705
|
+
const paymentMethod = checkoutItem?.selectedPaymentMethodInfo?.paymentMethod;
|
|
14706
|
+
const estTime = hackTimeEstimationForImportantCustomer(
|
|
14707
|
+
(checkoutItem?.latestQuote?.finalTimeEstimationMs || 0) / 1e3,
|
|
14708
|
+
paymentMethod,
|
|
14709
|
+
apiKey
|
|
14710
|
+
);
|
|
14679
14711
|
const paymentTokenString = useMemo25(() => {
|
|
14680
14712
|
return formatCryptoAndStringify(
|
|
14681
14713
|
parseFloat(checkoutItem?.latestQuote?.finalPaymentTokenAmount || "0"),
|
|
@@ -14685,7 +14717,6 @@ function FunTransactionSummary({
|
|
|
14685
14717
|
checkoutItem?.latestQuote?.finalPaymentTokenAmount,
|
|
14686
14718
|
checkoutItem?.selectedSourceAssetInfo?.symbol
|
|
14687
14719
|
]);
|
|
14688
|
-
const paymentMethod = checkoutItem?.selectedPaymentMethodInfo?.paymentMethod;
|
|
14689
14720
|
const isLoading = checkoutItem ? checkoutItem?.isQuoting || checkoutItem?.isDrafting : false;
|
|
14690
14721
|
const total = parseInputToNumber(checkoutItem?.latestQuote?.finalTotalUsd);
|
|
14691
14722
|
const symbol = checkoutItem?.selectedSourceAssetInfo.symbol || "";
|
|
@@ -17542,7 +17573,7 @@ var SourceChange = ({ modalState, onNext, onClose }) => {
|
|
|
17542
17573
|
isActive: newSource === method,
|
|
17543
17574
|
onClick: () => handleNewSourceSelection(method)
|
|
17544
17575
|
}
|
|
17545
|
-
)),
|
|
17576
|
+
)), false, bottomSectionRef && createPortal8(
|
|
17546
17577
|
/* @__PURE__ */ React171.createElement(
|
|
17547
17578
|
Dialog.BottomBar,
|
|
17548
17579
|
{
|
package/dist/utils/checkout.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CheckoutHistoryItem, CheckoutState } from '@funkit/api-base';
|
|
2
2
|
import { Address, Hex } from 'viem';
|
|
3
3
|
import { UseConfigReturnType } from 'wagmi';
|
|
4
|
+
import { PaymentMethod } from '../consts/payment';
|
|
4
5
|
import { FunkitActiveCheckoutItem, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
|
|
5
6
|
export declare const MOONPAY_TIME_ESTIMATE_MS = 120000;
|
|
6
7
|
export declare const MESH_TIME_ESTIMATE_MS = 300000;
|
|
@@ -107,7 +108,8 @@ export declare function categorizeCheckoutHistories(checkoutHistoryList: Checkou
|
|
|
107
108
|
};
|
|
108
109
|
export declare function getCheckoutStateStepNumber(state: CheckoutState): 0 | 1 | 3 | 2;
|
|
109
110
|
export declare function formatTokenAmountForMoonpay(amount: number, mpCurrencyCode: string): string;
|
|
110
|
-
export declare function
|
|
111
|
+
export declare function hackTimeEstimationForImportantCustomer(originalTimeEstimation: number, paymentMethod: PaymentMethod, apiKey: string): any;
|
|
112
|
+
export declare function getEstimateEndTimeInfo(createdTimeMs: number, checkoutItem: FunkitActiveCheckoutItem, apiKey: string): {
|
|
111
113
|
estimatedEndTimeMs: number;
|
|
112
114
|
estimatedEndTimeFromNowMs: number;
|
|
113
115
|
isExceededEstimation: boolean;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
zerionWallet
|
|
4
|
-
} from "./chunk-DBP432DI.js";
|
|
5
2
|
import {
|
|
6
3
|
xdefiWallet
|
|
7
4
|
} from "./chunk-RVIZMVFR.js";
|
|
8
5
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
zealWallet
|
|
7
|
+
} from "./chunk-BUUV6BS4.js";
|
|
8
|
+
import {
|
|
9
|
+
zerionWallet
|
|
10
|
+
} from "./chunk-DBP432DI.js";
|
|
11
|
+
import {
|
|
12
|
+
mewWallet
|
|
13
|
+
} from "./chunk-CVYXTHZ6.js";
|
|
11
14
|
import {
|
|
12
15
|
tahoWallet
|
|
13
16
|
} from "./chunk-6AYBA6IH.js";
|
|
17
|
+
import {
|
|
18
|
+
talismanWallet
|
|
19
|
+
} from "./chunk-OTXHQMSG.js";
|
|
14
20
|
import {
|
|
15
21
|
tokenPocketWallet
|
|
16
22
|
} from "./chunk-ISJYPD3T.js";
|
|
@@ -26,24 +32,18 @@ import {
|
|
|
26
32
|
import {
|
|
27
33
|
walletConnectWallet
|
|
28
34
|
} from "./chunk-OFU3PEVT.js";
|
|
29
|
-
import {
|
|
30
|
-
oneInchWallet
|
|
31
|
-
} from "./chunk-I7MKK24W.js";
|
|
32
|
-
import {
|
|
33
|
-
zealWallet
|
|
34
|
-
} from "./chunk-BUUV6BS4.js";
|
|
35
35
|
import {
|
|
36
36
|
rabbyWallet
|
|
37
37
|
} from "./chunk-H5LLXNOI.js";
|
|
38
38
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./chunk-
|
|
39
|
+
rainbowWallet
|
|
40
|
+
} from "./chunk-OHJBALD3.js";
|
|
41
41
|
import {
|
|
42
42
|
ramperWallet
|
|
43
43
|
} from "./chunk-TKXQYHWJ.js";
|
|
44
44
|
import {
|
|
45
|
-
|
|
46
|
-
} from "./chunk-
|
|
45
|
+
roninWallet
|
|
46
|
+
} from "./chunk-63YLN6R5.js";
|
|
47
47
|
import {
|
|
48
48
|
safeWallet
|
|
49
49
|
} from "./chunk-Z2QCE6O6.js";
|
|
@@ -56,24 +56,24 @@ import {
|
|
|
56
56
|
import {
|
|
57
57
|
subWallet
|
|
58
58
|
} from "./chunk-N3ELQYCY.js";
|
|
59
|
+
import {
|
|
60
|
+
injectedWallet
|
|
61
|
+
} from "./chunk-E5NYR4SS.js";
|
|
59
62
|
import {
|
|
60
63
|
metaMaskWallet
|
|
61
64
|
} from "./chunk-ODRDT73B.js";
|
|
62
|
-
import {
|
|
63
|
-
ledgerWallet
|
|
64
|
-
} from "./chunk-ZMHCZCGS.js";
|
|
65
|
-
import {
|
|
66
|
-
mewWallet
|
|
67
|
-
} from "./chunk-CVYXTHZ6.js";
|
|
68
65
|
import {
|
|
69
66
|
oktoWallet
|
|
70
67
|
} from "./chunk-MBQTOALG.js";
|
|
68
|
+
import {
|
|
69
|
+
omniWallet
|
|
70
|
+
} from "./chunk-II6YBG2B.js";
|
|
71
71
|
import {
|
|
72
72
|
okxWallet
|
|
73
73
|
} from "./chunk-5HXH52SO.js";
|
|
74
74
|
import {
|
|
75
|
-
|
|
76
|
-
} from "./chunk-
|
|
75
|
+
oneInchWallet
|
|
76
|
+
} from "./chunk-I7MKK24W.js";
|
|
77
77
|
import {
|
|
78
78
|
oneKeyWallet
|
|
79
79
|
} from "./chunk-ZP2SV6KN.js";
|
|
@@ -81,11 +81,8 @@ import {
|
|
|
81
81
|
phantomWallet
|
|
82
82
|
} from "./chunk-KEVUI6AA.js";
|
|
83
83
|
import {
|
|
84
|
-
|
|
85
|
-
} from "./chunk-
|
|
86
|
-
import {
|
|
87
|
-
frameWallet
|
|
88
|
-
} from "./chunk-KPVNJO3R.js";
|
|
84
|
+
foxWallet
|
|
85
|
+
} from "./chunk-WAOREEBE.js";
|
|
89
86
|
import {
|
|
90
87
|
frontierWallet
|
|
91
88
|
} from "./chunk-LCOUKF2U.js";
|
|
@@ -93,14 +90,17 @@ import {
|
|
|
93
90
|
gateWallet
|
|
94
91
|
} from "./chunk-YIJ5ULO3.js";
|
|
95
92
|
import {
|
|
96
|
-
|
|
97
|
-
} from "./chunk-
|
|
98
|
-
import {
|
|
99
|
-
imTokenWallet
|
|
100
|
-
} from "./chunk-BMJOLT2N.js";
|
|
93
|
+
frameWallet
|
|
94
|
+
} from "./chunk-KPVNJO3R.js";
|
|
101
95
|
import {
|
|
102
96
|
kresusWallet
|
|
103
97
|
} from "./chunk-QQJKQCII.js";
|
|
98
|
+
import {
|
|
99
|
+
ledgerWallet
|
|
100
|
+
} from "./chunk-ZMHCZCGS.js";
|
|
101
|
+
import {
|
|
102
|
+
imTokenWallet
|
|
103
|
+
} from "./chunk-BMJOLT2N.js";
|
|
104
104
|
import {
|
|
105
105
|
bybitWallet
|
|
106
106
|
} from "./chunk-3AZNOY75.js";
|
|
@@ -123,8 +123,8 @@ import {
|
|
|
123
123
|
desigWallet
|
|
124
124
|
} from "./chunk-44CHUPEQ.js";
|
|
125
125
|
import {
|
|
126
|
-
|
|
127
|
-
} from "./chunk-
|
|
126
|
+
enkryptWallet
|
|
127
|
+
} from "./chunk-JJ4DXD7R.js";
|
|
128
128
|
import {
|
|
129
129
|
argentWallet
|
|
130
130
|
} from "./chunk-ZHFISYEQ.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -92,8 +92,8 @@
|
|
|
92
92
|
"ua-parser-js": "^1.0.37",
|
|
93
93
|
"uuid": "^9.0.1",
|
|
94
94
|
"@funkit/api-base": "1.1.2",
|
|
95
|
-
"@funkit/
|
|
96
|
-
"@funkit/
|
|
95
|
+
"@funkit/wagmi-tools": "3.0.9",
|
|
96
|
+
"@funkit/core": "2.1.7"
|
|
97
97
|
},
|
|
98
98
|
"repository": {
|
|
99
99
|
"type": "git",
|