Pact Swap
SWAPPACTSWAP Market MakerC1 (Bid) Orders APICreate a single C1 (Bid) order of UTXO type (BTC, LTC, DOGE) POST

Create a single C1 (Bid) order of UTXO type (BTC, LTC, DOGE)


Creates a UI command (QR code string) for creating a single UTXO-based C1 (Bid) order (BTC, LTC, DOGE). The UI command can be used to compose a Coinweb L2 transaction, by means of @coinweb/wallet-lib library or Coinweb Mobile Wallet (by scanning QR generated from the UI command with a camera). The L2 Transaction then can be signed and broadcasted, with the wallet-library or mobile wallet. Validates order amounts and calculates the total cost including fees. Throws an error if baseAmount is not defined or if l1Amount is less than minL1Amount.

POST
/pactswap_cm/ui-commands/c1/createOrderBtc
contractIdstring

The L2 contract address for the UTXO-based token (BTC, LTC, DOGE).

baseAmount?string

Amount of base tokens (CWEB) to spend. Required for creating the order. Must be provided as a string representation of a bigint.

l1Amountstring

Amount of L1 tokens (UTXO-based chains) to receive. For BTC, this is in satoshis.

minL1Amount?string

Minimum acceptable L1 token amount. If the actual amount received is less than this, the order will fail.

l1Addressstring

Recipient address on the L1 chain (UTXO-based chains address).

accessId?string

Optional unique identifier for history tracking. Used to track order creation in off-chain history systems.

contractOwnerFeestring

Fee paid to the contract owner (in base token units). Deprecated: Set to "0". No fee should be paid to the contract owner. Will be removed in a future version.

l1TxIdstring

The transaction ID of the L1 transaction that funds this order. This is the UTXO-based chain transaction hash.

voutnumber

The output index (vout) of the L1 transaction that will be used to fund this order.

psbtstring

Partially Signed Bitcoin Transaction (PSBT) in base64 format. This contains the transaction data needed to create the order on the L1 chain.

Response Body

curl -X POST "https://cwap-api.coinhq.store/pactswap_cm/ui-commands/c1/createOrderBtc" \
  -H "Content-Type: application/json" \
  -d '{
    "contractId": "0x6f20d1802288c90d2a044d3f7afae73fda261b27d85c0e01fdaaf3199b2c0e85",
    "l1Amount": "50000000",
    "l1Address": "bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh",
    "contractOwnerFee": "0",
    "l1TxId": "a1075db55d416d3ca199f55b6084e2115b9345e16c5cf302fc80e9d5fbf5d48d",
    "vout": 0,
    "psbt": "cHNidP8BAH0CAAAAASeaIKOgT6lALsLPHWqN6VB5J+hkZbP+uDsiXqgKAAAAAAD9////AgAAAAA="
  }'
{
  "rawTx": "string"
}

Was this documentation helpful? Any suggestions?