Uh oh!
There was an error while loading. Please reload this page.
Feat/opensea Integrate Opensea Actions to Agentkit - #325
Conversation
🟡 Heimdall Review Status
|
Elkhan-Isayev
commented
Feb 9, 2025
OpenSea Action Provider for AgentKit🚀 Overview File StructureCore Features
Technical Details
This integration ensures that AI agents can interact with OpenSea via a secure and type-safe interface, simplifying the process for users and enabling efficient NFT trading within the chat system. |
Elkhan-Isayev
commented
Feb 9, 2025
Issue ticked id: #300 |
0xRAG
left a comment
There was a problem hiding this comment.
Thanks for the contribution @Elkhan-Isayev, this is an exciting addition! Please review and address my feedback. Also, it would be great if you could add screenshots of the action working as expected.
| "typescript": "^5.4.5" | ||
| }, | ||
| "dependencies": { | ||
| "opensea-js": "^7.1.15" |
There was a problem hiding this comment.
Please move this to typescript/agentkit/package.json
| import { z } from "zod"; | ||
| import { ActionProvider } from "../actionProvider"; | ||
| import { CreateAction } from "../actionDecorator"; | ||
| import { OpenSeaSDK, Chain } from "opensea-js"; // Assuming an OpenSea SDK is available |
| */ | ||
| export class OpenSeaActionProvider extends ActionProvider { | ||
| private readonly client: OpenSeaSDK; | ||
| private readonly walletProvider: ViemWalletProvider; |
There was a problem hiding this comment.
I suggest extending ViemWalletProvider which will configure a PublicClient / WalletClient. Then you'll also be able to remove the walletPrivateKey config parameter
| */ | ||
| export interface OpenSeaActionProviderConfig { | ||
| apiKey?: string; | ||
| walletPrivateKey: string; |
There was a problem hiding this comment.
See comment below about removing this
| /* | ||
| * if (!config.apiKey) { | ||
| * throw new Error("OPENSEA_API_KEY is not configured."); | ||
| * } | ||
| */ |
| }) | ||
| async listNFT(args: z.infer<typeof OpenSeaListNFTSchema>): Promise<string> { | ||
| try { | ||
| const expirationTime = Math.round(Date.now() / 1000 + 60 * 60 * 24); |
There was a problem hiding this comment.
Should the expiration be user-configurable?
| return `Successfully listed NFT:\n${JSON.stringify(response)}`; | ||
| } catch (error) { | ||
| console.log("response: ", error); |
| "OPENAI_API_KEY", | ||
| "CDP_API_KEY_NAME", | ||
| "CDP_API_KEY_PRIVATE_KEY", | ||
| "WALLET_PRIVATE_KEY", |
There was a problem hiding this comment.
Please remove, see comment in openSeaActionProvider.ts
| apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY?.replace(/\\n/g, "\n"), | ||
| cdpWalletData: walletDataStr || undefined, | ||
| networkId: process.env.NETWORK_ID || "base-sepolia", | ||
| networkId: process.env.NETWORK_ID || "ethereum-sepolia", |
There was a problem hiding this comment.
Please revert – fallback value should remain base-sepolia
| openSeaActionProvider({ | ||
| walletPrivateKey: process.env.WALLET_PRIVATE_KEY!, | ||
| }), |
There was a problem hiding this comment.
Should an apiKey be passed in here?
Has been implemented in #261, can be closed @CarsonRoscoe together with issue #300 |
OpenSea Action Provider for AgentKit
🚀 Overview
We are enhancing Coinbase's chat system with seamless OpenSea integration, enabling users to effortlessly browse their NFTs, select assets, and list them—all within the chat interface. This integration makes NFT trading more intuitive, accessible, and streamlined.
File Structure
Core Features
List an NFT Action
@CreateAction({ name: "list_nft" })This tool allows users to list an NFT on OpenSea. It takes the token ID, contract address, and listing price as input.
Fetch NFTs of a Specific Wallet Address
@CreateAction({ name: "get_nfts_by_account" })This tool fetches all NFTs associated with a given wallet address.
Technical Details
This integration ensures that AI agents can interact with OpenSea via a secure and type-safe interface, simplifying the process for users and enabling efficient NFT trading within the chat system.