Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
ea4fcc2
feat(wallet): add reusable wallet modules
3esmit Jul 15, 2026
ae52613
refactor(amm-ui): use shared wallet modules
3esmit Jul 15, 2026
049ccdf
refactor(wallet): centralize UI wallet coordination
3esmit Jul 15, 2026
d47cc70
fix(apps/amm): use patched LEZ version that nukes xcrun cache
0x-r4bbit Jul 16, 2026
c0947e1
fix(apps/wallet): use @loader_path rpath for the QML plugin on macOS
0x-r4bbit Jul 16, 2026
327618c
fix(apps/amm): ensure changing endpoint works
0x-r4bbit Jun 26, 2026
bfeff4f
WIP
0x-r4bbit Jun 26, 2026
8db90fd
feat(amm-ui): add new position prototype #221
3esmit Jul 10, 2026
de1c239
feat(amm-ui): add new position backend API #222
3esmit Jul 10, 2026
cede727
feat(amm-ui): wire new position QML flow #223
3esmit Jul 10, 2026
6c682db
test(amm-ui): validate new position flow #224
3esmit Jul 10, 2026
8dd1189
feat(amm-ui): implement new position flow #216
3esmit Jul 12, 2026
53a3d03
feat(amm-ui): refactor quote computation and introduce new position p…
3esmit Jul 12, 2026
6de8a5f
feat(amm-ui): complete new position liquidity flow
3esmit Jul 14, 2026
4a9ea63
refactor(amm): split client protocol into reusable API
3esmit Jul 14, 2026
7c98ca7
feat(amm-ui): reshape liquidity position layout
3esmit Jul 14, 2026
0c4c916
refactor(amm-ui): defer token decimal inference
3esmit Jul 14, 2026
0605477
fix(amm-ui): require explicit liquidity inputs
3esmit Jul 16, 2026
1692581
fix(amm): make flake portable across macOS and Linux
3esmit Jul 17, 2026
90ba65f
feat(wallet): implement asynchronous connection and snapshot handling
3esmit Jul 17, 2026
0e01962
feat: Introduce SequencerClient for enhanced account management and t…
3esmit Jul 17, 2026
57c3712
fix(amm): align wallet RPC with public testnet
3esmit Jul 17, 2026
df5152c
fix(amm): back off network identity probes
3esmit Jul 17, 2026
14dff68
fix(amm): refresh wallet holdings on context reload
3esmit Jul 17, 2026
ba23429
fix(amm): evict stale accounts before forced reads
3esmit Jul 17, 2026
1d1db9b
fix(amm): reload changed sequencer configuration
3esmit Jul 17, 2026
a66ffdd
fix(amm): complete repeated context refreshes
3esmit Jul 17, 2026
72bde7a
fix(amm): avoid duplicate wallet context refreshes
3esmit Jul 17, 2026
3508bfb
fix(amm): deduplicate transaction status polls
3esmit Jul 17, 2026
0ef3c21
fix(wallet): release completed snapshot state
3esmit Jul 17, 2026
3721d88
fix(wallet): guard deferred controller callbacks
3esmit Jul 17, 2026
5c2e4fe
fix(wallet): ignore stale reachability results
3esmit Jul 17, 2026
969a98a
fix(wallet): coalesce reachability probes
3esmit Jul 17, 2026
7a09449
fix(wallet): stop reachability checks while closed
3esmit Jul 17, 2026
7d1bef9
fix(wallet): avoid saving read-only snapshots
3esmit Jul 17, 2026
1f70ed5
fix(amm): reject failed identity responses
3esmit Jul 17, 2026
d36afdf
fix(amm): force fresh post-transaction reads
3esmit Jul 17, 2026
f8c0fa6
fix(amm): cancel cached reads on endpoint change
3esmit Jul 17, 2026
9c4ade7
fix(wallet): surface background sync failures
3esmit Jul 17, 2026
c5e4231
fix(wallet): report partial creation failures
3esmit Jul 17, 2026
02a65aa
fix(amm): cancel submits after wallet changes
3esmit Jul 17, 2026
cfaaba3
fix(amm): submit wallet mutations asynchronously
3esmit Jul 17, 2026
8023195
fix(amm): align reads with adopted wallet endpoint
3esmit Jul 17, 2026
a947318
fix(amm): label sample swaps as previews
3esmit Jul 17, 2026
0e6a387
fix(amm): apply slippage to exact-output input
3esmit Jul 17, 2026
69c9783
fix(amm): prevent swaps with identical tokens
3esmit Jul 17, 2026
07325cc
fix(wallet): sync new wallets in background
3esmit Jul 17, 2026
d9852f2
fix(amm): end submits when backend disconnects
3esmit Jul 17, 2026
7b595dc
fix(amm): keep trade controls reachable
3esmit Jul 17, 2026
a8de6b4
fix(amm): reserve balance for exact-output slippage
3esmit Jul 17, 2026
a3bbcda
fix(amm): reject exact output at pool reserve
3esmit Jul 17, 2026
f704ab6
fix(amm): contain compact navbar controls
3esmit Jul 17, 2026
d51856a
fix(amm): reuse pending LP accounts
3esmit Jul 18, 2026
43cdc0d
fix(amm): pause hidden pool probes
3esmit Jul 18, 2026
9b25a72
fix(amm): read selected holdings once
3esmit Jul 18, 2026
942920b
fix(amm): stop superseded context work
3esmit Jul 18, 2026
ec18833
fix(amm): cancel superseded quote work
3esmit Jul 18, 2026
0fdc130
fix(amm): reduce pending pool probes
3esmit Jul 18, 2026
31f1b68
fix(amm): make theme toggle clickable
3esmit Jul 18, 2026
774e340
fix(amm): avoid confirmation busy binding loop
3esmit Jul 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"apps/amm/client",
"programs/token/core",
"programs/token",
"programs/token/methods",
Expand Down
66 changes: 63 additions & 3 deletions apps/amm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
cmake_minimum_required(VERSION 3.14)
cmake_minimum_required(VERSION 3.21)
project(AmmUiPlugin LANGUAGES CXX)

find_package(Qt6 6.8 REQUIRED COMPONENTS Core Gui Network Qml Quick QuickControls2)
qt_standard_project_setup(REQUIRES 6.8)

find_package(PkgConfig REQUIRED)
pkg_check_modules(BASE58 REQUIRED IMPORTED_TARGET libbase58)

include(CTest)

if(DEFINED ENV{LOGOS_MODULE_BUILDER_ROOT})
include($ENV{LOGOS_MODULE_BUILDER_ROOT}/cmake/LogosModule.cmake)
else()
message(FATAL_ERROR "LogosModule.cmake not found. Set LOGOS_MODULE_BUILDER_ROOT.")
endif()

set(LOGOS_WALLET_SOURCE_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/../shared/wallet"
CACHE PATH "Path to the shared Logos wallet module"
)
set(LOGOS_WALLET_GENERATED_DIR
"${CMAKE_CURRENT_SOURCE_DIR}/generated_code"
CACHE PATH "Path to generated Logos SDK sources"
)
add_subdirectory("${LOGOS_WALLET_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/shared-wallet")

# ui_qml module with a hand-written C++ backend (QtRO .rep view contract +
# generated *SimpleSource/*ViewPluginBase). Mirrors the LEZ wallet UI module.
logos_module(
Expand All @@ -18,12 +36,54 @@ logos_module(
src/AmmUiPlugin.cpp
src/AmmUiBackend.h
src/AmmUiBackend.cpp
src/AccountModel.h
src/AccountModel.cpp
src/ActiveNetwork.h
src/ActiveNetwork.cpp
src/AmmClient.h
src/AmmClient.cpp
src/NewPositionRuntime.h
src/NewPositionRuntime.cpp
src/SequencerClient.h
src/SequencerClient.cpp
FIND_PACKAGES
Qt6Gui
Qt6Network
LINK_LIBRARIES
Qt6::Gui
Qt6::Network
PkgConfig::BASE58
LINK_TARGETS
logos_wallet_access
EXTERNAL_LIBS
amm_client
)

qt_add_resources(amm_ui_module_plugin amm_ui_config
PREFIX "/amm"
FILES
config/networks.json
)

if(BUILD_TESTING)
add_executable(amm_active_network_test
tests/cpp/ActiveNetworkTest.cpp
src/ActiveNetwork.cpp
)
target_include_directories(amm_active_network_test PRIVATE src)
target_link_libraries(amm_active_network_test PRIVATE Qt6::Core)
add_test(NAME amm_active_network COMMAND amm_active_network_test)

add_executable(amm_new_position_runtime_test
tests/cpp/NewPositionRuntimeTest.cpp
src/NewPositionRuntime.cpp
src/SequencerClient.cpp
src/SequencerClient.h
)
target_include_directories(amm_new_position_runtime_test PRIVATE src)
target_link_libraries(amm_new_position_runtime_test PRIVATE
Qt6::Core
Qt6::Network
PkgConfig::BASE58
logos_wallet_access
)
add_test(NAME amm_new_position_runtime COMMAND amm_new_position_runtime_test)
endif()
173 changes: 173 additions & 0 deletions apps/amm/MACOS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
# AMM UI on macOS

The AMM flake exposes native packages for Apple Silicon and Intel macOS. Nix
provides the Rust, C++, Qt, and Apple SDK build dependencies. The only required
host toolchain is Apple's Metal compiler, which Apple distributes through
Xcode rather than through a redistributable package.

The standalone build needs no input overrides, temporary source pins, or
`DYLD_LIBRARY_PATH`.

## One-time prerequisites

### Nix

Install Nix in multi-user mode, make sure its daemon is available, and enable
flakes:

```sh
mkdir -p ~/.config/nix
printf '%s\n' 'experimental-features = nix-command flakes' >> ~/.config/nix/nix.conf
nix --version
nix store info
```

Nix normally has `sandbox = false` on macOS. This build must retain that
setting because RISC Zero invokes Apple's host-installed Metal toolchain. The
preflight script below reports an actionable error if the daemon is configured
otherwise.

### Xcode and the Metal Toolchain

Apple Command Line Tools alone do not include `metal` and `metallib`. Install
the newest full Xcode release supported by the installed macOS from the App
Store or [Apple Developer Downloads](https://developer.apple.com/download/all/).
This requires an Apple account and cannot be automated by the repository.

After installation:

```sh
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
sudo xcodebuild -runFirstLaunch
xcodebuild -downloadComponent MetalToolchain
xcrun --sdk macosx --find metal
xcrun --sdk macosx --find metallib
```

The last two commands must print executable paths. Do not use
`RISC0_SKIP_BUILD_KERNELS=1`: the pinned dependency graph requires the real
Metal kernels.

### Disk space and preflight

Leave at least 60 GiB free before downloading Xcode. Once Xcode is installed,
keep at least 40 GiB free for the first Nix build. Later builds reuse the Nix
store.

Run the complete machine check from `apps/amm`:

```sh
bash scripts/check-macos-prerequisites.sh
```

## Build and run

From `apps/amm`:

```sh
nix build .
nix run .
```

The first cold build is large because it includes Qt, the wallet, the AMM
client, and the RISC Zero Metal kernels. The first start opens without a
wallet; select **Connect** to create or open `~/.lee/wallet/`.

## Why the flake is structured this way

Nix 2.25 rejects committed lock entries for unlocked relative flake inputs such
as `path:../shared/wallet` and `path:../..`. Newer Nix versions may accept that
layout, which is why it can appear to work on one developer's Mac and fail on
another.

The portable layout avoids both relative flake inputs:

- the shared wallet is passed to CMake as an ordinary Nix source path;
- the repository-root AMM client package is imported directly with the same
locked `nixpkgs` and Crane inputs;
- `flake.lock` contains only immutable upstream sources.

The app output uses the builder's full-library QML package layout. The current
`qt-plugin` layout copies the UI plugin and replica factory but omits sibling
external libraries such as `libamm_client`. The module metadata still selects
the C++ backend, so this packaging choice does not change process isolation or
runtime behavior.

Do not replace these with a pull-request URL, self-reference, or local
`path:` flake input. A normal `nix flake lock`, `nix build`, and `nix run`
must work without overrides.

## Known-good validation host

This configuration has been exercised on:

- Apple Silicon (`arm64`)
- macOS 26.5.2
- Xcode 26.6 (build 17F113)
- Metal Toolchain 32023.883
- Nix 2.25.3

The flake also evaluates its complete package and app outputs for
`x86_64-darwin`; an Intel Mac is still required for native runtime validation.

## Recovery

### Nix is unavailable

Open a new terminal after installing Nix. For the standard multi-user
installation, check the store and daemon before trying to bootstrap it again:

```sh
test -x /nix/var/nix/profiles/default/bin/nix
nix store info
sudo launchctl print system/org.nixos.nix-daemon
```

`launchctl bootstrap` can report an I/O error when a service is already loaded
or in an inconsistent state; that message alone does not prove the daemon is
stopped.

### `xcrun` cannot find `metal`

The selected developer directory points at Command Line Tools, or Xcode lacks
the separately downloaded Metal Toolchain component. Repeat the Xcode setup
and verification commands above.

Apple does not distribute the Metal compiler as a standalone redistributable
SDK, so Nix cannot install this host component.

### The build reports that the macOS sandbox blocks Metal

Confirm the active setting:

```sh
nix config show sandbox
```

For this native macOS build it must be `false`. If a machine-wide policy set it
to `true`, update that Nix installation's daemon configuration and restart the
daemon before retrying.

### The first build runs out of space

Remove only disposable build outputs, then collect dead Nix store paths:

```sh
rm -rf /private/tmp/amm-build
nix-store --gc
```

Do not remove `/nix/store` directly.

### A lock error mentions an unlocked input

Restore the committed app lock and verify it without rewriting it:

```sh
git restore flake.lock
nix flake metadata --no-update-lock-file .
```

If the error still names `path:../shared/wallet` or `path:../..`, the checkout
does not contain the portable flake fix described above.
Loading
Loading