export type SelfMintDropItemTraitRequest = {trait_type: string, value: string}; export type UpdateSelfMintDropItemRequest = {animation_url?: (string | null) | undefined, description?: (string | null) | undefined, external_url?: (string | null) | undefined, media_token: string, name: string, traits?: (Array | null) | undefined}; export type UpdateApiApiV2DropsSlugItemsTokenIdArgs = {slug: string, token_id: string, body: UpdateSelfMintDropItemRequest}; export type UpdateApiApiV2DropsSlugItemsTokenIdOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, WalletAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Build transaction data for updating a SelfMint drop item * * PUT /api/v2/drops/{slug}/items/{token_id} */ export const updateApiApiV2DropsSlugItemsTokenId = async (args: UpdateApiApiV2DropsSlugItemsTokenIdArgs, options?: UpdateApiApiV2DropsSlugItemsTokenIdOptions) => { const {baseUrl = "https://api.opensea.io", fetch: fetchFn = fetch, ApiKeyAuth, WalletAuth} = 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) if (WalletAuth !== undefined) headers.set('authorization', `Bearer ${WalletAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/drops/${encodeURIComponent(String(args.slug))}/items/${encodeURIComponent(String(args.token_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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() };