Struct hedera::ContractCreateFlow
source · pub struct ContractCreateFlow { /* private fields */ }
Expand description
Create a new smart contract
The operation of this flow is as follows:
- Create a file for the contract’s bytecode (via a
FileCreateTransaction
and zero or moreFileAppendTransaction
s) - Execute a
ContractCreateTransaction
using the provided information and the newly created file. - Delete the file created in step 1.
Implementations§
source§impl ContractCreateFlow
impl ContractCreateFlow
sourcepub fn get_bytecode(&self) -> &[u8] ⓘ
pub fn get_bytecode(&self) -> &[u8] ⓘ
Returns bytes of the smart contract.
sourcepub fn bytecode(&mut self, bytecode: Vec<u8>) -> &mut Self
pub fn bytecode(&mut self, bytecode: Vec<u8>) -> &mut Self
Sets the raw bytes of the smart contract.
sourcepub fn bytecode_hex(&mut self, bytecode: &str) -> Result<&mut Self>
pub fn bytecode_hex(&mut self, bytecode: &str) -> Result<&mut Self>
Sets the bytecode of the smart contract in hex.
§Errors
Error::BasicParse
ifbytecode
is invalid hex.
sourcepub fn get_node_account_ids(&self) -> Option<&[AccountId]>
pub fn get_node_account_ids(&self) -> Option<&[AccountId]>
Returns the account IDs of the nodes the transactions may be submitted to.
sourcepub fn node_account_ids(
&mut self,
node_account_ids: impl IntoIterator<Item = AccountId>,
) -> &mut Self
pub fn node_account_ids( &mut self, node_account_ids: impl IntoIterator<Item = AccountId>, ) -> &mut Self
Sets the account IDs of the nodes the transactions may be submitted to.
Defaults to the full list of nodes configured on the client.
sourcepub fn get_max_chunks(&self) -> Option<usize>
pub fn get_max_chunks(&self) -> Option<usize>
Returns maximum number of chunks the FileAppendTransaction
can be split into.
If null, the default value for a FileAppendTransaction
will be used.
sourcepub fn max_chunks(&mut self, max_chunks: usize) -> &mut Self
pub fn max_chunks(&mut self, max_chunks: usize) -> &mut Self
Sets the maximum number of chunks the FileAppendTransaction
can be split into.
sourcepub fn get_constructor_parameters(&self) -> &[u8] ⓘ
pub fn get_constructor_parameters(&self) -> &[u8] ⓘ
Returns the parameters to pass to the constructor.
sourcepub fn constructor_parameters(
&mut self,
constructor_parameters: impl Into<Vec<u8>>,
) -> &mut Self
pub fn constructor_parameters( &mut self, constructor_parameters: impl Into<Vec<u8>>, ) -> &mut Self
Sets the parameters to pass to the constructor.
sourcepub fn get_initial_balance(&self) -> Hbar
pub fn get_initial_balance(&self) -> Hbar
Returns the initial balance to put into the cryptocurrency account associated with the new smart contract.
sourcepub fn initial_balance(&mut self, initial_balance: Hbar) -> &mut Self
pub fn initial_balance(&mut self, initial_balance: Hbar) -> &mut Self
Sets the initial balance to put into the cryptocurrency account associated with the new smart contract.
sourcepub fn get_max_automatic_token_associations(&self) -> u32
pub fn get_max_automatic_token_associations(&self) -> u32
Retunrs the maximum number of tokens that the contract can be automatically associated with.
sourcepub fn max_automatic_token_associations(
&mut self,
max_automatic_token_associations: u32,
) -> &mut Self
pub fn max_automatic_token_associations( &mut self, max_automatic_token_associations: u32, ) -> &mut Self
Sets the maximum number of tokens that the contract can be automatically associated with.
sourcepub fn get_decline_staking_reward(&self) -> bool
pub fn get_decline_staking_reward(&self) -> bool
If true
, the contract will decline receiving a staking reward.
The default value is false.
sourcepub fn decline_staking_reward(
&mut self,
decline_staking_reward: bool,
) -> &mut Self
pub fn decline_staking_reward( &mut self, decline_staking_reward: bool, ) -> &mut Self
If set to true
, the contract will decline receiving a staking reward.
sourcepub fn get_admin_key(&self) -> Option<&Key>
pub fn get_admin_key(&self) -> Option<&Key>
Reutrns the admin key for the new contract.
sourcepub fn admin_key(&mut self, admin_key: impl Into<Key>) -> &mut Self
pub fn admin_key(&mut self, admin_key: impl Into<Key>) -> &mut Self
Sets the admin key for the new contract.
sourcepub fn get_auto_renew_account_id(&self) -> Option<AccountId>
pub fn get_auto_renew_account_id(&self) -> Option<AccountId>
Returns the account to be used at the contract’s expiration time to extend the life of the contract.
sourcepub fn auto_renew_account_id(
&mut self,
auto_renew_account_id: AccountId,
) -> &mut Self
pub fn auto_renew_account_id( &mut self, auto_renew_account_id: AccountId, ) -> &mut Self
Sets the account to be used at the contract’s expiration time to extend the life of the contract.
sourcepub fn get_auto_renew_period(&self) -> Option<Duration>
pub fn get_auto_renew_period(&self) -> Option<Duration>
Returns the auto renew period for the smart contract.
sourcepub fn auto_renew_period(&mut self, auto_renew_period: Duration) -> &mut Self
pub fn auto_renew_period(&mut self, auto_renew_period: Duration) -> &mut Self
Sets the auto renew period for the smart contract.
sourcepub fn get_contract_memo(&self) -> Option<&str>
pub fn get_contract_memo(&self) -> Option<&str>
Returns the memo for the new smart contract.
sourcepub fn contract_memo(&mut self, contract_memo: String) -> &mut Self
pub fn contract_memo(&mut self, contract_memo: String) -> &mut Self
Sets the memo for the new smart contract.
sourcepub fn get_staked_account_id(&self) -> Option<AccountId>
pub fn get_staked_account_id(&self) -> Option<AccountId>
Returns the ID of the account to which the contract is staking.
sourcepub fn staked_account_id(&mut self, staked_account_id: AccountId) -> &mut Self
pub fn staked_account_id(&mut self, staked_account_id: AccountId) -> &mut Self
Sets the ID of the account to which the contract is staking.
sourcepub fn get_staked_node_id(&self) -> Option<u64>
pub fn get_staked_node_id(&self) -> Option<u64>
Returns ID of the node to which the contract is staking.
sourcepub fn staked_node_id(&mut self, staked_node_id: u64) -> &mut Self
pub fn staked_node_id(&mut self, staked_node_id: u64) -> &mut Self
Sets the ID of the node to which the contract is staking.
sourcepub fn freeze_with(&mut self, client: Client) -> &mut Self
pub fn freeze_with(&mut self, client: Client) -> &mut Self
Sets the client to use for freezing the generated ContractCreateTransaction
.
By default freezing will use the client provided to execute
.
Note: This only affects the ContractCreateTransaction
currently, that is not guaranteed to always be the case.
sourcepub fn sign(&mut self, key: PrivateKey) -> &mut Self
pub fn sign(&mut self, key: PrivateKey) -> &mut Self
Sets the signer for use in the ContractCreateTransaction
Important: Only one signer is allowed.
sourcepub fn sign_with<F: Fn(&[u8]) -> Vec<u8> + Send + Sync + 'static>(
&mut self,
public_key: PublicKey,
signer: F,
) -> &mut Self
pub fn sign_with<F: Fn(&[u8]) -> Vec<u8> + Send + Sync + 'static>( &mut self, public_key: PublicKey, signer: F, ) -> &mut Self
Sets the signer for use in the ContractCreateTransaction
Important: Only one signer is allowed.
sourcepub async fn execute(&self, client: &Client) -> Result<TransactionResponse>
pub async fn execute(&self, client: &Client) -> Result<TransactionResponse>
Generates the required transactions and executes them all.
sourcepub async fn execute_with_timeout(
&self,
client: &Client,
timeout_per_transaction: Duration,
) -> Result<TransactionResponse>
pub async fn execute_with_timeout( &self, client: &Client, timeout_per_transaction: Duration, ) -> Result<TransactionResponse>
Generates the required transactions and executes them all.
Trait Implementations§
source§impl Debug for ContractCreateFlow
impl Debug for ContractCreateFlow
source§impl Default for ContractCreateFlow
impl Default for ContractCreateFlow
source§fn default() -> ContractCreateFlow
fn default() -> ContractCreateFlow
Auto Trait Implementations§
impl Freeze for ContractCreateFlow
impl !RefUnwindSafe for ContractCreateFlow
impl Send for ContractCreateFlow
impl Sync for ContractCreateFlow
impl !Unpin for ContractCreateFlow
impl !UnwindSafe for ContractCreateFlow
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request