Files
lez-programs/apps/amm/.gitignore
r4bbit 7a7ebfdbaf feat(amm): source liquidity tokens app-side + add custom tokens by id
Move the liquidity token selector off the module's stateful newPositionContext
onto a lean, app-owned surface, and let users add unlisted tokens by id.

FFI: new stateless `resolve_tokens` op — the app passes an explicit id set and
gets uniform selector rows `{ definitionId (base58), name, totalSupply, holdingId,
balance }`, held tokens first, unresolvable/non-fungible ids omitted. Reuses the
per-token definition/holding logic from `context`, without the network/status
envelope. Unit-tested.

Module: `resolveTokens(request, wallet_open)` reads the definitions + wallet and
calls the op (ids wrapped in a map — the universal-module glue only marshals
map/scalar inputs, not bare lists).

Backend: the app owns the id set — configured tokens (TOKENS_CONFIG) plus the
user's persisted custom ids. Held-but-unlisted tokens are NOT auto-listed (the
list mirrors the swap side); a token you hold still shows its balance once listed.
`addCustomToken` validates a pasted id by resolving its on-chain definition, then
persists it to CUSTOM_TOKEN_CONFIG (defaulting to the per-user app-data store, with
a HOME fallback so persistence never silently no-ops on an empty path).

QML: NewPositionForm/LiquidityPage take tokens/walletReady/loadingTokens as inputs
and drive selection + custom-token resolution through the backend; dropped all
newPositionContext reads and the selectable/status/code row fields.

Tests: custom-token.mjs creates token D on-chain (left out of the token config)
and verifies pasting its id resolves, selects, and persists it across a reload.
The setup script mints token D and initializes/prints the isolated
CUSTOM_TOKEN_CONFIG store
2026-08-13 15:33:31 +02:00

27 lines
821 B
Plaintext

result
result-*
modules/
# Personal token/account config — copy amm-tokens.json.example and fill in
# your own definitionId/holding accounts. Never commit your real accounts.
amm-tokens.json
# Personal known-pools config (AMM_POOLS_CONFIG). Same rationale as above.
amm-pools.json
# Screenshot artifacts written by tests/swap.mjs
tests/*.png
# Isolated wallet home used by tests/testnet/setup-amm-testnet.sh
tests/testnet/.wallet/
# Isolated token config written by tests/testnet/setup-amm-testnet.sh
tests/testnet/amm-tokens.json
# Isolated known-pools config written by tests/testnet/setup-amm-testnet.sh
tests/testnet/amm-pools.json
# Isolated custom-token store (CUSTOM_TOKEN_CONFIG) — initialized by the setup script
# and written by the app during tests/custom-token.mjs
tests/testnet/custom-tokens.json