chore: 🔧 remove anys

This commit is contained in:
AP 2020-06-07 13:33:47 +02:00
parent 6c6520c9a7
commit 786d88f414
51 changed files with 291 additions and 147 deletions

View file

@ -38,7 +38,7 @@ const Wrapper: React.FC = ({ children }) => {
);
};
const App = ({ Component, pageProps, initialConfig }: any) => (
const App = ({ Component, pageProps, initialConfig }) => (
<>
<Head>
<title>ThunderHub - Lightning Node Manager</title>

View file

@ -5,6 +5,7 @@ import { useAccountState } from 'src/context/AccountContext';
import { useGetChannelsQuery } from 'src/graphql/queries/__generated__/getChannels.generated';
import { GridWrapper } from 'src/components/gridWrapper/GridWrapper';
import { withApollo } from 'config/client';
import { ChannelType } from 'src/graphql/types';
import {
CardWithTitle,
Card,
@ -29,8 +30,8 @@ const BalanceView = () => {
const { minorVersion } = useStatusState();
const { auth } = useAccountState();
const [outgoing, setOutgoing] = useState<{ id: string } | null>();
const [incoming, setIncoming] = useState();
const [outgoing, setOutgoing] = useState<ChannelType | null>();
const [incoming, setIncoming] = useState<ChannelType | null>();
const [amount, setAmount] = useState<number>();
const [maxFee, setMaxFee] = useState<number>();
@ -92,7 +93,7 @@ const BalanceView = () => {
const finalChannels = isOutgoing ? channels : channels.reverse();
return finalChannels.map((channel: any, index: number) => {
return finalChannels.map((channel: ChannelType, index: number) => {
if (!isOutgoing && outgoing && outgoing.id === channel.id) {
return null;
}

View file

@ -110,7 +110,7 @@ const FeesView = () => {
<CardWithTitle>
<SubTitle>Channel Fees</SubTitle>
<Card mobileCardPadding={'0'} mobileNoBackground={true}>
{data.getChannelFees.map((channel: any, index: number) => (
{data.getChannelFees.map((channel, index: number) => (
<FeeCard
channelInfo={channel}
index={index + 1}

View file

@ -31,7 +31,7 @@ const PeersView = () => {
<CardWithTitle>
<SubTitle>Peers</SubTitle>
<Card mobileCardPadding={'0'} mobileNoBackground={true}>
{data.getPeers.map((peer: any, index: number) => (
{data.getPeers.map((peer, index: number) => (
<PeersCard
peer={peer}
index={index + 1}

View file

@ -103,7 +103,7 @@ const TradingView = () => {
</Card>
<Card bottom={'8px'} mobileCardPadding={'0'} mobileNoBackground={true}>
{amountOfOffers <= 0 && <DarkSubTitle>No Offers Found</DarkSubTitle>}
{data.getOffers.map((offer: any, index: number) => (
{data.getOffers.map((offer, index: number) => (
<OfferCard
offer={offer}
index={index + 1}

View file

@ -49,8 +49,8 @@ const TransactionsView = () => {
<CardWithTitle>
<SubTitle>Transactions</SubTitle>
<Card bottom={'8px'} mobileCardPadding={'0'} mobileNoBackground={true}>
{resumeList.map((entry: any, index: number) => {
if (entry.type === 'invoice') {
{resumeList.map((entry, index: number) => {
if (entry.__typename === 'InvoiceType') {
return (
<InvoiceCard
invoice={entry}

View file

@ -35,6 +35,7 @@ import { healthResolvers } from './health/resolvers';
import { healthTypes } from './health/types';
import { githubResolvers } from './github/resolvers';
import { routeTypes } from './route/types';
import { generalResolvers } from './resolvers';
const typeDefs = [
generalTypes,
@ -59,6 +60,7 @@ const typeDefs = [
];
const resolvers = merge(
generalResolvers,
nodeResolvers,
authResolvers,
accountResolvers,

View file

@ -0,0 +1,7 @@
import { GraphQLDate, GraphQLDateTime, GraphQLTime } from 'graphql-iso-date';
export const generalResolvers = {
Date: GraphQLDate,
Time: GraphQLTime,
DateTime: GraphQLDateTime,
};

View file

@ -6,40 +6,34 @@ import {
import { ContextType } from 'server/types/apiTypes';
import { logger } from 'server/helpers/logger';
import { requestLimiter } from 'server/helpers/rateLimiter';
import {
getAuthLnd,
getErrorMsg,
getCorrectAuth,
} from 'server/helpers/helpers';
import { toWithError } from 'server/helpers/async';
import { getLnd } from 'server/helpers/helpers';
import { toWithError, to } from 'server/helpers/async';
export const routeResolvers = {
Query: {
getRoutes: async (_: undefined, params: any, context: ContextType) => {
await requestLimiter(context.ip, 'getRoutes');
const auth = getCorrectAuth(params.auth, context);
const lnd = getAuthLnd(auth);
const lnd = getLnd(params.auth, context);
const { public_key } = await getWalletInfo({ lnd });
const { route } = await getRouteToDestination({
lnd,
outgoing_channel: params.outgoing,
incoming_peer: params.incoming,
destination: public_key,
tokens: params.tokens,
...(params.maxFee && { max_fee: params.maxFee }),
}).catch((error: any) => {
logger.error('Error getting routes: %o', error);
throw new Error(getErrorMsg(error));
});
const { route } = await to(
getRouteToDestination({
lnd,
outgoing_channel: params.outgoing,
incoming_peer: params.incoming,
destination: public_key,
tokens: params.tokens,
...(params.maxFee && { max_fee: params.maxFee }),
})
);
if (!route) {
throw new Error('NoRouteFound');
}
return JSON.stringify(route);
return route;
},
},
ProbeRoute: {

View file

@ -1,6 +1,35 @@
import { gql } from 'apollo-server-micro';
export const routeTypes = gql`
type RouteMessageType {
type: String!
value: String!
}
type RouteHopType {
channel: String!
channel_capacity: Int!
fee: Int!
fee_mtokens: String!
forward: Int!
forward_mtokens: String!
public_key: String!
timeout: Int!
}
type GetRouteType {
confidence: Int
fee: Int!
fee_mtokens: String!
hops: [RouteHopType!]!
messages: [RouteMessageType]
mtokens: String!
safe_fee: Int!
safe_tokens: Int!
timeout: Int!
tokens: Int!
}
type probedRouteHop {
channel: String!
channel_capacity: Int!

View file

@ -9,9 +9,8 @@ export const generalTypes = gql`
cert: String
}
# A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the
# date-time format outlined in section 5.6 of the RFC 3339 profile of the ISO
# 8601 standard for representation of dates and times using the Gregorian calendar.
scalar Date
scalar Time
scalar DateTime
`;
@ -57,7 +56,7 @@ export const queryTypes = gql`
incoming: String!
tokens: Int!
maxFee: Int
): String
): GetRouteType
getPeers(auth: authType!): [peerType]
signMessage(auth: authType!, message: String!): String
verifyMessage(auth: authType!, message: String!, signature: String!): String

View file

@ -118,10 +118,9 @@ export interface ColorButtonProps {
loading?: boolean;
color?: string;
disabled?: boolean;
children?: any;
selected?: boolean;
arrow?: boolean;
onClick?: any;
onClick?: () => void;
withMargin?: string;
mobileMargin?: string;
withBorder?: boolean;
@ -130,7 +129,7 @@ export interface ColorButtonProps {
width?: string;
}
export const ColorButton = ({
export const ColorButton: React.FC<ColorButtonProps> = ({
loading,
color,
disabled,
@ -144,7 +143,7 @@ export const ColorButton = ({
mobileFullWidth,
width,
onClick,
}: ColorButtonProps) => {
}) => {
if (disabled && !loading) {
return (
<DisabledButton

View file

@ -32,18 +32,17 @@ const StyledSingleButton = styled.button<StyledSingleProps>`
`;
interface SingleButtonProps {
children: any;
selected?: boolean;
color?: string;
onClick?: () => void;
}
export const SingleButton = ({
export const SingleButton: React.FC<SingleButtonProps> = ({
children,
selected,
color,
onClick,
}: SingleButtonProps) => {
}) => {
return (
<StyledSingleButton
selected={selected}
@ -74,10 +73,12 @@ const MultiBackground = styled.div<MultiBackProps>`
`;
interface MultiButtonProps {
children: any;
margin?: string;
}
export const MultiButton = ({ children, margin }: MultiButtonProps) => {
export const MultiButton: React.FC<MultiButtonProps> = ({
children,
margin,
}) => {
return <MultiBackground margin={margin}>{children}</MultiBackground>;
};

View file

@ -20,7 +20,7 @@ import { MultiButton, SingleButton } from '../multiButton/MultiButton';
interface LoginProps {
macaroon: string;
color?: string;
callback: any;
callback: (variables: {}) => void;
variables: {};
setModalOpen: (value: boolean) => void;
}

View file

@ -6,7 +6,7 @@ import { ColorButton, ColorButtonProps } from '../colorButton/ColorButton';
import { LoginModal } from './LoginModal';
interface SecureButtonProps extends ColorButtonProps {
callback: any;
callback: (variables: {}) => void;
disabled: boolean;
variables: {};
color?: string;

View file

@ -5,7 +5,7 @@ import Modal from '../../modal/ReactModal';
import { LoginModal } from './LoginModal';
interface SecureButtonProps {
callback: any;
callback: (variables: {}) => void;
variables: {};
color?: string;
}

View file

@ -112,7 +112,7 @@ export const getStatusDot = (status: boolean, type: string) => {
export const renderLine = (
title: string,
content: any,
content: number | string | JSX.Element,
key?: string | number,
deleteCallback?: () => void
) => {

View file

@ -83,8 +83,8 @@ interface InputCompProps {
fullWidth?: boolean;
mobileFullWidth?: boolean;
maxWidth?: string;
onChange: (e: any) => void;
onKeyDown?: (e: any) => void;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
onKeyDown?: (e: React.KeyboardEvent<HTMLInputElement>) => void;
}
export const Input = ({
@ -110,7 +110,7 @@ export const Input = ({
backgroundColor={backgroundColor}
withMargin={withMargin}
mobileMargin={mobileMargin}
onChange={e => onChange(e)}
onChange={onChange}
fullWidth={fullWidth}
mobileFullWidth={mobileFullWidth}
maxWidth={maxWidth}

View file

@ -41,7 +41,6 @@ const NoStyling = styled.a`
`;
interface LinkProps {
children: any;
href?: string;
to?: string;
color?: string | ThemeSet;
@ -55,7 +54,7 @@ interface LinkProps {
const { publicRuntimeConfig } = getConfig();
const { basePath } = publicRuntimeConfig;
export const Link = ({
export const Link: React.FC<LinkProps> = ({
children,
href,
to,
@ -65,7 +64,7 @@ export const Link = ({
fullWidth,
noStyling,
newTab,
}: LinkProps) => {
}) => {
const props = { fontColor: color, underline, inheritColor, fullWidth };
if (!href && !to) return null;

View file

@ -2,7 +2,11 @@ import * as React from 'react';
import { HelpCircle } from 'react-feather';
import styled from 'styled-components';
import ReactTooltip from 'react-tooltip';
import { useAccountState, CLIENT_ACCOUNT } from 'src/context/AccountContext';
import {
useAccountState,
CLIENT_ACCOUNT,
AccountType,
} from 'src/context/AccountContext';
import { CardWithTitle, SubTitle } from '../generic/Styled';
import { useConfigState } from '../../context/ConfigContext';
import { getTooltipType } from '../generic/helpers';
@ -27,7 +31,7 @@ export const NodeBar = () => {
const viewOnlyAccounts = accounts.filter(
account => account.type === CLIENT_ACCOUNT && account.viewOnly !== ''
);
) as AccountType[];
const handleScroll = (decrease?: boolean) => {
if (slider.current !== null) {

View file

@ -3,6 +3,7 @@ import { useInView } from 'react-intersection-observer';
import 'intersection-observer'; // Polyfill
import ScaleLoader from 'react-spinners/ScaleLoader';
import { useGetNodeInfoQuery } from 'src/graphql/queries/__generated__/getNodeInfo.generated';
import { AccountType } from 'src/context/AccountContext';
import { SingleLine, DarkSubTitle, ResponsiveLine } from '../generic/Styled';
import { themeColors } from '../../styles/Themes';
import { Price } from '../price/Price';
@ -16,7 +17,7 @@ export const getStatusDot = (status: boolean) => {
};
interface NodeCardProps {
account: any;
account: AccountType;
accountId: string;
}
@ -117,12 +118,7 @@ export const NodeCard = ({ account, accountId }: NodeCardProps) => {
setIsOpen(false);
}}
>
<NodeInfoModal
account={{
...data,
}}
accountId={accountId}
/>
<NodeInfoModal account={data} accountId={accountId} />
</Modal>
</>
);

View file

@ -1,5 +1,6 @@
import React from 'react';
import { useAccountDispatch } from 'src/context/AccountContext';
import { GetNodeInfoQuery } from 'src/graphql/queries/__generated__/getNodeInfo.generated';
import {
SubTitle,
SingleLine,
@ -12,7 +13,7 @@ import { ColorButton } from '../buttons/colorButton/ColorButton';
import { useStatusDispatch } from '../../context/StatusContext';
interface NodeInfoModalProps {
account: any;
account: GetNodeInfoQuery;
accountId: string;
}

View file

@ -1,4 +1,4 @@
import React, { ReactNode } from 'react';
import React from 'react';
import styled, { css } from 'styled-components';
import { ThemeSet } from 'styled-theming';
import { backgroundColor, mediaWidths } from '../../styles/Themes';
@ -39,20 +39,21 @@ const FixedWidth = styled.div`
}
`;
export const Section = ({
type SectionProps = {
fixedWidth?: boolean;
withColor?: boolean;
color?: string | ThemeSet;
textColor?: string | ThemeSet;
padding?: string;
};
export const Section: React.FC<SectionProps> = ({
fixedWidth = true,
withColor = true,
children,
color,
textColor,
padding,
}: {
fixedWidth?: boolean;
withColor?: boolean;
color?: any;
textColor?: any;
padding?: string;
children: ReactNode;
}) => {
const Fixed = fixedWidth ? FixedWidth : React.Fragment;

View file

@ -36,13 +36,15 @@ export type AuthType =
id: string;
};
export type AccountType = {
type: ACCOUNT_TYPE;
id: string;
} & AccountProps;
export type CompleteAccount =
| ({
type: 'client';
id: string;
} & AccountProps)
| AccountType
| {
type: 'sso' | 'server';
type: SERVER_ACCOUNT_TYPE;
id: string;
name: string;
loggedIn?: boolean;

View file

@ -108,7 +108,7 @@ const stateReducer = (state: State, action: ActionType): State => {
}
};
const ChatProvider = ({ children }: any) => {
const ChatProvider = ({ children }) => {
const [state, dispatch] = useReducer(stateReducer, initialState);
return (

View file

@ -16,10 +16,6 @@ const firstAccount = {
};
const secondAccount = {
name: 'Chao',
host: 'Host2',
admin: 'Admin2',
viewOnly: 'ViewOnly2',
cert: 'Cert2',
id: '1234',
type: SSO_ACCOUNT,
};

View file

@ -11,10 +11,35 @@ export type GetRoutesQueryVariables = {
maxFee?: Types.Maybe<Types.Scalars['Int']>;
};
export type GetRoutesQuery = { __typename?: 'Query' } & Pick<
Types.Query,
'getRoutes'
>;
export type GetRoutesQuery = { __typename?: 'Query' } & {
getRoutes?: Types.Maybe<
{ __typename?: 'GetRouteType' } & Pick<
Types.GetRouteType,
| 'confidence'
| 'fee'
| 'fee_mtokens'
| 'mtokens'
| 'safe_fee'
| 'safe_tokens'
| 'timeout'
| 'tokens'
> & {
hops: Array<
{ __typename?: 'RouteHopType' } & Pick<
Types.RouteHopType,
| 'channel'
| 'channel_capacity'
| 'fee'
| 'fee_mtokens'
| 'forward'
| 'forward_mtokens'
| 'public_key'
| 'timeout'
>
>;
}
>;
};
export const GetRoutesDocument = gql`
query GetRoutes(
@ -30,7 +55,26 @@ export const GetRoutesDocument = gql`
incoming: $incoming
tokens: $tokens
maxFee: $maxFee
)
) {
confidence
fee
fee_mtokens
hops {
channel
channel_capacity
fee
fee_mtokens
forward
forward_mtokens
public_key
timeout
}
mtokens
safe_fee
safe_tokens
timeout
tokens
}
}
`;

View file

@ -14,6 +14,25 @@ export const GET_ROUTES = gql`
incoming: $incoming
tokens: $tokens
maxFee: $maxFee
)
) {
confidence
fee
fee_mtokens
hops {
channel
channel_capacity
fee
fee_mtokens
forward
forward_mtokens
public_key
timeout
}
mtokens
safe_fee
safe_tokens
timeout
tokens
}
}
`;

View file

@ -6,6 +6,11 @@ export type Scalars = {
Boolean: boolean;
Int: number;
Float: number;
/** A date string, such as 2007-12-03, compliant with the `full-date` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */
Date: any;
/** A time string at UTC, such as 10:15:30Z, compliant with the `full-time` format outlined in section 5.6 of the RFC 3339profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */
Time: any;
/** A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the `date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar. */
DateTime: any;
};
@ -44,7 +49,7 @@ export type Query = {
getBackups?: Maybe<Scalars['String']>;
verifyBackups?: Maybe<Scalars['Boolean']>;
recoverFunds?: Maybe<Scalars['Boolean']>;
getRoutes?: Maybe<Scalars['String']>;
getRoutes?: Maybe<GetRouteType>;
getPeers?: Maybe<Array<Maybe<PeerType>>>;
signMessage?: Maybe<Scalars['String']>;
verifyMessage?: Maybe<Scalars['String']>;
@ -891,6 +896,38 @@ export type ChannelsFeeHealth = {
channels?: Maybe<Array<Maybe<ChannelFeeHealth>>>;
};
export type RouteMessageType = {
__typename?: 'RouteMessageType';
type: Scalars['String'];
value: Scalars['String'];
};
export type RouteHopType = {
__typename?: 'RouteHopType';
channel: Scalars['String'];
channel_capacity: Scalars['Int'];
fee: Scalars['Int'];
fee_mtokens: Scalars['String'];
forward: Scalars['Int'];
forward_mtokens: Scalars['String'];
public_key: Scalars['String'];
timeout: Scalars['Int'];
};
export type GetRouteType = {
__typename?: 'GetRouteType';
confidence?: Maybe<Scalars['Int']>;
fee: Scalars['Int'];
fee_mtokens: Scalars['String'];
hops: Array<RouteHopType>;
messages?: Maybe<Array<Maybe<RouteMessageType>>>;
mtokens: Scalars['String'];
safe_fee: Scalars['Int'];
safe_tokens: Scalars['Int'];
timeout: Scalars['Int'];
tokens: Scalars['Int'];
};
export type ProbedRouteHop = {
__typename?: 'probedRouteHop';
channel: Scalars['String'];

View file

@ -1,6 +1,6 @@
import { useEffect, useRef } from 'react';
export const useInterval = (callback: any, delay: number) => {
export const useInterval = (callback: () => void, delay: number) => {
const savedCallback = useRef(callback);
useEffect(() => {

View file

@ -7,6 +7,7 @@ import {
MessageCircle,
Settings,
Home,
Icon,
} from 'react-feather';
import { useTransition, animated } from 'react-spring';
import { useRouter } from 'next/router';
@ -43,7 +44,7 @@ export const Header = () => {
leave: { opacity: 0 },
});
const renderNavButton = (link: string, NavIcon: any) => (
const renderNavButton = (link: string, NavIcon: Icon) => (
<Link to={link} noStyling={true}>
<HeaderNavButton selected={pathname === link}>
<NavIcon size={18} />

View file

@ -14,6 +14,7 @@ import {
CreditCard,
MessageCircle,
BarChart2,
Icon,
} from 'react-feather';
import { useRouter } from 'next/router';
import {
@ -139,7 +140,7 @@ export const Navigation = ({ isBurger, setOpen }: NavigationProps) => {
const renderNavButton = (
title: string,
link: string,
NavIcon: any,
NavIcon: Icon,
open = true
) => (
<Link to={link}>
@ -150,7 +151,7 @@ export const Navigation = ({ isBurger, setOpen }: NavigationProps) => {
</Link>
);
const renderBurgerNav = (title: string, link: string, NavIcon: any) => (
const renderBurgerNav = (title: string, link: string, NavIcon: Icon) => (
<Link to={link}>
<BurgerNav
selected={pathname === link}

View file

@ -1,5 +1,5 @@
import React from 'react';
import { Sun, Moon, ChevronLeft, ChevronRight } from 'react-feather';
import { Sun, Moon, ChevronLeft, ChevronRight, Icon } from 'react-feather';
import styled from 'styled-components';
import { Separation, SingleLine } from '../../../components/generic/Styled';
import {
@ -98,7 +98,7 @@ export const SideSettings = ({ isBurger }: SideSettingsProps) => {
value: string,
text: string,
on = false,
Icon?: any
SideIcon?: Icon
) => (
<SelectedIcon
selected={
@ -116,7 +116,7 @@ export const SideSettings = ({ isBurger }: SideSettingsProps) => {
}}
>
{type === 'currency' && <Symbol>{text}</Symbol>}
{type === 'theme' && <Icon size={18} />}
{type === 'theme' && <SideIcon size={18} />}
</SelectedIcon>
);

View file

@ -3,7 +3,7 @@ import { sortBy } from 'underscore';
import { MessagesType } from 'src/graphql/types';
import { MessageType } from '../views/chat/Chat.types';
export const separateBySender = (chats: any[]) => {
export const separateBySender = chats => {
return groupBy(chats, 'sender');
};

View file

@ -36,7 +36,7 @@ const ErrorLine = styled.div`
hyphens: auto;
`;
export const getErrorContent = (error: any): ReactNode => {
export const getErrorContent = (error): ReactNode => {
const errors = error.graphQLErrors.map(x => x.message);
const renderMessage = errors.map((errorMsg, i) => {

View file

@ -3,6 +3,7 @@ import { toast } from 'react-toastify';
import { useGetRoutesLazyQuery } from 'src/graphql/queries/__generated__/getRoutes.generated';
import { useAccountState } from 'src/context/AccountContext';
import { useCircularRebalanceMutation } from 'src/graphql/mutations/__generated__/circularRebalance.generated';
import { ChannelType } from 'src/graphql/types';
import {
SubCard,
Sub4Title,
@ -20,8 +21,8 @@ import { AdminSwitch } from '../../components/adminSwitch/AdminSwitch';
import { HopCard } from './Balance.styled';
type BalancedRouteProps = {
incoming: any;
outgoing: any;
incoming: ChannelType;
outgoing: ChannelType;
amount: number;
maxFee?: number;
blocked: boolean;
@ -63,7 +64,7 @@ export const BalanceRoute = ({
refetchQueries: ['GetChannels'],
});
const renderHop = (hop: any, index: number) => (
const renderHop = (hop, index: number) => (
<HopCard key={index}>
{renderLine('Channel', hop.channel)}
{renderLine('Fee', hop.fee)}
@ -94,7 +95,7 @@ export const BalanceRoute = ({
const renderRoute = () => {
if (canShow()) {
const route = JSON.parse(data.getRoutes);
const route = data.getRoutes;
return (
<>
<Sub4Title>Route</Sub4Title>
@ -108,7 +109,7 @@ export const BalanceRoute = ({
{renderLine('Confidence', route.confidence)}
{renderLine('Hops', route.hops.length)}
<Separation />
{route.hops.map((hop: any, index: number) =>
{route.hops.map((hop, index: number) =>
renderLine(`${index + 1}`, renderHop(hop, index), index)
)}
</SubCard>
@ -128,7 +129,7 @@ export const BalanceRoute = ({
<SecureButton
callback={payRoute}
disabled={loadingP}
variables={{ route: data.getRoutes }}
variables={{ route: JSON.stringify(data.getRoutes) }}
fullWidth={true}
arrow={true}
withMargin={'0 0 0 8px'}

View file

@ -29,7 +29,7 @@ export const ChainTransactions = () => {
<CardWithTitle>
<SubTitle>Chain Transactions</SubTitle>
<Card mobileCardPadding={'0'} mobileNoBackground={true}>
{data.getChainTransactions.map((transaction: any, index: number) => (
{data.getChainTransactions.map((transaction, index: number) => (
<TransactionsCard
transaction={transaction}
key={index}

View file

@ -1,5 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import { GetTransactionsType } from 'src/graphql/types';
import {
Separation,
SubCard,
@ -22,7 +23,7 @@ const AddMargin = styled.div`
`;
interface TransactionsCardProps {
transaction: any;
transaction: GetTransactionsType;
index: number;
setIndexOpen: (index: number) => void;
indexOpen: number;
@ -69,7 +70,7 @@ export const TransactionsCard = ({
{renderLine('Confirmation Height: ', confirmation_height)}
{renderLine('Fee: ', fee)}
{renderLine('Output Addresses: ', output_addresses.length)}
{output_addresses.map((address: any, index: number) =>
{output_addresses.map((address, index: number) =>
renderLine(`${index + 1}`, address, `${index}`)
)}
</>

View file

@ -29,7 +29,7 @@ export const ChainUtxos = () => {
<CardWithTitle>
<SubTitle>Unspent Utxos</SubTitle>
<Card mobileCardPadding={'0'} mobileNoBackground={true}>
{data.getUtxos.map((utxo: any, index: number) => (
{data.getUtxos.map((utxo, index: number) => (
<UtxoCard
utxo={utxo}
key={index}

View file

@ -1,4 +1,5 @@
import React from 'react';
import { GetUtxosType } from 'src/graphql/types';
import { Separation, SubCard } from '../../../components/generic/Styled';
import { MainInfo } from '../../../components/generic/CardGeneric';
import { renderLine } from '../../../components/generic/helpers';
@ -7,7 +8,7 @@ import { useConfigState } from '../../../context/ConfigContext';
import { usePriceState } from '../../../context/PriceContext';
interface TransactionsCardProps {
utxo: any;
utxo: GetUtxosType;
index: number;
setIndexOpen: (index: number) => void;
indexOpen: number;

View file

@ -185,7 +185,10 @@ export const ChannelCard: React.FC<ChannelCardProps> = ({
{renderLine('Channel Id:', id)}
{renderLine('Commit Fee:', commitFee)}
{renderLine('Commit Weight:', commitWeight)}
{renderLine('Is Static Remote Key:', is_static_remote_key)}
{renderLine(
'Is Static Remote Key:',
is_static_remote_key ? 'True' : 'False'
)}
{renderLine('Local Reserve:', localReserve)}
{renderLine('Remote Reserve:', remoteReserve)}
{renderLine('Time Offline:', formatSeconds(time_offline))}

View file

@ -3,6 +3,7 @@ import { toast } from 'react-toastify';
import { ChevronRight } from 'react-feather';
import { useUpdateFeesMutation } from 'src/graphql/mutations/__generated__/updateFees.generated';
import { InputWithDeco } from 'src/components/input/InputWithDeco';
import { ChannelFeeType } from 'src/graphql/types';
import {
SubCard,
Separation,
@ -22,7 +23,7 @@ import { SecureButton } from '../../components/buttons/secureButton/SecureButton
import { AdminSwitch } from '../../components/adminSwitch/AdminSwitch';
interface FeeCardProps {
channelInfo: any;
channelInfo: ChannelFeeType;
index: number;
setIndexOpen: (index: number) => void;
indexOpen: number;

View file

@ -136,9 +136,8 @@ export const FlowBox = () => {
amount: 0,
};
const totalInvoices: any =
parsedData.length > 0 ? reduce(parsedData) : emptyArray;
const totalPayments: any =
const totalInvoices = parsedData.length > 0 ? reduce(parsedData) : emptyArray;
const totalPayments =
parsedData2.length > 0 ? reduce(parsedData2) : emptyArray;
const flowPie = [

View file

@ -124,13 +124,15 @@ export const ForwardChannelsReport = ({ isTime, isType, color }: Props) => {
};
const renderRoute = (parsed: {}[]) => {
const routes = parsed.map((channel: any, index: number) => (
<ChannelRow key={index}>
<TableLine>{channel.aliasIn}</TableLine>
<TableLine>{channel.aliasOut}</TableLine>
<LastTableLine>{getFormatString(channel[isType])}</LastTableLine>
</ChannelRow>
));
const routes = parsed.map(
(channel: { aliasIn: string; aliasOut: string }, index: number) => (
<ChannelRow key={index}>
<TableLine>{channel.aliasIn}</TableLine>
<TableLine>{channel.aliasOut}</TableLine>
<LastTableLine>{getFormatString(channel[isType])}</LastTableLine>
</ChannelRow>
)
);
return (
<>
@ -145,13 +147,15 @@ export const ForwardChannelsReport = ({ isTime, isType, color }: Props) => {
};
const renderChannels = (parsed: {}[]) => {
const channels = parsed.map((channel: any, index: number) => (
<ChannelRow key={index}>
<TableLine>{`${channel.alias}`}</TableLine>
<DarkSubTitle>{`${channel.name}`}</DarkSubTitle>
<LastTableLine>{getFormatString(channel[isType])}</LastTableLine>
</ChannelRow>
));
const channels = parsed.map(
(channel: { alias: string; name: string }, index: number) => (
<ChannelRow key={index}>
<TableLine>{`${channel.alias}`}</TableLine>
<DarkSubTitle>{`${channel.name}`}</DarkSubTitle>
<LastTableLine>{getFormatString(channel[isType])}</LastTableLine>
</ChannelRow>
)
);
return (
<>

View file

@ -70,9 +70,7 @@ export const ForwardReport = ({ isTime, isType }: Props) => {
};
const total = getLabelString(
parsedData
.map((x: any) => x[isType])
.reduce((a: number, c: number) => a + c, 0)
parsedData.map(x => x[isType]).reduce((a: number, c: number) => a + c, 0)
);
const renderContent = () => {

View file

@ -1,5 +1,6 @@
import React from 'react';
import styled from 'styled-components';
import { HodlOfferPaymentType } from 'src/graphql/types';
import { themeColors, subCardColor } from '../../styles/Themes';
interface MethodProps {
@ -9,7 +10,7 @@ interface MethodProps {
}
interface MethodBoxesProps {
methods: MethodProps[] | undefined;
methods: HodlOfferPaymentType[] | undefined;
}
const StyledMethodBoxes = styled.div`

View file

@ -1,4 +1,4 @@
import React, { useState, useEffect } from 'react';
import React, { useState, useEffect, Dispatch } from 'react';
import ScaleLoader from 'react-spinners/ScaleLoader';
import { toast } from 'react-toastify';
import {
@ -9,14 +9,14 @@ import {
} from 'src/graphql/hodlhodl/__generated__/query.generated';
import { SubTitle } from '../../../components/generic/Styled';
import { SortOptions, NewOptions } from '../OfferConfigs';
import { FilterType } from '../OfferFilters';
import { FilterType, FilterActionType } from '../OfferFilters';
import { themeColors } from '../../../styles/Themes';
import { OptionsLoading } from '../OfferCard.styled';
import { FilteredList } from './FilteredList';
interface FilterProps {
type: string;
dispatch: any;
dispatch: Dispatch<FilterActionType>;
final?: {};
newOptions?: FilterType[];
setModalType: (type: string) => void;

View file

@ -3,11 +3,12 @@ import { ColorButton } from '../../../components/buttons/colorButton/ColorButton
import { OfferModalBox } from '../OfferCard.styled';
import { Input } from '../../../components/input/Input';
import { Sub4Title } from '../../../components/generic/Styled';
import { FilterType } from '../OfferFilters';
interface FilteredProps {
searchable: boolean;
options: any;
handleClick: any;
options: FilterType[];
handleClick: (name: string, option?: {}) => () => void;
}
interface FilteredOptionsProps {
@ -41,7 +42,7 @@ export const FilteredList = ({
setOptions(filtered);
}, [searchTerm, options]);
const handleChange = (event: any) => {
const handleChange = event => {
setSearchTerm(event.target.value);
};

View file

@ -1,5 +1,6 @@
import React from 'react';
import numeral from 'numeral';
import { HodlOfferType } from 'src/graphql/types';
import {
SubCard,
Sub4Title,
@ -27,7 +28,7 @@ const format = (value: number | string, format = '0,0.00') =>
numeral(value).format(format);
interface OfferCardProps {
offer: any;
offer: HodlOfferType;
index: number;
setIndexOpen: (index: number) => void;
indexOpen: number;
@ -116,16 +117,16 @@ export const OfferCard = ({
{renderLine('Balance:', format(balance))}
{renderLine('Payment Window (min):', payment_window_minutes)}
{renderLine('Confirmations:', confirmations)}
{renderLine('Fee Rate:', `${format(author_fee_rate * 100)}%`)}
{renderLine('Fee Rate:', `${format(Number(author_fee_rate) * 100)}%`)}
<Separation />
<Sub4Title>Trader</Sub4Title>
{renderLine('User:', login)}
{renderLine('Online:', online_status)}
{renderLine('Rating:', rating)}
{renderLine('Amount of Trades:', trades_count)}
{renderLine('Verified:', verified)}
{renderLine('Verified:', verified ? 'True' : 'False')}
{renderLine('Verified By:', verified_by)}
{renderLine('Strong Hodler:', strong_hodler)}
{renderLine('Strong Hodler:', strong_hodler ? 'True' : 'False')}
{renderLine('Country:', `${traderCountry} (${traderCode})`)}
{renderLine('Average Payment Time (min):', average_payment_time_minutes)}
{renderLine('Average Release Time (min):', average_release_time_minutes)}
@ -172,7 +173,7 @@ export const OfferCard = ({
{trades_count > 0 && (
<TradesAmount>{`(${trades_count}) `}</TradesAmount>
)}
<Rating rating={rating} />
<Rating rating={Number(rating)} />
</SingleLine>
</ResponsiveLine>
<StyledTitle>{title}</StyledTitle>

View file

@ -21,7 +21,7 @@ import { appendBasePath } from '../../utils/basePath';
import { SortOptions } from './OfferConfigs';
import { FilterModal } from './Modal/FilterModal';
type ActionType = {
export type FilterActionType = {
type: 'addFilter' | 'addSort' | 'removeSort' | 'removeFilter' | 'changeLimit';
state?: QueryProps;
newItem?: {};
@ -29,7 +29,7 @@ type ActionType = {
changeLimit?: number;
};
const reducer = (state: QueryProps, action: ActionType): QueryProps => {
const reducer = (state: QueryProps, action: FilterActionType): QueryProps => {
const { sort, filters } = state;
switch (action.type) {
case 'addSort': {

View file

@ -80,9 +80,9 @@ export const InvoiceCard = ({
{renderLine('Id:', id)}
{renderLine('Chain Address:', chain_address)}
{renderLine('Description Hash:', description_hash)}
{renderLine('Is Canceled:', is_canceled)}
{renderLine('Is Held:', is_held)}
{renderLine('Is Private:', is_private)}
{renderLine('Is Canceled:', is_canceled ? 'True' : 'False')}
{renderLine('Is Held:', is_held ? 'True' : 'False')}
{renderLine('Is Private:', is_private ? 'True' : 'False')}
{renderLine('Secret:', secret)}
</>
);