Skip to content

Port on-chain send and receive from iOS #654

Description

@dmnyc

Port on-chain send and receive from iOS: barrydeen/wisp-ios#454.

What it adds

Receive: a Lightning / Bitcoin selector on the receive sheet, showing the static deposit address as QR and text with copy, share, and rotation.

Pending deposits: tracked from the wallet store rather than the receive screen. A deposit arrives with no user action and takes three confirmations to mature, so nothing on screen prompts a refresh when one lands — tracking it in a view means "my money arrived" is only visible if you happen to be sitting on the right tab. The wallet dashboard shows a banner with amount and status, and each pending deposit exposes its transaction id and a block explorer link.

Claim failures: claiming stays automatic. The SDK's claim error was never read, so a deposit whose fee exceeded the automatic cap sat unclaimed with nothing said. Those now surface with a reason and a retry that names the required fee and asks first.

Send: accepts a Bitcoin address or BIP-21 URI. A BIP-21 that also offers a Lightning invoice takes the invoice. On-chain sends quote before sending, since the fee is added on top of the amount rather than taken out of it, and a fee over a tenth of the amount is called out. "Send all funds" quotes with the fee coming out of the balance instead.

Available balance on the send screen — on-chain what clears is amount plus fee, so a send that looks affordable can fail on a total the user was never shown.

Stranded tokens: draining warns when it would leave a token balance behind, since the bitcoin balance is separate from token balances.

Don't build instant (0-conf) claims

I built this and removed it. It can't work on this SDK:

  • Spark sells 0-conf by validating at broadcast and absorbing double-spend risk.
  • But listUnclaimedDeposits doesn't report a deposit until it already has a confirmation. Verified directly: the SDK's unclaimed_deposits table stayed empty and the txid appeared nowhere in its storage the entire time a real deposit sat in the mempool.
  • So the deposit becomes actionable exactly when the plan stops existing. A live attempt returned No instant (0-conf) claim plan available.
  • There's no quote API to check plan availability first, so the button can't be shown only when it would work.

Read the instant-claim status so a deposit the SDK claims that way isn't touched mid-settle, but don't offer it as an action.

Also worth porting together

barrydeen/wisp-ios#453 — the wallet showed a confident "0 sats" over a funded wallet during the initial sync. Two halves: the view stated a zero it didn't know, and the Spark path published an unsynced zero so the "unknown" guard never fired. That fake zero also got cached and reloaded on the next launch.

This repo

Breez SDK is already on 0.23.1, so the APIs are available — no upgrade needed.

(written by my agent)

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