export type CrossChainPaymentToken = {chain: string, token_address: string}; export type CrossChainDropMintRequest = {minter: string, payer: string, payment: CrossChainPaymentToken, quantity: number}; export type CreateApiApiV2DropsSlugCrossChainMintArgs = {slug: string, body: CrossChainDropMintRequest}; export type CreateApiApiV2DropsSlugCrossChainMintOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Build cross-chain mint transactions for a drop * * POST /api/v2/drops/{slug}/cross_chain_mint */ export const createApiApiV2DropsSlugCrossChainMint = async (args: CreateApiApiV2DropsSlugCrossChainMintArgs, options?: CreateApiApiV2DropsSlugCrossChainMintOptions) => { 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/drops/${encodeURIComponent(String(args.slug))}/cross_chain_mint${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() };