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

Example catalogue

120 examples: 75 fixtures from the CLI’s test suite, 14 captured from the binary, 31 authored for this book. Every one validates against the generated schema of its command (scripts/validate_examples.py).

Files are in examples/, one envelope per file, exactly as printed on stdout. examples/index.json adds the command line, exit code, title and source of each.

  • fixture: a contract case of the CLI repository (specs/*/contracts/examples.json), reproduced by its tests. Synthetic values.
  • captured: real output of mostro-cli 0.16.3, run offline.
  • authored: written for this book from the contract and validated against the schema; synthetic values.

By command

ExampleCommandStatusCodeExitSource
bond.add-invoice/invoice_accepted — Payout invoice for a slashed bond acceptedbond.add-invoiceok0fixture
bond.add-invoice/no_share_reported — Accepted; the node did not report the share amountbond.add-invoiceok0authored
bond.add-invoice/node_refused — Refused with reason invalid_invoicebond.add-invoiceerrornode_refused1fixture
bond.add-invoice/order_unknown — No local row for this orderbond.add-invoiceerrororder_unknown1fixture
bond.add-invoice/reply_timeout_uncertain — No answer: wait for the payout before sending againbond.add-invoiceuncertainreply_timeout1fixture
general/output_not_supported_dispute_list — Another legacy command asked for JSONdispute.listerroroutput_not_supported2captured
general/output_not_supported_secret — A legacy command asked for JSON: rejected before it runsaccount.trade-keyerroroutput_not_supported2fixture
general/unknown_command — An unknown command: command is nullNoneerrorinvalid_arguments2captured
message.list/identity_missing — No local identitymessage.listerroridentity_missing1fixture
message.list/identity_unreadable — The database holds no valid mnemonicmessage.listerroridentity_unreadable1authored
message.list/messages_of_a_trade — Four messages of one trade, oldest firstmessage.listok0fixture
message.list/no_messages — An empty window is a successmessage.listok0fixture
message.list/one_order — –order reads only that order’s stored key; trade_index is null when it is not among the newest 200message.listok0authored
message.list/order_unknown — –order names an order the store does not knowmessage.listerrororder_unknown1fixture
message.list/payload_kinds — A tour of the payload kinds: payment_request, peer, other, none, cant_do, bond_payout_request and a new-order to a fresh keymessage.listok0authored
message.list/read_timeout — The relays did not finish in timemessage.listerrorread_timeout1fixture
message.list/relay_connection_failed — No relay could be connectedmessage.listerrorrelay_connection_failed1fixture
message.list/removed_getdm — The removed getdm spellingNoneerrorinvalid_arguments2fixture
message.list/store_unreadable — The local database cannot be readmessage.listerrorstore_unreadable1fixture
message.list/truncated_and_keys_limited — More keys and messages than were read: truncated with a warningmessage.listok0fixture
message.list/window_out_of_range — –since above 10080 minutesmessage.listerrorinvalid_arguments2fixture
order.add-invoice/invoice_updated — A replacement invoice (for example after a failed payment) was storedorder.add-invoiceok0fixture
order.add-invoice/node_refused — Refused with reason invalid_peerorder.add-invoiceerrornode_refused1fixture
order.add-invoice/order_declined — Declined at the human promptorder.add-invoiceerrororder_declined1fixture
order.add-invoice/order_unknown — No local row for this order: nothing was sentorder.add-invoiceerrororder_unknown1fixture
order.add-invoice/payment_accepted — Invoice accepted and the seller had already paid: the order is activeorder.add-invoiceok0fixture
order.add-invoice/relay_read_failed_uncertain — A Lightning address sent; the relays dropped the wait afterwardsorder.add-invoiceuncertainrelay_read_failed1authored
order.add-invoice/removed_spelling — The removed addinvoice spellingNoneerrorinvalid_arguments2fixture
order.add-invoice/reply_malformed_uncertain — An answer that could not be usedorder.add-invoiceuncertainreply_malformed1fixture
order.add-invoice/reply_timeout_uncertain — No answer: the node may hold the invoiceorder.add-invoiceuncertainreply_timeout1fixture
order.add-invoice/stale_status — Accepted, but the local status could not be updated: ok with a warningorder.add-invoiceok0fixture
order.add-invoice/waiting_seller_payment — Invoice accepted; the seller has not paid yetorder.add-invoiceok0fixture
order.add-invoice/yes_required — JSON mode without –yesorder.add-invoiceerrorinvalid_arguments2fixture
order.cancel/cancel_accepted — The counterparty had requested a cancel: now canceled by bothorder.cancelok0fixture
order.cancel/cancel_requested — In an active trade: a cooperative cancel was startedorder.cancelok0fixture
order.cancel/canceled — A pending order canceledorder.cancelok0fixture
order.cancel/node_refused — Refused with reason order_already_canceledorder.cancelerrornode_refused1fixture
order.cancel/order_declined — Declined at the human promptorder.cancelerrororder_declined1fixture
order.cancel/reply_malformed_uncertain — An unusable answer: the cancel may have happenedorder.canceluncertainreply_malformed1fixture
order.cancel/store_unwritable — Local store not writable: nothing sentorder.cancelerrorstore_unwritable1authored
order.cancel/yes_required — JSON mode without –yesorder.cancelerrorinvalid_arguments2captured
order.fiat-sent/fiat_sent — The buyer confirmed the fiat paymentorder.fiat-sentok0fixture
order.fiat-sent/node_refused — Refused with reason invalid_pubkeyorder.fiat-senterrornode_refused1fixture
order.fiat-sent/range_key_sent — Maker of a buy range order: the step carried the next trade key (index 4)order.fiat-sentok0fixture
order.fiat-sent/removed_spelling — The removed fiatsent spellingNoneerrorinvalid_arguments2fixture
order.fiat-sent/trade_index_not_recorded — Range maker: accepted, but the reserved index 4 could not be recordedorder.fiat-sentok0authored
order.fiat-sent/yes_required — JSON mode without –yesorder.fiat-senterrorinvalid_arguments2fixture
order.info/identity_missing — No local identity: nothing was sentorder.infoerroridentity_missing1fixture
order.info/identity_missing_captured — Identity checked before any network accessorder.infoerroridentity_missing1captured
order.info/invalid_arguments — An –order value that is not a UUIDorder.infoerrorinvalid_arguments2fixture
order.info/node_refused — The node refused with reason too_many_requestsorder.infoerrornode_refused1fixture
order.info/not_found_success — The node knows none of the ids: still ok, with a warningorder.infook0fixture
order.info/own_trade_in_progress — One of your own orders mid-trade, with both trade keys knownorder.infook0authored
order.info/pow_required — The node asks for more proof of work than –pow / POWorder.infoerrorpow_required1authored
order.info/protocol_unsupported — The node advertises protocol v1 (gift wrap): nothing is publishedorder.infoerrorprotocol_unsupported1authored
order.info/removed_spelling — The removed ordersinfo spelling: unresolved command, command is nullNoneerrorinvalid_arguments2fixture
order.info/reply_malformed — A correlated answer with an unusable payloadorder.infoerrorreply_malformed1authored
order.info/reply_timeout — Published, no answer within 15 s: an error (a read is safe to repeat)order.infoerrorreply_timeout1fixture
order.info/request_rejected_ambiguous — No relay confirmed the event and one failed ambiguously: publication unknown (still an error, a read is safe to repeat)order.infoerrorrequest_rejected1authored
order.info/subset_success — Two of three orders returned; the third is listed in not_returnedorder.infook0fixture
order.list/active_with_cleanup_warning — Status filter active; relay cleanup overran its 1 s budget, which is only a warningorder.listok0authored
order.list/configuration_invalid — An unparsable node keyorder.listerrorconfiguration_invalid1captured
order.list/configuration_missing — Neither MOSTRO_PUBKEY nor RELAYS setorder.listerrorconfiguration_missing1captured
order.list/empty_success — An empty book is a success with an empty arrayorder.listok0fixture
order.list/invalid_side — An invalid –side valueorder.listerrorinvalid_arguments2fixture
order.list/large_amount_success — Sell orders in USD; the sats amount is above 2^53, which is why amounts are stringsorder.listok0fixture
order.list/mixed_book — A fixed sell order, a buy range order at market price and an order with an unrepresentable timestamporder.listok0authored
order.list/read_limit_exceeded — More than 10000 unique events: rejected rather than truncatedorder.listerrorread_limit_exceeded1authored
order.list/read_timeout — One of two relays did not finish: an error, never partial dataorder.listerrorread_timeout1fixture
order.list/relay_connection_failed — The only relay refuses connectionsorder.listerrorrelay_connection_failed1captured
order.list/relay_read_failed — A relay closed the subscription before EOSE: no partial dataorder.listerrorrelay_read_failed1authored
order.list/terminator_keeps_json — Tokens after – are not options; JSON stays selected and the stray tokens are an argument errororder.listerrorinvalid_arguments2captured
order.new/bond_to_pay — A bonded node asks the maker to pay a bond firstorder.newok0fixture
order.new/created — A market-price sell order created and savedorder.newok0fixture
order.new/fixed_buy_with_invoice — A fixed-price buy order with the buyer’s invoice attachedorder.newok0authored
order.new/identity_missing — No local identity: nothing was sentorder.newerroridentity_missing1fixture
order.new/identity_missing_captured — Write-command stages on a local failureorder.newerroridentity_missing1captured
order.new/node_refused — The node refused with reason invalid_amountorder.newerrornode_refused1fixture
order.new/order_declined — The outcome of answering n at the human prompt; a JSON caller never sees it because JSON requires –yesorder.newerrororder_declined1fixture
order.new/order_not_saved_uncertain — The node created the order but the local row could not be written; data is presentorder.newuncertainorder_not_saved1fixture
order.new/pow_required — Not enough proof of work configured: nothing sentorder.newerrorpow_required1authored
order.new/range_created — A range order 100-300 USDorder.newok0fixture
order.new/relay_read_failed_uncertain — Published, then the relays dropped the wait; recording the spent index also failedorder.newuncertainrelay_read_failed1authored
order.new/removed_spelling — The removed neworder spellingNoneerrorinvalid_arguments2fixture
order.new/reply_timeout_uncertain — Published, no answer: the order may exist; the trade index was spentorder.newuncertainreply_timeout1fixture
order.new/request_rejected_error — Every relay explicitly rejected the event: provably nothing sent, a plain errororder.newerrorrequest_rejected1authored
order.new/request_rejected_uncertain — Relays answered ambiguously: the event may be out there; the index was spentorder.newuncertainrequest_rejected1authored
order.new/store_unwritable — The database is read-only, so the index cannot be reserved: nothing sentorder.newerrorstore_unwritable1authored
order.new/yes_required — JSON mode without –yes is an argument error; nothing is doneorder.newerrorinvalid_arguments2fixture
order.release/node_refused — Refused with reason invalid_peerorder.releaseerrornode_refused1fixture
order.release/order_unknown — No local row for this orderorder.releaseerrororder_unknown1fixture
order.release/range_continued — Maker of a sell range order released; the node creates a child order: run order syncorder.releaseok0fixture
order.release/relay_read_failed_uncertain_range — Range maker released, the wait failed; the index reserved for the child was recordedorder.releaseuncertainrelay_read_failed1authored
order.release/released — The seller released the satsorder.releaseok0fixture
order.release/reply_timeout_uncertain — No answer: the sats may have been released. Do not resend blindlyorder.releaseuncertainreply_timeout1fixture
order.release/stale_status — Released, local status not updated: ok with local_status_staleorder.releaseok0fixture
order.sync/adopted_child — After a range release: the child order announced to trade key 4 gets a local roworder.syncok0authored
order.sync/identity_missing — No local identityorder.syncerroridentity_missing1captured
order.sync/nothing_to_adopt — Nothing new: idempotent second run, nothing writtenorder.syncok0authored
order.sync/order_not_saved_uncertain — One row saved, the next failed: data lists what was savedorder.syncuncertainorder_not_saved1authored
order.sync/since_out_of_range — –since must be 1..10080order.syncerrorinvalid_arguments2captured
order.sync/store_unwritable — A child was due but the store cannot be writtenorder.syncerrorstore_unwritable1authored
order.take-buy/identity_missing — No local identityorder.take-buyerroridentity_missing1fixture
order.take-buy/invalid_uuid — –order is not a UUIDorder.take-buyerrorinvalid_arguments2captured
order.take-buy/order_not_saved_uncertain — Accepted by the node, local row not written; data still carries the hold invoiceorder.take-buyuncertainorder_not_saved1fixture
order.take-buy/pay_bond_invoice — A bonded node asks the taker for a bond before the hold invoiceorder.take-buyok0authored
order.take-buy/pay_hold_invoice — Took a buy order: as the seller, pay the hold invoiceorder.take-buyok0fixture
order.take-buy/reply_timeout_uncertain — Published, no answer: the take may have happenedorder.take-buyuncertainreply_timeout1fixture
order.take-buy/request_rejected_uncertain — Ambiguous relay answers; recording the spent index failed tooorder.take-buyuncertainrequest_rejected1authored
order.take-sell/add_invoice — Took a sell order without an invoice: the node asks for one nextorder.take-sellok0fixture
order.take-sell/node_refused — The order is no longer pending: invalid_order_statusorder.take-sellerrornode_refused1fixture
order.take-sell/order_declined — Declined at the human prompt (not reachable in JSON mode)order.take-sellerrororder_declined1fixture
order.take-sell/pay_bond_invoice — A bonded node asks the taker for a bond firstorder.take-sellok0fixture
order.take-sell/range_amount — Took 50 USD out of a 10-100 USD sell range order; the node asks for an invoiceorder.take-sellok0authored
order.take-sell/removed_spelling — The removed takesell spellingNoneerrorinvalid_arguments2fixture
order.take-sell/reply_malformed_uncertain — An answer the CLI cannot use (for example a Cashu escrow): the take may standorder.take-selluncertainreply_malformed1authored
order.take-sell/waiting_for_seller — Took a sell order with an invoice: wait for the seller to payorder.take-sellok0fixture
order.take-sell/yes_required — JSON mode without –yesorder.take-sellerrorinvalid_arguments2fixture
schema/discovery — The full discovery document (all commands, inputs, outputs)schemaok0captured
schema/invalid_arguments — schema takes no optionsschemaerrorinvalid_arguments2captured

General

Another legacy command asked for JSON

general/output_not_supported_dispute_list · status error · output_not_supported · exit 2 · captured

mostro-cli --output json listdisputes
{
  "schema_version": "1",
  "command": "dispute.list",
  "status": "error",
  "data": null,
  "error": {
    "code": "output_not_supported",
    "message": "This command does not support JSON output."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

A legacy command asked for JSON: rejected before it runs

general/output_not_supported_secret · status error · output_not_supported · exit 2 · fixture

mostro-cli --output json getlasttradeprivkey
{
  "schema_version": "1",
  "command": "account.trade-key",
  "status": "error",
  "data": null,
  "error": {
    "code": "output_not_supported",
    "message": "This command does not support JSON output."
  },
  "warnings": [],
  "meta": {
    "publication": "not_attempted",
    "daemon_acceptance": "unknown",
    "persistence": "not_attempted",
    "snapshot": null
  }
}

An unknown command: command is null

general/unknown_command · status error · invalid_arguments · exit 2 · captured

mostro-cli --output json unknowncmd
{
  "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
  }
}