export type TradingCashWithdrawCalldataReqDto = {userAddress: string, tokenAddress: string, creditAmount: number}; export type CreateApiApiV1CashWithdrawalsCalldataArgs = {body: TradingCashWithdrawCalldataReqDto}; export type CreateApiApiV1CashWithdrawalsCalldataOptions = {baseUrl?: string | undefined, TradingApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Build withdraw calldata * * POST /api/v1/cash/withdrawals/calldata * * Also accepts auth: TradingApiNonce, TradingApiTimestamp, TradingApiSignature, ApiChainId, ApiProductType */ export const createApiApiV1CashWithdrawalsCalldata = async (args: CreateApiApiV1CashWithdrawalsCalldataArgs, options?: CreateApiApiV1CashWithdrawalsCalldataOptions) => { 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/cash/withdrawals/calldata${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() };