@funkit/connect 1.0.9 → 1.0.10
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 +10 -0
- package/dist/components/FunPayments/FunPaymentMoonpayType.d.ts +2 -1
- package/dist/components/FunPayments/FunPaymentSetup.d.ts +2 -1
- package/dist/components/FunTransactionSummary/FunTransactionSummary.d.ts +1 -2
- package/dist/components/FunkitProvider/FunkitCheckoutContext.d.ts +8 -3
- package/dist/consts/checkout.d.ts +18 -0
- package/dist/hooks/useFunListeners.d.ts +1 -0
- package/dist/index.js +126 -55
- 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/funkitConnectWallet/funkitConnectWallet.js +2 -1
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +72 -72
- 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 +1 -1
- package/dist/wallets/walletConnectors/chunk-2B3SPBRY.js +0 -100
- package/dist/wallets/walletConnectors/chunk-2GAW2UBU.js +0 -102
- package/dist/wallets/walletConnectors/chunk-7KDOXASH.js +0 -95
- package/dist/wallets/walletConnectors/chunk-CRSPGVPF.js +0 -105
- package/dist/wallets/walletConnectors/chunk-CUKVUCIP.js +0 -98
- package/dist/wallets/walletConnectors/chunk-DV3SI63E.js +0 -96
- package/dist/wallets/walletConnectors/chunk-GW6EF4G2.js +0 -92
- package/dist/wallets/walletConnectors/chunk-HD5VYJNC.js +0 -98
- package/dist/wallets/walletConnectors/chunk-IBWFKX7P.js +0 -94
- package/dist/wallets/walletConnectors/chunk-KGTZ6E7L.js +0 -71
- package/dist/wallets/walletConnectors/chunk-OKWOB3DN.js +0 -66
- package/dist/wallets/walletConnectors/chunk-RCWZ4KBR.js +0 -73
- package/dist/wallets/walletConnectors/chunk-RTW6PVQI.js +0 -107
- package/dist/wallets/walletConnectors/chunk-T6JVHES7.js +0 -87
- package/dist/wallets/walletConnectors/chunk-VSZ7PAHS.js +0 -94
- package/dist/wallets/walletConnectors/chunk-XNNLZXHE.js +0 -102
- package/dist/wallets/walletConnectors/chunk-XRMAVTK7.js +0 -178
- package/dist/wallets/walletConnectors/chunk-Z2HIQYVN.js +0 -96
package/dist/index.js
CHANGED
|
@@ -160,7 +160,8 @@ var TO_PROGRESS_CHECKOUT_STATES = [
|
|
|
160
160
|
CheckoutState.TO_UNFUNDED,
|
|
161
161
|
CheckoutState.TO_FUNDED,
|
|
162
162
|
CheckoutState.TO_POOLED,
|
|
163
|
-
CheckoutState.TO_READY
|
|
163
|
+
CheckoutState.TO_READY,
|
|
164
|
+
CheckoutState.PENDING_RECEIVAL
|
|
164
165
|
];
|
|
165
166
|
var IN_PROGRESS_CHECKOUT_STATES = [
|
|
166
167
|
...TO_PROGRESS_CHECKOUT_STATES,
|
|
@@ -1537,7 +1538,7 @@ var animateContentInClass = "stgjxl2";
|
|
|
1537
1538
|
var animateContentOutClass = "stgjxl3";
|
|
1538
1539
|
|
|
1539
1540
|
// src/hooks/useFunListeners.ts
|
|
1540
|
-
import { useEffect as useEffect8 } from "react";
|
|
1541
|
+
import { useEffect as useEffect8, useRef as useRef4 } from "react";
|
|
1541
1542
|
|
|
1542
1543
|
// src/components/FunkitProvider/FunkitCheckoutContext.tsx
|
|
1543
1544
|
import {
|
|
@@ -1576,6 +1577,17 @@ import {
|
|
|
1576
1577
|
} from "viem";
|
|
1577
1578
|
import { useConfig as useConfig2 } from "wagmi";
|
|
1578
1579
|
|
|
1580
|
+
// src/consts/checkout.ts
|
|
1581
|
+
var CHECKOUT_STEP_MESSAGE_GENERATOR = {
|
|
1582
|
+
[1 /* PREPARING_DATA */]: () => "Preparing order data...",
|
|
1583
|
+
[0 /* CONFIRMING */]: () => "Confirming your order..."
|
|
1584
|
+
};
|
|
1585
|
+
var WEB3_ACCOUNT_BALANCE_MESSAGE_GENERATOR = {
|
|
1586
|
+
[0 /* SIGN_TX */]: () => `Sign the message request in your wallet.`,
|
|
1587
|
+
[1 /* SWITCH_CHAIN */]: (newChainName) => `Accept the network switch request to ${newChainName} in your wallet.`,
|
|
1588
|
+
[2 /* APPROVE_TRANSFER */]: (tokenSymbol) => `Accept the ${tokenSymbol} transfer request in your wallet.`
|
|
1589
|
+
};
|
|
1590
|
+
|
|
1579
1591
|
// src/consts/quote.ts
|
|
1580
1592
|
var PENDING_QUOTE_MESSAGE_GENERATOR = {
|
|
1581
1593
|
[0 /* PREPARING */]: () => "Preparing your quote...",
|
|
@@ -1592,9 +1604,13 @@ var QUOTE_API_ERROR_STRING_INFO = {
|
|
|
1592
1604
|
check: "try to increase the amount",
|
|
1593
1605
|
display: "Checkout amount is too low. Please try again with a higher amount."
|
|
1594
1606
|
},
|
|
1595
|
-
[2 /*
|
|
1607
|
+
[2 /* INSUFFICIENT_AMOUNT_FOR_BRDIGE_1 */]: {
|
|
1596
1608
|
check: "target token must be at least",
|
|
1597
1609
|
display: "Checkout amount is too low. Please try again with a higher amount."
|
|
1610
|
+
},
|
|
1611
|
+
[3 /* INSUFFICIENT_AMOUNT_FOR_BRDIGE_2 */]: {
|
|
1612
|
+
check: "Bridge min amount not met",
|
|
1613
|
+
display: "Checkout amount is too low. Please try again with a higher amount."
|
|
1598
1614
|
}
|
|
1599
1615
|
};
|
|
1600
1616
|
function generateQuoteApiErrorForDisplay(errorMessage = "") {
|
|
@@ -2119,7 +2135,7 @@ var FunkitCheckoutContext = createContext9({
|
|
|
2119
2135
|
isCheckoutHistoryInited: false,
|
|
2120
2136
|
isRefreshingCheckoutHistory: true,
|
|
2121
2137
|
reDraftSymbol: Symbol(),
|
|
2122
|
-
_startCheckoutHistoryListener: () => void 0,
|
|
2138
|
+
_startCheckoutHistoryListener: () => setTimeout(() => void 0, 0),
|
|
2123
2139
|
_stopCheckoutHistoryListener: () => void 0,
|
|
2124
2140
|
_initNewCheckout: () => "",
|
|
2125
2141
|
_updateSelectedSourceAsset: () => void 0,
|
|
@@ -2228,15 +2244,23 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2228
2244
|
setHistoryDepositAddress(singleDepositAddr);
|
|
2229
2245
|
clearInterval(intervalRef.current);
|
|
2230
2246
|
triggerRefreshSymbol();
|
|
2231
|
-
|
|
2247
|
+
const newIntervalId = setInterval(() => {
|
|
2232
2248
|
triggerRefreshSymbol();
|
|
2233
2249
|
}, CHECKOUT_HISTORY_REFETCH_INTERVAL_MS);
|
|
2250
|
+
intervalRef.current = newIntervalId;
|
|
2251
|
+
return newIntervalId;
|
|
2234
2252
|
},
|
|
2235
2253
|
[triggerRefreshSymbol]
|
|
2236
2254
|
);
|
|
2237
|
-
const _stopCheckoutHistoryListener = useCallback6(
|
|
2238
|
-
|
|
2239
|
-
|
|
2255
|
+
const _stopCheckoutHistoryListener = useCallback6(
|
|
2256
|
+
(cancelIntervalId) => {
|
|
2257
|
+
clearInterval(cancelIntervalId);
|
|
2258
|
+
if (cancelIntervalId === intervalRef.current) {
|
|
2259
|
+
intervalRef.current = void 0;
|
|
2260
|
+
}
|
|
2261
|
+
},
|
|
2262
|
+
[]
|
|
2263
|
+
);
|
|
2240
2264
|
const _initNewCheckout = useCallback6(
|
|
2241
2265
|
(initSettings, hasSufficientBalance, sourceSymbol) => {
|
|
2242
2266
|
const newCheckoutId = uuid();
|
|
@@ -2642,11 +2666,14 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2642
2666
|
]
|
|
2643
2667
|
);
|
|
2644
2668
|
const _generateSignedBatchOperation = useCallback6(
|
|
2645
|
-
async (actionsParams, assetChainId, bypassWalletInit) => {
|
|
2669
|
+
async (actionsParams, assetChainId, bypassWalletInit, stepMessageSetter) => {
|
|
2646
2670
|
if (!funWallet || !funWalletAuth) {
|
|
2647
2671
|
throw new Error("Funwallet or auth not defined");
|
|
2648
2672
|
}
|
|
2649
2673
|
try {
|
|
2674
|
+
stepMessageSetter(
|
|
2675
|
+
CHECKOUT_STEP_MESSAGE_GENERATOR[1 /* PREPARING_DATA */]()
|
|
2676
|
+
);
|
|
2650
2677
|
let txParamsList = [];
|
|
2651
2678
|
actionsParams.forEach((actionParam) => {
|
|
2652
2679
|
const tokenInterface = new ContractInterface(actionParam.contractAbi);
|
|
@@ -2697,6 +2724,11 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2697
2724
|
bypassWalletInit
|
|
2698
2725
|
});
|
|
2699
2726
|
const userId = await (funWalletAuth == null ? void 0 : funWalletAuth.getUserId());
|
|
2727
|
+
if (isWeb3Login) {
|
|
2728
|
+
stepMessageSetter(
|
|
2729
|
+
WEB3_ACCOUNT_BALANCE_MESSAGE_GENERATOR[0 /* SIGN_TX */]()
|
|
2730
|
+
);
|
|
2731
|
+
}
|
|
2700
2732
|
const batchOperation = await funWallet.createBatchOperation(
|
|
2701
2733
|
funWalletAuth,
|
|
2702
2734
|
userId,
|
|
@@ -2734,7 +2766,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2734
2766
|
[_getAndValidateCheckoutItemByCheckoutId]
|
|
2735
2767
|
);
|
|
2736
2768
|
const _confirmCheckout = useCallback6(
|
|
2737
|
-
async (checkoutId, shouldbatchOpBypassInit) => {
|
|
2769
|
+
async (checkoutId, shouldbatchOpBypassInit, stepMessageSetter) => {
|
|
2738
2770
|
var _a, _b, _c;
|
|
2739
2771
|
if (!(funkitConfig == null ? void 0 : funkitConfig.apiKey)) {
|
|
2740
2772
|
throw new Error(
|
|
@@ -2759,10 +2791,14 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2759
2791
|
const signedBatchOperation = await _generateSignedBatchOperation(
|
|
2760
2792
|
checkoutItem.initSettings.config.actionsParams,
|
|
2761
2793
|
checkoutItem.initSettings.config.targetChain,
|
|
2762
|
-
shouldbatchOpBypassInit
|
|
2794
|
+
shouldbatchOpBypassInit,
|
|
2795
|
+
stepMessageSetter
|
|
2763
2796
|
);
|
|
2764
2797
|
batchUserOp = signedBatchOperation.userOp;
|
|
2765
2798
|
}
|
|
2799
|
+
stepMessageSetter(
|
|
2800
|
+
CHECKOUT_STEP_MESSAGE_GENERATOR[0 /* CONFIRMING */]()
|
|
2801
|
+
);
|
|
2766
2802
|
const depositAddress = await postApiInitializeCheckout({
|
|
2767
2803
|
userOp: batchUserOp,
|
|
2768
2804
|
quoteId: checkoutItem.latestQuote.baseQuote.quoteId,
|
|
@@ -2857,7 +2893,11 @@ var useFunkitPreCheckoutInternal = (checkoutId) => {
|
|
|
2857
2893
|
isCheckoutCrFlow
|
|
2858
2894
|
),
|
|
2859
2895
|
updateSelectedPaymentMethodInfo: (newPaymentMethodInfo) => _updateSelectedPaymentMethodInfo(checkoutId, newPaymentMethodInfo),
|
|
2860
|
-
confirmCheckout: async (shouldBatchOpBypassInit) => await _confirmCheckout(
|
|
2896
|
+
confirmCheckout: async (shouldBatchOpBypassInit, stepMessageSetter) => await _confirmCheckout(
|
|
2897
|
+
checkoutId,
|
|
2898
|
+
shouldBatchOpBypassInit,
|
|
2899
|
+
stepMessageSetter
|
|
2900
|
+
),
|
|
2861
2901
|
clearCheckoutQuoteMessages: () => _clearCheckoutQuoteMessages(checkoutId),
|
|
2862
2902
|
getCheckoutQuote: async (sponsorInitialTransferGasLimit, newPaymentMethodInfo) => await _getCheckoutQuote(
|
|
2863
2903
|
checkoutId,
|
|
@@ -3035,12 +3075,14 @@ var useFunkitCheckout = (props) => {
|
|
|
3035
3075
|
|
|
3036
3076
|
// src/hooks/useFunListeners.ts
|
|
3037
3077
|
function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
|
|
3078
|
+
const activeIntervalRef = useRef4();
|
|
3038
3079
|
const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useFunkitAllPostCheckoutsInternal();
|
|
3039
3080
|
useEffect8(() => {
|
|
3040
3081
|
if (activate) {
|
|
3041
|
-
startCheckoutHistoryListener(singleDepositAddr);
|
|
3082
|
+
const createdIntervalId = startCheckoutHistoryListener(singleDepositAddr);
|
|
3083
|
+
activeIntervalRef.current = createdIntervalId;
|
|
3042
3084
|
}
|
|
3043
|
-
return () => stopCheckoutHistoryListener();
|
|
3085
|
+
return () => stopCheckoutHistoryListener(activeIntervalRef.current);
|
|
3044
3086
|
}, [activate]);
|
|
3045
3087
|
}
|
|
3046
3088
|
function useWalletAssetsListener(activate = true) {
|
|
@@ -3655,7 +3697,7 @@ import React89, { useCallback as useCallback19, useMemo as useMemo25, useState a
|
|
|
3655
3697
|
import { useAccount as useAccount5 } from "wagmi";
|
|
3656
3698
|
|
|
3657
3699
|
// src/hooks/useMesh.tsx
|
|
3658
|
-
import React43, { useCallback as useCallback8, useMemo as useMemo11, useRef as
|
|
3700
|
+
import React43, { useCallback as useCallback8, useMemo as useMemo11, useRef as useRef5, useState as useState12 } from "react";
|
|
3659
3701
|
import { useAccount as useAccount3 } from "wagmi";
|
|
3660
3702
|
|
|
3661
3703
|
// src/components/FunDot/FunDot.tsx
|
|
@@ -4316,7 +4358,7 @@ var useMeshExchanges = ({
|
|
|
4316
4358
|
};
|
|
4317
4359
|
};
|
|
4318
4360
|
function useEqualMeshNetworkSupportedTokens(array, clearCache) {
|
|
4319
|
-
const previousArray =
|
|
4361
|
+
const previousArray = useRef5(array);
|
|
4320
4362
|
if (!clearCache && array.length === previousArray.current.length) {
|
|
4321
4363
|
return previousArray.current;
|
|
4322
4364
|
}
|
|
@@ -4339,7 +4381,7 @@ var useMeshActiveNetworkInfo = (exchange) => {
|
|
|
4339
4381
|
const { chain: activeChain } = useAccount3();
|
|
4340
4382
|
const [meshNetworkId, setMeshNetworkId] = useState12(null);
|
|
4341
4383
|
const [meshSupportedTokens, setMeshSupportedTokens] = useState12([]);
|
|
4342
|
-
const networkandExchange =
|
|
4384
|
+
const networkandExchange = useRef5(`${exchange}${meshNetworkId}`);
|
|
4343
4385
|
const meshSupportedTokensEqualLength = useEqualMeshNetworkSupportedTokens(
|
|
4344
4386
|
meshSupportedTokens,
|
|
4345
4387
|
networkandExchange.current !== `${exchange}${meshNetworkId}`
|
|
@@ -5506,8 +5548,7 @@ function LineItem({ children, ...otherProps }) {
|
|
|
5506
5548
|
}
|
|
5507
5549
|
function FeesLineItem({
|
|
5508
5550
|
feesItem,
|
|
5509
|
-
isLoading
|
|
5510
|
-
isEstimatedNetworkFees
|
|
5551
|
+
isLoading
|
|
5511
5552
|
}) {
|
|
5512
5553
|
const [isExpanded, setIsExpanded] = useState15(false);
|
|
5513
5554
|
const toggle = () => setIsExpanded(!isExpanded);
|
|
@@ -5533,7 +5574,7 @@ function FeesLineItem({
|
|
|
5533
5574
|
weight: "medium",
|
|
5534
5575
|
color: "modalText",
|
|
5535
5576
|
size: "14"
|
|
5536
|
-
},
|
|
5577
|
+
}, formatCurrencyAndStringify(
|
|
5537
5578
|
parseFloat(feesItem.totalUsd.toString())
|
|
5538
5579
|
)), isExpanded ? /* @__PURE__ */ React58.createElement(FunUpArrow, null) : /* @__PURE__ */ React58.createElement(FunDownArrow, null)) : null), isExpanded ? /* @__PURE__ */ React58.createElement(Fragment, null, /* @__PURE__ */ React58.createElement(LineItem, null, /* @__PURE__ */ React58.createElement(Text, {
|
|
5539
5580
|
weight: "medium",
|
|
@@ -5560,7 +5601,7 @@ function FeesLineItem({
|
|
|
5560
5601
|
weight: "medium",
|
|
5561
5602
|
color: "modalText",
|
|
5562
5603
|
size: "14"
|
|
5563
|
-
},
|
|
5604
|
+
}, formatCurrencyAndStringify(
|
|
5564
5605
|
parseFloat(feesItem.transactionFeesUsd.toString())
|
|
5565
5606
|
))) : null), /* @__PURE__ */ React58.createElement(LineItem, null, /* @__PURE__ */ React58.createElement(Text, {
|
|
5566
5607
|
weight: "medium",
|
|
@@ -5608,8 +5649,7 @@ function FunTransactionSummary({
|
|
|
5608
5649
|
symbol = "",
|
|
5609
5650
|
paymentTokenString,
|
|
5610
5651
|
suffixComponent,
|
|
5611
|
-
errorMessage = ""
|
|
5612
|
-
isEstimatedNetworkFees = false
|
|
5652
|
+
errorMessage = ""
|
|
5613
5653
|
}) {
|
|
5614
5654
|
return /* @__PURE__ */ React58.createElement(Box, null, /* @__PURE__ */ React58.createElement(Box, {
|
|
5615
5655
|
paddingBottom: "8"
|
|
@@ -5664,8 +5704,7 @@ function FunTransactionSummary({
|
|
|
5664
5704
|
size: "14"
|
|
5665
5705
|
}, paymentTokenString))), /* @__PURE__ */ React58.createElement(FunTxSummaryDivider, null)) : null, /* @__PURE__ */ React58.createElement(FeesLineItem, {
|
|
5666
5706
|
feesItem: estFees,
|
|
5667
|
-
isLoading
|
|
5668
|
-
isEstimatedNetworkFees
|
|
5707
|
+
isLoading
|
|
5669
5708
|
}), /* @__PURE__ */ React58.createElement(FunTxSummaryDivider, null), /* @__PURE__ */ React58.createElement(LineItem, null, /* @__PURE__ */ React58.createElement(Text, {
|
|
5670
5709
|
weight: "medium",
|
|
5671
5710
|
color: "modalTextDim",
|
|
@@ -5695,7 +5734,7 @@ function FunTransactionSummary({
|
|
|
5695
5734
|
weight: "medium",
|
|
5696
5735
|
color: "modalText",
|
|
5697
5736
|
size: "14"
|
|
5698
|
-
},
|
|
5737
|
+
}, formatCurrencyAndStringify(parseFloat(total == null ? void 0 : total.toString()))) : null)) : null, suffixComponent));
|
|
5699
5738
|
}
|
|
5700
5739
|
|
|
5701
5740
|
// src/components/FunCheckoutModal/FunCheckoutPrimaryInfo.tsx
|
|
@@ -6224,7 +6263,7 @@ import React67, {
|
|
|
6224
6263
|
Fragment as Fragment2,
|
|
6225
6264
|
useCallback as useCallback12,
|
|
6226
6265
|
useEffect as useEffect12,
|
|
6227
|
-
useRef as
|
|
6266
|
+
useRef as useRef6
|
|
6228
6267
|
} from "react";
|
|
6229
6268
|
var FunTwoFaInput = ({
|
|
6230
6269
|
value,
|
|
@@ -6234,7 +6273,7 @@ var FunTwoFaInput = ({
|
|
|
6234
6273
|
errorMessage
|
|
6235
6274
|
}) => {
|
|
6236
6275
|
const inputLength = 6;
|
|
6237
|
-
const inputRefs =
|
|
6276
|
+
const inputRefs = useRef6([]);
|
|
6238
6277
|
inputRefs.current = Array(inputLength).fill(null);
|
|
6239
6278
|
const [focusIndex, setFocusIndex] = React67.useState(0);
|
|
6240
6279
|
const handleBackspace = useCallback12(
|
|
@@ -6547,7 +6586,7 @@ import React75 from "react";
|
|
|
6547
6586
|
import React71, { useCallback as useCallback14, useMemo as useMemo17, useState as useState19 } from "react";
|
|
6548
6587
|
|
|
6549
6588
|
// src/components/FunSelect/FunSelect.tsx
|
|
6550
|
-
import React69, { useMemo as useMemo16, useRef as
|
|
6589
|
+
import React69, { useMemo as useMemo16, useRef as useRef7 } from "react";
|
|
6551
6590
|
import { useState as useState18 } from "react";
|
|
6552
6591
|
|
|
6553
6592
|
// src/utils/indexBy.ts
|
|
@@ -6762,8 +6801,8 @@ function FunPaymentMeshType({
|
|
|
6762
6801
|
|
|
6763
6802
|
// src/components/FunPayments/FunPaymentMoonpayType.tsx
|
|
6764
6803
|
import { getMoonpayUrlSignature } from "@funkit/core";
|
|
6765
|
-
import React72, { useEffect as useEffect14, useMemo as useMemo18, useState as useState20 } from "react";
|
|
6766
|
-
var MoonPayBuyWidget = (props)
|
|
6804
|
+
import React72, { memo, useEffect as useEffect14, useMemo as useMemo18, useState as useState20 } from "react";
|
|
6805
|
+
var MoonPayBuyWidget = memo(function Widget(props) {
|
|
6767
6806
|
const [MoonPayBuyWidgetInner, setMoonPayBuyWidgetInner] = React72.useState(null);
|
|
6768
6807
|
useEffect14(() => {
|
|
6769
6808
|
const loadMoonPayBuyWidgetInner = async () => {
|
|
@@ -6781,7 +6820,7 @@ var MoonPayBuyWidget = (props) => {
|
|
|
6781
6820
|
return /* @__PURE__ */ React72.createElement(MoonPayBuyWidgetInner, {
|
|
6782
6821
|
...props
|
|
6783
6822
|
}, props.children);
|
|
6784
|
-
};
|
|
6823
|
+
});
|
|
6785
6824
|
function FunPaymentMoonpayType({
|
|
6786
6825
|
paymentFlow,
|
|
6787
6826
|
paymentAddress,
|
|
@@ -6790,7 +6829,8 @@ function FunPaymentMoonpayType({
|
|
|
6790
6829
|
depositTokenAmount,
|
|
6791
6830
|
onBackToHome,
|
|
6792
6831
|
backAnimation = false,
|
|
6793
|
-
redirectToCheckoutHistory
|
|
6832
|
+
redirectToCheckoutHistory,
|
|
6833
|
+
finalConvertedAssetName
|
|
6794
6834
|
}) {
|
|
6795
6835
|
const [isSupportedRegion, setIsSupportedRegion] = useState20(true);
|
|
6796
6836
|
const [isBackToHomeDisabled, setIsBackToHomeDisabled] = useState20(true);
|
|
@@ -6806,8 +6846,14 @@ function FunPaymentMoonpayType({
|
|
|
6806
6846
|
return signature || "";
|
|
6807
6847
|
};
|
|
6808
6848
|
const description = useMemo18(() => {
|
|
6809
|
-
|
|
6810
|
-
|
|
6849
|
+
const normalizedConvertedAssetName = finalConvertedAssetName.toLowerCase();
|
|
6850
|
+
if (normalizedConvertedAssetName.startsWith("$")) {
|
|
6851
|
+
return normalizedConvertedAssetName.slice(1);
|
|
6852
|
+
}
|
|
6853
|
+
const isSame = normalizedConvertedAssetName === depositToken.toLowerCase();
|
|
6854
|
+
const conversionText = finalConvertedAssetName && !isSame ? ` that is then automatically converted to ${finalConvertedAssetName}.` : ".";
|
|
6855
|
+
return `${funkitConfig == null ? void 0 : funkitConfig.appName} uses Moonpay to on-ramp ${depositToken} via credit & debit cards${conversionText}`;
|
|
6856
|
+
}, [finalConvertedAssetName, funkitConfig == null ? void 0 : funkitConfig.appName, depositToken]);
|
|
6811
6857
|
return /* @__PURE__ */ React72.createElement(Box, {
|
|
6812
6858
|
className: backAnimation ? animateContentOutClass : animateContentInClass
|
|
6813
6859
|
}, /* @__PURE__ */ React72.createElement(Box, {
|
|
@@ -7048,7 +7094,8 @@ function FunPaymentSetup({
|
|
|
7048
7094
|
tokenAmountUsd,
|
|
7049
7095
|
backAnimation = false,
|
|
7050
7096
|
redirectToCheckoutHistory,
|
|
7051
|
-
isParentLoading = false
|
|
7097
|
+
isParentLoading = false,
|
|
7098
|
+
finalConvertedAssetName = ""
|
|
7052
7099
|
}) {
|
|
7053
7100
|
const { optionsMap } = useMeshExchanges({ fullInfo: false });
|
|
7054
7101
|
return paymentMethod === "brokerage" /* BROKERAGE */ ? /* @__PURE__ */ React75.createElement(FunPaymentMeshType, {
|
|
@@ -7080,7 +7127,8 @@ function FunPaymentSetup({
|
|
|
7080
7127
|
depositTokenAmount: tokenAmountUsd,
|
|
7081
7128
|
onBackToHome,
|
|
7082
7129
|
backAnimation,
|
|
7083
|
-
redirectToCheckoutHistory
|
|
7130
|
+
redirectToCheckoutHistory,
|
|
7131
|
+
finalConvertedAssetName
|
|
7084
7132
|
}) : /* @__PURE__ */ React75.createElement(Text, {
|
|
7085
7133
|
color: "modalTextSecondary"
|
|
7086
7134
|
}, "Unsupported payment method");
|
|
@@ -7864,7 +7912,8 @@ function FunCheckoutModal({
|
|
|
7864
7912
|
(_l = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _l.baseQuote.estTotalFromAmount
|
|
7865
7913
|
) || 0,
|
|
7866
7914
|
redirectToCheckoutHistory,
|
|
7867
|
-
isParentLoading: !!(checkoutItem == null ? void 0 : checkoutItem.isDrafting)
|
|
7915
|
+
isParentLoading: !!(checkoutItem == null ? void 0 : checkoutItem.isDrafting),
|
|
7916
|
+
finalConvertedAssetName: checkoutItem == null ? void 0 : checkoutItem.initSettings.config.checkoutItemTitle
|
|
7868
7917
|
})) : checkoutStep === "select_asset" /* SELECT_ASSET */ ? /* @__PURE__ */ React80.createElement(FunCheckoutSelectAssetStep, {
|
|
7869
7918
|
checkoutId,
|
|
7870
7919
|
checkoutStep,
|
|
@@ -8082,7 +8131,7 @@ function FunCheckoutConfirmationStep({
|
|
|
8082
8131
|
onFinish,
|
|
8083
8132
|
animateOut
|
|
8084
8133
|
}) {
|
|
8085
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w
|
|
8134
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
8086
8135
|
const { writeContractAsync } = useWriteContract();
|
|
8087
8136
|
const { sendTransactionAsync } = useSendTransaction();
|
|
8088
8137
|
const { checkoutItem, updateSelectedPaymentMethodInfo, confirmCheckout } = useFunkitPreCheckoutInternal(checkoutId);
|
|
@@ -8099,12 +8148,14 @@ function FunCheckoutConfirmationStep({
|
|
|
8099
8148
|
amountUsd: ((checkoutItem == null ? void 0 : checkoutItem.draftDollarValue) || 0).toString()
|
|
8100
8149
|
});
|
|
8101
8150
|
const [isConfirming, setIsConfirming] = useState24(false);
|
|
8151
|
+
const [checkoutStepMessage, setCheckoutStepMessage] = useState24("");
|
|
8102
8152
|
const [confirmationError, setConfirmationError] = useState24("");
|
|
8103
8153
|
const hasCheckoutConfirmationError = useMemo23(
|
|
8104
8154
|
() => confirmationError !== "",
|
|
8105
8155
|
[confirmationError]
|
|
8106
8156
|
);
|
|
8107
8157
|
const [isPostCheckoutLoading, setIsPostCheckoutLoading] = useState24(false);
|
|
8158
|
+
const [postCheckoutStepMessage, setPostCheckoutStepMessage] = useState24("");
|
|
8108
8159
|
const [postCheckoutError, setPostCheckoutError] = useState24("");
|
|
8109
8160
|
const hasPostCheckoutError = useMemo23(
|
|
8110
8161
|
() => postCheckoutError !== "",
|
|
@@ -8205,8 +8256,15 @@ function FunCheckoutConfirmationStep({
|
|
|
8205
8256
|
sourceAssetChainId,
|
|
8206
8257
|
currentChain: chain
|
|
8207
8258
|
});
|
|
8259
|
+
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6[sourceAssetChainId].chainInfo.name;
|
|
8260
|
+
setPostCheckoutStepMessage(
|
|
8261
|
+
WEB3_ACCOUNT_BALANCE_MESSAGE_GENERATOR[1 /* SWITCH_CHAIN */](chainName)
|
|
8262
|
+
);
|
|
8208
8263
|
await (switchChainAsync == null ? void 0 : switchChainAsync({ chainId: parseInt(sourceAssetChainId) }));
|
|
8209
8264
|
}
|
|
8265
|
+
setPostCheckoutStepMessage(
|
|
8266
|
+
WEB3_ACCOUNT_BALANCE_MESSAGE_GENERATOR[2 /* APPROVE_TRANSFER */]((checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo.symbol) || "")
|
|
8267
|
+
);
|
|
8210
8268
|
if (((_c2 = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _c2.address) === NATIVE_TOKEN) {
|
|
8211
8269
|
const hash = await sendTransactionAsync({
|
|
8212
8270
|
chainId: parseInt(sourceAssetChainId),
|
|
@@ -8224,11 +8282,13 @@ function FunCheckoutConfirmationStep({
|
|
|
8224
8282
|
});
|
|
8225
8283
|
logger.log("handleWeb3AccountBalancePostCheckout_hash", { hash });
|
|
8226
8284
|
}
|
|
8285
|
+
setPostCheckoutStepMessage("");
|
|
8227
8286
|
},
|
|
8228
8287
|
[
|
|
8229
8288
|
(_m = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _m.baseQuote.estTotalFromAmountBaseUnit,
|
|
8230
8289
|
checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo.chainId,
|
|
8231
8290
|
(_n = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _n.address,
|
|
8291
|
+
checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo.symbol,
|
|
8232
8292
|
chain,
|
|
8233
8293
|
switchChainAsync,
|
|
8234
8294
|
sendTransactionAsync,
|
|
@@ -8290,8 +8350,9 @@ function FunCheckoutConfirmationStep({
|
|
|
8290
8350
|
} catch (err) {
|
|
8291
8351
|
logger.error("postCheckoutFundingError", err);
|
|
8292
8352
|
setPostCheckoutError(
|
|
8293
|
-
"An error occurred trying to fund the checkout. Please contact support for help."
|
|
8353
|
+
"An error occurred trying to fund the checkout. Please try again or contact support for help."
|
|
8294
8354
|
);
|
|
8355
|
+
setPostCheckoutStepMessage("");
|
|
8295
8356
|
} finally {
|
|
8296
8357
|
setIsPostCheckoutLoading(false);
|
|
8297
8358
|
}
|
|
@@ -8320,7 +8381,10 @@ function FunCheckoutConfirmationStep({
|
|
|
8320
8381
|
}));
|
|
8321
8382
|
shouldBatchOpBypassInit = ((_a2 = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _a2.paymentMethod) === "balance" /* ACCOUNT_BALANCE */ && !isFunWalletInitializedOnTargetChain && targetChainId === sourceChainId;
|
|
8322
8383
|
}
|
|
8323
|
-
const depositAddress = await (confirmCheckout == null ? void 0 : confirmCheckout(
|
|
8384
|
+
const depositAddress = await (confirmCheckout == null ? void 0 : confirmCheckout(
|
|
8385
|
+
shouldBatchOpBypassInit,
|
|
8386
|
+
setCheckoutStepMessage
|
|
8387
|
+
));
|
|
8324
8388
|
if (!depositAddress) {
|
|
8325
8389
|
throw new Error(
|
|
8326
8390
|
"Invalid depositAddress - unable to proceed with checkout"
|
|
@@ -8349,6 +8413,7 @@ function FunCheckoutConfirmationStep({
|
|
|
8349
8413
|
setConfirmationError(
|
|
8350
8414
|
"An error occurred during checkout. Please go back and try again."
|
|
8351
8415
|
);
|
|
8416
|
+
setCheckoutStepMessage("");
|
|
8352
8417
|
}
|
|
8353
8418
|
} finally {
|
|
8354
8419
|
setIsConfirming(false);
|
|
@@ -8377,6 +8442,7 @@ function FunCheckoutConfirmationStep({
|
|
|
8377
8442
|
(_p = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _p.chainId,
|
|
8378
8443
|
(_q = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _q.symbol
|
|
8379
8444
|
]);
|
|
8445
|
+
const hasError = hasDraftValueAndMethodError || hasQuoteError || hasCheckoutConfirmationError || hasPostCheckoutError;
|
|
8380
8446
|
return /* @__PURE__ */ React82.createElement(Box, {
|
|
8381
8447
|
display: "flex",
|
|
8382
8448
|
flexDirection: "column",
|
|
@@ -8412,12 +8478,14 @@ function FunCheckoutConfirmationStep({
|
|
|
8412
8478
|
hasPaymentToken: true,
|
|
8413
8479
|
paymentTokenString,
|
|
8414
8480
|
symbol: (_w = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _w.symbol,
|
|
8415
|
-
isEstimatedNetworkFees: isWeb3Login && ((_x = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _x.paymentMethod) === "balance" /* ACCOUNT_BALANCE */,
|
|
8416
8481
|
errorMessage: hasDraftValueAndMethodError ? generateInsufficientAmountForMoonpayError(
|
|
8417
8482
|
1 /* CHECKOUT */,
|
|
8418
8483
|
false
|
|
8419
8484
|
) : hasQuoteError ? checkoutItem == null ? void 0 : checkoutItem.quoteErrorMessage : hasCheckoutConfirmationError ? confirmationError : hasPostCheckoutError ? postCheckoutError : ""
|
|
8420
|
-
})), /* @__PURE__ */ React82.createElement(
|
|
8485
|
+
})), !hasError && (postCheckoutStepMessage || checkoutStepMessage) ? /* @__PURE__ */ React82.createElement(FunNotification, {
|
|
8486
|
+
description: postCheckoutStepMessage || checkoutStepMessage,
|
|
8487
|
+
type: "default"
|
|
8488
|
+
}) : null, /* @__PURE__ */ React82.createElement(Box, {
|
|
8421
8489
|
display: "flex",
|
|
8422
8490
|
flexDirection: "column",
|
|
8423
8491
|
gap: "4"
|
|
@@ -8507,8 +8575,7 @@ function FunOnrampConfirmationStep({
|
|
|
8507
8575
|
hasTotal: true,
|
|
8508
8576
|
total: totalAmountUsd,
|
|
8509
8577
|
isLoading: isFetchingEstimatedFees,
|
|
8510
|
-
errorMessage: estimationError
|
|
8511
|
-
isEstimatedNetworkFees: false
|
|
8578
|
+
errorMessage: estimationError
|
|
8512
8579
|
})), /* @__PURE__ */ React84.createElement(Box, {
|
|
8513
8580
|
display: "flex",
|
|
8514
8581
|
flexDirection: "column",
|
|
@@ -10495,7 +10562,7 @@ var AppleIcon = () => {
|
|
|
10495
10562
|
import React113, { useContext as useContext15, useState as useState33 } from "react";
|
|
10496
10563
|
|
|
10497
10564
|
// src/components/FunkitProvider/useCoolMode.ts
|
|
10498
|
-
import { useContext as useContext14, useEffect as useEffect22, useRef as
|
|
10565
|
+
import { useContext as useContext14, useEffect as useEffect22, useRef as useRef8 } from "react";
|
|
10499
10566
|
|
|
10500
10567
|
// src/components/FunkitProvider/CoolModeContext.ts
|
|
10501
10568
|
import { createContext as createContext13 } from "react";
|
|
@@ -10503,7 +10570,7 @@ var CoolModeContext = createContext13(false);
|
|
|
10503
10570
|
|
|
10504
10571
|
// src/components/FunkitProvider/useCoolMode.ts
|
|
10505
10572
|
var useCoolMode = (imageUrl) => {
|
|
10506
|
-
const ref =
|
|
10573
|
+
const ref = useRef8(null);
|
|
10507
10574
|
const coolModeEnabled = useContext14(CoolModeContext);
|
|
10508
10575
|
const resolvedImageUrl = useAsyncImage(imageUrl);
|
|
10509
10576
|
useEffect22(() => {
|
|
@@ -11267,7 +11334,7 @@ var ScanIcon = () => /* @__PURE__ */ React121.createElement(AsyncImage, {
|
|
|
11267
11334
|
});
|
|
11268
11335
|
|
|
11269
11336
|
// src/components/ConnectOptions/DesktopOptions.tsx
|
|
11270
|
-
import React130, { Fragment as Fragment6, useContext as useContext18, useEffect as useEffect24, useRef as
|
|
11337
|
+
import React130, { Fragment as Fragment6, useContext as useContext18, useEffect as useEffect24, useRef as useRef9, useState as useState35 } from "react";
|
|
11271
11338
|
|
|
11272
11339
|
// src/components/ConnectModal/ConnectModalIntro.tsx
|
|
11273
11340
|
import React127, { useContext as useContext17 } from "react";
|
|
@@ -11491,7 +11558,7 @@ function DesktopOptions({ onClose }) {
|
|
|
11491
11558
|
const { disclaimer: Disclaimer } = useContext18(AppContext);
|
|
11492
11559
|
const { i18n: i18n2 } = useContext18(I18nContext);
|
|
11493
11560
|
const safari = isSafari();
|
|
11494
|
-
const initialized =
|
|
11561
|
+
const initialized = useRef9(false);
|
|
11495
11562
|
const { connector } = useContext18(WalletButtonContext);
|
|
11496
11563
|
const mergeEIP6963WithRkConnectors = !connector;
|
|
11497
11564
|
const wallets = useWalletConnectors(mergeEIP6963WithRkConnectors).filter((wallet) => wallet.ready || !!wallet.extensionDownloadUrl).sort((a, b) => a.groupIndex - b.groupIndex);
|
|
@@ -12780,7 +12847,7 @@ function FunConnectOptions({ onClose }) {
|
|
|
12780
12847
|
}
|
|
12781
12848
|
|
|
12782
12849
|
// src/components/SignIn/SignIn.tsx
|
|
12783
|
-
import React134, { useCallback as useCallback24, useContext as useContext20, useRef as
|
|
12850
|
+
import React134, { useCallback as useCallback24, useContext as useContext20, useRef as useRef10 } from "react";
|
|
12784
12851
|
import { UserRejectedRequestError } from "viem";
|
|
12785
12852
|
import { useAccount as useAccount9, useSignMessage } from "wagmi";
|
|
12786
12853
|
var signInIcon = async () => (await import("./sign-FZVB2CS6.js")).default;
|
|
@@ -12803,7 +12870,7 @@ function SignIn({
|
|
|
12803
12870
|
}));
|
|
12804
12871
|
}
|
|
12805
12872
|
}, [authAdapter, i18n2]);
|
|
12806
|
-
const onceRef =
|
|
12873
|
+
const onceRef = useRef10(false);
|
|
12807
12874
|
React134.useEffect(() => {
|
|
12808
12875
|
if (onceRef.current)
|
|
12809
12876
|
return;
|
|
@@ -15365,7 +15432,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
15365
15432
|
localStorage.setItem(storageKey4, version);
|
|
15366
15433
|
}
|
|
15367
15434
|
function getCurrentSdkVersion() {
|
|
15368
|
-
return "1.0.
|
|
15435
|
+
return "1.0.10";
|
|
15369
15436
|
}
|
|
15370
15437
|
function useFingerprint() {
|
|
15371
15438
|
const fingerprint = useCallback28(() => {
|
|
@@ -15517,7 +15584,11 @@ function FunkitProviderInner({
|
|
|
15517
15584
|
apiKey: "pk_live_IxayBRQuBC3RzpPZkbGPrwUsRWAaeO",
|
|
15518
15585
|
debug: !!debug
|
|
15519
15586
|
}, /* @__PURE__ */ React146.createElement(ModalProvider, null, activeTheme ? /* @__PURE__ */ React146.createElement("div", {
|
|
15520
|
-
...createThemeRootProps2(id)
|
|
15587
|
+
...createThemeRootProps2(id),
|
|
15588
|
+
style: {
|
|
15589
|
+
width: "100%",
|
|
15590
|
+
height: "100%"
|
|
15591
|
+
}
|
|
15521
15592
|
}, /* @__PURE__ */ React146.createElement("style", {
|
|
15522
15593
|
dangerouslySetInnerHTML: {
|
|
15523
15594
|
__html: [
|
|
@@ -15727,7 +15798,7 @@ import React149, {
|
|
|
15727
15798
|
useCallback as useCallback30,
|
|
15728
15799
|
useContext as useContext30,
|
|
15729
15800
|
useEffect as useEffect36,
|
|
15730
|
-
useRef as
|
|
15801
|
+
useRef as useRef11,
|
|
15731
15802
|
useState as useState45
|
|
15732
15803
|
} from "react";
|
|
15733
15804
|
|
|
@@ -15779,7 +15850,7 @@ function WalletButton2({
|
|
|
15779
15850
|
showWalletConnectModal
|
|
15780
15851
|
} = wallet;
|
|
15781
15852
|
const coolModeRef = useCoolMode(iconUrl);
|
|
15782
|
-
const initialized =
|
|
15853
|
+
const initialized = useRef11(false);
|
|
15783
15854
|
const { i18n: i18n2 } = useContext30(I18nContext);
|
|
15784
15855
|
const onConnect = useCallback30(async () => {
|
|
15785
15856
|
const onMobileUri = async () => {
|
|
@@ -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
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
bitgetWallet
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-ZNXQ4V6G.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
|
bitgetWallet
|
|
10
10
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
3
|
frontierWallet
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-AM4SSLAP.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
|
frontierWallet
|
|
10
10
|
};
|