Skip to content

Commit 28e93c2

Browse files
ryanioclaude
andcommitted
Release v2.10.0
Origin-SHA: 49cb7689dccdcb72c9950f9cb5849caa81b30fa0 ### Minor Changes - 07d0bdc: Add `opensea drops upload-items <slug> <dir> [--manifest <path>] [--concurrency <n>]`, which uploads a folder of item media and saves it as the drop's items in one upload batch: it generates one batch id, requests upload contexts 50 files at a time with it, uploads each chunk, then saves the batch by filename. Without a manifest, items are numbered in natural filename order (`2.png` before `10.png`); hidden files, subfolders and `.csv` files are skipped, and a symlink in the folder is refused rather than followed. Add `opensea drops save-item-media-batch <slug>` (`--body <path>`, or `--upload-batch-id <uuid> --dir <path>` to re-save a folder that is already uploaded) and `create-item-media-upload --upload-batch-id <uuid>`. `save-item-media`, which saves by media token, is deprecated. The programmatic `DropsAPI` gains `createItemMediaUpload`, `saveItemMediaBatch` and `uploadItemMedia(slug, files, options)`, the helper behind `upload-items`. Each file's `data` can be a function so a large drop is read one file at a time. ### Patch Changes - Updated dependencies [bab8feb] - Updated dependencies [07d0bdc] - Updated dependencies [07d0bdc] - @opensea/api-types@0.15.0 - @opensea/sdk@12.11.0 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 707b0a0 commit 28e93c2

11 files changed

Lines changed: 1151 additions & 31 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# @opensea/cli
22

3+
## 2.10.0
4+
5+
### Minor Changes
6+
7+
- 07d0bdc: Add `opensea drops upload-items <slug> <dir> [--manifest <path>] [--concurrency <n>]`, which uploads a folder of item media and saves it as the drop's items in one upload batch: it generates one batch id, requests upload contexts 50 files at a time with it, uploads each chunk, then saves the batch by filename. Without a manifest, items are numbered in natural filename order (`2.png` before `10.png`); hidden files, subfolders and `.csv` files are skipped, and a symlink in the folder is refused rather than followed. Add `opensea drops save-item-media-batch <slug>` (`--body <path>`, or `--upload-batch-id <uuid> --dir <path>` to re-save a folder that is already uploaded) and `create-item-media-upload --upload-batch-id <uuid>`. `save-item-media`, which saves by media token, is deprecated.
8+
9+
The programmatic `DropsAPI` gains `createItemMediaUpload`, `saveItemMediaBatch` and `uploadItemMedia(slug, files, options)`, the helper behind `upload-items`. Each file's `data` can be a function so a large drop is read one file at a time.
10+
11+
### Patch Changes
12+
13+
- Updated dependencies [bab8feb]
14+
- Updated dependencies [07d0bdc]
15+
- Updated dependencies [07d0bdc]
16+
- @opensea/api-types@0.15.0
17+
- @opensea/sdk@12.11.0
18+
319
## 2.9.1
420

521
### Patch Changes

‎docs/cli-reference.md‎

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ opensea drops upload-metadata-ipfs <slug> [--wait] [--interval <seconds>] [--wai
208208
opensea drops metadata-ipfs-status <slug> <workflow-execution-id>
209209
opensea drops create-manifest-upload <slug>
210210
opensea drops upload-file --context <path|-> --file <path> [--index <n>]
211+
opensea drops upload-items <slug> <dir> [--manifest <path>] [--concurrency <n>]
212+
opensea drops create-item-media-upload <slug> --body <path> [--upload-batch-id <uuid>]
213+
opensea drops save-item-media-batch <slug> (--body <path> | --upload-batch-id <uuid> --dir <path>)
214+
opensea drops save-item-media <slug> --body <path>
211215
```
212216

213217
`publish` and `unpublish` print a ready-to-sign transaction. With `--send`
@@ -236,6 +240,35 @@ The upload URL and fields are short-lived credentials, so avoid saving the
236240
context to a shared location. `upload-file` refuses a context whose `url` is
237241
not HTTPS.
238242

243+
`upload-items` saves a folder of item media as the drop's items, replacing any
244+
it already has. It generates one upload batch id, requests upload contexts 50
245+
files at a time with that id, uploads each chunk (`--concurrency` files at
246+
once, default 4), then saves the whole batch by filename. With `--manifest`, it
247+
uploads the manifest CSV first and the save takes token ids and metadata from
248+
it. Without one, items are numbered 1 to n in natural filename order, so
249+
`2.png` comes before `10.png`. Hidden files, subfolders and `.csv` files in the
250+
folder are skipped, and a symlink fails the command before anything is sent,
251+
since item media is published on a public CDN. Progress goes to stderr, and the result is
252+
`{"upload_batch_id": ..., "item_count": ..., "success": true}`:
253+
254+
```bash
255+
opensea drops upload-items my-drop ./media --manifest manifest.csv
256+
```
257+
258+
If every file uploads but the save fails, for example because the manifest
259+
names a file that is not in the folder, fix the cause and save the same batch
260+
again without re-uploading:
261+
262+
```bash
263+
opensea drops save-item-media-batch my-drop --upload-batch-id <uuid> --dir ./media
264+
```
265+
266+
To run the steps yourself, pass one `--upload-batch-id` (a UUID you generate
267+
per set of files) to every `create-item-media-upload` request, upload each
268+
context with `upload-file`, then run `save-item-media-batch` with a body of
269+
`{"upload_batch_id": "<uuid>", "filenames": [...]}` (up to 15,000 filenames).
270+
`save-item-media`, which saves by media token, is deprecated.
271+
239272
## Transactions
240273

241274
```bash

‎docs/sdk.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,36 @@ await uploadToContext(context, new Blob([csvBytes]), {
132132
})
133133
```
134134

135+
`uploadItemMedia` saves a set of item media files as the drop's items, replacing
136+
any it already has. It puts every file in one upload batch (a new UUID unless
137+
you pass `uploadBatchId`), requests upload contexts 50 files at a time and
138+
uploads each chunk before requesting the next, then saves the batch by filename
139+
with `saveItemMediaBatch`. Without a manifest, items are numbered 1 to n in the
140+
order of `files`. A file's `data` can be a function, so a large drop is read one
141+
file at a time:
142+
143+
```typescript
144+
import { readFile } from "node:fs/promises"
145+
146+
const result = await creator.drops.uploadItemMedia(
147+
"my-drop",
148+
["1.png", "2.png"].map(filename => ({
149+
filename,
150+
data: async () =>
151+
new Blob([new Uint8Array(await readFile(`media/${filename}`))]),
152+
})),
153+
{
154+
manifest: { filename: "manifest.csv", data: new Blob([csvBytes]) },
155+
onProgress: ({ uploaded, total }) => console.error(`${uploaded}/${total}`),
156+
},
157+
)
158+
// { upload_batch_id: "...", item_count: 2, success: true }
159+
```
160+
161+
For the steps one at a time, pass one `upload_batch_id` to every
162+
`createItemMediaUpload` call, upload each context with `uploadToContext`, then
163+
call `saveItemMediaBatch("my-drop", { upload_batch_id, filenames })`.
164+
135165
## Events
136166

137167
```typescript

‎package-lock.json‎

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/cli",
3-
"version": "2.9.1",
3+
"version": "2.10.0",
44
"type": "module",
55
"description": "OpenSea CLI - Query the OpenSea API from the command line or programmatically",
66
"main": "dist/index.js",
@@ -23,8 +23,8 @@
2323
"prepublishOnly": "npm run build"
2424
},
2525
"dependencies": {
26-
"@opensea/api-types": "^0.14.2",
27-
"@opensea/sdk": "^12.10.2",
26+
"@opensea/api-types": "^0.15.0",
27+
"@opensea/sdk": "^12.11.0",
2828
"@opensea/wallet-adapters": "^1.2.1",
2929
"commander": "^14.0.3",
3030
"zod": "^4.3.6"

0 commit comments

Comments
 (0)