mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
Add type currency
for offers amount field. Eg.1.50USD
.
This commit is contained in:
parent
f100b1cdf1
commit
8615a87452
3 changed files with 46 additions and 26 deletions
|
@ -15676,10 +15676,20 @@
|
|||
},
|
||||
"stop.schema.json": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Shutdown complete"
|
||||
]
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": [
|
||||
"result"
|
||||
],
|
||||
"properties": {
|
||||
"result": {
|
||||
"type": "string",
|
||||
"added": "v24.05",
|
||||
"enum": [
|
||||
"Shutdown complete"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"txdiscard.request.json": {
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -392,6 +392,13 @@ def _extra_validator(is_request: bool):
|
|||
return True
|
||||
return is_msat_request(checker, instance)
|
||||
|
||||
def is_currency(checker, instance):
|
||||
"""currency including currency code"""
|
||||
pattern = re.compile(r'^\d+(\.\d+)?[A-Z][A-Z][A-Z]$')
|
||||
if pattern.match(instance):
|
||||
return True
|
||||
return False
|
||||
|
||||
# "msat" for request can be many forms
|
||||
if is_request:
|
||||
is_msat = is_msat_request
|
||||
|
@ -410,6 +417,7 @@ def _extra_validator(is_request: bool):
|
|||
"msat": is_msat,
|
||||
"msat_or_all": is_msat_or_all,
|
||||
"msat_or_any": is_msat_or_any,
|
||||
"currency": is_currency,
|
||||
"txid": is_txid,
|
||||
"signature": is_signature,
|
||||
"bip340sig": is_bip340sig,
|
||||
|
|
Loading…
Add table
Reference in a new issue