TypeScript SDK - Create Order
import { KaleidoClient } from 'kaleido-sdk';
const client = new KaleidoClient({
baseUrl: 'https://api.staging.kaleidoswap.com/api/v1'
});
// First get a quote
const quote = await client.quoteRequest('BTC', 'rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak', 1000000);
// Create order
const order = await client.createOrder({
rfq_id: quote.rfq_id,
from_type: 'ONCHAIN',
to_type: 'LIGHTNING',
from_asset: 'BTC',
to_asset: 'rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak',
from_amount: 1000000,
to_amount: quote.to_amount
});
console.log(`Order created: ${order.id}`);import asyncio
from kaleido_sdk import KaleidoClient, CreateOrderRequest
async def main():
async with KaleidoClient(
api_url="https://api.staging.kaleidoswap.com/api/v1"
) as client:
# First get a quote
quote = await client.get_quote(
from_asset="BTC",
to_asset="rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak",
amount=1000000
)
# Create order
order = await client.create_order(
CreateOrderRequest(
rfq_id=quote.rfq_id,
from_type="ONCHAIN",
to_type="LIGHTNING",
from_asset="BTC",
to_asset="rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak",
from_amount=1000000,
to_amount=quote.to_amount
)
)
print(f"Order created: {order.id}")
asyncio.run(main())curl --request POST \
--url https://api.signet.kaleidoswap.com/api/v1/swaps/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rfq_id": "<string>",
"min_onchain_conf": 1,
"dest_bolt11": "<string>",
"dest_onchain_address": "<string>",
"dest_rgb_invoice": "<string>",
"refund_address": "<string>",
"email": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.signet.kaleidoswap.com/api/v1/swaps/orders",
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([
'rfq_id' => '<string>',
'min_onchain_conf' => 1,
'dest_bolt11' => '<string>',
'dest_onchain_address' => '<string>',
'dest_rgb_invoice' => '<string>',
'refund_address' => '<string>',
'email' => '<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.signet.kaleidoswap.com/api/v1/swaps/orders"
payload := strings.NewReader("{\n \"rfq_id\": \"<string>\",\n \"min_onchain_conf\": 1,\n \"dest_bolt11\": \"<string>\",\n \"dest_onchain_address\": \"<string>\",\n \"dest_rgb_invoice\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"email\": \"<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.signet.kaleidoswap.com/api/v1/swaps/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rfq_id\": \"<string>\",\n \"min_onchain_conf\": 1,\n \"dest_bolt11\": \"<string>\",\n \"dest_onchain_address\": \"<string>\",\n \"dest_rgb_invoice\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.signet.kaleidoswap.com/api/v1/swaps/orders")
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 \"rfq_id\": \"<string>\",\n \"min_onchain_conf\": 1,\n \"dest_bolt11\": \"<string>\",\n \"dest_onchain_address\": \"<string>\",\n \"dest_rgb_invoice\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"rfq_id": "<string>",
"ln_invoice": "<string>",
"onchain_address": "<string>",
"rgb_recipient_id": "<string>",
"rgb_invoice": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}swap-orders
Create Swap Order
Create a new swap order with on-chain or Lightning settlement
POST
/
api
/
v1
/
swaps
/
orders
TypeScript SDK - Create Order
import { KaleidoClient } from 'kaleido-sdk';
const client = new KaleidoClient({
baseUrl: 'https://api.staging.kaleidoswap.com/api/v1'
});
// First get a quote
const quote = await client.quoteRequest('BTC', 'rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak', 1000000);
// Create order
const order = await client.createOrder({
rfq_id: quote.rfq_id,
from_type: 'ONCHAIN',
to_type: 'LIGHTNING',
from_asset: 'BTC',
to_asset: 'rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak',
from_amount: 1000000,
to_amount: quote.to_amount
});
console.log(`Order created: ${order.id}`);import asyncio
from kaleido_sdk import KaleidoClient, CreateOrderRequest
async def main():
async with KaleidoClient(
api_url="https://api.staging.kaleidoswap.com/api/v1"
) as client:
# First get a quote
quote = await client.get_quote(
from_asset="BTC",
to_asset="rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak",
amount=1000000
)
# Create order
order = await client.create_order(
CreateOrderRequest(
rfq_id=quote.rfq_id,
from_type="ONCHAIN",
to_type="LIGHTNING",
from_asset="BTC",
to_asset="rgb:im7mWgoS-4QX_1b1-DT23iPq-niObDFM-qGN7R2x-lFLJYak",
from_amount=1000000,
to_amount=quote.to_amount
)
)
print(f"Order created: {order.id}")
asyncio.run(main())curl --request POST \
--url https://api.signet.kaleidoswap.com/api/v1/swaps/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"rfq_id": "<string>",
"min_onchain_conf": 1,
"dest_bolt11": "<string>",
"dest_onchain_address": "<string>",
"dest_rgb_invoice": "<string>",
"refund_address": "<string>",
"email": "<string>"
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.signet.kaleidoswap.com/api/v1/swaps/orders",
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([
'rfq_id' => '<string>',
'min_onchain_conf' => 1,
'dest_bolt11' => '<string>',
'dest_onchain_address' => '<string>',
'dest_rgb_invoice' => '<string>',
'refund_address' => '<string>',
'email' => '<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.signet.kaleidoswap.com/api/v1/swaps/orders"
payload := strings.NewReader("{\n \"rfq_id\": \"<string>\",\n \"min_onchain_conf\": 1,\n \"dest_bolt11\": \"<string>\",\n \"dest_onchain_address\": \"<string>\",\n \"dest_rgb_invoice\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"email\": \"<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.signet.kaleidoswap.com/api/v1/swaps/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"rfq_id\": \"<string>\",\n \"min_onchain_conf\": 1,\n \"dest_bolt11\": \"<string>\",\n \"dest_onchain_address\": \"<string>\",\n \"dest_rgb_invoice\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"email\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.signet.kaleidoswap.com/api/v1/swaps/orders")
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 \"rfq_id\": \"<string>\",\n \"min_onchain_conf\": 1,\n \"dest_bolt11\": \"<string>\",\n \"dest_onchain_address\": \"<string>\",\n \"dest_rgb_invoice\": \"<string>\",\n \"refund_address\": \"<string>\",\n \"email\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"rfq_id": "<string>",
"ln_invoice": "<string>",
"onchain_address": "<string>",
"rgb_recipient_id": "<string>",
"rgb_invoice": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Settlement Types
- LIGHTNING: Instant settlement via Lightning Network
- ONCHAIN: Settlement via on-chain Bitcoin transaction
Lightning settlement is recommended for faster finality and lower fees.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
RFQ ID cannot be empty
Minimum string length:
1Input type: ONCHAIN or LIGHTNING
Available options:
LIGHTNING, ONCHAIN Output type: ONCHAIN or LIGHTNING
Available options:
LIGHTNING, ONCHAIN Optional email for notifications
Response
Successful Response
Available options:
LIGHTNING, ONCHAIN Available options:
OPEN, PENDING_PAYMENT, PAID, EXECUTING, FILLED, CANCELLED, EXPIRED, FAILED, PENDING_RATE_DECISION Was this page helpful?
⌘I