getTokenData method
Queries token data
Queries token data by tokenId
Implementation
// Future<dynamic> getTokenData(String tokenId) async {
// final variables = {
// "token_id": tokenId
// };
// return queryIndexer(document: GetTokenData, variables: variables);
// }
/// Queries token data by [tokenId]
Future<List<CurrentTokenData>> getTokenData(
String tokenId,
{TokenStandard? tokenStandard}
) async {
final tokenAddress = HexString.ensure(tokenId).hex();
IndexerClient.validateAddress(tokenAddress);
final whereCondition = {
"token_data_id": { "_eq": tokenAddress },
};
if (tokenStandard != null) {
whereCondition["token_standard"] = { "_eq": tokenStandard.toString() };
}
final variables = { "where_condition": whereCondition };
final data = await queryIndexer(document: GetTokenData, variables: variables);
return CurrentTokenDatas.fromJson(data).currentTokenDatasV2;
}