curl --request GET \
--url https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign', 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}/legs/{leg}/presign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"kind": "claim",
"toAddress": "<string>",
"signerPubkeyHex": "<string>",
"receiverPubkeyHex": "<string>",
"inputs": [
{
"txid": "<string>",
"vout": 123,
"value": 123
}
],
"levels": [
{
"feeSats": 123,
"psbtBase64": "<string>",
"sighashHexes": [
"<string>"
]
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Bitcoin leg: build its claim (receiver) or refund (funder) to PRE-SIGN, at up to three fee levels
kind=claim (default): only the leg’s receiver, once its escrow is recorded. A claim sighash does not cover the witness, so signing it needs no secret: sign every sighashHexes entry of each level with the script’s receiver key and POST them back. When the secret is revealed the keeper inserts it and broadcasts the level the fee market needs, so the claim is paid while you are offline. kind=refund: only the initiator’s leg, by its funder, once its escrow is recorded and while the secret is not revealed and the leg not refunded — also after the deal failed; signed with the script’s sender key, valid only after the timelock. If the deal cannot complete (the secret never revealed, the other leg refunded), the keeper broadcasts it once the median time past is beyond the timelock — never after a reveal. to (optional) is where the spend pays; default: a claim pays the leg’s claimTo (a Bitcoin address sent to POST /v1/swaps//address — over /v1 one of this account’s proven wallets), else the receiver’s own wallet behind the signing key, else that key’s P2WPKH address; a refund pays the signing key’s own P2WPKH address. A claim to other than a set claimTo is refused with 409.
curl --request GET \
--url https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign', 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}/legs/{leg}/presign",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/swaps/{id}/legs/{leg}/presign")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"kind": "claim",
"toAddress": "<string>",
"signerPubkeyHex": "<string>",
"receiverPubkeyHex": "<string>",
"inputs": [
{
"txid": "<string>",
"vout": 123,
"value": 123
}
],
"levels": [
{
"feeSats": 123,
"psbtBase64": "<string>",
"sighashHexes": [
"<string>"
]
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Response
the spend to sign at each fee level