simolus3 / web3dart

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

getBlockInformation() - Throws Error #235

Open TheGreatAxios opened 2 years ago

TheGreatAxios commented 2 years ago

Using this in a for loop starting at 0 and right now it is running from 0 -> 0x28 so about 45-50 times I believe.

Using: getBlockInformation(blockNumber: BlockNum.exact(i).toBlockParam());

When it gets to 0x28 it throws this error;


#0      JsonRPC.call (package:web3dart/json_rpc.dart:62:7)
<asynchronous suspension>
#1      Web3Client._makeRPCCall (package:web3dart/src/core/client.dart:54:20)
<asynchronous suspension>```

Any thoughts would be helpful, pretty sure that I did something similar a few days ago so not sure what may be throwing the error now. 
simolus3 commented 2 years ago

I tried to reproduce this with the following snippet, but it does not report an error for me. Maybe you're hitting rate limits?

import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart';

Future<void> main() async {
  final client = Web3Client(
    'https://mainnet.infura.io/v3/<project>',
    Client(),
  );

  for (var i = 0; i <= 0x28; i++) {
    await client.getBlockInformation(blockNumber: BlockNum.exact(i));
  }
}