From 555548942092e6d104360a18c01485dbd15f6365 Mon Sep 17 00:00:00 2001 From: Mothana Date: Sat, 9 Mar 2024 22:32:57 +0400 Subject: [PATCH] newBlockHandler sends event to sender as well --- src/services/main/index.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/services/main/index.ts b/src/services/main/index.ts index 115988de..596ee4aa 100644 --- a/src/services/main/index.ts +++ b/src/services/main/index.ts @@ -95,6 +95,10 @@ export default class { await Promise.all(confirmed.map(async c => { if (c.type === 'outgoing') { await this.storage.paymentStorage.UpdateUserTransactionPayment(c.tx.serial_id, { confs: c.confs }) + const { linkedApplication, user, address, paid_amount: amount, service_fees: serviceFee, serial_id: serialId, chain_fees } = c.tx; + const operationId = `${Types.UserOperationType.OUTGOING_TX}-${serialId}` + const op = { amount, paidAtUnix: Date.now() / 1000, inbound: false, type: Types.UserOperationType.OUTGOING_TX, identifier: address, operationId, network_fee: chain_fees, service_fee: serviceFee, confirmed: true, tx_hash: c.tx.tx_hash, internal: c.tx.internal } + this.sendOperationToNostr(linkedApplication!, user.user_id, op) } else { this.storage.StartTransaction(async tx => { const { user_address: userAddress, paid_amount: amount, service_fee: serviceFee, serial_id: serialId } = c.tx