r4bbit b2753aa0c9
feat(apps/amm): add create-pool / new liquidity position flow
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, …).
2026-07-24 14:00:42 +02:00

64 lines
1.8 KiB
QML

import QtQuick 2.15
import QtQuick.Layouts 1.15
Item {
id: root
property string label: ""
property string value: ""
property bool valueWrapAnywhere: false
property bool estimated: false
property string estimateHelp: qsTr("This value is derived from your LP token balance, total LP supply, and current pool reserves.")
implicitHeight: Math.max(18, Math.max(labelText.implicitHeight, valueGroup.implicitHeight))
RowLayout {
anchors.fill: parent
spacing: 8
Text {
id: labelText
color: "#A9A098"
elide: Text.ElideRight
font.pixelSize: 12
text: root.label
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
}
RowLayout {
id: valueGroup
spacing: 4
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
Text {
color: "#E7E1D8"
elide: root.valueWrapAnywhere ? Text.ElideNone : Text.ElideRight
font.bold: true
font.pixelSize: 12
horizontalAlignment: Text.AlignRight
text: root.value
verticalAlignment: Text.AlignVCenter
wrapMode: root.valueWrapAnywhere ? Text.WrapAtWordBoundaryOrAnywhere : Text.NoWrap
Layout.maximumWidth: Math.max(178, root.width * 0.55)
Layout.preferredWidth: Math.min(implicitWidth, Math.max(178, root.width * 0.55))
}
EstimateInfoButton {
enabled: root.estimated
helpText: root.estimateHelp
opacity: root.estimated ? 1 : 0
visible: root.estimated
Layout.preferredHeight: 18
Layout.preferredWidth: root.estimated ? 18 : 0
}
}
}
}