Synthetic USD
Create swap
POST
/synthetic-usd/swapPrivateSwap inAmount between your BTC and synthetic USD balances. BTC to USD swaps fill at the best bid, USD to BTC swaps at the best ask (see GET /synthetic-usd/best-price). Returns the swap with the amount received.
Permissions: synthetic-usd:write
application/json- body
inAsset*stringAsset to swap from
Value in
"BTC""USD"outAsset*stringAsset to swap to
Value in
"BTC""USD"inAmount*numberAmount to swap (in satoshis if BTC, in dollars if USD)
OK
application/json- response
id*stringSwap ID
Match
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Format
uuidinAmount*numberAmount to swap (in satoshis if BTC, in dollars with 2 decimal places if USD)
Range
0 < valueinAsset*stringAsset to swap from
Value in
"BTC""USD"outAmount*numberAmount received after conversion (in satoshis if BTC, in dollars with 2 decimal places if USD)
Range
0 < valueoutAsset*stringAsset to swap to
Value in
"BTC""USD"import { createHttpClient } from '@ln-markets/sdk/rest/v3'
const client = createHttpClient({
key: 'your-key',
secret: 'your-secret',
passphrase: 'your-passphrase',
})
const result = await client.syntheticUsd.newSwap({
inAsset: 'BTC',
outAsset: 'USD',
inAmount: 1337
}){
"id": "550e8400-e29b-41d4-a716-446655440000",
"inAmount": 1337,
"inAsset": "BTC",
"outAmount": 0.5969,
"outAsset": "USD"
}