export type Decimal = number; export type Currency = string; export type CreateApiAccountTransferSOONArgs = {body: {debit_account?: string | undefined, credit_account?: string | undefined, amount?: Decimal | undefined, currency?: Currency | undefined}}; export type CreateApiAccountTransferSOONOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Transfer funds between own accounts * * POST /account/transfer (SOON) */ export const createApiAccountTransferSOON = async (args: CreateApiAccountTransferSOONArgs, options: CreateApiAccountTransferSOONOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/account/transfer (SOON)${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 undefined };