bond add-invoice
command | bond.add-invoice |
| Kind | Write |
| Needs | MOSTRO_PUBKEY, RELAYS, identity, the order’s local row, --yes in JSON mode |
| Publishes | One request with the payout invoice, signed with the order’s trade key |
| Local write | None (persistence is not_attempted on success) |
| Statuses | ok, error, uncertain |
| Schemas | schemas/bond.add-invoice.input.json, schemas/bond.add-invoice.output.json |
On a bonded node, when the counterparty’s bond was slashed, part of it is owed to you.
The node asks for an invoice (message list shows next_step: add_bond_invoice with a
bond_payout_request payload); this command sends it.
Invocation
mostro-cli --output json bond add-invoice --order UUID --invoice BOLT11 --yes
Replaces addbondinvoice.
Input
| Option | Required | Rule |
|---|---|---|
--order | yes | UUID of the order whose bond was slashed |
--invoice | yes | A BOLT-11 invoice for exactly your share of the slashed bond |
--yes | yes in JSON |
Success data: BondInvoiceData
| Field | Type | Meaning |
|---|---|---|
node_pubkey | hex64 | The node |
order_id | uuid | The order |
result | "invoice_accepted" | The node accepted the invoice and pays it from its wallet |
counterparty_share_sats | decimal string or null | The share amount the node reported; null when it reported none |
trade_pubkey | hex64 | The order’s trade key |
Outcomes
| Case | status | code | Stages |
|---|---|---|---|
| Accepted | ok | published / accepted / not_attempted | |
Local failure, order_unknown | error | its code | not_attempted / unknown / not_attempted |
| Refused (wrong amount…) | error | node_refused + reason | published / rejected / not_attempted |
| No / unusable reply | uncertain | reply_timeout, reply_malformed, relay_read_failed, pow_required | published / unknown / not_attempted |
| Ambiguous relays | uncertain | request_rejected | unknown / unknown / not_attempted |
After uncertain, wait for the payout (or a new request in message list) before sending
another invoice.
Errors
invalid_arguments, configuration_*, relay_connection_failed, relay_read_failed,
internal_error, identity_*, protocol_unsupported, pow_required, request_rejected,
node_refused, order_declined, order_unknown; uncertain: reply_timeout,
reply_malformed, request_rejected, relay_read_failed, pow_required.
Warnings
invalid_event_timestamp, cleanup_incomplete.
Examples
Payout invoice for a slashed bond accepted
bond.add-invoice/invoice_accepted · status ok · exit 0 · fixture
mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000001 --invoice lnbcrt50u1p... --yes
{
"schema_version": "1",
"command": "bond.add-invoice",
"status": "ok",
"data": {
"counterparty_share_sats": "5000",
"node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
"order_id": "00000000-0000-0000-0000-000000000001",
"result": "invoice_accepted",
"trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
},
"error": null,
"warnings": [],
"meta": {
"publication": "published",
"daemon_acceptance": "accepted",
"persistence": "not_attempted",
"snapshot": null
}
}
Accepted; the node did not report the share amount
bond.add-invoice/no_share_reported · status ok · exit 0 · authored
mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000001 --invoice lnbcrt50u1p... --yes
{
"schema_version": "1",
"command": "bond.add-invoice",
"status": "ok",
"data": {
"node_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
"order_id": "00000000-0000-0000-0000-000000000001",
"result": "invoice_accepted",
"counterparty_share_sats": null,
"trade_pubkey": "c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee5"
},
"error": null,
"warnings": [],
"meta": {
"publication": "published",
"daemon_acceptance": "accepted",
"persistence": "not_attempted",
"snapshot": null
}
}
No answer: wait for the payout before sending again
bond.add-invoice/reply_timeout_uncertain · status uncertain · reply_timeout · exit 1 · fixture
mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000001 --invoice lnbcrt50u1p... --yes
{
"schema_version": "1",
"command": "bond.add-invoice",
"status": "uncertain",
"data": null,
"error": {
"code": "reply_timeout",
"message": "The node did not answer before the deadline."
},
"warnings": [],
"meta": {
"publication": "published",
"daemon_acceptance": "unknown",
"persistence": "not_attempted",
"snapshot": null
}
}
Refused with reason invalid_invoice
bond.add-invoice/node_refused · status error · node_refused · exit 1 · fixture
mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000001 --invoice lnbcrt50u1p... --yes
{
"schema_version": "1",
"command": "bond.add-invoice",
"status": "error",
"data": null,
"error": {
"code": "node_refused",
"message": "The node refused the request.",
"reason": "invalid_invoice"
},
"warnings": [],
"meta": {
"publication": "published",
"daemon_acceptance": "rejected",
"persistence": "not_attempted",
"snapshot": null
}
}
No local row for this order
bond.add-invoice/order_unknown · status error · order_unknown · exit 1 · fixture
mostro-cli --output json bond add-invoice --order 00000000-0000-0000-0000-000000000009 --invoice lnbcrt50u1p... --yes
{
"schema_version": "1",
"command": "bond.add-invoice",
"status": "error",
"data": null,
"error": {
"code": "order_unknown",
"message": "No local order has this id, so nothing was sent."
},
"warnings": [],
"meta": {
"publication": "not_attempted",
"daemon_acceptance": "unknown",
"persistence": "not_attempted",
"snapshot": null
}
}