mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-24 07:36:45 +00:00
merge: main. Also removed eslint config from discord bot starter it was conflicting with global eslint config
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { create_image } from "../tools/create_image";
|
||||
import { create_image } from "../../tools/agent";
|
||||
|
||||
const createImageAction: Action = {
|
||||
name: "CREATE_IMAGE",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { SolanaAgentKit } from "..";
|
||||
import { get_wallet_address } from "../tools";
|
||||
import { Action } from "../types/action";
|
||||
import { get_wallet_address } from "../../tools/agent";
|
||||
|
||||
const getWalletAddressAction: Action = {
|
||||
name: "GET_WALLET_ADDRESS",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getAllDomainsTLDs } from "../tools";
|
||||
import { getAllDomainsTLDs } from "../../tools";
|
||||
|
||||
const getAllDomainsTLDsAction: Action = {
|
||||
name: "GET_ALL_TLDS",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { getOwnedAllDomains } from "../tools";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getOwnedAllDomains } from "../../tools";
|
||||
|
||||
const getOwnedAllDomainsAction: Action = {
|
||||
name: "GET_OWNED_ALL_DOMAINS",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getOwnedDomainsForTLD } from "../tools";
|
||||
import { getOwnedDomainsForTLD } from "../../tools";
|
||||
|
||||
const getOwnedDomainsForTLDAction: Action = {
|
||||
name: "GET_OWNED_DOMAINS_FOR_TLD",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { resolveAllDomains } from "../tools";
|
||||
import { resolveAllDomains } from "../../tools";
|
||||
|
||||
const resolveDomainAction: Action = {
|
||||
name: "RESOLVE_ALL_DOMAINS",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getTokenDataByTicker } from "../tools";
|
||||
import { getTokenDataByTicker } from "../../tools/dexscreener";
|
||||
|
||||
const tokenDataByTickerAction: Action = {
|
||||
name: "GET_TOKEN_DATA_BY_TICKER",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import type { Action } from "../../types";
|
||||
import type { SolanaAgentKit } from "../..";
|
||||
import { createVault } from "../../tools/drift_vault";
|
||||
import { createVault } from "../../tools";
|
||||
|
||||
const createDriftVaultAction: Action = {
|
||||
name: "CREATE_DRIFT_VAULT",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from "zod";
|
||||
import type { Action } from "../../types";
|
||||
import { depositIntoVault } from "../../tools/drift_vault";
|
||||
import { depositIntoVault } from "../../tools";
|
||||
|
||||
const depositIntoDriftVaultAction: Action = {
|
||||
name: "DEPOSIT_INTO_DRIFT_VAULT",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import type { Action } from "../../types";
|
||||
import type { SolanaAgentKit } from "../../agent";
|
||||
import { requestWithdrawalFromVault } from "../../tools/drift_vault";
|
||||
import { requestWithdrawalFromVault } from "../../tools";
|
||||
|
||||
const requestWithdrawalFromVaultAction: Action = {
|
||||
name: "REQUEST_WITHDRAWAL_FROM_DRIFT_VAULT",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { z } from "zod";
|
||||
import type { Action } from "../../types";
|
||||
import type { SolanaAgentKit } from "../../agent";
|
||||
import { updateVault } from "../../tools/drift_vault";
|
||||
import { updateVault } from "../../tools";
|
||||
|
||||
const updateDriftVaultAction: Action = {
|
||||
name: "UPDATE_DRIFT_VAULT",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { flashCloseTrade } from "../tools";
|
||||
import { flashCloseTrade } from "../../tools/flash";
|
||||
|
||||
const flashCloseTradeAction: Action = {
|
||||
name: "FLASH_CLOSE_TRADE",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { flashOpenTrade } from "../tools";
|
||||
import { flashOpenTrade } from "../../tools/flash";
|
||||
|
||||
const flashOpenTradeAction: Action = {
|
||||
name: "FLASH_OPEN_TRADE",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { create_gibwork_task } from "../tools";
|
||||
import { create_gibwork_task } from "../../tools/gibwork";
|
||||
|
||||
const createGibworkTaskAction: Action = {
|
||||
name: "CREATE_GIBWORK_TASK",
|
||||
57
src/actions/helius/createWebhook.ts
Normal file
57
src/actions/helius/createWebhook.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { create_HeliusWebhook } from "../../tools/helius";
|
||||
|
||||
const createWebhookAction: Action = {
|
||||
name: "CREATE_HELIOUS_WEBHOOK",
|
||||
similes: ["setup webhook", "register webhook", "initiate webhook"],
|
||||
description:
|
||||
"Creates a new webhook in the Helius system to monitor transactions for specified account addresses",
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
accountAddresses: [
|
||||
"BVdNLvyG2DNiWAXBE9qAmc4MTQXymd5Bzfo9xrQSUzVP",
|
||||
"Eo2ciguhMLmcTWXELuEQPdu7DWZt67LHXb2rdHZUbot7",
|
||||
],
|
||||
webhookURL: "https://yourdomain.com/webhook",
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
webhookURL: "https://yourdomain.com/webhook",
|
||||
webhookID: "webhook_123",
|
||||
message: "Webhook created successfully.",
|
||||
},
|
||||
explanation:
|
||||
"Creates a Webhook to send live notifications on the given Url with the wallet Addresses.",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
accountAddresses: z
|
||||
.array(z.string())
|
||||
.min(1)
|
||||
.describe("List of Solana account public keys to monitor"),
|
||||
webhookURL: z
|
||||
.string()
|
||||
.url()
|
||||
.describe("The URL where Helius will send webhook notifications"),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const response = await create_HeliusWebhook(
|
||||
agent,
|
||||
input.accountAddresses,
|
||||
input.webhookURL,
|
||||
);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
...response,
|
||||
message: "Webhook created successfully.",
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default createWebhookAction;
|
||||
40
src/actions/helius/deleteWebhook.ts
Normal file
40
src/actions/helius/deleteWebhook.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { deleteHeliusWebhook } from "../../tools/helius";
|
||||
|
||||
const deleteWebhookAction: Action = {
|
||||
name: "DELETE_HELIOUS_WEBHOOK",
|
||||
similes: ["remove webhook", "unregister webhook", "delete webhook"],
|
||||
description: "Deletes a Helius webhook by its unique ID",
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
webhookID: "webhook_123",
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "Webhook deleted successfully.",
|
||||
},
|
||||
explanation: "Permanently removes a Helius webhook.",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
webhookID: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe("The unique identifier of the Helius webhook to delete"),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const result = await deleteHeliusWebhook(agent, input.webhookID);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: result.message || "Webhook deleted successfully.",
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default deleteWebhookAction;
|
||||
75
src/actions/helius/getAssetsbyOwner.ts
Normal file
75
src/actions/helius/getAssetsbyOwner.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getAssetsByOwner } from "../../tools/helius";
|
||||
|
||||
const getAssetsByOwnerAction: Action = {
|
||||
name: "FETCH_ASSETS_BY_OWNER",
|
||||
similes: [
|
||||
"fetch assets",
|
||||
"get assets",
|
||||
"retrieve assets",
|
||||
"list assets",
|
||||
"assets by owner",
|
||||
],
|
||||
description:
|
||||
"Fetch assets owned by a specific Solana wallet address using the Helius Digital Asset Standard API",
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
ownerPublicKey: "4Pf8q3mHGLdkoc1M8xWZwW5q32gYmdhwC2gJ8K9EAGDX",
|
||||
limit: 10,
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
assets: [
|
||||
{
|
||||
name: "Helius NFT #1",
|
||||
type: "NFT",
|
||||
owner: "4Pf8q3mHGLdkoc1M8xWZwW5q32gYmdhwC2gJ8K9EAGDX",
|
||||
},
|
||||
{
|
||||
name: "Helius Token #10",
|
||||
type: "Token",
|
||||
owner: "4Pf8q3mHGLdkoc1M8xWZwW5q32gYmdhwC2gJ8K9EAGDX",
|
||||
},
|
||||
],
|
||||
message: "Successfully fetched assets for the wallet address",
|
||||
},
|
||||
explanation:
|
||||
"Fetches a list of assets from the for the given wallet address with a limit of 10 items.",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
ownerPublicKey: z.string().describe("Owner's Solana wallet PublicKey"),
|
||||
limit: z
|
||||
.number()
|
||||
.positive()
|
||||
.describe("Number of assets to retrieve per request"),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
try {
|
||||
const assets = await getAssetsByOwner(
|
||||
agent,
|
||||
new PublicKey(input.ownerPublicKey),
|
||||
input.limit,
|
||||
);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
assets: assets,
|
||||
message: `Successfully fetched assets for the wallet address: ${input.ownerPublicKey}`,
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
status: "error",
|
||||
message: `Failed to fetch assets: ${error.message}`,
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default getAssetsByOwnerAction;
|
||||
47
src/actions/helius/getWebhook.ts
Normal file
47
src/actions/helius/getWebhook.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getHeliusWebhook } from "../../tools/helius";
|
||||
|
||||
const getWebhookAction: Action = {
|
||||
name: "GET_HELIOUS_WEBHOOK",
|
||||
similes: ["fetch webhook details", "retrieve webhook", "get webhook info"],
|
||||
description: "Retrieves details of a Helius webhook by its unique ID",
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
webhookID: "webhook_123",
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
wallet: "WalletPublicKey",
|
||||
webhookURL: "https://yourdomain.com/webhook",
|
||||
transactionTypes: ["Any"],
|
||||
accountAddresses: ["SomePublicKey", "AnotherPublicKey"],
|
||||
webhookType: "enhanced",
|
||||
message: "Webhook details retrieved successfully.",
|
||||
},
|
||||
explanation:
|
||||
"Retrieves detailed information about an existing Helius webhook, including the wallet address it monitors, the types of transactions it tracks, and the specific webhook URL.",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
webhookID: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe("The unique identifier of the Helius webhook to retrieve"),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const webhookDetails = await getHeliusWebhook(agent, input.webhookID);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
...webhookDetails,
|
||||
message: "Webhook details retrieved successfully.",
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default getWebhookAction;
|
||||
65
src/actions/helius/parseTransaction.ts
Normal file
65
src/actions/helius/parseTransaction.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { parseTransaction } from "../../tools/helius";
|
||||
|
||||
const parseSolanaTransactionAction: Action = {
|
||||
name: "PARSE_SOLANA_TRANSACTION",
|
||||
similes: [
|
||||
"parse transaction",
|
||||
"analyze transaction",
|
||||
"inspect transaction",
|
||||
"decode transaction",
|
||||
],
|
||||
description:
|
||||
"Parse a Solana transaction to retrieve detailed information using the Helius Enhanced Transactions API",
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
transactionId:
|
||||
"4zZVvbgzcriyjAeEiK1w7CeDCt7gYThUCZat3ULTNerzKHF4WLfRG2YUjbRovfFJ639TAyARB4oyRDcLVUvrakq7",
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
transaction: {
|
||||
details: "Transaction details...",
|
||||
involvedAccounts: ["Account1", "Account2"],
|
||||
executedOperations: [{ operation: "Transfer", amount: "1000 SOL" }],
|
||||
},
|
||||
message:
|
||||
"Successfully parsed transaction: 4zZVvbgzcriyjAeEiK1w7CeDCt7gYThUCZat3ULTNerzKHF4WLfRG2YUjbRovfFJ639TAyARB4oyRDcLVUvrakq7",
|
||||
},
|
||||
explanation:
|
||||
"Parse a Transaction to transform it into human readable format.",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
transactionId: z
|
||||
.string()
|
||||
.min(1)
|
||||
.describe("The Solana transaction ID to parse"),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
try {
|
||||
const parsedTransactionData = await parseTransaction(
|
||||
agent,
|
||||
input.transactionId,
|
||||
);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
transaction: parsedTransactionData,
|
||||
message: `Successfully parsed transaction: ${input.transactionId}`,
|
||||
};
|
||||
} catch (error: any) {
|
||||
return {
|
||||
status: "error",
|
||||
message: `Failed to parse transaction: ${error.message}`,
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default parseSolanaTransactionAction;
|
||||
76
src/actions/helius/sendTransactionWithPriority.ts
Normal file
76
src/actions/helius/sendTransactionWithPriority.ts
Normal file
@@ -0,0 +1,76 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { sendTransactionWithPriorityFee } from "../../tools/helius";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
|
||||
const sendTransactionWithPriorityFeeAction: Action = {
|
||||
name: "SEND_TRANSACTION_WITH_PRIORITY_FEE",
|
||||
similes: [
|
||||
"send SOL with fee",
|
||||
"transfer tokens with priority",
|
||||
"execute priority transaction",
|
||||
],
|
||||
description:
|
||||
"Sends SOL or SPL tokens from a wallet with an estimated priority fee, ensuring faster processing on the Solana network.",
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
priorityLevel: "High",
|
||||
amount: 2,
|
||||
to: "BVdNLvyG2DNiWAXBE9qAmc4MTQXymd5Bzfo9xrQSUzVP",
|
||||
splmintAddress: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
transactionId: "5Xgq9xVABhwXpNStWpfqxS6Vm5Eau91pjfeHNwJbRgis",
|
||||
fee: 5000,
|
||||
message: "Transaction sent with priority fee successfully.",
|
||||
},
|
||||
explanation:
|
||||
"Sends 2 USDC to BVdNLvyG2DNiWAXBE9qAmc4MTQXymd5Bzfo9xrQSUzVP with High priority fee option.",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
priorityLevel: z
|
||||
.enum(["Min", "Low", "Medium", "High", "VeryHigh", "UnsafeMax"])
|
||||
.describe("Priority level to determine the urgency of the transaction."),
|
||||
amount: z
|
||||
.number()
|
||||
.positive()
|
||||
.describe("Amount of SOL or SPL tokens to send."),
|
||||
to: z.string().describe("Recipient's PublicKey."),
|
||||
splmintAddress: z
|
||||
.string()
|
||||
.optional()
|
||||
.describe(
|
||||
"Optional SPL token address, if transferring tokens other than SOL.",
|
||||
),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const { priorityLevel, amount, to, splmintAddress } = input;
|
||||
const toPublicKey = new PublicKey(to);
|
||||
const splmintPublicKey = splmintAddress
|
||||
? new PublicKey(splmintAddress)
|
||||
: undefined;
|
||||
|
||||
const result = await sendTransactionWithPriorityFee(
|
||||
agent,
|
||||
priorityLevel,
|
||||
amount,
|
||||
toPublicKey,
|
||||
splmintPublicKey,
|
||||
);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
transactionId: result.transactionId,
|
||||
fee: result.fee,
|
||||
message: "Transaction sent with priority fee successfully.",
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default sendTransactionWithPriorityFeeAction;
|
||||
@@ -1,35 +1,48 @@
|
||||
import deployTokenAction from "./deployToken";
|
||||
import balanceAction from "./balance";
|
||||
import transferAction from "./transfer";
|
||||
import deployCollectionAction from "./deployCollection";
|
||||
import mintNFTAction from "./mintNFT";
|
||||
import tradeAction from "./trade";
|
||||
import requestFundsAction from "./requestFunds";
|
||||
import resolveDomainAction from "./resolveDomain";
|
||||
import getTokenDataAction from "./getTokenData";
|
||||
import getTPSAction from "./getTPS";
|
||||
import fetchPriceAction from "./fetchPrice";
|
||||
import stakeWithJupAction from "./stakeWithJup";
|
||||
import stakeWithSolayerAction from "./stakeWithSolayer";
|
||||
import registerDomainAction from "./registerDomain";
|
||||
import lendAssetAction from "./lendAsset";
|
||||
import createGibworkTaskAction from "./createGibworkTask";
|
||||
import resolveSolDomainAction from "./resolveSolDomain";
|
||||
import pythFetchPriceAction from "./pythFetchPrice";
|
||||
import getOwnedDomainsForTLDAction from "./getOwnedDomainsForTLD";
|
||||
import getPrimaryDomainAction from "./getPrimaryDomain";
|
||||
import getAllDomainsTLDsAction from "./getAllDomainsTLDs";
|
||||
import getOwnedAllDomainsAction from "./getOwnedAllDomains";
|
||||
import createImageAction from "./createImage";
|
||||
import getMainAllDomainsDomainAction from "./getMainAllDomainsDomain";
|
||||
import getAllRegisteredAllDomainsAction from "./getAllRegisteredAllDomains";
|
||||
import raydiumCreateCpmmAction from "./raydiumCreateCpmm";
|
||||
import raydiumCreateAmmV4Action from "./raydiumCreateAmmV4";
|
||||
import createOrcaSingleSidedWhirlpoolAction from "./createOrcaSingleSidedWhirlpool";
|
||||
import launchPumpfunTokenAction from "./launchPumpfunToken";
|
||||
import getWalletAddressAction from "./getWalletAddress";
|
||||
import flashOpenTradeAction from "./flashOpenTrade";
|
||||
import flashCloseTradeAction from "./flashCloseTrade";
|
||||
import deployTokenAction from "./metaplex/deployToken";
|
||||
import balanceAction from "./solana/balance";
|
||||
import transferAction from "./solana/transfer";
|
||||
import deployCollectionAction from "./metaplex/deployCollection";
|
||||
import mintNFTAction from "./metaplex/mintNFT";
|
||||
import tradeAction from "./jupiter/trade";
|
||||
import requestFundsAction from "./solana/requestFunds";
|
||||
import resolveDomainAction from "./sns/registerDomain";
|
||||
import getTokenDataAction from "./jupiter/getTokenData";
|
||||
import getTPSAction from "./solana/getTPS";
|
||||
import fetchPriceAction from "./jupiter/fetchPrice";
|
||||
import stakeWithJupAction from "./jupiter/stakeWithJup";
|
||||
import stakeWithSolayerAction from "./solayer/stakeWithSolayer";
|
||||
import registerDomainAction from "./sns/registerDomain";
|
||||
import lendAssetAction from "./lulo/lendAsset";
|
||||
import createGibworkTaskAction from "./gibwork/createGibworkTask";
|
||||
import resolveSolDomainAction from "./sns/resolveSolDomain";
|
||||
import pythFetchPriceAction from "./pyth/pythFetchPrice";
|
||||
import getOwnedDomainsForTLDAction from "./alldomains/getOwnedDomainsForTLD";
|
||||
import getPrimaryDomainAction from "./sns/getPrimaryDomain";
|
||||
import getAllDomainsTLDsAction from "./alldomains/getAllDomainsTLDs";
|
||||
import getOwnedAllDomainsAction from "./alldomains/getOwnedAllDomains";
|
||||
import createImageAction from "./agent/createImage";
|
||||
import getMainAllDomainsDomainAction from "./sns/getMainAllDomainsDomain";
|
||||
import getAllRegisteredAllDomainsAction from "./sns/getAllRegisteredAllDomains";
|
||||
import raydiumCreateCpmmAction from "./raydium/raydiumCreateCpmm";
|
||||
import raydiumCreateAmmV4Action from "./raydium/raydiumCreateAmmV4";
|
||||
import createOrcaSingleSidedWhirlpoolAction from "./orca/createOrcaSingleSidedWhirlpool";
|
||||
import launchPumpfunTokenAction from "./pumpfun/launchPumpfunToken";
|
||||
import getWalletAddressAction from "./agent/getWalletAddress";
|
||||
import flashOpenTradeAction from "./flash/flashOpenTrade";
|
||||
import flashCloseTradeAction from "./flash/flashCloseTrade";
|
||||
import createMultisigAction from "./squads/createMultisig";
|
||||
import approveMultisigProposalAction from "./squads/approveMultisigProposal";
|
||||
import createMultisigProposalAction from "./squads/createMultisigProposal";
|
||||
import depositToMultisigAction from "./squads/depositToMultisigTreasury";
|
||||
import executeMultisigProposalAction from "./squads/executeMultisigProposal";
|
||||
import rejectMultisigProposalAction from "./squads/rejectMultisigProposal";
|
||||
import transferFromMultisigAction from "./squads/transferFromMultisigTreasury";
|
||||
import createWebhookAction from "./helius/createWebhook";
|
||||
import deleteWebhookAction from "./helius/deleteWebhook";
|
||||
import getAssetsByOwnerAction from "./helius/getAssetsbyOwner";
|
||||
import getWebhookAction from "./helius/getWebhook";
|
||||
import parseSolanaTransactionAction from "./helius/parseTransaction";
|
||||
import sendTransactionWithPriorityFeeAction from "./helius/sendTransactionWithPriority";
|
||||
import createDriftVaultAction from "./drift/createVault";
|
||||
import updateDriftVaultAction from "./drift/updateVault";
|
||||
import depositIntoDriftVaultAction from "./drift/depositIntoVault";
|
||||
@@ -78,6 +91,19 @@ export const ACTIONS = {
|
||||
LAUNCH_PUMPFUN_TOKEN_ACTION: launchPumpfunTokenAction,
|
||||
FLASH_OPEN_TRADE_ACTION: flashOpenTradeAction,
|
||||
FLASH_CLOSE_TRADE_ACTION: flashCloseTradeAction,
|
||||
CREATE_MULTISIG_ACTION: createMultisigAction,
|
||||
DEPOSIT_TO_MULTISIG_ACTION: depositToMultisigAction,
|
||||
TRANSFER_FROM_MULTISIG_ACTION: transferFromMultisigAction,
|
||||
CREATE_MULTISIG_PROPOSAL_ACTION: createMultisigProposalAction,
|
||||
APPROVE_MULTISIG_PROPOSAL_ACTION: approveMultisigProposalAction,
|
||||
REJECT_MULTISIG_PROPOSAL_ACTION: rejectMultisigProposalAction,
|
||||
EXECUTE_MULTISIG_PROPOSAL_ACTION: executeMultisigProposalAction,
|
||||
CREATE_WEBHOOK_ACTION: createWebhookAction,
|
||||
DELETE_WEBHOOK_ACTION: deleteWebhookAction,
|
||||
GET_ASSETS_BY_OWNER_ACTION: getAssetsByOwnerAction,
|
||||
GET_WEBHOOK_ACTION: getWebhookAction,
|
||||
PARSE_TRANSACTION_ACTION: parseSolanaTransactionAction,
|
||||
SEND_TRANSACTION_WITH_PRIORITY_ACTION: sendTransactionWithPriorityFeeAction,
|
||||
CREATE_DRIFT_VAULT_ACTION: createDriftVaultAction,
|
||||
UPDATE_DRIFT_VAULT_ACTION: updateDriftVaultAction,
|
||||
DEPOSIT_INTO_DRIFT_VAULT_ACTION: depositIntoDriftVaultAction,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { fetchPrice } from "../tools";
|
||||
import { fetchPrice } from "../../tools/jupiter";
|
||||
|
||||
const fetchPriceAction: Action = {
|
||||
name: "FETCH_PRICE",
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { JupiterTokenData } from "../types";
|
||||
import { getTokenAddressFromTicker, getTokenDataByAddress } from "../tools";
|
||||
import { JupiterTokenData } from "../../types";
|
||||
import { getTokenAddressFromTicker, getTokenDataByAddress } from "../../tools";
|
||||
|
||||
const getTokenDataAction: Action = {
|
||||
name: "GET_TOKEN_DATA",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { stakeWithJup } from "../tools";
|
||||
import { stakeWithJup } from "../../tools";
|
||||
|
||||
const stakeWithJupAction: Action = {
|
||||
name: "STAKE_WITH_JUPITER",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { trade } from "../tools";
|
||||
import { trade } from "../../tools";
|
||||
|
||||
const tradeAction: Action = {
|
||||
name: "TRADE",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { sendCompressedAirdrop } from "../tools";
|
||||
import { sendCompressedAirdrop } from "../../tools";
|
||||
|
||||
const compressedAirdropAction: Action = {
|
||||
name: "COMPRESSED_AIRDROP",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { lendAsset } from "../tools";
|
||||
import { lendAsset } from "../../tools/lulo";
|
||||
|
||||
const lendAssetAction: Action = {
|
||||
name: "LEND_ASSET",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { deploy_collection } from "../tools";
|
||||
import { deploy_collection } from "../../tools/metaplex";
|
||||
|
||||
interface CollectionOptions {
|
||||
name: string;
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { deploy_token } from "../tools";
|
||||
import { deploy_token } from "../../tools";
|
||||
|
||||
const deployTokenAction: Action = {
|
||||
name: "DEPLOY_TOKEN",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { mintCollectionNFT } from "../tools";
|
||||
import { mintCollectionNFT } from "../../tools/metaplex";
|
||||
|
||||
const mintNFTAction: Action = {
|
||||
name: "MINT_NFT",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { openbookCreateMarket } from "../tools";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { openbookCreateMarket } from "../../tools/openbook";
|
||||
|
||||
const createOpenbookMarketAction: Action = {
|
||||
name: "CREATE_OPENBOOK_MARKET",
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Decimal } from "decimal.js";
|
||||
import { orcaCreateSingleSidedLiquidityPool } from "../tools";
|
||||
import { orcaCreateSingleSidedLiquidityPool } from "../../tools";
|
||||
|
||||
// Fee tiers mapping from the original tool
|
||||
const FEE_TIERS = {
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { launchPumpFunToken } from "../tools";
|
||||
import { launchPumpFunToken } from "../../tools";
|
||||
|
||||
const launchPumpfunTokenAction: Action = {
|
||||
name: "LAUNCH_PUMPFUN_TOKEN",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { fetchPythPrice, fetchPythPriceFeedID } from "../tools";
|
||||
import { fetchPythPrice, fetchPythPriceFeedID } from "../../tools";
|
||||
|
||||
const pythFetchPriceAction: Action = {
|
||||
name: "PYTH_FETCH_PRICE",
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
import { raydiumCreateAmmV4 } from "../tools";
|
||||
import { raydiumCreateAmmV4 } from "../../tools";
|
||||
|
||||
const raydiumCreateAmmV4Action: Action = {
|
||||
name: "RAYDIUM_CREATE_AMM_V4",
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { BN } from "@coral-xyz/anchor";
|
||||
import Decimal from "decimal.js";
|
||||
import { raydiumCreateClmm } from "../tools";
|
||||
import { raydiumCreateClmm } from "../../tools";
|
||||
|
||||
const raydiumCreateClmmAction: Action = {
|
||||
name: "RAYDIUM_CREATE_CLMM",
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import BN from "bn.js";
|
||||
import { raydiumCreateCpmm } from "../tools";
|
||||
import { raydiumCreateCpmm } from "../../tools";
|
||||
|
||||
const raydiumCreateCpmmAction: Action = {
|
||||
name: "RAYDIUM_CREATE_CPMM",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getAllRegisteredAllDomains } from "../tools";
|
||||
import { getAllRegisteredAllDomains } from "../../tools";
|
||||
|
||||
const getAllRegisteredAllDomainsAction: Action = {
|
||||
name: "GET_ALL_REGISTERED_ALL_DOMAINS",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { getMainAllDomainsDomain } from "../tools";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getMainAllDomainsDomain } from "../../tools";
|
||||
|
||||
const getMainAllDomainsDomainAction: Action = {
|
||||
name: "GET_MAIN_ALL_DOMAINS_DOMAIN",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { z } from "zod";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { getPrimaryDomain } from "../tools";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getPrimaryDomain } from "../../tools";
|
||||
|
||||
const getPrimaryDomainAction: Action = {
|
||||
name: "GET_PRIMARY_DOMAIN",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { registerDomain } from "../tools";
|
||||
import { registerDomain } from "../../tools";
|
||||
|
||||
const registerDomainAction: Action = {
|
||||
name: "REGISTER_DOMAIN",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { resolveSolDomain } from "../tools";
|
||||
import { resolveSolDomain } from "../../tools/";
|
||||
|
||||
const resolveSolDomainAction: Action = {
|
||||
name: "RESOLVE_SOL_DOMAIN",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { get_balance } from "../tools";
|
||||
import { get_balance } from "../../tools";
|
||||
|
||||
const balanceAction: Action = {
|
||||
name: "BALANCE_ACTION",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { closeEmptyTokenAccounts } from "../tools";
|
||||
import { closeEmptyTokenAccounts } from "../../tools";
|
||||
|
||||
const closeEmptyTokenAccountsAction: Action = {
|
||||
name: "CLOSE_EMPTY_TOKEN_ACCOUNTS",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { getTPS } from "../tools";
|
||||
import { getTPS } from "../../tools/solana";
|
||||
|
||||
const getTPSAction: Action = {
|
||||
name: "GET_TPS",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { request_faucet_funds } from "../tools";
|
||||
import { request_faucet_funds } from "../../tools/solana";
|
||||
|
||||
const requestFundsAction: Action = {
|
||||
name: "REQUEST_FUNDS",
|
||||
@@ -1,8 +1,8 @@
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { transfer } from "../tools";
|
||||
import { transfer } from "../../tools";
|
||||
|
||||
const transferAction: Action = {
|
||||
name: "TRANSFER",
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Action } from "../types/action";
|
||||
import { SolanaAgentKit } from "../agent";
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { stakeWithSolayer } from "../tools";
|
||||
import { stakeWithSolayer } from "../../tools";
|
||||
|
||||
const stakeWithSolayerAction: Action = {
|
||||
name: "STAKE_WITH_SOLAYER",
|
||||
50
src/actions/squads/approveMultisigProposal.ts
Normal file
50
src/actions/squads/approveMultisigProposal.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { multisig_approve_proposal } from "../../tools";
|
||||
|
||||
const approveMultisigProposalAction: Action = {
|
||||
name: "APPROVE_MULTISIG_PROPOSAL_ACTION",
|
||||
similes: [
|
||||
"approve proposal",
|
||||
"approve proposal to transfer funds",
|
||||
"approve proposal to transfer funds from 2-of-2 multisig",
|
||||
"approve proposal to transfer funds from 2-of-2 multisig account",
|
||||
"approve proposal to transfer funds from 2-of-2 multisig account on Solana",
|
||||
],
|
||||
description: `Approve a proposal to transfer funds from a 2-of-2 multisig account on Solana with the user and the agent, where both approvals will be required to run the transactions.
|
||||
|
||||
Note: For one AI agent, only one 2-by-2 multisig can be created as it is pair-wise.`,
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
transactionIndex: 0,
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "Proposal approved successfully",
|
||||
transaction: "4xKpN2...",
|
||||
transactionIndex: "0",
|
||||
},
|
||||
explanation:
|
||||
"Approve a proposal to transfer 1 SOL from 2-of-2 multisig account on Solana",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
transactionIndex: z.number().optional(),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const tx = await multisig_approve_proposal(agent, input.transactionIndex);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: "Proposal approved successfully",
|
||||
transaction: tx,
|
||||
transactionIndex: input.transactionIndex.toString(),
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default approveMultisigProposalAction;
|
||||
52
src/actions/squads/createMultisig.ts
Normal file
52
src/actions/squads/createMultisig.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { create_squads_multisig } from "../../tools";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
|
||||
const createMultisigAction: Action = {
|
||||
name: "CREATE_MULTISIG_ACTION",
|
||||
similes: [
|
||||
"create multisig",
|
||||
"create squads multisig",
|
||||
"create 2-by-2 multisig",
|
||||
"create 2-of-2 multisig",
|
||||
"create 2-of-2 multisig account",
|
||||
"create 2-of-2 multisig account on Solana",
|
||||
],
|
||||
description: `Create a 2-of-2 multisig account on Solana using Squads with the user and the agent, where both approvals will be required to run the transactions.
|
||||
|
||||
Note: For one AI agent, only one 2-by-2 multisig can be created as it is pair-wise.`,
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
creator: "7nE9GvcwsqzYxmJLSrYmSB1V1YoJWVK1KWzAcWAzjXkN",
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "2-by-2 multisig account created successfully",
|
||||
signature: "4xKpN2...",
|
||||
},
|
||||
explanation: "Create a 2-of-2 multisig account on Solana",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
creator: z.string(),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const multisig = await create_squads_multisig(
|
||||
agent,
|
||||
new PublicKey(input.creator as string),
|
||||
);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: "2-by-2 multisig account created successfully",
|
||||
signature: multisig,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default createMultisigAction;
|
||||
55
src/actions/squads/createMultisigProposal.ts
Normal file
55
src/actions/squads/createMultisigProposal.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { multisig_create_proposal } from "../../tools";
|
||||
|
||||
const createMultisigProposalAction: Action = {
|
||||
name: "CREATE_MULTISIG_PROPOSAL_ACTION",
|
||||
similes: [
|
||||
"create proposal",
|
||||
"create proposal to transfer funds",
|
||||
"create proposal to transfer funds from 2-of-2 multisig",
|
||||
"create proposal to transfer funds from 2-of-2 multisig account",
|
||||
"create proposal to transfer funds from 2-of-2 multisig account on Solana",
|
||||
],
|
||||
description: `Create a proposal to transfer funds from a 2-of-2 multisig account on Solana with the user and the agent, where both approvals will be required to run the transactions.
|
||||
|
||||
If transactionIndex is not provided, the latest index will automatically be fetched and used.`,
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
transactionIndex: 0,
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "Proposal created successfully",
|
||||
transaction: "4xKpN2...",
|
||||
transactionIndex: "0",
|
||||
},
|
||||
explanation:
|
||||
"Create a proposal to transfer 1 SOL from 2-of-2 multisig account on Solana",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
transactionIndex: z.number().optional(),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const transactionIndex =
|
||||
input.transactionIndex !== undefined
|
||||
? Number(input.transactionIndex)
|
||||
: undefined;
|
||||
|
||||
const multisig = await multisig_create_proposal(agent, transactionIndex);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: "Proposal created successfully",
|
||||
transaction: multisig,
|
||||
transactionIndex: transactionIndex,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default createMultisigProposalAction;
|
||||
49
src/actions/squads/depositToMultisigTreasury.ts
Normal file
49
src/actions/squads/depositToMultisigTreasury.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { multisig_deposit_to_treasury } from "../../tools";
|
||||
|
||||
const depositToMultisigAction: Action = {
|
||||
name: "DEPOSIT_TO_MULTISIG_ACTION",
|
||||
similes: [
|
||||
"deposit to multisig",
|
||||
"deposit to squads multisig",
|
||||
"deposit to 2-of-2 multisig account",
|
||||
"deposit to 2-of-2 multisig account on Solana",
|
||||
"deposit SOL to 2-of-2 multisig",
|
||||
"deposit SPL tokens to 2-of-2 multisig",
|
||||
],
|
||||
description: `Deposit funds to a 2-of-2 multisig account on Solana with the user and the agent, where both approvals will be required to run the transactions.`,
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
amount: 1,
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "Funds deposited to 2-by-2 multisig account successfully",
|
||||
signature: "4xKpN2...",
|
||||
},
|
||||
explanation: "Deposit 1 SOL to 2-of-2 multisig account on Solana",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
amount: z.number().min(0, "Amount must be greater than 0"),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const multisig = await multisig_deposit_to_treasury(
|
||||
agent,
|
||||
input.amount as number,
|
||||
);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: "Funds deposited to 2-by-2 multisig account successfully",
|
||||
signature: multisig,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default depositToMultisigAction;
|
||||
53
src/actions/squads/executeMultisigProposal.ts
Normal file
53
src/actions/squads/executeMultisigProposal.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { multisig_execute_proposal } from "../../tools";
|
||||
|
||||
const executeMultisigProposalAction: Action = {
|
||||
name: "EXECUTE_MULTISIG_PROPOSAL_ACTION",
|
||||
similes: [
|
||||
"execute proposal",
|
||||
"execute proposal to transfer funds",
|
||||
"execute proposal to transfer funds from 2-of-2 multisig",
|
||||
"execute proposal to transfer funds from 2-of-2 multisig account",
|
||||
"execute proposal to transfer funds from 2-of-2 multisig account on Solana",
|
||||
],
|
||||
description: `Execute a proposal to transfer funds from a 2-of-2 multisig account on Solana with the user and the agent, where both approvals will be required to run the transactions.`,
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
proposalIndex: 0,
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "Proposal executed successfully",
|
||||
transaction: "4xKpN2...",
|
||||
proposalIndex: "0",
|
||||
},
|
||||
explanation:
|
||||
"Execute a proposal to transfer 1 SOL from 2-of-2 multisig account on Solana",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
proposalIndex: z.number().optional(),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const proposalIndex =
|
||||
input.proposalIndex !== undefined
|
||||
? Number(input.proposalIndex)
|
||||
: undefined;
|
||||
|
||||
const multisig = await multisig_execute_proposal(agent, proposalIndex);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: "Proposal executed successfully",
|
||||
transaction: multisig,
|
||||
proposalIndex,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default executeMultisigProposalAction;
|
||||
53
src/actions/squads/rejectMultisigProposal.ts
Normal file
53
src/actions/squads/rejectMultisigProposal.ts
Normal file
@@ -0,0 +1,53 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { multisig_reject_proposal } from "../../tools";
|
||||
|
||||
const rejectMultisigProposalAction: Action = {
|
||||
name: "REJECT_MULTISIG_PROPOSAL_ACTION",
|
||||
similes: [
|
||||
"reject proposal",
|
||||
"reject proposal to transfer funds",
|
||||
"reject proposal to transfer funds from 2-of-2 multisig",
|
||||
"reject proposal to transfer funds from 2-of-2 multisig account",
|
||||
"reject proposal to transfer funds from 2-of-2 multisig account on Solana",
|
||||
],
|
||||
description: `Reject a proposal to transfer funds from a 2-of-2 multisig account on Solana with the user and the agent, where both approvals will be required to run the transactions.`,
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
proposalIndex: 0,
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "Proposal rejected successfully",
|
||||
transaction: "4xKpN2...",
|
||||
proposalIndex: "0",
|
||||
},
|
||||
explanation:
|
||||
"Reject a proposal to transfer 1 SOL from 2-of-2 multisig account on Solana",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
proposalIndex: z.number().optional(),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const proposalIndex =
|
||||
input.proposalIndex !== undefined
|
||||
? Number(input.proposalIndex)
|
||||
: undefined;
|
||||
|
||||
const tx = await multisig_reject_proposal(agent, proposalIndex);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: "Proposal rejected successfully",
|
||||
transaction: tx,
|
||||
proposalIndex,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default rejectMultisigProposalAction;
|
||||
56
src/actions/squads/transferFromMultisigTreasury.ts
Normal file
56
src/actions/squads/transferFromMultisigTreasury.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
import { Action } from "../../types/action";
|
||||
import { SolanaAgentKit } from "../../agent";
|
||||
import { z } from "zod";
|
||||
import { multisig_transfer_from_treasury } from "../../tools";
|
||||
import { PublicKey } from "@solana/web3.js";
|
||||
|
||||
const transferFromMultisigAction: Action = {
|
||||
name: "TRANSFER_FROM_MULTISIG_ACTION",
|
||||
similes: [
|
||||
"transfer from multisig",
|
||||
"transfer from squads multisig",
|
||||
"transfer SOL from 2-by-2 multisig",
|
||||
"transfer from 2-of-2 multisig account",
|
||||
"transfer from 2-of-2 multisig account on Solana",
|
||||
],
|
||||
description: `Create a transaction to transfer funds from a 2-of-2 multisig account on Solana using Squads with the user and the agent, where both approvals will be required to run the transactions.`,
|
||||
examples: [
|
||||
[
|
||||
{
|
||||
input: {
|
||||
amount: 1,
|
||||
recipient: "7nE9GvcwsqzYxmJLSrYmSB1V1YoJWVK1KWzAcWAzjXkN",
|
||||
},
|
||||
output: {
|
||||
status: "success",
|
||||
message: "Transaction added to 2-by-2 multisig account successfully",
|
||||
transaction: "4xKpN2...",
|
||||
amount: "1",
|
||||
recipient: "7nE9GvcwsqzYxmJLSrYmSB1V1YoJWVK1KWzAcWAzjXkN",
|
||||
},
|
||||
explanation: "Transfer 1 SOL from 2-of-2 multisig account on Solana",
|
||||
},
|
||||
],
|
||||
],
|
||||
schema: z.object({
|
||||
amount: z.number().min(0, "Amount must be greater than 0"),
|
||||
recipient: z.string(),
|
||||
}),
|
||||
handler: async (agent: SolanaAgentKit, input: Record<string, any>) => {
|
||||
const multisig = await multisig_transfer_from_treasury(
|
||||
agent,
|
||||
input.amount as number,
|
||||
new PublicKey(input.recipient as string),
|
||||
);
|
||||
|
||||
return {
|
||||
status: "success",
|
||||
message: "Transaction added to 2-by-2 multisig account successfully",
|
||||
transaction: multisig,
|
||||
amount: input.amount,
|
||||
recipient: input.recipient,
|
||||
};
|
||||
},
|
||||
};
|
||||
|
||||
export default transferFromMultisigAction;
|
||||
Reference in New Issue
Block a user