@funkit/connect 5.5.7 → 5.5.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 +29 -0
- package/dist/components/Dialog/Dialog.d.ts +5 -3
- package/dist/components/Dialog/DialogContent.css.d.ts +2 -1
- package/dist/hooks/queries/useMeldLimits.d.ts +158 -2
- package/dist/hooks/useCheckoutDirectExecution.d.ts +3 -1
- package/dist/index.css +19 -17
- package/dist/index.js +429 -394
- package/dist/modals/CheckoutModal/InputAmount/QuickOptions.d.ts +6 -3
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +19 -17
- package/dist/modals/CheckoutModal/InputAmount/useAmountInput.d.ts +2 -2
- package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +1 -0
- package/dist/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.d.ts +0 -2
- package/dist/utils/flags/config.d.ts +6 -29
- package/dist/wallets/walletConnectors/index.js +55 -55
- package/package.json +13 -17
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
lightTheme
|
|
4
|
-
} from "./chunk-RN4I4Y57.js";
|
|
5
2
|
import {
|
|
6
3
|
darkTheme
|
|
7
4
|
} from "./chunk-ICCAQZHZ.js";
|
|
5
|
+
import {
|
|
6
|
+
lightTheme
|
|
7
|
+
} from "./chunk-RN4I4Y57.js";
|
|
8
8
|
import {
|
|
9
9
|
systemFontStack
|
|
10
10
|
} from "./chunk-R2UFCJL7.js";
|
|
@@ -12,18 +12,19 @@ import {
|
|
|
12
12
|
// src/components/Dialog/DialogContent.css.ts
|
|
13
13
|
var BASE_DIALOG_PADDING = "6";
|
|
14
14
|
var SCROLL_BAR_WIDTH = 6;
|
|
15
|
-
var contentCollapsed = "
|
|
16
|
-
var contentExpanded = "
|
|
15
|
+
var contentCollapsed = "_1pzt423f";
|
|
16
|
+
var contentExpanded = "_1pzt423e";
|
|
17
17
|
var dialog = "_1pzt4231 _1rsrm2fjf _1rsrm2fzx _1rsrm2fw _1rsrm2f1b _1rsrm2f1f _1rsrm2f1cx _1rsrm2fa _1rsrm2f1p _1rsrm2fbs _1rsrm2fev _1rsrm2fca _1rsrm2fdh _1rsrm2fcq";
|
|
18
18
|
var dialogCompact = "_1pzt4232 _1pzt4231 _1rsrm2fjf _1rsrm2fzx _1rsrm2fw _1rsrm2f1b _1rsrm2f1f _1rsrm2f1cx _1rsrm2fa _1rsrm2f1p _1rsrm2fbs _1rsrm2fev _1rsrm2fca _1rsrm2fdh _1rsrm2fcq";
|
|
19
19
|
var dialogMedium = "_1pzt4233 _1pzt4231 _1rsrm2fjf _1rsrm2fzx _1rsrm2fw _1rsrm2f1b _1rsrm2f1f _1rsrm2f1cx _1rsrm2fa _1rsrm2f1p _1rsrm2fbs _1rsrm2fev _1rsrm2fca _1rsrm2fdh _1rsrm2fcq";
|
|
20
|
-
var dialogMobile = "
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
20
|
+
var dialogMobile = "_1pzt4237 _1rsrm2fx _1rsrm2f1f";
|
|
21
|
+
var dividerTransition = "_1pzt423d";
|
|
22
|
+
var fullHeightContent = "_1pzt423b";
|
|
23
|
+
var noPaddingContent = "_1pzt423c";
|
|
24
|
+
var scrollContent = "_1pzt4239 _1rsrm2fg0";
|
|
25
|
+
var scrollbarHidden = "_1pzt423a";
|
|
26
|
+
var withoutBottomPadding = "_1pzt4235";
|
|
27
|
+
var withoutSidePadding = "_1pzt4234";
|
|
27
28
|
|
|
28
29
|
// src/modals/DevTest/DevEmbed.tsx
|
|
29
30
|
import React2 from "react";
|
|
@@ -509,7 +510,7 @@ import React256, {
|
|
|
509
510
|
useCallback as useCallback47,
|
|
510
511
|
useContext as useContext18,
|
|
511
512
|
useEffect as useEffect48,
|
|
512
|
-
useMemo as
|
|
513
|
+
useMemo as useMemo43,
|
|
513
514
|
useState as useState67
|
|
514
515
|
} from "react";
|
|
515
516
|
import { useConfig as useConfig5, useConnect as useConnect2, useDisconnect as useDisconnect2 } from "wagmi";
|
|
@@ -1031,7 +1032,7 @@ import React255, {
|
|
|
1031
1032
|
useCallback as useCallback46,
|
|
1032
1033
|
useContext as useContext17,
|
|
1033
1034
|
useEffect as useEffect47,
|
|
1034
|
-
useMemo as
|
|
1035
|
+
useMemo as useMemo42,
|
|
1035
1036
|
useState as useState66
|
|
1036
1037
|
} from "react";
|
|
1037
1038
|
import { useAccount as useAccount9, useAccountEffect as useAccountEffect2, useConfig as useConfig4 } from "wagmi";
|
|
@@ -3237,7 +3238,7 @@ var flagConfig = {
|
|
|
3237
3238
|
{
|
|
3238
3239
|
key: "userId",
|
|
3239
3240
|
type: "pctRollout",
|
|
3240
|
-
pct:
|
|
3241
|
+
pct: 50
|
|
3241
3242
|
},
|
|
3242
3243
|
{
|
|
3243
3244
|
key: "apiKey",
|
|
@@ -3592,48 +3593,48 @@ var flagConfig = {
|
|
|
3592
3593
|
type: "boolean",
|
|
3593
3594
|
default_value: false,
|
|
3594
3595
|
overrides: [
|
|
3595
|
-
{
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
|
|
3602
|
-
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
},
|
|
3615
|
-
{
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
},
|
|
3596
|
+
// {
|
|
3597
|
+
// if_any: [
|
|
3598
|
+
// {
|
|
3599
|
+
// key: 'userId',
|
|
3600
|
+
// type: 'isAnyOf',
|
|
3601
|
+
// values: [
|
|
3602
|
+
// '0x6ec0c2f25d323e7779925Cc20c3740101f990d9F',
|
|
3603
|
+
// '0xbeFE12aA8cBa36DD79F50eE5E23828adB62f2FD6',
|
|
3604
|
+
// '0x2A8Bd916E85d98d8175258De99fc0ddbcC102eF6',
|
|
3605
|
+
// '0xda6b07Eb94f699F511a943e9bFC12B64B7fe3486',
|
|
3606
|
+
// '0x0D6e43CA32545B3dc2FE6f93AafBD7e640F548d4',
|
|
3607
|
+
// '0x236c60C57a8B9ca563Fb0dA5199FDdCB686d91E8', // greg
|
|
3608
|
+
// '0x4a1457fa2845bAfE8D3909cA3C5ac6107be312Dd', // william PM
|
|
3609
|
+
// '0xfCB8B2d294eD7373B3B590dd7C0CBC430d41a9a0', // Arun from Meld
|
|
3610
|
+
// '0x9CB7F86F360459cC96C74a0F81aF2C4cC7a54bd2', // felix
|
|
3611
|
+
// ],
|
|
3612
|
+
// },
|
|
3613
|
+
// ],
|
|
3614
|
+
// value: true,
|
|
3615
|
+
// },
|
|
3616
|
+
// {
|
|
3617
|
+
// if_all: [
|
|
3618
|
+
// {
|
|
3619
|
+
// key: 'userId',
|
|
3620
|
+
// type: 'pctRollout',
|
|
3621
|
+
// pct: 5,
|
|
3622
|
+
// },
|
|
3623
|
+
// {
|
|
3624
|
+
// key: 'apiKey',
|
|
3625
|
+
// type: 'isAnyOf',
|
|
3626
|
+
// values: [POLYMARKET_API_KEY],
|
|
3627
|
+
// },
|
|
3628
|
+
// ],
|
|
3629
|
+
// if_any: [
|
|
3630
|
+
// {
|
|
3631
|
+
// key: 'userId',
|
|
3632
|
+
// type: 'pctRollout',
|
|
3633
|
+
// pct: 0,
|
|
3634
|
+
// },
|
|
3635
|
+
// ],
|
|
3636
|
+
// value: true,
|
|
3637
|
+
// },
|
|
3637
3638
|
{
|
|
3638
3639
|
if_any: [
|
|
3639
3640
|
{
|
|
@@ -3665,6 +3666,14 @@ var flagConfig = {
|
|
|
3665
3666
|
PLN: [370, 1860, 3715],
|
|
3666
3667
|
SGD: [130, 645, 1285]
|
|
3667
3668
|
})
|
|
3669
|
+
},
|
|
3670
|
+
[FlagKey.MinTokenTransferValue]: {
|
|
3671
|
+
type: "string",
|
|
3672
|
+
default_value: JSON.stringify({
|
|
3673
|
+
CA: { mainnet: 80, nonMainnet: 15 },
|
|
3674
|
+
AU: { mainnet: 90, nonMainnet: 20 },
|
|
3675
|
+
DEFAULT: { mainnet: 50, nonMainnet: 10 }
|
|
3676
|
+
})
|
|
3668
3677
|
}
|
|
3669
3678
|
};
|
|
3670
3679
|
|
|
@@ -3930,7 +3939,7 @@ import {
|
|
|
3930
3939
|
isTokenEquivalent as isTokenEquivalent2,
|
|
3931
3940
|
round
|
|
3932
3941
|
} from "@funkit/utils";
|
|
3933
|
-
import { polygon as polygon2 } from "viem/chains";
|
|
3942
|
+
import { arbitrum as arbitrum2, polygon as polygon2 } from "viem/chains";
|
|
3934
3943
|
|
|
3935
3944
|
// src/hooks/useCheckoutDirectExecution.ts
|
|
3936
3945
|
import { DirectExecutionType } from "@funkit/api-base";
|
|
@@ -4050,13 +4059,17 @@ function isVertexDirectExecution({
|
|
|
4050
4059
|
config,
|
|
4051
4060
|
paymentMethod,
|
|
4052
4061
|
sourceAsset,
|
|
4053
|
-
sourceChain
|
|
4062
|
+
sourceChain,
|
|
4063
|
+
targetAsset,
|
|
4064
|
+
targetChain
|
|
4054
4065
|
}) {
|
|
4055
4066
|
return isVertexCustomer(apiKey) && isCheckoutPostActionRequired(config) && paymentMethod === "balance" /* ACCOUNT_BALANCE */ && isTokenEquivalent({
|
|
4056
4067
|
firstTokenAddress: sourceAsset,
|
|
4057
4068
|
firstTokenChainId: sourceChain,
|
|
4058
|
-
|
|
4059
|
-
|
|
4069
|
+
// consider the current target asset and chain first before the config values, reasoning is the real values get updated after submitting the Select Asset step, not when the Receive token dropdown changes value
|
|
4070
|
+
// if needed, we can still provide config values as current target asset and chain
|
|
4071
|
+
secondTokenAddress: targetAsset ?? config.targetAsset,
|
|
4072
|
+
secondTokenChainId: targetChain ?? config.targetChain
|
|
4060
4073
|
});
|
|
4061
4074
|
}
|
|
4062
4075
|
function useCheckoutDirectExecution() {
|
|
@@ -4231,6 +4244,9 @@ var DEFAULT_CHECKOUT_HISTORY_DETAIL_TITLE = "Your Purchase";
|
|
|
4231
4244
|
var ASSET_DECIMALS = 5;
|
|
4232
4245
|
var USD_DECIMALS = 2;
|
|
4233
4246
|
var USD_INITIAL_AMOUNT = 100;
|
|
4247
|
+
function getDefaultAmountFromQuickOptions(quickOptions) {
|
|
4248
|
+
return quickOptions?.[Math.floor((quickOptions.length - 1) / 2)];
|
|
4249
|
+
}
|
|
4234
4250
|
function getUsdMaxAmount(maxUsd) {
|
|
4235
4251
|
if (maxUsd < Number.MAX_VALUE) return maxUsd;
|
|
4236
4252
|
return null;
|
|
@@ -4353,6 +4369,10 @@ function isDefaultToken(asset, checkoutConfig) {
|
|
|
4353
4369
|
);
|
|
4354
4370
|
}
|
|
4355
4371
|
var isPolygonEcosystemToken = (chainId, tokenAddress) => chainId === polygon2.id.toString() && tokenAddress === "0x0000000000000000000000000000000000001010";
|
|
4372
|
+
var isVertexTokenOnArbitrum = (chainId, tokenAddress) => chainId === arbitrum2.id.toString() && isTokenAddressEquivalent2({
|
|
4373
|
+
firstTokenAddress: tokenAddress,
|
|
4374
|
+
secondTokenAddress: "0x95146881b86b3ee99e63705ec87afe29fcc044d9"
|
|
4375
|
+
});
|
|
4356
4376
|
var isAssetUsableToPayForCheckout = ({
|
|
4357
4377
|
apiKey,
|
|
4358
4378
|
config,
|
|
@@ -4380,24 +4400,28 @@ var isAssetUsableToPayForCheckout = ({
|
|
|
4380
4400
|
if (isSameAsPurchasingToken) {
|
|
4381
4401
|
return { isUsable: false, reason: "Not Applicable" };
|
|
4382
4402
|
}
|
|
4403
|
+
const isVertexDirectExecutionCase = isVertexDirectExecution({
|
|
4404
|
+
apiKey,
|
|
4405
|
+
config,
|
|
4406
|
+
paymentMethod,
|
|
4407
|
+
targetAsset: targetTokenAddress,
|
|
4408
|
+
targetChain: targetChainId,
|
|
4409
|
+
sourceAsset: assetTokenAddress,
|
|
4410
|
+
sourceChain: assetChainId
|
|
4411
|
+
});
|
|
4383
4412
|
const usableAmountEstimation = getUsdAvailableAmount(
|
|
4384
4413
|
targetChainId,
|
|
4385
4414
|
assetChainId,
|
|
4386
4415
|
assetUsdAmount,
|
|
4387
4416
|
paymentMethod,
|
|
4388
|
-
|
|
4389
|
-
apiKey,
|
|
4390
|
-
config,
|
|
4391
|
-
paymentMethod,
|
|
4392
|
-
sourceAsset: assetTokenAddress,
|
|
4393
|
-
sourceChain: assetChainId
|
|
4394
|
-
})
|
|
4417
|
+
isVertexDirectExecutionCase
|
|
4395
4418
|
);
|
|
4396
4419
|
if (usableAmountEstimation !== null && usableAmountEstimation < getUsdMinAmount(paymentMethod)) {
|
|
4397
4420
|
return { isUsable: false, reason: LOW_BALANCE };
|
|
4398
4421
|
}
|
|
4422
|
+
const isVertexTokenDisabledOnArbitrum = isVertexTokenOnArbitrum(assetChainId, assetTokenAddress) && !isVertexDirectExecutionCase;
|
|
4399
4423
|
const isConnectedAccountSupported = loginType !== "web2" /* Web2 */ || FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId]?.isFunWalletSupported;
|
|
4400
|
-
const isSupported = isAllowedForCheckout && isConnectedAccountSupported && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId]?.isCheckoutSupported;
|
|
4424
|
+
const isSupported = isAllowedForCheckout && isConnectedAccountSupported && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId]?.isCheckoutSupported && !isVertexTokenDisabledOnArbitrum;
|
|
4401
4425
|
return {
|
|
4402
4426
|
isUsable: !!isSupported,
|
|
4403
4427
|
reason: !isSupported ? "Unsupported" : ""
|
|
@@ -6070,7 +6094,7 @@ var HelpIcon = () => {
|
|
|
6070
6094
|
fill: "none",
|
|
6071
6095
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6072
6096
|
},
|
|
6073
|
-
/* @__PURE__ */ React57.createElement("g", {
|
|
6097
|
+
/* @__PURE__ */ React57.createElement("g", { clipPath: "url(#clip0_29018_24767)" }, /* @__PURE__ */ React57.createElement(
|
|
6074
6098
|
"path",
|
|
6075
6099
|
{
|
|
6076
6100
|
d: "M6.09825 6.50016C6.25498 6.05461 6.56435 5.6789 6.97155 5.43958C7.37875 5.20027 7.85751 5.11279 8.32303 5.19264C8.78855 5.27249 9.21079 5.51451 9.51497 5.87585C9.81914 6.23718 9.98562 6.69451 9.98491 7.16683C9.98491 8.50016 7.98492 9.16683 7.98492 9.16683M8.03825 11.8335H8.04492M14.7049 8.50016C14.7049 12.1821 11.7201 15.1668 8.03825 15.1668C4.35635 15.1668 1.37158 12.1821 1.37158 8.50016C1.37158 4.81826 4.35635 1.8335 8.03825 1.8335C11.7201 1.8335 14.7049 4.81826 14.7049 8.50016Z",
|
|
@@ -6191,7 +6215,8 @@ function Dialog({
|
|
|
6191
6215
|
titleId,
|
|
6192
6216
|
isHidden = false,
|
|
6193
6217
|
isSmartCloseable = false,
|
|
6194
|
-
|
|
6218
|
+
withoutSidePadding: withoutSidePadding2 = false,
|
|
6219
|
+
withoutBottomPadding: withoutBottomPadding2 = false,
|
|
6195
6220
|
withTransition = true
|
|
6196
6221
|
}) {
|
|
6197
6222
|
const { allowBackgroundScroll } = useFunkitConfig();
|
|
@@ -6277,7 +6302,8 @@ function Dialog({
|
|
|
6277
6302
|
/* @__PURE__ */ React59.createElement(FocusTrap, { className: content }, /* @__PURE__ */ React59.createElement(
|
|
6278
6303
|
DialogWrapper,
|
|
6279
6304
|
{
|
|
6280
|
-
|
|
6305
|
+
withoutSidePadding: withoutSidePadding2,
|
|
6306
|
+
withoutBottomPadding: withoutBottomPadding2
|
|
6281
6307
|
},
|
|
6282
6308
|
children
|
|
6283
6309
|
))
|
|
@@ -6289,7 +6315,8 @@ function Dialog({
|
|
|
6289
6315
|
}
|
|
6290
6316
|
var DialogWrapper = ({
|
|
6291
6317
|
children,
|
|
6292
|
-
|
|
6318
|
+
withoutSidePadding: withoutSidePadding2 = false,
|
|
6319
|
+
withoutBottomPadding: withoutBottomPadding2 = false
|
|
6293
6320
|
}) => {
|
|
6294
6321
|
const mobile = isMobile2();
|
|
6295
6322
|
const modalSize = useContext9(ModalSizeContext);
|
|
@@ -6304,7 +6331,8 @@ var DialogWrapper = ({
|
|
|
6304
6331
|
className: clsx6(
|
|
6305
6332
|
mapModalSizeToClassName[modalSize],
|
|
6306
6333
|
mobile && dialogMobile,
|
|
6307
|
-
|
|
6334
|
+
withoutSidePadding2 && withoutSidePadding,
|
|
6335
|
+
withoutBottomPadding2 && withoutBottomPadding
|
|
6308
6336
|
)
|
|
6309
6337
|
},
|
|
6310
6338
|
children
|
|
@@ -7030,7 +7058,7 @@ function getCheckoutCompletionTime(checkout) {
|
|
|
7030
7058
|
}
|
|
7031
7059
|
|
|
7032
7060
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
7033
|
-
import React221, { useCallback as useCallback40, useMemo as
|
|
7061
|
+
import React221, { useCallback as useCallback40, useMemo as useMemo36, useState as useState57 } from "react";
|
|
7034
7062
|
import { createPortal as createPortal14 } from "react-dom";
|
|
7035
7063
|
|
|
7036
7064
|
// src/components/HelpAlert/HelpAlert.tsx
|
|
@@ -7785,7 +7813,7 @@ import {
|
|
|
7785
7813
|
getAllWalletTokens
|
|
7786
7814
|
} from "@funkit/api-base";
|
|
7787
7815
|
import { keepPreviousData, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
7788
|
-
import { arbitrum as
|
|
7816
|
+
import { arbitrum as arbitrum3, polygon as polygon3 } from "viem/chains";
|
|
7789
7817
|
import { useAccount as useAccount3 } from "wagmi";
|
|
7790
7818
|
|
|
7791
7819
|
// src/utils/assets.ts
|
|
@@ -7820,7 +7848,7 @@ function normalizeAssetSymbol(asset) {
|
|
|
7820
7848
|
if (isTokenEquivalent3({
|
|
7821
7849
|
firstTokenChainId: asset.chainId,
|
|
7822
7850
|
firstTokenAddress: asset.contractAddress,
|
|
7823
|
-
secondTokenChainId:
|
|
7851
|
+
secondTokenChainId: arbitrum3.id.toString(),
|
|
7824
7852
|
secondTokenAddress: ARBITRUM_USDCE_TOKEN
|
|
7825
7853
|
})) {
|
|
7826
7854
|
return { ...asset, symbol: "USDC.e" };
|
|
@@ -10705,7 +10733,7 @@ var BankIconActive = ({ size = 20 }) => {
|
|
|
10705
10733
|
|
|
10706
10734
|
// src/components/FunConnectOptions/FunSignInStep.tsx
|
|
10707
10735
|
import { groupBy, isMobile as isMobile8, isSafari as isSafari3, redirectInMobile as redirectInMobile2 } from "@funkit/utils";
|
|
10708
|
-
import React214, { Fragment as Fragment3, useCallback as useCallback39, useMemo as
|
|
10736
|
+
import React214, { Fragment as Fragment3, useCallback as useCallback39, useMemo as useMemo34, useState as useState55 } from "react";
|
|
10709
10737
|
|
|
10710
10738
|
// src/providers/walletConnectDeepLink.ts
|
|
10711
10739
|
var storageKey2 = "WALLETCONNECT_DEEPLINK_CHOICE";
|
|
@@ -11302,7 +11330,7 @@ var SocialsIcon = () => {
|
|
|
11302
11330
|
};
|
|
11303
11331
|
|
|
11304
11332
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
11305
|
-
import React213, { useCallback as useCallback38, useMemo as
|
|
11333
|
+
import React213, { useCallback as useCallback38, useMemo as useMemo33, useState as useState54 } from "react";
|
|
11306
11334
|
|
|
11307
11335
|
// src/hooks/useAnimatedNavigation.ts
|
|
11308
11336
|
import { useCallback as useCallback16, useState as useState17 } from "react";
|
|
@@ -14223,6 +14251,7 @@ import {
|
|
|
14223
14251
|
noop as noop4
|
|
14224
14252
|
} from "@funkit/utils";
|
|
14225
14253
|
import React124, { useMemo as useMemo17, useState as useState23 } from "react";
|
|
14254
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14 } from "@funkit/chains";
|
|
14226
14255
|
import clsx13 from "clsx";
|
|
14227
14256
|
import { motion as motion4, useAnimationControls } from "motion/react";
|
|
14228
14257
|
|
|
@@ -14262,6 +14291,8 @@ var NO_DATA = {
|
|
|
14262
14291
|
function renderRelayFee(relayQuote) {
|
|
14263
14292
|
const { details, fees } = relayQuote;
|
|
14264
14293
|
const gasUsd = Number.parseFloat(fees?.gas?.amountUsd || "0");
|
|
14294
|
+
const destinationChainId = details?.currencyOut?.currency?.chainId || "";
|
|
14295
|
+
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14[destinationChainId]?.name;
|
|
14265
14296
|
const totalImpactStr = (details?.totalImpact?.percent || "0").replace("-", "");
|
|
14266
14297
|
const totalImpact = Number.parseFloat(totalImpactStr);
|
|
14267
14298
|
const swapImpactStr = (details?.swapImpact?.percent || "0").replace("-", "");
|
|
@@ -14288,13 +14319,7 @@ function renderRelayFee(relayQuote) {
|
|
|
14288
14319
|
label: "Network cost",
|
|
14289
14320
|
valueIcon: /* @__PURE__ */ React124.createElement(GasIcon, null),
|
|
14290
14321
|
value: formatCurrencyAndStringify4(gasUsd),
|
|
14291
|
-
tooltipText: /* @__PURE__ */ React124.createElement(React124.Fragment, null, "Estimated gas cost for completing your transaction, including the network fee and routing gas fees. The final cost may vary based on network conditions."
|
|
14292
|
-
FunLinkButton,
|
|
14293
|
-
{
|
|
14294
|
-
href: "https://docs.polymarket.com/docs/price-impact",
|
|
14295
|
-
text: "Learn more"
|
|
14296
|
-
}
|
|
14297
|
-
))
|
|
14322
|
+
tooltipText: /* @__PURE__ */ React124.createElement(React124.Fragment, null, "Estimated gas cost for completing your transaction, including the network fee and routing gas fees. The final cost may vary based on network conditions.")
|
|
14298
14323
|
},
|
|
14299
14324
|
{
|
|
14300
14325
|
label: "Price impact",
|
|
@@ -14324,7 +14349,7 @@ function renderRelayFee(relayQuote) {
|
|
|
14324
14349
|
display: "flex",
|
|
14325
14350
|
justifyContent: "space-between"
|
|
14326
14351
|
},
|
|
14327
|
-
/* @__PURE__ */ React124.createElement(Text, { size: "10" }, "Fill gas (
|
|
14352
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10" }, "Fill gas ", chainName ? `(${chainName})` : ""),
|
|
14328
14353
|
/* @__PURE__ */ React124.createElement(Text, { size: "10", weight: "medium" }, formatCurrencyAndStringify4(relayGas))
|
|
14329
14354
|
), /* @__PURE__ */ React124.createElement(
|
|
14330
14355
|
Box,
|
|
@@ -14335,26 +14360,12 @@ function renderRelayFee(relayQuote) {
|
|
|
14335
14360
|
},
|
|
14336
14361
|
/* @__PURE__ */ React124.createElement(Text, { size: "10" }, "Fun.xyz fee"),
|
|
14337
14362
|
/* @__PURE__ */ React124.createElement(Text, { size: "10", weight: "medium" }, formatPercent(appFeePercent))
|
|
14338
|
-
)), /* @__PURE__ */ React124.createElement(FunDivider, null), /* @__PURE__ */ React124.createElement(Box, null, "Price impact is the difference between the expected and executed price.", /* @__PURE__ */ React124.createElement("br", null), /* @__PURE__ */ React124.createElement("br", null), "Final cost may vary based on network conditions."
|
|
14339
|
-
FunLinkButton,
|
|
14340
|
-
{
|
|
14341
|
-
inline: true,
|
|
14342
|
-
href: "https://docs.polymarket.com/docs/price-impact",
|
|
14343
|
-
text: "Learn more"
|
|
14344
|
-
}
|
|
14345
|
-
)))
|
|
14363
|
+
)), /* @__PURE__ */ React124.createElement(FunDivider, null), /* @__PURE__ */ React124.createElement(Box, null, "Price impact is the difference between the expected and executed price.", /* @__PURE__ */ React124.createElement("br", null), /* @__PURE__ */ React124.createElement("br", null), "Final cost may vary based on network conditions."))
|
|
14346
14364
|
},
|
|
14347
14365
|
{
|
|
14348
14366
|
label: "Max slippage",
|
|
14349
14367
|
value: formatPercent(maxSlippage),
|
|
14350
|
-
tooltipText: /* @__PURE__ */ React124.createElement(React124.Fragment, null, "Slippage occurs due to price changes during trade execution. Slippage limits are adjusted based on your asset to ensure a reliable, timely execution.", /* @__PURE__ */ React124.createElement("br", null), /* @__PURE__ */ React124.createElement("br", null), "The slippage is set as low as possible. If it is required to be higher than 1.50% during execution, Fun.xyz will cover the difference."
|
|
14351
|
-
FunLinkButton,
|
|
14352
|
-
{
|
|
14353
|
-
inline: true,
|
|
14354
|
-
href: "https://docs.polymarket.com/docs/price-impact",
|
|
14355
|
-
text: "Learn more"
|
|
14356
|
-
}
|
|
14357
|
-
))
|
|
14368
|
+
tooltipText: /* @__PURE__ */ React124.createElement(React124.Fragment, null, "Slippage occurs due to price changes during trade execution. Slippage limits are adjusted based on your asset to ensure a reliable, timely execution.", /* @__PURE__ */ React124.createElement("br", null), /* @__PURE__ */ React124.createElement("br", null), "The slippage is set as low as possible. If it is required to be higher than 1.50% during execution, Fun.xyz will cover the difference.")
|
|
14358
14369
|
}
|
|
14359
14370
|
]
|
|
14360
14371
|
};
|
|
@@ -16475,7 +16486,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
16475
16486
|
const { userIpInfo } = useFunkitUserIp();
|
|
16476
16487
|
const enableMeld = useFlag(FlagKey18.EnableMeldPayment);
|
|
16477
16488
|
const query = useQuery12({
|
|
16478
|
-
queryKey: ["meld", "defaultCurrency"],
|
|
16489
|
+
queryKey: ["meld", "defaultCurrency", paymentMethod],
|
|
16479
16490
|
queryFn: async () => {
|
|
16480
16491
|
if (!apiKey) return "";
|
|
16481
16492
|
const response = await getMeldDefaultFiat({
|
|
@@ -16494,6 +16505,92 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
16494
16505
|
return query;
|
|
16495
16506
|
};
|
|
16496
16507
|
|
|
16508
|
+
// src/hooks/queries/useMeldLimits.ts
|
|
16509
|
+
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
16510
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify5 } from "@funkit/utils";
|
|
16511
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
16512
|
+
|
|
16513
|
+
// src/hooks/queries/useMeldCryptoCurrencyCode.ts
|
|
16514
|
+
function useMeldCryptoCurrencyCode() {
|
|
16515
|
+
const { checkoutItem } = useCheckoutContext();
|
|
16516
|
+
const _targetChain = checkoutItem?.initSettings.config.targetChain;
|
|
16517
|
+
const _targetAsset = checkoutItem?.initSettings.config.targetAsset;
|
|
16518
|
+
return "USDC_POLYGON";
|
|
16519
|
+
}
|
|
16520
|
+
|
|
16521
|
+
// src/hooks/queries/useMeldLimits.ts
|
|
16522
|
+
var useMeldLimits = (isEnabled = true) => {
|
|
16523
|
+
const { apiKey } = useFunkitConfig();
|
|
16524
|
+
const { userIpInfo } = useFunkitUserIp();
|
|
16525
|
+
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
16526
|
+
const countryCode = userIpInfo?.alpha2;
|
|
16527
|
+
const query = useQuery13({
|
|
16528
|
+
queryKey: ["meld", "limits", countryCode, cryptoCurrency],
|
|
16529
|
+
queryFn: async () => {
|
|
16530
|
+
if (!apiKey || !countryCode) return void 0;
|
|
16531
|
+
const response = await getMeldFiatLimits({
|
|
16532
|
+
params: {
|
|
16533
|
+
countries: [countryCode],
|
|
16534
|
+
cryptoCurrencies: cryptoCurrency ? [cryptoCurrency] : [],
|
|
16535
|
+
// left out intentionally to preload other currency limits
|
|
16536
|
+
fiatCurrencies: []
|
|
16537
|
+
},
|
|
16538
|
+
apiKey
|
|
16539
|
+
});
|
|
16540
|
+
return response?.limits;
|
|
16541
|
+
},
|
|
16542
|
+
enabled: isEnabled && !!apiKey && !!countryCode && !!cryptoCurrency,
|
|
16543
|
+
refetchOnMount: false,
|
|
16544
|
+
refetchOnReconnect: false,
|
|
16545
|
+
refetchOnWindowFocus: false,
|
|
16546
|
+
staleTime: 1e3 * 60 * 60
|
|
16547
|
+
// 1 hour
|
|
16548
|
+
});
|
|
16549
|
+
return query;
|
|
16550
|
+
};
|
|
16551
|
+
var useMeldLimit = (fiatCurrency) => {
|
|
16552
|
+
const query = useMeldLimits();
|
|
16553
|
+
return {
|
|
16554
|
+
...query,
|
|
16555
|
+
data: query.data?.find((limit) => limit.currencyCode === fiatCurrency)
|
|
16556
|
+
};
|
|
16557
|
+
};
|
|
16558
|
+
var useMeldLimitError = (amount, fiatCurrency) => {
|
|
16559
|
+
const { data: meldLimit } = useMeldLimit(fiatCurrency);
|
|
16560
|
+
if (!meldLimit) return void 0;
|
|
16561
|
+
if (amount < meldLimit.minimumAmount) {
|
|
16562
|
+
const limit = formatCurrencyAndStringify5(
|
|
16563
|
+
meldLimit.minimumAmount ?? 0,
|
|
16564
|
+
{},
|
|
16565
|
+
{
|
|
16566
|
+
currency: fiatCurrency,
|
|
16567
|
+
currencyDisplay: "narrowSymbol",
|
|
16568
|
+
minimumFractionDigits: 0
|
|
16569
|
+
}
|
|
16570
|
+
);
|
|
16571
|
+
return {
|
|
16572
|
+
issue: "Amount below minimum",
|
|
16573
|
+
suggestion: `Input an amount greater than ${limit}.`
|
|
16574
|
+
};
|
|
16575
|
+
}
|
|
16576
|
+
if (amount > meldLimit.maximumAmount) {
|
|
16577
|
+
const limit = formatCurrencyAndStringify5(
|
|
16578
|
+
meldLimit.maximumAmount ?? 0,
|
|
16579
|
+
{},
|
|
16580
|
+
{
|
|
16581
|
+
currency: fiatCurrency,
|
|
16582
|
+
currencyDisplay: "narrowSymbol",
|
|
16583
|
+
minimumFractionDigits: 0
|
|
16584
|
+
}
|
|
16585
|
+
);
|
|
16586
|
+
return {
|
|
16587
|
+
issue: "Amount above maximum",
|
|
16588
|
+
suggestion: `Input an amount lower than ${limit}.`
|
|
16589
|
+
};
|
|
16590
|
+
}
|
|
16591
|
+
return void 0;
|
|
16592
|
+
};
|
|
16593
|
+
|
|
16497
16594
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoaded.tsx
|
|
16498
16595
|
import {
|
|
16499
16596
|
FlagKey as FlagKey21,
|
|
@@ -16502,7 +16599,7 @@ import {
|
|
|
16502
16599
|
isTokenEquivalent as isTokenEquivalent6,
|
|
16503
16600
|
round as round3
|
|
16504
16601
|
} from "@funkit/utils";
|
|
16505
|
-
import React150, { useMemo as
|
|
16602
|
+
import React150, { useMemo as useMemo22 } from "react";
|
|
16506
16603
|
|
|
16507
16604
|
// src/components/CurrencySelector/CurrencySelector.tsx
|
|
16508
16605
|
import React139 from "react";
|
|
@@ -16579,7 +16676,7 @@ import React142 from "react";
|
|
|
16579
16676
|
// src/components/MeldQuoteItem/MeldQuoteItem.tsx
|
|
16580
16677
|
import {
|
|
16581
16678
|
formatCryptoAndStringify as formatCryptoAndStringify2,
|
|
16582
|
-
formatCurrencyAndStringify as
|
|
16679
|
+
formatCurrencyAndStringify as formatCurrencyAndStringify6
|
|
16583
16680
|
} from "@funkit/utils";
|
|
16584
16681
|
import React141 from "react";
|
|
16585
16682
|
|
|
@@ -16649,7 +16746,7 @@ var MeldQuoteItem = ({
|
|
|
16649
16746
|
}
|
|
16650
16747
|
}
|
|
16651
16748
|
);
|
|
16652
|
-
const fiatAmount =
|
|
16749
|
+
const fiatAmount = formatCurrencyAndStringify6(
|
|
16653
16750
|
quote.sourceAmount,
|
|
16654
16751
|
{},
|
|
16655
16752
|
{ currency: quote.sourceCurrencyCode }
|
|
@@ -16668,8 +16765,8 @@ var MeldQuoteItem = ({
|
|
|
16668
16765
|
/* @__PURE__ */ React141.createElement(Box, { display: "flex", alignItems: "center", gap: "8" }, /* @__PURE__ */ React141.createElement(Box, { justifyContent: "center", display: "flex", alignItems: "center" }, /* @__PURE__ */ React141.createElement(
|
|
16669
16766
|
AsyncImage,
|
|
16670
16767
|
{
|
|
16671
|
-
width: "
|
|
16672
|
-
height: "
|
|
16768
|
+
width: "28",
|
|
16769
|
+
height: "28",
|
|
16673
16770
|
src: getMeldProviderIconUrl(quote.serviceProvider),
|
|
16674
16771
|
fallbackSrc: FALLBACK_ASSET,
|
|
16675
16772
|
alt: quote.serviceProvider,
|
|
@@ -17550,90 +17647,6 @@ var YouPayYouReceiveBottomBarLayoutWrapper = ({
|
|
|
17550
17647
|
);
|
|
17551
17648
|
};
|
|
17552
17649
|
|
|
17553
|
-
// src/hooks/queries/useMeldLimits.ts
|
|
17554
|
-
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
17555
|
-
import { formatCurrencyAndStringify as formatCurrencyAndStringify6 } from "@funkit/utils";
|
|
17556
|
-
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
17557
|
-
import { useMemo as useMemo22 } from "react";
|
|
17558
|
-
|
|
17559
|
-
// src/hooks/queries/useMeldCryptoCurrencyCode.ts
|
|
17560
|
-
function useMeldCryptoCurrencyCode() {
|
|
17561
|
-
const { checkoutItem } = useCheckoutContext();
|
|
17562
|
-
const _targetChain = checkoutItem?.initSettings.config.targetChain;
|
|
17563
|
-
const _targetAsset = checkoutItem?.initSettings.config.targetAsset;
|
|
17564
|
-
return "USDC_POLYGON";
|
|
17565
|
-
}
|
|
17566
|
-
|
|
17567
|
-
// src/hooks/queries/useMeldLimits.ts
|
|
17568
|
-
var useMeldLimits = (fiatCurrency) => {
|
|
17569
|
-
const { apiKey } = useFunkitConfig();
|
|
17570
|
-
const { userIpInfo } = useFunkitUserIp();
|
|
17571
|
-
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
17572
|
-
const query = useQuery13({
|
|
17573
|
-
queryKey: ["meld", "limits", userIpInfo?.alpha2, cryptoCurrency],
|
|
17574
|
-
queryFn: async () => {
|
|
17575
|
-
if (!apiKey || !userIpInfo) return void 0;
|
|
17576
|
-
const { alpha2: countryCode } = userIpInfo;
|
|
17577
|
-
const response = await getMeldFiatLimits({
|
|
17578
|
-
params: {
|
|
17579
|
-
countries: [countryCode],
|
|
17580
|
-
cryptoCurrencies: cryptoCurrency ? [cryptoCurrency] : [],
|
|
17581
|
-
// left out intentionally to preload other currency limits
|
|
17582
|
-
fiatCurrencies: []
|
|
17583
|
-
},
|
|
17584
|
-
apiKey
|
|
17585
|
-
});
|
|
17586
|
-
return response?.limits;
|
|
17587
|
-
},
|
|
17588
|
-
enabled: !!apiKey && !!userIpInfo && !!fiatCurrency && !!cryptoCurrency,
|
|
17589
|
-
refetchOnMount: false,
|
|
17590
|
-
refetchOnReconnect: false,
|
|
17591
|
-
refetchOnWindowFocus: false,
|
|
17592
|
-
staleTime: 1e3 * 60 * 60
|
|
17593
|
-
// 1 hour
|
|
17594
|
-
});
|
|
17595
|
-
return query;
|
|
17596
|
-
};
|
|
17597
|
-
var useMeldLimitError = (amount, fiatCurrency) => {
|
|
17598
|
-
const { data } = useMeldLimits(fiatCurrency);
|
|
17599
|
-
const meldLimit = useMemo22(
|
|
17600
|
-
() => data?.find((lim) => lim.currencyCode === fiatCurrency),
|
|
17601
|
-
[data, fiatCurrency]
|
|
17602
|
-
);
|
|
17603
|
-
if (!meldLimit) return void 0;
|
|
17604
|
-
if (amount < meldLimit.minimumAmount) {
|
|
17605
|
-
const limit = formatCurrencyAndStringify6(
|
|
17606
|
-
meldLimit.minimumAmount ?? 0,
|
|
17607
|
-
{},
|
|
17608
|
-
{
|
|
17609
|
-
currency: fiatCurrency,
|
|
17610
|
-
currencyDisplay: "narrowSymbol",
|
|
17611
|
-
minimumFractionDigits: 0
|
|
17612
|
-
}
|
|
17613
|
-
);
|
|
17614
|
-
return {
|
|
17615
|
-
issue: "Amount below minimum",
|
|
17616
|
-
suggestion: `Input an amount greater than ${limit}.`
|
|
17617
|
-
};
|
|
17618
|
-
}
|
|
17619
|
-
if (amount > meldLimit.maximumAmount) {
|
|
17620
|
-
const limit = formatCurrencyAndStringify6(
|
|
17621
|
-
meldLimit.maximumAmount ?? 0,
|
|
17622
|
-
{},
|
|
17623
|
-
{
|
|
17624
|
-
currency: fiatCurrency,
|
|
17625
|
-
currencyDisplay: "narrowSymbol",
|
|
17626
|
-
minimumFractionDigits: 0
|
|
17627
|
-
}
|
|
17628
|
-
);
|
|
17629
|
-
return {
|
|
17630
|
-
issue: "Amount above maximum",
|
|
17631
|
-
suggestion: `Input an amount lower than ${limit}.`
|
|
17632
|
-
};
|
|
17633
|
-
}
|
|
17634
|
-
return void 0;
|
|
17635
|
-
};
|
|
17636
|
-
|
|
17637
17650
|
// src/components/Icons/SwitchIcon.tsx
|
|
17638
17651
|
import React147 from "react";
|
|
17639
17652
|
var SwitchIcon = () => {
|
|
@@ -17886,35 +17899,22 @@ function InputAmountLayout({
|
|
|
17886
17899
|
|
|
17887
17900
|
// src/modals/CheckoutModal/InputAmount/QuickOptions.tsx
|
|
17888
17901
|
import { FlagKey as FlagKey20, clamp, formatCurrencyAndStringify as formatCurrencyAndStringify7 } from "@funkit/utils";
|
|
17889
|
-
import React149
|
|
17902
|
+
import React149 from "react";
|
|
17890
17903
|
var USD_AMOUNT_OPTIONS_PCT = [25, 50, 75, 100];
|
|
17891
|
-
var USD_AMOUNT_OPTIONS = [100, 500, 1e3];
|
|
17892
17904
|
function deduplicateArray(arr) {
|
|
17893
17905
|
return Array.from(new Set(arr));
|
|
17894
17906
|
}
|
|
17895
|
-
function useFiatAmountOptions(
|
|
17907
|
+
function useFiatAmountOptions(currency) {
|
|
17896
17908
|
const currencyQuickOptionStr = useFlag(FlagKey20.MeldQuickOptions);
|
|
17897
17909
|
const currencyQuickOption = safeJSONParse(
|
|
17898
17910
|
currencyQuickOptionStr
|
|
17899
17911
|
);
|
|
17900
|
-
const { data:
|
|
17901
|
-
const meldLimit = useMemo23(
|
|
17902
|
-
() => limits?.find((lim) => lim.currencyCode === currency),
|
|
17903
|
-
[limits, currency]
|
|
17904
|
-
);
|
|
17905
|
-
if (percentMode) {
|
|
17906
|
-
return USD_AMOUNT_OPTIONS_PCT;
|
|
17907
|
-
}
|
|
17912
|
+
const { data: meldLimit, isPending } = useMeldLimit(currency);
|
|
17908
17913
|
if (isPending || !meldLimit) {
|
|
17909
17914
|
return [];
|
|
17910
17915
|
}
|
|
17911
17916
|
const minimumAmount = meldLimit.minimumAmount;
|
|
17912
17917
|
const maximumAmount = meldLimit.maximumAmount;
|
|
17913
|
-
if (currency === "USD") {
|
|
17914
|
-
return deduplicateArray(
|
|
17915
|
-
USD_AMOUNT_OPTIONS.map((val) => clamp(val, minimumAmount, maximumAmount))
|
|
17916
|
-
);
|
|
17917
|
-
}
|
|
17918
17918
|
return deduplicateArray(
|
|
17919
17919
|
currencyQuickOption?.[currency]?.map(
|
|
17920
17920
|
(val) => clamp(val, minimumAmount, maximumAmount)
|
|
@@ -17922,42 +17922,44 @@ function useFiatAmountOptions(percentMode, currency) {
|
|
|
17922
17922
|
);
|
|
17923
17923
|
}
|
|
17924
17924
|
var QuickOptions = ({
|
|
17925
|
-
|
|
17926
|
-
percentMode = true,
|
|
17925
|
+
currency = "USD",
|
|
17927
17926
|
disabled = false,
|
|
17928
|
-
|
|
17927
|
+
onSelect,
|
|
17928
|
+
options,
|
|
17929
|
+
percentMode = true
|
|
17929
17930
|
}) => {
|
|
17930
|
-
|
|
17931
|
-
|
|
17932
|
-
|
|
17933
|
-
{
|
|
17934
|
-
borderRadius: "actionButton",
|
|
17935
|
-
fontSize: "14",
|
|
17936
|
-
fontWeight: "medium",
|
|
17937
|
-
color: "primaryText",
|
|
17938
|
-
icon: null,
|
|
17939
|
-
isDisabled: disabled,
|
|
17940
|
-
key: `${option}-${index}`,
|
|
17941
|
-
onClick: () => onSelect?.(option),
|
|
17942
|
-
paddingX: "12",
|
|
17943
|
-
size: "36",
|
|
17944
|
-
variant: "filled",
|
|
17945
|
-
colorOverrides: {
|
|
17946
|
-
baseBackground: "inputAmountQuickOptionBaseBackground",
|
|
17947
|
-
hoverBackground: "inputAmountQuickOptionHoverBackground",
|
|
17948
|
-
activeBackground: "inputAmountQuickOptionActiveBackground"
|
|
17949
|
-
}
|
|
17950
|
-
},
|
|
17951
|
-
!percentMode ? formatCurrencyAndStringify7(
|
|
17952
|
-
option,
|
|
17953
|
-
{},
|
|
17931
|
+
return (percentMode ? USD_AMOUNT_OPTIONS_PCT : options)?.map(
|
|
17932
|
+
(option, index) => /* @__PURE__ */ React149.createElement(
|
|
17933
|
+
FunIconButton,
|
|
17954
17934
|
{
|
|
17955
|
-
|
|
17956
|
-
|
|
17957
|
-
|
|
17958
|
-
|
|
17959
|
-
|
|
17960
|
-
|
|
17935
|
+
borderRadius: "actionButton",
|
|
17936
|
+
fontSize: "14",
|
|
17937
|
+
fontWeight: "medium",
|
|
17938
|
+
color: "primaryText",
|
|
17939
|
+
icon: null,
|
|
17940
|
+
isDisabled: disabled,
|
|
17941
|
+
key: `${option}-${index}`,
|
|
17942
|
+
onClick: () => onSelect?.(option),
|
|
17943
|
+
paddingX: "12",
|
|
17944
|
+
size: "36",
|
|
17945
|
+
variant: "filled",
|
|
17946
|
+
colorOverrides: {
|
|
17947
|
+
baseBackground: "inputAmountQuickOptionBaseBackground",
|
|
17948
|
+
hoverBackground: "inputAmountQuickOptionHoverBackground",
|
|
17949
|
+
activeBackground: "inputAmountQuickOptionActiveBackground"
|
|
17950
|
+
}
|
|
17951
|
+
},
|
|
17952
|
+
!percentMode ? formatCurrencyAndStringify7(
|
|
17953
|
+
option,
|
|
17954
|
+
{},
|
|
17955
|
+
{
|
|
17956
|
+
minimumFractionDigits: 0,
|
|
17957
|
+
currency,
|
|
17958
|
+
currencyDisplay: "narrowSymbol"
|
|
17959
|
+
}
|
|
17960
|
+
) : option === 100 ? "Max" : `${option}%`
|
|
17961
|
+
)
|
|
17962
|
+
);
|
|
17961
17963
|
};
|
|
17962
17964
|
|
|
17963
17965
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
@@ -17970,12 +17972,12 @@ import {
|
|
|
17970
17972
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
17971
17973
|
import { round as round2 } from "@funkit/utils";
|
|
17972
17974
|
function getInputValueFromAmount(params) {
|
|
17973
|
-
const amount = params.
|
|
17975
|
+
const amount = params.isInputInFiat ? params.fiatAmount : params.assetAmount;
|
|
17974
17976
|
if (!amount) return "";
|
|
17975
17977
|
const formattedAmount = amount.toFixed(
|
|
17976
|
-
params.
|
|
17978
|
+
params.isInputInFiat ? USD_DECIMALS : ASSET_DECIMALS
|
|
17977
17979
|
);
|
|
17978
|
-
return params.
|
|
17980
|
+
return params.isInputInFiat ? params.currencySymbol + formattedAmount : formattedAmount;
|
|
17979
17981
|
}
|
|
17980
17982
|
function initializeState({
|
|
17981
17983
|
apiKey,
|
|
@@ -17986,10 +17988,12 @@ function initializeState({
|
|
|
17986
17988
|
sourceHolding,
|
|
17987
17989
|
unitPrice,
|
|
17988
17990
|
defaultAmount,
|
|
17989
|
-
fiatCurrency = "USD"
|
|
17991
|
+
fiatCurrency = "USD",
|
|
17992
|
+
quickOptions
|
|
17990
17993
|
}) {
|
|
17991
17994
|
const { targetAssetAmount, targetChain } = checkoutConfig;
|
|
17992
|
-
const
|
|
17995
|
+
const isCardCheckout = paymentMethod === "card" /* CARD */;
|
|
17996
|
+
const isInputInFiat = true;
|
|
17993
17997
|
const usdAvailableAmount = getUsdAvailableAmount(
|
|
17994
17998
|
targetChain,
|
|
17995
17999
|
sourceHolding?.pickedChainId,
|
|
@@ -18005,26 +18009,27 @@ function initializeState({
|
|
|
18005
18009
|
);
|
|
18006
18010
|
const usdMaxAmount = getUsdMaxAmount(maxUsd);
|
|
18007
18011
|
const usdMinAmount = getUsdMinAmount(paymentMethod, minUsd);
|
|
18008
|
-
const
|
|
18009
|
-
const
|
|
18010
|
-
Math.max(
|
|
18012
|
+
const initialFiatAmount = defaultAmount ?? (isCardCheckout ? getDefaultAmountFromQuickOptions(quickOptions) : targetAssetAmount === void 0 ? USD_INITIAL_AMOUNT : targetAssetAmount * unitPrice);
|
|
18013
|
+
const finalFiatAmount = initialFiatAmount === void 0 ? void 0 : Math.min(
|
|
18014
|
+
Math.max(initialFiatAmount, usdMinAmount, 0),
|
|
18011
18015
|
usdAvailableAmount ?? Number.MAX_VALUE,
|
|
18012
18016
|
usdMaxAmount ?? Number.MAX_VALUE
|
|
18013
18017
|
);
|
|
18014
|
-
const rounding =
|
|
18015
|
-
const assetAmount =
|
|
18016
|
-
const
|
|
18018
|
+
const rounding = finalFiatAmount === initialFiatAmount ? "round" : finalFiatAmount === usdMinAmount ? "ceil" : "floor";
|
|
18019
|
+
const assetAmount = finalFiatAmount ? targetAssetAmount && finalFiatAmount === targetAssetAmount * unitPrice ? targetAssetAmount : finalFiatAmount / unitPrice || 0 : 0;
|
|
18020
|
+
const fiatAmount = finalFiatAmount ? round2(finalFiatAmount, USD_DECIMALS, rounding) : 0;
|
|
18017
18021
|
const inputValue = getInputValueFromAmount({
|
|
18018
18022
|
assetAmount,
|
|
18019
|
-
|
|
18020
|
-
|
|
18021
|
-
|
|
18023
|
+
currencySymbol: getCurrencySymbol(fiatCurrency),
|
|
18024
|
+
isInputInFiat,
|
|
18025
|
+
fiatAmount
|
|
18022
18026
|
});
|
|
18023
18027
|
return {
|
|
18024
18028
|
assetAmount,
|
|
18029
|
+
fiatAmount,
|
|
18030
|
+
fiatCurrency,
|
|
18025
18031
|
inputValue,
|
|
18026
|
-
|
|
18027
|
-
usdAmount,
|
|
18032
|
+
isInputInFiat,
|
|
18028
18033
|
usdAvailableAmount,
|
|
18029
18034
|
usdMaxAmount,
|
|
18030
18035
|
usdMinAmount
|
|
@@ -18032,10 +18037,10 @@ function initializeState({
|
|
|
18032
18037
|
}
|
|
18033
18038
|
function reduceState(state, action) {
|
|
18034
18039
|
switch (action.type) {
|
|
18035
|
-
case "
|
|
18040
|
+
case "toggleInputInFiat": {
|
|
18036
18041
|
const newState = {
|
|
18037
18042
|
...state,
|
|
18038
|
-
|
|
18043
|
+
isInputInFiat: !state.isInputInFiat
|
|
18039
18044
|
};
|
|
18040
18045
|
const inputValue = getInputValueFromAmount({
|
|
18041
18046
|
...newState,
|
|
@@ -18044,83 +18049,84 @@ function reduceState(state, action) {
|
|
|
18044
18049
|
return { ...newState, inputValue };
|
|
18045
18050
|
}
|
|
18046
18051
|
case "setInputValue": {
|
|
18047
|
-
const { inputValue: rawInputValue, unitPrice
|
|
18048
|
-
const currencySymbol = getCurrencySymbol(fiatCurrency);
|
|
18049
|
-
const regex = state.
|
|
18052
|
+
const { inputValue: rawInputValue, unitPrice } = action;
|
|
18053
|
+
const currencySymbol = getCurrencySymbol(state.fiatCurrency);
|
|
18054
|
+
const regex = state.isInputInFiat ? /\d+(\.\d{0,2})?/ : /\d+(\.\d{0,5})?/;
|
|
18050
18055
|
const match = regex.exec(rawInputValue);
|
|
18051
18056
|
const numericInputValue = match?.[0] || "";
|
|
18052
|
-
const newInputValue = numericInputValue && state.
|
|
18057
|
+
const newInputValue = numericInputValue && state.isInputInFiat ? `${currencySymbol}${numericInputValue}` : numericInputValue;
|
|
18053
18058
|
if (newInputValue === state.inputValue) return state;
|
|
18054
18059
|
const newInputAmount = Number.parseFloat(numericInputValue) || 0;
|
|
18055
|
-
if (state.
|
|
18060
|
+
if (state.isInputInFiat) {
|
|
18056
18061
|
return {
|
|
18057
18062
|
...state,
|
|
18058
18063
|
assetAmount: newInputAmount / unitPrice || 0,
|
|
18059
18064
|
inputValue: newInputValue,
|
|
18060
|
-
|
|
18065
|
+
fiatAmount: newInputAmount
|
|
18061
18066
|
};
|
|
18062
18067
|
}
|
|
18063
18068
|
return {
|
|
18064
18069
|
...state,
|
|
18065
18070
|
assetAmount: newInputAmount,
|
|
18066
18071
|
inputValue: newInputValue,
|
|
18067
|
-
|
|
18072
|
+
fiatAmount: round2(newInputAmount * unitPrice, USD_DECIMALS)
|
|
18068
18073
|
};
|
|
18069
18074
|
}
|
|
18070
|
-
case "
|
|
18075
|
+
case "setFiatCurrency": {
|
|
18071
18076
|
const inputValue = getInputValueFromAmount({
|
|
18072
18077
|
...state,
|
|
18073
18078
|
currencySymbol: getCurrencySymbol(action.fiatCurrency)
|
|
18074
18079
|
});
|
|
18075
18080
|
return {
|
|
18076
18081
|
...state,
|
|
18082
|
+
fiatCurrency: action.fiatCurrency,
|
|
18077
18083
|
inputValue
|
|
18078
18084
|
};
|
|
18079
18085
|
}
|
|
18080
|
-
case "
|
|
18081
|
-
const { unitPrice,
|
|
18082
|
-
const assetAmount =
|
|
18086
|
+
case "setFiatAmount": {
|
|
18087
|
+
const { unitPrice, fiatAmount } = action;
|
|
18088
|
+
const assetAmount = fiatAmount / unitPrice || 0;
|
|
18083
18089
|
const inputValue = getInputValueFromAmount({
|
|
18084
|
-
isInputInUsd: state.isInputInUsd,
|
|
18085
18090
|
assetAmount,
|
|
18086
|
-
|
|
18087
|
-
|
|
18091
|
+
currencySymbol: getCurrencySymbol(state.fiatCurrency),
|
|
18092
|
+
fiatAmount,
|
|
18093
|
+
isInputInFiat: state.isInputInFiat
|
|
18088
18094
|
});
|
|
18089
18095
|
return {
|
|
18090
18096
|
...state,
|
|
18091
18097
|
assetAmount,
|
|
18092
|
-
|
|
18098
|
+
fiatAmount,
|
|
18093
18099
|
inputValue
|
|
18094
18100
|
};
|
|
18095
18101
|
}
|
|
18096
18102
|
}
|
|
18097
18103
|
}
|
|
18098
18104
|
function getAmountInputError(state) {
|
|
18099
|
-
const {
|
|
18105
|
+
const { fiatAmount, usdAvailableAmount, usdMaxAmount, usdMinAmount } = state;
|
|
18100
18106
|
if (usdAvailableAmount === 0) {
|
|
18101
18107
|
return {
|
|
18102
18108
|
type: "noAvailableBalance"
|
|
18103
18109
|
};
|
|
18104
18110
|
}
|
|
18105
|
-
if (usdAvailableAmount &&
|
|
18111
|
+
if (usdAvailableAmount && fiatAmount > usdAvailableAmount) {
|
|
18106
18112
|
return {
|
|
18107
18113
|
type: "aboveAvailable",
|
|
18108
18114
|
usdAvailableAmount
|
|
18109
18115
|
};
|
|
18110
18116
|
}
|
|
18111
|
-
if (usdMaxAmount &&
|
|
18117
|
+
if (usdMaxAmount && fiatAmount > usdMaxAmount) {
|
|
18112
18118
|
return {
|
|
18113
18119
|
type: "aboveMax",
|
|
18114
18120
|
usdMaxAmount
|
|
18115
18121
|
};
|
|
18116
18122
|
}
|
|
18117
|
-
if (usdMinAmount &&
|
|
18123
|
+
if (usdMinAmount && fiatAmount < usdMinAmount) {
|
|
18118
18124
|
return {
|
|
18119
18125
|
type: "belowMin",
|
|
18120
18126
|
usdMinAmount
|
|
18121
18127
|
};
|
|
18122
18128
|
}
|
|
18123
|
-
if (
|
|
18129
|
+
if (fiatAmount === 0) {
|
|
18124
18130
|
return {
|
|
18125
18131
|
type: "noInput"
|
|
18126
18132
|
};
|
|
@@ -18138,10 +18144,12 @@ function getDerivedState(state) {
|
|
|
18138
18144
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
18139
18145
|
function useAmountInput(options) {
|
|
18140
18146
|
const [state, dispatch] = useReducer3(reduceState, options, initializeState);
|
|
18147
|
+
const isCardCheckout = options.paymentMethod === "card" /* CARD */;
|
|
18141
18148
|
const {
|
|
18142
18149
|
unitPrice: realUnitPrice,
|
|
18143
18150
|
checkoutConfig,
|
|
18144
|
-
fiatCurrency = "USD"
|
|
18151
|
+
fiatCurrency = "USD",
|
|
18152
|
+
quickOptions
|
|
18145
18153
|
} = options;
|
|
18146
18154
|
const unitPrice = isStablecoin(checkoutConfig.targetAssetTicker) ? 1 : realUnitPrice;
|
|
18147
18155
|
const dispatchAndGetNewState = useCallback28(
|
|
@@ -18156,41 +18164,60 @@ function useAmountInput(options) {
|
|
|
18156
18164
|
dispatch({
|
|
18157
18165
|
type: "setInputValue",
|
|
18158
18166
|
inputValue: event.target.value,
|
|
18159
|
-
unitPrice
|
|
18160
|
-
fiatCurrency
|
|
18167
|
+
unitPrice
|
|
18161
18168
|
});
|
|
18162
18169
|
},
|
|
18163
|
-
[unitPrice
|
|
18170
|
+
[unitPrice]
|
|
18164
18171
|
);
|
|
18165
|
-
|
|
18166
|
-
|
|
18167
|
-
|
|
18168
|
-
|
|
18169
|
-
|
|
18170
|
-
|
|
18171
|
-
|
|
18172
|
-
|
|
18173
|
-
|
|
18174
|
-
|
|
18172
|
+
const defaultAmount = isCardCheckout ? getDefaultAmountFromQuickOptions(quickOptions) : void 0;
|
|
18173
|
+
useEffect27(() => {
|
|
18174
|
+
if (state.fiatCurrency !== fiatCurrency) {
|
|
18175
|
+
dispatch({
|
|
18176
|
+
type: "setFiatCurrency",
|
|
18177
|
+
fiatCurrency
|
|
18178
|
+
});
|
|
18179
|
+
if (state.isInputInFiat) {
|
|
18180
|
+
dispatch({
|
|
18181
|
+
type: "setFiatAmount",
|
|
18182
|
+
fiatAmount: defaultAmount ?? 0,
|
|
18183
|
+
unitPrice
|
|
18184
|
+
});
|
|
18185
|
+
}
|
|
18186
|
+
}
|
|
18187
|
+
}, [fiatCurrency]);
|
|
18188
|
+
useEffect27(() => {
|
|
18189
|
+
if (defaultAmount && state.inputValue === "") {
|
|
18190
|
+
dispatch({
|
|
18191
|
+
type: "setFiatAmount",
|
|
18192
|
+
fiatAmount: defaultAmount,
|
|
18193
|
+
unitPrice
|
|
18194
|
+
});
|
|
18195
|
+
}
|
|
18196
|
+
}, [defaultAmount]);
|
|
18197
|
+
const setFiatAmount = useCallback28(
|
|
18198
|
+
(fiatAmount) => dispatchAndGetNewState({
|
|
18199
|
+
type: "setFiatAmount",
|
|
18200
|
+
fiatAmount,
|
|
18201
|
+
unitPrice
|
|
18175
18202
|
}),
|
|
18176
|
-
[dispatchAndGetNewState, unitPrice
|
|
18203
|
+
[dispatchAndGetNewState, unitPrice]
|
|
18177
18204
|
);
|
|
18178
18205
|
const derivedState = getDerivedState(state);
|
|
18179
|
-
const
|
|
18180
|
-
() => dispatch({ type: "
|
|
18206
|
+
const toggleInputInFiat = useCallback28(
|
|
18207
|
+
() => dispatch({ type: "toggleInputInFiat" }),
|
|
18181
18208
|
[]
|
|
18182
18209
|
);
|
|
18183
18210
|
return {
|
|
18184
18211
|
...derivedState,
|
|
18185
18212
|
onChange,
|
|
18186
|
-
|
|
18187
|
-
setUsdAmount,
|
|
18188
|
-
placeholder: state.isInputInUsd ? formatCurrencyAndStringify8(
|
|
18213
|
+
placeholder: state.isInputInFiat ? formatCurrencyAndStringify8(
|
|
18189
18214
|
0,
|
|
18190
18215
|
{},
|
|
18191
18216
|
{ currency: fiatCurrency, currencyDisplay: "narrowSymbol" }
|
|
18192
18217
|
) : formatCryptoAndStringify3(0),
|
|
18193
|
-
|
|
18218
|
+
setFiatAmount,
|
|
18219
|
+
suggestion: getInputAmountSuggestion(derivedState.inputError),
|
|
18220
|
+
toggleInputInFiat
|
|
18194
18221
|
};
|
|
18195
18222
|
}
|
|
18196
18223
|
|
|
@@ -18223,7 +18250,7 @@ function InputAmountLoaded({
|
|
|
18223
18250
|
onNext,
|
|
18224
18251
|
sourceHolding,
|
|
18225
18252
|
unitPrice,
|
|
18226
|
-
defaultFiatCurrency,
|
|
18253
|
+
defaultFiatCurrency = "USD",
|
|
18227
18254
|
textCustomizations
|
|
18228
18255
|
}) {
|
|
18229
18256
|
const maxCheckoutUsdString = useFlag(FlagKey21.MaxCheckoutUsd);
|
|
@@ -18236,16 +18263,17 @@ function InputAmountLoaded({
|
|
|
18236
18263
|
const { updateTargetAssetAmount } = useCheckoutContext();
|
|
18237
18264
|
const minUsd = targetAssetMinAmount && unitPrice ? Math.ceil(targetAssetMinAmount * unitPrice * 100) / 100 : void 0;
|
|
18238
18265
|
const fiatCurrency = modalState.fiatCurrency ?? defaultFiatCurrency;
|
|
18266
|
+
const quickOptions = useFiatAmountOptions(fiatCurrency);
|
|
18239
18267
|
const {
|
|
18240
18268
|
assetAmount,
|
|
18241
18269
|
inputError,
|
|
18242
18270
|
inputValue,
|
|
18243
|
-
|
|
18271
|
+
isInputInFiat,
|
|
18244
18272
|
isValid,
|
|
18245
18273
|
onChange,
|
|
18246
|
-
|
|
18247
|
-
|
|
18248
|
-
|
|
18274
|
+
toggleInputInFiat,
|
|
18275
|
+
setFiatAmount,
|
|
18276
|
+
fiatAmount,
|
|
18249
18277
|
usdAvailableAmount,
|
|
18250
18278
|
placeholder,
|
|
18251
18279
|
suggestion
|
|
@@ -18258,6 +18286,7 @@ function InputAmountLoaded({
|
|
|
18258
18286
|
unitPrice,
|
|
18259
18287
|
maxUsd: Number.parseFloat(maxCheckoutUsdString),
|
|
18260
18288
|
minUsd,
|
|
18289
|
+
quickOptions,
|
|
18261
18290
|
fiatCurrency
|
|
18262
18291
|
});
|
|
18263
18292
|
const {
|
|
@@ -18268,8 +18297,8 @@ function InputAmountLoaded({
|
|
|
18268
18297
|
bestRateQuote,
|
|
18269
18298
|
selectedQuote,
|
|
18270
18299
|
isSelectedQuoteUnavailable
|
|
18271
|
-
} = useMeld(manuallySelectedQuote,
|
|
18272
|
-
const error =
|
|
18300
|
+
} = useMeld(manuallySelectedQuote, fiatAmount, fiatCurrency);
|
|
18301
|
+
const error = useMemo22(() => {
|
|
18273
18302
|
if (isCardCheckout) {
|
|
18274
18303
|
if (isSelectedQuoteUnavailable) {
|
|
18275
18304
|
return {
|
|
@@ -18307,12 +18336,15 @@ function InputAmountLoaded({
|
|
|
18307
18336
|
]);
|
|
18308
18337
|
const { ref, fontSize, resetText } = useDynamicFont(inputValue || placeholder);
|
|
18309
18338
|
const handleIsAmountInAbsoluteToggle = () => {
|
|
18310
|
-
|
|
18339
|
+
toggleInputInFiat();
|
|
18311
18340
|
resetText();
|
|
18312
18341
|
};
|
|
18313
18342
|
const handleContinue = async (assetAmount2) => {
|
|
18314
18343
|
updateTargetAssetAmount(assetAmount2);
|
|
18315
|
-
if (!meldEnabled)
|
|
18344
|
+
if (!meldEnabled) {
|
|
18345
|
+
onNext({});
|
|
18346
|
+
return;
|
|
18347
|
+
}
|
|
18316
18348
|
if (selectedQuote) {
|
|
18317
18349
|
const result = await mutateAsync(selectedQuote.serviceProvider);
|
|
18318
18350
|
window.open(result.widgetUrl, "_blank", "noopener,noreferrer");
|
|
@@ -18320,7 +18352,7 @@ function InputAmountLoaded({
|
|
|
18320
18352
|
};
|
|
18321
18353
|
const handleSubmit = () => {
|
|
18322
18354
|
if (!suggestion) return handleContinue(assetAmount);
|
|
18323
|
-
const newState =
|
|
18355
|
+
const newState = setFiatAmount(suggestion.usdAmount);
|
|
18324
18356
|
if (suggestion.autoConfirm && newState.isValid) {
|
|
18325
18357
|
handleContinue(newState.assetAmount);
|
|
18326
18358
|
}
|
|
@@ -18331,10 +18363,10 @@ function InputAmountLoaded({
|
|
|
18331
18363
|
handleSubmit();
|
|
18332
18364
|
};
|
|
18333
18365
|
const displayAssetAmount = round3(
|
|
18334
|
-
isStablecoin(targetAssetTicker) ?
|
|
18366
|
+
isStablecoin(targetAssetTicker) ? fiatAmount : assetAmount,
|
|
18335
18367
|
ASSET_DECIMALS
|
|
18336
18368
|
);
|
|
18337
|
-
const isConvertedAmountShown = targetAssetTicker && (!
|
|
18369
|
+
const isConvertedAmountShown = targetAssetTicker && (!isInputInFiat || isCardCheckout && fiatCurrency === "USD" || !isCardCheckout);
|
|
18338
18370
|
const isMeldContinueDisabled = meldEnabled && (!!meldLimitError || isMeldLinkPending || !!meldQuotesQuery.error || meldQuotesQuery.isFetching || isSelectedQuoteUnavailable);
|
|
18339
18371
|
return /* @__PURE__ */ React150.createElement(
|
|
18340
18372
|
InputAmountLayout,
|
|
@@ -18350,7 +18382,7 @@ function InputAmountLoaded({
|
|
|
18350
18382
|
{
|
|
18351
18383
|
selectedCurrency: fiatCurrency,
|
|
18352
18384
|
onClick: (fiatCurrency2) => onNext({
|
|
18353
|
-
fiatAmount
|
|
18385
|
+
fiatAmount,
|
|
18354
18386
|
fiatCurrency: fiatCurrency2,
|
|
18355
18387
|
nextStep: "meld_currency_select" /* MELD_CURRENCY_SELECT */
|
|
18356
18388
|
})
|
|
@@ -18364,8 +18396,7 @@ function InputAmountLoaded({
|
|
|
18364
18396
|
keyIcon: /* @__PURE__ */ React150.createElement(CreditCardIcon, { size: 16 }),
|
|
18365
18397
|
onClick: () => onNext({
|
|
18366
18398
|
nextStep: "source_change" /* SOURCE_CHANGE */,
|
|
18367
|
-
fiatAmount
|
|
18368
|
-
navigateToHistoryStep: true
|
|
18399
|
+
fiatAmount
|
|
18369
18400
|
})
|
|
18370
18401
|
}
|
|
18371
18402
|
)),
|
|
@@ -18387,7 +18418,7 @@ function InputAmountLoaded({
|
|
|
18387
18418
|
onChange,
|
|
18388
18419
|
onKeyDown: handleKeyDown,
|
|
18389
18420
|
inputProps: {
|
|
18390
|
-
type:
|
|
18421
|
+
type: isInputInFiat ? "text" : "number",
|
|
18391
18422
|
autoFocus: true,
|
|
18392
18423
|
spellCheck: false,
|
|
18393
18424
|
// get ios to use numpad key with period
|
|
@@ -18423,28 +18454,29 @@ function InputAmountLoaded({
|
|
|
18423
18454
|
borderRadius: "inputAmountSwitcher",
|
|
18424
18455
|
isDisabled: isCardCheckout
|
|
18425
18456
|
},
|
|
18426
|
-
/* @__PURE__ */ React150.createElement(Text, { color: "secondaryText", size: "14" },
|
|
18457
|
+
/* @__PURE__ */ React150.createElement(Text, { color: "secondaryText", size: "14" }, isInputInFiat ? formatCryptoAndStringify4(
|
|
18427
18458
|
displayAssetAmount,
|
|
18428
18459
|
targetAssetTicker
|
|
18429
|
-
) : formatCurrencyAndStringify9(
|
|
18460
|
+
) : formatCurrencyAndStringify9(fiatAmount))
|
|
18430
18461
|
)
|
|
18431
18462
|
),
|
|
18432
18463
|
amountOptions: (!!usdAvailableAmount || isCardCheckout) && /* @__PURE__ */ React150.createElement(
|
|
18433
18464
|
QuickOptions,
|
|
18434
18465
|
{
|
|
18435
|
-
percentMode: !isCardCheckout,
|
|
18436
18466
|
currency: fiatCurrency,
|
|
18437
18467
|
onSelect: (option) => {
|
|
18438
18468
|
const selectedOption = usdAvailableAmount && !isCardCheckout ? usdAvailableAmount * (option / 100) : option;
|
|
18439
|
-
|
|
18440
|
-
}
|
|
18469
|
+
setFiatAmount(selectedOption);
|
|
18470
|
+
},
|
|
18471
|
+
options: quickOptions,
|
|
18472
|
+
percentMode: !isCardCheckout
|
|
18441
18473
|
}
|
|
18442
18474
|
),
|
|
18443
18475
|
footer: meldEnabled ? /* @__PURE__ */ React150.createElement(Box, { paddingX: "6" }, /* @__PURE__ */ React150.createElement(
|
|
18444
18476
|
SourceMeldQuoteItem,
|
|
18445
18477
|
{
|
|
18446
18478
|
onClick: () => onNext({
|
|
18447
|
-
fiatAmount
|
|
18479
|
+
fiatAmount,
|
|
18448
18480
|
fiatCurrency,
|
|
18449
18481
|
provider: selectedQuote?.serviceProvider,
|
|
18450
18482
|
nextStep: "meld_quotes" /* MELD_QUOTES */
|
|
@@ -18513,7 +18545,7 @@ function YouPayYouReceiveWrapper({
|
|
|
18513
18545
|
|
|
18514
18546
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoading.tsx
|
|
18515
18547
|
import { FlagKey as FlagKey22, formatCryptoAndStringify as formatCryptoAndStringify5 } from "@funkit/utils";
|
|
18516
|
-
import React151, { useMemo as
|
|
18548
|
+
import React151, { useMemo as useMemo23 } from "react";
|
|
18517
18549
|
function InputAmountLoading({
|
|
18518
18550
|
modalState,
|
|
18519
18551
|
onBack,
|
|
@@ -18526,7 +18558,7 @@ function InputAmountLoading({
|
|
|
18526
18558
|
const meldEnabled = useFlag(FlagKey22.EnableMeldPayment);
|
|
18527
18559
|
const targetAssetAmount = checkoutItem?.initSettings.config.targetAssetAmount;
|
|
18528
18560
|
const targetAssetTicker = checkoutItem?.initSettings.config.targetAssetTicker;
|
|
18529
|
-
const error =
|
|
18561
|
+
const error = useMemo23(() => {
|
|
18530
18562
|
if (sourceHoldingError) {
|
|
18531
18563
|
return {
|
|
18532
18564
|
message: /* @__PURE__ */ React151.createElement("div", null, "Unable to retrieve your account balance. Please try re-linking your account.", " ", paymentMethodInfo.paymentMethod === "brokerage" /* BROKERAGE */ && /* @__PURE__ */ React151.createElement(
|
|
@@ -18605,7 +18637,7 @@ function InputAmountLoading({
|
|
|
18605
18637
|
)
|
|
18606
18638
|
)
|
|
18607
18639
|
),
|
|
18608
|
-
amountOptions: /* @__PURE__ */ React151.createElement(QuickOptions, { disabled: true, percentMode:
|
|
18640
|
+
amountOptions: !isCardCheckout && /* @__PURE__ */ React151.createElement(QuickOptions, { disabled: true, options: USD_AMOUNT_OPTIONS_PCT, percentMode: true }),
|
|
18609
18641
|
footer: isMeldCheckout ? /* @__PURE__ */ React151.createElement(Box, { paddingX: "6" }, /* @__PURE__ */ React151.createElement(SourceMeldQuoteItem, { isLoading: true })) : /* @__PURE__ */ React151.createElement(YouPayYouReceiveBottomBarLayoutWrapper, null, /* @__PURE__ */ React151.createElement(
|
|
18610
18642
|
FunSkeletonBlock,
|
|
18611
18643
|
{
|
|
@@ -18694,7 +18726,7 @@ function useAssetPrice({
|
|
|
18694
18726
|
}
|
|
18695
18727
|
|
|
18696
18728
|
// src/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.ts
|
|
18697
|
-
import { useMemo as
|
|
18729
|
+
import { useMemo as useMemo24 } from "react";
|
|
18698
18730
|
function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetChainId, assetSymbol) {
|
|
18699
18731
|
const {
|
|
18700
18732
|
data: meshAssetHoldings,
|
|
@@ -18712,7 +18744,7 @@ function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetC
|
|
|
18712
18744
|
["token_transfer" /* TOKEN_TRANSFER */]: null,
|
|
18713
18745
|
["virtual_bank" /* VIRTUAL_BANK */]: null
|
|
18714
18746
|
}[paymentMethodInfo.paymentMethod];
|
|
18715
|
-
const holdingItem =
|
|
18747
|
+
const holdingItem = useMemo24(() => {
|
|
18716
18748
|
if (!assetSymbol || !holdings) {
|
|
18717
18749
|
return;
|
|
18718
18750
|
}
|
|
@@ -18788,7 +18820,9 @@ function InputAmount(props) {
|
|
|
18788
18820
|
checkoutItem?.selectedSourceAssetInfo.symbol ?? null
|
|
18789
18821
|
);
|
|
18790
18822
|
const { data: defaultCurrency, isLoading: isMeldDefaultCurrencyLoading } = useMeldDefaultCurrency(paymentMethodInfo.paymentMethod);
|
|
18791
|
-
|
|
18823
|
+
const isMeld = paymentMethodInfo.paymentMethod === "card" /* CARD */;
|
|
18824
|
+
useMeldCurrencies(isMeld);
|
|
18825
|
+
useMeldLimits(isMeld);
|
|
18792
18826
|
const { error: unitPriceError, unitPrice } = useAssetPrice({
|
|
18793
18827
|
chainId: checkoutItem?.initSettings.config.targetChain,
|
|
18794
18828
|
assetTokenAddress: checkoutItem?.initSettings.config.targetAsset
|
|
@@ -19211,9 +19245,8 @@ function LoadingAccount({
|
|
|
19211
19245
|
}
|
|
19212
19246
|
|
|
19213
19247
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
19214
|
-
import { clamp as clamp2 } from "@funkit/utils";
|
|
19215
19248
|
import clsx15 from "clsx";
|
|
19216
|
-
import React159, { useMemo as
|
|
19249
|
+
import React159, { useMemo as useMemo25, useState as useState35 } from "react";
|
|
19217
19250
|
|
|
19218
19251
|
// src/components/FunNoResults/FunNoResults.tsx
|
|
19219
19252
|
import React158 from "react";
|
|
@@ -19369,14 +19402,13 @@ var selectWrapperStyle = "_163ehmk1";
|
|
|
19369
19402
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
19370
19403
|
var MeldCurrencySelectInfo = {
|
|
19371
19404
|
Component: MeldCurrencySelect,
|
|
19372
|
-
//TODO: improve needless inflating of history if changing currency multiple times
|
|
19373
19405
|
onNext: (state, payload) => {
|
|
19374
19406
|
const common = extractCommonState(state);
|
|
19375
19407
|
return {
|
|
19376
19408
|
...common,
|
|
19377
19409
|
step: "input_amount" /* INPUT_AMOUNT */,
|
|
19410
|
+
// fiatAmount: payload.fiatAmount,
|
|
19378
19411
|
fiatCurrency: payload.currency,
|
|
19379
|
-
fiatAmount: payload.fiatAmount,
|
|
19380
19412
|
paymentMethodInfo: state.paymentMethodInfo
|
|
19381
19413
|
};
|
|
19382
19414
|
},
|
|
@@ -19386,7 +19418,7 @@ var MeldCurrencySelectInfo = {
|
|
|
19386
19418
|
return {
|
|
19387
19419
|
...common,
|
|
19388
19420
|
step: "input_amount" /* INPUT_AMOUNT */,
|
|
19389
|
-
fiatAmount: state.fiatAmount,
|
|
19421
|
+
// fiatAmount: state.fiatAmount,
|
|
19390
19422
|
fiatCurrency: state.defaultCurrency,
|
|
19391
19423
|
paymentMethodInfo: state.paymentMethodInfo
|
|
19392
19424
|
};
|
|
@@ -19396,14 +19428,13 @@ function MeldCurrencySelect({
|
|
|
19396
19428
|
modalState,
|
|
19397
19429
|
onNext
|
|
19398
19430
|
}) {
|
|
19399
|
-
const { defaultCurrency
|
|
19431
|
+
const { defaultCurrency } = modalState;
|
|
19400
19432
|
const { data, isPending } = useMeldCurrencies();
|
|
19401
|
-
const { data: meldLimits } = useMeldLimits();
|
|
19402
19433
|
const [query, setQuery] = useState35("");
|
|
19403
19434
|
const [selectedCurrency, setSelectedCurrency] = useState35(
|
|
19404
19435
|
defaultCurrency
|
|
19405
19436
|
);
|
|
19406
|
-
const filteredOptions =
|
|
19437
|
+
const filteredOptions = useMemo25(() => {
|
|
19407
19438
|
const newOptions = data?.filter(
|
|
19408
19439
|
({ name, currencyCode }) => currencyCode.toLowerCase().includes(query.toLowerCase()) || name.toLowerCase().includes(query.toLowerCase())
|
|
19409
19440
|
) ?? [];
|
|
@@ -19416,13 +19447,9 @@ function MeldCurrencySelect({
|
|
|
19416
19447
|
};
|
|
19417
19448
|
const handleSelect = (value) => {
|
|
19418
19449
|
setSelectedCurrency(value.currencyCode);
|
|
19419
|
-
const newLimit = meldLimits?.find(
|
|
19420
|
-
(limit) => limit.currencyCode === value.currencyCode
|
|
19421
|
-
);
|
|
19422
|
-
const newFiatAmount = newLimit ? clamp2(fiatAmount, newLimit.minimumAmount, newLimit.maximumAmount) : fiatAmount;
|
|
19423
19450
|
onNext({
|
|
19424
19451
|
currency: value.currencyCode,
|
|
19425
|
-
fiatAmount: newFiatAmount,
|
|
19452
|
+
// fiatAmount: newFiatAmount,
|
|
19426
19453
|
navigateToHistoryStep: true
|
|
19427
19454
|
});
|
|
19428
19455
|
};
|
|
@@ -19524,7 +19551,7 @@ import {
|
|
|
19524
19551
|
meshExecuteTransferProxy
|
|
19525
19552
|
} from "@funkit/api-base";
|
|
19526
19553
|
import { ClientError as ClientError4, FlagKey as FlagKey24, formatAddress as formatAddress4 } from "@funkit/utils";
|
|
19527
|
-
import React172, { useMemo as
|
|
19554
|
+
import React172, { useMemo as useMemo26, useState as useState38 } from "react";
|
|
19528
19555
|
import { createPortal as createPortal9 } from "react-dom";
|
|
19529
19556
|
|
|
19530
19557
|
// src/components/CopyAddress/CopyAddressButton.tsx
|
|
@@ -20104,7 +20131,7 @@ function MeshVerification({
|
|
|
20104
20131
|
return () => setScreen(0 /* INITIAL */);
|
|
20105
20132
|
});
|
|
20106
20133
|
const brokerName = getExchangeName(brokerType);
|
|
20107
|
-
const verificationTitle =
|
|
20134
|
+
const verificationTitle = useMemo26(() => {
|
|
20108
20135
|
switch (executionStatus) {
|
|
20109
20136
|
case MeshExecuteTransferStatus.secondMfaRequired:
|
|
20110
20137
|
return `Additional ${brokerName} 2FA required`;
|
|
@@ -20131,7 +20158,7 @@ function MeshVerification({
|
|
|
20131
20158
|
executionContent?.verificationSteps?.length,
|
|
20132
20159
|
isSecond2fa
|
|
20133
20160
|
]);
|
|
20134
|
-
const verificationDescription =
|
|
20161
|
+
const verificationDescription = useMemo26(() => {
|
|
20135
20162
|
switch (executionStatus) {
|
|
20136
20163
|
case MeshExecuteTransferStatus.secondMfaRequired:
|
|
20137
20164
|
return `Please enable at least two 2FA methods on your ${brokerName} account. Once enabled, you will have to reconnect your account.`;
|
|
@@ -20276,7 +20303,7 @@ var VerificationPopup = ({
|
|
|
20276
20303
|
};
|
|
20277
20304
|
|
|
20278
20305
|
// src/modals/CheckoutModal/MoonpaySetup.tsx
|
|
20279
|
-
import React174, { useCallback as useCallback31, useMemo as
|
|
20306
|
+
import React174, { useCallback as useCallback31, useMemo as useMemo28, useState as useState40 } from "react";
|
|
20280
20307
|
|
|
20281
20308
|
// src/components/FunPayments/FunPaymentMoonpayType.css.ts
|
|
20282
20309
|
var mpClass = "_1kmpeyf0";
|
|
@@ -20285,7 +20312,7 @@ var stretchStyle = "_1kmpeyf1";
|
|
|
20285
20312
|
// src/components/FunPayments/FunPaymentMoonpayType.tsx
|
|
20286
20313
|
import { getMoonpayUrlSignature } from "@funkit/api-base";
|
|
20287
20314
|
import { colorToHex } from "@funkit/utils";
|
|
20288
|
-
import React173, { Fragment as Fragment2, useEffect as useEffect33, useMemo as
|
|
20315
|
+
import React173, { Fragment as Fragment2, useEffect as useEffect33, useMemo as useMemo27, useState as useState39 } from "react";
|
|
20289
20316
|
var LazyMoonPayBuyWidget = (props) => {
|
|
20290
20317
|
const [MoonPayBuyWidget, setMoonPayBuyWidget] = useState39(null);
|
|
20291
20318
|
useEffect33(() => {
|
|
@@ -20316,7 +20343,7 @@ function FunPaymentMoonpayType({
|
|
|
20316
20343
|
const isSandboxMode = useIsFunkitSandboxMode();
|
|
20317
20344
|
const funkitConfig = useFunkitConfig();
|
|
20318
20345
|
const { userInfo } = useGeneralWallet();
|
|
20319
|
-
const currencyCode =
|
|
20346
|
+
const currencyCode = useMemo27(() => {
|
|
20320
20347
|
return generateMoonpayCurrencyCode(depositToken, depositTokenChainId);
|
|
20321
20348
|
}, [depositToken, depositTokenChainId]);
|
|
20322
20349
|
const depositTokenAmountStringFormatted = formatTokenAmountForMoonpay(
|
|
@@ -20339,7 +20366,7 @@ function FunPaymentMoonpayType({
|
|
|
20339
20366
|
});
|
|
20340
20367
|
return signature || "";
|
|
20341
20368
|
};
|
|
20342
|
-
const moonpayButtonColor =
|
|
20369
|
+
const moonpayButtonColor = useMemo27(() => {
|
|
20343
20370
|
const primaryButtonHex = colorToHex(activeTheme.colors.buttonPrimary);
|
|
20344
20371
|
if (["#FFF", "#FFFF", "#FFFFFF", "#FFFFFFFF"].includes(primaryButtonHex)) {
|
|
20345
20372
|
return void 0;
|
|
@@ -20394,7 +20421,7 @@ function MoonpaySetup({
|
|
|
20394
20421
|
depositAddress: paymentAddress
|
|
20395
20422
|
});
|
|
20396
20423
|
}, [onNext, paymentAddress]);
|
|
20397
|
-
const MoonpayWidget =
|
|
20424
|
+
const MoonpayWidget = useMemo28(() => {
|
|
20398
20425
|
return /* @__PURE__ */ React174.createElement(
|
|
20399
20426
|
FunPaymentMoonpayType,
|
|
20400
20427
|
{
|
|
@@ -20425,7 +20452,7 @@ function MoonpaySetup({
|
|
|
20425
20452
|
// src/modals/CheckoutModal/SelectAsset.tsx
|
|
20426
20453
|
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST2 } from "@funkit/chains";
|
|
20427
20454
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify11, isTokenEquivalent as isTokenEquivalent7 } from "@funkit/utils";
|
|
20428
|
-
import React183, { useEffect as useEffect35, useMemo as
|
|
20455
|
+
import React183, { useEffect as useEffect35, useMemo as useMemo30, useState as useState42 } from "react";
|
|
20429
20456
|
import { createPortal as createPortal10 } from "react-dom";
|
|
20430
20457
|
|
|
20431
20458
|
// src/components/Dropdown/ChainDropdown.tsx
|
|
@@ -20434,7 +20461,7 @@ import React180 from "react";
|
|
|
20434
20461
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
20435
20462
|
import { isMobile as isMobile6, noop as noop6 } from "@funkit/utils";
|
|
20436
20463
|
import { AnimatePresence as AnimatePresence4, motion as motion6 } from "motion/react";
|
|
20437
|
-
import React178, { useCallback as useCallback32, useMemo as
|
|
20464
|
+
import React178, { useCallback as useCallback32, useMemo as useMemo29, useState as useState41 } from "react";
|
|
20438
20465
|
|
|
20439
20466
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
20440
20467
|
import React175 from "react";
|
|
@@ -20640,7 +20667,7 @@ function BaseDropdown({
|
|
|
20640
20667
|
const handleSearch = (event) => {
|
|
20641
20668
|
setSearchInput(event.target.value);
|
|
20642
20669
|
};
|
|
20643
|
-
const filteredOptions =
|
|
20670
|
+
const filteredOptions = useMemo29(
|
|
20644
20671
|
() => options.filter(
|
|
20645
20672
|
(singleOption) => singleOption.label.toLowerCase().includes(searchInput?.toLowerCase())
|
|
20646
20673
|
),
|
|
@@ -21123,7 +21150,7 @@ function useEnrichedAccountHoldings({
|
|
|
21123
21150
|
const { apiKey } = useFunkitConfig();
|
|
21124
21151
|
const { isAllowed, isLoading } = useAllowedAssets();
|
|
21125
21152
|
const { loginType, walletAddress } = useGeneralWallet();
|
|
21126
|
-
const enrichedAccountHoldings =
|
|
21153
|
+
const enrichedAccountHoldings = useMemo30(() => {
|
|
21127
21154
|
if (!checkoutConfig) return [];
|
|
21128
21155
|
return Object.values(accountHoldings).map((asset) => {
|
|
21129
21156
|
const usableForCheckout = isAssetUsableToPayForCheckout({
|
|
@@ -21165,7 +21192,7 @@ function useAssetOptions({
|
|
|
21165
21192
|
userSelectedTargetAsset,
|
|
21166
21193
|
chainId
|
|
21167
21194
|
}) {
|
|
21168
|
-
const assetOptions =
|
|
21195
|
+
const assetOptions = useMemo30(() => {
|
|
21169
21196
|
return enrichedAccountHoldings.filter(
|
|
21170
21197
|
({ asset }) => chainId !== void 0 ? asset.pickedChainId === chainId.toString() : true
|
|
21171
21198
|
).map(({ asset, usableForCheckout }) => {
|
|
@@ -21236,7 +21263,7 @@ function MeshOrAccountSelectAsset({
|
|
|
21236
21263
|
targetAssetMinAmount: 0
|
|
21237
21264
|
};
|
|
21238
21265
|
const [selectedTargetAsset, setSelectedTargetAsset] = useState42(defaultTargetAsset);
|
|
21239
|
-
const defaultTokenSymbols =
|
|
21266
|
+
const defaultTokenSymbols = useMemo30(() => {
|
|
21240
21267
|
if (!checkoutConfig) {
|
|
21241
21268
|
return [];
|
|
21242
21269
|
}
|
|
@@ -21300,7 +21327,7 @@ function MeshOrAccountSelectAsset({
|
|
|
21300
21327
|
handleTargetAssetUpdate(tokenItem);
|
|
21301
21328
|
onFinish();
|
|
21302
21329
|
});
|
|
21303
|
-
const selectedChainTokenSymbol =
|
|
21330
|
+
const selectedChainTokenSymbol = useMemo30(() => {
|
|
21304
21331
|
if (explicitlySelectedChainTokenSymbol) {
|
|
21305
21332
|
const assetExists = assetOptions.find(
|
|
21306
21333
|
({ asset }) => asset.chainSymbolKey === explicitlySelectedChainTokenSymbol
|
|
@@ -21718,7 +21745,7 @@ import { createPortal as createPortal12 } from "react-dom";
|
|
|
21718
21745
|
|
|
21719
21746
|
// src/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.ts
|
|
21720
21747
|
import {
|
|
21721
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
21748
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15,
|
|
21722
21749
|
dydxChain as dydxChain3,
|
|
21723
21750
|
katanaChain
|
|
21724
21751
|
} from "@funkit/chains";
|
|
@@ -21744,7 +21771,7 @@ var pickSourceAssetForCard = async (checkoutItem, userIpInfo) => {
|
|
|
21744
21771
|
const wethAddrOnTargetChain = (await getTokenAddressBySymbolAndChainId2("weth", moonpayChainId)).toLowerCase();
|
|
21745
21772
|
const isTargetAssetEthOrWeth = [NATIVE_TOKEN, wethAddrOnTargetChain].includes(
|
|
21746
21773
|
checkoutItem.initSettings.config.targetAsset
|
|
21747
|
-
) &&
|
|
21774
|
+
) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15[moonpayChainId]?.nativeCurrency.symbol === "ETH" /* ETH */;
|
|
21748
21775
|
let sourceTokenAddress;
|
|
21749
21776
|
let sourceTokenTicker;
|
|
21750
21777
|
let sourceTokenChainId;
|
|
@@ -21996,6 +22023,7 @@ function SourceChange({
|
|
|
21996
22023
|
if (!enableMeldPayment) await onSelectCard();
|
|
21997
22024
|
onNext({
|
|
21998
22025
|
connectNew: true,
|
|
22026
|
+
reverseAnimation: true,
|
|
21999
22027
|
paymentMethod: newSource2,
|
|
22000
22028
|
paymentMethodInfo: paymentMethodInfo2,
|
|
22001
22029
|
brokerageFailed: false
|
|
@@ -22284,7 +22312,7 @@ var LightningBoltIcon = ({ size = 16 }) => /* @__PURE__ */ React190.createElemen
|
|
|
22284
22312
|
|
|
22285
22313
|
// src/components/QRCode/QRCode.tsx
|
|
22286
22314
|
import QRCodeUtil from "qrcode";
|
|
22287
|
-
import React191, { useMemo as
|
|
22315
|
+
import React191, { useMemo as useMemo31 } from "react";
|
|
22288
22316
|
var generateMatrix = (value, errorCorrectionLevel) => {
|
|
22289
22317
|
const { data } = QRCodeUtil.create(value, { errorCorrectionLevel }).modules;
|
|
22290
22318
|
const sqrt = Math.sqrt(data.length);
|
|
@@ -22312,7 +22340,7 @@ function QRCode({
|
|
|
22312
22340
|
}) {
|
|
22313
22341
|
const { activeTheme } = useActiveTheme();
|
|
22314
22342
|
const size = sizeProp - Number.parseInt(outsidePadding, 10) * 2;
|
|
22315
|
-
const dots =
|
|
22343
|
+
const dots = useMemo31(() => {
|
|
22316
22344
|
const dots2 = [];
|
|
22317
22345
|
const matrix = generateMatrix(uri, ecl);
|
|
22318
22346
|
const cellSize = size / matrix.length;
|
|
@@ -22895,11 +22923,16 @@ var useTokenTransfer = (selectedChainId, selectedToken) => {
|
|
|
22895
22923
|
};
|
|
22896
22924
|
};
|
|
22897
22925
|
var useMinTransferValue = (selectedChainId) => {
|
|
22926
|
+
const minTransferValueJsonString = useFlag(FlagKey28.MinTokenTransferValue);
|
|
22927
|
+
const minTransferValue = safeJSONParse(
|
|
22928
|
+
minTransferValueJsonString
|
|
22929
|
+
);
|
|
22898
22930
|
const { userIpInfo } = useFunkitUserIp();
|
|
22899
22931
|
const isMainnet = selectedChainId === mainnet8.id;
|
|
22900
|
-
if (
|
|
22901
|
-
|
|
22902
|
-
|
|
22932
|
+
if (!minTransferValue) return 0;
|
|
22933
|
+
const transferLimitKey = userIpInfo?.alpha2 || "DEFAULT";
|
|
22934
|
+
const minTransferLimit = minTransferValue[transferLimitKey] ?? minTransferValue.DEFAULT;
|
|
22935
|
+
return isMainnet ? minTransferLimit.mainnet : minTransferLimit.nonMainnet;
|
|
22903
22936
|
};
|
|
22904
22937
|
var usePriceImpactEstimation = (selectedToken) => {
|
|
22905
22938
|
const { apiKey } = useFunkitConfig();
|
|
@@ -23483,7 +23516,7 @@ var FiatAccountDetail = {
|
|
|
23483
23516
|
|
|
23484
23517
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
23485
23518
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
23486
|
-
import React205, { useCallback as useCallback34, useEffect as useEffect38, useMemo as
|
|
23519
|
+
import React205, { useCallback as useCallback34, useEffect as useEffect38, useMemo as useMemo32, useState as useState50 } from "react";
|
|
23487
23520
|
function useIframeListener(listeners) {
|
|
23488
23521
|
const handleMessage = useCallback34(
|
|
23489
23522
|
(event) => {
|
|
@@ -23536,7 +23569,7 @@ function KycIframe({
|
|
|
23536
23569
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
23537
23570
|
const { data: kycLink, isLoading: isLinkLoading } = useLoadKycLink(modalState);
|
|
23538
23571
|
const [iframeLoading, setIframeLoading] = useState50(true);
|
|
23539
|
-
const listeners =
|
|
23572
|
+
const listeners = useMemo32(
|
|
23540
23573
|
() => ({
|
|
23541
23574
|
load: () => {
|
|
23542
23575
|
logger.info("KYC iframe loaded");
|
|
@@ -23565,7 +23598,8 @@ function KycIframe({
|
|
|
23565
23598
|
onClose: onBack,
|
|
23566
23599
|
open: true,
|
|
23567
23600
|
titleId: "rk_kyc_title",
|
|
23568
|
-
|
|
23601
|
+
withoutSidePadding: !loading,
|
|
23602
|
+
withoutBottomPadding: !loading,
|
|
23569
23603
|
withTransition: false
|
|
23570
23604
|
},
|
|
23571
23605
|
loading && /* @__PURE__ */ React205.createElement(React205.Fragment, null, /* @__PURE__ */ React205.createElement(
|
|
@@ -24256,7 +24290,7 @@ function FunConnectOptions({
|
|
|
24256
24290
|
}
|
|
24257
24291
|
}
|
|
24258
24292
|
};
|
|
24259
|
-
const stepComponent =
|
|
24293
|
+
const stepComponent = useMemo33(() => {
|
|
24260
24294
|
switch (step) {
|
|
24261
24295
|
case 0 /* SIGNIN_PRIMARY */:
|
|
24262
24296
|
case 1 /* SIGNIN_SECONDARY */:
|
|
@@ -24365,7 +24399,7 @@ var FULL_SOCIAL_LOGIN_OPTIONS = [
|
|
|
24365
24399
|
function useEnabledSocialLogins() {
|
|
24366
24400
|
const funkitConfig = useFunkitConfig();
|
|
24367
24401
|
const { web2SocialLogins } = funkitConfig.loginConfig;
|
|
24368
|
-
const enabledSocialItems =
|
|
24402
|
+
const enabledSocialItems = useMemo34(() => {
|
|
24369
24403
|
return FULL_SOCIAL_LOGIN_OPTIONS.filter(
|
|
24370
24404
|
(oAuthItem) => !!web2SocialLogins[oAuthItem.funkitKey]
|
|
24371
24405
|
);
|
|
@@ -24394,7 +24428,7 @@ function FunSignInStep({
|
|
|
24394
24428
|
handleOauthRedirect,
|
|
24395
24429
|
handleGenerateFcUri
|
|
24396
24430
|
} = useFunkitWeb2Login();
|
|
24397
|
-
const isEmailInputValid =
|
|
24431
|
+
const isEmailInputValid = useMemo34(() => {
|
|
24398
24432
|
return validateEmailString(emailInput);
|
|
24399
24433
|
}, [emailInput]);
|
|
24400
24434
|
const [emailError, setEmailError] = useState55();
|
|
@@ -24933,7 +24967,7 @@ var getTimestamp = (timestampMs) => formatTimestamp(new Date(timestampMs), {
|
|
|
24933
24967
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.tsx
|
|
24934
24968
|
import { formatSecondsToCountdownForm } from "@funkit/utils";
|
|
24935
24969
|
import { motion as motion11 } from "motion/react";
|
|
24936
|
-
import React220, { useMemo as
|
|
24970
|
+
import React220, { useMemo as useMemo35 } from "react";
|
|
24937
24971
|
|
|
24938
24972
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.css.ts
|
|
24939
24973
|
var GradientLoadingBox = "_101aujm0";
|
|
@@ -24994,7 +25028,7 @@ function PendingCheckoutStatus({
|
|
|
24994
25028
|
checkoutItem.latestQuote?.finalTimeEstimationMs,
|
|
24995
25029
|
checkoutItem.selectedPaymentMethodInfo?.paymentMethod
|
|
24996
25030
|
);
|
|
24997
|
-
const estimatedRemainingSeconds =
|
|
25031
|
+
const estimatedRemainingSeconds = useMemo35(() => {
|
|
24998
25032
|
const startTimeMs = extractStartTimeMs(
|
|
24999
25033
|
checkoutItem.id,
|
|
25000
25034
|
activeCheckoutItem,
|
|
@@ -25120,7 +25154,7 @@ function FunCheckoutHistoryDetail({
|
|
|
25120
25154
|
includeGenerateActionsParams
|
|
25121
25155
|
]
|
|
25122
25156
|
);
|
|
25123
|
-
const buttonProps =
|
|
25157
|
+
const buttonProps = useMemo36(() => {
|
|
25124
25158
|
if (!isCheckoutLoaded) {
|
|
25125
25159
|
return { title: "", isDisabled: true, isLoading: true };
|
|
25126
25160
|
}
|
|
@@ -25202,7 +25236,7 @@ var CheckoutAlert = ({ state, refundState, onHelp }) => {
|
|
|
25202
25236
|
|
|
25203
25237
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryHelp.tsx
|
|
25204
25238
|
import { sendSupportMessage } from "@funkit/api-base";
|
|
25205
|
-
import React224, { useEffect as useEffect43, useMemo as
|
|
25239
|
+
import React224, { useEffect as useEffect43, useMemo as useMemo37, useRef as useRef19, useState as useState58 } from "react";
|
|
25206
25240
|
import { createPortal as createPortal15 } from "react-dom";
|
|
25207
25241
|
|
|
25208
25242
|
// src/components/FunInput/FunTextAreaInput.tsx
|
|
@@ -25349,7 +25383,7 @@ function FunCheckoutHistoryHelp({
|
|
|
25349
25383
|
);
|
|
25350
25384
|
const [descriptionInput, setDescriptionInput] = useState58("");
|
|
25351
25385
|
const [errorMessage, setErrorMessage] = useState58();
|
|
25352
|
-
const isEmailInputValid =
|
|
25386
|
+
const isEmailInputValid = useMemo37(() => {
|
|
25353
25387
|
return validateEmailString(emailInput);
|
|
25354
25388
|
}, [emailInput]);
|
|
25355
25389
|
const [processStage, setProcessStage] = useState58(
|
|
@@ -25538,11 +25572,11 @@ import {
|
|
|
25538
25572
|
formatTimestamp as formatTimestamp2,
|
|
25539
25573
|
isTokenEquivalent as isTokenEquivalent8
|
|
25540
25574
|
} from "@funkit/utils";
|
|
25541
|
-
import React226, { useCallback as useCallback41, useMemo as
|
|
25575
|
+
import React226, { useCallback as useCallback41, useMemo as useMemo39, useRef as useRef20, useState as useState59 } from "react";
|
|
25542
25576
|
import { createPortal as createPortal16 } from "react-dom";
|
|
25543
25577
|
|
|
25544
25578
|
// src/components/FunCheckoutHistory/FunDirectExecutionStatus.tsx
|
|
25545
|
-
import React225, { useMemo as
|
|
25579
|
+
import React225, { useMemo as useMemo38 } from "react";
|
|
25546
25580
|
function FunDirectExecutionStatus({
|
|
25547
25581
|
directExecution
|
|
25548
25582
|
}) {
|
|
@@ -25564,11 +25598,11 @@ function FunDirectExecutionStatus({
|
|
|
25564
25598
|
function PendingDirectExecutionStatus({
|
|
25565
25599
|
directExecution
|
|
25566
25600
|
}) {
|
|
25567
|
-
const totalSeconds =
|
|
25601
|
+
const totalSeconds = useMemo38(() => {
|
|
25568
25602
|
const timeEstimation = directExecution.clientMetadata.latestQuote?.finalTimeEstimationMs || 0;
|
|
25569
25603
|
return Math.ceil(timeEstimation / 1e3);
|
|
25570
25604
|
}, [directExecution]);
|
|
25571
|
-
const estimatedRemainingSeconds =
|
|
25605
|
+
const estimatedRemainingSeconds = useMemo38(() => {
|
|
25572
25606
|
const startTimeMs = directExecution.createdTimeMs;
|
|
25573
25607
|
return getTimeFromNowSeconds(startTimeMs, totalSeconds * 1e3);
|
|
25574
25608
|
}, [totalSeconds, directExecution]);
|
|
@@ -25620,7 +25654,7 @@ function FunDirectExecutionHistoryDetail({
|
|
|
25620
25654
|
includeGenerateActionsParams
|
|
25621
25655
|
]
|
|
25622
25656
|
);
|
|
25623
|
-
const buttonProps =
|
|
25657
|
+
const buttonProps = useMemo39(() => {
|
|
25624
25658
|
if (!isLoaded) {
|
|
25625
25659
|
return void 0;
|
|
25626
25660
|
}
|
|
@@ -25832,7 +25866,7 @@ function FunCheckoutHistoryContent({
|
|
|
25832
25866
|
}
|
|
25833
25867
|
|
|
25834
25868
|
// src/components/FunCheckoutHistory/useCustomStatusAnimationAboveTopbar.tsx
|
|
25835
|
-
import { clamp as
|
|
25869
|
+
import { clamp as clamp2 } from "@funkit/utils";
|
|
25836
25870
|
import React228, { useRef as useRef21, useState as useState60 } from "react";
|
|
25837
25871
|
var TOPBAR_HEIGHT = 56;
|
|
25838
25872
|
var DURATION_MS = 200;
|
|
@@ -25890,7 +25924,7 @@ function useCustomStatusAnimationAboveTopbar({
|
|
|
25890
25924
|
style: {
|
|
25891
25925
|
// Apply a position-based opacity to the icon if it gets too far into the topbar, so it fades out faster
|
|
25892
25926
|
// This helps (slightly) when scrolling much faster than the normal background fade animation
|
|
25893
|
-
opacity:
|
|
25927
|
+
opacity: clamp2(
|
|
25894
25928
|
1 - (scrollPos - startFadePos - statusIconSize) / TOPBAR_HEIGHT,
|
|
25895
25929
|
0,
|
|
25896
25930
|
1
|
|
@@ -25916,7 +25950,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
25916
25950
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
25917
25951
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
25918
25952
|
import clsx20 from "clsx";
|
|
25919
|
-
import React237, { useEffect as useEffect44, useMemo as
|
|
25953
|
+
import React237, { useEffect as useEffect44, useMemo as useMemo40, useRef as useRef22, useState as useState62 } from "react";
|
|
25920
25954
|
import { Virtuoso } from "react-virtuoso";
|
|
25921
25955
|
import { useAccount as useAccount6 } from "wagmi";
|
|
25922
25956
|
|
|
@@ -26464,7 +26498,7 @@ function Home({
|
|
|
26464
26498
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
26465
26499
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
26466
26500
|
}, []);
|
|
26467
|
-
const AssetsList =
|
|
26501
|
+
const AssetsList = useMemo40(() => {
|
|
26468
26502
|
if (walletAssets && !Object.keys(walletAssets).length) {
|
|
26469
26503
|
return /* @__PURE__ */ React237.createElement(EmptyTabAlert, null);
|
|
26470
26504
|
}
|
|
@@ -26491,7 +26525,7 @@ function Home({
|
|
|
26491
26525
|
}
|
|
26492
26526
|
));
|
|
26493
26527
|
}, [walletAssets]);
|
|
26494
|
-
const CheckoutsList =
|
|
26528
|
+
const CheckoutsList = useMemo40(() => {
|
|
26495
26529
|
if (checkoutHistoryList.length === 0 && isCheckoutHistoryInited) {
|
|
26496
26530
|
return /* @__PURE__ */ React237.createElement(EmptyTabAlert, null);
|
|
26497
26531
|
}
|
|
@@ -27244,7 +27278,7 @@ var FunCheckoutBlocked = ({ reason }) => {
|
|
|
27244
27278
|
|
|
27245
27279
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
27246
27280
|
import clsx23 from "clsx";
|
|
27247
|
-
import React252, { useEffect as useEffect46, useMemo as
|
|
27281
|
+
import React252, { useEffect as useEffect46, useMemo as useMemo41, useState as useState65 } from "react";
|
|
27248
27282
|
|
|
27249
27283
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
27250
27284
|
import React247 from "react";
|
|
@@ -28285,15 +28319,15 @@ var CheckoutNotifications = ({
|
|
|
28285
28319
|
if (initialDirectExecutions || !directExecutions) return;
|
|
28286
28320
|
setInitialDirectExecutions(directExecutions);
|
|
28287
28321
|
}, [initialDirectExecutions, directExecutions]);
|
|
28288
|
-
const displayedDirectExecutions =
|
|
28322
|
+
const displayedDirectExecutions = useMemo41(() => {
|
|
28289
28323
|
if (!directExecutions) return [];
|
|
28290
28324
|
return getUpdatedDirectExecutions(directExecutions, initialDirectExecutions).filter(({ txHash }) => !closedNotifications.includes(txHash)).slice(0, MAX_COUNT);
|
|
28291
28325
|
}, [initialDirectExecutions, directExecutions, closedNotifications]);
|
|
28292
|
-
const displayedCheckouts =
|
|
28326
|
+
const displayedCheckouts = useMemo41(() => {
|
|
28293
28327
|
if (!checkouts) return [];
|
|
28294
28328
|
return getUpdatedCheckouts(checkouts, initialCheckouts).filter(({ depositAddr }) => !closedNotifications.includes(depositAddr)).slice(0, MAX_COUNT);
|
|
28295
28329
|
}, [initialCheckouts, checkouts, closedNotifications]);
|
|
28296
|
-
const combinedNotifications =
|
|
28330
|
+
const combinedNotifications = useMemo41(() => {
|
|
28297
28331
|
return [
|
|
28298
28332
|
...displayedDirectExecutions.map(
|
|
28299
28333
|
(item) => ({ ...item, isDirectExecution: true })
|
|
@@ -28303,7 +28337,7 @@ var CheckoutNotifications = ({
|
|
|
28303
28337
|
)
|
|
28304
28338
|
].sort((a, b) => b.createdTimeMs - a.createdTimeMs);
|
|
28305
28339
|
}, [displayedDirectExecutions, displayedCheckouts]);
|
|
28306
|
-
const displayedNotifications =
|
|
28340
|
+
const displayedNotifications = useMemo41(() => {
|
|
28307
28341
|
return isExpanded ? combinedNotifications : combinedNotifications.slice(0, COLLAPSED_COUNT);
|
|
28308
28342
|
}, [isExpanded, combinedNotifications]);
|
|
28309
28343
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
@@ -28457,7 +28491,8 @@ function FunCheckoutModalInner({
|
|
|
28457
28491
|
onClose: onCloseWrapper,
|
|
28458
28492
|
onAnimationComplete: handleAnimationComplete,
|
|
28459
28493
|
titleId: "fun-checkout-modal",
|
|
28460
|
-
isHidden: modalState.isSoftHidden
|
|
28494
|
+
isHidden: modalState.isSoftHidden,
|
|
28495
|
+
withoutBottomPadding: modalState.step === "meld_currency_select" /* MELD_CURRENCY_SELECT */
|
|
28461
28496
|
},
|
|
28462
28497
|
/* @__PURE__ */ React253.createElement(FunCheckoutModalHeightAnimationWrapper, { checkoutStep: modalState.step }, topbar, /* @__PURE__ */ React253.createElement(
|
|
28463
28498
|
Dialog.Content,
|
|
@@ -28628,7 +28663,7 @@ function ModalProvider({ children }) {
|
|
|
28628
28663
|
return /* @__PURE__ */ React255.createElement(
|
|
28629
28664
|
ModalContext.Provider,
|
|
28630
28665
|
{
|
|
28631
|
-
value:
|
|
28666
|
+
value: useMemo42(
|
|
28632
28667
|
() => ({
|
|
28633
28668
|
accountModalOpen,
|
|
28634
28669
|
accountModalTab,
|
|
@@ -29354,7 +29389,7 @@ var FunkitWeb2Provider = ({
|
|
|
29354
29389
|
},
|
|
29355
29390
|
[privy]
|
|
29356
29391
|
);
|
|
29357
|
-
const web2UserInfo =
|
|
29392
|
+
const web2UserInfo = useMemo43(() => {
|
|
29358
29393
|
if (!loggedInUser || !loggedInUser?.linked_accounts || !loggedInUser?.linked_accounts?.length) {
|
|
29359
29394
|
return PLACEHOLDER_FUNKIT_USER_INFO;
|
|
29360
29395
|
}
|
|
@@ -30369,7 +30404,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
30369
30404
|
localStorage.setItem(storageKey5, version);
|
|
30370
30405
|
}
|
|
30371
30406
|
function getCurrentSdkVersion() {
|
|
30372
|
-
return "5.5.
|
|
30407
|
+
return "5.5.10";
|
|
30373
30408
|
}
|
|
30374
30409
|
function useFingerprint() {
|
|
30375
30410
|
const fingerprint = useCallback49(() => {
|