GetWrappableBalances
GetWrappableBalances returns the maximum amount of a wrapper or alias denom an address can mint from its token balances.
Returns the maximum amount of a cosmos coin denom that an address can wrap from its current token balances in the denom's collection.
Example
bb query tokenization wrappable-balances "badges:1:utoken" bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d
bb query tokenization wrappable-balances "badgeslp:1:utoken" bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70dcurl "https://lcd.bitbadges.io/bitbadges/bitbadgeschain/tokenization/get_wrappable_balances/badges%3A1%3Autoken/bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d"The denom is a path segment, so encode : as %3A.
Request
| Field | Type | Description |
|---|---|---|
denom | string | badges:<collectionId>:<suffix> (wrapper path) or badgeslp:<collectionId>:<suffix> (alias path). Denoms with an {id} placeholder match by the numeric characters in the suffix. |
address | string | Address whose balances to evaluate. |
Response
{ "amount": "100" }| Field | Type | Description |
|---|---|---|
amount | Uint | Maximum wrappable amount in the denom's base units. |
Behavior
The query parses the collection ID from the denom, finds the matching path, and computes:
- For each balance in the path's
conversion.sideB, how many times it fits in the address's balances for those token IDs and ownership times (userAmount / pathAmount). - The minimum across all side B balances (every one is needed per conversion).
- That minimum multiplied by
conversion.sideA.amount.
Errors:
- Denom does not start with
badges:orbadgeslp:, or has fewer than three:segments. - Collection not found.
- No path matches the denom (
wrapper path not found). - The path has no side B balances or a zero side A amount (returns
0or an error).
Uses: pre-wrap validation in a UI, sizing batch wraps, verifying a path configuration.