Appearance
Creating a swap
Endpoints
| Endpoint | Purpose |
|---|---|
GET /api/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/tokens exactly.
The response
The response carries a deposit address unique to this swap, an expiry, and the swap ID you will use to track it.
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