mirror of
https://github.com/zapstore/zapstore.git
synced 2026-10-05 20:48:24 +00:00
If timeout is thrown, tell the user the invoice still may get paid
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user