Struct 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>

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: &str) -> 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_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

Source

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

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_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

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

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
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T