From 208f3c9a9f148ee09e79bac63050e3e84c3d5e7d Mon Sep 17 00:00:00 2001 From: Corey Phillips Date: Thu, 31 Aug 2023 10:10:01 -0400 Subject: [PATCH] fix(lightning): Update handleOrderStateChange Swapped out restartLdk with refreshLdk in handleOrderStateChange. Updated i18n import in lightning.ts. Updated condition for lightningConnecting addTodo in lightning.ts. --- src/store/actions/blocktank.ts | 6 +++--- src/store/actions/lightning.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/store/actions/blocktank.ts b/src/store/actions/blocktank.ts index f87c7f9de..dec91824a 100644 --- a/src/store/actions/blocktank.ts +++ b/src/store/actions/blocktank.ts @@ -31,7 +31,7 @@ import { import { showToast } from '../../utils/notifications'; import { getDisplayValues } from '../../utils/displayValues'; import i18n from '../../utils/i18n'; -import { restartLdk } from '../../utils/lightning'; +import { refreshLdk } from '../../utils/lightning'; import { TWalletName } from '../types/wallet'; import { IBlocktank } from '../types/blocktank'; import { @@ -424,8 +424,8 @@ const handleOrderStateChange = (order: IBtOrder): void => { // } removeTodo('transferToSpending'); - // restart LDK after channel open - restartLdk(); + // refresh LDK after channel open + refreshLdk({}); } }; diff --git a/src/store/actions/lightning.ts b/src/store/actions/lightning.ts index bf6363ee9..740c0aa95 100644 --- a/src/store/actions/lightning.ts +++ b/src/store/actions/lightning.ts @@ -34,7 +34,8 @@ import { import { EPaymentType, TWalletName } from '../types/wallet'; import { EActivityType, TLightningActivityItem } from '../types/activity'; import { addTodo, removeTodo } from './todos'; -import i18n from 'i18next'; +import i18n from '../../utils/i18n'; + import { showToast } from '../../utils/notifications'; const dispatch = getDispatch(); @@ -140,7 +141,6 @@ export const updateLightningChannels = async ({ const confirmations_required = channel?.confirmations_required ?? 1; if (channel.confirmations < confirmations_required) { shouldRemoveTodo = false; - addTodo('lightningConnecting'); } } if (!openChannelIds.includes(channel.channel_id)) { @@ -162,6 +162,10 @@ export const updateLightningChannels = async ({ } } + if (!shouldRemoveTodo && !openChannelIds.length) { + addTodo('lightningConnecting'); + } + const payload = { channels, openChannelIds,