LP Interactions
The flow model
1. submit addCompoundingLiquidityWithAction sendAndConfirmTransaction
2. wait receipt becomes ready
3. commit addCompoundingLiquidityEr sendAndConfirmErTransaction (throwaway payer)
4. settle receipt closes → read the outcomeconst exists = (info: { lamports: number } | null) => info !== null && info.lamports > 0
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))
const pollReady = async (pk: PublicKey, timeoutMs = 30_000) => {
const deadline = Date.now() + timeoutMs
while (Date.now() < deadline) {
if (exists(await flashClient.erConnection!.getAccountInfo(pk).catch(() => null))) return
await sleep(1_000)
}
throw new Error(`receipt ${pk.toBase58()} not ready`)
}
const pollClosed = async (pk: PublicKey, timeoutMs = 60_000) => {
const deadline = Date.now() + timeoutMs
let seen = false
while (Date.now() < deadline) {
const info = await flashClient.connection.getAccountInfo(pk).catch(() => null)
if (exists(info)) seen = true
else if (seen) return // existed, now gone → settled
await sleep(3_000)
}
throw new Error(`receipt ${pk.toBase58()} never closed`)
}Mint FLP (auto-compounding)
Mint sFLP (staked)
Activating a stake
Burn FLP
Burn sFLP
Collect sFLP staking rewards
Migrate between FLP and sFLP
Reading the outcome / resuming
Quotes (views)
Last updated
Was this helpful?

