Create a single C2 (Ask) order
Creates a UI command (QR code string) for creating a single C2 (Ask) order. 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. This is an Ask order where the user sells L1 tokens (e.g., BTC, ETH) in exchange for base currency (CWEB). Validates order amounts and calculates the total cost including fees. Throws an error if l1Amount is less than minL1Amount.
The L2 contract address of the market maker contract.
Recipient information for the base currency (CWEB). Contains authentication type and address payload.
Amount of L1 tokens to sell (in smallest unit, e.g., satoshis for BTC, wei for ETH). Must be provided as a string representation of a bigint.
Minimum acceptable L1 token amount. If the actual amount received is less than this, the order will fail. Must be provided as a string representation of a bigint.
Amount of base currency (CWEB) to receive (in smallest unit, e.g., wei). Must be provided as a string representation of a bigint.
Optional unique identifier for history tracking. Used to track order creation in off-chain history systems.
Response Body
curl -X POST "https://cwap-api.coinhq.store/pactswap_cm/ui-commands/c2/createOrder" \
-H "Content-Type: application/json" \
-d '{
"contractId": "0x1234567890123456789012345678901234567890",
"baseRecipient": {
"auth": "EcdsaContract",
"payload": "020a89e0698443aaf4ecd613317d2fdf90ef73b99244182fc7bb3c6b85f375b876"
},
"l1Amount": "50000000",
"baseAmount": "1000000000000000000"
}'{
"rawTx": "string"
}Was this documentation helpful? Any suggestions?