Skip to content

feat: wake the wallet to claim pubky swaps - #1991

Draft
coreyphillips wants to merge 3 commits into
masterfrom
feat/swap-claim-wakes
Draft

coreyphillips wants to merge 3 commits into
masterfrom
feat/swap-claim-wakes

Conversation

@coreyphillips

@coreyphillips coreyphillips commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Part of #1804
Twin: synonymdev/bitkit-ios#1387
Dependency: synonymdev/bitkit-core#223

Pins bitkit-core 0.8.0-swaps.12, a prerelease of rc15 plus synonymdev/bitkit-core#223, until a release includes it.

Description

  • After a commit whose provider takes wakes, PubkySwapsRouteRepo creates a 2-day swap.claimable grant for the registered pk: identity, else ln:, and bitkit-core hands it to the provider. Only an opted-in install with a gateway registration gets one. Only the grant id is kept, never the token.
  • The grant is revoked when the swap ends, when the provider refuses it, and when the swap is already claimable, which is then advanced at once.
  • SwapClaimableWakeHandler advances every unfinished swap every 3 s for up to 2 minutes and acks handled once a claim goes out or no swap is left open, else failed. The swaps then keep advancing in the background.
  • No changelog fragment: wakes through the gateway have not shipped in a release yet.

Out of Scope

Design

N/A: no UI changes.

Preview

N/A

QA Notes

Setup

A regtest build on a device with Background Payments on and the install registered (Dev Settings, Wake), a Pubky Swaps provider that allowlists the gateway (--wake-gateway), and a contact reachable only on chain.

Journeys

N/A: not drivable; see Manual Tests.

Manual Tests

  • 1. Pay the contact through a swap, send Bitkit to the background before the lockup confirms, mine the confirmations: the wake claims the swap, and wake status shows it acked handled. Needs a gateway wake, not in Capabilities.
  • 2. After the claim confirms, the gateway lists the swap's grant as revoked. Needs gateway access, not in Capabilities.
  • 3. regression: with Background Payments off, a swap creates no grant and still claims on the next launch. Needs a swap provider, not in Capabilities.

Automated Checks

  • added WakeRepoTest.kt: grant gating, the pk: then ln: recipient, and revoking on the gateway
  • added WakeHandlersTest.kt: a swap.claimable wake acks handled or failed
  • updated PubkySwapsRouteRepoTest.kt: the grant handed over, refused, already claimable and revoked when the swap ends; the claimable wake's outcomes; every test stops the repo's background loops before it ends

Evidence

  • eb27d5e, published bitkit-core 0.8.0-swaps.12 with strict verification: compileDevDebugKotlin, testDevDebugUnitTest (6296 passed, 0 failed), detekt and lintDevDebug pass; just deps passes.
  • CI on eb27d5e: build, unit tests, compose UI tests, lint and detekt passed.

Gaps

  • Manual tests not run: no provider with a gateway allowlist is running yet.

@github-actions

Copy link
Copy Markdown
Contributor

Regtest APK

Built from eb27d5e (run).

Download bitkit-dev-debug universal APK (expires in 30 days).

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant