chore: resolve merge conflights

This commit is contained in:
jakeyvee
2025-01-16 15:21:20 +08:00
26 changed files with 866 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
import tokenBalancesAction from "./tokenBalances";
import deployTokenAction from "./metaplex/deployToken";
import balanceAction from "./solana/balance";
import transferAction from "./solana/transfer";
@@ -64,6 +65,7 @@ import withdrawVoltrStrategyAction from "./voltr/withdrawStrategy";
export const ACTIONS = {
WALLET_ADDRESS_ACTION: getWalletAddressAction,
TOKEN_BALANCES_ACTION: tokenBalancesAction,
DEPLOY_TOKEN_ACTION: deployTokenAction,
BALANCE_ACTION: balanceAction,
TRANSFER_ACTION: transferAction,

View File

@@ -1,6 +1,6 @@
import { PublicKey } from "@solana/web3.js";
import { Action } from "../../types/action";
import { SolanaAgentKit } from "../../agent";
import type { Action } from "../../types/action";
import type { SolanaAgentKit } from "../../agent";
import { z } from "zod";
import { get_balance } from "../../tools";

View File

@@ -0,0 +1,80 @@
import { PublicKey } from "@solana/web3.js";
import type { Action } from "../types/action";
import type { SolanaAgentKit } from "../agent";
import { z } from "zod";
import { get_token_balance } from "../tools";
const tokenBalancesAction: Action = {
name: "TOKEN_BALANCE_ACTION",
similes: [
"check token balances",
"get wallet token balances",
"view token balances",
"show token balances",
"check token balance",
],
description: `Get the token balances of a Solana wallet.
If you want to get the balance of your wallet, you don't need to provide the wallet address.`,
examples: [
[
{
input: {},
output: {
status: "success",
balance: {
sol: 100,
tokens: [
{
tokenAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
name: "USD Coin",
symbol: "USDC",
balance: 100,
decimals: 9,
},
],
},
},
explanation: "Get token balances of the wallet",
},
],
[
{
input: {
walletAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
},
output: {
status: "success",
balance: {
sol: 100,
tokens: [
{
tokenAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
name: "USD Coin",
symbol: "USDC",
balance: 100,
decimals: 9,
},
],
},
},
explanation: "Get address token balance",
},
],
],
schema: z.object({
walletAddress: z.string().optional(),
}),
handler: async (agent: SolanaAgentKit, input) => {
const balance = await get_token_balance(
agent,
input.tokenAddress && new PublicKey(input.tokenAddress),
);
return {
status: "success",
balance: balance,
};
},
};
export default tokenBalancesAction;