getBlockTimestamp method
- int blockNumber
Estimate Time to be included in the next block
Get Timestamp for block
Implementation
///
/// Get Timestamp for block
///
Future<int> getBlockTimestamp(int blockNumber) async {
final response = await _call(
'eth_getBlockByNumber',
args: [blockNumber.toHexWithPrefix, false],
);
if (response
case {
"timestamp": String timestamp_s,
}) {
final timestamp = timestamp_s.toBigIntOrNull;
if (timestamp == null) throw Exception('Could not parse timestamp');
return timestamp.toInt();
}
throw UnimplementedError();
}