@goat-sdk/wallet-safe
TypeScript icon, indicating that this package has built-in type declarations

0.1.5 • Public • Published

Safe Wallet for GOAT

Installation

npm install @goat-sdk/wallet-safe
yarn add @goat-sdk/wallet-safe
pnpm add @goat-sdk/wallet-safe

Usage

import type { ChatPromptTemplate } from "@langchain/core/prompts";
import { Ollama } from "@langchain/ollama";
import { AgentExecutor, createStructuredChatAgent } from "langchain/agents";
import { pull } from "langchain/hub";

import { baseSepolia } from "viem/chains";

import { getOnChainTools } from "@goat-sdk/adapter-langchain";

import { sendETH } from "@goat-sdk/wallet-evm";
import { safe } from "@goat-sdk/wallet-safe";

require("dotenv").config();

const pk = process.env.WALLET_PRIVATE_KEY as `0x${string}`;

const llm = new Ollama({
    model: "llama3.2:latest",
});

(async (): Promise<void> => {
    const prompt = await pull<ChatPromptTemplate>("hwchase17/structured-chat-agent");

    const tools = await getOnChainTools({
        // The wallet will be deployed on chain and requires eth beforehand.
        wallet: await safe(pk, baseSepolia),
        plugins: [sendETH()],
    });

    const agent = await createStructuredChatAgent({
        llm,
        tools,
        prompt,
    });

    const agentExecutor = new AgentExecutor({
        agent,
        tools,
    });

    const response = await agentExecutor.invoke({
        input: "Send 0.00001 eth to 0xBd33b475626b81A77d7b687AeCc9D547312691ac",
    });

    console.log(response);
})();


Readme

Keywords

Package Sidebar

Install

npm i @goat-sdk/wallet-safe

Homepage

ohmygoat.dev

Weekly Downloads

17

Version

0.1.5

License

MIT

Unpacked Size

21.2 kB

Total Files

20

Last publish

Collaborators

  • aigustin
  • mpaella