Skip to content

Commit

Permalink
v3.2.2
Browse files Browse the repository at this point in the history
v3.2.2
  • Loading branch information
platschi authored Sep 13, 2022
2 parents 5d59a39 + ebf5a01 commit f392577
Show file tree
Hide file tree
Showing 207 changed files with 5,121 additions and 1,919 deletions.
14 changes: 12 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
"import/no-anonymous-default-export": "off",
"@next/next/no-img-element": "off",
"no-console": "error",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
],
"import/order": [
"warn",
{
Expand Down Expand Up @@ -89,7 +98,8 @@
}
],
"pathGroupsExcludedImportTypes": []
}
},
]
}
},

}
2 changes: 1 addition & 1 deletion .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
url:
description: Url of website to scan
required: true
default: https://kwenta.io
default: https://kwenta.eth.limo

jobs:
lighthouse_scan:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
![Kwenta CI](https://github.com/Synthetixio/kwenta/workflows/Kwenta%20CI/badge.svg?branch=master) [![Discord](https://img.shields.io/discord/413890591840272394.svg?color=768AD4&label=discord&logo=https%3A%2F%2Fdiscordapp.com%2Fassets%2F8c9701b98ad4372b58f13fd9f65f966e.svg)](https://discordapp.com/channels/413890591840272394/)
![Kwenta CI](https://github.com/kwenta/kwenta/workflows/Kwenta%20CI/badge.svg?branch=main) [![Discord](https://img.shields.io/discord/413890591840272394.svg?color=768AD4&label=discord&logo=https%3A%2F%2Fdiscordapp.com%2Fassets%2F8c9701b98ad4372b58f13fd9f65f966e.svg)](https://discordapp.com/channels/413890591840272394/)
[![Twitter Follow](https://img.shields.io/twitter/follow/kwenta_io.svg?label=kwenta_io&style=social)](https://twitter.com/kwenta_io)

# Kwenta

A dApp enabling derivatives trading with infinite liquidity — powered by the Synthetix protocol.

The trading UI is available on [kwenta.io](https://kwenta.io).<br />
The decentralized trading UI is available at [kwenta.eth.limo](https://kwenta.eth.limo).<br />
ENS link: [kwenta.eth](https://app.ens.domains/name/kwenta.eth).

The latest IPFS hash can be found under [releases](https://github.com/Kwenta/kwenta/releases).

## Tech stack

- Next.js
Expand All @@ -21,7 +23,7 @@ ENS link: [kwenta.eth](https://app.ens.domains/name/kwenta.eth).
## Ethereum stack

- ethers.js v5 - Ethereum wallet implementation.
- Blocknative Onboard - for ethereum wallet connectivity.
- [Rainbowkit](https://github.com/rainbow-me/rainbowkit) - for ethereum wallet onboarding.
- [@synthetixio/contracts-interface](https://github.com/Synthetixio/js-monorepo/tree/master/packages/contracts-interface) - for interactions with the Synthetix protocol.
- [@synthetixio/queries](https://github.com/Synthetixio/js-monorepo/tree/master/packages/queries) - for historical data (powered by [TheGraph](https://thegraph.com/))

Expand Down
Binary file added assets/png/currencies/sOP.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/svg/futures/cross-margin-icon-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/svg/futures/cross-margin-icon-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/futures/deposit-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/futures/isolated-margin-icon-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/futures/isolated-margin-icon-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/futures/onboard-complete-check.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/svg/futures/withdraw-arrow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions components/BaseModal/BaseModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const StyledDialogContent = styled(DialogContent)`
padding: 0;
border: 0;
background: none;
${media.lessThan('sm')`
&&& {
width: 100%;
Expand All @@ -91,9 +92,7 @@ const StyledCard = styled(Card)`
background-color: ${(props) => props.theme.colors.selectedTheme.background};
border-radius: 10px;
position: relative;
box-shadow: ${(props) => props.theme.colors.selectedTheme.button.shadow};
border: ${(props) => props.theme.colors.selectedTheme.border};
${media.lessThan('sm')`
&&& {
margin-top: 30px;
Expand All @@ -102,14 +101,16 @@ const StyledCard = styled(Card)`
`;

const StyledCardHeader = styled(Card.Header)`
justify-content: center;
height: 45px;
font-size: 16px;
font-family: ${(props) => props.theme.fonts.bold};
font-family: ${(props) => props.theme.fonts.regular};
padding: 20px;
`;

const StyledCardBody = styled(Card.Body)`
overflow-y: scroll;
padding: 0 20px;
padding-bottom: 20px;
`;

const DismissButton = styled.button`
Expand All @@ -118,7 +119,7 @@ const DismissButton = styled.button`
right: 20px;
color: ${(props) => props.theme.colors.selectedTheme.gray};
&:hover {
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) => props.theme.colors.selectedTheme.button.text.primary};
}
`;

Expand Down
21 changes: 16 additions & 5 deletions components/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import styled, { css } from 'styled-components';

type ButtonProps = {
size?: 'sm' | 'md' | 'lg' | 'xl';
variant?: 'primary' | 'secondary' | 'outline' | 'alt' | 'success' | 'danger' | 'text' | 'select';
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
variant?: 'primary' | 'secondary' | 'flat' | 'alt' | 'success' | 'danger' | 'text' | 'select';
isActive?: boolean;
isRounded?: boolean;
mono?: boolean;
fullWidth?: boolean;
noOutline?: boolean;
textColor?: 'yellow';
textTransform?: 'none' | 'uppercase' | 'capitalize' | 'lowercase';
};

Expand Down Expand Up @@ -38,14 +39,16 @@ const Button = styled.button<ButtonProps>`
height: auto;
cursor: pointer;
position: relative;
border-radius: 10px;
border-radius: ${(props) => (props.isRounded ? '50px' : '8px')};
padding: 0 14px;
box-sizing: border-box;
text-transform: ${(props) => props.textTransform || 'capitalize'};
outline: none;
white-space: nowrap;
font-size: 17px;
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) =>
(props.textColor && props.theme.colors.selectedTheme.button.text[props.textColor]) ||
props.theme.colors.selectedTheme.button.text.primary};
transition: all 0.1s ease-in-out;
${border}
&:hover {
Expand All @@ -63,7 +66,7 @@ const Button = styled.button<ButtonProps>`
`};
${(props) =>
props.noOutline &&
(props.noOutline || props.variant === 'flat') &&
css`
background: ${(props) => props.theme.colors.selectedTheme.button.fill};
border: ${(props) => props.theme.colors.selectedTheme.border};
Expand Down Expand Up @@ -97,6 +100,14 @@ const Button = styled.button<ButtonProps>`
color: ${props.theme.colors.selectedTheme.red};
`};
${(props) =>
props.size === 'xs' &&
css`
height: 22px;
min-width: 50px;
font-size: 11px;
`};
${(props) =>
props.size === 'sm' &&
css`
Expand Down
2 changes: 1 addition & 1 deletion components/Button/NavButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const StyledButton = styled(Button)`
.title {
color: ${(props) =>
props.isActive
? props.theme.colors.selectedTheme.button.text
? props.theme.colors.selectedTheme.button.text.primary
: props.theme.colors.selectedTheme.gray};
}
Expand Down
4 changes: 2 additions & 2 deletions components/Button/TabButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const StyledButton = styled(Button)<{
text-align: center;
color: ${(props) =>
props.active
? props.theme.colors.selectedTheme.button.text
? props.theme.colors.selectedTheme.button.text.primary
: props.theme.colors.selectedTheme.gray};
}
Expand Down Expand Up @@ -91,7 +91,7 @@ const StyledButton = styled(Button)<{
${(props) =>
css`
${props.nofill ? 'stroke' : 'fill'}: ${props.active
? props.theme.colors.selectedTheme.button.text
? props.theme.colors.selectedTheme.button.text.primary
: props.theme.colors.selectedTheme.gray};
`}
}
Expand Down
2 changes: 1 addition & 1 deletion components/Card/CardHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const CardHeader: FC<CardHeaderProps> = ({

const Container = styled(FlexDivCentered)<{ lowercase: boolean; noBorder: boolean }>`
position: relative;
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) => props.theme.colors.selectedTheme.button.text.primary};
border-bottom: ${(props) => (props.noBorder ? 'none' : `1px solid ${props.theme.colors.navy}`)};
height: 32px;
padding: 0 18px;
Expand Down
2 changes: 1 addition & 1 deletion components/Currency/CurrencyAmount/CurrencyAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Container = styled.span`
`;

const Amount = styled.span`
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) => props.theme.colors.selectedTheme.button.text.primary};
`;
const TotalValue = styled.span`
color: ${(props) => props.theme.colors.selectedTheme.gray};
Expand Down
20 changes: 9 additions & 11 deletions components/Currency/CurrencyIcon/CurrencyIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ const CurrencyIconContainer: FC<CurrencyIconProps> = React.memo(({ className, ..
</Container>
));

const CurrencyIcon: FC<CurrencyIconProps> = React.memo(
({ currencyKey, isDeprecated, url, ...rest }) => {
const props = { width: '30px', height: '30px', alt: currencyKey, ...rest };
const src = SYNTH_ICONS[currencyKey];

if (src) {
return <Image src={src} {...props} />;
} else {
return <TokenIcon currencyKey={currencyKey} {...props} />;
}
const CurrencyIcon: FC<CurrencyIconProps> = React.memo(({ currencyKey, ...rest }) => {
const props = { width: '30px', height: '30px', alt: currencyKey, ...rest };
const src = SYNTH_ICONS[currencyKey];

if (src) {
return <Image src={src} {...props} />;
} else {
return <TokenIcon currencyKey={currencyKey} {...props} />;
}
);
});

const Container = styled.div`
position: relative;
Expand Down
6 changes: 4 additions & 2 deletions components/Currency/CurrencyIcon/TokenIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@ const Placeholder = styled(FlexDivCentered)<{
width?: string;
}>`
border-radius: 100%;
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) => props.theme.colors.selectedTheme.button.text.primary};
border: 2px solid
${(props) =>
props.isDeprecated ? props.theme.colors.red : props.theme.colors.selectedTheme.button.text};
props.isDeprecated
? props.theme.colors.red
: props.theme.colors.selectedTheme.button.text.primary};
font-size: 7px;
font-family: ${(props) => props.theme.fonts.bold};
justify-content: center;
Expand Down
2 changes: 1 addition & 1 deletion components/Currency/CurrencyName/CurrencyName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const NameAndSymbol = styled.span`
`;

const Symbol = styled.div`
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) => props.theme.colors.selectedTheme.button.text.primary};
font-family: ${(props) => props.theme.fonts.bold};
font-size: 14px;
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion components/Currency/CurrencyPrice/CurrencyPrice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const CurrencyPrice: FC<CurrencyPriceProps> = ({
const Container = styled.span`
${ContainerRowMixin};
font-family: ${(props) => props.theme.fonts.mono};
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) => props.theme.colors.selectedTheme.button.text.primary};
`;

const Price = styled.span``;
Expand Down
3 changes: 2 additions & 1 deletion components/Error/Error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { FC, useMemo } from 'react';
import styled from 'styled-components';

import { formatRevert, isUserDeniedError } from 'utils/formatters/error';
import { truncateString } from 'utils/formatters/string';

type ErrorProps = {
message: string;
Expand All @@ -20,7 +21,7 @@ export const Error: FC<ErrorProps> = ({ message, formatter }) => {

if (isUserDeniedError(message) || !message) return null;

return <ErrorContainer>{formattedMessage}</ErrorContainer>;
return <ErrorContainer>{truncateString(formattedMessage)}</ErrorContainer>;
};

const ErrorContainer = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion components/FullScreenModal/FullScreenModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const StyledDialogContent = styled(DialogContent)`
const Title = styled.div`
text-transform: capitalize;
font-family: ${(props) => props.theme.fonts.bold};
color: ${(props) => props.theme.colors.selectedTheme.button.text};
color: ${(props) => props.theme.colors.selectedTheme.button.text.primary};
font-size: 24px;
line-height: 24px;
padding-bottom: 24px;
Expand Down
47 changes: 26 additions & 21 deletions components/InfoBox/InfoBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import styled from 'styled-components';
import { NO_VALUE } from 'constants/placeholder';

export type DetailedInfo = {
value: string;
value: string | React.ReactNode;
keyNode?: React.ReactNode;
valueNode?: React.ReactNode;
color?: 'green' | 'red' | 'gold';
spaceBeneath?: boolean;
};

type InfoBoxProps = {
details: Record<string, DetailedInfo>;
details: Record<string, DetailedInfo | null>;
style?: React.CSSProperties;
className?: string;
disabled?: boolean;
Expand All @@ -22,25 +22,30 @@ type InfoBoxProps = {
const InfoBox: React.FC<InfoBoxProps> = ({ details, style, className, disabled, dataTestId }) => {
return (
<InfoBoxContainer style={style} className={className}>
{Object.entries(details).map(([key, value], index) => (
<React.Fragment key={key}>
<div>
<div className="key">
{key}: {value.keyNode}
</div>
<p
data-testid={`${dataTestId}-${index}`}
className={`${disabled ? 'value closed' : 'value'}${
value.color ? ` ${value.color}` : ''
}`}
>
{disabled ? NO_VALUE : value.value}
{value.valueNode}
</p>
</div>
{value?.spaceBeneath && <br />}
</React.Fragment>
))}
{Object.entries(details).map(([key, value], index) => {
if (value !== null) {
return (
<React.Fragment key={key}>
<div>
<div className="key">
{key}: {value.keyNode}
</div>
<p
data-testid={`${dataTestId}-${index}`}
className={`${disabled ? 'value closed' : 'value'}${
value.color ? ` ${value.color}` : ''
}`}
>
{disabled ? NO_VALUE : value.value}
{value.valueNode}
</p>
</div>
{value?.spaceBeneath && <br />}
</React.Fragment>
);
}
return null;
})}
</InfoBoxContainer>
);
};
Expand Down
Loading

1 comment on commit f392577

@vercel
Copy link

@vercel vercel bot commented on f392577 Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kwenta – ./

kwenta-git-main-kwenta.vercel.app
kwenta.io
kwenta-kwenta.vercel.app

Please sign in to comment.