@funkit/connect 11.3.0 → 11.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/clients/{chunk-DGBIV3ZS.js → chunk-B7UU2ETA.js} +0 -13
  3. package/dist/clients/{chunk-L2XMI4EX.js → chunk-BB5FHA47.js} +13 -12
  4. package/dist/clients/chunk-MSLPLXR2.js +30 -0
  5. package/dist/clients/{chunk-QQEGNLGD.js → chunk-TYG42JRZ.js} +4 -4
  6. package/dist/clients/{chunk-46L2KJJ4.js → chunk-UMU5S2WF.js} +34 -43
  7. package/dist/clients/internal/nado/withdrawalCallback.js +4 -11
  8. package/dist/clients/internal/nado/withdrawalConfig.d.ts +3 -1
  9. package/dist/clients/internal/nado/withdrawalConfig.js +2 -3
  10. package/dist/clients/internal/nado/withdrawalErrors.d.ts +6 -10
  11. package/dist/clients/internal/nado/withdrawalErrors.js +1 -2
  12. package/dist/clients/internal/nado/withdrawalForm.css +44 -36
  13. package/dist/clients/internal/nado/withdrawalForm.d.ts +1 -1
  14. package/dist/clients/internal/nado/withdrawalForm.js +20 -73
  15. package/dist/clients/internal/nado/withdrawalStatus.js +4 -8
  16. package/dist/clients/lighter.css +44 -36
  17. package/dist/clients/lighter.d.ts +0 -31
  18. package/dist/clients/lighter.js +10 -102
  19. package/dist/clients/nado.d.ts +3 -1
  20. package/dist/clients/nado.js +8 -15
  21. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +47 -39
  22. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +4 -4
  23. package/dist/clients/polymarket/index.css +47 -39
  24. package/dist/clients/polymarket/index.js +9 -9
  25. package/dist/components/Dropdown/BaseDropdown.css.d.ts +1 -0
  26. package/dist/components/Dropdown/BaseDropdown.d.ts +0 -1
  27. package/dist/domains/checkout.d.ts +6 -1
  28. package/dist/hooks/track/analytics/events.d.ts +19 -9
  29. package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +1 -0
  30. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +11 -3
  31. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +3 -33
  32. package/dist/hooks/track/useTrackV2.d.ts +2 -0
  33. package/dist/hooks/useAssetPrice.d.ts +1 -6
  34. package/dist/hooks/useBluvo.d.ts +7 -2
  35. package/dist/index.css +44 -36
  36. package/dist/index.js +922 -1205
  37. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +5 -11
  38. package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -1
  39. package/dist/providers/FunkitStatsigProvider.d.ts +1 -1
  40. package/dist/utils/withdrawal.d.ts +1 -21
  41. package/dist/wallets/walletConnectors/index.js +32 -32
  42. package/package.json +6 -6
  43. package/dist/clients/chunk-2576N7PQ.js +0 -44
  44. package/dist/clients/chunk-3P2C436B.js +0 -20
  45. package/dist/clients/chunk-63XTVHO3.js +0 -19
  46. package/dist/clients/chunk-6T6URLBM.js +0 -33
  47. package/dist/clients/chunk-FM7SFGAV.js +0 -106
  48. package/dist/clients/chunk-JFDRLSYM.js +0 -42
  49. package/dist/clients/chunk-TZGKB6WY.js +0 -160
  50. package/dist/clients/chunk-VIAEAD75.js +0 -61
  51. package/dist/clients/chunk-WZRW6WUM.js +0 -112
  52. package/dist/clients/chunk-Z7HTQFEO.js +0 -69
  53. package/dist/clients/internal/nado/consts.d.ts +0 -22
  54. package/dist/clients/internal/nado/consts.js +0 -15
  55. package/dist/clients/internal/nado/encoding.d.ts +0 -25
  56. package/dist/clients/internal/nado/encoding.js +0 -11
  57. package/dist/clients/internal/nado/errors.d.ts +0 -68
  58. package/dist/clients/internal/nado/errors.js +0 -19
  59. package/dist/clients/internal/nado/fetch.d.ts +0 -15
  60. package/dist/clients/internal/nado/fetch.js +0 -9
  61. package/dist/clients/internal/nado/gateway.d.ts +0 -61
  62. package/dist/clients/internal/nado/gateway.js +0 -17
  63. package/dist/clients/internal/nado/hooks.d.ts +0 -208
  64. package/dist/clients/internal/nado/hooks.js +0 -21
  65. package/dist/clients/internal/nado/indexer.d.ts +0 -43
  66. package/dist/clients/internal/nado/indexer.js +0 -13
  67. package/dist/clients/internal/nado/typedData.d.ts +0 -80
  68. package/dist/clients/internal/nado/typedData.js +0 -10
  69. package/dist/clients/internal/nado/withdrawalTypes.d.ts +0 -49
  70. package/dist/clients/internal/nado/withdrawalTypes.js +0 -1
  71. package/dist/utils/safeBigInt.d.ts +0 -5
@@ -1,208 +0,0 @@
1
- /**
2
- * React-query hooks over the Nado gateway/indexer. Poll cadences are budgeted
3
- * against Nado's IP rate limit (2400 query-weight/min): an open modal spends
4
- * ~10 weight/min on the selected product's max; the indexer poll runs only
5
- * while a settlement is pending.
6
- *
7
- * @see {@link https://docs.nado.xyz/developer-resources/api/rate-limits | Nado rate limits}
8
- */
9
- import type { Hex } from 'viem';
10
- /**
11
- * React-query owns retries (the fetch layer never retries) — up to 2 with
12
- * backoff, except deterministic api failures, 429s (retrying hammers the
13
- * limit we just tripped), and timeouts (the caller already waited 30s; the
14
- * next scheduled poll is the retry).
15
- */
16
- export declare function shouldRetryNadoQuery(failureCount: number, error: unknown): boolean;
17
- export declare function useNadoMaxWithdrawable(params: {
18
- productId: number | undefined;
19
- sender: Hex | undefined;
20
- spotLeverage: boolean;
21
- }): import("@tanstack/react-query").UseQueryResult<string, unknown>;
22
- /**
23
- * Drops every cached max — prefix match, since each product and borrow state
24
- * holds its own entry — so a follow-up withdrawal sees the debited balance
25
- * rather than waiting out the refetch interval.
26
- */
27
- export declare function useInvalidateNadoMaxWithdrawable(): () => void;
28
- export declare function useNadoFeeRates(sender: Hex | undefined): import("@tanstack/react-query").UseQueryResult<import("./gateway").NadoFeeRates, unknown>;
29
- export interface NadoSettlementStatus {
30
- /** True once the sequencer has recorded the withdrawal we signed. */
31
- isSequenced: boolean;
32
- /** Unix seconds of the sequenced tx, when available. */
33
- sequencedAt: number | undefined;
34
- }
35
- /**
36
- * Poll the indexer for the withdrawal signed with `nonce` until it appears
37
- * or the wall-clock timeout passes. `isTimedOut` flips after the cap — show
38
- * a "still pending, check Nado" state.
39
- */
40
- export declare function useNadoSettlementStatus(params: {
41
- subaccount: Hex | undefined;
42
- nonce: bigint | undefined;
43
- /** When the withdrawal was submitted — anchors the timeout. */
44
- submittedAtMs: number | undefined;
45
- enabled: boolean;
46
- }): {
47
- isTimedOut: boolean;
48
- data: NadoSettlementStatus;
49
- error: Error;
50
- isError: true;
51
- isPending: false;
52
- isLoading: false;
53
- isLoadingError: false;
54
- isRefetchError: true;
55
- isSuccess: false;
56
- isPlaceholderData: false;
57
- status: "error";
58
- dataUpdatedAt: number;
59
- errorUpdatedAt: number;
60
- failureCount: number;
61
- failureReason: Error | null;
62
- errorUpdateCount: number;
63
- isFetched: boolean;
64
- isFetchedAfterMount: boolean;
65
- isFetching: boolean;
66
- isInitialLoading: boolean;
67
- isPaused: boolean;
68
- isRefetching: boolean;
69
- isStale: boolean;
70
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
71
- fetchStatus: import("@tanstack/react-query").FetchStatus;
72
- promise: Promise<NadoSettlementStatus>;
73
- } | {
74
- isTimedOut: boolean;
75
- data: NadoSettlementStatus;
76
- error: null;
77
- isError: false;
78
- isPending: false;
79
- isLoading: false;
80
- isLoadingError: false;
81
- isRefetchError: false;
82
- isSuccess: true;
83
- isPlaceholderData: false;
84
- status: "success";
85
- dataUpdatedAt: number;
86
- errorUpdatedAt: number;
87
- failureCount: number;
88
- failureReason: Error | null;
89
- errorUpdateCount: number;
90
- isFetched: boolean;
91
- isFetchedAfterMount: boolean;
92
- isFetching: boolean;
93
- isInitialLoading: boolean;
94
- isPaused: boolean;
95
- isRefetching: boolean;
96
- isStale: boolean;
97
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
98
- fetchStatus: import("@tanstack/react-query").FetchStatus;
99
- promise: Promise<NadoSettlementStatus>;
100
- } | {
101
- isTimedOut: boolean;
102
- data: undefined;
103
- error: Error;
104
- isError: true;
105
- isPending: false;
106
- isLoading: false;
107
- isLoadingError: true;
108
- isRefetchError: false;
109
- isSuccess: false;
110
- isPlaceholderData: false;
111
- status: "error";
112
- dataUpdatedAt: number;
113
- errorUpdatedAt: number;
114
- failureCount: number;
115
- failureReason: Error | null;
116
- errorUpdateCount: number;
117
- isFetched: boolean;
118
- isFetchedAfterMount: boolean;
119
- isFetching: boolean;
120
- isInitialLoading: boolean;
121
- isPaused: boolean;
122
- isRefetching: boolean;
123
- isStale: boolean;
124
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
125
- fetchStatus: import("@tanstack/react-query").FetchStatus;
126
- promise: Promise<NadoSettlementStatus>;
127
- } | {
128
- isTimedOut: boolean;
129
- data: undefined;
130
- error: null;
131
- isError: false;
132
- isPending: true;
133
- isLoading: true;
134
- isLoadingError: false;
135
- isRefetchError: false;
136
- isSuccess: false;
137
- isPlaceholderData: false;
138
- status: "pending";
139
- dataUpdatedAt: number;
140
- errorUpdatedAt: number;
141
- failureCount: number;
142
- failureReason: Error | null;
143
- errorUpdateCount: number;
144
- isFetched: boolean;
145
- isFetchedAfterMount: boolean;
146
- isFetching: boolean;
147
- isInitialLoading: boolean;
148
- isPaused: boolean;
149
- isRefetching: boolean;
150
- isStale: boolean;
151
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
152
- fetchStatus: import("@tanstack/react-query").FetchStatus;
153
- promise: Promise<NadoSettlementStatus>;
154
- } | {
155
- isTimedOut: boolean;
156
- data: undefined;
157
- error: null;
158
- isError: false;
159
- isPending: true;
160
- isLoadingError: false;
161
- isRefetchError: false;
162
- isSuccess: false;
163
- isPlaceholderData: false;
164
- status: "pending";
165
- dataUpdatedAt: number;
166
- errorUpdatedAt: number;
167
- failureCount: number;
168
- failureReason: Error | null;
169
- errorUpdateCount: number;
170
- isFetched: boolean;
171
- isFetchedAfterMount: boolean;
172
- isFetching: boolean;
173
- isLoading: boolean;
174
- isInitialLoading: boolean;
175
- isPaused: boolean;
176
- isRefetching: boolean;
177
- isStale: boolean;
178
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
179
- fetchStatus: import("@tanstack/react-query").FetchStatus;
180
- promise: Promise<NadoSettlementStatus>;
181
- } | {
182
- isTimedOut: boolean;
183
- data: NadoSettlementStatus;
184
- isError: false;
185
- error: null;
186
- isPending: false;
187
- isLoading: false;
188
- isLoadingError: false;
189
- isRefetchError: false;
190
- isSuccess: true;
191
- isPlaceholderData: true;
192
- status: "success";
193
- dataUpdatedAt: number;
194
- errorUpdatedAt: number;
195
- failureCount: number;
196
- failureReason: Error | null;
197
- errorUpdateCount: number;
198
- isFetched: boolean;
199
- isFetchedAfterMount: boolean;
200
- isFetching: boolean;
201
- isInitialLoading: boolean;
202
- isPaused: boolean;
203
- isRefetching: boolean;
204
- isStale: boolean;
205
- refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
206
- fetchStatus: import("@tanstack/react-query").FetchStatus;
207
- promise: Promise<NadoSettlementStatus>;
208
- };
@@ -1,21 +0,0 @@
1
- "use client";
2
- import {
3
- shouldRetryNadoQuery,
4
- useInvalidateNadoMaxWithdrawable,
5
- useNadoFeeRates,
6
- useNadoMaxWithdrawable,
7
- useNadoSettlementStatus
8
- } from "../../chunk-FM7SFGAV.js";
9
- import "../../chunk-JFDRLSYM.js";
10
- import "../../chunk-TZGKB6WY.js";
11
- import "../../chunk-3P2C436B.js";
12
- import "../../chunk-WZRW6WUM.js";
13
- import "../../chunk-Z7HTQFEO.js";
14
- import "../../chunk-AHYOV7AV.js";
15
- export {
16
- shouldRetryNadoQuery,
17
- useInvalidateNadoMaxWithdrawable,
18
- useNadoFeeRates,
19
- useNadoMaxWithdrawable,
20
- useNadoSettlementStatus
21
- };
@@ -1,43 +0,0 @@
1
- /**
2
- * Nado archive/indexer queries — tracks a submitted withdrawal through
3
- * sequencing so the UI can show settlement progress.
4
- *
5
- * @see {@link https://docs.nado.xyz/developer-resources/api/archive-indexer | Nado archive indexer API}
6
- */
7
- import type { Hex } from 'viem';
8
- interface NadoWithdrawalTxPayload {
9
- sender: Hex;
10
- product_id: number;
11
- /** Raw base units (native decimals). */
12
- amount: string;
13
- nonce: number | string;
14
- }
15
- export interface NadoIndexerTx {
16
- tx: {
17
- withdraw_collateral?: NadoWithdrawalTxPayload;
18
- withdraw_collateral_v2?: NadoWithdrawalTxPayload;
19
- };
20
- submission_idx: string;
21
- /** Unix seconds. */
22
- timestamp: string;
23
- }
24
- export interface NadoWithdrawalEventsResponse {
25
- /** Present in the response; settlement matching only reads `txs`. */
26
- events: unknown[];
27
- txs: NadoIndexerTx[];
28
- }
29
- /**
30
- * Sequenced withdraw-collateral (v1 + v2) events for a subaccount, newest
31
- * first. Unlike the gateway, a successful indexer response returns the
32
- * payload bare — only failures carry the `{status, error}` wrapper.
33
- */
34
- export declare function getNadoWithdrawalEvents(params: {
35
- subaccount: Hex;
36
- limit?: number;
37
- }, signal?: AbortSignal): Promise<NadoWithdrawalEventsResponse>;
38
- /**
39
- * Find the sequenced tx for a withdrawal we submitted, matched by the signed
40
- * nonce. Presence means Nado's sequencer accepted it.
41
- */
42
- export declare function findSettlementForNonce(txs: NadoIndexerTx[], nonce: bigint): NadoIndexerTx | undefined;
43
- export {};
@@ -1,13 +0,0 @@
1
- "use client";
2
- import {
3
- findSettlementForNonce,
4
- getNadoWithdrawalEvents
5
- } from "../../chunk-JFDRLSYM.js";
6
- import "../../chunk-3P2C436B.js";
7
- import "../../chunk-WZRW6WUM.js";
8
- import "../../chunk-Z7HTQFEO.js";
9
- import "../../chunk-AHYOV7AV.js";
10
- export {
11
- findSettlementForNonce,
12
- getNadoWithdrawalEvents
13
- };
@@ -1,80 +0,0 @@
1
- /**
2
- * EIP-712 typed data for Nado's `withdraw_collateral_v2` execute.
3
- *
4
- * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/executes/withdraw-collateral | Nado withdraw collateral execute}
5
- */
6
- import type { Address, Hex } from 'viem';
7
- export declare const WITHDRAW_COLLATERAL_V2_TYPES: {
8
- readonly WithdrawCollateralV2: readonly [{
9
- readonly name: "sender";
10
- readonly type: "bytes32";
11
- }, {
12
- readonly name: "productId";
13
- readonly type: "uint32";
14
- }, {
15
- readonly name: "amount";
16
- readonly type: "uint128";
17
- }, {
18
- readonly name: "nonce";
19
- readonly type: "uint64";
20
- }, {
21
- readonly name: "sendTo";
22
- readonly type: "address";
23
- }, {
24
- readonly name: "appendix";
25
- readonly type: "uint128";
26
- }];
27
- };
28
- export interface WithdrawCollateralV2Params {
29
- /** Packed subaccount id (see `buildNadoSubaccountId`). */
30
- sender: Hex;
31
- productId: number;
32
- /** Raw base units in the token's native decimals — not x18. */
33
- amount: bigint;
34
- /** `tx_nonce` from the nonces query, fetched immediately before signing. */
35
- nonce: bigint;
36
- /** Payout recipient. Non-zero forces owner-wallet signing on Nado's side. */
37
- sendTo: Address;
38
- }
39
- /**
40
- * Typed data for Nado's `withdraw_collateral_v2` execute. `appendix` is
41
- * reserved by Nado and must be 0.
42
- */
43
- export declare function buildWithdrawCollateralV2TypedData(params: WithdrawCollateralV2Params): {
44
- readonly domain: {
45
- readonly name: "Nado";
46
- readonly version: "0.0.1";
47
- readonly chainId: 57073;
48
- readonly verifyingContract: `0x${string}`;
49
- };
50
- readonly types: {
51
- readonly WithdrawCollateralV2: readonly [{
52
- readonly name: "sender";
53
- readonly type: "bytes32";
54
- }, {
55
- readonly name: "productId";
56
- readonly type: "uint32";
57
- }, {
58
- readonly name: "amount";
59
- readonly type: "uint128";
60
- }, {
61
- readonly name: "nonce";
62
- readonly type: "uint64";
63
- }, {
64
- readonly name: "sendTo";
65
- readonly type: "address";
66
- }, {
67
- readonly name: "appendix";
68
- readonly type: "uint128";
69
- }];
70
- };
71
- readonly primaryType: "WithdrawCollateralV2";
72
- readonly message: {
73
- readonly sender: `0x${string}`;
74
- readonly productId: number;
75
- readonly amount: bigint;
76
- readonly nonce: bigint;
77
- readonly sendTo: `0x${string}`;
78
- readonly appendix: 0n;
79
- };
80
- };
@@ -1,10 +0,0 @@
1
- "use client";
2
- import {
3
- WITHDRAW_COLLATERAL_V2_TYPES,
4
- buildWithdrawCollateralV2TypedData
5
- } from "../../chunk-2576N7PQ.js";
6
- import "../../chunk-3P2C436B.js";
7
- export {
8
- WITHDRAW_COLLATERAL_V2_TYPES,
9
- buildWithdrawCollateralV2TypedData
10
- };
@@ -1,49 +0,0 @@
1
- /**
2
- * Nado-specific members of the shared withdrawal discriminated unions. Kept in
3
- * `clients/internal/nado/` (customer-isolated) and imported by the shared
4
- * `WithdrawalCustomerData` / `WithdrawalCustomerConfig` aliases in
5
- * `providers/FunkitCheckoutContext`. viem-only imports — no provider deps — so
6
- * the shared→customer reference stays cycle-free.
7
- */
8
- import type { Address, Hex } from 'viem';
9
- /**
10
- * The dropdown pick, flattened out of the config's `sourceTokens`. Travels whole
11
- * so identity, decimals, and product id can't be resolved from disagreeing
12
- * sources — two lookups that disagree would sign against the wrong asset or off
13
- * by a power of ten.
14
- */
15
- export interface NadoWithdrawalSourceOption {
16
- /** Nado's own key for the asset — every subaccount query is keyed on it. */
17
- productId: number;
18
- symbol: string;
19
- decimals: number;
20
- tokenAddress: Address;
21
- tokenChainId: string;
22
- iconSrc: string | undefined;
23
- }
24
- /**
25
- * Nado per-submission form selections threaded to the withdrawal callback (the
26
- * static config can't know them).
27
- * - `spotLeverage` must be explicit — Nado treats an absent value as borrowing,
28
- * so `false` fails instead of opening a borrow.
29
- * - `sequencerFeeTokenAmount` pins the fee the screen displayed, so the callback
30
- * signs the same net amount instead of re-reading a possibly-refreshed cache.
31
- * - `selectedSourceToken` is the live dropdown pick. The shared form data carries
32
- * the config's static `sourceTokenSymbol` instead, which is stale for a
33
- * multi-source flow.
34
- */
35
- export interface NadoWithdrawalCustomerData {
36
- customerName: 'nado';
37
- spotLeverage: boolean;
38
- /** Sequencer fee in the product's token units, as shown at submit. */
39
- sequencerFeeTokenAmount: number;
40
- selectedSourceToken: NadoWithdrawalSourceOption;
41
- }
42
- /** Nado config-level identity, supplied by the integrator on the withdrawal config. */
43
- export interface NadoWithdrawalCustomerConfig {
44
- customerName: 'nado';
45
- /** Connected wallet — must be the signer (Nado rejects linked signers). */
46
- walletAddress: Address;
47
- /** Packed id of the active subaccount (`buildNadoSubaccountId`); the EIP-712/execute `sender`. */
48
- subaccount: Hex;
49
- }
@@ -1 +0,0 @@
1
- "use client";
@@ -1,5 +0,0 @@
1
- /**
2
- * Convert a value to bigint without throwing. Accepts bigint, integer number,
3
- * or an integer-valued string. Anything else returns the fallback.
4
- */
5
- export declare function safeBigInt(value: unknown, fallback: bigint): bigint;