@funkit/connect 5.3.4 → 5.3.6
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 +18 -0
- package/dist/components/Dropdown/ChainDropdown.d.ts +6 -3
- package/dist/components/Dropdown/TokenDropdown.d.ts +7 -3
- package/dist/components/FunFeatureList/FunFeatureList.d.ts +3 -1
- package/dist/hooks/useCheckoutDirectExecutionHistory.d.ts +2 -2
- package/dist/index.js +190 -122
- package/dist/providers/FunkitHistoryContext.d.ts +9 -5
- package/dist/utils/purifyCheckoutHistoryItem.d.ts +24 -3
- package/dist/wallets/walletConnectors/index.js +45 -45
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 5.3.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- cf2ab03: feat(connect): handle Relay not finding route
|
|
8
|
+
- c6ca047: feat(connect): refactor checkout listener hooks, including direct executions
|
|
9
|
+
- 6cb808b: chore(connect): upgrade fun-relay
|
|
10
|
+
- 1846641: feat(connect): adjust selection of tokens and chains for Transfer crypto
|
|
11
|
+
- Updated dependencies [6cb808b]
|
|
12
|
+
- @funkit/fun-relay@0.1.2
|
|
13
|
+
|
|
14
|
+
## 5.3.5
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [bff34b2]
|
|
19
|
+
- @funkit/fun-relay@0.1.1
|
|
20
|
+
|
|
3
21
|
## 5.3.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -6,8 +6,11 @@ interface ChainDropdownProps {
|
|
|
6
6
|
assets: TokenTransferSourceChainsAndAssets;
|
|
7
7
|
chainIds?: number[];
|
|
8
8
|
selectedChainId?: number;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
onChainSelected: (chainId: number | undefined,
|
|
10
|
+
/**
|
|
11
|
+
* If true, it will trigger automatic updates for the matching token in the parent component.
|
|
12
|
+
*/
|
|
13
|
+
autoUpdate?: boolean) => void;
|
|
11
14
|
/** Provides option to allow going back to unselected state and displays that state as a selectable option */
|
|
12
15
|
allowUnselect?: boolean;
|
|
13
16
|
activeItemProps?: BaseDropdownProps['activeItemProps'];
|
|
@@ -15,5 +18,5 @@ interface ChainDropdownProps {
|
|
|
15
18
|
size?: BaseActiveDropdownItemProps['size'];
|
|
16
19
|
isLoading?: BaseDropdownProps['isLoading'];
|
|
17
20
|
}
|
|
18
|
-
export declare const ChainDropdown: ({ assets, chainIds: chains, selectedChainId
|
|
21
|
+
export declare const ChainDropdown: ({ assets, chainIds: chains, selectedChainId: propSelectedChainId, allowUnselect, onChainSelected, activeItemProps, size, openDropdownBackgroundColor, isLoading, }: ChainDropdownProps) => React.JSX.Element;
|
|
19
22
|
export {};
|
|
@@ -4,9 +4,13 @@ import { type BaseDropdownProps } from './BaseDropdown';
|
|
|
4
4
|
interface TokenDropdownProps {
|
|
5
5
|
selectedChainId: number;
|
|
6
6
|
assets: TokenTransferSourceChainsAndAssets;
|
|
7
|
-
onTokenSelected: (token: string, chainId?: number
|
|
8
|
-
|
|
7
|
+
onTokenSelected: (token: string, chainId?: number,
|
|
8
|
+
/**
|
|
9
|
+
* If true, it will trigger automatic updates for the matching chain in the parent component.
|
|
10
|
+
*/
|
|
11
|
+
autoUpdate?: boolean) => void;
|
|
12
|
+
selectedToken?: string;
|
|
9
13
|
isLoading?: BaseDropdownProps['isLoading'];
|
|
10
14
|
}
|
|
11
|
-
export declare const TokenDropdown: ({ assets, selectedChainId,
|
|
15
|
+
export declare const TokenDropdown: ({ assets, selectedChainId, selectedToken, onTokenSelected, isLoading, }: TokenDropdownProps) => React.JSX.Element;
|
|
12
16
|
export {};
|
|
@@ -7,7 +7,9 @@ interface FunFeatureListProps {
|
|
|
7
7
|
isExpandable?: boolean;
|
|
8
8
|
disabled?: boolean;
|
|
9
9
|
withBackgroundContainer?: boolean;
|
|
10
|
+
/** Whether background should be applied only to individual items. Defaults to false since background is applied to the container by default */
|
|
11
|
+
withBackgroundItem?: boolean;
|
|
10
12
|
gapBetweenItems?: Extract<BoxProps['gap'], string>;
|
|
11
13
|
}
|
|
12
|
-
export declare const FunFeatureList: ({ items, isExpandable, disabled, withBackgroundContainer, gapBetweenItems, }: FunFeatureListProps) => React.JSX.Element;
|
|
14
|
+
export declare const FunFeatureList: ({ items, isExpandable, disabled, withBackgroundContainer, withBackgroundItem, gapBetweenItems, }: FunFeatureListProps) => React.JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -2,8 +2,8 @@ import { CheckoutState, type DirectExecution } from '@funkit/api-base';
|
|
|
2
2
|
export declare function useCheckoutDirectExecutionHistory({ directExecution, }: {
|
|
3
3
|
directExecution: DirectExecution | undefined;
|
|
4
4
|
}): {
|
|
5
|
-
state:
|
|
6
|
-
refundState: import("@funkit/fun-relay/
|
|
5
|
+
state: import("@funkit/fun-relay/src/types").CheckoutState | CheckoutState;
|
|
6
|
+
refundState: import("@funkit/fun-relay/src/types").CheckoutRefundState | undefined;
|
|
7
7
|
isRefunded: boolean;
|
|
8
8
|
isCompleted: boolean;
|
|
9
9
|
isFailed: boolean;
|
package/dist/index.js
CHANGED
|
@@ -3012,7 +3012,7 @@ function createPaymentMethodInfo(params) {
|
|
|
3012
3012
|
case "virtual_bank" /* VIRTUAL_BANK */:
|
|
3013
3013
|
return {
|
|
3014
3014
|
paymentMethod: "virtual_bank" /* VIRTUAL_BANK */,
|
|
3015
|
-
title: "
|
|
3015
|
+
title: "Fiat Account",
|
|
3016
3016
|
description: "",
|
|
3017
3017
|
matchingFiatAccount: params.matchingFiatAccount,
|
|
3018
3018
|
bridgeCustomer: params.bridgeCustomer
|
|
@@ -3846,6 +3846,7 @@ function useCheckoutDirectExecution() {
|
|
|
3846
3846
|
fromTokenAddress,
|
|
3847
3847
|
recipientAddress
|
|
3848
3848
|
}) => {
|
|
3849
|
+
const multiplier = 10 ** toTokenDecimals;
|
|
3849
3850
|
return await getRelayQuote({
|
|
3850
3851
|
actionParams,
|
|
3851
3852
|
fromChainId,
|
|
@@ -3854,8 +3855,8 @@ function useCheckoutDirectExecution() {
|
|
|
3854
3855
|
recipientAddress,
|
|
3855
3856
|
toChainId,
|
|
3856
3857
|
toTokenAddress,
|
|
3857
|
-
toTokenAmount,
|
|
3858
|
-
|
|
3858
|
+
toTokenAmountBaseUnit: BigInt(Math.floor(toTokenAmount * multiplier)),
|
|
3859
|
+
tradeType: "EXACT_OUTPUT",
|
|
3859
3860
|
userAddress: address
|
|
3860
3861
|
});
|
|
3861
3862
|
},
|
|
@@ -3915,9 +3916,11 @@ function useCheckoutDirectExecution() {
|
|
|
3915
3916
|
logger.error("executeRelayQuote:error", error);
|
|
3916
3917
|
reject(error);
|
|
3917
3918
|
},
|
|
3919
|
+
onProgress: (step) => {
|
|
3920
|
+
stepMessageSetter(step?.action ?? "");
|
|
3921
|
+
},
|
|
3918
3922
|
logger,
|
|
3919
3923
|
relayQuote,
|
|
3920
|
-
stepMessageSetter,
|
|
3921
3924
|
walletClient
|
|
3922
3925
|
});
|
|
3923
3926
|
});
|
|
@@ -6314,17 +6317,39 @@ import React61, {
|
|
|
6314
6317
|
useRef as useRef5,
|
|
6315
6318
|
useState as useState12
|
|
6316
6319
|
} from "react";
|
|
6320
|
+
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
6317
6321
|
|
|
6318
6322
|
// src/utils/purifyCheckoutHistoryItem.ts
|
|
6323
|
+
import {
|
|
6324
|
+
CheckoutState as CheckoutState2
|
|
6325
|
+
} from "@funkit/api-base";
|
|
6319
6326
|
var purifyCheckoutHistoryItem = (item) => {
|
|
6327
|
+
if ("depositAddr" in item) {
|
|
6328
|
+
return {
|
|
6329
|
+
depositAddr: item.depositAddr,
|
|
6330
|
+
directExecution: false,
|
|
6331
|
+
id: item.depositAddr,
|
|
6332
|
+
fromAmountBaseUnit: item.fromAmountBaseUnit,
|
|
6333
|
+
fromChainId: item.fromChainId,
|
|
6334
|
+
fromTokenAddress: item.fromTokenAddress,
|
|
6335
|
+
state: item.state,
|
|
6336
|
+
toChainId: item.toChainId,
|
|
6337
|
+
toTokenAddress: item.toTokenAddress,
|
|
6338
|
+
toAmountBaseUnit: item.toAmountBaseUnit
|
|
6339
|
+
};
|
|
6340
|
+
}
|
|
6320
6341
|
return {
|
|
6321
|
-
|
|
6322
|
-
|
|
6342
|
+
directExecution: true,
|
|
6343
|
+
id: item.txHash,
|
|
6344
|
+
fromAmountBaseUnit: item.fromAmountBaseUnit,
|
|
6323
6345
|
fromChainId: item.fromChainId,
|
|
6324
6346
|
fromTokenAddress: item.fromTokenAddress,
|
|
6347
|
+
state: CheckoutState2.COMPLETED,
|
|
6348
|
+
// TODO: Read status from BE!!!
|
|
6325
6349
|
toChainId: item.toChainId,
|
|
6326
6350
|
toTokenAddress: item.toTokenAddress,
|
|
6327
|
-
toAmountBaseUnit: item.toAmountBaseUnit
|
|
6351
|
+
toAmountBaseUnit: item.toAmountBaseUnit,
|
|
6352
|
+
txHash: item.txHash
|
|
6328
6353
|
};
|
|
6329
6354
|
};
|
|
6330
6355
|
|
|
@@ -6455,48 +6480,50 @@ function useCheckoutHistoryContext() {
|
|
|
6455
6480
|
}
|
|
6456
6481
|
function useCheckoutsListenerByUserId(userId) {
|
|
6457
6482
|
const { apiKey } = useFunkitConfig();
|
|
6458
|
-
const
|
|
6459
|
-
|
|
6460
|
-
|
|
6461
|
-
|
|
6462
|
-
userId
|
|
6463
|
-
|
|
6464
|
-
|
|
6465
|
-
|
|
6466
|
-
|
|
6467
|
-
|
|
6468
|
-
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6483
|
+
const { data, isLoading } = useQuery2({
|
|
6484
|
+
enabled: !!userId,
|
|
6485
|
+
queryKey: ["getPurifiedCheckoutsByUserId", userId],
|
|
6486
|
+
queryFn: async () => {
|
|
6487
|
+
if (!userId) return void 0;
|
|
6488
|
+
const results = await Promise.all([
|
|
6489
|
+
getCheckoutsByUserId({
|
|
6490
|
+
apiKey,
|
|
6491
|
+
logger,
|
|
6492
|
+
userId
|
|
6493
|
+
}),
|
|
6494
|
+
getDirectExecutionsByUserId({
|
|
6495
|
+
apiKey,
|
|
6496
|
+
logger,
|
|
6497
|
+
userId
|
|
6498
|
+
})
|
|
6499
|
+
]);
|
|
6500
|
+
return results.flat().map(purifyCheckoutHistoryItem);
|
|
6501
|
+
},
|
|
6502
|
+
refetchInterval: CHECKOUT_HISTORY_REFETCH_INTERVAL_MS
|
|
6503
|
+
});
|
|
6504
|
+
return { data, isLoading };
|
|
6476
6505
|
}
|
|
6477
6506
|
function useCheckoutListenerByCheckoutId(checkoutId) {
|
|
6478
6507
|
const { apiKey } = useFunkitConfig();
|
|
6479
|
-
const
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
}, [fetchData]);
|
|
6499
|
-
return data;
|
|
6508
|
+
const { data, isLoading } = useQuery2({
|
|
6509
|
+
enabled: !!checkoutId,
|
|
6510
|
+
queryKey: ["getPurifiedCheckoutById", checkoutId],
|
|
6511
|
+
queryFn: async () => {
|
|
6512
|
+
if (!checkoutId) return void 0;
|
|
6513
|
+
const result = isCheckoutHistoryDirectExecution(checkoutId) ? await getDirectExecutionByTxHash({
|
|
6514
|
+
apiKey,
|
|
6515
|
+
logger,
|
|
6516
|
+
txHash: checkoutId
|
|
6517
|
+
}) : await getCheckoutByDepositAddress({
|
|
6518
|
+
apiKey,
|
|
6519
|
+
depositAddress: checkoutId,
|
|
6520
|
+
logger
|
|
6521
|
+
});
|
|
6522
|
+
return result && purifyCheckoutHistoryItem(result);
|
|
6523
|
+
},
|
|
6524
|
+
refetchInterval: CHECKOUT_HISTORY_REFETCH_INTERVAL_MS
|
|
6525
|
+
});
|
|
6526
|
+
return { data, isLoading };
|
|
6500
6527
|
}
|
|
6501
6528
|
var useFunkitPostCheckoutInternal = (checkoutId) => {
|
|
6502
6529
|
const funkitConfig = useFunkitConfig();
|
|
@@ -6708,7 +6735,7 @@ import {
|
|
|
6708
6735
|
TERMINAL_CHECKOUT_STATES,
|
|
6709
6736
|
getRiskAssessmentForAddress
|
|
6710
6737
|
} from "@funkit/api-base";
|
|
6711
|
-
import { CheckoutRefundState, CheckoutState as
|
|
6738
|
+
import { CheckoutRefundState, CheckoutState as CheckoutState3 } from "@funkit/api-base";
|
|
6712
6739
|
var BLOCKED_RISK_LEVELS = ["Severe", "High"];
|
|
6713
6740
|
var hasRisk = async (apiKey, walletAddress, customRecipient) => {
|
|
6714
6741
|
const getUserWalletRisk = walletAddress ? getRiskAssessmentForAddress({
|
|
@@ -6738,9 +6765,9 @@ var hasRisk = async (apiKey, walletAddress, customRecipient) => {
|
|
|
6738
6765
|
};
|
|
6739
6766
|
function getCheckoutStateBooleans(checkoutState, refundState) {
|
|
6740
6767
|
const isProcessing = IN_PROGRESS_CHECKOUT_STATES.includes(checkoutState);
|
|
6741
|
-
const isCompleted = checkoutState ===
|
|
6742
|
-
const isError = checkoutState ===
|
|
6743
|
-
const isExpired = checkoutState ===
|
|
6768
|
+
const isCompleted = checkoutState === CheckoutState3.COMPLETED;
|
|
6769
|
+
const isError = checkoutState === CheckoutState3.CHECKOUT_ERROR;
|
|
6770
|
+
const isExpired = checkoutState === CheckoutState3.EXPIRED;
|
|
6744
6771
|
const isFailed = isError || isExpired;
|
|
6745
6772
|
const isTerminal = TERMINAL_CHECKOUT_STATES.includes(checkoutState);
|
|
6746
6773
|
const isRefundProceeded = refundState === CheckoutRefundState.PROCEEDED || refundState === CheckoutRefundState.FULFILLED;
|
|
@@ -7338,7 +7365,7 @@ function useSIWFarcasterListener(channelToken) {
|
|
|
7338
7365
|
import {
|
|
7339
7366
|
getAllWalletTokens
|
|
7340
7367
|
} from "@funkit/api-base";
|
|
7341
|
-
import { keepPreviousData, useQuery as
|
|
7368
|
+
import { keepPreviousData, useQuery as useQuery3 } from "@tanstack/react-query";
|
|
7342
7369
|
import { arbitrum as arbitrum2, polygon as polygon3 } from "viem/chains";
|
|
7343
7370
|
import { useAccount as useAccount3 } from "wagmi";
|
|
7344
7371
|
|
|
@@ -7440,7 +7467,7 @@ var useWalletAssets = ({
|
|
|
7440
7467
|
} = {}) => {
|
|
7441
7468
|
const { address, isConnected } = useAccount3();
|
|
7442
7469
|
const { apiKey } = useFunkitConfig();
|
|
7443
|
-
const { data, isLoading, isFetching } =
|
|
7470
|
+
const { data, isLoading, isFetching } = useQuery3({
|
|
7444
7471
|
queryKey: ["getWalletAssets", address, apiKey],
|
|
7445
7472
|
queryFn: ({ queryKey: [_, addr, key] }) => fetchAssets(addr, key),
|
|
7446
7473
|
placeholderData: keepPreviousData,
|
|
@@ -7972,7 +7999,7 @@ var getFiatAccountLabel = (defaultLabel, account) => {
|
|
|
7972
7999
|
const instruction = account.source_deposit_instructions;
|
|
7973
8000
|
const accountNumber = instruction.iban || instruction.bank_account_number || "";
|
|
7974
8001
|
const accountEnd = accountNumber.slice(-4);
|
|
7975
|
-
const acountNumberPeek = `\u2022\u2022\u2022\u2022
|
|
8002
|
+
const acountNumberPeek = `\u2022\u2022\u2022\u2022${accountEnd}`;
|
|
7976
8003
|
return `${isSepa ? "SEPA " : ""}${defaultLabel} ${acountNumberPeek}`;
|
|
7977
8004
|
};
|
|
7978
8005
|
function isKycUninitialized(customerStatus) {
|
|
@@ -8014,7 +8041,7 @@ import { FlagKey as FlagKey8 } from "@funkit/utils";
|
|
|
8014
8041
|
import { base as base5 } from "viem/chains";
|
|
8015
8042
|
|
|
8016
8043
|
// src/providers/FunkitMoonpayProvider.tsx
|
|
8017
|
-
import { useQuery as
|
|
8044
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
8018
8045
|
import React72, {
|
|
8019
8046
|
createContext as createContext14,
|
|
8020
8047
|
useContext as useContext14,
|
|
@@ -8076,7 +8103,7 @@ var isCountryBlocked = (blockedList, userIpInfo) => {
|
|
|
8076
8103
|
function useFunkitUserIp() {
|
|
8077
8104
|
const { moonpayApiKey } = useContext14(FunkitMoonpayContext);
|
|
8078
8105
|
const { getFlag, isLoading: isLoadingFlags } = useFlags();
|
|
8079
|
-
const { data: userIpInfo, isLoading: isLoadingGeoCheck } =
|
|
8106
|
+
const { data: userIpInfo, isLoading: isLoadingGeoCheck } = useQuery4({
|
|
8080
8107
|
queryKey: ["getUserIpInfo"],
|
|
8081
8108
|
queryFn: async () => {
|
|
8082
8109
|
try {
|
|
@@ -8154,7 +8181,7 @@ import {
|
|
|
8154
8181
|
} from "@funkit/api-base";
|
|
8155
8182
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9 } from "@funkit/chains";
|
|
8156
8183
|
import { FlagKey as FlagKey10 } from "@funkit/utils";
|
|
8157
|
-
import { useQuery as
|
|
8184
|
+
import { useQuery as useQuery6, useQueryClient } from "@tanstack/react-query";
|
|
8158
8185
|
import { useCallback as useCallback14 } from "react";
|
|
8159
8186
|
|
|
8160
8187
|
// src/hooks/useCheckoutTransferInit.ts
|
|
@@ -8162,7 +8189,7 @@ import {
|
|
|
8162
8189
|
initializeCheckoutTokenTransferAddress
|
|
8163
8190
|
} from "@funkit/api-base";
|
|
8164
8191
|
import { FlagKey as FlagKey9 } from "@funkit/utils";
|
|
8165
|
-
import { useQuery as
|
|
8192
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
8166
8193
|
var useCheckoutTransferInit = (checkoutConfig) => {
|
|
8167
8194
|
const { walletAddress, userInfo } = useGeneralWallet();
|
|
8168
8195
|
const { apiKey } = useFunkitConfig();
|
|
@@ -8180,7 +8207,7 @@ var useCheckoutTransferInit = (checkoutConfig) => {
|
|
|
8180
8207
|
logger,
|
|
8181
8208
|
clientMetadata: generateClientMetadataForTokenTransfer()
|
|
8182
8209
|
};
|
|
8183
|
-
const { data, isFetching } =
|
|
8210
|
+
const { data, isFetching } = useQuery5({
|
|
8184
8211
|
queryKey: ["initializeCheckoutTokenTransferAddress", queryKey],
|
|
8185
8212
|
queryFn: ({ queryKey: [_, params] }) => initializeCheckoutTokenTransferAddress(params),
|
|
8186
8213
|
refetchOnWindowFocus: false,
|
|
@@ -8278,7 +8305,7 @@ function useFiatEnabled() {
|
|
|
8278
8305
|
function useFrogAccounts() {
|
|
8279
8306
|
const { apiKey } = useFunkitConfig();
|
|
8280
8307
|
const { walletAddress } = useGeneralWallet();
|
|
8281
|
-
const query =
|
|
8308
|
+
const query = useQuery6({
|
|
8282
8309
|
queryKey: ["frogSubAccounts", walletAddress],
|
|
8283
8310
|
queryFn: () => fetchFrogAccounts(walletAddress, { apiKey, logger }),
|
|
8284
8311
|
enabled: !!walletAddress,
|
|
@@ -8314,7 +8341,7 @@ function useVirtualFiatAccounts() {
|
|
|
8314
8341
|
const bridgeSubAccount = frogSubAccounts?.find(
|
|
8315
8342
|
(subAccount) => subAccount.subAccountType === "bridge"
|
|
8316
8343
|
);
|
|
8317
|
-
const query =
|
|
8344
|
+
const query = useQuery6({
|
|
8318
8345
|
queryKey: ["useVirtualFiatAccounts", bridgeSubAccount?.guid],
|
|
8319
8346
|
queryFn: () => fetchAllFiatAccounts(bridgeSubAccount, { apiKey, logger }),
|
|
8320
8347
|
enabled: !!bridgeSubAccount,
|
|
@@ -8342,7 +8369,7 @@ function useMatchingVirtualFiatAccount(accounts) {
|
|
|
8342
8369
|
}
|
|
8343
8370
|
function useLoadKycLink(linkLoad) {
|
|
8344
8371
|
const { apiKey } = useFunkitConfig();
|
|
8345
|
-
const query =
|
|
8372
|
+
const query = useQuery6({
|
|
8346
8373
|
queryKey: ["kycLink", linkLoad.guid],
|
|
8347
8374
|
queryFn: async () => {
|
|
8348
8375
|
if (linkLoad.kycLink) {
|
|
@@ -9167,7 +9194,7 @@ var getDefaultTransports = () => {
|
|
|
9167
9194
|
};
|
|
9168
9195
|
|
|
9169
9196
|
// src/hooks/useMesh.tsx
|
|
9170
|
-
import { useQuery as
|
|
9197
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
9171
9198
|
import React75, { useMemo as useMemo10 } from "react";
|
|
9172
9199
|
import { FlagKey as FlagKey11 } from "@funkit/utils";
|
|
9173
9200
|
|
|
@@ -9295,7 +9322,7 @@ var useMeshActiveNetworkInfo = (chainId, brokerType) => {
|
|
|
9295
9322
|
};
|
|
9296
9323
|
function useMeshIntegrations() {
|
|
9297
9324
|
const { apiKey } = useFunkitConfig();
|
|
9298
|
-
const { data, isLoading } =
|
|
9325
|
+
const { data, isLoading } = useQuery7({
|
|
9299
9326
|
queryKey: ["funkit-mesh-integrations", apiKey],
|
|
9300
9327
|
queryFn: async () => {
|
|
9301
9328
|
return await fetchMeshTransferIntegrations(apiKey);
|
|
@@ -9337,7 +9364,7 @@ function useMeshAccountHoldings(targetChain, connection) {
|
|
|
9337
9364
|
const { integrations } = useMeshIntegrations();
|
|
9338
9365
|
const meshDeviceId = getMeshDeviceIdFromLocalStorage();
|
|
9339
9366
|
const enableFrogProxyServer = useFlag(FlagKey11.EnableFrogProxyServer);
|
|
9340
|
-
const query =
|
|
9367
|
+
const query = useQuery7({
|
|
9341
9368
|
queryKey: [
|
|
9342
9369
|
{
|
|
9343
9370
|
apiKey,
|
|
@@ -9361,12 +9388,12 @@ import { useMemo as useMemo12 } from "react";
|
|
|
9361
9388
|
|
|
9362
9389
|
// src/hooks/useAllowedAssets.ts
|
|
9363
9390
|
import { getAllowedAssets } from "@funkit/api-base";
|
|
9364
|
-
import { useQuery as
|
|
9391
|
+
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
9365
9392
|
import { useCallback as useCallback15, useMemo as useMemo11 } from "react";
|
|
9366
9393
|
function useAllowedAssets() {
|
|
9367
9394
|
const { apiKey } = useFunkitConfig();
|
|
9368
9395
|
const isRelayEnabled = useSourceTokenRelayEnabled();
|
|
9369
|
-
const { data: allowedAssets, isLoading } =
|
|
9396
|
+
const { data: allowedAssets, isLoading } = useQuery8({
|
|
9370
9397
|
queryKey: ["getAllowedAssets", apiKey],
|
|
9371
9398
|
queryFn: () => getAllowedAssets({ apiKey, logger }),
|
|
9372
9399
|
refetchOnMount: false,
|
|
@@ -10929,6 +10956,10 @@ var QUOTE_API_ERROR_STRING_INFO = {
|
|
|
10929
10956
|
check: "Error estimating checkout cost and time",
|
|
10930
10957
|
display: DEFAULT_QUOTE_ERROR
|
|
10931
10958
|
},
|
|
10959
|
+
[6 /* NO_ROUTE_FOUND_RELAY */]: {
|
|
10960
|
+
check: "No routes found",
|
|
10961
|
+
display: "No routes found."
|
|
10962
|
+
},
|
|
10932
10963
|
[2 /* INSUFFICIENT_AMOUNT_GENERAL_1 */]: {
|
|
10933
10964
|
check: "try to increase the amount",
|
|
10934
10965
|
display: "Checkout amount is too low. Please retry."
|
|
@@ -16656,13 +16687,13 @@ function InputAmountLoading({
|
|
|
16656
16687
|
|
|
16657
16688
|
// src/modals/CheckoutModal/InputAmount/useAssetPrice.ts
|
|
16658
16689
|
import { getAssetPriceInfo as getAssetPriceInfo3 } from "@funkit/api-base";
|
|
16659
|
-
import { skipToken, useQuery as
|
|
16690
|
+
import { skipToken, useQuery as useQuery9 } from "@tanstack/react-query";
|
|
16660
16691
|
function useAssetPrice({
|
|
16661
16692
|
chainId,
|
|
16662
16693
|
assetTokenAddress
|
|
16663
16694
|
}) {
|
|
16664
16695
|
const { apiKey } = useFunkitConfig();
|
|
16665
|
-
const { data, error, isLoading } =
|
|
16696
|
+
const { data, error, isLoading } = useQuery9({
|
|
16666
16697
|
queryKey: ["getAssetPriceInfo", chainId, assetTokenAddress],
|
|
16667
16698
|
queryFn: chainId && assetTokenAddress ? async () => {
|
|
16668
16699
|
try {
|
|
@@ -18480,8 +18511,7 @@ var DEFAULT_VALUE = "";
|
|
|
18480
18511
|
var ChainDropdown = ({
|
|
18481
18512
|
assets,
|
|
18482
18513
|
chainIds: chains,
|
|
18483
|
-
selectedChainId,
|
|
18484
|
-
selectedToken,
|
|
18514
|
+
selectedChainId: propSelectedChainId,
|
|
18485
18515
|
allowUnselect,
|
|
18486
18516
|
onChainSelected,
|
|
18487
18517
|
activeItemProps,
|
|
@@ -18490,15 +18520,26 @@ var ChainDropdown = ({
|
|
|
18490
18520
|
isLoading
|
|
18491
18521
|
}) => {
|
|
18492
18522
|
const chainIds = chains ?? Object.keys(assets).map(Number);
|
|
18493
|
-
const enabledChainIds = selectedToken ? chainIds.filter((chainId) => assets[chainId].includes(selectedToken)) : chainIds;
|
|
18494
18523
|
const options = allowUnselect ? [DEFAULT_VALUE, ...chainIds] : chainIds;
|
|
18495
|
-
const
|
|
18524
|
+
const [selectedChainId, setSelectedChainId] = React171.useState(propSelectedChainId);
|
|
18525
|
+
useIsomorphicLayoutEffect(() => {
|
|
18526
|
+
if (propSelectedChainId === void 0) {
|
|
18527
|
+
setSelectedChainId(void 0);
|
|
18528
|
+
return;
|
|
18529
|
+
}
|
|
18530
|
+
if (propSelectedChainId && propSelectedChainId !== selectedChainId) {
|
|
18531
|
+
handleOptionSelect(propSelectedChainId.toString(), false);
|
|
18532
|
+
}
|
|
18533
|
+
}, [propSelectedChainId, selectedChainId]);
|
|
18534
|
+
const handleOptionSelect = (value, autoUpdate = true) => {
|
|
18496
18535
|
if (!value) return onChainSelected(void 0);
|
|
18497
18536
|
const chainId = Number(value);
|
|
18498
18537
|
if (allowUnselect && chainId === selectedChainId) {
|
|
18499
|
-
|
|
18538
|
+
setSelectedChainId(void 0);
|
|
18539
|
+
onChainSelected(void 0, autoUpdate);
|
|
18500
18540
|
} else {
|
|
18501
|
-
|
|
18541
|
+
setSelectedChainId(chainId);
|
|
18542
|
+
onChainSelected(chainId, autoUpdate);
|
|
18502
18543
|
}
|
|
18503
18544
|
};
|
|
18504
18545
|
return /* @__PURE__ */ React171.createElement(
|
|
@@ -18531,7 +18572,6 @@ var ChainDropdown = ({
|
|
|
18531
18572
|
})),
|
|
18532
18573
|
renderDropdownOption: (option, isSelected) => {
|
|
18533
18574
|
const metadata = chainMetadataById[option.value];
|
|
18534
|
-
const isDisabled = option.value !== DEFAULT_VALUE && !enabledChainIds.includes(Number(option.value));
|
|
18535
18575
|
const dropdownItem = /* @__PURE__ */ React171.createElement(
|
|
18536
18576
|
BaseDropdownItem_default,
|
|
18537
18577
|
{
|
|
@@ -18549,19 +18589,10 @@ var ChainDropdown = ({
|
|
|
18549
18589
|
id: option.value,
|
|
18550
18590
|
onClick: handleOptionSelect,
|
|
18551
18591
|
label: option.label,
|
|
18552
|
-
isSelected
|
|
18553
|
-
isDisabled
|
|
18592
|
+
isSelected
|
|
18554
18593
|
}
|
|
18555
18594
|
);
|
|
18556
|
-
return
|
|
18557
|
-
FunTooltip,
|
|
18558
|
-
{
|
|
18559
|
-
tooltipPosition: "left",
|
|
18560
|
-
maxWidth: 132,
|
|
18561
|
-
content: "Chain isn't available for the selected token"
|
|
18562
|
-
},
|
|
18563
|
-
dropdownItem
|
|
18564
|
-
) : dropdownItem;
|
|
18595
|
+
return dropdownItem;
|
|
18565
18596
|
},
|
|
18566
18597
|
preloadIconUrls: chainIds.map((id) => chainMetadataById[id].iconUrl)
|
|
18567
18598
|
}
|
|
@@ -20471,7 +20502,7 @@ var useNewTokens = () => {
|
|
|
20471
20502
|
var TokenDropdown = ({
|
|
20472
20503
|
assets,
|
|
20473
20504
|
selectedChainId,
|
|
20474
|
-
|
|
20505
|
+
selectedToken,
|
|
20475
20506
|
onTokenSelected,
|
|
20476
20507
|
isLoading
|
|
20477
20508
|
}) => {
|
|
@@ -20479,26 +20510,26 @@ var TokenDropdown = ({
|
|
|
20479
20510
|
const allTokens = Array.from(
|
|
20480
20511
|
new Set(Object.values(assets).flat())
|
|
20481
20512
|
);
|
|
20482
|
-
const defaultToken =
|
|
20513
|
+
const defaultToken = selectedToken ?? enabledTokens[0];
|
|
20483
20514
|
const [isTouched, setIsTouched] = useState46(false);
|
|
20484
20515
|
const [selectedSymbol, setSelectedSymbol] = useState46(defaultToken);
|
|
20485
20516
|
const { newTokens, newSymbol } = useNewTokens();
|
|
20486
|
-
|
|
20517
|
+
useIsomorphicLayoutEffect(() => {
|
|
20518
|
+
if (selectedToken && selectedToken !== selectedSymbol && allTokens.includes(selectedToken)) {
|
|
20519
|
+
handleChangeSymbol(selectedToken, false);
|
|
20520
|
+
}
|
|
20521
|
+
}, [selectedToken, allTokens, selectedSymbol, enabledTokens]);
|
|
20522
|
+
const handleChangeSymbol = (symbol, autoUpdate = true) => {
|
|
20487
20523
|
setSelectedSymbol(symbol);
|
|
20488
20524
|
if (!enabledTokens.includes(symbol)) {
|
|
20489
20525
|
const matchingChainIdForToken = Object.entries(assets).find(
|
|
20490
20526
|
([, tokens]) => tokens.includes(symbol)
|
|
20491
20527
|
)?.[0];
|
|
20492
|
-
onTokenSelected(symbol, Number(matchingChainIdForToken));
|
|
20528
|
+
onTokenSelected(symbol, Number(matchingChainIdForToken), autoUpdate);
|
|
20493
20529
|
} else {
|
|
20494
|
-
onTokenSelected(symbol);
|
|
20530
|
+
onTokenSelected(symbol, void 0, autoUpdate);
|
|
20495
20531
|
}
|
|
20496
20532
|
};
|
|
20497
|
-
useIsomorphicLayoutEffect(() => {
|
|
20498
|
-
if (!enabledTokens.includes(selectedSymbol)) {
|
|
20499
|
-
handleChangeSymbol(enabledTokens[0]);
|
|
20500
|
-
}
|
|
20501
|
-
}, [selectedSymbol, enabledTokens]);
|
|
20502
20533
|
return /* @__PURE__ */ React182.createElement(
|
|
20503
20534
|
BaseDropdown_default,
|
|
20504
20535
|
{
|
|
@@ -20909,8 +20940,11 @@ var FunFeatureListItem = ({
|
|
|
20909
20940
|
gap: "6"
|
|
20910
20941
|
}
|
|
20911
20942
|
},
|
|
20912
|
-
isMultiline ? /* @__PURE__ */ React189.createElement(Box, { display: "flex" }, /* @__PURE__ */ React189.createElement(Text, { size: "12", weight: "medium" }, text), tooltip && TooltipWrapperElement) : /* @__PURE__ */ React189.createElement(Text, { size: "12"
|
|
20913
|
-
isMultiline ? /* @__PURE__ */ React189.createElement(Box, { display: "flex", flexDirection: "column", gap: "6" }, value.map((v, index) =>
|
|
20943
|
+
isMultiline ? /* @__PURE__ */ React189.createElement(Box, { display: "flex" }, /* @__PURE__ */ React189.createElement(Text, { size: "12", weight: "medium" }, text), tooltip && TooltipWrapperElement) : /* @__PURE__ */ React189.createElement(Text, { size: "12" }, text, /* @__PURE__ */ React189.createElement(React189.Fragment, null, "\xA0")),
|
|
20944
|
+
isMultiline ? /* @__PURE__ */ React189.createElement(Box, { display: "flex", flexDirection: "column", gap: "6" }, value.map((v, index) => (
|
|
20945
|
+
// biome-ignore lint/suspicious/noArrayIndexKey: this is completely fine
|
|
20946
|
+
/* @__PURE__ */ React189.createElement(Text, { size: "12", display: "inline", key: index }, v)
|
|
20947
|
+
))) : /* @__PURE__ */ React189.createElement(Text, { size: "12", weight: "medium", display: "inline" }, valueLabel),
|
|
20914
20948
|
!isMultiline && tooltip && TooltipWrapperElement
|
|
20915
20949
|
)
|
|
20916
20950
|
);
|
|
@@ -20922,6 +20956,7 @@ var FunFeatureList = ({
|
|
|
20922
20956
|
isExpandable = false,
|
|
20923
20957
|
disabled = false,
|
|
20924
20958
|
withBackgroundContainer = true,
|
|
20959
|
+
withBackgroundItem = false,
|
|
20925
20960
|
gapBetweenItems = "6"
|
|
20926
20961
|
}) => {
|
|
20927
20962
|
const [isExpanded, setIsExpanded] = useState47(false);
|
|
@@ -21009,7 +21044,19 @@ var FunFeatureList = ({
|
|
|
21009
21044
|
paddingY: "8"
|
|
21010
21045
|
}
|
|
21011
21046
|
},
|
|
21012
|
-
items.map((item, index) => /* @__PURE__ */ React190.createElement(
|
|
21047
|
+
items.map((item, index) => /* @__PURE__ */ React190.createElement(
|
|
21048
|
+
Box,
|
|
21049
|
+
{
|
|
21050
|
+
key: index,
|
|
21051
|
+
...withBackgroundItem && {
|
|
21052
|
+
paddingX: "12",
|
|
21053
|
+
paddingY: "8",
|
|
21054
|
+
borderRadius: "connectButton",
|
|
21055
|
+
background: "offBackground"
|
|
21056
|
+
}
|
|
21057
|
+
},
|
|
21058
|
+
/* @__PURE__ */ React190.createElement(FunFeatureListItem, { ...item })
|
|
21059
|
+
))
|
|
21013
21060
|
)
|
|
21014
21061
|
);
|
|
21015
21062
|
};
|
|
@@ -21282,10 +21329,10 @@ function TransferToken({
|
|
|
21282
21329
|
TokenDropdown,
|
|
21283
21330
|
{
|
|
21284
21331
|
isLoading: isLoadingDepositAddress,
|
|
21285
|
-
|
|
21332
|
+
selectedToken,
|
|
21286
21333
|
selectedChainId,
|
|
21287
21334
|
assets: filteredAssets,
|
|
21288
|
-
onTokenSelected: (token, chainId) => {
|
|
21335
|
+
onTokenSelected: (token, chainId, autoUpdate) => {
|
|
21289
21336
|
logger.log(`${TRANSFER_TOKEN_LOG_PREFIX}_changeToken`, {
|
|
21290
21337
|
previousToken: selectedToken,
|
|
21291
21338
|
newToken: token,
|
|
@@ -21301,16 +21348,30 @@ function TransferToken({
|
|
|
21301
21348
|
if (chainId !== void 0 && chainId !== selectedChainId) {
|
|
21302
21349
|
setSelectedChainId(chainId);
|
|
21303
21350
|
}
|
|
21351
|
+
if (autoUpdate) {
|
|
21352
|
+
const isSupportedOnDefaultChain = filteredAssets[defaultChainId]?.includes(token);
|
|
21353
|
+
if (isSupportedOnDefaultChain) {
|
|
21354
|
+
setSelectedChainId(defaultChainId);
|
|
21355
|
+
} else {
|
|
21356
|
+
const matchingDefaultChainId = Object.keys(
|
|
21357
|
+
filteredAssets
|
|
21358
|
+
).find(
|
|
21359
|
+
(chainId2) => filteredAssets[Number(chainId2)]?.includes(token)
|
|
21360
|
+
);
|
|
21361
|
+
if (matchingDefaultChainId) {
|
|
21362
|
+
setSelectedChainId(Number(matchingDefaultChainId));
|
|
21363
|
+
}
|
|
21364
|
+
}
|
|
21365
|
+
}
|
|
21304
21366
|
}
|
|
21305
21367
|
}
|
|
21306
21368
|
)), /* @__PURE__ */ React193.createElement(Box, { width: "full", display: "flex", flexDirection: "column", gap: "4" }, /* @__PURE__ */ React193.createElement(Text, { size: "12", weight: "medium" }, "Supported chain"), /* @__PURE__ */ React193.createElement(
|
|
21307
21369
|
ChainDropdown,
|
|
21308
21370
|
{
|
|
21309
21371
|
isLoading: isLoadingDepositAddress,
|
|
21310
|
-
selectedToken,
|
|
21311
21372
|
selectedChainId,
|
|
21312
21373
|
assets: filteredAssets,
|
|
21313
|
-
onChainSelected: (chainId) => {
|
|
21374
|
+
onChainSelected: (chainId, autoUpdate) => {
|
|
21314
21375
|
if (chainId === void 0) return;
|
|
21315
21376
|
logger.log(`${TRANSFER_TOKEN_LOG_PREFIX}_changeChain`, {
|
|
21316
21377
|
previousChainId: selectedChainId,
|
|
@@ -21319,6 +21380,12 @@ function TransferToken({
|
|
|
21319
21380
|
depositAddress
|
|
21320
21381
|
});
|
|
21321
21382
|
setSelectedChainId(chainId);
|
|
21383
|
+
if (autoUpdate) {
|
|
21384
|
+
const matchingDefaultToken = filteredAssets[chainId][0];
|
|
21385
|
+
if (matchingDefaultToken && matchingDefaultToken !== selectedToken) {
|
|
21386
|
+
setSelectedToken(matchingDefaultToken);
|
|
21387
|
+
}
|
|
21388
|
+
}
|
|
21322
21389
|
}
|
|
21323
21390
|
}
|
|
21324
21391
|
))),
|
|
@@ -21527,7 +21594,7 @@ var AccountDetailsScreen = ({
|
|
|
21527
21594
|
setDetailsExpanded((prev) => !prev);
|
|
21528
21595
|
};
|
|
21529
21596
|
const { source_deposit_instructions: sourceDeposit } = matchingFiatAccount;
|
|
21530
|
-
return /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "
|
|
21597
|
+
return /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "16" }, /* @__PURE__ */ React196.createElement(
|
|
21531
21598
|
SourcePaymentMethodItem,
|
|
21532
21599
|
{
|
|
21533
21600
|
onClick: () => onNext({}),
|
|
@@ -21535,14 +21602,14 @@ var AccountDetailsScreen = ({
|
|
|
21535
21602
|
keyText: label.text,
|
|
21536
21603
|
keyIcon: label.icon
|
|
21537
21604
|
}
|
|
21538
|
-
), /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "
|
|
21605
|
+
), /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "8" }, /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "12" }, /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "8" }, /* @__PURE__ */ React196.createElement(Text, null, "Your virtual fiat account details"), /* @__PURE__ */ React196.createElement(Text, { size: "12" }, "Use these details to transfer EUR. Funds arrive in 1\u20132 days to your ", appName, " account.")), /* @__PURE__ */ React196.createElement(
|
|
21539
21606
|
Tabs,
|
|
21540
21607
|
{
|
|
21541
21608
|
tabs,
|
|
21542
21609
|
activeTab,
|
|
21543
21610
|
onTabChange: (tab) => setActiveTab(tab)
|
|
21544
21611
|
}
|
|
21545
|
-
), activeTab === "details" ? /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "8" }, sourceDeposit.bank_account_number ? /* @__PURE__ */ React196.createElement(
|
|
21612
|
+
)), activeTab === "details" ? /* @__PURE__ */ React196.createElement(Box, { display: "flex", flexDirection: "column", gap: "8" }, sourceDeposit.bank_account_number ? /* @__PURE__ */ React196.createElement(
|
|
21546
21613
|
FunInputButton,
|
|
21547
21614
|
{
|
|
21548
21615
|
label: "Account number",
|
|
@@ -21632,8 +21699,9 @@ var AccountDetailsScreen = ({
|
|
|
21632
21699
|
)) : /* @__PURE__ */ React196.createElement(
|
|
21633
21700
|
FunFeatureList,
|
|
21634
21701
|
{
|
|
21702
|
+
gapBetweenItems: "8",
|
|
21635
21703
|
withBackgroundContainer: false,
|
|
21636
|
-
|
|
21704
|
+
withBackgroundItem: true,
|
|
21637
21705
|
items: [
|
|
21638
21706
|
{
|
|
21639
21707
|
text: "Fees",
|
|
@@ -21647,9 +21715,8 @@ var AccountDetailsScreen = ({
|
|
|
21647
21715
|
{
|
|
21648
21716
|
text: "Limits",
|
|
21649
21717
|
value: [
|
|
21650
|
-
|
|
21651
|
-
"
|
|
21652
|
-
"Maximum amount: 20,000,000 USD"
|
|
21718
|
+
"Minimum amount: 25 EUR",
|
|
21719
|
+
"Maximum amount: 20,000,000 EUR"
|
|
21653
21720
|
],
|
|
21654
21721
|
icon: /* @__PURE__ */ React196.createElement(DollarIcon, null)
|
|
21655
21722
|
},
|
|
@@ -21972,7 +22039,8 @@ function useTitleConfig(checkoutItem, state) {
|
|
|
21972
22039
|
// src/components/FunCheckoutModalHeightAnimationWrapper/FunCheckoutModalHeightAnimationWrapper.tsx
|
|
21973
22040
|
var DEFAULT_HEIGHT = 525;
|
|
21974
22041
|
var mapHeightToCheckoutStep = {
|
|
21975
|
-
["transfer_token" /* TRANSFER_TOKEN */]: 825
|
|
22042
|
+
["transfer_token" /* TRANSFER_TOKEN */]: 825,
|
|
22043
|
+
["fiat_account_detail" /* FIAT_ACCOUNT_DETAIL */]: 825
|
|
21976
22044
|
};
|
|
21977
22045
|
function FunCheckoutModalHeightAnimationWrapper({
|
|
21978
22046
|
children,
|
|
@@ -23750,7 +23818,7 @@ import { createPortal as createPortal13 } from "react-dom";
|
|
|
23750
23818
|
// src/hooks/useCheckoutDirectExecutionHistory.ts
|
|
23751
23819
|
import {
|
|
23752
23820
|
CheckoutRefundState as CheckoutRefundState2,
|
|
23753
|
-
CheckoutState as
|
|
23821
|
+
CheckoutState as CheckoutState4,
|
|
23754
23822
|
DirectExecutionType as DirectExecutionType4
|
|
23755
23823
|
} from "@funkit/api-base";
|
|
23756
23824
|
import {
|
|
@@ -23763,13 +23831,13 @@ import {
|
|
|
23763
23831
|
getRelayExecutionInfo,
|
|
23764
23832
|
isRelayExecutionTerminalStatus
|
|
23765
23833
|
} from "@funkit/fun-relay";
|
|
23766
|
-
import { useQuery as
|
|
23834
|
+
import { useQuery as useQuery10 } from "@tanstack/react-query";
|
|
23767
23835
|
var RELAY_FETCH_INTERVAL = 2e3;
|
|
23768
23836
|
var logPrefix = "useRelayExecutionInfo";
|
|
23769
23837
|
function useRelayExecutionInfo({
|
|
23770
23838
|
relayRequestId
|
|
23771
23839
|
}) {
|
|
23772
|
-
const { data: relayExecutionInfo, isLoading: isLoadingRelayExecutionInfo } =
|
|
23840
|
+
const { data: relayExecutionInfo, isLoading: isLoadingRelayExecutionInfo } = useQuery10({
|
|
23773
23841
|
queryKey: [logPrefix, relayRequestId],
|
|
23774
23842
|
queryFn: async () => {
|
|
23775
23843
|
try {
|
|
@@ -23808,7 +23876,7 @@ function useCheckoutDirectExecutionHistory({
|
|
|
23808
23876
|
getRelayExecutionState(relayExecutionInfo)
|
|
23809
23877
|
) : (
|
|
23810
23878
|
// For all other cases, direct execution is considered completed
|
|
23811
|
-
|
|
23879
|
+
CheckoutState4.COMPLETED
|
|
23812
23880
|
);
|
|
23813
23881
|
const refundState = relayExecutionInfo && type === DirectExecutionType4.RELAY ? getRelayExecutionRefundState(relayExecutionInfo) : void 0;
|
|
23814
23882
|
const isDelayed2 = type === DirectExecutionType4.RELAY && relayExecutionInfo?.status === "delayed";
|
|
@@ -23816,8 +23884,8 @@ function useCheckoutDirectExecutionHistory({
|
|
|
23816
23884
|
state,
|
|
23817
23885
|
refundState,
|
|
23818
23886
|
isRefunded: refundState === CheckoutRefundState2.REFUNDED,
|
|
23819
|
-
isCompleted: state ===
|
|
23820
|
-
isFailed: state ===
|
|
23887
|
+
isCompleted: state === CheckoutState4.COMPLETED,
|
|
23888
|
+
isFailed: state === CheckoutState4.CHECKOUT_ERROR,
|
|
23821
23889
|
isDelayed: isDelayed2
|
|
23822
23890
|
};
|
|
23823
23891
|
}
|
|
@@ -25484,7 +25552,7 @@ import {
|
|
|
25484
25552
|
getCheckoutsByUserId as getCheckoutsByUserId2
|
|
25485
25553
|
} from "@funkit/api-base";
|
|
25486
25554
|
import { FlagKey as FlagKey27 } from "@funkit/utils";
|
|
25487
|
-
import { useQuery as
|
|
25555
|
+
import { useQuery as useQuery11 } from "@tanstack/react-query";
|
|
25488
25556
|
var hasCorrectPaymentMethod = (checkout, paymentMethod) => !paymentMethod || checkout.clientMetadata.selectedPaymentMethodInfo?.paymentMethod === paymentMethod;
|
|
25489
25557
|
var isRecent = (checkout, timestampCutoff) => checkout.createdTimeMs > timestampCutoff;
|
|
25490
25558
|
var DEFAULT_CUTOFF = 7 * 24 * 60 * 60 * 1e3;
|
|
@@ -25502,7 +25570,7 @@ var useRecentCheckouts = ({
|
|
|
25502
25570
|
const { listRefresh } = useCheckoutRefreshInterval();
|
|
25503
25571
|
const defaultTimestampCutoff = Date.now() - DEFAULT_CUTOFF;
|
|
25504
25572
|
const timestampCutoff = newerThanMs ?? defaultTimestampCutoff;
|
|
25505
|
-
const query =
|
|
25573
|
+
const query = useQuery11({
|
|
25506
25574
|
queryKey: ["checkouts", userInfo.id],
|
|
25507
25575
|
queryFn: async () => {
|
|
25508
25576
|
const checkouts = await getCheckoutsByUserId2({
|
|
@@ -26215,11 +26283,11 @@ var FunNotificationBanner = ({
|
|
|
26215
26283
|
import {
|
|
26216
26284
|
getCheckoutByDepositAddress as getCheckoutByDepositAddress2
|
|
26217
26285
|
} from "@funkit/api-base";
|
|
26218
|
-
import { useQuery as
|
|
26286
|
+
import { useQuery as useQuery12 } from "@tanstack/react-query";
|
|
26219
26287
|
var useCheckout = (depositAddress, initial) => {
|
|
26220
26288
|
const { apiKey } = useFunkitConfig();
|
|
26221
26289
|
const { itemRefresh } = useCheckoutRefreshInterval();
|
|
26222
|
-
const query =
|
|
26290
|
+
const query = useQuery12({
|
|
26223
26291
|
queryKey: ["checkouts", "checkout", depositAddress],
|
|
26224
26292
|
queryFn: () => (
|
|
26225
26293
|
// biome-ignore lint/style/noNonNullAssertion: already checked for null
|
|
@@ -28371,7 +28439,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
28371
28439
|
localStorage.setItem(storageKey5, version);
|
|
28372
28440
|
}
|
|
28373
28441
|
function getCurrentSdkVersion() {
|
|
28374
|
-
return "5.3.
|
|
28442
|
+
return "5.3.6";
|
|
28375
28443
|
}
|
|
28376
28444
|
function useFingerprint() {
|
|
28377
28445
|
const fingerprint = useCallback49(() => {
|
|
@@ -19,18 +19,22 @@ export declare function FunkitCheckoutHistoryProvider({ children, }: {
|
|
|
19
19
|
export declare function useCheckoutHistoryContext(): FunkitCheckoutHistoryContextInterface;
|
|
20
20
|
/**
|
|
21
21
|
* External hook to listen for checkout history every 5000ms
|
|
22
|
-
*
|
|
23
22
|
* @param userId ID of the user (wallet address)
|
|
24
23
|
* @returns PurifiedCheckoutHistoryItem[]
|
|
25
24
|
*/
|
|
26
|
-
export declare function useCheckoutsListenerByUserId(userId: string):
|
|
25
|
+
export declare function useCheckoutsListenerByUserId(userId: string | undefined): {
|
|
26
|
+
data?: PurifiedCheckoutHistoryItem[];
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
};
|
|
27
29
|
/**
|
|
28
30
|
* External hook to listen for checkout history every 5000ms
|
|
29
|
-
*
|
|
30
31
|
* @param checkoutId ID of the checkout
|
|
31
|
-
* @returns PurifiedCheckoutHistoryItem |
|
|
32
|
+
* @returns PurifiedCheckoutHistoryItem | null
|
|
32
33
|
*/
|
|
33
|
-
export declare function useCheckoutListenerByCheckoutId(checkoutId:
|
|
34
|
+
export declare function useCheckoutListenerByCheckoutId(checkoutId: Hex | undefined): {
|
|
35
|
+
data?: PurifiedCheckoutHistoryItem | null;
|
|
36
|
+
isLoading: boolean;
|
|
37
|
+
};
|
|
34
38
|
/**
|
|
35
39
|
* Internal hook to handle post-checkout, PER-BACKEND-CHECKOUT ITEM.
|
|
36
40
|
*/
|
|
@@ -1,3 +1,24 @@
|
|
|
1
|
-
import type
|
|
2
|
-
|
|
3
|
-
export
|
|
1
|
+
import { type CheckoutHistoryItem, CheckoutState, type DirectExecution } from '@funkit/api-base';
|
|
2
|
+
import type { Address, Hex } from 'viem';
|
|
3
|
+
export type PurifiedCheckoutHistoryItem = {
|
|
4
|
+
depositAddr?: Address;
|
|
5
|
+
directExecution: boolean;
|
|
6
|
+
id: Hex;
|
|
7
|
+
fromAmountBaseUnit: string;
|
|
8
|
+
fromChainId: string;
|
|
9
|
+
fromTokenAddress: Address;
|
|
10
|
+
state: CheckoutState;
|
|
11
|
+
toAmountBaseUnit: string;
|
|
12
|
+
toChainId: string;
|
|
13
|
+
toTokenAddress: Address;
|
|
14
|
+
txHash?: Hex;
|
|
15
|
+
} & ({
|
|
16
|
+
depositAddr: Address;
|
|
17
|
+
directExecution: false;
|
|
18
|
+
txHash?: never;
|
|
19
|
+
} | {
|
|
20
|
+
depositAddr?: never;
|
|
21
|
+
directExecution: true;
|
|
22
|
+
txHash: Hex;
|
|
23
|
+
});
|
|
24
|
+
export declare const purifyCheckoutHistoryItem: (item: CheckoutHistoryItem | DirectExecution) => PurifiedCheckoutHistoryItem;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
zerionWallet
|
|
4
|
-
} from "./chunk-AXWP3GD4.js";
|
|
5
2
|
import {
|
|
6
3
|
walletConnectWallet
|
|
7
4
|
} from "./chunk-NP5QGWNL.js";
|
|
8
5
|
import {
|
|
9
|
-
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
zerionWallet
|
|
7
|
+
} from "./chunk-AXWP3GD4.js";
|
|
8
|
+
import {
|
|
9
|
+
xdefiWallet
|
|
10
|
+
} from "./chunk-NO7XMBB5.js";
|
|
11
11
|
import {
|
|
12
12
|
subWallet
|
|
13
13
|
} from "./chunk-AD2KIJB6.js";
|
|
@@ -18,23 +18,20 @@ import {
|
|
|
18
18
|
talismanWallet
|
|
19
19
|
} from "./chunk-ABFSXBE6.js";
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
tokenaryWallet
|
|
22
|
+
} from "./chunk-SLOIIJGP.js";
|
|
23
23
|
import {
|
|
24
|
-
|
|
25
|
-
} from "./chunk-
|
|
24
|
+
uniswapWallet
|
|
25
|
+
} from "./chunk-LH7BMNFZ.js";
|
|
26
26
|
import {
|
|
27
27
|
trustWallet
|
|
28
28
|
} from "./chunk-ISIBREBO.js";
|
|
29
29
|
import {
|
|
30
|
-
|
|
31
|
-
} from "./chunk-
|
|
32
|
-
import {
|
|
33
|
-
tokenaryWallet
|
|
34
|
-
} from "./chunk-SLOIIJGP.js";
|
|
30
|
+
tokenPocketWallet
|
|
31
|
+
} from "./chunk-IDKVN5CF.js";
|
|
35
32
|
import {
|
|
36
|
-
|
|
37
|
-
} from "./chunk-
|
|
33
|
+
zealWallet
|
|
34
|
+
} from "./chunk-JROWU5BP.js";
|
|
38
35
|
import {
|
|
39
36
|
oneKeyWallet
|
|
40
37
|
} from "./chunk-4AD7VI2P.js";
|
|
@@ -50,39 +47,39 @@ import {
|
|
|
50
47
|
import {
|
|
51
48
|
safeheronWallet
|
|
52
49
|
} from "./chunk-R6RWZRFF.js";
|
|
50
|
+
import {
|
|
51
|
+
safepalWallet
|
|
52
|
+
} from "./chunk-MSFKSQBY.js";
|
|
53
|
+
import {
|
|
54
|
+
oneInchWallet
|
|
55
|
+
} from "./chunk-OESTDX6I.js";
|
|
53
56
|
import {
|
|
54
57
|
safeWallet
|
|
55
58
|
} from "./chunk-BQQQL6UD.js";
|
|
56
59
|
import {
|
|
57
|
-
|
|
58
|
-
} from "./chunk-
|
|
60
|
+
ledgerWallet
|
|
61
|
+
} from "./chunk-BRBKM4PW.js";
|
|
59
62
|
import {
|
|
60
63
|
metaMaskWallet
|
|
61
64
|
} from "./chunk-G73C6P5P.js";
|
|
62
|
-
import {
|
|
63
|
-
mewWallet
|
|
64
|
-
} from "./chunk-V57WLZEE.js";
|
|
65
65
|
import {
|
|
66
66
|
oktoWallet
|
|
67
67
|
} from "./chunk-ADIXAKUL.js";
|
|
68
|
-
import {
|
|
69
|
-
ledgerWallet
|
|
70
|
-
} from "./chunk-BRBKM4PW.js";
|
|
71
|
-
import {
|
|
72
|
-
oneInchWallet
|
|
73
|
-
} from "./chunk-OESTDX6I.js";
|
|
74
68
|
import {
|
|
75
69
|
okxWallet
|
|
76
70
|
} from "./chunk-4WEHDI4Y.js";
|
|
71
|
+
import {
|
|
72
|
+
mewWallet
|
|
73
|
+
} from "./chunk-V57WLZEE.js";
|
|
77
74
|
import {
|
|
78
75
|
omniWallet
|
|
79
76
|
} from "./chunk-7CUY5G6R.js";
|
|
77
|
+
import {
|
|
78
|
+
phantomWallet
|
|
79
|
+
} from "./chunk-ZSVTX6EK.js";
|
|
80
80
|
import {
|
|
81
81
|
rabbyWallet
|
|
82
82
|
} from "./chunk-BVX4XGNP.js";
|
|
83
|
-
import {
|
|
84
|
-
frameWallet
|
|
85
|
-
} from "./chunk-ZMYVTWDF.js";
|
|
86
83
|
import {
|
|
87
84
|
foxWallet
|
|
88
85
|
} from "./chunk-LMZMXEXL.js";
|
|
@@ -90,35 +87,38 @@ import {
|
|
|
90
87
|
frontierWallet
|
|
91
88
|
} from "./chunk-3S2U24BJ.js";
|
|
92
89
|
import {
|
|
93
|
-
|
|
94
|
-
} from "./chunk-
|
|
90
|
+
frameWallet
|
|
91
|
+
} from "./chunk-ZMYVTWDF.js";
|
|
95
92
|
import {
|
|
96
93
|
gateWallet
|
|
97
94
|
} from "./chunk-GSOYKKIS.js";
|
|
98
95
|
import {
|
|
99
96
|
imTokenWallet
|
|
100
97
|
} from "./chunk-COZ7MIQS.js";
|
|
98
|
+
import {
|
|
99
|
+
injectedWallet
|
|
100
|
+
} from "./chunk-VCVVV2K7.js";
|
|
101
101
|
import {
|
|
102
102
|
kresusWallet
|
|
103
103
|
} from "./chunk-MJXPRJZT.js";
|
|
104
|
-
import {
|
|
105
|
-
coin98Wallet
|
|
106
|
-
} from "./chunk-DTRYS3MO.js";
|
|
107
104
|
import {
|
|
108
105
|
clvWallet
|
|
109
106
|
} from "./chunk-KR6JBW5E.js";
|
|
110
107
|
import {
|
|
111
|
-
|
|
112
|
-
} from "./chunk-
|
|
108
|
+
coin98Wallet
|
|
109
|
+
} from "./chunk-DTRYS3MO.js";
|
|
113
110
|
import {
|
|
114
111
|
coinbaseWallet
|
|
115
112
|
} from "./chunk-H4IRCEZN.js";
|
|
113
|
+
import {
|
|
114
|
+
coreWallet
|
|
115
|
+
} from "./chunk-HBA36GW3.js";
|
|
116
116
|
import {
|
|
117
117
|
dawnWallet
|
|
118
118
|
} from "./chunk-LN7OD5EC.js";
|
|
119
119
|
import {
|
|
120
|
-
|
|
121
|
-
} from "./chunk-
|
|
120
|
+
bloomWallet
|
|
121
|
+
} from "./chunk-S27IADFU.js";
|
|
122
122
|
import {
|
|
123
123
|
desigWallet
|
|
124
124
|
} from "./chunk-CTU6JCOK.js";
|
|
@@ -131,22 +131,22 @@ import {
|
|
|
131
131
|
import {
|
|
132
132
|
bifrostWallet
|
|
133
133
|
} from "./chunk-W6N74MS3.js";
|
|
134
|
-
import {
|
|
135
|
-
bitskiWallet
|
|
136
|
-
} from "./chunk-P74YPRF6.js";
|
|
137
134
|
import {
|
|
138
135
|
bitgetWallet
|
|
139
136
|
} from "./chunk-A5APNTGL.js";
|
|
140
137
|
import {
|
|
141
|
-
|
|
142
|
-
} from "./chunk-
|
|
138
|
+
bitskiWallet
|
|
139
|
+
} from "./chunk-P74YPRF6.js";
|
|
143
140
|
import {
|
|
144
141
|
bitverseWallet
|
|
145
142
|
} from "./chunk-3HZRRP4Y.js";
|
|
146
|
-
import "./chunk-23WIEY36.js";
|
|
147
143
|
import {
|
|
148
144
|
braveWallet
|
|
149
145
|
} from "./chunk-PB254NQ4.js";
|
|
146
|
+
import {
|
|
147
|
+
bybitWallet
|
|
148
|
+
} from "./chunk-6ONTSPEY.js";
|
|
149
|
+
import "./chunk-23WIEY36.js";
|
|
150
150
|
import "./chunk-WRA2DVJ7.js";
|
|
151
151
|
export {
|
|
152
152
|
argentWallet,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funkit/connect",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.6",
|
|
4
4
|
"description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -91,11 +91,11 @@
|
|
|
91
91
|
"react-virtuoso": "4.10.1",
|
|
92
92
|
"ua-parser-js": "^1.0.37",
|
|
93
93
|
"uuid": "^9.0.1",
|
|
94
|
-
"@funkit/
|
|
94
|
+
"@funkit/core": "2.3.19",
|
|
95
|
+
"@funkit/fun-relay": "0.1.2",
|
|
95
96
|
"@funkit/chains": "0.2.3",
|
|
97
|
+
"@funkit/api-base": "1.8.2",
|
|
96
98
|
"@funkit/utils": "1.0.13",
|
|
97
|
-
"@funkit/core": "2.3.19",
|
|
98
|
-
"@funkit/fun-relay": "0.1.0",
|
|
99
99
|
"@funkit/wagmi-tools": "3.0.41"
|
|
100
100
|
},
|
|
101
101
|
"repository": {
|