ETHAddress constructor

ETHAddress(
  1. String address, {
  2. bool skipChecksum = true,
})

Creates an ETHAddress instance from an Ethereum address string.

Optionally, skipChecksum can be set to true to skip the address checksum validation.

Implementation

factory ETHAddress(String address, {bool skipChecksum = true}) {
  try {
    EthAddrDecoder().decodeAddr(address, {"skip_chksum_enc": skipChecksum});
    return ETHAddress._(EthAddrUtils.toChecksumAddress(address));
  } catch (e) {
    throw MessageException("invalid ethereum address",
        details: {"input": address});
  }
}