Skip to content

Commit 92f261f

Browse files
committed
Release v1.17.0
Origin-SHA: 49f6b1ccdea412dd451b3ecdb71446338fc13e0e
1 parent 364c2e4 commit 92f261f

13 files changed

Lines changed: 225 additions & 17 deletions

File tree

CHANGELOG.md

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

3+
## 1.17.0
4+
5+
### Minor Changes
6+
7+
- a093a89: Add first-class SDK and CLI access to materialized token activity stats, with typed window selection and response models.
8+
9+
### Patch Changes
10+
11+
- 954d547: Add typed account agent status fields and helpers to mark or clear registered
12+
agent wallets from the SDK and CLI.
13+
- Updated dependencies [954d547]
14+
- Updated dependencies [a093a89]
15+
- @opensea/api-types@0.8.6
16+
- @opensea/sdk@11.7.0
17+
318
## 1.16.0
419

520
### Minor Changes

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,11 @@ Wallet-authenticated endpoints also require a scoped token:
5555

5656
```bash
5757
export OPENSEA_PRIVATE_KEY="..."
58-
opensea login --private-key --scopes read:favorites
58+
opensea login --private-key --scopes read:favorites,write:wallets
5959
WALLET=$(opensea --format json whoami | jq -r '.address')
6060
opensea api request GET "/api/v2/account/$WALLET/favorites" --params '{"limit":1}'
61+
opensea accounts mark-agent "$WALLET"
62+
opensea accounts remove-agent "$WALLET"
6163
opensea auth revoke
6264
```
6365

@@ -90,6 +92,9 @@ opensea search collections "cool cats"
9092
# Get trending tokens
9193
opensea tokens trending --limit 5
9294

95+
# Get materialized token activity for selected windows
96+
opensea tokens activity-stats base 0x4200000000000000000000000000000000000006 --windows 1h,24h
97+
9398
# Human-readable table output
9499
opensea --format table collections stats mfers
95100
```
@@ -106,9 +111,9 @@ opensea --format table collections stats mfers
106111
| `transactions` | Poll transaction and cross-chain receipt status |
107112
| `events` | List marketplace events (sales, transfers, mints, etc.) |
108113
| `search` | Search collections, NFTs, tokens, and accounts |
109-
| `tokens` | Get trending tokens, top tokens, and token details |
114+
| `tokens` | Get trending tokens, top tokens, token details, and activity stats |
110115
| `swaps` | Get swap quotes for token trading |
111-
| `accounts` | Get account details |
116+
| `accounts` | Get account details and manage agent wallet designations |
112117
| `whoami` | Show the current wallet, scopes, and scope source |
113118
| `api request` | Call any API v2 endpoint with the active API key and wallet JWT |
114119

@@ -130,7 +135,14 @@ const { asset_events } = await client.events.byCollection("mfers", {
130135
eventType: "sale",
131136
})
132137
const { tokens } = await client.tokens.trending({ chains: ["base"], limit: 5 })
138+
const activity = await client.tokens.activityStats(
139+
"base",
140+
"0x4200000000000000000000000000000000000006",
141+
{ windows: ["1h", "24h"] },
142+
)
133143
const results = await client.search.collections("mfers", { limit: 5 })
144+
const markedAgent = await client.accounts.markAgent("0x123...")
145+
const clearedAgent = await client.accounts.removeAgent("0x123...")
134146

135147
// Error handling
136148
try {

docs/cli-reference.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,12 @@ opensea search <query> [--types <types>] [--chains <chains>] [--limit <n>]
125125
opensea tokens trending [--chains <chains>] [--limit <n>] [--next <cursor>]
126126
opensea tokens top [--chains <chains>] [--limit <n>] [--next <cursor>]
127127
opensea tokens get <chain> <address>
128+
opensea tokens activity-stats <chain> <address> [--windows <windows>]
128129
```
129130

131+
`--windows` accepts a comma-separated list containing `5m`, `1h`, `4h`, and
132+
`24h`. If omitted, the API returns every available materialized window.
133+
130134
## Swaps
131135

132136
```bash
@@ -137,6 +141,11 @@ opensea swaps quote --from-chain <chain> --from-address <address> --to-chain <ch
137141

138142
```bash
139143
opensea accounts get <address>
144+
opensea accounts mark-agent <wallet>
145+
opensea accounts remove-agent <wallet>
140146
```
141147

148+
Agent designation commands require a wallet-authenticated token with the
149+
`write:wallets` scope.
150+
142151
> REST list commands support cursor-based pagination. The search command returns a flat list with no cursor. See [pagination.md](pagination.md) for details.

docs/sdk.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ const { asset_events, next } = await client.events.byNFT(
137137

138138
```typescript
139139
const account = await client.accounts.get("0x123...")
140+
const markedAgent = await client.accounts.markAgent("0x123...")
141+
const clearedAgent = await client.accounts.removeAgent("0x123...")
140142
```
141143

142144
## Tokens
@@ -154,8 +156,18 @@ const { tokens, next } = await client.tokens.top({
154156
})
155157

156158
const tokenDetails = await client.tokens.get("base", "0x123...")
159+
160+
const activity = await client.tokens.activityStats(
161+
"base",
162+
"0x4200000000000000000000000000000000000006",
163+
{ windows: ["1h", "24h"] },
164+
)
157165
```
158166

167+
Token activity stats use the public REST response shape, including
168+
`computed_at`, `volume_usd`, and `average_trade_usd`. A requested window is
169+
omitted from `windows` when it has no swaps.
170+
159171
## Search
160172

161173
Search uses the unified `/api/v2/search` REST endpoint. Results are ranked by relevance and each result has a `type` discriminator (`collection`, `nft`, `token`, or `account`) with the corresponding typed object. The search endpoint does not support cursor-based pagination; use `limit` to control result count (max 50).

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": "1.16.0",
3+
"version": "1.17.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.8.4",
27-
"@opensea/sdk": "^11.6.0",
26+
"@opensea/api-types": "^0.8.6",
27+
"@opensea/sdk": "^11.7.0",
2828
"@opensea/wallet-adapters": "^0.3.3",
2929
"commander": "^14.0.3",
3030
"zod": "^4.3.6"

src/commands/accounts.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import type {
1111
FavoriteResponse,
1212
TokenBalanceSortBy,
13+
WalletAgentStatusResponse,
1314
WatchlistRequest,
1415
} from "../types/index.js"
1516

@@ -28,6 +29,34 @@ export function accountsCommand(
2829
await outputGet(client, getFormat(), `/api/v2/accounts/${address}`)
2930
})
3031

32+
cmd
33+
.command("mark-agent")
34+
.description(
35+
"Mark a registered wallet as an agent (requires write:wallets)",
36+
)
37+
.argument("<wallet>", "Registered wallet address")
38+
.action(async (wallet: string) => {
39+
const client = getClient()
40+
const result = await client.put<WalletAgentStatusResponse>(
41+
`/api/v2/accounts/wallets/${encodeURIComponent(wallet)}/agent`,
42+
)
43+
console.log(formatOutput(result, getFormat()))
44+
})
45+
46+
cmd
47+
.command("remove-agent")
48+
.description(
49+
"Remove a registered wallet's agent designation (requires write:wallets)",
50+
)
51+
.argument("<wallet>", "Registered wallet address")
52+
.action(async (wallet: string) => {
53+
const client = getClient()
54+
const result = await client.delete<WalletAgentStatusResponse>(
55+
`/api/v2/accounts/wallets/${encodeURIComponent(wallet)}/agent`,
56+
)
57+
console.log(formatOutput(result, getFormat()))
58+
})
59+
3160
cmd
3261
.command("tokens")
3362
.description("Get token balances for an account")

src/commands/tokens.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,26 @@ export function tokensCommand(
198198
},
199199
)
200200

201+
cmd
202+
.command("activity-stats")
203+
.description(
204+
"Get materialized trade count, USD volume, and average trade size for a token",
205+
)
206+
.argument("<chain>", "Chain")
207+
.argument("<address>", "Token contract address")
208+
.option("--windows <windows>", "Comma-separated windows (5m, 1h, 4h, 24h)")
209+
.action(
210+
async (chain: string, address: string, options: { windows?: string }) => {
211+
const client = getClient()
212+
await outputGet(
213+
client,
214+
getFormat(),
215+
`/api/v2/chain/${chain as Chain}/token/${address}/activity/stats`,
216+
{ windows: options.windows },
217+
)
218+
},
219+
)
220+
201221
addPaginationOptions(
202222
cmd
203223
.command("account-activity")

src/sdk.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ import type {
5858
SweepCollectionResponse,
5959
Token,
6060
TokenAccountActivityPaginatedResponse,
61+
TokenActivityStatsResponse,
62+
TokenActivityStatsWindow,
6163
TokenBalancePaginatedResponse,
6264
TokenBalanceSortBy,
6365
TokenBatchResponse,
@@ -74,6 +76,7 @@ import type {
7476
TransferRequest,
7577
TransferResponse,
7678
ValidateMetadataResponse,
79+
WalletAgentStatusResponse,
7780
WalletPnlResponse,
7881
} from "./types/index.js"
7982
import type { TransactionResult, WalletAdapter } from "./wallet/index.js"
@@ -682,6 +685,18 @@ class AccountsAPI {
682685
return this.client.get(`/api/v2/accounts/${address}`)
683686
}
684687

688+
async markAgent(wallet: string): Promise<WalletAgentStatusResponse> {
689+
return this.client.put(
690+
`/api/v2/accounts/wallets/${encodeURIComponent(wallet)}/agent`,
691+
)
692+
}
693+
694+
async removeAgent(wallet: string): Promise<WalletAgentStatusResponse> {
695+
return this.client.delete(
696+
`/api/v2/accounts/wallets/${encodeURIComponent(wallet)}/agent`,
697+
)
698+
}
699+
685700
async tokens(
686701
address: string,
687702
options?: {
@@ -942,6 +957,17 @@ class TokensAPI {
942957
})
943958
}
944959

960+
async activityStats(
961+
chain: Chain,
962+
address: string,
963+
options?: { windows?: TokenActivityStatsWindow[] },
964+
): Promise<TokenActivityStatsResponse> {
965+
return this.client.get(
966+
`/api/v2/chain/${chain}/token/${address}/activity/stats`,
967+
{ windows: options?.windows?.join(",") },
968+
)
969+
}
970+
945971
async accountActivity(
946972
address: string,
947973
options?: {

src/types/api.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ export type PriceHistoryResponse = Schemas["PriceHistoryResponse"]
9595
export type OhlcvResponse = Schemas["OhlcvResponse"]
9696
export type TokenSwapActivityPaginatedResponse =
9797
Schemas["TokenSwapActivityPaginatedResponse"]
98+
export type TokenActivityStatsResponse = Schemas["TokenActivityStatsResponse"]
99+
export type TokenActivityWindowStatsResponse =
100+
Schemas["TokenActivityWindowStatsResponse"]
98101
export type TokenAccountActivityPaginatedResponse =
99102
Schemas["TokenAccountActivityPaginatedResponse"]
100103
export type TokenHoldersResponse = Schemas["TokenHoldersResponse"]
@@ -124,6 +127,8 @@ export interface TraitFilter {
124127
value: string
125128
}
126129

130+
export type TokenActivityStatsWindow = "5m" | "1h" | "4h" | "24h"
131+
127132
// ── CLI-specific types (not from API spec) ──────────────────────────
128133

129134
export type SafelistStatus =
@@ -278,6 +283,7 @@ export type WatchlistRequest = Schemas["WatchlistRequest"]
278283
export type FavoriteResponse = Schemas["FavoriteResponse"]
279284
export type CancelRequest = Schemas["CancelRequest"]
280285
export type WalletUnlinkResponse = Schemas["WalletUnlinkResponse"]
286+
export type WalletAgentStatusResponse = Schemas["WalletAgentStatusResponse"]
281287

282288
export type UpdateProfileSettingsRequest =
283289
Schemas["UpdateProfileSettingsRequest"]

0 commit comments

Comments
 (0)