mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-22 07:36:44 +00:00
added 2by2 multisig proposal/tx execution
This commit is contained in:
@@ -2271,7 +2271,7 @@ export class SolanaApproveProposal2by2Multisig extends Tool {
|
||||
description = `Approve a proposal to transfer funds from a 2-of-2 multisig account on Solana.
|
||||
|
||||
Inputs (JSON string):
|
||||
- proposalIndex: number, the index of the proposal (required).`;
|
||||
- proposalIndex: number, the index of the proposal (optional).`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
@@ -2305,7 +2305,7 @@ export class SolanaRejectProposal2by2Multisig extends Tool {
|
||||
description = `Reject a proposal to transfer funds from a 2-of-2 multisig account on Solana.
|
||||
|
||||
Inputs (JSON string):
|
||||
- proposalIndex: number, the index of the proposal (required).`;
|
||||
- proposalIndex: number, the index of the proposal (optional).`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
@@ -2334,6 +2334,40 @@ export class SolanaRejectProposal2by2Multisig extends Tool {
|
||||
}
|
||||
}
|
||||
|
||||
export class SolanaExecuteProposal2by2Multisig extends Tool {
|
||||
name = "execute_proposal_2by2_multisig";
|
||||
description = `Execute a proposal/transaction to transfer funds from a 2-of-2 multisig account on Solana.
|
||||
|
||||
Inputs (JSON string):
|
||||
- proposalIndex: number, the index of the proposal (optional).`;
|
||||
|
||||
constructor(private solanaKit: SolanaAgentKit) {
|
||||
super();
|
||||
}
|
||||
|
||||
protected async _call(input: string): Promise<string> {
|
||||
try {
|
||||
const inputFormat = JSON.parse(input);
|
||||
const proposalIndex = inputFormat.proposalIndex;
|
||||
|
||||
const tx = await this.solanaKit.executeMultisigTransaction(proposalIndex);
|
||||
|
||||
return JSON.stringify({
|
||||
status: "success",
|
||||
message: "Proposal executed successfully",
|
||||
transaction: tx,
|
||||
proposalIndex: proposalIndex.toString(),
|
||||
});
|
||||
} catch (error: any) {
|
||||
return JSON.stringify({
|
||||
status: "error",
|
||||
message: error.message,
|
||||
code: error.code || "EXECUTE_PROPOSAL_2BY2_MULTISIG_ERROR",
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function createSolanaTools(solanaKit: SolanaAgentKit) {
|
||||
return [
|
||||
new SolanaBalanceTool(solanaKit),
|
||||
@@ -2394,5 +2428,6 @@ export function createSolanaTools(solanaKit: SolanaAgentKit) {
|
||||
new SolanaCreateProposal2by2Multisig(solanaKit),
|
||||
new SolanaApproveProposal2by2Multisig(solanaKit),
|
||||
new SolanaRejectProposal2by2Multisig(solanaKit),
|
||||
new SolanaExecuteProposal2by2Multisig(solanaKit),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user