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>

source

pub fn latest_height(&self) -> Result<u32>

Get the latest block height

source

pub fn latest_hash(&self) -> Result<N::BlockHash>

Get the latest block hash

source

pub fn latest_block(&self) -> Result<Block<N>>

Get the latest block

source

pub fn get_block(&self, height: u32) -> Result<Block<N>>

Get the block matching the specific height from the network

source

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)

source

pub fn get_transaction( &self, transaction_id: N::TransactionID ) -> Result<Transaction<N>>

Retrieve a transaction by via its transaction id

source

pub fn get_memory_pool_transactions(&self) -> Result<Vec<Transaction<N>>>

Get pending transactions currently in the mempool.

source

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.

source

pub fn get_program_mappings( &self, program_id: impl TryInto<ProgramID<N>> ) -> Result<Vec<Identifier<N>>>

Get all mappings associated with a program.

source

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

source

pub fn find_block_hash( &self, transaction_id: N::TransactionID ) -> Result<N::BlockHash>

source

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.

source

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.

source

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

source

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>

source

pub fn new(base_url: &str, chain: &str) -> Result<Self>

source

pub fn testnet3() -> Self

source

pub fn local_testnet3(port: &str) -> Self

source

pub fn base_url(&self) -> &str

Get base URL

source

pub fn network_id(&self) -> &str

Get network ID being interacted with

Trait Implementations§

source§

impl<N: Clone + Network> Clone for AleoAPIClient<N>

source§

fn clone(&self) -> AleoAPIClient<N>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<N: Debug + Network> Debug for AleoAPIClient<N>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more