get_nft_sales
Retrieve NFT sales data for collections or specific tokens using contract addresses, token IDs, and customizable filters like block ranges and marketplaces.
Instructions
Get NFT sales data for a contract or specific NFT
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| contractAddress | No | The contract address of the NFT collection | |
| tokenId | No | The token ID of the specific NFT | |
| fromBlock | No | Starting block number for the query | |
| toBlock | No | Ending block number for the query | |
| order | No | Order of results (ascending or descending) | |
| marketplace | No | Filter by marketplace (e.g., 'seaport', 'wyvern') | |
| pageKey | No | Key for pagination | |
| pageSize | No | Number of results per page |
Implementation Reference
- index.ts:471-512 (registration)Registration of the 'get_nft_sales' tool in the tools list, including its description and input schema definition.name: "get_nft_sales", description: "Get NFT sales data for a contract or specific NFT", inputSchema: { type: "object", properties: { contractAddress: { type: "string", description: "The contract address of the NFT collection", }, tokenId: { type: "string", description: "The token ID of the specific NFT", }, fromBlock: { type: "number", description: "Starting block number for the query", }, toBlock: { type: "number", description: "Ending block number for the query", }, order: { type: "string", enum: ["asc", "desc"], description: "Order of results (ascending or descending)", }, marketplace: { type: "string", description: "Filter by marketplace (e.g., 'seaport', 'wyvern')", }, pageKey: { type: "string", description: "Key for pagination", }, pageSize: { type: "number", description: "Number of results per page", }, }, }, },
- index.ts:61-64 (schema)TypeScript type definition for GetNftSalesParams, extending Alchemy SDK's GetNftSalesOptions with optional contractAddress and tokenId.type GetNftSalesParams = GetNftSalesOptions & { contractAddress?: string; tokenId?: string; };
- index.ts:163-177 (schema)Parameter validation function for get_nft_sales tool inputs, ensuring args conform to GetNftSalesParams.const isValidGetNftSalesParams = (args: any): args is GetNftSalesParams => { return ( typeof args === "object" && args !== null && (args.contractAddress === undefined || typeof args.contractAddress === "string") && (args.tokenId === undefined || typeof args.tokenId === "string") && (args.fromBlock === undefined || typeof args.fromBlock === "number") && (args.toBlock === undefined || typeof args.toBlock === "number") && (args.order === undefined || typeof args.order === "string") && (args.marketplace === undefined || typeof args.marketplace === "string") && (args.pageKey === undefined || typeof args.pageKey === "string") && (args.pageSize === undefined || typeof args.pageSize === "number") ); };
- index.ts:43-43 (schema)Import of GetNftSalesOptions type from alchemy-sdk for use in get_nft_sales schema.GetNftSalesOptions,