optional blind

This commit is contained in:
boufni95 2025-10-06 17:56:13 +00:00
parent 86efd923d6
commit a93aafc8ee
3 changed files with 8 additions and 7 deletions

View file

@ -1394,7 +1394,7 @@ The nostr server will send back a message response, and inside the body there wi
- __invoice__: _string_ - __invoice__: _string_
### OfferConfig ### OfferConfig
- __blind__: _boolean_ - __blind__: _boolean_ *this field is optional
- __callback_url__: _string_ - __callback_url__: _string_
- __createdAtUnix__: _number_ - __createdAtUnix__: _number_
- __default_offer__: _boolean_ - __default_offer__: _boolean_

View file

@ -2824,7 +2824,7 @@ export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvo
} }
export type OfferConfig = { export type OfferConfig = {
blind: boolean blind?: boolean
callback_url: string callback_url: string
createdAtUnix: number createdAtUnix: number
default_offer: boolean default_offer: boolean
@ -2837,10 +2837,11 @@ export type OfferConfig = {
token: string token: string
updatedAtUnix: number updatedAtUnix: number
} }
export const OfferConfigOptionalFields: [] = [] export type OfferConfigOptionalField = 'blind'
export const OfferConfigOptionalFields: OfferConfigOptionalField[] = ['blind']
export type OfferConfigOptions = OptionsBaseMessage & { export type OfferConfigOptions = OptionsBaseMessage & {
checkOptionalsAreSet?: [] checkOptionalsAreSet?: OfferConfigOptionalField[]
blind_CustomCheck?: (v: boolean) => boolean blind_CustomCheck?: (v?: boolean) => boolean
callback_url_CustomCheck?: (v: string) => boolean callback_url_CustomCheck?: (v: string) => boolean
createdAtUnix_CustomCheck?: (v: number) => boolean createdAtUnix_CustomCheck?: (v: number) => boolean
default_offer_CustomCheck?: (v: boolean) => boolean default_offer_CustomCheck?: (v: boolean) => boolean
@ -2857,7 +2858,7 @@ export const OfferConfigValidate = (o?: OfferConfig, opts: OfferConfigOptions =
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message') if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null') if (typeof o !== 'object' || o === null) return new Error(path + ': object is not an instance of an object or is null')
if (typeof o.blind !== 'boolean') return new Error(`${path}.blind: is not a boolean`) if ((o.blind || opts.allOptionalsAreSet || opts.checkOptionalsAreSet?.includes('blind')) && typeof o.blind !== 'boolean') return new Error(`${path}.blind: is not a boolean`)
if (opts.blind_CustomCheck && !opts.blind_CustomCheck(o.blind)) return new Error(`${path}.blind: custom check failed`) if (opts.blind_CustomCheck && !opts.blind_CustomCheck(o.blind)) return new Error(`${path}.blind: custom check failed`)
if (typeof o.callback_url !== 'string') return new Error(`${path}.callback_url: is not a string`) if (typeof o.callback_url !== 'string') return new Error(`${path}.callback_url: is not a string`)

View file

@ -786,7 +786,7 @@ message OfferConfig {
bool rejectUnauthorized = 9; bool rejectUnauthorized = 9;
int64 createdAtUnix = 10; int64 createdAtUnix = 10;
int64 updatedAtUnix = 11; int64 updatedAtUnix = 11;
bool blind = 12; optional bool blind = 12;
} }
message UserOffers { message UserOffers {