mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-07-03 05:29:50 +00:00
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.
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
#ifndef AMM_UI_PLUGIN_H
|
|
#define AMM_UI_PLUGIN_H
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QtPlugin> // for Q_PLUGIN_METADATA, Q_INTERFACES
|
|
#include "AmmUiPluginInterface.h"
|
|
#include "LogosViewPluginBase.h"
|
|
|
|
class LogosAPI;
|
|
class AmmUiBackend;
|
|
|
|
// Thin plugin entry point. Holds an AmmUiBackend and lets the generated
|
|
// view-plugin base expose it to ui-host.
|
|
class AmmUiPlugin : public QObject,
|
|
public AmmUiPluginInterface,
|
|
public AmmUiBackendViewPluginBase
|
|
{
|
|
Q_OBJECT
|
|
Q_PLUGIN_METADATA(IID AmmUiPluginInterface_iid FILE "../metadata.json")
|
|
Q_INTERFACES(AmmUiPluginInterface)
|
|
|
|
public:
|
|
explicit AmmUiPlugin(QObject* parent = nullptr);
|
|
~AmmUiPlugin() override;
|
|
|
|
QString name() const override { return "amm_ui"; }
|
|
QString version() const override { return "0.1.0"; }
|
|
|
|
// Called by ui-host after plugin load. Creates the backend and wires it
|
|
// up with the provided LogosAPI.
|
|
Q_INVOKABLE void initLogos(LogosAPI* api);
|
|
|
|
private:
|
|
AmmUiBackend* m_backend = nullptr;
|
|
};
|
|
|
|
#endif // AMM_UI_PLUGIN_H
|