feat: fix merge

This commit is contained in:
Arihant Bansal
2025-01-12 09:52:11 +05:30
285 changed files with 15577 additions and 3548 deletions

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;