diff --git a/proto/autogenerated/client.md b/proto/autogenerated/client.md index cc4fccd3..f039792a 100644 --- a/proto/autogenerated/client.md +++ b/proto/autogenerated/client.md @@ -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_ diff --git a/proto/autogenerated/go/types.go b/proto/autogenerated/go/types.go index d9658ebb..9a4b6765 100644 --- a/proto/autogenerated/go/types.go +++ b/proto/autogenerated/go/types.go @@ -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"` diff --git a/proto/autogenerated/ts/types.ts b/proto/autogenerated/ts/types.ts index 4ead50bc..625f93bb 100644 --- a/proto/autogenerated/ts/types.ts +++ b/proto/autogenerated/ts/types.ts @@ -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`) diff --git a/proto/service/structs.proto b/proto/service/structs.proto index c42e582e..f560c86f 100644 --- a/proto/service/structs.proto +++ b/proto/service/structs.proto @@ -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{ diff --git a/src/services/main/appUserManager.ts b/src/services/main/appUserManager.ts index 419a60fa..4da8ea4b 100644 --- a/src/services/main/appUserManager.ts +++ b/src/services/main/appUserManager.ts @@ -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: "" }) } } diff --git a/src/services/main/applicationManager.ts b/src/services/main/applicationManager.ts index c134a3df..4384e343 100644 --- a/src/services/main/applicationManager.ts +++ b/src/services/main/applicationManager.ts @@ -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: "" }) }, } }