@funkit/connect 10.3.0 → 10.4.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 +23 -0
- package/dist/clients/chunk-2YWQL3AO.js +46 -0
- package/dist/clients/chunk-APQYFP6X.js +207 -0
- package/dist/clients/chunk-BNMZM23Q.js +42 -0
- package/dist/clients/chunk-II5CZTBC.js +18 -0
- package/dist/clients/chunk-KNHO756P.js +28 -0
- package/dist/clients/chunk-L2KSNS7H.js +112 -0
- package/dist/clients/{chunk-3STGJU6Z.js → chunk-M6C7MBQN.js} +1 -1
- package/dist/clients/chunk-OZ3KD24N.js +107 -0
- package/dist/clients/{chunk-RWCJ4XGX.js → chunk-RCMAGKMG.js} +30 -1
- package/dist/clients/internal/nado/consts.d.ts +16 -0
- package/dist/clients/internal/nado/consts.js +13 -0
- package/dist/clients/internal/nado/encoding.d.ts +22 -0
- package/dist/clients/internal/nado/encoding.js +32 -0
- package/dist/clients/internal/nado/errors.d.ts +55 -0
- package/dist/clients/internal/nado/errors.js +15 -0
- package/dist/clients/internal/nado/fetch.d.ts +15 -0
- package/dist/clients/internal/nado/fetch.js +9 -0
- package/dist/clients/internal/nado/gateway.d.ts +83 -0
- package/dist/clients/internal/nado/gateway.js +23 -0
- package/dist/clients/internal/nado/hooks.d.ts +360 -0
- package/dist/clients/internal/nado/hooks.js +132 -0
- package/dist/clients/internal/nado/indexer.d.ts +43 -0
- package/dist/clients/internal/nado/indexer.js +13 -0
- package/dist/clients/internal/nado/products.d.ts +36 -0
- package/dist/clients/internal/nado/products.js +19 -0
- package/dist/clients/internal/nado/typedData.d.ts +80 -0
- package/dist/clients/internal/nado/typedData.js +43 -0
- package/dist/clients/lighter.js +117 -40
- package/dist/clients/mallard.js +8 -23
- package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +2 -2
- package/dist/clients/polymarket/index.js +2 -2
- package/dist/components/ChainIcon/ChainIcon.d.ts +16 -0
- package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +1 -1
- package/dist/components/FunAssetAvatar/FunAssetAvatar.d.ts +1 -2
- package/dist/hooks/useChainMetadata.d.ts +11 -0
- package/dist/hooks/usePaymentMethodTabs.d.ts +8 -2
- package/dist/hooks/useSwappedIframeLifecycle.d.ts +5 -2
- package/dist/hooks/useSwappedPreload.d.ts +7 -11
- package/dist/hooks/useUserIpInfo.d.ts +1 -19
- package/dist/index.js +2710 -2638
- package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +3 -0
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframe.d.ts +4 -1
- package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeController.d.ts +3 -0
- package/dist/modals/CheckoutModal/isWithdrawalStep.d.ts +3 -2
- package/dist/providers/FunkitCheckoutContext/types.d.ts +34 -13
- package/dist/providers/FunkitConfigContext.d.ts +4 -0
- package/dist/providers/SwappedProvider.d.ts +5 -3
- package/dist/utils/tokenIconUrl.d.ts +5 -0
- package/dist/wallets/walletConnectors/index.js +28 -28
- package/package.json +3 -2
- package/dist/hooks/useSkipSwappedPreload.d.ts +0 -7
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
export declare function x18ToRawBaseUnit(x18Amount: string, decimals: number): bigint;
|
|
21
|
+
/** x18-scaled query amount → human token units, floored at native decimals. */
|
|
22
|
+
export declare function x18ToTokenUnits(x18Amount: string, decimals: number): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/clients/internal/nado/encoding.ts
|
|
4
|
+
import {
|
|
5
|
+
concatHex,
|
|
6
|
+
formatUnits,
|
|
7
|
+
pad,
|
|
8
|
+
stringToHex
|
|
9
|
+
} from "viem";
|
|
10
|
+
var SUBACCOUNT_NAME_BYTES = 12;
|
|
11
|
+
var X18_DECIMALS = 18;
|
|
12
|
+
function buildNadoSubaccountId(owner, name = "default") {
|
|
13
|
+
const nameHex = stringToHex(name);
|
|
14
|
+
if ((nameHex.length - 2) / 2 > SUBACCOUNT_NAME_BYTES) {
|
|
15
|
+
throw new Error("Nado subaccount name must be 12 bytes or fewer");
|
|
16
|
+
}
|
|
17
|
+
return concatHex([
|
|
18
|
+
owner,
|
|
19
|
+
pad(nameHex, { dir: "right", size: SUBACCOUNT_NAME_BYTES })
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
function x18ToRawBaseUnit(x18Amount, decimals) {
|
|
23
|
+
return BigInt(x18Amount) * 10n ** BigInt(decimals) / 10n ** BigInt(X18_DECIMALS);
|
|
24
|
+
}
|
|
25
|
+
function x18ToTokenUnits(x18Amount, decimals) {
|
|
26
|
+
return formatUnits(x18ToRawBaseUnit(x18Amount, decimals), decimals);
|
|
27
|
+
}
|
|
28
|
+
export {
|
|
29
|
+
buildNadoSubaccountId,
|
|
30
|
+
x18ToRawBaseUnit,
|
|
31
|
+
x18ToTokenUnits
|
|
32
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
/** Stale `tx_nonce` — refetch and retry once. */
|
|
14
|
+
readonly INVALID_NONCE: 2022;
|
|
15
|
+
/** Subaccount has never deposited, so it doesn't exist on Nado yet. */
|
|
16
|
+
readonly NO_PRIOR_DEPOSIT: 2024;
|
|
17
|
+
/** Withdrawal tx not found at the given submission index. */
|
|
18
|
+
readonly INVALID_WITHDRAWAL_IDX: 3004;
|
|
19
|
+
/** Fast-withdrawal validator signatures not aggregated yet. */
|
|
20
|
+
readonly NOT_ENOUGH_FAST_WITHDRAWAL_SIGNATURES: 3005;
|
|
21
|
+
/** Protocol 24h withdrawal limit exceeded. */
|
|
22
|
+
readonly WITHDRAW_RISK: 4004;
|
|
23
|
+
};
|
|
24
|
+
export type NadoErrorCode = (typeof NADO_ERROR_CODES)[keyof typeof NADO_ERROR_CODES];
|
|
25
|
+
/**
|
|
26
|
+
* Stamped at the throw site — retry logic must never infer the failure kind
|
|
27
|
+
* from which fields happen to be missing.
|
|
28
|
+
* - `api`: Nado answered `{status:'failure'}` (or a malformed success)
|
|
29
|
+
* - `http`: non-2xx response
|
|
30
|
+
* - `timeout`: our 30s backstop fired — the caller already waited
|
|
31
|
+
* - `transport`: request never completed (network drop, garbled body)
|
|
32
|
+
*/
|
|
33
|
+
export type NadoErrorKind = 'api' | 'http' | 'timeout' | 'transport';
|
|
34
|
+
/** A failed Nado gateway/indexer call, classified by `kind`. */
|
|
35
|
+
export declare class NadoGatewayError extends Error {
|
|
36
|
+
readonly kind: NadoErrorKind;
|
|
37
|
+
/** Nado's application error code — set only for `api`-kind failures. */
|
|
38
|
+
readonly errorCode: number | undefined;
|
|
39
|
+
/** HTTP status, kept for diagnostics (present on `http` and bad-JSON 2xx). */
|
|
40
|
+
readonly httpStatus: number | undefined;
|
|
41
|
+
constructor(message: string, options: {
|
|
42
|
+
kind: NadoErrorKind;
|
|
43
|
+
errorCode?: number;
|
|
44
|
+
httpStatus?: number;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** Request never completed — safe to retry. Excludes timeouts: a retry after
|
|
48
|
+
* a 30s stall would hold the user another 30s. */
|
|
49
|
+
export declare function isNadoTransportError(error: unknown): boolean;
|
|
50
|
+
/** Maps a gateway/indexer failure response to a NadoGatewayError. */
|
|
51
|
+
export declare function createNadoGatewayError(response: {
|
|
52
|
+
error?: string;
|
|
53
|
+
error_code?: number;
|
|
54
|
+
}, fallbackMessage: string): NadoGatewayError;
|
|
55
|
+
export declare function isNadoErrorCode(error: unknown, code: NadoErrorCode): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
NADO_ERROR_CODES,
|
|
4
|
+
NadoGatewayError,
|
|
5
|
+
createNadoGatewayError,
|
|
6
|
+
isNadoErrorCode,
|
|
7
|
+
isNadoTransportError
|
|
8
|
+
} from "../../chunk-2YWQL3AO.js";
|
|
9
|
+
export {
|
|
10
|
+
NADO_ERROR_CODES,
|
|
11
|
+
NadoGatewayError,
|
|
12
|
+
createNadoGatewayError,
|
|
13
|
+
isNadoErrorCode,
|
|
14
|
+
isNadoTransportError
|
|
15
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
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>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nado gateway client: the queries and the withdraw execute used by the
|
|
3
|
+
* withdrawal flow.
|
|
4
|
+
*
|
|
5
|
+
* Flow composition: `subaccount_info` / `max_withdrawable` / `fee_rates` feed
|
|
6
|
+
* the enter-amount 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
|
|
9
|
+
* takes 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
|
+
/** Largest withdrawal (x18) that keeps the subaccount healthy. */
|
|
15
|
+
export declare function getNadoMaxWithdrawable(params: {
|
|
16
|
+
productId: number;
|
|
17
|
+
sender: Hex;
|
|
18
|
+
spotLeverage: boolean;
|
|
19
|
+
}, signal?: AbortSignal): Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* Current `tx_nonce` for the owner wallet — fetch immediately before signing.
|
|
22
|
+
* One manual retry on network failures only (imperative call site, no
|
|
23
|
+
* react-query retry layer above it).
|
|
24
|
+
*/
|
|
25
|
+
export declare function getNadoTxNonce(address: Address): Promise<bigint>;
|
|
26
|
+
export interface NadoFeeRates {
|
|
27
|
+
/** Withdraw sequencer fee per product (indexed by product_id), x18 token units. */
|
|
28
|
+
withdraw_sequencer_fees: string[];
|
|
29
|
+
}
|
|
30
|
+
export declare function getNadoFeeRates(sender: Hex, signal?: AbortSignal): Promise<NadoFeeRates>;
|
|
31
|
+
export interface NadoSpotBalance {
|
|
32
|
+
product_id: number;
|
|
33
|
+
/** x18-normalized; negative when the balance is a borrow. */
|
|
34
|
+
balance: {
|
|
35
|
+
amount: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface NadoSubaccountInfo {
|
|
39
|
+
/** False until the subaccount's first deposit lands on Nado. */
|
|
40
|
+
exists: boolean;
|
|
41
|
+
spot_balances: NadoSpotBalance[];
|
|
42
|
+
}
|
|
43
|
+
export declare function getNadoSubaccountInfo(subaccount: Hex, signal?: AbortSignal): Promise<NadoSubaccountInfo>;
|
|
44
|
+
export interface NadoSpotProduct {
|
|
45
|
+
product_id: number;
|
|
46
|
+
config: {
|
|
47
|
+
token: string;
|
|
48
|
+
/** Product-default withdraw sequencer fee, x18 token units. */
|
|
49
|
+
withdraw_fee_x18: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export declare function getNadoAllProducts(signal?: AbortSignal): Promise<{
|
|
53
|
+
spot_products: NadoSpotProduct[];
|
|
54
|
+
}>;
|
|
55
|
+
export interface NadoSymbolInfo {
|
|
56
|
+
type: 'spot' | 'perp';
|
|
57
|
+
product_id: number;
|
|
58
|
+
symbol: string;
|
|
59
|
+
trading_status: string;
|
|
60
|
+
}
|
|
61
|
+
/** Keyed by symbol. The quote asset (USDT0, product 0) is not included. */
|
|
62
|
+
export declare function getNadoSymbols(signal?: AbortSignal): Promise<{
|
|
63
|
+
symbols: Record<string, NadoSymbolInfo>;
|
|
64
|
+
}>;
|
|
65
|
+
export interface ExecuteWithdrawCollateralV2Params {
|
|
66
|
+
/** Subaccount id per Nado's spec (see `buildNadoSubaccountId`). */
|
|
67
|
+
sender: Hex;
|
|
68
|
+
productId: number;
|
|
69
|
+
/** Raw base units in the token's native decimals — not x18. */
|
|
70
|
+
amount: bigint;
|
|
71
|
+
nonce: bigint;
|
|
72
|
+
sendTo: Address;
|
|
73
|
+
signature: Hex;
|
|
74
|
+
/** Required so callers can't enable borrowing by omission — `false` fails
|
|
75
|
+
* the withdrawal instead of opening a borrow (Nado defaults absent to true). */
|
|
76
|
+
spotLeverage: boolean;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Submit a signed `withdraw_collateral_v2`; resolves on gateway acceptance,
|
|
80
|
+
* on-chain settlement follows asynchronously. Never retried — a retry could
|
|
81
|
+
* re-submit a consumed nonce and report failure for a successful withdrawal.
|
|
82
|
+
*/
|
|
83
|
+
export declare function executeNadoWithdrawCollateralV2(params: ExecuteWithdrawCollateralV2Params): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
executeNadoWithdrawCollateralV2,
|
|
4
|
+
getNadoAllProducts,
|
|
5
|
+
getNadoFeeRates,
|
|
6
|
+
getNadoMaxWithdrawable,
|
|
7
|
+
getNadoSubaccountInfo,
|
|
8
|
+
getNadoSymbols,
|
|
9
|
+
getNadoTxNonce
|
|
10
|
+
} from "../../chunk-OZ3KD24N.js";
|
|
11
|
+
import "../../chunk-II5CZTBC.js";
|
|
12
|
+
import "../../chunk-L2KSNS7H.js";
|
|
13
|
+
import "../../chunk-2YWQL3AO.js";
|
|
14
|
+
import "../../chunk-AHYOV7AV.js";
|
|
15
|
+
export {
|
|
16
|
+
executeNadoWithdrawCollateralV2,
|
|
17
|
+
getNadoAllProducts,
|
|
18
|
+
getNadoFeeRates,
|
|
19
|
+
getNadoMaxWithdrawable,
|
|
20
|
+
getNadoSubaccountInfo,
|
|
21
|
+
getNadoSymbols,
|
|
22
|
+
getNadoTxNonce
|
|
23
|
+
};
|
|
@@ -0,0 +1,360 @@
|
|
|
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
|
+
* ~15 weight/min; the indexer poll runs only while a settlement is pending.
|
|
5
|
+
*
|
|
6
|
+
* @see {@link https://docs.nado.xyz/developer-resources/api/rate-limits | Nado rate limits}
|
|
7
|
+
*/
|
|
8
|
+
import type { Hex } from 'viem';
|
|
9
|
+
/**
|
|
10
|
+
* React-query owns retries (the fetch layer never retries) — up to 2 with
|
|
11
|
+
* backoff, except deterministic api failures, 429s (retrying hammers the
|
|
12
|
+
* limit we just tripped), and timeouts (the caller already waited 30s; the
|
|
13
|
+
* next scheduled poll is the retry).
|
|
14
|
+
*/
|
|
15
|
+
export declare function shouldRetryNadoQuery(failureCount: number, error: unknown): boolean;
|
|
16
|
+
/** Live product list; falls back to the static list while loading or on gateway failure. */
|
|
17
|
+
export declare function useNadoProducts(): {
|
|
18
|
+
data: import("./products").NadoProduct[];
|
|
19
|
+
error: unknown;
|
|
20
|
+
isError: true;
|
|
21
|
+
isPending: false;
|
|
22
|
+
isLoading: false;
|
|
23
|
+
isLoadingError: false;
|
|
24
|
+
isRefetchError: true;
|
|
25
|
+
isSuccess: false;
|
|
26
|
+
isPlaceholderData: false;
|
|
27
|
+
status: "error";
|
|
28
|
+
dataUpdatedAt: number;
|
|
29
|
+
errorUpdatedAt: number;
|
|
30
|
+
failureCount: number;
|
|
31
|
+
failureReason: unknown;
|
|
32
|
+
errorUpdateCount: number;
|
|
33
|
+
isFetched: boolean;
|
|
34
|
+
isFetchedAfterMount: boolean;
|
|
35
|
+
isFetching: boolean;
|
|
36
|
+
isInitialLoading: boolean;
|
|
37
|
+
isPaused: boolean;
|
|
38
|
+
isRefetching: boolean;
|
|
39
|
+
isStale: boolean;
|
|
40
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("./products").NadoProduct[], unknown>>;
|
|
41
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
42
|
+
promise: Promise<import("./products").NadoProduct[]>;
|
|
43
|
+
} | {
|
|
44
|
+
data: import("./products").NadoProduct[];
|
|
45
|
+
error: null;
|
|
46
|
+
isError: false;
|
|
47
|
+
isPending: false;
|
|
48
|
+
isLoading: false;
|
|
49
|
+
isLoadingError: false;
|
|
50
|
+
isRefetchError: false;
|
|
51
|
+
isSuccess: true;
|
|
52
|
+
isPlaceholderData: false;
|
|
53
|
+
status: "success";
|
|
54
|
+
dataUpdatedAt: number;
|
|
55
|
+
errorUpdatedAt: number;
|
|
56
|
+
failureCount: number;
|
|
57
|
+
failureReason: unknown;
|
|
58
|
+
errorUpdateCount: number;
|
|
59
|
+
isFetched: boolean;
|
|
60
|
+
isFetchedAfterMount: boolean;
|
|
61
|
+
isFetching: boolean;
|
|
62
|
+
isInitialLoading: boolean;
|
|
63
|
+
isPaused: boolean;
|
|
64
|
+
isRefetching: boolean;
|
|
65
|
+
isStale: boolean;
|
|
66
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("./products").NadoProduct[], unknown>>;
|
|
67
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
68
|
+
promise: Promise<import("./products").NadoProduct[]>;
|
|
69
|
+
} | {
|
|
70
|
+
data: import("./products").NadoProduct[];
|
|
71
|
+
error: unknown;
|
|
72
|
+
isError: true;
|
|
73
|
+
isPending: false;
|
|
74
|
+
isLoading: false;
|
|
75
|
+
isLoadingError: true;
|
|
76
|
+
isRefetchError: false;
|
|
77
|
+
isSuccess: false;
|
|
78
|
+
isPlaceholderData: false;
|
|
79
|
+
status: "error";
|
|
80
|
+
dataUpdatedAt: number;
|
|
81
|
+
errorUpdatedAt: number;
|
|
82
|
+
failureCount: number;
|
|
83
|
+
failureReason: unknown;
|
|
84
|
+
errorUpdateCount: number;
|
|
85
|
+
isFetched: boolean;
|
|
86
|
+
isFetchedAfterMount: boolean;
|
|
87
|
+
isFetching: boolean;
|
|
88
|
+
isInitialLoading: boolean;
|
|
89
|
+
isPaused: boolean;
|
|
90
|
+
isRefetching: boolean;
|
|
91
|
+
isStale: boolean;
|
|
92
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("./products").NadoProduct[], unknown>>;
|
|
93
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
94
|
+
promise: Promise<import("./products").NadoProduct[]>;
|
|
95
|
+
} | {
|
|
96
|
+
data: import("./products").NadoProduct[];
|
|
97
|
+
error: null;
|
|
98
|
+
isError: false;
|
|
99
|
+
isPending: true;
|
|
100
|
+
isLoading: true;
|
|
101
|
+
isLoadingError: false;
|
|
102
|
+
isRefetchError: false;
|
|
103
|
+
isSuccess: false;
|
|
104
|
+
isPlaceholderData: false;
|
|
105
|
+
status: "pending";
|
|
106
|
+
dataUpdatedAt: number;
|
|
107
|
+
errorUpdatedAt: number;
|
|
108
|
+
failureCount: number;
|
|
109
|
+
failureReason: unknown;
|
|
110
|
+
errorUpdateCount: number;
|
|
111
|
+
isFetched: boolean;
|
|
112
|
+
isFetchedAfterMount: boolean;
|
|
113
|
+
isFetching: boolean;
|
|
114
|
+
isInitialLoading: boolean;
|
|
115
|
+
isPaused: boolean;
|
|
116
|
+
isRefetching: boolean;
|
|
117
|
+
isStale: boolean;
|
|
118
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("./products").NadoProduct[], unknown>>;
|
|
119
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
120
|
+
promise: Promise<import("./products").NadoProduct[]>;
|
|
121
|
+
} | {
|
|
122
|
+
data: import("./products").NadoProduct[];
|
|
123
|
+
error: null;
|
|
124
|
+
isError: false;
|
|
125
|
+
isPending: true;
|
|
126
|
+
isLoadingError: false;
|
|
127
|
+
isRefetchError: false;
|
|
128
|
+
isSuccess: false;
|
|
129
|
+
isPlaceholderData: false;
|
|
130
|
+
status: "pending";
|
|
131
|
+
dataUpdatedAt: number;
|
|
132
|
+
errorUpdatedAt: number;
|
|
133
|
+
failureCount: number;
|
|
134
|
+
failureReason: unknown;
|
|
135
|
+
errorUpdateCount: number;
|
|
136
|
+
isFetched: boolean;
|
|
137
|
+
isFetchedAfterMount: boolean;
|
|
138
|
+
isFetching: boolean;
|
|
139
|
+
isLoading: boolean;
|
|
140
|
+
isInitialLoading: boolean;
|
|
141
|
+
isPaused: boolean;
|
|
142
|
+
isRefetching: boolean;
|
|
143
|
+
isStale: boolean;
|
|
144
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("./products").NadoProduct[], unknown>>;
|
|
145
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
146
|
+
promise: Promise<import("./products").NadoProduct[]>;
|
|
147
|
+
} | {
|
|
148
|
+
data: import("./products").NadoProduct[];
|
|
149
|
+
isError: false;
|
|
150
|
+
error: null;
|
|
151
|
+
isPending: false;
|
|
152
|
+
isLoading: false;
|
|
153
|
+
isLoadingError: false;
|
|
154
|
+
isRefetchError: false;
|
|
155
|
+
isSuccess: true;
|
|
156
|
+
isPlaceholderData: true;
|
|
157
|
+
status: "success";
|
|
158
|
+
dataUpdatedAt: number;
|
|
159
|
+
errorUpdatedAt: number;
|
|
160
|
+
failureCount: number;
|
|
161
|
+
failureReason: unknown;
|
|
162
|
+
errorUpdateCount: number;
|
|
163
|
+
isFetched: boolean;
|
|
164
|
+
isFetchedAfterMount: boolean;
|
|
165
|
+
isFetching: boolean;
|
|
166
|
+
isInitialLoading: boolean;
|
|
167
|
+
isPaused: boolean;
|
|
168
|
+
isRefetching: boolean;
|
|
169
|
+
isStale: boolean;
|
|
170
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<import("./products").NadoProduct[], unknown>>;
|
|
171
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
172
|
+
promise: Promise<import("./products").NadoProduct[]>;
|
|
173
|
+
};
|
|
174
|
+
export declare function useNadoSubaccountBalances(subaccount: Hex | undefined): import("@tanstack/react-query").UseQueryResult<import("./gateway").NadoSubaccountInfo, unknown>;
|
|
175
|
+
export declare function useNadoMaxWithdrawable(params: {
|
|
176
|
+
productId: number | undefined;
|
|
177
|
+
sender: Hex | undefined;
|
|
178
|
+
spotLeverage: boolean;
|
|
179
|
+
}): import("@tanstack/react-query").UseQueryResult<string, unknown>;
|
|
180
|
+
export declare function useNadoFeeRates(sender: Hex | undefined): import("@tanstack/react-query").UseQueryResult<import("./gateway").NadoFeeRates, unknown>;
|
|
181
|
+
export interface NadoSettlementStatus {
|
|
182
|
+
/** True once the sequencer has recorded the withdrawal we signed. */
|
|
183
|
+
isSequenced: boolean;
|
|
184
|
+
/** Unix seconds of the sequenced tx, when available. */
|
|
185
|
+
sequencedAt: number | undefined;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Poll the indexer for the withdrawal signed with `nonce` until it appears
|
|
189
|
+
* or the wall-clock timeout passes. `isTimedOut` flips after the cap — show
|
|
190
|
+
* a "still pending, check Nado" state.
|
|
191
|
+
*/
|
|
192
|
+
export declare function useNadoSettlementStatus(params: {
|
|
193
|
+
subaccount: Hex | undefined;
|
|
194
|
+
nonce: bigint | undefined;
|
|
195
|
+
/** When the withdrawal was submitted — anchors the timeout. */
|
|
196
|
+
submittedAtMs: number | undefined;
|
|
197
|
+
enabled: boolean;
|
|
198
|
+
}): {
|
|
199
|
+
isTimedOut: boolean;
|
|
200
|
+
data: NadoSettlementStatus;
|
|
201
|
+
error: Error;
|
|
202
|
+
isError: true;
|
|
203
|
+
isPending: false;
|
|
204
|
+
isLoading: false;
|
|
205
|
+
isLoadingError: false;
|
|
206
|
+
isRefetchError: true;
|
|
207
|
+
isSuccess: false;
|
|
208
|
+
isPlaceholderData: false;
|
|
209
|
+
status: "error";
|
|
210
|
+
dataUpdatedAt: number;
|
|
211
|
+
errorUpdatedAt: number;
|
|
212
|
+
failureCount: number;
|
|
213
|
+
failureReason: Error | null;
|
|
214
|
+
errorUpdateCount: number;
|
|
215
|
+
isFetched: boolean;
|
|
216
|
+
isFetchedAfterMount: boolean;
|
|
217
|
+
isFetching: boolean;
|
|
218
|
+
isInitialLoading: boolean;
|
|
219
|
+
isPaused: boolean;
|
|
220
|
+
isRefetching: boolean;
|
|
221
|
+
isStale: boolean;
|
|
222
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
|
|
223
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
224
|
+
promise: Promise<NadoSettlementStatus>;
|
|
225
|
+
} | {
|
|
226
|
+
isTimedOut: boolean;
|
|
227
|
+
data: NadoSettlementStatus;
|
|
228
|
+
error: null;
|
|
229
|
+
isError: false;
|
|
230
|
+
isPending: false;
|
|
231
|
+
isLoading: false;
|
|
232
|
+
isLoadingError: false;
|
|
233
|
+
isRefetchError: false;
|
|
234
|
+
isSuccess: true;
|
|
235
|
+
isPlaceholderData: false;
|
|
236
|
+
status: "success";
|
|
237
|
+
dataUpdatedAt: number;
|
|
238
|
+
errorUpdatedAt: number;
|
|
239
|
+
failureCount: number;
|
|
240
|
+
failureReason: Error | null;
|
|
241
|
+
errorUpdateCount: number;
|
|
242
|
+
isFetched: boolean;
|
|
243
|
+
isFetchedAfterMount: boolean;
|
|
244
|
+
isFetching: boolean;
|
|
245
|
+
isInitialLoading: boolean;
|
|
246
|
+
isPaused: boolean;
|
|
247
|
+
isRefetching: boolean;
|
|
248
|
+
isStale: boolean;
|
|
249
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
|
|
250
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
251
|
+
promise: Promise<NadoSettlementStatus>;
|
|
252
|
+
} | {
|
|
253
|
+
isTimedOut: boolean;
|
|
254
|
+
data: undefined;
|
|
255
|
+
error: Error;
|
|
256
|
+
isError: true;
|
|
257
|
+
isPending: false;
|
|
258
|
+
isLoading: false;
|
|
259
|
+
isLoadingError: true;
|
|
260
|
+
isRefetchError: false;
|
|
261
|
+
isSuccess: false;
|
|
262
|
+
isPlaceholderData: false;
|
|
263
|
+
status: "error";
|
|
264
|
+
dataUpdatedAt: number;
|
|
265
|
+
errorUpdatedAt: number;
|
|
266
|
+
failureCount: number;
|
|
267
|
+
failureReason: Error | null;
|
|
268
|
+
errorUpdateCount: number;
|
|
269
|
+
isFetched: boolean;
|
|
270
|
+
isFetchedAfterMount: boolean;
|
|
271
|
+
isFetching: boolean;
|
|
272
|
+
isInitialLoading: boolean;
|
|
273
|
+
isPaused: boolean;
|
|
274
|
+
isRefetching: boolean;
|
|
275
|
+
isStale: boolean;
|
|
276
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
|
|
277
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
278
|
+
promise: Promise<NadoSettlementStatus>;
|
|
279
|
+
} | {
|
|
280
|
+
isTimedOut: boolean;
|
|
281
|
+
data: undefined;
|
|
282
|
+
error: null;
|
|
283
|
+
isError: false;
|
|
284
|
+
isPending: true;
|
|
285
|
+
isLoading: true;
|
|
286
|
+
isLoadingError: false;
|
|
287
|
+
isRefetchError: false;
|
|
288
|
+
isSuccess: false;
|
|
289
|
+
isPlaceholderData: false;
|
|
290
|
+
status: "pending";
|
|
291
|
+
dataUpdatedAt: number;
|
|
292
|
+
errorUpdatedAt: number;
|
|
293
|
+
failureCount: number;
|
|
294
|
+
failureReason: Error | null;
|
|
295
|
+
errorUpdateCount: number;
|
|
296
|
+
isFetched: boolean;
|
|
297
|
+
isFetchedAfterMount: boolean;
|
|
298
|
+
isFetching: boolean;
|
|
299
|
+
isInitialLoading: boolean;
|
|
300
|
+
isPaused: boolean;
|
|
301
|
+
isRefetching: boolean;
|
|
302
|
+
isStale: boolean;
|
|
303
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
|
|
304
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
305
|
+
promise: Promise<NadoSettlementStatus>;
|
|
306
|
+
} | {
|
|
307
|
+
isTimedOut: boolean;
|
|
308
|
+
data: undefined;
|
|
309
|
+
error: null;
|
|
310
|
+
isError: false;
|
|
311
|
+
isPending: true;
|
|
312
|
+
isLoadingError: false;
|
|
313
|
+
isRefetchError: false;
|
|
314
|
+
isSuccess: false;
|
|
315
|
+
isPlaceholderData: false;
|
|
316
|
+
status: "pending";
|
|
317
|
+
dataUpdatedAt: number;
|
|
318
|
+
errorUpdatedAt: number;
|
|
319
|
+
failureCount: number;
|
|
320
|
+
failureReason: Error | null;
|
|
321
|
+
errorUpdateCount: number;
|
|
322
|
+
isFetched: boolean;
|
|
323
|
+
isFetchedAfterMount: boolean;
|
|
324
|
+
isFetching: boolean;
|
|
325
|
+
isLoading: boolean;
|
|
326
|
+
isInitialLoading: boolean;
|
|
327
|
+
isPaused: boolean;
|
|
328
|
+
isRefetching: boolean;
|
|
329
|
+
isStale: boolean;
|
|
330
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
|
|
331
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
332
|
+
promise: Promise<NadoSettlementStatus>;
|
|
333
|
+
} | {
|
|
334
|
+
isTimedOut: boolean;
|
|
335
|
+
data: NadoSettlementStatus;
|
|
336
|
+
isError: false;
|
|
337
|
+
error: null;
|
|
338
|
+
isPending: false;
|
|
339
|
+
isLoading: false;
|
|
340
|
+
isLoadingError: false;
|
|
341
|
+
isRefetchError: false;
|
|
342
|
+
isSuccess: true;
|
|
343
|
+
isPlaceholderData: true;
|
|
344
|
+
status: "success";
|
|
345
|
+
dataUpdatedAt: number;
|
|
346
|
+
errorUpdatedAt: number;
|
|
347
|
+
failureCount: number;
|
|
348
|
+
failureReason: Error | null;
|
|
349
|
+
errorUpdateCount: number;
|
|
350
|
+
isFetched: boolean;
|
|
351
|
+
isFetchedAfterMount: boolean;
|
|
352
|
+
isFetching: boolean;
|
|
353
|
+
isInitialLoading: boolean;
|
|
354
|
+
isPaused: boolean;
|
|
355
|
+
isRefetching: boolean;
|
|
356
|
+
isStale: boolean;
|
|
357
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<NadoSettlementStatus, Error>>;
|
|
358
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
359
|
+
promise: Promise<NadoSettlementStatus>;
|
|
360
|
+
};
|