Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

order take-sell

commandorder.take-sell
KindWrite
NeedsMOSTRO_PUBKEY, RELAYS, an existing identity, a writable store, --yes in JSON mode
PublishesOne take-sell request signed with a fresh trade key
Local writeReserves the next trade index; saves the order row
Statusesok, error, uncertain
Schemasschemas/order.take-sell.input.json, schemas/order.take-sell.output.json

Takes a sell order: you become the buyer of the sats. The name is the side of the order taken, not your side.

Invocation

mostro-cli --output json order take-sell --order UUID [--invoice INVOICE] [--amount FIAT] --yes

Replaces takesell -o ....

Input

OptionRequiredRule
--orderyesUUID of a sell order, any case
--invoicenoWhere you want to receive the sats: a BOLT-11 invoice or a Lightning address, ≤ 4096 bytes, no whitespace. Without it, the node asks for one next (add_invoice)
--amountnoInteger > 0: the fiat amount you take from a range order. The node checks the range
--yesyes in JSON

Behavior

Like order new: reserve a trade index, publish one request, wait for the correlated reply, save the order row with the trade key. The index is spent whenever the request was published and not provably refused.

If the node answers that the seller must pay first and sends no order (wait_for_seller_payment), the CLI saves a minimal local row (id, side sell, status waiting-payment, the amount if given) so later steps find the trade key; run order info to see the full order.

Success data: OrderTakeData

FieldTypeMeaning
node_pubkeyhex64The node
order_iduuidThe order taken
side"sell"The side of the order taken
next_stepenumSee below
orderOrderRecord or nullThe node’s order; null when the reply carried none
payment_requeststring or nullInvoice to pay; only with pay_hold_invoice or pay_bond_invoice
trade_indexdecimal stringIndex of the trade key used for this take
trade_pubkeyhex64Public trade key
next_stepMeaningDo
add_invoiceThe node needs your invoice for the satsorder add-invoice (the amount is in order.sats_amount)
wait_for_seller_paymentYour invoice was accepted; the seller must lock the satsWatch message list
pay_bond_invoiceA bonded node wants a taker bond firstPay payment_request; the node continues the take after
pay_hold_invoice(Only for take-buy in practice)—

Outcomes

Identical to order new, with OrderTakeData as data.

CasestatuscodeStages
Taken and savedokpublished / accepted / applied
Local failure, --yes missingerrorits codenot_attempted / unknown / not_attempted
Refused (taken by someone else, wrong amount…)errornode_refused + reasonpublished / rejected / not_attempted
Accepted, row not saveduncertainorder_not_saved (data present)published / accepted / failed
No / unusable reply, relay dropped waituncertainreply_timeout, reply_malformed, relay_read_failed, pow_requiredpublished / unknown / applied or failed
Ambiguous relaysuncertainrequest_rejectedunknown / unknown / applied or failed

reply_malformed also covers replies this CLI does not handle (for example a Cashu escrow).

After uncertain: run order info --order <id> and look at buyer_trade_pubkey and status before taking again.

Errors

Same set as order new.

Warnings

invalid_order_timestamp, invalid_event_timestamp, cleanup_incomplete.

Examples

Took a sell order without an invoice: the node asks for one next

order.take-sell/add_invoice · status ok · exit 0 · fixture

mostro-cli --output json order take-sell --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "ok",
  "data": {
    "next_step": "add_invoice",
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order": {
      "buyer_trade_pubkey": null,
      "created_at": "2026-10-16T00:00:00Z",
      "created_at_unix": "1792108800",
      "expires_at": "2026-10-17T00:00:00Z",
      "expires_at_unix": "1792195200",
      "fiat_amount": "15",
      "fiat_amount_max": null,
      "fiat_amount_min": null,
      "fiat_currency": "USD",
      "id": "00000000-0000-0000-0000-000000000001",
      "payment_method": "bank transfer",
      "premium_percent": "1",
      "sats_amount": "15000",
      "seller_trade_pubkey": null,
      "side": "sell",
      "status": "waiting-buyer-invoice"
    },
    "order_id": "00000000-0000-0000-0000-000000000001",
    "payment_request": null,
    "side": "sell",
    "trade_index": "3",
    "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "applied",
    "snapshot": null
  }
}

A bonded node asks the taker for a bond first

order.take-sell/pay_bond_invoice · status ok · exit 0 · fixture

mostro-cli --output json order take-sell --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "ok",
  "data": {
    "next_step": "pay_bond_invoice",
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order": {
      "buyer_trade_pubkey": null,
      "created_at": "2026-10-16T00:00:00Z",
      "created_at_unix": "1792108800",
      "expires_at": "2026-10-17T00:00:00Z",
      "expires_at_unix": "1792195200",
      "fiat_amount": "15",
      "fiat_amount_max": null,
      "fiat_amount_min": null,
      "fiat_currency": "USD",
      "id": "00000000-0000-0000-0000-000000000001",
      "payment_method": "bank transfer",
      "premium_percent": "1",
      "sats_amount": "15000",
      "seller_trade_pubkey": null,
      "side": "sell",
      "status": "pending"
    },
    "order_id": "00000000-0000-0000-0000-000000000001",
    "payment_request": "lnbcrt1bondinvoice",
    "side": "sell",
    "trade_index": "3",
    "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "applied",
    "snapshot": null
  }
}

Took 50 USD out of a 10-100 USD sell range order; the node asks for an invoice

order.take-sell/range_amount · status ok · exit 0 · authored

mostro-cli --output json order take-sell --order 00000000-0000-0000-0000-000000000031 --amount 50 --yes
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "ok",
  "data": {
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order_id": "00000000-0000-0000-0000-000000000031",
    "side": "sell",
    "next_step": "add_invoice",
    "order": {
      "id": "00000000-0000-0000-0000-000000000031",
      "side": "sell",
      "status": "waiting-buyer-invoice",
      "sats_amount": "52000",
      "fiat_currency": "USD",
      "fiat_amount": "50",
      "fiat_amount_min": "10",
      "fiat_amount_max": "100",
      "payment_method": "bank transfer",
      "premium_percent": "1",
      "buyer_trade_pubkey": null,
      "seller_trade_pubkey": null,
      "created_at": "2026-11-02T09:00:00Z",
      "created_at_unix": "1793610000",
      "expires_at": "2026-11-03T09:00:00Z",
      "expires_at_unix": "1793696400"
    },
    "payment_request": null,
    "trade_index": "8",
    "trade_pubkey": "f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "applied",
    "snapshot": null
  }
}

Took a sell order with an invoice: wait for the seller to pay

order.take-sell/waiting_for_seller · status ok · exit 0 · fixture

mostro-cli --output json order take-sell --order 00000000-0000-0000-0000-000000000001 --invoice lnbcrt150u1p... --yes
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "ok",
  "data": {
    "next_step": "wait_for_seller_payment",
    "node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
    "order": null,
    "order_id": "00000000-0000-0000-0000-000000000001",
    "payment_request": null,
    "side": "sell",
    "trade_index": "3",
    "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "accepted",
    "persistence": "applied",
    "snapshot": null
  }
}

An answer the CLI cannot use (for example a Cashu escrow): the take may stand

order.take-sell/reply_malformed_uncertain · status uncertain · reply_malformed · exit 1 · authored

mostro-cli --output json order take-sell --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "uncertain",
  "data": null,
  "error": {
    "code": "reply_malformed",
    "message": "The reply from the node could not be used."
  },
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "unknown",
    "persistence": "applied",
    "snapshot": null
  }
}

The order is no longer pending: invalid_order_status

order.take-sell/node_refused · status error · node_refused · exit 1 · fixture

mostro-cli --output json order take-sell --order 00000000-0000-0000-0000-000000000001 --yes
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "error",
  "data": null,
  "error": {
    "code": "node_refused",
    "message": "The node refused the request.",
    "reason": "invalid_order_status"
  },
  "warnings": [],
  "meta": {
    "publication": "published",
    "daemon_acceptance": "rejected",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

Declined at the human prompt (not reachable in JSON mode)

order.take-sell/order_declined · status error · order_declined · exit 1 · fixture

mostro-cli order take-sell --order 00000000-0000-0000-0000-000000000001
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "error",
  "data": null,
  "error": {
    "code": "order_declined",
    "message": "The order was not confirmed, so nothing was sent."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

The removed takesell spelling

order.take-sell/removed_spelling · status error · invalid_arguments · exit 2 · fixture

mostro-cli --output json takesell -o 00000000-0000-0000-0000-000000000001
{
  "schema_version": "1",
  "command": null,
  "status": "error",
  "data": null,
  "error": {
    "code": "invalid_arguments",
    "message": "The command arguments are invalid."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

JSON mode without –yes

order.take-sell/yes_required · status error · invalid_arguments · exit 2 · fixture

mostro-cli --output json order take-sell --order 00000000-0000-0000-0000-000000000001
{
  "schema_version": "1",
  "command": "order.take-sell",
  "status": "error",
  "data": null,
  "error": {
    "code": "invalid_arguments",
    "message": "The command arguments are invalid."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

Next

Buying as a taker