@funkit/connect 9.12.0 → 9.13.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 +19 -0
- package/README.md +21 -0
- package/dist/clients/lighter.js +1 -0
- package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
- package/dist/hooks/queries/useRecentDeposits.d.ts +39 -49
- package/dist/index.js +2226 -2082
- package/dist/modals/CheckoutModal/SourceChange/FlatList.d.ts +31 -0
- package/dist/modals/CheckoutModal/SourceChange/GroupedList.d.ts +25 -0
- package/dist/modals/CheckoutModal/SourceChange/SourceList.d.ts +17 -9
- package/dist/modals/CheckoutModal/SourceChange/buildSourceGroups.d.ts +47 -0
- package/dist/modals/CheckoutModal/TransferToken/types.d.ts +1 -2
- package/dist/modals/ProfileDetails/FunProfileViews/Home/HomeCheckoutDisplayRow.css.d.ts +1 -1
- package/dist/modals/WithdrawalModal/ErrorMessage.d.ts +4 -0
- package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +11 -0
- package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -0
- package/dist/providers/FunkitConfigContext.d.ts +2 -0
- package/dist/providers/GeneralWalletProvider.d.ts +2 -4
- package/dist/utils/userInfo.d.ts +36 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/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 +43 -43
- 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 +7 -3
- package/dist/wallets/walletConnectors/{chunk-5TN5Z2WY.js → chunk-3ZJN3PXP.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-V6UOWTEZ.js → chunk-55VS2NKG.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-DEFRRPXB.js → chunk-7IEUTLHY.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-LCIPVVH5.js → chunk-AZYMJ4C6.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-T4ROGPMF.js → chunk-FWM4KTOV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-YIEASHLS.js → chunk-IMNI4AGV.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-7V33VJAL.js → chunk-IRHK6SOW.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-UDTBQV4Q.js → chunk-J3PJOMO7.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-VJZWNQOF.js → chunk-LEAZMT5Y.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-6DRCY52E.js → chunk-OD6B2ISG.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-FG2LDVXL.js → chunk-OSOB6QYX.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-XVBSJCW5.js → chunk-RZQ4B4Z7.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-KWX2SYU2.js → chunk-UFYNHHDU.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HXWUH73P.js → chunk-UYW6MV74.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-34HACM5U.js → chunk-VMMROPXK.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-ZPSPK6LH.js → chunk-YGMU5VWD.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-APHCF4DT.js → chunk-ZJJWGKB6.js} +3 -3
- package/dist/wallets/walletConnectors/{chunk-HRDPUW3V.js → chunk-ZL6XCMV5.js} +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @funkit/connect
|
|
2
2
|
|
|
3
|
+
## 9.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ac8b104: Add `showWalletConnect` option to `uiCustomizations.sourceChangeScreen` to allow hiding the wallet connect payment method
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 01826fb: chore(connect): bump postcss
|
|
12
|
+
- ab86ca3: refactor(connect): split `SourceList` into a thin composer + `FlatList`/`GroupedList` layout primitives. Internal-only; no public API change; rendered DOM unchanged.
|
|
13
|
+
- 6039a1b: When `externalUserId` is set for Lighter customers, use it directly as `userId` and `walletAddress` instead of wrapping via `generateSyntheticUserId`
|
|
14
|
+
- 3719658: Split useRecentDeposits into a raw API hook and a pure testable transform function
|
|
15
|
+
- ce7e633: Internal: add `testId` prop to `SourceList` for testability.
|
|
16
|
+
- 7743d5b: Extract withdrawal error notification helpers into ErrorMessage module
|
|
17
|
+
- 7743d5b: Extract WithdrawRecipientAddress into its own module and allow multi-method config to disable connected wallet
|
|
18
|
+
- 7743d5b: Use config source chain for withdrawal source token price lookup
|
|
19
|
+
- Updated dependencies [ec97ba2]
|
|
20
|
+
- @funkit/fun-relay@2.7.2
|
|
21
|
+
|
|
3
22
|
## 9.12.0
|
|
4
23
|
|
|
5
24
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -10,3 +10,24 @@ The `@funkit/connect` package elevates decentralize applications via web2 & web3
|
|
|
10
10
|
### 📝 Note
|
|
11
11
|
|
|
12
12
|
This package is currently in closed beta. To learn more, reach out to [developers@fun.xyz](mailto:developers@fun.xyz).
|
|
13
|
+
|
|
14
|
+
## Development
|
|
15
|
+
|
|
16
|
+
### Running tests
|
|
17
|
+
|
|
18
|
+
From the monorepo root:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
# Run all connect tests once
|
|
22
|
+
pnpm --filter=@funkit/connect test
|
|
23
|
+
|
|
24
|
+
# Run with coverage (terminal summary + lcov + HTML report)
|
|
25
|
+
pnpm --filter=@funkit/connect test:coverage
|
|
26
|
+
|
|
27
|
+
# Open the Vitest UI (interactive dashboard with live coverage heatmap)
|
|
28
|
+
pnpm --filter=@funkit/connect test:ui
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
After `test:coverage`, open `packages/connect/coverage/index.html` to browse the HTML report. The `coverage/` directory is gitignored.
|
|
32
|
+
|
|
33
|
+
Coverage is collected by [`@vitest/coverage-v8`](https://vitest.dev/guide/coverage) and excludes generated files, Storybook stories, vanilla-extract style files (`*.css.ts`), and translation JSON. Update the `coverage` block in `vitest.config.ts` to tweak include/exclude patterns.
|
package/dist/clients/lighter.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const funOptionBoxStyle: Record<"
|
|
1
|
+
export declare const funOptionBoxStyle: Record<"baseStyle" | "compactListStyle" | "defaultBorder" | "defaultModeNotActiveBorder" | "activeBorder" | "disabledOptionBorder" | "defaultBackground" | "activeBackground" | "uninteractiveBackground", string>;
|
|
@@ -1,47 +1,7 @@
|
|
|
1
1
|
import { type DirectExecution } from '@funkit/api-base';
|
|
2
|
+
import { type UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import type { NotificationVariant } from '../../modals/CheckoutModal/TransferToken/types';
|
|
2
4
|
import { type PurifiedCheckoutHistoryItem } from '../../utils/purifyCheckoutHistoryItem';
|
|
3
|
-
/**
|
|
4
|
-
* Query parameters for the useRecentDeposits hook.
|
|
5
|
-
*/
|
|
6
|
-
interface RecentDirectExecutionsQuery {
|
|
7
|
-
/**
|
|
8
|
-
* Controls whether the hook should fetch and return data.
|
|
9
|
-
* When false, the query is disabled and no data will be fetched.
|
|
10
|
-
*/
|
|
11
|
-
isVisible: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Optional filter function to further refine which deposits are returned.
|
|
14
|
-
* WARNING: Must be a stable reference (wrap in useMemo), otherwise the hook will constantly re-render.
|
|
15
|
-
* @param de - The DirectExecution to filter
|
|
16
|
-
* @returns true to include the deposit, false to exclude it
|
|
17
|
-
*/
|
|
18
|
-
memoizedFilterFunc?: (de: DirectExecution) => boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Maximum number of deposits to fetch from the API.
|
|
21
|
-
* @default 5
|
|
22
|
-
*/
|
|
23
|
-
fetchSize?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Custom cutoff time in milliseconds for determining which deposits are "recent".
|
|
26
|
-
* Deposits created after this timestamp will be included.
|
|
27
|
-
* If not provided, uses Fun's default strategy.
|
|
28
|
-
*/
|
|
29
|
-
cutOffTimeMs?: number;
|
|
30
|
-
/**
|
|
31
|
-
* API key for authenticating requests to Fun's API server.
|
|
32
|
-
*/
|
|
33
|
-
apiKey: string;
|
|
34
|
-
/**
|
|
35
|
-
* User ID for which to fetch direct executions.
|
|
36
|
-
* Usually user's connected wallet address.
|
|
37
|
-
*/
|
|
38
|
-
userId: string;
|
|
39
|
-
/**
|
|
40
|
-
* Interval in milliseconds for how often to refetch the data.
|
|
41
|
-
* Determines the polling frequency for keeping deposit data up to date.
|
|
42
|
-
*/
|
|
43
|
-
refreshIntervalMs: number;
|
|
44
|
-
}
|
|
45
5
|
export interface MergedMultiStepDirectExecution extends DirectExecution {
|
|
46
6
|
/**
|
|
47
7
|
* In a multi-step DE chain, represents the latest **present** DE of the chain.
|
|
@@ -53,15 +13,45 @@ export interface MergedMultiStepDirectExecution extends DirectExecution {
|
|
|
53
13
|
export declare function mergeMultiStepDirectExecutions(directExecutions: DirectExecution[]): MergedMultiStepDirectExecution[];
|
|
54
14
|
export declare function isTokenTransferDirectExecution(de: DirectExecution): boolean;
|
|
55
15
|
export declare function isWithdrawalDirectExecution(de: DirectExecution): boolean;
|
|
56
|
-
type DefaultDEQueryKey = 'apiKey' | 'userId' | 'refreshIntervalMs';
|
|
57
|
-
export type RecentDEQuerySimplified = Omit<RecentDirectExecutionsQuery, DefaultDEQueryKey>;
|
|
58
16
|
/**
|
|
59
|
-
*
|
|
17
|
+
* Pure transform: filters, merges multi-step chains, and sorts direct executions.
|
|
18
|
+
* Testable without React.
|
|
60
19
|
*/
|
|
61
|
-
export declare
|
|
62
|
-
|
|
63
|
-
|
|
20
|
+
export declare function processRecentDepositsForNotifications(directExecutions: DirectExecution[] | undefined, { createdAfterMs, cutOffTimeMs, variant, }?: {
|
|
21
|
+
createdAfterMs?: number;
|
|
22
|
+
cutOffTimeMs?: number;
|
|
23
|
+
variant?: NotificationVariant;
|
|
24
|
+
}): MergedMultiStepDirectExecution[] | undefined;
|
|
25
|
+
interface RecentDepositsApiQuery {
|
|
26
|
+
isVisible: boolean;
|
|
27
|
+
fetchSize?: number;
|
|
28
|
+
apiKey: string;
|
|
29
|
+
userId: string;
|
|
30
|
+
refreshIntervalMs: number;
|
|
31
|
+
}
|
|
32
|
+
type DefaultDEQueryKey = 'apiKey' | 'userId' | 'refreshIntervalMs';
|
|
33
|
+
export type RecentDEQuerySimplified = {
|
|
34
|
+
isVisible: boolean;
|
|
35
|
+
fetchSize?: number;
|
|
64
36
|
};
|
|
37
|
+
/**
|
|
38
|
+
* @returns raw direct executions for the current user (no filtering or transforms applied)
|
|
39
|
+
*/
|
|
40
|
+
export declare const useRecentDeposits: ({ isVisible, fetchSize, }: RecentDEQuerySimplified) => UseQueryResult<DirectExecution[]>;
|
|
41
|
+
/**
|
|
42
|
+
* Full explicit-params version of `useRecentDeposits` for use outside FunkitProvider context.
|
|
43
|
+
* Used by SDK wrappers.
|
|
44
|
+
*/
|
|
45
|
+
interface RecentDirectExecutionsQuery extends RecentDepositsApiQuery {
|
|
46
|
+
cutOffTimeMs?: number;
|
|
47
|
+
/**
|
|
48
|
+
* Optional filter function to further refine which deposits are returned.
|
|
49
|
+
* WARNING: Must be a stable reference (wrap in useMemo), otherwise the hook will constantly re-render.
|
|
50
|
+
* @param de - The DirectExecution to filter
|
|
51
|
+
* @returns true to include the deposit, false to exclude it
|
|
52
|
+
*/
|
|
53
|
+
memoizedFilterFunc?: (de: DirectExecution) => boolean;
|
|
54
|
+
}
|
|
65
55
|
/**
|
|
66
56
|
* Hook for SDK users to fetch recent deposits/direct executions with automatic context integration.
|
|
67
57
|
*
|
|
@@ -85,7 +75,7 @@ export declare const useRecentDeposits: ({ isVisible, memoizedFilterFunc, fetchS
|
|
|
85
75
|
* }
|
|
86
76
|
* ```
|
|
87
77
|
*/
|
|
88
|
-
export declare function useFunkitRecentDeposits(query:
|
|
78
|
+
export declare function useFunkitRecentDeposits(query: Omit<RecentDirectExecutionsQuery, DefaultDEQueryKey>): {
|
|
89
79
|
data: PurifiedCheckoutHistoryItem[] | undefined;
|
|
90
80
|
};
|
|
91
81
|
/**
|