Appearance
Creating a swap
Endpoints
| Endpoint | Purpose |
|---|---|
GET /api/swap/tokens | Every supported token and chain |
GET /api/swap/config | Runtime configuration, including the fee percent |
GET /api/swap/pool-price/bsc-wknyx-usdt | Current BSC pool spot price |
GET /api/swap | Usage help for swap creation |
POST /api/swap | Create a swap |
Create
bash
curl -X POST https://bridge.testnet.kriptonyx.com/api/swap \
-H 'Content-Type: application/json' \
-d '{
"source_chain": "BSC",
"source_token": "USDT",
"target_chain": "KRIPTONYX",
"target_token": "KNYX",
"source_token_amount": 10,
"target_wallet": "0xYourWallet"
}'| Field | Meaning |
|---|---|
source_chain | Chain you are sending from |
source_token | Asset you are sending |
target_chain | Chain you want to receive on |
target_token | Asset you want to receive |
source_token_amount | Amount to send |
target_wallet | Where the output goes |
refund_address | Optional. Where a failed swap returns funds |
Chain and token names must match GET /api/swap/tokens exactly.
The response
HTTP 201, with the swap as created. This is the response for the worked example at the foot of this page:
json
{
"swap_id": "d6dc0570-465a-47ff-8f68-c31c7e5f7175",
"deposit_address": "0x26A59146915ED7E2CB97669Dbc04715593e02D92",
"source_chain": "KRIPTONYX",
"source_token": "KNYX",
"source_amount": "20",
"target_chain": "KRIPTONYX",
"target_token": "KUSD",
"estimated_target_amount": "1.950000",
"exchange_rate": "0.1",
"bridge_fee": "0.050000",
"bridge_fee_percent": 2.5,
"expires_at": "2026-09-18T18:43:23.535Z",
"status": "pending_deposit",
"route_type": "internal_multi_hop",
"simpleswap_public_id": null
}| Field | Meaning |
|---|---|
swap_id | Identifies the swap. Use it for every tracking call |
deposit_address | Send the source asset here. Unique to this swap |
source_chain, source_token, source_amount | What you committed to send |
target_chain, target_token | What you will receive |
estimated_target_amount | Output after the fee, at the quoted rate. An estimate: the rate locks when the deposit is detected |
exchange_rate | The quoted rate |
bridge_fee, bridge_fee_percent | The fee in target-token units, and as a percentage |
expires_at | Deposit deadline — 30 minutes after creation |
status | pending_deposit on creation |
route_type | How the bridge will route the swap |
simpleswap_public_id | Set when a SimpleSwap leg is used; otherwise null |
Amounts are strings
Every amount except bridge_fee_percent is a decimal string. Parse it with a decimal library rather than Number — see KNYX and denominations.
Three things to get right
- Send to the deposit address, not to the bridge's main address.
- Send the exact asset on the exact chain the swap expects. A USDT-on-BSC swap will not detect USDT sent on Ethereum.
- Send before the window expires. After expiry the swap moves to
swap_expiredand the address is no longer monitored.
Set a refund address
If the swap fails after you have deposited, funds return to refund_address. On chains where the sending address cannot be inferred reliably, this is the only way the bridge knows where to send them. Set it.
After depositing
The blockchain monitor polls the deposit address every 20 seconds. Once the deposit is seen, the rate locks and the rest proceeds automatically.
Follow progress by tracking the swap.
A worked example
| Swap | 20 KNYX → 1.95 KUSD |
| Route | internal_multi_hop |
| Rate / fee | 0.10 — fee 0.05 (2.50%) |
| Deposit address | 0x26A59146915ED7E2CB97669Dbc04715593e02D92 |
| Payout | 0xa8137e6ed03ed52f9bebc46c3e195092717e51aa96d8ac73787bd7cf9b614ea0 |
| Block | 6,179,202 |
| Elapsed | 82 seconds |
Lifecycle: deposit_wallet_created → source_token_deposited → rate_locked → vault_locking → vault_locked → payout_processing → target_token_sent