Turns the dummy-data AMM UI into a real client of the on-chain LEZ wallet.
Adds a hand-written ui_qml C++ backend (src/AmmUi*) over the core
logos_execution_zone module: create/open a local wallet, create and list
public/private accounts, and a navbar Connect / Connected + account-selector
+ Disconnect flow. Onboarding is password-only (no path picking) with a
per-app wallet at ~/.lee/amm-wallet (override: AMM_WALLET_HOME_DIR);
standalone gets its own wallet, Basecamp shares accounts via adopt-on-start.
Requires Nix with flakes; macOS also needs `sandbox = false` (the default).
The logos_execution_zone input is pinned to a module rev whose LEZ (lssa)
already includes the macOS Metal-build fix, so no `--override-input` is
needed — plain `nix run .` works:
cd apps/amm
nix run .
- create_new now returns the new wallet's BIP39 mnemonic (not an int status);
the app currently discards it, so the wallet can't yet be recovered. Surfacing
it in onboarding (+ restore_storage) is a follow-up.
- The wallet password is currently a no-op upstream (storage.rs: "TODO: use
password for storage encryption"); storage.json is plaintext. So Disconnect
is a UI-level lock and reconnect does not (cannot yet) re-prompt for it.
- wallet-ffi requires explicit config/storage paths; a *_default() FFI would
let the app drop its path handling.
- Bundled network config: connects to whatever WalletConfig::default() points
at; real testnet endpoints still TBD.
2.2 KiB
AMM UI
A QML UI application for the Automated Market Maker (AMM) program.
See the Logos QML UI App Tutorial for more information.
Wallet / chain integration
This app is a ui_qml module with a hand-written C++ backend
(src/AmmUiBackend.*, plugin in src/AmmUiPlugin.*) that depends on the core
logos_execution_zone wallet module. The backend calls the core module's
wallet FFI through m_logos->logos_execution_zone.* and exposes an async QtRO
surface (src/AmmUiBackend.rep) plus an account list model to the QML view.
Onboarding is non-invasive. The app opens straight to the Trade screen; the
navbar shows Connect (opens a password-only modal) or Connected + the
account selector. There is no path picking — the wallet uses LEZ's canonical
home, ~/.lee/wallet/ (override with LEE_WALLET_HOME_DIR, the same var LEZ
honors), and its config (wallet_config.json) self-initializes.
Account/keystore sharing follows the runtime:
- Standalone (
nix run .): own core-module instance, but the canonical~/.lee/walletkeystore is shared with the LEZ wallet UI and any other LEZ app on the machine. A previously-created wallet auto-opens on launch. - Inside Basecamp: the core wallet module is a single shared instance, so on
startup the backend adopts the already-open wallet (see
openOrAdoptWallet()), surfacing shared accounts across apps.
Follow-up: the wallet FFI requires explicit
config_path/storage_patheven though the wallet crate already defines defaults (~/.lee/wallet,from_path_or_initialize_default). Awallet_ffi_create_new_default()/_open_default()upstream would let the app drop its path handling entirely.
Setup
This project requires Nix with experimental features enabled. If you haven't already, enable them permanently:
mkdir -p ~/.config/nix && echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf
Running the UI
Start the UI with:
nix run .
This builds and runs the application in development mode.
Updating Dependencies
To update the pinned versions of dependencies in flake.lock:
nix flake update