diff --git a/backend/src/graphql/resolver/TransactionResolver.ts b/backend/src/graphql/resolver/TransactionResolver.ts index 9c7c8b93f..edbe6373e 100644 --- a/backend/src/graphql/resolver/TransactionResolver.ts +++ b/backend/src/graphql/resolver/TransactionResolver.ts @@ -117,11 +117,11 @@ async function calculateAndAddDecayTransactions( finalTransaction.balance = roundFloorFrom4(Number(transaction.amount)) // Todo unsafe conversion if (transaction.userId === user.id) { finalTransaction.type = TransactionType.SEND - otherUser = userIndiced[transaction.sendReceiverUserId!] // TODO properly enforce null + otherUser = userIndiced.find((u) => u.id === transaction.sendReceiverUserId) // TODO properly enforce null // finalTransaction.pubkey = sendCoin.recipiantPublic } else if (transaction.sendReceiverUserId === user.id) { finalTransaction.type = TransactionType.RECIEVE - otherUser = userIndiced[transaction.userId] + otherUser = userIndiced.find((u) => u.id === transaction.userId) // finalTransaction.pubkey = sendCoin.senderPublic } else { throw new Error('invalid transaction')