getTransactionCount method Null safety
Returns the number of transactions sent from an address
address
- Address of the transaction
Example
var res = eth.getTransactionCount(
address: '0x2910543af39aba0cd09dbb2d50200b3e800a63d2',
tag: 'latest'
);
Implementation
Future<EtherScanRpcResponseModel> getTransactionCount({
required String? address,
String? tag,
}) async {
const module = 'proxy';
const action = 'eth_getTransactionCount';
Map<String, dynamic>? query = {
'address': address,
'module': module,
'action': action,
'apiKey': apiKey,
};
if (tag != null) {
query.putIfAbsent('tag', () => tag);
}
return (await get(query)).fold(
(l) => EtherScanRpcResponseModel.empty(),
(r) => EtherScanRpcResponseModel.fromJson(r),
);
}