export type CreateApiV1PayoutValidateAddressArgs = {'x-api-key'?: string | undefined, body: {address?: string | undefined, currency?: string | undefined, extra_id?: string | undefined}}; export type CreateApiV1PayoutValidateAddressOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Validate address * * POST /v1/payout/validate-address */ export const createApiV1PayoutValidateAddress = async (args: CreateApiV1PayoutValidateAddressArgs, options?: CreateApiV1PayoutValidateAddressOptions) => { const {baseUrl = "https://api.nowpayments.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/v1/payout/validate-address${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 };