If timeout is thrown, tell the user the invoice still may get paid

This commit is contained in:
franzap
2025-01-07 18:42:40 -03:00
parent b834816a57
commit 8f89d4956f
3 changed files with 9 additions and 4 deletions
-1
View File
@@ -116,7 +116,6 @@ class User extends base.User with DataModelMixin<User> {
}
// Pay the invoice via NWC (errors are thrown)
// TODO: If timeout is thrown, tell the user the invoice still may get paid
await adapter.socialRelays.ndk!.nwc.payInvoice(nwcConnection,
invoice: invoice, timeout: Duration(seconds: 20));
}
+8 -1
View File
@@ -186,8 +186,15 @@ class ZapButton extends HookConsumerWidget {
context.showInfo('$amount sat${amount > 1 ? 's' : ''} sent!',
description: 'Payment was successful');
} catch (e) {
var title = 'Unable to zap';
var description = e.toString();
if (e.toString().contains('Timed out')) {
title = 'Unknown state';
description =
'The call timed out but payment may still go through! Please watch the zaps list.\n\n$description';
}
// ignore: use_build_context_synchronously
context.showError('Unable to zap', description: e.toString());
context.showError(title, description: description);
}
}
},
+1 -2
View File
@@ -72,7 +72,6 @@ class ZapReceipts extends HookConsumerWidget {
final totalUserAmount = receipts
.where((r) => u.pubkey == r.senderPubkey)
.fold(0, (acc, e) => acc + e.amount);
print('$totalUserAmount - ${u.nameOrNpub}');
return totalUserAmount.wrapped;
});
@@ -97,7 +96,7 @@ class ZapReceipts extends HookConsumerWidget {
Widget _wrap(Widget inner) {
return Padding(
padding: const EdgeInsets.only(top: 10, bottom: 20),
padding: const EdgeInsets.only(top: 10, bottom: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 10,