# ResolveDenom

Resolves a tokenization wrapped (`badges:<collectionId>:<baseDenom>`) or alias (`badgeslp:<collectionId>:<baseDenom>`) Cosmos denom back to its source collection ID, matched token ID (for `{id}` placeholder wrapper paths), and full path definition.

## Example

```bash
curl "https://lcd.bitbadges.io/bitbadges/bitbadgeschain/tokenization/resolve_denom/badges%3A1%3Autoken"
curl "https://lcd.bitbadges.io/bitbadges/bitbadgeschain/tokenization/resolve_denom/badgeslp%3A1%3Amylp"
```

## Request

| Field | Type | Description |
| --- | --- | --- |
| `denom` | string | Full wrapped (`badges:<collectionId>:<baseDenom>`) or alias (`badgeslp:<collectionId>:<baseDenom>`) denom. |

## Response

```json
{
  "pathType": "wrapper",
  "collectionId": "1",
  "baseDenom": "nft-42",
  "matchedTokenId": "42",
  "wrapperPath": {
    "denom": "nft-{id}",
    "symbol": "NFT",
    "allowOverrideWithAnyValidToken": true,
    "conversion": {
      "sideA": { "amount": "1" },
      "sideB": [
        {
          "amount": "1",
          "tokenIds": [{ "start": "1", "end": "1" }],
          "ownershipTimes": [{ "start": "1", "end": "18446744073709551615" }]
        }
      ]
    }
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `pathType` | string | `"wrapper"` for `badges:` denoms, `"alias"` for `badgeslp:` denoms. |
| `collectionId` | string | Resolved collection ID. |
| `baseDenom` | string | Denom suffix after `<prefix><collectionId>:`. |
| `matchedTokenId` | string | Extracted canonical token ID when matched via a `{id}` placeholder wrapper path; empty for exact matches and aliases. |
| `wrapperPath` | `CosmosCoinWrapperPath` | Populated when `pathType` is `"wrapper"`. |
| `aliasPath` | `AliasPath` | Populated when `pathType` is `"alias"`. |

## Behavior

- Exact wrapper path matches take precedence over `{id}` placeholder matches.
- Placeholder `{id}` matches require `allowOverrideWithAnyValidToken: true`, a canonical positive integer token ID (no leading zeros), and membership in `collection.validTokenIds`.
- Fails with `InvalidArgument` if `denom` is empty, lacks the `badges:` or `badgeslp:` prefix, or is malformed; fails with `NotFound` if the collection or matching path does not exist.
- Also callable from Solidity via [`resolveDenom`](https://docs.bitbadges.io/chain/evm/tokenization-precompile/api#resolvedenom) on the tokenization precompile (`0x1001`).

## Related

- [GetCollection](https://docs.bitbadges.io/token-standard/queries/get-collection)
- [GetWrappableBalances](https://docs.bitbadges.io/token-standard/queries/get-wrappable-balances)
- [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)
