pub struct ProvaClient { /* private fields */ }Implementations§
Source§impl ProvaClient
impl ProvaClient
pub fn new(agent_keypair: Keypair, config: ProvaConfig) -> Self
Sourcepub fn derive_agent_pda(&self, operator: &Pubkey) -> (Pubkey, u8)
pub fn derive_agent_pda(&self, operator: &Pubkey) -> (Pubkey, u8)
Deriva la PDA del agente a partir de la pubkey del operador.
Sourcepub fn hash_action(action: &str) -> [u8; 32]
pub fn hash_action(action: &str) -> [u8; 32]
Calcula el SHA-256 de un string de acción, devuelve 32 bytes.
Sourcepub fn explorer_url(&self, signature: &str) -> String
pub fn explorer_url(&self, signature: &str) -> String
URL del explorador para una firma de transacción.
Sourcepub async fn register_agent(
&self,
operator_keypair: &Keypair,
policy_root: Option<[u8; 32]>,
) -> Result<RegisterAgentResult, ProvaError>
pub async fn register_agent( &self, operator_keypair: &Keypair, policy_root: Option<[u8; 32]>, ) -> Result<RegisterAgentResult, ProvaError>
Registra un nuevo agente on-chain.
El operator_keypair paga la transacción y se convierte en el dueño del agente.
policy_root es opcional (32 bytes); si es None, se usa un root vacío.
Sourcepub async fn attest(
&self,
operator_keypair: &Keypair,
action_hash: [u8; 32],
action_type: ActionType,
privacy_mode: bool,
) -> Result<AttestResult, ProvaError>
pub async fn attest( &self, operator_keypair: &Keypair, action_hash: [u8; 32], action_type: ActionType, privacy_mode: bool, ) -> Result<AttestResult, ProvaError>
Emite una sola atestación on-chain.
Sourcepub async fn batch_attest(
&self,
operator_keypair: &Keypair,
attestations: &[AttestParams],
) -> Result<AttestResult, ProvaError>
pub async fn batch_attest( &self, operator_keypair: &Keypair, attestations: &[AttestParams], ) -> Result<AttestResult, ProvaError>
Emite un batch de atestaciones on-chain (máximo 100).
Sourcepub async fn revoke_agent(
&self,
operator_keypair: &Keypair,
) -> Result<AttestResult, ProvaError>
pub async fn revoke_agent( &self, operator_keypair: &Keypair, ) -> Result<AttestResult, ProvaError>
Revoca un agente on-chain. Una vez revocado, no puede emitir más atestaciones.
Sourcepub async fn update_policy_root(
&self,
operator_keypair: &Keypair,
new_root: [u8; 32],
) -> Result<AttestResult, ProvaError>
pub async fn update_policy_root( &self, operator_keypair: &Keypair, new_root: [u8; 32], ) -> Result<AttestResult, ProvaError>
Actualiza el policy root de un agente registrado.
Sourcepub async fn get_agent_account(
&self,
operator: &Pubkey,
) -> Result<AgentAccount, ProvaError>
pub async fn get_agent_account( &self, operator: &Pubkey, ) -> Result<AgentAccount, ProvaError>
Lee la cuenta del agente directamente desde la blockchain.
Sourcepub async fn is_agent_active(&self, operator: &Pubkey) -> bool
pub async fn is_agent_active(&self, operator: &Pubkey) -> bool
Verifica si un agente está activo (registrado y no revocado).
Auto Trait Implementations§
impl !Freeze for ProvaClient
impl !RefUnwindSafe for ProvaClient
impl Send for ProvaClient
impl Sync for ProvaClient
impl Unpin for ProvaClient
impl UnsafeUnpin for ProvaClient
impl !UnwindSafe for ProvaClient
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more