export type AssetQuantityInput = {amount: string, chain: string, contract: string, token_id?: (string | null) | undefined}; export type SwapQuoteInput = {from_assets: Array, to_assets?: (Array | null) | undefined}; export type TransactionIdentifierInput = {chain: string, swap_provider?: (string | null) | undefined, transaction_hash: string}; export type TransactionReceiptRequest = {relay_request_id?: (string | null) | undefined, request_id?: (string | null) | undefined, swap_quote: SwapQuoteInput, transaction_identifiers?: (Array | null) | undefined}; export type CreateApiApiV2TransactionsReceiptArgs = {body: TransactionReceiptRequest}; export type CreateApiApiV2TransactionsReceiptOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get transaction receipt * * POST /api/v2/transactions/receipt */ export const createApiApiV2TransactionsReceipt = async (args: CreateApiApiV2TransactionsReceiptArgs, options?: CreateApiApiV2TransactionsReceiptOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (ApiKeyAuth !== undefined) headers.set("x-api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/transactions/receipt${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 res.blob() };