lez-programs/apps/amm/src/AmmUiBackend.rep
2026-06-30 11:59:27 -03:00

54 lines
2.4 KiB
Plaintext

// QtRO view contract for the AMM UI backend. PROPs auto-sync to every QML
// replica; SLOTs are the async surface QML calls via logos.watch(...).
// The account list is exposed separately as a Q_PROPERTY model on the backend
// (reached from QML via logos.model("amm_ui", "accountModel")).
class AmmUiBackend
{
PROP(bool isWalletOpen READONLY)
PROP(bool walletExists READONLY)
PROP(QString configPath READONLY)
PROP(QString storagePath READONLY)
PROP(QString walletHome READONLY)
PROP(int lastSyncedBlock READONLY)
PROP(int currentBlockHeight READONLY)
PROP(QString sequencerAddr READONLY)
// Whether the configured sequencer answered the last reachability probe.
// Defaults true so the UI doesn't flash a warning before the first check.
PROP(bool sequencerReachable READONLY)
// Chain-backed deployment state for the configured AMM pool.
PROP(QVariantList deploymentTokens READONLY)
PROP(QVariantMap deploymentPool READONLY)
PROP(bool deploymentNetworkMatched READONLY)
PROP(bool deploymentIdentityPending READONLY)
// AMM transactions. Returns wallet JSON: { success, tx_hash, error }.
SLOT(QString submitSwap(QVariantMap snapshot))
SLOT(QString submitLiquidity(QVariantMap snapshot))
// Account management
SLOT(QString createAccountPublic())
SLOT(QString createAccountPrivate())
SLOT(void refreshAccounts())
SLOT(void refreshBalances())
SLOT(QString getBalance(QString accountIdHex, bool isPublic))
// Wallet lifecycle. createNewDefault() is the happy path: it creates a
// fresh wallet at the canonical LEZ wallet home with no path picking.
// createNew() exists for the QtRO contract but only accepts canonical
// config/storage filenames. Both return the new BIP39 mnemonic, or an
// empty string on failure.
SLOT(QString createNewDefault(QString password))
SLOT(QString createNew(QString configPath, QString storagePath, QString password))
// Re-open the existing on-disk wallet after a disconnect.
SLOT(bool openExisting())
// Close this app's wallet view (lock); does not delete the wallet and, in
// Basecamp, does not close the wallet other apps share.
SLOT(void disconnectWallet())
// Settings. Rewrites the wallet config's sequencer_addr and re-opens the
// wallet so the new network takes effect immediately.
SLOT(bool changeSequencerAddr(QString url))
}