Recycle
Find idle liquidity for an owner and plan a one-transaction recycle into recycling pairs around the market price.
Idle liquidity is liquidity that isn't earning. A recycle moves it back into recycling pairs around today's price, so it stays in Mesh. The server never signs: it plans, your wallet signs one transaction.
| Kind | What it is | Detected when |
|---|---|---|
wallet |
Proceeds your wallet-mode pools paid out, still in your wallet | The smaller of proceeds paid and what the wallet holds, per asset, worth more than the dust level |
stale |
A pool that doesn't fill | Active, no fill for IDLE_STALE_SEC (3 days), and priced IDLE_OFF_MID_BPS (3%) from the mid on the side that can't fill: a bid too far below, an ask too far above |
one-sided |
A recycling pair or grid stuck on one side | The whole range is past the mid, and the pools hold only the asset they can't sell back |
dust |
Almost empty pools | Reserve at or below IDLE_DUST_SATS (3,000 sats), or 2 token units |
GET /api/v1/recycle/idle
Idle items for an owner, with reasons and value. wallet=false skips the wallet lookup.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
owner |
query | string | yes | 20-byte hex pkh or a P2PKH cashaddr. |
wallet |
query | string | no | false to skip wallet proceeds. |
POST /api/v1/recycle/plan
Close the chosen idle pools and reopen what they held (plus chosen wallet proceeds) as recycling pairs at mid ∓ spread. Same shape as a rebalance: close, open, needs.
Freed liquidity is grouped by the token it trades against.
- The BCH a bid pool held reopens as a recycling pair that starts in BCH.
- A token reserve reopens as one that starts in the token.
- Assets with no market price, or below a pool's minimum, go back to your wallet. The plan lists them in
notesandtoWallet.
To execute it:
- In one transaction, dock every
closeUTXO with your signature and fund everyopenpool. Your wallet adds the fee, any wallet proceeds, and the carrier sats of new token pools. - Register each
openentry:POST /api/v1/strategies { template, ownerPkh, params, txid, part, recycledFrom }. Withpart, several strategies from one transaction get distinct ids:stg-<txid prefix>-<part>.
The app's Recycle button does all of this, and rebuilds and checks every pool locally before you sign.