clink exp and desc

This commit is contained in:
boufni95 2025-09-16 18:16:35 +00:00
parent e62e6473db
commit 8b0e56f215
8 changed files with 23 additions and 10 deletions

View file

@ -1393,6 +1393,7 @@ The nostr server will send back a message response, and inside the body there wi
### NewInvoiceRequest
- __amountSats__: _number_
- __expiry__: _number_ *this field is optional
- __memo__: _string_
- __zap__: _string_ *this field is optional

View file

@ -466,6 +466,7 @@ type NewAddressResponse struct {
}
type NewInvoiceRequest struct {
Amountsats int64 `json:"amountSats"`
Expiry int64 `json:"expiry"`
Memo string `json:"memo"`
Zap string `json:"zap"`
}

View file

@ -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`)

View file

@ -379,7 +379,6 @@ message AddAppUserInvoiceRequest {
optional string offer_string = 6;
optional bool rejectUnauthorized = 7;
optional string token = 8;
}
message GetAppUserRequest {
@ -450,6 +449,7 @@ message NewInvoiceRequest{
int64 amountSats = 1;
string memo = 2;
optional string zap = 3;
optional int64 expiry = 4;
}
message NewInvoiceResponse{