Recover swaps by deriving user_id keys from an Xpub
curl --request POST \
--url https://api.satora.io/swap/recover \
--header 'Content-Type: application/json' \
--data '
{
"xpub": "<string>",
"start_index": 1
}
'import requests
url = "https://api.satora.io/swap/recover"
payload = {
"xpub": "<string>",
"start_index": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({xpub: '<string>', start_index: 1})
};
fetch('https://api.satora.io/swap/recover', 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.satora.io/swap/recover",
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([
'xpub' => '<string>',
'start_index' => 1
]),
CURLOPT_HTTPHEADER => [
"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.satora.io/swap/recover"
payload := strings.NewReader("{\n \"xpub\": \"<string>\",\n \"start_index\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
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.satora.io/swap/recover")
.header("Content-Type", "application/json")
.body("{\n \"xpub\": \"<string>\",\n \"start_index\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.satora.io/swap/recover")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"xpub\": \"<string>\",\n \"start_index\": 1\n}"
response = http.request(request)
puts response.read_body{
"complete": true,
"highest_index": 1,
"next_index": 1,
"scanned_until": 1,
"swaps": [
{
"arkade_htlc_script_version": 123,
"arkade_server_pk": "<string>",
"arkade_vhtlc_address": "<string>",
"asset_amount": 123,
"btc_htlc_address": "<string>",
"btc_htlc_script_version": 123,
"btc_refund_locktime": 123,
"created_at": "2023-11-07T05:31:56Z",
"fee_sats": 123,
"hash_lock": "<string>",
"id": "<string>",
"network": "<string>",
"sats_receive": 123,
"server_vhtlc_pk": "<string>",
"source_amount": "<string>",
"source_token": {
"chain": "Arkade",
"decimals": 1,
"name": "<string>",
"symbol": "<string>",
"token_id": "btc"
},
"status": "pending",
"target_amount": "<string>",
"target_arkade_address": "<string>",
"target_token": {
"chain": "Arkade",
"decimals": 1,
"name": "<string>",
"symbol": "<string>",
"token_id": "btc"
},
"unilateral_claim_delay": 123,
"unilateral_refund_delay": 123,
"unilateral_refund_without_receiver_delay": 123,
"vhtlc_refund_locktime": 123,
"direction": "btc_to_arkade",
"index": 1,
"arkade_claim_txid": "<string>",
"arkade_fund_txid": "<string>",
"btc_claim_txid": "<string>",
"btc_fund_txid": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Swap Management
Recover swaps by deriving user_id keys from an Xpub
This endpoint allows clients to recover their swap history after importing a mnemonic. The
client provides an Xpub they used to derive `user_id`s, and the server derives `user_id` keys at
m/9419/121923/<index> from the requested start index until the server-owned gap limit or scan
cap is reached.
POST
/
swap
/
recover
Recover swaps by deriving user_id keys from an Xpub
curl --request POST \
--url https://api.satora.io/swap/recover \
--header 'Content-Type: application/json' \
--data '
{
"xpub": "<string>",
"start_index": 1
}
'import requests
url = "https://api.satora.io/swap/recover"
payload = {
"xpub": "<string>",
"start_index": 1
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({xpub: '<string>', start_index: 1})
};
fetch('https://api.satora.io/swap/recover', 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.satora.io/swap/recover",
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([
'xpub' => '<string>',
'start_index' => 1
]),
CURLOPT_HTTPHEADER => [
"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.satora.io/swap/recover"
payload := strings.NewReader("{\n \"xpub\": \"<string>\",\n \"start_index\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
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.satora.io/swap/recover")
.header("Content-Type", "application/json")
.body("{\n \"xpub\": \"<string>\",\n \"start_index\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.satora.io/swap/recover")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"xpub\": \"<string>\",\n \"start_index\": 1\n}"
response = http.request(request)
puts response.read_body{
"complete": true,
"highest_index": 1,
"next_index": 1,
"scanned_until": 1,
"swaps": [
{
"arkade_htlc_script_version": 123,
"arkade_server_pk": "<string>",
"arkade_vhtlc_address": "<string>",
"asset_amount": 123,
"btc_htlc_address": "<string>",
"btc_htlc_script_version": 123,
"btc_refund_locktime": 123,
"created_at": "2023-11-07T05:31:56Z",
"fee_sats": 123,
"hash_lock": "<string>",
"id": "<string>",
"network": "<string>",
"sats_receive": 123,
"server_vhtlc_pk": "<string>",
"source_amount": "<string>",
"source_token": {
"chain": "Arkade",
"decimals": 1,
"name": "<string>",
"symbol": "<string>",
"token_id": "btc"
},
"status": "pending",
"target_amount": "<string>",
"target_arkade_address": "<string>",
"target_token": {
"chain": "Arkade",
"decimals": 1,
"name": "<string>",
"symbol": "<string>",
"token_id": "btc"
},
"unilateral_claim_delay": 123,
"unilateral_refund_delay": 123,
"unilateral_refund_without_receiver_delay": 123,
"vhtlc_refund_locktime": 123,
"direction": "btc_to_arkade",
"index": 1,
"arkade_claim_txid": "<string>",
"arkade_fund_txid": "<string>",
"btc_claim_txid": "<string>",
"btc_fund_txid": "<string>"
}
]
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Body
application/json
Response
Swaps recovered successfully
True when scanning stopped due to the recovery gap limit.
False means the server-side max scan cap was reached and callers may continue from
scanned_until + 1 if they are performing an explicit deep recovery.
The highest index used in any recovered swap.
Legacy compatibility field. Set to 0 when no swaps are found, which makes it ambiguous
with a real swap at index 0. New clients should use next_index instead.
Required range:
x >= 0Derivation index clients should use for the next new swap.
Equivalent to highest_index + 1 when swaps were found. When no swaps were found, this is
the requested start index.
Required range:
x >= 0Last derivation index scanned by the server.
Required range:
x >= 0List of recovered swaps with their derivation indices
The swap data
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
Show child attributes
Show child attributes