/** * Nado gateway client: the queries and the withdraw execute used by the * withdrawal flow. * * Flow composition: `max_withdrawable` / `fee_rates` feed the enter-amount * screen → `nonces` immediately before signing → execute * `withdraw_collateral_v2` with `sendTo` = the Fun deposit address → checkout * tracking takes over once funds arrive. * * @see {@link https://docs.nado.xyz/developer-resources/api/gateway | Nado gateway API} */ import type { Address, Hex } from 'viem'; import { type NadoRequestOptions } from './fetch'; /** * Largest withdrawal (x18) the subaccount can make, measured against prod: * `(spot_leverage ? initial_health : min(spot, initial_health)) − sequencer_fee` * * - Already net of the fee: `max + fee` is debited, `max` is what arrives — so * the screen adds it back (`withdrawalForm.ts`). * - Health-bound, so no sum of spot balances can replace it: an open perp cuts * the max without moving any balance. */ export declare function getNadoMaxWithdrawable(params: { productId: number; sender: Hex; spotLeverage: boolean; }, options: NadoRequestOptions): Promise; /** * Current `tx_nonce` for the owner wallet — fetch immediately before signing. * One manual retry on network failures only (imperative call site, no * react-query retry layer above it). */ export declare function getNadoTxNonce(address: Address, options: NadoRequestOptions): Promise; export interface NadoFeeRates { /** Withdraw sequencer fee per product (indexed by product_id), x18 token units. */ withdraw_sequencer_fees: string[]; } export declare function getNadoFeeRates(sender: Hex, options: NadoRequestOptions): Promise; export interface ExecuteWithdrawCollateralV2Params { /** Subaccount id per Nado's spec (see `buildNadoSubaccountId`). */ sender: Hex; productId: number; /** Raw base units in the token's native decimals — not x18. */ amount: bigint; nonce: bigint; sendTo: Address; signature: Hex; /** Required so callers can't enable borrowing by omission — `false` fails * the withdrawal instead of opening a borrow (Nado defaults absent to true). */ spotLeverage: boolean; } /** * Submit a signed `withdraw_collateral_v2`; resolves on gateway acceptance, * on-chain settlement follows asynchronously. * * A timeout means "no answer", not "didn't happen", so it replays the * identical payload rather than surfacing an ambiguous failure. `tx_nonce` is * a sequential counter, so the replay either fills the same slot or is * rejected — it can never withdraw twice. */ export declare function executeNadoWithdrawCollateralV2(params: ExecuteWithdrawCollateralV2Params, options: NadoRequestOptions): Promise; //# sourceMappingURL=gateway.d.ts.map