# GetWrappableBalances

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

```bash
bb query tokenization wrappable-balances "badges:1:utoken" bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d
bb query tokenization wrappable-balances "badgeslp:1:utoken" bb1p0rrel3365scadq5k9pv0x0zp9j22js6dnw70d
```

```bash
curl "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

```json
{ "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:

1. 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`).
2. The minimum across all side B balances (every one is needed per conversion).
3. That minimum multiplied by `conversion.sideA.amount`.

Errors:

- Denom does not start with `badges:` or `badgeslp:`, 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 `0` or an error).

Uses: pre-wrap validation in a UI, sizing batch wraps, verifying a path configuration.

## Related

- [Cosmos Coin Wrapper Paths](https://docs.bitbadges.io/token-standard/ibc/cosmos-coin-wrapper-paths)
- [Alias Denoms](https://docs.bitbadges.io/token-standard/ibc/alias-denoms)
- [GetBalance](https://docs.bitbadges.io/token-standard/queries/get-balance)
- [Wrap to an IBC Denom](https://docs.bitbadges.io/guides/wrap-to-an-ibc-denom)
