mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-13 23:16:55 +00:00
Update code snippets for adding new tools
This commit is contained in:
@@ -104,6 +104,10 @@ if (customTool) {
|
||||
const result = await customTool._call("your-input");
|
||||
console.log(result);
|
||||
}
|
||||
|
||||
// or alternatively
|
||||
const result = await agent.customFunction("your-input"); // assuming you have a `customFunction` method in SolanaAgentKit
|
||||
console.log(result);
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
@@ -170,6 +174,21 @@ export class SolanaAgentKit {
|
||||
}
|
||||
```
|
||||
|
||||
Then it can be used as such:
|
||||
|
||||
```typescript
|
||||
import { SolanaAgentKit } from "solana-agent-kit";
|
||||
|
||||
const agent = new SolanaAgentKit(
|
||||
"your-wallet-private-key-as-base58",
|
||||
"https://api.mainnet-beta.solana.com",
|
||||
"your-openai-api-key"
|
||||
);
|
||||
|
||||
const result = await agent.getTokenPrice("SOL");
|
||||
console.log(result);
|
||||
```
|
||||
|
||||
## Need Help?
|
||||
|
||||
If you encounter any issues while implementing your custom tool:
|
||||
|
||||
Reference in New Issue
Block a user