OX
Ordexv1.2
Executable Recipes

Operational Recipes

Follow one operation per step. Inspect request payloads, expected success envelopes, and common refusal codes side by side.

Executable Recipe

Recipe: Complete Public Ask Lifecycle

End-to-end operational recipe: build ask, publish signed PSBT, quote purchase, and preflight settlement.

01

Build Unsigned Public Ask

POST /api/ordex/orders/build

Create the unsigned PSBT committing to the seller payment output.

Executable Request (SDK)
import { OrdexClient } from '@bitcoinuniverse/ordex-sdk';

const client = new OrdexClient({ origin: 'http://localhost:8080' });

// Build Unsigned Public Ask
const res = await client.buildAsk({
  "offeredOutpoint": {
    "txid": "7b28f7a932b13c19e830e2f5b84c8a20984ef11320498a102938472910384729",
    "vout": 0
  },
  "priceSats": "150000",
  "sellerPaymentScriptHex": "001438924b8923489123049182309481230948120394",
  "assetClaim": {
    "protocol": "ordex",
    "inscriptionId": "7b28f7a932b13c19e830e2f5b84c8a20984ef11320498a102938472910384729i0"
  }
});
console.log('Result:', res);
Expected Success Response (200 OK)
{
  "orderId": "ord_pub_98a72f1029384b",
  "status": "DRAFT",
  "unsignedPsbtHex": "70736274ff010072..."
}
Common Refusal: MALFORMED_ORDER

Returned if priceSats is not an exact decimal string or outpoint is invalid.

View Refusal Specification →
02

Publish Signed Ask to Gateway

POST /api/ordex/orders/publish

Submit the seller-signed PSBT (SIGHASH_SINGLE | ANYONECANPAY) to the catalog.

Executable Request (SDK)
import { OrdexClient } from '@bitcoinuniverse/ordex-sdk';

const client = new OrdexClient({ origin: 'http://localhost:8080' });

// Publish Signed Ask to Gateway
const res = await client.publishAsk({
  "orderId": "ord_pub_98a72f1029384b",
  "signedPsbtHex": "70736274ff01007202..."
});
console.log('Result:', res);
Expected Success Response (200 OK)
{
  "orderId": "ord_pub_98a72f1029384b",
  "status": "OPEN",
  "publishedAt": "2026-09-02T16:00:00Z"
}
Common Refusal: SELLER_OUTPUT_MISSING

Returned if seller signature does not commit to the matching payment index.

View Refusal Specification →
03

Quote and Preflight Buyer Purchase

POST /api/ordex/orders/ord_pub_98a72f1029384b/preflight

Preflight the final settlement transaction to verify sat-flow and output positioning.

Executable Request (SDK)
import { OrdexClient } from '@bitcoinuniverse/ordex-sdk';

const client = new OrdexClient({ origin: 'http://localhost:8080' });

// Quote and Preflight Buyer Purchase
const res = await client.preflightOrder({
  "buyerFundingOutpoints": [
    {
      "txid": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "vout": 1,
      "valueSats": "200000"
    }
  ],
  "buyerReceiveScriptHex": "0014aabbccddeeff00112233445566778899aabbccdd"
});
console.log('Result:', res);
Expected Success Response (200 OK)
{
  "ok": true,
  "verdict": "PASS",
  "sharedIndex": 0,
  "networkFeeSats": "3500"
}
Common Refusal: SAT_FLOW_SHORTFALL

Returned if buyer funding inputs do not cover seller payment plus required network fee.

View Refusal Specification →