export type CreateApiOrdersOrderUuidSignatureArgs = {order_uuid: string, body: BodyInit}; export type CreateApiOrdersOrderUuidSignatureOptions = {baseUrl?: string | undefined, bityAccountOauth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Sign proof of wallet ownership message * * POST /orders/{order_uuid}/signature * * Also accepts auth: bity_account_client_oauth, client_oauth */ export const createApiOrdersOrderUuidSignature = async (args: CreateApiOrdersOrderUuidSignatureArgs, options?: CreateApiOrdersOrderUuidSignatureOptions) => { const {baseUrl = "https://exchange.api.bity.com/v2", fetch: fetchFn = fetch, bityAccountOauth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "*/*") if (bityAccountOauth !== undefined) headers.set('authorization', `Bearer ${bityAccountOauth}`) const url = `${baseUrl.replace(/\/+$/, '')}/orders/${encodeURIComponent(String(args.order_uuid))}/signature${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };