feat(wallet): humanize shared wallet experience

Consolidate wallet account decoding and portfolio handling around the shared Rust IDL decoder. Simplify AMM wallet integration, remove obsolete caches and network plumbing, and cover account selection and live flows.
This commit is contained in:
Ricardo Guilherme Schmidt
2026-08-21 17:38:45 -03:00
parent 62d133e909
commit 8c3e6fccfe
64 changed files with 6268 additions and 27501 deletions
+38 -10
View File
@@ -11,10 +11,8 @@
};
# The AMM QML UI module (apps/amm) is built from this same flake so it can
# reference the amm_ffi crate package via `self` — no filesystem
# path or git-remote reference to this repo is needed (see apps/amm/flake.nix
# history: a `git+file://` URL pointing at a local checkout is
# machine-specific and not portable).
# reference the amm_ffi crate package via `self` — no filesystem path or
# git-remote reference to this repo is needed.
logos-module-builder.url = "github:logos-co/logos-module-builder";
# Core wallet module (the LEZ wallet FFI Qt plugin). The input name must
@@ -110,11 +108,36 @@
sourceDir = "modules/token/ffi";
header = "token_ffi.h";
};
walletDecoderArgs = {
inherit src;
strictDeps = true;
pname = "wallet-idl-decoder";
version = "0.1.0";
cargoExtraArgs = "-p wallet-idl-decoder";
doCheck = false;
};
walletDecoder = craneLib.buildPackage (
walletDecoderArgs
// {
cargoArtifacts = craneLib.buildDepsOnly walletDecoderArgs;
postInstall =
''
mkdir -p $out/include
cp tools/wallet-idl-decoder/include/wallet_idl_decoder.h $out/include/
''
+ pkgs.lib.optionalString pkgs.stdenv.isDarwin ''
if [ -f $out/lib/libwallet_idl_decoder.dylib ]; then
install_name_tool -id "$out/lib/libwallet_idl_decoder.dylib" $out/lib/libwallet_idl_decoder.dylib
fi
'';
}
);
in
{
packages.default = ammFfi;
packages.amm_ffi = ammFfi;
packages.token_ffi = tokenFfi;
packages.wallet_idl_decoder = walletDecoder;
}
);
@@ -135,15 +158,19 @@
flakeInputs = inputs // { amm_module = ammModuleOutputs; };
# The UI links no external lib of its own — the AMM brain (amm_ffi) is
# linked by amm_module, which the UI reaches via modules().amm_module.
externalLibInputs = { };
externalLibInputs = {
wallet_idl_decoder = {
input = self;
packages.default = "wallet_idl_decoder";
};
};
# The AMM UI links the shared C++ wallet access lib and bundles the
# Logos.Wallet QML module (apps/shared/wallet). apps/amm/flake.nix wires
# these via its `shared_wallet` input; when built from this root flake
# the source lives in-tree, so point CMake straight at it and stage the
# built QML module the same way. Keep in sync with apps/amm/flake.nix.
# Logos.Wallet QML module (apps/shared/wallet). Point CMake at the
# in-tree source and stage the built QML module with the app.
preConfigure = ''
cmakeFlagsArray+=("-DLOGOS_WALLET_SOURCE_DIR=${./apps/shared/wallet}")
cmakeFlagsArray+=("-DLOGOS_WALLET_GENERATED_DIR=$PWD/generated_code/include")
cmakeFlagsArray+=("-DLEZ_IDL_ARTIFACTS_DIR=${./artifacts}")
'';
postInstall = ''
walletQmlDescriptor="$(find "$PWD" -type f -path '*/shared-wallet/qml/Logos/Wallet/qmldir' -print -quit)"
@@ -318,10 +345,11 @@
pkgs = import nixpkgs { inherit system; overlays = [ rust-overlay.overlays.default ]; };
ammFfi = crateOutputs.packages.${system}.amm_ffi;
moduleDir = appPkgs.${system}.default;
walletDecoder = crateOutputs.packages.${system}.wallet_idl_decoder;
in
app // {
program = "${pkgs.writeShellScript "run-amm-ui" ''
export DYLD_FALLBACK_LIBRARY_PATH="${ammFfi}/lib''${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH}"
export DYLD_FALLBACK_LIBRARY_PATH="${ammFfi}/lib:${walletDecoder}/lib''${DYLD_FALLBACK_LIBRARY_PATH:+:$DYLD_FALLBACK_LIBRARY_PATH}"
export QML_IMPORT_PATH="${moduleDir}/lib''${QML_IMPORT_PATH:+:$QML_IMPORT_PATH}"
exec ${app.program} "$@"
''}";