requestReadContract method

  1. @override
Future<List> requestReadContract({
  1. required String? topic,
  2. required String chainId,
  3. required DeployedContract deployedContract,
  4. required String functionName,
  5. EthereumAddress? sender,
  6. List parameters = const [],
})
override

Implementation

@override
Future<List<dynamic>> requestReadContract({
  required String? topic,
  required String chainId,
  required DeployedContract deployedContract,
  required String functionName,
  EthereumAddress? sender,
  List parameters = const [],
}) async {
  try {
    if (selectedChain == null) {
      throw W3MServiceException(
        'You must select a chain before reading a contract',
      );
    }
    return await _web3App.requestReadContract(
      deployedContract: deployedContract,
      functionName: functionName,
      rpcUrl: selectedChain!.rpcUrl,
      sender: sender,
      parameters: parameters,
    );
  } catch (e) {
    rethrow;
  }
}