> For the complete documentation index, see [llms.txt](https://vity-toolkit.gitbook.io/vity-toolkit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vity-toolkit.gitbook.io/vity-toolkit/tools/solana-wallet.md).

# Solana Wallet

Guide to use superteam earn tool on your AI agent using Vity Toolkit

A Solana wallet is a digital account that allows users to store, send, receive, and use SOL cryptocurrency on the Solana blockchain.

### Quick Start <a href="#transfer-tokens-to-another-wallet-on-solana" id="transfer-tokens-to-another-wallet-on-solana"></a>

{% stepper %}
{% step %}

#### Install the package.

```bash
npm install vity-toolkit langchain @langchain/openai
```

{% endstep %}

{% step %}

#### Initialize Vity Toolkit and Langchain.

```typescript
import { ChatOpenAI } from "@langchain/openai";
import { App, LangchainToolkit } from "vity-toolkit";
import { createOpenAIFunctionsAgent, AgentExecutor } from "langchain/agents";
import { ChatPromptTemplate } from "@langchain/core/prompts";

const llm = new ChatOpenAI({ model: "gpt-4o" });
const toolKit = new LangchainToolkit({
    userPrivateKey: "<private_key>",
});
```

{% endstep %}

{% step %}

#### Add the tool.

```typescript
const tools = toolKit.getTools({ apps: [App.SOLANA_WALLET] });
```

{% endstep %}

{% step %}

#### Define the Agent.

```typescript
const prompt = ChatPromptTemplate.fromMessages([
  ["system", "You are a helpful assistant"],
  ["placeholder", "{chat_history}"],
  ["human", "{input}"],
  ["placeholder", "{agent_scratchpad}"],
]);

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

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

```

{% endstep %}

{% step %}

#### Execute the Agent.

```typescript
const response = await agentExecutor.invoke({ input: "Create a Solana Wallet and give me it's public key. Also tell me it's balance." });
console.log(response);
```

{% endstep %}
{% endstepper %}

### Supported Actions

<table><thead><tr><th>Action</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>Action.SOLANA_WALLET_GENERATE_KEYPAIR
</code></pre></td><td>Generate a new Solana wallet keypair.</td></tr><tr><td><pre><code>Action.SOLANA_WALLET_GET_BALANCE
</code></pre></td><td>Retrieve the balance of a Solana account.</td></tr><tr><td><pre><code>Action.SOLANA_WALLET_GET_MY_PUBLIC_KEY
</code></pre></td><td>Get the public key of the current user who is using the Vity Toolkit.</td></tr><tr><td><pre><code>Action.SOLANA_WALLET_TRANSFER
</code></pre></td><td>Transfer Solana tokens like SOL, USDC, BONK, etc. to another account on any network.</td></tr></tbody></table>
