This commit is contained in:
boufni95 2024-09-04 15:39:02 +00:00
parent 17e00f9821
commit f2b42749b6
5 changed files with 15 additions and 12 deletions

View file

@ -652,7 +652,6 @@ The nostr server will send back a message response, and inside the body there wi
- __identifier__: _string_
- __info__: _[UserInfo](#UserInfo)_
- __max_withdrawable__: _number_
- __noffer__: _string_
### Application
- __balance__: _number_
@ -966,6 +965,7 @@ The nostr server will send back a message response, and inside the body there wi
- __max_withdrawable__: _number_
- __network_max_fee_bps__: _number_
- __network_max_fee_fixed__: _number_
- __noffer__: _string_
- __service_fee_bps__: _number_
- __userId__: _string_
- __user_identifier__: _string_

View file

@ -510,7 +510,6 @@ export type AppUser = {
identifier: string
info: UserInfo
max_withdrawable: number
noffer: string
}
export const AppUserOptionalFields: [] = []
export type AppUserOptions = OptionsBaseMessage & {
@ -518,7 +517,6 @@ export type AppUserOptions = OptionsBaseMessage & {
identifier_CustomCheck?: (v: string) => boolean
info_Options?: UserInfoOptions
max_withdrawable_CustomCheck?: (v: number) => boolean
noffer_CustomCheck?: (v: string) => boolean
}
export const AppUserValidate = (o?: AppUser, opts: AppUserOptions = {}, path: string = 'AppUser::root.'): Error | null => {
if (opts.checkOptionalsAreSet && opts.allOptionalsAreSet) return new Error(path + ': only one of checkOptionalsAreSet or allOptionalNonDefault can be set for each message')
@ -534,9 +532,6 @@ export const AppUserValidate = (o?: AppUser, opts: AppUserOptions = {}, path: st
if (typeof o.max_withdrawable !== 'number') return new Error(`${path}.max_withdrawable: is not a number`)
if (opts.max_withdrawable_CustomCheck && !opts.max_withdrawable_CustomCheck(o.max_withdrawable)) return new Error(`${path}.max_withdrawable: custom check failed`)
if (typeof o.noffer !== 'string') return new Error(`${path}.noffer: is not a string`)
if (opts.noffer_CustomCheck && !opts.noffer_CustomCheck(o.noffer)) return new Error(`${path}.noffer: custom check failed`)
return null
}
@ -2361,6 +2356,7 @@ export type UserInfo = {
max_withdrawable: number
network_max_fee_bps: number
network_max_fee_fixed: number
noffer: string
service_fee_bps: number
userId: string
user_identifier: string
@ -2372,6 +2368,7 @@ export type UserInfoOptions = OptionsBaseMessage & {
max_withdrawable_CustomCheck?: (v: number) => boolean
network_max_fee_bps_CustomCheck?: (v: number) => boolean
network_max_fee_fixed_CustomCheck?: (v: number) => boolean
noffer_CustomCheck?: (v: string) => boolean
service_fee_bps_CustomCheck?: (v: number) => boolean
userId_CustomCheck?: (v: string) => boolean
user_identifier_CustomCheck?: (v: string) => boolean
@ -2392,6 +2389,9 @@ export const UserInfoValidate = (o?: UserInfo, opts: UserInfoOptions = {}, path:
if (typeof o.network_max_fee_fixed !== 'number') return new Error(`${path}.network_max_fee_fixed: is not a number`)
if (opts.network_max_fee_fixed_CustomCheck && !opts.network_max_fee_fixed_CustomCheck(o.network_max_fee_fixed)) return new Error(`${path}.network_max_fee_fixed: custom check failed`)
if (typeof o.noffer !== 'string') return new Error(`${path}.noffer: is not a string`)
if (opts.noffer_CustomCheck && !opts.noffer_CustomCheck(o.noffer)) return new Error(`${path}.noffer: custom check failed`)
if (typeof o.service_fee_bps !== 'number') return new Error(`${path}.service_fee_bps: is not a number`)
if (opts.service_fee_bps_CustomCheck && !opts.service_fee_bps_CustomCheck(o.service_fee_bps)) return new Error(`${path}.service_fee_bps: custom check failed`)