Skip to content

Commit

Permalink
temp example
Browse files Browse the repository at this point in the history
  • Loading branch information
bryan-eastwood3 committed Dec 7, 2024
1 parent d509536 commit 2f98acb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { generateText } from "ai";
import { getOnChainTools } from "@goat-sdk/adapter-vercel-ai";
import { crossmint } from "@goat-sdk/crossmint";
import { Connection } from "@solana/web3.js";
import { nfts } from "@goat-sdk/plugin-solana-actions";

require("dotenv").config();

Expand All @@ -15,22 +16,24 @@ if (!apiKey || !email) {
}

const { custodial } = crossmint(apiKey);
const connection = new Connection("https://api.devnet.solana.com", "confirmed");

(async () => {
const tools = await getOnChainTools({
wallet: await custodial({
chain: "solana",
email: email,
address: "3q1PB3Yde3wUnJ45RLrAhCg3W1n9HEC8Jd9NkfuhRGS1",
env: "staging",
connection: new Connection("https://api.devnet.solana.com", "confirmed"),
connection,
}),
plugins: [nfts(connection)],
});

const result = await generateText({
model: openai("gpt-4o-mini"),
tools: tools,
maxSteps: 5,
prompt: "Get my balance in SOL",
prompt: "Transfer NFT with assetId 57hD2akP2FsEwnDMJn8CNS565p2dNUz8UKuQ5tUGEsh7 to the wallet CKkeuMRjRsM9zBNnFVRRYhQ3rg4uL4tPkaADNLgk2omb",
});

console.log(result.text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"create-wallet": "ts-node create-custodial-wallet.ts",
"test": "vitest run --passWithNoTests"
},
"main": "index.ts",
"author": "",
"license": "MIT",
"dependencies": {
Expand All @@ -15,6 +16,7 @@
"@goat-sdk/core": "workspace:*",
"@goat-sdk/plugin-erc20": "workspace:*",
"@goat-sdk/crossmint": "workspace:*",
"@goat-sdk/plugin-solana-actions": "workspace:*",
"@solana/web3.js": "1.95.8",
"ai": "^4.0.3",
"dotenv": "^16.4.5",
Expand Down

0 comments on commit 2f98acb

Please sign in to comment.