pub struct ProgramManager<N: Network> { /* private fields */ }
Expand description

Program management object for loading programs for building, execution, and deployment

This object is meant to be a software abstraction that can be consumed by software like CLI tools, IDE plugins, Server-side stack components and other software that needs to interact with the Aleo network.

Implementations§

source§

impl<N: Network> ProgramManager<N>

source

pub fn deploy_program( &mut self, program_id: impl TryInto<ProgramID<N>>, fee: u64, fee_record: Record<N, Plaintext<N>>, password: Option<&str> ) -> Result<String>

Deploy a program to the network

source

pub fn create_deploy_transaction( program: &Program<N>, imports: &[Program<N>], private_key: &PrivateKey<N>, fee: u64, fee_record: Record<N, Plaintext<N>>, query: String ) -> Result<Transaction<N>>

Create a deploy transaction for a program without instantiating the program manager

source§

impl<N: Network> ProgramManager<N>

source

pub fn execute_program( &mut self, program_id: impl TryInto<ProgramID<N>>, function: impl TryInto<Identifier<N>>, inputs: impl ExactSizeIterator<Item = impl TryInto<Value<N>>>, fee: u64, fee_record: Record<N, Plaintext<N>>, password: Option<&str> ) -> 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

source

pub fn create_execute_transaction( private_key: &PrivateKey<N>, fee: u64, inputs: impl ExactSizeIterator<Item = impl TryInto<Value<N>>>, fee_record: Record<N, Plaintext<N>>, program: &Program<N>, function: impl TryInto<Identifier<N>>, query: String ) -> Result<Transaction<N>>

Create an execute transaction

source§

impl<N: Network> ProgramManager<N>

source

pub fn broadcast_transaction( &self, transaction: Transaction<N> ) -> Result<String>

Broadcast a transaction to the network

source

pub fn api_client(&self) -> Result<&AleoAPIClient<N>>

Get a reference to the configured API client

source

pub fn on_chain_program_state( &self, program: &Program<N> ) -> Result<OnChainProgramState>

Check the on-chain version of a program to determine if it is deployed, and if so, if it is the same as the local version

source§

impl<N: Network> ProgramManager<N>

source

pub fn find_program(&self, program_id: &ProgramID<N>) -> Result<Program<N>>

Find a program by first looking on disk, and if not found, on the aleo network

source

pub fn find_program_on_disk( &self, program_id: &ProgramID<N> ) -> Result<Program<N>>

Load a program from a local program directory

source

pub fn find_program_on_chain( &self, program_id: &ProgramID<N> ) -> Result<Program<N>>

Load a program from the network

source

pub fn find_program_imports( &self, program: &Program<N> ) -> Result<Vec<Program<N>>>

Find a program’s imports by first searching on disk, and if not found, on the aleo network

source§

impl<N: Network> ProgramManager<N>

source

pub fn transfer( &self, amount: u64, fee: u64, recipient_address: Address<N>, password: Option<&str>, input_record: Record<N, Plaintext<N>>, fee_record: Record<N, Plaintext<N>> ) -> Result<String>

Executes a transfer to the specified recipient_address with the specified amount and fee. Specify 0 for no fee.

source§

impl<N: Network> ProgramManager<N>

source

pub fn new( private_key: Option<PrivateKey<N>>, private_key_ciphertext: Option<Ciphertext<N>>, api_client: Option<AleoAPIClient<N>>, local_program_directory: Option<PathBuf> ) -> Result<Self>

Create a new program manager by specifying custom options for the private key (or private key ciphertext) and resolver. Use this method if you want to create a custom resolver (i.e. one that searches a local or remote database) for program and record resolution.

source

pub fn add_program(&mut self, program: &Program<N>) -> Result<()>

Manually add a program to the program manager from memory if it does not already exist

source

pub fn update_program(&mut self, program: &Program<N>) -> Option<Program<N>>

Manually add a program to the program manager if it does not already exist or update it if it does

source

pub fn get_program( &self, program_id: impl TryInto<ProgramID<N>> ) -> Result<Program<N>>

Retrieve a program from the program manager if it exists

source

pub fn contains_program( &self, program_id: impl TryInto<ProgramID<N>> ) -> Result<bool>

Determine if a program exists in the program manager

Trait Implementations§

source§

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

source§

fn clone(&self) -> ProgramManager<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

Auto Trait Implementations§

§

impl<N> !RefUnwindSafe for ProgramManager<N>

§

impl<N> Send for ProgramManager<N>

§

impl<N> Sync for ProgramManager<N>

§

impl<N> Unpin for ProgramManager<N>where N: Unpin, <N as Environment>::Field: Unpin, <N as Environment>::Projective: Unpin, <N as Environment>::Scalar: Unpin,

§

impl<N> !UnwindSafe for ProgramManager<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