When to use this
- Bootstrap liquidity for a token you issued.
- Execute an exact-input swap with a minimum-out guard.
- Withdraw your share of pool reserves after collecting fees.
Prerequisites
- Two assets to pair. Each is identified as either
MINT(the native currency) or a token id liketok:demo:points. - The pool may not yet exist — if so, you’ll create it in step 1.
Recipe
Create a pool (or skip if it exists)
fee_bps is the per-swap fee in basis points (30 = 0.30%). min_lp_shares is your slippage guard.pool_id you’ll use for all subsequent operations. Resolve it from the receipt’s event log or via sigil_listDexPools.Quote a swap (no transaction)
Before submitting, get a deterministic quote.Use the returned
amount_out to set min_amount_out with your slippage tolerance — typically 50 bps below the quote.Reading state
Common errors
| Symptom | Cause | Fix |
|---|---|---|
pool already exists | Pair already pooled | Use DexAddLiquidity instead |
slippage exceeded | Price moved past min_amount_out | Re-quote and resubmit |
expiration height passed | Tx waited too long in mempool | Resubmit with a later expiration_height or null |
insufficient lp_shares | Tried to remove more than you hold | Query sigil_getDexPosition first |
See also
- Primitive: native DEX
- Cookbook: Create a custom token — to pair against MINT.
- Transaction reference: DexCreatePool