v1

latestOpenAPI 3.0.22026-07-17112726.4 KB
loop

post/v1/loop/out

Request body

pair_idstring
amountinteger required

amount you wish to swap out (in satoshi).

swap_tx_conf_requirementinteger nullable

The number of confirmation of the swaptx (htlc tx) before we make an off-chain offer. a.k.a. htlc_confirmations on the lightning loop. Default number depends on the asset type, (see NLoop.Server/Options/CryptoCodeParams.fs) Set this to 0 for zero-conf swap.

labelstring nullable

Additional label for this request.

max_swap_routing_feeinteger nullable

Maximum off-chain fee in sats that may be paied for swap payment to the server. This limit is applied during path finding. Default value depends on the asset type, (see NLoop.Server/Options/CryptoCodeParams.fs)

max_prepay_routing_feeinteger nullable

Maximum off-chain fee in sat that may be paid for the prepay to the server. This limit is applied during path finding. Default value depends on the asset type, (see NLoop.Server/Options/CryptoCodeParams.fs)

max_swap_feeinteger nullable

Maximum we are willing to pay the server for the swap (by diff of on/off-chain payment). If the server asks for a higher fee, we do not perform the swap. For multi-asset swap, the unit of this value is off-chain currency. We use a rate information from external exchanges to calculate the value. Default value depends on the asset type, and a channel size. (see NLoop.Server/Options/CryptoCodeParams.fs)

max_prepay_amountinteger nullable

The server might request a pre-payment for the sake of DoS-prevention, this is a maximum amount (in sats) of the off-chain prepayment. Default value depends on the asset type, (see NLoop.Server/Options/CryptoCodeParams.fs)

max_miner_feeinteger nullable

Maximum on-chain fees that we are willing to spend. If we want to sweep the on-chain htlc and the fee estimate turns out higher than this value, we cancel the swap. If the fee estimate is lower, we publish the sweep tx. If the sweep tx is not confirmed, we are forced to ratchet up fees until it is swept. Possibly even exceeding max_miner_fee if we get close to the HTLC timeout. Because the initial publication revealed the preimage, we have no other choice. The server may already have pulled the off-chain HTLC. Only when the fee becomes higher than the swap amount, we can wait for fees to come down and hope -- if we are past the timeout -- that the server is not publishing the revocation. So think this value as a "soft-limit" for preventing to start the swap when the fee market is too expensive, rather than the hard-limit. Default value depends on the asset type, (see NLoop.Server/Options/CryptoCodeParams.fs)

sweep_conf_targetinteger nullable

Confimation target (block num) for estimating the fee for the sweeping tx (a.k.a. sweep tx, claim tx.) from the HTLC tx (a.k.a. swaptx, lockuptx) Default depends on the asset type, but usually it is not that short. If you want to finish swap asap and get your on-chain funds quickly, You probably want to set a short time. Default value depends on the asset type, (see NLoop.Server/Options/CryptoCodeParams.fs)

Example request

{
  "channel_ids": [
    "140x10x1"
  ],
  "pair_id": "BTC/LTC",
  "address": "bc1q2y7lfmmm7xhv2dpf0n0mx6w26zspmvszm3hvkc4yn785xp8dvs5shejlc5"
}

Response

OK

idstring

Swap identifier to track status.

{"stackTrail":"components:schemas:LoopOutResponse:properties:claim_tx_id","oasType":"schema","type":"unknown","description":"An txid by which they have paid to us. It is populated only when its 0-conf.","nullable":true}

Example response

{
  "id": "tY8iDo",
  "address": "bc1q2y7lfmmm7xhv2dpf0n0mx6w26zspmvszm3hvkc4yn785xp8dvs5shejlc5"
}