Get Badge Balance
Get badge balance for an address
Retrieves the number of badges owned by a specific address.
Endpoint: /game/badge/balance
Method: GET
{
nft: string; // Badge contract address
address: string; // Address to check balance for
}
{
data: {
balance: number; // Number of badges owned
}
status: string;
}
{
error: string;
details?: any;
}
Example Usage
// Setup request parameters
const timestamp = Date.now().toString();
const params = {
nft: '0x1234567890123456789012345678901234567890', // Badge contract address
address: '0xabcdef1234567890abcdef1234567890abcdef' // Address to check
};
// Generate HMAC signature
const hmac = generateHmacSignature(timestamp, params, secretKey);
// Make the API request
const response = await axios.get(apiEndpoint + '/game/badge/balance', {
params,
headers: {
apikey: apiKey,
signature: hmac,
timestamp: timestamp
}
});
// Process the response
console.log('Badge Balance:', response.data.data.balance);
Last updated