Skip to content

Commit 1501669

Browse files
committed
Release v0.4.0
1 parent 24b479f commit 1501669

22 files changed

Lines changed: 1172 additions & 56 deletions

CHANGELOG.md

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

3+
## 0.4.0
4+
5+
### Minor Changes
6+
7+
- 5838915: DX improvements from canary builder feedback:
8+
9+
- `createWellKnownHandler` now accepts `ManifestDefinition` (with `EnvResolver` lambdas) and resolves internally on first request — eliminates the silent-failure footgun where lambda fields would serialize as `undefined`. Accepts an optional `env` parameter for non-Node runtimes (Cloudflare Workers, Bun).
10+
- Well-known handler no longer 404s on pathname mismatch — relies on framework router. If you mounted `createWellKnownHandler` as a fall-through, scope it to the well-known path explicitly.
11+
- `defineToolPaywall` recipient accepts `EnvResolver<Address>` so the payout address can be read from env vars at request time instead of module-load time
12+
- `defineToolPaywall` returns `onSettle` callback for post-payment telemetry/logging
13+
- Template `package.json` files inject the current SDK version at `init` time instead of pinning stale `^0.1.0`
14+
- Vercel adapter uses `x-forwarded-proto` header (consistent with Express adapter)
15+
- `describeToolAccess` helper reads a tool's predicate name and requirements from the registry; `decodeRequirement` decodes known kinds (ERC-721, ERC-1155, Subscription) into typed objects
16+
- `onSettle` payer is now sourced from the facilitator's `/verify` response (reliable for pure-x402 tools) with fallback to `ctx.callerAddress`
17+
- `registerTool` and `updateToolMetadata` validate URI length client-side before sending the transaction
18+
- Templates include `EnvResolver` lambda examples in comments
19+
- `init` command prints workspace warning for pnpm users
20+
21+
- ba59886: Add `@opensea/tool-sdk/testing` subpath export with test utilities for tool builders: `createMockManifest`, `createMockToolContext`, `mockFetch`, and `createTestHandler`.
22+
323
## 0.3.1
424

525
### Patch Changes

SKILLS.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,35 @@ CompositePredicate.setComposition(toolId, Op.ALL, [
689689
])
690690
```
691691

692+
### SDK Helpers for Reading Predicate Requirements
693+
694+
Use `describeToolAccess` to read a tool's predicate name, requirements, and logic from the registry, and `decodeRequirement` to decode the raw `kind`/`data` into typed objects:
695+
696+
```typescript
697+
import { describeToolAccess, decodeRequirement } from "@opensea/tool-sdk"
698+
699+
const description = await describeToolAccess({ toolId: 1n })
700+
// { openAccess: false, predicateName: "ERC721OwnerPredicate", requirements: [...], logic: "OR" }
701+
702+
for (const req of description.requirements) {
703+
const decoded = decodeRequirement(req)
704+
switch (decoded.type) {
705+
case "erc721":
706+
console.log(`Requires NFT from collection ${decoded.collection}`)
707+
break
708+
case "erc1155":
709+
console.log(`Requires token #${decoded.tokenId} from ${decoded.collection}`)
710+
break
711+
case "subscription":
712+
console.log(`Requires subscription (min tier ${decoded.minTier}) from ${decoded.collection}`)
713+
break
714+
case "unknown":
715+
console.log(`Unknown requirement kind ${decoded.kind}`)
716+
break
717+
}
718+
}
719+
```
720+
692721
---
693722

694723
## 7. Wallet Setup

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@opensea/tool-sdk",
3-
"version": "0.3.1",
3+
"version": "0.4.0",
44
"type": "module",
55
"description": "SDK and CLI for building ERC-XXXX compliant AI agent tools",
66
"repository": {
@@ -18,6 +18,10 @@
1818
"./cloudflare": {
1919
"types": "./dist/adapters/cloudflare.d.ts",
2020
"default": "./dist/adapters/cloudflare.js"
21+
},
22+
"./testing": {
23+
"types": "./dist/testing/index.d.ts",
24+
"default": "./dist/testing/index.js"
2125
}
2226
},
2327
"files": [

0 commit comments

Comments
 (0)