fix: total balance can be equal to the amount, access undefined with ?

This commit is contained in:
P. Reis 2025-02-25 16:20:40 -03:00
parent e08603a42a
commit cf4d888ad5

View file

@ -348,7 +348,7 @@ route.post('/nutzap', userMiddleware({ enc: 'nip44' }), async (c) => {
let selectedMint: string | undefined; let selectedMint: string | undefined;
for (const mint of recipientMints) { for (const mint of recipientMints) {
if (organizedProofs[mint].totalBalance > amount) { if (organizedProofs[mint]?.totalBalance >= amount) {
selectedMint = mint; selectedMint = mint;
let minimumRequiredBalance = 0; let minimumRequiredBalance = 0;
@ -357,7 +357,7 @@ route.post('/nutzap', userMiddleware({ enc: 'nip44' }), async (c) => {
continue; continue;
} }
if (minimumRequiredBalance > amount) { if (minimumRequiredBalance >= amount) {
break; break;
} }