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 mine

commandorder.mine
KindLocal read
NeedsAn existing identity. No MOSTRO_PUBKEY, RELAYS, stdin or --yes
PublishesNothing; contacts no relay or node
Local writeNone
Statusesok, error
Schemasschemas/order.mine.input.json, schemas/order.mine.output.json

Lists the orders of the local store: the ones you made, took, or adopted with order sync (range children included), with the trade index and key of each. It answers “which orders does this store know?” without asking the node.

Invocation

mostro-cli --output json order mine

Input

None. Any option of its own is invalid_arguments (exit 2). Root options such as --mostro-pubkey or --relays are accepted and ignored.

Behavior

  1. Opens the store read-only (MCLI_DIR, else .mcli in the home directory) and reads every row of its orders table.
  2. The store keeps each order’s trade key but not its index. The index is found by deriving the keys of the recorded indexes, newest first, as message list does (the newest 200), and matching them.
  3. Sorts newest first: by trade index, highest first (each order or take reserves the next index). Rows whose index is unknown come after, by creation time, newest first, then by id.

status is the local status, as the store recorded it when this CLI last changed it. It is not refreshed from the node; ask order info for the node’s view.

Success data: OrderMineData

FieldTypeMeaning
ordersarray of MineOrderThe rows of the store, newest first; empty when there are none

MineOrder

FieldTypeMeaning
iduuidOrder id
sidebuy | sellSide of the order
statusstatusThe local status (see above)
trade_indexdecimal string or nullIndex of the order’s trade key; null when the key is not among the newest 200 derived or the row has no key
trade_pubkeyhex64 or nullPublic key of the order’s trade key; null when the row has no usable key

No private key, mnemonic or invoice is included.

Outcomes

CasestatuscodeStages
Rows read (possibly none)oknot_applicable ×3
No data directory, no mcli.db, or no user rowerroridentity_missingnot_applicable ×3
The store, or a row’s id, side or status, cannot be readerrorstore_unreadablenot_applicable ×3
An option was givenerrorinvalid_arguments (exit 2)not_applicable ×3

Errors

invalid_arguments, identity_missing, store_unreadable, internal_error. Nothing is created or changed in any case.

Warnings

trade_keys_limited when a row has a key whose index is unknown and older keys than the newest 200 were not derived. The schema also lists invalid_event_timestamp and cleanup_incomplete, which this command does not emit.

Examples

A key older than the newest 200: index unknown, with trade_keys_limited

order.mine/key_older_than_derived · status ok · exit 0 · fixture

mostro-cli --output json order mine
{
  "schema_version": "1",
  "command": "order.mine",
  "status": "ok",
  "data": {
    "orders": [
      {
        "id": "00000000-0000-0000-0000-000000000002",
        "side": "sell",
        "status": "success",
        "trade_index": null,
        "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
      },
      {
        "id": "00000000-0000-0000-0000-000000000003",
        "side": "sell",
        "status": "canceled",
        "trade_index": null,
        "trade_pubkey": null
      }
    ]
  },
  "error": null,
  "warnings": [
    {
      "code": "trade_keys_limited",
      "message": "Trade keys older than the newest 200 were not read."
    }
  ],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

An identity with no orders yet

order.mine/no_orders · status ok · exit 0 · fixture

mostro-cli --output json order mine
{
  "schema_version": "1",
  "command": "order.mine",
  "status": "ok",
  "data": {
    "orders": []
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

Two local orders, highest trade index first

order.mine/orders_newest_first · status ok · exit 0 · fixture

mostro-cli --output json order mine
{
  "schema_version": "1",
  "command": "order.mine",
  "status": "ok",
  "data": {
    "orders": [
      {
        "id": "00000000-0000-0000-0000-000000000005",
        "side": "sell",
        "status": "pending",
        "trade_index": "3",
        "trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
      },
      {
        "id": "00000000-0000-0000-0000-000000000001",
        "side": "buy",
        "status": "waiting-payment",
        "trade_index": "1",
        "trade_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
      }
    ]
  },
  "error": null,
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

No local store

order.mine/identity_missing · status error · identity_missing · exit 1 · fixture

mostro-cli --output json order mine
{
  "schema_version": "1",
  "command": "order.mine",
  "status": "error",
  "data": null,
  "error": {
    "code": "identity_missing",
    "message": "No local identity exists."
  },
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

The orders table or a row cannot be read

order.mine/store_unreadable · status error · store_unreadable · exit 1 · fixture

mostro-cli --output json order mine
{
  "schema_version": "1",
  "command": "order.mine",
  "status": "error",
  "data": null,
  "error": {
    "code": "store_unreadable",
    "message": "The local store cannot be read."
  },
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

order mine takes no options

order.mine/invalid_arguments · status error · invalid_arguments · exit 2 · fixture

mostro-cli --output json order mine --bogus
{
  "schema_version": "1",
  "command": "order.mine",
  "status": "error",
  "data": null,
  "error": {
    "code": "invalid_arguments",
    "message": "The command arguments are invalid."
  },
  "warnings": [],
  "meta": {
    "publication": "not_applicable",
    "daemon_acceptance": "not_applicable",
    "persistence": "not_applicable",
    "snapshot": null
  }
}

Next

order info for the node’s current state of these orders; message list for what the node sent to their trade keys.