export type GetApiV1UtxosAbsoluteIndexArgs = {absolute_index: number}; export type GetApiV1UtxosAbsoluteIndexOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Single UTXO by absolute index * * GET /v1/utxos/{absolute_index} */ export const getApiV1UtxosAbsoluteIndex = async (args: GetApiV1UtxosAbsoluteIndexArgs, options?: GetApiV1UtxosAbsoluteIndexOptions) => { const {baseUrl = "https://utxo-indexer.api.umbraprivacy.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/x-protobuf") const url = `${baseUrl.replace(/\/+$/, '')}/v1/utxos/${encodeURIComponent(String(args.absolute_index))}${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 res.blob() };