mintAmount method
Mint by spending up to a premium budget (see MintAmountOptions).
Implementation
Future<Transaction> mintAmount(
String owner, MarketDescriptor m, MintAmountOptions opts) async {
final feeds = _c._feeds(m.underlying);
// The chain requires a positive all-in cost cap (EMintCostCapRequired);
// reject a zero cap pre-flight rather than surface a cryptic Move abort.
final maxCost = opts.maxCost;
if (maxCost != null && maxCost <= 0) {
throw PredictInputError('maxCost must be > 0');
}
final resolved = await _c._resolveMarket(
underlying: m.underlying, expiryMs: m.expiryMs, marketId: m.marketId);
// No lot check: min_quantity is a floor the chain compares against an
// already-lot-floored minted quantity, so any floor value is legal.
final minQuantityRaw = usdcToRaw(opts.minQuantity);
final ticks = await _c._strikeTicks(m, resolved.id, resolved.state);
return _txOf(trade.mintExactAmount(
_c._config,
expiryMarketId: resolved.id,
wrapperId: _c.wrapperIdFor(owner),
lowerTick: ticks.lowerTick,
higherTick: ticks.higherTick,
maxPremiumRaw: usdcToRaw(opts.spend),
minQuantityRaw: minQuantityRaw,
maxCostRaw: maxCost != null ? usdcToRaw(maxCost) : null,
feeds: feeds,
));
}