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>
182 lines
5.9 KiB
JSON
182 lines
5.9 KiB
JSON
{
|
|
"$schema": "../rpc-schema-draft.json",
|
|
"type": "object",
|
|
"rpc": "commando",
|
|
"title": "Command to Send a Command to a Remote Peer",
|
|
"description": [
|
|
"The **commando** RPC command is a homage to bad 80s movies. It also sends a directly-connected *peer_id* a custom message, containing a request to run *method* (with an optional dictionary of *params*); generally the peer will only allow you to run a command if it has provided you with a *rune* which allows it."
|
|
],
|
|
"request": {
|
|
"required": [
|
|
"peer_id",
|
|
"method"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"peer_id": {
|
|
"type": "pubkey",
|
|
"description": [
|
|
"Peer to command."
|
|
]
|
|
},
|
|
"method": {
|
|
"type": "string",
|
|
"description": [
|
|
"Method to invoke on peer."
|
|
]
|
|
},
|
|
"params": {
|
|
"oneOf": [
|
|
{
|
|
"type": "array",
|
|
"description": [
|
|
"Array of positional parameters."
|
|
]
|
|
},
|
|
{
|
|
"type": "object",
|
|
"description": [
|
|
"Parameters for method."
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"rune": {
|
|
"type": "string",
|
|
"description": [
|
|
"Rune to authorize the command."
|
|
]
|
|
},
|
|
"filter": {
|
|
"type": "object",
|
|
"description": [
|
|
"Filter to peer to apply to any successful result."
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"required": [],
|
|
"additionalProperties": true,
|
|
"properties": {},
|
|
"pre_return_value_notes": [
|
|
"On success, the return depends on the *method* invoked."
|
|
]
|
|
},
|
|
"errors": [
|
|
"On failure, one of the following error codes may be returned:",
|
|
"",
|
|
"- -32600: Usually means peer is not connected",
|
|
"- 19535: the local commando plugin discovered an error.",
|
|
"- 19536: the remote commando plugin discovered an error.",
|
|
"- 19537: the remote commando plugin said we weren't authorized.",
|
|
"",
|
|
"It can also fail if the peer does not respond, in which case it will simply hang awaiting a response."
|
|
],
|
|
"author": [
|
|
"Rusty Russell <<rusty@rustcorp.com.au>> wrote the original Python commando.py plugin, the in-tree commando plugin, and this manual page.",
|
|
"",
|
|
"Christian Decker came up with the name \"commando\", which almost excuses his previous adoption of the name \"Eltoo\"."
|
|
],
|
|
"see_also": [
|
|
"lightning-commando-rune(7)"
|
|
],
|
|
"resources": [
|
|
"Main web site: <https://github.com/ElementsProject/lightning>"
|
|
],
|
|
"examples": [
|
|
{
|
|
"request": {
|
|
"id": "example:commando#1",
|
|
"method": "commando",
|
|
"params": {
|
|
"peer_id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
|
"rune": "_RWaZZRI7wAYU2hqlFBmYgC_dFczcpAdI_9O87YbDpg9MCZtZXRob2RebGlzdHxtZXRob2ReZ2V0fG1ldGhvZD1zdW1tYXJ5Jm1ldGhvZC9saXN0ZGF0YXN0b3Jl",
|
|
"method": "getinfo",
|
|
"params": {}
|
|
}
|
|
},
|
|
"response": {
|
|
"id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
|
"alias": "SILENTARTIST-190-g5fd2f9c-modded",
|
|
"color": "022d22",
|
|
"num_peers": 3,
|
|
"num_pending_channels": 0,
|
|
"num_active_channels": 3,
|
|
"num_inactive_channels": 1,
|
|
"address": [],
|
|
"binding": [
|
|
{
|
|
"type": "ipv4",
|
|
"address": "127.0.0.1",
|
|
"port": 41219
|
|
}
|
|
],
|
|
"version": "v24.05-190-g5fd2f9c-modded",
|
|
"blockheight": 130,
|
|
"network": "regtest",
|
|
"fees_collected_msat": 106,
|
|
"lightning-dir": "/tmp/.lightning/regtest",
|
|
"our_features": {
|
|
"init": "08a0802a8a59a1",
|
|
"node": "88a0802a8a59a1",
|
|
"channel": "",
|
|
"invoice": "02000002024100"
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:commando#2",
|
|
"method": "commando",
|
|
"params": {
|
|
"peer_id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
|
"rune": "RXgu0DD_i0wSPEZkIDyZIWL0bSAGdhvJ_GHOQdTg04A9MSZpZF4wMjY2ZTQ1OThkMWQzYzQxNWY1NyZtZXRob2Q9bGlzdHBlZXJz",
|
|
"method": "listpeers",
|
|
"params": [
|
|
"035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d"
|
|
]
|
|
}
|
|
},
|
|
"response": {
|
|
"peers": [
|
|
{
|
|
"id": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d",
|
|
"connected": true,
|
|
"num_channels": 2,
|
|
"netaddr": [
|
|
"127.0.0.1:34785"
|
|
],
|
|
"features": "08a0802a8a59a1"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"request": {
|
|
"id": "example:commando#3",
|
|
"method": "commando",
|
|
"params": {
|
|
"peer_id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
|
"rune": "QUJEYMLGgiaJvMDv_MhR2hiMKIBTbq-PrL-KxcIlirQ9MiZtZXRob2Q9cGF5JnBuYW1lYW1vdW50bXNhdDwxMDAwMA==",
|
|
"method": "pay",
|
|
"params": {
|
|
"bolt11": "lnbcrt1pn2s38zsp5lv49w44a8tvkwtkxfxwts8rnr864u59srp7sxuua3haahdhlhtrqpp5p928w8rmsg2hjeymedcn54vxhsz372qhcedgf003nmsknhx9594sdqcdserxgryv4ekxunfwp6xjmmwxqyjw5qcqp9rzjqdwjkyvjm7apxnssu4qgwhfkd67ghs6n6k48v6uqczgt88p6tky96qqq0vqqqqgqqyqqqqqpqqqqqzsqqc9qxpqysgqt5h8te9lkn0jpdkhkmlkzs80aw7mt5kdm6jxmvddkavt3vj0vakkmfcs0hsde8y8g8za46sch2lp4jxy56u8ve25sgpgcsya0vp92sgphzw570",
|
|
"amount_msat": 9900
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"destination": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
|
"payment_hash": "0954771c7b821579649bcb713a5586bc051f2817c65a84bdf19ee169dcc5a16b",
|
|
"created_at": 1722303715.008808,
|
|
"parts": 1,
|
|
"amount_msat": 9900,
|
|
"amount_sent_msat": 9900,
|
|
"payment_preimage": "f3a3b40d63e62785f537aad60f93980914c5639872c7746299a6a1228abbc303",
|
|
"status": "complete"
|
|
}
|
|
}
|
|
]
|
|
}
|