Skip to main content
POST
/
api
/
v1
/
swaps
/
orders
TypeScript SDK - Create Order
import { KaleidoClient } from '@kaleidoswap/kaleidoswap-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}`);
{
  "id": "<string>",
  "rfq_id": "<string>",
  "pay_in": "LIGHTNING",
  "status": "OPEN",
  "ln_invoice": "<string>",
  "onchain_address": "<string>",
  "rgb_recipient_id": "<string>",
  "rgb_invoice": "<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

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
rfq_id
string
required

RFQ ID cannot be empty

Minimum string length: 1
from_type
enum<string>
required

Input type: ONCHAIN or LIGHTNING

Available options:
LIGHTNING,
ONCHAIN
to_type
enum<string>
required

Output type: ONCHAIN or LIGHTNING

Available options:
LIGHTNING,
ONCHAIN
min_onchain_conf
integer | null
default:1
dest_bolt11
string | null
dest_onchain_address
string | null
dest_rgb_invoice
string | null
refund_address
string | null
email
string | null

Optional email for notifications

Response

Successful Response

id
string
required
rfq_id
string
required
pay_in
enum<string>
required
Available options:
LIGHTNING,
ONCHAIN
status
enum<string>
required
Available options:
OPEN,
PENDING_PAYMENT,
PAID,
EXECUTING,
FILLED,
CANCELLED,
EXPIRED,
FAILED,
PENDING_RATE_DECISION
ln_invoice
string | null
onchain_address
string | null
rgb_recipient_id
string | null
rgb_invoice
string | null