Struct aleo_rust::ProgramManager
source · 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>
impl<N: Network> ProgramManager<N>
sourcepub fn deploy_program(
&mut self,
program_id: impl TryInto<ProgramID<N>>,
fee: u64,
fee_record: Record<N, Plaintext<N>>,
password: Option<&str>
) -> Result<String>
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
sourcepub 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>>
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>
impl<N: Network> ProgramManager<N>
sourcepub 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>
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
sourcepub 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>>
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>
impl<N: Network> ProgramManager<N>
sourcepub fn broadcast_transaction(
&self,
transaction: Transaction<N>
) -> Result<String>
pub fn broadcast_transaction( &self, transaction: Transaction<N> ) -> Result<String>
Broadcast a transaction to the network
sourcepub fn api_client(&self) -> Result<&AleoAPIClient<N>>
pub fn api_client(&self) -> Result<&AleoAPIClient<N>>
Get a reference to the configured API client
sourcepub fn on_chain_program_state(
&self,
program: &Program<N>
) -> Result<OnChainProgramState>
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>
impl<N: Network> ProgramManager<N>
sourcepub fn find_program(&self, program_id: &ProgramID<N>) -> Result<Program<N>>
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
sourcepub fn find_program_on_disk(
&self,
program_id: &ProgramID<N>
) -> Result<Program<N>>
pub fn find_program_on_disk( &self, program_id: &ProgramID<N> ) -> Result<Program<N>>
Load a program from a local program directory
sourcepub fn find_program_on_chain(
&self,
program_id: &ProgramID<N>
) -> Result<Program<N>>
pub fn find_program_on_chain( &self, program_id: &ProgramID<N> ) -> Result<Program<N>>
Load a program from the network
source§impl<N: Network> ProgramManager<N>
impl<N: Network> ProgramManager<N>
sourcepub 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>
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>
impl<N: Network> ProgramManager<N>
sourcepub 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>
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.
sourcepub fn add_program(&mut self, program: &Program<N>) -> Result<()>
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
sourcepub fn update_program(&mut self, program: &Program<N>) -> Option<Program<N>>
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