94 lines
2.7 KiB
QML
Raw Normal View History

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
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
import Logos.Theme
import "pages"
Item {
id: root
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
// Backend replica + account model, bridged from the C++ backend.
readonly property var backend: logos.module("amm_ui")
readonly property var accountModel: logos.model("amm_ui", "accountModel")
property bool ready: false
Connections {
target: logos
function onViewModuleReadyChanged(moduleName, isReady) {
if (moduleName === "amm_ui")
root.ready = isReady && root.backend !== null
}
}
Component.onCompleted: {
root.ready = root.backend !== null && logos.isViewModuleReady("amm_ui")
}
// Connectivity banner: shown when a wallet is open but its configured
// sequencer doesn't answer reachability probes (so transactions will fail).
Rectangle {
id: connectionBanner
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
z: 101
readonly property bool show: root.ready
&& root.backend
&& root.backend.isWalletOpen
&& root.backend.sequencerAddr.length > 0
&& !root.backend.sequencerReachable
height: show ? 32 : 0
visible: height > 0
clip: true
color: Theme.palette.warning
Behavior on height { NumberAnimation { duration: 150; easing.type: Easing.OutCubic } }
Text {
anchors.centerIn: parent
width: parent.width - 40
horizontalAlignment: Text.AlignHCenter
elide: Text.ElideMiddle
font.pixelSize: 12
font.weight: Font.Medium
color: Theme.palette.background
text: qsTr("Unable to connect to network")
}
}
// The app is always usable; the wallet is opt-in via the navbar "Connect"
// control. Trade/Liquidity render immediately on launch.
NavBar {
id: navbar
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
anchors.top: connectionBanner.bottom
anchors.left: parent.left
anchors.right: parent.right
z: 100
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
backend: root.ready ? root.backend : null
accountModel: root.accountModel
}
Item {
anchors.top: navbar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
SwapPage {
anchors.fill: parent
visible: navbar.currentIndex === 0
}
LiquidityPage {
anchors.fill: parent
visible: navbar.currentIndex === 1
}
}
}