Skip to content

Commit fe24151

Browse files
annipialexjavabraz
authored andcommitted
fix: different response when blockbook is not responding
1 parent 359a8b4 commit fe24151

File tree

6 files changed

+23
-9
lines changed

6 files changed

+23
-9
lines changed

package-lock.json

Lines changed: 5 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/common/store/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ export enum PegStatus {
292292
ERROR_NOT_A_PEGIN = 'ERROR_NOT_A_PEGIN',
293293
ERROR_BELOW_MIN = 'ERROR_BELOW_MIN',
294294
ERROR_UNEXPECTED = 'ERROR_UNEXPECTED',
295+
BLOCKBOOK_FAILED = 'BLOCKBOOK_FAILED',
295296
}
296297

297298
export enum FlyoverStatus {

src/common/types/store.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ export enum TxStatusType {
9898
UNEXPECTED_ERROR = 'UNEXPECTED_ERROR',
9999
UNSET_STATUS = 'UNSET_STATUS',
100100
NOT_FOUND = 'NOT_FOUND',
101+
BLOCKBOOK_FAILED = 'BLOCKBOOK_FAILED',
101102
}
102103

103104
export interface TxStatus {

src/common/utils/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ export function setStatusMessage(txType: string, status: string): TxStatusMessag
287287
error = true;
288288
errorMessage = 'The input transaction is not valid, please check it and try again';
289289
break;
290+
case TxStatusType.BLOCKBOOK_FAILED:
291+
activeMessageStyle = 'statusRejected';
292+
error = true;
293+
errorMessage = 'Blockbook service is not responding';
294+
break;
290295
default:
291296
error = true;
292297
errorMessage = 'The input transaction is not valid, please check it and try again';

src/status/store/getters.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export const getters: GetterTree<TxStatus, RootState> = {
1616
|| state.txDetails.status === constants.PegStatus.ERROR_BELOW_MIN
1717
|| state.txDetails.status === constants.PegStatus.REJECTED_NO_REFUND
1818
|| state.txDetails.status === constants.PegStatus.REJECTED_REFUND
19+
|| state.type === TxStatusType.BLOCKBOOK_FAILED
1920
|| state.type === TxStatusType.UNEXPECTED_ERROR;
2021
}
2122
return isRejected;

src/status/views/Status.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export default defineComponent({
9393
9494
const invalidData = computed(() => status.value.type === TxStatusType.INVALID_DATA);
9595
const unexpectedError = computed(() => status.value.type === TxStatusType.UNEXPECTED_ERROR);
96+
const blockBookError = computed(() => status.value.type === TxStatusType.BLOCKBOOK_FAILED);
9697
9798
const isFlyover = computed((): boolean => status.value.type === TxStatusType.FLYOVER_PEGOUT
9899
|| status.value.type === TxStatusType.FLYOVER_PEGIN);
@@ -101,14 +102,21 @@ export default defineComponent({
101102
102103
const txNotFound = computed((): boolean => invalidData.value
103104
|| unexpectedError.value
104-
|| quoteNotFound.value);
105+
|| quoteNotFound.value
106+
|| blockBookError.value);
105107
106108
const isRejected = computed(() => status.value.txDetails?.status === 'REJECTED' || txNotFound.value);
107109
108110
const rejectionMsg = computed(() => {
109111
const details = txDetails.value as PegoutStatusDataModel;
110112
const { LOW_AMOUNT, CALLER_CONTRACT, FEE_ABOVE_VALUE } = constants.RejectedPegoutReasons;
111-
if (txNotFound.value) return 'Your transaction is not processed yet, search again in a few minutes';
113+
if (txNotFound.value) {
114+
if (blockBookError.value) {
115+
return 'We are experiencing technical issues and therefore were unable to retrieve and'
116+
+ ' display the transaction status. Please try again later.';
117+
}
118+
return 'Your transaction is not processed yet, search again in a few minutes';
119+
}
112120
switch (details.reason) {
113121
case LOW_AMOUNT:
114122
return 'The transaction was rejected because the amount is less than the minimum required.';

0 commit comments

Comments
 (0)