getDataByContractAddress method
Get all the NFT data (name, floor price, 24 hr volume....) based on the nft collection contract address and respective asset platform
assetPlatformId
sets the asset platform id.
Refers to /asset_platforms
contractAddress
sets the contract address of token.
Query path: /nfts/{asset_platform_id}/contract/{contract_address}
Implementation
Future<CoinGeckoResult<NftCollectionData?>> getDataByContractAddress({
required String assetPlatformId,
required String contractAddress,
}) async {
final response = await _client.dio.get(
'/nfts/$assetPlatformId/contract/$contractAddress',
);
if (response.statusCode == 200) {
final map = Convert.toMapN<String, dynamic>(response.data);
final data = map != null ? NftCollectionData.fromJson(map) : null;
return CoinGeckoResult(data);
} else {
return CoinGeckoResult(
null,
errorMessage: response.data.toString(),
errorCode: response.statusCode ?? null,
isError: true,
);
}
}