@funkit/connect 11.4.0 → 11.5.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/dist/clients/{chunk-5MY7WMEJ.js → chunk-3U55HYGJ.js} +2 -2
  3. package/dist/clients/{chunk-BPDLF2R6.js → chunk-DSZHYQPX.js} +1 -1
  4. package/dist/clients/chunk-MSLPLXR2.js +30 -0
  5. package/dist/clients/{chunk-3Y5EIONT.js → chunk-UMU5S2WF.js} +30 -39
  6. package/dist/clients/chunk-WCQ6HJ27.js +13 -0
  7. package/dist/clients/{chunk-XJTRLB7W.js → chunk-ZEDRWRYA.js} +15 -13
  8. package/dist/clients/fanatics.js +4 -4
  9. package/dist/clients/internal/nado/withdrawalCallback.js +2 -9
  10. package/dist/clients/internal/nado/withdrawalConfig.d.ts +4 -9
  11. package/dist/clients/internal/nado/withdrawalConfig.js +3 -7
  12. package/dist/clients/internal/nado/withdrawalErrors.d.ts +6 -10
  13. package/dist/clients/internal/nado/withdrawalErrors.js +1 -2
  14. package/dist/clients/internal/nado/withdrawalForm.css +82 -74
  15. package/dist/clients/internal/nado/withdrawalForm.d.ts +1 -1
  16. package/dist/clients/internal/nado/withdrawalForm.js +12 -45
  17. package/dist/clients/internal/nado/withdrawalStatus.d.ts +1 -15
  18. package/dist/clients/internal/nado/withdrawalStatus.js +11 -61
  19. package/dist/clients/lighter.css +260 -252
  20. package/dist/clients/lighter.js +6 -9
  21. package/dist/clients/nado.d.ts +2 -2
  22. package/dist/clients/nado.js +10 -16
  23. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +263 -255
  24. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +3 -3
  25. package/dist/clients/polymarket/index.css +263 -255
  26. package/dist/clients/polymarket/index.js +3 -3
  27. package/dist/components/Dropdown/BaseDropdown.css.d.ts +1 -0
  28. package/dist/components/Dropdown/BaseDropdown.d.ts +0 -1
  29. package/dist/consts/funkit.d.ts +2 -0
  30. package/dist/hooks/track/analytics/events.d.ts +35 -3
  31. package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +1 -0
  32. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +11 -3
  33. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +1 -0
  34. package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +24 -1
  35. package/dist/hooks/useBluvo.d.ts +7 -2
  36. package/dist/hooks/useSwappedTheme.d.ts +3 -0
  37. package/dist/index.css +93 -85
  38. package/dist/index.js +12822 -12797
  39. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +5 -11
  40. package/dist/modals/WithdrawalModal/RecipientAddress.d.ts +3 -1
  41. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
  42. package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -1
  43. package/dist/providers/FunkitProvider.d.ts +1 -0
  44. package/dist/shadow/adoptStyles.d.ts +5 -0
  45. package/dist/shadow-css.d.ts +1 -0
  46. package/dist/shadow-css.js +2 -0
  47. package/dist/utils/swapped.d.ts +8 -6
  48. package/dist/wallets/walletConnectors/index.js +9 -9
  49. package/package.json +11 -6
  50. package/shadow-css/package.json +3 -0
  51. package/dist/clients/chunk-2576N7PQ.js +0 -44
  52. package/dist/clients/chunk-3P2C436B.js +0 -20
  53. package/dist/clients/chunk-63XTVHO3.js +0 -19
  54. package/dist/clients/chunk-6T6URLBM.js +0 -33
  55. package/dist/clients/chunk-EQFVPSR2.js +0 -40
  56. package/dist/clients/chunk-FM7SFGAV.js +0 -106
  57. package/dist/clients/chunk-JFDRLSYM.js +0 -42
  58. package/dist/clients/chunk-TZGKB6WY.js +0 -160
  59. package/dist/clients/chunk-VIAEAD75.js +0 -61
  60. package/dist/clients/chunk-WZRW6WUM.js +0 -112
  61. package/dist/clients/chunk-Z7HTQFEO.js +0 -69
  62. package/dist/clients/internal/nado/consts.d.ts +0 -22
  63. package/dist/clients/internal/nado/consts.js +0 -15
  64. package/dist/clients/internal/nado/encoding.d.ts +0 -25
  65. package/dist/clients/internal/nado/encoding.js +0 -11
  66. package/dist/clients/internal/nado/errors.d.ts +0 -68
  67. package/dist/clients/internal/nado/errors.js +0 -19
  68. package/dist/clients/internal/nado/fetch.d.ts +0 -15
  69. package/dist/clients/internal/nado/fetch.js +0 -9
  70. package/dist/clients/internal/nado/gateway.d.ts +0 -61
  71. package/dist/clients/internal/nado/gateway.js +0 -17
  72. package/dist/clients/internal/nado/hooks.d.ts +0 -208
  73. package/dist/clients/internal/nado/hooks.js +0 -21
  74. package/dist/clients/internal/nado/indexer.d.ts +0 -43
  75. package/dist/clients/internal/nado/indexer.js +0 -13
  76. package/dist/clients/internal/nado/typedData.d.ts +0 -80
  77. package/dist/clients/internal/nado/typedData.js +0 -10
  78. package/dist/clients/internal/nado/withdrawalTypes.d.ts +0 -49
  79. package/dist/clients/internal/nado/withdrawalTypes.js +0 -1
  80. package/dist/utils/safeBigInt.d.ts +0 -5
@@ -1,112 +0,0 @@
1
- "use client";
2
- import {
3
- NadoGatewayError
4
- } from "./chunk-Z7HTQFEO.js";
5
- import {
6
- logger
7
- } from "./chunk-AHYOV7AV.js";
8
-
9
- // src/clients/internal/nado/fetch.ts
10
- var DEFAULT_TIMEOUT_MS = 3e4;
11
- var LOGGED_BODY_MAX_CHARS = 500;
12
- function isTimeoutError(error) {
13
- return error instanceof DOMException && error.name === "TimeoutError";
14
- }
15
- function createAbortWithTimeout(callerSignal, ms) {
16
- const controller = new AbortController();
17
- const id = setTimeout(
18
- () => controller.abort(
19
- new DOMException("Nado request timed out", "TimeoutError")
20
- ),
21
- ms
22
- );
23
- const propagateAbort = () => controller.abort(callerSignal?.reason);
24
- if (callerSignal?.aborted) {
25
- propagateAbort();
26
- } else {
27
- callerSignal?.addEventListener("abort", propagateAbort);
28
- }
29
- return {
30
- signal: controller.signal,
31
- cleanup: () => {
32
- clearTimeout(id);
33
- callerSignal?.removeEventListener("abort", propagateAbort);
34
- }
35
- };
36
- }
37
- async function nadoFetch(params) {
38
- const { uri, method, body, signal } = params;
39
- const startTimeMs = Date.now();
40
- const abort = createAbortWithTimeout(signal, DEFAULT_TIMEOUT_MS);
41
- let response;
42
- let responseText;
43
- try {
44
- response = await fetch(uri, {
45
- method,
46
- signal: abort.signal,
47
- ...body !== void 0 && {
48
- headers: { "Content-Type": "application/json" },
49
- body: JSON.stringify(body)
50
- }
51
- });
52
- responseText = await response.text();
53
- } catch (error) {
54
- if (!signal?.aborted) {
55
- logger.warn("nado:fetch_error", {
56
- uri,
57
- method,
58
- durationMs: Date.now() - startTimeMs,
59
- error
60
- });
61
- }
62
- throw new NadoGatewayError(
63
- `An error occurred trying to reach Nado: ${error}`,
64
- { kind: isTimeoutError(error) ? "timeout" : "transport" }
65
- );
66
- } finally {
67
- abort.cleanup();
68
- }
69
- if (!response.ok) {
70
- logger.warn("nado:fetch_failed", {
71
- uri,
72
- method,
73
- status: response.status,
74
- durationMs: Date.now() - startTimeMs,
75
- bodyPreview: responseText.slice(0, LOGGED_BODY_MAX_CHARS)
76
- });
77
- throw new NadoGatewayError(
78
- response.status === 429 ? "Nado rate limit exceeded" : `Nado request failed with status ${response.status}`,
79
- { kind: "http", httpStatus: response.status }
80
- );
81
- }
82
- let json;
83
- try {
84
- json = JSON.parse(responseText);
85
- } catch {
86
- json = void 0;
87
- }
88
- if (json == null) {
89
- logger.warn("nado:fetch_failed", {
90
- uri,
91
- method,
92
- status: response.status,
93
- bodyPreview: responseText.slice(0, LOGGED_BODY_MAX_CHARS)
94
- });
95
- throw new NadoGatewayError("Nado returned an invalid success response", {
96
- kind: "transport",
97
- httpStatus: response.status
98
- });
99
- }
100
- logger.debug("nado:fetch", {
101
- uri,
102
- method,
103
- status: response.status,
104
- durationMs: Date.now() - startTimeMs,
105
- bytes: responseText.length
106
- });
107
- return json;
108
- }
109
-
110
- export {
111
- nadoFetch
112
- };
@@ -1,69 +0,0 @@
1
- "use client";
2
-
3
- // src/clients/internal/nado/errors.ts
4
- var NADO_ERROR_CODES = {
5
- /** Amount would open a borrow with `spot_leverage: "false"`. */
6
- SPOT_EXECUTE_EXCEEDS_BORROW_LIMIT: 2017,
7
- /** Gateway-level nonce rejection. A consumed `tx_nonce` reverts in the EVM
8
- * instead — see `EVM_REVERT`. */
9
- INVALID_NONCE: 2022,
10
- /** Subaccount has never deposited, so it doesn't exist on Nado yet. */
11
- NO_PRIOR_DEPOSIT: 2024,
12
- /** Withdrawal tx not found at the given submission index. */
13
- INVALID_WITHDRAWAL_IDX: 3004,
14
- /** Fast-withdrawal validator signatures not aggregated yet. */
15
- NOT_ENOUGH_FAST_WITHDRAWAL_SIGNATURES: 3005,
16
- /** Protocol 24h withdrawal limit exceeded. */
17
- WITHDRAW_RISK: 4004,
18
- /** Catch-all EVM revert — the reason lives in the message, not the code.
19
- * A consumed `tx_nonce` lands here (see `parseNadoExpectedNonce`). */
20
- EVM_REVERT: 4003
21
- };
22
- var NadoGatewayError = class extends Error {
23
- constructor(message, options) {
24
- super(message);
25
- this.name = "NadoGatewayError";
26
- this.kind = options.kind;
27
- this.errorCode = options.errorCode;
28
- this.httpStatus = options.httpStatus;
29
- }
30
- };
31
- var NadoWithdrawalUnconfirmedError = class extends Error {
32
- constructor(message = "Nado withdrawal outcome could not be confirmed") {
33
- super(message);
34
- this.name = "NadoWithdrawalUnconfirmedError";
35
- }
36
- };
37
- function isNadoTransportError(error) {
38
- return error instanceof NadoGatewayError && error.kind === "transport";
39
- }
40
- function createNadoGatewayError(response, fallbackMessage) {
41
- return new NadoGatewayError(response.error ?? fallbackMessage, {
42
- kind: "api",
43
- errorCode: response.error_code
44
- });
45
- }
46
- function isNadoErrorCode(error, code) {
47
- return error instanceof NadoGatewayError && error.errorCode === code;
48
- }
49
- var NADO_EXPECTED_NONCE_PATTERN = /Invalid nonce: expected:\s*(\d+)/;
50
- function parseNadoExpectedNonce(error) {
51
- if (!(error instanceof NadoGatewayError) || error.errorCode !== NADO_ERROR_CODES.EVM_REVERT) {
52
- return void 0;
53
- }
54
- const captured = error.message.match(NADO_EXPECTED_NONCE_PATTERN)?.[1];
55
- if (captured === void 0) {
56
- return void 0;
57
- }
58
- return BigInt(captured);
59
- }
60
-
61
- export {
62
- NADO_ERROR_CODES,
63
- NadoGatewayError,
64
- NadoWithdrawalUnconfirmedError,
65
- isNadoTransportError,
66
- createNadoGatewayError,
67
- isNadoErrorCode,
68
- parseNadoExpectedNonce
69
- };
@@ -1,22 +0,0 @@
1
- /**
2
- * Nado deployment constants: prod endpoints and on-chain contract addresses.
3
- *
4
- * @see {@link https://docs.nado.xyz/developer-resources/api/endpoints | Nado API endpoints}
5
- * @see {@link https://docs.nado.xyz/more/contracts | Nado contract addresses}
6
- */
7
- /** Nado settles exclusively on Ink. */
8
- export declare const INK_CHAIN_ID: 57073;
9
- export declare const NADO_GATEWAY_URL = "https://gateway.prod.nado.xyz/v1";
10
- export declare const NADO_INDEXER_URL = "https://archive.prod.nado.xyz/v1";
11
- /**
12
- * Nado's Endpoint contract on Ink. Never called by this flow — it's the
13
- * EIP-712 domain `verifyingContract` both we and Nado's gateway hash
14
- * signatures over (orders verify against the product address instead).
15
- */
16
- export declare const NADO_EIP712_VERIFYING_CONTRACT_ADDRESS: `0x${string}`;
17
- /**
18
- * Attribution-only action type — generates no on-chain action. It only splits
19
- * the withdrawal UDA off from the deposit UDA so backend can tell them apart.
20
- * Restricted to Nado customer keys by the api-server validator.
21
- */
22
- export declare const NADO_WITHDRAWAL_ACTION_TYPE = "NADO_WITHDRAWAL";
@@ -1,15 +0,0 @@
1
- "use client";
2
- import {
3
- INK_CHAIN_ID,
4
- NADO_EIP712_VERIFYING_CONTRACT_ADDRESS,
5
- NADO_GATEWAY_URL,
6
- NADO_INDEXER_URL,
7
- NADO_WITHDRAWAL_ACTION_TYPE
8
- } from "../../chunk-3P2C436B.js";
9
- export {
10
- INK_CHAIN_ID,
11
- NADO_EIP712_VERIFYING_CONTRACT_ADDRESS,
12
- NADO_GATEWAY_URL,
13
- NADO_INDEXER_URL,
14
- NADO_WITHDRAWAL_ACTION_TYPE
15
- };
@@ -1,25 +0,0 @@
1
- /**
2
- * Nado wire encodings: bytes32 subaccount ids and x18 ↔ native-decimal
3
- * amount scaling.
4
- *
5
- * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/signing/examples | Nado signing examples}
6
- * @see {@link https://docs.nado.xyz/developer-resources/api/gateway/queries#amounts-and-prices | Nado amounts & prices (x18 convention)}
7
- */
8
- import { type Address, type Hex } from 'viem';
9
- /**
10
- * Nado subaccount id: 20-byte owner address ++ 12-byte ascii name,
11
- * zero-padded right. Every wallet's primary subaccount is named `default`
12
- * (auto-assigned on first interaction) — the empty name is a different subaccount.
13
- */
14
- export declare function buildNadoSubaccountId(owner: Address, name?: string): Hex;
15
- /**
16
- * x18 query amount → raw base units. Floors — never rounds up — so a
17
- * converted `max_withdrawable` can't exceed the true maximum. Same semantics
18
- * as Nado's own frontend, which floors at submit (`BigNumber.ROUND_DOWN`).
19
- *
20
- * Takes a bigint so it cannot throw: parsing a gateway string stays at the one
21
- * boundary that receives it (`safeBigInt`).
22
- */
23
- export declare function x18ToRawBaseUnit(x18Amount: bigint, decimals: number): bigint;
24
- /** x18-scaled query amount → human token units, floored at native decimals. */
25
- export declare function x18ToTokenUnits(x18Amount: bigint, decimals: number): string;
@@ -1,11 +0,0 @@
1
- "use client";
2
- import {
3
- buildNadoSubaccountId,
4
- x18ToRawBaseUnit,
5
- x18ToTokenUnits
6
- } from "../../chunk-6T6URLBM.js";
7
- export {
8
- buildNadoSubaccountId,
9
- x18ToRawBaseUnit,
10
- x18ToTokenUnits
11
- };
@@ -1,68 +0,0 @@
1
- /**
2
- * Nado gateway/indexer error type and the codes the SDK branches on.
3
- *
4
- * @see {@link https://docs.nado.xyz/developer-resources/api/errors | Nado error codes (full table)}
5
- */
6
- /**
7
- * Codes are shared across all Nado executes and queries, not just
8
- * withdrawals — keep this module flow-agnostic.
9
- */
10
- export declare const NADO_ERROR_CODES: {
11
- /** Amount would open a borrow with `spot_leverage: "false"`. */
12
- readonly SPOT_EXECUTE_EXCEEDS_BORROW_LIMIT: 2017;
13
- /** Gateway-level nonce rejection. A consumed `tx_nonce` reverts in the EVM
14
- * instead — see `EVM_REVERT`. */
15
- readonly INVALID_NONCE: 2022;
16
- /** Subaccount has never deposited, so it doesn't exist on Nado yet. */
17
- readonly NO_PRIOR_DEPOSIT: 2024;
18
- /** Withdrawal tx not found at the given submission index. */
19
- readonly INVALID_WITHDRAWAL_IDX: 3004;
20
- /** Fast-withdrawal validator signatures not aggregated yet. */
21
- readonly NOT_ENOUGH_FAST_WITHDRAWAL_SIGNATURES: 3005;
22
- /** Protocol 24h withdrawal limit exceeded. */
23
- readonly WITHDRAW_RISK: 4004;
24
- /** Catch-all EVM revert — the reason lives in the message, not the code.
25
- * A consumed `tx_nonce` lands here (see `parseNadoExpectedNonce`). */
26
- readonly EVM_REVERT: 4003;
27
- };
28
- export type NadoErrorCode = (typeof NADO_ERROR_CODES)[keyof typeof NADO_ERROR_CODES];
29
- /**
30
- * Stamped at the throw site — retry logic must never infer the failure kind
31
- * from which fields happen to be missing.
32
- * - `api`: Nado answered `{status:'failure'}` (or a malformed success)
33
- * - `http`: non-2xx response
34
- * - `timeout`: our 30s backstop fired — the caller already waited
35
- * - `transport`: request never completed (network drop, garbled body)
36
- */
37
- export type NadoErrorKind = 'api' | 'http' | 'timeout' | 'transport';
38
- /** A failed Nado gateway/indexer call, classified by `kind`. */
39
- export declare class NadoGatewayError extends Error {
40
- readonly kind: NadoErrorKind;
41
- /** Nado's application error code — set only for `api`-kind failures. */
42
- readonly errorCode: number | undefined;
43
- /** HTTP status, kept for diagnostics (present on `http` and bad-JSON 2xx). */
44
- readonly httpStatus: number | undefined;
45
- constructor(message: string, options: {
46
- kind: NadoErrorKind;
47
- errorCode?: number;
48
- httpStatus?: number;
49
- });
50
- }
51
- /**
52
- * A submit went unanswered and its replay didn't settle the question — the
53
- * withdrawal may or may not have landed. Distinct from a plain failure because
54
- * the user must not be told to retry: a fresh nonce would withdraw twice.
55
- */
56
- export declare class NadoWithdrawalUnconfirmedError extends Error {
57
- constructor(message?: string);
58
- }
59
- /** Request never completed — safe to retry. Excludes timeouts: a retry after
60
- * a 30s stall would hold the user another 30s. */
61
- export declare function isNadoTransportError(error: unknown): boolean;
62
- /** Maps a gateway/indexer failure response to a NadoGatewayError. */
63
- export declare function createNadoGatewayError(response: {
64
- error?: string;
65
- error_code?: number;
66
- }, fallbackMessage: string): NadoGatewayError;
67
- export declare function isNadoErrorCode(error: unknown, code: NadoErrorCode): boolean;
68
- export declare function parseNadoExpectedNonce(error: unknown): bigint | undefined;
@@ -1,19 +0,0 @@
1
- "use client";
2
- import {
3
- NADO_ERROR_CODES,
4
- NadoGatewayError,
5
- NadoWithdrawalUnconfirmedError,
6
- createNadoGatewayError,
7
- isNadoErrorCode,
8
- isNadoTransportError,
9
- parseNadoExpectedNonce
10
- } from "../../chunk-Z7HTQFEO.js";
11
- export {
12
- NADO_ERROR_CODES,
13
- NadoGatewayError,
14
- NadoWithdrawalUnconfirmedError,
15
- createNadoGatewayError,
16
- isNadoErrorCode,
17
- isNadoTransportError,
18
- parseNadoExpectedNonce
19
- };
@@ -1,15 +0,0 @@
1
- /**
2
- * Native-fetch wrapper for Nado's gateway/indexer — outbound third-party
3
- * calls that api-base's Fun-API-shaped `sendRequest` doesn't fit.
4
- */
5
- export interface NadoFetchParams {
6
- uri: string;
7
- method: 'GET' | 'POST';
8
- body?: object;
9
- signal?: AbortSignal;
10
- }
11
- /**
12
- * Returns the parsed JSON body of a 2xx response; every other outcome throws
13
- * NadoGatewayError. Emits one bounded log event per call.
14
- */
15
- export declare function nadoFetch<T>(params: NadoFetchParams): Promise<T>;
@@ -1,9 +0,0 @@
1
- "use client";
2
- import {
3
- nadoFetch
4
- } from "../../chunk-WZRW6WUM.js";
5
- import "../../chunk-Z7HTQFEO.js";
6
- import "../../chunk-AHYOV7AV.js";
7
- export {
8
- nadoFetch
9
- };
@@ -1,61 +0,0 @@
1
- /**
2
- * Nado gateway client: the queries and the withdraw execute used by the
3
- * withdrawal flow.
4
- *
5
- * Flow composition: `max_withdrawable` / `fee_rates` feed the enter-amount
6
- * screen → `nonces` immediately before signing → execute
7
- * `withdraw_collateral_v2` with `sendTo` = the Fun deposit address → the
8
- * indexer poll (indexer.ts) confirms sequencing, then checkout tracking takes
9
- * over once funds arrive.
10
- *
11
- * @see {@link https://docs.nado.xyz/developer-resources/api/gateway | Nado gateway API}
12
- */
13
- import type { Address, Hex } from 'viem';
14
- /**
15
- * Largest withdrawal (x18) the subaccount can make, measured against prod:
16
- * `(spot_leverage ? initial_health : min(spot, initial_health)) − sequencer_fee`
17
- *
18
- * - Already net of the fee: `max + fee` is debited, `max` is what arrives — so
19
- * the screen adds it back (`withdrawalForm.ts`).
20
- * - Health-bound, so no sum of spot balances can replace it: an open perp cuts
21
- * the max without moving any balance.
22
- */
23
- export declare function getNadoMaxWithdrawable(params: {
24
- productId: number;
25
- sender: Hex;
26
- spotLeverage: boolean;
27
- }, signal?: AbortSignal): Promise<string>;
28
- /**
29
- * Current `tx_nonce` for the owner wallet — fetch immediately before signing.
30
- * One manual retry on network failures only (imperative call site, no
31
- * react-query retry layer above it).
32
- */
33
- export declare function getNadoTxNonce(address: Address): Promise<bigint>;
34
- export interface NadoFeeRates {
35
- /** Withdraw sequencer fee per product (indexed by product_id), x18 token units. */
36
- withdraw_sequencer_fees: string[];
37
- }
38
- export declare function getNadoFeeRates(sender: Hex, signal?: AbortSignal): Promise<NadoFeeRates>;
39
- export interface ExecuteWithdrawCollateralV2Params {
40
- /** Subaccount id per Nado's spec (see `buildNadoSubaccountId`). */
41
- sender: Hex;
42
- productId: number;
43
- /** Raw base units in the token's native decimals — not x18. */
44
- amount: bigint;
45
- nonce: bigint;
46
- sendTo: Address;
47
- signature: Hex;
48
- /** Required so callers can't enable borrowing by omission — `false` fails
49
- * the withdrawal instead of opening a borrow (Nado defaults absent to true). */
50
- spotLeverage: boolean;
51
- }
52
- /**
53
- * Submit a signed `withdraw_collateral_v2`; resolves on gateway acceptance,
54
- * on-chain settlement follows asynchronously.
55
- *
56
- * A timeout means "no answer", not "didn't happen", so it replays the
57
- * identical payload rather than surfacing an ambiguous failure. `tx_nonce` is
58
- * a sequential counter, so the replay either fills the same slot or is
59
- * rejected — it can never withdraw twice.
60
- */
61
- export declare function executeNadoWithdrawCollateralV2(params: ExecuteWithdrawCollateralV2Params): Promise<void>;
@@ -1,17 +0,0 @@
1
- "use client";
2
- import {
3
- executeNadoWithdrawCollateralV2,
4
- getNadoFeeRates,
5
- getNadoMaxWithdrawable,
6
- getNadoTxNonce
7
- } from "../../chunk-TZGKB6WY.js";
8
- import "../../chunk-3P2C436B.js";
9
- import "../../chunk-WZRW6WUM.js";
10
- import "../../chunk-Z7HTQFEO.js";
11
- import "../../chunk-AHYOV7AV.js";
12
- export {
13
- executeNadoWithdrawCollateralV2,
14
- getNadoFeeRates,
15
- getNadoMaxWithdrawable,
16
- getNadoTxNonce
17
- };
@@ -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
- };