clink exp and desc
This commit is contained in:
parent
e62e6473db
commit
8b0e56f215
8 changed files with 23 additions and 10 deletions
|
|
@ -2743,14 +2743,16 @@ export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddr
|
|||
|
||||
export type NewInvoiceRequest = {
|
||||
amountSats: number
|
||||
expiry?: number
|
||||
memo: string
|
||||
zap?: string
|
||||
}
|
||||
export type NewInvoiceRequestOptionalField = 'zap'
|
||||
export const NewInvoiceRequestOptionalFields: NewInvoiceRequestOptionalField[] = ['zap']
|
||||
export type NewInvoiceRequestOptionalField = 'expiry' | 'zap'
|
||||
export const NewInvoiceRequestOptionalFields: NewInvoiceRequestOptionalField[] = ['expiry', 'zap']
|
||||
export type NewInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: NewInvoiceRequestOptionalField[]
|
||||
amountSats_CustomCheck?: (v: number) => boolean
|
||||
expiry_CustomCheck?: (v?: number) => boolean
|
||||
memo_CustomCheck?: (v: string) => boolean
|
||||
zap_CustomCheck?: (v?: string) => boolean
|
||||
}
|
||||
|
|
@ -2761,6 +2763,9 @@ export const NewInvoiceRequestValidate = (o?: NewInvoiceRequest, opts: NewInvoic
|
|||
if (typeof o.amountSats !== 'number') return new Error(`${path}.amountSats: is not a number`)
|
||||
if (opts.amountSats_CustomCheck && !opts.amountSats_CustomCheck(o.amountSats)) return new Error(`${path}.amountSats: custom check failed`)
|
||||
|
||||
if ((o.expiry || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('expiry')) && typeof o.expiry !== 'number') return new Error(`${path}.expiry: is not a number`)
|
||||
if (opts.expiry_CustomCheck && !opts.expiry_CustomCheck(o.expiry)) return new Error(`${path}.expiry: custom check failed`)
|
||||
|
||||
if (typeof o.memo !== 'string') return new Error(`${path}.memo: is not a string`)
|
||||
if (opts.memo_CustomCheck && !opts.memo_CustomCheck(o.memo)) return new Error(`${path}.memo: custom check failed`)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue