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, …).
81 lines
2.1 KiB
QML
81 lines
2.1 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
Button {
|
|
id: root
|
|
|
|
required property var theme
|
|
property bool hasToken: false
|
|
property string tokenColor: root.theme.colors.noTokenCircle
|
|
property string tokenLetter: ""
|
|
property bool showIndicator: true
|
|
property bool invalid: false
|
|
property real maximumTextWidth: 112
|
|
|
|
implicitWidth: contentRow.implicitWidth + 24
|
|
implicitHeight: 40
|
|
leftPadding: 12
|
|
rightPadding: 12
|
|
hoverEnabled: true
|
|
|
|
contentItem: RowLayout {
|
|
id: contentRow
|
|
|
|
spacing: 6
|
|
|
|
Rectangle {
|
|
Layout.preferredWidth: 24
|
|
Layout.preferredHeight: 24
|
|
visible: root.hasToken
|
|
radius: 12
|
|
color: root.tokenColor
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: root.tokenLetter
|
|
color: "#FFFFFF"
|
|
font.pixelSize: 10
|
|
font.weight: Font.Bold
|
|
}
|
|
}
|
|
|
|
Text {
|
|
Layout.maximumWidth: root.maximumTextWidth
|
|
text: root.text
|
|
color: root.enabled
|
|
? root.theme.colors.textPrimary
|
|
: root.theme.colors.textPlaceholder
|
|
font.pixelSize: 15
|
|
font.weight: root.hasToken ? Font.Medium : Font.Normal
|
|
elide: Text.ElideRight
|
|
}
|
|
|
|
Text {
|
|
visible: root.showIndicator
|
|
text: "\u25BE"
|
|
color: root.enabled
|
|
? root.theme.colors.textSecondary
|
|
: root.theme.colors.textPlaceholder
|
|
font.pixelSize: 10
|
|
}
|
|
}
|
|
|
|
background: Rectangle {
|
|
radius: 20
|
|
color: root.pressed
|
|
? root.theme.colors.selection
|
|
: root.hovered || root.activeFocus
|
|
? root.theme.colors.panelHoverBg
|
|
: root.theme.colors.panelBg
|
|
border.width: root.invalid || root.activeFocus ? 1 : 0
|
|
border.color: root.invalid ? root.theme.colors.error : root.theme.colors.ctaBg
|
|
|
|
Behavior on color {
|
|
ColorAnimation { duration: 120 }
|
|
}
|
|
}
|
|
}
|