nmanage in user info
This commit is contained in:
parent
df088bf0fe
commit
acfe5099e6
7 changed files with 16 additions and 6 deletions
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -13,7 +13,7 @@
|
|||
"@protobuf-ts/grpc-transport": "^2.9.4",
|
||||
"@protobuf-ts/plugin": "^2.5.0",
|
||||
"@protobuf-ts/runtime": "^2.5.0",
|
||||
"@shocknet/clink-sdk": "^1.1.6",
|
||||
"@shocknet/clink-sdk": "^1.1.7",
|
||||
"@stablelib/xchacha20": "^1.0.1",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^17.0.31",
|
||||
|
|
@ -591,9 +591,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@shocknet/clink-sdk": {
|
||||
"version": "1.1.6",
|
||||
"resolved": "https://registry.npmjs.org/@shocknet/clink-sdk/-/clink-sdk-1.1.6.tgz",
|
||||
"integrity": "sha512-PXNXdaS5sFIgfdWV5yMW0/ghrORAEVTy9K3fY4j/Rf4fjbNspBAaDioYn7to+lU/boPUxRMmFE0ix/2Mr6pkFQ==",
|
||||
"version": "1.1.7",
|
||||
"resolved": "https://registry.npmjs.org/@shocknet/clink-sdk/-/clink-sdk-1.1.7.tgz",
|
||||
"integrity": "sha512-9qr2WWalrPyi9ZoIsA2oEeQM3fWMCrVarghIStvkd/HoIR7oFjuHl+OUMLwvPxWXuCRIqnyRmXu970JVO8fx7Q==",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@noble/hashes": "^1.8.0",
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
"@protobuf-ts/grpc-transport": "^2.9.4",
|
||||
"@protobuf-ts/plugin": "^2.5.0",
|
||||
"@protobuf-ts/runtime": "^2.5.0",
|
||||
"@shocknet/clink-sdk": "^1.1.6",
|
||||
"@shocknet/clink-sdk": "^1.1.7",
|
||||
"@stablelib/xchacha20": "^1.0.1",
|
||||
"@types/express": "^4.17.21",
|
||||
"@types/node": "^17.0.31",
|
||||
|
|
|
|||
|
|
@ -1557,6 +1557,7 @@ The nostr server will send back a message response, and inside the body there wi
|
|||
- __ndebit__: _string_
|
||||
- __network_max_fee_bps__: _number_
|
||||
- __network_max_fee_fixed__: _number_
|
||||
- __nmanage__: _string_
|
||||
- __noffer__: _string_
|
||||
- __service_fee_bps__: _number_
|
||||
- __userId__: _string_
|
||||
|
|
|
|||
|
|
@ -660,6 +660,7 @@ type UserInfo struct {
|
|||
Ndebit string `json:"ndebit"`
|
||||
Network_max_fee_bps int64 `json:"network_max_fee_bps"`
|
||||
Network_max_fee_fixed int64 `json:"network_max_fee_fixed"`
|
||||
Nmanage string `json:"nmanage"`
|
||||
Noffer string `json:"noffer"`
|
||||
Service_fee_bps int64 `json:"service_fee_bps"`
|
||||
Userid string `json:"userId"`
|
||||
|
|
|
|||
|
|
@ -3795,6 +3795,7 @@ export type UserInfo = {
|
|||
ndebit: string
|
||||
network_max_fee_bps: number
|
||||
network_max_fee_fixed: number
|
||||
nmanage: string
|
||||
noffer: string
|
||||
service_fee_bps: number
|
||||
userId: string
|
||||
|
|
@ -3810,6 +3811,7 @@ export type UserInfoOptions = OptionsBaseMessage & {
|
|||
ndebit_CustomCheck?: (v: string) => boolean
|
||||
network_max_fee_bps_CustomCheck?: (v: number) => boolean
|
||||
network_max_fee_fixed_CustomCheck?: (v: number) => boolean
|
||||
nmanage_CustomCheck?: (v: string) => boolean
|
||||
noffer_CustomCheck?: (v: string) => boolean
|
||||
service_fee_bps_CustomCheck?: (v: number) => boolean
|
||||
userId_CustomCheck?: (v: string) => boolean
|
||||
|
|
@ -3840,6 +3842,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.nmanage !== 'string') return new Error(`${path}.nmanage: is not a string`)
|
||||
if (opts.nmanage_CustomCheck && !opts.nmanage_CustomCheck(o.nmanage)) return new Error(`${path}.nmanage: 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`)
|
||||
|
||||
|
|
|
|||
|
|
@ -529,6 +529,7 @@ message UserInfo{
|
|||
string ndebit = 9;
|
||||
string callback_url = 10;
|
||||
string bridge_url = 11;
|
||||
string nmanage = 12;
|
||||
}
|
||||
message GetUserOperationsRequest{
|
||||
int64 latestIncomingInvoice = 1;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import { PubLogger, getLogger } from '../helpers/logger.js'
|
|||
import crypto from 'crypto'
|
||||
import { Application } from '../storage/entity/Application.js'
|
||||
import { ZapInfo } from '../storage/entity/UserReceivingInvoice.js'
|
||||
import { nofferEncode, ndebitEncode, OfferPriceType } from '@shocknet/clink-sdk'
|
||||
import { nofferEncode, ndebitEncode, OfferPriceType, nmanageEncode } from '@shocknet/clink-sdk'
|
||||
const TOKEN_EXPIRY_TIME = 2 * 60 * 1000 // 2 minutes, in milliseconds
|
||||
|
||||
type NsecLinkingData = {
|
||||
|
|
@ -163,6 +163,7 @@ export default class {
|
|||
service_fee_bps: this.settings.outgoingAppUserInvoiceFeeBps,
|
||||
noffer: nofferEncode({ pubkey: app.nostr_public_key!, offer: u.identifier, priceType: OfferPriceType.Spontaneous, relay: nostrSettings.relays[0] }),
|
||||
ndebit: ndebitEncode({ pubkey: app.nostr_public_key!, pointer: u.identifier, relay: nostrSettings.relays[0] }),
|
||||
nmanage: nmanageEncode({ pubkey: app.nostr_public_key!, pointer: u.identifier, relay: nostrSettings.relays[0] }),
|
||||
callback_url: u.callback_url,
|
||||
bridge_url: this.settings.bridgeUrl
|
||||
|
||||
|
|
@ -215,6 +216,7 @@ export default class {
|
|||
service_fee_bps: this.settings.outgoingAppUserInvoiceFeeBps,
|
||||
noffer: nofferEncode({ pubkey: app.nostr_public_key!, offer: user.identifier, priceType: OfferPriceType.Spontaneous, relay: nostrSettings.relays[0] }),
|
||||
ndebit: ndebitEncode({ pubkey: app.nostr_public_key!, pointer: user.identifier, relay: nostrSettings.relays[0] }),
|
||||
nmanage: nmanageEncode({ pubkey: app.nostr_public_key!, pointer: user.identifier, relay: nostrSettings.relays[0] }),
|
||||
callback_url: user.callback_url,
|
||||
bridge_url: this.settings.bridgeUrl
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue