deployed method
- EthereumAddress? address,
- {BlockNum atBlock = const BlockNum.current()}
Checks if a contract is deployed.
address
: The address of the contract.- optional
atBlock
: The block number to check. defaults to the current block
Returns a Future
Implementation
Future<bool> deployed(EthereumAddress? address,
{BlockNum atBlock = const BlockNum.current()}) {
if (address == null) {
return Future.value(false);
}
final isDeployed = _provider
.send<String>('eth_getCode', [address.hex, atBlock.toBlockParam()])
.then(hexToBytes)
.then((value) => value.isNotEmpty);
return isDeployed;
}