Accept the current terms — COMMITS, and cannot be undone
curl --request POST \
--url https://api.hashlock.markets/v1/threads/{id}/accept \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"quoteAmount": "<the current price, base units — GET /v1/threads/{id}>",
"hashlock": "<sha256(secret), 32-byte hex>"
}
'import requests
url = "https://api.hashlock.markets/v1/threads/{id}/accept"
payload = {
"quoteAmount": "<the current price, base units — GET /v1/threads/{id}>",
"hashlock": "<sha256(secret), 32-byte hex>"
}
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({
quoteAmount: '<the current price, base units — GET /v1/threads/{id}>',
hashlock: '<sha256(secret), 32-byte hex>'
})
};
fetch('https://api.hashlock.markets/v1/threads/{id}/accept', 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/threads/{id}/accept",
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([
'quoteAmount' => '<the current price, base units — GET /v1/threads/{id}>',
'hashlock' => '<sha256(secret), 32-byte hex>'
]),
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/threads/{id}/accept"
payload := strings.NewReader("{\n \"quoteAmount\": \"<the current price, base units — GET /v1/threads/{id}>\",\n \"hashlock\": \"<sha256(secret), 32-byte hex>\"\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/threads/{id}/accept")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"quoteAmount\": \"<the current price, base units — GET /v1/threads/{id}>\",\n \"hashlock\": \"<sha256(secret), 32-byte hex>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/threads/{id}/accept")
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 \"quoteAmount\": \"<the current price, base units — GET /v1/threads/{id}>\",\n \"hashlock\": \"<sha256(secret), 32-byte hex>\"\n}"
response = http.request(request)
puts response.read_body{
"thread": {
"id": "<string>",
"rfqId": "<string>",
"takerId": "<string>",
"makerId": "<string>",
"status": "open",
"takerAccepted": true,
"makerAccepted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"currentQuoteAmount": "<string>",
"pendingAmount": "<string>",
"pendingBy": "<string>",
"hashlock": "<string>",
"counterpartyName": "<string>",
"counterpartyPicture": {},
"counterpartyStats": {
"swaps": 123,
"deals": 123,
"walkedAway": 123,
"fundSeconds": 123,
"revealSeconds": 123,
"fundSamples": 123,
"revealSamples": 123,
"since": "2023-11-07T05:31:56Z"
}
},
"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>"
}Negotiation
Accept the current terms — COMMITS, and cannot be undone
Name the price you are accepting: it is refused if the terms moved since you read the thread. The initiator (funds the long leg) also passes hashlock = sha256(secret); when BOTH sides accept, the swap is created.
POST
/
v1
/
threads
/
{id}
/
accept
Accept the current terms — COMMITS, and cannot be undone
curl --request POST \
--url https://api.hashlock.markets/v1/threads/{id}/accept \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"quoteAmount": "<the current price, base units — GET /v1/threads/{id}>",
"hashlock": "<sha256(secret), 32-byte hex>"
}
'import requests
url = "https://api.hashlock.markets/v1/threads/{id}/accept"
payload = {
"quoteAmount": "<the current price, base units — GET /v1/threads/{id}>",
"hashlock": "<sha256(secret), 32-byte hex>"
}
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({
quoteAmount: '<the current price, base units — GET /v1/threads/{id}>',
hashlock: '<sha256(secret), 32-byte hex>'
})
};
fetch('https://api.hashlock.markets/v1/threads/{id}/accept', 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/threads/{id}/accept",
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([
'quoteAmount' => '<the current price, base units — GET /v1/threads/{id}>',
'hashlock' => '<sha256(secret), 32-byte hex>'
]),
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/threads/{id}/accept"
payload := strings.NewReader("{\n \"quoteAmount\": \"<the current price, base units — GET /v1/threads/{id}>\",\n \"hashlock\": \"<sha256(secret), 32-byte hex>\"\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/threads/{id}/accept")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"quoteAmount\": \"<the current price, base units — GET /v1/threads/{id}>\",\n \"hashlock\": \"<sha256(secret), 32-byte hex>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/threads/{id}/accept")
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 \"quoteAmount\": \"<the current price, base units — GET /v1/threads/{id}>\",\n \"hashlock\": \"<sha256(secret), 32-byte hex>\"\n}"
response = http.request(request)
puts response.read_body{
"thread": {
"id": "<string>",
"rfqId": "<string>",
"takerId": "<string>",
"makerId": "<string>",
"status": "open",
"takerAccepted": true,
"makerAccepted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"currentQuoteAmount": "<string>",
"pendingAmount": "<string>",
"pendingBy": "<string>",
"hashlock": "<string>",
"counterpartyName": "<string>",
"counterpartyPicture": {},
"counterpartyStats": {
"swaps": 123,
"deals": 123,
"walkedAway": 123,
"fundSeconds": 123,
"revealSeconds": 123,
"fundSamples": 123,
"revealSamples": 123,
"since": "2023-11-07T05:31:56Z"
}
},
"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>"
}Authorizations
Body
application/json