-
Notifications
You must be signed in to change notification settings - Fork 303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/opensea Integrate Opensea Actions to Agentkit #325
base: main
Are you sure you want to change the base?
Conversation
🟡 Heimdall Review Status
|
OpenSea Action Provider for AgentKit🚀 Overview File Structure
Core 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. |
Issue ticked id: #300 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -53,5 +53,8 @@ | |||
"turbo": "^2.3.3", | |||
"typedoc": "^0.27.2", | |||
"typescript": "^5.4.5" | |||
}, | |||
"dependencies": { | |||
"opensea-js": "^7.1.15" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Please remove this comment
*/ | ||
export class OpenSeaActionProvider extends ActionProvider { | ||
private readonly client: OpenSeaSDK; | ||
private readonly walletProvider: ViemWalletProvider; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment below about removing this
/* | ||
* if (!config.apiKey) { | ||
* throw new Error("OPENSEA_API_KEY is not configured."); | ||
* } | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove
}) | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the expiration be user-configurable?
|
||
return `Successfully listed NFT:\n${JSON.stringify(response)}`; | ||
} catch (error) { | ||
console.log("response: ", error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove
"OPENAI_API_KEY", | ||
"CDP_API_KEY_NAME", | ||
"CDP_API_KEY_PRIVATE_KEY", | ||
"WALLET_PRIVATE_KEY", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove, see comment in openSeaActionProvider.ts
@@ -86,7 +92,7 @@ async function initializeAgent() { | |||
apiKeyName: process.env.CDP_API_KEY_NAME, | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert – fallback value should remain base-sepolia
openSeaActionProvider({ | ||
walletPrivateKey: process.env.WALLET_PRIVATE_KEY!, | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should an apiKey be passed in here?
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.