import { ClientCatalog } from "../../catalogs/types.js"; import { AuthApiTransports } from "../../shared/transports.js"; import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js"; import { SubaccountResolver } from "../subaccount-resolver.js"; import { SdkScales } from "../../shared/decimal-surface.js"; import { CreateTradingWithdrawResult, CreateTradingWithdrawToExternalChainInput, CreateTradingWithdrawToFundingInput, ValidateWithdrawDestinationInput, ValidateWithdrawDestinationResult } from "./trading-withdraws.schemas.js"; import { Address, Hex } from "viem"; //#region src/services/trading-withdraws/trading-withdraws.d.ts type TradingWithdrawWalletSigner = { signerWallet: string; accountId: string; /** * Signs the UTF-8 message directly using EIP-191 personal_sign, without pre-hashing or switching chains. * For a viem account, use `(message) => account.signMessage({ message })`. */ signMessage: (message: string) => Promise; }; type TradingWithdrawSigningConfig = { chainId: number; tradingGatewayAddress: Address; }; type CreateTradingWithdrawToFundingServiceInput = CreateTradingWithdrawToFundingInput & { walletSigner?: TradingWithdrawWalletSigner; }; type CreateTradingWithdrawToExternalChainServiceInput = CreateTradingWithdrawToExternalChainInput & { walletSigner?: TradingWithdrawWalletSigner; }; type PreparedTradingWithdraw = Readonly<{ /** When the backend stops accepting this signed request. */ deadline: Date; /** * True once the deadline is less than a minute away. Prepare again (same input, * same idempotency key) instead of submitting, e.g. after a slow MFA enrollment. */ isExpired: () => boolean; /** * Submits the exact payload and signature produced during preparation. * Repeated calls only change transport options such as the step-up token. */ submit: (options?: PolyesterMutationOptions) => Promise; }>; /** * Creates durable Trading withdrawal intents to Funding using API signatures or wallet EIP-191 signatures. */ declare class TradingWithdrawsService { #private; constructor(transports: AuthApiTransports, resolver: SubaccountResolver | undefined, signingConfig: TradingWithdrawSigningConfig, scales: SdkScales, catalog?: ClientCatalog); /** * Checks whether an external-chain destination can receive a withdrawal without creating, signing, or reserving one. */ validateDestination(input: ValidateWithdrawDestinationInput, options?: PolyesterRequestOptions): Promise; /** * Builds a Trading-to-Funding withdraw intent payload with asset id, decimal amount, destination address, five-minute deadline, nonce, and idempotency key. If a wallet signer is provided, it signs the canonical EIP-191 message and calls the wallet endpoint; otherwise a payload signature is required for the backend-authorized endpoint. */ createToFunding(input: CreateTradingWithdrawToFundingServiceInput, options?: PolyesterMutationOptions): Promise; /** * Builds and signs a Trading-to-Funding withdrawal once so the exact request can be * resubmitted after backend-directed authorization such as MFA step-up. */ prepareToFunding(input: CreateTradingWithdrawToFundingServiceInput): Promise; /** * Builds a Trading-to-external-chain withdraw intent payload with asset id, decimal gross amount, destination network, destination address, five-minute deadline, nonce, and idempotency key. If a wallet signer is provided, it signs the canonical EIP-191 message and calls the wallet endpoint; otherwise a payload signature is required for the backend-authorized endpoint. */ createToExternalChain(input: CreateTradingWithdrawToExternalChainServiceInput, options?: PolyesterMutationOptions): Promise; /** * Builds and signs a Trading-to-external-chain withdrawal once so the exact request can * be resubmitted after backend-directed authorization such as MFA step-up. */ prepareToExternalChain(input: CreateTradingWithdrawToExternalChainServiceInput): Promise; } //#endregion export { CreateTradingWithdrawToExternalChainServiceInput, CreateTradingWithdrawToFundingServiceInput, PreparedTradingWithdraw, TradingWithdrawSigningConfig, TradingWithdrawWalletSigner, TradingWithdrawsService }; //# sourceMappingURL=trading-withdraws.d.ts.map