# {{TOOL_NAME}} > {{TOOL_DESCRIPTION}} This is an ERC-8257 compliant AI agent tool built with @opensea/tool-sdk. ## Manifest - [Tool Manifest](/.well-known/ai-tool/{{TOOL_SLUG}}.json): Full ERC-8257 manifest with inputs, outputs, and endpoint ## Calling this tool Endpoint: POST {{TOOL_ENDPOINT}}/api Authentication depends on which gates the tool uses (check the [manifest](/.well-known/ai-tool/{{TOOL_SLUG}}.json)): - **Predicate gate**: the endpoint returns `402` with a zero-value challenge. Sign a zero-value EIP-3009 `TransferWithAuthorization` to the challenge's `payTo` with a qualifying wallet and send it in the `X-Payment` header. No USDC moves. - **x402 payment gate**: `X-Payment` header with a signed USDC transfer authorization. The endpoint returns `402` with payment requirements when this gate is active. - Tools may use one gate, both, or neither. Input: JSON body matching the manifest's `inputs` schema. See the [manifest](/.well-known/ai-tool/{{TOOL_SLUG}}.json) for the exact format. ## Using the CLI ``` # Predicate-gated tool (zero-value EIP-3009 auth) PRIVATE_KEY=0x... RPC_URL=https://mainnet.base.org npx @opensea/tool-sdk auth {{TOOL_ENDPOINT}}/api --body '{"query": "hello"}' # x402-paid tool (USDC payment) PRIVATE_KEY=0x... RPC_URL=https://mainnet.base.org npx @opensea/tool-sdk pay {{TOOL_ENDPOINT}}/api --body '{"query": "hello"}' # Smoke-test (auto-detects gate type) PRIVATE_KEY=0x... RPC_URL=https://mainnet.base.org npx @opensea/tool-sdk smoke --endpoint {{TOOL_ENDPOINT}}/api --expect 200 ``` ## Programmatic usage (wallet adapters) ```typescript import { createWalletFromEnv, walletAdapterToClient } from "@opensea/tool-sdk" import { base } from "viem/chains" // createWalletFromEnv auto-detects provider from env vars: // Privy > Fireblocks > Turnkey > PrivateKey const adapter = createWalletFromEnv() const client = await walletAdapterToClient(adapter, base) ``` For **predicate-gated** tools (zero-value EIP-3009 auth): ```typescript import { eip3009AuthenticatedFetch } from "@opensea/tool-sdk" const res = await eip3009AuthenticatedFetch( "{{TOOL_ENDPOINT}}/api", { account: client.account, method: "POST", body: JSON.stringify({ query: "hello" }) }, ) const data = await res.json() ``` For **x402-paid** tools (USDC payment): ```typescript import { paidFetch } from "@opensea/tool-sdk" const res = await paidFetch( "{{TOOL_ENDPOINT}}/api", { signer: adapter, method: "POST", body: JSON.stringify({ query: "hello" }) }, ) const data = await res.json() ``` For tools with **both** gates (predicate + x402): ```typescript import { paidAuthenticatedFetch } from "@opensea/tool-sdk" const res = await paidAuthenticatedFetch( "{{TOOL_ENDPOINT}}/api", { account: client.account, signer: adapter, method: "POST", body: JSON.stringify({ query: "hello" }) }, ) const data = await res.json() ``` ## Wallet providers Set env vars and `createWalletFromEnv()` auto-detects the provider: - `PRIVATE_KEY` + `RPC_URL` — Local private key (simplest) - `PRIVY_APP_ID` — Privy server wallet - `TURNKEY_API_PUBLIC_KEY` — Turnkey signing - `FIREBLOCKS_API_KEY` — Fireblocks vault CLI commands also accept `--wallet-provider privy|turnkey|fireblocks|bankr|private-key`. ## Response codes - 200: Success (JSON body matching outputs schema) - 402: No `X-Payment` header. The challenge is zero-value for predicate-gated tools (use `eip3009AuthenticatedFetch`) and a USDC amount for x402-paid tools (use the `pay` command or `paidAuthenticatedFetch`) - 401: Malformed or invalid `X-Payment` header - 403: Access predicate denied (wallet does not meet requirements) ## Creator {{CREATOR_ADDRESS}}