From 83f3ec24c14c8035ce17898e28f91ae4956a484b Mon Sep 17 00:00:00 2001 From: Anni Piragauta Date: Fri, 6 Dec 2024 10:28:20 -0500 Subject: [PATCH] fix: different response when blockbook is not responding --- package-lock.json | 12 +++++------- src/common/store/constants.ts | 1 + src/common/types/store.ts | 1 + src/common/utils/utils.ts | 5 +++++ src/status/store/getters.ts | 1 + src/status/views/Status.vue | 12 ++++++++++-- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 20284b923..ad43fe48e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6802,9 +6802,8 @@ }, "node_modules/@rsksmart/bridges-core-sdk": { "version": "0.4.1", - "resolved": "https://npm.pkg.github.com/download/@rsksmart/bridges-core-sdk/0.4.1/8851d4ce76d8b24dfffa0509d8b110fccd7c7641", - "integrity": "sha512-5bfa7++YTsscrIekzG/IsjWmiGykTUYIi7RYlwlWErMOgaMO6QrTKbTon89UtzCUtt3DvI/IazKyVaDR4OHfOg==", - "license": "ISC", + "resolved": "https://registry.npmjs.org/@rsksmart/bridges-core-sdk/-/bridges-core-sdk-0.4.1.tgz", + "integrity": "sha512-bLED4LtICzKcvvYgVOnhjY7ncpyg7PZTWq4E+d5FbV6dc6XB9RWTqCis9kvM2p3m1iyVUZXBV1eDVS9FDNUIhw==", "dependencies": { "bech32": "^2.0.0", "bs58check": "^3.0.1", @@ -6842,11 +6841,10 @@ }, "node_modules/@rsksmart/flyover-sdk": { "version": "1.6.2", - "resolved": "https://npm.pkg.github.com/download/@rsksmart/flyover-sdk/1.6.2/138cf45abc465bf578738b4fad82057a3722b9ed", - "integrity": "sha512-iJRpupCBffAipR+yK/JZ/WDA1ge2gSKmOx8bPamQe+rNvC7GXCVqCURNeTG64fWtBNtkG9ye4b5BtNQ5ey5y/g==", - "license": "ISC", + "resolved": "https://registry.npmjs.org/@rsksmart/flyover-sdk/-/flyover-sdk-1.6.2.tgz", + "integrity": "sha512-d1vo9rU9Mnd526vCXhM8plakmghO/5BgWth3sRZnYC9cyauofFZeSSiRFdm7UvBJU5Xtiv6QZ8o8mzNjQRIkrg==", "dependencies": { - "@rsksmart/bridges-core-sdk": "^0.4.0", + "@rsksmart/bridges-core-sdk": "^0.4.1", "bitcoinjs-lib": "^6.1.6", "qrcode": "^1.5.1" } diff --git a/src/common/store/constants.ts b/src/common/store/constants.ts index fa2c5099e..a5ea9082c 100644 --- a/src/common/store/constants.ts +++ b/src/common/store/constants.ts @@ -285,6 +285,7 @@ export enum PegStatus { ERROR_NOT_A_PEGIN = 'ERROR_NOT_A_PEGIN', ERROR_BELOW_MIN = 'ERROR_BELOW_MIN', ERROR_UNEXPECTED = 'ERROR_UNEXPECTED', + BLOCKBOOK_FAILED = 'BLOCKBOOK_FAILED', } export enum FlyoverStatus { diff --git a/src/common/types/store.ts b/src/common/types/store.ts index b1fbe09e6..3e43a4363 100644 --- a/src/common/types/store.ts +++ b/src/common/types/store.ts @@ -98,6 +98,7 @@ export enum TxStatusType { UNEXPECTED_ERROR = 'UNEXPECTED_ERROR', UNSET_STATUS = 'UNSET_STATUS', NOT_FOUND = 'NOT_FOUND', + BLOCKBOOK_FAILED = 'BLOCKBOOK_FAILED', } export interface TxStatus { diff --git a/src/common/utils/utils.ts b/src/common/utils/utils.ts index 0de917604..13782ce3c 100644 --- a/src/common/utils/utils.ts +++ b/src/common/utils/utils.ts @@ -287,6 +287,11 @@ export function setStatusMessage(txType: string, status: string): TxStatusMessag error = true; errorMessage = 'The input transaction is not valid, please check it and try again'; break; + case TxStatusType.BLOCKBOOK_FAILED: + activeMessageStyle = 'statusRejected'; + error = true; + errorMessage = 'Blockbook service is not responding'; + break; default: error = true; errorMessage = 'The input transaction is not valid, please check it and try again'; diff --git a/src/status/store/getters.ts b/src/status/store/getters.ts index 3783c017c..fdca630ec 100644 --- a/src/status/store/getters.ts +++ b/src/status/store/getters.ts @@ -16,6 +16,7 @@ export const getters: GetterTree = { || state.txDetails.status === constants.PegStatus.ERROR_BELOW_MIN || state.txDetails.status === constants.PegStatus.REJECTED_NO_REFUND || state.txDetails.status === constants.PegStatus.REJECTED_REFUND + || state.type === TxStatusType.BLOCKBOOK_FAILED || state.type === TxStatusType.UNEXPECTED_ERROR; } return isRejected; diff --git a/src/status/views/Status.vue b/src/status/views/Status.vue index 492794ac7..b51dff70b 100644 --- a/src/status/views/Status.vue +++ b/src/status/views/Status.vue @@ -93,6 +93,7 @@ export default defineComponent({ const invalidData = computed(() => status.value.type === TxStatusType.INVALID_DATA); const unexpectedError = computed(() => status.value.type === TxStatusType.UNEXPECTED_ERROR); + const blockBookError = computed(() => status.value.type === TxStatusType.BLOCKBOOK_FAILED); const isFlyover = computed((): boolean => status.value.type === TxStatusType.FLYOVER_PEGOUT || status.value.type === TxStatusType.FLYOVER_PEGIN); @@ -101,14 +102,21 @@ export default defineComponent({ const txNotFound = computed((): boolean => invalidData.value || unexpectedError.value - || quoteNotFound.value); + || quoteNotFound.value + || blockBookError.value); const isRejected = computed(() => status.value.txDetails?.status === 'REJECTED' || txNotFound.value); const rejectionMsg = computed(() => { const details = txDetails.value as PegoutStatusDataModel; const { LOW_AMOUNT, CALLER_CONTRACT, FEE_ABOVE_VALUE } = constants.RejectedPegoutReasons; - if (txNotFound.value) return 'Your transaction is not processed yet, search again in a few minutes'; + if (txNotFound.value) { + if (blockBookError.value) { + return 'We are experiencing technical issues and therefore were unable to retrieve and' + + ' display the transaction status. Please try again later.'; + } + return 'Your transaction is not processed yet, search again in a few minutes'; + } switch (details.reason) { case LOW_AMOUNT: return 'The transaction was rejected because the amount is less than the minimum required.';