Struct fuels_contract::script_calls::ScriptCallHandler
source · pub struct ScriptCallHandler<D> {
pub script_call: ScriptCall,
pub tx_parameters: TxParameters,
pub wallet: WalletUnlocked,
pub provider: Provider,
pub output_param: ParamType,
pub datatype: PhantomData<D>,
pub log_decoder: LogDecoder,
}
Expand description
Helper that handles submitting a script call to a client and formatting the response
Fields§
§script_call: ScriptCall
§tx_parameters: TxParameters
§wallet: WalletUnlocked
§provider: Provider
§output_param: ParamType
§datatype: PhantomData<D>
§log_decoder: LogDecoder
Implementations§
source§impl<D> ScriptCallHandler<D>where
D: Tokenizable + Debug,
impl<D> ScriptCallHandler<D>where
D: Tokenizable + Debug,
pub fn new(
script_binary: Vec<u8>,
encoded_args: UnresolvedBytes,
wallet: WalletUnlocked,
provider: Provider,
output_param: ParamType,
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
sourcepub async fn call(self) -> Result<FuelCallResponse<D>, Error>
pub async fn call(self) -> Result<FuelCallResponse<D>, Error>
Call a script on the node, in a state-modifying manner.
sourcepub async fn simulate(self) -> Result<FuelCallResponse<D>, Error>
pub async fn simulate(self) -> Result<FuelCallResponse<D>, Error>
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 fn get_response(
&self,
receipts: Vec<Receipt>
) -> Result<FuelCallResponse<D>, Error>
pub fn get_response(
&self,
receipts: Vec<Receipt>
) -> Result<FuelCallResponse<D>, Error>
Create a FuelCallResponse
from call receipts