Embed swaps in a wallet
Give wallet users best-execution swaps without running liquidity: quote, create, fund with the user's key, track.
A wallet already holds the user's keys and UTXOs. That's everything an intent needs: the wallet funds the covenant, and solvers do the rest.
Steps
- Quote the pair and size.
- Create the intent with the user's address as maker and your wallet's pkh as
frontendPkh. - Fund from the user's UTXOs with
TransactionBuilderagainst the covenant locking bytecode. - Track via the WebSocket or
GET /intent/:idand show the fill or refund.
To document
- Full TypeScript example from
examples/1-embedded-dex-wallet.ts - Handling token funding (token address + 1,000 sats)
- UX for
expired→refunded