Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove bignumber.js #40

Open
wants to merge 51 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
60f4e29
a
denis-orbs Aug 14, 2024
c9ebaab
a
denis-orbs Aug 15, 2024
fd87274
a
denis-orbs Aug 15, 2024
430eca3
v2.0.0
denis-orbs Aug 25, 2024
0d3e311
v2.0.1
denis-orbs Aug 26, 2024
b6176e2
v2.0.2
denis-orbs Aug 27, 2024
2a12036
a
denis-orbs Aug 29, 2024
78599f2
a
denis-orbs Sep 4, 2024
c4c47c4
a
denis-orbs Sep 8, 2024
2a2a120
a
denis-orbs Sep 8, 2024
8812ebc
v2.0.3
denis-orbs Sep 8, 2024
9ee9401
a
denis-orbs Sep 10, 2024
edb191a
a
denis-orbs Sep 12, 2024
43bde71
a
denis-orbs Sep 12, 2024
48ad66a
a
denis-orbs Sep 12, 2024
fb78364
v2.0.4
denis-orbs Sep 12, 2024
4b55701
v2.0.5
denis-orbs Sep 12, 2024
10bd410
v2.0.6
denis-orbs Sep 15, 2024
677e922
v2.0.7
denis-orbs Sep 15, 2024
2117585
v2.0.8
denis-orbs Sep 15, 2024
5821dfb
v2.0.9
denis-orbs Sep 15, 2024
bf44164
v2.0.10
denis-orbs Sep 16, 2024
c51bd4e
a
denis-orbs Sep 18, 2024
9c78b63
v2.0.11
denis-orbs Sep 18, 2024
16ab6b5
a
denis-orbs Sep 18, 2024
3b05cff
v2.0.12
denis-orbs Sep 19, 2024
a1d43f3
v2.0.13
denis-orbs Sep 22, 2024
6b05a77
v2.0.14
denis-orbs Sep 23, 2024
2296976
a
denis-orbs Sep 23, 2024
10d842c
a
denis-orbs Sep 26, 2024
164347e
a
denis-orbs Sep 26, 2024
eb807e5
v2.0.15
denis-orbs Sep 29, 2024
9e3603f
v2.0.16
denis-orbs Sep 29, 2024
6dd01da
a
denis-orbs Sep 29, 2024
e701851
v2.0.17
denis-orbs Oct 6, 2024
37e5d47
a
denis-orbs Oct 6, 2024
05fff11
v2.0.18
denis-orbs Oct 6, 2024
5b73d33
v2.0.19
denis-orbs Oct 7, 2024
4b1e164
v2.0.20
denis-orbs Oct 7, 2024
797824f
v2.0.21
denis-orbs Oct 7, 2024
569e180
v2.0.22
denis-orbs Oct 7, 2024
75346a6
v2.0.23
denis-orbs Oct 7, 2024
82fc01c
a
denis-orbs Oct 7, 2024
be13c32
remove bignumber.js
sukhsinghcodes Oct 7, 2024
4c8c727
changed calc to use bigint divide
sukhsinghcodes Oct 7, 2024
bc96ffd
updated ui lib
sukhsinghcodes Oct 7, 2024
8a01d4b
a
denis-orbs Oct 8, 2024
fa5c352
improve safet of using bigint and precision of bigint division
sukhsinghcodes Oct 8, 2024
75c5bcf
more tests + fixes for bigint
sukhsinghcodes Oct 8, 2024
b60c1fd
improve toBigInt to convert decimal numbers to bigint with MAX_DECIMALS
sukhsinghcodes Oct 9, 2024
e62dbd8
added test
sukhsinghcodes Oct 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/** @type {import('ts-jest').JestConfigWithTsJest} **/
module.exports = {
testEnvironment: "node",
transform: {
"^.+.tsx?$": ["ts-jest",{}],
},
};
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"version": "1.1.35",
"version": "2.0.23",
"useNx": false,
"useWorkspaces": true,
"progress": true,
Expand Down
967 changes: 493 additions & 474 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@
"devDependencies": {
"@testing-library/jest-dom": "5.x",
"@testing-library/react": "13.x",
"@types/jest": "^29.5.13",
"@types/styled-components": "^5.1.34",
"@types/uuid": "^10.0.0",
"@types/web3-provider-engine": "^14.0.1",
"@typescript-eslint/eslint-plugin": "5.x",
"@typescript-eslint/parser": "5.x",
"eslint": "8.x",
"eslint-plugin-import": "2.x",
"jest": "29.x",
"jest": "^29.7.0",
"jest-environment-jsdom": "29.x",
"lerna": "6.x",
"nodemon": "2.x",
"react-scripts": "5.x",
"ts-jest": "29.x",
"ts-jest": "^29.2.5",
"typescript": "4.x"
},
"scripts": {
Expand All @@ -29,7 +30,8 @@
"start": "PORT=3005 lerna run start --parallel",
"test": "lerna run test",
"test:watch": "cd packages/lib; npm run test:watch",
"publish": "npm run build && lerna publish --force-publish"
"publish": "npm run build && lerna publish --force-publish",
"sdk:test:unit": "jest packages/sdk"
},
"prettier": {
"printWidth": 180
Expand Down
4 changes: 2 additions & 2 deletions packages/arbidex/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbs-network/twap-ui-arbidex",
"version": "1.1.35",
"version": "2.0.23",
"description": "TWAP UI for Arbidex",
"license": "MIT",
"author": "Orbs",
Expand All @@ -20,7 +20,7 @@
"test": "eslint src"
},
"dependencies": {
"@orbs-network/twap-ui": "^1.1.35",
"@orbs-network/twap-ui": "^2.0.23",
"web3": "1.x"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/baseswap/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbs-network/twap-ui-baseswap",
"version": "1.1.35",
"version": "2.0.23",
"description": "TWAP UI for BaseSwap",
"license": "MIT",
"author": "Orbs",
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@orbs-network/twap": "^2.0.1",
"@orbs-network/twap-ui": "^1.1.35",
"@orbs-network/twap-ui": "^2.0.23",
"web3": "1.x"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/chronos/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbs-network/twap-ui-chronos",
"version": "1.1.35",
"version": "2.0.23",
"description": "TWAP UI for Chronos",
"license": "MIT",
"author": "Orbs",
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@orbs-network/twap": "^2.0.1",
"@orbs-network/twap-ui": "^1.1.35",
"@orbs-network/twap-ui": "^2.0.23",
"web3": "1.x"
},
"peerDependencies": {
Expand Down
49 changes: 2 additions & 47 deletions packages/chronos/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import {
TWAPTokenSelectProps,
hooks,
TWAPProps,
ORDERS_CONTAINER_ID,
Styles,
size,
compact,
TooltipProps,
Status,
Configs,
Token,
} from "@orbs-network/twap-ui";
Expand Down Expand Up @@ -52,6 +50,7 @@ import { VscSettings } from "@react-icons/all-files/vsc/VscSettings";
import { IoIosArrowDown } from "@react-icons/all-files/io/IoIosArrowDown";
import { IoWalletOutline } from "@react-icons/all-files/io5/IoWalletOutline";
import { ThemeProvider } from "styled-components";
import { OrderStatus } from "@orbs-network/twap-sdk";

const useMobile = () => {
return hooks.useWindowWidth() < 768;
Expand All @@ -68,7 +67,7 @@ interface ChronosTWAPProps extends TWAPProps {
const uiPreferences: TwapContextUIPreferences = {
getOrdersTabsLabel: (name: string, amount: number) => `${name} (${amount})`,
qrSize: 120,
orderTabsToExclude: [Status.Canceled],
orderTabsToExclude: [OrderStatus.Canceled],
};

const makeElipsisAddress = (address?: string, padding = 6): string => {
Expand Down Expand Up @@ -370,49 +369,6 @@ const TWAP = (props: ChronosTWAPProps) => {
);
};

const MobileTabs = () => {
const setTab = hooks.stateActions.useSelectOrdersTab();
const tab = useTwapContext().state.selectedOrdersTab;

const [anchorEl, setAnchorEl] = useState<null | HTMLElement>(null);
const open = Boolean(anchorEl);
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
setAnchorEl(event.currentTarget);
};
const handleClose = () => {
setAnchorEl(null);
};

const onSelected = (value: number) => {
setTab(value);
setAnchorEl(null);
};

return (
<>
<StyledMobileTabsMenuButton aria-controls={open ? "basic-menu" : undefined} aria-expanded={open ? "true" : undefined} onClick={handleClick}>
<TwapStyles.StyledRowFlex gap={5}>
<VscSettings />
</TwapStyles.StyledRowFlex>
</StyledMobileTabsMenuButton>
</>
);
};

const OrdersLayout = () => {
const mobile = useMobile();

return (
<StyledOrders className="twap-orders">
<StyledOrdersHeader className="twap-chronos-orders-header">
<StyledOrderHeaderRight className="twap-chronos-orders-header-right">
<Components.Base.Odnp />
</StyledOrderHeaderRight>
</StyledOrdersHeader>
</StyledOrders>
);
};

const TWAPPanel = () => {
return (
<div className="twap-container">
Expand Down Expand Up @@ -461,7 +417,6 @@ const TotalTrades = () => {
</div>
<Styles.StyledRowFlex style={{ alignItems: "stretch" }}>
<Components.ChunkSelector.Input />
<Components.ChunkSelector.Slider />
</Styles.StyledRowFlex>
</div>
</Components.ChunkSelector>
Expand Down
32 changes: 16 additions & 16 deletions packages/dapp-example/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbs-network/twap-ui-dapp-example",
"version": "1.1.35",
"version": "2.0.23",
"private": true,
"license": "MIT",
"scripts": {
Expand All @@ -12,21 +12,21 @@
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@mui/material": "^5.16.4",
"@orbs-network/twap-ui": "^1.1.35",
"@orbs-network/twap-ui-arbidex": "^1.1.35",
"@orbs-network/twap-ui-baseswap": "^1.1.35",
"@orbs-network/twap-ui-chronos": "^1.1.35",
"@orbs-network/twap-ui-kinetix": "^1.1.35",
"@orbs-network/twap-ui-lynex": "^1.1.35",
"@orbs-network/twap-ui-pancake": "^1.1.35",
"@orbs-network/twap-ui-pangolin": "^1.1.35",
"@orbs-network/twap-ui-quickswap": "^1.1.35",
"@orbs-network/twap-ui-spiritswap": "^1.1.35",
"@orbs-network/twap-ui-spookyswap": "^1.1.35",
"@orbs-network/twap-ui-stellaswap": "^1.1.35",
"@orbs-network/twap-ui-sushiswap": "^1.1.35",
"@orbs-network/twap-ui-syncswap": "^1.1.35",
"@orbs-network/twap-ui-thena": "^1.1.35",
"@orbs-network/twap-ui": "^2.0.23",
"@orbs-network/twap-ui-arbidex": "^2.0.23",
"@orbs-network/twap-ui-baseswap": "^2.0.23",
"@orbs-network/twap-ui-chronos": "^2.0.23",
"@orbs-network/twap-ui-kinetix": "^2.0.23",
"@orbs-network/twap-ui-lynex": "^2.0.23",
"@orbs-network/twap-ui-pancake": "^2.0.23",
"@orbs-network/twap-ui-pangolin": "^2.0.23",
"@orbs-network/twap-ui-quickswap": "^2.0.23",
"@orbs-network/twap-ui-spiritswap": "^2.0.23",
"@orbs-network/twap-ui-spookyswap": "^2.0.23",
"@orbs-network/twap-ui-stellaswap": "^2.0.23",
"@orbs-network/twap-ui-sushiswap": "^2.0.23",
"@orbs-network/twap-ui-syncswap": "^2.0.23",
"@orbs-network/twap-ui-thena": "^2.0.23",
"@tanstack/react-query": "4.x",
"@tanstack/react-query-devtools": "4.x",
"@types/react": "18.x",
Expand Down
3 changes: 2 additions & 1 deletion packages/dapp-example/src/Components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ import useMediaQuery from "@mui/material/useMediaQuery";
import { FiMenu } from "@react-icons/all-files/fi/FiMenu";
import Backdrop from "@mui/material/Backdrop";
import { Button, styled, TextField, Typography } from "@mui/material";
import { Components, Config, hooks, isEmpty, size, Styles, Token } from "@orbs-network/twap-ui";
import { Components, hooks, isEmpty, size, Styles, Token } from "@orbs-network/twap-ui";
import { eqIgnoreCase } from "@defi.org/web3-candies";
import { Config } from "@orbs-network/twap-sdk";

import { AiOutlineClose } from "@react-icons/all-files/ai/AiOutlineClose";
import { BsMoon } from "@react-icons/all-files/bs/BsMoon";
Expand Down
4 changes: 2 additions & 2 deletions packages/dapp-example/src/SushiSwap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Dapp, Popup, TokensList, UISelector } from "./Components";
import { ReactNode, useCallback, useEffect, useMemo, useState } from "react";
import MuiTooltip from "@mui/material/Tooltip";
import { SelectorOption, TokenListItem } from "./types";
import { Components, getConfig, mapCollection, size, TooltipProps, Configs } from "@orbs-network/twap-ui";
import { getConfig, mapCollection, size, TooltipProps, Configs } from "@orbs-network/twap-ui";
import { DappProvider } from "./context";
import { baseSwapTokens } from "./BaseSwap";
import { network } from "@defi.org/web3-candies";
Expand Down Expand Up @@ -207,7 +207,7 @@ const useConfig = () => {
};

const DappComponent = () => {
const [selected, setSelected] = useState(SelectorOption.LIMIT);
const [selected, setSelected] = useState(SelectorOption.TWAP);
const { isDarkTheme } = useTheme();

const config = useConfig();
Expand Down
2 changes: 1 addition & 1 deletion packages/dapp-example/src/context.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Config } from "@orbs-network/twap-ui";
import { Config } from "@orbs-network/twap-sdk";
import { createContext, useContext, useMemo } from "react";

interface ContextProps {
Expand Down
4 changes: 2 additions & 2 deletions packages/kinetix/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbs-network/twap-ui-kinetix",
"version": "1.1.35",
"version": "2.0.23",
"description": "TWAP UI for Kinetix",
"license": "MIT",
"author": "Orbs",
Expand All @@ -21,7 +21,7 @@
},
"dependencies": {
"@orbs-network/twap": "^2.0.1",
"@orbs-network/twap-ui": "^1.1.35",
"@orbs-network/twap-ui": "^2.0.23",
"web3": "1.x"
},
"peerDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@orbs-network/twap-ui",
"version": "1.1.35",
"version": "2.0.23",
"description": "TWAP UI",
"license": "MIT",
"author": "Orbs",
Expand All @@ -23,6 +23,7 @@
"dependencies": {
"@defi.org/web3-candies": "^5.0.0",
"@orbs-network/twap": "^2.0.1",
"@orbs-network/twap-sdk": "^2.0.23",
"@react-icons/all-files": "^4.1.0",
"@tanstack/react-query": "4.x",
"bignumber.js": "9.x",
Expand Down
10 changes: 1 addition & 9 deletions packages/lib/src/ErrorHandling.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { styled } from "styled-components";
import React from "react";
import { ErrorBoundary } from "react-error-boundary";
import { useTwapContext } from ".";
import { analytics } from "./analytics";

const StyledContainer = styled("div")<{ isDarkTheme?: number }>(({ theme, isDarkTheme }) => {
return {
Expand Down Expand Up @@ -41,7 +39,6 @@ export function TwapErrorWrapper({ children }: { children: React.ReactNode }) {
return (
<ErrorBoundary
onError={(error) => {
analytics.onUiCreashed(error);
// You can also log the error to an error reporting service like AppSignal
// logErrorToMyService(error, errorInfo);
console.error(error);
Expand All @@ -55,12 +52,7 @@ export function TwapErrorWrapper({ children }: { children: React.ReactNode }) {

export function OrdersErrorWrapper({ children }: { children: React.ReactNode }) {
return (
<ErrorBoundary
onError={(error) => {
analytics.onUiCreashed(error);
}}
fallbackRender={OrdersFallbackUI}
>
<ErrorBoundary fallbackRender={OrdersFallbackUI}>
<>{children}</>
</ErrorBoundary>
);
Expand Down
Loading