Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(activity): refresh LDK after payment sent #1958

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/screens/Wallets/Send/Pending.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ const Pending = ({ route }: SendScreenProps<'Pending'>): ReactElement => {
{t('send_pending_note')}
</BodyM>

<HourglassSpinner />
<View style={styles.image}>
<HourglassSpinner />
</View>

<View style={styles.buttonContainer}>
<Button
Expand Down Expand Up @@ -94,6 +96,11 @@ const styles = StyleSheet.create({
text: {
marginTop: 16,
},
image: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
buttonContainer: {
flexDirection: 'row',
justifyContent: 'center',
Expand Down
3 changes: 2 additions & 1 deletion src/utils/lightning/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ export const subscribeToLightningPayments = ({
if (!paymentSentSubscription) {
paymentSentSubscription = ldk.onEvent(
EEventTypes.channel_manager_payment_sent,
(res: TChannelManagerPaymentSent) => {
async (res: TChannelManagerPaymentSent) => {
const pending = getLightningStore().pendingPayments;
const found = pending.find((p) => p.payment_hash === res.payment_hash);

Expand All @@ -461,6 +461,7 @@ export const subscribeToLightningPayments = ({
title: i18n.t('wallet:toast_payment_success_title'),
description: i18n.t('wallet:toast_payment_success_description'),
});
await refreshLdk();
bitkitLedger?.handleLNTx({ ...res, amount_sat: found.amount });
} else {
syncLedger(); // TChannelManagerPaymentSent doesn't have amount_sat
Expand Down
Loading