From 17e00f98214b10bc8fbc47790d33c1c969ee46cb Mon Sep 17 00:00:00 2001 From: boufni95 Date: Wed, 4 Sep 2024 15:29:51 +0000 Subject: [PATCH] fixies --- src/custom-nip19.ts | 2 +- src/services/main/applicationManager.ts | 6 +++--- src/services/main/productManager.ts | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/custom-nip19.ts b/src/custom-nip19.ts index 70a222cb..baf2f8e5 100644 --- a/src/custom-nip19.ts +++ b/src/custom-nip19.ts @@ -25,7 +25,7 @@ export type OfferPointer = { priceType: PriceType, price?: number } -enum PriceType { +export enum PriceType { fixed = 0, variable = 1, spontaneous = 2, diff --git a/src/services/main/applicationManager.ts b/src/services/main/applicationManager.ts index b7331cc2..4c8d0b0e 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 } 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: "" }) } } diff --git a/src/services/main/productManager.ts b/src/services/main/productManager.ts index bf7a93dd..1b8320a7 100644 --- a/src/services/main/productManager.ts +++ b/src/services/main/productManager.ts @@ -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: "" }) } }