Function: getMaxWrappableAmount()
Calculates the maximum wrappable/fungible amount for an alias or Cosmos coin wrapper path.
getMaxWrappableAmount<
T>(path,userBalances):bigint
Defined in: packages/bitbadgesjs-sdk/src/core/balances.ts:732
Calculates the maximum wrappable/fungible amount for an alias or Cosmos coin wrapper path.
This function determines how many wrapped tokens can be created based on the user's balances and the conversion path requirements.
Logic:
- Gets the path's conversion.sideB (balances required per conversion)
- For each sideB balance, finds matching user balances via getBalancesForIds
- Calculates minimum conversions possible across all sideB requirements
- Multiplies by conversion.sideA.amount (wrapped tokens created per conversion)
Type Parameters
T
T extends NumberType
Parameters
path
The alias path or cosmos coin wrapper path with conversion details
conversion
{ sideA: { amount: T; }; sideB: object[]; }
conversion.sideA
{ amount: T; }
conversion.sideA.amount
T
conversion.sideB
object[]
userBalances
iBalance<T>[]
The user's current balances to check against
Returns
bigint
The maximum amount of wrapped tokens that can be created