@funkit/connect 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +3 -2
- package/dist/domains/quote.d.ts +1 -0
- package/dist/index.js +75 -82
- package/dist/providers/FunkitConfigContext.d.ts +2 -2
- package/dist/utils/safeJSON.d.ts +3 -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-25VW5TZP.js +92 -0
- package/dist/wallets/walletConnectors/chunk-3NC26XLM.js +92 -0
- package/dist/wallets/walletConnectors/chunk-3U3BMEH5.js +94 -0
- package/dist/wallets/walletConnectors/chunk-4UM4GTKZ.js +103 -0
- package/dist/wallets/walletConnectors/chunk-545L7Y4M.js +69 -0
- package/dist/wallets/walletConnectors/chunk-6LPM6LUQ.js +110 -0
- package/dist/wallets/walletConnectors/chunk-7GSNBOD3.js +99 -0
- package/dist/wallets/walletConnectors/chunk-ETTNDQQG.js +100 -0
- package/dist/wallets/walletConnectors/chunk-FRGSRLTS.js +93 -0
- package/dist/wallets/walletConnectors/chunk-HKV7EMYZ.js +96 -0
- package/dist/wallets/walletConnectors/chunk-IPOC2VJX.js +106 -0
- package/dist/wallets/walletConnectors/chunk-JXP2QPW7.js +95 -0
- package/dist/wallets/walletConnectors/chunk-KFFJPS5R.js +96 -0
- package/dist/wallets/walletConnectors/chunk-LEXSM5KI.js +87 -0
- package/dist/wallets/walletConnectors/chunk-MOOBCMMB.js +70 -0
- package/dist/wallets/walletConnectors/chunk-N2NIIUW6.js +146 -0
- package/dist/wallets/walletConnectors/chunk-W5O4YSZN.js +98 -0
- package/dist/wallets/walletConnectors/chunk-XYBEMO3C.js +66 -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 +65 -65
- 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 +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 4.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 67b7b1e: feat(fits,connect,utils): add search suggestions (history), move safe json parsing to utils package
|
|
8
|
+
- 76ac39b: fix: remove unused showAvailableBalance option
|
|
9
|
+
- e2419b9: fix: pin datadog version
|
|
10
|
+
- df63829: fix: update tsconfig version
|
|
11
|
+
- 3519ae0: feat: new uiCustomization.showPaymentAmountUsd to show source token amount in confirmation page
|
|
12
|
+
- Updated dependencies [67b7b1e]
|
|
13
|
+
- Updated dependencies [df63829]
|
|
14
|
+
- @funkit/utils@1.0.2
|
|
15
|
+
- @funkit/api-base@1.4.1
|
|
16
|
+
- @funkit/core@2.2.8
|
|
17
|
+
- @funkit/wagmi-tools@3.0.19
|
|
18
|
+
|
|
3
19
|
## 4.0.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type PaymentMethodInfo } from '../../domains/paymentMethods';
|
|
3
3
|
import type { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
|
|
4
|
-
import type
|
|
4
|
+
import { type FunkitTextCustomizationsConfig, type FunkitUiCustomRecipientConfig, type FunkitUiCustomizationsConfig } from '../../providers/FunkitConfigContext';
|
|
5
5
|
interface PaymentMethodSummaryProps {
|
|
6
6
|
paymentMethodInfo: PaymentMethodInfo;
|
|
7
7
|
walletAddress: string | undefined;
|
|
@@ -16,6 +16,7 @@ interface PaymentAmountSummaryProps {
|
|
|
16
16
|
targetChainId: string;
|
|
17
17
|
checkoutItem: FunkitActiveCheckoutItem | null;
|
|
18
18
|
textCustomizations: FunkitTextCustomizationsConfig['confirmationScreen'];
|
|
19
|
+
uiCustomizations: FunkitUiCustomizationsConfig['confirmationScreen'];
|
|
19
20
|
}
|
|
20
|
-
export declare function PaymentAmountSummary({ isLoading, targetChainId, checkoutItem, textCustomizations, }: PaymentAmountSummaryProps): React.JSX.Element;
|
|
21
|
+
export declare function PaymentAmountSummary({ isLoading, targetChainId, checkoutItem, textCustomizations, uiCustomizations, }: PaymentAmountSummaryProps): React.JSX.Element;
|
|
21
22
|
export {};
|
package/dist/domains/quote.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { LoginType } from '~/providers/GeneralWalletProvider';
|
|
|
6
6
|
import { type CheckoutFees } from './checkoutFees';
|
|
7
7
|
import { type PaymentMethodInfo } from './paymentMethods';
|
|
8
8
|
export interface FunkitCheckoutQuoteResult extends Omit<ApiFunkitCheckoutQuoteResult, 'finalFeesBreakdown'> {
|
|
9
|
+
finalSpreadUsd: string;
|
|
9
10
|
finalFeesBreakdown: CheckoutFees;
|
|
10
11
|
}
|
|
11
12
|
export declare function getCheckoutBaseQuote(checkoutItem: FunkitActiveCheckoutItem, userId: string, walletAddress: Address, apiKey: string, sponsorInitialTransferGasLimit: number, wagmiConfig: Config): Promise<CheckoutQuoteResponse>;
|
package/dist/index.js
CHANGED
|
@@ -3209,11 +3209,14 @@ var flagConfig = {
|
|
|
3209
3209
|
type: "string",
|
|
3210
3210
|
default_value: JSON.stringify({
|
|
3211
3211
|
// mainnet
|
|
3212
|
-
1: [
|
|
3212
|
+
// 1: ['USDC', 'DAI', 'ETH'],
|
|
3213
|
+
1: ["USDC", "DAI"],
|
|
3213
3214
|
// base
|
|
3214
|
-
8453: ["USDC", "USDT", "DAI", "
|
|
3215
|
+
8453: ["USDC", "USDT", "DAI", "WETH"],
|
|
3216
|
+
// 8453: ['USDC', 'USDT', 'DAI', 'ETH', 'WETH'],
|
|
3215
3217
|
// arbitrum
|
|
3216
|
-
42161: ["USDC", "USDT", "DAI", "
|
|
3218
|
+
42161: ["USDC", "USDT", "DAI", "WETH"],
|
|
3219
|
+
// 42161: ['USDC', 'USDT', 'DAI', 'ETH', 'WETH'],
|
|
3217
3220
|
// polygon
|
|
3218
3221
|
137: ["USDC", "USDC.e", "USDT", "DAI", "WETH"]
|
|
3219
3222
|
})
|
|
@@ -6187,6 +6190,7 @@ async function getQuoteFinalEstimation(baseQuote, checkoutItem, newPaymentMethod
|
|
|
6187
6190
|
}
|
|
6188
6191
|
const finalEstimation = {
|
|
6189
6192
|
baseQuote,
|
|
6193
|
+
finalSpreadUsd: (baseQuote.estTotalUsd - baseQuote.estSubtotalUsd - (baseQuote.estMarketMakerGasUsd ?? 0) - (baseQuote.lpFeeUsd ?? 0)).toString(),
|
|
6190
6194
|
finalFeesBreakdown,
|
|
6191
6195
|
finalPaymentTokenAmount: finalPaymentTokenAmount.toString(),
|
|
6192
6196
|
finalTimeEstimationMs,
|
|
@@ -12117,14 +12121,11 @@ import { getRiskAssessmentForAddress } from "@funkit/api-base";
|
|
|
12117
12121
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
12118
12122
|
|
|
12119
12123
|
// src/utils/safeJSON.ts
|
|
12124
|
+
import { safeParseJson } from "@funkit/utils";
|
|
12120
12125
|
function safeJSONParse(src) {
|
|
12121
|
-
|
|
12122
|
-
try {
|
|
12123
|
-
return JSON.parse(src);
|
|
12124
|
-
} catch (e) {
|
|
12126
|
+
return safeParseJson(src, (e) => {
|
|
12125
12127
|
logger.error("parseJSON:error", e);
|
|
12126
|
-
|
|
12127
|
-
}
|
|
12128
|
+
});
|
|
12128
12129
|
}
|
|
12129
12130
|
|
|
12130
12131
|
// src/hooks/useIsCheckoutRisky.ts
|
|
@@ -12677,7 +12678,11 @@ function FeeLineItem({
|
|
|
12677
12678
|
|
|
12678
12679
|
// src/components/FunTransactionSummary/PaymentMethodSummary.tsx
|
|
12679
12680
|
import { STABLECOIN_SYMBOLS as STABLECOIN_SYMBOLS2 } from "@funkit/core";
|
|
12680
|
-
import {
|
|
12681
|
+
import {
|
|
12682
|
+
formatAddress as formatAddress5,
|
|
12683
|
+
formatCurrencyAndStringify as formatCurrencyAndStringify5,
|
|
12684
|
+
formatSecondsToReadableForm as formatSecondsToReadableForm2
|
|
12685
|
+
} from "@funkit/utils";
|
|
12681
12686
|
import { formatCryptoAndStringify as formatCryptoAndStringify3 } from "@funkit/utils";
|
|
12682
12687
|
import React137, { useMemo as useMemo21, useState as useState33 } from "react";
|
|
12683
12688
|
|
|
@@ -12746,20 +12751,27 @@ function PaymentAmountSummary({
|
|
|
12746
12751
|
isLoading,
|
|
12747
12752
|
targetChainId,
|
|
12748
12753
|
checkoutItem,
|
|
12749
|
-
textCustomizations
|
|
12754
|
+
textCustomizations,
|
|
12755
|
+
uiCustomizations
|
|
12750
12756
|
}) {
|
|
12757
|
+
const { apiKey } = useFunkitConfig();
|
|
12751
12758
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
12752
12759
|
const sourceSymbol = checkoutItem?.selectedSourceAssetInfo.symbol ?? "";
|
|
12753
12760
|
const targetSymbol = checkoutConfig?.targetAssetTicker ?? "";
|
|
12754
|
-
const
|
|
12755
|
-
const areBothStablecoins =
|
|
12756
|
-
const sourceTokenAmount =
|
|
12761
|
+
const isSourceStablecoin = STABLECOIN_SYMBOLS2.includes(sourceSymbol);
|
|
12762
|
+
const areBothStablecoins = isSourceStablecoin && STABLECOIN_SYMBOLS2.includes(targetSymbol);
|
|
12763
|
+
const sourceTokenAmount = Number.parseFloat(
|
|
12764
|
+
checkoutItem?.latestQuote?.finalPaymentTokenAmount || "0"
|
|
12765
|
+
);
|
|
12757
12766
|
const paymentTokenString = useMemo21(() => {
|
|
12758
|
-
return formatCryptoAndStringify3(
|
|
12759
|
-
Number.parseFloat(sourceTokenAmount || "0"),
|
|
12760
|
-
sourceSymbol
|
|
12761
|
-
);
|
|
12767
|
+
return formatCryptoAndStringify3(sourceTokenAmount, sourceSymbol);
|
|
12762
12768
|
}, [sourceTokenAmount, sourceSymbol]);
|
|
12769
|
+
const paymentTokenUsdAmount = useMemo21(() => {
|
|
12770
|
+
if (!checkoutItem?.latestQuote) return void 0;
|
|
12771
|
+
return formatCurrencyAndStringify5(
|
|
12772
|
+
checkoutItem.latestQuote.baseQuote.estSubtotalUsd + Number.parseFloat(checkoutItem.latestQuote.finalPaymentFeeUsd) - Number.parseFloat(checkoutItem.latestQuote.finalSpreadUsd)
|
|
12773
|
+
);
|
|
12774
|
+
}, [checkoutItem?.latestQuote]);
|
|
12763
12775
|
const targetTokenString = useMemo21(() => {
|
|
12764
12776
|
const targetItemName = checkoutConfig?.targetAssetTicker || checkoutConfig?.checkoutItemTitle;
|
|
12765
12777
|
const targetTokenAmount = checkoutConfig?.targetAssetAmount ?? 0;
|
|
@@ -12768,14 +12780,16 @@ function PaymentAmountSummary({
|
|
|
12768
12780
|
const sourceChainId = checkoutItem?.selectedSourceAssetInfo.chainId;
|
|
12769
12781
|
const areSameChains = sourceChainId === targetChainId;
|
|
12770
12782
|
const sourceIcon = checkoutItem?.selectedSourceAssetInfo.iconSrc ?? void 0;
|
|
12771
|
-
const
|
|
12783
|
+
const areSameAssets = sourceSymbol === targetSymbol;
|
|
12784
|
+
const showYouWillPaySummary = isDydxCustomer(apiKey) || !areSameAssets && !areBothStablecoins;
|
|
12772
12785
|
return /* @__PURE__ */ React137.createElement(FunTxSummaryBox, null, showYouWillPaySummary && /* @__PURE__ */ React137.createElement(React137.Fragment, null, /* @__PURE__ */ React137.createElement(
|
|
12773
12786
|
PaymentAmountSummaryItem,
|
|
12774
12787
|
{
|
|
12775
12788
|
sourceChainId,
|
|
12776
12789
|
destinationChainId: targetChainId,
|
|
12777
12790
|
label: "You will pay",
|
|
12778
|
-
paymentTokenString,
|
|
12791
|
+
paymentTokenAmount: paymentTokenString,
|
|
12792
|
+
paymentUsdAmount: uiCustomizations?.showPaymentAmountUsd ? paymentTokenUsdAmount : void 0,
|
|
12779
12793
|
icon: /* @__PURE__ */ React137.createElement(
|
|
12780
12794
|
FunAssetAvatar,
|
|
12781
12795
|
{
|
|
@@ -12787,8 +12801,7 @@ function PaymentAmountSummary({
|
|
|
12787
12801
|
hideIfUnknown: true
|
|
12788
12802
|
}
|
|
12789
12803
|
),
|
|
12790
|
-
isLoading
|
|
12791
|
-
enableChainDetailExpand: false
|
|
12804
|
+
isLoading
|
|
12792
12805
|
}
|
|
12793
12806
|
), /* @__PURE__ */ React137.createElement(FunTxSummaryDivider, null)), /* @__PURE__ */ React137.createElement(
|
|
12794
12807
|
PaymentAmountSummaryItem,
|
|
@@ -12796,7 +12809,7 @@ function PaymentAmountSummary({
|
|
|
12796
12809
|
sourceChainId,
|
|
12797
12810
|
destinationChainId: targetChainId,
|
|
12798
12811
|
label: textCustomizations?.receiveAmountLabel ?? "You will receive",
|
|
12799
|
-
|
|
12812
|
+
paymentTokenAmount: targetTokenString,
|
|
12800
12813
|
icon: /* @__PURE__ */ React137.createElement(
|
|
12801
12814
|
FunAssetAvatar,
|
|
12802
12815
|
{
|
|
@@ -12810,8 +12823,7 @@ function PaymentAmountSummary({
|
|
|
12810
12823
|
assetName: "checkout-asset"
|
|
12811
12824
|
}
|
|
12812
12825
|
),
|
|
12813
|
-
isLoading
|
|
12814
|
-
enableChainDetailExpand: false
|
|
12826
|
+
isLoading
|
|
12815
12827
|
}
|
|
12816
12828
|
));
|
|
12817
12829
|
}
|
|
@@ -12820,9 +12832,10 @@ function PaymentAmountSummaryItem({
|
|
|
12820
12832
|
destinationChainId,
|
|
12821
12833
|
isLoading,
|
|
12822
12834
|
label,
|
|
12823
|
-
|
|
12835
|
+
paymentTokenAmount,
|
|
12836
|
+
paymentUsdAmount,
|
|
12824
12837
|
icon,
|
|
12825
|
-
enableChainDetailExpand
|
|
12838
|
+
enableChainDetailExpand = false
|
|
12826
12839
|
}) {
|
|
12827
12840
|
const [isExpanded, setIsExpanded] = useState33(false);
|
|
12828
12841
|
const toggle = () => setIsExpanded(!isExpanded);
|
|
@@ -12833,41 +12846,21 @@ function PaymentAmountSummaryItem({
|
|
|
12833
12846
|
onClick: toggle
|
|
12834
12847
|
},
|
|
12835
12848
|
/* @__PURE__ */ React137.createElement(FunTxSummaryLineItemKeyText, { text: label }),
|
|
12836
|
-
isLoading ? /* @__PURE__ */ React137.createElement(Box, { alignItems: "center", display: "flex", gap: "8" }, /* @__PURE__ */ React137.createElement(FunSkeletonCircle, { size: "15" }), /* @__PURE__ */ React137.createElement(FunSkeletonBlock, { height: "10", width: "93" })) : /* @__PURE__ */ React137.createElement(
|
|
12849
|
+
isLoading ? /* @__PURE__ */ React137.createElement(Box, { alignItems: "center", display: "flex", gap: "8" }, /* @__PURE__ */ React137.createElement(FunSkeletonCircle, { size: "15" }), /* @__PURE__ */ React137.createElement(FunSkeletonBlock, { height: "10", width: "93" })) : /* @__PURE__ */ React137.createElement(Box, { display: "flex", justifyContent: "flex-end", flexDirection: "column" }, /* @__PURE__ */ React137.createElement(Box, { display: "flex", alignItems: "center", gap: "5" }, icon, /* @__PURE__ */ React137.createElement(Text, { weight: "medium", size: "12", style: { textAlign: "end" } }, paymentTokenAmount), enableChainDetailExpand && /* @__PURE__ */ React137.createElement(
|
|
12837
12850
|
Box,
|
|
12838
12851
|
{
|
|
12852
|
+
color: "secondaryText",
|
|
12853
|
+
width: "8",
|
|
12854
|
+
height: "8",
|
|
12839
12855
|
display: "flex",
|
|
12840
12856
|
alignItems: "center",
|
|
12841
|
-
justifyContent: "
|
|
12842
|
-
|
|
12857
|
+
justifyContent: "center",
|
|
12858
|
+
style: {
|
|
12859
|
+
transform: `rotate(${isExpanded ? "0deg" : "-90deg"})`
|
|
12860
|
+
}
|
|
12843
12861
|
},
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
Text,
|
|
12847
|
-
{
|
|
12848
|
-
weight: "medium",
|
|
12849
|
-
color: "primaryText",
|
|
12850
|
-
size: "12",
|
|
12851
|
-
style: { textAlign: "end" }
|
|
12852
|
-
},
|
|
12853
|
-
paymentTokenString
|
|
12854
|
-
),
|
|
12855
|
-
enableChainDetailExpand && /* @__PURE__ */ React137.createElement(
|
|
12856
|
-
Box,
|
|
12857
|
-
{
|
|
12858
|
-
color: "secondaryText",
|
|
12859
|
-
width: "8",
|
|
12860
|
-
height: "8",
|
|
12861
|
-
display: "flex",
|
|
12862
|
-
alignItems: "center",
|
|
12863
|
-
justifyContent: "center",
|
|
12864
|
-
style: {
|
|
12865
|
-
transform: `rotate(${isExpanded ? "0deg" : "-90deg"})`
|
|
12866
|
-
}
|
|
12867
|
-
},
|
|
12868
|
-
/* @__PURE__ */ React137.createElement(CaretDownIcon, null)
|
|
12869
|
-
)
|
|
12870
|
-
)
|
|
12862
|
+
/* @__PURE__ */ React137.createElement(CaretDownIcon, null)
|
|
12863
|
+
)), paymentUsdAmount && /* @__PURE__ */ React137.createElement(Text, { size: "10", color: "secondaryText", textAlign: "right" }, paymentUsdAmount))
|
|
12871
12864
|
), enableChainDetailExpand && /* @__PURE__ */ React137.createElement(FunTxSummaryCollapsibleBox, { isExpanded }, /* @__PURE__ */ React137.createElement(FunTxSummaryLineItem, null, /* @__PURE__ */ React137.createElement(FunTxSummaryLineItemKeyText, { text: "Source chain" }), isLoading ? /* @__PURE__ */ React137.createElement(FunSkeletonBlock, { height: "10", width: "54" }) : /* @__PURE__ */ React137.createElement(
|
|
12872
12865
|
Box,
|
|
12873
12866
|
{
|
|
@@ -12908,7 +12901,7 @@ function PaymentAmountSummaryItem({
|
|
|
12908
12901
|
}
|
|
12909
12902
|
|
|
12910
12903
|
// src/modals/CheckoutModal/ConfirmationStep/CheckoutPrimaryInfo.tsx
|
|
12911
|
-
import { formatCurrencyAndStringify as
|
|
12904
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify6 } from "@funkit/utils";
|
|
12912
12905
|
import React138 from "react";
|
|
12913
12906
|
function CheckoutPrimaryInfoSnapshot({
|
|
12914
12907
|
checkoutItem,
|
|
@@ -12926,7 +12919,7 @@ function CheckoutPrimaryInfoSnapshot({
|
|
|
12926
12919
|
justifyContent: "center",
|
|
12927
12920
|
gap: "4"
|
|
12928
12921
|
},
|
|
12929
|
-
isLoading ? /* @__PURE__ */ React138.createElement(FunSkeletonBlock, { height: "48", width: "120" }) : /* @__PURE__ */ React138.createElement(Text, { color: "primaryText", size: "40", weight: "medium", textAlign: "center" },
|
|
12922
|
+
isLoading ? /* @__PURE__ */ React138.createElement(FunSkeletonBlock, { height: "48", width: "120" }) : /* @__PURE__ */ React138.createElement(Text, { color: "primaryText", size: "40", weight: "medium", textAlign: "center" }, formatCurrencyAndStringify6(displayDollarValue)),
|
|
12930
12923
|
showTokenAmount && /* @__PURE__ */ React138.createElement(Box, { display: "flex", gap: "5", justifyContent: "center" }, checkoutConfig.iconSrc ? /* @__PURE__ */ React138.createElement(
|
|
12931
12924
|
FunAssetAvatar,
|
|
12932
12925
|
{
|
|
@@ -14296,7 +14289,8 @@ function ConfirmationStep({
|
|
|
14296
14289
|
isLoading: isQuoting,
|
|
14297
14290
|
targetChainId,
|
|
14298
14291
|
checkoutItem,
|
|
14299
|
-
textCustomizations
|
|
14292
|
+
textCustomizations,
|
|
14293
|
+
uiCustomizations
|
|
14300
14294
|
}
|
|
14301
14295
|
), /* @__PURE__ */ React143.createElement(PaymentFeesSummary, { isLoading: isQuoting, checkoutItem }), /* @__PURE__ */ React143.createElement(
|
|
14302
14296
|
FunAlert,
|
|
@@ -14564,7 +14558,7 @@ import React156 from "react";
|
|
|
14564
14558
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoaded.tsx
|
|
14565
14559
|
import {
|
|
14566
14560
|
formatCryptoAndStringify as formatCryptoAndStringify4,
|
|
14567
|
-
formatCurrencyAndStringify as
|
|
14561
|
+
formatCurrencyAndStringify as formatCurrencyAndStringify8,
|
|
14568
14562
|
round as round3
|
|
14569
14563
|
} from "@funkit/utils";
|
|
14570
14564
|
import React154, { useMemo as useMemo25 } from "react";
|
|
@@ -14630,7 +14624,7 @@ var useDynamicFont = (inputValue, max, min = 16) => {
|
|
|
14630
14624
|
|
|
14631
14625
|
// src/modals/CheckoutModal/InputAmount/AvailableBalance.tsx
|
|
14632
14626
|
import {
|
|
14633
|
-
formatCurrencyAndStringify as
|
|
14627
|
+
formatCurrencyAndStringify as formatCurrencyAndStringify7,
|
|
14634
14628
|
isMobile as isMobile10,
|
|
14635
14629
|
isNotNullish as isNotNullish9
|
|
14636
14630
|
} from "@funkit/utils";
|
|
@@ -14650,7 +14644,7 @@ function AvailableBalanceInner({
|
|
|
14650
14644
|
assetName: sourceHolding.symbol,
|
|
14651
14645
|
assetIconSize: "12"
|
|
14652
14646
|
}
|
|
14653
|
-
), /* @__PURE__ */ React151.createElement(Text, { size: "10", color: "primaryText" },
|
|
14647
|
+
), /* @__PURE__ */ React151.createElement(Text, { size: "10", color: "primaryText" }, formatCurrencyAndStringify7(usdAvailableAmount), " available"));
|
|
14654
14648
|
}
|
|
14655
14649
|
var AvailableBalance = (props) => {
|
|
14656
14650
|
return /* @__PURE__ */ React151.createElement(
|
|
@@ -14682,7 +14676,6 @@ function InputAmountLayout({
|
|
|
14682
14676
|
const funkitConfig = useFunkitConfig();
|
|
14683
14677
|
const uiCustomizations = funkitConfig.uiCustomizations?.inputAmountScreen;
|
|
14684
14678
|
const allowTokenAmountInput = uiCustomizations?.allowTokenAmountInput ?? true;
|
|
14685
|
-
const showAvailableBalance = uiCustomizations?.showAvailableBalance ?? true;
|
|
14686
14679
|
const bottomSectionRef = useBottomSectionRef();
|
|
14687
14680
|
return /* @__PURE__ */ React152.createElement(Box, { display: "flex", flexDirection: "column", width: "full", style: { flex: 1 } }, /* @__PURE__ */ React152.createElement(
|
|
14688
14681
|
Box,
|
|
@@ -14761,7 +14754,7 @@ function InputAmountLayout({
|
|
|
14761
14754
|
}
|
|
14762
14755
|
)
|
|
14763
14756
|
)
|
|
14764
|
-
),
|
|
14757
|
+
), availableBalance),
|
|
14765
14758
|
actionButtonProps
|
|
14766
14759
|
}
|
|
14767
14760
|
),
|
|
@@ -15100,7 +15093,7 @@ function InputAmountLoaded({
|
|
|
15100
15093
|
switch (inputError?.type) {
|
|
15101
15094
|
case "aboveAvailable": {
|
|
15102
15095
|
return {
|
|
15103
|
-
message: `Insufficient funds to purchase ${
|
|
15096
|
+
message: `Insufficient funds to purchase ${formatCurrencyAndStringify8(
|
|
15104
15097
|
usdAmount
|
|
15105
15098
|
)} of ${checkoutItemTitle}. Please either lower the checkout amount, select an alternative asset, or another payment method.`,
|
|
15106
15099
|
type: "error"
|
|
@@ -15108,7 +15101,7 @@ function InputAmountLoaded({
|
|
|
15108
15101
|
}
|
|
15109
15102
|
case "aboveMax": {
|
|
15110
15103
|
return {
|
|
15111
|
-
message: `${
|
|
15104
|
+
message: `${formatCurrencyAndStringify8(
|
|
15112
15105
|
inputError.usdMaxAmount
|
|
15113
15106
|
)} maximum order`,
|
|
15114
15107
|
type: "hint"
|
|
@@ -15116,7 +15109,7 @@ function InputAmountLoaded({
|
|
|
15116
15109
|
}
|
|
15117
15110
|
case "belowMin": {
|
|
15118
15111
|
return {
|
|
15119
|
-
message: `${
|
|
15112
|
+
message: `${formatCurrencyAndStringify8(
|
|
15120
15113
|
inputError.usdMinAmount
|
|
15121
15114
|
)} minimum order`,
|
|
15122
15115
|
type: "hint"
|
|
@@ -15236,7 +15229,7 @@ function InputAmountLoaded({
|
|
|
15236
15229
|
color: { base: "actionColor", hover: "actionColorHover" },
|
|
15237
15230
|
onClick: handleIsAmountInAbsoluteToggle
|
|
15238
15231
|
},
|
|
15239
|
-
/* @__PURE__ */ React154.createElement(Text, { color: "actionColorDisabled", size: "14" }, isInputInUsd ? formatCryptoAndStringify4(assetAmount, targetAssetTicker) :
|
|
15232
|
+
/* @__PURE__ */ React154.createElement(Text, { color: "actionColorDisabled", size: "14" }, isInputInUsd ? formatCryptoAndStringify4(assetAmount, targetAssetTicker) : formatCurrencyAndStringify8(usdAmount))
|
|
15240
15233
|
)
|
|
15241
15234
|
)
|
|
15242
15235
|
),
|
|
@@ -15543,7 +15536,7 @@ import React160 from "react";
|
|
|
15543
15536
|
// src/components/FunAsset/FunAssetItem.tsx
|
|
15544
15537
|
import {
|
|
15545
15538
|
formatCryptoAndStringify as formatCryptoAndStringify6,
|
|
15546
|
-
formatCurrencyAndStringify as
|
|
15539
|
+
formatCurrencyAndStringify as formatCurrencyAndStringify9,
|
|
15547
15540
|
isNotNullish as isNotNullish10
|
|
15548
15541
|
} from "@funkit/utils";
|
|
15549
15542
|
import React159 from "react";
|
|
@@ -15731,7 +15724,7 @@ var FunAssetItem = ({
|
|
|
15731
15724
|
gap: "12"
|
|
15732
15725
|
},
|
|
15733
15726
|
badgeText ? /* @__PURE__ */ React159.createElement(FunAssetBadge, null, badgeText) : null,
|
|
15734
|
-
/* @__PURE__ */ React159.createElement(Box, { fontSize: TEXT_SIZE_MEDIUM2, fontWeight: "medium" },
|
|
15727
|
+
/* @__PURE__ */ React159.createElement(Box, { fontSize: TEXT_SIZE_MEDIUM2, fontWeight: "medium" }, formatCurrencyAndStringify9(asset.usdAmount || 0))
|
|
15735
15728
|
)
|
|
15736
15729
|
)
|
|
15737
15730
|
);
|
|
@@ -16412,7 +16405,7 @@ function MoonpaySetup({
|
|
|
16412
16405
|
}
|
|
16413
16406
|
|
|
16414
16407
|
// src/modals/CheckoutModal/SelectAsset.tsx
|
|
16415
|
-
import { formatCurrencyAndStringify as
|
|
16408
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify10 } from "@funkit/utils";
|
|
16416
16409
|
import React172, { useEffect as useEffect34, useMemo as useMemo33, useState as useState47 } from "react";
|
|
16417
16410
|
import { createPortal as createPortal8 } from "react-dom";
|
|
16418
16411
|
|
|
@@ -16795,7 +16788,7 @@ function SelectWalletAsset({
|
|
|
16795
16788
|
{
|
|
16796
16789
|
isSource: true,
|
|
16797
16790
|
keyText: getWalletLabel(textCustomizations, walletAddress),
|
|
16798
|
-
disclaimerText:
|
|
16791
|
+
disclaimerText: formatCurrencyAndStringify10(totalBalance),
|
|
16799
16792
|
keyIcon: label.icon,
|
|
16800
16793
|
onClick: onSelectSource
|
|
16801
16794
|
}
|
|
@@ -16841,7 +16834,7 @@ function SelectMeshAsset({
|
|
|
16841
16834
|
{
|
|
16842
16835
|
isSource: true,
|
|
16843
16836
|
keyText: label.text,
|
|
16844
|
-
disclaimerText:
|
|
16837
|
+
disclaimerText: formatCurrencyAndStringify10(totalBalance),
|
|
16845
16838
|
keyIcon: label.icon,
|
|
16846
16839
|
onClick: onSelectSource
|
|
16847
16840
|
}
|
|
@@ -17015,7 +17008,7 @@ import { isNotNullish as isNotNullish11 } from "@funkit/utils";
|
|
|
17015
17008
|
import React176, { useEffect as useEffect35, useState as useState50 } from "react";
|
|
17016
17009
|
|
|
17017
17010
|
// src/components/FunPayments/FunPaymentMethods.tsx
|
|
17018
|
-
import { formatCurrencyAndStringify as
|
|
17011
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify11 } from "@funkit/utils";
|
|
17019
17012
|
import React175, { Fragment as Fragment4 } from "react";
|
|
17020
17013
|
|
|
17021
17014
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
@@ -17859,7 +17852,7 @@ var ConnectedMeshPaymentMethodItem = ({
|
|
|
17859
17852
|
} = useMeshAccountHoldings(targetChainId, paymentMethodInfo.meta);
|
|
17860
17853
|
const sourceBalance = meshAssets ? getTotalAssetBalance(meshAssets) : 0;
|
|
17861
17854
|
const label = usePaymentMethodInfoLabel(paymentMethodInfo);
|
|
17862
|
-
const disclaimerText = isPending ? "Fetching balance..." : balanceError ? "Couldn't fetch balance" : `${
|
|
17855
|
+
const disclaimerText = isPending ? "Fetching balance..." : balanceError ? "Couldn't fetch balance" : `${formatCurrencyAndStringify11(sourceBalance)} \u2022 3 mins`;
|
|
17863
17856
|
const isDisabled = !!balanceError || sourceBalance < 0.01;
|
|
17864
17857
|
return /* @__PURE__ */ React175.createElement(
|
|
17865
17858
|
FunPaymentMethodItem,
|
|
@@ -17894,7 +17887,7 @@ var AccountBalancePaymentMethodItem = ({
|
|
|
17894
17887
|
);
|
|
17895
17888
|
return /* @__PURE__ */ React175.createElement(SupportedChainList, { chainIdList: uniqueChainIds });
|
|
17896
17889
|
};
|
|
17897
|
-
const dynamicLimit =
|
|
17890
|
+
const dynamicLimit = formatCurrencyAndStringify11(sourceBalance);
|
|
17898
17891
|
const disclaimerText = `${dynamicLimit ?? "No limit"} \u2022 Instant`;
|
|
17899
17892
|
const isClickable = sourceBalance !== void 0 && sourceBalance > 0.01;
|
|
17900
17893
|
const isDisabled = !isClickable || isLoadingAssets;
|
|
@@ -18339,7 +18332,7 @@ function SourceChange({
|
|
|
18339
18332
|
}
|
|
18340
18333
|
|
|
18341
18334
|
// src/modals/CheckoutModal/TransferToken.tsx
|
|
18342
|
-
import { formatCurrencyAndStringify as
|
|
18335
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify12 } from "@funkit/utils";
|
|
18343
18336
|
import React182, { useCallback as useCallback37, useState as useState54 } from "react";
|
|
18344
18337
|
import { mainnet as mainnet7, polygon as polygon4 } from "viem/chains";
|
|
18345
18338
|
|
|
@@ -18935,7 +18928,7 @@ function TransferToken({
|
|
|
18935
18928
|
justifyContent: "space-between"
|
|
18936
18929
|
},
|
|
18937
18930
|
/* @__PURE__ */ React182.createElement(Text, { size: "12", color: "secondaryText", weight: "medium" }, "Min. transfer amount"),
|
|
18938
|
-
/* @__PURE__ */ React182.createElement(Text, { size: "12", color: "primaryText", weight: "medium" }, minTransferUsd === 0 ? "No minimum" :
|
|
18931
|
+
/* @__PURE__ */ React182.createElement(Text, { size: "12", color: "primaryText", weight: "medium" }, minTransferUsd === 0 ? "No minimum" : formatCurrencyAndStringify12(minTransferUsd))
|
|
18939
18932
|
)
|
|
18940
18933
|
),
|
|
18941
18934
|
showOriginalRecipient ? null : /* @__PURE__ */ React182.createElement(Box, { display: "flex", flexDirection: "column", gap: "14", width: "full" }, /* @__PURE__ */ React182.createElement(Text, { size: "12", color: "secondaryText", weight: "medium" }, "Transfer ", selectedToken, " (", selectedChainInfo.name, ") to the deposit address above. The equivalent USD value (minus", " ", /* @__PURE__ */ React182.createElement(
|
|
@@ -20223,7 +20216,7 @@ function ShowBalanceProvider({ children }) {
|
|
|
20223
20216
|
var useShowBalance = () => useContext20(ShowBalanceContext);
|
|
20224
20217
|
|
|
20225
20218
|
// src/components/ConnectButton/ConnectButtonRenderer.tsx
|
|
20226
|
-
import { formatCurrencyAndStringify as
|
|
20219
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify13, isMobile as isMobile14, noop as noop6 } from "@funkit/utils";
|
|
20227
20220
|
import React190 from "react";
|
|
20228
20221
|
import { useAccount as useAccount12, useBalance, useConfig as useConfig6 } from "wagmi";
|
|
20229
20222
|
|
|
@@ -20308,7 +20301,7 @@ function ConnectButtonRenderer({
|
|
|
20308
20301
|
query: { structuralSharing: false }
|
|
20309
20302
|
});
|
|
20310
20303
|
const balanceNativeAmount = balanceData ? `${abbreviateETHBalance(Number.parseFloat(balanceData.formatted))} ${balanceData.symbol}` : void 0;
|
|
20311
|
-
const displayBalance =
|
|
20304
|
+
const displayBalance = formatCurrencyAndStringify13(
|
|
20312
20305
|
Number.parseFloat(totalWalletAssetsUsd.toString())
|
|
20313
20306
|
);
|
|
20314
20307
|
const { openConnectModal } = useConnectModal();
|
|
@@ -21111,7 +21104,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
21111
21104
|
localStorage.setItem(storageKey5, version);
|
|
21112
21105
|
}
|
|
21113
21106
|
function getCurrentSdkVersion() {
|
|
21114
|
-
return "4.0.
|
|
21107
|
+
return "4.0.2";
|
|
21115
21108
|
}
|
|
21116
21109
|
function useFingerprint() {
|
|
21117
21110
|
const fingerprint = useCallback42(() => {
|
|
@@ -22,14 +22,14 @@ export interface FunkitUiCustomizationsConfig {
|
|
|
22
22
|
confirmationScreen?: {
|
|
23
23
|
/** Whether to show the amount of tokens below the USD equivalent - defaults to true */
|
|
24
24
|
showTokenAmount?: boolean;
|
|
25
|
+
/** Whether to show the total payment amount in USD below the token amount equivalent. Defaults to false */
|
|
26
|
+
showPaymentAmountUsd?: boolean;
|
|
25
27
|
/** Configure UI when `customRecipient` is specified in the config */
|
|
26
28
|
customRecipientConfig?: FunkitUiCustomRecipientConfig;
|
|
27
29
|
};
|
|
28
30
|
inputAmountScreen?: {
|
|
29
31
|
/** Whether to allow entering an amount of tokens, rather than only USD - defaults to true */
|
|
30
32
|
allowTokenAmountInput?: boolean;
|
|
31
|
-
/** Whether to show available balance in Input Amount screen (wallet/brokerage only) - defaults to true */
|
|
32
|
-
showAvailableBalance?: boolean;
|
|
33
33
|
};
|
|
34
34
|
paymentMethods?: {
|
|
35
35
|
/** Whether paying by card is a payment method the users can use - defaults to true */
|
package/dist/utils/safeJSON.d.ts
CHANGED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
getInjectedConnector,
|
|
4
|
+
hasInjectedProvider
|
|
5
|
+
} from "./chunk-WRA2DVJ7.js";
|
|
6
|
+
import {
|
|
7
|
+
getWalletConnectConnector
|
|
8
|
+
} from "./chunk-23WIEY36.js";
|
|
9
|
+
|
|
10
|
+
// src/wallets/walletConnectors/roninWallet/roninWallet.ts
|
|
11
|
+
var roninWallet = ({
|
|
12
|
+
projectId,
|
|
13
|
+
walletConnectParameters
|
|
14
|
+
}) => {
|
|
15
|
+
const isRoninInjected = hasInjectedProvider({
|
|
16
|
+
namespace: "ronin.provider"
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
id: "ronin",
|
|
20
|
+
name: "Ronin Wallet",
|
|
21
|
+
iconUrl: async () => (await import("./roninWallet-SAB5ESVK.js")).default,
|
|
22
|
+
iconBackground: "#ffffff",
|
|
23
|
+
rdns: "com.roninchain.wallet",
|
|
24
|
+
installed: isRoninInjected || void 0,
|
|
25
|
+
downloadUrls: {
|
|
26
|
+
android: "https://play.google.com/store/apps/details?id=com.skymavis.genesis",
|
|
27
|
+
ios: "https://apps.apple.com/us/app/ronin-wallet/id1592675001",
|
|
28
|
+
mobile: "https://wallet.roninchain.com",
|
|
29
|
+
chrome: "https://chrome.google.com/webstore/detail/ronin-wallet/fnjhmkhhmkbjkkabndcnnogagogbneec",
|
|
30
|
+
edge: "https://microsoftedge.microsoft.com/addons/detail/ronin-wallet/kjmoohlgokccodicjjfebfomlbljgfhk",
|
|
31
|
+
firefox: "https://addons.mozilla.org/firefox/addon/ronin-wallet",
|
|
32
|
+
browserExtension: "https://wallet.roninchain.com/",
|
|
33
|
+
qrCode: "https://wallet.roninchain.com/"
|
|
34
|
+
},
|
|
35
|
+
mobile: {
|
|
36
|
+
getUri: (uri) => `roninwallet://wc?uri=${encodeURIComponent(uri)}`
|
|
37
|
+
},
|
|
38
|
+
qrCode: {
|
|
39
|
+
getUri: (uri) => uri,
|
|
40
|
+
instructions: {
|
|
41
|
+
learnMoreUrl: "https://wallet.roninchain.com/",
|
|
42
|
+
steps: [
|
|
43
|
+
{
|
|
44
|
+
description: "wallet_connectors.ronin.qr_code.step1.description",
|
|
45
|
+
step: "install",
|
|
46
|
+
title: "wallet_connectors.ronin.qr_code.step1.title"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
description: "wallet_connectors.ronin.qr_code.step2.description",
|
|
50
|
+
step: "create",
|
|
51
|
+
title: "wallet_connectors.ronin.qr_code.step2.title"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
description: "wallet_connectors.ronin.qr_code.step3.description",
|
|
55
|
+
step: "scan",
|
|
56
|
+
title: "wallet_connectors.ronin.qr_code.step3.title"
|
|
57
|
+
}
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
extension: {
|
|
62
|
+
instructions: {
|
|
63
|
+
learnMoreUrl: "https://wallet.roninchain.com/",
|
|
64
|
+
steps: [
|
|
65
|
+
{
|
|
66
|
+
description: "wallet_connectors.ronin.extension.step1.description",
|
|
67
|
+
step: "install",
|
|
68
|
+
title: "wallet_connectors.ronin.extension.step1.title"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
description: "wallet_connectors.ronin.extension.step2.description",
|
|
72
|
+
step: "create",
|
|
73
|
+
title: "wallet_connectors.ronin.extension.step2.title"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
description: "wallet_connectors.ronin.extension.step3.description",
|
|
77
|
+
step: "refresh",
|
|
78
|
+
title: "wallet_connectors.ronin.extension.step3.title"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
createConnector: isRoninInjected ? getInjectedConnector({ namespace: "ronin.provider" }) : getWalletConnectConnector({
|
|
84
|
+
projectId,
|
|
85
|
+
walletConnectParameters
|
|
86
|
+
})
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
roninWallet
|
|
92
|
+
};
|