core-lightning/doc/schemas/lightning-listfunds.json
Rusty Russell b327bd30c3 doc: fix all JSON schemas to enforce no additional properties.
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>
2024-10-30 15:39:12 +10:30

408 lines
12 KiB
JSON

{
"$schema": "../rpc-schema-draft.json",
"type": "object",
"rpc": "listfunds",
"title": "Command showing all funds currently managed by the Core Lightning node",
"description": [
"The **listfunds** RPC command displays all funds available, either in unspent outputs (UTXOs) in the internal wallet or funds locked in currently open channels."
],
"categories": [
"readonly"
],
"request": {
"required": [],
"additionalProperties": false,
"properties": {
"spent": {
"type": "boolean",
"description": [
"If True, then the *outputs* will include spent outputs in addition to the unspent ones."
],
"default": "False"
}
}
},
"response": {
"required": [
"outputs",
"channels"
],
"additionalProperties": false,
"properties": {
"outputs": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true,
"required": [
"txid",
"output",
"amount_msat",
"scriptpubkey",
"status",
"reserved"
],
"properties": {
"txid": {
"type": "txid",
"description": [
"The ID of the spendable transaction."
]
},
"output": {
"type": "u32",
"description": [
"The index within *txid*."
]
},
"amount_msat": {
"type": "msat",
"description": [
"The amount of the output."
]
},
"scriptpubkey": {
"type": "hex",
"description": [
"The scriptPubkey of the output."
]
},
"address": {
"type": "string",
"description": [
"The bitcoin address of the output."
]
},
"redeemscript": {
"type": "hex",
"description": [
"The redeemscript, only if it's p2sh-wrapped."
]
},
"status": {
"type": "string",
"enum": [
"unconfirmed",
"confirmed",
"spent",
"immature"
]
},
"reserved": {
"type": "boolean",
"description": [
"Whether this UTXO is currently reserved for an in-flight tx."
]
}
},
"allOf": [
{
"if": {
"additionalProperties": true,
"properties": {
"status": {
"type": "string",
"enum": [
"confirmed"
]
}
}
},
"then": {
"additionalProperties": false,
"required": [
"blockheight"
],
"properties": {
"txid": {},
"output": {},
"amount_msat": {},
"scriptpubkey": {},
"address": {},
"value": {},
"redeemscript": {},
"status": {},
"reserved": {},
"reserved_to_block": {},
"blockheight": {
"type": "u32",
"description": [
"Block height where it was confirmed."
]
}
}
}
},
{
"if": {
"additionalProperties": true,
"properties": {
"reserved": {
"type": "boolean",
"enum": [
"true"
]
}
}
},
"then": {
"additionalProperties": false,
"required": [
"reserved_to_block"
],
"properties": {
"txid": {},
"output": {},
"amount_msat": {},
"scriptpubkey": {},
"address": {},
"value": {},
"redeemscript": {},
"status": {},
"blockheight": {},
"reserved": {},
"reserved_to_block": {
"type": "u32",
"description": [
"Block height where reservation will expire."
]
}
}
}
}
]
}
},
"channels": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true,
"required": [
"peer_id",
"our_amount_msat",
"amount_msat",
"funding_txid",
"funding_output",
"connected",
"state",
"channel_id"
],
"properties": {
"peer_id": {
"type": "pubkey",
"description": [
"The peer with which the channel is opened."
]
},
"our_amount_msat": {
"type": "msat",
"description": [
"Available satoshis on our node's end of the channel."
]
},
"amount_msat": {
"type": "msat",
"description": [
"Total channel value."
]
},
"funding_txid": {
"type": "txid",
"description": [
"Funding transaction id."
]
},
"funding_output": {
"type": "u32",
"description": [
"The 0-based index of the output in the funding transaction."
]
},
"connected": {
"type": "boolean",
"description": [
"Whether the channel peer is connected."
]
},
"state": {
"type": "string",
"enum": [
"OPENINGD",
"CHANNELD_AWAITING_LOCKIN",
"CHANNELD_NORMAL",
"CHANNELD_SHUTTING_DOWN",
"CLOSINGD_SIGEXCHANGE",
"CLOSINGD_COMPLETE",
"AWAITING_UNILATERAL",
"FUNDING_SPEND_SEEN",
"ONCHAIN",
"DUALOPEND_OPEN_INIT",
"DUALOPEND_AWAITING_LOCKIN",
"DUALOPEND_OPEN_COMMITTED",
"DUALOPEND_OPEN_COMMIT_READY"
],
"description": [
"The channel state, in particular `CHANNELD_NORMAL` means the channel can be used normally."
]
},
"channel_id": {
"type": "hash",
"description": [
"The full channel_id (funding txid Xored with output number)."
],
"added": "v23.05"
}
},
"allOf": [
{
"if": {
"additionalProperties": true,
"properties": {
"state": {
"type": "string",
"enum": [
"CHANNELD_NORMAL"
]
}
}
},
"then": {
"additionalProperties": false,
"required": [
"short_channel_id"
],
"properties": {
"peer_id": {},
"our_amount_msat": {},
"channel_sat": {},
"amount_msat": {},
"channel_total_sat": {},
"funding_txid": {},
"funding_output": {},
"connected": {},
"state": {},
"channel_id": {},
"short_channel_id": {
"type": "short_channel_id",
"description": [
"Short channel id of channel."
]
}
}
}
},
{
"if": {
"additionalProperties": true,
"properties": {
"state": {
"type": "string",
"enum": [
"CHANNELD_SHUTTING_DOWN",
"CLOSINGD_SIGEXCHANGE",
"CLOSINGD_COMPLETE",
"AWAITING_UNILATERAL",
"FUNDING_SPEND_SEEN",
"ONCHAIN"
]
}
}
},
"then": {
"additionalProperties": false,
"required": [],
"properties": {
"peer_id": {},
"our_amount_msat": {},
"channel_sat": {},
"amount_msat": {},
"channel_total_sat": {},
"funding_txid": {},
"funding_output": {},
"connected": {},
"state": {},
"channel_id": {},
"short_channel_id": {
"type": "short_channel_id",
"description": [
"Short channel id of channel (only if funding reached lockin depth before closing)."
]
}
}
}
}
]
}
}
}
},
"author": [
"Felix <<fixone@gmail.com>> is mainly responsible."
],
"see_also": [
"lightning-newaddr(7)",
"lightning-fundchannel(7)",
"lightning-withdraw(7)",
"lightning-listtransactions(7)"
],
"resources": [
"Main web site: <https://github.com/ElementsProject/lightning>"
],
"examples": [
{
"request": {
"id": "example:listfunds#1",
"method": "listfunds",
"params": {}
},
"response": {
"outputs": [
{
"txid": "9454852bb62e304ee8933662284e10bd22a7f3710c262da4c94bdcc8b05ae407",
"output": 0,
"amount_msat": 19993653000,
"scriptpubkey": "51206c27e1956acfa61e68292c80908880e813450f754132e8a2ac471a86bf1326b5",
"address": "bcrt1pdsn7r9t2e7npu6pf9jqfpzyqaqf52rm4gyew3g4vgudgd0cny66srft45s",
"status": "confirmed",
"blockheight": 103,
"reserved": false
},
{
"txid": "7547ffc11396c62852104f7100d5ca27a2b9c0d5d43d08122147b2b03eb157a5",
"output": 0,
"amount_msat": 2000000000,
"scriptpubkey": "00149fb67bfcefee6cb7db4c7e55d9c6bfd749e31d1e",
"address": "bcrt1qn7m8hl80aekt0k6v0e2an34l6ay7x8g703x07y",
"status": "confirmed",
"blockheight": 108,
"reserved": false
},
{
"txid": "737d6835ddafd515ba9e9def733bb4e4211f6053a32b1422bf1c8cc240850f96",
"output": 0,
"amount_msat": 198995073000,
"scriptpubkey": "512035f1184f6b470c9df347da62c4b28e7ec9ee10b220bac3accd22209def0036ea",
"address": "bcrt1pxhc3snmtguxfmu68mf3vfv5w0my7uy9jyzav8txdygsfmmcqxm4q0mms62",
"status": "confirmed",
"blockheight": 109,
"reserved": false
}
],
"channels": [
{
"peer_id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
"connected": true,
"state": "CHANNELD_NORMAL",
"channel_id": "252d1b0a1e57895e84137f28cf19ab2c35847e284c112fefdecc7afeaa5c1de7",
"short_channel_id": "109x1x1",
"our_amount_msat": 490518792,
"amount_msat": 1000000000,
"funding_txid": "737d6835ddafd515ba9e9def733bb4e4211f6053a32b1422bf1c8cc240850f96",
"funding_output": 1
}
]
}
}
]
}