export type GetApiRampOrdersByIntentIntentAddressArgs = {intentAddress: string}; export type GetApiRampOrdersByIntentIntentAddressOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get a ramp order by intent address * * GET /ramp/orders/by-intent/{intentAddress} */ export const getApiRampOrdersByIntentIntentAddress = async (args: GetApiRampOrdersByIntentIntentAddressArgs, options?: GetApiRampOrdersByIntentIntentAddressOptions) => { const {baseUrl = "https://api.chainrails.io/api/v1", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set('authorization', `Bearer ${apiKey}`) const url = `${baseUrl.replace(/\/+$/, '')}/ramp/orders/by-intent/${encodeURIComponent(String(args.intentAddress))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };