fromEns static method

Future<ENSResolver?>? fromEns(
  1. String name,
  2. {ChainBaseApiBase? client}
)

Creates an instance of ENSResolver from an ENS name.

  • name: The ENS name.

Returns a Future that completes with an instance of ENSResolver.

Implementation

static Future<ENSResolver?>? fromEns(String name,
    {ChainBaseApiBase? client}) {
  return client
      ?.resolveENSName(name)
      .then((value) => value.data?.address)
      .then((address) => address == null
          ? null
          : ENSResolver(EthereumAddress.fromHex(address).addressBytes));
}