callMulti method

Future<List<Map>> callMulti(
  1. String caller,
  2. List<Clause> clauses, {
  3. int gas = 0,
  4. String? gasPayer,
  5. String block = "best",
})

Call a contract method (read-only). This is a single transaction, multi-clause call. This WON'T create ANY change on blockchain. Only emulation happens. If the called functions has any return value, it will be included in "decoded" field

Implementation

Future<List<Map>> callMulti(String caller, List<dev.Clause> clauses,
    {int gas = 0, String? gasPayer, String block = "best"}) async {
  bool needFeeDelegation = gasPayer != null;
  // Build tx body
  Map b = await getBlock();

  var tx = buildTransaction(
      clauses, await getChainTag(), calcBlockRef(b["id"]), calcNonce(),
      gas: gas, feeDelegation: needFeeDelegation);
  var txBody = json.decode(tx.toJsonString());

  // Emulate the Tx
  var eResponses =
      await emulateTx(caller, txBody, block: block, gasPayer: gasPayer);
  assert(eResponses.length == clauses.length);
  return eResponses;
}