UserInfo includes ndebit
This commit is contained in:
parent
bed397e424
commit
143fe44589
6 changed files with 15 additions and 4 deletions
|
|
@ -1042,6 +1042,7 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
### UserInfo
|
||||
- __balance__: _number_
|
||||
- __max_withdrawable__: _number_
|
||||
- __ndebit__: _string_
|
||||
- __network_max_fee_bps__: _number_
|
||||
- __network_max_fee_fixed__: _number_
|
||||
- __noffer__: _string_
|
||||
|
|
|
|||
|
|
@ -456,6 +456,7 @@ type UseInviteLinkRequest struct {
|
|||
type UserInfo struct {
|
||||
Balance int64 `json:"balance"`
|
||||
Max_withdrawable int64 `json:"max_withdrawable"`
|
||||
Ndebit string `json:"ndebit"`
|
||||
Network_max_fee_bps int64 `json:"network_max_fee_bps"`
|
||||
Network_max_fee_fixed int64 `json:"network_max_fee_fixed"`
|
||||
Noffer string `json:"noffer"`
|
||||
|
|
|
|||
|
|
@ -2575,6 +2575,7 @@ export const UseInviteLinkRequestValidate = (o?: UseInviteLinkRequest, opts: Use
|
|||
export type UserInfo = {
|
||||
balance: number
|
||||
max_withdrawable: number
|
||||
ndebit: string
|
||||
network_max_fee_bps: number
|
||||
network_max_fee_fixed: number
|
||||
noffer: string
|
||||
|
|
@ -2587,6 +2588,7 @@ export type UserInfoOptions = OptionsBaseMessage & {
|
|||
checkOptionalsAreSet?: []
|
||||
balance_CustomCheck?: (v: number) => boolean
|
||||
max_withdrawable_CustomCheck?: (v: number) => boolean
|
||||
ndebit_CustomCheck?: (v: string) => boolean
|
||||
network_max_fee_bps_CustomCheck?: (v: number) => boolean
|
||||
network_max_fee_fixed_CustomCheck?: (v: number) => boolean
|
||||
noffer_CustomCheck?: (v: string) => boolean
|
||||
|
|
@ -2604,6 +2606,9 @@ export const UserInfoValidate = (o?: UserInfo, opts: UserInfoOptions = {}, path:
|
|||
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.ndebit !== 'string') return new Error(`${path}.ndebit: is not a string`)
|
||||
if (opts.ndebit_CustomCheck && !opts.ndebit_CustomCheck(o.ndebit)) return new Error(`${path}.ndebit: custom check failed`)
|
||||
|
||||
if (typeof o.network_max_fee_bps !== 'number') return new Error(`${path}.network_max_fee_bps: is not a number`)
|
||||
if (opts.network_max_fee_bps_CustomCheck && !opts.network_max_fee_bps_CustomCheck(o.network_max_fee_bps)) return new Error(`${path}.network_max_fee_bps: custom check failed`)
|
||||
|
||||
|
|
|
|||
|
|
@ -354,6 +354,7 @@ message UserInfo{
|
|||
int64 network_max_fee_bps = 6;
|
||||
int64 network_max_fee_fixed = 7;
|
||||
string noffer = 8;
|
||||
string ndebit = 9;
|
||||
}
|
||||
|
||||
message GetUserOperationsRequest{
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ export default class {
|
|||
network_max_fee_bps: this.settings.lndSettings.feeRateBps,
|
||||
network_max_fee_fixed: this.settings.lndSettings.feeFixedLimit,
|
||||
service_fee_bps: this.settings.outgoingAppUserInvoiceFeeBps,
|
||||
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: appUser.identifier, priceType: PriceType.spontaneous, relay: "" })
|
||||
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: appUser.identifier, priceType: PriceType.spontaneous, relay: "" }),
|
||||
ndebit: encodeNdebit({ pubkey: app.nostr_public_key!, pointerId: appUser.identifier, relay: "" })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { ApplicationUser } from '../storage/entity/ApplicationUser.js'
|
|||
import { PubLogger, getLogger } from '../helpers/logger.js'
|
||||
import crypto from 'crypto'
|
||||
import { Application } from '../storage/entity/Application.js'
|
||||
import { encodeNoffer, PriceType } from '../../custom-nip19.js'
|
||||
import { encodeNdebit, encodeNoffer, PriceType } from '../../custom-nip19.js'
|
||||
|
||||
const TOKEN_EXPIRY_TIME = 2 * 60 * 1000 // 2 minutes, in milliseconds
|
||||
|
||||
|
|
@ -159,7 +159,8 @@ export default class {
|
|||
network_max_fee_bps: this.settings.lndSettings.feeRateBps,
|
||||
network_max_fee_fixed: this.settings.lndSettings.feeFixedLimit,
|
||||
service_fee_bps: this.settings.outgoingAppUserInvoiceFeeBps,
|
||||
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: u.identifier, priceType: PriceType.spontaneous, relay: "" })
|
||||
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: u.identifier, priceType: PriceType.spontaneous, relay: "" }),
|
||||
ndebit: encodeNdebit({ pubkey: app.nostr_public_key!, pointerId: u.identifier, relay: "" })
|
||||
|
||||
},
|
||||
max_withdrawable: this.paymentManager.GetMaxPayableInvoice(u.user.balance_sats, true)
|
||||
|
|
@ -199,7 +200,8 @@ export default class {
|
|||
network_max_fee_bps: this.settings.lndSettings.feeRateBps,
|
||||
network_max_fee_fixed: this.settings.lndSettings.feeFixedLimit,
|
||||
service_fee_bps: this.settings.outgoingAppUserInvoiceFeeBps,
|
||||
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: user.identifier, priceType: PriceType.spontaneous, relay: "" })
|
||||
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: user.identifier, priceType: PriceType.spontaneous, relay: "" }),
|
||||
ndebit: encodeNdebit({ pubkey: app.nostr_public_key!, pointerId: user.identifier, relay: "" })
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue