Struct fuels_programs::script_calls::ScriptCallHandler
source · pub struct ScriptCallHandler<T: Account, D> {
pub script_call: ScriptCall,
pub tx_parameters: TxParameters,
pub account: T,
pub provider: Provider,
pub datatype: PhantomData<D>,
pub log_decoder: LogDecoder,
/* private fields */
}Expand description
Helper that handles submitting a script call to a client and formatting the response
Fields§
§script_call: ScriptCall§tx_parameters: TxParameters§account: T§provider: Provider§datatype: PhantomData<D>§log_decoder: LogDecoderImplementations§
source§impl<T: Account, D> ScriptCallHandler<T, D>where
D: Parameterize + Tokenizable + Debug,
impl<T: Account, D> ScriptCallHandler<T, D>where D: Parameterize + Tokenizable + Debug,
pub fn new( script_binary: Vec<u8>, encoded_args: UnresolvedBytes, account: T, provider: Provider, log_decoder: LogDecoder ) -> Self
sourcepub fn tx_params(self, params: TxParameters) -> Self
pub fn tx_params(self, params: TxParameters) -> Self
Sets the transaction parameters for a given transaction. Note that this is a builder method, i.e. use it as a chain:
ⓘ
let params = TxParameters { gas_price: 100, gas_limit: 1000000 };
instance.main(...).tx_params(params).call()pub fn with_outputs(self, outputs: Vec<Output>) -> Self
pub fn with_inputs(self, inputs: Vec<Input>) -> Self
pub fn set_contract_ids(self, contract_ids: &[Bech32ContractId]) -> Self
pub fn set_contracts(self, contracts: &[&dyn SettableContract]) -> Self
sourcepub async fn call(self) -> Result<FuelCallResponse<D>>
pub async fn call(self) -> Result<FuelCallResponse<D>>
Call a script on the node, in a state-modifying manner.
sourcepub async fn simulate(&mut self) -> Result<FuelCallResponse<D>>
pub async fn simulate(&mut self) -> Result<FuelCallResponse<D>>
Call a script on the node, in a simulated manner, meaning the state of the
blockchain is not modified but simulated.
It is the same as the call method because the API is more user-friendly this way.
sourcepub async fn estimate_transaction_cost(
&self,
tolerance: Option<f64>
) -> Result<TransactionCost>
pub async fn estimate_transaction_cost( &self, tolerance: Option<f64> ) -> Result<TransactionCost>
Get a scripts’s estimated cost
sourcepub fn get_response(
&self,
receipts: Vec<Receipt>
) -> Result<FuelCallResponse<D>>
pub fn get_response( &self, receipts: Vec<Receipt> ) -> Result<FuelCallResponse<D>>
Create a FuelCallResponse from call receipts
Trait Implementations§
source§impl<T, D> TxDependencyExtension for ScriptCallHandler<T, D>where
T: Account,
D: Tokenizable + Parameterize + Debug + Send + Sync,
impl<T, D> TxDependencyExtension for ScriptCallHandler<T, D>where T: Account, D: Tokenizable + Parameterize + Debug + Send + Sync,
fn simulate<'life0, 'async_trait>( &'life0 mut self ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
source§fn append_variable_outputs(self, num: u64) -> Self
fn append_variable_outputs(self, num: u64) -> Self
Appends
num fuel_tx::Output::Variables to the transaction.
Note that this is a builder method, i.e. use it as a chain: Read moresource§fn append_contract(self, contract_id: Bech32ContractId) -> Self
fn append_contract(self, contract_id: Bech32ContractId) -> Self
Appends additional external contracts as dependencies to this call.
Effectively, this will be used to create additional
fuel_tx::Input::Contract/fuel_tx::Output::Contract
pairs and set them into the transaction. Note that this is a builder
method, i.e. use it as a chain: Read morefn append_missing_dependencies(self, receipts: &[Receipt]) -> Self
source§fn estimate_tx_dependencies<'async_trait>(
self,
max_attempts: Option<u64>
) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
fn estimate_tx_dependencies<'async_trait>( self, max_attempts: Option<u64> ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>where Self: Send + 'async_trait,
Simulates the call and attempts to resolve missing tx dependencies.
Forwards the received error if it cannot be fixed.
Auto Trait Implementations§
impl<T, D> !RefUnwindSafe for ScriptCallHandler<T, D>
impl<T, D> Send for ScriptCallHandler<T, D>where D: Send,
impl<T, D> Sync for ScriptCallHandler<T, D>where D: Sync,
impl<T, D> Unpin for ScriptCallHandler<T, D>where D: Unpin, T: Unpin,
impl<T, D> !UnwindSafe for ScriptCallHandler<T, D>
Blanket Implementations§
§impl<T> AnyDebug for Twhere
T: Any + Debug,
impl<T> AnyDebug for Twhere T: Any + Debug,
§fn as_any_ref(&self) -> &(dyn Any + 'static)
fn as_any_ref(&self) -> &(dyn Any + 'static)
Returns a reference to the underlying type as
Any.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
Mutably borrows from an owned value. Read more