Setup
Both abaseUrl and a nodeUrl are required: the first reaches the maker, the second reaches your node.
Step 1: Get a Quote
Request a quote for the pair you want to swap. Amounts are always raw integer units — see Utilities for conversion helpers.rfq_id on the response is what ties the next step to this price. Quotes expire — do not hold an rfq_id across user think-time, or initSwap will raise QuoteExpiredError.
Step 2: Initialize the Swap
Lock the swap with the maker against that quote. This returns theswapstring and the payment_hash you need for every remaining step, plus the access_token that authorizes status polling — it is only returned here, so store it alongside the payment hash.
Step 3: Whitelist on Your Taker Node
Your node has to authorize theswapstring before it will honour the incoming HTLC. This is the only step that runs against client.rln.
Step 4: Execute the Swap
Hand the maker your node’s details so it can settle.Step 5: Track Settlement
executeSwap returning is not the same as the swap having settled. Poll the status by payment_hash, passing the access_token from initSwap, until it reaches a terminal state.
client.rln.refreshTransfers() / refresh_transfers() advances pending RGB transfers, and client.rln.listSwaps() gives you the node’s own view. See Troubleshooting for the failure modes.
Next Steps
Error Handling
The exception hierarchy and retry patterns around each step.
Swap Protocol
The HTLC flow underneath, endpoint by endpoint, with the sequence diagram.
WebSocket
Stream live quotes instead of requesting them one at a time.
Client Reference
Every method on
client.maker and client.rln.