Skip to content

Commit 99d5769

Browse files
committed
fix(settings): show correct order state
1 parent 76e08b0 commit 99d5769

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed

src/utils/blocktank/index.ts

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ export const getCJitEntry = async (entryId: string): Promise<ICJitEntry> => {
171171
*/
172172
export const getOrder = async (orderId: string): Promise<Result<IBtOrder>> => {
173173
try {
174-
const orderState = await bt.getOrder(orderId);
175-
return ok(orderState);
174+
const order = await bt.getOrder(orderId);
175+
return ok(order);
176176
} catch (e) {
177177
return err(e);
178178
}
@@ -317,52 +317,44 @@ export const getStateMessage = (order: IBtOrder): string => {
317317
const channelState: BtOpenChannelState | undefined = order.channel?.state;
318318

319319
switch (orderState) {
320-
case 'expired':
320+
case BtOrderState.EXPIRED:
321321
return i18n.t('lightning:order_state.expired');
322322
}
323323

324324
switch (paymentState) {
325-
case 'refunded':
325+
case BtPaymentState.REFUNDED:
326326
return i18n.t('lightning:order_state.refunded');
327327
}
328328

329329
if (channelState) {
330330
switch (channelState) {
331-
case 'opening':
331+
case BtOpenChannelState.OPENING:
332332
return i18n.t('lightning:order_state.opening');
333-
case 'open':
333+
case BtOpenChannelState.OPEN:
334334
return i18n.t('lightning:order_state.open');
335-
case 'closed':
335+
case BtOpenChannelState.CLOSED:
336336
return i18n.t('lightning:order_state.closed');
337337
}
338338
}
339339

340340
switch (orderState) {
341-
case 'closed':
341+
case BtOrderState.CLOSED:
342342
return i18n.t('lightning:order_state.closed');
343-
case 'open':
343+
case BtOrderState.OPEN:
344344
return i18n.t('lightning:order_state.open');
345-
case 'created':
346-
return i18n.t('lightning:order_state.awaiting_payment');
347345
}
348346

349347
switch (paymentState) {
350-
case 'created':
348+
case BtPaymentState.CREATED:
351349
return i18n.t('lightning:order_state.awaiting_payment');
352-
case 'paid':
350+
case BtPaymentState.PAID:
353351
return i18n.t('lightning:order_state.paid');
354352
}
355353

356354
switch (orderState) {
357-
case 'closed':
358-
return i18n.t('lightning:order_state.closed');
359-
case 'open':
360-
return i18n.t('lightning:order_state.open');
361-
case 'created':
355+
case BtOrderState.CREATED:
362356
return i18n.t('lightning:order_state.awaiting_payment');
363357
}
364-
365-
return 'Unknown state';
366358
};
367359

368360
/**

src/utils/i18n/locales/en/wallet.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"other": "Other"
158158
},
159159
"details_savings_title": "Savings Balance",
160-
"details_savings_subtitle": "On-chain BTC",
160+
"details_savings_subtitle": "BTC",
161161
"details_spending_title": "Spending Balance",
162162
"details_spending_subtitle": "Instant BTC",
163163
"tx_invalid": "Transaction Invalid",

src/utils/i18n/locales/ru/wallet.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
"other": "Другие"
110110
},
111111
"details_savings_title": "Баланс Сбережений",
112-
"details_savings_subtitle": "On-chain BTC",
112+
"details_savings_subtitle": "BTC",
113113
"details_spending_title": "Баланс Расходов",
114114
"details_spending_subtitle": "Мгновенные BTC",
115115
"tx_invalid": "Неверная Транзакция",

0 commit comments

Comments
 (0)