diff --git a/components/Account/AccountDetails.tsx b/components/Account/AccountDetails.tsx deleted file mode 100644 index c028d0cf..00000000 --- a/components/Account/AccountDetails.tsx +++ /dev/null @@ -1,220 +0,0 @@ -import BigNumber from 'bignumber.js' -import classNames from 'classnames' -import { useState } from 'react' - -import Button from 'components/Button' -import FormattedNumber from 'components/FormattedNumber' -import ArrowRightLine from 'components/Icons/arrow-right-line.svg' -import ChevronDown from 'components/Icons/chevron-down.svg' -import ChevronLeft from 'components/Icons/chevron-left.svg' -import Text from 'components/Text' -import useAccountStats from 'hooks/useAccountStats' -import useCreditAccountPositions from 'hooks/useCreditAccountPositions' -import useMarkets from 'hooks/useMarkets' -import useTokenPrices from 'hooks/useTokenPrices' -import { useAccountDetailsStore } from 'stores' -import { chain } from 'utils/chains' -import { getTokenDecimals, getTokenSymbol } from 'utils/tokens' - -import AccountManageOverlay from './AccountManageOverlay' - -const AccountDetails = () => { - const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) - const isOpen = useAccountDetailsStore((s) => s.isOpen) - - const { data: positionsData, isLoading: isLoadingPositions } = useCreditAccountPositions( - selectedAccount ?? '', - ) - - const { data: tokenPrices } = useTokenPrices() - const { data: marketsData } = useMarkets() - const accountStats = useAccountStats() - - const [showManageMenu, setShowManageMenu] = useState(false) - - const getTokenTotalUSDValue = (amount: string, denom: string) => { - // early return if prices are not fetched yet - if (!tokenPrices) return 0 - - return ( - BigNumber(amount) - .div(10 ** getTokenDecimals(denom)) - .toNumber() * tokenPrices[denom] - ) - } - - return ( -
- -
- -
{}}> - -
- -
-
-
- - Total Position: - - - - - -
-
- - Total Liabilities: - - - - -
-
-
- - Balances - - {isLoadingPositions ? ( -
Loading...
- ) : ( -
-
- - Asset - - - Value - - - Size - - - APY - -
- {positionsData?.coins.map((coin) => ( -
- - {getTokenSymbol(coin.denom)} - - - - - - - - - - - -
- ))} - {positionsData?.debts.map((coin) => ( -
- - {getTokenSymbol(coin.denom)} - - - - - - - - - - -
- ))} -
- )} -
-
- ) -} - -export default AccountDetails diff --git a/components/Account/ConfirmModal.tsx b/components/Account/ConfirmModal.tsx deleted file mode 100644 index 7c277113..00000000 --- a/components/Account/ConfirmModal.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import CircularProgress from 'components/CircularProgress' -import Modal from 'components/Modal' -import Text from 'components/Text' -import { useModalStore } from 'stores' - -const ConfirmModal = () => { - const createOpen = useModalStore((s) => s.createAccountModal) - const deleteOpen = useModalStore((s) => s.deleteAccountModal) - - return ( - -
- - Confirm Transaction - -
- -
-
-
- ) -} - -export default ConfirmModal diff --git a/components/Account/index.tsx b/components/Account/index.tsx deleted file mode 100644 index a48750fa..00000000 --- a/components/Account/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -export { default as AccountDetails } from './AccountDetails' -export { default as AccountManageOverlay } from './AccountManageOverlay' -export { default as AccountNavigation } from './AccountNavigation' -export { default as AccountStatus } from './AccountStatus' -export { default as ConfirmModal } from './ConfirmModal' -export { default as FundAccountModal } from './FundAccountModal' -export { default as WithdrawModal } from './WithdrawModal' diff --git a/components/Borrow/index.tsx b/components/Borrow/index.tsx deleted file mode 100644 index 16a1e665..00000000 --- a/components/Borrow/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export { default as AssetRow } from './AssetRow' -export { default as BorrowTable } from './BorrowTable' diff --git a/components/FormattedNumber.tsx b/components/FormattedNumber.tsx deleted file mode 100644 index 2445390b..00000000 --- a/components/FormattedNumber.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import classNames from 'classnames' -import React, { useEffect, useRef } from 'react' -import { animated, useSpring } from 'react-spring' - -import { formatValue } from 'utils/formatters' - -interface Props { - amount: number - animate?: boolean - className?: string - minDecimals?: number - maxDecimals?: number - thousandSeparator?: boolean - prefix?: boolean | string - suffix?: boolean | string - rounded?: boolean - abbreviated?: boolean -} - -const FormattedNumber = ({ - amount, - animate = false, - className, - minDecimals = 2, - maxDecimals = 2, - thousandSeparator = true, - prefix = false, - suffix = false, - rounded = false, - abbreviated = false, -}: Props) => { - const prevAmountRef = useRef(0) - - useEffect(() => { - if (prevAmountRef.current !== amount) prevAmountRef.current = amount - }, [amount]) - - const springAmount = useSpring({ - number: amount, - from: { number: prevAmountRef.current }, - config: { duration: 1000 }, - }) - - return (prevAmountRef.current === amount && amount === 0) || !animate ? ( - - {formatValue( - amount, - minDecimals, - maxDecimals, - thousandSeparator, - prefix, - suffix, - rounded, - abbreviated, - )} - - ) : ( - - {springAmount.number.to((num) => - formatValue( - num, - minDecimals, - maxDecimals, - thousandSeparator, - prefix, - suffix, - rounded, - abbreviated, - ), - )} - - ) -} - -export default React.memo(FormattedNumber) diff --git a/components/Navigation/index.tsx b/components/Navigation/index.tsx deleted file mode 100644 index 7115fb97..00000000 --- a/components/Navigation/index.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export { default as DesktopNavigation } from './DesktopNavigation' -export { default as menuTree } from './menuTree' -export { default as NavLink } from './NavLink' diff --git a/components/Overlay/index.tsx b/components/Overlay/index.tsx deleted file mode 100644 index d10dab9a..00000000 --- a/components/Overlay/index.tsx +++ /dev/null @@ -1,2 +0,0 @@ -export { default as Overlay } from './Overlay' -export { default as OverlayLink } from './OverlayLink' diff --git a/components/Wallet/index.tsx b/components/Wallet/index.tsx deleted file mode 100644 index 9939cb05..00000000 --- a/components/Wallet/index.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export { default as ConnectButton } from './ConnectButton' -export { default as ConnectedButton } from './ConnectedButton' -export { default as Wallet } from './Wallet' diff --git a/next.config.js b/next.config.js index 394afad7..c1b68c05 100644 --- a/next.config.js +++ b/next.config.js @@ -1,16 +1,9 @@ const { withSentryConfig } = require('@sentry/nextjs') - -// This file sets a custom webpack configuration to use your Next.js app -// with Sentry. -// https://nextjs.org/docs/api-reference/next.config.js/introduction -// https://docs.sentry.io/platforms/javascript/guides/nextjs/ - /** @type {import('next').NextConfig} */ + const nextConfig = { reactStrictMode: true, - // swcMinify: true, sentry: { - // https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#use-hidden-source-map hideSourceMaps: true, }, async redirects() { diff --git a/package.json b/package.json index e77f8ce2..cbd917ef 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,11 @@ "scripts": { "build": "next build", "dev": "next dev", - "format": "eslint . --ext=ts,tsx --fix && prettier --write ./**/*.ts ./**/*.tsx", - "lint": "next lint", - "start": "next start" + "lint": "eslint ./src/ && yarn prettier-check", + "format": "yarn index && eslint ./src/ --fix && prettier --write ./src/", + "prettier-check": "prettier --ignore-path .gitignore --check ./src/", + "start": "next start", + "index": "vscode-generate-index-standalone src/" }, "dependencies": { "@cosmjs/cosmwasm-stargate": "^0.29.4", @@ -27,6 +29,7 @@ "ethereumjs-util": "^7.1.5", "graphql": "^16.6.0", "graphql-request": "^5.0.0", + "moment": "^2.29.4", "next": "12.3.1", "react": "18.2.0", "react-dom": "18.2.0", @@ -34,13 +37,14 @@ "react-spring": "^9.5.5", "react-toastify": "^9.0.8", "react-use-clipboard": "^1.0.9", + "recharts": "^2.2.0", "tailwindcss-border-gradient-radius": "^3.0.1", "use-local-storage-state": "^18.1.1", "zustand": "^4.1.4" }, "devDependencies": { "@svgr/webpack": "^6.4.0", - "@types/node": "18.11.11", + "@types/node": "^18.11.13", "@types/react": "18.0.26", "@types/react-dom": "18.0.9", "autoprefixer": "^10.4.13", @@ -51,6 +55,7 @@ "prettier": "^2.7.1", "prettier-plugin-tailwindcss": "^0.1.13", "tailwindcss": "^3.2.1", - "typescript": "4.8.2" + "typescript": "4.8.2", + "vscode-generate-index-standalone": "^1.6.0" } } diff --git a/public/images/create-account-bg.png b/public/images/create-account-bg.png new file mode 100644 index 00000000..2cf5abcc Binary files /dev/null and b/public/images/create-account-bg.png differ diff --git a/public/images/create-account-bg.webp b/public/images/create-account-bg.webp new file mode 100644 index 00000000..40f35f3b Binary files /dev/null and b/public/images/create-account-bg.webp differ diff --git a/public/images/delete-account-bg.png b/public/images/delete-account-bg.png new file mode 100644 index 00000000..74a0070d Binary files /dev/null and b/public/images/delete-account-bg.png differ diff --git a/public/images/delete-account-bg.webp b/public/images/delete-account-bg.webp new file mode 100644 index 00000000..b5aa99c8 Binary files /dev/null and b/public/images/delete-account-bg.webp differ diff --git a/public/images/fund-bg.png b/public/images/fund-bg.png new file mode 100644 index 00000000..263165e7 Binary files /dev/null and b/public/images/fund-bg.png differ diff --git a/public/images/fund-bg.webp b/public/images/fund-bg.webp new file mode 100644 index 00000000..49600e63 Binary files /dev/null and b/public/images/fund-bg.webp differ diff --git a/public/images/fund-modal-bg.png b/public/images/fund-modal-bg.png deleted file mode 100644 index 6f7d2835..00000000 Binary files a/public/images/fund-modal-bg.png and /dev/null differ diff --git a/src/components/Account/AccountDetails.tsx b/src/components/Account/AccountDetails.tsx new file mode 100644 index 00000000..a0388e3b --- /dev/null +++ b/src/components/Account/AccountDetails.tsx @@ -0,0 +1,111 @@ +import classNames from 'classnames' +import { useEffect, useState } from 'react' + +import { Button, LabelValuePair, PositionsList } from 'components' +import { AccountManageOverlay, RiskChart } from 'components/Account' +import { ArrowRightLine, ChevronDown, ChevronLeft } from 'components/Icons' +import { useAccountStats, useBalances } from 'hooks/data' +import { useAccountDetailsStore, useSettings } from 'stores' +import { chain } from 'utils/chains' +import { lookup } from 'utils/formatters' +import { createRiskData } from 'utils/risk' + +export const AccountDetails = () => { + const enableAnimations = useSettings((s) => s.enableAnimations) + const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) + const isOpen = useAccountDetailsStore((s) => s.isOpen) + const balances = useBalances() + const accountStats = useAccountStats() + + const [showManageMenu, setShowManageMenu] = useState(false) + const [riskData, setRiskData] = useState() + + useEffect(() => { + setRiskData(createRiskData(accountStats?.risk ?? 0)) + }, [accountStats?.risk, selectedAccount]) + + return ( +
+ +
+ +
{}}> + +
+ +
+
+ + +
+ {riskData && } + +
+ ) +} diff --git a/components/Account/AccountManageOverlay.tsx b/src/components/Account/AccountManageOverlay.tsx similarity index 75% rename from components/Account/AccountManageOverlay.tsx rename to src/components/Account/AccountManageOverlay.tsx index d12a164d..184b3174 100644 --- a/components/Account/AccountManageOverlay.tsx +++ b/src/components/Account/AccountManageOverlay.tsx @@ -1,16 +1,9 @@ import { useEffect } from 'react' -import Button from 'components/Button' -import PlusIcon from 'components/Icons/add.svg' -import ArrowDown from 'components/Icons/arrow-down.svg' -import ArrowUp from 'components/Icons/arrow-up.svg' -import ArrowsLeftRight from 'components/Icons/arrows-left-right.svg' -import DeleteIcon from 'components/Icons/rubbish.svg' -import Overlay from 'components/Overlay/Overlay' -import OverlayAction from 'components/Overlay/OverlayLink' -import Text from 'components/Text' -import useCreateCreditAccount from 'hooks/mutations/useCreateCreditAccount' -import useDeleteCreditAccount from 'hooks/mutations/useDeleteCreditAccount' +import { Button, Text } from 'components' +import { Add, ArrowDown, ArrowsLeftRight, ArrowUp, Rubbish } from 'components/Icons' +import { Overlay, OverlayAction } from 'components/Overlay' +import { useCreateCreditAccount, useDeleteCreditAccount } from 'hooks/mutations' import { useAccountDetailsStore, useModalStore } from 'stores' interface Props { @@ -19,7 +12,7 @@ interface Props { show: boolean } -const AccountManageOverlay = ({ className, setShow, show }: Props) => { +export const AccountManageOverlay = ({ className, setShow, show }: Props) => { const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) const { mutate: createCreditAccount, isLoading: isLoadingCreate } = useCreateCreditAccount() @@ -73,13 +66,13 @@ const AccountManageOverlay = ({ className, setShow, show }: Props) => { setShow={setShow} text='Create New Account' onClick={createCreditAccount} - icon={} + icon={} /> } + icon={} /> { ) } - -export default AccountManageOverlay diff --git a/components/Account/AccountNavigation.tsx b/src/components/Account/AccountNavigation.tsx similarity index 89% rename from components/Account/AccountNavigation.tsx rename to src/components/Account/AccountNavigation.tsx index b89de187..df090627 100644 --- a/components/Account/AccountNavigation.tsx +++ b/src/components/Account/AccountNavigation.tsx @@ -1,12 +1,11 @@ import classNames from 'classnames' import { useMemo, useState } from 'react' -import Button from 'components/Button' -import ChevronDownIcon from 'components/Icons/chevron-down.svg' -import Overlay from 'components/Overlay/Overlay' +import { Button } from 'components' +import { ChevronDown } from 'components/Icons' +import { Overlay } from 'components/Overlay' import { useAccountDetailsStore } from 'stores' - -import AccountManageOverlay from './AccountManageOverlay' +import { AccountManageOverlay } from 'components/Account' interface Props { creditAccountsList: string[] @@ -15,7 +14,7 @@ interface Props { const MAX_VISIBLE_CREDIT_ACCOUNTS = 5 -const AccountNavigation = ({ creditAccountsList, selectedAccount }: Props) => { +export const AccountNavigation = ({ creditAccountsList, selectedAccount }: Props) => { const { firstCreditAccounts, restCreditAccounts } = useMemo(() => { return { firstCreditAccounts: creditAccountsList?.slice(0, MAX_VISIBLE_CREDIT_ACCOUNTS) ?? [], @@ -53,7 +52,7 @@ const AccountNavigation = ({ creditAccountsList, selectedAccount }: Props) => { > More - + @@ -92,7 +91,7 @@ const AccountNavigation = ({ creditAccountsList, selectedAccount }: Props) => { > Manage - + @@ -105,5 +104,3 @@ const AccountNavigation = ({ creditAccountsList, selectedAccount }: Props) => { ) } - -export default AccountNavigation diff --git a/components/Account/AccountStatus.tsx b/src/components/Account/AccountStatus.tsx similarity index 85% rename from components/Account/AccountStatus.tsx rename to src/components/Account/AccountStatus.tsx index e0a5522e..8770d622 100644 --- a/components/Account/AccountStatus.tsx +++ b/src/components/Account/AccountStatus.tsx @@ -1,19 +1,16 @@ import BigNumber from 'bignumber.js' import { useEffect } from 'react' +import { Button, FormattedNumber, Gauge, Text } from 'components' import { BorrowCapacity } from 'components/BorrowCapacity' -import Button from 'components/Button' -import FormattedNumber from 'components/FormattedNumber' -import Gauge from 'components/Gauge' -import Text from 'components/Text' -import useCreateCreditAccount from 'hooks/mutations/useCreateCreditAccount' -import useAccountStats from 'hooks/useAccountStats' -import useCreditAccounts from 'hooks/useCreditAccounts' +import { useAccountStats } from 'hooks/data' +import { useCreateCreditAccount } from 'hooks/mutations' +import { useCreditAccounts } from 'hooks/queries' import { useModalStore } from 'stores' import { chain } from 'utils/chains' import { formatValue } from 'utils/formatters' -const AccountStatus = () => { +export const AccountStatus = () => { const accountStats = useAccountStats() const { data: creditAccountsList } = useCreditAccounts() const { mutate: createCreditAccount, isLoading: isLoadingCreate } = useCreateCreditAccount() @@ -81,4 +78,3 @@ const AccountStatus = () => { ) } -export default AccountStatus diff --git a/src/components/Account/ConfirmModal.tsx b/src/components/Account/ConfirmModal.tsx new file mode 100644 index 00000000..2be37333 --- /dev/null +++ b/src/components/Account/ConfirmModal.tsx @@ -0,0 +1,36 @@ +import classNames from 'classnames' + +import { CircularProgress, Modal, Text } from 'components' +import { MarsProtocol } from 'components/Icons' +import { useModalStore } from 'stores' + +export const ConfirmModal = () => { + const createOpen = useModalStore((s) => s.createAccountModal) + const deleteOpen = useModalStore((s) => s.deleteAccountModal) + + return ( + +
+
+
+ +
+ + {createOpen && + 'A small step for a Smart Contracts but a big leap for your financial freedom.'} + {deleteOpen && 'Some rovers have to be recycled once in a while...'} + +
+
+ +
+
+
+ ) +} diff --git a/components/Account/FundAccountModal.tsx b/src/components/Account/FundAccountModal.tsx similarity index 92% rename from components/Account/FundAccountModal.tsx rename to src/components/Account/FundAccountModal.tsx index e3772bb6..f42da491 100644 --- a/components/Account/FundAccountModal.tsx +++ b/src/components/Account/FundAccountModal.tsx @@ -4,19 +4,14 @@ import { useEffect, useMemo, useState } from 'react' import { toast } from 'react-toastify' import useLocalStorageState from 'use-local-storage-state' -import Button from 'components/Button' -import CircularProgress from 'components/CircularProgress' -import MarsProtocolLogo from 'components/Icons/mars-protocol.svg' -import Modal from 'components/Modal' -import Slider from 'components/Slider' -import Text from 'components/Text' -import useDepositCreditAccount from 'hooks/mutations/useDepositCreditAccount' -import useAllBalances from 'hooks/useAllBalances' -import useAllowedCoins from 'hooks/useAllowedCoins' +import { Button, CircularProgress, Modal, Slider, Text } from 'components' +import { MarsProtocol } from 'components/Icons' +import { useDepositCreditAccount } from 'hooks/mutations' +import { useAllBalances, useAllowedCoins } from 'hooks/queries' import { useAccountDetailsStore, useModalStore } from 'stores' import { getTokenDecimals, getTokenSymbol } from 'utils/tokens' -const FundAccountModal = () => { +export const FundAccountModal = () => { // --------------- // STORE // --------------- @@ -105,7 +100,7 @@ const FundAccountModal = () => {
- +
@@ -202,7 +197,7 @@ const FundAccountModal = () => { @@ -218,5 +213,3 @@ const FundAccountModal = () => { ) } - -export default FundAccountModal diff --git a/src/components/Account/RiskChart.tsx b/src/components/Account/RiskChart.tsx new file mode 100644 index 00000000..99baac39 --- /dev/null +++ b/src/components/Account/RiskChart.tsx @@ -0,0 +1,97 @@ +import moment from 'moment' +import { + Area, + AreaChart, + CartesianGrid, + ResponsiveContainer, + Tooltip, + XAxis, + YAxis, +} from 'recharts' + +import { FormattedNumber, Text } from 'components' +import { useAccountStats } from 'hooks/data' +import { useSettings } from 'stores' +import { formatValue } from 'utils/formatters' + +export const RiskChart = ({ data }: RiskChartProps) => { + const enableAnimations = useSettings((s) => s.enableAnimations) + const accountStats = useAccountStats() + const currentRisk = accountStats?.risk ?? 0 + + return ( +
+ +
+ + + + + + + + + + { + return moment(value).format('DD') + }} + fontSize={10.53} + dataKey='date' + /> + + { + if (payload && payload.length) { + const risk = Number(payload[0].value) ?? 0 + return ( +
+ {moment(label).format('MM-DD-YYYY')} + Risk: {formatValue(risk, 0, 0, true, false, '%')} +
+ ) + } + }} + /> + +
+
+
+
+ ) +} diff --git a/components/Account/WithdrawModal.tsx b/src/components/Account/WithdrawModal.tsx similarity index 61% rename from components/Account/WithdrawModal.tsx rename to src/components/Account/WithdrawModal.tsx index 3d2ccbc6..579454fe 100644 --- a/components/Account/WithdrawModal.tsx +++ b/src/components/Account/WithdrawModal.tsx @@ -4,27 +4,27 @@ import classNames from 'classnames' import React, { useEffect, useMemo, useState } from 'react' import { toast } from 'react-toastify' +import { + Button, + CircularProgress, + FormattedNumber, + Gauge, + LabelValuePair, + Modal, + PositionsList, + Slider, + Text, +} from 'components' import { BorrowCapacity } from 'components/BorrowCapacity' -import Button from 'components/Button' -import CircularProgress from 'components/CircularProgress' -import FormattedNumber from 'components/FormattedNumber' -import Gauge from 'components/Gauge' -import Modal from 'components/Modal' -import Slider from 'components/Slider' -import Text from 'components/Text' -import useWithdrawFunds from 'hooks/mutations/useWithdrawFunds' -import useAccountStats, { AccountStatsAction } from 'hooks/useAccountStats' -import useAllBalances from 'hooks/useAllBalances' -import useCalculateMaxWithdrawAmount from 'hooks/useCalculateMaxWithdrawAmount' -import useCreditAccountPositions from 'hooks/useCreditAccountPositions' -import useMarkets from 'hooks/useMarkets' -import useTokenPrices from 'hooks/useTokenPrices' +import { useAccountStats, useBalances, useCalculateMaxWithdrawAmount } from 'hooks/data' +import { useWithdrawFunds } from 'hooks/mutations' +import { useCreditAccountPositions, useTokenPrices } from 'hooks/queries' import { useAccountDetailsStore, useModalStore } from 'stores' import { chain } from 'utils/chains' -import { formatValue } from 'utils/formatters' +import { formatValue, lookup } from 'utils/formatters' import { getTokenDecimals, getTokenSymbol } from 'utils/tokens' -const WithdrawModal = () => { +export const WithdrawModal = () => { // --------------- // STORE // --------------- @@ -45,9 +45,8 @@ const WithdrawModal = () => { // --------------- // EXTERNAL HOOKS // --------------- - const { data: balancesData } = useAllBalances() const { data: tokenPrices } = useTokenPrices() - const { data: marketsData } = useMarkets() + const balances = useBalances() const selectedTokenSymbol = getTokenSymbol(selectedToken) const selectedTokenDecimals = getTokenDecimals(selectedToken) @@ -100,14 +99,6 @@ const WithdrawModal = () => { const maxWithdrawAmount = useCalculateMaxWithdrawAmount(selectedToken, isBorrowEnabled) - const walletAmount = useMemo(() => { - if (!selectedToken) return 0 - - return BigNumber(balancesData?.find((balance) => balance.denom === selectedToken)?.amount ?? 0) - .div(10 ** selectedTokenDecimals) - .toNumber() - }, [balancesData, selectedToken, selectedTokenDecimals]) - useEffect(() => { if (positionsData && positionsData.coins.length > 0) { // initialize selected token when allowedCoins fetch data is available @@ -248,7 +239,7 @@ const WithdrawModal = () => { @@ -310,130 +301,28 @@ const WithdrawModal = () => { )}
-
- - Total Position: - - - - - -
-
- - Total Liabilities: - - - - -
-
-
- - Balances - - {isLoadingPositions ? ( -
Loading...
- ) : ( -
-
- - Asset - - - Value - - - Size - - - APY - -
- {positionsData?.coins.map((coin) => ( -
- - {getTokenSymbol(coin.denom)} - - - - - - - - - - - -
- ))} - {positionsData?.debts.map((coin) => ( -
- - {getTokenSymbol(coin.denom)} - - - - - - - - - - -
- ))} -
- )} + +
+ ) } - -export default WithdrawModal diff --git a/src/components/Account/index.ts b/src/components/Account/index.ts new file mode 100644 index 00000000..34946daa --- /dev/null +++ b/src/components/Account/index.ts @@ -0,0 +1,10 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { AccountDetails } from './AccountDetails' +export { AccountManageOverlay } from './AccountManageOverlay' +export { AccountNavigation } from './AccountNavigation' +export { AccountStatus } from './AccountStatus' +export { ConfirmModal } from './ConfirmModal' +export { FundAccountModal } from './FundAccountModal' +export { RiskChart } from './RiskChart' +export { WithdrawModal } from './WithdrawModal' +// @endindex diff --git a/components/Borrow/AssetRow.tsx b/src/components/Borrow/AssetRow.tsx similarity index 86% rename from components/Borrow/AssetRow.tsx rename to src/components/Borrow/AssetRow.tsx index 8de92a8b..d49d7dcc 100644 --- a/components/Borrow/AssetRow.tsx +++ b/src/components/Borrow/AssetRow.tsx @@ -1,9 +1,8 @@ import Image from 'next/image' import React, { useState } from 'react' -import ChevronUpIcon from 'components/Icons/chevron-up.svg' -import ChevronDownIcon from 'components/Icons/chevron-down.svg' -import Button from 'components/Button' +import { Button } from 'components' +import { ChevronDown, ChevronUp } from 'components/Icons' import { formatCurrency } from 'utils/formatters' type AssetRowProps = { @@ -23,7 +22,7 @@ type AssetRowProps = { onRepayClick: () => void } -const AssetRow = ({ data, onBorrowClick, onRepayClick }: AssetRowProps) => { +export const AssetRow = ({ data, onBorrowClick, onRepayClick }: AssetRowProps) => { const [isExpanded, setIsExpanded] = useState(false) return ( @@ -54,7 +53,7 @@ const AssetRow = ({ data, onBorrowClick, onRepayClick }: AssetRowProps) => {
{data.marketLiquidity}
-
{isExpanded ? : }
+
{isExpanded ? : }
{isExpanded && ( @@ -84,5 +83,3 @@ const AssetRow = ({ data, onBorrowClick, onRepayClick }: AssetRowProps) => { ) } - -export default AssetRow diff --git a/components/Borrow/BorrowTable.tsx b/src/components/Borrow/BorrowTable.tsx similarity index 91% rename from components/Borrow/BorrowTable.tsx rename to src/components/Borrow/BorrowTable.tsx index 2be7ddcf..bc8aba77 100644 --- a/components/Borrow/BorrowTable.tsx +++ b/src/components/Borrow/BorrowTable.tsx @@ -9,11 +9,9 @@ import { import Image from 'next/image' import React from 'react' -import ChevronUpIcon from 'components/Icons/chevron-up.svg' -import ChevronDownIcon from 'components/Icons/chevron-down.svg' +import { ChevronDown, ChevronUp } from 'components/Icons' import { formatCurrency } from 'utils/formatters' - -import AssetRow from './AssetRow' +import { AssetRow } from 'components/Borrow' interface Market { denom: string @@ -34,7 +32,7 @@ type Props = { onRepayClick: (denom: string) => void } -const BorrowTable = ({ data, onBorrowClick, onRepayClick }: Props) => { +export const BorrowTable = ({ data, onBorrowClick, onRepayClick }: Props) => { const [sorting, setSorting] = React.useState([]) const columns = React.useMemo[]>( @@ -91,9 +89,7 @@ const BorrowTable = ({ data, onBorrowClick, onRepayClick }: Props) => { width: 150, cell: ({ row }) => (
-
- {row.getIsExpanded() ? : } -
+
{row.getIsExpanded() ? : }
), }, @@ -158,5 +154,3 @@ const BorrowTable = ({ data, onBorrowClick, onRepayClick }: Props) => { ) } - -export default BorrowTable diff --git a/src/components/Borrow/index.ts b/src/components/Borrow/index.ts new file mode 100644 index 00000000..edf81c9e --- /dev/null +++ b/src/components/Borrow/index.ts @@ -0,0 +1,4 @@ +// @index(['./**/*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { AssetRow } from './AssetRow' +export { BorrowTable } from './BorrowTable' +// @endindex diff --git a/components/BorrowCapacity.tsx b/src/components/BorrowCapacity.tsx similarity index 67% rename from components/BorrowCapacity.tsx rename to src/components/BorrowCapacity.tsx index 107af20c..86d8c2de 100644 --- a/components/BorrowCapacity.tsx +++ b/src/components/BorrowCapacity.tsx @@ -1,9 +1,8 @@ import classNames from 'classnames' import { useEffect, useState } from 'react' -import FormattedNumber from 'components/FormattedNumber' -import Text from 'components/Text' -import Tooltip from 'components/Tooltip' +import { FormattedNumber, Text, Tooltip } from 'components' +import { useSettings } from 'stores' interface Props { balance: number @@ -28,26 +27,25 @@ export const BorrowCapacity = ({ hideValues, decimals = 2, }: Props) => { + const enableAnimations = useSettings((s) => s.enableAnimations) + const [percentOfMaxRound, setPercentOfMaxRound] = useState(0) const [percentOfMaxRange, setPercentOfMaxRange] = useState(0) const [limitPercentOfMax, setLimitPercentOfMax] = useState(0) - useEffect( - () => { - if (max === 0) { - setPercentOfMaxRound(0) - setPercentOfMaxRange(0) - setLimitPercentOfMax(0) - return - } + useEffect(() => { + if (max === 0) { + setPercentOfMaxRound(0) + setPercentOfMaxRange(0) + setLimitPercentOfMax(0) + return + } - const pOfMax = +((balance / max) * 100) - setPercentOfMaxRound(+(Math.round(pOfMax * 100) / 100)) - setPercentOfMaxRange(Math.min(Math.max(pOfMax, 0), 100)) - setLimitPercentOfMax((limit / max) * 100) - }, // eslint-disable-next-line react-hooks/exhaustive-deps - [balance, max], - ) + const pOfMax = +((balance / max) * 100) + setPercentOfMaxRound(+(Math.round(pOfMax * 100) / 100)) + setPercentOfMaxRange(Math.min(Math.max(pOfMax, 0), 100)) + setLimitPercentOfMax((limit / max) * 100) + }, [balance, max, limit]) return (
@@ -63,7 +61,8 @@ export const BorrowCapacity = ({ {!hideValues && (
@@ -79,7 +78,10 @@ export const BorrowCapacity = ({ >
{showPercentageText ? ( - + {max !== 0 && ( { +export const BorrowModal = ({ show, onClose, tokenDenom }: Props) => { const [amount, setAmount] = useState(0) const [isBorrowToCreditAccount, setIsBorrowToCreditAccount] = useState(false) const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) - const { data: positionsData, isLoading: isLoadingPositions } = useCreditAccountPositions( - selectedAccount ?? '', - ) + + const balances = useBalances() const { actions, borrowAmount } = useMemo(() => { const borrowAmount = BigNumber(amount) @@ -124,17 +122,6 @@ const BorrowModal = ({ show, onClose, tokenDenom }: Props) => { setAmount(0) } - const getTokenTotalUSDValue = (amount: string, denom: string) => { - // early return if prices are not fetched yet - if (!tokenPrices) return 0 - - return ( - BigNumber(amount) - .div(10 ** getTokenDecimals(denom)) - .toNumber() * tokenPrices[denom] - ) - } - return ( @@ -310,62 +297,7 @@ const BorrowModal = ({ show, onClose, tokenDenom }: Props) => {
-
-

Balances

- {isLoadingPositions ? ( -
Loading...
- ) : ( - - - - - - - - - - - {accountStats?.assets.map((coin) => ( - - - - - - - ))} - {accountStats?.debts.map((coin) => ( - - - - - - - ))} - -
AssetValueSizeAPY
{getTokenSymbol(coin.denom)} - {formatCurrency(getTokenTotalUSDValue(coin.amount, coin.denom))} - - {BigNumber(coin.amount) - .div(10 ** getTokenDecimals(coin.denom)) - .toNumber() - .toLocaleString(undefined, { - maximumFractionDigits: getTokenDecimals(coin.denom), - })} - -
{getTokenSymbol(coin.denom)} - -{formatCurrency(getTokenTotalUSDValue(coin.amount, coin.denom))} - - - - {BigNumber(coin.amount) - .div(10 ** getTokenDecimals(coin.denom)) - .toNumber() - .toLocaleString(undefined, { - maximumFractionDigits: 6, - })} - - -{(Number(marketsData?.[coin.denom].borrow_rate) * 100).toFixed(1)}% -
- )} -
+
@@ -375,5 +307,3 @@ const BorrowModal = ({ show, onClose, tokenDenom }: Props) => { ) } - -export default BorrowModal diff --git a/components/Button.tsx b/src/components/Button.tsx similarity index 91% rename from components/Button.tsx rename to src/components/Button.tsx index 233ae6bd..673ac9d4 100644 --- a/components/Button.tsx +++ b/src/components/Button.tsx @@ -1,7 +1,8 @@ import classNames from 'classnames' import React, { LegacyRef, ReactNode } from 'react' -import CircularProgress from 'components/CircularProgress' +import { CircularProgress } from 'components' +import { useSettings } from 'stores' interface Props { children?: string | ReactNode @@ -57,7 +58,7 @@ export const buttonVariantClasses = { text: 'border-none bg-transparent', } -const Button = React.forwardRef(function Button( +export const Button = React.forwardRef(function Button( { children, className = '', @@ -73,6 +74,7 @@ const Button = React.forwardRef(function Button( ref, ) { const buttonClasses = [] + const enableAnimations = useSettings((s) => s.enableAnimations) switch (variant) { case 'round': @@ -96,7 +98,8 @@ const Button = React.forwardRef(function Button( return (
) } - -export default Navigation diff --git a/components/Navigation/NavLink.tsx b/src/components/Navigation/NavLink.tsx similarity index 88% rename from components/Navigation/NavLink.tsx rename to src/components/Navigation/NavLink.tsx index 4ed6d499..3ea7ec7f 100644 --- a/components/Navigation/NavLink.tsx +++ b/src/components/Navigation/NavLink.tsx @@ -8,7 +8,7 @@ interface Props { children: string | ReactNode } -const NavLink = ({ href, children }: Props) => { +export const NavLink = ({ href, children }: Props) => { const router = useRouter() const isActive = router.pathname === href @@ -25,5 +25,3 @@ const NavLink = ({ href, children }: Props) => { ) } - -export default NavLink diff --git a/components/Navigation/SearchInput.tsx b/src/components/Navigation/SearchInput.tsx similarity index 74% rename from components/Navigation/SearchInput.tsx rename to src/components/Navigation/SearchInput.tsx index dddc330c..b5c10949 100644 --- a/components/Navigation/SearchInput.tsx +++ b/src/components/Navigation/SearchInput.tsx @@ -1,8 +1,8 @@ -import SearchIcon from 'components/Icons/search.svg' -const SearchInput = () => ( +import { Search } from 'components/Icons' +export const SearchInput = () => (
- + ( />
) - -export default SearchInput diff --git a/src/components/Navigation/index.ts b/src/components/Navigation/index.ts new file mode 100644 index 00000000..89a98d65 --- /dev/null +++ b/src/components/Navigation/index.ts @@ -0,0 +1,6 @@ +// @index(['./*.ts*'], f => `export { ${f.name} } from '${f.path}'`) +export { DesktopNavigation } from './DesktopNavigation' +export { menuTree } from './menuTree' +export { NavLink } from './NavLink' +export { SearchInput } from './SearchInput' +// @endindex diff --git a/components/Navigation/menuTree.ts b/src/components/Navigation/menuTree.ts similarity index 82% rename from components/Navigation/menuTree.ts rename to src/components/Navigation/menuTree.ts index 2664d5d4..016d6a20 100644 --- a/components/Navigation/menuTree.ts +++ b/src/components/Navigation/menuTree.ts @@ -1,9 +1,7 @@ -const navItems = [ +export const menuTree = [ { href: '/trade', label: 'Trade' }, { href: '/earn', label: 'Earn' }, { href: '/borrow', label: 'Borrow' }, { href: '/portfolio', label: 'Portfolio' }, { href: '/council', label: 'Council' }, ] - -export default navItems diff --git a/components/Overlay/Overlay.tsx b/src/components/Overlay/Overlay.tsx similarity index 87% rename from components/Overlay/Overlay.tsx rename to src/components/Overlay/Overlay.tsx index 7a88ac88..7bffb7ca 100644 --- a/components/Overlay/Overlay.tsx +++ b/src/components/Overlay/Overlay.tsx @@ -9,7 +9,7 @@ interface Props { setShow: (show: boolean) => void } -const Overlay = ({ children, content, className, show, setShow }: Props) => { +export const Overlay = ({ children, content, className, show, setShow }: Props) => { const onClickAway = () => { setShow(false) } @@ -32,5 +32,3 @@ const Overlay = ({ children, content, className, show, setShow }: Props) => { ) : null } - -export default Overlay diff --git a/components/Overlay/OverlayLink.tsx b/src/components/Overlay/OverlayAction.tsx similarity index 80% rename from components/Overlay/OverlayLink.tsx rename to src/components/Overlay/OverlayAction.tsx index 1632190b..117340ea 100644 --- a/components/Overlay/OverlayLink.tsx +++ b/src/components/Overlay/OverlayAction.tsx @@ -1,7 +1,7 @@ import classNames from 'classnames' import { ReactNode } from 'react' -import Button from 'components/Button' +import { Button } from 'components' interface Props { className?: string @@ -11,7 +11,7 @@ interface Props { text: string | ReactNode } -const OverlayAction = ({ className, icon, onClick, setShow, text }: Props) => { +export const OverlayAction = ({ className, icon, onClick, setShow, text }: Props) => { return ( ) } - -export default OverlayAction diff --git a/src/components/Overlay/index.ts b/src/components/Overlay/index.ts new file mode 100644 index 00000000..c35f4561 --- /dev/null +++ b/src/components/Overlay/index.ts @@ -0,0 +1,4 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { Overlay } from './Overlay' +export { OverlayAction } from './OverlayAction' +// @endindex diff --git a/src/components/PositionsList.tsx b/src/components/PositionsList.tsx new file mode 100644 index 00000000..6b5f8db3 --- /dev/null +++ b/src/components/PositionsList.tsx @@ -0,0 +1,61 @@ +import classNames from 'classnames' + +import { FormattedNumber, Text } from 'components' + +interface Props { + title: string + data?: PositionsData[] +} + +export const PositionsList = (props: Props) => { + if (!props?.data || props.data?.length === 0) return null + const arrayKeys = Object.keys(props.data[0]) + + return ( +
+ + {props.title} + +
+ <> +
+ {arrayKeys.map((label, index) => ( + + {label} + + ))} +
+ {props.data && + props.data.map((positionsData: PositionsData, index) => ( +
+ {arrayKeys.map((key, index) => { + if (index === 0) + return ( + + {positionsData[key].amount} + + ) + return ( + + {positionsData[key].format && positionsData[key].format === 'number' ? ( + + ) : ( + positionsData[key]?.amount || '' + )} + + ) + })} +
+ ))} + +
+
+ ) +} diff --git a/components/ProgressBar.tsx b/src/components/ProgressBar.tsx similarity index 90% rename from components/ProgressBar.tsx rename to src/components/ProgressBar.tsx index 20edc483..c6374196 100644 --- a/components/ProgressBar.tsx +++ b/src/components/ProgressBar.tsx @@ -4,7 +4,7 @@ type Props = { value: number } -const ProgressBar = ({ value }: Props) => { +export const ProgressBar = ({ value }: Props) => { const percentageValue = `${(value * 100).toFixed(0)}%` let bgColorClass = 'bg-green-500' @@ -26,5 +26,3 @@ const ProgressBar = ({ value }: Props) => {
) } - -export default ProgressBar diff --git a/components/RepayModal.tsx b/src/components/RepayModal.tsx similarity index 92% rename from components/RepayModal.tsx rename to src/components/RepayModal.tsx index c990fc57..0b12efa6 100644 --- a/components/RepayModal.tsx +++ b/src/components/RepayModal.tsx @@ -5,17 +5,12 @@ import React, { useMemo, useState } from 'react' import { NumericFormat } from 'react-number-format' import { toast } from 'react-toastify' -import Button from 'components/Button' -import CircularProgress from 'components/CircularProgress' -import ContainerSecondary from 'components/ContainerSecondary' -import Slider from 'components/Slider' -import useRepayFunds from 'hooks/mutations/useRepayFunds' -import useAllBalances from 'hooks/useAllBalances' -import useCreditAccountPositions from 'hooks/useCreditAccountPositions' -import useTokenPrices from 'hooks/useTokenPrices' +import { Button, CircularProgress, ContainerSecondary, Slider } from 'components' +import { useRepayFunds } from 'hooks/mutations' import { useAccountDetailsStore } from 'stores' import { formatCurrency } from 'utils/formatters' import { getTokenDecimals, getTokenSymbol } from 'utils/tokens' +import { useAllBalances, useCreditAccountPositions, useTokenPrices } from 'hooks/queries' // 0.001% buffer / slippage to avoid repay action from not fully repaying the debt amount const REPAY_BUFFER = 1.00001 @@ -26,7 +21,7 @@ type Props = { tokenDenom: string } -const RepayModal = ({ show, onClose, tokenDenom }: Props) => { +export const RepayModal = ({ show, onClose, tokenDenom }: Props) => { const [amount, setAmount] = useState(0) const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) @@ -190,5 +185,3 @@ const RepayModal = ({ show, onClose, tokenDenom }: Props) => { ) } - -export default RepayModal diff --git a/components/Slider.tsx b/src/components/Slider.tsx similarity index 92% rename from components/Slider.tsx rename to src/components/Slider.tsx index 702906e3..cb07abb9 100644 --- a/components/Slider.tsx +++ b/src/components/Slider.tsx @@ -8,7 +8,7 @@ type Props = { onMaxClick: () => void } -const Slider = ({ className, value, onChange, onMaxClick }: Props) => { +export const Slider = ({ className, value, onChange, onMaxClick }: Props) => { return (
{
) } - -export default Slider diff --git a/components/Text.tsx b/src/components/Text.tsx similarity index 96% rename from components/Text.tsx rename to src/components/Text.tsx index b2a034e7..5fb615f5 100644 --- a/components/Text.tsx +++ b/src/components/Text.tsx @@ -13,7 +13,7 @@ interface Props { const headlines = ['h1', 'h2', 'h3', 'h4'] const headMap = ['6xl', '5xl', '4xl', '3xl'] -const Text = ({ +export const Text = ({ children, className, monospace = false, @@ -37,5 +37,3 @@ const Text = ({ ) } - -export default Text diff --git a/components/TextLink.tsx b/src/components/TextLink.tsx similarity index 95% rename from components/TextLink.tsx rename to src/components/TextLink.tsx index 3c277aa3..723f6e56 100644 --- a/components/TextLink.tsx +++ b/src/components/TextLink.tsx @@ -26,7 +26,7 @@ const textSizeClasses = { large: 'text-lg', } -const TextLink = React.forwardRef(function TextLink( +export const TextLink = React.forwardRef(function TextLink( { children, className = '', @@ -70,5 +70,3 @@ const TextLink = React.forwardRef(function TextLink( ) }) - -export default TextLink diff --git a/components/Tooltip.tsx b/src/components/Tooltip.tsx similarity index 79% rename from components/Tooltip.tsx rename to src/components/Tooltip.tsx index a7ba76de..22911338 100644 --- a/components/Tooltip.tsx +++ b/src/components/Tooltip.tsx @@ -2,7 +2,8 @@ import Tippy from '@tippyjs/react' import classNames from 'classnames' import { ReactNode } from 'react' -import TooltipIcon from 'components/Icons/tooltip.svg' +import { Questionmark } from 'components/Icons' +import { useSettings } from 'stores' interface Props { children?: ReactNode | string @@ -13,7 +14,7 @@ interface Props { underline?: boolean } -const Tooltip = ({ +export const Tooltip = ({ children, content, className, @@ -21,6 +22,8 @@ const Tooltip = ({ inderactive = false, underline = false, }: Props) => { + const enableAnimations = useSettings((s) => s.enableAnimations) + return ( document.body} @@ -42,7 +45,8 @@ const Tooltip = ({ @@ -55,11 +59,9 @@ const Tooltip = ({ className, )} > - + )} ) } - -export default Tooltip diff --git a/components/Trade/TradeActionModule.tsx b/src/components/Trade/TradeActionModule.tsx similarity index 94% rename from components/Trade/TradeActionModule.tsx rename to src/components/Trade/TradeActionModule.tsx index 00be9922..3fb307c9 100644 --- a/components/Trade/TradeActionModule.tsx +++ b/src/components/Trade/TradeActionModule.tsx @@ -3,17 +3,17 @@ import BigNumber from 'bignumber.js' import React, { useEffect, useMemo, useState } from 'react' import { toast } from 'react-toastify' -import Button from 'components/Button' -import CircularProgress from 'components/CircularProgress' -import ArrowsUpDownIcon from 'components/Icons/arrows-up-down.svg' -import Slider from 'components/Slider' -import useTradeAsset from 'hooks/mutations/useTradeAsset' -import useAllBalances from 'hooks/useAllBalances' -import useAllowedCoins from 'hooks/useAllowedCoins' -import useCalculateMaxTradeAmount from 'hooks/useCalculateMaxTradeAmount' -import useCreditAccountPositions from 'hooks/useCreditAccountPositions' -import useMarkets from 'hooks/useMarkets' -import useTokenPrices from 'hooks/useTokenPrices' +import { Button, CircularProgress, Slider } from 'components' +import { ArrowsUpDown } from 'components/Icons' +import { useCalculateMaxTradeAmount } from 'hooks/data' +import { useTradeAsset } from 'hooks/mutations' +import { + useAllBalances, + useAllowedCoins, + useCreditAccountPositions, + useMarkets, + useTokenPrices, +} from 'hooks/queries' import { useAccountDetailsStore } from 'stores' import { getTokenDecimals, getTokenSymbol } from 'utils/tokens' @@ -22,7 +22,7 @@ enum FundingMode { WalletAndAccount = 'WalletAndAccount', } -const TradeActionModule = () => { +export const TradeActionModule = () => { const [selectedTokenIn, setSelectedTokenIn] = useState('') const [selectedTokenOut, setSelectedTokenOut] = useState('') const [amountIn, setAmountIn] = useState(0) @@ -216,7 +216,7 @@ const TradeActionModule = () => { resetAmounts() }} > - +

To:

@@ -299,7 +299,7 @@ const TradeActionModule = () => {
@@ -347,5 +347,3 @@ const TradeActionModule = () => { ) } - -export default TradeActionModule diff --git a/src/components/Trade/index.ts b/src/components/Trade/index.ts new file mode 100644 index 00000000..92560f88 --- /dev/null +++ b/src/components/Trade/index.ts @@ -0,0 +1,3 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { TradeActionModule } from './TradeActionModule' +// @endindex diff --git a/components/Wallet/ConnectButton.tsx b/src/components/Wallet/ConnectButton.tsx similarity index 80% rename from components/Wallet/ConnectButton.tsx rename to src/components/Wallet/ConnectButton.tsx index 1b53790d..a38e39cd 100644 --- a/components/Wallet/ConnectButton.tsx +++ b/src/components/Wallet/ConnectButton.tsx @@ -1,8 +1,8 @@ import { useWalletManager, WalletConnectionStatus } from '@marsprotocol/wallet-connector' import { ReactNode } from 'react' -import CircularProgress from 'components/CircularProgress' -import WalletIcon from 'components/Icons/wallet.svg' +import { CircularProgress } from 'components' +import { Wallet } from 'components/Icons' interface Props { textOverride?: string | ReactNode @@ -10,7 +10,7 @@ interface Props { status?: WalletConnectionStatus } -const ConnectButton = ({ textOverride, disabled = false, status }: Props) => { +export const ConnectButton = ({ textOverride, disabled = false, status }: Props) => { const { connect } = useWalletManager() return ( @@ -27,7 +27,7 @@ const ConnectButton = ({ textOverride, disabled = false, status }: Props) => { ) : ( <> - + {textOverride || 'Connect Wallet'} @@ -36,5 +36,3 @@ const ConnectButton = ({ textOverride, disabled = false, status }: Props) => { ) } - -export default ConnectButton diff --git a/components/Wallet/ConnectedButton.tsx b/src/components/Wallet/ConnectedButton.tsx similarity index 88% rename from components/Wallet/ConnectedButton.tsx rename to src/components/Wallet/ConnectedButton.tsx index 9485ac99..11954e6c 100644 --- a/components/Wallet/ConnectedButton.tsx +++ b/src/components/Wallet/ConnectedButton.tsx @@ -8,20 +8,13 @@ import classNames from 'classnames' import { useCallback, useEffect, useState } from 'react' import useClipboard from 'react-use-clipboard' -import Button from 'components/Button' -import CircularProgress from 'components/CircularProgress' -import FormattedNumber from 'components/FormattedNumber' -import CheckIcon from 'components/Icons/check.svg' -import CopyIcon from 'components/Icons/copy.svg' -import ExternalLinkIcon from 'components/Icons/external-link.svg' -import OsmoIcon from 'components/Icons/osmo.svg' -import WalletIcon from 'components/Icons/wallet.svg' +import { Button, CircularProgress, FormattedNumber, Text } from 'components' +import { Check, Copy, ExternalLink, Osmo, Wallet } from 'components/Icons' import { Overlay } from 'components/Overlay' -import Text from 'components/Text' -import useTokenBalance from 'hooks/useTokenBalance' +import { useTokenBalance } from 'hooks/queries' import { formatValue, truncate } from 'utils/formatters' -const ConnectedButton = () => { +export const ConnectedButton = () => { // --------------- // EXTERNAL HOOKS // --------------- @@ -84,9 +77,9 @@ const ConnectedButton = () => { {chainInfo?.chainId === ChainInfoID.Osmosis1 || chainInfo?.chainId === ChainInfoID.OsmosisTestnet ? ( - + ) : ( - + )} {name ? name : truncate(address, [2, 4])} @@ -142,11 +135,11 @@ const ConnectedButton = () => { onClick={setCopied} > - + {isCopied ? ( - Copied + Copied ) : ( Copy Address @@ -157,7 +150,7 @@ const ConnectedButton = () => { onClick={viewOnFinder} > - + View on {explorerName} @@ -168,5 +161,3 @@ const ConnectedButton = () => { ) } - -export default ConnectedButton diff --git a/components/Wallet/Wallet.tsx b/src/components/Wallet/Wallet.tsx similarity index 92% rename from components/Wallet/Wallet.tsx rename to src/components/Wallet/Wallet.tsx index 5510ecb4..53cc5c01 100644 --- a/components/Wallet/Wallet.tsx +++ b/src/components/Wallet/Wallet.tsx @@ -3,7 +3,7 @@ import { useEffect, useState } from 'react' import { ConnectButton, ConnectedButton } from 'components/Wallet' -const Wallet = () => { +export const Wallet = () => { const { status } = useWallet() const [isConnected, setIsConnected] = useState(false) @@ -16,5 +16,3 @@ const Wallet = () => { return !isConnected ? : } - -export default Wallet diff --git a/components/Wallet/WalletConnectProvider.tsx b/src/components/Wallet/WalletConnectProvider.tsx similarity index 80% rename from components/Wallet/WalletConnectProvider.tsx rename to src/components/Wallet/WalletConnectProvider.tsx index 218e98b7..0b8331fe 100644 --- a/components/Wallet/WalletConnectProvider.tsx +++ b/src/components/Wallet/WalletConnectProvider.tsx @@ -1,17 +1,20 @@ import { ChainInfoID, WalletManagerProvider, WalletType } from '@marsprotocol/wallet-connector' +import classNames from 'classnames' import { FC } from 'react' +import { CircularProgress } from 'components' import { buttonColorClasses, buttonSizeClasses, buttonVariantClasses } from 'components/Button' -import CircularProgress from 'components/CircularProgress' -import CloseIcon from 'components/Icons/close.svg' -import KeplrImage from 'public/images/keplr-wallet-extension.png' -import WalletConnectImage from 'public/images/walletconnect-keplr.png' +import { Close } from 'components/Icons' +import KeplrImage from 'images/keplr-wallet-extension.png' +import WalletConnectImage from 'images/walletconnect-keplr.png' +import { useSettings } from 'stores' type Props = { children?: React.ReactNode } -const WalletConnectProvider: FC = ({ children }) => { +export const WalletConnectProvider: FC = ({ children }) => { + const enableAnimations = useSettings((s) => s.enableAnimations) return ( = ({ children }) => { }} closeIcon={ - + } defaultChainId={ChainInfoID.OsmosisTestnet} @@ -46,7 +49,13 @@ const WalletConnectProvider: FC = ({ children }) => { text: 'If nothing shows up in your wallet try to connect again, by clicking on the button below. Refresh the page if the problem persists.', textClassName: 'block w-full text-center text-base text-white', buttonText: 'Retry the Connection', - buttonClassName: `cursor-pointer appearance-none break-normal rounded-3xl outline-none transition-colors ${buttonColorClasses.primary} ${buttonSizeClasses.small} ${buttonVariantClasses.solid}`, + buttonClassName: classNames( + 'cursor-pointer appearance-none break-normal rounded-3xl outline-none', + enableAnimations && 'transition-colors', + buttonColorClasses.primary, + buttonSizeClasses.small, + buttonVariantClasses.solid, + ), contentClassName: 'flex flex-wrap w-full justify-center', }} enablingStringOverride='connecting to wallet' @@ -78,5 +87,3 @@ const WalletConnectProvider: FC = ({ children }) => { ) } - -export default WalletConnectProvider diff --git a/src/components/Wallet/index.ts b/src/components/Wallet/index.ts new file mode 100644 index 00000000..7d19ade0 --- /dev/null +++ b/src/components/Wallet/index.ts @@ -0,0 +1,6 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { ConnectButton } from './ConnectButton' +export { ConnectedButton } from './ConnectedButton' +export { Wallet } from './Wallet' +export { WalletConnectProvider } from './WalletConnectProvider' +// @endindex diff --git a/src/components/index.ts b/src/components/index.ts new file mode 100644 index 00000000..ce497440 --- /dev/null +++ b/src/components/index.ts @@ -0,0 +1,21 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { BorrowCapacity } from './BorrowCapacity' +export { BorrowModal } from './BorrowModal' +export { Button } from './Button' +export { Card } from './Card' +export { CircularProgress } from './CircularProgress' +export { ContainerSecondary } from './ContainerSecondary' +export { FormattedNumber } from './FormattedNumber' +export { Gauge } from './Gauge' +export { LabelValuePair } from './LabelValuePair' +export { Layout } from './Layout' +export { Modal } from './Modal' +export { Modals } from './Modals' +export { PositionsList } from './PositionsList' +export { ProgressBar } from './ProgressBar' +export { RepayModal } from './RepayModal' +export { Slider } from './Slider' +export { Text } from './Text' +export { TextLink } from './TextLink' +export { Tooltip } from './Tooltip' +// @endindex diff --git a/config/contracts.ts b/src/config/contracts.ts similarity index 100% rename from config/contracts.ts rename to src/config/contracts.ts diff --git a/config/tokenInfo.ts b/src/config/tokenInfo.ts similarity index 90% rename from config/tokenInfo.ts rename to src/config/tokenInfo.ts index 578453c7..d72679f4 100644 --- a/config/tokenInfo.ts +++ b/src/config/tokenInfo.ts @@ -6,7 +6,7 @@ type Token = { chain: string } -const tokenInfo: { [key in string]: Token } = { +export const tokenInfo: { [key in string]: Token } = { uosmo: { denom: 'uosmo', symbol: 'OSMO', @@ -29,5 +29,3 @@ const tokenInfo: { [key in string]: Token } = { chain: 'Crypto.org', }, } - -export default tokenInfo diff --git a/fonts/Inter-ExtraLight.woff b/src/fonts/Inter-ExtraLight.woff similarity index 100% rename from fonts/Inter-ExtraLight.woff rename to src/fonts/Inter-ExtraLight.woff diff --git a/fonts/Inter-ExtraLight.woff2 b/src/fonts/Inter-ExtraLight.woff2 similarity index 100% rename from fonts/Inter-ExtraLight.woff2 rename to src/fonts/Inter-ExtraLight.woff2 diff --git a/fonts/Inter-Regular.woff b/src/fonts/Inter-Regular.woff similarity index 100% rename from fonts/Inter-Regular.woff rename to src/fonts/Inter-Regular.woff diff --git a/fonts/Inter-Regular.woff2 b/src/fonts/Inter-Regular.woff2 similarity index 100% rename from fonts/Inter-Regular.woff2 rename to src/fonts/Inter-Regular.woff2 diff --git a/fonts/Inter-SemiBold.woff b/src/fonts/Inter-SemiBold.woff similarity index 100% rename from fonts/Inter-SemiBold.woff rename to src/fonts/Inter-SemiBold.woff diff --git a/fonts/Inter-SemiBold.woff2 b/src/fonts/Inter-SemiBold.woff2 similarity index 100% rename from fonts/Inter-SemiBold.woff2 rename to src/fonts/Inter-SemiBold.woff2 diff --git a/src/hooks/data/index.ts b/src/hooks/data/index.ts new file mode 100644 index 00000000..b46daceb --- /dev/null +++ b/src/hooks/data/index.ts @@ -0,0 +1,8 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { useAccountStats } from './useAccountStats' +export { useAnimations } from './useAnimations' +export { useBalances } from './useBalances' +export { useCalculateMaxBorrowAmount } from './useCalculateMaxBorrowAmount' +export { useCalculateMaxTradeAmount } from './useCalculateMaxTradeAmount' +export { useCalculateMaxWithdrawAmount } from './useCalculateMaxWithdrawAmount' +// @endindex diff --git a/hooks/useAccountStats.tsx b/src/hooks/data/useAccountStats.tsx similarity index 95% rename from hooks/useAccountStats.tsx rename to src/hooks/data/useAccountStats.tsx index 98f68bd3..712a8b23 100644 --- a/hooks/useAccountStats.tsx +++ b/src/hooks/data/useAccountStats.tsx @@ -1,12 +1,9 @@ import BigNumber from 'bignumber.js' import { useMemo } from 'react' +import { useCreditAccountPositions, useMarkets, useTokenPrices } from 'hooks/queries' import { useAccountDetailsStore } from 'stores' -import useCreditAccountPositions from './useCreditAccountPositions' -import useMarkets from './useMarkets' -import useTokenPrices from './useTokenPrices' - // displaying 3 levels of risk based on the weighted average of liquidation LTVs // 0.85 -> 25% risk // 0.65 - 0.85 -> 50% risk @@ -82,13 +79,7 @@ const calculateStatsFromAccountPositions = (assets: Asset[], debts: Debt[]) => { } } -export type AccountStatsAction = { - type: 'borrow' | 'repay' | 'deposit' | 'withdraw' - amount: number - denom: string -} - -const useAccountStats = (actions?: AccountStatsAction[]) => { +export const useAccountStats = (actions?: AccountStatsAction[]) => { const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') @@ -260,5 +251,3 @@ const useAccountStats = (actions?: AccountStatsAction[]) => { return actionResultStats || currentStats } - -export default useAccountStats diff --git a/src/hooks/data/useAnimations.tsx b/src/hooks/data/useAnimations.tsx new file mode 100644 index 00000000..14edeb4f --- /dev/null +++ b/src/hooks/data/useAnimations.tsx @@ -0,0 +1,23 @@ +import { useEffect } from 'react' + +import { useSettings } from 'stores' + +export const useAnimations = () => { + const enableAnimations = useSettings((s) => s.enableAnimations) + + const queryChangeHandler = (event: MediaQueryListEvent) => { + useSettings.setState({ enableAnimations: !event?.matches ?? true }) + } + + useEffect(() => { + const mediaQuery: MediaQueryList = window.matchMedia('(prefers-reduced-motion: reduce)') + + if (mediaQuery) { + useSettings.setState({ enableAnimations: !mediaQuery.matches }) + mediaQuery.addEventListener('change', queryChangeHandler) + return () => mediaQuery.removeEventListener('change', queryChangeHandler) + } + }, []) + + return enableAnimations +} diff --git a/src/hooks/data/useBalances.tsx b/src/hooks/data/useBalances.tsx new file mode 100644 index 00000000..95ba3e43 --- /dev/null +++ b/src/hooks/data/useBalances.tsx @@ -0,0 +1,32 @@ +import { useEffect, useState } from 'react' + +import { useCreditAccountPositions, useMarkets, useTokenPrices } from 'hooks/queries' +import { useAccountDetailsStore } from 'stores' +import { formatBalances } from 'utils/balances' + +export const useBalances = () => { + const [balanceData, setBalanceData] = useState() + + const { data: marketsData } = useMarkets() + const { data: tokenPrices } = useTokenPrices() + const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) + + const { data: positionsData, isLoading: isLoadingPositions } = useCreditAccountPositions( + selectedAccount ?? '', + ) + + useEffect(() => { + const balances = + positionsData?.coins && tokenPrices + ? formatBalances(positionsData.coins, tokenPrices, false) + : [] + const debtBalances = + positionsData?.debts && tokenPrices + ? formatBalances(positionsData.debts, tokenPrices, true, marketsData) + : [] + + setBalanceData([...balances, ...debtBalances]) + }, [positionsData, marketsData, tokenPrices]) + + return balanceData +} diff --git a/hooks/useCalculateMaxBorrowAmount.tsx b/src/hooks/data/useCalculateMaxBorrowAmount.tsx similarity index 89% rename from hooks/useCalculateMaxBorrowAmount.tsx rename to src/hooks/data/useCalculateMaxBorrowAmount.tsx index 7c54a989..99d676d9 100644 --- a/hooks/useCalculateMaxBorrowAmount.tsx +++ b/src/hooks/data/useCalculateMaxBorrowAmount.tsx @@ -1,21 +1,22 @@ import BigNumber from 'bignumber.js' import { useCallback, useMemo } from 'react' +import { + useCreditAccountPositions, + useMarkets, + useRedbankBalances, + useTokenPrices, +} from 'hooks/queries' import { useAccountDetailsStore } from 'stores' import { getTokenDecimals } from 'utils/tokens' -import useCreditAccountPositions from './useCreditAccountPositions' -import useMarkets from './useMarkets' -import useRedbankBalances from './useRedbankBalances' -import useTokenPrices from './useTokenPrices' - const getApproximateHourlyInterest = (amount: string, borrowAPY: string) => { const hourlyAPY = BigNumber(borrowAPY).div(24 * 365) return hourlyAPY.times(amount).toNumber() } -const useCalculateMaxBorrowAmount = (denom: string, isUnderCollateralized: boolean) => { +export const useCalculateMaxBorrowAmount = (denom: string, isUnderCollateralized: boolean) => { const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') @@ -97,5 +98,3 @@ const useCalculateMaxBorrowAmount = (denom: string, isUnderCollateralized: boole tokenPrices, ]) } - -export default useCalculateMaxBorrowAmount diff --git a/hooks/useCalculateMaxTradeAmount.tsx b/src/hooks/data/useCalculateMaxTradeAmount.tsx similarity index 93% rename from hooks/useCalculateMaxTradeAmount.tsx rename to src/hooks/data/useCalculateMaxTradeAmount.tsx index a31e29be..79954042 100644 --- a/hooks/useCalculateMaxTradeAmount.tsx +++ b/src/hooks/data/useCalculateMaxTradeAmount.tsx @@ -1,13 +1,14 @@ import BigNumber from 'bignumber.js' import { useCallback, useMemo } from 'react' +import { + useCreditAccountPositions, + useMarkets, + useRedbankBalances, + useTokenPrices, +} from 'hooks/queries' import { useAccountDetailsStore } from 'stores' -import useCreditAccountPositions from './useCreditAccountPositions' -import useMarkets from './useMarkets' -import useRedbankBalances from './useRedbankBalances' -import useTokenPrices from './useTokenPrices' - const getApproximateHourlyInterest = (amount: string, borrowAPY: string) => { const hourlyAPY = BigNumber(borrowAPY).div(24 * 365) @@ -16,7 +17,11 @@ const getApproximateHourlyInterest = (amount: string, borrowAPY: string) => { // max trade amount doesnt consider wallet balance as its not relevant // the entire token balance within the wallet will always be able to be fully swapped -const useCalculateMaxTradeAmount = (tokenIn: string, tokenOut: string, isMargin: boolean) => { +export const useCalculateMaxTradeAmount = ( + tokenIn: string, + tokenOut: string, + isMargin: boolean, +) => { const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') @@ -140,5 +145,3 @@ const useCalculateMaxTradeAmount = (tokenIn: string, tokenOut: string, isMargin: tokenPrices, ]) } - -export default useCalculateMaxTradeAmount diff --git a/hooks/useCalculateMaxWithdrawAmount.tsx b/src/hooks/data/useCalculateMaxWithdrawAmount.tsx similarity index 92% rename from hooks/useCalculateMaxWithdrawAmount.tsx rename to src/hooks/data/useCalculateMaxWithdrawAmount.tsx index 32bab34a..e094c52c 100644 --- a/hooks/useCalculateMaxWithdrawAmount.tsx +++ b/src/hooks/data/useCalculateMaxWithdrawAmount.tsx @@ -1,21 +1,22 @@ import BigNumber from 'bignumber.js' import { useCallback, useMemo } from 'react' +import { + useCreditAccountPositions, + useMarkets, + useRedbankBalances, + useTokenPrices, +} from 'hooks/queries' import { useAccountDetailsStore } from 'stores' import { getTokenDecimals } from 'utils/tokens' -import useCreditAccountPositions from './useCreditAccountPositions' -import useMarkets from './useMarkets' -import useRedbankBalances from './useRedbankBalances' -import useTokenPrices from './useTokenPrices' - const getApproximateHourlyInterest = (amount: string, borrowAPY: string) => { const hourlyAPY = BigNumber(borrowAPY).div(24 * 365) return hourlyAPY.times(amount).toNumber() } -const useCalculateMaxWithdrawAmount = (denom: string, borrow: boolean) => { +export const useCalculateMaxWithdrawAmount = (denom: string, borrow: boolean) => { const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) const { data: positionsData } = useCreditAccountPositions(selectedAccount ?? '') @@ -131,5 +132,3 @@ const useCalculateMaxWithdrawAmount = (denom: string, borrow: boolean) => { return maxAmount } - -export default useCalculateMaxWithdrawAmount diff --git a/src/hooks/mutations/index.ts b/src/hooks/mutations/index.ts new file mode 100644 index 00000000..6efd700e --- /dev/null +++ b/src/hooks/mutations/index.ts @@ -0,0 +1,9 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { useBorrowFunds } from './useBorrowFunds' +export { useCreateCreditAccount } from './useCreateCreditAccount' +export { useDeleteCreditAccount } from './useDeleteCreditAccount' +export { useDepositCreditAccount } from './useDepositCreditAccount' +export { useRepayFunds } from './useRepayFunds' +export { useTradeAsset } from './useTradeAsset' +export { useWithdrawFunds } from './useWithdrawFunds' +// @endindex diff --git a/hooks/mutations/useBorrowFunds.tsx b/src/hooks/mutations/useBorrowFunds.tsx similarity index 97% rename from hooks/mutations/useBorrowFunds.tsx rename to src/hooks/mutations/useBorrowFunds.tsx index 24dfcedc..ebfec481 100644 --- a/hooks/mutations/useBorrowFunds.tsx +++ b/src/hooks/mutations/useBorrowFunds.tsx @@ -6,7 +6,7 @@ import { useAccountDetailsStore, useWalletStore } from 'stores' import { queryKeys } from 'types/query-keys-factory' import { hardcodedFee } from 'utils/contants' -const useBorrowFunds = ( +export const useBorrowFunds = ( amount: number, denom: string, withdraw = false, @@ -70,5 +70,3 @@ const useBorrowFunds = ( }, ) } - -export default useBorrowFunds diff --git a/hooks/mutations/useCreateCreditAccount.tsx b/src/hooks/mutations/useCreateCreditAccount.tsx similarity index 94% rename from hooks/mutations/useCreateCreditAccount.tsx rename to src/hooks/mutations/useCreateCreditAccount.tsx index 41299ed8..55e7d6c3 100644 --- a/hooks/mutations/useCreateCreditAccount.tsx +++ b/src/hooks/mutations/useCreateCreditAccount.tsx @@ -11,7 +11,7 @@ const executeMsg = { create_credit_account: {}, } -const useCreateCreditAccount = () => { +export const useCreateCreditAccount = () => { const signingClient = useWalletStore((s) => s.signingClient) const address = useWalletStore((s) => s.address) @@ -43,5 +43,3 @@ const useCreateCreditAccount = () => { }, ) } - -export default useCreateCreditAccount diff --git a/hooks/mutations/useDeleteCreditAccount.tsx b/src/hooks/mutations/useDeleteCreditAccount.tsx similarity index 91% rename from hooks/mutations/useDeleteCreditAccount.tsx rename to src/hooks/mutations/useDeleteCreditAccount.tsx index 83227d02..99930b6a 100644 --- a/hooks/mutations/useDeleteCreditAccount.tsx +++ b/src/hooks/mutations/useDeleteCreditAccount.tsx @@ -6,7 +6,7 @@ import { useWalletStore } from 'stores' import { queryKeys } from 'types/query-keys-factory' import { hardcodedFee } from 'utils/contants' -const useCreateCreditAccount = (accountId: string) => { +export const useDeleteCreditAccount = (accountId: string) => { const signingClient = useWalletStore((s) => s.signingClient) const address = useWalletStore((s) => s.address) @@ -37,5 +37,3 @@ const useCreateCreditAccount = (accountId: string) => { }, ) } - -export default useCreateCreditAccount diff --git a/hooks/mutations/useDepositCreditAccount.tsx b/src/hooks/mutations/useDepositCreditAccount.tsx similarity index 95% rename from hooks/mutations/useDepositCreditAccount.tsx rename to src/hooks/mutations/useDepositCreditAccount.tsx index 5ec4c695..aa97b85e 100644 --- a/hooks/mutations/useDepositCreditAccount.tsx +++ b/src/hooks/mutations/useDepositCreditAccount.tsx @@ -6,7 +6,7 @@ import { useWalletStore } from 'stores' import { queryKeys } from 'types/query-keys-factory' import { hardcodedFee } from 'utils/contants' -const useDepositCreditAccount = ( +export const useDepositCreditAccount = ( accountId: string, denom: string, amount: number, @@ -60,5 +60,3 @@ const useDepositCreditAccount = ( }, ) } - -export default useDepositCreditAccount diff --git a/hooks/mutations/useRepayFunds.tsx b/src/hooks/mutations/useRepayFunds.tsx similarity index 96% rename from hooks/mutations/useRepayFunds.tsx rename to src/hooks/mutations/useRepayFunds.tsx index f914bd93..f181c9da 100644 --- a/hooks/mutations/useRepayFunds.tsx +++ b/src/hooks/mutations/useRepayFunds.tsx @@ -6,7 +6,7 @@ import { useAccountDetailsStore, useWalletStore } from 'stores' import { queryKeys } from 'types/query-keys-factory' import { hardcodedFee } from 'utils/contants' -const useRepayFunds = ( +export const useRepayFunds = ( amount: number, denom: string, options: Omit, @@ -61,5 +61,3 @@ const useRepayFunds = ( }, ) } - -export default useRepayFunds diff --git a/hooks/mutations/useTradeAsset.tsx b/src/hooks/mutations/useTradeAsset.tsx similarity index 97% rename from hooks/mutations/useTradeAsset.tsx rename to src/hooks/mutations/useTradeAsset.tsx index 7679997b..e8bd13a1 100644 --- a/hooks/mutations/useTradeAsset.tsx +++ b/src/hooks/mutations/useTradeAsset.tsx @@ -7,7 +7,7 @@ import { Action } from 'types/generated/mars-credit-manager/MarsCreditManager.ty import { queryKeys } from 'types/query-keys-factory' import { hardcodedFee } from 'utils/contants' -const useTradeAsset = ( +export const useTradeAsset = ( amount: number, borrowAmount: number, depositAmount: number, @@ -82,5 +82,3 @@ const useTradeAsset = ( }, ) } - -export default useTradeAsset diff --git a/hooks/mutations/useWithdrawFunds.tsx b/src/hooks/mutations/useWithdrawFunds.tsx similarity index 96% rename from hooks/mutations/useWithdrawFunds.tsx rename to src/hooks/mutations/useWithdrawFunds.tsx index eba4f263..63170021 100644 --- a/hooks/mutations/useWithdrawFunds.tsx +++ b/src/hooks/mutations/useWithdrawFunds.tsx @@ -6,7 +6,7 @@ import { useAccountDetailsStore, useWalletStore } from 'stores' import { queryKeys } from 'types/query-keys-factory' import { hardcodedFee } from 'utils/contants' -const useWithdrawFunds = ( +export const useWithdrawFunds = ( amount: number, borrowAmount: number, denom: string, @@ -71,5 +71,3 @@ const useWithdrawFunds = ( }, ) } - -export default useWithdrawFunds diff --git a/src/hooks/queries/index.ts b/src/hooks/queries/index.ts new file mode 100644 index 00000000..580c18bb --- /dev/null +++ b/src/hooks/queries/index.ts @@ -0,0 +1,10 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) +export { useAllBalances } from './useAllBalances' +export { useAllowedCoins } from './useAllowedCoins' +export { useCreditAccountPositions } from './useCreditAccountPositions' +export { useCreditAccounts } from './useCreditAccounts' +export { useMarkets } from './useMarkets' +export { useRedbankBalances } from './useRedbankBalances' +export { useTokenBalance } from './useTokenBalance' +export { useTokenPrices } from './useTokenPrices' +// @endindex diff --git a/hooks/useAllBalances.tsx b/src/hooks/queries/useAllBalances.tsx similarity index 90% rename from hooks/useAllBalances.tsx rename to src/hooks/queries/useAllBalances.tsx index e17bc130..f812e348 100644 --- a/hooks/useAllBalances.tsx +++ b/src/hooks/queries/useAllBalances.tsx @@ -8,7 +8,7 @@ type Result = { balances: { amount: string; denom: string }[] } -const useAllBalances = () => { +export const useAllBalances = () => { const address = useWalletStore((s) => s.address) const result = useQuery( @@ -25,5 +25,3 @@ const useAllBalances = () => { data: result?.data?.balances, } } - -export default useAllBalances diff --git a/hooks/useAllowedCoins.tsx b/src/hooks/queries/useAllowedCoins.tsx similarity index 90% rename from hooks/useAllowedCoins.tsx rename to src/hooks/queries/useAllowedCoins.tsx index f47f6431..08c0603d 100644 --- a/hooks/useAllowedCoins.tsx +++ b/src/hooks/queries/useAllowedCoins.tsx @@ -10,7 +10,7 @@ const queryMsg = { allowed_coins: {}, } -const useAllowedCoins = () => { +export const useAllowedCoins = () => { const client = useWalletStore((s) => s.signingClient) const result = useQuery( @@ -27,5 +27,3 @@ const useAllowedCoins = () => { data: result?.data, } } - -export default useAllowedCoins diff --git a/hooks/useCreditAccountPositions.tsx b/src/hooks/queries/useCreditAccountPositions.tsx similarity index 91% rename from hooks/useCreditAccountPositions.tsx rename to src/hooks/queries/useCreditAccountPositions.tsx index a64f6ae2..e59212de 100644 --- a/hooks/useCreditAccountPositions.tsx +++ b/src/hooks/queries/useCreditAccountPositions.tsx @@ -24,7 +24,7 @@ interface Result { vaults: VaultPosition[] } -const useCreditAccountPositions = (accountId: string) => { +export const useCreditAccountPositions = (accountId: string) => { const address = useWalletStore((s) => s.address) const client = useWalletStore((s) => s.signingClient) @@ -52,5 +52,3 @@ const useCreditAccountPositions = (accountId: string) => { }, [result.data, address]), } } - -export default useCreditAccountPositions diff --git a/hooks/useCreditAccounts.tsx b/src/hooks/queries/useCreditAccounts.tsx similarity index 95% rename from hooks/useCreditAccounts.tsx rename to src/hooks/queries/useCreditAccounts.tsx index 879c5cac..25514f2f 100644 --- a/hooks/useCreditAccounts.tsx +++ b/src/hooks/queries/useCreditAccounts.tsx @@ -9,7 +9,7 @@ type Result = { tokens: string[] } -const useCreditAccounts = () => { +export const useCreditAccounts = () => { const address = useWalletStore((s) => s.address) const client = useWalletStore((s) => s.signingClient) const selectedAccount = useAccountDetailsStore((s) => s.selectedAccount) @@ -48,5 +48,3 @@ const useCreditAccounts = () => { }, [address, result?.data]), } } - -export default useCreditAccounts diff --git a/hooks/useMarkets.tsx b/src/hooks/queries/useMarkets.tsx similarity index 81% rename from hooks/useMarkets.tsx rename to src/hooks/queries/useMarkets.tsx index 8fc8c7b3..1d5b65b0 100644 --- a/hooks/useMarkets.tsx +++ b/src/hooks/queries/useMarkets.tsx @@ -1,38 +1,8 @@ import { useQuery } from '@tanstack/react-query' import { useMemo } from 'react' -interface Market { - denom: string - max_loan_to_value: string - liquidation_threshold: string - liquidation_bonus: string - reserve_factor: string - interest_rate_model: { - optimal_utilization_rate: string - base: string - slope_1: string - slope_2: string - } - borrow_index: string - liquidity_index: string - borrow_rate: string - liquidity_rate: string - indexes_last_updated: number - collateral_total_scaled: string - debt_total_scaled: string - deposit_enabled: boolean - borrow_enabled: boolean - deposit_cap: string -} - -interface Result { - wasm: { - [key: string]: Market - } -} - -const useMarkets = () => { - const result = useQuery( +export const useMarkets = () => { + const result = useQuery( ['marketInfo'], () => ({ wasm: { @@ -119,5 +89,3 @@ const useMarkets = () => { }, [result.data]), } } - -export default useMarkets diff --git a/hooks/useRedbankBalances.tsx b/src/hooks/queries/useRedbankBalances.tsx similarity index 94% rename from hooks/useRedbankBalances.tsx rename to src/hooks/queries/useRedbankBalances.tsx index 14541d4b..b4f7fb6d 100644 --- a/hooks/useRedbankBalances.tsx +++ b/src/hooks/queries/useRedbankBalances.tsx @@ -37,7 +37,7 @@ const fetchBalances = () => { }).then((res) => res.json()) } -const useRedbankBalances = () => { +export const useRedbankBalances = () => { const result = useQuery(queryKeys.redbankBalances(), fetchBalances) return { @@ -55,5 +55,3 @@ const useRedbankBalances = () => { }, [result.data]), } } - -export default useRedbankBalances diff --git a/hooks/useTokenBalance.tsx b/src/hooks/queries/useTokenBalance.tsx similarity index 92% rename from hooks/useTokenBalance.tsx rename to src/hooks/queries/useTokenBalance.tsx index 5b89fee5..14bf6f74 100644 --- a/hooks/useTokenBalance.tsx +++ b/src/hooks/queries/useTokenBalance.tsx @@ -12,7 +12,7 @@ type Result = { } } -const useTokenBalance = (denom?: string) => { +export const useTokenBalance = (denom?: string) => { const address = useWalletStore((s) => s.address) const result = useQuery( @@ -37,5 +37,3 @@ const useTokenBalance = (denom?: string) => { : 0, } } - -export default useTokenBalance diff --git a/hooks/useTokenPrices.tsx b/src/hooks/queries/useTokenPrices.tsx similarity index 81% rename from hooks/useTokenPrices.tsx rename to src/hooks/queries/useTokenPrices.tsx index 34ed83f0..0a1998d1 100644 --- a/hooks/useTokenPrices.tsx +++ b/src/hooks/queries/useTokenPrices.tsx @@ -1,20 +1,11 @@ import { useQuery } from '@tanstack/react-query' -import { useMemo } from 'react' import { gql, request } from 'graphql-request' +import { useMemo } from 'react' import { contractAddresses } from 'config/contracts' +import { tokenInfo } from 'config/tokenInfo' import { queryKeys } from 'types/query-keys-factory' import { chain } from 'utils/chains' -import tokenInfo from 'config/tokenInfo' - -interface Result { - prices: { - [key: string]: { - denom: string - price: string - } - } -} const tokenInfoList = Object.values(tokenInfo) @@ -41,8 +32,8 @@ const fetchTokenPrices = () => { ) } -const useTokenPrices = () => { - const result = useQuery(queryKeys.tokenPrices(), fetchTokenPrices, { +export const useTokenPrices = () => { + const result = useQuery(queryKeys.tokenPrices(), fetchTokenPrices, { refetchInterval: 30000, staleTime: Infinity, }) @@ -62,5 +53,3 @@ const useTokenPrices = () => { }, [result.data]), } } - -export default useTokenPrices diff --git a/public/images/keplr-wallet-extension.png b/src/images/keplr-wallet-extension.png similarity index 100% rename from public/images/keplr-wallet-extension.png rename to src/images/keplr-wallet-extension.png diff --git a/public/images/walletconnect-keplr.png b/src/images/walletconnect-keplr.png similarity index 100% rename from public/images/walletconnect-keplr.png rename to src/images/walletconnect-keplr.png diff --git a/pages/404.tsx b/src/pages/404.tsx similarity index 81% rename from pages/404.tsx rename to src/pages/404.tsx index 292d01c8..02ba2d75 100644 --- a/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,6 +1,4 @@ -import Button from 'components/Button' -import Card from 'components/Card' -import Text from 'components/Text' +import { Button, Card, Text } from 'components' const Error404 = () => { return ( diff --git a/pages/_app.tsx b/src/pages/_app.tsx similarity index 76% rename from pages/_app.tsx rename to src/pages/_app.tsx index 844775ab..7ed0739b 100644 --- a/pages/_app.tsx +++ b/src/pages/_app.tsx @@ -7,13 +7,15 @@ import type { AppProps } from 'next/app' import Head from 'next/head' import { ToastContainer, Zoom } from 'react-toastify' -import Layout from 'components/Layout' -import Modals from 'components/Modals' -import WalletConnectProvider from 'components/Wallet/WalletConnectProvider' +import { Layout, Modals } from 'components' +import { WalletConnectProvider } from 'components/Wallet' +import { useAnimations } from 'hooks/data' const queryClient = new QueryClient() -function MyApp({ Component, pageProps }: AppProps) { +const App = ({ Component, pageProps }: AppProps) => { + const animations = useAnimations() + return ( <> @@ -33,7 +35,7 @@ function MyApp({ Component, pageProps }: AppProps) { position='bottom-right' hideProgressBar newestOnTop - transition={Zoom} + transition={animations ? Zoom : undefined} /> @@ -41,4 +43,4 @@ function MyApp({ Component, pageProps }: AppProps) { ) } -export default MyApp +export default App diff --git a/pages/_error.js b/src/pages/_error.js similarity index 100% rename from pages/_error.js rename to src/pages/_error.js diff --git a/pages/borrow.tsx b/src/pages/borrow.tsx similarity index 90% rename from pages/borrow.tsx rename to src/pages/borrow.tsx index 0d0e5f86..ab9df023 100644 --- a/pages/borrow.tsx +++ b/src/pages/borrow.tsx @@ -1,18 +1,17 @@ import BigNumber from 'bignumber.js' import { useMemo, useRef, useState } from 'react' -import BorrowTable from 'components/Borrow/BorrowTable' -import BorrowModal from 'components/BorrowModal' -import Card from 'components/Card' -import RepayModal from 'components/RepayModal' -import Text from 'components/Text' -import useAllowedCoins from 'hooks/useAllowedCoins' -import useCreditAccountPositions from 'hooks/useCreditAccountPositions' -import useMarkets from 'hooks/useMarkets' -import useRedbankBalances from 'hooks/useRedbankBalances' -import useTokenPrices from 'hooks/useTokenPrices' +import { BorrowModal, Card, RepayModal, Text } from 'components' +import { BorrowTable } from 'components/Borrow' import { useAccountDetailsStore } from 'stores' import { getTokenDecimals, getTokenInfo } from 'utils/tokens' +import { + useAllowedCoins, + useCreditAccountPositions, + useMarkets, + useRedbankBalances, + useTokenPrices, +} from 'hooks/queries' type ModalState = { show: 'borrow' | 'repay' | false diff --git a/pages/council.tsx b/src/pages/council.tsx similarity index 75% rename from pages/council.tsx rename to src/pages/council.tsx index 8601fb39..7f088971 100644 --- a/pages/council.tsx +++ b/src/pages/council.tsx @@ -1,5 +1,4 @@ -import Card from 'components/Card' -import Text from 'components/Text' +import { Card, Text } from 'components' const Council = () => { return ( diff --git a/pages/earn.tsx b/src/pages/earn.tsx similarity index 84% rename from pages/earn.tsx rename to src/pages/earn.tsx index eada7623..bf2c6022 100644 --- a/pages/earn.tsx +++ b/src/pages/earn.tsx @@ -1,5 +1,4 @@ -import Card from 'components/Card' -import Text from 'components/Text' +import { Card, Text } from 'components' const Earn = () => { return ( diff --git a/pages/portfolio.tsx b/src/pages/portfolio.tsx similarity index 96% rename from pages/portfolio.tsx rename to src/pages/portfolio.tsx index 48dd8c5d..c0353bb5 100644 --- a/pages/portfolio.tsx +++ b/src/pages/portfolio.tsx @@ -1,6 +1,4 @@ -import Card from 'components/Card' -import FormattedNumber from 'components/FormattedNumber' -import Text from 'components/Text' +import { Card, FormattedNumber, Text } from 'components' const mockedAccounts = [ { diff --git a/pages/trade.tsx b/src/pages/trade.tsx similarity index 83% rename from pages/trade.tsx rename to src/pages/trade.tsx index 60af8a94..c90b599a 100644 --- a/pages/trade.tsx +++ b/src/pages/trade.tsx @@ -1,6 +1,5 @@ -import Card from 'components/Card' -import Text from 'components/Text' -import TradeActionModule from 'components/Trade/TradeActionModule' +import { Card, Text } from 'components' +import { TradeActionModule } from 'components/Trade' const Trade = () => { return ( diff --git a/stores/index.tsx b/src/stores/index.ts similarity index 56% rename from stores/index.tsx rename to src/stores/index.ts index 364aeafc..566fd425 100644 --- a/stores/index.tsx +++ b/src/stores/index.ts @@ -1,3 +1,6 @@ +// @index(['./*.tsx'], f => `export { ${f.name} } from '${f.path}'`) export { useAccountDetailsStore } from './useAccountDetailsStore' export { useModalStore } from './useModalStore' +export { useSettings } from './useSettings' export { useWalletStore } from './useWalletStore' +// @endindex diff --git a/stores/useAccountDetailsStore.tsx b/src/stores/useAccountDetailsStore.tsx similarity index 93% rename from stores/useAccountDetailsStore.tsx rename to src/stores/useAccountDetailsStore.tsx index 0888483c..b945602c 100644 --- a/stores/useAccountDetailsStore.tsx +++ b/src/stores/useAccountDetailsStore.tsx @@ -5,7 +5,7 @@ interface AccountDetailsStore { selectedAccount: string | null } -export const useAccountDetailsStore = create()((set) => ({ +export const useAccountDetailsStore = create()(() => ({ isOpen: true, selectedAccount: null, })) diff --git a/stores/useModalStore.tsx b/src/stores/useModalStore.tsx similarity index 100% rename from stores/useModalStore.tsx rename to src/stores/useModalStore.tsx diff --git a/src/stores/useSettings.tsx b/src/stores/useSettings.tsx new file mode 100644 index 00000000..fd360ebb --- /dev/null +++ b/src/stores/useSettings.tsx @@ -0,0 +1,9 @@ +import create from 'zustand' + +interface SettingsStore { + enableAnimations: boolean +} + +export const useSettings = create()(() => ({ + enableAnimations: true, +})) diff --git a/stores/useWalletStore.tsx b/src/stores/useWalletStore.tsx similarity index 88% rename from stores/useWalletStore.tsx rename to src/stores/useWalletStore.tsx index b4544b3c..dada5395 100644 --- a/stores/useWalletStore.tsx +++ b/src/stores/useWalletStore.tsx @@ -1,10 +1,9 @@ -import { SigningCosmWasmClient } from '@cosmjs/cosmwasm-stargate' -import create from 'zustand' import { WalletChainInfo, WalletConnectionStatus, WalletSigningCosmWasmClient, } from '@marsprotocol/wallet-connector' +import create from 'zustand' import { contractAddresses } from 'config/contracts' import { MarsAccountNftClient } from 'types/generated/mars-account-nft/MarsAccountNft.client' @@ -24,7 +23,7 @@ interface WalletStore { swapperBase?: MarsSwapperBaseClient } actions: { - initClients: (address: string, signingClient: SigningCosmWasmClient) => void + initClients: (address: string, signingClient: WalletSigningCosmWasmClient) => void initialize: ( status: WalletConnectionStatus, signingCosmWasmClient?: WalletSigningCosmWasmClient, @@ -42,9 +41,12 @@ export const useWalletStore = create()((set, get) => ({ clients: {}, actions: { initClients: (address, signingClient) => { - const client = get().signingClient - if (!client) return - const accountNft = new MarsAccountNftClient(client, address, contractAddresses.accountNft) + if (!signingClient) return + const accountNft = new MarsAccountNftClient( + signingClient, + address, + contractAddresses.accountNft, + ) const creditManager = new MarsCreditManagerClient( signingClient, address, diff --git a/styles/globals.css b/src/styles/globals.css similarity index 100% rename from styles/globals.css rename to src/styles/globals.css diff --git a/src/types/components/FormattedNumber.d.ts b/src/types/components/FormattedNumber.d.ts new file mode 100644 index 00000000..267e8ff3 --- /dev/null +++ b/src/types/components/FormattedNumber.d.ts @@ -0,0 +1,12 @@ +interface FormattedNumberProps { + amount: number | string + animate?: boolean + className?: string + minDecimals?: number + maxDecimals?: number + thousandSeparator?: boolean + prefix?: boolean | string + suffix?: boolean | string + rounded?: boolean + abbreviated?: boolean +} diff --git a/src/types/components/PositionsList.d.ts b/src/types/components/PositionsList.d.ts new file mode 100644 index 00000000..841bdea2 --- /dev/null +++ b/src/types/components/PositionsList.d.ts @@ -0,0 +1,8 @@ +interface PositionsEntry extends FormattedNumberProps { + format?: 'number' | 'string' + type?: 'debt' +} + +interface PositionsData { + [key: string]: PositionsEntry +} diff --git a/src/types/components/RiskChart.d.ts b/src/types/components/RiskChart.d.ts new file mode 100644 index 00000000..de2bb959 --- /dev/null +++ b/src/types/components/RiskChart.d.ts @@ -0,0 +1,8 @@ +interface RiskTimePair { + date: string + risk: number +} + +interface RiskChartProps { + data: RiskTimePair[] +} diff --git a/src/types/custom.d.ts b/src/types/custom.d.ts new file mode 100644 index 00000000..2e323377 --- /dev/null +++ b/src/types/custom.d.ts @@ -0,0 +1,4 @@ +declare module '*.svg' { + const content: React.FunctionComponent> + export default content +} diff --git a/types/generated/mars-account-nft/MarsAccountNft.client.ts b/src/types/generated/mars-account-nft/MarsAccountNft.client.ts similarity index 100% rename from types/generated/mars-account-nft/MarsAccountNft.client.ts rename to src/types/generated/mars-account-nft/MarsAccountNft.client.ts diff --git a/types/generated/mars-account-nft/MarsAccountNft.message-composer.ts b/src/types/generated/mars-account-nft/MarsAccountNft.message-composer.ts similarity index 100% rename from types/generated/mars-account-nft/MarsAccountNft.message-composer.ts rename to src/types/generated/mars-account-nft/MarsAccountNft.message-composer.ts diff --git a/types/generated/mars-account-nft/MarsAccountNft.react-query.ts b/src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts similarity index 100% rename from types/generated/mars-account-nft/MarsAccountNft.react-query.ts rename to src/types/generated/mars-account-nft/MarsAccountNft.react-query.ts diff --git a/types/generated/mars-account-nft/MarsAccountNft.types.ts b/src/types/generated/mars-account-nft/MarsAccountNft.types.ts similarity index 100% rename from types/generated/mars-account-nft/MarsAccountNft.types.ts rename to src/types/generated/mars-account-nft/MarsAccountNft.types.ts diff --git a/types/generated/mars-account-nft/bundle.ts b/src/types/generated/mars-account-nft/bundle.ts similarity index 100% rename from types/generated/mars-account-nft/bundle.ts rename to src/types/generated/mars-account-nft/bundle.ts diff --git a/types/generated/mars-credit-manager/MarsCreditManager.client.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.client.ts similarity index 100% rename from types/generated/mars-credit-manager/MarsCreditManager.client.ts rename to src/types/generated/mars-credit-manager/MarsCreditManager.client.ts diff --git a/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts similarity index 100% rename from types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts rename to src/types/generated/mars-credit-manager/MarsCreditManager.message-composer.ts diff --git a/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts similarity index 100% rename from types/generated/mars-credit-manager/MarsCreditManager.react-query.ts rename to src/types/generated/mars-credit-manager/MarsCreditManager.react-query.ts diff --git a/types/generated/mars-credit-manager/MarsCreditManager.types.ts b/src/types/generated/mars-credit-manager/MarsCreditManager.types.ts similarity index 100% rename from types/generated/mars-credit-manager/MarsCreditManager.types.ts rename to src/types/generated/mars-credit-manager/MarsCreditManager.types.ts diff --git a/types/generated/mars-credit-manager/bundle.ts b/src/types/generated/mars-credit-manager/bundle.ts similarity index 100% rename from types/generated/mars-credit-manager/bundle.ts rename to src/types/generated/mars-credit-manager/bundle.ts diff --git a/types/generated/mars-mock-oracle/MarsMockOracle.client.ts b/src/types/generated/mars-mock-oracle/MarsMockOracle.client.ts similarity index 100% rename from types/generated/mars-mock-oracle/MarsMockOracle.client.ts rename to src/types/generated/mars-mock-oracle/MarsMockOracle.client.ts diff --git a/types/generated/mars-mock-oracle/MarsMockOracle.message-composer.ts b/src/types/generated/mars-mock-oracle/MarsMockOracle.message-composer.ts similarity index 100% rename from types/generated/mars-mock-oracle/MarsMockOracle.message-composer.ts rename to src/types/generated/mars-mock-oracle/MarsMockOracle.message-composer.ts diff --git a/types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts b/src/types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts similarity index 100% rename from types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts rename to src/types/generated/mars-mock-oracle/MarsMockOracle.react-query.ts diff --git a/types/generated/mars-mock-oracle/MarsMockOracle.types.ts b/src/types/generated/mars-mock-oracle/MarsMockOracle.types.ts similarity index 100% rename from types/generated/mars-mock-oracle/MarsMockOracle.types.ts rename to src/types/generated/mars-mock-oracle/MarsMockOracle.types.ts diff --git a/types/generated/mars-mock-oracle/bundle.ts b/src/types/generated/mars-mock-oracle/bundle.ts similarity index 100% rename from types/generated/mars-mock-oracle/bundle.ts rename to src/types/generated/mars-mock-oracle/bundle.ts diff --git a/types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts b/src/types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts similarity index 100% rename from types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts rename to src/types/generated/mars-mock-red-bank/MarsMockRedBank.client.ts diff --git a/types/generated/mars-mock-red-bank/MarsMockRedBank.message-composer.ts b/src/types/generated/mars-mock-red-bank/MarsMockRedBank.message-composer.ts similarity index 100% rename from types/generated/mars-mock-red-bank/MarsMockRedBank.message-composer.ts rename to src/types/generated/mars-mock-red-bank/MarsMockRedBank.message-composer.ts diff --git a/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts b/src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts similarity index 100% rename from types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts rename to src/types/generated/mars-mock-red-bank/MarsMockRedBank.react-query.ts diff --git a/types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts b/src/types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts similarity index 100% rename from types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts rename to src/types/generated/mars-mock-red-bank/MarsMockRedBank.types.ts diff --git a/types/generated/mars-mock-red-bank/bundle.ts b/src/types/generated/mars-mock-red-bank/bundle.ts similarity index 100% rename from types/generated/mars-mock-red-bank/bundle.ts rename to src/types/generated/mars-mock-red-bank/bundle.ts diff --git a/types/generated/mars-mock-vault/MarsMockVault.client.ts b/src/types/generated/mars-mock-vault/MarsMockVault.client.ts similarity index 100% rename from types/generated/mars-mock-vault/MarsMockVault.client.ts rename to src/types/generated/mars-mock-vault/MarsMockVault.client.ts diff --git a/types/generated/mars-mock-vault/MarsMockVault.message-composer.ts b/src/types/generated/mars-mock-vault/MarsMockVault.message-composer.ts similarity index 100% rename from types/generated/mars-mock-vault/MarsMockVault.message-composer.ts rename to src/types/generated/mars-mock-vault/MarsMockVault.message-composer.ts diff --git a/types/generated/mars-mock-vault/MarsMockVault.react-query.ts b/src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts similarity index 100% rename from types/generated/mars-mock-vault/MarsMockVault.react-query.ts rename to src/types/generated/mars-mock-vault/MarsMockVault.react-query.ts diff --git a/types/generated/mars-mock-vault/MarsMockVault.types.ts b/src/types/generated/mars-mock-vault/MarsMockVault.types.ts similarity index 100% rename from types/generated/mars-mock-vault/MarsMockVault.types.ts rename to src/types/generated/mars-mock-vault/MarsMockVault.types.ts diff --git a/types/generated/mars-mock-vault/bundle.ts b/src/types/generated/mars-mock-vault/bundle.ts similarity index 100% rename from types/generated/mars-mock-vault/bundle.ts rename to src/types/generated/mars-mock-vault/bundle.ts diff --git a/types/generated/mars-mock-zapper/MarsMockZapper.client.ts b/src/types/generated/mars-mock-zapper/MarsMockZapper.client.ts similarity index 100% rename from types/generated/mars-mock-zapper/MarsMockZapper.client.ts rename to src/types/generated/mars-mock-zapper/MarsMockZapper.client.ts diff --git a/types/generated/mars-mock-zapper/MarsMockZapper.message-composer.ts b/src/types/generated/mars-mock-zapper/MarsMockZapper.message-composer.ts similarity index 100% rename from types/generated/mars-mock-zapper/MarsMockZapper.message-composer.ts rename to src/types/generated/mars-mock-zapper/MarsMockZapper.message-composer.ts diff --git a/types/generated/mars-mock-zapper/MarsMockZapper.react-query.ts b/src/types/generated/mars-mock-zapper/MarsMockZapper.react-query.ts similarity index 100% rename from types/generated/mars-mock-zapper/MarsMockZapper.react-query.ts rename to src/types/generated/mars-mock-zapper/MarsMockZapper.react-query.ts diff --git a/types/generated/mars-mock-zapper/MarsMockZapper.types.ts b/src/types/generated/mars-mock-zapper/MarsMockZapper.types.ts similarity index 100% rename from types/generated/mars-mock-zapper/MarsMockZapper.types.ts rename to src/types/generated/mars-mock-zapper/MarsMockZapper.types.ts diff --git a/types/generated/mars-mock-zapper/bundle.ts b/src/types/generated/mars-mock-zapper/bundle.ts similarity index 100% rename from types/generated/mars-mock-zapper/bundle.ts rename to src/types/generated/mars-mock-zapper/bundle.ts diff --git a/types/generated/mars-oracle-adapter/MarsOracleAdapter.client.ts b/src/types/generated/mars-oracle-adapter/MarsOracleAdapter.client.ts similarity index 100% rename from types/generated/mars-oracle-adapter/MarsOracleAdapter.client.ts rename to src/types/generated/mars-oracle-adapter/MarsOracleAdapter.client.ts diff --git a/types/generated/mars-oracle-adapter/MarsOracleAdapter.message-composer.ts b/src/types/generated/mars-oracle-adapter/MarsOracleAdapter.message-composer.ts similarity index 100% rename from types/generated/mars-oracle-adapter/MarsOracleAdapter.message-composer.ts rename to src/types/generated/mars-oracle-adapter/MarsOracleAdapter.message-composer.ts diff --git a/types/generated/mars-oracle-adapter/MarsOracleAdapter.react-query.ts b/src/types/generated/mars-oracle-adapter/MarsOracleAdapter.react-query.ts similarity index 100% rename from types/generated/mars-oracle-adapter/MarsOracleAdapter.react-query.ts rename to src/types/generated/mars-oracle-adapter/MarsOracleAdapter.react-query.ts diff --git a/types/generated/mars-oracle-adapter/MarsOracleAdapter.types.ts b/src/types/generated/mars-oracle-adapter/MarsOracleAdapter.types.ts similarity index 100% rename from types/generated/mars-oracle-adapter/MarsOracleAdapter.types.ts rename to src/types/generated/mars-oracle-adapter/MarsOracleAdapter.types.ts diff --git a/types/generated/mars-oracle-adapter/bundle.ts b/src/types/generated/mars-oracle-adapter/bundle.ts similarity index 100% rename from types/generated/mars-oracle-adapter/bundle.ts rename to src/types/generated/mars-oracle-adapter/bundle.ts diff --git a/types/generated/mars-swapper-base/MarsSwapperBase.client.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.client.ts similarity index 100% rename from types/generated/mars-swapper-base/MarsSwapperBase.client.ts rename to src/types/generated/mars-swapper-base/MarsSwapperBase.client.ts diff --git a/types/generated/mars-swapper-base/MarsSwapperBase.message-composer.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.message-composer.ts similarity index 100% rename from types/generated/mars-swapper-base/MarsSwapperBase.message-composer.ts rename to src/types/generated/mars-swapper-base/MarsSwapperBase.message-composer.ts diff --git a/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts similarity index 100% rename from types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts rename to src/types/generated/mars-swapper-base/MarsSwapperBase.react-query.ts diff --git a/types/generated/mars-swapper-base/MarsSwapperBase.types.ts b/src/types/generated/mars-swapper-base/MarsSwapperBase.types.ts similarity index 100% rename from types/generated/mars-swapper-base/MarsSwapperBase.types.ts rename to src/types/generated/mars-swapper-base/MarsSwapperBase.types.ts diff --git a/types/generated/mars-swapper-base/bundle.ts b/src/types/generated/mars-swapper-base/bundle.ts similarity index 100% rename from types/generated/mars-swapper-base/bundle.ts rename to src/types/generated/mars-swapper-base/bundle.ts diff --git a/src/types/hooks/useAccountStats.d.ts b/src/types/hooks/useAccountStats.d.ts new file mode 100644 index 00000000..2b5aa913 --- /dev/null +++ b/src/types/hooks/useAccountStats.d.ts @@ -0,0 +1,5 @@ +interface AccountStatsAction { + type: 'borrow' | 'repay' | 'deposit' | 'withdraw' + amount: number + denom: string +} diff --git a/src/types/hooks/useMarkets.d.ts b/src/types/hooks/useMarkets.d.ts new file mode 100644 index 00000000..ae486710 --- /dev/null +++ b/src/types/hooks/useMarkets.d.ts @@ -0,0 +1,31 @@ +interface Market { + denom: string + max_loan_to_value: string + liquidation_threshold: string + liquidation_bonus: string + reserve_factor: string + interest_rate_model: { + optimal_utilization_rate: string + base: string + slope_1: string + slope_2: string + } + borrow_index: string + liquidity_index: string + borrow_rate: string + liquidity_rate: string + indexes_last_updated: number + collateral_total_scaled: string + debt_total_scaled: string + deposit_enabled: boolean + borrow_enabled: boolean + deposit_cap: string +} + +interface MarketResult { + wasm: MarketData +} + +interface MarketData { + [key: string]: Market +} diff --git a/src/types/hooks/useTokenPrices.d.ts b/src/types/hooks/useTokenPrices.d.ts new file mode 100644 index 00000000..562716e0 --- /dev/null +++ b/src/types/hooks/useTokenPrices.d.ts @@ -0,0 +1,8 @@ +interface TokenPricesResult { + prices: { + [key: string]: { + denom: string + price: string + } + } +} diff --git a/types/index.ts b/src/types/index.ts similarity index 100% rename from types/index.ts rename to src/types/index.ts diff --git a/types/query-keys-factory.ts b/src/types/query-keys-factory.ts similarity index 100% rename from types/query-keys-factory.ts rename to src/types/query-keys-factory.ts diff --git a/src/types/utils/formatters.d.ts b/src/types/utils/formatters.d.ts new file mode 100644 index 00000000..ac426e3e --- /dev/null +++ b/src/types/utils/formatters.d.ts @@ -0,0 +1,3 @@ +interface KeyValuePair { + [key: string]: number +} diff --git a/utils/address.ts b/src/utils/address.ts similarity index 100% rename from utils/address.ts rename to src/utils/address.ts diff --git a/src/utils/balances.ts b/src/utils/balances.ts new file mode 100644 index 00000000..e77169af --- /dev/null +++ b/src/utils/balances.ts @@ -0,0 +1,42 @@ +import { Coin } from '@cosmjs/stargate' + +import { getTokenTotalUSDValue, lookup } from './formatters' +import { getTokenSymbol } from './tokens' + +export const formatBalances = ( + positionData: Coin[], + tokenPrices: KeyValuePair, + debt: boolean, + marketsData?: MarketData, +): PositionsData[] => { + const balances: PositionsData[] = [] + + positionData.forEach((coin) => { + const dataEntry: PositionsData = { + asset: { + amount: getTokenSymbol(coin.denom), + type: debt ? 'debt' : undefined, + }, + value: { + amount: getTokenTotalUSDValue(coin.amount, coin.denom, tokenPrices), + format: 'number', + prefix: '$', + }, + size: { + amount: lookup(coin.amount, coin.denom), + format: 'number', + maxDecimals: 4, + minDecimals: 0, + }, + apy: { + amount: debt ? Number(marketsData?.[coin.denom].borrow_rate) * 100 : '-', + format: debt ? 'number' : 'string', + suffix: '%', + minDecimals: 0, + }, + } + balances.push(dataEntry) + }) + + return balances +} diff --git a/utils/chains.ts b/src/utils/chains.ts similarity index 100% rename from utils/chains.ts rename to src/utils/chains.ts diff --git a/utils/contants.ts b/src/utils/contants.ts similarity index 100% rename from utils/contants.ts rename to src/utils/contants.ts diff --git a/utils/formatters.ts b/src/utils/formatters.ts similarity index 85% rename from utils/formatters.ts rename to src/utils/formatters.ts index 09b5b16d..e5b4f937 100644 --- a/utils/formatters.ts +++ b/src/utils/formatters.ts @@ -1,3 +1,7 @@ +import BigNumber from 'bignumber.js' + +import { getTokenDecimals } from './tokens' + export function truncate(text = '', [h, t]: [number, number] = [6, 6]): string { const head = text.slice(0, h) if (t === 0) return text.length > h + t ? head + '...' : text @@ -13,6 +17,26 @@ export const formatCurrency = (value: string | number) => { }) } +export const getTokenTotalUSDValue = ( + amount: string, + denom: string, + tokenPrices?: KeyValuePair, +) => { + if (!tokenPrices) return 0 + + return ( + BigNumber(amount) + .div(10 ** getTokenDecimals(denom)) + .toNumber() * tokenPrices[denom] + ) +} + +export const lookup = (amount: string | number, denom: string) => { + return BigNumber(amount) + .div(10 ** getTokenDecimals(denom)) + .toNumber() +} + export const formatValue = ( amount: number | string, minDecimals = 2, diff --git a/src/utils/risk.ts b/src/utils/risk.ts new file mode 100644 index 00000000..74393827 --- /dev/null +++ b/src/utils/risk.ts @@ -0,0 +1,19 @@ +import moment from 'moment' + +export const createRiskData = (risk: number) => { + const data = [] + const days = 30 + const today = new Date() + + for (let i = 0; i <= days; i++) { + const date = moment(today) + .subtract(days - i, 'days') + .format('YYYY-MM-DD') + data.push({ + date: date, + risk: risk === 0 ? 0 : i === days ? risk * 100 : Math.floor(Math.random() * 100), + }) + } + + return data +} diff --git a/utils/tokens.ts b/src/utils/tokens.ts similarity index 88% rename from utils/tokens.ts rename to src/utils/tokens.ts index 3ddb5728..8c66a5b5 100644 --- a/utils/tokens.ts +++ b/src/utils/tokens.ts @@ -1,4 +1,4 @@ -import tokenInfo from 'config/tokenInfo' +import { tokenInfo } from 'config/tokenInfo' export const getTokenSymbol = (denom: string) => { return tokenInfo[denom]?.symbol ?? denom diff --git a/tailwind.config.js b/tailwind.config.js index 491e186e..1a3d2e3f 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -2,7 +2,7 @@ const plugin = require('tailwindcss/plugin') module.exports = { - content: ['./pages/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}'], + content: ['./src/pages/**/*.{js,ts,jsx,tsx}', './src//components/**/*.{js,ts,jsx,tsx}'], safelist: [ 'h-15', 'text-3xs', @@ -37,7 +37,9 @@ module.exports = { }, backgroundImage: { mars: 'url(/images/bg.svg)', - 'fund-modal': 'url(/images/fund-modal-bg.png)', + 'fund-modal': 'url(/images/fund-bg.webp), url(/images/fund-bg.png)', + 'delete-modal': 'url(/images/delete-account-bg.webp), url(/images/delete-account-bg.png)', + 'create-modal': 'url(/images/create-account-bg.webp), url(/images/create-account-bg.png)', }, backgroundSize: { desktop: '100% auto', diff --git a/tsconfig.json b/tsconfig.json index cdde52e4..8f916607 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,18 +4,20 @@ "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, "strict": true, "forceConsistentCasingInFileNames": true, - "noEmit": true, - "esModuleInterop": true, + "noFallthroughCasesInSwitch": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, + "noEmit": true, "jsx": "preserve", "incremental": true, - "baseUrl": "." + "baseUrl": "src" }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], + "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "src/types/custom.d.ts"], "exclude": ["node_modules"] } diff --git a/yarn.lock b/yarn.lock index 8494c365..674f2cb2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -951,7 +951,7 @@ core-js-pure "^3.25.1" regenerator-runtime "^0.13.11" -"@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.13.10", "@babel/runtime@^7.18.9", "@babel/runtime@^7.8.4": +"@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.11.2", "@babel/runtime@^7.13.10", "@babel/runtime@^7.18.9", "@babel/runtime@^7.8.4": version "7.20.6" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.20.6.tgz#facf4879bfed9b5326326273a64220f099b0fce3" integrity sha512-Q+8MqP7TiHMWzSfwiJwXCjyf4GYA4Dgw3emg/7xmwsdLJOZUp+nMqcOwOzzYheuM1rhDu8FSj2l0aoMygEuXuA== @@ -1027,24 +1027,6 @@ long "^4.0.0" pako "^2.0.2" -"@cosmjs/crypto@^0.24.1": - version "0.24.1" - resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.24.1.tgz#62da59c32b26344f26b10dd31a02b93655586d04" - integrity sha512-GPhaWmQO06mXldKj/b+oKF5o3jMNfRKpAw+Q8XQhrD7ItinVPDMu8Xgl6frUXWTUdgpYwqpvqOcpm85QUsYV0Q== - dependencies: - "@cosmjs/encoding" "^0.24.1" - "@cosmjs/math" "^0.24.1" - "@cosmjs/utils" "^0.24.1" - bip39 "^3.0.2" - bn.js "^4.11.8" - elliptic "^6.5.3" - js-sha3 "^0.8.0" - libsodium-wrappers "^0.7.6" - pbkdf2 "^3.1.1" - ripemd160 "^2.0.2" - sha.js "^2.4.11" - unorm "^1.5.0" - "@cosmjs/crypto@^0.29.4": version "0.29.4" resolved "https://registry.yarnpkg.com/@cosmjs/crypto/-/crypto-0.29.4.tgz#2198e1d2da9eb310df9ed8b8609dbf1a370e900b" @@ -1067,15 +1049,6 @@ bech32 "^1.1.4" readonly-date "^1.0.0" -"@cosmjs/encoding@^0.24.1": - version "0.24.1" - resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.24.1.tgz#b30e92cdb70fc200a163b8c7aa5254606c8a09ab" - integrity sha512-PMr+gaXAuM0XgjeXwB1zdX1QI0t+PgVhbmjgI/RSgswDzdExNH97qUopecL0/HG3p64vhIT/6ZjXYYTljZL7WA== - dependencies: - base64-js "^1.3.0" - bech32 "^1.1.4" - readonly-date "^1.0.0" - "@cosmjs/encoding@^0.29.4": version "0.29.4" resolved "https://registry.yarnpkg.com/@cosmjs/encoding/-/encoding-0.29.4.tgz#0ae1b78c064dacda7c35eeb7c35ed7b55951d94f" @@ -1093,18 +1066,6 @@ "@cosmjs/stream" "^0.29.4" xstream "^11.14.0" -"@cosmjs/launchpad@^0.24.0-alpha.25", "@cosmjs/launchpad@^0.24.1": - version "0.24.1" - resolved "https://registry.yarnpkg.com/@cosmjs/launchpad/-/launchpad-0.24.1.tgz#fe7e80734dfd60ea093429a646d7a38634c70134" - integrity sha512-syqVGKRH6z1vw4DdAJOSu4OgUXJdkXQozqvDde0cXYwnvhb7EXGSg5CTtp+2GqTBJuNVfMZ2DSvrC2Ig8cWBQQ== - dependencies: - "@cosmjs/crypto" "^0.24.1" - "@cosmjs/encoding" "^0.24.1" - "@cosmjs/math" "^0.24.1" - "@cosmjs/utils" "^0.24.1" - axios "^0.21.1" - fast-deep-equal "^3.1.3" - "@cosmjs/math@^0.20.0": version "0.20.1" resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.20.1.tgz#c3c2be821b8b5dbbb9b2c0401bd9f1472e821f2a" @@ -1112,13 +1073,6 @@ dependencies: bn.js "^4.11.8" -"@cosmjs/math@^0.24.1": - version "0.24.1" - resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.24.1.tgz#9eed507885aacc9b269441fc9ecb00fb5876883a" - integrity sha512-eBQk8twgzmpHFCVkoNjTZhsZwWRbR+JXt0FhjXJoD85SBm4K8b2OnOyTg68uPHVKOJjLRwzyRVYgMrg5TBVgwQ== - dependencies: - bn.js "^4.11.8" - "@cosmjs/math@^0.29.4": version "0.29.4" resolved "https://registry.yarnpkg.com/@cosmjs/math/-/math-0.29.4.tgz#9e9079826090718de75ff239a63314b0baf63999" @@ -1126,15 +1080,6 @@ dependencies: bn.js "^5.2.0" -"@cosmjs/proto-signing@^0.24.0-alpha.25": - version "0.24.1" - resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.24.1.tgz#4ee38d4e0d29c626344fb832235fda8e8d645c28" - integrity sha512-/rnyNx+FlG6b6O+igsb42eMN1/RXY+pTrNnAE8/YZaRloP9A6MXiTMO5JdYSTcjaD0mEVhejiy96bcyflKYXBg== - dependencies: - "@cosmjs/launchpad" "^0.24.1" - long "^4.0.0" - protobufjs "~6.10.2" - "@cosmjs/proto-signing@^0.29.4": version "0.29.4" resolved "https://registry.yarnpkg.com/@cosmjs/proto-signing/-/proto-signing-0.29.4.tgz#8f314a936f07d15f5414280bec8aabb6de4078db" @@ -1204,11 +1149,6 @@ resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.20.1.tgz#4d239b7d93c15523cdf109f225cbf61326fb69cd" integrity sha512-xl9YnIrAAaBd6nFffwFbyrnKjqjD9zKGP8OBKxzyglxamHfqAS+PcJPEiaEpt+oUt7HAIOyhL3KK75Dh52hGvA== -"@cosmjs/utils@^0.24.1": - version "0.24.1" - resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.24.1.tgz#0adfefe63b7f17222bc2bc12f71296f35e7ad378" - integrity sha512-VA3WFx1lMFb7esp9BqHWkDgMvHoA3D9w+uDRvWhVRpUpDc7RYHxMbWExASjz+gNblTCg556WJGzF64tXnf9tdQ== - "@cosmjs/utils@^0.29.4": version "0.29.4" resolved "https://registry.yarnpkg.com/@cosmjs/utils/-/utils-0.29.4.tgz#8a80da006fe2b544a3c36f557e4b782810e532fd" @@ -1786,17 +1726,6 @@ long "^4.0.0" secretjs "0.17.7" -"@keplr-wallet/types@^0.10.24": - version "0.10.24" - resolved "https://registry.yarnpkg.com/@keplr-wallet/types/-/types-0.10.24.tgz#b795f3f45ccad852803c726812625c61ff2b4a29" - integrity sha512-L90/1/w2/QS9QMB9T0rqqfduy6qn9Isqjfdmi6AHewhKjy2TfZJaXBFuMvyYmpYBbkhkei+pM9mLh4+f3eblww== - dependencies: - "@cosmjs/launchpad" "^0.24.0-alpha.25" - "@cosmjs/proto-signing" "^0.24.0-alpha.25" - axios "^0.27.2" - long "^4.0.0" - secretjs "^0.17.0" - "@keplr-wallet/unit@0.11.21": version "0.11.21" resolved "https://registry.yarnpkg.com/@keplr-wallet/unit/-/unit-0.11.21.tgz#845ae7df30e5f069c53b6de3889329611bcbdd70" @@ -2635,6 +2564,42 @@ dependencies: "@types/node" "*" +"@types/d3-color@^2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@types/d3-color/-/d3-color-2.0.3.tgz#8bc4589073c80e33d126345542f588056511fe82" + integrity sha512-+0EtEjBfKEDtH9Rk3u3kLOUXM5F+iZK+WvASPb0MhIZl8J8NUvGeZRwKCXl+P3HkYx5TdU4YtcibpqHkSR9n7w== + +"@types/d3-interpolate@^2.0.0": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-interpolate/-/d3-interpolate-2.0.2.tgz#78eddf7278b19e48e8652603045528d46897aba0" + integrity sha512-lElyqlUfIPyWG/cD475vl6msPL4aMU7eJvx1//Q177L8mdXoVPFl1djIESF2FKnc0NyaHvQlJpWwKJYwAhUoCw== + dependencies: + "@types/d3-color" "^2" + +"@types/d3-path@^2": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@types/d3-path/-/d3-path-2.0.2.tgz#6052f38f6186319769dfabab61b5514b0e02c75c" + integrity sha512-3YHpvDw9LzONaJzejXLOwZ3LqwwkoXb9LI2YN7Hbd6pkGo5nIlJ09ul4bQhBN4hQZJKmUpX8HkVqbzgUKY48cg== + +"@types/d3-scale@^3.0.0": + version "3.3.2" + resolved "https://registry.yarnpkg.com/@types/d3-scale/-/d3-scale-3.3.2.tgz#18c94e90f4f1c6b1ee14a70f14bfca2bd1c61d06" + integrity sha512-gGqr7x1ost9px3FvIfUMi5XA/F/yAf4UkUDtdQhpH92XCT0Oa7zkkRzY61gPVJq+DxpHn/btouw5ohWkbBsCzQ== + dependencies: + "@types/d3-time" "^2" + +"@types/d3-shape@^2.0.0": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@types/d3-shape/-/d3-shape-2.1.3.tgz#35d397b9e687abaa0de82343b250b9897b8cacf3" + integrity sha512-HAhCel3wP93kh4/rq+7atLdybcESZ5bRHDEZUojClyZWsRuEMo3A52NGYJSh48SxfxEU6RZIVbZL2YFZ2OAlzQ== + dependencies: + "@types/d3-path" "^2" + +"@types/d3-time@^2": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@types/d3-time/-/d3-time-2.1.1.tgz#743fdc821c81f86537cbfece07093ac39b4bc342" + integrity sha512-9MVYlmIgmRR31C5b4FVSWtuMmBHh2mOWQYfl7XAYOa8dsnb7iEmUmRSWSFgXFtkjxO65d7hTUHQC+RhR/9IWFg== + "@types/json5@^0.0.29": version "0.0.29" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" @@ -2645,7 +2610,7 @@ resolved "https://registry.yarnpkg.com/@types/long/-/long-4.0.2.tgz#b74129719fc8d11c01868010082d483b7545591a" integrity sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA== -"@types/node@*", "@types/node@18.11.11", "@types/node@>=13.7.0": +"@types/node@*", "@types/node@>=13.7.0": version "18.11.11" resolved "https://registry.yarnpkg.com/@types/node/-/node-18.11.11.tgz#1d455ac0211549a8409d3cdb371cd55cc971e8dc" integrity sha512-KJ021B1nlQUBLopzZmPBVuGU9un7WJd/W4ya7Ih02B4Uwky5Nja0yGYav2EfYIk0RR2Q9oVhf60S2XR1BCWJ2g== @@ -2660,10 +2625,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== -"@types/node@^13.7.0": - version "13.13.52" - resolved "https://registry.yarnpkg.com/@types/node/-/node-13.13.52.tgz#03c13be70b9031baaed79481c0c0cfb0045e53f7" - integrity sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ== +"@types/node@18.7.14": + version "18.7.14" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.14.tgz#0fe081752a3333392d00586d815485a17c2cf3c9" + integrity sha512-6bbDaETVi8oyIARulOE9qF1/Qdi/23z6emrUh0fNJRUmjznqrixD4MpGDdgOFk5Xb0m2H6Xu42JGdvAxaJR/wA== "@types/parse-json@^4.0.0": version "4.0.0" @@ -3104,7 +3069,7 @@ axios@0.21.1: dependencies: follow-redirects "^1.10.0" -axios@^0.21.1, axios@^0.21.2: +axios@^0.21.2: version "0.21.4" resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.4.tgz#c67b90dc0568e5c1cf2b0b858c43ba28e2eda575" integrity sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg== @@ -3412,7 +3377,7 @@ cipher-base@^1.0.0, cipher-base@^1.0.1, cipher-base@^1.0.3: inherits "^2.0.1" safe-buffer "^5.0.1" -classnames@^2.3.2: +classnames@^2.2.5, classnames@^2.3.2: version "2.3.2" resolved "https://registry.yarnpkg.com/classnames/-/classnames-2.3.2.tgz#351d813bf0137fcc6a76a16b88208d2560a0d924" integrity sha512-CSbhY4cFEJRe6/GQzIk5qXZ4Jeg5pcsP7b5peFSDpffpe1cqjASH/n9UTjBwOp6XpMSTwQ8Za2K5V02ueA7Tmw== @@ -3632,6 +3597,11 @@ css-tree@^1.1.2, css-tree@^1.1.3: mdn-data "2.0.14" source-map "^0.6.1" +css-unit-converter@^1.1.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/css-unit-converter/-/css-unit-converter-1.1.2.tgz#4c77f5a1954e6dbff60695ecb214e3270436ab21" + integrity sha512-IiJwMC8rdZE0+xiEZHeru6YoONC4rfPMqGm2W85jMIbkFvv5nFTwJVFHam2eFrN6txmoUYFAFXiv8ICVeTO0MA== + css-what@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/css-what/-/css-what-6.1.0.tgz#fb5effcf76f1ddea2c81bdfaa4de44e79bac70f4" @@ -3659,6 +3629,67 @@ curve25519-js@0.0.4: resolved "https://registry.yarnpkg.com/curve25519-js/-/curve25519-js-0.0.4.tgz#e6ad967e8cd284590d657bbfc90d8b50e49ba060" integrity sha512-axn2UMEnkhyDUPWOwVKBMVIzSQy2ejH2xRGy1wq81dqRwApXfIzfbE3hIX0ZRFBIihf/KDqK158DLwESu4AK1w== +d3-array@2, d3-array@^2.3.0: + version "2.12.1" + resolved "https://registry.yarnpkg.com/d3-array/-/d3-array-2.12.1.tgz#e20b41aafcdffdf5d50928004ececf815a465e81" + integrity sha512-B0ErZK/66mHtEsR1TkPEEkwdy+WDesimkM5gpZr5Dsg54BiTA5RXtYW5qTLIAcekaS9xfZrzBLF/OAkB3Qn1YQ== + dependencies: + internmap "^1.0.0" + +"d3-color@1 - 2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/d3-color/-/d3-color-2.0.0.tgz#8d625cab42ed9b8f601a1760a389f7ea9189d62e" + integrity sha512-SPXi0TSKPD4g9tw0NMZFnR95XVgUZiBH+uUTqQuDu1OsE2zomHU7ho0FISciaPvosimixwHFl3WHLGabv6dDgQ== + +"d3-format@1 - 2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/d3-format/-/d3-format-2.0.0.tgz#a10bcc0f986c372b729ba447382413aabf5b0767" + integrity sha512-Ab3S6XuE/Q+flY96HXT0jOXcM4EAClYFnRGY5zsjRGNy6qCYrQsMffs7cV5Q9xejb35zxW5hf/guKw34kvIKsA== + +"d3-interpolate@1.2.0 - 2", d3-interpolate@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/d3-interpolate/-/d3-interpolate-2.0.1.tgz#98be499cfb8a3b94d4ff616900501a64abc91163" + integrity sha512-c5UhwwTs/yybcmTpAVqwSFl6vrQ8JZJoT5F7xNFK9pymv5C0Ymcc9/LIJHtYIggg/yS9YHw8i8O8tgb9pupjeQ== + dependencies: + d3-color "1 - 2" + +"d3-path@1 - 2": + version "2.0.0" + resolved "https://registry.yarnpkg.com/d3-path/-/d3-path-2.0.0.tgz#55d86ac131a0548adae241eebfb56b4582dd09d8" + integrity sha512-ZwZQxKhBnv9yHaiWd6ZU4x5BtCQ7pXszEV9CU6kRgwIQVQGLMv1oiL4M+MK/n79sYzsj+gcgpPQSctJUsLN7fA== + +d3-scale@^3.0.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/d3-scale/-/d3-scale-3.3.0.tgz#28c600b29f47e5b9cd2df9749c206727966203f3" + integrity sha512-1JGp44NQCt5d1g+Yy+GeOnZP7xHo0ii8zsQp6PGzd+C1/dl0KGsp9A7Mxwp+1D1o4unbTTxVdU/ZOIEBoeZPbQ== + dependencies: + d3-array "^2.3.0" + d3-format "1 - 2" + d3-interpolate "1.2.0 - 2" + d3-time "^2.1.1" + d3-time-format "2 - 3" + +d3-shape@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/d3-shape/-/d3-shape-2.1.0.tgz#3b6a82ccafbc45de55b57fcf956c584ded3b666f" + integrity sha512-PnjUqfM2PpskbSLTJvAzp2Wv4CZsnAgTfcVRTwW03QR3MkXF8Uo7B1y/lWkAsmbKwuecto++4NlsYcvYpXpTHA== + dependencies: + d3-path "1 - 2" + +"d3-time-format@2 - 3": + version "3.0.0" + resolved "https://registry.yarnpkg.com/d3-time-format/-/d3-time-format-3.0.0.tgz#df8056c83659e01f20ac5da5fdeae7c08d5f1bb6" + integrity sha512-UXJh6EKsHBTjopVqZBhFysQcoXSv/5yLONZvkQ5Kk3qbwiUYkdX17Xa1PT6U1ZWXGGfB1ey5L8dKMlFq2DO0Ag== + dependencies: + d3-time "1 - 2" + +"d3-time@1 - 2", d3-time@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/d3-time/-/d3-time-2.1.1.tgz#e9d8a8a88691f4548e68ca085e5ff956724a6682" + integrity sha512-/eIQe/eR4kCQwq7yxi7z4c6qEXf2IYGcjoWB5OOQy4Tq9Uv39/947qlDcN2TLkiTzQWzvnsuYPB9TrWaNfipKQ== + dependencies: + d3-array "2" + damerau-levenshtein@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz#b43d286ccbd36bc5b2f7ed41caf2d0aba1f8a6e7" @@ -3685,6 +3716,11 @@ debug@^3.2.7: dependencies: ms "^2.1.1" +decimal.js-light@^2.4.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/decimal.js-light/-/decimal.js-light-2.5.1.tgz#134fd32508f19e208f4fb2f8dac0d2626a867934" + integrity sha512-qIMFpTMZmny+MMIitAB6D7iVPEorVw6YQRWkvarTkT4tBeSLLiHzcwj6q0MmYSFCiVpiqPJTJEYIrpcPzVEIvg== + decode-uri-component@^0.2.0: version "0.2.2" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" @@ -3773,6 +3809,13 @@ doctrine@^3.0.0: dependencies: esutils "^2.0.2" +dom-helpers@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/dom-helpers/-/dom-helpers-3.4.0.tgz#e9b369700f959f62ecde5a6babde4bccd9169af8" + integrity sha512-LnuPJ+dwqKDIyotW1VzmOZ5TONUN7CwkCR5hrgawTUbkBGYdeoNLZo6nNfGkCrjtE1nXXaj7iMMpDa8/d9WoIA== + dependencies: + "@babel/runtime" "^7.1.2" + dom-serializer@^1.0.1: version "1.4.1" resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.4.1.tgz#de5d41b1aea290215dc45a6dae8adcf1d32e2d30" @@ -4154,7 +4197,7 @@ ethereumjs-util@^7.1.5: ethereum-cryptography "^0.1.3" rlp "^2.2.4" -eventemitter3@^4.0.4, eventemitter3@^4.0.7: +eventemitter3@^4.0.1, eventemitter3@^4.0.4, eventemitter3@^4.0.7: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f" integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw== @@ -4192,6 +4235,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== +fast-equals@^2.0.0: + version "2.0.4" + resolved "https://registry.yarnpkg.com/fast-equals/-/fast-equals-2.0.4.tgz#3add9410585e2d7364c2deeb6a707beadb24b927" + integrity sha512-caj/ZmjHljPrZtbzJ3kfH5ia/k4mTJe/qSiXAGzxZWRZgsgDV0cvNaQULqUX8t0/JVlzzEdYOwCN5DmzTxoD4w== + fast-glob@^3.2.12, fast-glob@^3.2.9: version "3.2.12" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.12.tgz#7f39ec99c2e6ab030337142da9e0c18f37afae80" @@ -4597,6 +4645,11 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" +internmap@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/internmap/-/internmap-1.0.1.tgz#0017cc8a3b99605f0302f2b198d272e015e5df95" + integrity sha512-lDB5YccMydFBtasVtxnZ3MRBHuaoE8GKsppq+EchKL2U4nK/DmEpPHNH8MZe5HkMtpSiTSOZwfN0tzYjO/lJEw== + invariant@2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" @@ -4978,7 +5031,7 @@ lodash.merge@^4.6.2: resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== -lodash@^4.17.19: +lodash@^4.17.19, lodash@^4.17.21: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -5099,6 +5152,11 @@ mobx@^6.1.7: resolved "https://registry.yarnpkg.com/mobx/-/mobx-6.7.0.tgz#2d805610fee1801fd015c54fd5400d2601aa3768" integrity sha512-1kBLBdSNG2bA522HQdbsTvwAwYf9hq9FWxmlhX7wTsJUAI54907J+ozfGW+LoYUo06vjit748g6QH1AAGLNebw== +moment@^2.29.4: + version "2.29.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -5388,7 +5446,7 @@ path-type@^4.0.0: resolved "https://registry.yarnpkg.com/path-type/-/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b" integrity sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw== -pbkdf2@^3.0.16, pbkdf2@^3.0.17, pbkdf2@^3.0.9, pbkdf2@^3.1.1, pbkdf2@^3.1.2: +pbkdf2@^3.0.16, pbkdf2@^3.0.17, pbkdf2@^3.0.9, pbkdf2@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/pbkdf2/-/pbkdf2-3.1.2.tgz#dd822aa0887580e52f1a039dc3eda108efae3075" integrity sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA== @@ -5458,6 +5516,11 @@ postcss-selector-parser@^6.0.10: cssesc "^3.0.0" util-deprecate "^1.0.2" +postcss-value-parser@^3.3.0: + version "3.3.1" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" + integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== + postcss-value-parser@^4.0.0, postcss-value-parser@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz#723c09920836ba6d3e5af019f92bc0971c02e514" @@ -5506,7 +5569,7 @@ progress@^2.0.3: resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== -prop-types@^15.7.2, prop-types@^15.8.1: +prop-types@^15.6.2, prop-types@^15.7.2, prop-types@^15.8.1: version "15.8.1" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== @@ -5534,25 +5597,6 @@ protobufjs@6.11.3, protobufjs@^6.11.2, protobufjs@^6.8.8, protobufjs@~6.11.2, pr "@types/node" ">=13.7.0" long "^4.0.0" -protobufjs@~6.10.2: - version "6.10.3" - resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.10.3.tgz#11ed1dd02acbfcb330becf1611461d4b407f9eef" - integrity sha512-yvAslS0hNdBhlSKckI4R1l7wunVilX66uvrjzE4MimiAt7/qw1nLpMhZrn/ObuUTM/c3Xnfl01LYMdcSJe6dwg== - dependencies: - "@protobufjs/aspromise" "^1.1.2" - "@protobufjs/base64" "^1.1.2" - "@protobufjs/codegen" "^2.0.4" - "@protobufjs/eventemitter" "^1.1.0" - "@protobufjs/fetch" "^1.1.0" - "@protobufjs/float" "^1.0.2" - "@protobufjs/inquire" "^1.1.0" - "@protobufjs/path" "^1.1.2" - "@protobufjs/pool" "^1.1.0" - "@protobufjs/utf8" "^1.1.0" - "@types/long" "^4.0.1" - "@types/node" "^13.7.0" - long "^4.0.0" - proxy-from-env@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.1.0.tgz#e102f16ca355424865755d2c9e8ea4f24d58c3e2" @@ -5602,12 +5646,12 @@ react-dom@18.2.0: loose-envify "^1.1.0" scheduler "^0.23.0" -react-is@^16.13.1, react-is@^16.7.0: +react-is@^16.10.2, react-is@^16.13.1, react-is@^16.7.0: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== -react-lifecycles-compat@^3.0.0: +react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== @@ -5629,6 +5673,21 @@ react-number-format@^5.1.0: dependencies: prop-types "^15.7.2" +react-resize-detector@^7.1.2: + version "7.1.2" + resolved "https://registry.yarnpkg.com/react-resize-detector/-/react-resize-detector-7.1.2.tgz#8ef975dd8c3d56f9a5160ac382ef7136dcd2d86c" + integrity sha512-zXnPJ2m8+6oq9Nn8zsep/orts9vQv3elrpA+R8XTcW7DVVUJ9vwDwMXaBtykAYjMnkCIaOoK9vObyR7ZgFNlOw== + dependencies: + lodash "^4.17.21" + +react-smooth@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/react-smooth/-/react-smooth-2.0.1.tgz#74c7309916d6ccca182c4b30c8992f179e6c5a05" + integrity sha512-Own9TA0GPPf3as4vSwFhDouVfXP15ie/wIHklhyKBH5AN6NFtdk0UpHBnonV11BtqDkAWlt40MOUc+5srmW7NA== + dependencies: + fast-equals "^2.0.0" + react-transition-group "2.9.0" + react-spring@^9.5.5: version "9.5.5" resolved "https://registry.yarnpkg.com/react-spring/-/react-spring-9.5.5.tgz#314009a65efc04d0ef157d3d60590dbb9de65f3c" @@ -5648,6 +5707,16 @@ react-toastify@^9.0.8: dependencies: clsx "^1.1.1" +react-transition-group@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.9.0.tgz#df9cdb025796211151a436c69a8f3b97b5b07c8d" + integrity sha512-+HzNTCHpeQyl4MJ/bdE0u6XRMe9+XG/+aL4mCxVN4DnPBQ0/5bfHWPDuOZUzYdMj94daZaZdCCc1Dzt9R/xSSg== + dependencies: + dom-helpers "^3.4.0" + loose-envify "^1.4.0" + prop-types "^15.6.2" + react-lifecycles-compat "^3.0.4" + react-use-clipboard@^1.0.9: version "1.0.9" resolved "https://registry.yarnpkg.com/react-use-clipboard/-/react-use-clipboard-1.0.9.tgz#d34d4d04500f77c606795d3756fc587ec93db8d2" @@ -5703,6 +5772,41 @@ readonly-date@^1.0.0: resolved "https://registry.yarnpkg.com/readonly-date/-/readonly-date-1.0.0.tgz#5af785464d8c7d7c40b9d738cbde8c646f97dcd9" integrity sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ== +recharts-scale@^0.4.4: + version "0.4.5" + resolved "https://registry.yarnpkg.com/recharts-scale/-/recharts-scale-0.4.5.tgz#0969271f14e732e642fcc5bd4ab270d6e87dd1d9" + integrity sha512-kivNFO+0OcUNu7jQquLXAxz1FIwZj8nrj+YkOKc5694NbjCvcT6aSZiIzNzd2Kul4o4rTto8QVR9lMNtxD4G1w== + dependencies: + decimal.js-light "^2.4.1" + +recharts@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/recharts/-/recharts-2.2.0.tgz#1b8ba0799ff0feb96c87f009cd2ddd8cf5108817" + integrity sha512-/uRJ0oaESGyz//PgAzvrwXEhrKaNha1ELLysEMRklbnsddiVQsSNicP7DWiz8qFcyYXy3BrDqrUjiLiVRTSMtA== + dependencies: + "@types/d3-interpolate" "^2.0.0" + "@types/d3-scale" "^3.0.0" + "@types/d3-shape" "^2.0.0" + classnames "^2.2.5" + d3-interpolate "^2.0.0" + d3-scale "^3.0.0" + d3-shape "^2.0.0" + eventemitter3 "^4.0.1" + lodash "^4.17.19" + react-is "^16.10.2" + react-resize-detector "^7.1.2" + react-smooth "^2.0.1" + recharts-scale "^0.4.4" + reduce-css-calc "^2.1.8" + +reduce-css-calc@^2.1.8: + version "2.1.8" + resolved "https://registry.yarnpkg.com/reduce-css-calc/-/reduce-css-calc-2.1.8.tgz#7ef8761a28d614980dc0c982f772c93f7a99de03" + integrity sha512-8liAVezDmUcH+tdzoEGrhfbGcP7nOV4NkGE3a74+qqvE7nt9i4sKLGBuZNOnpI4WiGksiNPklZxva80061QiPg== + dependencies: + css-unit-converter "^1.1.1" + postcss-value-parser "^3.3.0" + regenerate-unicode-properties@^10.1.0: version "10.1.0" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-10.1.0.tgz#7c3192cab6dd24e21cb4461e5ddd7dd24fa8374c" @@ -5898,23 +6002,6 @@ secretjs@0.17.7: protobufjs "6.11.3" secure-random "1.1.2" -secretjs@^0.17.0: - version "0.17.8" - resolved "https://registry.yarnpkg.com/secretjs/-/secretjs-0.17.8.tgz#a7158ebf492727da8297f9b80cf9c83597e70cc9" - integrity sha512-PD/GUF52GjysBo8dDVK8KZXRXON1iPXkkyBNWIBVsaap3A1nZPbqynx/VUOjSpFx103KdjvzeA4+O0+EdWWWmw== - dependencies: - "@iov/crypto" "2.1.0" - "@iov/encoding" "2.1.0" - "@iov/utils" "2.0.2" - axios "0.21.1" - curve25519-js "0.0.4" - fast-deep-equal "3.1.1" - js-crypto-hkdf "0.7.3" - miscreant "0.3.2" - pako "1.0.11" - protobufjs "6.11.3" - secure-random "1.1.2" - secure-random@1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/secure-random/-/secure-random-1.1.2.tgz#ed103b460a851632d420d46448b2a900a41e7f7c" @@ -6409,6 +6496,13 @@ utility-types@^3.10.0: resolved "https://registry.yarnpkg.com/utility-types/-/utility-types-3.10.0.tgz#ea4148f9a741015f05ed74fd615e1d20e6bed82b" integrity sha512-O11mqxmi7wMKCo6HKFt5AhO4BwY3VV68YU07tgxfz8zJTIxr4BpsezN49Ffwy9j3ZpwwJp4fkRwjRzq3uWE6Rg== +vscode-generate-index-standalone@^1.6.0: + version "1.7.1" + resolved "https://registry.yarnpkg.com/vscode-generate-index-standalone/-/vscode-generate-index-standalone-1.7.1.tgz#de16fb3300f62281554bacd70ccc34d75b866179" + integrity sha512-N0lwDq5v0d6ghhXiZ3zGLVzZ66yyVeCf2YwxaX70t2G2J5KA9RRPAu8p5uuokXYThxubDiw+cNNXkFqiwh2/1w== + optionalDependencies: + fsevents "~2.3.2" + warning@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"