From 152e5c16cb5e664d3af7ebaab2894744bb480d80 Mon Sep 17 00:00:00 2001 From: Abdul Haseeb Date: Fri, 15 Dec 2023 10:43:30 +0500 Subject: [PATCH] chore: code improvements --- src/app/hooks/queries/useConfirmedBtcBalance.ts | 2 +- src/app/screens/createInscription/index.tsx | 8 ++++++-- src/locales/en.json | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/app/hooks/queries/useConfirmedBtcBalance.ts b/src/app/hooks/queries/useConfirmedBtcBalance.ts index f154023a2..aeb0d9b54 100644 --- a/src/app/hooks/queries/useConfirmedBtcBalance.ts +++ b/src/app/hooks/queries/useConfirmedBtcBalance.ts @@ -8,7 +8,7 @@ const useConfirmBtcBalance = () => { const fetchBtcAddressData = async () => btcClient.getAddressData(btcAddress); - let confirmedBalance: number = 0; + let confirmedBalance = 0; const response = useQuery({ queryKey: ['btc-address-data'], diff --git a/src/app/screens/createInscription/index.tsx b/src/app/screens/createInscription/index.tsx index 3ed63c289..9ccb337bb 100644 --- a/src/app/screens/createInscription/index.tsx +++ b/src/app/screens/createInscription/index.tsx @@ -232,6 +232,7 @@ const ButtonImage = styled.img((props) => ({ })); const DEFAULT_FEE_RATE = 8; +const MAX_REPEATS = 24; function CreateInscription() { const { t } = useTranslation('translation', { keyPrefix: 'INSCRIPTION_REQUEST' }); @@ -263,7 +264,7 @@ function CreateInscription() { } = payload as CreateInscriptionPayload | CreateRepeatInscriptionsPayload; const { repeat } = payload as CreateRepeatInscriptionsPayload; - const showOver24RepeatsError = !Number.isNaN(repeat) && repeat > 24; + const showOver24RepeatsError = !Number.isNaN(repeat) && repeat > MAX_REPEATS; const [utxos, setUtxos] = useState(); const [showFeeSettings, setShowFeeSettings] = useState(false); @@ -468,7 +469,10 @@ function CreateInscription() { {t('TITLE')} {t('SUBTITLE', { name: appName ?? '' })} {showOver24RepeatsError && ( - + )} {showConfirmedBalanceError && ( diff --git a/src/locales/en.json b/src/locales/en.json index 0366d0c56..1e3e9ec41 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -982,7 +982,7 @@ "FAILED_TO_FINALIZE": "The inscription transaction failed to finalize. Please try again or contact support.", "SERVER_ERROR": "An unknown server error occurred. Please try again or contact support." }, - "TOO_MANY_REPEATS": "You can only create up to 24 inscriptions in a single request", + "TOO_MANY_REPEATS": "You can only create up to {{maxRepeats}} inscriptions in a single request", "UNCONFIRMED_UTXO": "Some of your balance consists of unconfirmed outputs. You don't have enough confirmed funds to proceed with this transaction", "LEDGER_INSCRIPTION": "This inscription service is not compatible with Ledger accounts. Please switch to a standard account to inscribe." }