getGenesisAddress method

Future<Address> getGenesisAddress(
  1. String address
)

Query the network to find the genesis address of a transaction Returns a Address with genesisAddress

Implementation

Future<Address> getGenesisAddress(String address) async {
  final body = 'query { genesisAddress (address:"$address") }';

  final result = await _client
      .withLogger(
        'getGenesisAddress',
        logsActivation: logsActivation,
      )
      .query(
        QueryOptions(
          document: gql(body),
          parserFn: (json) =>
              GenesisAddressResponseData.fromJson(json).address,
        ),
      );

  if (result.exception?.linkException != null) {
    throw ArchethicConnectionException(
      result.exception!.linkException.toString(),
    );
  }

  return result.parsedData ?? const Address(address: '');
}