From 66a3c054e771e3b07531da49180fb5d57be95ead Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 25 Jan 2026 16:54:48 -0500 Subject: [PATCH] feat: update CashOutView UI for noffer-based flow - Redesign cash-out view for noffer (CLINK Offers) workflow - Add states: generatingNoffer, displayingNoffer, validatingRequest, sendingInvoice, awaitingPayment - Remove old selectingAmount state (user specifies amount in wallet) - Add debug controls to simulate offer requests for testing - Wire up offer request callback in ATM store to state machine Co-Authored-By: Claude Opus 4.5 --- lamassu-next/apps/machine/src/stores/atm.ts | 15 +- .../apps/machine/src/views/CashOutView.vue | 148 +++++++++++++----- 2 files changed, 124 insertions(+), 39 deletions(-) diff --git a/lamassu-next/apps/machine/src/stores/atm.ts b/lamassu-next/apps/machine/src/stores/atm.ts index 0c805ed..f078a77 100644 --- a/lamassu-next/apps/machine/src/stores/atm.ts +++ b/lamassu-next/apps/machine/src/stores/atm.ts @@ -156,10 +156,23 @@ export const useAtmStore = defineStore('atm', () => { paymentReceived(preimage) }) - // Wire up offer request callback (for logging/debugging) + // Wire up offer request callback - send to state machine for cash-out flow services.onOfferRequest((request, sender) => { console.log('[ATM] Offer request from:', sender.slice(0, 16) + '...') console.log('[ATM] Amount requested:', request.amount_sats, 'sats') + + // Send to state machine if we're in the displayingNoffer state + if (nestedState.value === 'displayingNoffer') { + send({ + type: 'OFFER_REQUEST_RECEIVED', + request: { + eventId: request.offer || 'unknown', + payerPubkey: sender, + amountSats: request.amount_sats, + description: request.description, + }, + }) + } }) // Initialize state machine with real services diff --git a/lamassu-next/apps/machine/src/views/CashOutView.vue b/lamassu-next/apps/machine/src/views/CashOutView.vue index af22593..5d4eb70 100644 --- a/lamassu-next/apps/machine/src/views/CashOutView.vue +++ b/lamassu-next/apps/machine/src/views/CashOutView.vue @@ -25,13 +25,6 @@ watch( const nestedState = computed(() => atmStore.nestedState) const context = computed(() => atmStore.context) -// Available denominations for cash-out -const amounts = [20, 40, 60, 80, 100] - -function selectAmount(amount: number) { - atmStore.selectAmount(amount) -} - function cancel() { atmStore.cancel() } @@ -47,6 +40,10 @@ function skipReceipt() { function formatSats(sats: number): string { return sats.toLocaleString() } + +function formatFiat(cents: number): string { + return (cents / 100).toFixed(2) +}