Transaction parameters

Transaction parameters are:

  1. Gas price;
  2. Gas limit;
  3. Byte price;
  4. Maturity.

You can configure these parameters by creating an instance of TxParameters and passing it to a chain method called tx_params:

        // In order: gas_price, gas_limit, and maturity
        let my_tx_params = TxParameters::new(None, Some(1_000_000), None);

        let response = contract_instance
            .initialize_counter(42) // Our contract method.
            .tx_params(my_tx_params) // Chain the tx params setting method.
            .call() // Perform the contract call.
            .await?; // This is an async call, `.await` for it.

You can also use TxParameters::default() to use the default values:

pub const DEFAULT_GAS_LIMIT: u64 = 1_000_000;
pub const DEFAULT_GAS_PRICE: u64 = 0;
pub const DEFAULT_MATURITY: u64 = 0;

This way:

        let response = contract_instance
            .initialize_counter(42)
            .tx_params(TxParameters::default())
            .call()
            .await?;