...init homa sdk
const keyring = new Keyring({ type: 'sr25519' })
const account = keyring.addFromMnemonic('XXX') // your account mnemonic
const stakingToken = await wallet.getToken('KSM')
const amount = new FixedPointNumber(10, stakingToken.decimals);
const mint = await homa.getEstimateMintResult(amount)
// check pay amount
console.log(mint.pay.toString())
// check receive amount
console.log(mint.receive.toString())
const call = homa.createMintCall(mint.pay)
// send transaction to mint LDOT/LKSM
await call.signAndSend(account)
Fast Redeem
When user stakes, the staking token will be stored in a mint pool before being sent to Relay Chain for staking via XCM. You can call fast redeem to exchange L-Token for staking token from this pool.
Some reference web application would employ the following flow to achieve instant redemption
check there's enough staking token in the pool using mint.canTryFastReddem
if there's, then swap L-Token to staking token from the mint pool
otherwise, swap L-Token to staking token via the Acalaswap DeX
Redeem and wait unbounding period + 1 Era to receive staked tokens. Unbounding period is defined by the staking asset protocol e.g. 28 days unbounding period for DOT and 7 days for KSM.