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, …).
52 lines
1.1 KiB
QML
52 lines
1.1 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
|
|
ColumnLayout {
|
|
id: root
|
|
|
|
property var snapshot: ({})
|
|
|
|
spacing: 8
|
|
|
|
function actionText(instruction) {
|
|
if (instruction === "NewDefinition")
|
|
return qsTr("Create pool")
|
|
if (instruction === "AddLiquidity")
|
|
return qsTr("Add liquidity")
|
|
return instruction || "-"
|
|
}
|
|
|
|
SummaryRow {
|
|
Layout.fillWidth: true
|
|
label: qsTr("Pair")
|
|
value: root.snapshot.pairText || "-"
|
|
}
|
|
|
|
SummaryRow {
|
|
Layout.fillWidth: true
|
|
label: qsTr("Action")
|
|
value: root.actionText(root.snapshot.instruction)
|
|
}
|
|
|
|
SummaryRow {
|
|
Layout.fillWidth: true
|
|
label: qsTr("Fee")
|
|
value: root.snapshot.feeText || "-"
|
|
}
|
|
|
|
SummaryRow {
|
|
Layout.fillWidth: true
|
|
label: qsTr("Deposit")
|
|
value: qsTr("%1 + %2")
|
|
.arg(root.snapshot.depositAText || "-")
|
|
.arg(root.snapshot.depositBText || "-")
|
|
valueWrapAnywhere: true
|
|
}
|
|
|
|
SummaryRow {
|
|
Layout.fillWidth: true
|
|
label: qsTr("Expected LP")
|
|
value: root.snapshot.expectedLpText || "-"
|
|
}
|
|
}
|