readFromContract static method

Future<List> readFromContract(
  1. Web3Client client,
  2. String contractName,
  3. String contractAddress,
  4. String functionName,
  5. List params, {
  6. String? jsonInterface,
})

Reads data from a deployed contract using the specified function and parameters.

client is the web3 client instance to interact with the Fuse network. contractName is the name of the contract. contractAddress is the address of the deployed contract. functionName is the name of the function to be called. params is a list of parameters to be passed to the function. jsonInterface is an optional JSON string representing the contract ABI.

Returns a Future that resolves to a list of values returned by the contract function.

Implementation

static Future<List<dynamic>> readFromContract(
  Web3Client client,
  String contractName,
  String contractAddress,
  String functionName,
  List<dynamic> params, {
  String? jsonInterface,
}) async {
  final DeployedContract contract = _getDeployedContract(
    contractName,
    contractAddress,
    jsonInterface: jsonInterface,
  );
  return client.call(
    contract: contract,
    function: contract.function(functionName),
    params: params,
  );
}