# For intent apps

A Maxy order is a signed intent. The user signs exactly what they get, a solver fills it, and a contract settles it only against a proof of the Bitcoin payment. For intent-based swap apps, order-flow routers and solver teams that want native BTC on the other side of a signed order.

## The intent

Buying BTC, the user signs one EIP-712 message with the domain `{ name: "BitcoinIntentSettler", version: "6", chainId, verifyingContract }`, where the contract is the settler on that chain. Its hash is the order id, on chain and in the API.

Its 20 fields, what each binds, and the value the API always sends: [Intent fields](https://maxy.co/docs/intent-fields). Reject a quote whose fields differ.

## Who fills it

The settler lets any solver that posts the bond commit to an order whose `designatedFiller` is the zero address; an order that names a filler takes only that one. The API names no designated filler, so each order is open to the whole network. A solver must commit within 2 hours of the quote, and pay the BTC within the order's `settlementTimeoutBlocks` of its commit: 36 Bitcoin blocks, about 6 hours, on API orders. The settler pays it only when the verifier, an on-chain Bitcoin node, accepts a proof of that payment. No Maxy server can mark a payment as made.

| Exit | Coins go to | When |
| --- | --- | --- |
| Settle | The solver | It proves it paid the BTC |
| Cancel | The user | No solver committed: the user any time, anyone after 2 hours |
| Slash | The user, plus the bond | A solver committed and did not prove within the order's `settlementTimeoutBlocks`, 36 Bitcoin blocks on API orders |
| Refund | The user | The Bitcoin deadline passed with no bond |

Pausing the settler never blocks cancel, slash or refund, so no escrow can be trapped: [Security and compliance](https://maxy.co/docs/security-and-compliance).

## What to build

1. **Quote.** `GET /quote` answers the intent as typed data in `steps`, with its `hash`: [Get a quote](https://maxy.co/docs/buy-btc#get-a-quote).
2. **Check before the wallet opens.** Compute the EIP-712 hash yourself and compare it with the step's `hash`. The SDK also compares it with the settler's own `hashIntent`; a mismatch stops the order with nothing signed: [Sign](https://maxy.co/docs/buy-btc#sign).
3. **Place it.** `POST /orders` answers the escrow transaction and its simulation. Send it only if `simulation.ok` is true, then `POST /orders/submit` with its hash so a solver starts at once: [Place the order](https://maxy.co/docs/buy-btc#place-the-order).
4. **Follow it by its hash.** `GET /status?orderId=` takes the intent hash. An order your app placed another way, straight on the settler, joins your webhooks with `POST /orders/watch`.
5. **Give the user the exits.** While no solver has committed, `POST /orders/{id}/cancel` answers the call to send. When it reads `refundable`, `GET /orders/{id}/refund` builds the refund for the user's wallet: [When it fails](https://maxy.co/docs/when-it-fails).

## Follow an order placed elsewhere

`ORDER_ID` is the intent hash, and `BASE` is as on [Get a price](https://maxy.co/docs/buy-btc#get-a-price). `GET /orders/{id}` also says when the deposit can be taken back: `refundAt`, and once a solver has committed, `refundAfterBlock`, the Bitcoin block it must pay by.

```sh
curl -s -X POST "$BASE/orders/watch" -H "x-maxy-key: $MAXY_API_KEY" -H "content-type: application/json" \
  -d "{\"orderId\": \"$ORDER_ID\", \"chainId\": 8453}"
curl -s -H "x-maxy-key: $MAXY_API_KEY" "$BASE/orders/$ORDER_ID?chainId=8453" | jq '{state, refundAt, refundAfterBlock}'
```

## Selling and Solana

Selling BTC runs the other way: the solver locks the payout in the settler first, and a proof of the user's payment releases it: [Sell BTC](https://maxy.co/docs/sell-btc). On Solana, the settlement program holds SOL escrows with its own Bitcoin node: [Pay with SOL](https://maxy.co/docs/pay-with-sol). Every contract and who can change it: [Contracts](https://maxy.co/docs/contracts). Opening an escrow from your own contract: [Opening an escrow from a contract](https://maxy.co/docs/opening-an-escrow-from-a-contract).

---
Source: https://maxy.co/docs/for-intent-apps (Maxy Docs › Maxy for your app › Use cases)
