Version Compatibility
The current SDK implementation in kaleido-sdk (TypeScript) and kaleido_sdk (Python) is v0.1.2.
Both SDKs are generated from the same Maker API and RGB Lightning Node specs, then wrapped with handwritten clients for:
client.maker for Kaleidoswap market, swap, and LSPS1 endpoints
client.rln for RGB Lightning Node wallet, channel, payment, and swap endpoints
Installation
Requirements
- Node.js 18 or higher
- TypeScript 5.x recommended
- Python 3.10 or higher
- Runtime dependencies are installed automatically
Basic Setup
import { KaleidoClient } from 'kaleido-sdk';
const client = KaleidoClient.create({
baseUrl: 'https://api.regtest.kaleidoswap.com',
});
const assets = await client.maker.listAssets();
console.log(`Found ${assets.assets.length} assets`);
KaleidoClient.create() is synchronous in both SDKs. Do not await client creation.
Configuration
TypeScript
KaleidoClient.create() accepts a KaleidoConfig object:
import { KaleidoClient, LogLevel } from 'kaleido-sdk';
const client = KaleidoClient.create({
baseUrl: 'https://api.regtest.kaleidoswap.com',
nodeUrl: 'http://localhost:3001',
apiKey: process.env.KALEIDO_API_KEY,
timeout: 30,
logLevel: LogLevel.INFO,
});
Supported config fields:
baseUrl?: Maker API base URL. Defaults to https://api.regtest.kaleidoswap.com
nodeUrl?: RGB Lightning Node URL
apiKey?: optional API key
timeout?: request timeout in seconds
logLevel?: SDK log level
logger?: custom logger implementation
Python
KaleidoClient.create() accepts keyword arguments:
import logging
from kaleido_sdk import KaleidoClient
client = KaleidoClient.create(
base_url="https://api.regtest.kaleidoswap.com",
node_url="http://localhost:3001",
api_key=None,
timeout=30.0,
max_retries=3,
cache_ttl=60,
log_level=logging.INFO,
)
Python supports the same connection settings plus:
max_retries: retry budget for the HTTP client
cache_ttl: cache TTL in seconds
log_level: standard Python logging level
Environment Variables
The SDK does not auto-load environment variables, but these names are used by the examples and work well as a convention:
| Variable | Typical use |
|---|
KALEIDO_API_URL | Maker API base URL |
KALEIDO_NODE_URL | RGB Lightning Node URL |
KALEIDO_API_KEY | API key |
import { KaleidoClient } from 'kaleido-sdk';
const client = KaleidoClient.create({
baseUrl: process.env.KALEIDO_API_URL || 'https://api.regtest.kaleidoswap.com',
nodeUrl: process.env.KALEIDO_NODE_URL,
apiKey: process.env.KALEIDO_API_KEY,
});
Available Environments
Common Maker API endpoints used in this repo:
| Environment | API URL |
|---|
| Regtest | https://api.regtest.kaleidoswap.com |
| Signet / staging | https://api.staging.kaleidoswap.com |
| Signet | https://api.signet.kaleidoswap.com |
Sub-Client Architecture
const client = KaleidoClient.create({
baseUrl: 'https://api.regtest.kaleidoswap.com',
nodeUrl: 'http://localhost:3001',
});
const pairs = await client.maker.listPairs();
if (client.hasNode()) {
const nodeInfo = await client.rln.getNodeInfo();
const channels = await client.rln.listChannels();
}
Node Configuration Checks
TypeScript exposes client.hasNode() and always returns an rln client instance. Python exposes client.has_node(), and client.rln raises NodeNotConfiguredError if node_url is missing.
if (!client.hasNode()) {
console.log('Node URL not configured; only maker operations are available');
} else {
const nodeInfo = await client.rln.getNodeInfo();
console.log(nodeInfo.pubkey);
}
First Quote
import { KaleidoClient, Layer } from 'kaleido-sdk';
const client = KaleidoClient.create();
const quote = await client.maker.getQuote({
from_asset: {
asset_id: 'BTC',
layer: Layer.BTC_LN,
amount: 100000,
},
to_asset: {
asset_id: 'USDT',
layer: Layer.RGB_LN,
},
});
console.log(quote.rfq_id);
console.log(quote.price);