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>
300 lines
8.2 KiB
JSON
300 lines
8.2 KiB
JSON
{
|
|
"$schema": "../rpc-schema-draft.json",
|
|
"type": "object",
|
|
"added": "v23.05",
|
|
"rpc": "decodepay",
|
|
"title": "Command for decoding a bolt11 string (low-level)",
|
|
"description": [
|
|
"The **decodepay** RPC command checks and parses a *bolt11* string as specified by the BOLT 11 specification."
|
|
],
|
|
"request": {
|
|
"required": [
|
|
"bolt11"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"bolt11": {
|
|
"type": "string",
|
|
"description": [
|
|
"Bolt11 invoice to decode."
|
|
]
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": [
|
|
"Description of the invoice to decode."
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"response": {
|
|
"required": [
|
|
"currency",
|
|
"created_at",
|
|
"expiry",
|
|
"payee",
|
|
"min_final_cltv_expiry",
|
|
"payment_hash",
|
|
"signature"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"currency": {
|
|
"type": "string",
|
|
"description": [
|
|
"The BIP173 name for the currency."
|
|
]
|
|
},
|
|
"created_at": {
|
|
"type": "u64",
|
|
"description": [
|
|
"The UNIX-style timestamp of the invoice."
|
|
]
|
|
},
|
|
"expiry": {
|
|
"type": "u64",
|
|
"description": [
|
|
"The number of seconds this is valid after *timestamp*."
|
|
]
|
|
},
|
|
"payee": {
|
|
"type": "pubkey",
|
|
"description": [
|
|
"The public key of the recipient."
|
|
]
|
|
},
|
|
"amount_msat": {
|
|
"type": "msat",
|
|
"description": [
|
|
"Amount the invoice asked for."
|
|
]
|
|
},
|
|
"payment_hash": {
|
|
"type": "hash",
|
|
"description": [
|
|
"The hash of the *payment_preimage*."
|
|
]
|
|
},
|
|
"signature": {
|
|
"type": "signature",
|
|
"description": [
|
|
"Signature of the *payee* on this invoice."
|
|
]
|
|
},
|
|
"description": {
|
|
"type": "string",
|
|
"description": [
|
|
"The description of the purpose of the purchase."
|
|
]
|
|
},
|
|
"description_hash": {
|
|
"type": "hash",
|
|
"description": [
|
|
"The hash of the description, in place of *description*."
|
|
]
|
|
},
|
|
"min_final_cltv_expiry": {
|
|
"type": "u32",
|
|
"description": [
|
|
"The minimum CLTV delay for the final node."
|
|
]
|
|
},
|
|
"payment_secret": {
|
|
"type": "hash",
|
|
"description": [
|
|
"The secret to hand to the payee node."
|
|
]
|
|
},
|
|
"features": {
|
|
"type": "hex",
|
|
"description": [
|
|
"The features bitmap for this invoice."
|
|
]
|
|
},
|
|
"payment_metadata": {
|
|
"type": "hex",
|
|
"description": [
|
|
"The payment_metadata to put in the payment."
|
|
]
|
|
},
|
|
"fallbacks": {
|
|
"type": "array",
|
|
"description": [
|
|
"Onchain addresses."
|
|
],
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"type",
|
|
"hex"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"type": {
|
|
"type": "string",
|
|
"description": [
|
|
"The address type (if known)."
|
|
],
|
|
"enum": [
|
|
"P2PKH",
|
|
"P2SH",
|
|
"P2WPKH",
|
|
"P2WSH",
|
|
"P2TR"
|
|
]
|
|
},
|
|
"addr": {
|
|
"type": "string",
|
|
"description": [
|
|
"The address in appropriate format for *type*."
|
|
]
|
|
},
|
|
"hex": {
|
|
"type": "hex",
|
|
"description": [
|
|
"Raw encoded address."
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"routes": {
|
|
"type": "array",
|
|
"description": [
|
|
"Route hints to the *payee*."
|
|
],
|
|
"items": {
|
|
"type": "array",
|
|
"description": [
|
|
"Hops in the route."
|
|
],
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"pubkey",
|
|
"short_channel_id",
|
|
"fee_base_msat",
|
|
"fee_proportional_millionths",
|
|
"cltv_expiry_delta"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"pubkey": {
|
|
"type": "pubkey",
|
|
"description": [
|
|
"The public key of the node."
|
|
]
|
|
},
|
|
"short_channel_id": {
|
|
"type": "short_channel_id",
|
|
"description": [
|
|
"A channel to the next peer."
|
|
]
|
|
},
|
|
"fee_base_msat": {
|
|
"type": "msat",
|
|
"description": [
|
|
"The base fee for payments."
|
|
]
|
|
},
|
|
"fee_proportional_millionths": {
|
|
"type": "u32",
|
|
"description": [
|
|
"The parts-per-million fee for payments."
|
|
]
|
|
},
|
|
"cltv_expiry_delta": {
|
|
"type": "u32",
|
|
"description": [
|
|
"The CLTV delta across this hop."
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"extra": {
|
|
"type": "array",
|
|
"description": [
|
|
"Any extra fields we didn't know how to parse."
|
|
],
|
|
"items": {
|
|
"type": "object",
|
|
"required": [
|
|
"tag",
|
|
"data"
|
|
],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"tag": {
|
|
"type": "string",
|
|
"description": [
|
|
"The bech32 letter which identifies this field."
|
|
],
|
|
"maxLength": 1,
|
|
"minLength": 1
|
|
},
|
|
"data": {
|
|
"type": "string",
|
|
"description": [
|
|
"The bech32 data for this field."
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post_return_value_notes": [
|
|
"Technically, the *description* field is optional if a *description_hash* field is given, but in this case **decodepay** will only succeed if the optional *description* field is passed and matches the *description_hash*. In practice, these are currently unused."
|
|
]
|
|
},
|
|
"author": [
|
|
"Rusty Russell <<rusty@rustcorp.com.au>> is mainly responsible."
|
|
],
|
|
"see_also": [
|
|
"lightning-pay(7)",
|
|
"lightning-getroute(7)",
|
|
"lightning-sendpay(7)"
|
|
],
|
|
"resources": [
|
|
"[BOLT #11](https://github.com/lightning/bolts/blob/master/11-payment-encoding.md)",
|
|
"",
|
|
"Main web site: <https://github.com/ElementsProject/lightning>"
|
|
],
|
|
"examples": [
|
|
{
|
|
"request": {
|
|
"id": "example:decodepay#1",
|
|
"method": "decodepay",
|
|
"params": {
|
|
"bolt11": "lnbcrt100n1pn2s3xxsp5s4wvy67lduz0tpxzmw0x0m8z5krfn6ppeu3a9t559tcdxquqwjfqpp5r0zx30ded4lpxp7vrdxqenmwr9rqftn93dcymvmuaxpu8y5zxunqdqcdscnzgryv4ekxunfwp6xjmmwxqyjw5qcqp9rzjqgkjyd3q5dv6gllh77kygly9c3kfy0d9xwyjyxsq2nq3c83u5vw4jqqqd5qqqqgqqyqqqqqpqqqqqzsqqc9qxpqysgqyk0lnqhsl07405jsqzyyaheu3dhxdv6s498ex97yvacs04gf6carplepnh5drlse8spy8nluz4uwj78h47ez6hak9md2s8mtg6yy5tcqt8yfsj"
|
|
}
|
|
},
|
|
"response": {
|
|
"currency": "bcrt",
|
|
"created_at": 1722303686,
|
|
"expiry": 604800,
|
|
"payee": "0266e4598d1d3c415f572a8488830b60f7e744ed9235eb0b1ba93283b315c03518",
|
|
"amount_msat": 10000,
|
|
"description": "l11 description",
|
|
"min_final_cltv_expiry": 5,
|
|
"payment_secret": "855cc26bdf6f04f584c2db9e67ece2a58699e821cf23d2ae942af0d303807492",
|
|
"features": "02024100",
|
|
"routes": [
|
|
[
|
|
{
|
|
"pubkey": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59",
|
|
"short_channel_id": "109x1x1",
|
|
"fee_base_msat": 1,
|
|
"fee_proportional_millionths": 10,
|
|
"cltv_expiry_delta": 6
|
|
}
|
|
]
|
|
],
|
|
"payment_hash": "1bc468bdb96d7e1307cc1b4c0ccf6e194604ae658b704db37ce983c392823726",
|
|
"signature": "30440220259ff982f0fbfd57d25000884edf3c8b6e66b350a94f9317c4677107d509d63a022030ff219de8d1fe193c0243cffc1578e978f7afb22d5fb62edaa81f6b46884a2f"
|
|
}
|
|
}
|
|
]
|
|
}
|