@funkit/connect 11.3.0 → 11.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +69 -0
- package/dist/clients/{chunk-DGBIV3ZS.js → chunk-B7UU2ETA.js} +0 -13
- package/dist/clients/{chunk-L2XMI4EX.js → chunk-BB5FHA47.js} +13 -12
- package/dist/clients/chunk-MSLPLXR2.js +30 -0
- package/dist/clients/{chunk-QQEGNLGD.js → chunk-TYG42JRZ.js} +4 -4
- package/dist/clients/{chunk-46L2KJJ4.js → chunk-UMU5S2WF.js} +34 -43
- package/dist/clients/internal/nado/withdrawalCallback.js +4 -11
- package/dist/clients/internal/nado/withdrawalConfig.d.ts +3 -1
- package/dist/clients/internal/nado/withdrawalConfig.js +2 -3
- package/dist/clients/internal/nado/withdrawalErrors.d.ts +6 -10
- package/dist/clients/internal/nado/withdrawalErrors.js +1 -2
- package/dist/clients/internal/nado/withdrawalForm.css +44 -36
- package/dist/clients/internal/nado/withdrawalForm.d.ts +1 -1
- package/dist/clients/internal/nado/withdrawalForm.js +20 -73
- package/dist/clients/internal/nado/withdrawalStatus.js +4 -8
- package/dist/clients/lighter.css +44 -36
- package/dist/clients/lighter.d.ts +0 -31
- package/dist/clients/lighter.js +10 -102
- package/dist/clients/nado.d.ts +3 -1
- package/dist/clients/nado.js +8 -15
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +47 -39
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +4 -4
- package/dist/clients/polymarket/index.css +47 -39
- package/dist/clients/polymarket/index.js +9 -9
- package/dist/components/Dropdown/BaseDropdown.css.d.ts +1 -0
- package/dist/components/Dropdown/BaseDropdown.d.ts +0 -1
- package/dist/domains/checkout.d.ts +6 -1
- package/dist/hooks/track/analytics/events.d.ts +19 -9
- package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +1 -0
- package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +11 -3
- package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +3 -33
- package/dist/hooks/track/useTrackV2.d.ts +2 -0
- package/dist/hooks/useAssetPrice.d.ts +1 -6
- package/dist/hooks/useBluvo.d.ts +7 -2
- package/dist/index.css +44 -36
- package/dist/index.js +922 -1205
- package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +5 -11
- package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -1
- package/dist/providers/FunkitStatsigProvider.d.ts +1 -1
- package/dist/utils/withdrawal.d.ts +1 -21
- package/dist/wallets/walletConnectors/index.js +32 -32
- package/package.json +6 -6
- package/dist/clients/chunk-2576N7PQ.js +0 -44
- package/dist/clients/chunk-3P2C436B.js +0 -20
- package/dist/clients/chunk-63XTVHO3.js +0 -19
- package/dist/clients/chunk-6T6URLBM.js +0 -33
- package/dist/clients/chunk-FM7SFGAV.js +0 -106
- package/dist/clients/chunk-JFDRLSYM.js +0 -42
- package/dist/clients/chunk-TZGKB6WY.js +0 -160
- package/dist/clients/chunk-VIAEAD75.js +0 -61
- package/dist/clients/chunk-WZRW6WUM.js +0 -112
- package/dist/clients/chunk-Z7HTQFEO.js +0 -69
- package/dist/clients/internal/nado/consts.d.ts +0 -22
- package/dist/clients/internal/nado/consts.js +0 -15
- package/dist/clients/internal/nado/encoding.d.ts +0 -25
- package/dist/clients/internal/nado/encoding.js +0 -11
- package/dist/clients/internal/nado/errors.d.ts +0 -68
- package/dist/clients/internal/nado/errors.js +0 -19
- package/dist/clients/internal/nado/fetch.d.ts +0 -15
- package/dist/clients/internal/nado/fetch.js +0 -9
- package/dist/clients/internal/nado/gateway.d.ts +0 -61
- package/dist/clients/internal/nado/gateway.js +0 -17
- package/dist/clients/internal/nado/hooks.d.ts +0 -208
- package/dist/clients/internal/nado/hooks.js +0 -21
- package/dist/clients/internal/nado/indexer.d.ts +0 -43
- package/dist/clients/internal/nado/indexer.js +0 -13
- package/dist/clients/internal/nado/typedData.d.ts +0 -80
- package/dist/clients/internal/nado/typedData.js +0 -10
- package/dist/clients/internal/nado/withdrawalTypes.d.ts +0 -49
- package/dist/clients/internal/nado/withdrawalTypes.js +0 -1
- package/dist/utils/safeBigInt.d.ts +0 -5
package/dist/index.js
CHANGED
|
@@ -449,7 +449,7 @@ function Avatar({ address, imageUrl, loading, size }) {
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
452
|
-
import React308, { useEffect as
|
|
452
|
+
import React308, { useEffect as useEffect91, useState as useState93 } from "react";
|
|
453
453
|
|
|
454
454
|
// src/css/touchableStyles.css.ts
|
|
455
455
|
var active = { shrink: "_7rkubb8", shrinkSm: "_7rkubb9" };
|
|
@@ -5744,7 +5744,7 @@ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
|
|
|
5744
5744
|
// src/components/ConnectButton/ConnectButtonRenderer.tsx
|
|
5745
5745
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify15, isMobile as isMobile16, noop as noop7 } from "@funkit/utils";
|
|
5746
5746
|
import React307 from "react";
|
|
5747
|
-
import { formatUnits as
|
|
5747
|
+
import { formatUnits as formatUnits7 } from "viem";
|
|
5748
5748
|
|
|
5749
5749
|
// src/hooks/useIsMounted.ts
|
|
5750
5750
|
import { useCallback as useCallback2, useEffect as useEffect4, useState as useState5 } from "react";
|
|
@@ -5805,7 +5805,7 @@ function useMainnetEnsName(address) {
|
|
|
5805
5805
|
import {
|
|
5806
5806
|
getAllWalletTokens
|
|
5807
5807
|
} from "@funkit/api-base";
|
|
5808
|
-
import { keepPreviousData as keepPreviousData4, useQuery as
|
|
5808
|
+
import { keepPreviousData as keepPreviousData4, useQuery as useQuery25 } from "@tanstack/react-query";
|
|
5809
5809
|
import { arbitrum as arbitrum6, polygon as polygon8 } from "viem/chains";
|
|
5810
5810
|
|
|
5811
5811
|
// src/domains/asset.ts
|
|
@@ -5838,8 +5838,8 @@ import {
|
|
|
5838
5838
|
isEVMAddressEquivalent as isEVMAddressEquivalent6,
|
|
5839
5839
|
round as round4
|
|
5840
5840
|
} from "@funkit/utils";
|
|
5841
|
-
import * as
|
|
5842
|
-
import { erc20Abi as erc20Abi8, formatUnits as
|
|
5841
|
+
import * as dnum11 from "dnum";
|
|
5842
|
+
import { erc20Abi as erc20Abi8, formatUnits as formatUnits6, isAddress as isAddress2 } from "viem";
|
|
5843
5843
|
|
|
5844
5844
|
// src/wagmi/actions.ts
|
|
5845
5845
|
import { erc20Abi, formatUnits } from "viem";
|
|
@@ -5910,7 +5910,7 @@ import React306, {
|
|
|
5910
5910
|
createContext as createContext21,
|
|
5911
5911
|
useCallback as useCallback65,
|
|
5912
5912
|
useContext as useContext21,
|
|
5913
|
-
useEffect as
|
|
5913
|
+
useEffect as useEffect90,
|
|
5914
5914
|
useRef as useRef46,
|
|
5915
5915
|
useState as useState92
|
|
5916
5916
|
} from "react";
|
|
@@ -6780,7 +6780,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
6780
6780
|
localStorage.setItem(storageKey, version);
|
|
6781
6781
|
}
|
|
6782
6782
|
function getCurrentSdkVersion() {
|
|
6783
|
-
return "11.
|
|
6783
|
+
return "11.4.1";
|
|
6784
6784
|
}
|
|
6785
6785
|
function useFingerprint() {
|
|
6786
6786
|
const fingerprint = useCallback3(() => {
|
|
@@ -7709,7 +7709,8 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
|
7709
7709
|
});
|
|
7710
7710
|
const qrCodeUri = funDepositAddress ? getTransferTokenQrCodeUri({
|
|
7711
7711
|
depositAddress: funDepositAddress,
|
|
7712
|
-
type: blockchainType
|
|
7712
|
+
type: blockchainType,
|
|
7713
|
+
chainId: selectedChainId
|
|
7713
7714
|
}) : void 0;
|
|
7714
7715
|
return {
|
|
7715
7716
|
depositAddress: showOriginalRecipient ? recipientAddr : funDepositAddress,
|
|
@@ -7777,8 +7778,12 @@ var USDC_USDT_FAMILY_TICKERS = /* @__PURE__ */ new Set([
|
|
|
7777
7778
|
...USDT_FAMILY_TICKERS
|
|
7778
7779
|
]);
|
|
7779
7780
|
var isSameUsdcOrUsdtFamily = (sourceToken, targetTicker) => {
|
|
7780
|
-
if (!sourceToken)
|
|
7781
|
-
|
|
7781
|
+
if (!sourceToken) {
|
|
7782
|
+
return false;
|
|
7783
|
+
}
|
|
7784
|
+
if (sourceToken === targetTicker) {
|
|
7785
|
+
return true;
|
|
7786
|
+
}
|
|
7782
7787
|
if (USDC_FAMILY_TICKERS.has(sourceToken) && USDC_FAMILY_TICKERS.has(targetTicker)) {
|
|
7783
7788
|
return true;
|
|
7784
7789
|
}
|
|
@@ -10345,42 +10350,7 @@ import {
|
|
|
10345
10350
|
// src/utils/withdrawal.ts
|
|
10346
10351
|
import { chainMetadataById as chainMetadataById2 } from "@funkit/chains";
|
|
10347
10352
|
import { isEVMAddressEquivalent, isTokenEquivalent as isTokenEquivalent3 } from "@funkit/utils";
|
|
10348
|
-
import * as dnum3 from "dnum";
|
|
10349
10353
|
import { parseUnits } from "viem";
|
|
10350
|
-
function deductFlatFee(inputAmount, feeTokens) {
|
|
10351
|
-
if (!feeTokens || feeTokens <= 0) {
|
|
10352
|
-
return inputAmount;
|
|
10353
|
-
}
|
|
10354
|
-
try {
|
|
10355
|
-
const net = dnum3.subtract(inputAmount || "0", feeTokens);
|
|
10356
|
-
return dnum3.greaterThan(net, 0) ? dnum3.toString(net) : "0";
|
|
10357
|
-
} catch {
|
|
10358
|
-
return "0";
|
|
10359
|
-
}
|
|
10360
|
-
}
|
|
10361
|
-
function resolveWithdrawalSourceTokenBalance(fn, params) {
|
|
10362
|
-
if (!fn) {
|
|
10363
|
-
return void 0;
|
|
10364
|
-
}
|
|
10365
|
-
let raw;
|
|
10366
|
-
try {
|
|
10367
|
-
raw = fn(params);
|
|
10368
|
-
} catch (err) {
|
|
10369
|
-
logger.warn("withdrawal:sourceTokenBalanceThrew", {
|
|
10370
|
-
error: err instanceof Error ? err.message : String(err)
|
|
10371
|
-
});
|
|
10372
|
-
return "0";
|
|
10373
|
-
}
|
|
10374
|
-
if (raw == null) {
|
|
10375
|
-
return "0";
|
|
10376
|
-
}
|
|
10377
|
-
const str = String(raw);
|
|
10378
|
-
if (str === "" || Number.isNaN(Number(str)) || Number(str) < 0) {
|
|
10379
|
-
logger.warn("withdrawal:invalidSourceTokenBalance", { raw });
|
|
10380
|
-
return "0";
|
|
10381
|
-
}
|
|
10382
|
-
return str;
|
|
10383
|
-
}
|
|
10384
10354
|
function isWalletWithdrawalConfig(config) {
|
|
10385
10355
|
return "wallet" in config;
|
|
10386
10356
|
}
|
|
@@ -11267,8 +11237,8 @@ import React305, {
|
|
|
11267
11237
|
createContext as createContext20,
|
|
11268
11238
|
useCallback as useCallback64,
|
|
11269
11239
|
useContext as useContext20,
|
|
11270
|
-
useEffect as
|
|
11271
|
-
useMemo as
|
|
11240
|
+
useEffect as useEffect89,
|
|
11241
|
+
useMemo as useMemo67,
|
|
11272
11242
|
useState as useState91
|
|
11273
11243
|
} from "react";
|
|
11274
11244
|
|
|
@@ -11286,25 +11256,14 @@ var topbarFadeWrapper = "_1r8f577";
|
|
|
11286
11256
|
var topbarOverflowContent = "_1r8f576 _1rsrm2fq3 _1rsrm2fs4";
|
|
11287
11257
|
|
|
11288
11258
|
// src/modals/WithdrawalModal/WithdrawalModal.tsx
|
|
11289
|
-
import
|
|
11259
|
+
import { resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance3 } from "@funkit/connect-core";
|
|
11260
|
+
import React151, { useCallback as useCallback32, useEffect as useEffect52, useState as useState47 } from "react";
|
|
11290
11261
|
import { mainnet as mainnet8 } from "viem/chains";
|
|
11291
11262
|
|
|
11292
|
-
// src/clients/internal/nado/encoding.ts
|
|
11293
|
-
import {
|
|
11294
|
-
concatHex,
|
|
11295
|
-
formatUnits as formatUnits4,
|
|
11296
|
-
pad,
|
|
11297
|
-
stringToHex
|
|
11298
|
-
} from "viem";
|
|
11299
|
-
var X18_DECIMALS = 18;
|
|
11300
|
-
function x18ToRawBaseUnit(x18Amount, decimals) {
|
|
11301
|
-
return x18Amount * 10n ** BigInt(decimals) / 10n ** BigInt(X18_DECIMALS);
|
|
11302
|
-
}
|
|
11303
|
-
function x18ToTokenUnits(x18Amount, decimals) {
|
|
11304
|
-
return formatUnits4(x18ToRawBaseUnit(x18Amount, decimals), decimals);
|
|
11305
|
-
}
|
|
11306
|
-
|
|
11307
11263
|
// src/clients/internal/nado/withdrawalConfig.ts
|
|
11264
|
+
import {
|
|
11265
|
+
buildNadoSubaccountId
|
|
11266
|
+
} from "@funkit/connect-core/clients/nado";
|
|
11308
11267
|
function isNadoWithdrawalConfig(config) {
|
|
11309
11268
|
return !!config && isCustomWithdrawalConfig(config) && config.customerConfig?.customerName === "nado";
|
|
11310
11269
|
}
|
|
@@ -11906,11 +11865,13 @@ function checkFeatureGate(name) {
|
|
|
11906
11865
|
}
|
|
11907
11866
|
|
|
11908
11867
|
// src/domains/checkout.ts
|
|
11909
|
-
var hasRisk = async (apiKey, walletAddress, customRecipient) => {
|
|
11868
|
+
var hasRisk = async (apiKey, walletAddress, customRecipient, chainIds) => {
|
|
11910
11869
|
const screeningDisabled = checkFeatureGate("disable-frontend-chainalysis");
|
|
11911
11870
|
const { isRisky } = await screenAddressesForRisk({
|
|
11912
11871
|
senderAddress: walletAddress,
|
|
11913
11872
|
recipientAddress: customRecipient,
|
|
11873
|
+
senderChainId: chainIds?.sourceChainId,
|
|
11874
|
+
recipientChainId: chainIds?.targetChainId,
|
|
11914
11875
|
apiKey,
|
|
11915
11876
|
logger,
|
|
11916
11877
|
screeningDisabled
|
|
@@ -14653,6 +14614,9 @@ import React54, {
|
|
|
14653
14614
|
} from "react";
|
|
14654
14615
|
|
|
14655
14616
|
// src/hooks/useBluvo.ts
|
|
14617
|
+
import {
|
|
14618
|
+
extractErrorTypeInfo
|
|
14619
|
+
} from "@bluvo/sdk-ts";
|
|
14656
14620
|
import { bluvoGetWithdrawableBalanceById as bluvoGetWithdrawableBalanceById2 } from "@funkit/api-base";
|
|
14657
14621
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5 } from "@funkit/chains";
|
|
14658
14622
|
import { keepPreviousData, useQuery as useQuery11 } from "@tanstack/react-query";
|
|
@@ -14834,7 +14798,17 @@ var useBluvo = () => {
|
|
|
14834
14798
|
walletId: walletId2
|
|
14835
14799
|
});
|
|
14836
14800
|
} catch (err) {
|
|
14837
|
-
|
|
14801
|
+
const { knownCode, rawType } = extractErrorTypeInfo(err);
|
|
14802
|
+
logger.error("[useBluvo][startWithdrawal]: error", err, {
|
|
14803
|
+
knownCode,
|
|
14804
|
+
rawType
|
|
14805
|
+
});
|
|
14806
|
+
return {
|
|
14807
|
+
error: {
|
|
14808
|
+
code: knownCode ?? "UNKNOWN",
|
|
14809
|
+
message: err.message
|
|
14810
|
+
}
|
|
14811
|
+
};
|
|
14838
14812
|
}
|
|
14839
14813
|
},
|
|
14840
14814
|
[bluvoClient, authorizedConnections]
|
|
@@ -15060,13 +15034,17 @@ var getQuoteCustomErrorDisplayInfo = (t) => {
|
|
|
15060
15034
|
};
|
|
15061
15035
|
function getClientErrorDisplayMessage(err, t) {
|
|
15062
15036
|
const raw = err.rawMessage;
|
|
15063
|
-
if (!raw)
|
|
15037
|
+
if (!raw) {
|
|
15038
|
+
return null;
|
|
15039
|
+
}
|
|
15064
15040
|
const patterns = [
|
|
15065
15041
|
{ check: /too low/i, display: t("quote.checkoutAmountTooLow") },
|
|
15066
15042
|
{ check: /too high/i, display: t("quote.insufficientBalance") }
|
|
15067
15043
|
];
|
|
15068
15044
|
const matched = patterns.find((p) => p.check.test(raw));
|
|
15069
|
-
if (matched)
|
|
15045
|
+
if (matched) {
|
|
15046
|
+
return matched.display;
|
|
15047
|
+
}
|
|
15070
15048
|
return raw;
|
|
15071
15049
|
}
|
|
15072
15050
|
function generateQuoteApiErrorForDisplay(err, t) {
|
|
@@ -15136,8 +15114,8 @@ function wrapResolveHealthFactor(resolve) {
|
|
|
15136
15114
|
// src/domains/quote.ts
|
|
15137
15115
|
import { getCheckoutQuote as getApiCheckoutQuote } from "@funkit/api-base";
|
|
15138
15116
|
import { RELAY_LIGHTER_CHAIN_ID } from "@funkit/fun-relay";
|
|
15139
|
-
import * as
|
|
15140
|
-
import { formatUnits as
|
|
15117
|
+
import * as dnum3 from "dnum";
|
|
15118
|
+
import { formatUnits as formatUnits4 } from "viem";
|
|
15141
15119
|
|
|
15142
15120
|
// src/domains/fees.ts
|
|
15143
15121
|
import { getAssetPriceInfo as getAssetPriceInfo2 } from "@funkit/api-base";
|
|
@@ -15365,7 +15343,7 @@ function resolveFromTokenAmount(checkoutItem, isExactInViaBuilder, userInputAmou
|
|
|
15365
15343
|
if (!isExactInViaBuilder) {
|
|
15366
15344
|
return checkoutItem.sourceAssetAmount ?? "0";
|
|
15367
15345
|
}
|
|
15368
|
-
return checkoutItem.inputTokenAmountBaseUnits != null ?
|
|
15346
|
+
return checkoutItem.inputTokenAmountBaseUnits != null ? formatUnits4(checkoutItem.inputTokenAmountBaseUnits, fromTokenDecimals) : userInputAmount.toString();
|
|
15369
15347
|
}
|
|
15370
15348
|
function deriveEstSubtotalToAmountIfNeeded(baseQuote, isExactIn, toTokenDecimals) {
|
|
15371
15349
|
if (!isExactIn) {
|
|
@@ -15378,7 +15356,7 @@ function deriveEstSubtotalToAmountIfNeeded(baseQuote, isExactIn, toTokenDecimals
|
|
|
15378
15356
|
if (!raw || !/^\d+$/.test(raw)) {
|
|
15379
15357
|
return null;
|
|
15380
15358
|
}
|
|
15381
|
-
return
|
|
15359
|
+
return formatUnits4(BigInt(raw), toTokenDecimals);
|
|
15382
15360
|
}
|
|
15383
15361
|
async function getQuoteFinalEstimation(baseQuote, checkoutItem, newPaymentMethodInfo, wagmiConfig, apiKey, loginType, isWithdrawal, brokerageQuote) {
|
|
15384
15362
|
const newFinalDollarValue = baseQuote.estSubtotalUsd;
|
|
@@ -15490,11 +15468,11 @@ async function checkAssetAmount(checkoutItem, finalEstimation, wagmiConfig, wall
|
|
|
15490
15468
|
0
|
|
15491
15469
|
);
|
|
15492
15470
|
const margin = 0.01;
|
|
15493
|
-
const minTargetAssetAmount =
|
|
15471
|
+
const minTargetAssetAmount = dnum3.from(
|
|
15494
15472
|
minSourceAssetAmount * exchangeRate * (1 + margin),
|
|
15495
15473
|
targetAssetDecimals
|
|
15496
15474
|
);
|
|
15497
|
-
const maxTargetAssetAmount =
|
|
15475
|
+
const maxTargetAssetAmount = dnum3.from(
|
|
15498
15476
|
maxSourceAssetAmount * exchangeRate * (1 - margin),
|
|
15499
15477
|
targetAssetDecimals
|
|
15500
15478
|
);
|
|
@@ -15611,7 +15589,7 @@ import React53, {
|
|
|
15611
15589
|
} from "react";
|
|
15612
15590
|
|
|
15613
15591
|
// src/domains/quoteMode/exactOut.ts
|
|
15614
|
-
import * as
|
|
15592
|
+
import * as dnum4 from "dnum";
|
|
15615
15593
|
|
|
15616
15594
|
// src/domains/feeEstimate.ts
|
|
15617
15595
|
import { mainnet as mainnet3 } from "viem/chains";
|
|
@@ -15666,10 +15644,10 @@ function createExactOutBuilder(isStablecoin) {
|
|
|
15666
15644
|
assetChainId,
|
|
15667
15645
|
paymentMethod
|
|
15668
15646
|
);
|
|
15669
|
-
const feeTokens =
|
|
15670
|
-
const maxAmount =
|
|
15671
|
-
const zero =
|
|
15672
|
-
return
|
|
15647
|
+
const feeTokens = dnum4.from(feeUsd / unitPrice, tokenBalanceBaseUnit[1]);
|
|
15648
|
+
const maxAmount = dnum4.subtract(tokenBalanceBaseUnit, feeTokens);
|
|
15649
|
+
const zero = dnum4.from(0, tokenBalanceBaseUnit[1]);
|
|
15650
|
+
return dnum4.greaterThan(maxAmount, zero) ? maxAmount : zero;
|
|
15673
15651
|
},
|
|
15674
15652
|
buildQuoteRequest({
|
|
15675
15653
|
tokenAmountBaseUnit
|
|
@@ -15681,7 +15659,7 @@ function createExactOutBuilder(isStablecoin) {
|
|
|
15681
15659
|
},
|
|
15682
15660
|
handleRetry({ error }) {
|
|
15683
15661
|
if (error.reason === "insufficientBalance" /* INSUFFICIENT_BALANCE */ && error.maxTargetAssetAmount !== void 0) {
|
|
15684
|
-
if (error.minTargetAssetAmount !== void 0 &&
|
|
15662
|
+
if (error.minTargetAssetAmount !== void 0 && dnum4.greaterThan(
|
|
15685
15663
|
error.minTargetAssetAmount,
|
|
15686
15664
|
error.maxTargetAssetAmount
|
|
15687
15665
|
)) {
|
|
@@ -15737,7 +15715,7 @@ function createExactOutBuilder(isStablecoin) {
|
|
|
15737
15715
|
}
|
|
15738
15716
|
|
|
15739
15717
|
// src/domains/quoteMode/exactIn.ts
|
|
15740
|
-
import * as
|
|
15718
|
+
import * as dnum5 from "dnum";
|
|
15741
15719
|
function createExactInBuilder() {
|
|
15742
15720
|
return {
|
|
15743
15721
|
mode: "EXACT_IN" /* EXACT_IN */,
|
|
@@ -15755,10 +15733,10 @@ function createExactInBuilder() {
|
|
|
15755
15733
|
if (!isNativeToken) {
|
|
15756
15734
|
return tokenBalanceBaseUnit;
|
|
15757
15735
|
}
|
|
15758
|
-
const gasBuffer = gasEstimateWei ??
|
|
15759
|
-
const zero =
|
|
15760
|
-
const maxAmount =
|
|
15761
|
-
return
|
|
15736
|
+
const gasBuffer = gasEstimateWei ?? dnum5.from(0, tokenBalanceBaseUnit[1]);
|
|
15737
|
+
const zero = dnum5.from(0, tokenBalanceBaseUnit[1]);
|
|
15738
|
+
const maxAmount = dnum5.subtract(tokenBalanceBaseUnit, gasBuffer);
|
|
15739
|
+
return dnum5.greaterThan(maxAmount, zero) ? maxAmount : zero;
|
|
15762
15740
|
},
|
|
15763
15741
|
buildQuoteRequest({
|
|
15764
15742
|
tokenAmountBaseUnit
|
|
@@ -15810,7 +15788,7 @@ function createExactInBuilder() {
|
|
|
15810
15788
|
return { type: "setFiatAmount" /* SET_FIAT_AMOUNT */, fiatAmount: percentage };
|
|
15811
15789
|
}
|
|
15812
15790
|
const base6 = maxSendableAmount ?? tokenBalanceBaseUnit;
|
|
15813
|
-
const fraction =
|
|
15791
|
+
const fraction = dnum5.multiply(base6, percentage / 100);
|
|
15814
15792
|
return {
|
|
15815
15793
|
type: "setTokenAmount" /* SET_TOKEN_AMOUNT */,
|
|
15816
15794
|
tokenAmountBaseUnit: fraction,
|
|
@@ -17486,6 +17464,19 @@ var PaddedScrollableArea = React69.forwardRef(function PaddedScrollableArea2({ p
|
|
|
17486
17464
|
|
|
17487
17465
|
// src/components/Dialog/FocusTrap.tsx
|
|
17488
17466
|
import React70, { useCallback as useCallback21, useEffect as useEffect27, useRef as useRef10 } from "react";
|
|
17467
|
+
var MAX_SHADOW_DEPTH = 32;
|
|
17468
|
+
var getActiveElementAcrossShadowRoots = () => {
|
|
17469
|
+
let active2 = document.activeElement;
|
|
17470
|
+
for (let depth = 0; depth < MAX_SHADOW_DEPTH; depth++) {
|
|
17471
|
+
const inner = active2?.shadowRoot?.activeElement;
|
|
17472
|
+
if (!inner || inner === active2) {
|
|
17473
|
+
return active2;
|
|
17474
|
+
}
|
|
17475
|
+
active2 = inner;
|
|
17476
|
+
}
|
|
17477
|
+
logger.warn("focusTrap:shadowDepthExceeded", { maxDepth: MAX_SHADOW_DEPTH });
|
|
17478
|
+
return active2;
|
|
17479
|
+
};
|
|
17489
17480
|
var moveFocusWithin = (element2, position) => {
|
|
17490
17481
|
const focusableElements = element2.querySelectorAll(
|
|
17491
17482
|
"button:not(:disabled), a[href]"
|
|
@@ -17498,7 +17489,7 @@ var moveFocusWithin = (element2, position) => {
|
|
|
17498
17489
|
function FocusTrap(props) {
|
|
17499
17490
|
const contentRef = useRef10(null);
|
|
17500
17491
|
useEffect27(() => {
|
|
17501
|
-
const previouslyActiveElement =
|
|
17492
|
+
const previouslyActiveElement = getActiveElementAcrossShadowRoots();
|
|
17502
17493
|
return () => {
|
|
17503
17494
|
;
|
|
17504
17495
|
previouslyActiveElement.focus?.();
|
|
@@ -18111,7 +18102,7 @@ import React87, {
|
|
|
18111
18102
|
useState as useState30
|
|
18112
18103
|
} from "react";
|
|
18113
18104
|
import { createPortal as createPortal2 } from "react-dom";
|
|
18114
|
-
import { numberToHex, pad
|
|
18105
|
+
import { numberToHex, pad, parseUnits as parseUnits3 } from "viem";
|
|
18115
18106
|
import { mainnet as mainnet5 } from "viem/chains";
|
|
18116
18107
|
|
|
18117
18108
|
// src/components/FunButton/FunRedirectButton.tsx
|
|
@@ -19646,34 +19637,30 @@ async function toCheckoutConfirmationError(t, error, wagmiConfig, options) {
|
|
|
19646
19637
|
}
|
|
19647
19638
|
|
|
19648
19639
|
// src/modals/WithdrawalModal/LighterWithdrawal.tsx
|
|
19640
|
+
import { useLogOnce } from "@funkit/connect-core";
|
|
19649
19641
|
import {
|
|
19650
19642
|
LIGHTER_ROUTE_TYPE,
|
|
19651
|
-
LIGHTER_STAKING_POOL_INDEX,
|
|
19652
19643
|
buildLighterL1WithdrawTransaction as buildLighterL1WithdrawTransaction2,
|
|
19653
|
-
findLighterStakingShare,
|
|
19654
19644
|
getLighterBaseSymbol,
|
|
19655
19645
|
isLighterWithdrawalRateLimitError as isLighterWithdrawalRateLimitError2,
|
|
19656
19646
|
lighterWithdrawBaseUnits as lighterWithdrawBaseUnits2,
|
|
19657
|
-
resolveLighterSharePrice,
|
|
19658
|
-
resolveLighterUnstakedFeeTokens,
|
|
19659
19647
|
resolveLighterWithdrawalExplorerUrl as resolveLighterWithdrawalExplorerUrl2,
|
|
19660
|
-
truncateToDecimals as truncateToDecimals2
|
|
19648
|
+
truncateToDecimals as truncateToDecimals2,
|
|
19649
|
+
useLighterFastUnstakedFeeTokens
|
|
19661
19650
|
} from "@funkit/connect-core/clients/lighter";
|
|
19662
19651
|
import {
|
|
19663
19652
|
LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
|
|
19664
19653
|
LIGHTER_FAST_MAX_WITHDRAWAL_USD,
|
|
19665
19654
|
LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE2,
|
|
19666
19655
|
LIGHTER_SECURE_ASSETS_BY_INDEX,
|
|
19667
|
-
LIGHTER_STAKING_POOL_INDEX
|
|
19656
|
+
LIGHTER_STAKING_POOL_INDEX,
|
|
19668
19657
|
LIGHTER_STAKING_THRESHOLD_LIT,
|
|
19669
19658
|
LIGHTER_UNSTAKED_FEE_TOKENS,
|
|
19670
19659
|
LIGHTER_USDC_SPOT_SYMBOL,
|
|
19671
19660
|
getLighterBaseSymbol as getLighterBaseSymbol2,
|
|
19672
19661
|
getLighterSecureMainnetAddress,
|
|
19673
19662
|
resolveLighterAssetIndex,
|
|
19674
|
-
resolveLighterSecureRouteType
|
|
19675
|
-
resolveLighterSharePrice as resolveLighterSharePrice2,
|
|
19676
|
-
resolveLighterUnstakedFeeTokens as resolveLighterUnstakedFeeTokens2
|
|
19663
|
+
resolveLighterSecureRouteType
|
|
19677
19664
|
} from "@funkit/connect-core/clients/lighter";
|
|
19678
19665
|
var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
|
|
19679
19666
|
var LIGHTER_PERPS_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
@@ -19691,7 +19678,7 @@ function resolveLighterSourceAsset({
|
|
|
19691
19678
|
return void 0;
|
|
19692
19679
|
}
|
|
19693
19680
|
return {
|
|
19694
|
-
tokenAddress:
|
|
19681
|
+
tokenAddress: pad(numberToHex(assetIndex), { size: 20 }),
|
|
19695
19682
|
tokenChainId: RELAY_LIGHTER_CHAIN_ID2
|
|
19696
19683
|
};
|
|
19697
19684
|
}
|
|
@@ -19746,12 +19733,6 @@ function LighterSecureWithdrawalLink({
|
|
|
19746
19733
|
}
|
|
19747
19734
|
);
|
|
19748
19735
|
}
|
|
19749
|
-
function useLighterStakingSharePrice(enabled) {
|
|
19750
|
-
const { account } = useLighterAccount(
|
|
19751
|
-
enabled ? { by: "index", value: `${LIGHTER_STAKING_POOL_INDEX}` } : null
|
|
19752
|
-
);
|
|
19753
|
-
return useMemo25(() => resolveLighterSharePrice(account), [account]);
|
|
19754
|
-
}
|
|
19755
19736
|
function useLighterWithdrawalBalances({
|
|
19756
19737
|
accountIndex
|
|
19757
19738
|
}) {
|
|
@@ -19767,10 +19748,8 @@ function useLighterWithdrawalBalances({
|
|
|
19767
19748
|
});
|
|
19768
19749
|
}, [accountIndex, isLoading, account, error]);
|
|
19769
19750
|
const assets = useMemo25(() => account?.assets ?? [], [account]);
|
|
19770
|
-
const shares = useMemo25(() => account?.shares ?? [], [account]);
|
|
19771
19751
|
return {
|
|
19772
19752
|
assets,
|
|
19773
|
-
shares,
|
|
19774
19753
|
isLoading
|
|
19775
19754
|
};
|
|
19776
19755
|
}
|
|
@@ -19787,44 +19766,33 @@ function useLighterWithdrawal(config, setRecipientAddress) {
|
|
|
19787
19766
|
const { mainAccountIndex, isUnifiedTradingMode } = useLighterAccounts({
|
|
19788
19767
|
address: connectedAddress
|
|
19789
19768
|
});
|
|
19790
|
-
const { assets: lighterAssets
|
|
19769
|
+
const { assets: lighterAssets } = useLighterWithdrawalBalances({
|
|
19791
19770
|
accountIndex: mainAccountIndex
|
|
19792
19771
|
});
|
|
19793
|
-
const
|
|
19794
|
-
|
|
19795
|
-
|
|
19796
|
-
|
|
19797
|
-
|
|
19798
|
-
|
|
19799
|
-
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
|
|
19807
|
-
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
}
|
|
19813
|
-
if (lighterShares.length > 1 || !stakingShare) {
|
|
19814
|
-
logger.warn("lighter:fast:unexpected-shares", {
|
|
19772
|
+
const {
|
|
19773
|
+
feeTokens: lighterFastUnstakedFee,
|
|
19774
|
+
isFetched: isLighterFastUnstakedFeeFetched,
|
|
19775
|
+
isError: isLighterFastUnstakedFeeError
|
|
19776
|
+
} = useLighterFastUnstakedFeeTokens({
|
|
19777
|
+
accountIndex: mainAccountIndex,
|
|
19778
|
+
enabled: isLighterFast
|
|
19779
|
+
});
|
|
19780
|
+
useLogOnce(
|
|
19781
|
+
isLighterFast && isLighterFastUnstakedFeeFetched ? `${mainAccountIndex}|${isLighterFastUnstakedFeeError}|${lighterFastUnstakedFee}` : void 0,
|
|
19782
|
+
() => {
|
|
19783
|
+
if (isLighterFastUnstakedFeeError) {
|
|
19784
|
+
logger.warn("lighter:fast:unstaked-fee:account-unavailable", {
|
|
19785
|
+
accountIndex: mainAccountIndex,
|
|
19786
|
+
unstakedFeeTokens: lighterFastUnstakedFee
|
|
19787
|
+
});
|
|
19788
|
+
return;
|
|
19789
|
+
}
|
|
19790
|
+
logger.info("lighter:fast:unstaked-fee:resolved", {
|
|
19815
19791
|
accountIndex: mainAccountIndex,
|
|
19816
|
-
|
|
19817
|
-
publicPoolIndexes: lighterShares.map((s) => s.public_pool_index),
|
|
19818
|
-
hasStakingShare: !!stakingShare
|
|
19792
|
+
unstakedFeeTokens: lighterFastUnstakedFee
|
|
19819
19793
|
});
|
|
19820
19794
|
}
|
|
19821
|
-
|
|
19822
|
-
isLighterFast,
|
|
19823
|
-
mainAccountIndex,
|
|
19824
|
-
lighterShares,
|
|
19825
|
-
lighterSharePrice,
|
|
19826
|
-
lighterFastUnstakedFee
|
|
19827
|
-
]);
|
|
19795
|
+
);
|
|
19828
19796
|
const invalidateLighterAccount = useInvalidateLighterAccount();
|
|
19829
19797
|
return {
|
|
19830
19798
|
isLighterSecure,
|
|
@@ -19833,6 +19801,9 @@ function useLighterWithdrawal(config, setRecipientAddress) {
|
|
|
19833
19801
|
connectedAddress,
|
|
19834
19802
|
lighterAssets,
|
|
19835
19803
|
lighterFastUnstakedFee,
|
|
19804
|
+
// Fast: the fee gates quoting (see useLighterFastUnstakedFeeTokens) — true
|
|
19805
|
+
// for every other flow, where there's no fee fetch to wait on.
|
|
19806
|
+
isLighterFastUnstakedFeeFetched: !isLighterFast || isLighterFastUnstakedFeeFetched,
|
|
19836
19807
|
invalidateLighterAccount
|
|
19837
19808
|
};
|
|
19838
19809
|
}
|
|
@@ -20183,10 +20154,11 @@ import { createPortal as createPortal3 } from "react-dom";
|
|
|
20183
20154
|
import {
|
|
20184
20155
|
getCompletionTxInfo as getCompletionTxInfo2,
|
|
20185
20156
|
processRecentDepositsForNotifications,
|
|
20157
|
+
useLogOnce as useLogOnce2,
|
|
20186
20158
|
useRecentDepositsApiQuery
|
|
20187
20159
|
} from "@funkit/connect-core";
|
|
20188
20160
|
import { isEVMAddressEquivalent as isEVMAddressEquivalent2 } from "@funkit/utils";
|
|
20189
|
-
import { useEffect as useEffect33, useMemo as useMemo26,
|
|
20161
|
+
import { useEffect as useEffect33, useMemo as useMemo26, useState as useState31 } from "react";
|
|
20190
20162
|
import { zeroHash } from "viem";
|
|
20191
20163
|
var RECENT_DIRECT_EXECUTION_SCAN_SIZE = 5;
|
|
20192
20164
|
function useNadoWithdrawalStatus({
|
|
@@ -20236,19 +20208,14 @@ function useNadoWithdrawalStatus({
|
|
|
20236
20208
|
setHasSettled(true);
|
|
20237
20209
|
}
|
|
20238
20210
|
}, [status]);
|
|
20239
|
-
|
|
20240
|
-
useEffect33(() => {
|
|
20241
|
-
if (status === "pending" || loggedStatusRef.current === status) {
|
|
20242
|
-
return;
|
|
20243
|
-
}
|
|
20244
|
-
loggedStatusRef.current = status;
|
|
20211
|
+
useLogOnce2(status === "pending" ? void 0 : status, () => {
|
|
20245
20212
|
logger.info("nado:withdrawal:settled", {
|
|
20246
20213
|
depositAddress,
|
|
20247
20214
|
status,
|
|
20248
20215
|
txHash: latestStep?.txHash,
|
|
20249
20216
|
relayStatus: latestStep?.listenerInfo?.status
|
|
20250
20217
|
});
|
|
20251
|
-
}
|
|
20218
|
+
});
|
|
20252
20219
|
const completionTx = useMemo26(() => {
|
|
20253
20220
|
if (status !== "completed" || !latestStep) {
|
|
20254
20221
|
return void 0;
|
|
@@ -20426,7 +20393,7 @@ var STATUS_COPY = {
|
|
|
20426
20393
|
};
|
|
20427
20394
|
|
|
20428
20395
|
// src/modals/WithdrawalModal/WithdrawalCallbackSuccess.tsx
|
|
20429
|
-
import React120, { useMemo as
|
|
20396
|
+
import React120, { useMemo as useMemo35 } from "react";
|
|
20430
20397
|
|
|
20431
20398
|
// src/components/FunCheckoutHistory/PendingSuccessScreen.tsx
|
|
20432
20399
|
import {
|
|
@@ -20512,7 +20479,7 @@ import {
|
|
|
20512
20479
|
formatTimestamp as formatTimestamp2,
|
|
20513
20480
|
isTokenEquivalent as isTokenEquivalent5
|
|
20514
20481
|
} from "@funkit/utils";
|
|
20515
|
-
import React118, { useCallback as useCallback24, useMemo as useMemo33, useRef as
|
|
20482
|
+
import React118, { useCallback as useCallback24, useMemo as useMemo33, useRef as useRef16, useState as useState33 } from "react";
|
|
20516
20483
|
import { createPortal as createPortal4 } from "react-dom";
|
|
20517
20484
|
|
|
20518
20485
|
// src/hooks/useReceiveAmountLabel.ts
|
|
@@ -21122,7 +21089,7 @@ import React93 from "react";
|
|
|
21122
21089
|
|
|
21123
21090
|
// src/components/FunOptionBox/FunOptionBox.tsx
|
|
21124
21091
|
import clsx14 from "clsx";
|
|
21125
|
-
import React92, { useRef as
|
|
21092
|
+
import React92, { useRef as useRef14 } from "react";
|
|
21126
21093
|
|
|
21127
21094
|
// src/components/FunOptionBox/FunOptionBox.css.ts
|
|
21128
21095
|
var funOptionBoxStyle = { baseStyle: "_1rfcluh0", compactListStyle: "_1rfcluh1", defaultBorder: "_1rsrm2f2aa _1rsrm2f2ah _1rsrm2f1rx", defaultModeNotActiveBorder: "_1rsrm2f2am _1rsrm2f2at _1rsrm2f1rx _1rsrm2f1n", activeBorder: "_1rsrm2f1rs", disabledOptionBorder: "_1rsrm2f1ts", defaultBackground: "_1rsrm2f1ia _1rsrm2f11t", borderedBackground: "_1rsrm2f1ig _1rsrm2f11t", activeBackground: "_1rsrm2f1ia _1rsrm2f18n _1rsrm2f18o", uninteractiveBackground: "_1rsrm2f1im" };
|
|
@@ -21149,7 +21116,7 @@ function FunOptionBox({
|
|
|
21149
21116
|
...boxProps
|
|
21150
21117
|
}) {
|
|
21151
21118
|
const isClickable = !!onClick && !disabled;
|
|
21152
|
-
const ref =
|
|
21119
|
+
const ref = useRef14(null);
|
|
21153
21120
|
return /* @__PURE__ */ React92.createElement(
|
|
21154
21121
|
Box,
|
|
21155
21122
|
{
|
|
@@ -22852,7 +22819,7 @@ function AddTokenToWalletButton({
|
|
|
22852
22819
|
import { CheckoutState as CheckoutState3 } from "@funkit/api-base";
|
|
22853
22820
|
import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
|
|
22854
22821
|
import { formatAddress as formatAddress6, formatTimestamp } from "@funkit/utils";
|
|
22855
|
-
import React117, { useEffect as useEffect35, useRef as
|
|
22822
|
+
import React117, { useEffect as useEffect35, useRef as useRef15, useState as useState32 } from "react";
|
|
22856
22823
|
|
|
22857
22824
|
// src/utils/checkoutHistory.ts
|
|
22858
22825
|
function getCheckoutCompletionTime(checkout) {
|
|
@@ -23057,7 +23024,7 @@ function OrderDetail({
|
|
|
23057
23024
|
}) {
|
|
23058
23025
|
const { t } = useFunkitTranslation();
|
|
23059
23026
|
const [isExpanded, setIsExpanded] = useState32(false);
|
|
23060
|
-
const contentRef =
|
|
23027
|
+
const contentRef = useRef15(null);
|
|
23061
23028
|
const isCheckoutItemLoaded = checkoutHistoryItem !== void 0;
|
|
23062
23029
|
return /* @__PURE__ */ React117.createElement(Box, { ref: contentRef, paddingX: "12" }, /* @__PURE__ */ React117.createElement(
|
|
23063
23030
|
Box,
|
|
@@ -23370,7 +23337,7 @@ function DirectExecutionOrderDetail({
|
|
|
23370
23337
|
}) {
|
|
23371
23338
|
const { t } = useFunkitTranslation();
|
|
23372
23339
|
const [isExpanded, setIsExpanded] = useState33(false);
|
|
23373
|
-
const contentRef =
|
|
23340
|
+
const contentRef = useRef16(null);
|
|
23374
23341
|
return /* @__PURE__ */ React118.createElement(Box, { ref: contentRef, paddingX: "12" }, /* @__PURE__ */ React118.createElement(
|
|
23375
23342
|
Box,
|
|
23376
23343
|
{
|
|
@@ -23668,8 +23635,34 @@ var PendingSuccessScreen = ({
|
|
|
23668
23635
|
);
|
|
23669
23636
|
};
|
|
23670
23637
|
|
|
23671
|
-
// src/hooks/track/
|
|
23672
|
-
import {
|
|
23638
|
+
// src/hooks/track/useTrackV2.ts
|
|
23639
|
+
import { useCallback as useCallback26 } from "react";
|
|
23640
|
+
function useTrackV2() {
|
|
23641
|
+
const { logEventV2 } = useTrack();
|
|
23642
|
+
const { checkoutItem } = useCheckoutContext();
|
|
23643
|
+
const { apiKey } = useFunkitConfig();
|
|
23644
|
+
const { userInfo } = useGeneralWallet();
|
|
23645
|
+
const checkoutId = checkoutItem?.id;
|
|
23646
|
+
const isWithdrawal = !!checkoutItem?.isWithdrawal;
|
|
23647
|
+
const connectorName = userInfo.isConnected ? userInfo.typeLabel : null;
|
|
23648
|
+
const userId = userInfo.isConnected && userInfo.id !== "0x" ? userInfo.id : null;
|
|
23649
|
+
return useCallback26(
|
|
23650
|
+
(event, buildMetadata) => {
|
|
23651
|
+
if (!checkoutId) {
|
|
23652
|
+
return;
|
|
23653
|
+
}
|
|
23654
|
+
logEventV2(event, () => ({
|
|
23655
|
+
api_key: apiKey,
|
|
23656
|
+
checkout_id: checkoutId,
|
|
23657
|
+
connector_name: connectorName || null,
|
|
23658
|
+
flow: isWithdrawal ? "withdraw" : "deposit",
|
|
23659
|
+
user_id: userId || null,
|
|
23660
|
+
...buildMetadata()
|
|
23661
|
+
}));
|
|
23662
|
+
},
|
|
23663
|
+
[apiKey, checkoutId, connectorName, isWithdrawal, logEventV2, userId]
|
|
23664
|
+
);
|
|
23665
|
+
}
|
|
23673
23666
|
|
|
23674
23667
|
// src/hooks/track/analytics/resolveExecutionProgressContext.ts
|
|
23675
23668
|
import {
|
|
@@ -23697,7 +23690,9 @@ function resolveProgressState(historyItem) {
|
|
|
23697
23690
|
function getDirectExecutionFulfillmentTimeMs(rootExecution, latestStep) {
|
|
23698
23691
|
const startedAtMs = getDirectExecutionCreatedTimeMs2(rootExecution);
|
|
23699
23692
|
const completedAtMs = getDirectExecutionUpdatedTimeMs2(latestStep);
|
|
23700
|
-
if (!startedAtMs || !completedAtMs)
|
|
23693
|
+
if (!startedAtMs || !completedAtMs) {
|
|
23694
|
+
return null;
|
|
23695
|
+
}
|
|
23701
23696
|
return completedAtMs - startedAtMs;
|
|
23702
23697
|
}
|
|
23703
23698
|
function resolveExecutionProgressContext(historyItem, flow) {
|
|
@@ -23746,6 +23741,7 @@ function resolveExecutionProgressContext(historyItem, flow) {
|
|
|
23746
23741
|
...common,
|
|
23747
23742
|
claimKey: getDirectExecutionNotificationKey2(historyItem),
|
|
23748
23743
|
errorCode: isFailed2 ? latestStep.listenerInfo?.status ?? null : null,
|
|
23744
|
+
errorMessage: null,
|
|
23749
23745
|
executionType: historyItem.type,
|
|
23750
23746
|
fulfillmentTimeMs: isCompleted ? getDirectExecutionFulfillmentTimeMs(historyItem, latestStep) : null,
|
|
23751
23747
|
historicalUserId: historyItem.userId,
|
|
@@ -23765,6 +23761,7 @@ function resolveExecutionProgressContext(historyItem, flow) {
|
|
|
23765
23761
|
...common,
|
|
23766
23762
|
claimKey: historyItem.depositAddr,
|
|
23767
23763
|
errorCode: isFailed ? historyItem.state : null,
|
|
23764
|
+
errorMessage: null,
|
|
23768
23765
|
executionType: null,
|
|
23769
23766
|
fulfillmentTimeMs: isCompleted ? getCheckoutCompletionTime(historyItem) * 1e3 : null,
|
|
23770
23767
|
historicalUserId: null,
|
|
@@ -23861,7 +23858,7 @@ var eventNames = {
|
|
|
23861
23858
|
succeeded: "fc_withdrawal_succeeded" /* WITHDRAWAL_SUCCEEDED */
|
|
23862
23859
|
}
|
|
23863
23860
|
};
|
|
23864
|
-
function buildExecutionTransactionSnapshotProperties(args,
|
|
23861
|
+
function buildExecutionTransactionSnapshotProperties(args, connectorId) {
|
|
23865
23862
|
return {
|
|
23866
23863
|
...resolvePaymentMethodProperties(args, connectorId),
|
|
23867
23864
|
checkout_id: args.historicalCheckoutId,
|
|
@@ -23878,38 +23875,22 @@ function buildExecutionTransactionSnapshotProperties(args, connectedUserId, conn
|
|
|
23878
23875
|
target_asset_ticker: args.target.ticker,
|
|
23879
23876
|
trade_type: args.tradeType,
|
|
23880
23877
|
tx_hash: args.txHash,
|
|
23881
|
-
user_id: args.historicalUserId
|
|
23878
|
+
...args.historicalUserId ? { user_id: args.historicalUserId } : {},
|
|
23882
23879
|
...resolveVisibleQuoteFeeProperties(args.quote)
|
|
23883
23880
|
};
|
|
23884
23881
|
}
|
|
23885
23882
|
function useTrackExecutionProgressEvents(flow) {
|
|
23886
|
-
const
|
|
23887
|
-
const {
|
|
23888
|
-
const { connectorId, userInfo } = useGeneralWallet();
|
|
23883
|
+
const logEventV2 = useTrackV2();
|
|
23884
|
+
const { connectorId } = useGeneralWallet();
|
|
23889
23885
|
const names = eventNames[flow];
|
|
23890
|
-
const connectorName = userInfo.isConnected ? userInfo.typeLabel || null : null;
|
|
23891
|
-
const userId = userInfo.isConnected && userInfo.id !== "0x" ? userInfo.id || null : null;
|
|
23892
|
-
const commonProperties = useMemo35(
|
|
23893
|
-
() => ({
|
|
23894
|
-
api_key: apiKey,
|
|
23895
|
-
connector_name: connectorName,
|
|
23896
|
-
flow,
|
|
23897
|
-
user_id: userId
|
|
23898
|
-
}),
|
|
23899
|
-
[apiKey, connectorName, flow, userId]
|
|
23900
|
-
);
|
|
23901
23886
|
const trackExecutionTransactionSubmitted = useEffectEvent(
|
|
23902
23887
|
(args, claimKey) => {
|
|
23903
23888
|
if (!claimAnalyticsEvent(names.submitted, claimKey)) {
|
|
23904
23889
|
return;
|
|
23905
23890
|
}
|
|
23906
23891
|
logEventV2(names.submitted, () => ({
|
|
23907
|
-
|
|
23908
|
-
...buildExecutionTransactionSnapshotProperties(
|
|
23909
|
-
args,
|
|
23910
|
-
userId,
|
|
23911
|
-
connectorId
|
|
23912
|
-
),
|
|
23892
|
+
flow,
|
|
23893
|
+
...buildExecutionTransactionSnapshotProperties(args, connectorId),
|
|
23913
23894
|
est_fulfillment_time_ms: args.quote?.finalTimeEstimationMs ?? null
|
|
23914
23895
|
}));
|
|
23915
23896
|
}
|
|
@@ -23920,12 +23901,8 @@ function useTrackExecutionProgressEvents(flow) {
|
|
|
23920
23901
|
return;
|
|
23921
23902
|
}
|
|
23922
23903
|
logEventV2(names.succeeded, () => ({
|
|
23923
|
-
|
|
23924
|
-
...buildExecutionTransactionSnapshotProperties(
|
|
23925
|
-
args,
|
|
23926
|
-
userId,
|
|
23927
|
-
connectorId
|
|
23928
|
-
),
|
|
23904
|
+
flow,
|
|
23905
|
+
...buildExecutionTransactionSnapshotProperties(args, connectorId),
|
|
23929
23906
|
fulfillment_time_ms: args.fulfillmentTimeMs
|
|
23930
23907
|
}));
|
|
23931
23908
|
}
|
|
@@ -23936,13 +23913,10 @@ function useTrackExecutionProgressEvents(flow) {
|
|
|
23936
23913
|
return;
|
|
23937
23914
|
}
|
|
23938
23915
|
logEventV2(names.failed, () => ({
|
|
23939
|
-
|
|
23940
|
-
...buildExecutionTransactionSnapshotProperties(
|
|
23941
|
-
|
|
23942
|
-
|
|
23943
|
-
connectorId
|
|
23944
|
-
),
|
|
23945
|
-
error_code: args.errorCode
|
|
23916
|
+
flow,
|
|
23917
|
+
...buildExecutionTransactionSnapshotProperties(args, connectorId),
|
|
23918
|
+
error_code: args.errorCode,
|
|
23919
|
+
error_message: args.errorMessage
|
|
23946
23920
|
}));
|
|
23947
23921
|
}
|
|
23948
23922
|
);
|
|
@@ -23980,7 +23954,7 @@ var WithdrawalCallbackSuccess = ({
|
|
|
23980
23954
|
}) => {
|
|
23981
23955
|
const { t } = useFunkitTranslation();
|
|
23982
23956
|
const { trackExecutionProgressEvents } = useTrackExecutionProgressEvents("withdraw");
|
|
23983
|
-
const customTextConfigSteps =
|
|
23957
|
+
const customTextConfigSteps = useMemo35(() => {
|
|
23984
23958
|
return {
|
|
23985
23959
|
...getDefaultTextConfigSteps(t),
|
|
23986
23960
|
1: ({ textCustomizations }) => ({
|
|
@@ -24005,290 +23979,36 @@ var WithdrawalCallbackSuccess = ({
|
|
|
24005
23979
|
};
|
|
24006
23980
|
|
|
24007
23981
|
// src/modals/WithdrawalModal/WithdrawalContent.tsx
|
|
24008
|
-
import {
|
|
23982
|
+
import {
|
|
23983
|
+
deductFlatFee,
|
|
23984
|
+
extractRelayFeeInfo as extractRelayFeeInfo3,
|
|
23985
|
+
resolveWithdrawalSourceTokenBalance
|
|
23986
|
+
} from "@funkit/connect-core";
|
|
24009
23987
|
import {
|
|
24010
23988
|
formatCryptoAndStringify as formatCryptoAndStringify4,
|
|
24011
23989
|
formatCurrencyAndStringify as formatCurrencyAndStringify6
|
|
24012
23990
|
} from "@funkit/utils";
|
|
24013
|
-
import React138, { useEffect as
|
|
23991
|
+
import React138, { useEffect as useEffect44, useMemo as useMemo40, useState as useState44 } from "react";
|
|
24014
23992
|
import { createPortal as createPortal5 } from "react-dom";
|
|
24015
23993
|
import { useDebounce } from "use-debounce";
|
|
24016
23994
|
import { isAddress } from "viem";
|
|
24017
23995
|
import { mainnet as mainnet7 } from "viem/chains";
|
|
24018
|
-
|
|
24019
|
-
// src/clients/internal/nado/hooks.ts
|
|
24020
|
-
import { skipToken, useQuery as useQuery13, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
24021
|
-
import { useCallback as useCallback26, useEffect as useEffect37, useReducer as useReducer3 } from "react";
|
|
24022
|
-
|
|
24023
|
-
// src/clients/internal/nado/errors.ts
|
|
24024
|
-
var NadoGatewayError = class extends Error {
|
|
24025
|
-
constructor(message, options) {
|
|
24026
|
-
super(message);
|
|
24027
|
-
this.name = "NadoGatewayError";
|
|
24028
|
-
this.kind = options.kind;
|
|
24029
|
-
this.errorCode = options.errorCode;
|
|
24030
|
-
this.httpStatus = options.httpStatus;
|
|
24031
|
-
}
|
|
24032
|
-
};
|
|
24033
|
-
function createNadoGatewayError(response, fallbackMessage) {
|
|
24034
|
-
return new NadoGatewayError(response.error ?? fallbackMessage, {
|
|
24035
|
-
kind: "api",
|
|
24036
|
-
errorCode: response.error_code
|
|
24037
|
-
});
|
|
24038
|
-
}
|
|
24039
|
-
|
|
24040
|
-
// src/clients/internal/nado/consts.ts
|
|
24041
|
-
import { getAddress as getAddress3 } from "viem";
|
|
24042
|
-
import { ink } from "viem/chains";
|
|
24043
|
-
var INK_CHAIN_ID = ink.id;
|
|
24044
|
-
var NADO_GATEWAY_URL = "https://gateway.prod.nado.xyz/v1";
|
|
24045
|
-
var NADO_EIP712_VERIFYING_CONTRACT_ADDRESS = getAddress3(
|
|
24046
|
-
"0x05ec92D78ED421f3D3Ada77FFdE167106565974E"
|
|
24047
|
-
);
|
|
24048
|
-
|
|
24049
|
-
// src/clients/internal/nado/fetch.ts
|
|
24050
|
-
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
24051
|
-
var LOGGED_BODY_MAX_CHARS = 500;
|
|
24052
|
-
function isTimeoutError(error) {
|
|
24053
|
-
return error instanceof DOMException && error.name === "TimeoutError";
|
|
24054
|
-
}
|
|
24055
|
-
function createAbortWithTimeout(callerSignal, ms) {
|
|
24056
|
-
const controller = new AbortController();
|
|
24057
|
-
const id = setTimeout(
|
|
24058
|
-
() => controller.abort(
|
|
24059
|
-
new DOMException("Nado request timed out", "TimeoutError")
|
|
24060
|
-
),
|
|
24061
|
-
ms
|
|
24062
|
-
);
|
|
24063
|
-
const propagateAbort = () => controller.abort(callerSignal?.reason);
|
|
24064
|
-
if (callerSignal?.aborted) {
|
|
24065
|
-
propagateAbort();
|
|
24066
|
-
} else {
|
|
24067
|
-
callerSignal?.addEventListener("abort", propagateAbort);
|
|
24068
|
-
}
|
|
24069
|
-
return {
|
|
24070
|
-
signal: controller.signal,
|
|
24071
|
-
cleanup: () => {
|
|
24072
|
-
clearTimeout(id);
|
|
24073
|
-
callerSignal?.removeEventListener("abort", propagateAbort);
|
|
24074
|
-
}
|
|
24075
|
-
};
|
|
24076
|
-
}
|
|
24077
|
-
async function nadoFetch(params) {
|
|
24078
|
-
const { uri, method, body, signal } = params;
|
|
24079
|
-
const startTimeMs = Date.now();
|
|
24080
|
-
const abort = createAbortWithTimeout(signal, DEFAULT_TIMEOUT_MS);
|
|
24081
|
-
let response;
|
|
24082
|
-
let responseText;
|
|
24083
|
-
try {
|
|
24084
|
-
response = await fetch(uri, {
|
|
24085
|
-
method,
|
|
24086
|
-
signal: abort.signal,
|
|
24087
|
-
...body !== void 0 && {
|
|
24088
|
-
headers: { "Content-Type": "application/json" },
|
|
24089
|
-
body: JSON.stringify(body)
|
|
24090
|
-
}
|
|
24091
|
-
});
|
|
24092
|
-
responseText = await response.text();
|
|
24093
|
-
} catch (error) {
|
|
24094
|
-
if (!signal?.aborted) {
|
|
24095
|
-
logger.warn("nado:fetch_error", {
|
|
24096
|
-
uri,
|
|
24097
|
-
method,
|
|
24098
|
-
durationMs: Date.now() - startTimeMs,
|
|
24099
|
-
error
|
|
24100
|
-
});
|
|
24101
|
-
}
|
|
24102
|
-
throw new NadoGatewayError(
|
|
24103
|
-
`An error occurred trying to reach Nado: ${error}`,
|
|
24104
|
-
{ kind: isTimeoutError(error) ? "timeout" : "transport" }
|
|
24105
|
-
);
|
|
24106
|
-
} finally {
|
|
24107
|
-
abort.cleanup();
|
|
24108
|
-
}
|
|
24109
|
-
if (!response.ok) {
|
|
24110
|
-
logger.warn("nado:fetch_failed", {
|
|
24111
|
-
uri,
|
|
24112
|
-
method,
|
|
24113
|
-
status: response.status,
|
|
24114
|
-
durationMs: Date.now() - startTimeMs,
|
|
24115
|
-
bodyPreview: responseText.slice(0, LOGGED_BODY_MAX_CHARS)
|
|
24116
|
-
});
|
|
24117
|
-
throw new NadoGatewayError(
|
|
24118
|
-
response.status === 429 ? "Nado rate limit exceeded" : `Nado request failed with status ${response.status}`,
|
|
24119
|
-
{ kind: "http", httpStatus: response.status }
|
|
24120
|
-
);
|
|
24121
|
-
}
|
|
24122
|
-
let json;
|
|
24123
|
-
try {
|
|
24124
|
-
json = JSON.parse(responseText);
|
|
24125
|
-
} catch {
|
|
24126
|
-
json = void 0;
|
|
24127
|
-
}
|
|
24128
|
-
if (json == null) {
|
|
24129
|
-
logger.warn("nado:fetch_failed", {
|
|
24130
|
-
uri,
|
|
24131
|
-
method,
|
|
24132
|
-
status: response.status,
|
|
24133
|
-
bodyPreview: responseText.slice(0, LOGGED_BODY_MAX_CHARS)
|
|
24134
|
-
});
|
|
24135
|
-
throw new NadoGatewayError("Nado returned an invalid success response", {
|
|
24136
|
-
kind: "transport",
|
|
24137
|
-
httpStatus: response.status
|
|
24138
|
-
});
|
|
24139
|
-
}
|
|
24140
|
-
logger.debug("nado:fetch", {
|
|
24141
|
-
uri,
|
|
24142
|
-
method,
|
|
24143
|
-
status: response.status,
|
|
24144
|
-
durationMs: Date.now() - startTimeMs,
|
|
24145
|
-
bytes: responseText.length
|
|
24146
|
-
});
|
|
24147
|
-
return json;
|
|
24148
|
-
}
|
|
24149
|
-
|
|
24150
|
-
// src/clients/internal/nado/gateway.ts
|
|
24151
|
-
function parseNadoGatewayResponse(response, uri) {
|
|
24152
|
-
if (response.status !== "success") {
|
|
24153
|
-
logger.warn("nado:gateway_rejected", {
|
|
24154
|
-
uri,
|
|
24155
|
-
error: response.error,
|
|
24156
|
-
errorCode: response.error_code
|
|
24157
|
-
});
|
|
24158
|
-
throw createNadoGatewayError(response, "Nado gateway request failed");
|
|
24159
|
-
}
|
|
24160
|
-
return response.data;
|
|
24161
|
-
}
|
|
24162
|
-
async function nadoQuery(params, signal) {
|
|
24163
|
-
const uri = `${NADO_GATEWAY_URL}/query?${new URLSearchParams(params)}`;
|
|
24164
|
-
const response = await nadoFetch({
|
|
24165
|
-
uri,
|
|
24166
|
-
method: "GET",
|
|
24167
|
-
signal
|
|
24168
|
-
});
|
|
24169
|
-
const data = parseNadoGatewayResponse(response, uri);
|
|
24170
|
-
if (data === void 0) {
|
|
24171
|
-
throw new NadoGatewayError("Nado returned success without data", {
|
|
24172
|
-
kind: "api"
|
|
24173
|
-
});
|
|
24174
|
-
}
|
|
24175
|
-
return data;
|
|
24176
|
-
}
|
|
24177
|
-
async function getNadoMaxWithdrawable(params, signal) {
|
|
24178
|
-
const data = await nadoQuery(
|
|
24179
|
-
{
|
|
24180
|
-
type: "max_withdrawable",
|
|
24181
|
-
product_id: params.productId.toString(),
|
|
24182
|
-
sender: params.sender,
|
|
24183
|
-
spot_leverage: params.spotLeverage ? "true" : "false"
|
|
24184
|
-
},
|
|
24185
|
-
signal
|
|
24186
|
-
);
|
|
24187
|
-
return data.max_withdrawable;
|
|
24188
|
-
}
|
|
24189
|
-
async function getNadoFeeRates(sender, signal) {
|
|
24190
|
-
return nadoQuery({ type: "fee_rates", sender }, signal);
|
|
24191
|
-
}
|
|
24192
|
-
|
|
24193
|
-
// src/clients/internal/nado/hooks.ts
|
|
24194
|
-
var MAX_WITHDRAWABLE_QUERY_KEY = "nadoMaxWithdrawable";
|
|
24195
|
-
var MAX_WITHDRAWABLE_REFETCH_MS = 3e4;
|
|
24196
|
-
var FEE_RATES_STALE_MS = 5 * 6e4;
|
|
24197
|
-
var SETTLEMENT_TIMEOUT_MS = 10 * 6e4;
|
|
24198
|
-
function shouldRetryNadoQuery(failureCount, error) {
|
|
24199
|
-
if (error instanceof NadoGatewayError && (error.kind === "api" || error.kind === "timeout" || error.httpStatus === 429)) {
|
|
24200
|
-
return false;
|
|
24201
|
-
}
|
|
24202
|
-
return failureCount < 2;
|
|
24203
|
-
}
|
|
24204
|
-
function useNadoMaxWithdrawable(params) {
|
|
24205
|
-
const { productId, sender, spotLeverage } = params;
|
|
24206
|
-
return useQuery13({
|
|
24207
|
-
queryKey: [MAX_WITHDRAWABLE_QUERY_KEY, sender, productId, spotLeverage],
|
|
24208
|
-
queryFn: productId !== void 0 && sender ? ({ signal }) => getNadoMaxWithdrawable({ productId, sender, spotLeverage }, signal) : skipToken,
|
|
24209
|
-
refetchInterval: MAX_WITHDRAWABLE_REFETCH_MS,
|
|
24210
|
-
retry: shouldRetryNadoQuery,
|
|
24211
|
-
// Toggling borrow re-keys the query, and the empty gap would flash the
|
|
24212
|
-
// balance to 0 ("insufficient" past any typed amount), so hold the last
|
|
24213
|
-
// answer while the next one loads — unless it could read too high.
|
|
24214
|
-
placeholderData: (previous, previousQuery) => {
|
|
24215
|
-
const [, previousSender, previousProductId, previousSpotLeverage] = previousQuery?.queryKey ?? [];
|
|
24216
|
-
const isSameAccountAndProduct = previousSender === sender && previousProductId === productId;
|
|
24217
|
-
const borrowTurnedOff = previousSpotLeverage === true && !spotLeverage;
|
|
24218
|
-
return isSameAccountAndProduct && !borrowTurnedOff ? previous : void 0;
|
|
24219
|
-
}
|
|
24220
|
-
});
|
|
24221
|
-
}
|
|
24222
|
-
function useInvalidateNadoMaxWithdrawable() {
|
|
24223
|
-
const queryClient = useQueryClient3();
|
|
24224
|
-
return useCallback26(() => {
|
|
24225
|
-
queryClient.invalidateQueries({ queryKey: [MAX_WITHDRAWABLE_QUERY_KEY] });
|
|
24226
|
-
}, [queryClient]);
|
|
24227
|
-
}
|
|
24228
|
-
function useNadoFeeRates(sender) {
|
|
24229
|
-
return useQuery13({
|
|
24230
|
-
queryKey: ["nadoFeeRates", sender],
|
|
24231
|
-
queryFn: sender ? ({ signal }) => getNadoFeeRates(sender, signal) : skipToken,
|
|
24232
|
-
staleTime: FEE_RATES_STALE_MS,
|
|
24233
|
-
retry: shouldRetryNadoQuery
|
|
24234
|
-
});
|
|
24235
|
-
}
|
|
23996
|
+
import { useInvalidateNadoMaxWithdrawable } from "@funkit/connect-core/clients/nado";
|
|
24236
23997
|
|
|
24237
23998
|
// src/clients/internal/nado/withdrawalForm.ts
|
|
24238
|
-
import {
|
|
24239
|
-
import {
|
|
23999
|
+
import { safeBigInt } from "@funkit/connect-core";
|
|
24000
|
+
import {
|
|
24001
|
+
useNadoFeeRates,
|
|
24002
|
+
useNadoMaxWithdrawable,
|
|
24003
|
+
x18ToRawBaseUnit,
|
|
24004
|
+
x18ToTokenUnits
|
|
24005
|
+
} from "@funkit/connect-core/clients/nado";
|
|
24006
|
+
import { useEffect as useEffect37, useMemo as useMemo36, useState as useState35 } from "react";
|
|
24007
|
+
import { formatUnits as formatUnits5 } from "viem";
|
|
24240
24008
|
|
|
24241
24009
|
// src/hooks/useAssetPrice.ts
|
|
24242
|
-
import {
|
|
24243
|
-
|
|
24244
|
-
} from "@funkit/api-base";
|
|
24245
|
-
import {
|
|
24246
|
-
convertFunToRelayTokenAddress,
|
|
24247
|
-
getRelayAssetPriceInfo
|
|
24248
|
-
} from "@funkit/fun-relay";
|
|
24249
|
-
import { skipToken as skipToken2, useQuery as useQuery14 } from "@tanstack/react-query";
|
|
24250
|
-
async function getFormattedRelayAssetPriceInfo({
|
|
24251
|
-
chainId: chainId2,
|
|
24252
|
-
assetTokenAddress
|
|
24253
|
-
}) {
|
|
24254
|
-
try {
|
|
24255
|
-
const relayResponse = await getRelayAssetPriceInfo({
|
|
24256
|
-
chainId: chainId2,
|
|
24257
|
-
address: convertFunToRelayTokenAddress(
|
|
24258
|
-
assetTokenAddress,
|
|
24259
|
-
Number(chainId2)
|
|
24260
|
-
)
|
|
24261
|
-
});
|
|
24262
|
-
return {
|
|
24263
|
-
unitPrice: relayResponse.price,
|
|
24264
|
-
amount: 1,
|
|
24265
|
-
total: 1
|
|
24266
|
-
};
|
|
24267
|
-
} catch (error) {
|
|
24268
|
-
logger.error("Unable to fetch token price from Relay", error);
|
|
24269
|
-
throw error;
|
|
24270
|
-
}
|
|
24271
|
-
}
|
|
24272
|
-
async function getAssetPriceInfoWithFallback({
|
|
24273
|
-
apiKey,
|
|
24274
|
-
chainId: chainId2,
|
|
24275
|
-
assetTokenAddress
|
|
24276
|
-
}) {
|
|
24277
|
-
try {
|
|
24278
|
-
return await getAssetPriceInfo3({
|
|
24279
|
-
apiKey,
|
|
24280
|
-
assetTokenAddress,
|
|
24281
|
-
chainId: chainId2,
|
|
24282
|
-
logger
|
|
24283
|
-
});
|
|
24284
|
-
} catch (primaryError) {
|
|
24285
|
-
logger.warn(
|
|
24286
|
-
"Unable to fetch token price from Primary provider, trying fallback",
|
|
24287
|
-
{ primaryError }
|
|
24288
|
-
);
|
|
24289
|
-
return await getFormattedRelayAssetPriceInfo({ chainId: chainId2, assetTokenAddress });
|
|
24290
|
-
}
|
|
24291
|
-
}
|
|
24010
|
+
import { getAssetPriceInfoWithFallback } from "@funkit/connect-core";
|
|
24011
|
+
import { skipToken, useQuery as useQuery13 } from "@tanstack/react-query";
|
|
24292
24012
|
function useAssetAddressPrice({
|
|
24293
24013
|
chainId: chainId2,
|
|
24294
24014
|
assetTokenAddress,
|
|
@@ -24299,13 +24019,14 @@ function useAssetAddressPrice({
|
|
|
24299
24019
|
}) {
|
|
24300
24020
|
const { apiKey } = useFunkitConfig();
|
|
24301
24021
|
const isStablecoin = useIsStablecoin();
|
|
24302
|
-
const { data, error, isLoading } =
|
|
24022
|
+
const { data, error, isLoading } = useQuery13({
|
|
24303
24023
|
queryKey: ["getAssetPriceInfo", chainId2, assetTokenAddress],
|
|
24304
24024
|
queryFn: enabled && chainId2 && assetTokenAddress ? () => getAssetPriceInfoWithFallback({
|
|
24305
24025
|
apiKey,
|
|
24306
24026
|
chainId: chainId2,
|
|
24307
|
-
assetTokenAddress
|
|
24308
|
-
|
|
24027
|
+
assetTokenAddress,
|
|
24028
|
+
logger
|
|
24029
|
+
}) : skipToken,
|
|
24309
24030
|
refetchInterval
|
|
24310
24031
|
});
|
|
24311
24032
|
const unitPrice = symbol && isStablecoin(symbol) ? 1 : data?.unitPrice;
|
|
@@ -24316,20 +24037,6 @@ function useAssetAddressPrice({
|
|
|
24316
24037
|
};
|
|
24317
24038
|
}
|
|
24318
24039
|
|
|
24319
|
-
// src/utils/safeBigInt.ts
|
|
24320
|
-
function safeBigInt(value, fallback2) {
|
|
24321
|
-
if (typeof value === "bigint") {
|
|
24322
|
-
return value;
|
|
24323
|
-
}
|
|
24324
|
-
if (typeof value === "number") {
|
|
24325
|
-
return Number.isFinite(value) && Number.isInteger(value) ? BigInt(value) : fallback2;
|
|
24326
|
-
}
|
|
24327
|
-
if (typeof value === "string" && /^-?\d+$/.test(value)) {
|
|
24328
|
-
return BigInt(value);
|
|
24329
|
-
}
|
|
24330
|
-
return fallback2;
|
|
24331
|
-
}
|
|
24332
|
-
|
|
24333
24040
|
// src/clients/internal/nado/withdrawalForm.ts
|
|
24334
24041
|
var PRICE_REFRESH_MS = 6e4;
|
|
24335
24042
|
function isNadoSourceToken(option) {
|
|
@@ -24347,7 +24054,7 @@ function getMaxEnterableAmount({
|
|
|
24347
24054
|
}
|
|
24348
24055
|
const maxRaw = x18ToRawBaseUnit(max, decimals);
|
|
24349
24056
|
const feeRaw = x18ToRawBaseUnit(sequencerFee, decimals);
|
|
24350
|
-
return
|
|
24057
|
+
return formatUnits5(maxRaw + feeRaw, decimals);
|
|
24351
24058
|
}
|
|
24352
24059
|
function getSequencerFee(feeRates, option) {
|
|
24353
24060
|
if (!option) {
|
|
@@ -24364,18 +24071,20 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
|
|
|
24364
24071
|
const isNado = !!nadoConfig;
|
|
24365
24072
|
const subaccount = nadoConfig?.customerConfig.subaccount;
|
|
24366
24073
|
const { t } = useFunkitTranslation();
|
|
24367
|
-
const [spotLeverage, setSpotLeverage] = useState35(
|
|
24368
|
-
|
|
24369
|
-
|
|
24370
|
-
|
|
24371
|
-
|
|
24074
|
+
const [spotLeverage, setSpotLeverage] = useState35(
|
|
24075
|
+
() => nadoConfig?.defaultSpotLeverage ?? false
|
|
24076
|
+
);
|
|
24077
|
+
const { data: feeRates } = useNadoFeeRates({ sender: subaccount, logger });
|
|
24078
|
+
useEffect37(() => {
|
|
24079
|
+
setSpotLeverage(nadoConfig?.defaultSpotLeverage ?? false);
|
|
24080
|
+
}, [subaccount, nadoConfig?.defaultSpotLeverage]);
|
|
24372
24081
|
const amountToggle = {
|
|
24373
24082
|
label: t("withdrawal.enableBorrowing"),
|
|
24374
24083
|
tooltip: t("withdrawal.enableBorrowingTooltip"),
|
|
24375
24084
|
checked: spotLeverage,
|
|
24376
24085
|
onChange: setSpotLeverage
|
|
24377
24086
|
};
|
|
24378
|
-
const sourceOptions =
|
|
24087
|
+
const sourceOptions = useMemo36(
|
|
24379
24088
|
() => (nadoConfig?.sourceTokens ?? []).filter(isNadoSourceToken).map(({ asset, customData, symbol, iconSrc }) => ({
|
|
24380
24089
|
productId: customData.productId,
|
|
24381
24090
|
symbol,
|
|
@@ -24399,7 +24108,8 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
|
|
|
24399
24108
|
const { data: maxWithdrawableX18 } = useNadoMaxWithdrawable({
|
|
24400
24109
|
productId: selectedOption?.productId,
|
|
24401
24110
|
sender: subaccount,
|
|
24402
|
-
spotLeverage
|
|
24111
|
+
spotLeverage,
|
|
24112
|
+
logger
|
|
24403
24113
|
});
|
|
24404
24114
|
const sequencerFee = getSequencerFee(feeRates, selectedOption);
|
|
24405
24115
|
const withdrawableBalanceTokenUnits = getMaxEnterableAmount({
|
|
@@ -24440,12 +24150,12 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
|
|
|
24440
24150
|
import React130 from "react";
|
|
24441
24151
|
|
|
24442
24152
|
// src/components/Dropdown/ChainDropdown.tsx
|
|
24443
|
-
import React128, { useMemo as
|
|
24153
|
+
import React128, { useMemo as useMemo38 } from "react";
|
|
24444
24154
|
|
|
24445
24155
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
24446
24156
|
import { isMobile as isMobile4 } from "@funkit/utils";
|
|
24447
24157
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
24448
|
-
import React126, { useCallback as useCallback27, useEffect as
|
|
24158
|
+
import React126, { useCallback as useCallback27, useEffect as useEffect38, useMemo as useMemo37, useRef as useRef17, useState as useState36 } from "react";
|
|
24449
24159
|
|
|
24450
24160
|
// src/components/FunNoResults/FunNoResults.tsx
|
|
24451
24161
|
import React123 from "react";
|
|
@@ -24688,9 +24398,10 @@ var baseStyles2 = "_1dewiqw0";
|
|
|
24688
24398
|
|
|
24689
24399
|
// src/components/Dropdown/BaseDropdown.css.ts
|
|
24690
24400
|
var BORDER_RADIUS = "dropdown";
|
|
24691
|
-
var baseDropdownItemWrapperStyles = "
|
|
24692
|
-
var
|
|
24693
|
-
var
|
|
24401
|
+
var baseDropdownItemWrapperStyles = "_1nns6ys6 _1rsrm2f17";
|
|
24402
|
+
var dropdownContentAnimationStyles = "_1nns6ys2";
|
|
24403
|
+
var scrollGradientWrapperStyles = "_1nns6ys4";
|
|
24404
|
+
var scrollableDropdownStyles = "_1nns6ys3";
|
|
24694
24405
|
|
|
24695
24406
|
// src/components/Dropdown/BaseActiveDropdownItem.tsx
|
|
24696
24407
|
function BaseActiveDropdownItem({
|
|
@@ -24912,21 +24623,21 @@ function BaseDropdown({
|
|
|
24912
24623
|
const [isOpened, setIsOpened] = useState36(false);
|
|
24913
24624
|
const [searchInput, setSearchInput] = useState36("");
|
|
24914
24625
|
const { ref: scrollRef, hasTopDivider, isAtBottom } = useScrollDivider();
|
|
24915
|
-
const allOptions =
|
|
24626
|
+
const allOptions = useMemo37(
|
|
24916
24627
|
() => buildAllOptions(options, allowUnselect, unselectLabel),
|
|
24917
24628
|
[options, allowUnselect, unselectLabel]
|
|
24918
24629
|
);
|
|
24919
24630
|
const selectedOption = allOptions.find((option) => option.value === value);
|
|
24920
|
-
const prevIsOpenedRef =
|
|
24921
|
-
const portalThemeRef =
|
|
24631
|
+
const prevIsOpenedRef = useRef17(false);
|
|
24632
|
+
const portalThemeRef = useRef17(null);
|
|
24922
24633
|
const handleSearch = (event) => {
|
|
24923
24634
|
setSearchInput(event.target.value);
|
|
24924
24635
|
};
|
|
24925
|
-
const filteredOptions =
|
|
24636
|
+
const filteredOptions = useMemo37(
|
|
24926
24637
|
() => filterOptions(allOptions, searchInput),
|
|
24927
24638
|
[allOptions, searchInput]
|
|
24928
24639
|
);
|
|
24929
|
-
const { organizedGroups, organizedOptions } =
|
|
24640
|
+
const { organizedGroups, organizedOptions } = useMemo37(
|
|
24930
24641
|
() => organizeDropdownGroups(
|
|
24931
24642
|
filteredOptions,
|
|
24932
24643
|
groups,
|
|
@@ -24946,7 +24657,7 @@ function BaseDropdown({
|
|
|
24946
24657
|
},
|
|
24947
24658
|
[onOpen, resetSearchOnClose]
|
|
24948
24659
|
);
|
|
24949
|
-
|
|
24660
|
+
useEffect38(() => {
|
|
24950
24661
|
if (isOpened && !prevIsOpenedRef.current) {
|
|
24951
24662
|
prevIsOpenedRef.current = true;
|
|
24952
24663
|
if (selectedOption) {
|
|
@@ -25002,7 +24713,7 @@ function BaseDropdown({
|
|
|
25002
24713
|
side: dropdownSide,
|
|
25003
24714
|
sideOffset: dropdownSide === "top" ? 8 : 6,
|
|
25004
24715
|
align: dropdownAlign,
|
|
25005
|
-
className:
|
|
24716
|
+
className: dropdownContentAnimationStyles,
|
|
25006
24717
|
style: {
|
|
25007
24718
|
zIndex: `calc(${themeVars.modalZIndex} + 1)`,
|
|
25008
24719
|
width: dropdownWidth ? `${dropdownWidth}px` : openDropdownFullWidth ? "var(--radix-dropdown-menu-trigger-width)" : void 0,
|
|
@@ -25243,20 +24954,20 @@ var ChainDropdown = ({
|
|
|
25243
24954
|
}) => {
|
|
25244
24955
|
const { t } = useFunkitTranslation();
|
|
25245
24956
|
const getChainMetadata = useChainMetadata();
|
|
25246
|
-
const chainIds =
|
|
24957
|
+
const chainIds = useMemo38(() => {
|
|
25247
24958
|
const availableChainIds = new Set(Object.keys(assets).map(Number));
|
|
25248
24959
|
const priorityIds = (chainIdSortOrder ?? []).filter(
|
|
25249
24960
|
(id) => availableChainIds.has(id)
|
|
25250
24961
|
);
|
|
25251
24962
|
return [.../* @__PURE__ */ new Set([...priorityIds, ...availableChainIds])];
|
|
25252
24963
|
}, [assets, chainIdSortOrder]);
|
|
25253
|
-
const options =
|
|
24964
|
+
const options = useMemo38(() => {
|
|
25254
24965
|
return chainIds.map((chainId2) => ({
|
|
25255
24966
|
label: getChainMetadata(chainId2)?.name ?? "",
|
|
25256
24967
|
value: chainId2.toString()
|
|
25257
24968
|
}));
|
|
25258
24969
|
}, [chainIds, getChainMetadata]);
|
|
25259
|
-
const preloadIconUrls =
|
|
24970
|
+
const preloadIconUrls = useMemo38(
|
|
25260
24971
|
() => chainIds.map((id) => getChainMetadata(id)?.iconUrl).filter((url) => typeof url === "string"),
|
|
25261
24972
|
[chainIds, getChainMetadata]
|
|
25262
24973
|
);
|
|
@@ -25353,7 +25064,7 @@ var ChainDropdown = ({
|
|
|
25353
25064
|
};
|
|
25354
25065
|
|
|
25355
25066
|
// src/components/Dropdown/TokenDropdown.tsx
|
|
25356
|
-
import React129, { useMemo as
|
|
25067
|
+
import React129, { useMemo as useMemo39, useState as useState37 } from "react";
|
|
25357
25068
|
var TOKEN_ICON_SIZE = 16;
|
|
25358
25069
|
var useNewTokens = () => {
|
|
25359
25070
|
const bannerData = useNewTokenBanner();
|
|
@@ -25379,7 +25090,7 @@ var TokenDropdown = ({
|
|
|
25379
25090
|
const enabledTokens = selectedChainId ? assets[selectedChainId] : void 0;
|
|
25380
25091
|
const [isTouched, setIsTouched] = useState37(false);
|
|
25381
25092
|
const [selectedSymbol, setSelectedSymbol] = useState37(selectedToken);
|
|
25382
|
-
const allTokens =
|
|
25093
|
+
const allTokens = useMemo39(() => {
|
|
25383
25094
|
const tokens = new Set(Object.values(assets).flat());
|
|
25384
25095
|
const sortedTokens = [...tokens].sort((a, b) => a.localeCompare(b));
|
|
25385
25096
|
const validPriorityTokens = priorityTokenSymbols?.filter(
|
|
@@ -25391,13 +25102,13 @@ var TokenDropdown = ({
|
|
|
25391
25102
|
return sortedTokens;
|
|
25392
25103
|
}, [assets, priorityTokenSymbols]);
|
|
25393
25104
|
const { newTokens, newSymbol } = useNewTokens();
|
|
25394
|
-
const options =
|
|
25105
|
+
const options = useMemo39(() => {
|
|
25395
25106
|
return allTokens.map((symbol) => ({
|
|
25396
25107
|
label: symbol,
|
|
25397
25108
|
value: symbol
|
|
25398
25109
|
}));
|
|
25399
25110
|
}, [allTokens]);
|
|
25400
|
-
const groups =
|
|
25111
|
+
const groups = useMemo39(() => {
|
|
25401
25112
|
if (!popularTokenSymbols?.length) {
|
|
25402
25113
|
return [];
|
|
25403
25114
|
}
|
|
@@ -25646,13 +25357,13 @@ import React134 from "react";
|
|
|
25646
25357
|
import React133, { useState as useState38 } from "react";
|
|
25647
25358
|
|
|
25648
25359
|
// src/hooks/useInterval.ts
|
|
25649
|
-
import { useEffect as
|
|
25360
|
+
import { useEffect as useEffect39, useRef as useRef18 } from "react";
|
|
25650
25361
|
function useInterval(callback, delay) {
|
|
25651
|
-
const savedCallback =
|
|
25362
|
+
const savedCallback = useRef18(callback);
|
|
25652
25363
|
useIsomorphicLayoutEffect(() => {
|
|
25653
25364
|
savedCallback.current = callback;
|
|
25654
25365
|
}, [callback]);
|
|
25655
|
-
|
|
25366
|
+
useEffect39(() => {
|
|
25656
25367
|
const id = setInterval(() => {
|
|
25657
25368
|
savedCallback.current();
|
|
25658
25369
|
}, delay);
|
|
@@ -25949,7 +25660,7 @@ function FunNotification({
|
|
|
25949
25660
|
|
|
25950
25661
|
// src/hooks/queries/useWithdrawalQuote.ts
|
|
25951
25662
|
import { isTokenEquivalent as isTokenEquivalent6 } from "@funkit/utils";
|
|
25952
|
-
import { useQuery as
|
|
25663
|
+
import { useQuery as useQuery14 } from "@tanstack/react-query";
|
|
25953
25664
|
|
|
25954
25665
|
// src/hooks/useIsBlacklistedWithdrawalAddress.ts
|
|
25955
25666
|
import { isBlacklistedWithdrawalAddress } from "@funkit/connect-core";
|
|
@@ -25999,7 +25710,7 @@ function useWithdrawalQuote({
|
|
|
25999
25710
|
secondTokenAddress: selectedTokenAddress
|
|
26000
25711
|
});
|
|
26001
25712
|
const { logEvent } = useTrack();
|
|
26002
|
-
const query =
|
|
25713
|
+
const query = useQuery14({
|
|
26003
25714
|
queryKey: [
|
|
26004
25715
|
"withdrawal",
|
|
26005
25716
|
"quote",
|
|
@@ -26066,14 +25777,13 @@ function useWithdrawalQuote({
|
|
|
26066
25777
|
|
|
26067
25778
|
// src/hooks/queries/useWithdrawalRisk.ts
|
|
26068
25779
|
import { isWithdrawalRisky } from "@funkit/connect-core";
|
|
26069
|
-
import { useQuery as
|
|
25780
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
26070
25781
|
var useWithdrawalRisk = (apiKey, receiveAddress, chainId2) => {
|
|
26071
|
-
return
|
|
26072
|
-
|
|
26073
|
-
// the fetcher doesn't use it — chainId only gates `enabled` below.
|
|
26074
|
-
queryKey: ["withdrawal", "addressRisk", apiKey, receiveAddress],
|
|
25782
|
+
return useQuery15({
|
|
25783
|
+
queryKey: ["withdrawal", "addressRisk", apiKey, receiveAddress, chainId2],
|
|
26075
25784
|
queryFn: () => isWithdrawalRisky({
|
|
26076
25785
|
address: receiveAddress,
|
|
25786
|
+
chainId: chainId2?.toString(),
|
|
26077
25787
|
apiKey,
|
|
26078
25788
|
logger,
|
|
26079
25789
|
screeningDisabled: checkFeatureGate("disable-frontend-chainalysis")
|
|
@@ -26092,30 +25802,18 @@ var useWithdrawalRisk = (apiKey, receiveAddress, chainId2) => {
|
|
|
26092
25802
|
};
|
|
26093
25803
|
|
|
26094
25804
|
// src/hooks/track/analytics/useWithdrawalAnalytics.ts
|
|
26095
|
-
import { useCallback as useCallback28
|
|
25805
|
+
import { useCallback as useCallback28 } from "react";
|
|
26096
25806
|
function useWithdrawalAnalytics() {
|
|
26097
|
-
const
|
|
25807
|
+
const logEventV2 = useTrackV2();
|
|
26098
25808
|
const { checkoutItem } = useCheckoutContext();
|
|
26099
|
-
const { apiKey } = useFunkitConfig();
|
|
26100
|
-
const { connectorId, userInfo } = useGeneralWallet();
|
|
26101
25809
|
const checkoutId = checkoutItem?.id;
|
|
26102
|
-
const commonWithdrawalProperties = useMemo41(
|
|
26103
|
-
() => ({
|
|
26104
|
-
api_key: apiKey,
|
|
26105
|
-
connector_name: connectorId ? userInfo.typeLabel || null : null,
|
|
26106
|
-
flow: "withdraw",
|
|
26107
|
-
user_id: userInfo.id && userInfo.id !== "0x" ? userInfo.id : null
|
|
26108
|
-
}),
|
|
26109
|
-
[apiKey, connectorId, userInfo]
|
|
26110
|
-
);
|
|
26111
25810
|
const trackWithdrawalAmountConfirmed = useCallback28(
|
|
26112
25811
|
(args) => {
|
|
26113
25812
|
if (!checkoutId) {
|
|
26114
25813
|
return;
|
|
26115
25814
|
}
|
|
26116
25815
|
logEventV2("fc_withdrawal_amount_confirmed" /* WITHDRAWAL_AMOUNT_CONFIRMED */, () => ({
|
|
26117
|
-
|
|
26118
|
-
checkout_id: checkoutId,
|
|
25816
|
+
flow: "withdraw",
|
|
26119
25817
|
payment_method: PaymentMethod.ACCOUNT_BALANCE,
|
|
26120
25818
|
provider: null,
|
|
26121
25819
|
select_type: args.selectType,
|
|
@@ -26130,7 +25828,7 @@ function useWithdrawalAnalytics() {
|
|
|
26130
25828
|
trade_type: "EXACT_IN" /* EXACT_IN */
|
|
26131
25829
|
}));
|
|
26132
25830
|
},
|
|
26133
|
-
[
|
|
25831
|
+
[logEventV2]
|
|
26134
25832
|
);
|
|
26135
25833
|
return { trackWithdrawalAmountConfirmed };
|
|
26136
25834
|
}
|
|
@@ -26138,7 +25836,7 @@ function useWithdrawalAnalytics() {
|
|
|
26138
25836
|
// src/utils/polymarket.ts
|
|
26139
25837
|
import {
|
|
26140
25838
|
encodeAbiParameters,
|
|
26141
|
-
getAddress as
|
|
25839
|
+
getAddress as getAddress3,
|
|
26142
25840
|
getCreate2Address,
|
|
26143
25841
|
keccak256,
|
|
26144
25842
|
parseAbiParameters
|
|
@@ -26146,7 +25844,7 @@ import {
|
|
|
26146
25844
|
var EOA_PROXY_WALLET_FACTORY_ADDRESS = "0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b";
|
|
26147
25845
|
var EOA_PROXY_WALLET_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";
|
|
26148
25846
|
function derivePolymarketProxyAddress(address) {
|
|
26149
|
-
return
|
|
25847
|
+
return getAddress3(
|
|
26150
25848
|
getCreate2Address({
|
|
26151
25849
|
from: EOA_PROXY_WALLET_FACTORY_ADDRESS,
|
|
26152
25850
|
salt: keccak256(
|
|
@@ -26193,7 +25891,7 @@ function getErrorNotification({
|
|
|
26193
25891
|
}
|
|
26194
25892
|
|
|
26195
25893
|
// src/modals/WithdrawalModal/RecipientAddress.tsx
|
|
26196
|
-
import React136, { useEffect as
|
|
25894
|
+
import React136, { useEffect as useEffect40, useState as useState39 } from "react";
|
|
26197
25895
|
import {
|
|
26198
25896
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8,
|
|
26199
25897
|
solanaChain as solanaChain4,
|
|
@@ -26227,7 +25925,7 @@ function useShowConnectWallet({ config }) {
|
|
|
26227
25925
|
isConnected,
|
|
26228
25926
|
connectedWalletAddress
|
|
26229
25927
|
});
|
|
26230
|
-
|
|
25928
|
+
useEffect40(() => {
|
|
26231
25929
|
logger.debug("withdrawalContent:showUseConnected", {
|
|
26232
25930
|
isConnected,
|
|
26233
25931
|
connectedWalletAddress,
|
|
@@ -26623,9 +26321,9 @@ function LighterSourceTokenDropdown({
|
|
|
26623
26321
|
side: "bottom",
|
|
26624
26322
|
sideOffset: 6,
|
|
26625
26323
|
align: "end",
|
|
26626
|
-
className:
|
|
26324
|
+
className: dropdownContentAnimationStyles,
|
|
26627
26325
|
style: {
|
|
26628
|
-
zIndex:
|
|
26326
|
+
zIndex: `calc(${themeVars.modalZIndex} + 1)`,
|
|
26629
26327
|
// Track the chip width as a floor only — a short selection (e.g.
|
|
26630
26328
|
// "LIT") must not squeeze longer labels ("USDC (Perps)") into
|
|
26631
26329
|
// wrapping; the menu grows to its widest item instead.
|
|
@@ -26816,10 +26514,10 @@ function getRelayOutputCurrencyAmount(quote, fallback2) {
|
|
|
26816
26514
|
}
|
|
26817
26515
|
|
|
26818
26516
|
// src/modals/WithdrawalModal/withdrawalHooks.tsx
|
|
26819
|
-
import { useCallback as useCallback29, useEffect as
|
|
26517
|
+
import { useCallback as useCallback29, useEffect as useEffect42, useRef as useRef19 } from "react";
|
|
26820
26518
|
|
|
26821
26519
|
// src/hooks/useTokenAndChainDropdown.ts
|
|
26822
|
-
import { useEffect as
|
|
26520
|
+
import { useEffect as useEffect41, useState as useState41 } from "react";
|
|
26823
26521
|
import { polygon as polygon5 } from "viem/chains";
|
|
26824
26522
|
|
|
26825
26523
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
@@ -26907,12 +26605,12 @@ var useTokenAndChainDropdown = ({
|
|
|
26907
26605
|
const [selectedToken, setSelectedToken] = useState41(
|
|
26908
26606
|
noDefaultSelection ? void 0 : selectedDefaultToken
|
|
26909
26607
|
);
|
|
26910
|
-
|
|
26608
|
+
useEffect41(() => {
|
|
26911
26609
|
if (!noDefaultSelection) {
|
|
26912
26610
|
setSelectedChainId(selectedDefaultChainId);
|
|
26913
26611
|
}
|
|
26914
26612
|
}, [selectedDefaultChainId, noDefaultSelection]);
|
|
26915
|
-
|
|
26613
|
+
useEffect41(() => {
|
|
26916
26614
|
if (!noDefaultSelection) {
|
|
26917
26615
|
setSelectedToken(selectedDefaultToken);
|
|
26918
26616
|
}
|
|
@@ -27020,7 +26718,7 @@ var useFrozenSourceTokenBalance = ({
|
|
|
27020
26718
|
isWithdrawing,
|
|
27021
26719
|
sourceTokenBalance
|
|
27022
26720
|
}) => {
|
|
27023
|
-
const frozenSourceTokenBalanceRef =
|
|
26721
|
+
const frozenSourceTokenBalanceRef = useRef19(null);
|
|
27024
26722
|
if (!isWithdrawing) {
|
|
27025
26723
|
frozenSourceTokenBalanceRef.current = null;
|
|
27026
26724
|
}
|
|
@@ -27044,11 +26742,11 @@ function useWithdrawalLogging({
|
|
|
27044
26742
|
debouncedInputAmount,
|
|
27045
26743
|
debouncedInputAmountUsd
|
|
27046
26744
|
}) {
|
|
27047
|
-
const lastTargetAssetErrorRef =
|
|
27048
|
-
const lastQuoteErrorRef =
|
|
27049
|
-
const lastRiskyRecipientRef =
|
|
27050
|
-
const lastBlacklistedRecipientRef =
|
|
27051
|
-
|
|
26745
|
+
const lastTargetAssetErrorRef = useRef19(null);
|
|
26746
|
+
const lastQuoteErrorRef = useRef19(null);
|
|
26747
|
+
const lastRiskyRecipientRef = useRef19(null);
|
|
26748
|
+
const lastBlacklistedRecipientRef = useRef19(null);
|
|
26749
|
+
useEffect42(() => {
|
|
27052
26750
|
if (!targetAssetFetchError) {
|
|
27053
26751
|
return;
|
|
27054
26752
|
}
|
|
@@ -27063,7 +26761,7 @@ function useWithdrawalLogging({
|
|
|
27063
26761
|
});
|
|
27064
26762
|
lastTargetAssetErrorRef.current = errorKey;
|
|
27065
26763
|
}, [targetAssetFetchError, selectedChainId, selectedToken]);
|
|
27066
|
-
|
|
26764
|
+
useEffect42(() => {
|
|
27067
26765
|
if (!quoteErrorObject) {
|
|
27068
26766
|
return;
|
|
27069
26767
|
}
|
|
@@ -27091,7 +26789,7 @@ function useWithdrawalLogging({
|
|
|
27091
26789
|
debouncedInputAmount,
|
|
27092
26790
|
debouncedInputAmountUsd
|
|
27093
26791
|
]);
|
|
27094
|
-
|
|
26792
|
+
useEffect42(() => {
|
|
27095
26793
|
if (!isRisky) {
|
|
27096
26794
|
return;
|
|
27097
26795
|
}
|
|
@@ -27106,7 +26804,7 @@ function useWithdrawalLogging({
|
|
|
27106
26804
|
});
|
|
27107
26805
|
lastRiskyRecipientRef.current = warningKey;
|
|
27108
26806
|
}, [isRisky, recipientAddress, selectedChainId, selectedToken]);
|
|
27109
|
-
|
|
26807
|
+
useEffect42(() => {
|
|
27110
26808
|
if (!isRecipientBlacklisted) {
|
|
27111
26809
|
return;
|
|
27112
26810
|
}
|
|
@@ -27127,11 +26825,11 @@ function useWithdrawalLogging({
|
|
|
27127
26825
|
import { useState as useState43 } from "react";
|
|
27128
26826
|
|
|
27129
26827
|
// src/hooks/useAutoClearState.ts
|
|
27130
|
-
import { useCallback as useCallback30, useEffect as
|
|
26828
|
+
import { useCallback as useCallback30, useEffect as useEffect43, useRef as useRef20, useState as useState42 } from "react";
|
|
27131
26829
|
function useAutoClearState(initialValue = null) {
|
|
27132
26830
|
const [state, setState] = useState42(initialValue);
|
|
27133
|
-
const timeoutRef =
|
|
27134
|
-
|
|
26831
|
+
const timeoutRef = useRef20(void 0);
|
|
26832
|
+
useEffect43(() => {
|
|
27135
26833
|
return () => {
|
|
27136
26834
|
if (timeoutRef.current !== void 0) {
|
|
27137
26835
|
clearTimeout(timeoutRef.current);
|
|
@@ -27471,6 +27169,7 @@ function useClientSpecificWithdrawalFlow({
|
|
|
27471
27169
|
connectedAddress,
|
|
27472
27170
|
lighterAssets,
|
|
27473
27171
|
lighterFastUnstakedFee,
|
|
27172
|
+
isLighterFastUnstakedFeeFetched,
|
|
27474
27173
|
invalidateLighterAccount
|
|
27475
27174
|
} = useLighterWithdrawal(config, setRecipientAddress);
|
|
27476
27175
|
const lighterSecureMainnetAddress = isLighterSecure ? getLighterSecureMainnetAddress(selectedSourceToken) : void 0;
|
|
@@ -27623,6 +27322,10 @@ function useClientSpecificWithdrawalFlow({
|
|
|
27623
27322
|
// Both fees are 0 outside their own flow, so summing is safe. Resolved here
|
|
27624
27323
|
// so the shared flow never has to name a client.
|
|
27625
27324
|
clientFlatFeeTokens: lighterFastUnstakedFee + nadoSequencerFeeTokenAmount,
|
|
27325
|
+
// Gates quoting: Lighter Fast's fee is 0 (not yet real) until this flips
|
|
27326
|
+
// true, so quoting earlier would show an amount that changes underneath
|
|
27327
|
+
// the user once the real fee arrives.
|
|
27328
|
+
isClientFlatFeeSettled: isLighterFastUnstakedFeeFetched,
|
|
27626
27329
|
// Only Nado's: Lighter Fast's unstaked fee already lands inside the relay
|
|
27627
27330
|
// quote's own gas figure, so adding it again would double-count it.
|
|
27628
27331
|
clientSourceChainGasUsd: nadoSequencerFeeUsd,
|
|
@@ -27674,6 +27377,7 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27674
27377
|
clientSourceTokenBalance,
|
|
27675
27378
|
clientSourceTokenUsdPrice: sourceTokenUsdPrice,
|
|
27676
27379
|
clientFlatFeeTokens,
|
|
27380
|
+
isClientFlatFeeSettled,
|
|
27677
27381
|
buildClientSubmitCustomerData,
|
|
27678
27382
|
isL1FallbackAvailable,
|
|
27679
27383
|
isSubmittingL1,
|
|
@@ -27697,7 +27401,8 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27697
27401
|
},
|
|
27698
27402
|
// Same precedence: a declared option describes itself, else the client does.
|
|
27699
27403
|
customData: selectedOption?.customData ?? clientSourceCustomData
|
|
27700
|
-
}
|
|
27404
|
+
},
|
|
27405
|
+
logger
|
|
27701
27406
|
);
|
|
27702
27407
|
const sourceTokenBalance = integratorBalance ?? clientSourceTokenBalance ?? "0";
|
|
27703
27408
|
const { displayedSourceTokenBalance, freezeDisplayedSourceTokenBalance } = useFrozenSourceTokenBalance({
|
|
@@ -27745,10 +27450,10 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27745
27450
|
targetAmount: confirmedTarget.amount
|
|
27746
27451
|
});
|
|
27747
27452
|
}
|
|
27748
|
-
|
|
27453
|
+
useEffect44(() => {
|
|
27749
27454
|
updateWithdrawalSourceAssetAmount(quoteInputAmount);
|
|
27750
27455
|
}, [quoteInputAmount, updateWithdrawalSourceAssetAmount]);
|
|
27751
|
-
|
|
27456
|
+
useEffect44(() => {
|
|
27752
27457
|
if (!targetAssetAddress || !selectedChainId || !selectedToken) {
|
|
27753
27458
|
return;
|
|
27754
27459
|
}
|
|
@@ -27760,7 +27465,7 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27760
27465
|
iconSrc: getTokenIconUrl(selectedToken)
|
|
27761
27466
|
});
|
|
27762
27467
|
}, [targetAssetAddress, updateTargetAsset, selectedChainId, selectedToken]);
|
|
27763
|
-
|
|
27468
|
+
useEffect44(() => {
|
|
27764
27469
|
setTimeout(() => {
|
|
27765
27470
|
updateTargetAssetAmount(targetAssetAmount ?? 0);
|
|
27766
27471
|
}, 0);
|
|
@@ -27896,11 +27601,14 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27896
27601
|
if (isLighterSecure) {
|
|
27897
27602
|
return lighterAssetIndex !== void 0;
|
|
27898
27603
|
}
|
|
27899
|
-
return !!token && !!selectedChainId && !!quote && isValidAddressAndChain && isAmountSettled
|
|
27604
|
+
return !!token && !!selectedChainId && !!quote && isValidAddressAndChain && isAmountSettled && // ensure the amount is up to date
|
|
27605
|
+
// The flat fee (Lighter Fast's unstaked fee) reads 0 until settled — quoting
|
|
27606
|
+
// on that would show an amount that changes once the real fee arrives.
|
|
27607
|
+
isClientFlatFeeSettled;
|
|
27900
27608
|
}
|
|
27901
27609
|
const canContinue = computeCanContinue();
|
|
27902
27610
|
const isCtaDisabled = isL1FallbackAvailable ? isSubmittingL1 || disableSubmit || !canContinue : disableSubmit || !canContinue || isWithdrawing;
|
|
27903
|
-
const feesSummaryLoading = !isLighterSecure && isQuoteLoading;
|
|
27611
|
+
const feesSummaryLoading = !isLighterSecure && (isQuoteLoading || !isClientFlatFeeSettled);
|
|
27904
27612
|
const feesSummaryQuote = isLighterSecure ? void 0 : quote?.finalEstimation;
|
|
27905
27613
|
const feesSummaryUnavailable = isLighterSecure || !quoteEnabled;
|
|
27906
27614
|
const { swapImpactUsd, appFeeUsd, gasUsd } = extractRelayFeeInfo3(
|
|
@@ -27923,7 +27631,7 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27923
27631
|
selectedChainName,
|
|
27924
27632
|
t
|
|
27925
27633
|
});
|
|
27926
|
-
const errorNotification =
|
|
27634
|
+
const errorNotification = useMemo40(
|
|
27927
27635
|
() => getErrorNotification({
|
|
27928
27636
|
quoteErrorObject,
|
|
27929
27637
|
withdrawalError,
|
|
@@ -28300,8 +28008,8 @@ import React144 from "react";
|
|
|
28300
28008
|
|
|
28301
28009
|
// src/hooks/queries/useWithdrawFops.ts
|
|
28302
28010
|
import { RailConfigType as RailConfigType3, getFops as getFops3 } from "@funkit/api-base";
|
|
28303
|
-
import { useQuery as
|
|
28304
|
-
import { useMemo as
|
|
28011
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
28012
|
+
import { useMemo as useMemo41 } from "react";
|
|
28305
28013
|
import {
|
|
28306
28014
|
buildSwappedSellLimits,
|
|
28307
28015
|
buildSwappedThirdPartyPaymentConfigs as buildSwappedThirdPartyPaymentConfigs2,
|
|
@@ -28319,7 +28027,7 @@ var useWithdrawFops = (params) => {
|
|
|
28319
28027
|
} = useSwappedDefaultCurrency();
|
|
28320
28028
|
const fopPriority = useDynamicConfig("foppriority");
|
|
28321
28029
|
const sourceOverrides = useDynamicConfig("swappedwithdrawalsourceoverrides");
|
|
28322
|
-
const sourceOverride =
|
|
28030
|
+
const sourceOverride = useMemo41(
|
|
28323
28031
|
() => findSwappedSourceOverride(sourceOverrides, {
|
|
28324
28032
|
chainId: params.sourceChainId,
|
|
28325
28033
|
tokenAddress: params.sourceTokenAddress
|
|
@@ -28330,14 +28038,14 @@ var useWithdrawFops = (params) => {
|
|
|
28330
28038
|
chainId: sourceOverride.use.chainId,
|
|
28331
28039
|
address: sourceOverride.use.tokenAddress
|
|
28332
28040
|
} : { chainId: params.sourceChainId, address: params.sourceTokenAddress };
|
|
28333
|
-
const themeConfig =
|
|
28041
|
+
const themeConfig = useMemo41(
|
|
28334
28042
|
() => buildSwappedThemeQueryParams(resolveObjectCssVars(activeTheme)),
|
|
28335
28043
|
[activeTheme]
|
|
28336
28044
|
);
|
|
28337
28045
|
const userId = userInfo.id;
|
|
28338
28046
|
const countryCode = userIpInfo?.alpha2;
|
|
28339
28047
|
const isEnabled = (params.enabled ?? true) && !!apiKey && !!userId && !!userInfo.address && !!countryCode && !!params.sourceChainId && !!params.sourceTokenAddress && !isSwappedCurrencyCodeLoading;
|
|
28340
|
-
const query =
|
|
28048
|
+
const query = useQuery16({
|
|
28341
28049
|
// `prefillFiatEmail` is intentionally NOT in the queryKey: it's read inside
|
|
28342
28050
|
// `queryFn` and captured at fetch time, so post-mount changes don't trigger a refetch
|
|
28343
28051
|
queryKey: [
|
|
@@ -28434,11 +28142,11 @@ var useWithdrawFops = (params) => {
|
|
|
28434
28142
|
|
|
28435
28143
|
// src/hooks/useSwappedPreload.ts
|
|
28436
28144
|
import { isSwappedFop } from "@funkit/connect-core";
|
|
28437
|
-
import { useEffect as
|
|
28145
|
+
import { useEffect as useEffect45 } from "react";
|
|
28438
28146
|
|
|
28439
28147
|
// src/modals/CheckoutModal/SourceChange/FormOfPaymentsList.tsx
|
|
28440
28148
|
import { getFopKey, isSyntheticFop, sortFops as sortFops2 } from "@funkit/connect-core";
|
|
28441
|
-
import React143, { useRef as
|
|
28149
|
+
import React143, { useRef as useRef21, useState as useState45 } from "react";
|
|
28442
28150
|
|
|
28443
28151
|
// src/components/Icons/GlobeIcon.tsx
|
|
28444
28152
|
import React139 from "react";
|
|
@@ -28646,7 +28354,7 @@ function FormOfPaymentsContent({
|
|
|
28646
28354
|
}) {
|
|
28647
28355
|
const { t } = useFunkitTranslation();
|
|
28648
28356
|
const [isExpanded, setIsExpanded] = useState45(false);
|
|
28649
|
-
const toggleRef =
|
|
28357
|
+
const toggleRef = useRef21(null);
|
|
28650
28358
|
const { primary, secondary } = getFormOfPaymentSections(fopsData, fopPriority);
|
|
28651
28359
|
const totalItems = primary.items.length + secondary.items.length;
|
|
28652
28360
|
const showToggle = totalItems > defaultMaxItems;
|
|
@@ -28809,7 +28517,7 @@ function FormOfPaymentsList({
|
|
|
28809
28517
|
function useSwappedPreload(fopsData, mode) {
|
|
28810
28518
|
const fopPriority = useDynamicConfig("foppriority");
|
|
28811
28519
|
const { setIframeUrl } = useSwappedContext(mode);
|
|
28812
|
-
|
|
28520
|
+
useEffect45(() => {
|
|
28813
28521
|
if (!fopsData) {
|
|
28814
28522
|
setIframeUrl(null);
|
|
28815
28523
|
return;
|
|
@@ -28949,8 +28657,8 @@ function WithdrawalMethodSelect({
|
|
|
28949
28657
|
}
|
|
28950
28658
|
|
|
28951
28659
|
// src/modals/WithdrawalModal/WithdrawalSwappedIframeController.tsx
|
|
28952
|
-
import { useQueryClient as
|
|
28953
|
-
import React146, { useEffect as
|
|
28660
|
+
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
28661
|
+
import React146, { useEffect as useEffect48 } from "react";
|
|
28954
28662
|
|
|
28955
28663
|
// src/components/SwappedIframeSkeleton.tsx
|
|
28956
28664
|
import React145 from "react";
|
|
@@ -29069,7 +28777,7 @@ function SwappedIframeSkeleton({
|
|
|
29069
28777
|
}
|
|
29070
28778
|
|
|
29071
28779
|
// src/hooks/useSwappedIframeLifecycle.ts
|
|
29072
|
-
import { useEffect as
|
|
28780
|
+
import { useEffect as useEffect46, useRef as useRef22 } from "react";
|
|
29073
28781
|
var SWAPPED_IFRAME_TIMEOUT = 15e3;
|
|
29074
28782
|
function useSwappedIframeLifecycle({
|
|
29075
28783
|
fopType,
|
|
@@ -29077,13 +28785,13 @@ function useSwappedIframeLifecycle({
|
|
|
29077
28785
|
mode
|
|
29078
28786
|
}) {
|
|
29079
28787
|
const { activateIframe, deactivateIframe, isSwappedReady } = useSwappedContext(mode);
|
|
29080
|
-
const timeoutRef =
|
|
28788
|
+
const timeoutRef = useRef22(void 0);
|
|
29081
28789
|
const stableOnTimeout = useEffectEvent(onTimeout);
|
|
29082
|
-
|
|
28790
|
+
useEffect46(() => {
|
|
29083
28791
|
activateIframe(fopType);
|
|
29084
28792
|
return () => deactivateIframe();
|
|
29085
28793
|
}, [fopType, activateIframe, deactivateIframe]);
|
|
29086
|
-
|
|
28794
|
+
useEffect46(() => {
|
|
29087
28795
|
if (isSwappedReady) {
|
|
29088
28796
|
clearTimeout(timeoutRef.current);
|
|
29089
28797
|
return;
|
|
@@ -29100,9 +28808,11 @@ function useSwappedIframeLifecycle({
|
|
|
29100
28808
|
|
|
29101
28809
|
// src/modals/WithdrawalModal/useFiatWithdrawal.ts
|
|
29102
28810
|
import { getCheckoutQuoteV2 as getCheckoutQuoteV22 } from "@funkit/api-base";
|
|
29103
|
-
import { useEffect as
|
|
28811
|
+
import { useEffect as useEffect47, useRef as useRef23 } from "react";
|
|
28812
|
+
import { safeBigInt as safeBigInt2 } from "@funkit/connect-core";
|
|
29104
28813
|
import {
|
|
29105
|
-
findSwappedSourceOverride as findSwappedSourceOverride2
|
|
28814
|
+
findSwappedSourceOverride as findSwappedSourceOverride2,
|
|
28815
|
+
resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance2
|
|
29106
28816
|
} from "@funkit/connect-core";
|
|
29107
28817
|
function resolveSwappedWithdrawalLegs(config, override) {
|
|
29108
28818
|
const sourceChainId = Number(config.sourceChainId);
|
|
@@ -29118,7 +28828,9 @@ function resolveSwappedWithdrawalLegs(config, override) {
|
|
|
29118
28828
|
}
|
|
29119
28829
|
async function ensureOnSourceChain(wallet, sourceChainId) {
|
|
29120
28830
|
const currentChainId = await wallet.getChainId();
|
|
29121
|
-
if (currentChainId === sourceChainId)
|
|
28831
|
+
if (currentChainId === sourceChainId) {
|
|
28832
|
+
return;
|
|
28833
|
+
}
|
|
29122
28834
|
logger.info("fiat-withdrawal:switching_chain", {
|
|
29123
28835
|
from: currentChainId,
|
|
29124
28836
|
to: sourceChainId
|
|
@@ -29204,8 +28916,10 @@ function useFiatWithdrawal({
|
|
|
29204
28916
|
tokenAddress: config.sourceTokenAddress
|
|
29205
28917
|
})
|
|
29206
28918
|
) : null;
|
|
29207
|
-
|
|
29208
|
-
if (!legs || !checkoutItem)
|
|
28919
|
+
useEffect47(() => {
|
|
28920
|
+
if (!legs || !checkoutItem) {
|
|
28921
|
+
return;
|
|
28922
|
+
}
|
|
29209
28923
|
updateTargetAsset({
|
|
29210
28924
|
targetAsset: legs.targetTokenAddress,
|
|
29211
28925
|
targetChain: legs.targetChainId,
|
|
@@ -29221,8 +28935,8 @@ function useFiatWithdrawal({
|
|
|
29221
28935
|
legs?.targetTokenSymbol,
|
|
29222
28936
|
legs?.iconSrc
|
|
29223
28937
|
]);
|
|
29224
|
-
const isProcessingOrderRef =
|
|
29225
|
-
const submittedOrderIdsRef =
|
|
28938
|
+
const isProcessingOrderRef = useRef23(false);
|
|
28939
|
+
const submittedOrderIdsRef = useRef23(/* @__PURE__ */ new Set());
|
|
29226
28940
|
const { handleWithdrawal, withdrawalError } = useWithdrawal({
|
|
29227
28941
|
config,
|
|
29228
28942
|
withdrawalItem
|
|
@@ -29233,7 +28947,7 @@ function useFiatWithdrawal({
|
|
|
29233
28947
|
onError();
|
|
29234
28948
|
}
|
|
29235
28949
|
});
|
|
29236
|
-
|
|
28950
|
+
useEffect47(() => {
|
|
29237
28951
|
if (withdrawalError) {
|
|
29238
28952
|
handleWithdrawalFailure();
|
|
29239
28953
|
}
|
|
@@ -29270,8 +28984,12 @@ function useFiatWithdrawal({
|
|
|
29270
28984
|
}
|
|
29271
28985
|
);
|
|
29272
28986
|
const processOrder = useEffectEvent(async (order) => {
|
|
29273
|
-
if (rejectOrderBeforeStart(order))
|
|
29274
|
-
|
|
28987
|
+
if (rejectOrderBeforeStart(order)) {
|
|
28988
|
+
return;
|
|
28989
|
+
}
|
|
28990
|
+
if (!isWalletWithdrawalConfig(config) || !legs || !checkoutItem) {
|
|
28991
|
+
return;
|
|
28992
|
+
}
|
|
29275
28993
|
const { wallet } = config;
|
|
29276
28994
|
const userAddress = wallet.address();
|
|
29277
28995
|
isProcessingOrderRef.current = true;
|
|
@@ -29300,14 +29018,15 @@ function useFiatWithdrawal({
|
|
|
29300
29018
|
const { quote, estimation } = await quoteOrderExactOut(quoteContext);
|
|
29301
29019
|
let finalQuote = quote;
|
|
29302
29020
|
let finalEstimation = estimation;
|
|
29303
|
-
const balance =
|
|
29021
|
+
const balance = resolveWithdrawalSourceTokenBalance2(
|
|
29304
29022
|
withdrawalItem?.withdrawalSourceTokenBalance,
|
|
29305
29023
|
{
|
|
29306
29024
|
sourceAsset: {
|
|
29307
29025
|
tokenAddress: legs.sourceTokenAddress,
|
|
29308
29026
|
tokenChainId: String(legs.sourceChainId)
|
|
29309
29027
|
}
|
|
29310
|
-
}
|
|
29028
|
+
},
|
|
29029
|
+
logger
|
|
29311
29030
|
) ?? "0";
|
|
29312
29031
|
if (Number(balance) > 0) {
|
|
29313
29032
|
const sourceDecimals = await getTokenDecimals(
|
|
@@ -29315,7 +29034,7 @@ function useFiatWithdrawal({
|
|
|
29315
29034
|
String(legs.sourceChainId),
|
|
29316
29035
|
legs.sourceTokenAddress
|
|
29317
29036
|
);
|
|
29318
|
-
const requiredBaseUnit =
|
|
29037
|
+
const requiredBaseUnit = safeBigInt2(
|
|
29319
29038
|
quote.estTotalFromAmountBaseUnit,
|
|
29320
29039
|
0n
|
|
29321
29040
|
);
|
|
@@ -29374,7 +29093,9 @@ function useFiatWithdrawal({
|
|
|
29374
29093
|
|
|
29375
29094
|
// src/modals/WithdrawalModal/WithdrawalSwappedIframeController.tsx
|
|
29376
29095
|
function isValidOrderData(data) {
|
|
29377
|
-
if (!data || !data.order_id || !data.address)
|
|
29096
|
+
if (!data || !data.order_id || !data.address) {
|
|
29097
|
+
return false;
|
|
29098
|
+
}
|
|
29378
29099
|
const amount = Number(data.amount);
|
|
29379
29100
|
return Number.isFinite(amount) && amount > 0;
|
|
29380
29101
|
}
|
|
@@ -29388,7 +29109,7 @@ function WithdrawalSwappedIframeController({
|
|
|
29388
29109
|
}) {
|
|
29389
29110
|
const { logEvent } = useTrack();
|
|
29390
29111
|
const { t } = useFunkitTranslation();
|
|
29391
|
-
const queryClient =
|
|
29112
|
+
const queryClient = useQueryClient3();
|
|
29392
29113
|
const { withdrawalItem } = useCheckoutContext();
|
|
29393
29114
|
const { focusAmountInput, isSwappedReady, resetIframe, swappedTransport } = useSwappedContext("withdrawal");
|
|
29394
29115
|
const { processOrder } = useFiatWithdrawal({
|
|
@@ -29406,7 +29127,7 @@ function WithdrawalSwappedIframeController({
|
|
|
29406
29127
|
checkoutId: withdrawalItem?.id
|
|
29407
29128
|
})
|
|
29408
29129
|
);
|
|
29409
|
-
|
|
29130
|
+
useEffect48(() => {
|
|
29410
29131
|
if (isSwappedReady) {
|
|
29411
29132
|
const metadata = getTrackMetadata();
|
|
29412
29133
|
logger.info("swapped-withdrawal-iframe:ready", metadata);
|
|
@@ -29519,7 +29240,7 @@ function WithdrawalSwappedIframeController({
|
|
|
29519
29240
|
}
|
|
29520
29241
|
}
|
|
29521
29242
|
});
|
|
29522
|
-
|
|
29243
|
+
useEffect48(() => {
|
|
29523
29244
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
29524
29245
|
}, [swappedTransport, handleSwappedMessage]);
|
|
29525
29246
|
useSwappedIframeLifecycle({
|
|
@@ -29561,18 +29282,18 @@ import { noop as noop4 } from "@funkit/utils";
|
|
|
29561
29282
|
import React149 from "react";
|
|
29562
29283
|
|
|
29563
29284
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryContent.tsx
|
|
29564
|
-
import React148, { useEffect as
|
|
29285
|
+
import React148, { useEffect as useEffect50 } from "react";
|
|
29565
29286
|
|
|
29566
29287
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
29567
|
-
import React147, { useCallback as useCallback31, useMemo as
|
|
29288
|
+
import React147, { useCallback as useCallback31, useMemo as useMemo42, useState as useState46 } from "react";
|
|
29568
29289
|
import { createPortal as createPortal6 } from "react-dom";
|
|
29569
29290
|
|
|
29570
29291
|
// src/hooks/useFunListeners.ts
|
|
29571
|
-
import { useEffect as
|
|
29292
|
+
import { useEffect as useEffect49, useRef as useRef24 } from "react";
|
|
29572
29293
|
function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
|
|
29573
|
-
const activeIntervalRef =
|
|
29294
|
+
const activeIntervalRef = useRef24(void 0);
|
|
29574
29295
|
const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useCheckoutHistoryContext();
|
|
29575
|
-
|
|
29296
|
+
useEffect49(() => {
|
|
29576
29297
|
if (activate) {
|
|
29577
29298
|
const createdIntervalId = startCheckoutHistoryListener(
|
|
29578
29299
|
/* singleDepositAddr */
|
|
@@ -29628,7 +29349,7 @@ function FunCheckoutHistoryDetail({
|
|
|
29628
29349
|
isActiveCheckout
|
|
29629
29350
|
]
|
|
29630
29351
|
);
|
|
29631
|
-
const primaryButtonProps =
|
|
29352
|
+
const primaryButtonProps = useMemo42(() => {
|
|
29632
29353
|
if (!isCheckoutLoaded) {
|
|
29633
29354
|
return void 0;
|
|
29634
29355
|
}
|
|
@@ -29725,7 +29446,7 @@ function FunCheckoutHistoryContent({
|
|
|
29725
29446
|
initDirectExecution: directExecutionInfo
|
|
29726
29447
|
});
|
|
29727
29448
|
const isDirectExecutionRecord = isCheckoutHistoryDirectExecution(depositAddress);
|
|
29728
|
-
|
|
29449
|
+
useEffect50(() => {
|
|
29729
29450
|
if (isDirectExecutionRecord) {
|
|
29730
29451
|
if (directExecution) {
|
|
29731
29452
|
onHistoryItemChange?.({
|
|
@@ -29833,13 +29554,12 @@ function WithdrawalTypeSelect({
|
|
|
29833
29554
|
}
|
|
29834
29555
|
|
|
29835
29556
|
// src/modals/WithdrawalModal/useTrackWithdrawalEvents.ts
|
|
29836
|
-
import { useEffect as
|
|
29557
|
+
import { useEffect as useEffect51 } from "react";
|
|
29837
29558
|
function useTrackWithdrawalEvents() {
|
|
29838
|
-
const
|
|
29559
|
+
const logEventV2 = useTrackV2();
|
|
29839
29560
|
const { checkoutItem } = useCheckoutContext();
|
|
29840
|
-
const { apiKey } = useFunkitConfig();
|
|
29841
29561
|
const { authorizedConnections } = useFunkitBrokerageContext();
|
|
29842
|
-
const { connectorId,
|
|
29562
|
+
const { connectorId, walletAddress } = useGeneralWallet();
|
|
29843
29563
|
const trackModalOpened = useEffectEvent(() => {
|
|
29844
29564
|
if (!checkoutItem) {
|
|
29845
29565
|
return;
|
|
@@ -29847,22 +29567,17 @@ function useTrackWithdrawalEvents() {
|
|
|
29847
29567
|
const config = checkoutItem.initSettings.config;
|
|
29848
29568
|
const sourceAsset = checkoutItem.selectedSourceAssetInfo;
|
|
29849
29569
|
const exchanges = Object.keys(authorizedConnections);
|
|
29850
|
-
const userId = userInfo.id && userInfo.id !== "0x" ? userInfo.id : null;
|
|
29851
29570
|
logEventV2("fc_modal_opened" /* MODAL_OPENED */, () => ({
|
|
29852
|
-
api_key: apiKey,
|
|
29853
|
-
checkout_id: checkoutItem.id,
|
|
29854
|
-
connector_name: connectorId ? userInfo.typeLabel || null : null,
|
|
29855
|
-
flow: "withdraw",
|
|
29856
|
-
tab: "withdraw",
|
|
29857
|
-
user_id: userId,
|
|
29858
29571
|
custom_recipient: config.customRecipient || null,
|
|
29859
29572
|
dynamic_routing_id: config.dynamicRoutingId || null,
|
|
29860
29573
|
exchange_count: exchanges.length,
|
|
29574
|
+
flow: "withdraw",
|
|
29861
29575
|
primary_exchange: exchanges[0] || null,
|
|
29862
29576
|
primary_wallet: walletAddress ? connectorId || null : null,
|
|
29863
29577
|
source_asset: sourceAsset.address,
|
|
29864
29578
|
source_asset_ticker: sourceAsset.symbol || null,
|
|
29865
29579
|
source_chain: sourceAsset.chainId,
|
|
29580
|
+
tab: "withdraw",
|
|
29866
29581
|
// Target asset is not yet known when withdrawal modal is opened
|
|
29867
29582
|
target_asset: null,
|
|
29868
29583
|
target_asset_ticker: null,
|
|
@@ -29871,7 +29586,7 @@ function useTrackWithdrawalEvents() {
|
|
|
29871
29586
|
}));
|
|
29872
29587
|
});
|
|
29873
29588
|
const checkoutId = checkoutItem?.id;
|
|
29874
|
-
|
|
29589
|
+
useEffect51(() => {
|
|
29875
29590
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
29876
29591
|
trackModalOpened();
|
|
29877
29592
|
}
|
|
@@ -29916,7 +29631,7 @@ function WithdrawalModal({
|
|
|
29916
29631
|
"SELECT_METHOD" /* SELECT_METHOD */,
|
|
29917
29632
|
"ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
29918
29633
|
].includes(step);
|
|
29919
|
-
|
|
29634
|
+
useEffect52(() => {
|
|
29920
29635
|
setStep(
|
|
29921
29636
|
isInitialStepSelectMethod ? "SELECT_METHOD" /* SELECT_METHOD */ : "ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
29922
29637
|
);
|
|
@@ -30085,14 +29800,15 @@ function WithdrawalModal({
|
|
|
30085
29800
|
sourceChainId: activeConfig.sourceChainId,
|
|
30086
29801
|
sourceTokenAddress: activeConfig.sourceTokenAddress,
|
|
30087
29802
|
usdBalance: Number(
|
|
30088
|
-
|
|
29803
|
+
resolveWithdrawalSourceTokenBalance3(
|
|
30089
29804
|
withdrawalItem?.withdrawalSourceTokenBalance,
|
|
30090
29805
|
{
|
|
30091
29806
|
sourceAsset: {
|
|
30092
29807
|
tokenAddress: activeConfig.sourceTokenAddress,
|
|
30093
29808
|
tokenChainId: activeConfig.sourceChainId
|
|
30094
29809
|
}
|
|
30095
|
-
}
|
|
29810
|
+
},
|
|
29811
|
+
logger
|
|
30096
29812
|
) ?? "0"
|
|
30097
29813
|
),
|
|
30098
29814
|
onCryptoSelect: () => {
|
|
@@ -30177,7 +29893,7 @@ import React152, {
|
|
|
30177
29893
|
createContext as createContext19,
|
|
30178
29894
|
useCallback as useCallback33,
|
|
30179
29895
|
useContext as useContext19,
|
|
30180
|
-
useMemo as
|
|
29896
|
+
useMemo as useMemo43,
|
|
30181
29897
|
useState as useState48
|
|
30182
29898
|
} from "react";
|
|
30183
29899
|
var ActivityTraversalContext = createContext19({
|
|
@@ -30220,7 +29936,7 @@ var ActivityTraversalProvider = ({
|
|
|
30220
29936
|
setSelectedPurchaseInitView(void 0);
|
|
30221
29937
|
setReturnView(void 0);
|
|
30222
29938
|
}, []);
|
|
30223
|
-
const contextValue =
|
|
29939
|
+
const contextValue = useMemo43(
|
|
30224
29940
|
() => ({
|
|
30225
29941
|
selectedPurchaseId,
|
|
30226
29942
|
selectedPurchaseInitView,
|
|
@@ -30253,17 +29969,17 @@ import React270 from "react";
|
|
|
30253
29969
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
30254
29970
|
import {
|
|
30255
29971
|
useCallback as useCallback58,
|
|
30256
|
-
useEffect as
|
|
29972
|
+
useEffect as useEffect77,
|
|
30257
29973
|
useRef as useRef40,
|
|
30258
29974
|
useState as useState82
|
|
30259
29975
|
} from "react";
|
|
30260
29976
|
|
|
30261
29977
|
// src/hooks/useCheckoutQuoteNotification.ts
|
|
30262
|
-
import { useMemo as
|
|
29978
|
+
import { useMemo as useMemo44 } from "react";
|
|
30263
29979
|
function useCheckoutQuoteNotification() {
|
|
30264
29980
|
const { clearCheckoutQuoteMessages } = useQuoteContext();
|
|
30265
29981
|
const { quoteErrorMessage, quoteStepMessage } = useQuoteContext();
|
|
30266
|
-
const quoteNotification =
|
|
29982
|
+
const quoteNotification = useMemo44(() => {
|
|
30267
29983
|
if (quoteErrorMessage) {
|
|
30268
29984
|
return {
|
|
30269
29985
|
messageType: "error",
|
|
@@ -31663,17 +31379,17 @@ function VirtualFiatAccount({
|
|
|
31663
31379
|
}
|
|
31664
31380
|
|
|
31665
31381
|
// src/modals/PolymarketPerpsTransfer/PerpsTransferStep.tsx
|
|
31666
|
-
import { useQueryClient as
|
|
31667
|
-
import React180, { useEffect as
|
|
31382
|
+
import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
31383
|
+
import React180, { useEffect as useEffect54, useRef as useRef25, useState as useState52 } from "react";
|
|
31668
31384
|
import { createPortal as createPortal10 } from "react-dom";
|
|
31669
31385
|
|
|
31670
31386
|
// src/hooks/usePolymarketAccountBalances.ts
|
|
31671
31387
|
import {
|
|
31672
|
-
skipToken as
|
|
31673
|
-
useQuery as
|
|
31674
|
-
useQueryClient as
|
|
31388
|
+
skipToken as skipToken2,
|
|
31389
|
+
useQuery as useQuery17,
|
|
31390
|
+
useQueryClient as useQueryClient4
|
|
31675
31391
|
} from "@tanstack/react-query";
|
|
31676
|
-
import * as
|
|
31392
|
+
import * as dnum6 from "dnum";
|
|
31677
31393
|
var DEFAULT_BALANCE_REFETCH_MS = 1e3;
|
|
31678
31394
|
var polymarketAccountBalanceQueryKey = (address) => ["polymarket", "accountBalanceUsd", address ?? null];
|
|
31679
31395
|
var polymarketBalanceSettleUntilQueryKey = (address) => ["polymarket", "accountBalanceSettleUntil", address];
|
|
@@ -31681,8 +31397,8 @@ var PUSD_DECIMALS = 6;
|
|
|
31681
31397
|
var SETTLEMENT_WINDOW_MS = 3e4;
|
|
31682
31398
|
function applyOptimisticTransferBalances(queryClient, transfer) {
|
|
31683
31399
|
const { fromAddress, toAddress, amountUsd } = transfer;
|
|
31684
|
-
const amount =
|
|
31685
|
-
shiftBalance(queryClient, fromAddress,
|
|
31400
|
+
const amount = dnum6.from(amountUsd, PUSD_DECIMALS);
|
|
31401
|
+
shiftBalance(queryClient, fromAddress, dnum6.multiply(amount, -1));
|
|
31686
31402
|
shiftBalance(queryClient, toAddress, amount);
|
|
31687
31403
|
}
|
|
31688
31404
|
function shiftBalance(queryClient, address, deltaUsd) {
|
|
@@ -31698,7 +31414,7 @@ function shiftBalance(queryClient, address, deltaUsd) {
|
|
|
31698
31414
|
);
|
|
31699
31415
|
queryClient.setQueryData(
|
|
31700
31416
|
balanceKey,
|
|
31701
|
-
Math.max(0,
|
|
31417
|
+
Math.max(0, dnum6.toNumber(dnum6.add(displayedUsd, deltaUsd, PUSD_DECIMALS)))
|
|
31702
31418
|
);
|
|
31703
31419
|
}
|
|
31704
31420
|
async function fetchAccountBalance(queryClient, getBalanceUsd, queryKey) {
|
|
@@ -31727,15 +31443,15 @@ async function fetchAccountBalance(queryClient, getBalanceUsd, queryKey) {
|
|
|
31727
31443
|
}
|
|
31728
31444
|
}
|
|
31729
31445
|
function useAccountBalance(account, refetchIntervalMs) {
|
|
31730
|
-
const queryClient =
|
|
31446
|
+
const queryClient = useQueryClient4();
|
|
31731
31447
|
const getBalanceUsd = account?.getBalanceUsd;
|
|
31732
31448
|
const address = account?.address;
|
|
31733
|
-
const query =
|
|
31449
|
+
const query = useQuery17({
|
|
31734
31450
|
queryKey: polymarketAccountBalanceQueryKey(address),
|
|
31735
31451
|
// `skipToken` disables the query when the account isn't configured (the
|
|
31736
31452
|
// perps-transfer config is optional). It is *not* a fallback for a missing
|
|
31737
31453
|
// balance — the getter is the single source of truth.
|
|
31738
|
-
queryFn: getBalanceUsd && address ? ({ queryKey }) => fetchAccountBalance(queryClient, getBalanceUsd, queryKey) :
|
|
31454
|
+
queryFn: getBalanceUsd && address ? ({ queryKey }) => fetchAccountBalance(queryClient, getBalanceUsd, queryKey) : skipToken2,
|
|
31739
31455
|
refetchInterval: refetchIntervalMs,
|
|
31740
31456
|
// The poll interval is the freshness contract: a reader mounting within it
|
|
31741
31457
|
// (e.g. navigating between the deposit picker and the transfer step) reads
|
|
@@ -32320,7 +32036,7 @@ function PerpsTransferRows({ form }) {
|
|
|
32320
32036
|
}
|
|
32321
32037
|
|
|
32322
32038
|
// src/modals/PolymarketPerpsTransfer/usePerpsTransferForm.ts
|
|
32323
|
-
import { useEffect as
|
|
32039
|
+
import { useEffect as useEffect53, useState as useState51 } from "react";
|
|
32324
32040
|
function parseAmount(amount) {
|
|
32325
32041
|
return Number(amount.replace(/,/g, ""));
|
|
32326
32042
|
}
|
|
@@ -32350,7 +32066,7 @@ function usePerpsTransferForm({
|
|
|
32350
32066
|
const { t } = useFunkitTranslation();
|
|
32351
32067
|
const [amount, setAmount] = useState51(initialAmountUsd);
|
|
32352
32068
|
const [direction, setDirection] = useState51(initialDirection);
|
|
32353
|
-
|
|
32069
|
+
useEffect53(() => {
|
|
32354
32070
|
if (status === "success") {
|
|
32355
32071
|
setAmount("");
|
|
32356
32072
|
}
|
|
@@ -32407,18 +32123,18 @@ function usePerpsTransferForm({
|
|
|
32407
32123
|
var SUCCESS_RESET_MS = 2e3;
|
|
32408
32124
|
function PerpsTransferStepComponent() {
|
|
32409
32125
|
const bottomSectionRef = useBottomSectionRef();
|
|
32410
|
-
const queryClient =
|
|
32126
|
+
const queryClient = useQueryClient5();
|
|
32411
32127
|
const { checkoutItem } = useCheckoutContext();
|
|
32412
32128
|
const recordTransfer = useRecordPerpsTransfer();
|
|
32413
32129
|
const [status, setStatus] = useState52("idle");
|
|
32414
|
-
const successResetTimerRef =
|
|
32130
|
+
const successResetTimerRef = useRef25(null);
|
|
32415
32131
|
const clearSuccessResetTimer = () => {
|
|
32416
32132
|
if (successResetTimerRef.current !== null) {
|
|
32417
32133
|
window.clearTimeout(successResetTimerRef.current);
|
|
32418
32134
|
successResetTimerRef.current = null;
|
|
32419
32135
|
}
|
|
32420
32136
|
};
|
|
32421
|
-
|
|
32137
|
+
useEffect54(() => clearSuccessResetTimer, []);
|
|
32422
32138
|
const perpsTransfer = checkoutItem?.initSettings.config.polymarketPerpsTransfer;
|
|
32423
32139
|
const balances = usePolymarketAccountBalances({
|
|
32424
32140
|
predictions: perpsTransfer?.predictions,
|
|
@@ -32497,7 +32213,7 @@ import React182 from "react";
|
|
|
32497
32213
|
|
|
32498
32214
|
// src/modals/CheckoutModal/Brokerage/components/BrokerageSuccess.tsx
|
|
32499
32215
|
import { capitalizeFirstLetter } from "@funkit/utils";
|
|
32500
|
-
import React181, { useMemo as
|
|
32216
|
+
import React181, { useMemo as useMemo45 } from "react";
|
|
32501
32217
|
var BrokerageSuccess = ({
|
|
32502
32218
|
bottomBarId,
|
|
32503
32219
|
onClose,
|
|
@@ -32505,7 +32221,7 @@ var BrokerageSuccess = ({
|
|
|
32505
32221
|
}) => {
|
|
32506
32222
|
const { t } = useFunkitTranslation();
|
|
32507
32223
|
const { exchangeType } = useBluvo();
|
|
32508
|
-
const customTextConfigSteps =
|
|
32224
|
+
const customTextConfigSteps = useMemo45(() => {
|
|
32509
32225
|
if (exchangeType) {
|
|
32510
32226
|
return {
|
|
32511
32227
|
...getDefaultTextConfigSteps(t),
|
|
@@ -32581,8 +32297,8 @@ import { bluvoExecuteWithdrawal as bluvoExecuteWithdrawal2 } from "@funkit/api-b
|
|
|
32581
32297
|
// src/components/FunInput/FunTwoFaInput.tsx
|
|
32582
32298
|
import React183, {
|
|
32583
32299
|
useCallback as useCallback36,
|
|
32584
|
-
useEffect as
|
|
32585
|
-
useRef as
|
|
32300
|
+
useEffect as useEffect55,
|
|
32301
|
+
useRef as useRef26,
|
|
32586
32302
|
useState as useState53
|
|
32587
32303
|
} from "react";
|
|
32588
32304
|
var FunTwoFaInput = ({
|
|
@@ -32596,13 +32312,13 @@ var FunTwoFaInput = ({
|
|
|
32596
32312
|
hasResent = false,
|
|
32597
32313
|
onCompleted
|
|
32598
32314
|
}) => {
|
|
32599
|
-
const inputRefs =
|
|
32315
|
+
const inputRefs = useRef26(
|
|
32600
32316
|
Array.from({ length: initialInputLength }, () => null)
|
|
32601
32317
|
);
|
|
32602
32318
|
const [currentLength, setCurrentLength] = useState53(initialInputLength);
|
|
32603
32319
|
const [focusIndex, setFocusIndex] = useState53(0);
|
|
32604
32320
|
const [isFocused, setIsFocused] = useState53(false);
|
|
32605
|
-
|
|
32321
|
+
useEffect55(() => {
|
|
32606
32322
|
if (!value) {
|
|
32607
32323
|
setFocusIndex(0);
|
|
32608
32324
|
}
|
|
@@ -33182,7 +32898,7 @@ var TwoFactorIcon = () => /* @__PURE__ */ React184.createElement(
|
|
|
33182
32898
|
);
|
|
33183
32899
|
|
|
33184
32900
|
// src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
|
|
33185
|
-
import React188, { useCallback as
|
|
32901
|
+
import React188, { useCallback as useCallback38, useEffect as useEffect56, useRef as useRef27, useState as useState55 } from "react";
|
|
33186
32902
|
import { createPortal as createPortal12 } from "react-dom";
|
|
33187
32903
|
|
|
33188
32904
|
// src/components/FunMessage/FunMessage.tsx
|
|
@@ -33253,244 +32969,8 @@ var TwoFaIcon = () => {
|
|
|
33253
32969
|
);
|
|
33254
32970
|
};
|
|
33255
32971
|
|
|
33256
|
-
// src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
|
|
33257
|
-
var getGuaranteeList = (brokerType, t) => [
|
|
33258
|
-
{
|
|
33259
|
-
title: t("brokerage.credentialsNeverStored"),
|
|
33260
|
-
description: t("brokerage.dataEncrypted", {
|
|
33261
|
-
appName: FUN_ORG_NAME,
|
|
33262
|
-
exchangeName: getExchangeName(brokerType)
|
|
33263
|
-
}),
|
|
33264
|
-
icon: /* @__PURE__ */ React188.createElement(HandIcon, null)
|
|
33265
|
-
},
|
|
33266
|
-
{
|
|
33267
|
-
title: t("brokerage.twoFaAlwaysRequired"),
|
|
33268
|
-
description: t("brokerage.transfersRequireApproval"),
|
|
33269
|
-
icon: /* @__PURE__ */ React188.createElement(TwoFaIcon, null)
|
|
33270
|
-
}
|
|
33271
|
-
];
|
|
33272
|
-
var ConnectExchangeInfo = {
|
|
33273
|
-
Component: ConnectExchange,
|
|
33274
|
-
onNext(state, payload) {
|
|
33275
|
-
const common = extractCommonState(state);
|
|
33276
|
-
return {
|
|
33277
|
-
...common,
|
|
33278
|
-
step: "select_asset" /* SELECT_ASSET */,
|
|
33279
|
-
paymentMethodInfo: payload.paymentMethodInfo
|
|
33280
|
-
};
|
|
33281
|
-
}
|
|
33282
|
-
};
|
|
33283
|
-
function ConnectExchange({
|
|
33284
|
-
modalState,
|
|
33285
|
-
onNext
|
|
33286
|
-
}) {
|
|
33287
|
-
const { activeTheme } = useActiveTheme();
|
|
33288
|
-
const { brokerType } = modalState;
|
|
33289
|
-
const iconSize = Number.parseInt(activeTheme.dimensions.connectExchangeIconSize, 10) || 48;
|
|
33290
|
-
const { t } = useFunkitTranslation();
|
|
33291
|
-
const { appName, uiCustomizations } = useFunkitConfig();
|
|
33292
|
-
const { updateSelectedPaymentMethodInfo } = useCheckoutContext();
|
|
33293
|
-
const [authError, setAuthError] = useState55("");
|
|
33294
|
-
const { exchangeType, walletId, isConnected, handleStartWithdrawal } = useBluvo();
|
|
33295
|
-
const [isLoadingBluvoModal, setIsLoadingBluvoModal] = useState55(false);
|
|
33296
|
-
const icon = getExchangeIcon(brokerType, iconSize);
|
|
33297
|
-
const isLoading = isLoadingBluvoModal;
|
|
33298
|
-
const exchangeName = getExchangeName(brokerType);
|
|
33299
|
-
const navigateToBrokerage = useEffectEvent(() => {
|
|
33300
|
-
if (exchangeType !== brokerType || !walletId) {
|
|
33301
|
-
return;
|
|
33302
|
-
}
|
|
33303
|
-
setIsLoadingBluvoModal(false);
|
|
33304
|
-
const paymentInfo = createPaymentMethodInfo({
|
|
33305
|
-
paymentMethod: PaymentMethod.BROKERAGE,
|
|
33306
|
-
deviceId: walletId,
|
|
33307
|
-
exchange: exchangeType
|
|
33308
|
-
});
|
|
33309
|
-
updateSelectedPaymentMethodInfo(paymentInfo);
|
|
33310
|
-
onNext({ paymentMethodInfo: paymentInfo, popCurrentStep: true });
|
|
33311
|
-
});
|
|
33312
|
-
const handleAuthError = useEffectEvent((errorMessage) => {
|
|
33313
|
-
setAuthError(errorMessage);
|
|
33314
|
-
setIsLoadingBluvoModal(false);
|
|
33315
|
-
});
|
|
33316
|
-
useEffect57(() => {
|
|
33317
|
-
if (isConnected) {
|
|
33318
|
-
navigateToBrokerage();
|
|
33319
|
-
}
|
|
33320
|
-
}, [isConnected]);
|
|
33321
|
-
const onClickContinue = useCallback37(async () => {
|
|
33322
|
-
try {
|
|
33323
|
-
setIsLoadingBluvoModal(true);
|
|
33324
|
-
setAuthError("");
|
|
33325
|
-
await handleStartWithdrawal(brokerType);
|
|
33326
|
-
} catch (err) {
|
|
33327
|
-
logger.error("Unable to connect to bluvo", err);
|
|
33328
|
-
handleAuthError(t("brokerage.bluvoConnectionError"));
|
|
33329
|
-
} finally {
|
|
33330
|
-
setIsLoadingBluvoModal(false);
|
|
33331
|
-
}
|
|
33332
|
-
}, [brokerType, handleStartWithdrawal, handleAuthError, t]);
|
|
33333
|
-
const bottomSectionRef = useBottomSectionRef();
|
|
33334
|
-
const { CustomComponent } = uiCustomizations.connectExchangeScreen;
|
|
33335
|
-
return /* @__PURE__ */ React188.createElement(Box, { id: "connect-exchange" }, uiCustomizations.connectExchangeScreen.customTopComponent?.(), CustomComponent ? /* @__PURE__ */ React188.createElement(
|
|
33336
|
-
CustomComponent,
|
|
33337
|
-
{
|
|
33338
|
-
appName,
|
|
33339
|
-
exchangeIcon: icon,
|
|
33340
|
-
exchangeName,
|
|
33341
|
-
exchangeType: exchangeType || null
|
|
33342
|
-
}
|
|
33343
|
-
) : /* @__PURE__ */ React188.createElement(Box, { display: "flex", flexDirection: "column", gap: "verticalSectionGap" }, /* @__PURE__ */ React188.createElement(
|
|
33344
|
-
FunMessage,
|
|
33345
|
-
{
|
|
33346
|
-
icon,
|
|
33347
|
-
title: t("brokerage.thirdPartyConnectionMessage", {
|
|
33348
|
-
appName,
|
|
33349
|
-
exchangeName
|
|
33350
|
-
})
|
|
33351
|
-
}
|
|
33352
|
-
), /* @__PURE__ */ React188.createElement(FunGuarantees, { guarantees: getGuaranteeList(brokerType, t) })), bottomSectionRef && createPortal12(
|
|
33353
|
-
/* @__PURE__ */ React188.createElement(
|
|
33354
|
-
Dialog.BottomBar,
|
|
33355
|
-
{
|
|
33356
|
-
topSectionVisible: authError !== "",
|
|
33357
|
-
topSection: /* @__PURE__ */ React188.createElement(
|
|
33358
|
-
FunNotification,
|
|
33359
|
-
{
|
|
33360
|
-
description: authError,
|
|
33361
|
-
type: "error",
|
|
33362
|
-
isVisible: authError !== ""
|
|
33363
|
-
}
|
|
33364
|
-
),
|
|
33365
|
-
actionButtonProps: {
|
|
33366
|
-
title: t("brokerage.continue"),
|
|
33367
|
-
onClick: onClickContinue,
|
|
33368
|
-
isLoading,
|
|
33369
|
-
isDisabled: isLoading || authError !== ""
|
|
33370
|
-
}
|
|
33371
|
-
}
|
|
33372
|
-
),
|
|
33373
|
-
bottomSectionRef
|
|
33374
|
-
));
|
|
33375
|
-
}
|
|
33376
|
-
|
|
33377
|
-
// src/modals/CheckoutModal/Brokerage/SelectBrokerage.tsx
|
|
33378
|
-
import React191, { useCallback as useCallback39, useState as useState56 } from "react";
|
|
33379
|
-
import { createPortal as createPortal13 } from "react-dom";
|
|
33380
|
-
|
|
33381
|
-
// src/components/FunSelectBrokerage/FunSelectBrokerage.tsx
|
|
33382
|
-
import clsx19 from "clsx";
|
|
33383
|
-
import React190 from "react";
|
|
33384
|
-
|
|
33385
|
-
// src/css/scrollStyles.css.ts
|
|
33386
|
-
var hideScrollBar = "_163ehmk0";
|
|
33387
|
-
var selectWrapperStyle = "_163ehmk1";
|
|
33388
|
-
|
|
33389
|
-
// src/components/FunSelectBrokerage/FunBrokerageItem.tsx
|
|
33390
|
-
import React189 from "react";
|
|
33391
|
-
|
|
33392
|
-
// src/components/FunSelectBrokerage/FunBrokerageItem.css.ts
|
|
33393
|
-
var brokerageItemStyle = "an34y90";
|
|
33394
|
-
|
|
33395
|
-
// src/components/FunSelectBrokerage/FunBrokerageItem.tsx
|
|
33396
|
-
var FunBrokerageItem = ({
|
|
33397
|
-
exchangeName,
|
|
33398
|
-
exchangeIcon,
|
|
33399
|
-
hasActiveConnection,
|
|
33400
|
-
badgeText,
|
|
33401
|
-
disabled,
|
|
33402
|
-
fontSize = "12",
|
|
33403
|
-
fontWeight = "medium"
|
|
33404
|
-
}) => {
|
|
33405
|
-
const { t } = useFunkitTranslation();
|
|
33406
|
-
return /* @__PURE__ */ React189.createElement(
|
|
33407
|
-
Box,
|
|
33408
|
-
{
|
|
33409
|
-
className: brokerageItemStyle,
|
|
33410
|
-
disabled,
|
|
33411
|
-
cursor: disabled ? "not-allowed" : void 0
|
|
33412
|
-
},
|
|
33413
|
-
/* @__PURE__ */ React189.createElement(
|
|
33414
|
-
Box,
|
|
33415
|
-
{
|
|
33416
|
-
alignItems: "center",
|
|
33417
|
-
display: "flex",
|
|
33418
|
-
flexDirection: "row",
|
|
33419
|
-
gap: "12",
|
|
33420
|
-
style: { opacity: disabled ? 0.5 : 1 }
|
|
33421
|
-
},
|
|
33422
|
-
exchangeIcon,
|
|
33423
|
-
exchangeName && /* @__PURE__ */ React189.createElement(Text, { size: fontSize, weight: fontWeight, as: "span" }, exchangeName)
|
|
33424
|
-
),
|
|
33425
|
-
/* @__PURE__ */ React189.createElement(Box, { display: "flex", gap: "8", alignItems: "center", color: "secondaryText" }, hasActiveConnection && /* @__PURE__ */ React189.createElement(
|
|
33426
|
-
FunBadge,
|
|
33427
|
-
{
|
|
33428
|
-
background: "newBadgeBackground",
|
|
33429
|
-
borderColor: "newBadgeBorder",
|
|
33430
|
-
color: "newBadgeText"
|
|
33431
|
-
},
|
|
33432
|
-
t("common.connected")
|
|
33433
|
-
), badgeText && /* @__PURE__ */ React189.createElement(FunBadge, { borderColor: "generalBorder" }, badgeText))
|
|
33434
|
-
);
|
|
33435
|
-
};
|
|
33436
|
-
|
|
33437
|
-
// src/components/FunSelectBrokerage/FunSelectBrokerage.tsx
|
|
33438
|
-
function FunSelectBrokerage({
|
|
33439
|
-
isDisabled,
|
|
33440
|
-
options,
|
|
33441
|
-
onSelect,
|
|
33442
|
-
selectedKey
|
|
33443
|
-
}) {
|
|
33444
|
-
const { uiCustomizations } = useFunkitConfig();
|
|
33445
|
-
const { enableCompactList } = uiCustomizations;
|
|
33446
|
-
const { t } = useFunkitTranslation();
|
|
33447
|
-
if (options.length === 0) {
|
|
33448
|
-
return /* @__PURE__ */ React190.createElement(FunNoResults, { text: t("common.noResultsFound") });
|
|
33449
|
-
}
|
|
33450
|
-
return /* @__PURE__ */ React190.createElement(
|
|
33451
|
-
Box,
|
|
33452
|
-
{
|
|
33453
|
-
className: clsx19(hideScrollBar, selectWrapperStyle),
|
|
33454
|
-
width: "full",
|
|
33455
|
-
display: "flex",
|
|
33456
|
-
flexDirection: "column",
|
|
33457
|
-
gap: uiCustomizations.enableCompactList ? "0" : "selectBrokerageListGap"
|
|
33458
|
-
},
|
|
33459
|
-
options.map((option) => {
|
|
33460
|
-
const key = brokerageOptionKey(option);
|
|
33461
|
-
const isComingSoon = option.status === "coming_soon" /* ComingSoon */;
|
|
33462
|
-
const hasActiveConnection = option.kind === "bluvo" && option.hasActiveConnection;
|
|
33463
|
-
const isDisabledItem = isDisabled || isComingSoon || hasActiveConnection || option.kind === "swapped" /* SWAPPED */ && !option.fop.embeddedFlowUrl;
|
|
33464
|
-
return /* @__PURE__ */ React190.createElement(
|
|
33465
|
-
FunOptionBox,
|
|
33466
|
-
{
|
|
33467
|
-
key,
|
|
33468
|
-
isActive: selectedKey === key,
|
|
33469
|
-
isCompactList: uiCustomizations.enableCompactList,
|
|
33470
|
-
onClick: isDisabledItem ? void 0 : () => onSelect(option),
|
|
33471
|
-
paddingX: "selectBrokerageItemPaddingX",
|
|
33472
|
-
paddingY: "selectBrokerageItemPaddingY",
|
|
33473
|
-
type: "default"
|
|
33474
|
-
},
|
|
33475
|
-
/* @__PURE__ */ React190.createElement(
|
|
33476
|
-
FunBrokerageItem,
|
|
33477
|
-
{
|
|
33478
|
-
exchangeName: option.name,
|
|
33479
|
-
exchangeIcon: option.icon,
|
|
33480
|
-
hasActiveConnection,
|
|
33481
|
-
badgeText: isComingSoon ? t("common.comingSoon") : void 0,
|
|
33482
|
-
disabled: isDisabledItem,
|
|
33483
|
-
fontSize: enableCompactList ? "14" : "12",
|
|
33484
|
-
fontWeight: enableCompactList ? "semibold" : "medium"
|
|
33485
|
-
}
|
|
33486
|
-
)
|
|
33487
|
-
);
|
|
33488
|
-
})
|
|
33489
|
-
);
|
|
33490
|
-
}
|
|
33491
|
-
|
|
33492
32972
|
// src/hooks/track/analytics/useDepositAnalytics.ts
|
|
33493
|
-
import { useCallback as
|
|
32973
|
+
import { useCallback as useCallback37 } from "react";
|
|
33494
32974
|
function buildDepositQuoteSnapshotProperties(args, connectorId) {
|
|
33495
32975
|
return {
|
|
33496
32976
|
...resolvePaymentMethodProperties(args, connectorId),
|
|
@@ -33512,28 +32992,44 @@ function buildDepositQuoteSnapshotProperties(args, connectorId) {
|
|
|
33512
32992
|
};
|
|
33513
32993
|
}
|
|
33514
32994
|
function useDepositAnalytics() {
|
|
33515
|
-
const
|
|
32995
|
+
const logEventV2 = useTrackV2();
|
|
33516
32996
|
const { checkoutItem } = useCheckoutContext();
|
|
33517
|
-
const {
|
|
33518
|
-
const { connectorId, userInfo, walletAddress } = useGeneralWallet();
|
|
32997
|
+
const { connectorId, walletAddress } = useGeneralWallet();
|
|
33519
32998
|
const checkoutId = checkoutItem?.id;
|
|
33520
|
-
const
|
|
33521
|
-
|
|
33522
|
-
|
|
33523
|
-
|
|
33524
|
-
|
|
33525
|
-
|
|
33526
|
-
|
|
33527
|
-
|
|
32999
|
+
const config = checkoutItem?.initSettings.config;
|
|
33000
|
+
const paymentMethodInfo = checkoutItem?.selectedPaymentMethodInfo;
|
|
33001
|
+
const trackExchangeConnectStarted = useCallback37(
|
|
33002
|
+
(provider) => {
|
|
33003
|
+
logEventV2("fc_account_connect_started" /* ACCOUNT_CONNECT_STARTED */, () => ({
|
|
33004
|
+
payment_method: PaymentMethod.BROKERAGE,
|
|
33005
|
+
provider
|
|
33006
|
+
}));
|
|
33007
|
+
},
|
|
33008
|
+
[logEventV2]
|
|
33528
33009
|
);
|
|
33529
|
-
const
|
|
33010
|
+
const trackExchangeConnectCompleted = useCallback37(
|
|
33011
|
+
(provider) => {
|
|
33012
|
+
logEventV2("fc_account_connect_completed" /* ACCOUNT_CONNECT_COMPLETED */, () => ({
|
|
33013
|
+
payment_method: PaymentMethod.BROKERAGE,
|
|
33014
|
+
provider
|
|
33015
|
+
}));
|
|
33016
|
+
},
|
|
33017
|
+
[logEventV2]
|
|
33018
|
+
);
|
|
33019
|
+
const trackExchangeConnectFailed = useCallback37(
|
|
33020
|
+
(args) => {
|
|
33021
|
+
logEventV2("fc_account_connect_failed" /* ACCOUNT_CONNECT_FAILED */, () => ({
|
|
33022
|
+
error_code: args.errorCode,
|
|
33023
|
+
error_message: args.errorMessage,
|
|
33024
|
+
payment_method: PaymentMethod.BROKERAGE,
|
|
33025
|
+
provider: args.provider
|
|
33026
|
+
}));
|
|
33027
|
+
},
|
|
33028
|
+
[logEventV2]
|
|
33029
|
+
);
|
|
33030
|
+
const trackDepositAssetSelected = useCallback37(
|
|
33530
33031
|
(args) => {
|
|
33531
|
-
if (!checkoutId) {
|
|
33532
|
-
return;
|
|
33533
|
-
}
|
|
33534
33032
|
logEventV2("fc_deposit_asset_selected" /* DEPOSIT_ASSET_SELECTED */, () => ({
|
|
33535
|
-
...commonDepositProperties,
|
|
33536
|
-
checkout_id: checkoutId,
|
|
33537
33033
|
...resolvePaymentMethodProperties(args, connectorId),
|
|
33538
33034
|
source_chain: args.source.chainId,
|
|
33539
33035
|
source_asset: args.source.tokenAddress,
|
|
@@ -33545,16 +33041,11 @@ function useDepositAnalytics() {
|
|
|
33545
33041
|
is_default_token: args.isDefaultToken
|
|
33546
33042
|
}));
|
|
33547
33043
|
},
|
|
33548
|
-
[
|
|
33044
|
+
[connectorId, logEventV2]
|
|
33549
33045
|
);
|
|
33550
|
-
const trackDepositTransferInteracted =
|
|
33046
|
+
const trackDepositTransferInteracted = useCallback37(
|
|
33551
33047
|
(args) => {
|
|
33552
|
-
if (!checkoutId) {
|
|
33553
|
-
return;
|
|
33554
|
-
}
|
|
33555
33048
|
logEventV2("fc_deposit_transfer_interacted" /* DEPOSIT_TRANSFER_INTERACTED */, () => ({
|
|
33556
|
-
...commonDepositProperties,
|
|
33557
|
-
checkout_id: checkoutId,
|
|
33558
33049
|
action: args.action,
|
|
33559
33050
|
deposit_address: args.depositAddress,
|
|
33560
33051
|
est_price_impact: args.estPriceImpact,
|
|
@@ -33572,16 +33063,11 @@ function useDepositAnalytics() {
|
|
|
33572
33063
|
target_chain: args.target.chainId
|
|
33573
33064
|
}));
|
|
33574
33065
|
},
|
|
33575
|
-
[
|
|
33066
|
+
[logEventV2]
|
|
33576
33067
|
);
|
|
33577
|
-
const trackDepositAmountConfirmed =
|
|
33068
|
+
const trackDepositAmountConfirmed = useCallback37(
|
|
33578
33069
|
(args) => {
|
|
33579
|
-
if (!checkoutId) {
|
|
33580
|
-
return;
|
|
33581
|
-
}
|
|
33582
33070
|
logEventV2("fc_deposit_amount_confirmed" /* DEPOSIT_AMOUNT_CONFIRMED */, () => ({
|
|
33583
|
-
...commonDepositProperties,
|
|
33584
|
-
checkout_id: checkoutId,
|
|
33585
33071
|
...resolvePaymentMethodProperties(args, connectorId),
|
|
33586
33072
|
source_chain: args.source?.chainId ?? null,
|
|
33587
33073
|
source_asset: args.source?.tokenAddress ?? null,
|
|
@@ -33596,16 +33082,14 @@ function useDepositAnalytics() {
|
|
|
33596
33082
|
target_amount: formatAnalyticsAmount(args.targetAmount)
|
|
33597
33083
|
}));
|
|
33598
33084
|
},
|
|
33599
|
-
[
|
|
33085
|
+
[connectorId, logEventV2]
|
|
33600
33086
|
);
|
|
33601
|
-
const trackDepositMethodSelected =
|
|
33087
|
+
const trackDepositMethodSelected = useCallback37(
|
|
33602
33088
|
(args) => {
|
|
33603
|
-
|
|
33604
|
-
if (!checkoutId || !config) {
|
|
33089
|
+
if (!config) {
|
|
33605
33090
|
return;
|
|
33606
33091
|
}
|
|
33607
33092
|
logEventV2("fc_deposit_method_selected" /* DEPOSIT_METHOD_SELECTED */, () => ({
|
|
33608
|
-
...commonDepositProperties,
|
|
33609
33093
|
checkout_id: checkoutId,
|
|
33610
33094
|
payment_method: args.paymentMethod,
|
|
33611
33095
|
payment_rail: args.paymentRail || null,
|
|
@@ -33623,36 +33107,23 @@ function useDepositAnalytics() {
|
|
|
33623
33107
|
target_asset_ticker: config.targetAssetTicker || null
|
|
33624
33108
|
}));
|
|
33625
33109
|
},
|
|
33626
|
-
[
|
|
33627
|
-
checkoutId,
|
|
33628
|
-
checkoutItem,
|
|
33629
|
-
commonDepositProperties,
|
|
33630
|
-
connectorId,
|
|
33631
|
-
logEventV2
|
|
33632
|
-
]
|
|
33110
|
+
[config, connectorId, logEventV2]
|
|
33633
33111
|
);
|
|
33634
|
-
const trackDepositQuoteDisplayed =
|
|
33112
|
+
const trackDepositQuoteDisplayed = useCallback37(
|
|
33635
33113
|
(args) => {
|
|
33636
|
-
|
|
33637
|
-
|
|
33638
|
-
|
|
33639
|
-
|
|
33640
|
-
...commonDepositProperties,
|
|
33641
|
-
checkout_id: checkoutId,
|
|
33642
|
-
...buildDepositQuoteSnapshotProperties(args, connectorId)
|
|
33643
|
-
}));
|
|
33114
|
+
logEventV2(
|
|
33115
|
+
"fc_deposit_quote_displayed" /* DEPOSIT_QUOTE_DISPLAYED */,
|
|
33116
|
+
() => buildDepositQuoteSnapshotProperties(args, connectorId)
|
|
33117
|
+
);
|
|
33644
33118
|
},
|
|
33645
|
-
[
|
|
33119
|
+
[connectorId, logEventV2]
|
|
33646
33120
|
);
|
|
33647
|
-
const trackDepositMeldQuoteDisplayed =
|
|
33121
|
+
const trackDepositMeldQuoteDisplayed = useCallback37(
|
|
33648
33122
|
({ quote, numQuoteRefreshes }) => {
|
|
33649
|
-
|
|
33650
|
-
const paymentMethodInfo = checkoutItem?.selectedPaymentMethodInfo;
|
|
33651
|
-
if (!checkoutId || !config || paymentMethodInfo?.paymentMethod !== PaymentMethod.CARD) {
|
|
33123
|
+
if (!config || paymentMethodInfo?.paymentMethod !== PaymentMethod.CARD) {
|
|
33652
33124
|
return;
|
|
33653
33125
|
}
|
|
33654
33126
|
logEventV2("fc_deposit_quote_displayed" /* DEPOSIT_QUOTE_DISPLAYED */, () => ({
|
|
33655
|
-
...commonDepositProperties,
|
|
33656
33127
|
checkout_id: checkoutId,
|
|
33657
33128
|
...resolveVisibleQuoteFeeProperties(null),
|
|
33658
33129
|
...resolvePaymentMethodProperties(
|
|
@@ -33678,39 +33149,307 @@ function useDepositAnalytics() {
|
|
|
33678
33149
|
trade_type: "EXACT_IN" /* EXACT_IN */
|
|
33679
33150
|
}));
|
|
33680
33151
|
},
|
|
33681
|
-
[
|
|
33682
|
-
checkoutId,
|
|
33683
|
-
checkoutItem,
|
|
33684
|
-
commonDepositProperties,
|
|
33685
|
-
connectorId,
|
|
33686
|
-
logEventV2,
|
|
33687
|
-
walletAddress
|
|
33688
|
-
]
|
|
33152
|
+
[config, connectorId, logEventV2, paymentMethodInfo, walletAddress]
|
|
33689
33153
|
);
|
|
33690
|
-
const trackDepositQuoteConfirmed =
|
|
33154
|
+
const trackDepositQuoteConfirmed = useCallback37(
|
|
33691
33155
|
(args) => {
|
|
33692
|
-
|
|
33693
|
-
|
|
33694
|
-
|
|
33695
|
-
|
|
33696
|
-
...commonDepositProperties,
|
|
33697
|
-
checkout_id: checkoutId,
|
|
33698
|
-
...buildDepositQuoteSnapshotProperties(args, connectorId)
|
|
33699
|
-
}));
|
|
33156
|
+
logEventV2(
|
|
33157
|
+
"fc_deposit_quote_confirmed" /* DEPOSIT_QUOTE_CONFIRMED */,
|
|
33158
|
+
() => buildDepositQuoteSnapshotProperties(args, connectorId)
|
|
33159
|
+
);
|
|
33700
33160
|
},
|
|
33701
|
-
[
|
|
33161
|
+
[connectorId, logEventV2]
|
|
33702
33162
|
);
|
|
33703
33163
|
return {
|
|
33704
|
-
trackDepositAssetSelected,
|
|
33705
33164
|
trackDepositAmountConfirmed,
|
|
33706
|
-
|
|
33165
|
+
trackDepositAssetSelected,
|
|
33707
33166
|
trackDepositMeldQuoteDisplayed,
|
|
33708
|
-
|
|
33167
|
+
trackDepositMethodSelected,
|
|
33709
33168
|
trackDepositQuoteConfirmed,
|
|
33710
|
-
|
|
33169
|
+
trackDepositQuoteDisplayed,
|
|
33170
|
+
trackDepositTransferInteracted,
|
|
33171
|
+
trackExchangeConnectCompleted,
|
|
33172
|
+
trackExchangeConnectFailed,
|
|
33173
|
+
trackExchangeConnectStarted
|
|
33711
33174
|
};
|
|
33712
33175
|
}
|
|
33713
33176
|
|
|
33177
|
+
// src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
|
|
33178
|
+
var getGuaranteeList = (brokerType, t) => [
|
|
33179
|
+
{
|
|
33180
|
+
title: t("brokerage.credentialsNeverStored"),
|
|
33181
|
+
description: t("brokerage.dataEncrypted", {
|
|
33182
|
+
appName: FUN_ORG_NAME,
|
|
33183
|
+
exchangeName: getExchangeName(brokerType)
|
|
33184
|
+
}),
|
|
33185
|
+
icon: /* @__PURE__ */ React188.createElement(HandIcon, null)
|
|
33186
|
+
},
|
|
33187
|
+
{
|
|
33188
|
+
title: t("brokerage.twoFaAlwaysRequired"),
|
|
33189
|
+
description: t("brokerage.transfersRequireApproval"),
|
|
33190
|
+
icon: /* @__PURE__ */ React188.createElement(TwoFaIcon, null)
|
|
33191
|
+
}
|
|
33192
|
+
];
|
|
33193
|
+
var ConnectExchangeInfo = {
|
|
33194
|
+
Component: ConnectExchange,
|
|
33195
|
+
onNext(state, payload) {
|
|
33196
|
+
const common = extractCommonState(state);
|
|
33197
|
+
return {
|
|
33198
|
+
...common,
|
|
33199
|
+
step: "select_asset" /* SELECT_ASSET */,
|
|
33200
|
+
paymentMethodInfo: payload.paymentMethodInfo
|
|
33201
|
+
};
|
|
33202
|
+
}
|
|
33203
|
+
};
|
|
33204
|
+
function ConnectExchange({
|
|
33205
|
+
modalState,
|
|
33206
|
+
onNext
|
|
33207
|
+
}) {
|
|
33208
|
+
const { activeTheme } = useActiveTheme();
|
|
33209
|
+
const { brokerType } = modalState;
|
|
33210
|
+
const iconSize = Number.parseInt(activeTheme.dimensions.connectExchangeIconSize, 10) || 48;
|
|
33211
|
+
const { t } = useFunkitTranslation();
|
|
33212
|
+
const { appName, uiCustomizations } = useFunkitConfig();
|
|
33213
|
+
const {
|
|
33214
|
+
trackExchangeConnectCompleted,
|
|
33215
|
+
trackExchangeConnectFailed,
|
|
33216
|
+
trackExchangeConnectStarted
|
|
33217
|
+
} = useDepositAnalytics();
|
|
33218
|
+
const { updateSelectedPaymentMethodInfo } = useCheckoutContext();
|
|
33219
|
+
const [authError, setAuthError] = useState55("");
|
|
33220
|
+
const { exchangeType, walletId, isConnected, handleStartWithdrawal } = useBluvo();
|
|
33221
|
+
const [isLoadingBluvoModal, setIsLoadingBluvoModal] = useState55(false);
|
|
33222
|
+
const icon = getExchangeIcon(brokerType, iconSize);
|
|
33223
|
+
const isLoading = isLoadingBluvoModal;
|
|
33224
|
+
const exchangeName = getExchangeName(brokerType);
|
|
33225
|
+
const isConnectingRef = useRef27(false);
|
|
33226
|
+
const navigateToBrokerage = useEffectEvent(() => {
|
|
33227
|
+
if (exchangeType !== brokerType || !walletId) {
|
|
33228
|
+
return;
|
|
33229
|
+
}
|
|
33230
|
+
setIsLoadingBluvoModal(false);
|
|
33231
|
+
if (isConnectingRef.current) {
|
|
33232
|
+
trackExchangeConnectCompleted(brokerType);
|
|
33233
|
+
isConnectingRef.current = false;
|
|
33234
|
+
}
|
|
33235
|
+
const paymentInfo = createPaymentMethodInfo({
|
|
33236
|
+
paymentMethod: PaymentMethod.BROKERAGE,
|
|
33237
|
+
deviceId: walletId,
|
|
33238
|
+
exchange: exchangeType
|
|
33239
|
+
});
|
|
33240
|
+
updateSelectedPaymentMethodInfo(paymentInfo);
|
|
33241
|
+
onNext({ paymentMethodInfo: paymentInfo, popCurrentStep: true });
|
|
33242
|
+
});
|
|
33243
|
+
const handleAuthError = useEffectEvent(
|
|
33244
|
+
(error) => {
|
|
33245
|
+
setAuthError(error.message);
|
|
33246
|
+
setIsLoadingBluvoModal(false);
|
|
33247
|
+
if (isConnectingRef.current) {
|
|
33248
|
+
trackExchangeConnectFailed({
|
|
33249
|
+
errorCode: error.code,
|
|
33250
|
+
errorMessage: error.messageKey,
|
|
33251
|
+
provider: brokerType
|
|
33252
|
+
});
|
|
33253
|
+
isConnectingRef.current = false;
|
|
33254
|
+
}
|
|
33255
|
+
}
|
|
33256
|
+
);
|
|
33257
|
+
useEffect56(() => {
|
|
33258
|
+
if (isConnected) {
|
|
33259
|
+
navigateToBrokerage();
|
|
33260
|
+
}
|
|
33261
|
+
}, [isConnected]);
|
|
33262
|
+
const onClickContinue = useCallback38(async () => {
|
|
33263
|
+
try {
|
|
33264
|
+
isConnectingRef.current = true;
|
|
33265
|
+
setIsLoadingBluvoModal(true);
|
|
33266
|
+
setAuthError("");
|
|
33267
|
+
trackExchangeConnectStarted(brokerType);
|
|
33268
|
+
const result = await handleStartWithdrawal(brokerType);
|
|
33269
|
+
if ("error" in result) {
|
|
33270
|
+
handleAuthError({
|
|
33271
|
+
code: result.error.code,
|
|
33272
|
+
messageKey: "brokerage.bluvoConnectionError",
|
|
33273
|
+
message: t("brokerage.bluvoConnectionError")
|
|
33274
|
+
});
|
|
33275
|
+
}
|
|
33276
|
+
} catch (err) {
|
|
33277
|
+
logger.error("Unable to connect to bluvo", err);
|
|
33278
|
+
handleAuthError({
|
|
33279
|
+
code: null,
|
|
33280
|
+
messageKey: "brokerage.bluvoConnectionError",
|
|
33281
|
+
message: t("brokerage.bluvoConnectionError")
|
|
33282
|
+
});
|
|
33283
|
+
} finally {
|
|
33284
|
+
setIsLoadingBluvoModal(false);
|
|
33285
|
+
}
|
|
33286
|
+
}, [
|
|
33287
|
+
brokerType,
|
|
33288
|
+
handleStartWithdrawal,
|
|
33289
|
+
handleAuthError,
|
|
33290
|
+
t,
|
|
33291
|
+
trackExchangeConnectFailed,
|
|
33292
|
+
trackExchangeConnectStarted
|
|
33293
|
+
]);
|
|
33294
|
+
const bottomSectionRef = useBottomSectionRef();
|
|
33295
|
+
const { CustomComponent } = uiCustomizations.connectExchangeScreen;
|
|
33296
|
+
return /* @__PURE__ */ React188.createElement(Box, { id: "connect-exchange" }, uiCustomizations.connectExchangeScreen.customTopComponent?.(), CustomComponent ? /* @__PURE__ */ React188.createElement(
|
|
33297
|
+
CustomComponent,
|
|
33298
|
+
{
|
|
33299
|
+
appName,
|
|
33300
|
+
exchangeIcon: icon,
|
|
33301
|
+
exchangeName,
|
|
33302
|
+
exchangeType: exchangeType || null
|
|
33303
|
+
}
|
|
33304
|
+
) : /* @__PURE__ */ React188.createElement(Box, { display: "flex", flexDirection: "column", gap: "verticalSectionGap" }, /* @__PURE__ */ React188.createElement(
|
|
33305
|
+
FunMessage,
|
|
33306
|
+
{
|
|
33307
|
+
icon,
|
|
33308
|
+
title: t("brokerage.thirdPartyConnectionMessage", {
|
|
33309
|
+
appName,
|
|
33310
|
+
exchangeName
|
|
33311
|
+
})
|
|
33312
|
+
}
|
|
33313
|
+
), /* @__PURE__ */ React188.createElement(FunGuarantees, { guarantees: getGuaranteeList(brokerType, t) })), bottomSectionRef && createPortal12(
|
|
33314
|
+
/* @__PURE__ */ React188.createElement(
|
|
33315
|
+
Dialog.BottomBar,
|
|
33316
|
+
{
|
|
33317
|
+
topSectionVisible: authError !== "",
|
|
33318
|
+
topSection: /* @__PURE__ */ React188.createElement(
|
|
33319
|
+
FunNotification,
|
|
33320
|
+
{
|
|
33321
|
+
description: authError,
|
|
33322
|
+
type: "error",
|
|
33323
|
+
isVisible: authError !== ""
|
|
33324
|
+
}
|
|
33325
|
+
),
|
|
33326
|
+
actionButtonProps: {
|
|
33327
|
+
title: t("brokerage.continue"),
|
|
33328
|
+
onClick: onClickContinue,
|
|
33329
|
+
isLoading,
|
|
33330
|
+
isDisabled: isLoading || authError !== ""
|
|
33331
|
+
}
|
|
33332
|
+
}
|
|
33333
|
+
),
|
|
33334
|
+
bottomSectionRef
|
|
33335
|
+
));
|
|
33336
|
+
}
|
|
33337
|
+
|
|
33338
|
+
// src/modals/CheckoutModal/Brokerage/SelectBrokerage.tsx
|
|
33339
|
+
import React191, { useCallback as useCallback39, useState as useState56 } from "react";
|
|
33340
|
+
import { createPortal as createPortal13 } from "react-dom";
|
|
33341
|
+
|
|
33342
|
+
// src/components/FunSelectBrokerage/FunSelectBrokerage.tsx
|
|
33343
|
+
import clsx19 from "clsx";
|
|
33344
|
+
import React190 from "react";
|
|
33345
|
+
|
|
33346
|
+
// src/css/scrollStyles.css.ts
|
|
33347
|
+
var hideScrollBar = "_163ehmk0";
|
|
33348
|
+
var selectWrapperStyle = "_163ehmk1";
|
|
33349
|
+
|
|
33350
|
+
// src/components/FunSelectBrokerage/FunBrokerageItem.tsx
|
|
33351
|
+
import React189 from "react";
|
|
33352
|
+
|
|
33353
|
+
// src/components/FunSelectBrokerage/FunBrokerageItem.css.ts
|
|
33354
|
+
var brokerageItemStyle = "an34y90";
|
|
33355
|
+
|
|
33356
|
+
// src/components/FunSelectBrokerage/FunBrokerageItem.tsx
|
|
33357
|
+
var FunBrokerageItem = ({
|
|
33358
|
+
exchangeName,
|
|
33359
|
+
exchangeIcon,
|
|
33360
|
+
hasActiveConnection,
|
|
33361
|
+
badgeText,
|
|
33362
|
+
disabled,
|
|
33363
|
+
fontSize = "12",
|
|
33364
|
+
fontWeight = "medium"
|
|
33365
|
+
}) => {
|
|
33366
|
+
const { t } = useFunkitTranslation();
|
|
33367
|
+
return /* @__PURE__ */ React189.createElement(
|
|
33368
|
+
Box,
|
|
33369
|
+
{
|
|
33370
|
+
className: brokerageItemStyle,
|
|
33371
|
+
disabled,
|
|
33372
|
+
cursor: disabled ? "not-allowed" : void 0
|
|
33373
|
+
},
|
|
33374
|
+
/* @__PURE__ */ React189.createElement(
|
|
33375
|
+
Box,
|
|
33376
|
+
{
|
|
33377
|
+
alignItems: "center",
|
|
33378
|
+
display: "flex",
|
|
33379
|
+
flexDirection: "row",
|
|
33380
|
+
gap: "12",
|
|
33381
|
+
style: { opacity: disabled ? 0.5 : 1 }
|
|
33382
|
+
},
|
|
33383
|
+
exchangeIcon,
|
|
33384
|
+
exchangeName && /* @__PURE__ */ React189.createElement(Text, { size: fontSize, weight: fontWeight, as: "span" }, exchangeName)
|
|
33385
|
+
),
|
|
33386
|
+
/* @__PURE__ */ React189.createElement(Box, { display: "flex", gap: "8", alignItems: "center", color: "secondaryText" }, hasActiveConnection && /* @__PURE__ */ React189.createElement(
|
|
33387
|
+
FunBadge,
|
|
33388
|
+
{
|
|
33389
|
+
background: "newBadgeBackground",
|
|
33390
|
+
borderColor: "newBadgeBorder",
|
|
33391
|
+
color: "newBadgeText"
|
|
33392
|
+
},
|
|
33393
|
+
t("common.connected")
|
|
33394
|
+
), badgeText && /* @__PURE__ */ React189.createElement(FunBadge, { borderColor: "generalBorder" }, badgeText))
|
|
33395
|
+
);
|
|
33396
|
+
};
|
|
33397
|
+
|
|
33398
|
+
// src/components/FunSelectBrokerage/FunSelectBrokerage.tsx
|
|
33399
|
+
function FunSelectBrokerage({
|
|
33400
|
+
isDisabled,
|
|
33401
|
+
options,
|
|
33402
|
+
onSelect,
|
|
33403
|
+
selectedKey
|
|
33404
|
+
}) {
|
|
33405
|
+
const { uiCustomizations } = useFunkitConfig();
|
|
33406
|
+
const { enableCompactList } = uiCustomizations;
|
|
33407
|
+
const { t } = useFunkitTranslation();
|
|
33408
|
+
if (options.length === 0) {
|
|
33409
|
+
return /* @__PURE__ */ React190.createElement(FunNoResults, { text: t("common.noResultsFound") });
|
|
33410
|
+
}
|
|
33411
|
+
return /* @__PURE__ */ React190.createElement(
|
|
33412
|
+
Box,
|
|
33413
|
+
{
|
|
33414
|
+
className: clsx19(hideScrollBar, selectWrapperStyle),
|
|
33415
|
+
width: "full",
|
|
33416
|
+
display: "flex",
|
|
33417
|
+
flexDirection: "column",
|
|
33418
|
+
gap: uiCustomizations.enableCompactList ? "0" : "selectBrokerageListGap"
|
|
33419
|
+
},
|
|
33420
|
+
options.map((option) => {
|
|
33421
|
+
const key = brokerageOptionKey(option);
|
|
33422
|
+
const isComingSoon = option.status === "coming_soon" /* ComingSoon */;
|
|
33423
|
+
const hasActiveConnection = option.kind === "bluvo" && option.hasActiveConnection;
|
|
33424
|
+
const isDisabledItem = isDisabled || isComingSoon || hasActiveConnection || option.kind === "swapped" /* SWAPPED */ && !option.fop.embeddedFlowUrl;
|
|
33425
|
+
return /* @__PURE__ */ React190.createElement(
|
|
33426
|
+
FunOptionBox,
|
|
33427
|
+
{
|
|
33428
|
+
key,
|
|
33429
|
+
isActive: selectedKey === key,
|
|
33430
|
+
isCompactList: uiCustomizations.enableCompactList,
|
|
33431
|
+
onClick: isDisabledItem ? void 0 : () => onSelect(option),
|
|
33432
|
+
paddingX: "selectBrokerageItemPaddingX",
|
|
33433
|
+
paddingY: "selectBrokerageItemPaddingY",
|
|
33434
|
+
type: "default"
|
|
33435
|
+
},
|
|
33436
|
+
/* @__PURE__ */ React190.createElement(
|
|
33437
|
+
FunBrokerageItem,
|
|
33438
|
+
{
|
|
33439
|
+
exchangeName: option.name,
|
|
33440
|
+
exchangeIcon: option.icon,
|
|
33441
|
+
hasActiveConnection,
|
|
33442
|
+
badgeText: isComingSoon ? t("common.comingSoon") : void 0,
|
|
33443
|
+
disabled: isDisabledItem,
|
|
33444
|
+
fontSize: enableCompactList ? "14" : "12",
|
|
33445
|
+
fontWeight: enableCompactList ? "semibold" : "medium"
|
|
33446
|
+
}
|
|
33447
|
+
)
|
|
33448
|
+
);
|
|
33449
|
+
})
|
|
33450
|
+
);
|
|
33451
|
+
}
|
|
33452
|
+
|
|
33714
33453
|
// src/utils/openExternalFlowPopup.ts
|
|
33715
33454
|
var THEMES = {
|
|
33716
33455
|
light: {
|
|
@@ -33972,8 +33711,8 @@ function CheckoutComplete({
|
|
|
33972
33711
|
}
|
|
33973
33712
|
|
|
33974
33713
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
33975
|
-
import * as
|
|
33976
|
-
import React206, { useEffect as
|
|
33714
|
+
import * as dnum8 from "dnum";
|
|
33715
|
+
import React206, { useEffect as useEffect61, useMemo as useMemo50, useState as useState66 } from "react";
|
|
33977
33716
|
import { createPortal as createPortal15 } from "react-dom";
|
|
33978
33717
|
import { DirectExecutionType as DirectExecutionType7 } from "@funkit/api-base";
|
|
33979
33718
|
|
|
@@ -34009,7 +33748,7 @@ import {
|
|
|
34009
33748
|
} from "@funkit/utils";
|
|
34010
33749
|
import NumberFlow from "@number-flow/react";
|
|
34011
33750
|
import { motion as motion11 } from "motion/react";
|
|
34012
|
-
import React194, { useMemo as
|
|
33751
|
+
import React194, { useMemo as useMemo46 } from "react";
|
|
34013
33752
|
import { LIGHTER_CHAIN_ID } from "@funkit/chains";
|
|
34014
33753
|
|
|
34015
33754
|
// src/consts/design.ts
|
|
@@ -34074,7 +33813,7 @@ function PaymentAmountSummary({
|
|
|
34074
33813
|
const feeBreakdown = quote?.baseQuote.metadata?.feeBreakdown;
|
|
34075
33814
|
return checkoutConfig?.generateActionsParams ? feeBreakdown?.swapImpact || 0 : 0;
|
|
34076
33815
|
})();
|
|
34077
|
-
const receiveTokenUsdAmount =
|
|
33816
|
+
const receiveTokenUsdAmount = useMemo46(() => {
|
|
34078
33817
|
if (!quote) {
|
|
34079
33818
|
return void 0;
|
|
34080
33819
|
}
|
|
@@ -34411,8 +34150,8 @@ import {
|
|
|
34411
34150
|
import { permitTypedData, reserve, supply } from "@aave/client/actions";
|
|
34412
34151
|
import { sendWith, signERC20PermitWith } from "@aave/client/viem";
|
|
34413
34152
|
import { DirectExecutionType as DirectExecutionType5, createDirectExecution as createDirectExecution3 } from "@funkit/api-base";
|
|
34414
|
-
import { useQuery as
|
|
34415
|
-
import * as
|
|
34153
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
34154
|
+
import * as dnum7 from "dnum";
|
|
34416
34155
|
import { useCallback as useCallback41, useState as useState57 } from "react";
|
|
34417
34156
|
import { erc20Abi as erc20Abi5 } from "viem";
|
|
34418
34157
|
|
|
@@ -34436,7 +34175,7 @@ var aaveClient = AaveClient.create({ environment: production });
|
|
|
34436
34175
|
// src/modals/CheckoutModal/InputAmount/useAaveNativeSupply.ts
|
|
34437
34176
|
function formatSupplyAmount(tokenAmountBaseUnit, fallbackAssetAmount) {
|
|
34438
34177
|
if (tokenAmountBaseUnit) {
|
|
34439
|
-
return
|
|
34178
|
+
return dnum7.toString(tokenAmountBaseUnit);
|
|
34440
34179
|
}
|
|
34441
34180
|
return String(fallbackAssetAmount ?? 0);
|
|
34442
34181
|
}
|
|
@@ -34650,7 +34389,7 @@ function useAaveTargetPoolAllowance(checkoutItem, owner) {
|
|
|
34650
34389
|
const targetAsset = config?.targetAsset;
|
|
34651
34390
|
const market = targetChainStr ? AAVE_MARKET_ADDRESS_BY_CHAIN[targetChainStr] : void 0;
|
|
34652
34391
|
const wagmiConfig = useConfig();
|
|
34653
|
-
const { data } =
|
|
34392
|
+
const { data } = useQuery18({
|
|
34654
34393
|
queryKey: [
|
|
34655
34394
|
"aaveTargetPoolAllowance",
|
|
34656
34395
|
targetChainStr,
|
|
@@ -34682,7 +34421,7 @@ function useAaveTargetReservePermit(checkoutItem) {
|
|
|
34682
34421
|
const targetChainStr = config?.targetChain;
|
|
34683
34422
|
const targetAsset = config?.targetAsset;
|
|
34684
34423
|
const market = targetChainStr ? AAVE_MARKET_ADDRESS_BY_CHAIN[targetChainStr] : void 0;
|
|
34685
|
-
const { data } =
|
|
34424
|
+
const { data } = useQuery18({
|
|
34686
34425
|
queryKey: [
|
|
34687
34426
|
"aaveReservePermitSupported",
|
|
34688
34427
|
targetChainStr,
|
|
@@ -35168,11 +34907,11 @@ import React201 from "react";
|
|
|
35168
34907
|
|
|
35169
34908
|
// src/components/AnimatedDollarValue/AnimatedDollarValue.tsx
|
|
35170
34909
|
import NumberFlow2 from "@number-flow/react";
|
|
35171
|
-
import React199, { forwardRef as forwardRef5, useMemo as
|
|
34910
|
+
import React199, { forwardRef as forwardRef5, useMemo as useMemo47 } from "react";
|
|
35172
34911
|
var AnimatedDollarValue = forwardRef5((props, ref) => {
|
|
35173
34912
|
const { value, dynamicMinFractionDigits, ...restProps } = props;
|
|
35174
34913
|
const minimumFractionDigits = typeof value === "number" && !Number.isInteger(value) || !dynamicMinFractionDigits ? 2 : 0;
|
|
35175
|
-
const formatOptions =
|
|
34914
|
+
const formatOptions = useMemo47(
|
|
35176
34915
|
() => ({
|
|
35177
34916
|
style: "currency",
|
|
35178
34917
|
currency: "USD",
|
|
@@ -35312,7 +35051,7 @@ function CheckoutPrimaryInfo({
|
|
|
35312
35051
|
}
|
|
35313
35052
|
|
|
35314
35053
|
// src/modals/CheckoutModal/ConfirmationStep/DisclaimerText.tsx
|
|
35315
|
-
import React202, { useMemo as
|
|
35054
|
+
import React202, { useMemo as useMemo48 } from "react";
|
|
35316
35055
|
var FunLinkButtonComponent = ({
|
|
35317
35056
|
children,
|
|
35318
35057
|
href
|
|
@@ -35358,7 +35097,7 @@ var DisclaimerText = ({
|
|
|
35358
35097
|
};
|
|
35359
35098
|
function useCardDisclaimer(checkoutItem, finalConvertedAssetName) {
|
|
35360
35099
|
const { t } = useFunkitTranslation();
|
|
35361
|
-
const cardDisclaimer =
|
|
35100
|
+
const cardDisclaimer = useMemo48(() => {
|
|
35362
35101
|
if (!checkoutItem || !finalConvertedAssetName) {
|
|
35363
35102
|
return null;
|
|
35364
35103
|
}
|
|
@@ -35427,7 +35166,10 @@ function useCheckoutConfirmation({
|
|
|
35427
35166
|
walletAddress,
|
|
35428
35167
|
customRecipient
|
|
35429
35168
|
});
|
|
35430
|
-
const isRisky = await hasRisk(apiKey, walletAddress, customRecipient
|
|
35169
|
+
const isRisky = await hasRisk(apiKey, walletAddress, customRecipient, {
|
|
35170
|
+
sourceChainId: checkoutItem.selectedSourceAssetInfo.chainId,
|
|
35171
|
+
targetChainId: checkoutItem.initSettings.config.targetChain
|
|
35172
|
+
});
|
|
35431
35173
|
const isCheckoutRisky = isRisky || isWalletBlacklisted || isCustomRecipientBlacklisted;
|
|
35432
35174
|
if (isCheckoutRisky) {
|
|
35433
35175
|
throw new Error("RISK_ERROR" /* RISK_ERROR */);
|
|
@@ -35497,7 +35239,7 @@ function mapRetryAction(quoteBuilder, params) {
|
|
|
35497
35239
|
}
|
|
35498
35240
|
|
|
35499
35241
|
// src/modals/CheckoutModal/ConfirmationStep/useSourceAssetConfirm.tsx
|
|
35500
|
-
import { useEffect as
|
|
35242
|
+
import { useEffect as useEffect57, useState as useState60 } from "react";
|
|
35501
35243
|
function useSourceAssetConfirm(setPreloadedQuoteData) {
|
|
35502
35244
|
const { setCheckoutQuote, getCheckoutQuote, setQuoteProgress } = useQuoteContext();
|
|
35503
35245
|
const { checkoutItem, setCheckout } = useCheckoutContext();
|
|
@@ -35546,7 +35288,7 @@ function useHackyTriggerWorkaroundReactDevBrainExplode() {
|
|
|
35546
35288
|
function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult, setPreloadedQuoteData) {
|
|
35547
35289
|
const [assetRefresh, triggerAssetConfirm] = useHackyTriggerWorkaroundReactDevBrainExplode();
|
|
35548
35290
|
const { isSourceAssetConfirming, onSourceAssetConfirmed } = useSourceAssetConfirm(setPreloadedQuoteData);
|
|
35549
|
-
|
|
35291
|
+
useEffect57(() => {
|
|
35550
35292
|
if (assetRefresh === 0) {
|
|
35551
35293
|
return;
|
|
35552
35294
|
}
|
|
@@ -35906,7 +35648,7 @@ function usePostCheckout({
|
|
|
35906
35648
|
}
|
|
35907
35649
|
|
|
35908
35650
|
// src/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.ts
|
|
35909
|
-
import { useCallback as useCallback46, useEffect as
|
|
35651
|
+
import { useCallback as useCallback46, useEffect as useEffect59, useMemo as useMemo49, useRef as useRef29, useState as useState65 } from "react";
|
|
35910
35652
|
|
|
35911
35653
|
// src/hooks/useCountdown.tsx
|
|
35912
35654
|
import React205 from "react";
|
|
@@ -35914,7 +35656,7 @@ import { useCallback as useCallback45, useState as useState64 } from "react";
|
|
|
35914
35656
|
|
|
35915
35657
|
// src/components/FunCountdown/FunCountdown.tsx
|
|
35916
35658
|
import { noop as noop5 } from "@funkit/utils";
|
|
35917
|
-
import React204, { useCallback as useCallback44, useEffect as
|
|
35659
|
+
import React204, { useCallback as useCallback44, useEffect as useEffect58, useState as useState63 } from "react";
|
|
35918
35660
|
|
|
35919
35661
|
// src/components/FunCountdown/FunCountdown.css.ts
|
|
35920
35662
|
var backgroundRing = "_1t0bc111 _1rsrm2f2mm";
|
|
@@ -35957,7 +35699,7 @@ var FunCountdown = ({
|
|
|
35957
35699
|
setRemainingSeconds((prev) => prev > 0 ? prev - 1 : prev);
|
|
35958
35700
|
}, [isPaused]);
|
|
35959
35701
|
useInterval(handleInterval, 1e3);
|
|
35960
|
-
|
|
35702
|
+
useEffect58(() => {
|
|
35961
35703
|
if (remainingSeconds === onBeforeCountdownEndsSeconds) {
|
|
35962
35704
|
onBeforeCountdownEndsOnce();
|
|
35963
35705
|
}
|
|
@@ -36111,7 +35853,7 @@ function useQuoteRefresh({
|
|
|
36111
35853
|
const quoteCallbackRef = useRef29(void 0);
|
|
36112
35854
|
const [isPendingRefresh, setIsPendingRefresh] = useState65(false);
|
|
36113
35855
|
const [numQuoteRefreshes, setNumQuoteRefreshes] = useState65(0);
|
|
36114
|
-
|
|
35856
|
+
useEffect59(() => {
|
|
36115
35857
|
setNumQuoteRefreshes(0);
|
|
36116
35858
|
}, [checkoutId]);
|
|
36117
35859
|
const {
|
|
@@ -36188,7 +35930,7 @@ function useQuoteRefresh({
|
|
|
36188
35930
|
},
|
|
36189
35931
|
[isOnHold, restartCountdown, setCheckoutQuote, triggerAssetConfirm]
|
|
36190
35932
|
);
|
|
36191
|
-
const quoteError =
|
|
35933
|
+
const quoteError = useMemo49(() => {
|
|
36192
35934
|
if (quoteErrorMessage && !isQuoting) {
|
|
36193
35935
|
return {
|
|
36194
35936
|
message: quoteErrorMessage,
|
|
@@ -36197,7 +35939,7 @@ function useQuoteRefresh({
|
|
|
36197
35939
|
}
|
|
36198
35940
|
return null;
|
|
36199
35941
|
}, [isQuoting, quoteErrorMessage]);
|
|
36200
|
-
|
|
35942
|
+
useEffect59(() => {
|
|
36201
35943
|
if (isPendingRefresh && !isOnHold) {
|
|
36202
35944
|
setIsPendingRefresh(false);
|
|
36203
35945
|
refreshQuote();
|
|
@@ -36215,7 +35957,7 @@ function useQuoteRefresh({
|
|
|
36215
35957
|
}
|
|
36216
35958
|
|
|
36217
35959
|
// src/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.ts
|
|
36218
|
-
import { useCallback as useCallback47, useEffect as
|
|
35960
|
+
import { useCallback as useCallback47, useEffect as useEffect60, useRef as useRef30 } from "react";
|
|
36219
35961
|
function buildQuoteEventArgs({
|
|
36220
35962
|
checkoutConfig,
|
|
36221
35963
|
checkoutItem,
|
|
@@ -36275,10 +36017,10 @@ function useTrackDepositQuoteEvents({
|
|
|
36275
36017
|
const checkoutId = checkoutItem?.id ?? null;
|
|
36276
36018
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
36277
36019
|
const lastDisplayedQuoteIdRef = useRef30(null);
|
|
36278
|
-
|
|
36020
|
+
useEffect60(() => {
|
|
36279
36021
|
lastDisplayedQuoteIdRef.current = null;
|
|
36280
36022
|
}, [checkoutId]);
|
|
36281
|
-
|
|
36023
|
+
useEffect60(() => {
|
|
36282
36024
|
if (!checkoutItem?.finalDollarValue || !checkoutConfig || !latestQuote || isQuoteLoading) {
|
|
36283
36025
|
return;
|
|
36284
36026
|
}
|
|
@@ -36456,8 +36198,8 @@ function ConfirmationStep({
|
|
|
36456
36198
|
onFailure: (error2) => {
|
|
36457
36199
|
console.error(error2);
|
|
36458
36200
|
if (error2.reason === "insufficientBalance" && error2.maxTargetAssetAmount !== void 0) {
|
|
36459
|
-
const zero =
|
|
36460
|
-
if (
|
|
36201
|
+
const zero = dnum8.from(0, error2.maxTargetAssetAmount[1]);
|
|
36202
|
+
if (dnum8.greaterThan(error2.maxTargetAssetAmount, zero) && (error2.minTargetAssetAmount === void 0 || !dnum8.lessThan(
|
|
36461
36203
|
error2.maxTargetAssetAmount,
|
|
36462
36204
|
error2.minTargetAssetAmount
|
|
36463
36205
|
))) {
|
|
@@ -36466,7 +36208,7 @@ function ConfirmationStep({
|
|
|
36466
36208
|
}
|
|
36467
36209
|
}
|
|
36468
36210
|
});
|
|
36469
|
-
|
|
36211
|
+
useEffect61(() => {
|
|
36470
36212
|
if (!isDirectWalletTransfer) {
|
|
36471
36213
|
triggerNewQuote({ maxRetries: 1 });
|
|
36472
36214
|
}
|
|
@@ -36489,7 +36231,7 @@ function ConfirmationStep({
|
|
|
36489
36231
|
})
|
|
36490
36232
|
);
|
|
36491
36233
|
const error = confirmationError ?? postCheckoutError ?? quoteError ?? aaveSupply.error ?? nadoDirectTransfer.error;
|
|
36492
|
-
const stepMessage =
|
|
36234
|
+
const stepMessage = useMemo50(() => {
|
|
36493
36235
|
if (initialQuoteStep) {
|
|
36494
36236
|
return initialQuoteStep;
|
|
36495
36237
|
}
|
|
@@ -36610,7 +36352,7 @@ function ConfirmationStep({
|
|
|
36610
36352
|
};
|
|
36611
36353
|
const isStepLoading = isInitialQuoting || isContinuing || isRefreshing || aaveSupply.isPending || nadoDirectTransfer.isPending;
|
|
36612
36354
|
const customRecipient = checkoutItem?.initSettings.config.customRecipient;
|
|
36613
|
-
const displayAmounts =
|
|
36355
|
+
const displayAmounts = useMemo50(() => {
|
|
36614
36356
|
if (!latestQuote || !checkoutConfig?.targetAssetAmount) {
|
|
36615
36357
|
return null;
|
|
36616
36358
|
}
|
|
@@ -36626,7 +36368,7 @@ function ConfirmationStep({
|
|
|
36626
36368
|
quoteBuilder
|
|
36627
36369
|
]);
|
|
36628
36370
|
const supplyHumanAmount = displayAmounts?.receiveAmount ?? (checkoutConfig?.targetAssetAmount != null ? String(checkoutConfig.targetAssetAmount) : null);
|
|
36629
|
-
const resolveHealthFactor =
|
|
36371
|
+
const resolveHealthFactor = useMemo50(
|
|
36630
36372
|
() => wrapResolveHealthFactor(checkoutConfig?.resolveHealthFactor),
|
|
36631
36373
|
[checkoutConfig?.resolveHealthFactor]
|
|
36632
36374
|
);
|
|
@@ -36640,7 +36382,7 @@ function ConfirmationStep({
|
|
|
36640
36382
|
const hasStaticPrimaryInfoValue = isExactIn && checkoutItem?.inputFiatAmount != null || !isExactIn && !!checkoutConfig?.targetAssetAmount && isStablecoin(checkoutConfig.targetAssetTicker);
|
|
36641
36383
|
const checkoutId = checkoutItem?.id;
|
|
36642
36384
|
const isReady = !!checkoutItem?.finalDollarValue && !isQuoteLoading;
|
|
36643
|
-
|
|
36385
|
+
useEffect61(() => {
|
|
36644
36386
|
if (checkoutId && isReady) {
|
|
36645
36387
|
logMeasuredEvent({
|
|
36646
36388
|
eventName: "fc::ready::confirmation" /* READY_CONFIRMATION */,
|
|
@@ -36771,11 +36513,11 @@ function ConfirmationStep({
|
|
|
36771
36513
|
|
|
36772
36514
|
// src/modals/CheckoutModal/InputAmount/InputAmount.tsx
|
|
36773
36515
|
import { isMobile as isMobile7 } from "@funkit/utils";
|
|
36774
|
-
import React221, { useEffect as
|
|
36516
|
+
import React221, { useEffect as useEffect65 } from "react";
|
|
36775
36517
|
|
|
36776
36518
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
36777
36519
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
36778
|
-
import { useQuery as
|
|
36520
|
+
import { useQuery as useQuery19 } from "@tanstack/react-query";
|
|
36779
36521
|
var getPriority = (currencyCode) => {
|
|
36780
36522
|
if (currencyCode === "USD") {
|
|
36781
36523
|
return 0;
|
|
@@ -36787,7 +36529,7 @@ var getPriority = (currencyCode) => {
|
|
|
36787
36529
|
};
|
|
36788
36530
|
var useMeldCurrencies = (isEnabled = true) => {
|
|
36789
36531
|
const { apiKey } = useFunkitConfig();
|
|
36790
|
-
const query =
|
|
36532
|
+
const query = useQuery19({
|
|
36791
36533
|
queryKey: ["meld", "currencies"],
|
|
36792
36534
|
queryFn: async () => {
|
|
36793
36535
|
if (!apiKey) {
|
|
@@ -36813,12 +36555,12 @@ var useMeldCurrencies = (isEnabled = true) => {
|
|
|
36813
36555
|
|
|
36814
36556
|
// src/hooks/queries/useMeldDefaultCurrency.ts
|
|
36815
36557
|
import { getMeldDefaultFiat } from "@funkit/api-base";
|
|
36816
|
-
import { useQuery as
|
|
36558
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
36817
36559
|
var useMeldDefaultCurrency = (paymentMethod) => {
|
|
36818
36560
|
const { apiKey } = useFunkitConfig();
|
|
36819
36561
|
const { userIpInfo } = useFunkitUserIp();
|
|
36820
36562
|
const enableMeld = useIsMeldEnabled();
|
|
36821
|
-
const query =
|
|
36563
|
+
const query = useQuery20({
|
|
36822
36564
|
queryKey: ["meld", "defaultCurrency", paymentMethod],
|
|
36823
36565
|
queryFn: async () => {
|
|
36824
36566
|
if (!apiKey) {
|
|
@@ -36844,7 +36586,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
36844
36586
|
// src/hooks/queries/useMeldLimits.ts
|
|
36845
36587
|
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
36846
36588
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify8 } from "@funkit/utils";
|
|
36847
|
-
import { useQuery as
|
|
36589
|
+
import { useQuery as useQuery21 } from "@tanstack/react-query";
|
|
36848
36590
|
|
|
36849
36591
|
// src/hooks/useMinDeposit.ts
|
|
36850
36592
|
import { getMeldMinDepositInCurrency } from "@funkit/connect-core";
|
|
@@ -36881,7 +36623,7 @@ var useMeldLimits = (isEnabled = true) => {
|
|
|
36881
36623
|
const { userIpInfo } = useFunkitUserIp();
|
|
36882
36624
|
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
36883
36625
|
const countryCode = userIpInfo?.alpha2;
|
|
36884
|
-
const query =
|
|
36626
|
+
const query = useQuery21({
|
|
36885
36627
|
queryKey: ["meld", "limits", countryCode, cryptoCurrency],
|
|
36886
36628
|
queryFn: async () => {
|
|
36887
36629
|
if (!apiKey || !countryCode) {
|
|
@@ -36973,20 +36715,20 @@ import {
|
|
|
36973
36715
|
isTokenEquivalent as isTokenEquivalent11,
|
|
36974
36716
|
round as round3
|
|
36975
36717
|
} from "@funkit/utils";
|
|
36976
|
-
import * as
|
|
36718
|
+
import * as dnum10 from "dnum";
|
|
36977
36719
|
import { motion as motion13 } from "motion/react";
|
|
36978
|
-
import React219, { useEffect as
|
|
36720
|
+
import React219, { useEffect as useEffect64, useMemo as useMemo54, useState as useState70 } from "react";
|
|
36979
36721
|
|
|
36980
36722
|
// src/components/AnimatedWidthWrapper/AnimatedWidthWrapper.tsx
|
|
36981
36723
|
import { motion as motion12 } from "motion/react";
|
|
36982
36724
|
import React207 from "react";
|
|
36983
|
-
import { useEffect as
|
|
36725
|
+
import { useEffect as useEffect62, useRef as useRef31, useState as useState67 } from "react";
|
|
36984
36726
|
function AnimatedWidthWrapper({ children }) {
|
|
36985
36727
|
const containerRef = useRef31(null);
|
|
36986
36728
|
const animationFrameRef = useRef31(null);
|
|
36987
36729
|
const resizeObserverRef = useRef31(null);
|
|
36988
36730
|
const [width, setWidth] = useState67("auto");
|
|
36989
|
-
|
|
36731
|
+
useEffect62(() => {
|
|
36990
36732
|
if (containerRef.current) {
|
|
36991
36733
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
36992
36734
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
@@ -37018,7 +36760,7 @@ function AnimatedWidthWrapper({ children }) {
|
|
|
37018
36760
|
}
|
|
37019
36761
|
|
|
37020
36762
|
// src/components/ApprovalMethodToggle/ApprovalMethodToggle.tsx
|
|
37021
|
-
import React208, { useCallback as useCallback48, useMemo as
|
|
36763
|
+
import React208, { useCallback as useCallback48, useMemo as useMemo51, useRef as useRef32 } from "react";
|
|
37022
36764
|
function ApprovalMethodToggle({
|
|
37023
36765
|
value,
|
|
37024
36766
|
onChange,
|
|
@@ -37027,7 +36769,7 @@ function ApprovalMethodToggle({
|
|
|
37027
36769
|
}) {
|
|
37028
36770
|
const { t } = useFunkitTranslation();
|
|
37029
36771
|
const tooltipAnchorRef = useRef32(null);
|
|
37030
|
-
const options =
|
|
36772
|
+
const options = useMemo51(
|
|
37031
36773
|
() => [
|
|
37032
36774
|
{ label: t("approvalMethodToggle.signedMessage"), value: "sign" },
|
|
37033
36775
|
{
|
|
@@ -38009,6 +37751,9 @@ var YouPayYouReceiveBottomBarLayoutWrapper = ({
|
|
|
38009
37751
|
);
|
|
38010
37752
|
};
|
|
38011
37753
|
|
|
37754
|
+
// src/modals/CheckoutModal/InputAmount/InputAmountLoaded.tsx
|
|
37755
|
+
import { safeBigInt as safeBigInt3 } from "@funkit/connect-core";
|
|
37756
|
+
|
|
38012
37757
|
// src/components/Icons/SwitchIcon.tsx
|
|
38013
37758
|
import React213 from "react";
|
|
38014
37759
|
var SwitchIcon = () => {
|
|
@@ -38258,8 +38003,8 @@ var useCheckoutAmountLimits = ({
|
|
|
38258
38003
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
38259
38004
|
import {
|
|
38260
38005
|
useCallback as useCallback50,
|
|
38261
|
-
useMemo as
|
|
38262
|
-
useReducer as
|
|
38006
|
+
useMemo as useMemo52,
|
|
38007
|
+
useReducer as useReducer3,
|
|
38263
38008
|
useRef as useRef33,
|
|
38264
38009
|
useState as useState69
|
|
38265
38010
|
} from "react";
|
|
@@ -38302,7 +38047,7 @@ function useTextMeasurer(inputRef) {
|
|
|
38302
38047
|
|
|
38303
38048
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
38304
38049
|
import { isEVMAddressEquivalent as isEVMAddressEquivalent4, isTokenEquivalent as isTokenEquivalent10, round as round2 } from "@funkit/utils";
|
|
38305
|
-
import * as
|
|
38050
|
+
import * as dnum9 from "dnum";
|
|
38306
38051
|
import { mainnet as mainnet10 } from "viem/chains";
|
|
38307
38052
|
function resolveUnitPrice(isExactIn, sourceHolding, targetUnitPrice) {
|
|
38308
38053
|
if (!isExactIn) {
|
|
@@ -38387,9 +38132,9 @@ function isAmountAboveAvailable({
|
|
|
38387
38132
|
}
|
|
38388
38133
|
const limit = maxSendableAmount ?? tokenBalanceBaseUnit;
|
|
38389
38134
|
if (tokenAmountBaseUnit !== null) {
|
|
38390
|
-
return
|
|
38135
|
+
return dnum9.greaterThan(tokenAmountBaseUnit, limit);
|
|
38391
38136
|
}
|
|
38392
|
-
return
|
|
38137
|
+
return dnum9.greaterThan(toBaseUnits(assetAmount, limit[1]), limit);
|
|
38393
38138
|
}
|
|
38394
38139
|
function computeInitialTokenAmount(isExactIn, assetAmount, tokenDecimals, tokenBalanceBaseUnit, maxSendableAmount) {
|
|
38395
38140
|
if (!isExactIn || assetAmount === void 0 || tokenDecimals === null) {
|
|
@@ -38399,7 +38144,7 @@ function computeInitialTokenAmount(isExactIn, assetAmount, tokenDecimals, tokenB
|
|
|
38399
38144
|
toBaseUnits(assetAmount, tokenDecimals),
|
|
38400
38145
|
tokenBalanceBaseUnit
|
|
38401
38146
|
);
|
|
38402
|
-
if (clampedToBalance !== null && maxSendableAmount !== null &&
|
|
38147
|
+
if (clampedToBalance !== null && maxSendableAmount !== null && dnum9.greaterThan(clampedToBalance, maxSendableAmount)) {
|
|
38403
38148
|
return maxSendableAmount;
|
|
38404
38149
|
}
|
|
38405
38150
|
return clampedToBalance;
|
|
@@ -38409,7 +38154,7 @@ function parseTokenBalance(sourceHolding) {
|
|
|
38409
38154
|
if (!sourceHolding?.tokenBalanceRaw || decimals === null) {
|
|
38410
38155
|
return null;
|
|
38411
38156
|
}
|
|
38412
|
-
return
|
|
38157
|
+
return dnum9.from([BigInt(sourceHolding.tokenBalanceRaw), decimals]);
|
|
38413
38158
|
}
|
|
38414
38159
|
function tokenToFiat(tokenAmountBaseUnit, frozenUnitPrice, decimals = ASSET_DECIMALS) {
|
|
38415
38160
|
return mulByPriceRoundedDown(tokenAmountBaseUnit, frozenUnitPrice, decimals);
|
|
@@ -38418,7 +38163,7 @@ function clampToBalance(computed, tokenBalanceBaseUnit) {
|
|
|
38418
38163
|
if (computed === null || tokenBalanceBaseUnit === null) {
|
|
38419
38164
|
return computed;
|
|
38420
38165
|
}
|
|
38421
|
-
if (
|
|
38166
|
+
if (dnum9.greaterThan(computed, tokenBalanceBaseUnit) && dnum9.subtract(computed, tokenBalanceBaseUnit)[0] < 1000n) {
|
|
38422
38167
|
return tokenBalanceBaseUnit;
|
|
38423
38168
|
}
|
|
38424
38169
|
return computed;
|
|
@@ -39062,7 +38807,7 @@ var MAX_WIDTH = 310;
|
|
|
39062
38807
|
function useAmountInput(options) {
|
|
39063
38808
|
const { t } = useFunkitTranslation();
|
|
39064
38809
|
const isMeldEnabled = useIsMeldEnabled();
|
|
39065
|
-
const [state, dispatch] =
|
|
38810
|
+
const [state, dispatch] = useReducer3(reduceState, options, initializeState);
|
|
39066
38811
|
const {
|
|
39067
38812
|
unitPrice: realUnitPrice,
|
|
39068
38813
|
checkoutConfig,
|
|
@@ -39070,7 +38815,7 @@ function useAmountInput(options) {
|
|
|
39070
38815
|
quickOptions,
|
|
39071
38816
|
paymentMethodInfo
|
|
39072
38817
|
} = options;
|
|
39073
|
-
const derivedState =
|
|
38818
|
+
const derivedState = useMemo52(
|
|
39074
38819
|
() => getDerivedState(state, checkoutConfig.targetAssetTicker),
|
|
39075
38820
|
[state, checkoutConfig]
|
|
39076
38821
|
);
|
|
@@ -39493,10 +39238,10 @@ var useMeldLink = (sourceAmount, sourceCurrencyCode = "USD") => {
|
|
|
39493
39238
|
// src/modals/CheckoutModal/MeldQuotes/useMeldQuotes.tsx
|
|
39494
39239
|
import { getMeldQuotes } from "@funkit/api-base";
|
|
39495
39240
|
import {
|
|
39496
|
-
useQuery as
|
|
39497
|
-
useQueryClient as
|
|
39241
|
+
useQuery as useQuery22,
|
|
39242
|
+
useQueryClient as useQueryClient6
|
|
39498
39243
|
} from "@tanstack/react-query";
|
|
39499
|
-
import { useEffect as
|
|
39244
|
+
import { useEffect as useEffect63, useMemo as useMemo53 } from "react";
|
|
39500
39245
|
import { useDebounce as useDebounce2 } from "use-debounce";
|
|
39501
39246
|
var DEBOUNCE_DELAY = 500;
|
|
39502
39247
|
var COUNTDOWN_INTERVAL_SEC = 60;
|
|
@@ -39508,11 +39253,11 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
39508
39253
|
const { isAway } = useUserPresence();
|
|
39509
39254
|
const { checkoutItem } = useCheckoutContext();
|
|
39510
39255
|
const { trackDepositMeldQuoteDisplayed } = useDepositAnalytics();
|
|
39511
|
-
const queryClient =
|
|
39256
|
+
const queryClient = useQueryClient6();
|
|
39512
39257
|
const checkoutId = checkoutItem?.id ?? null;
|
|
39513
39258
|
const destinationCurrencyCode = useMeldCryptoCurrencyCode();
|
|
39514
39259
|
const sourceCurrencyCode = fiatCurrency || "USD";
|
|
39515
|
-
const queryKey =
|
|
39260
|
+
const queryKey = useMemo53(
|
|
39516
39261
|
() => [
|
|
39517
39262
|
"meld",
|
|
39518
39263
|
"quotes",
|
|
@@ -39532,7 +39277,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
39532
39277
|
walletAddress
|
|
39533
39278
|
]
|
|
39534
39279
|
);
|
|
39535
|
-
const query =
|
|
39280
|
+
const query = useQuery22({
|
|
39536
39281
|
queryKey,
|
|
39537
39282
|
queryFn: async () => {
|
|
39538
39283
|
if (!userIpInfo || !apiKey || !destinationCurrencyCode || debouncedSourceAmount === void 0) {
|
|
@@ -39567,7 +39312,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
39567
39312
|
autoRestart: true
|
|
39568
39313
|
});
|
|
39569
39314
|
const isOutdated = sourceAmount !== debouncedSourceAmount;
|
|
39570
|
-
|
|
39315
|
+
useEffect63(() => {
|
|
39571
39316
|
if (!checkoutId || isOutdated || query.isFetching || !query.isFetchedAfterMount || !query.data) {
|
|
39572
39317
|
return;
|
|
39573
39318
|
}
|
|
@@ -39743,7 +39488,7 @@ function InputAmountLoaded({
|
|
|
39743
39488
|
}) {
|
|
39744
39489
|
const { t } = useFunkitTranslation();
|
|
39745
39490
|
const { apiKey } = useFunkitConfig();
|
|
39746
|
-
const gasUnits =
|
|
39491
|
+
const gasUnits = safeBigInt3(
|
|
39747
39492
|
useDynamicConfig("checkoutgasbufferunits"),
|
|
39748
39493
|
BigInt(fallbackDynamicConfigs.checkoutgasbufferunits.value)
|
|
39749
39494
|
);
|
|
@@ -39785,7 +39530,7 @@ function InputAmountLoaded({
|
|
|
39785
39530
|
const isExactIn = quoteBuilder.isExactIn();
|
|
39786
39531
|
const sourceTokenKey = sourceHolding?.chainSymbolKey;
|
|
39787
39532
|
const sourceTokenChanged = modalState.sourceTokenKey != null && modalState.sourceTokenKey !== sourceTokenKey;
|
|
39788
|
-
|
|
39533
|
+
useEffect64(() => {
|
|
39789
39534
|
if (sourceTokenChanged) {
|
|
39790
39535
|
setAmountSelection({ selectType: "default", presetAmount: null });
|
|
39791
39536
|
}
|
|
@@ -39841,7 +39586,7 @@ function InputAmountLoaded({
|
|
|
39841
39586
|
const { tokenBalanceBaseUnit, frozenUnitPrice } = amountInputResult;
|
|
39842
39587
|
if (isExactIn && !isFixedFiatQuickOptions && tokenBalanceBaseUnit != null && frozenUnitPrice != null) {
|
|
39843
39588
|
const base6 = amountInputResult.maxSendableAmount ?? tokenBalanceBaseUnit;
|
|
39844
|
-
const amount = option === 100 ? base6 :
|
|
39589
|
+
const amount = option === 100 ? base6 : dnum10.multiply(base6, option / 100);
|
|
39845
39590
|
amountInputResult.setTokenAmount(amount, frozenUnitPrice);
|
|
39846
39591
|
return null;
|
|
39847
39592
|
}
|
|
@@ -39852,7 +39597,7 @@ function InputAmountLoaded({
|
|
|
39852
39597
|
}
|
|
39853
39598
|
return setFiatAmount(selectedFiat);
|
|
39854
39599
|
}
|
|
39855
|
-
|
|
39600
|
+
useEffect64(() => {
|
|
39856
39601
|
if (isInputInFiat !== modalState.isInputInFiat || fiatAmount !== modalState.fiatAmount || assetAmount !== modalState.assetAmount || sourceTokenKey !== modalState.sourceTokenKey || amountSelection.selectType !== modalState.amountSelection?.selectType || amountSelection.presetAmount !== modalState.amountSelection?.presetAmount) {
|
|
39857
39602
|
setModalState((state) => ({
|
|
39858
39603
|
...state,
|
|
@@ -39886,7 +39631,7 @@ function InputAmountLoaded({
|
|
|
39886
39631
|
fiatCurrency,
|
|
39887
39632
|
onNext
|
|
39888
39633
|
});
|
|
39889
|
-
const error =
|
|
39634
|
+
const error = useMemo54(() => {
|
|
39890
39635
|
if (isCardCheckout) {
|
|
39891
39636
|
const meldError = getMeldError();
|
|
39892
39637
|
if (meldError) {
|
|
@@ -40381,7 +40126,7 @@ function YouPayYouReceiveWrapper({
|
|
|
40381
40126
|
|
|
40382
40127
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoading.tsx
|
|
40383
40128
|
import { formatCryptoAndStringify as formatCryptoAndStringify7 } from "@funkit/utils";
|
|
40384
|
-
import React220, { useMemo as
|
|
40129
|
+
import React220, { useMemo as useMemo55 } from "react";
|
|
40385
40130
|
function InputAmountLoading({
|
|
40386
40131
|
modalState,
|
|
40387
40132
|
sourceHoldingError,
|
|
@@ -40404,7 +40149,7 @@ function InputAmountLoading({
|
|
|
40404
40149
|
isExactIn,
|
|
40405
40150
|
sourceTokenSymbol: sourceAsset?.symbol
|
|
40406
40151
|
});
|
|
40407
|
-
const error =
|
|
40152
|
+
const error = useMemo55(() => {
|
|
40408
40153
|
if (sourceHoldingError) {
|
|
40409
40154
|
return {
|
|
40410
40155
|
message: /* @__PURE__ */ React220.createElement("div", null, t("inputAmount.unableToRetrieveBalance"), " "),
|
|
@@ -40512,7 +40257,7 @@ function getLoadingAmountOptions(paymentMethod) {
|
|
|
40512
40257
|
}
|
|
40513
40258
|
|
|
40514
40259
|
// src/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.ts
|
|
40515
|
-
import { useMemo as
|
|
40260
|
+
import { useMemo as useMemo56 } from "react";
|
|
40516
40261
|
function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetChainId, assetSymbol) {
|
|
40517
40262
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
40518
40263
|
const isBrokerage = paymentMethod === PaymentMethod.BROKERAGE;
|
|
@@ -40529,7 +40274,7 @@ function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetC
|
|
|
40529
40274
|
[PaymentMethod.VIRTUAL_BANK]: null
|
|
40530
40275
|
}[paymentMethod];
|
|
40531
40276
|
const isLoading = isBrokerage ? isLoadingBrokerageBalance : isLoadingWalletAssetHoldings;
|
|
40532
|
-
const holdingItem =
|
|
40277
|
+
const holdingItem = useMemo56(() => {
|
|
40533
40278
|
if (!assetSymbol || !holdings) {
|
|
40534
40279
|
return;
|
|
40535
40280
|
}
|
|
@@ -40672,10 +40417,10 @@ function InputAmount(props) {
|
|
|
40672
40417
|
query: { enabled: gasFetchingEnabled }
|
|
40673
40418
|
});
|
|
40674
40419
|
const isLoaded = !!(checkoutItem && unitPrice && !sourceHoldingError && !isLoadingSourceHolding && !isMeldDefaultCurrencyLoading && (!gasFetchingEnabled || gasPriceWei !== void 0));
|
|
40675
|
-
|
|
40420
|
+
useEffect65(() => setCheckoutQuote(null), []);
|
|
40676
40421
|
const checkoutId = checkoutItem?.id;
|
|
40677
40422
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
40678
|
-
|
|
40423
|
+
useEffect65(() => {
|
|
40679
40424
|
if (checkoutId && isLoaded) {
|
|
40680
40425
|
logMeasuredEvent({
|
|
40681
40426
|
eventName: "fc::ready::input_amount" /* READY_INPUT_AMOUNT */,
|
|
@@ -40708,7 +40453,7 @@ function InputAmount(props) {
|
|
|
40708
40453
|
}
|
|
40709
40454
|
|
|
40710
40455
|
// src/modals/CheckoutModal/LightningInvoice/LightningInvoice.tsx
|
|
40711
|
-
import React226, { useEffect as
|
|
40456
|
+
import React226, { useEffect as useEffect68 } from "react";
|
|
40712
40457
|
import { createPortal as createPortal17 } from "react-dom";
|
|
40713
40458
|
|
|
40714
40459
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
@@ -40716,7 +40461,7 @@ import { truncateMiddleOfAddress } from "@funkit/utils";
|
|
|
40716
40461
|
import React222, { useCallback as useCallback53, useState as useState72 } from "react";
|
|
40717
40462
|
|
|
40718
40463
|
// src/hooks/useCopyToClipboard.ts
|
|
40719
|
-
import { useCallback as useCallback52, useEffect as
|
|
40464
|
+
import { useCallback as useCallback52, useEffect as useEffect66, useState as useState71 } from "react";
|
|
40720
40465
|
var useCopyToClipboard = (text, delay = 1500) => {
|
|
40721
40466
|
const [isCopied, setCopied] = useState71(false);
|
|
40722
40467
|
const handleCopy = useCallback52(() => {
|
|
@@ -40726,7 +40471,7 @@ var useCopyToClipboard = (text, delay = 1500) => {
|
|
|
40726
40471
|
navigator.clipboard.writeText(text);
|
|
40727
40472
|
setCopied(true);
|
|
40728
40473
|
}, [text]);
|
|
40729
|
-
|
|
40474
|
+
useEffect66(() => {
|
|
40730
40475
|
if (!isCopied) {
|
|
40731
40476
|
return;
|
|
40732
40477
|
}
|
|
@@ -40851,8 +40596,9 @@ import {
|
|
|
40851
40596
|
getLightningQuote
|
|
40852
40597
|
} from "@funkit/api-base";
|
|
40853
40598
|
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as bitcoinChain4 } from "@funkit/chains";
|
|
40854
|
-
import {
|
|
40855
|
-
import {
|
|
40599
|
+
import { getAssetPriceInfoWithFallback as getAssetPriceInfoWithFallback2 } from "@funkit/connect-core";
|
|
40600
|
+
import { keepPreviousData as keepPreviousData3, useQuery as useQuery23 } from "@tanstack/react-query";
|
|
40601
|
+
import { useEffect as useEffect67, useRef as useRef34, useState as useState73 } from "react";
|
|
40856
40602
|
import { parseUnits as parseUnits5 } from "viem";
|
|
40857
40603
|
var QUOTE_REFRESH_LEAD_MS = 3e3;
|
|
40858
40604
|
var QUOTE_REFRESH_MIN_MS = 250;
|
|
@@ -40870,7 +40616,7 @@ function useDeferredQuote(latestQuote) {
|
|
|
40870
40616
|
const [displayedQuote, setDisplayedQuote] = useState73(latestQuote);
|
|
40871
40617
|
const latestQuoteRef = useRef34(latestQuote);
|
|
40872
40618
|
latestQuoteRef.current = latestQuote;
|
|
40873
|
-
|
|
40619
|
+
useEffect67(() => {
|
|
40874
40620
|
if (!displayedQuote) {
|
|
40875
40621
|
if (latestQuote) {
|
|
40876
40622
|
setDisplayedQuote(latestQuote);
|
|
@@ -40895,7 +40641,7 @@ var useLightningQuote = ({
|
|
|
40895
40641
|
}) => {
|
|
40896
40642
|
const { apiKey } = useFunkitConfig();
|
|
40897
40643
|
const enabled = !!depositAddr && !!targetChain && !!targetAsset && !!walletAddress && !!fiatAmount;
|
|
40898
|
-
const query =
|
|
40644
|
+
const query = useQuery23({
|
|
40899
40645
|
queryKey: [
|
|
40900
40646
|
"lightning-quote",
|
|
40901
40647
|
depositAddr,
|
|
@@ -40908,10 +40654,11 @@ var useLightningQuote = ({
|
|
|
40908
40654
|
if (!depositAddr || !walletAddress || !targetChain || !targetAsset || !fiatAmount) {
|
|
40909
40655
|
throw new Error("useLightningQuote: missing required params");
|
|
40910
40656
|
}
|
|
40911
|
-
const btcPrice = await
|
|
40657
|
+
const btcPrice = await getAssetPriceInfoWithFallback2({
|
|
40912
40658
|
apiKey,
|
|
40913
40659
|
chainId: bitcoinChain4.id.toString(),
|
|
40914
|
-
assetTokenAddress: NATIVE_TOKEN
|
|
40660
|
+
assetTokenAddress: NATIVE_TOKEN,
|
|
40661
|
+
logger
|
|
40915
40662
|
});
|
|
40916
40663
|
const fromAmountSats = usdToSats(fiatAmount, btcPrice.unitPrice);
|
|
40917
40664
|
if (fromAmountSats === void 0) {
|
|
@@ -40969,7 +40716,7 @@ import React225 from "react";
|
|
|
40969
40716
|
|
|
40970
40717
|
// src/components/QRCode/QRCode.tsx
|
|
40971
40718
|
import QRCodeUtil from "qrcode";
|
|
40972
|
-
import React223, { useMemo as
|
|
40719
|
+
import React223, { useMemo as useMemo57 } from "react";
|
|
40973
40720
|
var generateMatrix = (value, errorCorrectionLevel) => {
|
|
40974
40721
|
const { data } = QRCodeUtil.create(value, { errorCorrectionLevel }).modules;
|
|
40975
40722
|
const sqrt = Math.sqrt(data.length);
|
|
@@ -40997,7 +40744,7 @@ function QRCode({
|
|
|
40997
40744
|
}) {
|
|
40998
40745
|
const { activeTheme } = useActiveTheme();
|
|
40999
40746
|
const size = sizeProp - Number.parseInt(outsidePadding, 10) * 2;
|
|
41000
|
-
const dots =
|
|
40747
|
+
const dots = useMemo57(() => {
|
|
41001
40748
|
const dots2 = [];
|
|
41002
40749
|
const matrix = generateMatrix(uri, ecl);
|
|
41003
40750
|
const cellSize = size / matrix.length;
|
|
@@ -41260,7 +41007,7 @@ function LightningInvoice(props) {
|
|
|
41260
41007
|
isHidden: isLoading || !!error,
|
|
41261
41008
|
isPaused: isLoading || !!error
|
|
41262
41009
|
});
|
|
41263
|
-
|
|
41010
|
+
useEffect68(() => {
|
|
41264
41011
|
if (expiresAtMs !== void 0) {
|
|
41265
41012
|
restartCountdown();
|
|
41266
41013
|
}
|
|
@@ -41315,7 +41062,7 @@ function LightningInvoice(props) {
|
|
|
41315
41062
|
}
|
|
41316
41063
|
|
|
41317
41064
|
// src/modals/CheckoutModal/LoadingAccount.tsx
|
|
41318
|
-
import React235, { useEffect as
|
|
41065
|
+
import React235, { useEffect as useEffect69 } from "react";
|
|
41319
41066
|
|
|
41320
41067
|
// src/components/FunAsset/FunAssetLoading.tsx
|
|
41321
41068
|
import React228 from "react";
|
|
@@ -41555,7 +41302,7 @@ var CheckoutTopAnnouncementBanner = () => {
|
|
|
41555
41302
|
};
|
|
41556
41303
|
|
|
41557
41304
|
// src/hooks/usePaymentMethodTabs.ts
|
|
41558
|
-
import { useMemo as
|
|
41305
|
+
import { useMemo as useMemo58 } from "react";
|
|
41559
41306
|
function usePaymentMethodTabs({
|
|
41560
41307
|
isCashier
|
|
41561
41308
|
}) {
|
|
@@ -41565,7 +41312,7 @@ function usePaymentMethodTabs({
|
|
|
41565
41312
|
);
|
|
41566
41313
|
const isWithdrawalTabEnabled = useDynamicConfig("enablecashierformfactor") && isCashier;
|
|
41567
41314
|
const defaultTab = isSavedCardDefaultsToFiatTabEnabled && hasSavedFops ? "fiat" : "crypto";
|
|
41568
|
-
const tabOrder =
|
|
41315
|
+
const tabOrder = useMemo58(() => {
|
|
41569
41316
|
const tabs2 = [];
|
|
41570
41317
|
if (defaultTab === "fiat") {
|
|
41571
41318
|
tabs2.push("fiat", "crypto");
|
|
@@ -42064,7 +41811,7 @@ function LoadingAccount({
|
|
|
42064
41811
|
const hasCustomStartingStep = !!checkoutConfig?.startingStep;
|
|
42065
41812
|
const startsOnConfirmationStep = checkoutConfig?.startingStep === "confirmation" /* CONFIRMATION */;
|
|
42066
41813
|
const startsOnSelectAssetStep = checkoutConfig?.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
42067
|
-
|
|
41814
|
+
useEffect69(() => {
|
|
42068
41815
|
if (isLoadingFiat || !checkoutConfig) {
|
|
42069
41816
|
return;
|
|
42070
41817
|
}
|
|
@@ -42134,7 +41881,7 @@ function LoadingAccount({
|
|
|
42134
41881
|
|
|
42135
41882
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
42136
41883
|
import clsx21 from "clsx";
|
|
42137
|
-
import React236, { useMemo as
|
|
41884
|
+
import React236, { useMemo as useMemo59, useState as useState74 } from "react";
|
|
42138
41885
|
|
|
42139
41886
|
// src/modals/CheckoutModal/MeldCurrencySelect/currenciesWithMultipleCountries.ts
|
|
42140
41887
|
var currenciesWithMultipleCountries = {
|
|
@@ -42195,7 +41942,7 @@ function MeldCurrencySelect({
|
|
|
42195
41942
|
const [selectedCurrency, setSelectedCurrency] = useState74(
|
|
42196
41943
|
defaultCurrency
|
|
42197
41944
|
);
|
|
42198
|
-
const filteredOptions =
|
|
41945
|
+
const filteredOptions = useMemo59(() => {
|
|
42199
41946
|
const newOptions = data?.filter(
|
|
42200
41947
|
({ name, currencyCode }) => currencyCode.toLowerCase().includes(query.toLowerCase()) || name.toLowerCase().includes(query.toLowerCase())
|
|
42201
41948
|
) ?? [];
|
|
@@ -42398,16 +42145,16 @@ function MeldRedirect({
|
|
|
42398
42145
|
import { etherealChain, hyperEvmChain as hyperEvmChain3 } from "@funkit/chains";
|
|
42399
42146
|
import { isTokenEquivalent as isTokenEquivalent12 } from "@funkit/utils";
|
|
42400
42147
|
import React242, {
|
|
42401
|
-
useEffect as
|
|
42148
|
+
useEffect as useEffect70,
|
|
42402
42149
|
useLayoutEffect as useLayoutEffect2,
|
|
42403
|
-
useMemo as
|
|
42150
|
+
useMemo as useMemo61,
|
|
42404
42151
|
useState as useState75
|
|
42405
42152
|
} from "react";
|
|
42406
42153
|
import { createPortal as createPortal20 } from "react-dom";
|
|
42407
42154
|
import { mainnet as mainnet11 } from "viem/chains";
|
|
42408
42155
|
|
|
42409
42156
|
// src/hooks/useDynamicRoutes.ts
|
|
42410
|
-
import { useMemo as
|
|
42157
|
+
import { useMemo as useMemo60 } from "react";
|
|
42411
42158
|
import { DYNAMIC_ROUTES, initDynamicRouting } from "@funkit/fun-relay";
|
|
42412
42159
|
var toMutable = (obj) => {
|
|
42413
42160
|
return obj;
|
|
@@ -42417,7 +42164,7 @@ var useDynamicRoutes = (_dynamicRoutingId) => {
|
|
|
42417
42164
|
const { checkoutItem } = useCheckoutContext();
|
|
42418
42165
|
const config = checkoutItem?.initSettings.config;
|
|
42419
42166
|
const dynamicRoutingId = _dynamicRoutingId || config?.dynamicRoutingId;
|
|
42420
|
-
const findPath =
|
|
42167
|
+
const findPath = useMemo60(() => {
|
|
42421
42168
|
if (!dynamicRoutingId) {
|
|
42422
42169
|
return () => null;
|
|
42423
42170
|
}
|
|
@@ -42663,7 +42410,7 @@ function useEnrichedAccountHoldings({
|
|
|
42663
42410
|
const minTransferLimits = useDynamicConfig("mintokentransfervalue");
|
|
42664
42411
|
const isDynamicRoutingEnabled = useIsDynamicRoutingEnabled();
|
|
42665
42412
|
const isNadoDirectTransferSource = useIsNadoDirectTransferSource();
|
|
42666
|
-
const enrichedAccountHoldings =
|
|
42413
|
+
const enrichedAccountHoldings = useMemo61(() => {
|
|
42667
42414
|
if (!checkoutConfig) {
|
|
42668
42415
|
return [];
|
|
42669
42416
|
}
|
|
@@ -42725,7 +42472,7 @@ function useAssetOptions({
|
|
|
42725
42472
|
const { t } = useFunkitTranslation();
|
|
42726
42473
|
const { findPath } = useDynamicRoutes();
|
|
42727
42474
|
const isNadoDirectTransferSource = useIsNadoDirectTransferSource();
|
|
42728
|
-
const assetOptions =
|
|
42475
|
+
const assetOptions = useMemo61(() => {
|
|
42729
42476
|
return enrichedAccountHoldings.map(({ asset, usableForCheckout }) => {
|
|
42730
42477
|
const { isUsable, reason } = usableForCheckout;
|
|
42731
42478
|
const isKnown = isKnownAsset(asset);
|
|
@@ -42791,7 +42538,7 @@ function useAssetOptions({
|
|
|
42791
42538
|
return assetOptions;
|
|
42792
42539
|
}
|
|
42793
42540
|
function useScrollToSelectedAsset(selectedChainTokenSymbol) {
|
|
42794
|
-
|
|
42541
|
+
useEffect70(() => {
|
|
42795
42542
|
const optionEl = document.getElementById(
|
|
42796
42543
|
`option-${selectedChainTokenSymbol}`
|
|
42797
42544
|
);
|
|
@@ -42833,7 +42580,7 @@ function AccountSelectAsset({
|
|
|
42833
42580
|
const { setSelectedBrokerageAsset } = useFunkitBrokerageContext();
|
|
42834
42581
|
const [explicitlySelectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState75("");
|
|
42835
42582
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
42836
|
-
const defaultTargetAsset =
|
|
42583
|
+
const defaultTargetAsset = useMemo61(
|
|
42837
42584
|
() => getDefaultDynamicTargetAsset(checkoutConfig),
|
|
42838
42585
|
[checkoutConfig]
|
|
42839
42586
|
);
|
|
@@ -42938,7 +42685,7 @@ function AccountSelectAsset({
|
|
|
42938
42685
|
});
|
|
42939
42686
|
onFinish();
|
|
42940
42687
|
});
|
|
42941
|
-
const defaultSelectedChainTokenSymbol =
|
|
42688
|
+
const defaultSelectedChainTokenSymbol = useMemo61(() => {
|
|
42942
42689
|
if (checkoutItem?.selectedSourceAssetInfo.symbol) {
|
|
42943
42690
|
const key = combineChainSymbolOrAddress({
|
|
42944
42691
|
chainId: checkoutItem.selectedSourceAssetInfo.chainId,
|
|
@@ -42954,7 +42701,7 @@ function AccountSelectAsset({
|
|
|
42954
42701
|
const usableOptions = assetOptions.filter((option) => !option.isDisabled);
|
|
42955
42702
|
return usableOptions[0]?.asset.chainSymbolKey;
|
|
42956
42703
|
}, [assetOptions, checkoutItem?.selectedSourceAssetInfo]);
|
|
42957
|
-
const selectedChainTokenSymbol =
|
|
42704
|
+
const selectedChainTokenSymbol = useMemo61(() => {
|
|
42958
42705
|
if (explicitlySelectedChainTokenSymbol) {
|
|
42959
42706
|
const assetExists = assetOptions.some(
|
|
42960
42707
|
({ asset }) => asset.chainSymbolKey === explicitlySelectedChainTokenSymbol
|
|
@@ -42988,7 +42735,7 @@ function AccountSelectAsset({
|
|
|
42988
42735
|
const isDisabled = isAssetsEmpty || !selectedChainTokenSymbol || isLoading;
|
|
42989
42736
|
const onBalanceTopUpSwitch = checkoutItem?.initSettings.onBalanceTopUpSwitch;
|
|
42990
42737
|
const checkoutId = checkoutItem?.id;
|
|
42991
|
-
|
|
42738
|
+
useEffect70(() => {
|
|
42992
42739
|
if (checkoutId && !isLoading) {
|
|
42993
42740
|
logMeasuredEvent({
|
|
42994
42741
|
eventName: "fc::ready::select_asset" /* READY_SELECT_ASSET */,
|
|
@@ -43149,10 +42896,11 @@ import { LIGHTER_CHAIN_ID as LIGHTER_CHAIN_ID3, lightningChain as lightningChain
|
|
|
43149
42896
|
import {
|
|
43150
42897
|
createSyntheticFop,
|
|
43151
42898
|
isSavedFormOfPaymentType as isSavedFormOfPaymentType2,
|
|
43152
|
-
isSyntheticFop as isSyntheticFop3
|
|
42899
|
+
isSyntheticFop as isSyntheticFop3,
|
|
42900
|
+
resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance4
|
|
43153
42901
|
} from "@funkit/connect-core";
|
|
43154
42902
|
import { isTokenEquivalent as isTokenEquivalent13, noop as noop6 } from "@funkit/utils";
|
|
43155
|
-
import React251, { useEffect as
|
|
42903
|
+
import React251, { useEffect as useEffect73, useMemo as useMemo62, useRef as useRef36, useState as useState76 } from "react";
|
|
43156
42904
|
import { createPortal as createPortal21 } from "react-dom";
|
|
43157
42905
|
|
|
43158
42906
|
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
@@ -43260,13 +43008,13 @@ function useIsUserUnderComplianceReview() {
|
|
|
43260
43008
|
}
|
|
43261
43009
|
|
|
43262
43010
|
// src/modals/CheckoutModal/SourceChange/ComplianceReviewBanner.tsx
|
|
43263
|
-
import React244, { useEffect as
|
|
43011
|
+
import React244, { useEffect as useEffect71 } from "react";
|
|
43264
43012
|
function ComplianceReviewBanner({
|
|
43265
43013
|
checkoutId
|
|
43266
43014
|
}) {
|
|
43267
43015
|
const { t } = useFunkitTranslation();
|
|
43268
43016
|
const { logEvent } = useTrack();
|
|
43269
|
-
|
|
43017
|
+
useEffect71(() => {
|
|
43270
43018
|
logEvent({
|
|
43271
43019
|
eventName: "fc::compliance_review::banner_shown" /* COMPLIANCE_REVIEW_BANNER_SHOWN */,
|
|
43272
43020
|
metadata: { checkoutId }
|
|
@@ -43604,15 +43352,14 @@ function useStartBitcoinLightning() {
|
|
|
43604
43352
|
}
|
|
43605
43353
|
|
|
43606
43354
|
// src/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.ts
|
|
43607
|
-
import { useEffect as
|
|
43355
|
+
import { useEffect as useEffect72, useRef as useRef35 } from "react";
|
|
43608
43356
|
function useTrackSourceChangeEvents({
|
|
43609
43357
|
tab
|
|
43610
43358
|
}) {
|
|
43611
|
-
const
|
|
43359
|
+
const logEventV2 = useTrackV2();
|
|
43612
43360
|
const { checkoutItem } = useCheckoutContext();
|
|
43613
|
-
const { apiKey } = useFunkitConfig();
|
|
43614
43361
|
const { authorizedConnections } = useFunkitBrokerageContext();
|
|
43615
|
-
const { connectorId,
|
|
43362
|
+
const { connectorId, walletAddress } = useGeneralWallet();
|
|
43616
43363
|
const tabSwitchCountRef = useRef35(0);
|
|
43617
43364
|
const trackModalOpened = useEffectEvent(() => {
|
|
43618
43365
|
if (!checkoutItem) {
|
|
@@ -43620,22 +43367,17 @@ function useTrackSourceChangeEvents({
|
|
|
43620
43367
|
}
|
|
43621
43368
|
const config = checkoutItem.initSettings.config;
|
|
43622
43369
|
const exchanges = Object.keys(authorizedConnections);
|
|
43623
|
-
const userId = userInfo.id && userInfo.id !== "0x" ? userInfo.id : null;
|
|
43624
43370
|
logEventV2("fc_modal_opened" /* MODAL_OPENED */, () => ({
|
|
43625
|
-
api_key: apiKey,
|
|
43626
|
-
checkout_id: checkoutItem.id,
|
|
43627
|
-
connector_name: connectorId ? userInfo.typeLabel || null : null,
|
|
43628
|
-
flow: tab === "withdraw" ? "withdraw" : "deposit",
|
|
43629
|
-
tab,
|
|
43630
|
-
user_id: userId,
|
|
43631
43371
|
custom_recipient: config.customRecipient ?? null,
|
|
43632
43372
|
dynamic_routing_id: config.dynamicRoutingId ?? null,
|
|
43633
43373
|
exchange_count: exchanges.length,
|
|
43374
|
+
flow: tab === "withdraw" ? "withdraw" : "deposit",
|
|
43634
43375
|
primary_exchange: exchanges[0] ?? null,
|
|
43635
43376
|
primary_wallet: walletAddress ? connectorId ?? null : null,
|
|
43636
43377
|
source_asset: checkoutItem.selectedSourceAssetInfo.address,
|
|
43637
43378
|
source_asset_ticker: checkoutItem.selectedSourceAssetInfo.symbol || null,
|
|
43638
43379
|
source_chain: checkoutItem.selectedSourceAssetInfo.chainId,
|
|
43380
|
+
tab,
|
|
43639
43381
|
target_asset: config.targetAsset,
|
|
43640
43382
|
target_asset_ticker: config.targetAssetTicker || null,
|
|
43641
43383
|
target_chain: config.targetChain,
|
|
@@ -43643,7 +43385,7 @@ function useTrackSourceChangeEvents({
|
|
|
43643
43385
|
}));
|
|
43644
43386
|
});
|
|
43645
43387
|
const checkoutId = checkoutItem?.id;
|
|
43646
|
-
|
|
43388
|
+
useEffect72(() => {
|
|
43647
43389
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
43648
43390
|
trackModalOpened();
|
|
43649
43391
|
}
|
|
@@ -43653,21 +43395,16 @@ function useTrackSourceChangeEvents({
|
|
|
43653
43395
|
fromTab,
|
|
43654
43396
|
tab: nextTab
|
|
43655
43397
|
}) => {
|
|
43656
|
-
if (
|
|
43398
|
+
if (fromTab === nextTab) {
|
|
43657
43399
|
return;
|
|
43658
43400
|
}
|
|
43659
43401
|
const switchCount = tabSwitchCountRef.current + 1;
|
|
43660
43402
|
tabSwitchCountRef.current = switchCount;
|
|
43661
|
-
const userId = userInfo.id && userInfo.id !== "0x" ? userInfo.id : null;
|
|
43662
43403
|
logEventV2("fc_tab_switched" /* TAB_SWITCHED */, () => ({
|
|
43663
|
-
api_key: apiKey,
|
|
43664
|
-
checkout_id: checkoutItem.id,
|
|
43665
|
-
connector_name: connectorId ? userInfo.typeLabel || null : null,
|
|
43666
43404
|
flow: nextTab === "withdraw" ? "withdraw" : "deposit",
|
|
43667
43405
|
from_tab: fromTab,
|
|
43668
43406
|
switch_count: switchCount,
|
|
43669
|
-
tab: nextTab
|
|
43670
|
-
user_id: userId
|
|
43407
|
+
tab: nextTab
|
|
43671
43408
|
}));
|
|
43672
43409
|
}
|
|
43673
43410
|
);
|
|
@@ -43843,7 +43580,7 @@ function SourceChange({
|
|
|
43843
43580
|
const { isUnifiedTradingMode: isLighterUnifiedAccount } = useLighterAccounts({
|
|
43844
43581
|
address: walletAddress
|
|
43845
43582
|
});
|
|
43846
|
-
const dynamicTargetAssets =
|
|
43583
|
+
const dynamicTargetAssets = useMemo62(() => {
|
|
43847
43584
|
const candidates = checkoutConfig?.dynamicTargetAssetCandidates;
|
|
43848
43585
|
if (!candidates || !isLighterUnifiedAccount) {
|
|
43849
43586
|
return candidates;
|
|
@@ -43891,7 +43628,7 @@ function SourceChange({
|
|
|
43891
43628
|
});
|
|
43892
43629
|
}
|
|
43893
43630
|
const [connectedSource, setConnectedSource] = useState76(paymentMethodInfo);
|
|
43894
|
-
const syntheticFops =
|
|
43631
|
+
const syntheticFops = useMemo62(
|
|
43895
43632
|
() => isCashAppLightningEnabled ? [createSyntheticFop(PaymentMethod.CASH_APP_LIGHTNING)] : [],
|
|
43896
43633
|
[isCashAppLightningEnabled]
|
|
43897
43634
|
);
|
|
@@ -43916,7 +43653,7 @@ function SourceChange({
|
|
|
43916
43653
|
const { trackTabSwitched } = useTrackSourceChangeEvents({
|
|
43917
43654
|
tab: paymentMethodTab
|
|
43918
43655
|
});
|
|
43919
|
-
const nativeHolding =
|
|
43656
|
+
const nativeHolding = useMemo62(() => {
|
|
43920
43657
|
if (!checkoutConfig || !walletHoldings || !isCustomerNativeFastPathEnabled(apiKey)) {
|
|
43921
43658
|
return void 0;
|
|
43922
43659
|
}
|
|
@@ -43930,7 +43667,7 @@ function SourceChange({
|
|
|
43930
43667
|
);
|
|
43931
43668
|
return holding && holding.usdAmount != null && holding.usdAmount > 0 ? holding : void 0;
|
|
43932
43669
|
}, [apiKey, walletHoldings, checkoutConfig]);
|
|
43933
|
-
const connectedWallet =
|
|
43670
|
+
const connectedWallet = useMemo62(
|
|
43934
43671
|
() => preferred.find(
|
|
43935
43672
|
(s) => isConnectablePaymentMethodInfo(s) && s.paymentMethod === PaymentMethod.ACCOUNT_BALANCE
|
|
43936
43673
|
),
|
|
@@ -43941,7 +43678,7 @@ function SourceChange({
|
|
|
43941
43678
|
const showTagline = useDynamicConfig("showpoweredtagline");
|
|
43942
43679
|
const hasBottomBar = showTagline || !isAutoContinue || bottomBarCloseButtonConfig.enabled;
|
|
43943
43680
|
useSwappedPreload(fopsData?.data, "deposit");
|
|
43944
|
-
|
|
43681
|
+
useEffect73(() => {
|
|
43945
43682
|
const nextWithdrawalConfig = shouldSeedSourceChangeWithdrawalConfig ? resolvedWithdrawalConfig : void 0;
|
|
43946
43683
|
setModalState((state) => {
|
|
43947
43684
|
if (state.withdrawalConfig === nextWithdrawalConfig) {
|
|
@@ -43957,7 +43694,7 @@ function SourceChange({
|
|
|
43957
43694
|
setModalState,
|
|
43958
43695
|
shouldSeedSourceChangeWithdrawalConfig
|
|
43959
43696
|
]);
|
|
43960
|
-
|
|
43697
|
+
useEffect73(() => {
|
|
43961
43698
|
if (!paymentMethodInfo) {
|
|
43962
43699
|
return;
|
|
43963
43700
|
}
|
|
@@ -44073,7 +43810,7 @@ function SourceChange({
|
|
|
44073
43810
|
)
|
|
44074
43811
|
);
|
|
44075
43812
|
});
|
|
44076
|
-
|
|
43813
|
+
useEffect73(() => {
|
|
44077
43814
|
sendPaymentMethodTabEvent(paymentMethodTab);
|
|
44078
43815
|
}, [paymentMethodTab, sendPaymentMethodTabEvent]);
|
|
44079
43816
|
const analyticsTab = isSwappedEnabled ? paymentMethodTab : null;
|
|
@@ -44330,14 +44067,15 @@ function SourceChange({
|
|
|
44330
44067
|
onCryptoSelect: handleWithdrawCryptoSelect,
|
|
44331
44068
|
onCashFopSelect: handleFiatItemSelect,
|
|
44332
44069
|
usdBalance: Number(
|
|
44333
|
-
|
|
44070
|
+
resolveWithdrawalSourceTokenBalance4(
|
|
44334
44071
|
resolvedWithdrawalConfig?.withdrawalSourceTokenBalance ?? checkoutConfig?.withdrawalSourceTokenBalance,
|
|
44335
44072
|
{
|
|
44336
44073
|
sourceAsset: {
|
|
44337
44074
|
tokenAddress: resolvedWithdrawalConfig.sourceTokenAddress,
|
|
44338
44075
|
tokenChainId: resolvedWithdrawalConfig.sourceChainId
|
|
44339
44076
|
}
|
|
44340
|
-
}
|
|
44077
|
+
},
|
|
44078
|
+
logger
|
|
44341
44079
|
) ?? "0"
|
|
44342
44080
|
),
|
|
44343
44081
|
hideSectionLabels: true
|
|
@@ -44507,8 +44245,8 @@ function trackEventForTabChange(checkoutItem, tab) {
|
|
|
44507
44245
|
}
|
|
44508
44246
|
|
|
44509
44247
|
// src/modals/CheckoutModal/SwappedIframe/SwappedIframeController.tsx
|
|
44510
|
-
import { useQueryClient as
|
|
44511
|
-
import React252, { useEffect as
|
|
44248
|
+
import { useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
44249
|
+
import React252, { useEffect as useEffect74, useRef as useRef37 } from "react";
|
|
44512
44250
|
import { createPortal as createPortal22 } from "react-dom";
|
|
44513
44251
|
var SwappedIframeInfo = {
|
|
44514
44252
|
Component: SwappedIframeController,
|
|
@@ -44541,7 +44279,7 @@ function SwappedIframeController({
|
|
|
44541
44279
|
}) {
|
|
44542
44280
|
const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
|
|
44543
44281
|
const { t } = useFunkitTranslation();
|
|
44544
|
-
const queryClient =
|
|
44282
|
+
const queryClient = useQueryClient7();
|
|
44545
44283
|
const successCallbackScheduledRef = useRef37(false);
|
|
44546
44284
|
const { checkoutItem, resetForNewDeposit } = useCheckoutContext();
|
|
44547
44285
|
const bottomSectionRef = useBottomSectionRef();
|
|
@@ -44563,10 +44301,10 @@ function SwappedIframeController({
|
|
|
44563
44301
|
metadata: {}
|
|
44564
44302
|
});
|
|
44565
44303
|
});
|
|
44566
|
-
|
|
44304
|
+
useEffect74(() => {
|
|
44567
44305
|
startMeasuredEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
44568
44306
|
}, [startMeasuredEvent]);
|
|
44569
|
-
|
|
44307
|
+
useEffect74(() => {
|
|
44570
44308
|
if (isSwappedReady) {
|
|
44571
44309
|
const event = getTrackEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
44572
44310
|
logger.info("swapped-iframe:ready", event.metadata);
|
|
@@ -44731,7 +44469,7 @@ function SwappedIframeController({
|
|
|
44731
44469
|
}
|
|
44732
44470
|
}
|
|
44733
44471
|
}
|
|
44734
|
-
|
|
44472
|
+
useEffect74(() => {
|
|
44735
44473
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
44736
44474
|
}, [swappedTransport, handleSwappedMessage]);
|
|
44737
44475
|
useSwappedIframeLifecycle({
|
|
@@ -45269,7 +45007,7 @@ var TransferTokenDetails = ({
|
|
|
45269
45007
|
};
|
|
45270
45008
|
|
|
45271
45009
|
// src/modals/CheckoutModal/TransferToken/useTransferTokenTracking.ts
|
|
45272
|
-
import { useCallback as useCallback56, useEffect as
|
|
45010
|
+
import { useCallback as useCallback56, useEffect as useEffect75, useRef as useRef38, useState as useState78 } from "react";
|
|
45273
45011
|
|
|
45274
45012
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.ts
|
|
45275
45013
|
function getNotificationId(item) {
|
|
@@ -45385,7 +45123,7 @@ function useTransferTokenTracking({
|
|
|
45385
45123
|
},
|
|
45386
45124
|
[]
|
|
45387
45125
|
);
|
|
45388
|
-
|
|
45126
|
+
useEffect75(() => {
|
|
45389
45127
|
if (!pendingInteraction || pendingInteraction.expectedSourceChain !== fromChainId || pendingInteraction.expectedSourceTicker !== fromTokenSymbol || !fromTokenAddress || !depositAddress || !targetChainId || !targetTokenAddress || lastEmittedInteractionIdRef.current >= pendingInteraction.id) {
|
|
45390
45128
|
return;
|
|
45391
45129
|
}
|
|
@@ -45424,7 +45162,7 @@ function useTransferTokenTracking({
|
|
|
45424
45162
|
targetTokenSymbol,
|
|
45425
45163
|
trackDepositTransferInteracted
|
|
45426
45164
|
]);
|
|
45427
|
-
|
|
45165
|
+
useEffect75(() => {
|
|
45428
45166
|
if (depositAddress && fromChainId && toChainId && toTokenAddress) {
|
|
45429
45167
|
setTokenTransferAddressShownAtMs({
|
|
45430
45168
|
fromChainId,
|
|
@@ -45543,56 +45281,35 @@ function useNotificationTracking({
|
|
|
45543
45281
|
item,
|
|
45544
45282
|
status
|
|
45545
45283
|
}) {
|
|
45546
|
-
const
|
|
45547
|
-
const {
|
|
45548
|
-
const { connectorId
|
|
45284
|
+
const logEventV2 = useTrackV2();
|
|
45285
|
+
const { logEvent } = useTrack();
|
|
45286
|
+
const { connectorId } = useGeneralWallet();
|
|
45549
45287
|
const depositNotificationDisplayRef = useRef38(null);
|
|
45550
|
-
const buildNotificationProperties = (item2, notificationStatus) => {
|
|
45551
|
-
const context = resolveExecutionProgressContext(item2, "deposit");
|
|
45552
|
-
if (!context) {
|
|
45553
|
-
return null;
|
|
45554
|
-
}
|
|
45555
|
-
const userId = userInfo.isConnected && userInfo.id !== "0x" ? userInfo.id || null : null;
|
|
45556
|
-
return {
|
|
45557
|
-
api_key: apiKey,
|
|
45558
|
-
connector_name: userInfo.isConnected ? userInfo.typeLabel || null : null,
|
|
45559
|
-
flow: "deposit",
|
|
45560
|
-
...buildExecutionTransactionSnapshotProperties(
|
|
45561
|
-
context,
|
|
45562
|
-
userId,
|
|
45563
|
-
connectorId
|
|
45564
|
-
),
|
|
45565
|
-
status: notificationStatus
|
|
45566
|
-
};
|
|
45567
|
-
};
|
|
45568
45288
|
const trackDepositNotificationDisplayed = useEffectEvent(
|
|
45569
45289
|
(notification, notificationStatus) => {
|
|
45570
|
-
const
|
|
45571
|
-
|
|
45572
|
-
|
|
45573
|
-
);
|
|
45574
|
-
if (!properties) {
|
|
45575
|
-
return;
|
|
45290
|
+
const context = resolveExecutionProgressContext(notification, "deposit");
|
|
45291
|
+
if (!context) {
|
|
45292
|
+
return null;
|
|
45576
45293
|
}
|
|
45577
|
-
logEventV2(
|
|
45578
|
-
"
|
|
45579
|
-
()
|
|
45580
|
-
|
|
45294
|
+
logEventV2("fc_deposit_notification_displayed" /* DEPOSIT_NOTIFICATION_DISPLAYED */, () => ({
|
|
45295
|
+
flow: "deposit",
|
|
45296
|
+
...buildExecutionTransactionSnapshotProperties(context, connectorId),
|
|
45297
|
+
status: notificationStatus
|
|
45298
|
+
}));
|
|
45581
45299
|
}
|
|
45582
45300
|
);
|
|
45583
45301
|
const trackDepositNotificationInteracted = useEffectEvent(
|
|
45584
45302
|
(notification, interaction) => {
|
|
45585
|
-
const
|
|
45586
|
-
|
|
45587
|
-
|
|
45588
|
-
);
|
|
45589
|
-
if (!properties) {
|
|
45590
|
-
return;
|
|
45303
|
+
const context = resolveExecutionProgressContext(notification, "deposit");
|
|
45304
|
+
if (!context) {
|
|
45305
|
+
return null;
|
|
45591
45306
|
}
|
|
45592
45307
|
logEventV2("fc_deposit_notification_interacted" /* DEPOSIT_NOTIFICATION_INTERACTED */, () => ({
|
|
45593
|
-
|
|
45308
|
+
flow: "deposit",
|
|
45309
|
+
...buildExecutionTransactionSnapshotProperties(context, connectorId),
|
|
45594
45310
|
action: interaction.action,
|
|
45595
|
-
ms_since_displayed: interaction.msSinceDisplayed
|
|
45311
|
+
ms_since_displayed: interaction.msSinceDisplayed,
|
|
45312
|
+
status: interaction.status
|
|
45596
45313
|
}));
|
|
45597
45314
|
}
|
|
45598
45315
|
);
|
|
@@ -45603,7 +45320,7 @@ function useNotificationTracking({
|
|
|
45603
45320
|
itemRef.current = item;
|
|
45604
45321
|
statusRef.current = status;
|
|
45605
45322
|
const id = item ? getNotificationId(item) : null;
|
|
45606
|
-
|
|
45323
|
+
useEffect75(() => {
|
|
45607
45324
|
if (!id || !itemRef.current) {
|
|
45608
45325
|
depositNotificationDisplayRef.current = null;
|
|
45609
45326
|
return;
|
|
@@ -45649,7 +45366,7 @@ function useNotificationTracking({
|
|
|
45649
45366
|
notificationDisplayedAtRef.current = null;
|
|
45650
45367
|
};
|
|
45651
45368
|
}, [id, logEvent, trackDepositNotificationDisplayed]);
|
|
45652
|
-
|
|
45369
|
+
useEffect75(() => {
|
|
45653
45370
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
45654
45371
|
return;
|
|
45655
45372
|
}
|
|
@@ -46577,7 +46294,7 @@ var FiatAccountDetail = {
|
|
|
46577
46294
|
|
|
46578
46295
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
46579
46296
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
46580
|
-
import React267, { useCallback as useCallback57, useEffect as
|
|
46297
|
+
import React267, { useCallback as useCallback57, useEffect as useEffect76, useMemo as useMemo63, useState as useState81 } from "react";
|
|
46581
46298
|
function useIframeListener(listeners, expectedOrigin) {
|
|
46582
46299
|
const handleMessage = useCallback57(
|
|
46583
46300
|
(event) => {
|
|
@@ -46604,7 +46321,7 @@ function useIframeListener(listeners, expectedOrigin) {
|
|
|
46604
46321
|
},
|
|
46605
46322
|
[listeners, expectedOrigin]
|
|
46606
46323
|
);
|
|
46607
|
-
|
|
46324
|
+
useEffect76(() => {
|
|
46608
46325
|
window.addEventListener("message", handleMessage);
|
|
46609
46326
|
return () => {
|
|
46610
46327
|
window.removeEventListener("message", handleMessage);
|
|
@@ -46634,14 +46351,14 @@ function KycIframe({
|
|
|
46634
46351
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
46635
46352
|
const { data: kycLink, isLoading: isLinkLoading } = useLoadKycLink(modalState);
|
|
46636
46353
|
const [iframeLoading, setIframeLoading] = useState81(true);
|
|
46637
|
-
const kycOrigin =
|
|
46354
|
+
const kycOrigin = useMemo63(() => {
|
|
46638
46355
|
try {
|
|
46639
46356
|
return kycLink ? new URL(kycLink).origin : null;
|
|
46640
46357
|
} catch {
|
|
46641
46358
|
return null;
|
|
46642
46359
|
}
|
|
46643
46360
|
}, [kycLink]);
|
|
46644
|
-
const listeners =
|
|
46361
|
+
const listeners = useMemo63(
|
|
46645
46362
|
() => ({
|
|
46646
46363
|
load: () => {
|
|
46647
46364
|
logger.info("KYC iframe loaded");
|
|
@@ -46905,7 +46622,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
46905
46622
|
ensureStepQueries(modalState.step);
|
|
46906
46623
|
}
|
|
46907
46624
|
});
|
|
46908
|
-
|
|
46625
|
+
useEffect77(() => {
|
|
46909
46626
|
ensureLoadingAccountScreen();
|
|
46910
46627
|
}, [ensureLoadingAccountScreen]);
|
|
46911
46628
|
const trackNextState = useCallback58(
|
|
@@ -47142,7 +46859,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
47142
46859
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
47143
46860
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
47144
46861
|
import clsx23 from "clsx";
|
|
47145
|
-
import React279, { useEffect as
|
|
46862
|
+
import React279, { useEffect as useEffect79, useMemo as useMemo64, useRef as useRef42, useState as useState84 } from "react";
|
|
47146
46863
|
import { Virtuoso } from "react-virtuoso";
|
|
47147
46864
|
|
|
47148
46865
|
// src/consts/layout.ts
|
|
@@ -47505,17 +47222,17 @@ import { useCallback as useCallback59, useState as useState83 } from "react";
|
|
|
47505
47222
|
|
|
47506
47223
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
47507
47224
|
import React275 from "react";
|
|
47508
|
-
import { useEffect as
|
|
47225
|
+
import { useEffect as useEffect78, useRef as useRef41 } from "react";
|
|
47509
47226
|
function FunClickOutside({
|
|
47510
47227
|
children,
|
|
47511
47228
|
onClick
|
|
47512
47229
|
}) {
|
|
47513
47230
|
const wrapperRef = useRef41(null);
|
|
47514
|
-
|
|
47231
|
+
const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
|
|
47232
|
+
useEffect78(() => {
|
|
47515
47233
|
const handleClickListener = (event) => {
|
|
47516
|
-
const
|
|
47517
|
-
|
|
47518
|
-
);
|
|
47234
|
+
const wrapper = wrapperRef.current;
|
|
47235
|
+
const clickedInside = isShadowDomEnabled ? !!wrapper && event.composedPath().includes(wrapper) : wrapper?.contains(event.target);
|
|
47519
47236
|
if (!clickedInside) {
|
|
47520
47237
|
onClick();
|
|
47521
47238
|
}
|
|
@@ -47524,7 +47241,7 @@ function FunClickOutside({
|
|
|
47524
47241
|
return () => {
|
|
47525
47242
|
document.removeEventListener("mousedown", handleClickListener);
|
|
47526
47243
|
};
|
|
47527
|
-
}, [onClick]);
|
|
47244
|
+
}, [onClick, isShadowDomEnabled]);
|
|
47528
47245
|
return /* @__PURE__ */ React275.createElement("div", { ref: wrapperRef }, children);
|
|
47529
47246
|
}
|
|
47530
47247
|
|
|
@@ -47694,11 +47411,11 @@ function Home({
|
|
|
47694
47411
|
const { checkoutHistoryList, isCheckoutHistoryInited } = useCheckoutHistoryContext();
|
|
47695
47412
|
const { returnViewPresets } = useActivityTraversal();
|
|
47696
47413
|
const { animation: tabAnimation, navigateTo } = useAnimatedNavigation(setSelectedView);
|
|
47697
|
-
|
|
47414
|
+
useEffect79(() => {
|
|
47698
47415
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
47699
47416
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
47700
47417
|
}, []);
|
|
47701
|
-
const AssetsList =
|
|
47418
|
+
const AssetsList = useMemo64(() => {
|
|
47702
47419
|
if (walletAssets && !Object.keys(walletAssets).length) {
|
|
47703
47420
|
return /* @__PURE__ */ React279.createElement(EmptyTabAlert, null);
|
|
47704
47421
|
}
|
|
@@ -47725,7 +47442,7 @@ function Home({
|
|
|
47725
47442
|
}
|
|
47726
47443
|
));
|
|
47727
47444
|
}, [walletAssets]);
|
|
47728
|
-
const CheckoutsList =
|
|
47445
|
+
const CheckoutsList = useMemo64(() => {
|
|
47729
47446
|
if (checkoutHistoryList.length === 0 && isCheckoutHistoryInited) {
|
|
47730
47447
|
return /* @__PURE__ */ React279.createElement(EmptyTabAlert, null);
|
|
47731
47448
|
}
|
|
@@ -48424,13 +48141,13 @@ function ChainModal({ onClose, open }) {
|
|
|
48424
48141
|
}
|
|
48425
48142
|
|
|
48426
48143
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
48427
|
-
import React303, { useEffect as
|
|
48144
|
+
import React303, { useEffect as useEffect88, useLayoutEffect as useLayoutEffect3, useRef as useRef45 } from "react";
|
|
48428
48145
|
|
|
48429
48146
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
48430
|
-
import React295, { useCallback as useCallback61, useMemo as
|
|
48147
|
+
import React295, { useCallback as useCallback61, useMemo as useMemo65, useState as useState88 } from "react";
|
|
48431
48148
|
|
|
48432
48149
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
48433
|
-
import React290, { useEffect as
|
|
48150
|
+
import React290, { useEffect as useEffect80 } from "react";
|
|
48434
48151
|
var AUTO_CLOSE = 2e3;
|
|
48435
48152
|
var messageMap = (hasQrCode) => ({
|
|
48436
48153
|
error: {
|
|
@@ -48449,7 +48166,7 @@ var FunConnectResultStep = ({
|
|
|
48449
48166
|
qrCodeUri
|
|
48450
48167
|
}) => {
|
|
48451
48168
|
const hasAutoclose = type === "success";
|
|
48452
|
-
|
|
48169
|
+
useEffect80(() => {
|
|
48453
48170
|
if (!hasAutoclose) {
|
|
48454
48171
|
return;
|
|
48455
48172
|
}
|
|
@@ -48869,7 +48586,7 @@ function FunConnectOptions({
|
|
|
48869
48586
|
}
|
|
48870
48587
|
}
|
|
48871
48588
|
};
|
|
48872
|
-
const stepComponent =
|
|
48589
|
+
const stepComponent = useMemo65(() => {
|
|
48873
48590
|
switch (step) {
|
|
48874
48591
|
case 0 /* SIGNIN_PRIMARY */:
|
|
48875
48592
|
return /* @__PURE__ */ React295.createElement(
|
|
@@ -48984,20 +48701,20 @@ var FunCheckoutBlocked = ({ reason }) => {
|
|
|
48984
48701
|
};
|
|
48985
48702
|
|
|
48986
48703
|
// src/modals/CheckoutModal/CheckoutModalPrefetchedHooks.tsx
|
|
48987
|
-
import { useEffect as
|
|
48704
|
+
import { useEffect as useEffect81 } from "react";
|
|
48988
48705
|
function CheckoutModalPrefetchedHooks() {
|
|
48989
48706
|
const { checkoutItem } = useCheckoutContext();
|
|
48990
48707
|
const { address: walletAddress } = useAccount();
|
|
48991
48708
|
const { setTargetAssetSupportsPermit, setTargetAssetPoolAllowance } = useQuoteContext();
|
|
48992
48709
|
const aavePermitSupported = useAaveTargetReservePermit(checkoutItem);
|
|
48993
|
-
|
|
48710
|
+
useEffect81(() => {
|
|
48994
48711
|
setTargetAssetSupportsPermit(aavePermitSupported);
|
|
48995
48712
|
}, [aavePermitSupported, setTargetAssetSupportsPermit]);
|
|
48996
48713
|
const aavePoolAllowance = useAaveTargetPoolAllowance(
|
|
48997
48714
|
checkoutItem,
|
|
48998
48715
|
walletAddress
|
|
48999
48716
|
);
|
|
49000
|
-
|
|
48717
|
+
useEffect81(() => {
|
|
49001
48718
|
setTargetAssetPoolAllowance(aavePoolAllowance);
|
|
49002
48719
|
}, [aavePoolAllowance, setTargetAssetPoolAllowance]);
|
|
49003
48720
|
return null;
|
|
@@ -49005,7 +48722,7 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
49005
48722
|
|
|
49006
48723
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
49007
48724
|
import clsx26 from "clsx";
|
|
49008
|
-
import React302, { useCallback as useCallback63, useEffect as
|
|
48725
|
+
import React302, { useCallback as useCallback63, useEffect as useEffect86, useMemo as useMemo66, useState as useState90 } from "react";
|
|
49009
48726
|
|
|
49010
48727
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
49011
48728
|
import React297 from "react";
|
|
@@ -49073,10 +48790,10 @@ var useRecentCheckouts = ({
|
|
|
49073
48790
|
|
|
49074
48791
|
// src/hooks/useOnNewNotification.ts
|
|
49075
48792
|
import { safeParseJson as safeParseJson2 } from "@funkit/utils";
|
|
49076
|
-
import { useEffect as
|
|
48793
|
+
import { useEffect as useEffect82 } from "react";
|
|
49077
48794
|
var storageKey5 = "fkc-processed-notifications";
|
|
49078
48795
|
var useOnNewNotification = (combinedNotifications, cb) => {
|
|
49079
|
-
|
|
48796
|
+
useEffect82(() => {
|
|
49080
48797
|
const alreadyProcessed = safeParseJsonObject(
|
|
49081
48798
|
sessionStorage.getItem(storageKey5)
|
|
49082
48799
|
);
|
|
@@ -49123,7 +48840,7 @@ import React300 from "react";
|
|
|
49123
48840
|
|
|
49124
48841
|
// src/components/FunNotificationBanner/FunNotificationBanner.tsx
|
|
49125
48842
|
import { AnimatePresence as AnimatePresence6, motion as motion19 } from "motion/react";
|
|
49126
|
-
import React299, { useEffect as
|
|
48843
|
+
import React299, { useEffect as useEffect84, useRef as useRef44, useState as useState89 } from "react";
|
|
49127
48844
|
import clsx25 from "clsx";
|
|
49128
48845
|
|
|
49129
48846
|
// src/components/FunNotificationBanner/FunNotificationBanner.css.ts
|
|
@@ -49133,7 +48850,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f1r4 _1rsrm2f1i _1rsrm2f1f _1rsrm2f11
|
|
|
49133
48850
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
49134
48851
|
import clsx24 from "clsx";
|
|
49135
48852
|
import { motion as motion18, useAnimate as useAnimate3 } from "motion/react";
|
|
49136
|
-
import React298, { useCallback as useCallback62, useEffect as
|
|
48853
|
+
import React298, { useCallback as useCallback62, useEffect as useEffect83, useRef as useRef43 } from "react";
|
|
49137
48854
|
|
|
49138
48855
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
49139
48856
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -49383,7 +49100,7 @@ var FunNotificationBannerIcon = ({
|
|
|
49383
49100
|
}) => {
|
|
49384
49101
|
const [animationScope, animate] = useAnimate3();
|
|
49385
49102
|
const triggerAnimationProcessingToCompleted = useCallback62(async () => {
|
|
49386
|
-
const completedIconPath =
|
|
49103
|
+
const completedIconPath = animationScope.current?.querySelector(
|
|
49387
49104
|
`.${generateAnimationPrefixClassName("icon-wrapper-completed")} path`
|
|
49388
49105
|
);
|
|
49389
49106
|
if (completedIconPath instanceof SVGPathElement) {
|
|
@@ -49488,7 +49205,7 @@ var FunNotificationBannerIcon = ({
|
|
|
49488
49205
|
}
|
|
49489
49206
|
)
|
|
49490
49207
|
]);
|
|
49491
|
-
}, [animate]);
|
|
49208
|
+
}, [animate, animationScope]);
|
|
49492
49209
|
const triggerAnimationDelayedToFailed = useCallback62(async () => {
|
|
49493
49210
|
await Promise.all([
|
|
49494
49211
|
animate(
|
|
@@ -49583,7 +49300,7 @@ var FunNotificationBannerIcon = ({
|
|
|
49583
49300
|
]);
|
|
49584
49301
|
}, [animate]);
|
|
49585
49302
|
const statusRef = useRef43(status);
|
|
49586
|
-
|
|
49303
|
+
useEffect83(() => {
|
|
49587
49304
|
if (statusRef.current !== status) {
|
|
49588
49305
|
if (statusRef.current === "processing" && status === "completed") {
|
|
49589
49306
|
triggerAnimationProcessingToCompleted();
|
|
@@ -49683,7 +49400,7 @@ var FunNotificationBanner = ({
|
|
|
49683
49400
|
const [isOpen, setIsOpen] = useState89(true);
|
|
49684
49401
|
const prevStatusRef = useRef44(status);
|
|
49685
49402
|
const prevStatus = prevStatusRef.current;
|
|
49686
|
-
|
|
49403
|
+
useEffect84(() => {
|
|
49687
49404
|
prevStatusRef.current = status;
|
|
49688
49405
|
}, [status]);
|
|
49689
49406
|
const direction = status && prevStatus && prevStatus !== status && (STATUS_RANK[status] ?? 0) < (STATUS_RANK[prevStatus] ?? 0) ? -1 : 1;
|
|
@@ -49871,13 +49588,13 @@ var FunNotificationBanner = ({
|
|
|
49871
49588
|
import {
|
|
49872
49589
|
getCheckoutByDepositAddress as getCheckoutByDepositAddress2
|
|
49873
49590
|
} from "@funkit/api-base";
|
|
49874
|
-
import { useQuery as
|
|
49591
|
+
import { useQuery as useQuery24 } from "@tanstack/react-query";
|
|
49875
49592
|
var useCheckout = (depositAddress, initial) => {
|
|
49876
49593
|
const { apiKey } = useFunkitConfig();
|
|
49877
49594
|
const { itemRefresh } = useDynamicConfig(
|
|
49878
49595
|
"checkoutnotificationsrefreshinterval"
|
|
49879
49596
|
);
|
|
49880
|
-
const query =
|
|
49597
|
+
const query = useQuery24({
|
|
49881
49598
|
queryKey: ["checkouts", "checkout", depositAddress],
|
|
49882
49599
|
queryFn: () => getCheckoutByDepositAddress2({
|
|
49883
49600
|
// biome-ignore lint/style/noNonNullAssertion: already checked for null
|
|
@@ -50211,10 +49928,10 @@ var parseDisclaimer2 = (t, isRefunded, isDelayed2, isFailed, onHelp) => {
|
|
|
50211
49928
|
};
|
|
50212
49929
|
|
|
50213
49930
|
// src/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.ts
|
|
50214
|
-
import { useEffect as
|
|
49931
|
+
import { useEffect as useEffect85 } from "react";
|
|
50215
49932
|
function useTrackDepositNotificationEvents(items) {
|
|
50216
49933
|
const { trackExecutionProgressEvents } = useTrackExecutionProgressEvents("deposit");
|
|
50217
|
-
|
|
49934
|
+
useEffect85(() => {
|
|
50218
49935
|
for (const item of items) {
|
|
50219
49936
|
trackExecutionProgressEvents(item);
|
|
50220
49937
|
}
|
|
@@ -50235,25 +49952,25 @@ var CheckoutNotifications = ({
|
|
|
50235
49952
|
const [closedNotifications, setClosedNotifications] = useState90([]);
|
|
50236
49953
|
const { data: checkouts } = useRecentCheckouts({ isVisible });
|
|
50237
49954
|
const { data: directExecutions } = useRecentDeposits({ isVisible });
|
|
50238
|
-
const mergedDirectExecutions =
|
|
49955
|
+
const mergedDirectExecutions = useMemo66(
|
|
50239
49956
|
() => processRecentDepositsForNotifications2(directExecutions, {
|
|
50240
49957
|
variant
|
|
50241
49958
|
}),
|
|
50242
49959
|
[directExecutions, variant]
|
|
50243
49960
|
);
|
|
50244
|
-
|
|
49961
|
+
useEffect86(() => {
|
|
50245
49962
|
if (initialCheckouts || !checkouts) {
|
|
50246
49963
|
return;
|
|
50247
49964
|
}
|
|
50248
49965
|
setInitialCheckouts(checkouts);
|
|
50249
49966
|
}, [initialCheckouts, checkouts]);
|
|
50250
|
-
|
|
49967
|
+
useEffect86(() => {
|
|
50251
49968
|
if (initialDirectExecutions || !directExecutions) {
|
|
50252
49969
|
return;
|
|
50253
49970
|
}
|
|
50254
49971
|
setInitialDirectExecutions(directExecutions);
|
|
50255
49972
|
}, [initialDirectExecutions, directExecutions]);
|
|
50256
|
-
const displayedDirectExecutions =
|
|
49973
|
+
const displayedDirectExecutions = useMemo66(() => {
|
|
50257
49974
|
if (!mergedDirectExecutions || !initialDirectExecutions) {
|
|
50258
49975
|
return [];
|
|
50259
49976
|
}
|
|
@@ -50265,13 +49982,13 @@ var CheckoutNotifications = ({
|
|
|
50265
49982
|
return !closedNotifications.includes(notificationKey);
|
|
50266
49983
|
}).slice(0, MAX_COUNT);
|
|
50267
49984
|
}, [initialDirectExecutions, mergedDirectExecutions, closedNotifications]);
|
|
50268
|
-
const displayedCheckouts =
|
|
49985
|
+
const displayedCheckouts = useMemo66(() => {
|
|
50269
49986
|
if (!checkouts || !initialCheckouts) {
|
|
50270
49987
|
return [];
|
|
50271
49988
|
}
|
|
50272
49989
|
return getUpdatedCheckouts(checkouts, initialCheckouts).filter(({ depositAddr }) => !closedNotifications.includes(depositAddr)).slice(0, MAX_COUNT);
|
|
50273
49990
|
}, [initialCheckouts, checkouts, closedNotifications]);
|
|
50274
|
-
const combinedNotifications =
|
|
49991
|
+
const combinedNotifications = useMemo66(() => {
|
|
50275
49992
|
return [
|
|
50276
49993
|
...displayedDirectExecutions.map(
|
|
50277
49994
|
(item) => ({ ...item, isDirectExecution: true })
|
|
@@ -50282,7 +49999,7 @@ var CheckoutNotifications = ({
|
|
|
50282
49999
|
].sort((a, b) => b.createdTimeMs - a.createdTimeMs);
|
|
50283
50000
|
}, [displayedDirectExecutions, displayedCheckouts]);
|
|
50284
50001
|
useTrackDepositNotificationEvents(combinedNotifications);
|
|
50285
|
-
const displayedNotifications =
|
|
50002
|
+
const displayedNotifications = useMemo66(() => {
|
|
50286
50003
|
return isExpanded ? combinedNotifications : combinedNotifications.slice(0, COLLAPSED_COUNT);
|
|
50287
50004
|
}, [isExpanded, combinedNotifications]);
|
|
50288
50005
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
@@ -50363,7 +50080,7 @@ function selectSuccessScreenBackground({
|
|
|
50363
50080
|
}
|
|
50364
50081
|
|
|
50365
50082
|
// src/modals/CheckoutModal/useCheckoutBlocked.ts
|
|
50366
|
-
import { useEffect as
|
|
50083
|
+
import { useEffect as useEffect87 } from "react";
|
|
50367
50084
|
var geoblockedViewableSteps = /* @__PURE__ */ new Set([
|
|
50368
50085
|
"loading_account" /* LOADING_ACCOUNT */,
|
|
50369
50086
|
"source_change" /* SOURCE_CHANGE */
|
|
@@ -50401,7 +50118,7 @@ function useCheckoutBlocked(params) {
|
|
|
50401
50118
|
params.onCheckoutBlocked?.({ blockedReason: reason });
|
|
50402
50119
|
}
|
|
50403
50120
|
);
|
|
50404
|
-
|
|
50121
|
+
useEffect87(() => {
|
|
50405
50122
|
if (blockedReason) {
|
|
50406
50123
|
onCheckoutBlockedEvent(blockedReason);
|
|
50407
50124
|
}
|
|
@@ -50507,7 +50224,7 @@ function FunCheckoutModalInner({
|
|
|
50507
50224
|
setModalState
|
|
50508
50225
|
};
|
|
50509
50226
|
const connectionStatus = useConnectionStatus();
|
|
50510
|
-
|
|
50227
|
+
useEffect88(() => {
|
|
50511
50228
|
if (!modalState.showWalletOptions) {
|
|
50512
50229
|
return;
|
|
50513
50230
|
}
|
|
@@ -50799,7 +50516,7 @@ function ModalProvider({ children }) {
|
|
|
50799
50516
|
onConnect: () => closeModals(isUnauthenticated),
|
|
50800
50517
|
onDisconnect: closeModals
|
|
50801
50518
|
});
|
|
50802
|
-
|
|
50519
|
+
useEffect89(() => {
|
|
50803
50520
|
if (isUnauthenticated) {
|
|
50804
50521
|
closeModals();
|
|
50805
50522
|
}
|
|
@@ -50807,7 +50524,7 @@ function ModalProvider({ children }) {
|
|
|
50807
50524
|
return /* @__PURE__ */ React305.createElement(
|
|
50808
50525
|
ModalContext.Provider,
|
|
50809
50526
|
{
|
|
50810
|
-
value:
|
|
50527
|
+
value: useMemo67(
|
|
50811
50528
|
() => ({
|
|
50812
50529
|
accountModalOpen,
|
|
50813
50530
|
accountModalTab,
|
|
@@ -50904,7 +50621,7 @@ function useConnectModal(onClose) {
|
|
|
50904
50621
|
const { connectModalOpen, openConnectModal } = useContext20(ModalContext);
|
|
50905
50622
|
const { isWalletConnectModalOpen } = useWalletConnectOpenState();
|
|
50906
50623
|
const effectiveConnectModalOpen = connectModalOpen || isWalletConnectModalOpen;
|
|
50907
|
-
|
|
50624
|
+
useEffect89(() => {
|
|
50908
50625
|
if (!effectiveConnectModalOpen && onClose) {
|
|
50909
50626
|
onClose();
|
|
50910
50627
|
}
|
|
@@ -51056,7 +50773,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
51056
50773
|
},
|
|
51057
50774
|
[]
|
|
51058
50775
|
);
|
|
51059
|
-
|
|
50776
|
+
useEffect90(() => {
|
|
51060
50777
|
if (isNotNullish7(logoutSymbol)) {
|
|
51061
50778
|
setActiveCheckout(null);
|
|
51062
50779
|
}
|
|
@@ -51862,13 +51579,13 @@ function useFunkitCheckout(props) {
|
|
|
51862
51579
|
});
|
|
51863
51580
|
openWithdrawalModal?.({ withdrawalId, ...config });
|
|
51864
51581
|
});
|
|
51865
|
-
|
|
51582
|
+
useEffect90(() => {
|
|
51866
51583
|
if (isUserLoggedIn && pendingCheckoutConfig) {
|
|
51867
51584
|
setPendingCheckoutConfig(void 0);
|
|
51868
51585
|
beginCheckout(pendingCheckoutConfig);
|
|
51869
51586
|
}
|
|
51870
51587
|
}, [beginCheckout, isUserLoggedIn, pendingCheckoutConfig]);
|
|
51871
|
-
|
|
51588
|
+
useEffect90(() => {
|
|
51872
51589
|
if (pendingCheckoutConfig && !isUserLoggedIn && !connectModalOpen) {
|
|
51873
51590
|
setPendingCheckoutConfig(void 0);
|
|
51874
51591
|
}
|
|
@@ -51977,7 +51694,7 @@ var hasSufficientBalance = async (wagmiConfig, walletAddress, tokenAddress, toke
|
|
|
51977
51694
|
requiredAssetAmount,
|
|
51978
51695
|
walletAddress
|
|
51979
51696
|
});
|
|
51980
|
-
const balance = Number.parseFloat(
|
|
51697
|
+
const balance = Number.parseFloat(formatUnits6(data.value, data.decimals));
|
|
51981
51698
|
if (balance >= requiredAssetAmount) {
|
|
51982
51699
|
return { balance, result: true, tokenTicker: data.symbol };
|
|
51983
51700
|
}
|
|
@@ -52060,8 +51777,8 @@ function getMaxTargetAssetAmountEstimate(sourceAssetBalance, config, quoteResult
|
|
|
52060
51777
|
const sourceAssetFees = getQuoteTotalFeesFromAmount(quoteResult);
|
|
52061
51778
|
const maxSourceAssetAmount = Math.max(sourceAssetBalance - sourceAssetFees, 0);
|
|
52062
51779
|
const maxTargetAssetAmount = maxSourceAssetAmount * exchangeRate;
|
|
52063
|
-
return
|
|
52064
|
-
|
|
51780
|
+
return dnum11.multiply(
|
|
51781
|
+
dnum11.from(maxTargetAssetAmount, targetAssetDecimals),
|
|
52065
51782
|
0.99
|
|
52066
51783
|
);
|
|
52067
51784
|
}
|
|
@@ -52355,7 +52072,7 @@ var useWalletAssets = ({
|
|
|
52355
52072
|
} = {}) => {
|
|
52356
52073
|
const { address, isConnected } = useAccount();
|
|
52357
52074
|
const { apiKey } = useFunkitConfig();
|
|
52358
|
-
const { data, isLoading, isFetching } =
|
|
52075
|
+
const { data, isLoading, isFetching } = useQuery25({
|
|
52359
52076
|
queryKey: ["getWalletAssets", address, apiKey],
|
|
52360
52077
|
meta: stepQueryMeta({
|
|
52361
52078
|
name: "walletAssets",
|
|
@@ -52447,7 +52164,7 @@ function ConnectButtonRenderer({
|
|
|
52447
52164
|
// TypeError: Do not know how to serialize a BigInt
|
|
52448
52165
|
query: { structuralSharing: false }
|
|
52449
52166
|
});
|
|
52450
|
-
const balanceFormatted = balanceData ?
|
|
52167
|
+
const balanceFormatted = balanceData ? formatUnits7(balanceData.value, balanceData.decimals) : void 0;
|
|
52451
52168
|
const balanceNativeAmount = balanceData && balanceFormatted ? `${abbreviateETHBalance(Number.parseFloat(balanceFormatted))} ${balanceData.symbol}` : void 0;
|
|
52452
52169
|
const displayBalance = formatCurrencyAndStringify15(
|
|
52453
52170
|
Number.parseFloat(totalWalletAssetsUsd.toString())
|
|
@@ -52656,7 +52373,7 @@ function ConnectButton({
|
|
|
52656
52373
|
const connectionStatus = useConnectionStatus();
|
|
52657
52374
|
const { setShowBalance } = useShowBalance();
|
|
52658
52375
|
const [ready, setReady] = useState93(false);
|
|
52659
|
-
|
|
52376
|
+
useEffect91(() => {
|
|
52660
52377
|
setShowBalance(showBalance);
|
|
52661
52378
|
if (!ready) {
|
|
52662
52379
|
setReady(true);
|