draft blinded paths
This commit is contained in:
parent
541b19272c
commit
7fc314e002
13 changed files with 905 additions and 867 deletions
|
|
@ -1385,6 +1385,7 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
|
||||
### NewInvoiceRequest
|
||||
- __amountSats__: _number_
|
||||
- __blind__: _boolean_ *this field is optional
|
||||
- __expiry__: _number_ *this field is optional
|
||||
- __memo__: _string_
|
||||
- __zap__: _string_ *this field is optional
|
||||
|
|
@ -1393,6 +1394,7 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
- __invoice__: _string_
|
||||
|
||||
### OfferConfig
|
||||
- __blind__: _boolean_
|
||||
- __callback_url__: _string_
|
||||
- __createdAtUnix__: _number_
|
||||
- __default_offer__: _boolean_
|
||||
|
|
|
|||
|
|
@ -470,6 +470,7 @@ type NewAddressResponse struct {
|
|||
}
|
||||
type NewInvoiceRequest struct {
|
||||
Amountsats int64 `json:"amountSats"`
|
||||
Blind bool `json:"blind"`
|
||||
Expiry int64 `json:"expiry"`
|
||||
Memo string `json:"memo"`
|
||||
Zap string `json:"zap"`
|
||||
|
|
@ -478,6 +479,7 @@ type NewInvoiceResponse struct {
|
|||
Invoice string `json:"invoice"`
|
||||
}
|
||||
type OfferConfig struct {
|
||||
Blind bool `json:"blind"`
|
||||
Callback_url string `json:"callback_url"`
|
||||
Createdatunix int64 `json:"createdAtUnix"`
|
||||
Default_offer bool `json:"default_offer"`
|
||||
|
|
|
|||
|
|
@ -2768,15 +2768,17 @@ export const NewAddressResponseValidate = (o?: NewAddressResponse, opts: NewAddr
|
|||
|
||||
export type NewInvoiceRequest = {
|
||||
amountSats: number
|
||||
blind?: boolean
|
||||
expiry?: number
|
||||
memo: string
|
||||
zap?: string
|
||||
}
|
||||
export type NewInvoiceRequestOptionalField = 'expiry' | 'zap'
|
||||
export const NewInvoiceRequestOptionalFields: NewInvoiceRequestOptionalField[] = ['expiry', 'zap']
|
||||
export type NewInvoiceRequestOptionalField = 'blind' | 'expiry' | 'zap'
|
||||
export const NewInvoiceRequestOptionalFields: NewInvoiceRequestOptionalField[] = ['blind', 'expiry', 'zap']
|
||||
export type NewInvoiceRequestOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: NewInvoiceRequestOptionalField[]
|
||||
amountSats_CustomCheck?: (v: number) => boolean
|
||||
blind_CustomCheck?: (v?: boolean) => boolean
|
||||
expiry_CustomCheck?: (v?: number) => boolean
|
||||
memo_CustomCheck?: (v: string) => boolean
|
||||
zap_CustomCheck?: (v?: string) => boolean
|
||||
|
|
@ -2788,6 +2790,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.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 ((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`)
|
||||
|
||||
|
|
@ -2819,6 +2824,7 @@ export const NewInvoiceResponseValidate = (o?: NewInvoiceResponse, opts: NewInvo
|
|||
}
|
||||
|
||||
export type OfferConfig = {
|
||||
blind: boolean
|
||||
callback_url: string
|
||||
createdAtUnix: number
|
||||
default_offer: boolean
|
||||
|
|
@ -2834,6 +2840,7 @@ export type OfferConfig = {
|
|||
export const OfferConfigOptionalFields: [] = []
|
||||
export type OfferConfigOptions = OptionsBaseMessage & {
|
||||
checkOptionalsAreSet?: []
|
||||
blind_CustomCheck?: (v: boolean) => boolean
|
||||
callback_url_CustomCheck?: (v: string) => boolean
|
||||
createdAtUnix_CustomCheck?: (v: number) => boolean
|
||||
default_offer_CustomCheck?: (v: boolean) => boolean
|
||||
|
|
@ -2850,6 +2857,9 @@ 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 (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 (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 (opts.callback_url_CustomCheck && !opts.callback_url_CustomCheck(o.callback_url)) return new Error(`${path}.callback_url: custom check failed`)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue