mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-08-25 14:11:09 +00:00
The AMM host FFI was split across two crates with two ABI styles: the typed-C `amm_client_ffi` (swap primitives, under programs/) and the JSON/wire `amm_client` (new-position flow, under apps/). Fold both into a single `amm_client` crate exposing one JSON C ABI, and delete `programs/amm/client-ffi`. Rust: - Re-express the swap path as `api/swap.rs` operations on the existing `call::<T>` dispatch — swap_pair, resolve_pool, swap_plan, program_id — reusing `pair::derive_pair` (no more duplicated PDA derivation) and `risc0_zkvm::serde` for the SwapExactInput words (the same encoding the guest decodes). The account list and signer flags stay byte-identical to the old typed path. - Generate a single header (`include/amm_client.h`) covering all ops via cbindgen; bump cbindgen 0.27 -> 0.28 for `#[unsafe(no_mangle)]` support. C++: - Extend the `AmmClient` wrapper with the four swap ops. - Add `SwapRuntime` (mirrors `NewPositionRuntime`): reads accounts through the wallet, drives the swap ops, submits the transaction. - `AmmUiBackend` swap methods now delegate to `SwapRuntime`, dropping ~390 lines of typed-FFI and byte-twiddling. `program_id` becomes a JSON op, and the swap clock is derived via `derive_pair` (clock_core::CLOCK_01) instead of a hardcoded base58 literal — same account, verified.
28 lines
626 B
JSON
28 lines
626 B
JSON
{
|
|
"name": "amm_ui",
|
|
"version": "0.1.0",
|
|
"type": "ui_qml",
|
|
"category": "amm",
|
|
"description": "UI module for the AMM program",
|
|
"main": "amm_ui_plugin",
|
|
"view": "qml/Main.qml",
|
|
"icon": "icons/amm.png",
|
|
"dependencies": ["logos_execution_zone"],
|
|
|
|
"nix": {
|
|
"packages": {
|
|
"build": ["pkg-config"],
|
|
"runtime": ["qt6.qtdeclarative", "zstd", "krb5", "abseil-cpp", "libbase58"]
|
|
},
|
|
"external_libraries": [
|
|
{ "name": "amm_client" }
|
|
],
|
|
"cmake": {
|
|
"find_packages": [],
|
|
"extra_sources": [],
|
|
"extra_include_dirs": ["lib"],
|
|
"extra_link_libraries": []
|
|
}
|
|
}
|
|
}
|