mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 06:01:11 +00:00
After the amm_module refactor, this crate is linked only by the module (the
UI delegates to modules().amm_module and links nothing), so its home under
apps/amm/ and the name "client" were both misnomers: it's the AMM business
logic the module wraps, reached across an FFI boundary — the same relationship
logos_execution_zone has with wallet_ffi. Co-locate it with the module that
owns it and name it for that role.
The FFI surface is unchanged — the exported functions are already amm_* (not
amm_client_*) — so only the crate, directory, generated header, dylib, and
package names move. The module's call sites are untouched; it just includes the
renamed header.
- apps/amm/client → modules/amm/ffi (git-tracked rename; history preserved)
- crate amm_client → amm_ffi: package name, include/amm_ffi.h, libamm_ffi.dylib,
AMM_FFI_H guard, build.rs output path, tests/public_api.rs import
- workspace member path + Cargo.lock
- flake.nix: pname, -p, header-copy path, dylib install_name, packages.amm_ffi,
ammModuleOutputs externalLibInputs, DYLD wrapper
- modules/amm: metadata external_libraries, CMakeLists EXTERNAL_LIBS, impl
#include + comments, README, flake note
- apps/amm/flake.nix: drop the now-dead amm_client external-lib input (the UI
links no external lib of its own)
Resulting layout:
modules/amm/
src/ # C++ module (amm_module_impl.{h,cpp})
ffi/ # Rust crate amm_ffi (Cargo.toml, src/, include/amm_ffi.h)
30 lines
1.3 KiB
Nix
30 lines
1.3 KiB
Nix
{
|
|
description = "Logos AMM core module — headless AMM business logic (pool resolution + swaps)";
|
|
|
|
inputs = {
|
|
logos-module-builder.url = "github:logos-co/logos-module-builder";
|
|
|
|
# Core wallet module dependency. The input name must match the
|
|
# metadata.json `dependencies` entry so the builder resolves it as a module
|
|
# dependency. Same fork the repo-root flake pins (the QtRO byte-string
|
|
# `instruction` fix for send_generic_public_transaction).
|
|
logos_execution_zone.url = "github:gravityblast/logos-execution-zone-module?ref=fix/generic-tx-instruction-bstr";
|
|
};
|
|
|
|
# NOTE: like apps/amm, this flake is NOT built standalone. The amm_ffi
|
|
# crate this module links (the Rust JSON-FFI brain) lives in the repo-root
|
|
# flake, and referencing it from here would require a hardcoded `git+file://`
|
|
# path or a `path:../..` input — the latter fails flake evaluation because this
|
|
# dir is copied into the Nix store as its own flake root, so `../..` can't
|
|
# escape it. Instead, the repo-root flake.nix builds this module directly
|
|
# (src = ./modules/amm) and resolves amm_ffi via `self`. Build it from
|
|
# the repo root:
|
|
# nix build .#amm-module
|
|
outputs = inputs@{ logos-module-builder, ... }:
|
|
logos-module-builder.lib.mkLogosModule {
|
|
src = ./.;
|
|
configFile = ./metadata.json;
|
|
flakeInputs = inputs;
|
|
};
|
|
}
|