Bitflow's v2 API is a separate generation, not a path change: bin ids are
signed, market-maker inventory moved to a tip-checked endpoint, and the
pool's contract principal moved fields. bitflow.ts now normalizes a whole
generation onto the v1 shape so nothing downstream knows which is live,
selected by BFF_API_VERSION (v2 default, v1 kept as a fallback).
The reason to default to v2 is inventory correctness. v1 returns 404 --
not an empty list -- for a wallet that has never deployed to the pool,
which is every wallet's first tick, so a fresh signer tripped the
api-error breaker before it could deploy. v2 returns a clean empty book.
v2 also reports whether the snapshot is tip-accurate; a snapshot that
isn't clean+complete now throws rather than reading as "no position",
which would have redeployed on top of live liquidity.
Verified against mainnet: both pools produce identical active bin,
reserves, inventory value and plan on v1 and v2, and v2's share counts
match v1 exactly (the 139 extra bins v1 returns all hold zero shares).
Also guard against an all-zero fee table. v2 briefly served that for
dlmm_1; sizing an add off it builds a max-fee post-condition of 0, which
the contract aborts against after the gas is spent.
Co-authored-by: Cursor <cursoragent@cursor.com>