feat(android): wallet screen and SDK payment surface
Some checks failed
ci / test (pull_request) Failing after 4m1s
ci / sdk (pull_request) Successful in 1m27s

Expose wallet balance/address/transfers plus one-shot invoice and tip on
the UniFFI SDK. Wire a Compose wallet route (QR, composers) without dropping
wipe-chat. Ignore machine-local android/.cargo NDK paths.
This commit is contained in:
agent 2026-09-13 15:27:57 -04:00
commit 7cf98bb9fe
No known key found for this signature in database
12 changed files with 728 additions and 18 deletions

View file

@ -23,6 +23,7 @@ import uniffi.onionwire_sdk.InviteInfo
import uniffi.onionwire_sdk.OutboxRow
import uniffi.onionwire_sdk.RotateOutcome
import uniffi.onionwire_sdk.SendState
import uniffi.onionwire_sdk.TransferRow
import uniffi.onionwire_sdk.Wire
import uniffi.onionwire_sdk.decodeInvite
import java.io.File
@ -405,4 +406,26 @@ class WireViewModel(app: Application) : AndroidViewModel(app) {
}
suspend fun decode(invite: String): InviteInfo = decodeInvite(invite)
// --- Wallet & payments -------------------------------------------------
// These mirror the SDK surface added for the wallet screen. Payment sends
// are one-shot: if the peer's onion is unreachable, `send_*` fails now.
// They are NOT queued through the outbox like chat messages — that is a
// deliberate choice in the core, not a bug.
suspend fun walletBalance(): String = requireWire().walletBalance()
suspend fun walletReceiveAddress(): String? = runCatching {
requireWire().walletReceiveAddress()
}.getOrElse { null }
suspend fun walletRecentTransfers(cap: Int = 25): List<TransferRow> = runCatching {
requireWire().walletRecentTransfers(cap.toUInt())
}.getOrElse { emptyList() }
suspend fun sendInvoice(pubkeyHex: String, amountXmr: String, memo: String = ""): Result<Unit> =
runCatching { requireWire().sendInvoice(pubkeyHex, amountXmr, memo) }
suspend fun sendTip(pubkeyHex: String, amountXmr: String, memo: String = ""): Result<Unit> =
runCatching { requireWire().sendTip(pubkeyHex, amountXmr, memo) }
}