getCode method
Returns code at a given address
address
- Address to get code from
tag
- ??
Example
var res = eth.getCode(
address: '0xf75e354c5edc8efed9b59ee9f67a80845ade7d0c',
tag: 'latest'
);
Implementation
Future<EtherScanRpcResponseModel> getCode({
required String address,
String? tag,
}) async {
const module = 'proxy';
const action = 'eth_getCode';
Map<String, dynamic>? query = {
'apiKey': apiKey,
'module': module,
'action': action,
'address': address,
};
if (tag != null) {
query.putIfAbsent('tag', () => tag);
}
return (await get(query)).fold(
(l) => EtherScanRpcResponseModel.empty(),
(r) => EtherScanRpcResponseModel.fromJson(r),
);
}