export type TradingStockWithdrawSendReqDto = {tokenAddress: string, tokenAmount: number, gasLimit?: number | undefined}; export type CreateApiApiV1StockWithdrawalsSendArgs = {body: TradingStockWithdrawSendReqDto}; export type CreateApiApiV1StockWithdrawalsSendOptions = {baseUrl?: string | undefined, TradingApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send stock withdrawal transaction through One Click * * POST /api/v1/stock/withdrawals/send * * Also accepts auth: TradingApiNonce, TradingApiTimestamp, TradingApiSignature, ApiChainId, ApiProductType */ export const createApiApiV1StockWithdrawalsSend = async (args: CreateApiApiV1StockWithdrawalsSendArgs, options?: CreateApiApiV1StockWithdrawalsSendOptions) => { const {baseUrl = "https://rwa-api.anchored.finance/rwa/trading", fetch: fetchFn = fetch, TradingApiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (TradingApiKey !== undefined) headers.set("x-api-key", TradingApiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/stock/withdrawals/send${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };