Repository navigation
feat: pay contacts via pubky swaps - #1732
Conversation
|
Pushed
|
|
Pushed
|
|
Pushed |
Rebuilt on the split Spark head; carries the Pubky Swaps route (#1732) as it was merged into this branch.
# Conflicts: # app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt
Restore passes the Lightning payments the node sent, so bitkit-core checks each listed lockup against what was paid, and drives the swaps already on record too.
Regtest APKDownload bitkit-dev-debug universal APK (expires in 30 days). |
# Conflicts: # app/src/main/java/to/bitkit/viewmodels/WalletViewModel.kt # app/src/test/java/to/bitkit/ui/WalletViewModelTest.kt # gradle/libs.versions.toml
|
Moved bitkit-core from the Then merged |
jvsena42
left a comment
There was a problem hiding this comment.
Delta review of the rebase onto master (7c56d7a9c, 46948b65b) and 9a7eebeb3 (bitkit-core 0.8.0-rc14): one LOW, inline.
- Core:
0.8.0-swaps.11is an ancestor of rc14, andpubky_swapsandpaykit_routeare identical between them.9a7eebeb3only addsauth = nullto the four regtest calls. - Route types:
PubkySwapsRouteRepo.kt:83-91sets all sevenPaykitRouteRequestfields, andAppViewModel.kt:4715-4737handles all fourPaykitRoutecases. - Merges: the conflicts are in
libs.versions.toml(rc14 plus master'sbreez-sdk-sparkand paykit rc7) and theWalletViewModelconstructor, which keeps bothpubkySwapsRouteRepoandsparkRepo. The swap files are byte-identical tocd13b132. - The LOW: Spark arriving from master now reaches the hold payment (inline). A restore also matches lockups only against node payments (
PubkySwapsRouteRepo.kt:123-124), so a Spark-paid swap left mid-flight refunds instead of being claimed. That loses nothing, so I'm not raising it separately.
The LOW can be fixed here or moved to a follow-up issue, your choice; please say which on the thread.
coreyphillips/pubky-swap f45e204) against bitkit-docker's LND and the marketplace stack. CI: build, build-and-test, lint, detekt, compose-ui and five e2e shards pass; two shards were still running.
Reviewer model: Claude Fable 5.2 (claude-fable-5-2), Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: not exposed
|
@ovitrif this conflicts with |
# Conflicts: # gradle/libs.versions.toml
# Conflicts: # app/build.gradle.kts # app/src/main/java/to/bitkit/services/CoreService.kt
|
@jvsena42 merged |
jvsena42
left a comment
There was a problem hiding this comment.
Delta review of c22b8f6ed and the master merges c866eb5dc/098c35550: my LOW is fixed (confirmed on the thread), and nothing new.
098c35550 resolves its two conflicts correctly. build.gradle.kts keeps the swap BuildConfig fields (PUBKY_SWAPS_ROUTES, PUBKY_SWAPS_PROVIDERS) and master's BLOCKTANK_REGTEST_AUTH. The four regtest calls in CoreService.kt take master's auth = Env.blocktankRegtestAuth instead of the branch's auth = null. c866eb5dc only resolves libs.versions.toml.
coreyphillips/pubky-swap f45e204) against bitkit-docker's LND and the marketplace stack.
Reviewer model: Claude Opus 5.5 (claude-opus-5-5)
Reasoning effort: not exposed
|
QA: J1 and J2 pass at 098c355, on a regtest Android 15 emulator (API 35). The stack is synonymdev/bitkit-docker#39's
J1, Spending only (500,000 sats, Savings 0), paying the on-chain-only
J2: the swap was started, the provider funded its HTLC, and the app was killed before any block. Then the app data was cleared and the wallet restored from its recovery phrase:
Not as written:
|
|
@ovitrif this conflicts with |
# Conflicts: # app/src/main/java/to/bitkit/ui/screens/wallets/send/SendConfirmScreen.kt # app/src/main/java/to/bitkit/viewmodels/AppViewModel.kt # app/src/main/res/values/strings.xml # app/src/test/java/to/bitkit/viewmodels/AppViewModelSendFlowTest.kt
|
@jvsena42 merged
|
|
QA: J1 passes via the saved issuer contact at a786e34, on a regtest Android 15 emulator (API 35). The stack is synonymdev/bitkit-docker#39 with main merged in, so its
J1, Spending only (500,000 sats, Savings 0), paying the saved
Setup: the issuer must be linked to the wallet and have sent it its private payment list before the tap. Without the list, the tap showed "The contact you're trying to send to hasn't enabled payments." synonymdev/bitkit-docker#39's README has the three calls. |
coreyphillips
left a comment
There was a problem hiding this comment.
Delta review from de7b78f, my last review, to a786e34. Nothing blocking, two LOWs inline.
- Fixes
8d40a8btocd13b13andc22b8f6. A hold payment that fails beforepayInvoicereturns opens the error screen once, a refused commit retries from Amount and releases the private payment list, and an unknown Spark outcome stays pending. These read correctly. - The
a786e34merge carries new behaviour, so I read it as code rather than a conflict fix. The Spark leg and the swap route stay exclusive:LegandDirectclearpaykitSwapRoute, theNonebranch clearsserviceLegbefore it returnsSwapFallback, the swap is paid before any service leg, the LNURL fetch andpaysLnurlskip a swap quote, and the sanity check uses its debit. I found no path that pays both. - Test gap, non-blocking.
spark balance short of a contact payment falls back to a swap quotecovers Spark to swap. Nothing covers the way back thatroutePaykitPaymentOnContinue's doc names: a smaller amount entered after a swap quote takes the Spark leg and clears the quote.
|
@coreyphillips thanks. The test gap is out of scope: tracked in #1922, with the two LOWs (#1920, #1921) for one follow-up PR after this one merges. |
|
Merged: approved at a786e34, CI green, no open threads. Corey's non-blocking points go into one follow-up PR (#1920, #1921, #1922). The iOS twin, synonymdev/bitkit-ios#1170, is still in review. |
Closes #1826
Dependency: synonymdev/bitkit-core#182
Refs:
Description
PUBKY_SWAPS_PROVIDERSadds extra candidates for testing.paykit-cap.*and refuses a reply not signed by the provider's key or the key its records delegate to.Route: Pubky Swaps · <provider>, with the whole swap cost in the fee row.PUBKY_SWAPS_ROUTES=trueon regtest debug builds only.Builds against the bitkit-core release
0.8.0-rc15, which includes synonymdev/bitkit-core#182. Master's Spark leg (#1754) goes first. A contact payment to an on-chain address takes the swap route when Spark can't carry it, including when Spark's balance is too small for the amount and fee: that's the order bitkit-core's router weighs service legs and swaps in. A send that only a swap pays skips the Paykit router on Amount and Confirm, so it never picks up a Spark leg next to its quote.Why this journey
What it needs to ship
swap/1in Paykit: the signedpaykit-cap.*negotiation runs over iroh; over Paykit Encrypted Links it needs the additive paykit-rs SDK API for extension kinds (Design review: Paykit Capabilities, a general capability and intent layer for Paykit peers (answers Paykit Intents question 8) pubky/paykit-rs#229, §17).Out of Scope
Design
N/A — no design available.
Preview
A wallet with only a spending balance pays a contact who accepts only on-chain bitcoin. The router finds a Pubky Swaps provider among the wallet's contacts, the confirm screen shows the route, the quote and contract are signed, and the contact receives exactly 20,000 sats on chain (Android emulator (API 35), 2x speed, regtest).
android-signed-swaps-route-2x.mp4
After a wallet restore from the seed, the swap the wallet left in flight before its claim is found at its provider and claimed to Savings, with the "Payment returned to Savings" notice (Android emulator (API 35), 2x speed, regtest; the phrase entry is not recorded). Recorded on bitkit-core
0.8.0-swaps.4, before restores took the node's payments.android-restore-j2c2x.mp4
QA Notes
Setup
feat/pubky-swap-provideruntil it merges): the stack, thepubky-swapsprofile with the provider atf45e204on the stack's LND, the marketplace andfixture-issuerfixtures, and the LNURL-pay fixture.docker compose logs pubky-swap | grep "Provider pubky"gives the provider's pubky.E2E=true E2E_BACKEND=local E2E_LOCAL_HOST=127.0.0.1 E2E_HOMESERVER_PUBKY=$(./pubky-marketplace info | jq -r .homeserver_z32) PUBKY_SWAPS_ROUTES=true ./gradlew assembleDevDebug. Before first launch,adb reverse6286, 6287, 6288, 15411, 15412, 60001, 23735, 23000 and 23010.curl -H 'Host: 127.0.0.1:23010' 127.0.0.1:23010/generate/channel(500,000 sats to spending); leave savings empty; create a Pubky profile; save the provider's pubky and the fixture-issuer's pubky as contacts.fixture-issuer(curl 127.0.0.1:23012/healthgives its pubky), which publishes onlybtc-regtest-p2wpkh.Journeys
paykit-swap-route.xml— a spending-only wallet pays an on-chain-only contact through a Pubky Swaps provider found among its contacts, and the contact receives exactly 20,000 satspaykit-swap-restore.xml— a swap route left in flight before its claim is finished after a wipe and a restore from the recovery phrase: claimed to Savings, with the "Payment returned to Savings" noticeManual Tests
N/A
Automated Checks
AppViewModelSendFlowTest.kt— the routed send: it finishes once, as the hold payment's success, and tags the hold payment; quote, hold-payment and claim failures, and a hold-payment failure event ending the wait; a Direct answer moving to Savings; quotes from a replaced send or wallet dropped; Spending selectable for a swap-routed contact; the endpoint's method id matching its address; a stale amount or fee after edits; a late claim or failure after dismissal leaving the next send alone; a failed payment retrying from the amount with a fresh quotePubkySwapsRouteRepoTest.kt— the claim wait finishes on broadcast, retries a failed advance, and keeps advancing a swap whose wait ran outWalletViewModelTest.kt— swap restore after a wallet restore, with the restore's failed categories; swaps already on record driven without the Savings noticedetektandtestDevDebugUnitTestforWalletViewModelTest,AppViewModel*andPubkySwaps*at4b8c8df: passEvidence
098c35550(bitkit-core0.8.0-rc14) on a regtest emulator (API 35), against feat: local pubky swaps provider bitkit-docker#39's stack, with noPUBKY_SWAPS_PROVIDERS: both pass. Recordings, claim txids and notes are in feat: pay contacts via pubky swaps #1732 (comment).a786e349e, against feat: local pubky swaps provider bitkit-docker#39 with its rc8fixture-issuer: passes. Confirm showed the contact as TO and the Pubky Swaps route; the recording and claim txid are in feat: pay contacts via pubky swaps #1732 (comment).9f6ec3bon a regtest emulator (API 35), bitkit-core0.8.0-swaps.9, provider coreyphillips/pubky-swapf45e204with--no-homeserver, and noPUBKY_SWAPS_PROVIDERS, so the provider came only from the wallet's contacts (the recording above):Route: Pubky Swaps · pubky…fez6yand a fee of ₿ 986 for 20,000 sats;hold invoice accepted,HTLC funded; awaiting client claimand, after one block,client claimed; hold invoice settled;d953772e4480f719bbf843f6df2015dd7befab453ef8d1944398f07c2abdb6c6, has one input, the provider's HTLC, and one output of exactly 0.0002 BTC to the contact's address.master, tracked in bug: saved contact payment stalls instead of failing #1827.257190c, bitkit-core0.8.0-swaps.4, provider coreyphillips/pubky-swapmainwith--no-homeserver:2d3aa3d…b577) had one input, the provider's lockup, and one output of exactly 0.0002 BTC to the wallet's own address. That take also showed the notice hidden under the "Received Bitcoin" sheet the claim opens, so it now stays until dismissed (257190c).PUBKY_SWAPS_PROVIDERSto the provider, in case contacts had not reloaded when the restore ran; they had, and the provider was also among them.46ad2a9, before quotes were signed on a regtest emulator (Android 15), with feat: pubky swaps as paykit route bitkit-core#182 at3fd9e9dand noPUBKY_SWAPS_PROVIDERS, so the provider came only from the wallet's contacts (the recording above):Route: Pubky Swaps · pubky…mpquoand a fee of ₿ 986 for 20,000 sats;hold invoice accepted,HTLC funded; awaiting client claimand, after one block,client claimed; hold invoice settled;PUBKY_SWAPS_PROVIDERS, paid the same way.Gaps
Models used
claude-opus-5-5(reasoning:medium),claude-sonnet(reasoning: Not exposed)claude-opus-5-5(reasoning:medium)Metadata note: the Sonnet entry is the research subagent that read pubky-swap and Bitkit's Paykit code; its exact model version is not exposed in this session's records.