pub struct AleoAPIClient<N: Network> { /* private fields */ }
Expand description
Aleo API client for interacting with the Aleo Beacon API
Implementations§
Source§impl<N: Network> AleoAPIClient<N>
impl<N: Network> AleoAPIClient<N>
Sourcepub fn latest_height(&self) -> Result<u32>
pub fn latest_height(&self) -> Result<u32>
Get the latest block height
Sourcepub fn latest_hash(&self) -> Result<N::BlockHash>
pub fn latest_hash(&self) -> Result<N::BlockHash>
Get the latest block hash
Sourcepub fn latest_block(&self) -> Result<Block<N>>
pub fn latest_block(&self) -> Result<Block<N>>
Get the latest block
Sourcepub fn get_block(&self, height: u32) -> Result<Block<N>>
pub fn get_block(&self, height: u32) -> Result<Block<N>>
Get the block matching the specific height from the network
Sourcepub fn get_blocks(
&self,
start_height: u32,
end_height: u32,
) -> Result<Vec<Block<N>>>
pub fn get_blocks( &self, start_height: u32, end_height: u32, ) -> Result<Vec<Block<N>>>
Get a range of blocks from the network (limited 50 blocks at a time)
Sourcepub fn get_transaction(&self, transaction_id: &str) -> Result<Transaction<N>>
pub fn get_transaction(&self, transaction_id: &str) -> Result<Transaction<N>>
Retrieve a transaction by via its transaction id
Sourcepub fn get_memory_pool_transactions(&self) -> Result<Vec<Transaction<N>>>
pub fn get_memory_pool_transactions(&self) -> Result<Vec<Transaction<N>>>
Get pending transactions currently in the mempool.
Sourcepub fn get_program(
&self,
program_id: impl TryInto<ProgramID<N>>,
) -> Result<Program<N>>
pub fn get_program( &self, program_id: impl TryInto<ProgramID<N>>, ) -> Result<Program<N>>
Get a program from the network by its ID. This method will return an error if it does not exist.
Sourcepub fn get_program_imports(
&self,
program_id: impl TryInto<ProgramID<N>>,
) -> Result<IndexMap<ProgramID<N>, Program<N>>>
pub fn get_program_imports( &self, program_id: impl TryInto<ProgramID<N>>, ) -> Result<IndexMap<ProgramID<N>, Program<N>>>
Resolve imports of a program in a depth-first-search order from a program id
Sourcepub fn get_program_imports_from_source(
&self,
program: &Program<N>,
) -> Result<IndexMap<ProgramID<N>, Program<N>>>
pub fn get_program_imports_from_source( &self, program: &Program<N>, ) -> Result<IndexMap<ProgramID<N>, Program<N>>>
Resolve imports of a program in a depth-first-search order from program source code
Sourcepub fn get_program_mappings(
&self,
program_id: impl TryInto<ProgramID<N>>,
) -> Result<Vec<Identifier<N>>>
pub fn get_program_mappings( &self, program_id: impl TryInto<ProgramID<N>>, ) -> Result<Vec<Identifier<N>>>
Get all mappings associated with a program.
Sourcepub fn get_mapping_value(
&self,
program_id: impl TryInto<ProgramID<N>>,
mapping_name: impl TryInto<Identifier<N>>,
key: impl TryInto<Plaintext<N>>,
) -> Result<Value<N>>
pub fn get_mapping_value( &self, program_id: impl TryInto<ProgramID<N>>, mapping_name: impl TryInto<Identifier<N>>, key: impl TryInto<Plaintext<N>>, ) -> Result<Value<N>>
Get the current value of a mapping given a specific program, mapping name, and mapping key
pub fn find_block_hash( &self, transaction_id: N::TransactionID, ) -> Result<N::BlockHash>
Sourcepub fn find_transition_id(
&self,
input_or_output_id: Field<N>,
) -> Result<N::TransitionID>
pub fn find_transition_id( &self, input_or_output_id: Field<N>, ) -> Result<N::TransitionID>
Returns the transition ID that contains the given input ID
or output ID
.
Sourcepub fn scan(
&self,
view_key: impl TryInto<ViewKey<N>>,
block_heights: Range<u32>,
max_records: Option<usize>,
) -> Result<Vec<(Field<N>, Record<N, Ciphertext<N>>)>>
pub fn scan( &self, view_key: impl TryInto<ViewKey<N>>, block_heights: Range<u32>, max_records: Option<usize>, ) -> Result<Vec<(Field<N>, Record<N, Ciphertext<N>>)>>
Scans the ledger for records that match the given view key.
Sourcepub fn get_program_records(
&self,
private_key: &PrivateKey<N>,
program_id: impl TryInto<ProgramID<N>>,
block_heights: Range<u32>,
unspent_only: bool,
max_records: Option<usize>,
) -> Result<Vec<(Field<N>, Record<N, Ciphertext<N>>)>>
pub fn get_program_records( &self, private_key: &PrivateKey<N>, program_id: impl TryInto<ProgramID<N>>, block_heights: Range<u32>, unspent_only: bool, max_records: Option<usize>, ) -> Result<Vec<(Field<N>, Record<N, Ciphertext<N>>)>>
Search for records that belong to a specific program
Sourcepub fn get_unspent_records(
&self,
private_key: &PrivateKey<N>,
block_heights: Range<u32>,
max_gates: Option<u64>,
specified_amounts: Option<&Vec<u64>>,
) -> Result<Vec<(Field<N>, Record<N, Plaintext<N>>)>>
pub fn get_unspent_records( &self, private_key: &PrivateKey<N>, block_heights: Range<u32>, max_gates: Option<u64>, specified_amounts: Option<&Vec<u64>>, ) -> Result<Vec<(Field<N>, Record<N, Plaintext<N>>)>>
Search for unspent records in the ledger
Sourcepub fn transaction_broadcast(
&self,
transaction: Transaction<N>,
) -> Result<String>
pub fn transaction_broadcast( &self, transaction: Transaction<N>, ) -> Result<String>
Broadcast a deploy or execute transaction to the Aleo network
Source§impl<N: Network> AleoAPIClient<N>
impl<N: Network> AleoAPIClient<N>
Trait Implementations§
Source§impl<N: Clone + Network> Clone for AleoAPIClient<N>
impl<N: Clone + Network> Clone for AleoAPIClient<N>
Source§fn clone(&self) -> AleoAPIClient<N>
fn clone(&self) -> AleoAPIClient<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<N> Freeze for AleoAPIClient<N>
impl<N> !RefUnwindSafe for AleoAPIClient<N>
impl<N> Send for AleoAPIClient<N>
impl<N> Sync for AleoAPIClient<N>
impl<N> Unpin for AleoAPIClient<N>where
N: Unpin,
impl<N> !UnwindSafe for AleoAPIClient<N>
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
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>
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>
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