core-lightning/doc/schemas/delinvoice.schema.json
2022-04-02 09:46:01 +10:30

184 lines
4.4 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"required": [
"label",
"payment_hash",
"status",
"expires_at"
],
"additionalProperties": true,
"properties": {
"label": {
"type": "string",
"description": "Unique label given at creation time"
},
"bolt11": {
"type": "string",
"description": "BOLT11 string"
},
"bolt12": {
"type": "string",
"description": "BOLT12 string"
},
"msatoshi": {
"deprecated": "true"
},
"amount_msat": {
"type": "msat",
"description": "the amount required to pay this invoice"
},
"description": {
"type": "string",
"description": "description used in the invoice"
},
"payment_hash": {
"type": "hash",
"description": "the hash of the *payment_preimage* which will prove payment",
"maxLength": 64,
"minLength": 64
},
"status": {
"type": "string",
"description": "State of invoice",
"enum": [
"paid",
"expired",
"unpaid"
]
},
"expires_at": {
"type": "u64",
"description": "UNIX timestamp when invoice expires (or expired)"
}
},
"allOf": [
{
"if": {
"required": [
"bolt12"
]
},
"then": {
"required": [],
"additionalProperties": false,
"properties": {
"label": {},
"bolt12": {},
"status": {},
"expires_at": {},
"msatoshi": {},
"amount_msat": {},
"description": {},
"payment_hash": {},
"pay_index": {},
"amount_received_msat": {},
"paid_at": {},
"payment_preimage": {},
"local_offer_id": {
"type": "hex",
"description": "offer for which this invoice was created"
},
"payer_note": {
"type": "string",
"description": "the optional *payer_note* from invoice_request which created this invoice"
}
}
},
"else": {
"required": [
"bolt11"
],
"additionalProperties": false,
"properties": {
"label": {},
"bolt11": {},
"status": {},
"expires_at": {},
"msatoshi": {},
"amount_msat": {},
"description": {},
"payment_hash": {},
"pay_index": {},
"amount_received_msat": {},
"msatoshi_received": {},
"paid_at": {},
"payment_preimage": {}
}
}
},
{
"if": {
"properties": {
"status": {
"type": "string",
"enum": [
"paid"
]
}
}
},
"then": {
"additionalProperties": false,
"required": [
"pay_index",
"amount_received_msat",
"paid_at",
"payment_preimage"
],
"properties": {
"label": {},
"bolt11": {},
"bolt12": {},
"status": {},
"expires_at": {},
"msatoshi": {},
"amount_msat": {},
"description": {},
"payment_hash": {},
"payer_note": {},
"local_offer_id": {},
"pay_index": {
"type": "u64",
"description": "unique index for this invoice payment"
},
"amount_received_msat": {
"type": "msat",
"description": "how much was actually received"
},
"msatoshi_received": {
"deprecated": "true"
},
"paid_at": {
"type": "u64",
"description": "UNIX timestamp of when payment was received"
},
"payment_preimage": {
"type": "secret",
"description": "SHA256 of this is the *payment_hash* offered in the invoice",
"maxLength": 64,
"minLength": 64
}
}
},
"else": {
"additionalProperties": false,
"properties": {
"label": {},
"bolt11": {},
"bolt12": {},
"status": {},
"msatoshi": {},
"amount_msat": {},
"description": {},
"payment_hash": {},
"expires_at": {},
"pay_index": {},
"payer_note": {},
"local_offer_id": {}
}
}
}
]
}