This commit is contained in:
boufni95 2024-09-04 15:29:51 +00:00
parent 0b27757f72
commit 17e00f9821
3 changed files with 6 additions and 6 deletions

View file

@ -25,7 +25,7 @@ export type OfferPointer = {
priceType: PriceType,
price?: number
}
enum PriceType {
export enum PriceType {
fixed = 0,
variable = 1,
spontaneous = 2,

View file

@ -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 } from '../../custom-nip19.js'
import { encodeNoffer, PriceType } from '../../custom-nip19.js'
const TOKEN_EXPIRY_TIME = 2 * 60 * 1000 // 2 minutes, in milliseconds
@ -161,7 +161,7 @@ export default class {
service_fee_bps: this.settings.outgoingAppUserInvoiceFeeBps
},
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: u.identifier, priceType: 'spontaneous' }),
noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: u.identifier, priceType: PriceType.spontaneous, relay: "" }),
max_withdrawable: this.paymentManager.GetMaxPayableInvoice(u.user.balance_sats, true)
}
}
@ -199,7 +199,7 @@ 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: 'spontaneous' })
}, noffer: encodeNoffer({ pubkey: app.nostr_public_key!, offer: user.identifier, priceType: PriceType.spontaneous, relay: "" })
}
}

View file

@ -5,7 +5,7 @@ import * as Types from '../../../proto/autogenerated/ts/types.js'
import { MainSettings } from './settings.js'
import PaymentManager from './paymentManager.js'
import { defaultInvoiceExpiry } from '../storage/paymentStorage.js'
import { encodeNoffer } from '../../custom-nip19.js'
import { encodeNoffer, PriceType } from '../../custom-nip19.js'
export default class {
storage: Storage
@ -26,7 +26,7 @@ export default class {
id: newProduct.product_id,
name: newProduct.name,
price_sats: newProduct.price_sats,
noffer: encodeNoffer({ pubkey: user.user_id, offer: offer, priceType: 'fixed', price: newProduct.price_sats })
noffer: encodeNoffer({ pubkey: user.user_id, offer: offer, priceType: PriceType.fixed, price: newProduct.price_sats, relay: "" })
}
}