From e79dc2ab6555cff561aea157cea91238982410d5 Mon Sep 17 00:00:00 2001 From: Damjan Date: Fri, 27 Dec 2024 16:37:51 +0100 Subject: [PATCH] Fix outdated docs code, add filename hints --- guides/add_your_own_tool.md | 12 ++++++------ guides/test_it_out.md | 16 +++++++++------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/guides/add_your_own_tool.md b/guides/add_your_own_tool.md index 6c41606..67f7772 100644 --- a/guides/add_your_own_tool.md +++ b/guides/add_your_own_tool.md @@ -18,7 +18,7 @@ Extending the **Solana Agent Kit** with custom tools allows you to add specializ Create a new TypeScript file in the `src/tools/` directory for your tool (e.g., `custom_tool.ts`). ### 2. Implement the Tool Class - +> `src/langchain/index.ts` ```typescript:src/langchain/index.ts import { Tool } from "langchain/tools"; import { SolanaAgentKit } from "../agent"; @@ -51,7 +51,7 @@ export class CustomTool extends Tool { ``` ### 3. Add Supporting Functions to SolanaAgentKit - +> `src/agent/index.ts` ```typescript:src/agent/index.ts export class SolanaAgentKit { // ... existing code ... @@ -64,7 +64,7 @@ export class SolanaAgentKit { ``` ### 4. Export the Tool - +> `src/tools/index.ts` ```typescript:src/tools/index.ts export * from "./request_faucet_funds"; export * from "./deploy_token"; @@ -72,7 +72,7 @@ export * from "./custom_tool"; // Add your new tool ``` ### 5. Integrate with Agent - +> `src/langchain/index.ts` ```typescript:src/langchain/index.ts import { CustomTool } from "../tools/custom_tool"; @@ -117,7 +117,7 @@ if (customTool) { ## Example: Token Price Fetching Tool Here's a complete example of implementing a tool to fetch token prices: - +> `src/tools/fetch_token_price.ts` ```typescript:src/tools/fetch_token_price.ts import { Tool } from "langchain/tools"; import { SolanaAgentKit } from "../agent"; @@ -150,7 +150,7 @@ export class FetchTokenPriceTool extends Tool { ``` Add the supporting function to SolanaAgentKit: - +> `src/agent/index.ts` ```typescript:src/agent/index.ts export class SolanaAgentKit { async getTokenPrice(tokenSymbol: string): Promise { diff --git a/guides/test_it_out.md b/guides/test_it_out.md index 02f8151..47504b1 100644 --- a/guides/test_it_out.md +++ b/guides/test_it_out.md @@ -49,12 +49,12 @@ The project includes a test script located at `test/index.ts`. To execute the te ### Token Deployment ```typescript -import { deploy_token } from "solana-agent-kit"; +import { SolanaAgentKit } from "solana-agent-kit"; -const result = await deploy_token( - agent, - 9, // decimals - 1000000 // initial supply +const agent = new SolanaAgentKit("your_private_key"); + +const result = await agent.deployToken( + 9, // decimals ); console.log("Token Mint Address:", result.mint.toString()); @@ -62,9 +62,11 @@ console.log("Token Mint Address:", result.mint.toString()); ### NFT Collection Creation ```typescript -import { deploy_collection } from "solana-agent-kit"; +import { SolanaAgentKit } from "solana-agent-kit"; -const collection = await deploy_collection(agent, { +const agent = new SolanaAgentKit("your_private_key"); + +const collection = await agent.deployCollection({ name: "My NFT Collection", uri: "https://arweave.net/metadata.json", royaltyBasisPoints: 500, // 5%