Skip to content

Commit

Permalink
fix(wallet): Update Lightning Setup Steps
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyphillips committed Aug 24, 2023
1 parent 572ca23 commit ca43c6a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/screens/Lightning/CustomConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const CustomConfirm = ({
setLoading(false);
return;
}
setLightningSettingUpStep(0);
setLightningSettingUpStep(1);
addTodo('lightningSettingUp');
navigation.navigate('SettingUp');
};
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Lightning/QuickConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const QuickConfirm = ({
setLoading(false);
return;
}
setLightningSettingUpStep(0);
setLightningSettingUpStep(1);
addTodo('lightningSettingUp');
navigation.navigate('SettingUp');
};
Expand Down
11 changes: 9 additions & 2 deletions src/screens/Settings/Lightning/Channels.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,15 @@ const getPendingBlocktankChannels = (
const failedOrders: TChannel[] = [];

Object.keys(paidOrders).forEach((orderId) => {
const order = orders.find((o) => o.id === orderId)!;

let order = orders.find((o) => o.id === orderId)!;
if (!order) {
// In the event it was paid for using the old api.
// @ts-ignore
order = orders.find((o) => o?._id === orderId)!;
if (!order) {
return;
}
}
const fakeChannel: TChannel = {
channel_id: order.id,
confirmations: 0,
Expand Down
4 changes: 3 additions & 1 deletion src/store/actions/blocktank.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ export const refreshOrder = async (
order.payment.state === BtPaymentState.PAID &&
order.state !== BtOrderState.OPEN
) {
setLightningSettingUpStep(1);
setLightningSettingUpStep(2);
const finalizeRes = await openChannel(orderId);
if (finalizeRes.isOk()) {
removeTodo('lightning');
setLightningSettingUpStep(3);
const getUpdatedOrderResult = await blocktank.getOrder(orderId);
if (getUpdatedOrderResult.isErr()) {
return err(getUpdatedOrderResult.error.message);
Expand Down Expand Up @@ -299,6 +300,7 @@ export const confirmChannelPurchase = async ({
resetSendTransaction({ selectedWallet, selectedNetwork });

watchOrder(orderId).then();
setLightningSettingUpStep(0);
removeTodo('lightning');
refreshWallet({
onchain: true,
Expand Down

0 comments on commit ca43c6a

Please sign in to comment.