readContract method

Future<String> readContract({
  1. required String contractAddress,
  2. required LocalContractFunctionWithValues function,
})

Implementation

Future<String> readContract({
  required String contractAddress,
  required LocalContractFunctionWithValues function,
}) async {
  assert(
    function.stateMutability == StateMutability.view ||
        function.stateMutability == StateMutability.pure,
    "Invalid function",
  );

  final data = function.buildDataField();

  return await call(
    contractAddress: contractAddress,
    data: data,
  );
}