mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-07-25 16:23:16 +00:00
Add a "Create Pool" flow to the AMM app that lets a user open a new liquidity position — seeding a pool's initial liquidity — from token selection and amount entry, through a confirmation dialog, to on-chain submission. - client crate (apps/amm/client): pure, testable protocol logic — account decoding, pair/position modelling, and quote/plan computation — exposed to the app over a C ABI (config/networks.json drives network selection). - C++ runtime + backend: AmmClient, ActiveNetwork, and NewPositionRuntime, wired into AmmUiBackend (new resolve/quote/submit slots). - QML flow: NewPositionForm, NewPositionFlow state, NewPositionConfirmation- Dialog, TokenSelectorModal, and reusable Amm* presentational components (theme, surfaces, buttons) + AmountMath.js. - tests: C++ (NewPositionRuntimeTest, ActiveNetworkTest) and QML (tst_NewPositionForm, tst_LiquidityPage, tst_TokenAmountInput, …).
86 lines
2.5 KiB
CMake
86 lines
2.5 KiB
CMake
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(
|
|
NAME amm_ui
|
|
REP_FILE src/AmmUiBackend.rep
|
|
SOURCES
|
|
src/AmmUiPluginInterface.h
|
|
src/AmmUiPlugin.h
|
|
src/AmmUiPlugin.cpp
|
|
src/AmmUiBackend.h
|
|
src/AmmUiBackend.cpp
|
|
src/ActiveNetwork.h
|
|
src/ActiveNetwork.cpp
|
|
src/AmmClient.h
|
|
src/AmmClient.cpp
|
|
src/NewPositionRuntime.h
|
|
src/NewPositionRuntime.cpp
|
|
FIND_PACKAGES
|
|
Qt6Gui
|
|
Qt6Network
|
|
LINK_LIBRARIES
|
|
Qt6::Gui
|
|
Qt6::Network
|
|
PkgConfig::BASE58
|
|
LINK_TARGETS
|
|
logos_wallet_access
|
|
EXTERNAL_LIBS
|
|
amm_client_ffi
|
|
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
|
|
)
|
|
target_include_directories(amm_new_position_runtime_test PRIVATE src)
|
|
target_link_libraries(amm_new_position_runtime_test PRIVATE
|
|
Qt6::Core
|
|
PkgConfig::BASE58
|
|
logos_wallet_access
|
|
)
|
|
add_test(NAME amm_new_position_runtime COMMAND amm_new_position_runtime_test)
|
|
endif()
|