Skip to main content

getMaxMintAmount

Description:

Maximum number of shares for minting

Arguments:

NameTypeRequiredDescription
userAddressstringYesThe user address
vaultAddressstringYesThe address of the vault
additionalStakedAssetsbigintNoExtra staked assets to fold into the position before computing the max — e.g. a deposit being staked in the same transaction. See sdk.vault.depositAndMint, whose receiveShares you size with this

Returns:

type Output = bigint

Example:

await sdk.osToken.getMaxMintAmount({
userAddress: '0x...',
vaultAddress: '0x...',
})

When staking and minting in the same transaction, pass the not-yet-confirmed deposit as additionalStakedAssets so the max accounts for it — this is how you size receiveShares for sdk.vault.depositAndMint:

await sdk.osToken.getMaxMintAmount({
userAddress: '0x...',
vaultAddress: '0x...',
additionalStakedAssets: parseEther('1'), // assets being staked in the same batch
})