mirror of
https://github.com/RoboSats/robosats.git
synced 2025-01-18 20:21:35 +00:00
Fix (some) lint issues
This commit is contained in:
parent
66c16760f6
commit
2361b728fc
@ -12,8 +12,8 @@ import BookTable from '../../components/BookTable';
|
||||
import { BarChart, FormatListBulleted, Map } from '@mui/icons-material';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import MapChart from '../../components/Charts/MapChart';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
const BookPage = (): JSX.Element => {
|
||||
const { windowSize } = useContext<UseAppStoreType>(AppContext);
|
||||
|
@ -8,8 +8,8 @@ import RobotAvatar from '../components/RobotAvatar';
|
||||
import Notifications from '../components/Notifications';
|
||||
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FederationContext, UseFederationStoreType } from '../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContext';
|
||||
|
||||
const Router = window.NativeRobosats === undefined ? BrowserRouter : MemoryRouter;
|
||||
|
||||
@ -46,7 +46,9 @@ const Main: React.FC = () => {
|
||||
style={{ display: 'none' }}
|
||||
nickname={garage.getRobot().nickname}
|
||||
baseUrl={federation.getCoordinator(sortedCoordinators[0]).getBaseUrl()}
|
||||
onLoad={() => garage.updateRobot({ avatarLoaded: true })}
|
||||
onLoad={() => {
|
||||
garage.updateRobot({ avatarLoaded: true });
|
||||
}}
|
||||
/>
|
||||
<Notifications
|
||||
page={page}
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
} from '../../components/Dialogs';
|
||||
import { pn } from '../../utils';
|
||||
import { AppContext, type UseAppStoreType, closeAll } from '../../contexts/AppContext';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
|
||||
export interface OpenDialogs {
|
||||
more: boolean;
|
||||
|
@ -9,8 +9,8 @@ import BookTable from '../../components/BookTable';
|
||||
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { NoRobotDialog } from '../../components/Dialogs';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
const MakerPage = (): JSX.Element => {
|
||||
const { fav, windowSize, navbarHeight } = useContext<UseAppStoreType>(AppContext);
|
||||
|
@ -16,8 +16,8 @@ import {
|
||||
} from '@mui/icons-material';
|
||||
import RobotAvatar from '../../components/RobotAvatar';
|
||||
import { AppContext, type UseAppStoreType, closeAll } from '../../contexts/AppContext';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
const NavBar = (): JSX.Element => {
|
||||
const theme = useTheme();
|
||||
@ -79,7 +79,6 @@ const NavBar = (): JSX.Element => {
|
||||
|
||||
const changePage = function (mouseEvent: any, newPage: Page): void {
|
||||
if (newPage === 'none') {
|
||||
return;
|
||||
} else {
|
||||
handleSlideDirection(page, newPage);
|
||||
setPage(newPage);
|
||||
|
@ -8,8 +8,8 @@ import OrderDetails from '../../components/OrderDetails';
|
||||
|
||||
import { apiClient } from '../../services/api';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
const OrderPage = (): JSX.Element => {
|
||||
const { windowSize, setOpen, settings, navbarHeight, hostUrl, origin } =
|
||||
|
@ -21,8 +21,8 @@ import RobotAvatar from '../../components/RobotAvatar';
|
||||
import TokenInput from './TokenInput';
|
||||
import { genBase62Token } from '../../utils';
|
||||
import { NewTabIcon } from '../../components/Icons';
|
||||
import { AppContext, UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
interface OnboardingProps {
|
||||
setView: (state: 'welcome' | 'onboarding' | 'recovery' | 'profile') => void;
|
||||
|
@ -21,8 +21,8 @@ import { type Slot, type Robot } from '../../models';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { genBase62Token } from '../../utils';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
|
||||
interface RobotProfileProps {
|
||||
robot: Robot;
|
||||
|
@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next';
|
||||
import { IconButton, LinearProgress, TextField, Tooltip } from '@mui/material';
|
||||
import { ContentCopy } from '@mui/icons-material';
|
||||
import { systemClient } from '../../services/System';
|
||||
import { UseGarageStoreType, GarageContext } from '../../contexts/GarageContext';
|
||||
import { type UseGarageStoreType, GarageContext } from '../../contexts/GarageContext';
|
||||
|
||||
interface TokenInputProps {
|
||||
editable?: boolean;
|
||||
|
@ -21,8 +21,8 @@ import { TorIcon } from '../../components/Icons';
|
||||
import { genKey } from '../../pgp';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { validateTokenEntropy } from '../../utils';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
interface RobotPageProps {
|
||||
avatarBaseUrl: string;
|
||||
|
@ -37,7 +37,7 @@ import RobotAvatar from '../RobotAvatar';
|
||||
// Icons
|
||||
import { Fullscreen, FullscreenExit, Refresh } from '@mui/icons-material';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
|
||||
const ClickThroughDataGrid = styled(DataGrid)({
|
||||
'& .MuiDataGrid-overlayWrapperInner': {
|
||||
@ -831,7 +831,11 @@ const BookTable = ({
|
||||
</IconButton>
|
||||
</Grid>
|
||||
<Grid item xs={6}>
|
||||
<IconButton onClick={() => federation.update()}>
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
federation.update();
|
||||
}}
|
||||
>
|
||||
<Refresh />
|
||||
</IconButton>
|
||||
</Grid>
|
||||
|
@ -26,7 +26,10 @@ import currencyDict from '../../../../static/assets/currencies.json';
|
||||
import getNivoScheme from '../NivoScheme';
|
||||
import OrderTooltip from '../helpers/OrderTooltip';
|
||||
import { type UseAppStoreType, AppContext } from '../../../contexts/AppContext';
|
||||
import { FederationContext, UseFederationStoreType } from '../../../contexts/FederationContext';
|
||||
import {
|
||||
FederationContext,
|
||||
type UseFederationStoreType,
|
||||
} from '../../../contexts/FederationContext';
|
||||
|
||||
interface DepthChartProps {
|
||||
maxWidth: number;
|
||||
|
@ -15,7 +15,10 @@ import Map from '../../Map';
|
||||
import { AppContext, type UseAppStoreType } from '../../../contexts/AppContext';
|
||||
import { PhotoSizeSelectActual } from '@mui/icons-material';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FederationContext, UseFederationStoreType } from '../../../contexts/FederationContext';
|
||||
import {
|
||||
FederationContext,
|
||||
type UseFederationStoreType,
|
||||
} from '../../../contexts/FederationContext';
|
||||
|
||||
interface MapChartProps {
|
||||
maxWidth: number;
|
||||
|
@ -7,7 +7,10 @@ import currencyDict from '../../../../../static/assets/currencies.json';
|
||||
import { PaymentStringAsIcons } from '../../../PaymentMethods';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { AppContext, type UseAppStoreType } from '../../../../contexts/AppContext';
|
||||
import { FederationContext, UseFederationStoreType } from '../../../../contexts/FederationContext';
|
||||
import {
|
||||
FederationContext,
|
||||
type UseFederationStoreType,
|
||||
} from '../../../../contexts/FederationContext';
|
||||
|
||||
interface OrderTooltipProps {
|
||||
order: PublicOrder;
|
||||
|
@ -16,9 +16,9 @@ import {
|
||||
import BoltIcon from '@mui/icons-material/Bolt';
|
||||
import RobotAvatar from '../RobotAvatar';
|
||||
import RobotInfo from '../RobotInfo';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { Coordinator } from '../../models';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { type Coordinator } from '../../models';
|
||||
|
||||
interface Props {
|
||||
open: boolean;
|
||||
@ -97,7 +97,7 @@ const ProfileDialog = ({ open = false, baseUrl, onClose }: Props): JSX.Element =
|
||||
</Typography>
|
||||
|
||||
{Object.values(federation.coordinators).map((coordinator: Coordinator): JSX.Element => {
|
||||
if (garage.getRobot()?.loading === false) {
|
||||
if (!garage.getRobot()?.loading) {
|
||||
return (
|
||||
<div key={coordinator.shortAlias}>
|
||||
<RobotInfo
|
||||
|
@ -5,10 +5,10 @@ import { DataGrid, type GridColDef, type GridValidRowModel } from '@mui/x-data-g
|
||||
import { type Coordinator } from '../../models';
|
||||
import RobotAvatar from '../RobotAvatar';
|
||||
import { Link, LinkOff } from '@mui/icons-material';
|
||||
import { AppContext, UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import {
|
||||
ActionFederation,
|
||||
UseFederationStoreType,
|
||||
type ActionFederation,
|
||||
type UseFederationStoreType,
|
||||
FederationContext,
|
||||
} from '../../contexts/FederationContext';
|
||||
|
||||
|
@ -43,8 +43,8 @@ import { LoadingButton } from '@mui/lab';
|
||||
import { fiatMethods } from '../PaymentMethods';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import SelectCoordinator from './SelectCoordinator';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
interface MakerFormProps {
|
||||
disableRequest?: boolean;
|
||||
|
@ -13,7 +13,7 @@ import RobotAvatar from '../RobotAvatar';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { useTheme } from '@emotion/react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
|
||||
interface SelectCoordinatorProps {
|
||||
coordinator: string;
|
||||
|
@ -8,7 +8,7 @@ import { type PublicOrder } from '../../models';
|
||||
import OrderTooltip from '../Charts/helpers/OrderTooltip';
|
||||
import getWorldmapGeojson from '../../geo/Web';
|
||||
import MarkerClusterGroup from '@christopherpickering/react-leaflet-markercluster';
|
||||
import { AppContext, UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
|
||||
interface MapPinProps {
|
||||
fillColor: string;
|
||||
|
@ -11,7 +11,7 @@ import {
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import Close from '@mui/icons-material/Close';
|
||||
import { type Page } from '../../basic/NavBar';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
interface NotificationsProps {
|
||||
rewards: number | undefined;
|
||||
|
@ -25,9 +25,9 @@ import { type Order, type Info } from '../../models';
|
||||
import { ConfirmationDialog } from '../Dialogs';
|
||||
import { LoadingButton } from '@mui/lab';
|
||||
import { computeSats } from '../../utils';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
||||
import { UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { type UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
||||
import { type UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
|
||||
interface TakeButtonProps {
|
||||
baseUrl: string;
|
||||
|
@ -40,9 +40,9 @@ import type { Order, Coordinator } from '../../models';
|
||||
import { statusBadgeColor, pn, amountToString, computeSats } from '../../utils';
|
||||
import TakeButton from './TakeButton';
|
||||
import { F2fMapDialog } from '../Dialogs';
|
||||
import { AppContext, UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { type UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
|
||||
interface OrderDetailsProps {
|
||||
coordinator: Coordinator;
|
||||
|
@ -4,8 +4,8 @@ import { Avatar, Badge, Tooltip } from '@mui/material';
|
||||
import { SendReceiveIcon } from '../Icons';
|
||||
import { apiClient } from '../../services/api';
|
||||
import placeholder from './placeholder.json';
|
||||
import { UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
||||
import { UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
import { type UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
||||
import { type UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
|
||||
interface Props {
|
||||
nickname: string | undefined;
|
||||
|
@ -50,9 +50,9 @@ import { type EncryptedChatMessage } from './EncryptedChat';
|
||||
import CollabCancelAlert from './CollabCancelAlert';
|
||||
import { Bolt } from '@mui/icons-material';
|
||||
import { signCleartextMessage } from '../../pgp';
|
||||
import { UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
import { UseGarageStoreType, GarageContext } from '../../contexts/GarageContext';
|
||||
import { UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
||||
import { type UseFederationStoreType, FederationContext } from '../../contexts/FederationContext';
|
||||
import { type UseGarageStoreType, GarageContext } from '../../contexts/GarageContext';
|
||||
import { type UseAppStoreType, AppContext } from '../../contexts/AppContext';
|
||||
|
||||
interface loadingButtonsProps {
|
||||
cancel: boolean;
|
||||
@ -287,7 +287,6 @@ const TradeBox = ({
|
||||
});
|
||||
// If Webln implements locked payments compatibility, this logic might be simplier
|
||||
if (webln === undefined) {
|
||||
return;
|
||||
} else if (order.is_maker && order.status === 0) {
|
||||
webln.sendPayment(order.bond_invoice);
|
||||
setWaitingWebln(true);
|
||||
@ -696,7 +695,7 @@ const TradeBox = ({
|
||||
return { title, titleVariables, titleColor, prompt, bondStatus, titleIcon };
|
||||
};
|
||||
|
||||
const contract = currentOrder.order ? statusToContract(currentOrder.order) : null;
|
||||
const contract = currentOrder.order != null ? statusToContract(currentOrder.order) : null;
|
||||
|
||||
return (
|
||||
<Box>
|
||||
|
@ -2,7 +2,7 @@ import { createContext, type Dispatch, useEffect, useState, type SetStateAction
|
||||
import { type Page } from '../basic/NavBar';
|
||||
import { type OpenDialogs } from '../basic/MainDialogs';
|
||||
|
||||
import { Settings, type Version, type Origin, Favorites } from '../models';
|
||||
import { Settings, type Version, type Origin, type Favorites } from '../models';
|
||||
|
||||
import { getClientVersion, getHost } from '../utils';
|
||||
|
||||
@ -25,10 +25,13 @@ export interface SlideDirection {
|
||||
|
||||
export type TorStatus = 'NOTINIT' | 'STARTING' | '"Done"' | 'DONE';
|
||||
|
||||
const entryPage: Page =
|
||||
window.NativeRobosats === undefined
|
||||
? ((window.location.pathname.split('/')[1] ?? 'robot') as Page)
|
||||
: 'robot';
|
||||
export const isNativeRoboSats = !(window.NativeRobosats === undefined);
|
||||
|
||||
const pageFromPath = window.location.pathname.split('/')[1];
|
||||
const isPagePathEmpty = pageFromPath === '';
|
||||
const entryPage: Page = !isNativeRoboSats
|
||||
? ((isPagePathEmpty ? 'robot' : pageFromPath) as Page)
|
||||
: 'robot';
|
||||
|
||||
export const closeAll = {
|
||||
more: false,
|
||||
@ -73,7 +76,7 @@ const getHostUrl = (network = 'mainnet'): string => {
|
||||
};
|
||||
|
||||
const getOrigin = (network = 'mainnet'): Origin => {
|
||||
let host = getHostUrl(network);
|
||||
const host = getHostUrl(network);
|
||||
let origin: Origin = 'onion';
|
||||
|
||||
if (window.NativeRobosats !== undefined || host.includes('.onion')) {
|
||||
|
@ -8,12 +8,12 @@ import {
|
||||
useContext,
|
||||
} from 'react';
|
||||
|
||||
import { Coordinator, type Order, Federation } from '../models';
|
||||
import { type Coordinator, type Order, Federation } from '../models';
|
||||
|
||||
import { federationLottery } from '../utils';
|
||||
|
||||
import { AppContext, UseAppStoreType } from './AppContext';
|
||||
import { GarageContext, UseGarageStoreType } from './GarageContext';
|
||||
import { AppContext, type UseAppStoreType } from './AppContext';
|
||||
import { GarageContext, type UseGarageStoreType } from './GarageContext';
|
||||
|
||||
// Refresh delays (ms) according to Order status
|
||||
const statusToDelay = [
|
||||
|
@ -1,5 +1,12 @@
|
||||
import { sha256 } from 'js-sha256';
|
||||
import { type Robot, type LimitList, type PublicOrder, Settings, Order, Garage } from '.';
|
||||
import {
|
||||
type Robot,
|
||||
type LimitList,
|
||||
type PublicOrder,
|
||||
type Settings,
|
||||
type Order,
|
||||
type Garage,
|
||||
} from '.';
|
||||
import { apiClient } from '../services/api';
|
||||
import { hexToBase91, validateTokenEntropy } from '../utils';
|
||||
import { compareUpdateLimit } from './Limit.model';
|
||||
@ -182,7 +189,7 @@ export class Coordinator {
|
||||
apiClient
|
||||
.get(this.url, `${this.basePath}/api/limits/`)
|
||||
.then((data) => {
|
||||
if (data) {
|
||||
if (data != null) {
|
||||
const newLimits = data as LimitList;
|
||||
|
||||
for (const currency in this.limits) {
|
||||
@ -232,7 +239,7 @@ export class Coordinator {
|
||||
};
|
||||
|
||||
isUpdated = () => {
|
||||
return ((this.loadingBook === this.loadingInfo) === this.loadingLimits) === false;
|
||||
return !((this.loadingBook === this.loadingInfo) === this.loadingLimits);
|
||||
};
|
||||
|
||||
getBaseUrl = () => {
|
||||
|
@ -1,15 +1,15 @@
|
||||
import {
|
||||
Coordinator,
|
||||
Exchange,
|
||||
Garage,
|
||||
Origin,
|
||||
PublicOrder,
|
||||
Robot,
|
||||
Settings,
|
||||
type Exchange,
|
||||
type Garage,
|
||||
type Origin,
|
||||
type PublicOrder,
|
||||
type Robot,
|
||||
type Settings,
|
||||
defaultExchange,
|
||||
} from '.';
|
||||
import defaultFederation from '../../static/federation.json';
|
||||
import { CurrentOrder } from '../contexts/FederationContext';
|
||||
import { type CurrentOrder } from '../contexts/FederationContext';
|
||||
import { updateExchangeInfo } from './Exchange.model';
|
||||
|
||||
type FederationHooks = 'onCoordinatorUpdate' | 'onFederationReady';
|
||||
@ -40,7 +40,7 @@ export class Federation {
|
||||
public book: PublicOrder[];
|
||||
public loading: boolean;
|
||||
|
||||
public hooks: Record<FederationHooks, (() => void)[]>;
|
||||
public hooks: Record<FederationHooks, Array<() => void>>;
|
||||
|
||||
// Hooks
|
||||
registerHook = (hookName: FederationHooks, fn: () => void): void => {
|
||||
@ -48,7 +48,9 @@ export class Federation {
|
||||
};
|
||||
|
||||
triggerHook = (hookName: FederationHooks): void => {
|
||||
this.hooks[hookName]?.forEach((fn) => fn());
|
||||
this.hooks[hookName]?.forEach((fn) => {
|
||||
fn();
|
||||
});
|
||||
};
|
||||
|
||||
onCoordinatorSaved = (shortAlias: string) => {
|
||||
@ -68,18 +70,18 @@ export class Federation {
|
||||
this.onCoordinatorSaved(shortAlias);
|
||||
};
|
||||
this.loading = true;
|
||||
Object.values(this.coordinators).forEach((coor) =>
|
||||
coor.start(origin, settings, hostUrl, onCoordinatorStarted),
|
||||
);
|
||||
Object.values(this.coordinators).forEach(async (coor) => {
|
||||
await coor.start(origin, settings, hostUrl, onCoordinatorStarted);
|
||||
});
|
||||
};
|
||||
|
||||
update = (): void => {
|
||||
this.loading = false;
|
||||
Object.values(this.coordinators).forEach((coor) =>
|
||||
coor.update(() => {
|
||||
Object.values(this.coordinators).forEach(async (coor) => {
|
||||
await coor.update(() => {
|
||||
this.onCoordinatorSaved(coor.shortAlias);
|
||||
}),
|
||||
);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
updateExchange = () => {
|
||||
@ -108,7 +110,7 @@ export class Federation {
|
||||
return currentOrder;
|
||||
};
|
||||
|
||||
//Coordinators
|
||||
// Coordinators
|
||||
getCoordinator = (shortAlias: string): Coordinator => {
|
||||
return this.coordinators[shortAlias];
|
||||
};
|
||||
|
@ -39,7 +39,7 @@ class Garage {
|
||||
slots: Slot[];
|
||||
currentSlot: number;
|
||||
|
||||
hooks: Record<GarageHooks, (() => void)[]>;
|
||||
hooks: Record<GarageHooks, Array<() => void>>;
|
||||
|
||||
// Hooks
|
||||
registerHook = (hookName: GarageHooks, fn: () => void): void => {
|
||||
@ -47,7 +47,9 @@ class Garage {
|
||||
};
|
||||
|
||||
triggerHook = (hookName: GarageHooks): void => {
|
||||
this.hooks[hookName]?.forEach((fn) => fn());
|
||||
this.hooks[hookName]?.forEach((fn) => {
|
||||
fn();
|
||||
});
|
||||
};
|
||||
|
||||
// Storage
|
||||
|
@ -3,7 +3,7 @@ import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { Paper } from '@mui/material';
|
||||
import BookTable from '../../components/BookTable';
|
||||
import { type GridItem } from 'react-grid-layout';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
|
||||
interface BookWidgetProps {
|
||||
layout: GridItem;
|
||||
|
@ -2,7 +2,7 @@ import React, { useContext } from 'react';
|
||||
import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
import { Paper } from '@mui/material';
|
||||
import DepthChart from '../../components/Charts/DepthChart';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
|
||||
interface DepthChartWidgetProps {
|
||||
layout: any;
|
||||
|
@ -3,8 +3,8 @@ import { AppContext, type UseAppStoreType } from '../../contexts/AppContext';
|
||||
|
||||
import MakerForm from '../../components/MakerForm';
|
||||
import { Paper } from '@mui/material';
|
||||
import { FederationContext, UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
import { FederationContext, type UseFederationStoreType } from '../../contexts/FederationContext';
|
||||
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
|
||||
|
||||
interface MakerWidgetProps {
|
||||
style?: React.StyleHTMLAttributes<HTMLElement>;
|
||||
|
@ -11,7 +11,7 @@
|
||||
// donate to the development fund. This is the only way envisioned to incentivize
|
||||
// donations to the development fund.
|
||||
|
||||
import { Federation } from '../models';
|
||||
import { type Federation } from '../models';
|
||||
|
||||
export default function federationLottery(federation: Federation): string[] {
|
||||
// Create an array to store the coordinator short aliases and their corresponding weights (chance)
|
||||
|
Loading…
Reference in New Issue
Block a user