1use serde::{Deserialize, Serialize};
2use solana_sdk::pubkey::Pubkey;
3
4#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
7#[serde(rename_all = "PascalCase")]
8#[repr(u8)]
9pub enum ActionType {
10 Transaction = 0,
11 Decision = 1,
12 ModelInvocation = 2,
13 ToolCall = 3,
14 ResourceAccess = 4,
15 PolicyCheck = 5,
16 Custom = 6,
17}
18
19#[derive(Debug, Clone, Serialize, Deserialize)]
21pub struct AttestationPayload {
22 pub action_type: ActionType,
23 pub payload: serde_json::Value,
24 pub metadata: Option<serde_json::Value>,
25}
26
27#[derive(Debug, Clone)]
29pub struct AttestResult {
30 pub tx_signature: String,
31 pub explorer_url: String,
32}
33
34#[derive(Debug, Clone)]
36pub struct RegisterAgentResult {
37 pub tx_signature: String,
38 pub agent_pda: Pubkey,
39 pub explorer_url: String,
40}
41
42#[derive(Debug, Clone)]
44pub struct AgentAccount {
45 pub address: Pubkey,
46 pub operator: Pubkey,
47 pub agent_id: [u8; 32],
48 pub policy_root: [u8; 32],
49 pub attestation_count: u64,
50 pub created_at: i64,
51 pub revoked: bool,
52 pub bump: u8,
53}
54
55#[derive(Debug, Clone)]
57pub struct AttestParams {
58 pub action_hash: [u8; 32],
59 pub action_type: ActionType,
60 pub privacy_mode: bool,
61}
62
63#[derive(Debug, Clone)]
65pub struct ProvaConfig {
66 pub rpc_url: String,
67 pub program_id: Option<String>,
69}
70
71impl Default for ProvaConfig {
72 fn default() -> Self {
73 Self {
74 rpc_url: "https://api.devnet.solana.com".to_string(),
75 program_id: None,
76 }
77 }
78}
79
80pub type AttestationResult = AttestResult;
82
83#[derive(Debug, Clone)]
84pub struct VerifyResult {
85 pub valid: bool,
86 pub error: Option<String>,
87}
88
89#[derive(Debug, Clone)]
90pub struct HistoryQuery {
91 pub agent_id: String,
92 pub from_timestamp: Option<u64>,
93 pub to_timestamp: Option<u64>,
94 pub action_type: Option<ActionType>,
95 pub limit: Option<usize>,
96 pub offset: Option<usize>,
97}