simolus3 / web3dart

Ethereum library, written in Dart.
MIT License
442 stars 270 forks source link

generated contract code shows "Expected an identifier." error #193

Closed Hanggi closed 2 years ago

Hanggi commented 2 years ago

The solidity code was:

    mapping(address => uint) public userTotalAmount;

And generates as below:

/// The optional [atBlock] parameter can be used to view historical data. When
  /// set, the function will be evaluated in the specified block. By default, the
  /// latest on-chain block will be used.
  Future<BigInt> userTotalAmount(_i1.EthereumAddress ,      <--------------- The first param shows "Expected an identifier."
      {_i1.BlockNum? atBlock}) async {
    final function = self.function('userTotalAmount');
    final params = [];
    final response = await read(function, params, atBlock);
    return (response[0] as BigInt);
  }
simolus3 commented 2 years ago

Fixed in 978051e464013891f101421ace020e0cc6a8ba43.