getBlockchainVersion method

Future<BlockchainVersionModel> getBlockchainVersion()

Query the network to find the protocol, transaction and code versions

Implementation

Future<BlockchainVersionModel> getBlockchainVersion() async {
  const body = 'query { version {code protocol transaction} }';

  final result = await _client
      .withLogger(
        'getBlockchainVersion',
      )
      .query(
        QueryOptions(
          document: gql(body),
          parserFn: (json) => BlockchainVersionModel.fromJson(json),
        ),
      );

  manageLinkException(result);

  return result.parsedData ??
      const BlockchainVersionModel(
        version: BlockchainVersion(protocol: '', transaction: ''),
      );
}