lez-programs/apps/amm/flake.nix

82 lines
2.8 KiB
Nix
Raw Normal View History

{
feat(amm): wire the AMM app to the LEZ wallet module 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.
2026-06-24 14:50:17 +02:00
description = "Logos AMM QML UI trade and provide liquidity on the LEZ AMM";
inputs = {
logos-module-builder.url = "github:logos-co/logos-module-builder";
nixpkgs.follows = "logos-module-builder/nixpkgs";
logos-standalone-app.follows = "logos-module-builder/logos-standalone-app";
feat(amm): wire the AMM app to the LEZ wallet module 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.
2026-06-24 14:50:17 +02:00
# Core wallet module (the LEZ wallet FFI Qt plugin). The input name must
# match the metadata.json `dependencies` entry so the builder can resolve
# it as a module dependency. This rev pins LEZ (lssa) at d2e9400, which
feat(amm): wire the AMM app to the LEZ wallet module 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.
2026-06-24 14:50:17 +02:00
# includes the macOS Metal-build fix, so no `--override-input` is needed.
logos_execution_zone.url = "github:logos-blockchain/logos-execution-zone-module?rev=d2e9400ac06c3cdbfc2405b4f153fff9841a453c";
};
outputs = inputs@{ logos-module-builder, logos-standalone-app, nixpkgs, ... }:
let
systems = [ "aarch64-darwin" "x86_64-darwin" "aarch64-linux" "x86_64-linux" ];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f (import nixpkgs { inherit system; }));
fixedStandalonePackages = forAllSystems (pkgs:
let
base = logos-standalone-app.packages.${pkgs.system};
qtLibPath = pkgs.lib.makeLibraryPath ([
pkgs.qt6.qtbase
pkgs.qt6.qtremoteobjects
pkgs.qt6.qtdeclarative
pkgs.qt6.qtwebview
pkgs.zstd
pkgs.krb5
pkgs.zlib
pkgs.glib
pkgs.stdenv.cc.cc
pkgs.freetype
pkgs.fontconfig
pkgs.boost
pkgs.openssl
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.libglvnd
pkgs.mesa
pkgs.xorg.libX11
pkgs.xorg.libXext
pkgs.xorg.libXrender
pkgs.xorg.libXrandr
pkgs.xorg.libXcursor
pkgs.xorg.libXi
pkgs.xorg.libXfixes
pkgs.xorg.libxcb
]);
fixedApp = base.default.overrideAttrs (old: {
inherit qtLibPath;
qtWrapperArgs = (old.qtWrapperArgs or [ ]) ++ [
"--prefix" "LD_LIBRARY_PATH" ":" qtLibPath
"--prefix" "QT_PLUGIN_PATH" ":" old.qtPluginPath
"--prefix" "QML_IMPORT_PATH" ":" old.qmlImportPath
"--prefix" "QML2_IMPORT_PATH" ":" old.qmlImportPath
];
});
in base // {
app = fixedApp;
default = fixedApp;
});
fixedStandalone = logos-standalone-app // {
packages = fixedStandalonePackages;
};
in
logos-module-builder.lib.mkLogosQmlModule {
src = ./.;
configFile = ./metadata.json;
flakeInputs = inputs;
logosStandalone = fixedStandalone;
preConfigure = ''
export AMM_UI_PROGRAM_DIR=${inputs.logos_execution_zone.inputs."logos-execution-zone"}/artifacts/program_methods
'';
postInstall = ''
mkdir -p "$out/lib/config"
cp -r ${./config}/. "$out/lib/config/"
'';
};
}