-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea64301
commit ba9f6a9
Showing
5 changed files
with
118 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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: { | ||
transactionIndex: 0, | ||
}, | ||
output: { | ||
status: "success", | ||
message: "Proposal rejected successfully", | ||
transaction: "4xKpN2...", | ||
transactionIndex: "0", | ||
}, | ||
explanation: | ||
"Reject 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 tx = await multisig_reject_proposal(agent, transactionIndex); | ||
|
||
return { | ||
status: "success", | ||
message: "Proposal rejected successfully", | ||
transaction: tx, | ||
transactionIndex: transactionIndex, | ||
}; | ||
}, | ||
}; | ||
|
||
export default rejectMultisigProposalAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters