Set your receive (payout) / refund address for a leg
curl --request POST \
--url https://api.hashlock.markets/v1/swaps/{id}/address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chain": "<a chain of this swap>",
"address": "<your payout address on that chain>"
}
'import requests
url = "https://api.hashlock.markets/v1/swaps/{id}/address"
payload = {
"chain": "<a chain of this swap>",
"address": "<your payout address on that chain>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chain: '<a chain of this swap>',
address: '<your payout address on that chain>'
})
};
fetch('https://api.hashlock.markets/v1/swaps/{id}/address', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hashlock.markets/v1/swaps/{id}/address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain' => '<a chain of this swap>',
'address' => '<your payout address on that chain>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hashlock.markets/v1/swaps/{id}/address"
payload := strings.NewReader("{\n \"chain\": \"<a chain of this swap>\",\n \"address\": \"<your payout address on that chain>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hashlock.markets/v1/swaps/{id}/address")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chain\": \"<a chain of this swap>\",\n \"address\": \"<your payout address on that chain>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/swaps/{id}/address")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain\": \"<a chain of this swap>\",\n \"address\": \"<your payout address on that chain>\"\n}"
response = http.request(request)
puts response.read_body{
"swap": {
"id": "<string>",
"threadId": "<string>",
"status": "<string>",
"makerId": "<string>",
"takerId": "<string>",
"initiatorUserId": "<string>",
"hashlock": "<string>",
"aAssetId": "<string>",
"aChain": "<string>",
"aAmount": "<string>",
"aTimelock": "2023-11-07T05:31:56Z",
"bAssetId": "<string>",
"bChain": "<string>",
"bAmount": "<string>",
"bTimelock": "2023-11-07T05:31:56Z",
"rfqId": "<string>",
"secretCiphertext": "<string>",
"meta": {},
"feeBps": 123,
"feeAmount": "<string>",
"feeAssetId": "<string>",
"aPayoutAddress": "<string>",
"aClaimTo": "<string>",
"aRefundAddress": "<string>",
"aHtlcAddress": "<string>",
"aFundTx": "<string>",
"aFundOutpoints": [
{
"txid": "<string>",
"vout": 123,
"value": 123
}
],
"aClaimTx": "<string>",
"aRefundTx": "<string>",
"bPayoutAddress": "<string>",
"bClaimTo": "<string>",
"bRefundAddress": "<string>",
"bHtlcAddress": "<string>",
"bFundTx": "<string>",
"bFundOutpoints": [
{
"txid": "<string>",
"vout": 123,
"value": 123
}
],
"bClaimTx": "<string>",
"bRefundTx": "<string>",
"timeline": {
"fundA": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"fundB": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"reveal": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"payoutA": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"payoutB": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
}
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Swaps and settlement
Set a settlement address
Set your receive (payout) / refund address for a leg. Bitcoin: the compressed pubkey (hex) — the P2WSH is derived once both sides are set. Required before funding. An address that RECEIVES money — the payout one, and on Bitcoin and Solana the refund one too — must be a wallet this account signed in with, one proven with the login wallet's authorisation (POST /v1/wallets/<chain> with `authorization`), or one proved from a signed-in wallet session on the web (for Bitcoin, the pubkey of such an address). A proof made with an API key alone widens what you can trade but does not count here, so a leaked key cannot redirect your money.
POST
/
v1
/
swaps
/
{id}
/
address
Set your receive (payout) / refund address for a leg
curl --request POST \
--url https://api.hashlock.markets/v1/swaps/{id}/address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"chain": "<a chain of this swap>",
"address": "<your payout address on that chain>"
}
'import requests
url = "https://api.hashlock.markets/v1/swaps/{id}/address"
payload = {
"chain": "<a chain of this swap>",
"address": "<your payout address on that chain>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
chain: '<a chain of this swap>',
address: '<your payout address on that chain>'
})
};
fetch('https://api.hashlock.markets/v1/swaps/{id}/address', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.hashlock.markets/v1/swaps/{id}/address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'chain' => '<a chain of this swap>',
'address' => '<your payout address on that chain>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.hashlock.markets/v1/swaps/{id}/address"
payload := strings.NewReader("{\n \"chain\": \"<a chain of this swap>\",\n \"address\": \"<your payout address on that chain>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.hashlock.markets/v1/swaps/{id}/address")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"chain\": \"<a chain of this swap>\",\n \"address\": \"<your payout address on that chain>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/swaps/{id}/address")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"chain\": \"<a chain of this swap>\",\n \"address\": \"<your payout address on that chain>\"\n}"
response = http.request(request)
puts response.read_body{
"swap": {
"id": "<string>",
"threadId": "<string>",
"status": "<string>",
"makerId": "<string>",
"takerId": "<string>",
"initiatorUserId": "<string>",
"hashlock": "<string>",
"aAssetId": "<string>",
"aChain": "<string>",
"aAmount": "<string>",
"aTimelock": "2023-11-07T05:31:56Z",
"bAssetId": "<string>",
"bChain": "<string>",
"bAmount": "<string>",
"bTimelock": "2023-11-07T05:31:56Z",
"rfqId": "<string>",
"secretCiphertext": "<string>",
"meta": {},
"feeBps": 123,
"feeAmount": "<string>",
"feeAssetId": "<string>",
"aPayoutAddress": "<string>",
"aClaimTo": "<string>",
"aRefundAddress": "<string>",
"aHtlcAddress": "<string>",
"aFundTx": "<string>",
"aFundOutpoints": [
{
"txid": "<string>",
"vout": 123,
"value": 123
}
],
"aClaimTx": "<string>",
"aRefundTx": "<string>",
"bPayoutAddress": "<string>",
"bClaimTo": "<string>",
"bRefundAddress": "<string>",
"bHtlcAddress": "<string>",
"bFundTx": "<string>",
"bFundOutpoints": [
{
"txid": "<string>",
"vout": 123,
"value": 123
}
],
"bClaimTx": "<string>",
"bRefundTx": "<string>",
"timeline": {
"fundA": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"fundB": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"reveal": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"payoutA": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
},
"payoutB": {
"openedAt": "2023-11-07T05:31:56Z",
"deadline": "2023-11-07T05:31:56Z",
"doneAt": "2023-11-07T05:31:56Z",
"sentAt": "2023-11-07T05:31:56Z",
"heldAt": "2023-11-07T05:31:56Z",
"shortAt": "2023-11-07T05:31:56Z",
"unverifiedAt": "2023-11-07T05:31:56Z"
}
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Body
application/json