Skip to content

Commit 4590963

Browse files
committed
Release v1.6.0
1 parent 34a07dc commit 4590963

12 files changed

Lines changed: 268 additions & 9 deletions

CHANGELOG.md

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

3+
## 1.6.0
4+
5+
### Minor Changes
6+
7+
- 94dbf08: Sync downstream packages to the API surface introduced in `@opensea/api-types` 0.3.0 (os2-core#40171 + #40190): drop methods backed by removed endpoints, fix POST shapes, and surface the four new endpoints (`/listings/sweep`, `/offers/collection/{slug}/nfts/{identifier}`, `/swap/execute`, `/transactions/receipt`).
8+
9+
### `@opensea/sdk` — breaking
10+
11+
**Removed methods** (the underlying GET endpoints were deleted; they would return 404 against the new API):
12+
13+
- `OpenSeaAPI.getOrder` / `OrdersAPI.getOrder` — was already `@deprecated`. Use `getBestOffer` / `getBestListing` for "best" or `getAllOffers` / `getAllListings` for collection-wide results.
14+
- `OpenSeaAPI.getOrders` / `OrdersAPI.getOrders` — was already `@deprecated`. Use `getAllOffers` / `getAllListings`.
15+
- `OpenSeaAPI.postOrder` / `OrdersAPI.postOrder` — was already `@deprecated`. Use `postListing` / `postOffer`.
16+
- `OpenSeaAPI.getNFTOffers` / `OffersAPI.getNFTOffers` — replaced by `getOffersByNFT(slug, tokenId)` (new endpoint takes a collection slug, not contract address).
17+
- `OpenSeaAPI.getNFTListings` / `ListingsAPI.getNFTListings` — no per-NFT all-listings endpoint exists. Use `getBestListing(slug, tokenId)` for the best, or `getAllListings(slug)` and filter client-side.
18+
- Helpers `getOrdersAPIPath`, `serializeOrdersQueryOptions`, `deserializeOrder` — orphaned with the methods above.
19+
- Types `OrderAPIOptions`, `OrdersQueryOptions`, `OrdersQueryResponse`, `OrdersPostQueryResponse`, `ListingPostQueryResponse`, `OfferPostQueryResponse`, `SerializedOrderV2`, `GetOrdersResponse` — unused after the deletions.
20+
- Stats fields `IntervalStat.{volume_diff, volume_change, sales_diff, average_price}` and `Stats.{market_cap, average_price}` — server stopped returning them (always `0` previously).
21+
22+
**Behavior changes:**
23+
24+
- `OrdersAPI.postListing` and `OrdersAPI.postOffer` now read the bare `Listing` / `Offer` response (the upstream API dropped the legacy `order` wrapper field).
25+
- `OpenSeaSDK.createOffer` returns `Promise<Offer>` (was `Promise<OrderV2>`).
26+
- `OpenSeaSDK.createListing` returns `Promise<Listing>` (was `Promise<OrderV2>`).
27+
- `OpenSeaSDK.createBulkListings` returns `Promise<BulkOrderResult<Listing>>`; `createBulkOffers` returns `Promise<BulkOrderResult<Offer>>`. `BulkOrderResult` is now generic in the success type.
28+
29+
**New methods:**
30+
31+
- `OpenSeaAPI.getOffersByNFT(slug, identifier, limit?, next?)` — all offers for one NFT.
32+
- `OpenSeaAPI.sweepCollection(request)` — bulk-buy items from a collection, any payment token (incl. cross-chain).
33+
- `OpenSeaAPI.executeSwap(request)` — multi-asset swap; companion to `getSwapQuote`.
34+
- `OpenSeaAPI.getTransactionReceipt(request)` — fetch transaction status (sweep, swap, fulfillment).
35+
- New `TransactionsAPI` sub-client.
36+
37+
### `@opensea/cli` — additive (with one type re-export removed)
38+
39+
- `OrdersResponse`, `SimpleAccount` re-exports removed from `src/types/api.ts` (schemas no longer exist).
40+
- `offers all` and `listings all` now accept `--maker <address>` to filter by order maker.
41+
- New commands:
42+
- `listings sweep` — bulk-buy items from a collection with any payment token.
43+
- `offers by-nft <collection> <token-id>` — all offers for a specific NFT.
44+
- `transactions receipt --request <file>` — fetch transaction receipt/status (request body via JSON file).
45+
- New SDK helpers: `OpenSeaCLI.transactions.receipt`, `SwapsAPI.executeMulti` (POST `/swap/execute`).
46+
47+
### `@opensea/skill` — docs refresh
48+
49+
- `opensea-api/references/rest-api.md` — endpoint tables refreshed: removed deleted GET rows, added `?maker=` annotations, added `listings/sweep`, per-NFT offers, `swap/execute`, and `transactions/receipt` rows.
50+
- `opensea-marketplace/references/marketplace-api.md` — replaced "Get listings/offers for specific NFT" sections (which curled the removed endpoints) with the slug-based replacements.
51+
52+
### Patch Changes
53+
54+
- Updated dependencies [7a51fd0]
55+
- @opensea/api-types@0.3.0
56+
357
## 1.5.0
458

559
### Minor Changes

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/cli",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"type": "module",
55
"description": "OpenSea CLI - Query the OpenSea API from the command line or programmatically",
66
"main": "dist/index.js",
@@ -23,7 +23,7 @@
2323
"prepublishOnly": "npm run build"
2424
},
2525
"dependencies": {
26-
"@opensea/api-types": "^0.2.3",
26+
"@opensea/api-types": "^0.3.0",
2727
"@opensea/wallet-adapters": "^0.3.0",
2828
"commander": "^14.0.3",
2929
"zod": "^4.3.6"

src/cli.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
swapsCommand,
1616
tokenGroupsCommand,
1717
tokensCommand,
18+
transactionsCommand,
1819
walletCommand,
1920
} from "./commands/index.js"
2021
import { type OutputFormat, setOutputOptions } from "./output.js"
@@ -132,6 +133,7 @@ program.addCommand(
132133
)
133134
program.addCommand(searchCommand(getClient, getFormat))
134135
program.addCommand(swapsCommand(getClient, getFormat))
136+
program.addCommand(transactionsCommand(getClient, getFormat))
135137
program.addCommand(healthCommand(getClient, getFormat))
136138
program.addCommand(walletCommand(getFormat))
137139

src/commands/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ export { searchCommand } from "./search.js"
1212
export { swapsCommand } from "./swaps.js"
1313
export { tokenGroupsCommand } from "./token-groups.js"
1414
export { tokensCommand } from "./tokens.js"
15+
export { transactionsCommand } from "./transactions.js"
1516
export { walletCommand } from "./wallet.js"

src/commands/listings.ts

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,75 @@ export function listingsCommand(
1717
.argument("<collection>", "Collection slug")
1818
.option("--limit <limit>", "Number of results", "20")
1919
.option("--next <cursor>", "Pagination cursor")
20+
.option("--maker <address>", "Filter by order maker address")
2021
.action(
21-
async (collection: string, options: { limit: string; next?: string }) => {
22+
async (
23+
collection: string,
24+
options: { limit: string; next?: string; maker?: string },
25+
) => {
2226
const client = getClient()
2327
const result = await client.get<{
2428
listings: Listing[]
2529
next?: string
2630
}>(`/api/v2/listings/collection/${collection}/all`, {
2731
limit: parseIntOption(options.limit, "--limit"),
2832
next: options.next,
33+
maker: options.maker,
2934
})
3035
console.log(formatOutput(result, getFormat()))
3136
},
3237
)
3338

39+
cmd
40+
.command("sweep")
41+
.description("Bulk-buy items from a collection (any payment token)")
42+
.requiredOption("--collection <slug>", "Collection slug to sweep")
43+
.requiredOption("--max-items <n>", "Maximum number of items to buy", v =>
44+
parseIntOption(v, "--max-items"),
45+
)
46+
.requiredOption(
47+
"--max-price-per-item <wei>",
48+
"Maximum price per item in wei of the payment token",
49+
)
50+
.requiredOption("--buyer <address>", "Buyer wallet address")
51+
.requiredOption(
52+
"--payment-chain <chain>",
53+
"Chain slug of the payment token (EVM or SVM)",
54+
)
55+
.requiredOption(
56+
"--payment-token <address>",
57+
"Payment token contract address (0x0...0 for native)",
58+
)
59+
.option("--recipient <address>", "Different recipient address for NFTs")
60+
.action(
61+
async (options: {
62+
collection: string
63+
maxItems: number
64+
maxPricePerItem: string
65+
buyer: string
66+
paymentChain: string
67+
paymentToken: string
68+
recipient?: string
69+
}) => {
70+
const client = getClient()
71+
const body: Record<string, unknown> = {
72+
collection_slug: options.collection,
73+
max_items: options.maxItems,
74+
max_price_per_item: options.maxPricePerItem,
75+
buyer: options.buyer,
76+
payment: {
77+
chain: options.paymentChain,
78+
token_address: options.paymentToken,
79+
},
80+
}
81+
if (options.recipient) {
82+
body.recipient = options.recipient
83+
}
84+
const result = await client.post("/api/v2/listings/sweep", body)
85+
console.log(formatOutput(result, getFormat()))
86+
},
87+
)
88+
3489
addTraitsOption(
3590
cmd
3691
.command("best")

src/commands/offers.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,45 @@ export function offersCommand(
1717
.argument("<collection>", "Collection slug")
1818
.option("--limit <limit>", "Number of results", "20")
1919
.option("--next <cursor>", "Pagination cursor")
20+
.option("--maker <address>", "Filter by order maker address")
2021
.action(
21-
async (collection: string, options: { limit: string; next?: string }) => {
22+
async (
23+
collection: string,
24+
options: { limit: string; next?: string; maker?: string },
25+
) => {
2226
const client = getClient()
2327
const result = await client.get<{
2428
offers: Offer[]
2529
next?: string
2630
}>(`/api/v2/offers/collection/${collection}/all`, {
2731
limit: parseIntOption(options.limit, "--limit"),
2832
next: options.next,
33+
maker: options.maker,
34+
})
35+
console.log(formatOutput(result, getFormat()))
36+
},
37+
)
38+
39+
cmd
40+
.command("by-nft")
41+
.description("Get all offers for a specific NFT")
42+
.argument("<collection>", "Collection slug")
43+
.argument("<token-id>", "Token ID")
44+
.option("--limit <limit>", "Number of results", "20")
45+
.option("--next <cursor>", "Pagination cursor")
46+
.action(
47+
async (
48+
collection: string,
49+
tokenId: string,
50+
options: { limit: string; next?: string },
51+
) => {
52+
const client = getClient()
53+
const result = await client.get<{
54+
offers: Offer[]
55+
next?: string
56+
}>(`/api/v2/offers/collection/${collection}/nfts/${tokenId}`, {
57+
limit: parseIntOption(options.limit, "--limit"),
58+
next: options.next,
2959
})
3060
console.log(formatOutput(result, getFormat()))
3161
},

src/commands/transactions.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { readFileSync } from "node:fs"
2+
import { Command } from "commander"
3+
import type { OpenSeaClient } from "../client.js"
4+
import type { OutputFormat } from "../output.js"
5+
import { formatOutput } from "../output.js"
6+
import type {
7+
TransactionReceiptRequest,
8+
TransactionReceiptResponse,
9+
} from "../types/index.js"
10+
11+
export function transactionsCommand(
12+
getClient: () => OpenSeaClient,
13+
getFormat: () => OutputFormat,
14+
): Command {
15+
const cmd = new Command("transactions").description(
16+
"Query transaction status and receipts",
17+
)
18+
19+
cmd
20+
.command("receipt")
21+
.description(
22+
"Fetch transaction status. Works for listing fulfillments, " +
23+
"cross-chain buys, sweeps, offer fulfillments, and token swaps.",
24+
)
25+
.requiredOption(
26+
"--request <file>",
27+
"Path to a JSON file containing the request body " +
28+
"(at minimum a `swap_quote` object). " +
29+
"Optional fields: `transaction_identifiers`, `relay_request_id`, " +
30+
"`request_id`.",
31+
)
32+
.action(async (options: { request: string }) => {
33+
const client = getClient()
34+
let body: TransactionReceiptRequest
35+
try {
36+
body = JSON.parse(
37+
readFileSync(options.request, "utf8"),
38+
) as TransactionReceiptRequest
39+
} catch (err) {
40+
const cause = err instanceof Error ? err.message : String(err)
41+
throw new Error(
42+
`--request: could not read or parse '${options.request}': ${cause}`,
43+
)
44+
}
45+
const result = await client.post<TransactionReceiptResponse>(
46+
"/api/v2/transactions/receipt",
47+
body,
48+
)
49+
console.log(formatOutput(result, getFormat()))
50+
})
51+
52+
return cmd
53+
}

0 commit comments

Comments
 (0)