feat(android): wallet screen and SDK payment surface
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:
parent
dc52df2366
commit
7cf98bb9fe
12 changed files with 728 additions and 18 deletions
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue