Create an intent
Compute a V2 intent covenant for a limit or Dutch order and get the funding instructions.
Creating an intent moves no funds. The server computes the covenant, stores its exact constructor arguments and returns where to send the sell asset. The intent becomes fillable once that UTXO is seen on-chain.
POST /api/v1/intent/create
Covenant times are chain time (MTP): the order is fillable immediately after funding and refundable duration seconds later.
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
orderType |
body | "limit" | "dutch" | "market" |
makerAddress |
body | string | yes | Cashaddr that receives the payout and refunds. Or pass makerPkh. |
sellToken |
body | string | yes | 0x for BCH, or a token category. |
buyToken |
body | string | yes | 0x for BCH, or a token category. |
sellAmount |
body | string | yes | Base units the maker will lock. |
buyAmount |
body | string | no | Limit: the covenant minimum. Dutch: used as startBuyAmount if that is omitted. |
startBuyAmount |
body | string | no | Dutch: minimum at the start of the window. |
endBuyAmount |
body | string | no | Dutch: minimum at the end. Defaults to 98% of start. |
duration |
body | number | no | Seconds. Default 3600. |
expiryTime |
body | number | no | Limit only: absolute unix expiry instead of duration. |
frontendPkh |
body | string | no | 20-byte hex. Receives the frontend share of surplus. |
userSurplusShareBps |
body | number | no | 0–10000. Share of the partner half that goes to the user. |
Funding
| Selling | Send |
|---|---|
| BCH | funding.satoshis to funding.to (the covenant address) |
| A token | funding.token.amount of funding.token.category plus funding.satoshis (1,000) to funding.to (the token-aware address) |
Warning: > Fund with
TransactionBuilderagainst the covenant's locking bytecode, and send the full amount. A short UTXO isunderfundedand can only be refunded after the deadline.
Keep the constructor args
contractName and constructorArgs fully determine the covenant. Store them if your app needs to build cancelEarly() for the maker, or to verify the address independently.