curl --request POST \
--url https://api.hashlock.markets/v1/swaps/{id}/fund-intent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"txHash": "<string>",
"from": "<string>",
"at": "<string>"
}
'import requests
url = "https://api.hashlock.markets/v1/swaps/{id}/fund-intent"
payload = {
"txHash": "<string>",
"from": "<string>",
"at": "<string>"
}
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({txHash: '<string>', from: '<string>', at: '<string>'})
};
fetch('https://api.hashlock.markets/v1/swaps/{id}/fund-intent', 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}/fund-intent",
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([
'txHash' => '<string>',
'from' => '<string>',
'at' => '<string>'
]),
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}/fund-intent"
payload := strings.NewReader("{\n \"txHash\": \"<string>\",\n \"from\": \"<string>\",\n \"at\": \"<string>\"\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}/fund-intent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"txHash\": \"<string>\",\n \"from\": \"<string>\",\n \"at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/swaps/{id}/fund-intent")
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 \"txHash\": \"<string>\",\n \"from\": \"<string>\",\n \"at\": \"<string>\"\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>"
}Reserve an EVM leg's funding, then report its broadcast
Call it WITHOUT txHash before the first transaction of an EVM leg you fund (approve or createSwap): it reserves the leg, and is refused with 409 while another funding of it is live — from any client or wallet. Call it again WITH txHash as soon as your createSwap is broadcast. While the reservation stands, every client shows the leg as on its way, and its refund address and the counterparty’s receive (payout) address on it are fixed. It is released when the escrow is recorded, or when the transaction reverts, mines without this swap’s escrow, or is not seen on chain for 30 minutes; a reservation that never names a transaction lapses after 30 minutes. Pass at (the reservation’s token) when attaching if more than one of your clients may fund. The same txHash again changes nothing.
curl --request POST \
--url https://api.hashlock.markets/v1/swaps/{id}/fund-intent \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"txHash": "<string>",
"from": "<string>",
"at": "<string>"
}
'import requests
url = "https://api.hashlock.markets/v1/swaps/{id}/fund-intent"
payload = {
"txHash": "<string>",
"from": "<string>",
"at": "<string>"
}
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({txHash: '<string>', from: '<string>', at: '<string>'})
};
fetch('https://api.hashlock.markets/v1/swaps/{id}/fund-intent', 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}/fund-intent",
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([
'txHash' => '<string>',
'from' => '<string>',
'at' => '<string>'
]),
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}/fund-intent"
payload := strings.NewReader("{\n \"txHash\": \"<string>\",\n \"from\": \"<string>\",\n \"at\": \"<string>\"\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}/fund-intent")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"txHash\": \"<string>\",\n \"from\": \"<string>\",\n \"at\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.hashlock.markets/v1/swaps/{id}/fund-intent")
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 \"txHash\": \"<string>\",\n \"from\": \"<string>\",\n \"at\": \"<string>\"\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>"
}