@funkit/connect 13.0.1 → 13.1.0
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 +22 -0
- package/dist/clients/internal/nado/withdrawalForm.js +1 -1
- package/dist/clients/lighter.d.ts +1 -1
- package/dist/hooks/track/analytics/events.d.ts +5 -1
- package/dist/hooks/track/analytics/swappedIframePayload.d.ts +1 -0
- package/dist/hooks/track/analytics/swappedIframeSubmission.d.ts +4 -0
- package/dist/hooks/track/analytics/useTrackSwappedIframeEvents.d.ts +1 -0
- package/dist/hooks/useSwappedPillAmounts.d.ts +8 -0
- package/dist/index.js +195 -111
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +55 -55
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +4 -4
- package/dist/wallets/walletConnectors/{chunk-CU5J53XR.js → chunk-53MYTA42.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZSSSLFQF.js → chunk-65ULY6OC.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-XODA5ESL.js → chunk-A5POD5SV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-RXRYHMRI.js → chunk-ANODOMIN.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IWOMSW64.js → chunk-ASTCNVJC.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-U52QO5HF.js → chunk-F45CUFRR.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YRMBR6NA.js → chunk-FYPQ3HP4.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-BBDNB5TQ.js → chunk-IWPW26AL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-4FHNLTR3.js → chunk-JJBLW4IU.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-NXWG6FG2.js → chunk-KE4CWI3A.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-BBB2J3US.js → chunk-MWB6LFSG.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-34B7OJNT.js → chunk-OVDCDVFX.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-SR5CZR3L.js → chunk-PPQ6L4K2.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-IA5432IR.js → chunk-RJF2YEZ5.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-RFCZYLNR.js → chunk-RQYEGJKL.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-TRZDAXCQ.js → chunk-TIHTQ3OB.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ALGPGI6V.js → chunk-TM7UBV3Q.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HOCKAU5H.js → chunk-USLZMUJ3.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 13.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fca33a2: Lighter Fast withdrawals pass the entered recipient and Relay's `protocol.v2` order to `signerClient.transfer` as `withdrawal`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 51ecbdf: Track Swapped deposit submissions once per checkout with payment method, order identifiers, and the configured destination chain and token.
|
|
12
|
+
- 352ba38: Swapped quick-amount buttons now show amounts in the user's local currency instead of fixed USD values.
|
|
13
|
+
- Updated dependencies [36310a3]
|
|
14
|
+
- Updated dependencies [fca33a2]
|
|
15
|
+
- Updated dependencies [07ea33e]
|
|
16
|
+
- Updated dependencies [2573e4a]
|
|
17
|
+
- Updated dependencies [fca33a2]
|
|
18
|
+
- Updated dependencies [116e0f0]
|
|
19
|
+
- Updated dependencies [f2d66a8]
|
|
20
|
+
- Updated dependencies [352ba38]
|
|
21
|
+
- @funkit/api-base@10.3.0
|
|
22
|
+
- @funkit/connect-core@16.1.0
|
|
23
|
+
- @funkit/fun-relay@4.1.0
|
|
24
|
+
|
|
3
25
|
## 13.0.1
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isNadoWithdrawalConfig
|
|
4
4
|
} from "../../chunk-LCYJLY4X.js";
|
|
5
|
+
import "../../chunk-LICTGZXW.js";
|
|
5
6
|
import "../../chunk-PZSKO3BJ.js";
|
|
6
7
|
import {
|
|
7
8
|
useFunkitConfig
|
|
8
9
|
} from "../../chunk-AJGDTTRJ.js";
|
|
9
|
-
import "../../chunk-LICTGZXW.js";
|
|
10
10
|
import {
|
|
11
11
|
useFunkitTranslation
|
|
12
12
|
} from "../../chunk-ZEXIDBIZ.js";
|
|
@@ -20,7 +20,7 @@ import { type LighterSigner } from '@funkit/connect-core/clients/lighter';
|
|
|
20
20
|
import type { CustomWithdrawalConfig, LighterRouteType, MultiMethodWithdrawalConfig, SourceTokenOption, WithdrawalSourceTokenBalanceParams } from '../providers/FunkitCheckoutContext/types';
|
|
21
21
|
export { LIGHTER_ROUTE_TYPE } from '@funkit/connect-core/clients/lighter';
|
|
22
22
|
export type { LighterRouteType } from '../providers/FunkitCheckoutContext/types';
|
|
23
|
-
export type { LighterSigner, LighterTransaction, LighterTransferParams, } from '@funkit/connect-core/clients/lighter';
|
|
23
|
+
export type { LighterSigner, LighterTransaction, LighterTransferParams, WithdrawalIntent, } from '@funkit/connect-core/clients/lighter';
|
|
24
24
|
export { LIGHTER_WITHDRAW_ABI, buildLighterL1WithdrawTransaction, isLighterWithdrawalRateLimitError, } from '@funkit/connect-core/clients/lighter';
|
|
25
25
|
/** Lighter base units, defaulting to mainnet for existing connect integrators. */
|
|
26
26
|
export declare function lighterWithdrawBaseUnits(assetIndex: number, amountTokenUnits: string, chainId?: LighterChainId): bigint;
|
|
@@ -210,9 +210,13 @@ export type ExecutionTransactionSnapshotProperties = DepositAssetContextProperti
|
|
|
210
210
|
tx_hash: string | null;
|
|
211
211
|
user_id?: string;
|
|
212
212
|
};
|
|
213
|
-
export type TransactionSubmittedProperties = ExecutionTransactionSnapshotProperties & {
|
|
213
|
+
export type TransactionSubmittedProperties = Omit<ExecutionTransactionSnapshotProperties, 'target_chain' | 'target_asset'> & {
|
|
214
|
+
target_chain: string | null;
|
|
215
|
+
target_asset: string | null;
|
|
214
216
|
est_fulfillment_time_ms: number | null;
|
|
215
217
|
quote_id: string | null;
|
|
218
|
+
payment_rail?: AnalyticsPaymentRail | null;
|
|
219
|
+
order_id?: string | null;
|
|
216
220
|
};
|
|
217
221
|
export type ExecutionSucceededProperties = ExecutionTransactionSnapshotProperties & {
|
|
218
222
|
fulfillment_time_ms: number | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readSwappedIdentifier(value: unknown): string | null;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FormOfPaymentType } from '@funkit/api-base';
|
|
2
|
+
import type { ApiFunkitCheckoutConfig } from '@funkit/utils';
|
|
3
|
+
import type { TransactionSubmittedProperties } from './events';
|
|
4
|
+
export declare function buildSwappedIframeSubmissionProperties(data: unknown, fopType: FormOfPaymentType, checkoutId: string, config: Pick<ApiFunkitCheckoutConfig, 'targetChain' | 'targetAsset' | 'targetAssetTicker'>): TransactionSubmittedProperties;
|
|
@@ -2,4 +2,5 @@ import type { FormOfPaymentType } from '@funkit/api-base';
|
|
|
2
2
|
import { type AnalyticsFlow } from './events';
|
|
3
3
|
export declare function useTrackSwappedIframeEvents(flow: AnalyticsFlow): {
|
|
4
4
|
trackIframeStepViewed: (step: string, fopType: FormOfPaymentType) => void;
|
|
5
|
+
trackIframeTransactionSubmitted: (data: unknown, fopType: FormOfPaymentType) => void;
|
|
5
6
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SwappedPillAmounts } from '@funkit/connect-core';
|
|
2
|
+
/**
|
|
3
|
+
* The Swapped embed's quick-amount pills in the user's local currency. Both
|
|
4
|
+
* queries are the ones /fops already ran, so this adds no requests.
|
|
5
|
+
* - Undefined while the currency or rates load; the session re-sends the
|
|
6
|
+
* theme once they arrive.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSwappedPillAmounts(): SwappedPillAmounts | undefined;
|
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
113
113
|
localStorage.setItem(storageKey, version);
|
|
114
114
|
}
|
|
115
115
|
function getCurrentSdkVersion() {
|
|
116
|
-
return "13.0
|
|
116
|
+
return "13.1.0";
|
|
117
117
|
}
|
|
118
118
|
function useFingerprint() {
|
|
119
119
|
const fingerprint = useCallback(() => {
|
|
@@ -10318,6 +10318,7 @@ import {
|
|
|
10318
10318
|
DirectExecutionType,
|
|
10319
10319
|
getCheckoutQuoteV2
|
|
10320
10320
|
} from "@funkit/api-base";
|
|
10321
|
+
import { bindWithdrawalIntent } from "@funkit/connect-core";
|
|
10321
10322
|
import { executeRelayQuote, shouldResetApproval } from "@funkit/fun-relay";
|
|
10322
10323
|
import { useCallback as useCallback11 } from "react";
|
|
10323
10324
|
import { decodeFunctionData, erc20Abi as erc20Abi3, getAddress as getAddress2 } from "viem";
|
|
@@ -10696,6 +10697,10 @@ function useCheckoutDirectExecution() {
|
|
|
10696
10697
|
vmType: adaptedWallet.vmType
|
|
10697
10698
|
});
|
|
10698
10699
|
}
|
|
10700
|
+
const relayWallet = adaptedWallet && withdrawalSignContext ? bindWithdrawalIntent(adaptedWallet, {
|
|
10701
|
+
recipient: withdrawalSignContext.destinationAddress,
|
|
10702
|
+
relayOrder: relayQuote.protocol?.v2
|
|
10703
|
+
}) : adaptedWallet;
|
|
10699
10704
|
const walletClient = rawWalletClient && !adaptedWallet ? await disableAtomicBatchIfSupported(
|
|
10700
10705
|
rawWalletClient,
|
|
10701
10706
|
executionChainId
|
|
@@ -10750,7 +10755,7 @@ function useCheckoutDirectExecution() {
|
|
|
10750
10755
|
},
|
|
10751
10756
|
logger,
|
|
10752
10757
|
relayQuote,
|
|
10753
|
-
walletClient:
|
|
10758
|
+
walletClient: relayWallet ?? (withdrawalClient ? {
|
|
10754
10759
|
vmType: "evm",
|
|
10755
10760
|
getChainId: () => withdrawalClient.getChainId(),
|
|
10756
10761
|
// Gasless routes (permit / EIP-3009) come back from Relay
|
|
@@ -17355,13 +17360,100 @@ import React53, {
|
|
|
17355
17360
|
createContext as createContext19,
|
|
17356
17361
|
useCallback as useCallback22,
|
|
17357
17362
|
useContext as useContext18,
|
|
17358
|
-
useMemo as
|
|
17363
|
+
useMemo as useMemo22,
|
|
17359
17364
|
useRef as useRef16,
|
|
17360
17365
|
useState as useState27
|
|
17361
17366
|
} from "react";
|
|
17362
17367
|
|
|
17363
|
-
// src/hooks/
|
|
17368
|
+
// src/hooks/useSwappedPillAmounts.ts
|
|
17369
|
+
import {
|
|
17370
|
+
getSwappedPillAmounts
|
|
17371
|
+
} from "@funkit/connect-core";
|
|
17372
|
+
|
|
17373
|
+
// src/hooks/queries/useSwappedDefaultCurrency.ts
|
|
17374
|
+
import { useSwappedDefaultCurrencyQuery } from "@funkit/connect-core";
|
|
17375
|
+
|
|
17376
|
+
// src/providers/FunkitMoonpayProvider.tsx
|
|
17364
17377
|
import { useMemo as useMemo20 } from "react";
|
|
17378
|
+
var BYPASS_COUNTRY_BLOCK_CHECK = false;
|
|
17379
|
+
var ALL_MATCH = "*";
|
|
17380
|
+
var isCountryBlocked = (blockedList, userIpInfo) => {
|
|
17381
|
+
if (BYPASS_COUNTRY_BLOCK_CHECK) {
|
|
17382
|
+
return false;
|
|
17383
|
+
}
|
|
17384
|
+
if (!userIpInfo.alpha2) {
|
|
17385
|
+
logger.log("isUserBlockedForCheckout_NoIpDetected");
|
|
17386
|
+
return true;
|
|
17387
|
+
}
|
|
17388
|
+
const isBlocked = blockedList.includes(ALL_MATCH) || blockedList.includes(userIpInfo.alpha2);
|
|
17389
|
+
logger.log("isUserBlockedForCheckoutResult", {
|
|
17390
|
+
isBlocked,
|
|
17391
|
+
blockedList,
|
|
17392
|
+
userIpInfo
|
|
17393
|
+
});
|
|
17394
|
+
return isBlocked;
|
|
17395
|
+
};
|
|
17396
|
+
function useFunkitUserIp() {
|
|
17397
|
+
const { isUserLoggedIn } = useGeneralWallet();
|
|
17398
|
+
const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo();
|
|
17399
|
+
const blockedCountries = useDynamicConfig("blockedcountries");
|
|
17400
|
+
const isUserGeoblocked = useMemo20(() => {
|
|
17401
|
+
if (isLoadingGeoCheck) {
|
|
17402
|
+
return false;
|
|
17403
|
+
}
|
|
17404
|
+
if (!userIpInfo) {
|
|
17405
|
+
return true;
|
|
17406
|
+
}
|
|
17407
|
+
return isCountryBlocked(blockedCountries, userIpInfo);
|
|
17408
|
+
}, [blockedCountries, isLoadingGeoCheck, userIpInfo]);
|
|
17409
|
+
return {
|
|
17410
|
+
isLoadingGeoCheck,
|
|
17411
|
+
isUserGeoblocked,
|
|
17412
|
+
isUserLoggedIn,
|
|
17413
|
+
userIpInfo
|
|
17414
|
+
};
|
|
17415
|
+
}
|
|
17416
|
+
|
|
17417
|
+
// src/hooks/queries/useSwappedDefaultCurrency.ts
|
|
17418
|
+
var useSwappedDefaultCurrency = () => {
|
|
17419
|
+
const { apiKey } = useFunkitConfig();
|
|
17420
|
+
const { userIpInfo } = useFunkitUserIp();
|
|
17421
|
+
return useSwappedDefaultCurrencyQuery({
|
|
17422
|
+
apiKey,
|
|
17423
|
+
countryCode: userIpInfo?.alpha2,
|
|
17424
|
+
logger
|
|
17425
|
+
});
|
|
17426
|
+
};
|
|
17427
|
+
|
|
17428
|
+
// src/hooks/useFiatExchangeRates.ts
|
|
17429
|
+
import { getFiatExchangeRates } from "@funkit/api-base";
|
|
17430
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
17431
|
+
function useFiatExchangeRates(enabled = true) {
|
|
17432
|
+
const { data, isLoading, error } = useQuery4({
|
|
17433
|
+
queryKey: ["fiatExchangeRates"],
|
|
17434
|
+
queryFn: () => getFiatExchangeRates({ logger }),
|
|
17435
|
+
refetchOnMount: false,
|
|
17436
|
+
refetchOnReconnect: false,
|
|
17437
|
+
refetchOnWindowFocus: false,
|
|
17438
|
+
gcTime: 1e3 * 60 * 60,
|
|
17439
|
+
// 1 hour
|
|
17440
|
+
enabled
|
|
17441
|
+
});
|
|
17442
|
+
return { data, isLoading, error };
|
|
17443
|
+
}
|
|
17444
|
+
|
|
17445
|
+
// src/hooks/useSwappedPillAmounts.ts
|
|
17446
|
+
function useSwappedPillAmounts() {
|
|
17447
|
+
const { data: fiatCurrencyCode } = useSwappedDefaultCurrency();
|
|
17448
|
+
const { data: exchangeRates } = useFiatExchangeRates();
|
|
17449
|
+
if (!fiatCurrencyCode) {
|
|
17450
|
+
return void 0;
|
|
17451
|
+
}
|
|
17452
|
+
return getSwappedPillAmounts(fiatCurrencyCode, exchangeRates);
|
|
17453
|
+
}
|
|
17454
|
+
|
|
17455
|
+
// src/hooks/useSwappedTheme.ts
|
|
17456
|
+
import { useMemo as useMemo21 } from "react";
|
|
17365
17457
|
|
|
17366
17458
|
// src/utils/swapped.ts
|
|
17367
17459
|
import chroma from "chroma-js";
|
|
@@ -17507,7 +17599,7 @@ function buildSwappedThemeQueryParams(resolvedTheme) {
|
|
|
17507
17599
|
var useSwappedThemeQueryParams = () => {
|
|
17508
17600
|
const { activeTheme } = useActiveTheme();
|
|
17509
17601
|
const themeRootElement = useThemeRootElement();
|
|
17510
|
-
return
|
|
17602
|
+
return useMemo21(
|
|
17511
17603
|
() => buildSwappedThemeQueryParams(
|
|
17512
17604
|
resolveObjectCssVars(activeTheme, themeRootElement)
|
|
17513
17605
|
),
|
|
@@ -17519,7 +17611,7 @@ var useSwappedIframeTheme = () => {
|
|
|
17519
17611
|
const { uiCustomizations } = useFunkitConfig();
|
|
17520
17612
|
const themeRootElement = useThemeRootElement();
|
|
17521
17613
|
const isDarkMode = activeTheme === darkTheme2;
|
|
17522
|
-
return
|
|
17614
|
+
return useMemo21(() => {
|
|
17523
17615
|
const customFontFamily = uiCustomizations.customFontFamily;
|
|
17524
17616
|
const theme = { ...activeTheme, customFontFamily };
|
|
17525
17617
|
return buildSwappedTheme(
|
|
@@ -17572,12 +17664,12 @@ function createIframeSwappedTransport({
|
|
|
17572
17664
|
|
|
17573
17665
|
// src/providers/SwappedProvider.tsx
|
|
17574
17666
|
var SwappedContext = createContext19(null);
|
|
17575
|
-
function useSwappedSlot(swappedTheme, buyingCrypto) {
|
|
17667
|
+
function useSwappedSlot(swappedTheme, buyingCrypto, pillAmounts) {
|
|
17576
17668
|
const [iframeUrl, setIframeUrlState] = useState27(null);
|
|
17577
17669
|
const iframeRef = useRef16(null);
|
|
17578
17670
|
const iframeUrlRef = useRef16(iframeUrl);
|
|
17579
17671
|
iframeUrlRef.current = iframeUrl;
|
|
17580
|
-
const transport =
|
|
17672
|
+
const transport = useMemo22(
|
|
17581
17673
|
() => createIframeSwappedTransport({
|
|
17582
17674
|
getContentWindow: () => iframeRef.current?.contentWindow ?? null,
|
|
17583
17675
|
getTargetOrigin: () => getSwappedOrigin(iframeUrlRef.current || "")
|
|
@@ -17588,6 +17680,7 @@ function useSwappedSlot(swappedTheme, buyingCrypto) {
|
|
|
17588
17680
|
transport,
|
|
17589
17681
|
swappedTheme,
|
|
17590
17682
|
buyingCrypto,
|
|
17683
|
+
pillAmounts,
|
|
17591
17684
|
logger
|
|
17592
17685
|
});
|
|
17593
17686
|
const setIframeRef = useCallback22((el) => {
|
|
@@ -17615,7 +17708,7 @@ function useSwappedSlot(swappedTheme, buyingCrypto) {
|
|
|
17615
17708
|
readyCheckoutIdsRef.current.add(checkoutId);
|
|
17616
17709
|
return true;
|
|
17617
17710
|
}, []);
|
|
17618
|
-
return
|
|
17711
|
+
return useMemo22(
|
|
17619
17712
|
() => ({
|
|
17620
17713
|
iframeUrl,
|
|
17621
17714
|
isSwappedReady: session.isSwappedReady,
|
|
@@ -17649,9 +17742,10 @@ function SwappedProvider({
|
|
|
17649
17742
|
buyingCrypto
|
|
17650
17743
|
}) {
|
|
17651
17744
|
const swappedTheme = useSwappedIframeTheme();
|
|
17652
|
-
const
|
|
17653
|
-
const
|
|
17654
|
-
const
|
|
17745
|
+
const pillAmounts = useSwappedPillAmounts();
|
|
17746
|
+
const deposit = useSwappedSlot(swappedTheme, buyingCrypto, pillAmounts);
|
|
17747
|
+
const withdrawal = useSwappedSlot(swappedTheme, void 0, pillAmounts);
|
|
17748
|
+
const value = useMemo22(
|
|
17655
17749
|
() => ({ deposit, withdrawal, swappedTheme }),
|
|
17656
17750
|
[deposit, withdrawal, swappedTheme]
|
|
17657
17751
|
);
|
|
@@ -19629,7 +19723,7 @@ import { v4 as uuid2 } from "uuid";
|
|
|
19629
19723
|
import React94, {
|
|
19630
19724
|
useCallback as useCallback27,
|
|
19631
19725
|
useEffect as useEffect39,
|
|
19632
|
-
useMemo as
|
|
19726
|
+
useMemo as useMemo25,
|
|
19633
19727
|
useRef as useRef21,
|
|
19634
19728
|
useState as useState35
|
|
19635
19729
|
} from "react";
|
|
@@ -20162,7 +20256,7 @@ import React85 from "react";
|
|
|
20162
20256
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
20163
20257
|
import { isMobile as isMobile4 } from "@funkit/utils";
|
|
20164
20258
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
20165
|
-
import React84, { useCallback as useCallback26, useEffect as useEffect37, useMemo as
|
|
20259
|
+
import React84, { useCallback as useCallback26, useEffect as useEffect37, useMemo as useMemo23, useRef as useRef19, useState as useState33 } from "react";
|
|
20166
20260
|
|
|
20167
20261
|
// src/components/FunNoResults/FunNoResults.tsx
|
|
20168
20262
|
import React82 from "react";
|
|
@@ -20582,7 +20676,7 @@ function BaseDropdown({
|
|
|
20582
20676
|
const [isOpened, setIsOpened] = useState33(false);
|
|
20583
20677
|
const [searchInput, setSearchInput] = useState33("");
|
|
20584
20678
|
const { ref: scrollRef, hasTopDivider, isAtBottom } = useScrollDivider();
|
|
20585
|
-
const allOptions =
|
|
20679
|
+
const allOptions = useMemo23(
|
|
20586
20680
|
() => buildAllOptions(options, allowUnselect, unselectLabel),
|
|
20587
20681
|
[options, allowUnselect, unselectLabel]
|
|
20588
20682
|
);
|
|
@@ -20592,11 +20686,11 @@ function BaseDropdown({
|
|
|
20592
20686
|
const handleSearch = (event) => {
|
|
20593
20687
|
setSearchInput(event.target.value);
|
|
20594
20688
|
};
|
|
20595
|
-
const filteredOptions =
|
|
20689
|
+
const filteredOptions = useMemo23(
|
|
20596
20690
|
() => filterOptions(allOptions, searchInput),
|
|
20597
20691
|
[allOptions, searchInput]
|
|
20598
20692
|
);
|
|
20599
|
-
const { organizedGroups, organizedOptions } =
|
|
20693
|
+
const { organizedGroups, organizedOptions } = useMemo23(
|
|
20600
20694
|
() => organizeDropdownGroups(
|
|
20601
20695
|
filteredOptions,
|
|
20602
20696
|
groups,
|
|
@@ -20948,7 +21042,7 @@ import {
|
|
|
20948
21042
|
} from "@funkit/utils";
|
|
20949
21043
|
import React90, {
|
|
20950
21044
|
useEffect as useEffect38,
|
|
20951
|
-
useMemo as
|
|
21045
|
+
useMemo as useMemo24,
|
|
20952
21046
|
useRef as useRef20,
|
|
20953
21047
|
useState as useState34
|
|
20954
21048
|
} from "react";
|
|
@@ -21495,7 +21589,7 @@ function PaymentFeesSummary({
|
|
|
21495
21589
|
setIsExpanded(false);
|
|
21496
21590
|
}
|
|
21497
21591
|
}, [valuesNotAvailable, isExpanded, controls]);
|
|
21498
|
-
const { collapsed: collapsedItem, expanded: expandedItems } =
|
|
21592
|
+
const { collapsed: collapsedItem, expanded: expandedItems } = useMemo24(() => {
|
|
21499
21593
|
const fees = quote?.finalFeesBreakdown ?? fallbackFees;
|
|
21500
21594
|
if (!fees) {
|
|
21501
21595
|
return NO_DATA;
|
|
@@ -22071,7 +22165,7 @@ function useLighterWithdrawalBalances({
|
|
|
22071
22165
|
error: error instanceof Error ? error.message : error
|
|
22072
22166
|
});
|
|
22073
22167
|
}, [accountIndex, isLoading, account, error]);
|
|
22074
|
-
const assets =
|
|
22168
|
+
const assets = useMemo25(() => account?.assets ?? [], [account]);
|
|
22075
22169
|
return {
|
|
22076
22170
|
assets,
|
|
22077
22171
|
isLoading
|
|
@@ -22575,7 +22669,7 @@ import {
|
|
|
22575
22669
|
useDirectExecutionForDepositAddress,
|
|
22576
22670
|
useLogOnce as useLogOnce6
|
|
22577
22671
|
} from "@funkit/connect-core";
|
|
22578
|
-
import { useEffect as useEffect40, useMemo as
|
|
22672
|
+
import { useEffect as useEffect40, useMemo as useMemo26, useState as useState36 } from "react";
|
|
22579
22673
|
function useNadoWithdrawalStatus({
|
|
22580
22674
|
depositAddress,
|
|
22581
22675
|
pollIntervalMs
|
|
@@ -22612,7 +22706,7 @@ function useNadoWithdrawalStatus({
|
|
|
22612
22706
|
relayStatus: latestStep?.listenerInfo?.status
|
|
22613
22707
|
});
|
|
22614
22708
|
});
|
|
22615
|
-
const completionTx =
|
|
22709
|
+
const completionTx = useMemo26(() => {
|
|
22616
22710
|
if (status !== "completed" || !latestStep) {
|
|
22617
22711
|
return void 0;
|
|
22618
22712
|
}
|
|
@@ -22791,7 +22885,7 @@ import {
|
|
|
22791
22885
|
import {
|
|
22792
22886
|
useRecentDepositsApiQuery
|
|
22793
22887
|
} from "@funkit/connect-core";
|
|
22794
|
-
import { useMemo as
|
|
22888
|
+
import { useMemo as useMemo27 } from "react";
|
|
22795
22889
|
function useRecentDepositsApi(params) {
|
|
22796
22890
|
return useRecentDepositsApiQuery({
|
|
22797
22891
|
...params,
|
|
@@ -22831,14 +22925,14 @@ function useFunkitRecentDepositsImpl(query) {
|
|
|
22831
22925
|
fetchSize: fetchSize * 2
|
|
22832
22926
|
// fetch extra to account for merging
|
|
22833
22927
|
});
|
|
22834
|
-
const mergedDirectExecutions =
|
|
22928
|
+
const mergedDirectExecutions = useMemo27(
|
|
22835
22929
|
() => processRecentDepositsForNotifications(
|
|
22836
22930
|
query.memoizedFilterFunc ? directExecutions?.filter(query.memoizedFilterFunc) : directExecutions,
|
|
22837
22931
|
{ cutOffTimeMs: query.cutOffTimeMs }
|
|
22838
22932
|
),
|
|
22839
22933
|
[directExecutions, query.cutOffTimeMs, query.memoizedFilterFunc]
|
|
22840
22934
|
);
|
|
22841
|
-
return
|
|
22935
|
+
return useMemo27(
|
|
22842
22936
|
() => ({
|
|
22843
22937
|
data: mergedDirectExecutions?.map((de) => purifyCheckoutHistoryItem(de)).slice(0, fetchSize)
|
|
22844
22938
|
}),
|
|
@@ -22867,12 +22961,12 @@ import React132 from "react";
|
|
|
22867
22961
|
|
|
22868
22962
|
// src/hooks/useConnectedWallets.ts
|
|
22869
22963
|
import { isAddressEquivalent as isAddressEquivalent6 } from "@funkit/utils";
|
|
22870
|
-
import { useMemo as
|
|
22964
|
+
import { useMemo as useMemo28 } from "react";
|
|
22871
22965
|
function useConnectedWallets() {
|
|
22872
22966
|
const {
|
|
22873
22967
|
payerWallets: { evmWallet, solanaWallet }
|
|
22874
22968
|
} = useGeneralWallet();
|
|
22875
|
-
return
|
|
22969
|
+
return useMemo28(() => {
|
|
22876
22970
|
const wallets = [];
|
|
22877
22971
|
if (evmWallet.address) {
|
|
22878
22972
|
wallets.push({ ...evmWallet, address: evmWallet.address });
|
|
@@ -22897,7 +22991,7 @@ function soleWalletVendor(wallets) {
|
|
|
22897
22991
|
}
|
|
22898
22992
|
function usePayerWallet(address) {
|
|
22899
22993
|
const wallets = useConnectedWallets();
|
|
22900
|
-
return
|
|
22994
|
+
return useMemo28(() => {
|
|
22901
22995
|
if (!address) {
|
|
22902
22996
|
return void 0;
|
|
22903
22997
|
}
|
|
@@ -23086,7 +23180,7 @@ function useCheckoutTimeEstimate(latestQuote, originalTimeEstimationMs, paymentM
|
|
|
23086
23180
|
// src/hooks/useCheckoutTransferInit.ts
|
|
23087
23181
|
import { isLighterChainId } from "@funkit/chains";
|
|
23088
23182
|
import { getCheckoutTokenTransferParams as getCheckoutTokenTransferParams2 } from "@funkit/connect-core";
|
|
23089
|
-
import { useQuery as
|
|
23183
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
23090
23184
|
import { useEffect as useEffect41 } from "react";
|
|
23091
23185
|
|
|
23092
23186
|
// src/hooks/useIsDynamicRoutingEnabled.ts
|
|
@@ -23196,7 +23290,7 @@ var useCheckoutTransferInit = (enabled = true, { trackStepReadiness = true } = {
|
|
|
23196
23290
|
const isQRCodeEnabledWithPostAction = !!checkoutConfig && // either no post action required
|
|
23197
23291
|
(!isCheckoutPostActionRequired(checkoutConfig) || // or action type is set
|
|
23198
23292
|
!!checkoutConfig?.qrcodeActionType || postActionOverride || !!queryKey?.actionType);
|
|
23199
|
-
const { data, isFetching, isLoading } =
|
|
23293
|
+
const { data, isFetching, isLoading } = useQuery5({
|
|
23200
23294
|
queryKey: ["initializeCheckoutTokenTransferAddress", queryKey],
|
|
23201
23295
|
meta: trackStepReadiness ? stepQueryMeta({
|
|
23202
23296
|
name: "udaAddress",
|
|
@@ -23576,7 +23670,7 @@ import {
|
|
|
23576
23670
|
getMinTransferValueUsd,
|
|
23577
23671
|
transferChainFamily
|
|
23578
23672
|
} from "@funkit/connect-core";
|
|
23579
|
-
import { useMemo as
|
|
23673
|
+
import { useMemo as useMemo29 } from "react";
|
|
23580
23674
|
import { arbitrum as arbitrum4, polygon as polygon4 } from "viem/chains";
|
|
23581
23675
|
|
|
23582
23676
|
// src/utils/transfer.ts
|
|
@@ -23585,23 +23679,6 @@ import {
|
|
|
23585
23679
|
getTransferTokenQrCodeUri
|
|
23586
23680
|
} from "@funkit/connect-core";
|
|
23587
23681
|
|
|
23588
|
-
// src/hooks/useFiatExchangeRates.ts
|
|
23589
|
-
import { getFiatExchangeRates } from "@funkit/api-base";
|
|
23590
|
-
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
23591
|
-
function useFiatExchangeRates(enabled = true) {
|
|
23592
|
-
const { data, isLoading, error } = useQuery5({
|
|
23593
|
-
queryKey: ["fiatExchangeRates"],
|
|
23594
|
-
queryFn: () => getFiatExchangeRates({ logger }),
|
|
23595
|
-
refetchOnMount: false,
|
|
23596
|
-
refetchOnReconnect: false,
|
|
23597
|
-
refetchOnWindowFocus: false,
|
|
23598
|
-
gcTime: 1e3 * 60 * 60,
|
|
23599
|
-
// 1 hour
|
|
23600
|
-
enabled
|
|
23601
|
-
});
|
|
23602
|
-
return { data, isLoading, error };
|
|
23603
|
-
}
|
|
23604
|
-
|
|
23605
23682
|
// src/hooks/useTokenTransfer.ts
|
|
23606
23683
|
var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
23607
23684
|
const { t } = useFunkitTranslation();
|
|
@@ -23680,7 +23757,7 @@ var useMinTransferValueEur = (selectedChainId) => {
|
|
|
23680
23757
|
};
|
|
23681
23758
|
var useMinTransferValues = (chainIds) => {
|
|
23682
23759
|
const limits = useDynamicConfig("mintokentransfervalue");
|
|
23683
|
-
return
|
|
23760
|
+
return useMemo29(() => {
|
|
23684
23761
|
return chainIds.reduce(
|
|
23685
23762
|
(acc, id) => {
|
|
23686
23763
|
acc[id] = getMinTransferValueUsd(id, limits);
|
|
@@ -23774,59 +23851,6 @@ var useMaxSlippage = ({
|
|
|
23774
23851
|
return { label, value: 1 };
|
|
23775
23852
|
};
|
|
23776
23853
|
|
|
23777
|
-
// src/providers/FunkitMoonpayProvider.tsx
|
|
23778
|
-
import { useMemo as useMemo29 } from "react";
|
|
23779
|
-
var BYPASS_COUNTRY_BLOCK_CHECK = false;
|
|
23780
|
-
var ALL_MATCH = "*";
|
|
23781
|
-
var isCountryBlocked = (blockedList, userIpInfo) => {
|
|
23782
|
-
if (BYPASS_COUNTRY_BLOCK_CHECK) {
|
|
23783
|
-
return false;
|
|
23784
|
-
}
|
|
23785
|
-
if (!userIpInfo.alpha2) {
|
|
23786
|
-
logger.log("isUserBlockedForCheckout_NoIpDetected");
|
|
23787
|
-
return true;
|
|
23788
|
-
}
|
|
23789
|
-
const isBlocked = blockedList.includes(ALL_MATCH) || blockedList.includes(userIpInfo.alpha2);
|
|
23790
|
-
logger.log("isUserBlockedForCheckoutResult", {
|
|
23791
|
-
isBlocked,
|
|
23792
|
-
blockedList,
|
|
23793
|
-
userIpInfo
|
|
23794
|
-
});
|
|
23795
|
-
return isBlocked;
|
|
23796
|
-
};
|
|
23797
|
-
function useFunkitUserIp() {
|
|
23798
|
-
const { isUserLoggedIn } = useGeneralWallet();
|
|
23799
|
-
const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo();
|
|
23800
|
-
const blockedCountries = useDynamicConfig("blockedcountries");
|
|
23801
|
-
const isUserGeoblocked = useMemo29(() => {
|
|
23802
|
-
if (isLoadingGeoCheck) {
|
|
23803
|
-
return false;
|
|
23804
|
-
}
|
|
23805
|
-
if (!userIpInfo) {
|
|
23806
|
-
return true;
|
|
23807
|
-
}
|
|
23808
|
-
return isCountryBlocked(blockedCountries, userIpInfo);
|
|
23809
|
-
}, [blockedCountries, isLoadingGeoCheck, userIpInfo]);
|
|
23810
|
-
return {
|
|
23811
|
-
isLoadingGeoCheck,
|
|
23812
|
-
isUserGeoblocked,
|
|
23813
|
-
isUserLoggedIn,
|
|
23814
|
-
userIpInfo
|
|
23815
|
-
};
|
|
23816
|
-
}
|
|
23817
|
-
|
|
23818
|
-
// src/hooks/queries/useSwappedDefaultCurrency.ts
|
|
23819
|
-
import { useSwappedDefaultCurrencyQuery } from "@funkit/connect-core";
|
|
23820
|
-
var useSwappedDefaultCurrency = () => {
|
|
23821
|
-
const { apiKey } = useFunkitConfig();
|
|
23822
|
-
const { userIpInfo } = useFunkitUserIp();
|
|
23823
|
-
return useSwappedDefaultCurrencyQuery({
|
|
23824
|
-
apiKey,
|
|
23825
|
-
countryCode: userIpInfo?.alpha2,
|
|
23826
|
-
logger
|
|
23827
|
-
});
|
|
23828
|
-
};
|
|
23829
|
-
|
|
23830
23854
|
// src/hooks/queries/useSwappedExchanges.ts
|
|
23831
23855
|
var EVM_USDC_TARGETS = [
|
|
23832
23856
|
{ chainId: "1", address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" },
|
|
@@ -34034,8 +34058,8 @@ function SwappedIframeSkeleton({
|
|
|
34034
34058
|
// src/hooks/track/analytics/useTrackSwappedIframeError.ts
|
|
34035
34059
|
import { useRef as useRef36 } from "react";
|
|
34036
34060
|
|
|
34037
|
-
// src/hooks/track/analytics/
|
|
34038
|
-
function
|
|
34061
|
+
// src/hooks/track/analytics/swappedIframePayload.ts
|
|
34062
|
+
function readSwappedIdentifier(value) {
|
|
34039
34063
|
if (typeof value === "string") {
|
|
34040
34064
|
return value || null;
|
|
34041
34065
|
}
|
|
@@ -34044,6 +34068,8 @@ function readIdentifier(value) {
|
|
|
34044
34068
|
}
|
|
34045
34069
|
return null;
|
|
34046
34070
|
}
|
|
34071
|
+
|
|
34072
|
+
// src/hooks/track/analytics/swappedIframeError.ts
|
|
34047
34073
|
function buildSwappedIframeErrorProperties(data, flow) {
|
|
34048
34074
|
const payload = typeof data === "object" && data !== null ? data : {};
|
|
34049
34075
|
return {
|
|
@@ -34053,15 +34079,19 @@ function buildSwappedIframeErrorProperties(data, flow) {
|
|
|
34053
34079
|
error_code: "SWAPPED_PROVIDER_ERROR",
|
|
34054
34080
|
// The embed payload is opaque; never forward arbitrary nested error data.
|
|
34055
34081
|
error_message: null,
|
|
34056
|
-
order_id:
|
|
34082
|
+
order_id: readSwappedIdentifier(
|
|
34083
|
+
"order_id" in payload ? payload.order_id : null
|
|
34084
|
+
)
|
|
34057
34085
|
};
|
|
34058
34086
|
}
|
|
34059
34087
|
function getSwappedIframeErrorKey(data) {
|
|
34060
34088
|
if (typeof data !== "object" || data === null) {
|
|
34061
34089
|
return null;
|
|
34062
34090
|
}
|
|
34063
|
-
const orderId =
|
|
34064
|
-
|
|
34091
|
+
const orderId = readSwappedIdentifier(
|
|
34092
|
+
"order_id" in data ? data.order_id : null
|
|
34093
|
+
);
|
|
34094
|
+
const error = readSwappedIdentifier("error" in data ? data.error : null);
|
|
34065
34095
|
if (!orderId || !error) {
|
|
34066
34096
|
return null;
|
|
34067
34097
|
}
|
|
@@ -34117,6 +34147,38 @@ function resolveIframeStepNavigation(history, nextStep) {
|
|
|
34117
34147
|
};
|
|
34118
34148
|
}
|
|
34119
34149
|
|
|
34150
|
+
// src/hooks/track/analytics/swappedIframeSubmission.ts
|
|
34151
|
+
function buildSwappedIframeSubmissionProperties(data, fopType, checkoutId, config) {
|
|
34152
|
+
const payload = typeof data === "object" && data !== null ? data : {};
|
|
34153
|
+
return {
|
|
34154
|
+
...NULL_VISIBLE_QUOTE_FEE_PROPERTIES,
|
|
34155
|
+
checkout_id: checkoutId,
|
|
34156
|
+
// Provider confirmation does not supply an authoritative execution snapshot.
|
|
34157
|
+
provider: null,
|
|
34158
|
+
source_chain: null,
|
|
34159
|
+
source_asset: null,
|
|
34160
|
+
source_asset_ticker: null,
|
|
34161
|
+
// The configured destination is known even before an execution is available.
|
|
34162
|
+
target_chain: config.targetChain,
|
|
34163
|
+
target_asset: config.targetAsset,
|
|
34164
|
+
target_asset_ticker: config.targetAssetTicker || null,
|
|
34165
|
+
destination_address: null,
|
|
34166
|
+
execution_type: null,
|
|
34167
|
+
sender_address: null,
|
|
34168
|
+
source_amount: null,
|
|
34169
|
+
target_amount: null,
|
|
34170
|
+
trade_type: null,
|
|
34171
|
+
tx_hash: null,
|
|
34172
|
+
quote_id: null,
|
|
34173
|
+
est_fulfillment_time_ms: null,
|
|
34174
|
+
payment_rail: "swapped",
|
|
34175
|
+
payment_method: mapSwappedFopTypeToPaymentMethod(fopType),
|
|
34176
|
+
order_id: readSwappedIdentifier(
|
|
34177
|
+
"order_id" in payload ? payload.order_id : null
|
|
34178
|
+
)
|
|
34179
|
+
};
|
|
34180
|
+
}
|
|
34181
|
+
|
|
34120
34182
|
// src/hooks/track/analytics/useTrackSwappedIframeEvents.ts
|
|
34121
34183
|
import { useCallback as useCallback40, useRef as useRef37 } from "react";
|
|
34122
34184
|
function useTrackSwappedIframeEvents(flow) {
|
|
@@ -34158,7 +34220,30 @@ function useTrackSwappedIframeEvents(flow) {
|
|
|
34158
34220
|
},
|
|
34159
34221
|
[checkoutId, flow, logEventV2]
|
|
34160
34222
|
);
|
|
34161
|
-
|
|
34223
|
+
const trackIframeTransactionSubmitted = useCallback40(
|
|
34224
|
+
(data, fopType) => {
|
|
34225
|
+
if (!checkoutItem || flow !== "deposit") {
|
|
34226
|
+
return;
|
|
34227
|
+
}
|
|
34228
|
+
if (!claimAnalyticsEvent(
|
|
34229
|
+
"fc_deposit_transaction_submitted" /* DEPOSIT_TRANSACTION_SUBMITTED */,
|
|
34230
|
+
`swapped:${checkoutItem.id}`
|
|
34231
|
+
)) {
|
|
34232
|
+
return;
|
|
34233
|
+
}
|
|
34234
|
+
logEventV2("fc_deposit_transaction_submitted" /* DEPOSIT_TRANSACTION_SUBMITTED */, () => ({
|
|
34235
|
+
flow: "deposit",
|
|
34236
|
+
...buildSwappedIframeSubmissionProperties(
|
|
34237
|
+
data,
|
|
34238
|
+
fopType,
|
|
34239
|
+
checkoutItem.id,
|
|
34240
|
+
checkoutItem.initSettings.config
|
|
34241
|
+
)
|
|
34242
|
+
}));
|
|
34243
|
+
},
|
|
34244
|
+
[checkoutItem, flow, logEventV2]
|
|
34245
|
+
);
|
|
34246
|
+
return { trackIframeStepViewed, trackIframeTransactionSubmitted };
|
|
34162
34247
|
}
|
|
34163
34248
|
|
|
34164
34249
|
// src/hooks/useSwappedIframeLifecycle.ts
|
|
@@ -58527,9 +58612,7 @@ function SwappedIframeController({
|
|
|
58527
58612
|
setModalState
|
|
58528
58613
|
}) {
|
|
58529
58614
|
const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
|
|
58530
|
-
const { trackIframeStepViewed } = useTrackSwappedIframeEvents(
|
|
58531
|
-
getCheckoutModalAnalyticsFlow(modalState)
|
|
58532
|
-
);
|
|
58615
|
+
const { trackIframeStepViewed, trackIframeTransactionSubmitted } = useTrackSwappedIframeEvents(getCheckoutModalAnalyticsFlow(modalState));
|
|
58533
58616
|
const logEventV2 = useTrackV2();
|
|
58534
58617
|
const { t } = useFunkitTranslation();
|
|
58535
58618
|
const queryClient = useQueryClient8();
|
|
@@ -58674,6 +58757,7 @@ function SwappedIframeController({
|
|
|
58674
58757
|
break;
|
|
58675
58758
|
}
|
|
58676
58759
|
case "SWAPPED_TRANSACTION_SUCCESSFUL": {
|
|
58760
|
+
trackIframeTransactionSubmitted(msg.data, selectedPaymentOption.fopType);
|
|
58677
58761
|
const trackEvent = getTrackEvent(
|
|
58678
58762
|
"fc::swapped_iframe::transaction_successful" /* SWAPPED_IFRAME_TRANSACTION_SUCCESSFUL */,
|
|
58679
58763
|
{ data: JSON.stringify(msg.data ?? {}) }
|