pub struct ProgramManager<'agent> { /* private fields */ }Implementations§
Source§impl<'agent> ProgramManager<'agent>
impl<'agent> ProgramManager<'agent>
Source§impl<'agent> ProgramManager<'agent>
impl<'agent> ProgramManager<'agent>
Sourcepub fn execute_program(
&self,
function: &str,
inputs: impl ExactSizeIterator<Item = impl TryInto<Value>>,
priority_fee: u64,
fee_record: Option<PlaintextRecord>,
) -> Result<String>
pub fn execute_program( &self, function: &str, inputs: impl ExactSizeIterator<Item = impl TryInto<Value>>, priority_fee: u64, fee_record: Option<PlaintextRecord>, ) -> Result<String>
Execute a program function on the Aleo Network.
To run this function successfully, the program must already be deployed on the Aleo Network
§Arguments
function- The function to executeinputs- The inputs to the functionpriority_fee- The priority fee to pay for the transactionfee_record- The plaintext record to pay for the transaction fee. If None, the fee will be paid through the account’s public balance
§Returns
The transaction ID of the execution transaction
§Example
ⓘ
use aleo_agent::agent::Agent;
use aleo_agent::program::ProgramManager;
let pm = Agent::default().program("xxx.aleo");
// Execute the main function of the xxx.aleo program with inputs 1, 2, 3; priority fee 100; and no fee record
// The fee will be paid through account's public balance
let tx_id = pm.execute_program("main", vec![1, 2, 3].into_iter(), 100, None).expect("Failed to execute program");Sourcepub fn get_program_records(
&self,
block_heights: Range<u32>,
unspent_only: bool,
) -> Result<Vec<(Field, CiphertextRecord)>>
pub fn get_program_records( &self, block_heights: Range<u32>, unspent_only: bool, ) -> Result<Vec<(Field, CiphertextRecord)>>
Execute a program function on the Aleo Network with a priority fee and no fee record
§Arguments
block_heights- The range of block heights to search for recordsunspent_only- Whether to return only unspent records : true for unspent records, false for all records
§Returns
A vector of records that match the search criteria
§Example
ⓘ
use aleo_agent::agent::Agent;
use aleo_agent::program::ProgramManager;
let pm = Agent::default().program("xxx.aleo");
// Get the unspent records of the first 100 blocks for the program
let records = pm.get_program_records(0..100, true).expect("Failed to get program records");Sourcepub fn get_mapping_value(
&self,
mapping_name: impl TryInto<Identifier>,
key: impl TryInto<Plaintext>,
) -> Result<Value>
pub fn get_mapping_value( &self, mapping_name: impl TryInto<Identifier>, key: impl TryInto<Plaintext>, ) -> Result<Value>
Sourcepub fn get_program_mappings(&self) -> Result<Vec<Identifier>>
pub fn get_program_mappings(&self) -> Result<Vec<Identifier>>
Get all mappings associated with a program.
Source§impl<'agent> ProgramManager<'agent>
impl<'agent> ProgramManager<'agent>
Trait Implementations§
Source§impl<'agent> Clone for ProgramManager<'agent>
impl<'agent> Clone for ProgramManager<'agent>
Source§fn clone(&self) -> ProgramManager<'agent>
fn clone(&self) -> ProgramManager<'agent>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<'agent> Freeze for ProgramManager<'agent>
impl<'agent> !RefUnwindSafe for ProgramManager<'agent>
impl<'agent> Send for ProgramManager<'agent>
impl<'agent> Sync for ProgramManager<'agent>
impl<'agent> Unpin for ProgramManager<'agent>
impl<'agent> !UnwindSafe for ProgramManager<'agent>
Blanket Implementations§
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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