mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 09:54:16 +01:00
b327bd30c3
Without this, we have hardly any enforcement. This is why the schema mistake fixed in the previous patches weren't spotted immediately. The hard work was done by: ``` $ for f in lightning-*.json; do grep -v '^ "additionalProperties": false,' $f | bagto $f; done $ for f in lightning-*.json; do sed 's/"properties": {/"additionalProperties": false, "properties": {/' $f | bagto $f; done $ make fmt-schemas ``` Then checking where 'additionalProperties: true' had been turned to false (we deliberately use it in some places where there are if statements in the schema, or occasionally where there can be arbitrary fields). [Including doc/rpc-schema-draft.json update by Shahana] Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
242 lines
9.3 KiB
JSON
242 lines
9.3 KiB
JSON
{
|
|
"$schema": "../rpc-schema-draft.json",
|
|
"type": "object",
|
|
"rpc": "invoice",
|
|
"title": "Command for accepting payments",
|
|
"description": [
|
|
"The **invoice** RPC command creates the expectation of a payment of a given amount of milli-satoshi: it returns a unique token which another lightning daemon can use to pay this invoice. This token includes a *route hint* description of an incoming channel with capacity to pay the invoice, if any exists."
|
|
],
|
|
"request": {
|
|
"required": [
|
|
"amount_msat",
|
|
"label",
|
|
"description"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"amount_msat": {
|
|
"type": "msat_or_any",
|
|
"description": [
|
|
"The string `any`, which creates an invoice that can be paid with any amount. Otherwise it is a positive value in millisatoshi precision; it can be a whole number, or a whole number ending in *msat* or *sat*, or a number with three decimal places ending in *sat*, or a number with 1 to 11 decimal places ending in *btc*."
|
|
]
|
|
},
|
|
"label": {
|
|
"oneOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "integer"
|
|
}
|
|
],
|
|
"description": [
|
|
"A unique string or number (which is treated as a string, so `01` is different from `1`); it is never revealed to other nodes on the lightning network, but it can be used to query the status of this invoice."
|
|
]
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": [
|
|
"A short description of purpose of payment, e.g. *1 cup of coffee*. This value is encoded into the BOLT11 invoice and is viewable by any node you send this invoice to (unless *deschashonly* is true as described below). It must be UTF-8, and cannot use *\\u* JSON escape codes."
|
|
]
|
|
},
|
|
"expiry": {
|
|
"type": "u64",
|
|
"description": [
|
|
"The time the invoice is valid for, in seconds. If no value is provided the default of 604800 (1 week) is used."
|
|
]
|
|
},
|
|
"fallbacks": {
|
|
"type": "array",
|
|
"description": [
|
|
"One or more fallback addresses to include in the invoice (in order from most- preferred to least): note that these arrays are not currently tracked to fulfill the invoice."
|
|
],
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"preimage": {
|
|
"type": "hex",
|
|
"description": [
|
|
"A 64-digit hex string to be used as payment preimage for the created invoice. By default, if unspecified, lightningd will generate a secure pseudorandom preimage seeded from an appropriate entropy source on your system. **IMPORTANT**: if you specify the *preimage*, you are responsible, to ensure appropriate care for generating using a secure pseudorandom generator seeded with sufficient entropy, and keeping the preimage secret. This parameter is an advanced feature intended for use with cutting-edge cryptographic protocols and should not be used unless explicitly needed."
|
|
]
|
|
},
|
|
"exposeprivatechannels": {
|
|
"description": [
|
|
"If specified, it overrides the default route hint logic, which will use unpublished channels only if there are no published channels."
|
|
],
|
|
"oneOf": [
|
|
{
|
|
"type": "boolean",
|
|
"description": [
|
|
"If *True* unpublished channels are always considered as a route hint candidate; if *False*, never."
|
|
]
|
|
},
|
|
{
|
|
"type": "array",
|
|
"description": [
|
|
"Array of short channel ids (or a remote alias), only those specific channels will be considered candidates, even if they are public or dead-ends."
|
|
],
|
|
"items": {
|
|
"type": "short_channel_id"
|
|
}
|
|
},
|
|
{
|
|
"type": "short_channel_id",
|
|
"description": [
|
|
"If it is a short channel id (e.g. *1x1x3*), only this specific channel will be considered candidate, even if it is public or dead-end."
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"cltv": {
|
|
"type": "u32",
|
|
"description": [
|
|
"If specified, sets the *min_final_cltv_expiry* for the invoice. Otherwise, it's set to the parameter **cltv-final**."
|
|
]
|
|
},
|
|
"deschashonly": {
|
|
"type": "boolean",
|
|
"description": [
|
|
"If True, then the bolt11 returned contains a hash of the *description*, rather than the *description* itself: this allows much longer descriptions, but they must be communicated via some other mechanism."
|
|
],
|
|
"default": "False"
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"required": [
|
|
"payment_hash",
|
|
"expires_at",
|
|
"created_index",
|
|
"bolt11",
|
|
"payment_secret"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"bolt11": {
|
|
"type": "string",
|
|
"description": [
|
|
"The bolt11 string."
|
|
]
|
|
},
|
|
"payment_hash": {
|
|
"type": "hash",
|
|
"description": [
|
|
"The hash of the *payment_preimage* which will prove payment."
|
|
]
|
|
},
|
|
"payment_secret": {
|
|
"type": "secret",
|
|
"description": [
|
|
"The *payment_secret* to place in the onion."
|
|
]
|
|
},
|
|
"expires_at": {
|
|
"type": "u64",
|
|
"description": [
|
|
"UNIX timestamp of when invoice expires."
|
|
]
|
|
},
|
|
"created_index": {
|
|
"type": "u64",
|
|
"added": "v23.08",
|
|
"description": [
|
|
"1-based index indicating order this invoice was created in."
|
|
]
|
|
},
|
|
"warning_capacity": {
|
|
"type": "string",
|
|
"description": [
|
|
"Even using all possible channels, there's not enough incoming capacity to pay this invoice."
|
|
]
|
|
},
|
|
"warning_offline": {
|
|
"type": "string",
|
|
"description": [
|
|
"There would be enough incoming capacity, but some channels are offline, so there isn't."
|
|
]
|
|
},
|
|
"warning_deadends": {
|
|
"type": "string",
|
|
"description": [
|
|
"There would be enough incoming capacity, but some channels are dead-ends (no other public channels from those peers), so there isn't."
|
|
]
|
|
},
|
|
"warning_private_unused": {
|
|
"type": "string",
|
|
"description": [
|
|
"There would be enough incoming capacity, but some channels are unannounced and *exposeprivatechannels* is *false*, so there isn't."
|
|
]
|
|
},
|
|
"warning_mpp": {
|
|
"type": "string",
|
|
"description": [
|
|
"There is sufficient capacity, but not in a single channel, so the payer will have to use multi-part payments."
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"errors": [
|
|
"On failure, an error is returned and no invoice is created. If the",
|
|
"lightning process fails before responding, the caller should use",
|
|
"lightning-listinvoices(7) to query whether this invoice was created or",
|
|
"not.",
|
|
"",
|
|
"The following error codes may occur:",
|
|
"",
|
|
"- -1: Catchall nonspecific error.",
|
|
"- 900: An invoice with the given *label* already exists.",
|
|
"- 901: An invoice with the given *preimage* already exists.",
|
|
"- 902: None of the specified *exposeprivatechannels* were usable."
|
|
],
|
|
"author": [
|
|
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
|
|
],
|
|
"see_also": [
|
|
"lightning-listinvoices(7)",
|
|
"lightning-delinvoice(7)",
|
|
"lightning-pay(7)"
|
|
],
|
|
"resources": [
|
|
"Main web site: <https://github.com/ElementsProject/lightning>"
|
|
],
|
|
"examples": [
|
|
{
|
|
"request": {
|
|
"id": "example:invoice#1",
|
|
"method": "invoice",
|
|
"params": {
|
|
"amount_msat": 10000,
|
|
"label": "lbl_l31",
|
|
"description": "Invoice description l31"
|
|
}
|
|
},
|
|
"response": {
|
|
"payment_hash": "d598cfc62da16b381b8fb8af9833a24005f730e54cc32c317fecc511ffc6d2a2",
|
|
"expires_at": 1722908474,
|
|
"bolt11": "lnbcrt100n1pn2s396sp5v3en0qa3rrljw4m0wtz88sx99q20rarufhjpfysefhwhs42gvqjqpp56kvvl33d594nsxu0hzhesvazgqzlwv89fnpjcvtlanz3rl7x623qdp9f9h8vmmfvdjjqer9wd3hy6tsw35k7m3qdsenzxqyjw5qcqp9rzjqgkjyd3q5dv6gllh77kygly9c3kfy0d9xwyjyxsq2nq3c83u5vw4jqqqduqqqqgqqqqqqqqpqqqqqzsqqc9qxpqysgq7za6z8kx2k5nul45zwttfz2njx3836v69mxqsl4ty9228pyjrkfnkymysy8ygsrrje9qf6j4tpalt5qkqusfp2esrsqc5ak7t4yzajgpezef54",
|
|
"payment_secret": "64733783b118ff27576f72c473c0c52814f1f47c4de41492194ddd7855486024",
|
|
"created_index": 2
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:invoice#2",
|
|
"method": "invoice",
|
|
"params": {
|
|
"amount_msat": "50000msat",
|
|
"label": "lbl_l32",
|
|
"description": "l32 description"
|
|
}
|
|
},
|
|
"response": {
|
|
"payment_hash": "788aea729ede48d315a199ce5ded76169601a61dd52e9734e707eb7c52e4e79e",
|
|
"expires_at": 1722908474,
|
|
"bolt11": "lnbcrt500n1pn2s396sp5h5tz6fpm3dxvrlwcnwmfq85v45wfj43mdmplpce6ku2vmfdhrx5qpp50z9w5u57meydx9dpn889mmtkz6tqrfsa65hfwd88ql4hc5hyu70qdqcdsenygryv4ekxunfwp6xjmmwxqyjw5qcqp9rzjqgkjyd3q5dv6gllh77kygly9c3kfy0d9xwyjyxsq2nq3c83u5vw4jqqqduqqqqgqqqqqqqqpqqqqqzsqqc9qxpqysgqt5m8qx0t25a0gygya7u4sxulyyp2dec87pwsxuuwtg0u66c07703g9j6vlwgmlhqk7qgn95qw7allhnuj2m9hf0xkcr2zkaxltv3t6gqjcdpll",
|
|
"payment_secret": "bd162d243b8b4cc1fdd89bb6901e8cad1c99563b6ec3f0e33ab714cda5b719a8",
|
|
"created_index": 3
|
|
}
|
|
}
|
|
]
|
|
}
|