Skip to content

Wallet: cap deposit / invoice amount with sensible max #577

Description

@dmnyc

Problem

The Receive screen (WalletScreen.ktReceiveAmountContent) currently accepts any user-entered amount with no client-side cap. If the user enters an amount that exceeds:

  • Spark: per-channel inbound liquidity / JIT channel limit
  • NWC: the backing wallet's max receive policy

…the invoice creation fails with a backend error string surfaced via _sendError, which is bad UX. The user only learns the cap exists by hitting it.

Investigation done

  • breez_sdk_spark 0.11.0 does not expose a queryable max-receive method. FetchConversionLimits only returns minFromAmount / minToAmount (for fiat onramps, not Lightning receive).
  • NIP-47 / our NwcRepository get_info response (alias, methods, pubkey, blockHeight) has no budget or max-amount fields. NIP-47 has no widely-implemented get_budget method.

Proposal

Pick a sensible static cap as a starting point (e.g. 1,000,000 sats / 0.01 BTC) applied to both Spark and NWC, with the field showing a supporting line like "Max 1,000,000 sats" and the Create invoice button disabled when exceeded.

This cap should match across Android and iOS — see companion issue on barrydeen/wisp-ios for iOS-side work.

Open questions

  1. What's the right number? 1M sats is ~$1000 at current price — generous for everyday Lightning use, well under typical channel limits.
  2. Should the cap differ per wallet backend? (Spark vs. NWC). Probably not for v1 — pick one number for simplicity.
  3. Should we tighten this dynamically once Spark SDK or a future NIP-47 extension exposes real limits? File-as-followup.

Related

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions