getIdentity method

  1. @override
Future<BlockchainIdentity> getIdentity(
  1. String address,
  2. int chainId
)
override

Gets the name and avatar of a provided address on the given chain

Implementation

@override
Future<BlockchainIdentity> getIdentity(String address, int chainId) async {
  final String scope = '$namespace:$chainId';
  final String endpoint =
      '$blockchainApiUriRoot/v1/identity/$address?chainId=$scope&projectId=$projectId';

  final response = await http.get(
    Uri.parse(endpoint),
  );

  if (response.statusCode == 200) {
    return BlockchainIdentity.fromJson(
      jsonDecode(response.body),
    );
  } else {
    throw Exception('Failed to load data');
  }
}