export type TradingDeferredRepaySendReqDto = {stockAddress: string, amount: number, gasLimit?: number | undefined}; export type CreateApiApiV1DeferredSellRepaySendArgs = {body: TradingDeferredRepaySendReqDto}; export type CreateApiApiV1DeferredSellRepaySendOptions = {baseUrl?: string | undefined, TradingApiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send repay deferred-sell debt transaction through One Click * * POST /api/v1/deferred-sell/repay/send * * Also accepts auth: TradingApiNonce, TradingApiTimestamp, TradingApiSignature, ApiChainId, ApiProductType */ export const createApiApiV1DeferredSellRepaySend = async (args: CreateApiApiV1DeferredSellRepaySendArgs, options?: CreateApiApiV1DeferredSellRepaySendOptions) => { 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/deferred-sell/repay/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() };