Repository navigation
Conversation
1 task
iroh reads network interfaces through Network.framework, so apps that link BitkitCore without it fail with undefined nw_* symbols.
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs:
Description
pubky_swapsmodule so that a Paykit payment routes through a Pubky Swaps provider when no balance the wallet holds reaches an endpoint the contact published. The user never picks the swap; the router does.swap/1edges, pre-ranks them by indicative fee (base + ppm + onchain, enforced minimum), asks the cheapest three for a firm quote and picks the smallest debit for the exact amount the contact must receive.swap-commonvalidators.pubky-swap/direct/1at once, with 20 s to answer, and those that run no provider are skipped. iroh needs no homeserver on either side.pubky_swaps_route_paykit_payment,pubky_swaps_commit_route,pubky_swaps_advance,pubky_swaps_provider_edges.The apps that use this are synonymdev/bitkit-android#1732 and synonymdev/bitkit-ios#1170, both on the prerelease
0.8.0-swaps.2or its predecessor0.8.0-swaps.1.Cross-platform impact
swap-common(git, coreyphillips/pubky-swap at8686702, unaudited),iroh1.2.0 andelectrum-client0.25. The library size change against a release build is not measured yet.cargo checkpasses foraarch64-apple-ios.nw_*symbols.What it needs to ship
swap/1in Paykit: Capability Descriptors published by providers, andpaykit-cap.*negotiation over Encrypted Links. That 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). pubky-swap signs nothing atmain, so quotes and contracts are not attributable yet.pubky_swaps_advancecall; the app does not resume it yet. Funds stay safe through the timeouts: the provider cancels its hold invoice, or refunds its own lock.Preview
The Android twin's journey: 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, and the contact receives exactly 20,000 sats on chain (2x speed, regtest).
swaps-route-android2x.mp4
QA Notes
Setup
8686702, built withcargo build --release -p swap-provider --features full, with one local change so it answers over iroh without signing in to a homeserver:swap-provider/src/lib.rs, inrun).swap-provider --network regtest --directions submarine,reverse --min-amount 10000 --max-amount 1000000 --base-fee 100 --fee-ppm 2500 --confirmations 1 --lnd-address https://127.0.0.1:23009 --lnd-cert <bitkit-docker>/lnd/tls.cert --lnd-macaroon <bitkit-docker>/lnd/data/chain/bitcoin/regtest/admin.macaroon --electrum-url tcp://127.0.0.1:60001 --data-dir <dir>, withPUBKY_SWAP_RECOVERY_PHRASE__FILEandPUBKY_SWAP_WALLET_MNEMONIC__FILEpointing at two throwaway BIP39 phrases. Fund the provider's first BIP84 address and mine six blocks.--doctormust pass.Automated Checks
keys.rsandrouter.rsunit tests: seed derivation, edge ranking, fee formula, endpoint preferenceclient.rslive test (ignored by default): route, quote, commit, contract and hold-invoice checks against a running regtest provider. Run withPUBKY_SWAPS_PROVIDER=<pubky> PUBKY_SWAPS_ELECTRUM=tcp://127.0.0.1:60001 PUBKY_SWAPS_DESTINATION=<bcrt1 address> cargo test --lib pubky_swaps::client::live_tests -- --ignoredcargo fmt --check,cargo clippy --locked --lib --tests,cargo test --lib modules::pubky_swaps,cargo check --lib --target aarch64-apple-ios: pass3fd9e9d, with the provider found only among the wallet's contacts: the provider loggedhold invoice accepted,HTLC fundedandclient claimed; hold invoice settled, and the claim paid exactly 20,000 sats to the contact's address (one input from the HTLC, one output)