diff --git a/frontend/src/components/MakerForm/MakerForm.tsx b/frontend/src/components/MakerForm/MakerForm.tsx
index 3dcfaef01..d01d7ae0e 100644
--- a/frontend/src/components/MakerForm/MakerForm.tsx
+++ b/frontend/src/components/MakerForm/MakerForm.tsx
@@ -93,7 +93,7 @@ const MakerForm = ({
useEffect(() => {
const slot = garage.getSlot();
- if (Boolean(slot?.token)) void federation.fetchRobot(garage, slot?.token);
+ if (slot?.token) void federation.fetchRobot(garage, slot?.token);
}, [garage.currentSlot]);
useEffect(() => {
@@ -104,7 +104,7 @@ const MakerForm = ({
updateCoordinatorInfo();
}, [maker.coordinator]);
- const updateCoordinatorInfo = () => {
+ const updateCoordinatorInfo = (): void => {
if (maker.coordinator != null) {
const newLimits = federation.getCoordinator(maker.coordinator).limits;
if (Object.keys(newLimits).length !== 0) {
@@ -294,7 +294,7 @@ const MakerForm = ({
const handleCreateOrder = function (): void {
const slot = garage.getSlot();
- if (Boolean(slot?.activeShortAlias)) {
+ if (slot?.activeShortAlias) {
setBadRequest(t('You are already maker of an active order'));
return;
}
diff --git a/frontend/src/components/MakerForm/SelectCoordinator.tsx b/frontend/src/components/MakerForm/SelectCoordinator.tsx
index dbc96b3f7..5f65ce067 100644
--- a/frontend/src/components/MakerForm/SelectCoordinator.tsx
+++ b/frontend/src/components/MakerForm/SelectCoordinator.tsx
@@ -21,7 +21,7 @@ interface SelectCoordinatorProps {
}
const SelectCoordinator: React.FC
= ({ coordinator, setCoordinator }) => {
- const { setOpen, hostUrl } = useContext(AppContext);
+ const { setOpen } = useContext(AppContext);
const { federation, sortedCoordinators } = useContext(FederationContext);
const theme = useTheme();
const { t } = useTranslation();
diff --git a/frontend/src/components/OrderDetails/index.tsx b/frontend/src/components/OrderDetails/index.tsx
index 37855eaa8..42cf1d5c5 100644
--- a/frontend/src/components/OrderDetails/index.tsx
+++ b/frontend/src/components/OrderDetails/index.tsx
@@ -94,7 +94,7 @@ const OrderDetails = ({
currentOrder.amount > 0 ? false : currentOrder.has_range,
currentOrder.min_amount,
currentOrder.max_amount,
- ) + ` ${currencyCode}`
+ ) + ` ${String(currencyCode)}`
);
}
}, [orderUpdatedAt, currencyCode]);
diff --git a/frontend/src/components/RobotAvatar/RobohashGenerator.ts b/frontend/src/components/RobotAvatar/RobohashGenerator.ts
index 8f6c1adc5..038cdf924 100644
--- a/frontend/src/components/RobotAvatar/RobohashGenerator.ts
+++ b/frontend/src/components/RobotAvatar/RobohashGenerator.ts
@@ -1,7 +1,7 @@
interface Task {
robohash: Robohash;
- resolves: ((result: string) => void)[];
- rejects: ((reason?: Error) => void)[];
+ resolves: Array<(result: string) => void>;
+ rejects: Array<(reason?: Error) => void>;
}
interface Robohash {
@@ -32,7 +32,7 @@ class RoboGenerator {
}
}
- private assignTasksToWorkers() {
+ private assignTasksToWorkers(): void {
const availableWorker = this.workers.find((w) => !w.busy);
if (availableWorker) {
@@ -42,13 +42,13 @@ class RoboGenerator {
availableWorker.worker.postMessage(task.robohash);
// Clean up the event listener and free the worker after receiving the result
- const cleanup = () => {
+ const cleanup = (): void => {
availableWorker.worker.removeEventListener('message', completionCallback);
availableWorker.busy = false;
};
// Resolve the promise when the task is completed
- const completionCallback = (event: MessageEvent) => {
+ const completionCallback = (event: MessageEvent): void => {
if (event.data.cacheKey === task.robohash.cacheKey) {
const { cacheKey, imageUrl } = event.data;
@@ -57,7 +57,9 @@ class RoboGenerator {
cleanup();
- task.resolves.forEach((f) => f(imageUrl));
+ task.resolves.forEach((f) => {
+ f(imageUrl);
+ });
}
};
@@ -67,7 +69,9 @@ class RoboGenerator {
availableWorker.worker.addEventListener('error', (error) => {
cleanup();
- task.rejects.forEach((f) => f(new Error(error.message)));
+ task.rejects.forEach((f) => {
+ f(new Error(error.message));
+ });
});
}
}
@@ -81,7 +85,7 @@ class RoboGenerator {
if (this.assetsCache[cacheKey]) {
return this.assetsCache[cacheKey];
} else {
- return new Promise((resolve, reject) => {
+ return await new Promise((resolve, reject) => {
let task = this.queue.find((t) => t.robohash.cacheKey === cacheKey);
if (!task) {
diff --git a/frontend/src/components/RobotAvatar/index.tsx b/frontend/src/components/RobotAvatar/index.tsx
index 2f31d5aed..c4992f8d1 100644
--- a/frontend/src/components/RobotAvatar/index.tsx
+++ b/frontend/src/components/RobotAvatar/index.tsx
@@ -4,7 +4,7 @@ import { Avatar, Badge, Tooltip } from '@mui/material';
import { SendReceiveIcon } from '../Icons';
import placeholder from './placeholder.json';
import { robohash } from './RobohashGenerator';
-import { AppContext, UseAppStoreType } from '../../contexts/AppContext';
+import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
interface Props {
shortAlias?: string | undefined;
diff --git a/frontend/src/components/RobotAvatar/robohash.worker.ts b/frontend/src/components/RobotAvatar/robohash.worker.ts
index 116167551..f0c7da33d 100644
--- a/frontend/src/components/RobotAvatar/robohash.worker.ts
+++ b/frontend/src/components/RobotAvatar/robohash.worker.ts
@@ -1,15 +1,17 @@
import { async_generate_robohash } from 'robo-identities-wasm';
// Listen for messages from the main thread
-self.addEventListener('message', async (event) => {
- const { hash, size, cacheKey, workerIndex } = event.data;
+self.addEventListener('message', (event) => {
+ void (async () => {
+ const { hash, size, cacheKey } = event.data;
- // Generate the image using async_image_base
- const t0 = performance.now();
- const avatarB64 = await async_generate_robohash(hash, size == 'small' ? 80 : 256);
- const imageUrl = `data:image/png;base64,${avatarB64}`;
- const t1 = performance.now();
- console.log(`Avatar generated in: ${t1 - t0} ms`);
- // Send the result back to the main thread
- self.postMessage({ cacheKey, imageUrl });
+ // Generate the image using async_image_base
+ const t0 = performance.now();
+ const avatarB64: string = await async_generate_robohash(hash, size === 'small' ? 80 : 256);
+ const imageUrl = `data:image/png;base64,${avatarB64}`;
+ const t1 = performance.now();
+ console.log(`Avatar generated in: ${t1 - t0} ms`);
+ // Send the result back to the main thread
+ self.postMessage({ cacheKey, imageUrl });
+ })();
});
diff --git a/frontend/src/components/RobotInfo/index.tsx b/frontend/src/components/RobotInfo/index.tsx
index d9f7fc755..7e4f56ec2 100644
--- a/frontend/src/components/RobotInfo/index.tsx
+++ b/frontend/src/components/RobotInfo/index.tsx
@@ -203,7 +203,7 @@ const RobotInfo: React.FC = ({ coordinator, onClose }: Props) => {
- {Boolean(robot?.tgEnabled) ? (
+ {robot?.tgEnabled ? (
{t('Telegram enabled')}
@@ -241,7 +241,7 @@ const RobotInfo: React.FC = ({ coordinator, onClose }: Props) => {
{
- setStealthInvoice(!Boolean(robot?.stealthInvoices));
+ setStealthInvoice(!robot?.stealthInvoices);
}}
/>
}
diff --git a/frontend/src/components/SettingsForm/index.tsx b/frontend/src/components/SettingsForm/index.tsx
index f720cf28b..7d1f149db 100644
--- a/frontend/src/components/SettingsForm/index.tsx
+++ b/frontend/src/components/SettingsForm/index.tsx
@@ -29,7 +29,7 @@ import {
} from '@mui/icons-material';
import { systemClient } from '../../services/System';
import SwapCalls from '@mui/icons-material/SwapCalls';
-import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
+import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
interface SettingsFormProps {
dense?: boolean;
@@ -226,7 +226,7 @@ const SettingsForm = ({ dense = false }: SettingsFormProps): JSX.Element => {
value={settings.network}
onChange={(e, network) => {
setSettings({ ...settings, network });
- federation.updateUrls(origin, { ...settings, network }, hostUrl);
+ void federation.updateUrls(origin, { ...settings, network }, hostUrl);
systemClient.setItem('settings_network', network);
}}
>
diff --git a/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx b/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx
index 7f6e5ea34..2653f10d0 100644
--- a/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx
+++ b/frontend/src/components/TradeBox/EncryptedChat/EncryptedSocketChat/index.tsx
@@ -15,9 +15,12 @@ import ChatHeader from '../ChatHeader';
import { type EncryptedChatMessage, type ServerMessage } from '..';
import ChatBottom from '../ChatBottom';
import { sha256 } from 'js-sha256';
-import { Order } from '../../../../models';
-import { UseFederationStoreType, FederationContext } from '../../../../contexts/FederationContext';
-import { UseAppStoreType, AppContext } from '../../../../contexts/AppContext';
+import { type Order } from '../../../../models';
+import {
+ type UseFederationStoreType,
+ FederationContext,
+} from '../../../../contexts/FederationContext';
+import { type UseAppStoreType, AppContext } from '../../../../contexts/AppContext';
const audioPath =
window.NativeRobosats === undefined
diff --git a/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx b/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx
index 3d4e9eaad..43de3a8f4 100644
--- a/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx
+++ b/frontend/src/components/TradeBox/EncryptedChat/EncryptedTurtleChat/index.tsx
@@ -19,7 +19,7 @@ import {
FederationContext,
} from '../../../../contexts/FederationContext';
import { type UseGarageStoreType, GarageContext } from '../../../../contexts/GarageContext';
-import { Order } from '../../../../models';
+import { type Order } from '../../../../models';
interface Props {
order: Order;
diff --git a/frontend/src/components/TradeBox/EncryptedChat/index.tsx b/frontend/src/components/TradeBox/EncryptedChat/index.tsx
index a04600062..3d6b8573f 100644
--- a/frontend/src/components/TradeBox/EncryptedChat/index.tsx
+++ b/frontend/src/components/TradeBox/EncryptedChat/index.tsx
@@ -1,5 +1,5 @@
import React, { useState } from 'react';
-import { Order, type Robot } from '../../../models';
+import { type Order, type Robot } from '../../../models';
import EncryptedSocketChat from './EncryptedSocketChat';
import EncryptedTurtleChat from './EncryptedTurtleChat';
diff --git a/frontend/src/components/TradeBox/Prompts/Successful.tsx b/frontend/src/components/TradeBox/Prompts/Successful.tsx
index 7e90b8b76..f0fd3be37 100644
--- a/frontend/src/components/TradeBox/Prompts/Successful.tsx
+++ b/frontend/src/components/TradeBox/Prompts/Successful.tsx
@@ -20,7 +20,10 @@ import { LoadingButton } from '@mui/lab';
import { type Order } from '../../../models';
import { systemClient } from '../../../services/System';
-import { FederationContext, UseFederationStoreType } from '../../../contexts/FederationContext';
+import {
+ FederationContext,
+ type UseFederationStoreType,
+} from '../../../contexts/FederationContext';
interface SuccessfulPromptProps {
order: Order;
diff --git a/frontend/src/components/TradeBox/index.tsx b/frontend/src/components/TradeBox/index.tsx
index e67b7bbc7..01c9714ef 100644
--- a/frontend/src/components/TradeBox/index.tsx
+++ b/frontend/src/components/TradeBox/index.tsx
@@ -156,7 +156,7 @@ const TradeBox = ({ baseUrl, onStartAgain }: TradeBoxProps): JSX.Element => {
const renewOrder = function (): void {
const currentOrder = garage.getSlot()?.order;
- if (Boolean(currentOrder)) {
+ if (currentOrder) {
const body = {
type: currentOrder.type,
currency: currentOrder.currency,