Struct aleo_rust::api::AleoAPIClient
source · 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: N::TransactionID
) -> Result<Transaction<N>>
pub fn get_transaction( &self, transaction_id: N::TransactionID ) -> 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_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_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