diff --git a/.github/workflows/boba-publish-develop.yml b/.github/workflows/boba-publish-develop.yml index d13022c0b3..7804e51516 100644 --- a/.github/workflows/boba-publish-develop.yml +++ b/.github/workflows/boba-publish-develop.yml @@ -72,7 +72,7 @@ jobs: with: node-version: 16 - name: yq - portable yaml processor - uses: mikefarah/yq@v4.34.2 + uses: mikefarah/yq@v4.35.1 - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/.github/workflows/boba-publish-master.yml b/.github/workflows/boba-publish-master.yml index 1945574437..54e05e5714 100644 --- a/.github/workflows/boba-publish-master.yml +++ b/.github/workflows/boba-publish-master.yml @@ -80,7 +80,7 @@ jobs: with: node-version: 16 - name: yq - portable yaml processor - uses: mikefarah/yq@v4.34.2 + uses: mikefarah/yq@v4.35.1 - name: Get yarn cache directory path id: yarn-cache-dir-path diff --git a/boba_audits/Boba_Zokyo_audit_report_Aug7_2023.pdf b/boba_audits/Boba_Zokyo_audit_report_Aug7_2023.pdf new file mode 100644 index 0000000000..cfac55e5e9 Binary files /dev/null and b/boba_audits/Boba_Zokyo_audit_report_Aug7_2023.pdf differ diff --git a/boba_documentation/developer/wagmi.md b/boba_documentation/developer/wagmi.md index 0b9d37f37c..822b40a5af 100644 --- a/boba_documentation/developer/wagmi.md +++ b/boba_documentation/developer/wagmi.md @@ -2,7 +2,7 @@ ## TLDR -The WAGMI incentives program is Boba Network's take on liquidity mining 2.0. In collaboration with UMA protocol, we are be distributing WAGMI options on BOBA token to promising projects building on Boba. Users can earn WAGMI options using their favorite dApps on Boba Network. WAGMI options are KPI (key performance indicators) options redeemable for BOBA tokens based on metrics relating to Boba Network, such as monthly active wallets or project specific TVL. +The WAGMI incentives program is Boba Network's take on liquidity mining 2.0. In collaboration with UMA protocol, we are be distributing WAGMI options on BOBA token to promising projects building on Boba. Users can earn WAGMI options using their favorite dApps on Boba Network. WAGMI options are KPI (key performance indicators) options redeemable for BOBA tokens based on metrics relating to Boba Network, such as monthly active wallets or project specific TVL. WAGMI works by using UMA protocol's [optimistic oracle](https://umaproject.org/optimistic-oracle.html). BOBA tokens are locked up in a smart contract that pays out subject to network KPIs (i.e. TVL of Boba) and secured in WAGMIvX tokens. BOBA is paid out after a 1 month settlement period on KPIs. @@ -33,11 +33,11 @@ collateralToken = getContract("ERC20").at("0x__________") await collateralToken .methods .approve( - LongShortPair.options.address, + LongShortPair.options.address, web3.utils.toWei("10")) .send({ - gas: 100000, - gasPrice: 2 * 1000000000, + gas: 100000, + gasPrice: 2 * 1000000000, from: (await web3.eth.getAccounts())[0] }) @@ -47,8 +47,8 @@ await LongShortPair .create( web3.utils.toWei("5") ).send({ - gas: 300000, - gasPrice: 2 * 1000000000, + gas: 300000, + gasPrice: 2 * 1000000000, from: (await web3.eth.getAccounts())[0] }) @@ -58,8 +58,8 @@ await LongShortPair .redeem( web3.utils.toWei("2.5") ).send({ - gas: 200000, - gasPrice: 2 * 1000000000, + gas: 200000, + gasPrice: 2 * 1000000000, from: (await web3.eth.getAccounts())[0] }) ``` @@ -88,7 +88,7 @@ const LongShortPair = new ethers.Contract( ) // collateralPerPair: units of collateral are required to mint one pair of synthetic tokens -const mintTx = await LongShortPair.create(depositBobaAmount.div(collateralPerPair)) +const mintTx = await LongShortPair.create(depositBobaAmount.div(collateralPerPair)) await mintTx.wait() ``` @@ -104,20 +104,20 @@ TVLDenomination:USD, LowerTVLBound:300000000, UpperTVLBound:1000000000, MinimumPayout:1, -Rounding:6" ---optimisticOracleLivenessTime 43200 +Rounding:6" +--optimisticOracleLivenessTime 43200 --fpl Linear --lowerBound 0 --upperBound 2000000000000000000 ``` -## Each WAGMI token needs a new Oracle that provides the goal-specific data +## Each WAGMI token needs a new Oracle that provides the goal-specific data -The WAGMIv0 oracle is documented [here](https://github.com/UMAprotocol/UMIPs/blob/master/Implementations/boba-wagmi-tvl.md). Briefly, the WAGMIv0 oracle estimates TVL bridged from L1 to Boba network through the L1 standard bridge contract. It is based on similar calculation logic that is used to estimate Boba network TVL on the Dune Analytics Boba Bridge USD TVL display. +The WAGMIv0 oracle is documented [here](https://github.com/UMAprotocol/UMIPs/blob/master/Implementations/boba-wagmi-tvl.md). Briefly, the WAGMIv0 oracle estimates TVL bridged from L1 to Boba network through the L1 standard bridge contract. It is based on similar calculation logic that is used to estimate Boba network TVL on the Dune Analytics Boba Bridge USD TVL display. [Method doc - Boba TVL](https://github.com/UMAprotocol/UMIPs/blob/master/Implementations/boba-wagmi-tvl.md) (that is referenced in LSP contract ancillary data) has link to example script: https://github.com/Reinis-FRP/boba-tvl. ## Claims Interface -For the claims interface, the relevant smart contracts are: +For the claims interface, the relevant smart contracts are: * The [LSP contract 0x7F969E3F19355C47f6bc957E502c79C75b373BF3](https://blockexplorer.boba.network/address/0x7F969E3F19355C47f6bc957E502c79C75b373BF3/transactions) @@ -195,7 +195,7 @@ Next, add the new WAGMI token to the **token lookup**: } else if (_tokenContractAddressL1 === 'wagmiv0') { if(tA['WAGMIv0'].L2 !== null) _tokenContractAddressL2 = tA['WAGMIv0'].L2.toLowerCase() tokenContract = new ethers.Contract( - _tokenContractAddressL2, + _tokenContractAddressL2, erc20abi, networkService.L2Provider, ) diff --git a/packages/boba/gateway/package.json b/packages/boba/gateway/package.json index 1b4624c812..d24da6ae19 100644 --- a/packages/boba/gateway/package.json +++ b/packages/boba/gateway/package.json @@ -40,9 +40,11 @@ "axios": "^0.21.1", "bignumber.js": "^9.0.1", "bn.js": "^5.1.3", + "bootstrap-daterangepicker": "^3.1.0", "browserify-fs": "^1.0.0", "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", + "date-fns": "^2.30.0", "dayjs": "^1.11.7", "dotenv": "^8.2.0", "eslint-config-react-app": "^7.0.0", @@ -60,8 +62,10 @@ "postcss-normalize": "^10.0.1", "process": "^0.11.10", "react": "^17.0.2", + "react-bootstrap-daterangepicker": "^8.0.0", "react-card-flip": "^1.1.5", "react-datepicker": "^4.6.0", + "react-day-picker": "^8.8.0", "react-dom": "^17.0.2", "react-ga4": "^1.4.1", "react-multi-carousel": "^2.6.5", diff --git a/packages/boba/gateway/src/actions/networkAction.js b/packages/boba/gateway/src/actions/networkAction.js index aed560c611..955c9a9e8d 100644 --- a/packages/boba/gateway/src/actions/networkAction.js +++ b/packages/boba/gateway/src/actions/networkAction.js @@ -274,3 +274,7 @@ export function setActiveNetworkType(payload) { return dispatch({ type: 'NETWORK/SET_TYPE/ACTIVE', payload }) } } + +export function fetchBlockExplorerUrls() { + return createAction('NETWORK/SET/BLOCK_EXPLORER', () => networkService.getBlockExplorerLinks()) +} diff --git a/packages/boba/gateway/src/assets/bobaAvax.svg b/packages/boba/gateway/src/assets/bobaAvax.svg new file mode 100644 index 0000000000..4c654c526a --- /dev/null +++ b/packages/boba/gateway/src/assets/bobaAvax.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/boba/gateway/src/assets/bobaBNB.svg b/packages/boba/gateway/src/assets/bobaBNB.svg new file mode 100644 index 0000000000..c1e8a91a2a --- /dev/null +++ b/packages/boba/gateway/src/assets/bobaBNB.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/packages/boba/gateway/src/assets/bobaEth.svg b/packages/boba/gateway/src/assets/bobaEth.svg new file mode 100644 index 0000000000..556f9a0175 --- /dev/null +++ b/packages/boba/gateway/src/assets/bobaEth.svg @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/packages/boba/gateway/src/assets/ethereum.svg b/packages/boba/gateway/src/assets/ethereum.svg new file mode 100644 index 0000000000..4043ff1446 --- /dev/null +++ b/packages/boba/gateway/src/assets/ethereum.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/boba/gateway/src/assets/images/Boba_Logo_Black_Circle.png b/packages/boba/gateway/src/assets/images/Boba_Logo_Black_Circle.png new file mode 100644 index 0000000000..538855100d Binary files /dev/null and b/packages/boba/gateway/src/assets/images/Boba_Logo_Black_Circle.png differ diff --git a/packages/boba/gateway/src/assets/images/Boba_Logo_White_Circle.png b/packages/boba/gateway/src/assets/images/Boba_Logo_White_Circle.png new file mode 100644 index 0000000000..f2567dd19e Binary files /dev/null and b/packages/boba/gateway/src/assets/images/Boba_Logo_White_Circle.png differ diff --git a/packages/boba/gateway/src/assets/images/allNetworks.svg b/packages/boba/gateway/src/assets/images/allNetworks.svg new file mode 100644 index 0000000000..d392621af1 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/allNetworks.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/boba/gateway/src/assets/images/boba-logo.svg b/packages/boba/gateway/src/assets/images/boba-logo.svg new file mode 100644 index 0000000000..3cf72d0b04 Binary files /dev/null and b/packages/boba/gateway/src/assets/images/boba-logo.svg differ diff --git a/packages/boba/gateway/src/images/boba-token.svg b/packages/boba/gateway/src/assets/images/boba-token.svg similarity index 100% rename from packages/boba/gateway/src/images/boba-token.svg rename to packages/boba/gateway/src/assets/images/boba-token.svg diff --git a/packages/boba/gateway/src/images/boba2/BobaNFTGlass.svg b/packages/boba/gateway/src/assets/images/boba2/BobaNFTGlass.svg similarity index 100% rename from packages/boba/gateway/src/images/boba2/BobaNFTGlass.svg rename to packages/boba/gateway/src/assets/images/boba2/BobaNFTGlass.svg diff --git a/packages/boba/gateway/src/images/boba2/boba_glass.svg b/packages/boba/gateway/src/assets/images/boba2/boba_glass.svg similarity index 100% rename from packages/boba/gateway/src/images/boba2/boba_glass.svg rename to packages/boba/gateway/src/assets/images/boba2/boba_glass.svg diff --git a/packages/boba/gateway/src/images/boba2/stake-balance-bg.png b/packages/boba/gateway/src/assets/images/boba2/stake-balance-bg.png similarity index 100% rename from packages/boba/gateway/src/images/boba2/stake-balance-bg.png rename to packages/boba/gateway/src/assets/images/boba2/stake-balance-bg.png diff --git a/packages/boba/gateway/src/assets/images/bobaAvax.png b/packages/boba/gateway/src/assets/images/bobaAvax.png new file mode 100644 index 0000000000..d3ef8812db Binary files /dev/null and b/packages/boba/gateway/src/assets/images/bobaAvax.png differ diff --git a/packages/boba/gateway/src/assets/images/bobaBNB.png b/packages/boba/gateway/src/assets/images/bobaBNB.png new file mode 100644 index 0000000000..67b060122a Binary files /dev/null and b/packages/boba/gateway/src/assets/images/bobaBNB.png differ diff --git a/packages/boba/gateway/src/assets/images/bobaETH.png b/packages/boba/gateway/src/assets/images/bobaETH.png new file mode 100644 index 0000000000..9833cf0b0f Binary files /dev/null and b/packages/boba/gateway/src/assets/images/bobaETH.png differ diff --git a/packages/boba/gateway/src/images/close.png b/packages/boba/gateway/src/assets/images/close.png similarity index 100% rename from packages/boba/gateway/src/images/close.png rename to packages/boba/gateway/src/assets/images/close.png diff --git a/packages/boba/gateway/src/images/close.svg b/packages/boba/gateway/src/assets/images/close.svg similarity index 100% rename from packages/boba/gateway/src/images/close.svg rename to packages/boba/gateway/src/assets/images/close.svg diff --git a/packages/boba/gateway/src/assets/images/ethereumFlex.svg b/packages/boba/gateway/src/assets/images/ethereumFlex.svg new file mode 100644 index 0000000000..394afb02a8 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/ethereumFlex.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/packages/boba/gateway/src/assets/images/filter.svg b/packages/boba/gateway/src/assets/images/filter.svg new file mode 100644 index 0000000000..35d57c0b29 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/filter.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/boba/gateway/src/assets/images/hamburger.svg b/packages/boba/gateway/src/assets/images/hamburger.svg new file mode 100644 index 0000000000..5c205e63b3 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/hamburger.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/boba/gateway/src/assets/images/icons/actions.svg b/packages/boba/gateway/src/assets/images/icons/actions.svg new file mode 100644 index 0000000000..a3e8201efa --- /dev/null +++ b/packages/boba/gateway/src/assets/images/icons/actions.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/boba/gateway/src/images/icons/arrowdown.svg b/packages/boba/gateway/src/assets/images/icons/arrowdown.svg similarity index 84% rename from packages/boba/gateway/src/images/icons/arrowdown.svg rename to packages/boba/gateway/src/assets/images/icons/arrowdown.svg index 9f267eaaef..c7ffde435e 100644 --- a/packages/boba/gateway/src/images/icons/arrowdown.svg +++ b/packages/boba/gateway/src/assets/images/icons/arrowdown.svg @@ -1,4 +1,4 @@ - + diff --git a/packages/boba/gateway/src/images/icons/arrowright.svg b/packages/boba/gateway/src/assets/images/icons/arrowright.svg similarity index 100% rename from packages/boba/gateway/src/images/icons/arrowright.svg rename to packages/boba/gateway/src/assets/images/icons/arrowright.svg diff --git a/packages/boba/gateway/src/assets/images/icons/check.svg b/packages/boba/gateway/src/assets/images/icons/check.svg new file mode 100644 index 0000000000..380e831549 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/icons/check.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/boba/gateway/src/assets/images/icons/magnifyingGlass.svg b/packages/boba/gateway/src/assets/images/icons/magnifyingGlass.svg new file mode 100644 index 0000000000..0439409570 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/icons/magnifyingGlass.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/boba/gateway/src/images/metamask.svg b/packages/boba/gateway/src/assets/images/icons/metamask.svg similarity index 100% rename from packages/boba/gateway/src/images/metamask.svg rename to packages/boba/gateway/src/assets/images/icons/metamask.svg diff --git a/packages/boba/gateway/src/assets/images/icons/no-data.svg b/packages/boba/gateway/src/assets/images/icons/no-data.svg new file mode 100644 index 0000000000..1bd23ecb47 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/icons/no-data.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/boba/gateway/src/assets/images/icons/switchButton.svg b/packages/boba/gateway/src/assets/images/icons/switchButton.svg new file mode 100644 index 0000000000..2f0a72965a --- /dev/null +++ b/packages/boba/gateway/src/assets/images/icons/switchButton.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/packages/boba/gateway/src/images/icons/switchIcon.svg b/packages/boba/gateway/src/assets/images/icons/switchIcon.svg similarity index 100% rename from packages/boba/gateway/src/images/icons/switchIcon.svg rename to packages/boba/gateway/src/assets/images/icons/switchIcon.svg diff --git a/packages/boba/gateway/src/assets/images/metamask.svg b/packages/boba/gateway/src/assets/images/metamask.svg new file mode 100644 index 0000000000..47ccb58a16 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/metamask.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/boba/gateway/src/images/mtt.png b/packages/boba/gateway/src/assets/images/mtt.png similarity index 100% rename from packages/boba/gateway/src/images/mtt.png rename to packages/boba/gateway/src/assets/images/mtt.png diff --git a/packages/boba/gateway/src/assets/images/noHistory.svg b/packages/boba/gateway/src/assets/images/noHistory.svg new file mode 100644 index 0000000000..5f7de04e70 --- /dev/null +++ b/packages/boba/gateway/src/assets/images/noHistory.svg @@ -0,0 +1,3 @@ + + + diff --git a/packages/boba/gateway/src/images/test.svg b/packages/boba/gateway/src/assets/images/test.svg similarity index 100% rename from packages/boba/gateway/src/images/test.svg rename to packages/boba/gateway/src/assets/images/test.svg diff --git a/packages/boba/gateway/src/images/walletconnect.svg b/packages/boba/gateway/src/assets/images/walletconnect.svg similarity index 100% rename from packages/boba/gateway/src/images/walletconnect.svg rename to packages/boba/gateway/src/assets/images/walletconnect.svg diff --git a/packages/boba/gateway/src/components/NetworkSelector/index.tsx b/packages/boba/gateway/src/components/NetworkSelector/index.tsx new file mode 100644 index 0000000000..515edd74ca --- /dev/null +++ b/packages/boba/gateway/src/components/NetworkSelector/index.tsx @@ -0,0 +1,25 @@ +import React, { useState } from 'react' +import { ChainLabel } from 'components/bridge/ChainLabel' +import { NetworkContainer, Arrow, Dropdown } from './styles' +import ArrowDown from 'assets/images/icons/arrowdown.svg' +import { NetworkList } from 'components/bridge/NetworkPickerList' +import { Typography } from 'components/global/' + +export const NetworkSelector = () => { + const [openDropdown, setOpenDropdown] = useState(false) + + const handleSelectNetwork = () => { + setOpenDropdown((currentStatus) => !currentStatus) + } + return ( + + + {openDropdown && ( + + Networks + + + )} + + ) +} diff --git a/packages/boba/gateway/src/components/NetworkSelector/styles.ts b/packages/boba/gateway/src/components/NetworkSelector/styles.ts new file mode 100644 index 0000000000..5c7451f309 --- /dev/null +++ b/packages/boba/gateway/src/components/NetworkSelector/styles.ts @@ -0,0 +1,87 @@ +import styled, { css } from 'styled-components' +import { Svg } from 'components/global/svg' +import { mobile } from 'themes/screens' +import { ChainLabelContainer } from 'components/bridge/ChainLabel/styles' + +export const NetworkContainer = styled.div` + display: flex; + justify-content: center; + align-items: center; + padding: 4px 24px; + border-radius: 33px; + gap: 10px; + user-select: none; + height: 40px; + cursor: pointer; + ${(props) => + props.theme.name === 'light' && + css` + background: #fff; + `} + ${(props) => + props.theme.name === 'dark' && + css` + background: ${props.theme.colors.gray[400]}; + `} + + ${mobile(css` + ${ChainLabelContainer} { + font-size: 0px; + gap: 0px; + } + `)} +` + +export const Arrow = styled(Svg)` + display: flex; + > div { + display: flex; + height: auto; + padding: 5px 0px; + } + ${(props) => + props.theme.name === 'light' && + css` + svg { + fill: ${props.theme.colors.gray[800]}; + } + `} + ${(props) => + props.theme.name === 'dark' && + css` + svg { + fill: ${props.theme.colors.gray[50]}; + } + `} +` + +export const Dropdown = styled.div` + display: flex; + flex-direction: column; + position: absolute; + top: 65px; + border-radius: 8px; + background: inherit; + gap: 5px; + padding: 10px 15px; + img, + svg { + max-width: 24px; + width: 100%; + height: 100%; + max-height: 34px; + } + > div { + > div { + padding: 5px 10px; + } + } + ${mobile(css` + width: 100%; + position: fixed; + left: 0px; + padding: 25px; + border-radius: 0px; + top: 72px; + `)} +` diff --git a/packages/boba/gateway/src/components/bridge/ChainLabel/index.tsx b/packages/boba/gateway/src/components/bridge/ChainLabel/index.tsx new file mode 100644 index 0000000000..f6ae48eca7 --- /dev/null +++ b/packages/boba/gateway/src/components/bridge/ChainLabel/index.tsx @@ -0,0 +1,55 @@ +import React, { useEffect, useState } from 'react' +import { useSelector } from 'react-redux' + +import { + selectActiveNetworkName, + selectActiveNetworkIcon, + selectLayer, +} from 'selectors' +import { DEFAULT_NETWORK, LAYER } from 'util/constant' +import { L1_ICONS, L2_ICONS } from 'util/network/network.util' +import { ChainLabelContainer } from './styles' +import { IconType, ChainLabelInterface, DirectionType } from './types' + +export const ChainLabel = ({ direction }: ChainLabelInterface) => { + const [toL2, setToL2] = useState(true) + + const layer = useSelector(selectLayer()) + const networkName = useSelector(selectActiveNetworkName()) + const icon: keyof IconType = useSelector(selectActiveNetworkIcon()) + + const isL1 = layer === LAYER.L1 + + useEffect(() => { + setToL2(isL1) + }, [isL1]) + + const L1Icon = L1_ICONS[icon] + const L2Icon = L2_ICONS[icon] + + const L1ChainLabel = () => { + return ( + + + {networkName['l1'] || DEFAULT_NETWORK.NAME.L1} + + ) + } + + const L2ChainLabel = () => { + return ( + + + {networkName['l2'] || DEFAULT_NETWORK.NAME.L2} + + ) + } + const config: DirectionType = { + from: toL2 ? : , + to: toL2 ? : , + } + + const selectedDirection = config[direction as keyof DirectionType] + + return direction ? selectedDirection : config.from +} diff --git a/packages/boba/gateway/src/components/bridge/ChainLabel/styles.ts b/packages/boba/gateway/src/components/bridge/ChainLabel/styles.ts new file mode 100644 index 0000000000..b6bd7f5091 --- /dev/null +++ b/packages/boba/gateway/src/components/bridge/ChainLabel/styles.ts @@ -0,0 +1,15 @@ +import styled from 'styled-components' +import { Typography } from 'components/global/typography' + +export const ChainLabelContainer = styled(Typography)` + display: flex; + justify-content: center; + align-items: center; + gap: 10px; + svg, + img { + max-width: 24px; + width: 100%; + height: auto; + } +` diff --git a/packages/boba/gateway/src/components/bridge/ChainLabel/types.ts b/packages/boba/gateway/src/components/bridge/ChainLabel/types.ts new file mode 100644 index 0000000000..526c2eea0f --- /dev/null +++ b/packages/boba/gateway/src/components/bridge/ChainLabel/types.ts @@ -0,0 +1,14 @@ +export interface ChainLabelInterface { + direction: string +} + +export type IconType = { + ethereum: ({ selected }: { selected?: boolean | undefined }) => Element + bnb: ({ selected }: { selected?: boolean | undefined }) => Element + avax: ({ selected }: { selected?: boolean | undefined }) => Element +} + +export type DirectionType = { + from: JSX.Element + to: JSX.Element +} diff --git a/packages/boba/gateway/src/components/bridge/NetworkPickerList/index.tsx b/packages/boba/gateway/src/components/bridge/NetworkPickerList/index.tsx new file mode 100644 index 0000000000..2414fa1b8e --- /dev/null +++ b/packages/boba/gateway/src/components/bridge/NetworkPickerList/index.tsx @@ -0,0 +1,76 @@ +import React, { ElementType, FC } from 'react' +import { useDispatch, useSelector } from 'react-redux' + +import { + L1_ICONS, + L2_ICONS, + NetworkList as NetworkLists, +} from 'util/network/network.util' + +import { + selectActiveNetwork, + selectActiveNetworkType, + selectModalState, + selectLayer, +} from 'selectors' + +import { setNetwork } from 'actions/networkAction' + +import { + NetworkPickerList, + NetworkItem, + NetworkIcon, + NetworkLabel, +} from './styles' + +interface NetworkListProps { + close?: () => void +} + +export const NetworkList: FC = ({ close = () => {} }) => { + const dispatch = useDispatch() + const networkType = useSelector(selectActiveNetworkType()) + const activeNetwork = useSelector(selectActiveNetwork()) + const selectionLayer = useSelector(selectModalState('selectionLayer')) + const layer = useSelector(selectLayer()) + + const l1Icon = L1_ICONS as Record + const l2Icon = L2_ICONS as Record + + const networks = (NetworkLists as Record)[networkType] + const currentLayer = selectionLayer || (layer as string).toLowerCase() + const onChainChange = (chainDetail: any) => { + dispatch( + setNetwork({ + network: chainDetail.chain, + name: chainDetail.name, + networkIcon: chainDetail.icon, + networkType, + }) + ) + close() + } + + return ( + + {networks.map((chainDetail: any) => { + const Icon = + currentLayer === 'l1' + ? l1Icon[chainDetail.icon] + : l2Icon[chainDetail.icon] + return ( + onChainChange(chainDetail)} + > + + + + {chainDetail.name[currentLayer]} + + ) + })} + + ) +} diff --git a/packages/boba/gateway/src/components/bridge/NetworkPickerList/styles.ts b/packages/boba/gateway/src/components/bridge/NetworkPickerList/styles.ts new file mode 100644 index 0000000000..49d31914a0 --- /dev/null +++ b/packages/boba/gateway/src/components/bridge/NetworkPickerList/styles.ts @@ -0,0 +1,55 @@ +import { Typography } from 'components/global' +import styled, { css } from 'styled-components' + +export const NetworkPickerModalContainer = styled.div` + width: 100%; +` +export const NetworkPickerList = styled.div` + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 8px; + width: 100%; +` +export const NetworkItem = styled.div<{ selected?: boolean }>` + cursor: pointer; + display: flex; + width: 100%; + padding: 12px 16px; + border-radius: 8px; + align-items: center; + justify-content: flex-start; + gap: 8px; + + ${({ selected }) => + selected && + css` + border-radius: 8px; + border: 1px solid var(--gray-100, #a8a8a8); + background: ${({ theme: { colors } }) => colors.gray[400]}; + `} + + &:hover { + border-radius: 8px; + background: ${({ theme: { colors } }) => colors.gray[400]}; + } +` +export const NetworkIcon = styled.div` + display: flex; + width: 30px; + height: 30px; +` +export const NetworkLabel = styled(Typography).attrs({ + variant: 'body1', +})` + color: ${({ theme: { colors, name } }) => + name === 'light' ? colors.gray[700] : colors.gray[50]}; + text-align: right; +` + +styled(Typography).attrs({ + variant: 'body2', +})` + text-align: left; + color: ${({ theme }) => theme.colors.gray[50]}; +` diff --git a/packages/boba/gateway/src/components/dao/preloader/styles.tsx b/packages/boba/gateway/src/components/dao/preloader/styles.tsx index 411da2c4d2..558dfd432b 100644 --- a/packages/boba/gateway/src/components/dao/preloader/styles.tsx +++ b/packages/boba/gateway/src/components/dao/preloader/styles.tsx @@ -1,6 +1,6 @@ import styled, { css, keyframes } from 'styled-components' -const pulseAnimation = keyframes` +const pulseLightAnimation = keyframes` 0% { background-color: rgba(255,255,255,0.1); } @@ -8,13 +8,29 @@ const pulseAnimation = keyframes` background-color: rgba(255,255,255,0.2); } ` + +const pulseDarkAnimation = keyframes` + 0% { + background-color: rgba(0,0,0,0.1); + } + 100% { + background-color: rgba(0,0,0,0.2); + } +` + const BasePreloader = styled.div` height: 22px; background: rgba(255, 255, 255, 0.2); - animation: ${css` - ${pulseAnimation} 0.65s infinite alternate - `}; - + ${(props) => + props.theme.name === 'light' && + css` + animation: ${pulseDarkAnimation} 0.65s infinite alternate; + `} + ${(props) => + props.theme.name === 'dark' && + css` + animation: ${pulseLightAnimation} 0.65s infinite alternate; + `} width: 100%; ` export const Number = styled(BasePreloader)` diff --git a/packages/boba/gateway/src/components/faucet/Faucet.js b/packages/boba/gateway/src/components/faucet/Faucet.js index a544cb1ccf..158162638a 100644 --- a/packages/boba/gateway/src/components/faucet/Faucet.js +++ b/packages/boba/gateway/src/components/faucet/Faucet.js @@ -10,7 +10,7 @@ import { openAlert } from 'actions/uiAction'; import { NETWORK_TYPE } from 'util/network/network.util'; import Copy from 'components/copy/Copy'; import Button from 'components/button/Button'; -import twitter from 'images/twitter.png' +import twitter from 'assets/images/twitter.png' import { Md5 } from 'ts-md5'; import networkService from 'services/networkService'; diff --git a/packages/boba/gateway/src/components/filter/index.tsx b/packages/boba/gateway/src/components/filter/index.tsx new file mode 100644 index 0000000000..c50c194e01 --- /dev/null +++ b/packages/boba/gateway/src/components/filter/index.tsx @@ -0,0 +1,102 @@ +import React, { + useState, + useCallback, + useEffect, + useRef, + ReactNode, +} from 'react' +import { + DropdownContainer, + Header, + IconContainer, + Option, + DefaultIcon, + DropdownBody, + Icon, + DropdownContent, +} from './styles' +export interface IFilterDropdownItem { + value: string + label: string | ReactNode +} + +export interface IFilterDropdownProps { + error: boolean + imgSrc: string + items: IFilterDropdownItem[] + defaultItem: IFilterDropdownItem + onItemSelected?: (item: IFilterDropdownItem) => void + className?: string +} + +export const FilterDropDown: React.FC = ({ + items, + defaultItem, + error = false, + imgSrc, + onItemSelected, + className, +}) => { + const [selectedItem, setSelectedItem] = + useState(defaultItem) + const [isOpen, setIsOpen] = useState(false) + + const handleDropdown = useCallback(() => { + setIsOpen(!isOpen) + }, [isOpen]) + + const selectItem = useCallback((item: IFilterDropdownItem) => { + onItemSelected && onItemSelected(item) + setSelectedItem(item) + setIsOpen(false) + }, []) + + const dropdownRef = useRef(null) + + useEffect(() => { + const handleClickOutside = (e: Event) => { + if ( + dropdownRef.current && + !dropdownRef.current.contains(e.target as Node) + ) { + setIsOpen(false) + } + } + // Bind the event listener + document.addEventListener('mousedown', handleClickOutside) + return () => { + // Unbind the event listener on clean up + document.removeEventListener('mousedown', handleClickOutside) + } + }, [dropdownRef]) + + return ( + +
+ {imgSrc && ( + + {imgSrc !== 'default' && } + {imgSrc === 'default' && } + + )} +
+ {isOpen && ( + + + {items.map((item, index) => ( + + ))} + + + )} +
+ ) +} diff --git a/packages/boba/gateway/src/components/filter/styles.ts b/packages/boba/gateway/src/components/filter/styles.ts new file mode 100644 index 0000000000..e51774ba06 --- /dev/null +++ b/packages/boba/gateway/src/components/filter/styles.ts @@ -0,0 +1,219 @@ +import styled, { css } from 'styled-components' +import { Svg } from 'components/global/svg' +import { screen } from 'themes/screens' + +export const DropdownContainer = styled.div` + display: inline-flex; + flex-direction: column; + position: relative; + cursor: pointer; + transition: 0.25s all; + box-sizing: border-box; + ${(props) => + props.theme.name === 'light' && + css` + color: ${props.theme.colors.gray[800]}; + `} + ${(props) => + props.theme.name === 'dark' && + css` + color: ${props.theme.colors.gray[50]}; + `} +` + +export const Header = styled.div<{ error: boolean; isOpen: boolean }>` + box-sizing: border-box; + position: relative; + color: inherit; + border-radius: 37px; + transition: all 0.3s ease; + background: none; + ${(props) => + props.theme.name === 'light' && + css` + border: 2px solid ${props.theme.colors.gray[600]}; + svg { + fill: ${props.theme.colors.gray[600]}; + } + &:hover { + border-color: ${props.theme.colors.gray[800]}; + svg { + fill: ${props.theme.colors.gray[800]}; + } + } + `} + ${(props) => + props.theme.name === 'dark' && + css` + border: 2px solid ${props.theme.colors.gray[200]}; + svg { + fill: ${props.theme.colors.gray[100]}; + } + &:hover { + color: ${props.theme.colors.gray[50]}; + border-color: ${props.theme.colors.green[300]}; + svg { + fill: ${props.theme.colors.gray[50]}; + } + } + `} + ${(props) => + props.error && + ` + border-color:${props.theme.colors.red[300]} + `} + ${({ isOpen, theme }) => + isOpen && + css` + color: ${theme.name === 'light' ? 'initial' : theme.colors.gray[50]}; + border-color: ${theme.name === 'light' + ? theme.colors.gray[800] + : theme.colors.green[300]}; + svg { + fill: ${theme.name === 'light' + ? theme.colors.gray[800] + : theme.colors.gray[50]}; + } + `} +` + +export const IconContainer = styled.div` + width: auto; + height: auto; + display: flex; + padding: 10px 11px; + align-items: center; + justify-content: center; + @media ${screen.mobile} { + width: 20px; + height: 20px; + } +` + +export const Option = styled.div<{ isSelected: boolean }>` + display: flex; + align-items: center; + font-size: ${(props) => props.theme.text.body2}; + font-weight: bold; + justify-content: flex-start; + text-align: left; + background: inherit; + color: inherit; + ${({ isSelected, theme }) => + isSelected && + css` + background: ${theme.colors.gray[400]}; + `} + @media ${screen.mobile} { + font-size: 10px; + } +` + +export const DefaultIcon = styled.div` + width: 32px; + height: 32px; + border-radius: 50%; + ${(props) => + props.theme.name === 'light' && + css` + background: ${props.theme.colors.gray[600]}; + `} + ${(props) => + props.theme.name === 'dark' && + css` + background: ${props.theme.colors.gray[200]}; + `} +` +export const Icon = styled(Svg)` + height: 16px; + width: auto; + display: flex; + align-items: center; + justify-content: center; + + svg { + max-width: 32px; + min-width: 10px; + height: auto; + } +` + +export const DropdownBody = styled.div` + transition: 0.25s all; + background: inherit; + position: absolute; + width: 100%; + min-width: 139px; + right: 0px; + top: 45px; + z-index: 1; + padding: 8px 8px 8px 8px; + box-sizing: border-box; + border: inherit; + border-top: 0px; + border-radius: 14px; + box-shadow: ${(props) => props.theme.backShadow}; + ${(props) => + props.theme.name === 'light' && + css` + color: ${props.theme.colors.gray[800]}; + border: 1px solid ${props.theme.colors.gray[400]}; + background: ${props.theme.colors.gray[50]}; + `} + ${(props) => + props.theme.name === 'dark' && + css` + color: ${props.theme.colors.gray[100]}; + border: 1px solid ${props.theme.colors.gray[400]}; + background: ${props.theme.colors.gray[500]}; + `} +` +export const DropdownContent = styled.div` + min-height: 80px; + max-height: 180px; + display: flex; + flex-direction: column; + gap: 5px 0px; + overflow-y: auto; + &::-webkit-scrollbar { + width: 4px; + margin-right: 4px; + } + &::-webkit-scrollbar-track { + background-color: #f1f1f1; + border-radius: 10px; + } + &::-webkit-scrollbar-thumb { + background-color: #888; + border-radius: 10px; + } + + &::-webkit-scrollbar-thumb:hover { + background-color: #555; + } + + & > ${Option} { + transition: 0.25s all; + border-radius: 8px; + padding: 8px; + box-sizing: border-box; + border: 1px solid rgba(0, 0, 0, 0); + &:hover { + background: ${(props) => props.theme.colors.gray[400]}; + } + ${(props) => + props.theme.name === 'light' && + css` + &:hover { + border: 1px solid ${props.theme.colors.gray[600]}; + } + `} + ${(props) => + props.theme.name === 'dark' && + css` + &:hover { + border: 1px solid ${props.theme.colors.gray[100]}; + } + `}; + } +` diff --git a/packages/boba/gateway/src/components/global/addToMetamask/index.tsx b/packages/boba/gateway/src/components/global/addToMetamask/index.tsx index e974220fc4..c18f34105a 100644 --- a/packages/boba/gateway/src/components/global/addToMetamask/index.tsx +++ b/packages/boba/gateway/src/components/global/addToMetamask/index.tsx @@ -1,6 +1,6 @@ import React from 'react' import { getCoinImage } from 'util/coinImage' -import MetamaskLogo from 'images/metamask.svg' +import MetamaskLogo from 'assets/images/metamask.svg' import networkService from 'services/networkService' import styled from 'styled-components' diff --git a/packages/boba/gateway/src/components/global/background/styles.ts b/packages/boba/gateway/src/components/global/background/styles.ts index d3aa14af3a..082955e4d4 100644 --- a/packages/boba/gateway/src/components/global/background/styles.ts +++ b/packages/boba/gateway/src/components/global/background/styles.ts @@ -32,12 +32,13 @@ export const GridBackground = styled.div` height: ${gridHeight}; overflow: hidden; perspective: calc(${gridHeight} * 90); + background-color: ${({ theme }) => + theme.name === 'light' ? '#E5E5E1' : 'transperant'}; ` export const GridFade = styled.div` width: 100%; height: 100%; - max-width: 1441px; max-height: 870px; position: absolute; z-index: 1; @@ -49,12 +50,11 @@ export const GridFade = styled.div` background-image: ${(props) => gradientColor(props.theme.name)}; background-clip: padding-box; background-origin: content-box; - ${({ position }) => position === 'top' && ` transform:translate(-50%, -150%); - `} + `}; ` const playAnimation = keyframes` diff --git a/packages/boba/gateway/src/components/global/button/__snapshots__/index.test.tsx.snap b/packages/boba/gateway/src/components/global/button/__snapshots__/index.test.tsx.snap index 6ec856472c..f567bcf7a7 100644 --- a/packages/boba/gateway/src/components/global/button/__snapshots__/index.test.tsx.snap +++ b/packages/boba/gateway/src/components/global/button/__snapshots__/index.test.tsx.snap @@ -3,7 +3,8 @@ exports[`Button Default Button 1`] = `
+ + +`; + +exports[`PlaceholderConnect PlaceholderConnect is not loading 1`] = ` + +
+
+
+
+
+
+

+ No +

+ +
+ +`; diff --git a/packages/boba/gateway/src/components/global/placeholderConnect/index.test.tsx b/packages/boba/gateway/src/components/global/placeholderConnect/index.test.tsx new file mode 100644 index 0000000000..7e64980233 --- /dev/null +++ b/packages/boba/gateway/src/components/global/placeholderConnect/index.test.tsx @@ -0,0 +1,46 @@ +import React from 'react' +import { render } from '@testing-library/react' +import { BrowserRouter } from 'react-router-dom' +import CustomThemeProvider from 'themes' +import { Provider } from 'react-redux' +import configureStore from 'redux-mock-store' +import { PlaceholderConnect } from './' +import { PlaceholderConnectInterface } from './types' + +const mockStore = configureStore() +const renderPlaceholderConnect = (props: PlaceholderConnectInterface) => { + return render( + + + + + + + + ) +} + +describe('PlaceholderConnect', () => { + test('PlaceholderConnect is not loading', () => { + const { asFragment } = renderPlaceholderConnect({ + isLoading: false, + }) + expect(asFragment()).toMatchSnapshot() + }) + test('PlaceholderConnect is loading', () => { + const { asFragment } = renderPlaceholderConnect({ + isLoading: true, + preloader: <>{'loading'}, + }) + expect(asFragment()).toMatchSnapshot() + }) +}) diff --git a/packages/boba/gateway/src/components/global/placeholderConnect/index.tsx b/packages/boba/gateway/src/components/global/placeholderConnect/index.tsx new file mode 100644 index 0000000000..f04372bb70 --- /dev/null +++ b/packages/boba/gateway/src/components/global/placeholderConnect/index.tsx @@ -0,0 +1,50 @@ +import React from 'react' +import { useDispatch, useSelector } from 'react-redux' +import { setConnectBOBA, setConnect } from 'actions/setupAction' +import { useLocation } from 'react-router-dom' +import { selectAccountEnabled, selectLayer } from 'selectors' + +import { Svg } from 'components/global/svg' +import { Button } from 'components/global/button' + +import { PlaceholderContainer, Label } from './styles' +import placehoderIcon from 'assets/images/icons/no-data.svg' +import { LAYER } from 'util/constant' +import { PlaceholderConnectInterface } from './types' + +export const PlaceholderConnect = ({ + isLoading = false, + preloader = null, +}: PlaceholderConnectInterface) => { + const layer = useSelector(selectLayer()) + const accountEnabled = useSelector(selectAccountEnabled()) + + const location = useLocation() + const dispatch = useDispatch() + + const handdleConnect = () => { + dispatch(layer === LAYER.L2 ? setConnectBOBA(true) : setConnect(true)) + } + + const DefaultLabel = () => { + return ( + <> + + + + ) + } + + return ( + + {isLoading && preloader} + {accountEnabled && !isLoading && } + {!accountEnabled && ( + <> + +
`; + +exports[`Svg Render Wrapped Svg file 1`] = ` + +
+
+
+
+
+
+
+ +`; diff --git a/packages/boba/gateway/src/components/global/svg/index.stories.tsx b/packages/boba/gateway/src/components/global/svg/index.stories.tsx index 3767aaa95b..a98dc48b96 100644 --- a/packages/boba/gateway/src/components/global/svg/index.stories.tsx +++ b/packages/boba/gateway/src/components/global/svg/index.stories.tsx @@ -3,6 +3,7 @@ import { Meta, StoryFn } from '@storybook/react' import Arrow from '../../../images/icons/arrowdown.svg' import { Svg } from './' import { SvgTypes } from './types' +import styled from 'styled-components' export default { title: 'Components/Svg', component: Svg, @@ -11,10 +12,23 @@ export default { }, } as Meta -const Template: StoryFn = (args: SvgTypes) => +const ArrowOnHover = styled.div` + svg { + &:hover { + fill: yellow; + } + } +` + +const Template: StoryFn = (args: SvgTypes) => ( + + + +) export const Default = Template.bind({}) Default.args = { src: Arrow, fill: 'lime', + className: '.yellowOnHover', } diff --git a/packages/boba/gateway/src/components/global/svg/index.test.tsx b/packages/boba/gateway/src/components/global/svg/index.test.tsx index d1ef08d8b8..181a221a85 100644 --- a/packages/boba/gateway/src/components/global/svg/index.test.tsx +++ b/packages/boba/gateway/src/components/global/svg/index.test.tsx @@ -5,8 +5,15 @@ import CustomThemeProvider from 'themes' import { Svg } from './' import { Provider } from 'react-redux' import configureStore from 'redux-mock-store' - +import styled from 'styled-components' const mockStore = configureStore() +const ArrowOnHover = styled.div` + svg { + &:hover { + fill: red; + } + } +` const renderSvg = (props: SvgTypes) => { return render( @@ -24,6 +31,24 @@ const renderSvg = (props: SvgTypes) => { ) } +const renderWrappedSvg = (props: SvgTypes) => { + return render( + + + + + + + + ) +} + describe('Svg', () => { test('Render Svg File', () => { const { asFragment } = renderSvg({ @@ -32,4 +57,11 @@ describe('Svg', () => { }) expect(asFragment()).toMatchSnapshot() }) + test('Render Wrapped Svg file', () => { + const { asFragment } = renderWrappedSvg({ + fill: 'yellow', + src: 'static/media/src/images/icons/arrowdown.svg', + }) + expect(asFragment()).toMatchSnapshot() + }) }) diff --git a/packages/boba/gateway/src/components/global/svg/index.tsx b/packages/boba/gateway/src/components/global/svg/index.tsx index 0b631793a6..873c94cae6 100644 --- a/packages/boba/gateway/src/components/global/svg/index.tsx +++ b/packages/boba/gateway/src/components/global/svg/index.tsx @@ -2,12 +2,21 @@ import React from 'react' import { ReactSVG } from 'react-svg' import { SvgTypes } from './types' -export const Svg: React.FC = ({ src, fill }) => ( +export const Svg: React.FC = ({ + src, + fill = 'current', + stroke = 'current', + onClick, + className, +}) => ( // @ts-ignore { svg.setAttribute('fill', fill) + svg.setAttribute('stroke', stroke) }} /> ) diff --git a/packages/boba/gateway/src/components/global/svg/types.ts b/packages/boba/gateway/src/components/global/svg/types.ts index d877825405..0a23b98e34 100644 --- a/packages/boba/gateway/src/components/global/svg/types.ts +++ b/packages/boba/gateway/src/components/global/svg/types.ts @@ -1,4 +1,7 @@ export interface SvgTypes { src: string - fill: string + fill?: string + stroke?: string + onClick?: () => void + className?: string } diff --git a/packages/boba/gateway/src/components/global/tabHeader/styles.tsx b/packages/boba/gateway/src/components/global/tabHeader/styles.tsx index d291ced286..9dd10bba88 100644 --- a/packages/boba/gateway/src/components/global/tabHeader/styles.tsx +++ b/packages/boba/gateway/src/components/global/tabHeader/styles.tsx @@ -1,7 +1,14 @@ import styled, { css } from 'styled-components' +import { mobile } from 'themes/screens' export const TabContainer = styled.div` display: flex; + ${mobile(css` + width: 110%; + overflow-x: auto; + margin: 10px 0px; + padding: 10px 50px 10px 25px; + `)} ` export const TabItem = styled.div` diff --git a/packages/boba/gateway/src/components/global/table/index.tsx b/packages/boba/gateway/src/components/global/table/index.tsx index 2954dba53c..45b1ec5edf 100644 --- a/packages/boba/gateway/src/components/global/table/index.tsx +++ b/packages/boba/gateway/src/components/global/table/index.tsx @@ -1,56 +1,33 @@ import React from 'react' -import { Row } from 'components/global/containers' import { Text } from 'components/global/text' import Tooltip from 'components/tooltip/Tooltip' import { HelpOutline } from '@mui/icons-material' -import styled from 'styled-components' +import { TableHeaderContainer, TableRow, TableContentContainer } from './styles' +import { ModalTypography } from '../modalTypography' -const TableRow = styled(Row)` - &:not(:first-of-type) { - margin-left: auto; - } - &:last-of-type { - margin-right: 0px; - } -` - -const TableHeaderContainer = styled(Row)` - padding: 20px; - display: flex; - align-items: center; - justify-content: space-between; - border-radius: 6px 6px 0 0; - background: ${(props) => props.theme.colors.gray[800]}; - @media (max-width: 960px) { - margin-bottom: 5px; - } -` - -const TableContentContainer = styled(Row)` - justify-content: space-between; -` - -type TableHeaderOptionType = { +export type TableHeaderOptionType = { name: string - tooltip: string + tooltip?: string width: number } type TableHeaderType = { options: TableHeaderOptionType[] + className?: string } -export const TableHeader = ({ options }: TableHeaderType) => { +export const TableHeader = ({ options, className }: TableHeaderType) => { return ( - + {options?.map((option) => { return ( - {option.name} + {option.name} {option.tooltip && ( @@ -71,17 +48,26 @@ type TableContentOptionType = { type TableContentType = { options: TableContentOptionType[] mobileOptions?: number[] + className?: string } -export const TableContent = ({ options, mobileOptions }: TableContentType) => { +export const TableContent = ({ + options, + mobileOptions, + className, +}: TableContentType) => { const isMobile = false const currentOptions = isMobile && mobileOptions ? mobileOptions.map((i) => options[i]) : options return ( - + {currentOptions?.map((option, index) => { return ( - + {option.content} ) diff --git a/packages/boba/gateway/src/components/global/table/styles.ts b/packages/boba/gateway/src/components/global/table/styles.ts new file mode 100644 index 0000000000..2e09824fb4 --- /dev/null +++ b/packages/boba/gateway/src/components/global/table/styles.ts @@ -0,0 +1,58 @@ +import styled, { css } from 'styled-components' +import { Row } from 'components/global/containers' +import { screen } from 'themes/screens' + +export const TableHeaderContainer = styled(Row)` + padding: 20px; + display: flex; + align-items: center; + justify-content: space-between; + background: ${({ theme: { colors, name } }) => + name === 'light' ? colors.gray[50] : colors.gray[800]}; + + ${({ theme: { name, colors } }) => + name === 'light' + ? css` + border-radius: 12px; + border: 1px solid var(--gray-400-light, #dee0d8); + background: var(--gray-50-light, rgba(253, 255, 248, 0.9)); + /* text box shadow */ + box-shadow: 0px 2px 17px 0px rgba(0, 0, 0, 0.15); + ` + : css` + border-radius: 12px; + border: 1px solid var(--gray-300, #545454); + background: var( + --glass-bg-popup, + linear-gradient( + 129deg, + rgba(48, 48, 48, 0.7) 0%, + rgba(48, 48, 48, 0.7) 46.35%, + rgba(37, 37, 37, 0.7) 94.51% + ) + ); + + /* text box shadow */ + box-shadow: 0px 2px 17px 0px rgba(0, 0, 0, 0.15); + `} + + ${screen.mobile} { + margin-bottom: 5px; + } + ${screen.tablet} { + margin-bottom: 5px; + } +` + +export const TableContentContainer = styled(Row)` + justify-content: space-between; +` + +export const TableRow = styled(Row)` + &:not(:first-of-type) { + margin-left: auto; + } + &:last-of-type { + margin-right: 0px; + } +` diff --git a/packages/boba/gateway/src/components/global/table/themes.ts b/packages/boba/gateway/src/components/global/table/themes.ts new file mode 100644 index 0000000000..cda88a56f0 --- /dev/null +++ b/packages/boba/gateway/src/components/global/table/themes.ts @@ -0,0 +1,61 @@ +import styled, { css } from 'styled-components' +import { TableHeader, TableContent } from 'components/global/table' +import { Svg } from 'components/global/svg' +import { TableRow } from './styles' +import { mobile, sdesktop } from 'themes/screens' +export const TransactionsTableHeader = styled(TableHeader)` + padding: 10px 24px 10px 24px; + position: sticky; + top: 0; + background: unset; + border-radius: unset; + border: unset; + box-shadow: none; + ${(props) => + props.theme.name === 'light' && + css` + color: ${props.theme.colors.gray[700]}; + border-top: 1px solid ${props.theme.colors.gray[400]}; + `} + ${(props) => + props.theme.name === 'dark' && + css` + color: ${props.theme.colors.gray[100]}; + border-top: 1px solid ${props.theme.colors.gray[300]}; + `} + ${TableRow} { + border: none; + margin: 0px; + padding: 0px; + p { + font-size: 12px; + } + } + ${sdesktop(css` + width: 750px; + `)} + ${mobile(css` + p { + font-size: 10px; + } + `)} +` + +export const TransactionsTableContent = styled(TableContent)` + padding: 16px 24px; + ${TableRow} { + border: none; + } + &:hover { + background: ${(props) => props.theme.colors.gray[300]}; + } + ${(props) => + props.theme.name === 'light' && + css` + fill: ${props.theme.colors.gray[600]}; + `} + ${TableRow} { + margin: 0px; + padding: 0px; + } +` diff --git a/packages/boba/gateway/src/components/icons/BobaLogo.js b/packages/boba/gateway/src/components/icons/BobaLogo.js index 77eab2cb6c..5fa244314f 100644 --- a/packages/boba/gateway/src/components/icons/BobaLogo.js +++ b/packages/boba/gateway/src/components/icons/BobaLogo.js @@ -1,7 +1,7 @@ import * as React from "react" import { useTheme } from '@mui/material'; -import { ReactComponent as LogoBoba2 } from 'images/boba2/logo-boba2.svg'; -import {ReactComponent as LogoBoba2dark} from 'images/boba2/logo-boba2-dark.svg'; +import { ReactComponent as LogoBoba2 } from 'assets/images/boba2/logo-boba2.svg'; +import {ReactComponent as LogoBoba2dark} from 'assets/images/boba2/logo-boba2-dark.svg'; function BobaLogo() { diff --git a/packages/boba/gateway/src/components/icons/CloseIcon.js b/packages/boba/gateway/src/components/icons/CloseIcon.js deleted file mode 100644 index 84975c926c..0000000000 --- a/packages/boba/gateway/src/components/icons/CloseIcon.js +++ /dev/null @@ -1,18 +0,0 @@ -import * as React from "react" -import { useTheme } from "@mui/material/styles"; - -function CloseIcon() { - const theme = useTheme(); - const isLight = theme.palette.mode === 'light'; - const color = theme.palette.common[ isLight ? 'black' : 'white' ]; - return ( - - - - - ) -} - -export default CloseIcon diff --git a/packages/boba/gateway/src/components/icons/DiscordIcon.js b/packages/boba/gateway/src/components/icons/DiscordIcon.js deleted file mode 100644 index f6949e5adc..0000000000 --- a/packages/boba/gateway/src/components/icons/DiscordIcon.js +++ /dev/null @@ -1,26 +0,0 @@ -import { useTheme } from '@mui/material' -import * as React from 'react' - -function DiscordIcon(props) { - const theme = useTheme() - const isLight = theme.palette.mode === 'light' - const color = theme.palette.common[isLight ? 'dark' : 'white'] - - return ( - - - - ) -} - -export default DiscordIcon diff --git a/packages/boba/gateway/src/components/icons/NavIcon.js b/packages/boba/gateway/src/components/icons/NavIcon.js deleted file mode 100644 index bd26a758f9..0000000000 --- a/packages/boba/gateway/src/components/icons/NavIcon.js +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from "react" -import { useTheme } from "@mui/material/styles"; - -function NavIcon() { - const theme = useTheme(); - const isLight = theme.palette.mode === 'light'; - const color = theme.palette.common[ isLight ? 'black' : 'white' ]; - - return ( - - - - - ) -} - -export default NavIcon diff --git a/packages/boba/gateway/src/components/icons/WalletIcon.js b/packages/boba/gateway/src/components/icons/WalletIcon.js deleted file mode 100644 index f79ca79df1..0000000000 --- a/packages/boba/gateway/src/components/icons/WalletIcon.js +++ /dev/null @@ -1,25 +0,0 @@ -import * as React from "react" -import { useTheme } from "@mui/material/styles"; - -function WalletIcon() { - - const theme = useTheme(); - const isLight = theme.palette.mode === 'light'; - const color = theme.palette.common[ isLight ? 'black' : 'white' ]; - - return ( - - - - ) -} - -export default WalletIcon diff --git a/packages/boba/gateway/src/components/icons/chain/L1/AvalancheIcon.js b/packages/boba/gateway/src/components/icons/chain/L1/AvalancheIcon.js index d8f76d73c6..50a1f903c7 100644 --- a/packages/boba/gateway/src/components/icons/chain/L1/AvalancheIcon.js +++ b/packages/boba/gateway/src/components/icons/chain/L1/AvalancheIcon.js @@ -1,39 +1,11 @@ import * as React from "react" +import { getCoinImage } from "util/coinImage" function AvalancheIcon({ selected = false }) { - - if (!selected) { - return - - - - - - - - - - - - - - } - - return ( - - - - - - - - - - - - - ) + return <> + avax icon + } export default AvalancheIcon diff --git a/packages/boba/gateway/src/components/icons/chain/L1/BNBIcon.js b/packages/boba/gateway/src/components/icons/chain/L1/BNBIcon.js index 1a50af5d04..0667b3d407 100644 --- a/packages/boba/gateway/src/components/icons/chain/L1/BNBIcon.js +++ b/packages/boba/gateway/src/components/icons/chain/L1/BNBIcon.js @@ -1,38 +1,10 @@ import * as React from "react" +import { getCoinImage } from "util/coinImage" function BnbIcon({ selected = false }) { - - - if (!selected) { - return - - - - - - - - - - - - - } - - return ( - - - - - - - - - - - - - ) + return <> + bnb logo + } export default BnbIcon diff --git a/packages/boba/gateway/src/components/icons/chain/L2/BobaAvaxIcon.js b/packages/boba/gateway/src/components/icons/chain/L2/BobaAvaxIcon.js index cc9492dc0d..74b3fe17ac 100644 --- a/packages/boba/gateway/src/components/icons/chain/L2/BobaAvaxIcon.js +++ b/packages/boba/gateway/src/components/icons/chain/L2/BobaAvaxIcon.js @@ -1,59 +1,15 @@ import * as React from "react" function BobaAvaxIcon({ selected = false }) { - - - if (!selected) { - return - - - - - - - - - - - - - - - - - - - - - - - - } - - return ( - - - - - - - - - - - - - - - - - - - - - + return + + + + + + + - ) } export default BobaAvaxIcon diff --git a/packages/boba/gateway/src/components/icons/chain/L2/BobaBNBIcon.js b/packages/boba/gateway/src/components/icons/chain/L2/BobaBNBIcon.js index ce5bccfea6..466387d258 100644 --- a/packages/boba/gateway/src/components/icons/chain/L2/BobaBNBIcon.js +++ b/packages/boba/gateway/src/components/icons/chain/L2/BobaBNBIcon.js @@ -2,55 +2,16 @@ import * as React from "react" function BobaBnbIcon({ selected = false }) { - if (!selected) { - return - - - - - - - - - - - - - - - - - - - - - - } + return + + + + + + + - return ( - - - - - - - - - - - - - - - - - - - - - - ) } export default BobaBnbIcon diff --git a/packages/boba/gateway/src/components/icons/chain/L2/BobaIcon.js b/packages/boba/gateway/src/components/icons/chain/L2/BobaIcon.js index 5d92aa1177..4eef997882 100644 --- a/packages/boba/gateway/src/components/icons/chain/L2/BobaIcon.js +++ b/packages/boba/gateway/src/components/icons/chain/L2/BobaIcon.js @@ -2,16 +2,21 @@ import * as React from "react" function BobaIcon({ selected = false }) { - return - - - - - - - + return + + + + + + + + + + + + } export default BobaIcon diff --git a/packages/boba/gateway/src/components/layout/Footer/FooterLinks/constant.ts b/packages/boba/gateway/src/components/layout/Footer/FooterLinks/constant.ts index fcb8cc39cf..708e083b4d 100644 --- a/packages/boba/gateway/src/components/layout/Footer/FooterLinks/constant.ts +++ b/packages/boba/gateway/src/components/layout/Footer/FooterLinks/constant.ts @@ -21,14 +21,6 @@ export const FOOTERLINKS: Array = [ path: ROUTES_PATH.BOBASCOPE, isNav: true, }, - /* - TODO: - FIXME: - as it's depenedent on network connect consider fixing it once bridge page setup. - { - label: 'Blockexplorer', - path: '', - }, */ ] export const FOOTERLINKS_RIGHT: Array = [ diff --git a/packages/boba/gateway/src/components/layout/Footer/FooterLinks/index.tsx b/packages/boba/gateway/src/components/layout/Footer/FooterLinks/index.tsx index 5749c5a134..80d83a3b76 100644 --- a/packages/boba/gateway/src/components/layout/Footer/FooterLinks/index.tsx +++ b/packages/boba/gateway/src/components/layout/Footer/FooterLinks/index.tsx @@ -1,11 +1,21 @@ -import React from 'react' +import React, { useEffect } from 'react' import { FOOTERLINKS, FOOTERLINKS_RIGHT } from './constant' +import { useSelector, useDispatch } from 'react-redux' import { LinkContainer, StyledLink, StyledNavLink } from './style' -import { link } from 'fs' +import { selectBlockExplorerLinks, selectBaseEnabled } from 'selectors' +import { fetchBlockExplorerUrls } from 'actions/networkAction' -interface Props {} +const FooterLinks = () => { + const dispatch = useDispatch() + const links = useSelector(selectBlockExplorerLinks()) + const baseEnabled = useSelector(selectBaseEnabled()) + + useEffect(() => { + if (!!baseEnabled) { + dispatch(fetchBlockExplorerUrls()) + } + }, [baseEnabled]) -const FooterLinks = (props: Props) => { return (
@@ -23,6 +33,20 @@ const FooterLinks = (props: Props) => { ) })} + {links && links.length > 0 ? ( + <> + + Blockexplorer + + + Boba Blockexplorer + + + ) : null}
{FOOTERLINKS_RIGHT.map((link) => ( diff --git a/packages/boba/gateway/src/components/layout/Footer/GasWatcher/index.tsx b/packages/boba/gateway/src/components/layout/Footer/GasWatcher/index.tsx index 8b22324d05..0c129820b6 100644 --- a/packages/boba/gateway/src/components/layout/Footer/GasWatcher/index.tsx +++ b/packages/boba/gateway/src/components/layout/Footer/GasWatcher/index.tsx @@ -29,20 +29,20 @@ const GasWatcher: FC = () => { Savings - {savings.toFixed(0)}x + {savings?.toFixed(0)}x L1 - {gas.blockL1} + {gas?.blockL1} L2 - {gas.blockL2} + {gas?.blockL2} Last Verified Block - {Number(verifierStatus?.matchedBlock)} + {Number(verifierStatus?.matchedBlock || 0)} diff --git a/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/icons/copy.tsx b/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/icons/copy.tsx new file mode 100644 index 0000000000..6ae0e06748 --- /dev/null +++ b/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/icons/copy.tsx @@ -0,0 +1,20 @@ +import React from 'react' + +const CopyIcon = () => { + return ( + + + + ) +} + +export default CopyIcon diff --git a/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/icons/disconnect.tsx b/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/icons/disconnect.tsx new file mode 100644 index 0000000000..953f5078c5 --- /dev/null +++ b/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/icons/disconnect.tsx @@ -0,0 +1,20 @@ +import React from 'react' + +const DisconnectIcon = () => { + return ( + + + + ) +} + +export default DisconnectIcon diff --git a/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/index.tsx b/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/index.tsx new file mode 100644 index 0000000000..13ab5b3004 --- /dev/null +++ b/packages/boba/gateway/src/components/layout/Header/NavDrawer/AccountDrawer/index.tsx @@ -0,0 +1,78 @@ +import Drawer from '@mui/material/Drawer' +import { Button } from 'components/global' +import React, { FC } from 'react' + +import CopyIcon from './icons/copy' +import DisconnectIcon from './icons/disconnect' +import { + AccountContainer, + Action, + Content, + ItemLabel, + MenuItemStyle, +} from '../styles' +import networkService from 'services/networkService' +import useDisconnect from 'hooks/useDisconnect' + +interface Props { + open: boolean + onClose: () => void + onCloseNav: () => void +} + +const CopyElement = () => { + const onCopyAddress = () => { + navigator.clipboard.writeText(networkService.account as string) + } + + return ( + onCopyAddress()}> + + Copy Address + + ) +} + +const DisconnectElement = ({ onDisconnect }: { onDisconnect: any }) => { + return ( + + + Disconnect + + ) +} + +const AccountDrawer: FC = ({ onClose, onCloseNav, open = false }) => { + const { disconnect } = useDisconnect() + const onDisconnect = () => { + disconnect() + onClose() + onCloseNav() + } + return ( + <> + + + + + + + +
+
+
+
+
+
+
+
diff --git a/packages/boba/gateway/src/components/layout/Header/feeSwitcher/index.tsx b/packages/boba/gateway/src/components/layout/Header/feeSwitcher/index.tsx index 5cae5ad8b8..c31913652f 100644 --- a/packages/boba/gateway/src/components/layout/Header/feeSwitcher/index.tsx +++ b/packages/boba/gateway/src/components/layout/Header/feeSwitcher/index.tsx @@ -13,34 +13,31 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -import React, { FC, useCallback } from 'react' -import { useDispatch, useSelector } from 'react-redux' -import { openError, openAlert } from 'actions/uiAction' +import React, { FC } from 'react' +import { useSelector } from 'react-redux' import { selectAccountEnabled, + selectActiveNetworkName, selectBobaFeeChoice, selectLayer, - selectlayer2Balance, - selectActiveNetworkName, } from 'selectors' -import { switchFee } from 'actions/setupAction.js' import Select from 'components/select/Select' import Tooltip from 'components/tooltip/Tooltip' -import { isEqual } from 'util/lodash' -import BN from 'bignumber.js' -import { logAmount } from 'util/amountConvert.js' import networkService from 'services/networkService.js' -import { FeeSwitcherIcon, FeeSwitcherLabel, FeeSwitcherWrapper } from './styles' +import useFeeSwitcher from 'hooks/useFeeSwitcher' import { getCoinImage } from 'util/coinImage' +import { FeeSwitcherIcon, FeeSwitcherLabel, FeeSwitcherWrapper } from './styles' + +import BobaLogo from 'assets/images/Boba_Logo_White_Circle.png' const OptionBoba = () => ({ value: 'BOBA', title: 'BOBA', - icon: getCoinImage('BOBA'), + icon: BobaLogo, }) const OptionNativeToken = () => ({ @@ -50,94 +47,12 @@ const OptionNativeToken = () => ({ }) const FeeSwitcher: FC = () => { - const dispatch = useDispatch() const accountEnabled = useSelector(selectAccountEnabled()) const feeUseBoba = useSelector(selectBobaFeeChoice()) - const networkName = useSelector(selectActiveNetworkName()) - const layer = useSelector(selectLayer()) - const l2Balances = useSelector(selectlayer2Balance, isEqual) - - const l2BalanceNativeToken = l2Balances.filter( - (i: any) => i.symbol === networkService.L1NativeTokenSymbol - ) - const balanceETH = l2BalanceNativeToken[0] - const l2BalanceBOBA = l2Balances.filter((i: any) => i.symbol === 'BOBA') - const balanceBOBA = l2BalanceBOBA[0] - - const dispatchSwitchFee = useCallback( - async (targetFee) => { - let tooSmallL1NativeToken = false - // mini balance required for token to use as bridge fee - const minL1NativeBalance = - await networkService.estimateMinL1NativeTokenForFee() //0.002 - let tooSmallBOBA = false - - if (typeof balanceBOBA === 'undefined') { - tooSmallBOBA = true - } else { - //check actual balance - tooSmallBOBA = new BN(logAmount(balanceBOBA.balance, 18)).lt(new BN(1)) - } - - if (typeof balanceETH === 'undefined') { - tooSmallL1NativeToken = true - } else { - //check actual balance - tooSmallL1NativeToken = new BN(logAmount(balanceETH.balance, 18)).lt( - new BN(minL1NativeBalance) - ) - } - - if (!balanceBOBA && !balanceETH) { - dispatch( - openError('Wallet empty - please bridge in ETH or BOBA from L1') - ) - return - } - - let res - - if (feeUseBoba && targetFee === 'BOBA') { - // do nothing - already set to BOBA - } else if ( - !feeUseBoba && - targetFee === networkService.L1NativeTokenSymbol - ) { - // do nothing - already set to ETH - } else if (!feeUseBoba && targetFee === 'BOBA') { - // change to BOBA - if (tooSmallBOBA) { - dispatch( - openError(`You cannot change the fee token to BOBA since your BOBA balance is below 1 BOBA. - If you change fee token now, you might get stuck. Please swap some ETH for BOBA first.`) - ) - } else { - res = await dispatch(switchFee(targetFee)) - } - } else if ( - feeUseBoba && - targetFee === networkService.L1NativeTokenSymbol - ) { - // change to L1Native Token - if (tooSmallL1NativeToken) { - dispatch( - openError(`You cannot change the fee token to ${networkService.L1NativeTokenSymbol} since your ${networkService.L1NativeTokenSymbol} balance is below ${minL1NativeBalance}. - If you change fee token now, you might get stuck. Please obtain some ${networkService.L1NativeTokenSymbol} first.`) - ) - } else { - res = await dispatch(switchFee(targetFee)) - } - } - - if (res) { - dispatch(openAlert(`Successfully changed fee to ${targetFee}`)) - } - }, - [dispatch, feeUseBoba, balanceETH, balanceBOBA] - ) + const { switchFeeUse } = useFeeSwitcher() if (!accountEnabled && layer !== 'L2') { return ( @@ -165,7 +80,9 @@ const FeeSwitcher: FC = () => { newSelect={true} label="" className="" - onSelect={(e: any) => dispatchSwitchFee(e.value)} + onSelect={(e: any) => { + switchFeeUse(e.value) + }} value={feeUseBoba ? OptionBoba() : OptionNativeToken()} options={[OptionBoba(), OptionNativeToken()]} /> diff --git a/packages/boba/gateway/src/components/layout/Header/feeSwitcher/styles.ts b/packages/boba/gateway/src/components/layout/Header/feeSwitcher/styles.ts index 6280751cd9..062d381938 100644 --- a/packages/boba/gateway/src/components/layout/Header/feeSwitcher/styles.ts +++ b/packages/boba/gateway/src/components/layout/Header/feeSwitcher/styles.ts @@ -1,12 +1,16 @@ import { HelpOutline } from '@mui/icons-material' import { Heading, Typography } from 'components/global' -import styled from 'styled-components' +import styled, { css } from 'styled-components' +import { mobile } from 'themes/screens' export const FeeSwitcherWrapper = styled.div` display: flex; gap: 5px; align-items: center; justify-content: space-around; + ${mobile(css` + display: none; + `)} ` export const FeeSwitcherLabel = styled(Heading).attrs({ diff --git a/packages/boba/gateway/src/components/layout/Header/index.tsx b/packages/boba/gateway/src/components/layout/Header/index.tsx index dc952bf93f..e681f23829 100644 --- a/packages/boba/gateway/src/components/layout/Header/index.tsx +++ b/packages/boba/gateway/src/components/layout/Header/index.tsx @@ -1,6 +1,12 @@ -import React, { FC } from 'react' +import React, { FC, useState } from 'react' import { HeaderProps } from './types' -import { BobaLogo, HeaderAction, HeaderContainer } from './style' +import { + BobaLogo, + HeaderAction, + HeaderContainer, + HumberIcon, + MobileMenuIcon, +} from './styles' import { Button } from 'components/global' import ThemeSwitcher from './ThemeSwitcher' import Navigation from './Navigation' @@ -10,11 +16,14 @@ import { selectAccountEnabled, selectLayer } from 'selectors' import { WalletAddress } from './WalletAddress' import { LAYER } from 'util/constant' import FeeSwitcher from './feeSwitcher' +import NavDrawer from './NavDrawer' +import { NetworkSelector } from 'components/NetworkSelector' export const Header: FC = () => { const dispatch = useDispatch() const layer = useSelector(selectLayer()) const accountEnabled = useSelector(selectAccountEnabled()) + const [showDrawer, setShowDrawer] = useState(false) const onConnect = () => { dispatch(setConnect(true)) @@ -24,15 +33,25 @@ export const Header: FC = () => { + setShowDrawer(false)} /> {accountEnabled ? ( <> {layer === LAYER.L2 ? : null} + ) : ( - - - - - {logAmount(userInfo.amount, decimals) === '0' ? - <> - Staked - 0.00 - - : - <> - Staked - {logAmount(userInfo.amount, decimals, 2)} - - - - - - } + label="Harvest" + /> + - - - ); - - } -} - -const mapStateToProps = state => ({ - fixed: state.fixed, -}) - -export default connect(mapStateToProps)(ListSave) diff --git a/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js b/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js index 374832e608..2ad6cd0d60 100644 --- a/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js +++ b/packages/boba/gateway/src/components/mainMenu/layerSwitcher/LayerSwitcher.js @@ -63,12 +63,12 @@ import Button from 'components/button/Button' import { L1_ICONS, L2_ICONS } from 'util/network/network.util' import { LAYER, DISABLE_WALLETCONNECT } from 'util/constant' -function LayerSwitcher({ visisble = true, isButton = false }) { +const LayerSwitcher = ({ visisble = true, isButton = false }) => { const dispatch = useDispatch() const accountEnabled = useSelector(selectAccountEnabled()) const baseEnabled = useSelector(selectBaseEnabled()) - let layer = useSelector(selectLayer()) + const layer = useSelector(selectLayer()) const network = useSelector(selectActiveNetwork()) const networkType = useSelector(selectActiveNetworkType()) const networkName = useSelector(selectActiveNetworkName()) @@ -91,10 +91,8 @@ function LayerSwitcher({ visisble = true, isButton = false }) { : '' const dispatchBootAccount = useCallback(() => { - if ((!accountEnabled && baseEnabled) || chainIdChanged) initializeAccount() - - async function initializeAccount() { + const initializeAccount = async () => { const initialized = await networkService.initializeAccount({ networkGateway: network, networkType, @@ -123,15 +121,18 @@ function LayerSwitcher({ visisble = true, isButton = false }) { return false } } + + if ((!accountEnabled && baseEnabled) || chainIdChanged) { + initializeAccount() + } }, [dispatch, accountEnabled, network, networkType, baseEnabled, chainIdChanged]) const doConnectToLayer = useCallback((layer) => { - function resetConnectChain() { + const resetConnectChain = () => { dispatch(setConnect(false)) dispatch(setConnectETH(false)) } - - async function doConnect() { + const doConnect = async () => { try { if (networkService.walletService.provider) { if (await networkService.switchChain(layer)) { diff --git a/packages/boba/gateway/src/components/mainMenu/menuItems/MenuItems.js b/packages/boba/gateway/src/components/mainMenu/menuItems/MenuItems.js index 6ecfb41172..903e6884d8 100644 --- a/packages/boba/gateway/src/components/mainMenu/menuItems/MenuItems.js +++ b/packages/boba/gateway/src/components/mainMenu/menuItems/MenuItems.js @@ -27,7 +27,7 @@ const MenuItems = ({ let fMenu = menuList .filter( (m) => - intersection([m.key], PAGES_BY_NETWORK[network.toLowerCase()]).length + intersection([m.key], PAGES_BY_NETWORK[network?.toLowerCase()])?.length ) .filter((m) => !m.disable) diff --git a/packages/boba/gateway/src/components/modal/Modal.js b/packages/boba/gateway/src/components/modal/Modal.tsx similarity index 72% rename from packages/boba/gateway/src/components/modal/Modal.js rename to packages/boba/gateway/src/components/modal/Modal.tsx index 1ab854914d..96cedd7d82 100644 --- a/packages/boba/gateway/src/components/modal/Modal.js +++ b/packages/boba/gateway/src/components/modal/Modal.tsx @@ -15,18 +15,13 @@ limitations under the License. */ import React from 'react' -import { - Fade, - Container, - Box, - useMediaQuery, - useTheme, -} from '@mui/material' +import { Fade, Container, Box, useMediaQuery, useTheme } from '@mui/material' import { Heading } from 'components/global' import * as S from './styles' -import CloseIcon from 'images/close.svg'; +import CloseIcon from 'assets/images/close.svg' import { Svg } from 'components/global/svg' +import { ModalInterface } from './types' const _Modal = ({ children, @@ -34,10 +29,13 @@ const _Modal = ({ onClose, title, transparent, - minHeight -}) => { - const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down('md')); + maxWidth, + minHeight, + isMobile = false, + newStyle = false, +}: ModalInterface) => { + const theme = useTheme() + const isMobileDevice = useMediaQuery(theme.breakpoints.down('md')) return ( - + - {title} + {title} - + @@ -69,7 +63,7 @@ const _Modal = ({ - ); + ) } -export default _Modal; +export default _Modal diff --git a/packages/boba/gateway/src/components/modal/styles.ts b/packages/boba/gateway/src/components/modal/styles.ts index 63aa5ba4bb..8b97106bff 100644 --- a/packages/boba/gateway/src/components/modal/styles.ts +++ b/packages/boba/gateway/src/components/modal/styles.ts @@ -71,10 +71,11 @@ export const Style = styled.div` export const WrapperActionsModal = styled(Box)` display: flex; + flex-direction: column; align-items: center; gap: 10px; justify-content: flex-end; - margin-top: 50px; + margin-top: 15px; ` export const ModalHead = styled(Box)` diff --git a/packages/boba/gateway/src/components/modal/types.ts b/packages/boba/gateway/src/components/modal/types.ts new file mode 100644 index 0000000000..a6d7848e19 --- /dev/null +++ b/packages/boba/gateway/src/components/modal/types.ts @@ -0,0 +1,12 @@ +export interface ModalInterface { + children: any + isMobile?: boolean + open: any + onClose: any + light?: any + title?: any + transparent?: any + maxWidth?: any + minHeight?: any + newStyle?: boolean | undefined +} diff --git a/packages/boba/gateway/src/components/notificationBanner/tests/__snapshots__/index.test.tsx.snap b/packages/boba/gateway/src/components/notificationBanner/tests/__snapshots__/index.test.tsx.snap index 91238090a4..0d77fa903b 100644 --- a/packages/boba/gateway/src/components/notificationBanner/tests/__snapshots__/index.test.tsx.snap +++ b/packages/boba/gateway/src/components/notificationBanner/tests/__snapshots__/index.test.tsx.snap @@ -3,10 +3,10 @@ exports[`NotificationBanner should match snapshot and check show banner when open set to true 1`] = `
Alert message goes here @@ -24,10 +24,10 @@ exports[`NotificationBanner should match snapshot and check show banner when op exports[`NotificationBanner should match snapshot without message 1`] = `
Alert message goes here diff --git a/packages/boba/gateway/src/components/pageFooter/PageFooter.js b/packages/boba/gateway/src/components/pageFooter/PageFooter.js deleted file mode 100644 index e982324aa4..0000000000 --- a/packages/boba/gateway/src/components/pageFooter/PageFooter.js +++ /dev/null @@ -1,176 +0,0 @@ -import { Telegram, Twitter } from '@mui/icons-material' -import DiscordIcon from 'components/icons/DiscordIcon' -import React from 'react' -import BobaLogo from '../../images/boba2/logo-boba2.svg' -import GasSwitcher from '../mainMenu/gasSwitcher/GasSwitcher' -import * as S from './PageFooter.styles' -import { useMediaQuery, useTheme } from '@mui/material' -import { LAYER, ROUTES_PATH, WALLET_VERSION } from 'util/constant' -import { useSelector } from 'react-redux' -import { - selectLayer, - selectActiveNetwork, - selectActiveNetworkType, -} from 'selectors' -import { getBlockExplorerUrl } from 'util/network/network.util' - - -const PageFooter = ({ maintenance }) => { - const theme = useTheme() - const isMobile = useMediaQuery(theme.breakpoints.down('md')) - const [isDiscordHover, setIsDiscordHover] = React.useState(false) - - const layer = useSelector(selectLayer()) - const network = useSelector(selectActiveNetwork()) - const networkType = useSelector(selectActiveNetworkType()) - - if (maintenance) { - return ( - - - - boba logo - - - - - - - Boba Docs - - - - - - - - setIsDiscordHover(true)} - onMouseLeave={() => setIsDiscordHover(false)} - > - - - - - - - Boba Website - - - - - ) - } - return ( - - - - - - - setIsDiscordHover(true)} - onMouseLeave={() => setIsDiscordHover(false)} - > - - - - - - - {!isMobile && } - - - - - - - - FAQs - - - Dev Tools - - BobaScope - - Blockexplorer - - - Boba Docs - - - - - - Boba Website - - - - v{WALLET_VERSION} - - - ) -} - -export default PageFooter diff --git a/packages/boba/gateway/src/components/pageFooter/PageFooter.styles.js b/packages/boba/gateway/src/components/pageFooter/PageFooter.styles.js deleted file mode 100644 index 15ff38add2..0000000000 --- a/packages/boba/gateway/src/components/pageFooter/PageFooter.styles.js +++ /dev/null @@ -1,168 +0,0 @@ -import { styled } from '@mui/material/styles' -import { Box, Divider } from '@mui/material' -import { NavLink } from 'react-router-dom' -import { IconButton } from '@mui/material' - -export const Wrapper = styled(Box)(({ theme }) => ({ - display: 'flex', - flexDirection: 'column', - justifyContent: 'flex-start', - alignItems: 'center', - //margin: '0', - //padding: '0 20px', - //bottom: 0, - //width: '100%', - //height: '184px', - background: theme.palette.background.footer, - [theme.breakpoints.down('md')]: { - marginTop: '10px', - maxHeight: '400px', - justifyContent: 'flex-start', - padding: '0 20px', - }, - color: 'rgba(255, 255, 255, 0.65)' -})) - -export const ContentWrapper = styled(Box)(({ theme }) => ({ - display: 'flex', - justifyContent: 'space-between', - width: '70%', - margin: '30px 0', - [theme.breakpoints.between('sm', 'md')]: { - width: '90%', - margin: '20px 0', - flexDirection: 'column', - justifyContent: 'center', - gap: '20px', - }, - [theme.breakpoints.down('md')]: { - margin: '20px 0', - width: '100%', - flexDirection: 'column', - justifyContent: 'center', - gap: '20px', - }, - -})) - -export const FooterLink = styled(NavLink)(({ theme }) => ({ - //marginLeft: theme.spacing(1), - marginTop: theme.spacing(1), - fontSize: '14px', - textDecoration: 'none', - cursor: 'pointer', - color: 'unset', - '&:hover': { - color: theme.palette.secondary.main, - }, -})) - -export const FooterLinkExt = styled(Box)(({ theme }) => ({ - //marginLeft: theme.spacing(1), - marginTop: theme.spacing(1), - fontSize: '14px', - textDecoration: 'none', - cursor: 'pointer', - color: 'unset', - '&:hover': { - color: theme.palette.secondary.main, - }, -})) - -export const FooterLogoWrapper = styled(Box)(({ theme }) => ({ - display: 'flex', - alignSelf: 'flex-start', - justifyContent: 'center', - alignItems: 'center', - -})) - -export const FooterDivider = styled(Divider)(({ theme }) => ({ - background: 'rgba(49,49,49, 1)', - boxSizing: 'border-box', - width: '100%', -})) - -export const FooterDividerMobile = styled(Divider)(({ theme }) => ({ - display: 'none', - [theme.breakpoints.down('md')]: { - display: 'block', - background: 'rgba(255, 255, 255, 0.04)', - boxSizing: 'border-box', - boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)', - width: '100%', - }, -})) - -export const FooterLinkWrapperLeft = styled(Box)(({ theme }) => ({})) - -export const FooterLinkWrapper = styled(Box)(({ theme }) => ({ - display: 'flex', - alignSelf: 'flex-start', - justifyContent: 'space-between', - alignItems: 'center', - width: '70%', - [theme.breakpoints.down('md')]: { - width: '100%', - justifyContent: 'space-around', - flexDirection: 'column', - margin: '0', - marginTop: '20px', - alignItems: 'flex-start', - }, -})) - -export const LinkWrapper = styled(Box)(({ theme }) => ({ - display: 'flex', - width: '40%', - justifyContent: 'flex-start', - gap: '10px', - [theme.breakpoints.down('md')]: { - flexDirection: 'column', - alignItems: 'flex-start', - margin: '10px 0', - width: '100%', - gap: 0, - }, - [theme.breakpoints.down('sm')]: { - width: '100%', - }, -})) - -export const SocialWrapper = styled(Box)(({ theme }) => ({ - display: 'flex', - width: '20%', - justifyContent: 'flex-start', - gap: '10px', - a: { - cursor: 'pointer', - }, - [theme.breakpoints.down('md')]: { - justifyContent: 'center', - margin: '10px 0', - width: '100%', - }, - [theme.breakpoints.down('sm')]: { - width: '100%', - }, -})) - -export const SocialButton = styled(IconButton)(({ theme }) => ({ - svg: { - path: { - fill: 'rgba(255, 255, 255, 0.65)', - fillOpacity: 1, - }, - }, - color: 'rgba(255, 255, 255, 1)', - opacity: 0.65, - '&:hover': { - background: 'none', - svg: { - path: { - fill: theme.palette.secondary.main, - fillOpacity: 1, - }, - }, - }, -})) diff --git a/packages/boba/gateway/src/components/pageHeader/PageHeader.js b/packages/boba/gateway/src/components/pageHeader/PageHeader.js deleted file mode 100644 index 4ee4c2aedf..0000000000 --- a/packages/boba/gateway/src/components/pageHeader/PageHeader.js +++ /dev/null @@ -1,181 +0,0 @@ -import React, { useState } from 'react' -import BobaLogo from '../icons/BobaLogo' -import { ReactComponent as BobaLogoM } from '../../images/boba2/logo-boba2-m.svg' -import { useSelector } from 'react-redux' -import { - HeaderWrapper, - StyleDrawer, - HeaderActionButton, - DrawerHeader, - WrapperCloseIcon, - HeaderDivider, -} from './PageHeader.styles' -import { - Box, - Container, - Drawer, - IconButton, - Typography, - useMediaQuery, - useTheme, -} from '@mui/material' - -import NavIcon from 'components/icons/NavIcon' -import WalletIcon from 'components/icons/WalletIcon' -import CloseIcon from 'components/icons/CloseIcon' -import networkService from 'services/networkService' -import { makeStyles } from '@mui/styles' -import { - Copy, - Disconnect, - MenuItems, - ThemeSwitcher, - FeeSwitcher, - NetworkSwitcher, -} from 'components' -import { selectAccountEnabled, selectLayer, selectMonster } from 'selectors' -import { LAYER } from 'util/constant' - -const useStyles = makeStyles({ - root: { - width: '100%', - color: 'f00', - }, -}) - -const PageHeader = ({ maintenance }) => { - const classes = useStyles() - const [open, setOpen] = useState(false) - const [walletOpen, setWalletOpen] = useState(false) - const [feeOpen, setFeeOpen] = useState(false) - - const theme = useTheme() - const accountEnabled = useSelector(selectAccountEnabled()) - const layer = useSelector(selectLayer()) - const monsterNumber = useSelector(selectMonster()) - const isMobile = useMediaQuery(theme.breakpoints.down('md')) - - const Logo = monsterNumber > 0 ? BobaLogoM : BobaLogo - - if (maintenance) { - return ( - - - - - ) - } - - return ( - <> - {isMobile ? ( - - - - - setFeeOpen(!feeOpen)} - sx={{ cursor: 'pointer' }} - > - - Fee - - - setWalletOpen(!walletOpen)} - sx={{ cursor: 'pointer' }} - > - - - setOpen(!open)} sx={{ cursor: 'pointer' }}> - - - - setOpen(false)} - classes={{ paper: classes.root }} - > - - - - - Menu - - setOpen(false)}> - - - - - - - - - - setWalletOpen(false)} - classes={{ paper: classes.root }} - > - - - - - Connect wallet - - setWalletOpen(false)} - > - - - - - - - - - setFeeOpen(false)} - classes={{ paper: classes.root }} - > - - - - - Select Fee - - setFeeOpen(false)}> - - - - - - {layer === LAYER.L2 ? : null} - - - - - ) : ( - - - - {layer === LAYER.L2 ? : null} - - {!!accountEnabled ? ( - <> - - - - ) : null} - - - )} - - ) -} - -export default PageHeader diff --git a/packages/boba/gateway/src/components/pageHeader/PageHeader.styles.js b/packages/boba/gateway/src/components/pageHeader/PageHeader.styles.js deleted file mode 100644 index 1685957079..0000000000 --- a/packages/boba/gateway/src/components/pageHeader/PageHeader.styles.js +++ /dev/null @@ -1,48 +0,0 @@ -import { Box, Divider } from "@mui/material" -import { styled } from '@mui/material/styles' - -export const HeaderWrapper = styled(Box)(({ theme }) => ({ - width: '100%', - height: '64px', - gap: '10px', - display: 'flex', - justifyContent: 'space-around', - alignItems: 'center', - padding: '20px', - [ theme.breakpoints.down('md') ]: { - justifyContent: 'space-between', - padding: '20px 0', - } -})) - -export const HeaderActionButton = styled(Box)(({ theme }) => ({ - gap: '10px', - display: 'flex', - justifyContent: 'space-around', - alignItems: 'center', -})) - -export const DrawerHeader = styled(Box)` - display: flex; - flex-direction: column; - gap: 30px; - padding: 20px 24px; -`; - -export const HeaderDivider = styled(Divider)(({ theme }) => ({ - background: `${ theme.palette.mode === 'dark' ? 'rgba(255, 255, 255, 0.04)' : 'rgba(3, 19, 19, 0.04)'}`, - boxSizing: 'border-box', - boxShadow: `${ theme.palette.mode === 'dark' ? '0px 4px 4px rgba(0, 0, 0, 0.25)' : 'none'}`, - width: '100%' -})) - -export const WrapperCloseIcon = styled(Box)` - display: flex; - justify-content: space-between; - align-items: center; -`; - -export const StyleDrawer = styled(Box)` - background-color: ${(props) => props.theme.palette.mode === 'light' ? 'white' : '#111315'}; - height: 100%; -`; diff --git a/packages/boba/gateway/src/components/pageHeader/PageHeader.styles.tsx b/packages/boba/gateway/src/components/pageHeader/PageHeader.styles.tsx deleted file mode 100644 index ef3d6858e6..0000000000 --- a/packages/boba/gateway/src/components/pageHeader/PageHeader.styles.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import styled, { css } from 'styled-components' - -export const HeaderWrapper = styled.div` - display: flex; - width: 100%; - height: 64px; - gap: 10px; - justify-content: space-around; - align-items: center; - padding: '20px'; - - @media (max-width: 980px) { - justify-content: space-between; - padding: 20px 0; - } -` - -export const HeaderActionButton = styled.div` - gap: 10px; - display: flex; - justify-content: space-around; - align-items: center; -` - -export const DrawerHeader = styled.div` - display: flex; - flex-direction: column; - gap: 30px; - padding: 20px 24px; -` - -export const HeaderDivider = styled.div` - ${(props) => - props.theme.name === 'light' && - css` - background: ${props.theme.colors.gray[700]}; - `} - ${(props) => - props.theme.name === 'dark' && - css` - background: ${props.theme.colors.gray[800]}; - `} - box-sizing: border-box; - box-shadow: ${(props) => props.theme.boxShadow}; - width: 100%; -` - -export const WrapperCloseIcon = styled.div` - display: flex; - justify-content: space-between; - align-items: center; -` - -export const StyleDrawer = styled.div` - height: 100%; - - ${(props) => - props.theme.name === 'light' && - css` - background: ${props.theme.colors.gray[50]}; - `} - ${(props) => - props.theme.name === 'dark' && - css` - background: ${props.theme.colors.gray[800]}; - `} -` diff --git a/packages/boba/gateway/src/components/seven/FastExit.js b/packages/boba/gateway/src/components/seven/FastExit.js index 0aba0b2171..38cf3ce590 100644 --- a/packages/boba/gateway/src/components/seven/FastExit.js +++ b/packages/boba/gateway/src/components/seven/FastExit.js @@ -18,17 +18,13 @@ import React from 'react' import { Typography } from '@mui/material' import * as S from './Transaction.styles' +import { ExitWrapper, ExitsWrapper, Hash, HashContainer } from './styles' import networkService from 'services/networkService' function FastExit({ - link, - status, - chain, blockNumber, - oriChain, oriHash, - age, unixTime }) { @@ -44,7 +40,7 @@ function FastExit({ let timeLabel = `Fast Exit was started ${secondsAgo} seconds ago` return ( - + -
+ {blockNumber} {timeLabel} - + Hash:  - {oriHash} - - -
+ + +
-
+ ) } diff --git a/packages/boba/gateway/src/components/seven/Seven.js b/packages/boba/gateway/src/components/seven/Seven.js index 83b80e7d2d..bf1c66d80f 100644 --- a/packages/boba/gateway/src/components/seven/Seven.js +++ b/packages/boba/gateway/src/components/seven/Seven.js @@ -18,17 +18,13 @@ import React from 'react' import { Typography } from '@mui/material' import * as S from './Transaction.styles' +import { Hash, ExitsWrapper, ExitWrapper, HashContainer } from './styles' import networkService from 'services/networkService' function Seven({ - link, - status, - chain, blockNumber, - oriChain, oriHash, - age, unixTime }) { @@ -57,7 +53,7 @@ function Seven({ } return ( - + -
+ {blockNumber} {overdue < 0 && @@ -84,21 +80,20 @@ function Seven({ {timeLabel} } - + Hash:  - {oriHash} - - -
+ + +
-
+ ) } diff --git a/packages/boba/gateway/src/components/seven/styles.ts b/packages/boba/gateway/src/components/seven/styles.ts new file mode 100644 index 0000000000..cf67669e97 --- /dev/null +++ b/packages/boba/gateway/src/components/seven/styles.ts @@ -0,0 +1,59 @@ +import styled, { css } from 'styled-components' +import { Typography } from 'components/global' + +export const ExitsWrapper = styled.div` + background: ${(props) => props.theme.colors.popup}; + padding: 10px; + border-radius: 12px; + ${(props) => + props.theme.name === 'light' && + css` + border: solid 1px ${props.theme.colors.gray[400]}; + &:hover { + background: ${props.theme.colors.gray[300]}; + border: solid 1px ${props.theme.colors.gray[500]}; + } + `} + ${(props) => + props.theme.name === 'dark' && + css` + border: solid 1px ${props.theme.colors.gray[300]}; + &:hover { + background: ${props.theme.colors.gray[300]}; + } + `} +` + +export const ExitWrapper = styled.div` + display: flex; + flex-direction: column; + justify-content: center; + align-items: flex-start; + gap: 5px; +` + +export const HashContainer = styled(Typography)` + ${(props) => + props.theme.name === 'light' && + css` + color: ${props.theme.colors.gray[700]}; + `} + ${(props) => + props.theme.name === 'dark' && + css` + color: ${props.theme.colors.gray[50]}; + `} +` + +export const Hash = styled.a` + ${(props) => + props.theme.name === 'light' && + css` + color: ${props.theme.colors.gray[700]}; + `} + ${(props) => + props.theme.name === 'dark' && + css` + color: ${props.theme.colors.gray[50]}; + `} +` diff --git a/packages/boba/gateway/src/components/stake/transactionList/index.tsx b/packages/boba/gateway/src/components/stake/transactionList/index.tsx new file mode 100644 index 0000000000..bc00a6c0c9 --- /dev/null +++ b/packages/boba/gateway/src/components/stake/transactionList/index.tsx @@ -0,0 +1,103 @@ +import React from 'react' +import dayjs from 'dayjs' +import duration from 'dayjs/plugin/duration' + +dayjs.extend(duration) + +import { useDispatch } from 'react-redux' +import { openAlert, openError } from 'actions/uiAction' +import { withdrawFS_Savings } from 'actions/fixedAction' + +import { Button } from 'components/global/button' +import { Typography } from 'components/global/typography' +import { ModalTypography } from 'components/global/modalTypography' + +import { TransactionListInterface } from './types' +import { StakeItemDetails, Token, Flex } from './styles' +import { getCoinImage } from 'util/coinImage' + +const TransactionList = ({ stakeInfo }: TransactionListInterface) => { + const dispatch = useDispatch() + + const timeDeposit = dayjs.unix(stakeInfo.depositTimestamp) + const timeNow = dayjs() + + const duration_Days = timeNow.diff(timeDeposit, 'day') + const earned = stakeInfo.depositAmount * (0.05 / 365.0) * duration_Days + + const unlocktimeNextBegin = timeDeposit.add(14, 'day') + + const unlocktimeNextEnd = unlocktimeNextBegin.add(2, 'day') + + /* finalize the migration to DAYJs next deploy*/ + const timeDeposit_S = stakeInfo.depositTimestamp + const timeNow_S = Math.round(Date.now() / 1000) + + const duration_S = timeNow_S - timeDeposit_S + + const twoWeeks = 14 * 24 * 60 * 60 + const twoDays = 2 * 24 * 60 * 60 + const residual_S = duration_S % (twoWeeks + twoDays) + + const handleUnstake = async () => { + const withdrawTX = await dispatch(withdrawFS_Savings(stakeInfo.stakeId)) + + if (withdrawTX !== null && withdrawTX !== undefined) { + openAlert('Your BOBA were unstaked') + } else { + openError('Failed to unstake BOBA') + } + } + + let locked = true + if (residual_S > twoWeeks) { + locked = false + } + + return ( + +
+ + + {timeDeposit.format('DD MMM YYYY hh:mm A')} + +
+ +
+ Amount Staked + + {stakeInfo.depositAmount + ? `${stakeInfo.depositAmount.toLocaleString(undefined, { + maximumFractionDigits: 2, + })}` + : `0`} + +
+
+ Earned + {earned.toFixed(3)} +
+
+ + Next unstake window:{' '} + + + {` ${unlocktimeNextBegin.format('DD')}-${unlocktimeNextEnd.format( + 'DD MMM YYYY hh:mm A' + )}`} + +
+
+
+
+
+ ) +} + +export default TransactionList diff --git a/packages/boba/gateway/src/components/stake/transactionList/styles.ts b/packages/boba/gateway/src/components/stake/transactionList/styles.ts new file mode 100644 index 0000000000..0575888b4c --- /dev/null +++ b/packages/boba/gateway/src/components/stake/transactionList/styles.ts @@ -0,0 +1,69 @@ +import styled, { css } from 'styled-components' +import { sdesktop, tablet, mobile } from 'themes/screens' +export const Wrapper = styled.div` + border-radius: 0; + background: ${(props) => props.theme.background.secondary}; +` + +export const Entry = styled.div` + padding: 20px; + display: flex; + justify-content: center; + align-items: center; + background: ${(props) => props.theme.background.secondary}; +` + +export const GridCoontainer = styled.div`` +export const GridItemTag = styled.div` + text-align: left; + display: flex; + flex-direction: row; + justify-content: flex-start; + align-items: center; +` + +export const StakeItemDetails = styled.div` + display: flex; + width: 100%; + justify-content: space-between; + align-items: center; + background: ${(props) => props.theme.colors.box.background}; + border: 1px solid ${(props) => props.theme.colors.box.border}; + box-sizing: border-box; + padding: 20px 35px; + border-radius: 8px; + + > div { + display: flex; + margin: 0px auto; + white-space: break-spaces; + align-items: center; + &:first-of-type { + margin-left: 0px; + width: 200px; + margin-right: 10px; + } + &:last-of-type { + margin-right: 0px; + margin-left: 15px; + } + } +` + +export const Flex = styled.div` + display: flex; + justify-content: space-between; + gap: 0px 10px; + + > div { + display: flex; + gap: 0px 5px; + white-space: initial; + } +` +export const Token = styled.img` + max-width: 32px; + width: 100%; + height: auto; + margin-right: 10px; +` diff --git a/packages/boba/gateway/src/components/stake/transactionList/types.ts b/packages/boba/gateway/src/components/stake/transactionList/types.ts new file mode 100644 index 0000000000..1e297d6e4b --- /dev/null +++ b/packages/boba/gateway/src/components/stake/transactionList/types.ts @@ -0,0 +1,10 @@ +type TransactionType = { + stakeId: number + depositTimestamp: number + depositAmount: number + isActive: boolean +} + +export interface TransactionListInterface { + stakeInfo: TransactionType +} diff --git a/packages/boba/gateway/src/components/transaction/Transaction.js b/packages/boba/gateway/src/components/transaction/Transaction.js deleted file mode 100644 index 971f001087..0000000000 --- a/packages/boba/gateway/src/components/transaction/Transaction.js +++ /dev/null @@ -1,282 +0,0 @@ -/* -Copyright 2021-present Boba Network. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -import React, { useState } from 'react' - -import { Typography, Fade, useMediaQuery, useTheme } from '@mui/material' -import ExpandMoreIcon from '@mui/icons-material/ExpandMore' - -import * as S from './Transaction.styles' - -import truncate from 'truncate-middle' -import networkService from 'services/networkService' -import { formatDate } from 'util/dates' - -function Transaction({ - time, - timeLabel = null, - chain, - typeTX, - blockNumber, - detail, - oriChain, - oriHash, - amountTx, - completion = '', - tx_ref = null, - eventType, - toChain, -}) { - const [dropDownBox, setDropDownBox] = useState(false) - - const theme = useTheme() - const isMobile = useMediaQuery(theme.breakpoints.down('md')) - const isNotFullScreen = useMediaQuery(theme.breakpoints.down(1920)) - - const chainLink = ({ chain, hash }) => { - const network = networkService.networkConfig - if (!!network && !!network[chain]) { - return `${network[chain].transaction}${hash}` - } - return '' - } - - function renderDetailRedesign() { - if (!detail) { - return null - } - - let prefix = 'L2' - if (oriChain === 'L2') prefix = 'L1' - - return ( - - - - - {prefix} Hash:  - - {isMobile ? truncate(detail.hash, 6, 6, '...') : detail.hash} - - - - - {prefix} Block: {detail.blockNumber} - - - {prefix} Block Hash:  - - {detail.blockHash} - - - - {prefix} From:  - - {detail.from} - - - - {prefix} To:  - - {detail.to} - - - - - - ) - } - - return ( - - - -
- - {chain} - - - {timeLabel ? timeLabel : formatDate(time, 'lll')} - - {completion === '' && ( - -   - - )} - {completion !== '' && ( - - {completion} - - )} - {toChain && ( - - {toChain} - - )} - - {oriChain} Hash:  - - {isNotFullScreen ? truncate(oriHash, 6, 6, '...') : oriHash} - - -
-
- - -
- - {blockNumber} - - - {typeTX} - - {eventType ? ( - - {eventType} - - ) : null} - {amountTx ? ( - - {amountTx} - - ) : null} -
-
- - - {!!detail && ( - { - setDropDownBox(!dropDownBox) - }} - > - More Information{' '} - - - )} - -
- - {dropDownBox ? renderDetailRedesign() : null} -
- ) -} - -export default Transaction diff --git a/packages/boba/gateway/src/components/transaction/Transaction.styles.js b/packages/boba/gateway/src/components/transaction/Transaction.styles.js deleted file mode 100644 index a7564b9b46..0000000000 --- a/packages/boba/gateway/src/components/transaction/Transaction.styles.js +++ /dev/null @@ -1,56 +0,0 @@ -import { styled } from '@mui/material/styles' -import { Box, Grid } from '@mui/material' - -export const Wrapper = styled(Box)(({ theme, ...props }) => ({ - borderBottom: theme.palette.mode === 'light' ? '1px solid #c3c5c7' : '1px solid #192537', - borderRadius: '0', - background: theme.palette.background.secondary, - [theme.breakpoints.down('md')]: { - //padding: '30px 10px', - }, - [theme.breakpoints.up('md')]: { - padding: '10px', - }, -})); - -export const GridContainer = styled(Grid)(({theme})=>({ - [theme.breakpoints.down('md')]:{ - justifyContent: 'flex-start' - } -})) - -export const GridItemTag = styled(Grid)(({ theme, ...props }) => ({ - display: 'flex', - alignItems: 'center', - [theme.breakpoints.down('md')]:{ - padding: `${props.xs === 12 ? '20px 0px 0px': 'inherit'}` - } -})) - -export const DropdownWrapper = styled(Box)` - display: flex; - flex-direction: column; - justify-content: flex-start; - align-items: flex-start; - gap: 5px; - width: 100%; - margin-top: 10px; - padding: 12px; - background-color: ${props => props.theme.palette.background.secondary}; - text-align: center; -`; - -export const DropdownContent = styled(Box)(({ theme }) => ({ - display: 'flex', - justifyContent: 'space-between', - [theme.breakpoints.down('md')]: { - flexDirection: 'column', - gap: '5px', - padding: '5px' - }, - [theme.breakpoints.up('md')]: { - flexDirection: 'row', - gap: '16px', - }, -})); - diff --git a/packages/boba/gateway/src/containers/Bridging/BridgeHeader/index.tsx b/packages/boba/gateway/src/containers/Bridging/BridgeHeader/index.tsx index 62ae9fdf0f..6e434cb672 100644 --- a/packages/boba/gateway/src/containers/Bridging/BridgeHeader/index.tsx +++ b/packages/boba/gateway/src/containers/Bridging/BridgeHeader/index.tsx @@ -27,7 +27,7 @@ const BridgeHeader = (props: Props) => { diff --git a/packages/boba/gateway/src/containers/Bridging/BridgeInput/EmergencySwap/index.tsx b/packages/boba/gateway/src/containers/Bridging/BridgeInput/EmergencySwap/index.tsx new file mode 100644 index 0000000000..31448bcf9d --- /dev/null +++ b/packages/boba/gateway/src/containers/Bridging/BridgeInput/EmergencySwap/index.tsx @@ -0,0 +1,88 @@ +import React, { FC, useEffect, useState } from 'react' +import { useDispatch, useSelector } from 'react-redux' +import { + selectAccountEnabled, + selectActiveNetwork, + selectLayer, + selectlayer2Balance, +} from 'selectors' +import networkService from 'services/networkService' + +import { getETHMetaTransaction } from 'actions/setupAction' +import { openAlert } from 'actions/uiAction' +import BN from 'bignumber.js' +import { isEqual } from 'lodash' +import { logAmount } from 'util/amountConvert' +import { LAYER } from 'util/constant' +import { NETWORK } from 'util/network/network.util' +import { SwapAction, SwapAlert, SwapContainer } from './styles' + +interface Props {} + +const EmergencySwap: FC = (props) => { + const network = useSelector(selectActiveNetwork()) + const accountEnabled = useSelector(selectAccountEnabled()) + const l2Balances = useSelector(selectlayer2Balance, isEqual) + const layer = useSelector(selectLayer()) + const [tooSmallSec, setTooSmallSec] = useState(false) + const dispatch = useDispatch() + + useEffect(() => { + if (accountEnabled && l2Balances.length > 0) { + const l2BalanceSec = l2Balances.find( + (i: any) => i.symbol === networkService.L1NativeTokenSymbol + ) + + if (l2BalanceSec && l2BalanceSec.balance) { + // FOR ETH MIN BALANCE 0.003ETH for other secondary tokens 1 + const minBalance = network === NETWORK.ETHEREUM ? 0.003 : 1 + setTooSmallSec( + new BN(logAmount(l2BalanceSec.balance, 18)).lt(new BN(minBalance)) + ) + } else { + // in case of zero ETH balance we are setting tooSmallSec + setTooSmallSec(true) + } + } + }, [l2Balances, accountEnabled, network]) + + const emergencySwap = async () => { + const res = await dispatch(getETHMetaTransaction()) + if (res) { + dispatch(openAlert('Emergency Swap submitted')) + } + } + + const alertContent = () => { + if (NETWORK.ETHEREUM === network) { + return `Using BOBA requires a minimum ETH balance (of 0.002 ETH) regardless of your fee setting, + otherwise MetaMask may incorrectly reject transactions. If you ran out of ETH, use EMERGENCY SWAP to swap BOBA + for 0.005 ETH at market rates.` + } else { + return `Using ${networkService.L1NativeTokenSymbol} requires a minimum BOBA + balance (of 1 BOBA) regardless of your fee setting, otherwise + MetaMask may incorrectly reject transactions. If you ran out of + BOBA, use EMERGENCY SWAP to swap ${networkService.L1NativeTokenSymbol} for 1 BOBA at market rates.` + } + } + + if (layer === LAYER.L2 && tooSmallSec) { + return ( + + {alertContent()} + { + emergencySwap() + }} + label="Emergency Swap" + /> + + ) + } else { + return null + } +} + +export default EmergencySwap diff --git a/packages/boba/gateway/src/containers/Bridging/BridgeInput/EmergencySwap/styles.ts b/packages/boba/gateway/src/containers/Bridging/BridgeInput/EmergencySwap/styles.ts new file mode 100644 index 0000000000..c09d41d002 --- /dev/null +++ b/packages/boba/gateway/src/containers/Bridging/BridgeInput/EmergencySwap/styles.ts @@ -0,0 +1,35 @@ +import { Button, Typography } from 'components/global' +import styled from 'styled-components' + +export const SwapContainer = styled.div` + display: flex; + flex-direction: column; + justify-content: space-between; + padding: 10px; + gap: 8px; + border-radius: 8px; + border: 1px solid + ${({ theme: { colors, name } }) => + name === 'light' ? colors.gray[600] : colors.green[300]}; + background: ${({ theme: { name } }) => + name === 'light' ? 'transparant' : 'rgba(238, 238, 238, 0.05)'}; +` +export const SwapAlert = styled(Typography).attrs({ + variant: 'body3', +})` + font-weight: 400; + line-height: normal; + color: ${({ theme, color }) => + color + ? color + : theme.name === 'light' + ? theme.colors.gray[700] + : theme.colors.gray[100]}; +` +export const SwapAction = styled(Button)` + padding: 10px; + display: flex; + flex-direction: column; + align-item: center; + justify-content: center; +` diff --git a/packages/boba/gateway/src/containers/Bridging/BridgeInput/Fee/index.tsx b/packages/boba/gateway/src/containers/Bridging/BridgeInput/Fee/index.tsx index ac625ee971..fdc4b968bc 100644 --- a/packages/boba/gateway/src/containers/Bridging/BridgeInput/Fee/index.tsx +++ b/packages/boba/gateway/src/containers/Bridging/BridgeInput/Fee/index.tsx @@ -43,7 +43,11 @@ const Fee = (props: Props) => { const estimateTime = () => { if (bridgeType === BRIDGE_TYPE.CLASSIC) { - return '7 days' + if (layer === LAYER.L1) { + return '13 ~ 14mins.' + } else { + return '7 days' + } } else { if (layer === LAYER.L1) { return '1 ~ 5min.' diff --git a/packages/boba/gateway/src/containers/Bridging/BridgeInput/index.tsx b/packages/boba/gateway/src/containers/Bridging/BridgeInput/index.tsx index 6ace07b910..06296d56ae 100644 --- a/packages/boba/gateway/src/containers/Bridging/BridgeInput/index.tsx +++ b/packages/boba/gateway/src/containers/Bridging/BridgeInput/index.tsx @@ -1,4 +1,4 @@ -import React, { FC } from 'react' +import React, { FC, useEffect } from 'react' import { useDispatch, useSelector } from 'react-redux' import { openModal } from 'actions/uiAction' import { selectAccountEnabled, selectTokenToBridge } from 'selectors' @@ -24,6 +24,8 @@ import { TokenSymbol, } from './styles' import { SectionLabel } from '../chain/styles' +import bobaLogo from 'assets/images/Boba_Logo_White_Circle.png' +import EmergencySwap from './EmergencySwap' type Props = {} @@ -47,12 +49,16 @@ const BridgeInput: FC = (props) => { - Amount + Token openTokenPicker()}> {token && ( {`ETH = (props) => { )} {token && } + ) } diff --git a/packages/boba/gateway/src/containers/Bridging/BridgeInput/styles.ts b/packages/boba/gateway/src/containers/Bridging/BridgeInput/styles.ts index 32eb1836bc..6097abcfca 100644 --- a/packages/boba/gateway/src/containers/Bridging/BridgeInput/styles.ts +++ b/packages/boba/gateway/src/containers/Bridging/BridgeInput/styles.ts @@ -1,6 +1,6 @@ import { Svg, Typography } from 'components/global' import styled, { css } from 'styled-components' -import ArrowDown from 'images/icons/arrowdown.svg' +import ArrowDown from 'assets/images/icons/arrowdown.svg' import { mobile } from 'themes/screens' export const BridgeInputContainer = styled.div` @@ -88,10 +88,10 @@ export const TokenLabel = styled(Typography).attrs({ export const TokenPickerIcon = styled.div` justify-self: flex-end; ` -export const DownArrow = styled(Svg).attrs({ +export const DownArrow = styled(Svg).attrs(({ theme }) => ({ src: ArrowDown, - fill: '#fff', -})`` + fill: `${theme.name === 'light' ? '#000' : '#fff'}`, +}))`` export const ReceiveAmount = styled(Typography).attrs({ variant: 'title', diff --git a/packages/boba/gateway/src/containers/Bridging/BridgeTypeSelector/style.ts b/packages/boba/gateway/src/containers/Bridging/BridgeTypeSelector/style.ts index 6936c8150b..5acb28a195 100644 --- a/packages/boba/gateway/src/containers/Bridging/BridgeTypeSelector/style.ts +++ b/packages/boba/gateway/src/containers/Bridging/BridgeTypeSelector/style.ts @@ -22,7 +22,6 @@ export const BridgeTabItem = styled.div<{ font-style: normal; font-weight: 700; line-height: normal; - border-radius: 8px; font-size: ${(props) => props.theme.text.body1}; cursor: pointer; background: transparent; @@ -40,4 +39,11 @@ export const BridgeTabItem = styled.div<{ : props.theme.colors.gray[600]}; background: ${props.theme.colors.green[300]}; `}; + + &:nth-child(odd) { + border-radius: 8px 0 0 8px; + } + &:nth-child(even) { + border-radius: 0 8px 8px 0; + } ` diff --git a/packages/boba/gateway/src/containers/Bridging/chain/styles.ts b/packages/boba/gateway/src/containers/Bridging/chain/styles.ts index 010231019c..c2426b93a6 100644 --- a/packages/boba/gateway/src/containers/Bridging/chain/styles.ts +++ b/packages/boba/gateway/src/containers/Bridging/chain/styles.ts @@ -1,8 +1,8 @@ import { Svg, Typography } from 'components/global' import styled from 'styled-components' -import ArrowDown from 'images/icons/arrowdown.svg' -import Switch from 'images/icons/switchIcon.svg' +import ArrowDown from 'assets/images/icons/arrowdown.svg' +import Switch from 'assets/images/icons/switchIcon.svg' export const ChainContainer = styled.div` display: flex; @@ -44,7 +44,8 @@ export const ChainPicker = styled.div` export const ChainIcon = styled.div` display: flex; - align-items: center; + width: 30px; + height: 30px; ` export const ChainPickerPlaceHolder = styled(Typography).attrs({ variant: 'body1', diff --git a/packages/boba/gateway/src/containers/Global.styles.js b/packages/boba/gateway/src/containers/Global.styles.js index 6209b36ece..b98b035631 100644 --- a/packages/boba/gateway/src/containers/Global.styles.js +++ b/packages/boba/gateway/src/containers/Global.styles.js @@ -101,13 +101,14 @@ export const footerLink = styled(IconButton)(({ theme }) => ({ export const PageSwitcher = styled(Box)(({ theme }) => ({ width: 'fit-content', padding: '3px', - background: theme.palette.mode === 'light' ? 'rgba(3, 19, 19, 0.04)' : 'rgba(255, 255, 255, 0.04)', + background: theme.palette.mode === 'light' ? '#F0F1EA' : '#262626', cursor: 'pointer', display: 'flex', borderRadius: '12px', height: '48px', + border:theme.palette.mode === 'light' ? '1px solid #DEE0D8' : '0px', 'span': { - padding: '2px 15px', + padding: '2px 25px', fontWeight: 'bold', borderRadius: '12px', display: 'flex', @@ -115,7 +116,7 @@ export const PageSwitcher = styled(Box)(({ theme }) => ({ alignItems: 'center', '&.active': { color: '#031313', - background: theme.palette.mode === 'dark'? '#BAE21A' :'#1CD6D1', + background: '#AEDB01', } }, [ theme.breakpoints.down('sm') ]: { diff --git a/packages/boba/gateway/src/containers/VoteAndDao/Vote/Pools/poolListItem.js b/packages/boba/gateway/src/containers/VoteAndDao/Vote/Pools/poolListItem.js index 7fa0438fd0..88de76bbdd 100644 --- a/packages/boba/gateway/src/containers/VoteAndDao/Vote/Pools/poolListItem.js +++ b/packages/boba/gateway/src/containers/VoteAndDao/Vote/Pools/poolListItem.js @@ -17,7 +17,7 @@ import React, { useEffect, useState } from 'react' import { Box, Typography, Slider, styled } from '@mui/material' import Button from 'components/button/Button' -import bobaLogo from 'images/boba-token.svg' +import bobaLogo from 'assets/images/boba-token.svg' import * as G from 'containers/Global.styles' diff --git a/packages/boba/gateway/src/containers/VoteAndDao/Vote/VeNfts/VeNfts.list.js b/packages/boba/gateway/src/containers/VoteAndDao/Vote/VeNfts/VeNfts.list.js index b399b6eb84..cd0bb99e52 100644 --- a/packages/boba/gateway/src/containers/VoteAndDao/Vote/VeNfts/VeNfts.list.js +++ b/packages/boba/gateway/src/containers/VoteAndDao/Vote/VeNfts/VeNfts.list.js @@ -5,7 +5,7 @@ import CheckMarkIcon from '@mui/icons-material/CheckCircleOutline' import Carousel from 'react-multi-carousel' import "react-multi-carousel/lib/styles.css"; -import BobaNFTGlass from 'images/boba2/BobaNFTGlass.svg' +import BobaNFTGlass from 'assets/images/boba2/BobaNFTGlass.svg' import * as G from 'containers/Global.styles' diff --git a/packages/boba/gateway/src/containers/bobaScope/BobaScope.js b/packages/boba/gateway/src/containers/bobaScope/BobaScope.js index d81279ebf4..648bf5aba7 100644 --- a/packages/boba/gateway/src/containers/bobaScope/BobaScope.js +++ b/packages/boba/gateway/src/containers/bobaScope/BobaScope.js @@ -28,7 +28,6 @@ import { fetchSevens, fetchFastExits } from 'actions/networkAction' import { selectBaseEnabled, selectActiveDataTab, selectSevens, selectFastExits } from 'selectors' import Tabs from 'components/tabs/Tabs' -import Input from 'components/input/Input' import Sevens from './Sevens' import FastExits from './FastExits' @@ -36,7 +35,9 @@ import FastExits from './FastExits' import useInterval from 'hooks/useInterval' import { POLL_INTERVAL } from 'util/constant' -import { ContentContainer, Header, ScopePageContainer } from './History.styles'; +import {Header, BobaScopeContainer, ContentContainer} from './styles' +import { TabComponent } from 'components/global/tabs'; +import { SearchInput } from 'components/global/searchInput'; function BobaScope() { @@ -70,43 +71,32 @@ function BobaScope() { }, POLL_INTERVAL) return ( - +
- - { setSearchData(i.target.value) }} - style={{ - flex: 1, - marginBottom: 0, - minWidth: '250px', - }} - /> - + { setSearchData(i.target.value) }}/>
- { dispatch(setActiveDataTab(tab)) }} - activeTab={activeTab} - tabs={[ 'Seven Day Queue', 'Fast Exits' ]} + ) + }, + {label:"Fast Exits", + content:( ) + } + ]} /> - - {activeTab === 'Seven Day Queue' && ( - - )} - {activeTab === 'Fast Exits' && ( - - )} -
+ ); } diff --git a/packages/boba/gateway/src/containers/bobaScope/FastExits.js b/packages/boba/gateway/src/containers/bobaScope/FastExits.js index e6bfb7d9ff..bb349abc83 100644 --- a/packages/boba/gateway/src/containers/bobaScope/FastExits.js +++ b/packages/boba/gateway/src/containers/bobaScope/FastExits.js @@ -23,7 +23,7 @@ import { Pager } from 'components' import FastExit from 'components/seven/FastExit' import styles from './Transactions.module.scss' -import * as S from './History.styles' +import { HistoryContainer, Content } from './styles' const PER_PAGE = 10 @@ -50,7 +50,7 @@ function FastExits({ searchData, data }) { return (
- + - + {!paginatedData.length && !loading && (
Scanning for pending fast exits...
)} @@ -80,10 +80,10 @@ function FastExits({ searchData, data }) { /> ) })} -
+
-
+
); } diff --git a/packages/boba/gateway/src/containers/bobaScope/History.styles.js b/packages/boba/gateway/src/containers/bobaScope/History.styles.js deleted file mode 100644 index a295c76449..0000000000 --- a/packages/boba/gateway/src/containers/bobaScope/History.styles.js +++ /dev/null @@ -1,118 +0,0 @@ -import styled from 'styled-components'; -import {Typography, Box} from '@mui/material' - -export const HistoryContainer = styled.div` - background: ${props => props.theme.palette.background.secondary}; - border-radius: 8px; - margin-bottom: 20px; -`; - -export const TableHeading = styled(Box)` - padding: 10px 20px; - border-radius: 6px; - display: flex; - align-items: flex-start; - justify-content: space-between; -`; - -export const TableHeadingItem = styled(Typography)` - width: 20%; - gap: 5px; - text-align: flex-start; - opacity: 0.7; -`; - -export const Content = styled(Box)` - display: flex; - flex-direction: column; - gap: 5px; - margin-bottom: 10px; - padding: 10px 20px; - border-radius: 6px; -`; - -export const Header = styled(Box)(({ theme }) => ({ - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - marginBottom: '20px', - [theme.breakpoints.down('md')]: { - flexDirection: 'column', - alignItems: 'flex-start', - gap: '20px', - }, -})); - - -export const ScopePageContainer = styled(Box)(({ theme }) => ({ - margin: '0px auto', - display: 'flex', - flexDirection: 'column', - justifyContent: 'space-around', - padding: '10px', - paddingTop: '0px', - width: '70%', - [ theme.breakpoints.between('md', 'lg') ]: { - width: '90%', - padding: '0px', - }, - [ theme.breakpoints.between('sm', 'md') ]: { - width: '90%', - padding: '0px', - }, - [ theme.breakpoints.down('sm') ]: { - width: '100%', - padding: '0px', - }, -})); - - -export const LayerAlert = styled(Box)(({ theme }) => ({ - width: "100%", - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - gap: '30px', - borderRadius: '8px', - margin: '20px 0px', - padding: '25px', - background: theme.palette.background.secondary, - [ theme.breakpoints.up('md') ]: { - padding: '25px 50px', - }, - -})); - -export const AlertText = styled(Typography)(({ theme }) => ({ - marginLeft: '10px', - flex: 4, - [ theme.breakpoints.up('md') ]: { - }, -})); - -export const AlertInfo = styled(Box)` - display: flex; - justify-content: space-around; - align-items: center; - flex: 1; -`; - - -export const SearchInputContainer = styled.div` - width: 250px !important; - @media (max-width: 768px) { - width: 100% !important; - } - -` - -export const ContentContainer = styled.div` - display: flex; - flex-direction: row; - width: 100%; - @media (max-width: 768px) { - flex-direction: column; - } -` - diff --git a/packages/boba/gateway/src/containers/bobaScope/Sevens.js b/packages/boba/gateway/src/containers/bobaScope/Sevens.js index 1f599aa13e..0a823b2bc5 100644 --- a/packages/boba/gateway/src/containers/bobaScope/Sevens.js +++ b/packages/boba/gateway/src/containers/bobaScope/Sevens.js @@ -23,7 +23,7 @@ import { Pager } from 'components' import Seven from 'components/seven/Seven' import styles from './Transactions.module.scss' -import * as S from './History.styles' +import { HistoryContainer, Content } from './styles' const PER_PAGE = 10 @@ -49,8 +49,8 @@ function Sevens({ searchData, sevens }) { if (totalNumberOfPages === 0) totalNumberOfPages = 1 return ( -
- +
+ - + {!paginatedSevens.length && !loading && (
Scanning for pending 7 day exits...
)} @@ -80,10 +80,10 @@ function Sevens({ searchData, sevens }) { /> ) })} -
+
- +
); } diff --git a/packages/boba/gateway/src/containers/bobaScope/styles.ts b/packages/boba/gateway/src/containers/bobaScope/styles.ts new file mode 100644 index 0000000000..3254df52cd --- /dev/null +++ b/packages/boba/gateway/src/containers/bobaScope/styles.ts @@ -0,0 +1,39 @@ +import styled, { css } from 'styled-components' +import { mobile, screen, sdesktop } from 'themes/screens' +import { Svg, Typography } from 'components/global' + +export const HistoryContainer = styled.div` + border-radius: 8px; + margin-bottom: 20px; +` + +export const Header = styled.div` + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + margin-bottom: 20px; +` + +export const BobaScopeContainer = styled.div` + margin: 0px auto; + display: flex; + flex-direction: column; + justify-content: space-around; + padding: 10px; + width: 70%; +` + +export const ContentContainer = styled.div` + display: flex; + flex-direction: column; + width: 100%; +` + +export const Content = styled.div` + display: flex; + flex-direction: column; + gap: 10px; + margin-bottom: 10px; + border-radius: 6px; +` diff --git a/packages/boba/gateway/src/containers/bridge/Bridge.styles.js b/packages/boba/gateway/src/containers/bridge/Bridge.styles.js index f4b337e86f..4408e3c0b0 100644 --- a/packages/boba/gateway/src/containers/bridge/Bridge.styles.js +++ b/packages/boba/gateway/src/containers/bridge/Bridge.styles.js @@ -1,6 +1,6 @@ import styled from '@emotion/styled' import {Box, Typography} from "@mui/material" -import bobaGlassIcon from 'images/boba2/boba_glass.svg' +import bobaGlassIcon from 'assets/images/boba2/boba_glass.svg' export const PageContainer = styled(Box)(({ theme }) => ({ margin: '20px auto', marginBottom: theme.palette.spacing.toFooter, diff --git a/packages/boba/gateway/src/containers/bridge/bobaBridge/bobaBridge.js b/packages/boba/gateway/src/containers/bridge/bobaBridge/bobaBridge.js index 1a042d0fc5..15a981f68d 100644 --- a/packages/boba/gateway/src/containers/bridge/bobaBridge/bobaBridge.js +++ b/packages/boba/gateway/src/containers/bridge/bobaBridge/bobaBridge.js @@ -35,30 +35,25 @@ import { selectBridgeTokens, selectMultiBridgeMode, selectActiveNetworkIcon, - selectActiveNetworkName, } from 'selectors' import { resetToken, setMultiBridgeMode } from 'actions/bridgeAction' import { setConnectETH, setConnectBOBA } from 'actions/setupAction' -import { L1_ICONS, L2_ICONS } from 'util/network/network.util' -import { DEFAULT_NETWORK, LAYER } from 'util/constant' +import { LAYER } from 'util/constant' import { AvailableBridges } from 'components' +import { ChainLabel } from 'components/bridge/ChainLabel' - -function BobaBridge() { +const BobaBridge = () => { const layer = useSelector(selectLayer()) const accountEnabled = useSelector(selectAccountEnabled()) const multibridgeMode = useSelector(selectMultiBridgeMode()) const tokens = useSelector(selectBridgeTokens()) - const networkName = useSelector(selectActiveNetworkName()) - const icon = useSelector(selectActiveNetworkIcon()) const userWallet = useSelector(selectWalletAddress()) - const L1Icon = L1_ICONS[icon] - const L2Icon = L2_ICONS[icon] + const dispatch = useDispatch() const [toL2, setToL2] = useState(true) @@ -73,7 +68,7 @@ function BobaBridge() { setToL2(isL1); }, [isL1]); - async function switchDirection() { + const switchDirection = async () => { if (accountEnabled) { if (isL1) dispatch(setConnectBOBA(true)) else dispatch(setConnectETH(true)) @@ -90,19 +85,7 @@ function BobaBridge() { await dispatch(multibridgeMode ? resetToken() : setMultiBridgeMode(!multibridgeMode)) } - const L1ChainLabel = () => { - return ( - - {networkName[ 'l1' ] || DEFAULT_NETWORK.NAME.L1} - ) - } - const L2ChainLabel = () => { - return ( - - {networkName[ 'l2' ] || DEFAULT_NETWORK.NAME.L2} - ) - } const ChainSwitchIcon = () => { return { - const config = () => ({ - from: toL2? : , - to: toL2? : - }); return ( <> @@ -141,7 +120,7 @@ function BobaBridge() { From - { config().from } + - { config().to } + diff --git a/packages/boba/gateway/src/containers/dao/OldDao.js b/packages/boba/gateway/src/containers/dao/OldDao.js index 9afbb7951e..c420906816 100644 --- a/packages/boba/gateway/src/containers/dao/OldDao.js +++ b/packages/boba/gateway/src/containers/dao/OldDao.js @@ -146,7 +146,9 @@ const OldDao = () => { }} > - BOBA: + + BOBA: + { - xBOBA: + + xBOBA: + ({ - margin: '0px auto', - marginBottom: theme.palette.spacing.toFooter, - display: 'flex', - flexDirection: 'column', - justifyContent: 'space-around', - padding: '10px', - paddingTop: '0px', - width: '70%', - gap: '10px', - [theme.breakpoints.between('md', 'lg')]: { - width: '90%', - padding: '0px', - }, - [theme.breakpoints.between('sm', 'md')]: { - width: '90%', - padding: '0px', - }, - [theme.breakpoints.down('sm')]: { - width: '100%', - padding: '0px', - }, +export const DaoPageContainer = styled.div` + margin: 0px auto; + display: flex; + flex-direction: column; + justify-content: space-around; + padding: 10px + padding-top: 0px; + width:100%; + max-width:1200px; + gap: '10px'; + ${mobile(css` + text-align: center; + overflow: hidden; + padding:0px 15px; + `)} +` -})); +export const DaoPageContent = styled.div` + display: flex; + flex-direction: row; + justify-content: center; + align-items: flex-start; + padding-top: 0px; + gap: 10px 35px; + ${tablet(css` + flex-direction: column; + padding:0px; + `)} +` -export const DaoPageContent = styled(Box)(({ theme }) => ({ - display: 'flex', - flexDirection: 'row', - justifyContent: 'center', - alignItems: 'flex-start', - paddingTop: '0px', - gap: '10px 35px', - [theme.breakpoints.down('sm')]: { - flexDirection: 'column' - }, -})); +export const DaoWalletContainer = styled.div` + display: 'flex'; + flex-direction: column; + padding: 0px 20px; + width: 30%; + min-width: 330px; + gap: 10px; + background: ${(props)=> props.theme.colors.box.background}; -export const DaoWalletContainer = styled(Box)(({ theme }) => ({ - display: 'flex', - flexDirection: 'column', - padding: '0px 20px', - width: '30%', - minWidth: '330px', - gap: '10px', - borderRadius: theme.palette.primary.borderRadius, - background: theme.palette.background.glassy, - [theme.breakpoints.down('sm')]: { - width: '100%', - }, -})); + ${tablet(css` + width: 100%; + `)} +` -export const VerticalDivisor = styled(Box)(({ theme }) => ({ - width:'1px', - background:"rgba(84, 84, 84, 1)", - height:'47px', - margin:'0px 50px' -})); +export const VerticalDivisor = styled.div` + width:1px; + background:rgba(84, 84, 84, 1); + height:47px; + margin:0px 50px; +` -export const DaoProposalContainer = styled(Box)(({ theme }) => ({ - width: '70%', - display: 'flex', - flexDirection: 'column', - justifyContent: 'flex-start', - padding: '0', - minHeight: '500px', - [theme.breakpoints.down('sm')]: { - width: '100%', - padding: '0 20px', - }, -})); +export const DaoProposalContainer = styled.div` + width: 70%; + display: flex; + flex-direction: column; + justify-content: flex-start; + padding: 0; + min-height: 500px; + ${tablet(css` + width: 100%; + padding:0px; + `)} -export const DaoProposalHead = styled(Box)(({ theme }) => ({ - display: 'flex', - alignItems: 'center', - alignSelf: 'flex-start', - justifyContent: 'space-between', - padding: '15px 0px', - width: '100%', - margin: '5px', - [theme.breakpoints.down('sm')]: { - padding: '0px', - }, -})) +` -export const DaoProposalListContainer = styled(Box)(({ theme }) => ({ - display:'flex', - flexDirection:'column', - margin: '10px auto', - borderRadius: '8px', - padding: '20px 0px 20px 0px', - width: '100%', - gap:'10px 0px', - '.loadingContainer' : { +export const DaoProposalHead = styled.div` + display: flex; + align-items: center; + align-self: flex-start; + justify-content: space-between; + padding: 15px 0px; + width: 100%; + margin: 5px; + ${mobile(css` + padding:0px; + `)} +` + +export const DaoProposalListContainer = styled.div` + display:flex; + flex-direction:column; + margin: 10px auto; + border-radius: 8px; + padding: 20px 0px 20px 0px; + width: 100%; + gap:10px 0px; + + .loadingContainer { padding: '10px auto', - }, - [theme.breakpoints.down('sm')]: { - padding: '0px', - }, -})) + }; + + ${mobile(css` + padding: 0px; + `)} +` -export const DaoWalletAction = styled(Box)(({ theme }) => ({ - display: 'flex', - justifyContent: 'space-around', - width: '100%', -})); +export const DaoWalletAction = styled.div` + display: flex; + justify-content: space-around; + width: 100%; +` diff --git a/packages/boba/gateway/src/containers/earn/Earn.js b/packages/boba/gateway/src/containers/earn/Earn.js index d799756d29..9887f84780 100644 --- a/packages/boba/gateway/src/containers/earn/Earn.js +++ b/packages/boba/gateway/src/containers/earn/Earn.js @@ -19,7 +19,6 @@ import React, { useState, useEffect } from 'react' import { useDispatch, useSelector } from 'react-redux'; -import { Box, FormControlLabel, Checkbox, Typography, useMediaQuery, useTheme } from '@mui/material' import { HelpOutline } from '@mui/icons-material' import { @@ -44,21 +43,22 @@ import LayerSwitcher from 'components/mainMenu/layerSwitcher/LayerSwitcher' import networkService from 'services/networkService' -import * as S from './Earn.styles' -import * as G from 'containers/Global.styles' +import * as S from './styles' import { fetchBalances } from 'actions/networkAction'; import { TableHeader } from 'components/global/table' +import { CheckboxWithLabel } from 'components/global/checkbox' +import { tableHeaderOptions } from './consts' +import { Typography } from 'components/global/typography' +import { toLayer } from './types' -function Earn() { - const [showMDO, setShowMDO] = useState(false) - const [showMSO, setShowMSO] = useState(false) - const [lpChoice, setLpChoice] = useState(networkService.L1orL2 === 'L1' ? 'L1LP' : 'L2LP') - const [poolTab, setPoolTab] = useState(networkService.L1orL2 === 'L1' ? 'Ethereum Pool' : 'Boba L2 Pool') +import { BridgeTooltip } from './tooltips' +const Earn = () => { const dispatch = useDispatch(); - const theme = useTheme(); - const isMobile = useMediaQuery(theme.breakpoints.down('md')); + + const activeNetworkName = useSelector(selectActiveNetworkName()) + const layer = useSelector(selectLayer()) const userInfo = useSelector(selectUserInfo()) const poolInfo = useSelector(selectPoolInfo()) @@ -68,9 +68,25 @@ function Earn() { const baseEnabled = useSelector(selectBaseEnabled()) const accountEnabled = useSelector(selectAccountEnabled()) - const layer = useSelector(selectLayer()) - const activeNetworkName = useSelector(selectActiveNetworkName()) + const [showMDO, setShowMDO] = useState(false) + const [showMSO, setShowMSO] = useState(false) + const [lpChoice, setLpChoice] = useState( + networkService.L1orL2 === 'L1' ? 'L1LP' : 'L2LP' + ) + + const isLp1 = lpChoice === 'L1LP'; + const isLp2 = lpChoice === 'L2LP'; + + const [poolTab, setPoolTab] = useState( + activeNetworkName[layer?.toLowerCase()] + ) + + useEffect(()=> { + setPoolTab(activeNetworkName[layer?.toLowerCase()]) + }, [layer, networkService]) + + useEffect(() => { if (baseEnabled) { dispatch(getEarnInfo()) @@ -82,154 +98,118 @@ function Earn() { }, [dispatch, baseEnabled, accountEnabled]) - function getBalance(address, chain) { - const tokens = chain === 'L1' ? Object.values(layer1Balance) : chain === 'L2' ? Object.values(layer2Balance) : [] + const getBalance = (address, chain) => { + const tokens = + chain === 'L1' + ? Object.values(layer1Balance) + : chain === 'L2' + ? Object.values(layer2Balance) + : [] const token = tokens.find(t => t.address.toLowerCase() === address.toLowerCase()) return token ? [token.balance, token.decimals] : [0, 0] } - const tableHeaderOptions = [ - {name:'Token', width:225}, - {name:'Available Balance', tooltip: 'Available Balance refers to the amount of funds currently in each pool.',width:145}, - {name:'Total Staked', tooltip: 'Total staked denotes the funds staked by liquidity providers.', width:115}, - {name:'APR', tooltip: 'The APR is the historical APR, which reflects the fees people paid to bridge and the previous usage patterns for each pool.',width:85}, - {name:'Your Stake',width:90}, - {name:'Earned',width:110}, - ] const selectedPoolInfo = lpChoice === 'L1LP' ? poolInfo.L1LP : poolInfo.L2LP; - const selectedNetworkConfig = lpChoice === 'L1LP' ? networkService?.networkConfig?.L1?.chainIdHex : networkService?.networkConfig?.L2?.chainIdHex; + const selectedNetworkConfig = + lpChoice === 'L1LP' + ? networkService?.networkConfig?.L1?.chainIdHex + : networkService?.networkConfig?.L2?.chainIdHex + + useEffect(()=>{ + setLpChoice(networkService.L1orL2 === 'L1' ? 'L1LP' : 'L2LP') + },[networkService.L1orL2]) return ( - {((layer === 'L2' && lpChoice === 'L1LP') || (layer === 'L1' && lpChoice === 'L2LP')) && ( + {((layer === 'L2' && isLp1) || (layer === 'L1' && isLp2)) && ( - You are on {layer}. To transact on {layer === 'L1' ? 'L2' : 'L1'}, SWITCH LAYER to {layer === 'L1' ? 'L2' : 'L1'} + You are on {layer}. To transact on {toLayer[layer]}, SWITCH LAYER to {toLayer[layer]} )} - +
- - + { setLpChoice('L1LP') - setPoolTab('Ethereum Pool') - }} - variant="body2" - component="span"> - {activeNetworkName['l1']} Pools - - + {activeNetworkName['l1']} Pools + + { setLpChoice('L2LP') - setPoolTab('Boba L2 Pool') - }} - variant="body2" - component="span"> - {activeNetworkName['l2']} Pools - - + setPoolTab(activeNetworkName['l2']) + }}> + {activeNetworkName['l2']} Pools + + - setShowMDO(e.target.checked)} - name="my tokens only" - color="primary" - icon={} - /> - } - label="My Tokens Only" - /> - setShowMSO(e.target.checked)} - name="my stakes only" - color="primary" - icon={} - /> - } + setShowMSO(status)} /> - - Bridging fees are proportionally distributed to stakers. The bridges are not farms. - Your earnings only increase when someone uses the bridge you have staked into. + Bridging fees are proportionally distributed to stakers. The bridges + are not farms. Your earnings only increase when someone uses the + bridge you have staked into. - - Staking example. When you stake 10 OMG into the L2 pool, then the pool's liquidity and balance both increase by 10 OMG. -

- Fast Bridge example. When a user bridges 10 OMG from L1 to L2 using the fast bridge, - they send 10 OMG to the L1 pool, increasing its balance by 10 OMG. Next, 9.99 OMG flow out from the L2 pool to the user's L2 wallet, completing the bridge. - Note that bridge operations do not change the pool's liquidity, but only its balance. - The difference between what was deposited into the L1 pool (10 OMG) and what was sent - to the user on the L2 (9.99 OMG), equal to 0.01 OMG, is sent to the reward pool, for harvesting by stakers. -

- Pool rebalancing. In some circumstances, excess balances can accumulate on one chain. For example, if many people - bridge from L1 to L2, then L1 pool balances will increase, while L2 balances will decrease. When needed, the pool operator can - rebalance the pools, using 'classic' deposit and exit operations to move funds from one pool to another. Rebalancing takes 7 days, due to the - 7 day fraud proof window, which also applies to the operator. -

- Dynamic fees. The pools use an automatic supply-and-demand approach to setting the fees. - When a pool's liquidity is low, the fees are increased to attract more liquidity into that pool and vice-versa. - - } - > + }>
- { !isMobile && ( - ) - } + {Object.keys(selectedPoolInfo).map((v, i) => { const ret = getBalance(v, lpChoice === 'L1LP' ? 'L1' : 'L2'); - if (showMDO && Number(ret[0]) === 0) return null; + if (showMDO && Number(ret[0]) === 0) { + return null + } return ( ); })} - +
) } diff --git a/packages/boba/gateway/src/containers/earn/Earn.styles.js b/packages/boba/gateway/src/containers/earn/Earn.styles.js deleted file mode 100644 index 26be8518f8..0000000000 --- a/packages/boba/gateway/src/containers/earn/Earn.styles.js +++ /dev/null @@ -1,189 +0,0 @@ -import { styled } from '@mui/material/styles' -import { Box, Typography, Grid } from "@mui/material" - -export const EarnPageContainer = styled(Box)(({ theme }) => ({ - margin: '0px auto', - marginBottom: theme.palette.spacing.toFooter, - display: 'flex', - flexDirection: 'column', - justifyContent: 'space-around', - padding: '10px', - paddingTop: '0px', - width: '70%', - [theme.breakpoints.between('md', 'lg')]: { - width: '90%', - padding: '0px', - }, - [theme.breakpoints.between('sm', 'md')]: { - width: '90%', - padding: '0px', - }, - [theme.breakpoints.down('sm')]: { - width: '100%', - padding: '0px', - }, -})) - -export const TableHeading = styled(Box)(({ theme }) => ({ - padding: "20px", - borderTopLeftRadius: "6px", - borderTopRightRadius: "6px", - display: "flex", - alignItems: "center", - background: theme.palette.background.secondary, - [theme.breakpoints.down('md')]: { - marginBottom: "5px", - }, -})) - -export const LayerAlert = styled(Box)(({ theme }) => ({ - width: "100%", - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - gap: '30px', - borderRadius: '8px', - margin: '20px 0px', - padding: '25px', - background: theme.palette.background.glassy, - [theme.breakpoints.up('md')]: { - padding: '25px 50px', - }, -})) - -export const Help = styled(Box)(({ theme }) => ({ - width: "100%", - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - gap: '30px', - margin: '10px 0px', - padding: '10px', - borderRadius: theme.palette.primary.borderRadius, - background: theme.palette.background.glassy, -})) - -export const AlertText = styled(Typography)(({ theme }) => ({ - marginLeft: '10px', - flex: 4, - [theme.breakpoints.up('md')]: { - }, -})) - -export const AlertInfo = styled(Box)` - display: flex; - justify-content: space-around; - align-items: center; - flex: 1; -`; - -export const Wrapper = styled(Box)(({ theme, ...props }) => ({ - borderRadius: '8px', - // background: props.dropDownBox ? theme.palette.background.dropdown : theme.palette.background.secondary, - [theme.breakpoints.down('md')]: { - padding: ' 30px 10px', - }, - [theme.breakpoints.up('md')]: { - padding: '20px', - }, -})) - -export const GridItemTagContainer = styled(Grid)(({ theme, ...props }) => ({ - spacing: 2, - flexDirection: 'row', - justifyContent: "left", - alignItems: "center", - [theme.breakpoints.down('md')]: { - flexDirection: 'column' - } -})); - -export const GridItemTag = styled(Grid)` - display: flex; - flex-direction: row; - align-items: center; - gap:5px; -`; - -export const EarnAction = styled(Box)(({theme})=>({ - display: 'flex', - justifyContent: 'space-around', - alignItems: 'center', - [theme.breakpoints.down('md')]: { - width: '100%' - } -})) - -export const EarnActionContainer = styled(Box)(({ theme }) => ({ - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - [theme.breakpoints.down('md')]: { - flexDirection: 'column' - } -})) - -export const EarnListContainer = styled(Box)(({theme})=>({ - [theme.breakpoints.down('md')]: { - display: 'flex', - flexDirection: 'column', - gap: '5px' - } -})) - -export const BpIcon = styled('span')(({ theme }) => ({ - borderRadius: 3, - width: 16, - height: 16, - boxShadow: - theme.palette.mode === 'dark' - ? '0 0 0 1px rgb(16 22 26 / 40%)' - : 'inset 0 0 0 1px rgba(16,22,26,.2), inset 0 -1px 0 rgba(16,22,26,.1)', - backgroundColor: theme.palette.mode === 'dark' ? '#394b59' : '#f5f8fa', - backgroundImage: - theme.palette.mode === 'dark' - ? 'linear-gradient(180deg,hsla(0,0%,100%,.05),hsla(0,0%,100%,0))' - : 'linear-gradient(180deg,hsla(0,0%,100%,.8),hsla(0,0%,100%,0))', - '.Mui-focusVisible &': { - outline: '2px auto rgba(19,124,189,.6)', - outlineOffset: 2, - }, - 'input:hover ~ &': { - backgroundColor: theme.palette.mode === 'dark' ? '#30404d' : '#ebf1f5', - }, - 'input:disabled ~ &': { - boxShadow: 'none', - background: - theme.palette.mode === 'dark' ? 'rgba(57,75,89,.5)' : 'rgba(206,217,224,.5)', - }, -})) - -export const PageSwitcher = styled(Box)(({ theme }) => ({ - width: 'fit-content', - padding: '3px', - background: theme.palette.mode === 'light' ? 'rgba(3, 19, 19, 0.04)': 'rgba(255, 255, 255, 0.04)', - cursor: 'pointer', - display: 'flex', - borderRadius: '12px', - height: '48px', - 'span': { - padding: '2px 15px', - fontWeight: 'bold', - borderRadius: '12px', - display: 'flex', - justifyContent: 'center', - alignItems: 'center', - '&.active': { - color: '#031313', - background: '#BAE21A', - } - }, - [ theme.breakpoints.down('sm') ]: { - width: '100%', - padding: '0px', - 'span': { - width: '50%' - } - }, - -})); diff --git a/packages/boba/gateway/src/containers/earn/EarnWrapper.js b/packages/boba/gateway/src/containers/earn/EarnWrapper.js index 3f838b4a76..55ad52b047 100644 --- a/packages/boba/gateway/src/containers/earn/EarnWrapper.js +++ b/packages/boba/gateway/src/containers/earn/EarnWrapper.js @@ -2,8 +2,9 @@ import { useMediaQuery, useTheme } from '@mui/material'; import React from 'react'; import Earn from './Earn'; -export default function EarnWrapper({ ...rest }) { +const EarnWrapper = ({ ...rest }) => { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('md')); return ; } +export default EarnWrapper; \ No newline at end of file diff --git a/packages/boba/gateway/src/containers/earn/consts.ts b/packages/boba/gateway/src/containers/earn/consts.ts new file mode 100644 index 0000000000..8e6bfb24e7 --- /dev/null +++ b/packages/boba/gateway/src/containers/earn/consts.ts @@ -0,0 +1,36 @@ +import { tabSwitcherTypes } from './types' + +export const TabSwitcherEnum: tabSwitcherTypes = { + L1LP: { + name: 'L1LP', + tab: 'Ethereum Pool', + }, + L2LP: { + name: 'L2LP', + tab: 'Boba L2 Pool', + }, +} + +export const tableHeaderOptions = [ + { name: 'Token', width: 225 }, + { + name: 'Available Balance', + tooltip: + 'Available Balance refers to the amount of funds currently in each pool.', + width: 145, + }, + { + name: 'Total Staked', + tooltip: 'Total staked denotes the funds staked by liquidity providers.', + width: 115, + }, + { + name: 'APR', + tooltip: + 'The APR is the historical APR, which reflects the fees people paid to bridge and the previous usage patterns for each pool.', + width: 85, + }, + { name: 'Your Stake', width: 90 }, + { name: 'Earned', width: 110 }, + { name: 'Actions', width: 75 }, +] diff --git a/packages/boba/gateway/src/containers/earn/styles.ts b/packages/boba/gateway/src/containers/earn/styles.ts new file mode 100644 index 0000000000..0210dfc134 --- /dev/null +++ b/packages/boba/gateway/src/containers/earn/styles.ts @@ -0,0 +1,147 @@ +import styled, { css } from 'styled-components' +import { Typography } from 'components/global/typography' + +export const EarnPageContainer = styled.div` + margin: 0px auto; + display: flex; + flex-direction: column; + justify-content: space-around; + padding: 10px; + padding-top: 0px; + width: 1025px; +` + +export const TableHeading = styled.div` + padding: 20px, + border-radius: 6px 6px 0 0; + display: flex; + align-items: center; + background: ${(props) => props.theme.colors.box.background}; +` + +export const LayerAlert = styled.div` + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + gap: 30px; + border-radius: 8px; + margin: 20px 0px; + padding: 25px; + background: ${(props) => props.theme.colors.box.background}; +` + +export const Help = styled.div` + width: 100%; + display: flex; + justify-content: space-between; + align-items: center; + gap: 30px; + margin: 10px 0px; + padding: 10px; + border-radius: 8px; + background: ${(props) => props.theme.colors.box.background}; +` + +export const AlertText = styled(Typography)` + margin-left: 10px; + flex: 4; +` + +export const AlertInfo = styled.div` + display: flex; + justify-content: space-around; + align-items: center; + flex: 1; +` + +export const Wrapper = styled.div` + border-radius: 8px; +` + +export const GridItemTagContainer = styled.div` + spacing: 2, + flex-direction: row; + justify-content: left; + align-items: center; +` + +export const GridItemTag = styled.div` + display: flex; + flex-direction: row; + align-items: center; + gap: 5px; +` + +export const EarnAction = styled.div` + display: flex; + justify-content: space-around; + align-items: center; +` + +export const EarnActionContainer = styled.div` + display: flex; + justify-content: space-between; + align-items: center; +` + +export const EarnListContainer = styled.div` + display: flex; + flex-direction: column; + gap: 10px 0px; + padding: 10px 0px; +` + +export const BpIcon = styled.span` + border-radius: 3; + width: 16; + height: 16; +` + +export const PageSwitcher = styled.div` + width: fit-content; + padding: 3px; + cursor: pointer; + display: flex; + border-radius: 12px; + height: 48px; + span { + padding: 2px 15px; + font-weight: bold; + border-radius: 12px; + display: flex; + justify-content: center; + align-items: center; + &.active { + color: #031313; + background: #bae21a; + } + } +` + +export const TabSwitcherContainer = styled.div` + display: flex; + padding: 4px; + gap: 0px 15px; + border-radius: 8px; + ${({ theme: { colors, name } }) => + name === 'light' + ? css` + background: ${colors.gray[50]}; + ` + : css` + background: ${colors.gray[500]}; + `} +` + +export const Tab = styled.div<{ active: boolean }>` + padding: 8px 24px; + border-radius: 8px; + cursor: pointer; + ${(props) => + props.active && + ` + color:${props.theme.colors.gray[800]}; + background:${props.theme.colors.green[300]} + `} +` diff --git a/packages/boba/gateway/src/containers/earn/tooltips.tsx b/packages/boba/gateway/src/containers/earn/tooltips.tsx new file mode 100644 index 0000000000..72ab532b85 --- /dev/null +++ b/packages/boba/gateway/src/containers/earn/tooltips.tsx @@ -0,0 +1,35 @@ +import React from 'react' +import { Typography } from 'components/global/typography' + +export const BridgeTooltip = () => ( + + Staking example. When you stake + 10 BOBA into the L2 pool, then the pool's liquidity and balance both + increase by 10 BOBA. +
+
+ Fast Bridge example. When a user + bridges 10 BOBA from L1 to L2 using the fast bridge, they send 10 BOBA to + the L1 pool, increasing its balance by 10 BOBA. Next, 9.99 BOBA flow out + from the L2 pool to the user's L2 wallet, completing the bridge. Note that + bridge operations do not change the pool's liquidity, but only its balance. + The difference between what was deposited into the L1 pool (10 BOBA) and + what was sent to the user on the L2 (9.99 BOBA), equal to 0.01 BOBA, is sent + to the reward pool, for harvesting by stakers. +
+
+ Pool rebalancing. In some + circumstances, excess balances can accumulate on one chain. For example, if + many people bridge from L1 to L2, then L1 pool balances will increase, while + L2 balances will decrease. When needed, the pool operator can rebalance the + pools, using 'classic' deposit and exit operations to move funds from one + pool to another. Rebalancing takes 7 days, due to the 7 day fraud proof + window, which also applies to the operator. +
+
+ Dynamic fees. The pools use an + automatic supply-and-demand approach to setting the fees. When a pool's + liquidity is low, the fees are increased to attract more liquidity into that + pool and vice-versa. +
+) diff --git a/packages/boba/gateway/src/containers/earn/types.ts b/packages/boba/gateway/src/containers/earn/types.ts new file mode 100644 index 0000000000..363d49a570 --- /dev/null +++ b/packages/boba/gateway/src/containers/earn/types.ts @@ -0,0 +1,14 @@ +type poolDetail = { + name: string + tab: string +} + +export type tabSwitcherTypes = { + L1LP: poolDetail + L2LP: poolDetail +} + +export enum toLayer { + L1 = 'L2', + L2 = 'L1', +} diff --git a/packages/boba/gateway/src/containers/history/DatePicker.tsx b/packages/boba/gateway/src/containers/history/DatePicker.tsx new file mode 100644 index 0000000000..98c53df48d --- /dev/null +++ b/packages/boba/gateway/src/containers/history/DatePicker.tsx @@ -0,0 +1,132 @@ +import React, { useRef, useState, useEffect, useCallback } from 'react' +import { subMonths } from 'date-fns' +import { + DatePickerDropdown, + DatePickerHeader, + DatePickerContainer, +} from './styles' +import { formatDate } from 'util/dates' +import { DayPicker, DateRange } from 'react-day-picker' +import 'react-day-picker/dist/style.css' + +export interface IDatePickerProps { + selected: Date + timeFormat?: string + onChange: Function + minDate?: Date + maxDate?: Date + range?: boolean + onChangeFrom?: Function + onChangeTo?: Function +} + +const DatePicker = (props: IDatePickerProps) => { + const dropdownRef = useRef(null) + useEffect(() => { + const handleClickOutside = (e: Event) => { + if ( + dropdownRef.current && + !dropdownRef.current.contains(e.target as Node) + ) { + setIsOpen(false) + } + } + // Bind the event listener + document.addEventListener('mousedown', handleClickOutside) + return () => { + // Unbind the event listener on clean up + document.removeEventListener('mousedown', handleClickOutside) + } + }, [dropdownRef]) + + const [selectedDate, setSelectedDate] = useState(props.selected) + const today = new Date() + const pastDate = new Date(2015, 7, 30) + + const disabledPeriod = { + before: props.minDate ? props.minDate : pastDate, + after: props.maxDate ? props.maxDate : today, + } + const disabledDays = [disabledPeriod] + + const [isOpen, setIsOpen] = useState(false) + + const defaultSelectedRange: DateRange = { + from: subMonths(today, 6), + to: today, + } + const [selectedRange, setSelectedRange] = useState( + defaultSelectedRange + ) + + const handleClick = useCallback(() => { + setIsOpen(!isOpen) + }, [isOpen]) + + const handleDateChange = (date: Date | undefined) => { + if (date && selectedDate !== date) { + setSelectedDate(date) + props.onChange(date) + } + } + const handleRangeChange = (range: DateRange | undefined) => { + if (range && range !== selectedRange) { + setSelectedRange(range) + props.onChangeFrom && props.onChangeFrom(range.from) + props.onChangeTo && props.onChangeTo(range.to) + } + } + + if (props.range) { + const dateRangeString = `${ + selectedRange?.from + ? formatDate(selectedRange?.from?.getTime() / 1000, props.timeFormat) + : 'From' + } - ${ + selectedRange?.to + ? formatDate(selectedRange?.to?.getTime() / 1000, props.timeFormat) + : 'To' + }` + + return ( + + + {dateRangeString} + + {isOpen && ( + + handleRangeChange(range)} + disabled={disabledDays} + /> + + )} + + ) + } + + return ( + + + {formatDate(selectedDate.getTime() / 1000, props.timeFormat)} + + {isOpen && ( + + handleDateChange(date)} + disabled={disabledDays} + /> + + )} + + ) +} + +export default DatePicker diff --git a/packages/boba/gateway/src/containers/history/History.js b/packages/boba/gateway/src/containers/history/History.js deleted file mode 100644 index c6fe04a0f9..0000000000 --- a/packages/boba/gateway/src/containers/history/History.js +++ /dev/null @@ -1,213 +0,0 @@ -/* -Copyright 2021-present Boba Network. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -import React, { useState } from 'react' -import { useDispatch } from 'react-redux' -import { isEqual,orderBy } from 'util/lodash'; - -import { useSelector } from 'react-redux' -import DatePicker from 'react-datepicker' -import 'react-datepicker/dist/react-datepicker.css' - -import { useMediaQuery, useTheme } from '@mui/material' -import {isSameOrAfterDate, isSameOrBeforeDate} from 'util/dates' -import Input from 'components/input/Input' - -import { setActiveHistoryTab } from 'actions/uiAction' -import { - selectActiveHistoryTab, - selectTransactions, - selectAccountEnabled, - selectLayer -} from 'selectors' - -import { fetchTransactions } from 'actions/networkAction' - -import Exits from './TX_Exits' -import Deposits from './TX_Deposits' -import All from './TX_All' -import Pending from './TX_Pending' -import Transfers from './TX_Transfers' - -import * as S from './History.styles' -import styles from './TX_All.module.scss' - -import useInterval from 'hooks/useInterval' -import Connect from 'containers/connect/Connect' -import Tabs from 'components/tabs/Tabs' - -import { POLL_INTERVAL } from 'util/constant' -import { selectActiveNetworkName } from 'selectors' - -function History() { - - const theme = useTheme() - const isMobile = useMediaQuery(theme.breakpoints.down('md')) - - const dispatch = useDispatch() - - const now = new Date() - const last_6months = new Date( - now.getFullYear(), - now.getMonth() - 6, - now.getDate() - ) - - const [startDate, setStartDate] = useState(last_6months) - const [endDate, setEndDate] = useState(now) - const layer = useSelector(selectLayer()) - const accountEnabled = useSelector(selectAccountEnabled()) - - const [searchHistory, setSearchHistory] = useState('') - const activeTab = useSelector(selectActiveHistoryTab, isEqual) - const networkName = useSelector(selectActiveNetworkName()) - - const unorderedTransactions = useSelector(selectTransactions, isEqual) - const orderedTransactions = orderBy( - unorderedTransactions, - (i) => i.timeStamp, - 'desc' - ) - - const transactions = orderedTransactions.filter((i) => { - if (startDate && endDate) { - return ( - isSameOrAfterDate(i.timeStamp, startDate) && - isSameOrBeforeDate(i.timeStamp,endDate) - ) - } - return true - }) - - useInterval(() => { - if (accountEnabled) { - dispatch(fetchTransactions()) - } - }, POLL_INTERVAL) - - return ( - - - - - {layer && ( - <> - -
- { - setSearchHistory(i.target.value) - }} - className={styles.searchBar} - /> -
-
- {!isMobile ? ( -
- Show period from -
- ) : null} - setStartDate(date)} - selectsStart - endDate={new Date(endDate)} - maxDate={new Date(endDate)} - calendarClassName={theme.palette.mode} - placeholderText={isMobile ? 'From' : ''} - /> - {!isMobile ? ( -
to
- ) : null} - setEndDate(date)} - selectsEnd - startDate={new Date(startDate)} - minDate={new Date(startDate)} - calendarClassName={theme.palette.mode} - placeholderText={isMobile ? 'To' : ''} - /> -
-
-
-
- { - dispatch(setActiveHistoryTab(tab)) - }} - activeTab={activeTab} - tabs={[ - 'All', - `${networkName['l1']} to ${networkName['l2']}`, - `${networkName['l2']} to ${networkName['l1']}`, - 'Bridge between L1s', - 'Pending', - ]} - /> - - {activeTab === 'All' && ( - - )} - - {activeTab === `${networkName['l1']} to ${networkName['l2']}` && ( - - )} - - {activeTab === `${networkName['l2']} to ${networkName['l1']}` && ( - - )} - - {activeTab === 'Bridge between L1s' && ( - - )} - - {activeTab === 'Pending' && ( - - )} -
-
- - )} -
- ) -} - -export default React.memo(History) diff --git a/packages/boba/gateway/src/containers/history/History.styles.js b/packages/boba/gateway/src/containers/history/History.styles.js deleted file mode 100644 index ec3cdbb228..0000000000 --- a/packages/boba/gateway/src/containers/history/History.styles.js +++ /dev/null @@ -1,86 +0,0 @@ -import styled from '@emotion/styled' -import { Box } from '@mui/material' - -export const HistoryContainer = styled.div` - background: ${props => props.theme.palette.background.glassy}; - border-radius: 8px; - margin-bottom: 20px; -`; - -export const HistoryPageContainer = styled(Box)(({ theme }) => ({ - margin: '0px auto', - marginBottom: theme.palette.spacing.toFooter, - display: 'flex', - flexDirection: 'column', - justifyContent: 'space-around', - padding: '10px', - paddingTop: '0px', - width: '70%', - [theme.breakpoints.between('md', 'lg')]: { - width: '90%', - padding: '0px', - }, - [theme.breakpoints.between('sm', 'md')]: { - width: '90%', - padding: '0px', - }, - [theme.breakpoints.down('sm')]: { - width: '100%', - padding: '0px', - }, -})) - -export const Disclaimer = styled.div` - margin: 5px 10px; - margin-top: 20px; -`; - -export const Content = styled(Box)(({ theme }) => ({ - display: 'flex', - flexDirection: 'column', - gap: '5px', - marginBottom: '10px', - padding: '10px 20px', - borderRadius: '6px' -})); - -export const Header = styled(Box)(({ theme }) => ({ - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - marginBottom: '20px', - [theme.breakpoints.down('md')]: { - flexDirection: 'column', - alignItems: 'flex-start', - gap: '20px', - }, -})) - -export const TableHeading = styled(Box)(({ theme }) => ({ - padding: "20px", - borderTopLeftRadius: "6px", - borderTopRightRadius: "6px", - display: "flex", - alignItems: "center", - background: theme.palette.background.secondary, - [theme.breakpoints.down('md')]: { - marginBottom: "5px", - }, -})) - -export const LayerAlert = styled(Box)(({ theme }) => ({ - width: "100%", - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - gap: '30px', - borderRadius: '8px', - margin: '20px 0px', - padding: '25px', - background: theme.palette.background.secondary, - [theme.breakpoints.up('md')]: { - padding: '25px 50px', - }, - -})); diff --git a/packages/boba/gateway/src/containers/history/History.tsx b/packages/boba/gateway/src/containers/history/History.tsx new file mode 100644 index 0000000000..5616b17acc --- /dev/null +++ b/packages/boba/gateway/src/containers/history/History.tsx @@ -0,0 +1,276 @@ +/* +Copyright 2021-present Boba Network. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +import React, { useState } from 'react' +import { useDispatch, useSelector } from 'react-redux' +import { isEqual } from 'util/lodash' +import { ValidValuesFromArray } from 'util/objectManipulation' + +import { useTheme } from 'styled-components' + +import { Button } from 'components/global' + +import transctionService from 'services/transaction.service' +import { NETWORK_TYPE } from 'util/network/network.util' +import { + ALL_NETWORKS, + FILTER_OPTIONS, + NETWORK_L1_OPTIONS, + NETWORK_L2_OPTIONS, + TableOptions, +} from './constants' + +import { + selectAccountEnabled, + selectLayer, + selectTransactions, +} from 'selectors' + +import { fetchTransactions } from 'actions/networkAction' + +import { + Table, + NoHistory, + HistoryPageContainer, + TableHeader, + TableFilters, + NetworkDropdowns, + DateDescriptions, + SwitchChainIcon, + SwitchIcon, + TableTransactionsContainer, + DatePickerWrapper, + DropdownNetwork, + MobileDateDescriptions, + MobileDatePickerWrapper, +} from './styles' + +import { setConnect } from 'actions/setupAction' +import useInterval from 'hooks/useInterval' + +import { POLL_INTERVAL } from 'util/constant' + +import FilterIcon from 'assets/images/filter.svg' +import noHistoryIcon from 'assets/images/noHistory.svg' +import { FilterDropDown } from 'components/filter' +import { Svg } from 'components/global/svg' +import { TransactionsTableHeader } from 'components/global/table/themes' +import { TransactionsResolver } from './TransactionsResolver' +import { CHAIN_NAME, TRANSACTION_FILTER_STATUS } from './types' +import { SearchInput } from 'components/global/searchInput' + +import { Typography } from 'components/global/typography' +import DatePicker from './DatePicker' + +const History = () => { + const [toNetwork, setToNetwork] = useState(ALL_NETWORKS) + const [fromNetwork, setFromNetwork] = useState(ALL_NETWORKS) + const [transactionsFound, setTransactionsFound] = useState(true) + const [switched, setSwitched] = useState(false) + + const theme: any = useTheme() + + const dispatch = useDispatch() + + const now = new Date() + const last_6months = new Date( + now.getFullYear(), + now.getMonth() - 6, + now.getDate() + ) + const handleSwitchDropdowns = () => { + const temp = fromNetwork + setFromNetwork(toNetwork) + setToNetwork(temp) + setSwitched((current) => !current) + } + + const [filterStartDate, setFilterStartDate] = useState(last_6months) + const [transactionStatus, setTransactionStatus] = useState('All') + const [filterEndDate, setFilterEndDate] = useState(now) + const layer = useSelector(selectLayer()) + const accountEnabled = useSelector(selectAccountEnabled()) + + const [searchHistory, setSearchHistory] = useState('') + + const transactions = useSelector(selectTransactions, isEqual) + + // TODO: not working as implementation needs be rewrite. + const getDatePicker = (label: string, range: boolean = false) => { + const dateSelector = (date: Date) => { + label === 'To' ? setFilterEndDate(date) : setFilterStartDate(date) + } + return ( + + date && !Array.isArray(date) && dateSelector(date) + } + timeFormat="MM/DD/YYYY" + range={range} + {...(range + ? { onChangeFrom: setFilterStartDate, onChangeTo: setFilterEndDate } + : {})} + {...(label === 'To' + ? { minDate: filterStartDate } + : { maxDate: filterEndDate })} + /> + ) + } + const syncTransactions = async () => { + if (accountEnabled) { + const newTransactions = await transctionService.getTransactions() + if (newTransactions.length === 0) { + setTransactionsFound(false) + } else { + setTransactionsFound(true) + } + if ( + new Set(ValidValuesFromArray(transactions)).size !== + new Set(newTransactions).size + ) { + dispatch(fetchTransactions()) + } + } + } + + useInterval(async () => { + await syncTransactions() + }, POLL_INTERVAL) + + return ( + + {layer && ( + <> + + { + setSearchHistory(i.target.value) + }} + /> + + + Date Range From + + {getDatePicker('From')} + To + {getDatePicker('To')} + + + + Date Range + + {getDatePicker('', true)} + + + + +
+ + + From + setFromNetwork(option)} + error={false} + headers={[NETWORK_TYPE.MAINNET, NETWORK_TYPE.TESTNET]} + /> + { + handleSwitchDropdowns() + }} + > + + + To + setToNetwork(option)} + error={false} + headers={[NETWORK_TYPE.MAINNET, NETWORK_TYPE.TESTNET]} + /> + + { + setTransactionStatus(item.value) + }} + error={false} + /> + +
+ + + {transactionsFound && ( + + )} + +
+ + )} + {!transactionsFound && ( + + +
No Transactions Found.
+
+ )} + {!layer && ( + + +
No History.
+ - - - - } - - {stakeValueValid && allowanceGTstake && - <> - {stakeToken.symbol !== netLayerNativeToken && - - Your allowance has been approved. You can now stake your funds. - - } - - - - - - } + ) } @@ -401,4 +411,4 @@ const mapStateToProps = state => ({ setup: state.setup, }) -export default connect(mapStateToProps)(EarnDepositModal) +export default connect(mapStateToProps)(EarnDepositModal) \ No newline at end of file diff --git a/packages/boba/gateway/src/containers/modals/earn/EarnWithdrawModal.js b/packages/boba/gateway/src/containers/modals/earn/EarnWithdrawModal.js index c9b10715ac..29da319981 100644 --- a/packages/boba/gateway/src/containers/modals/earn/EarnWithdrawModal.js +++ b/packages/boba/gateway/src/containers/modals/earn/EarnWithdrawModal.js @@ -3,19 +3,32 @@ import { connect } from 'react-redux' import { isEqual } from 'util/lodash'; import { closeModal, openAlert } from 'actions/uiAction' -import { fetchL1LPBalance, fetchL2LPBalance, getEarnInfo } from 'actions/earnAction' +import { + fetchL1LPBalance, + fetchL2LPBalance, + getEarnInfo, +} from 'actions/earnAction' -import Button from 'components/button/Button' import Modal from 'components/modal/Modal' -import Input from 'components/input/Input' import { logAmount, toWei_String } from 'util/amountConvert' -import { Typography } from '@mui/material' import { WrapperActionsModal } from 'components/modal/styles' import BN from 'bignumber.js' import { withdrawLiquidity } from 'actions/networkAction' +import { MaxInput } from 'components/global/InputMax' +import { Button } from 'components/global/button' +import { ModalTypography } from 'components/global/modalTypography' + +import { + EarnInputContainer, + EarnContent, + Flex, + EarnDetails, + ContainerMessage, +} from './styles' + class EarnWithdrawModal extends React.Component { constructor(props) { @@ -199,59 +212,58 @@ class EarnWithdrawModal extends React.Component { open={open} onClose={()=>{this.handleClose()}} maxWidth="md" - > + title={`Withdraw ${withdrawToken.symbol}`} - - Withdraw {`${withdrawToken.symbol}`} - - - { - this.setAmount(i.target.value, toWei_String(i.target.value, withdrawToken.decimals)) - }} - allowUseAll={true} - onUseMax={(i)=>{ - this.setAmount(maxValue, maxValue_Wei_String) - }} - disabledSelect={true} - variant="standard" - newStyle - /> - - {Number(value) > Number(LPBalance) && - - Insufficient {withdrawToken.symbol} in the {' '} - {withdrawToken.L1orL2Pool === 'L1LP' ? 'L1' : 'L2'} liquidity pool - to withdraw your full stake. At this time, you can only withdraw up to - {Number(LPBalance).toFixed(2)} {withdrawToken.symbol}. - - } - - - - - + > + + + +
+ Amount +
+
+ + Balance: {maxValue} {withdrawToken.symbol} + +
+
+ + this.setAmount(val, toWei_String(val, withdrawToken.decimals)) + } + /> + {Number(value) > Number(LPBalance) && + + + Insufficient {withdrawToken.symbol} in the {' '} + {withdrawToken.L1orL2Pool === 'L1LP' ? 'L1' : 'L2'} liquidity + pool to withdraw your full stake. At this time, you can only + withdraw up to + {Number(LPBalance).toFixed(2)} {withdrawToken.symbol}. + + + } + + + +
-
-
+
-
+ )} -
-
+ +
Staking Period - + Each staking period lasts 2 weeks. If you do not unstake after a +
staking period, your stake will be automatically renewed. -
+
Unstaking Window - + The first two days of every staking period, except for the first +
staking period, are the unstaking window. You can only unstake +
during the unstaking window. -
+
-
-
+ +
- -
- Stake BOBA Earn BOBA - 5% Fixed APY -
- -
- Active stakes - {totalBOBAstaked} BOBA -
-
-
- -
- BOBA Balance: - {state.max_Float_String} -
- { - handleStakeValue(i.target.value) - }} - onUseMax={(i: any) => { - handleStakeValue(state.max_Float_String) - }} - newStyle - disabled={netLayer !== 'L2'} - variant="standard" - //FIX ME AFTER REFACTORY INPUT COMPONETNT TO TYPESCRIPT - label={undefined} - disabledExitAll={undefined} - icon={undefined} - unit={undefined} - onSelect={undefined} - sx={undefined} - paste={undefined} - fullWidth={undefined} - size={undefined} - loading={undefined} - maxLength={undefined} - selectOptions={undefined} - defaultSelect={undefined} - selectValue={undefined} - style={undefined} - isBridge={undefined} - openTokenPicker={undefined} - /> - - {netLayer === 'L2' && bobaFeeChoice && state.fee && ( - Fee: {state.fee} BOBA - )} - - {netLayer === 'L2' && !bobaFeeChoice && state.fee && ( - Fee: {state.fee} ETH + + + Staking History + + + + {(!stakeInfo && layer === 'L2') || + (!Object.keys(stakeInfo).length && layer === 'L2') ? ( + + ) : ( + <> + + {Object.keys(stakeInfo).map((v, i) => { + if (stakeInfo[i].isActive) { + return ( + + ) + } + return null + })} + + )} - - {netLayer === 'L2' && ( -
-
- -
- - Stake BOBA -
-
- {Object.keys(stakeInfo).length === 0 ? ( - -
- - - - - {accountEnabled - ? 'No Content' - : 'Please connect to wallet first'} - -
-
- ) : ( -
- {Object.keys(stakeInfo).map((v, i) => { - if (stakeInfo[i].isActive) { - return ( - - - - ) - } - return null - })} -
- )} +
) } -const mapStateToProps = (state: any) => ({ - fixed: state.fixed, - setup: state.setup, - balance: state.balance, -}) - -export default connect(mapStateToProps)(Save) +export default Save diff --git a/packages/boba/gateway/src/containers/veboba/Records/RecordItem.js b/packages/boba/gateway/src/containers/veboba/Records/RecordItem.js index 186b50dfbf..38e707b3a8 100644 --- a/packages/boba/gateway/src/containers/veboba/Records/RecordItem.js +++ b/packages/boba/gateway/src/containers/veboba/Records/RecordItem.js @@ -1,7 +1,7 @@ import { Box, Grid, Typography } from '@mui/material' import Button from 'components/button/Button' import * as G from 'containers/Global.styles' -import BobaNFTGlass from 'images/boba2/BobaNFTGlass.svg' +import BobaNFTGlass from 'assets/images/boba2/BobaNFTGlass.svg' import {isSameMonth, isSameWeek, isBeforeDate, convertDate} from 'util/dates' import React from 'react' diff --git a/packages/boba/gateway/src/hooks/useBridgeAlerts.ts b/packages/boba/gateway/src/hooks/useBridgeAlerts.ts index 295715bcbe..c0a6226e6d 100644 --- a/packages/boba/gateway/src/hooks/useBridgeAlerts.ts +++ b/packages/boba/gateway/src/hooks/useBridgeAlerts.ts @@ -102,7 +102,7 @@ const useBridgeAlerts = () => { }) ) - if (underZero || amountToBridge <= 0) { + if ((underZero || amountToBridge <= 0) && amountToBridge) { dispatch( setBridgeAlert({ meta: ALERT_KEYS.VALUE_TOO_SMALL, @@ -213,7 +213,7 @@ const useBridgeAlerts = () => { ).toFixed(2)}) is too low. Please use the classic bridge.` } else { - warning = `Insufficient balance in pool - reduce amount or use classical exit` + warning = `There is not enough liquidity in the fast bridge pool - please reduce amount or use classical bridge` } } @@ -329,7 +329,7 @@ const useBridgeAlerts = () => { ${Number(LpRatio).toFixed(2)}) is too low. Please use the classic bridge.` } else { - warning = `Insufficient balance in pool - reduce amount or use classical exit` + warning = `There is not enough liquidity in the fast bridge pool - reduce your amount or use the Classic Bridge` } } diff --git a/packages/boba/gateway/src/hooks/useFeeSwitcher.ts b/packages/boba/gateway/src/hooks/useFeeSwitcher.ts new file mode 100644 index 0000000000..37eda27989 --- /dev/null +++ b/packages/boba/gateway/src/hooks/useFeeSwitcher.ts @@ -0,0 +1,103 @@ +import { switchFee } from 'actions/setupAction' +import { openAlert, openError } from 'actions/uiAction' +import BN from 'bignumber.js' +import { isEqual } from 'lodash' +import { useCallback } from 'react' +import { useDispatch, useSelector } from 'react-redux' +import { selectBobaFeeChoice, selectlayer2Balance } from 'selectors' +import networkService from 'services/networkService' +import { logAmount } from 'util/amountConvert' + +/** + * useFeeSwitcher. + * + * Hook to switch the fee when in case of L2 + */ + +const useFeeSwitcher = () => { + const dispatch = useDispatch() + const feeUseBoba = useSelector(selectBobaFeeChoice()) + const l2Balances = useSelector(selectlayer2Balance, isEqual) + const l2BalanceNativeToken = l2Balances.filter( + (i: any) => i.symbol === networkService.L1NativeTokenSymbol + ) + const balanceETH = l2BalanceNativeToken[0] + const l2BalanceBOBA = l2Balances.filter((i: any) => i.symbol === 'BOBA') + const balanceBOBA = l2BalanceBOBA[0] + + const switchFeeUse = useCallback( + async (targetFee) => { + let tooSmallL1NativeToken = false + // mini balance required for token to use as bridge fee + const minL1NativeBalance = + await networkService.estimateMinL1NativeTokenForFee() //0.002 + let tooSmallBOBA = false + + if (typeof balanceBOBA === 'undefined') { + tooSmallBOBA = true + } else { + //check actual balance + tooSmallBOBA = new BN(logAmount(balanceBOBA.balance, 18)).lt(new BN(1)) + } + + if (typeof balanceETH === 'undefined') { + tooSmallL1NativeToken = true + } else { + //check actual balance + tooSmallL1NativeToken = new BN(logAmount(balanceETH.balance, 18)).lt( + new BN(minL1NativeBalance) + ) + } + + if (!balanceBOBA && !balanceETH) { + dispatch( + openError('Wallet empty - please bridge in ETH or BOBA from L1') + ) + return + } + + let res + + if (feeUseBoba && targetFee === 'BOBA') { + // do nothing - already set to BOBA + } else if ( + !feeUseBoba && + targetFee === networkService.L1NativeTokenSymbol + ) { + // do nothing - already set to ETH + } else if (!feeUseBoba && targetFee === 'BOBA') { + // change to BOBA + if (tooSmallBOBA) { + dispatch( + openError(`You cannot change the fee token to BOBA since your BOBA balance is below 1 BOBA. + If you change fee token now, you might get stuck. Please swap some ETH for BOBA first.`) + ) + } else { + res = await dispatch(switchFee(targetFee)) + } + } else if ( + feeUseBoba && + targetFee === networkService.L1NativeTokenSymbol + ) { + // change to L1Native Token + if (tooSmallL1NativeToken) { + dispatch( + openError(`You cannot change the fee token to ${networkService.L1NativeTokenSymbol} since your ${networkService.L1NativeTokenSymbol} balance is below ${minL1NativeBalance}. + If you change fee token now, you might get stuck. Please obtain some ${networkService.L1NativeTokenSymbol} first.`) + ) + } else { + res = await dispatch(switchFee(targetFee)) + } + } + + if (res) { + dispatch(openAlert(`Successfully changed fee to ${targetFee}`)) + } + }, + [dispatch, feeUseBoba, balanceETH, balanceBOBA] + ) + + return { switchFeeUse } +} + +export default useFeeSwitcher diff --git a/packages/boba/gateway/src/hooks/useThemeSwitcher.ts b/packages/boba/gateway/src/hooks/useThemeSwitcher.ts new file mode 100644 index 0000000000..a7fe933bd2 --- /dev/null +++ b/packages/boba/gateway/src/hooks/useThemeSwitcher.ts @@ -0,0 +1,26 @@ +import { setTheme } from 'actions/uiAction' +import { THEME_NAME } from 'components/layout/Header/types' +import { useDispatch, useSelector } from 'react-redux' +import { selectModalState } from 'selectors' + +const useThemeSwitcher = () => { + const currentTheme = useSelector(selectModalState('theme')) + const dispatch = useDispatch() + + const setThemeLight = () => { + localStorage.setItem('theme', THEME_NAME.LIGHT) + dispatch(setTheme(THEME_NAME.LIGHT)) + } + const setThemeDark = () => { + localStorage.setItem('theme', THEME_NAME.DARK) + dispatch(setTheme(THEME_NAME.DARK)) + } + + return { + setThemeLight, + setThemeDark, + currentTheme, + } +} + +export default useThemeSwitcher diff --git a/packages/boba/gateway/src/hooks/useWalletConnect.ts b/packages/boba/gateway/src/hooks/useWalletConnect.ts index 62b879d8a7..898ee8e0b3 100644 --- a/packages/boba/gateway/src/hooks/useWalletConnect.ts +++ b/packages/boba/gateway/src/hooks/useWalletConnect.ts @@ -44,11 +44,11 @@ export const useWalletConnect = () => { */ const triggerInit = useCallback(() => { - console.log(['network', network, networkType]) const initAccount = async () => { const initialized = await networkService.initializeAccount({ chainIdChanged, }) + if (initialized === 'nometamask') { dispatch(openModal('noMetaMaskModal')) return false diff --git a/packages/boba/gateway/src/hooks/useWalletSwitch.ts b/packages/boba/gateway/src/hooks/useWalletSwitch.ts index cf6b987b9f..5f12e6513c 100644 --- a/packages/boba/gateway/src/hooks/useWalletSwitch.ts +++ b/packages/boba/gateway/src/hooks/useWalletSwitch.ts @@ -10,11 +10,16 @@ import { selectNetworkType, selectBaseEnabled, selectLayer, + selectAccountEnabled, + selectSetup, } from 'selectors' + import { LAYER } from 'util/constant' const useWalletSwitch = () => { const dispatch = useDispatch() + const walletInfo = useSelector(selectSetup()) + const accountEnabled = useSelector(selectAccountEnabled()) const network = useSelector(selectNetwork()) const activeNetwork = useSelector(selectActiveNetwork()) const networkType = useSelector(selectNetworkType()) @@ -39,8 +44,10 @@ const useWalletSwitch = () => { }, [layer, reconnect, baseEnabled, dispatch]) useEffect(() => { - if (activeNetwork !== network || activeNetworkType !== networkType) { - dispatch(openModal('switchNetworkModal')) + if (accountEnabled) { + if (activeNetwork !== network || activeNetworkType !== networkType) { + dispatch(openModal('switchNetworkModal')) + } } }, [activeNetwork, activeNetworkType, network, networkType, dispatch]) } diff --git a/packages/boba/gateway/src/images/CGT.svg b/packages/boba/gateway/src/images/CGT.svg deleted file mode 100644 index 7d8b32f94c..0000000000 --- a/packages/boba/gateway/src/images/CGT.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/boba/gateway/src/images/arrow.png b/packages/boba/gateway/src/images/arrow.png deleted file mode 100644 index fc248b3839..0000000000 Binary files a/packages/boba/gateway/src/images/arrow.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/avax.svg b/packages/boba/gateway/src/images/avax.svg deleted file mode 100644 index e2316b863a..0000000000 --- a/packages/boba/gateway/src/images/avax.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/backgrounds/account-glass.png b/packages/boba/gateway/src/images/backgrounds/account-glass.png deleted file mode 100644 index fa9dd91c4f..0000000000 Binary files a/packages/boba/gateway/src/images/backgrounds/account-glass.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/backgrounds/bg-wallet.png b/packages/boba/gateway/src/images/backgrounds/bg-wallet.png deleted file mode 100644 index 10430caaf5..0000000000 Binary files a/packages/boba/gateway/src/images/backgrounds/bg-wallet.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/backgrounds/drink.png b/packages/boba/gateway/src/images/backgrounds/drink.png deleted file mode 100644 index eeb64d5719..0000000000 Binary files a/packages/boba/gateway/src/images/backgrounds/drink.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/backgrounds/shadow-menu.svg b/packages/boba/gateway/src/images/backgrounds/shadow-menu.svg deleted file mode 100644 index 167c23cd31..0000000000 --- a/packages/boba/gateway/src/images/backgrounds/shadow-menu.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/bat.svg b/packages/boba/gateway/src/images/bat.svg deleted file mode 100644 index 966292588f..0000000000 --- a/packages/boba/gateway/src/images/bat.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/bnb.svg b/packages/boba/gateway/src/images/bnb.svg deleted file mode 100644 index 8a9561dfa7..0000000000 --- a/packages/boba/gateway/src/images/bnb.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/boba-token-glow.png b/packages/boba/gateway/src/images/boba-token-glow.png deleted file mode 100644 index 11e14363a0..0000000000 Binary files a/packages/boba/gateway/src/images/boba-token-glow.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/boba2/available_bridges_bg.svg b/packages/boba/gateway/src/images/boba2/available_bridges_bg.svg deleted file mode 100644 index 546cdb0d66..0000000000 --- a/packages/boba/gateway/src/images/boba2/available_bridges_bg.svg +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/boba2Icon.svg b/packages/boba/gateway/src/images/boba2/boba2Icon.svg deleted file mode 100644 index 8493dadf37..0000000000 --- a/packages/boba/gateway/src/images/boba2/boba2Icon.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/boba_glass_bg.svg b/packages/boba/gateway/src/images/boba2/boba_glass_bg.svg deleted file mode 100644 index 7f9ac8f784..0000000000 --- a/packages/boba/gateway/src/images/boba2/boba_glass_bg.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/bridge_bg.svg b/packages/boba/gateway/src/images/boba2/bridge_bg.svg deleted file mode 100644 index 507c7bbb04..0000000000 --- a/packages/boba/gateway/src/images/boba2/bridge_bg.svg +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/bridge_boba_glass.svg b/packages/boba/gateway/src/images/boba2/bridge_boba_glass.svg deleted file mode 100644 index f6ceb18d79..0000000000 --- a/packages/boba/gateway/src/images/boba2/bridge_boba_glass.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/discord.svg b/packages/boba/gateway/src/images/boba2/discord.svg deleted file mode 100644 index bb4671c1a1..0000000000 --- a/packages/boba/gateway/src/images/boba2/discord.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/boba/gateway/src/images/boba2/grid_bg.svg b/packages/boba/gateway/src/images/boba2/grid_bg.svg deleted file mode 100644 index 6b02105db4..0000000000 --- a/packages/boba/gateway/src/images/boba2/grid_bg.svg +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/loading_dark.gif b/packages/boba/gateway/src/images/boba2/loading_dark.gif deleted file mode 100644 index 35f98ece74..0000000000 Binary files a/packages/boba/gateway/src/images/boba2/loading_dark.gif and /dev/null differ diff --git a/packages/boba/gateway/src/images/boba2/loading_light.gif b/packages/boba/gateway/src/images/boba2/loading_light.gif deleted file mode 100644 index 544faa4243..0000000000 Binary files a/packages/boba/gateway/src/images/boba2/loading_light.gif and /dev/null differ diff --git a/packages/boba/gateway/src/images/boba2/logo-boba2-dark.svg b/packages/boba/gateway/src/images/boba2/logo-boba2-dark.svg deleted file mode 100644 index 20cb84035e..0000000000 --- a/packages/boba/gateway/src/images/boba2/logo-boba2-dark.svg +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/logo-boba2-m.svg b/packages/boba/gateway/src/images/boba2/logo-boba2-m.svg deleted file mode 100644 index 329660c7e7..0000000000 --- a/packages/boba/gateway/src/images/boba2/logo-boba2-m.svg +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/logo-boba2.svg b/packages/boba/gateway/src/images/boba2/logo-boba2.svg deleted file mode 100644 index 91bfdd6d18..0000000000 --- a/packages/boba/gateway/src/images/boba2/logo-boba2.svg +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/logo-boba2_error.svg b/packages/boba/gateway/src/images/boba2/logo-boba2_error.svg deleted file mode 100644 index 39ed71d506..0000000000 --- a/packages/boba/gateway/src/images/boba2/logo-boba2_error.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boba2/turing.png b/packages/boba/gateway/src/images/boba2/turing.png deleted file mode 100644 index eb3cabc0fc..0000000000 Binary files a/packages/boba/gateway/src/images/boba2/turing.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/boba2/wave_bg.svg b/packages/boba/gateway/src/images/boba2/wave_bg.svg deleted file mode 100644 index e5ad05a373..0000000000 --- a/packages/boba/gateway/src/images/boba2/wave_bg.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/packages/boba/gateway/src/images/bobaLinks/Bobaavax.svg b/packages/boba/gateway/src/images/bobaLinks/Bobaavax.svg deleted file mode 100644 index ef17db7f7b..0000000000 --- a/packages/boba/gateway/src/images/bobaLinks/Bobaavax.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/bobaLinks/Bobabeam.svg b/packages/boba/gateway/src/images/bobaLinks/Bobabeam.svg deleted file mode 100644 index cedbaeae20..0000000000 --- a/packages/boba/gateway/src/images/bobaLinks/Bobabeam.svg +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/bobaLinks/Bobabnb.svg b/packages/boba/gateway/src/images/bobaLinks/Bobabnb.svg deleted file mode 100644 index de861e67ce..0000000000 --- a/packages/boba/gateway/src/images/bobaLinks/Bobabnb.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/bobaLinks/Bobaeth.svg b/packages/boba/gateway/src/images/bobaLinks/Bobaeth.svg deleted file mode 100644 index 82191488f6..0000000000 --- a/packages/boba/gateway/src/images/bobaLinks/Bobaeth.svg +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/bobaLinks/Bobaftm.svg b/packages/boba/gateway/src/images/bobaLinks/Bobaftm.svg deleted file mode 100644 index 0ce8b90811..0000000000 --- a/packages/boba/gateway/src/images/bobaLinks/Bobaftm.svg +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/boxarrow.svg b/packages/boba/gateway/src/images/boxarrow.svg deleted file mode 100644 index ecf76d0f82..0000000000 --- a/packages/boba/gateway/src/images/boxarrow.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/boba/gateway/src/images/browserwallet.png b/packages/boba/gateway/src/images/browserwallet.png deleted file mode 100644 index f68a6e2410..0000000000 Binary files a/packages/boba/gateway/src/images/browserwallet.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/busd.svg b/packages/boba/gateway/src/images/busd.svg deleted file mode 100644 index 85917bc4f2..0000000000 --- a/packages/boba/gateway/src/images/busd.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/chevron.svg b/packages/boba/gateway/src/images/chevron.svg deleted file mode 100644 index f31857b098..0000000000 --- a/packages/boba/gateway/src/images/chevron.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/boba/gateway/src/images/close.svg:Zone.Identifier b/packages/boba/gateway/src/images/close.svg:Zone.Identifier deleted file mode 100644 index bbbaf19138..0000000000 --- a/packages/boba/gateway/src/images/close.svg:Zone.Identifier +++ /dev/null @@ -1,3 +0,0 @@ -[ZoneTransfer] -ZoneId=3 -HostUrl=https://www.figma.com/ diff --git a/packages/boba/gateway/src/images/coinbase.jpg b/packages/boba/gateway/src/images/coinbase.jpg deleted file mode 100644 index 535dd8da4b..0000000000 Binary files a/packages/boba/gateway/src/images/coinbase.jpg and /dev/null differ diff --git a/packages/boba/gateway/src/images/connect.svg b/packages/boba/gateway/src/images/connect.svg deleted file mode 100644 index f37ae7b69f..0000000000 --- a/packages/boba/gateway/src/images/connect.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/boba/gateway/src/images/dai.png b/packages/boba/gateway/src/images/dai.png deleted file mode 100644 index 2b3d066b35..0000000000 Binary files a/packages/boba/gateway/src/images/dai.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/dodo.svg b/packages/boba/gateway/src/images/dodo.svg deleted file mode 100644 index 7198923d8e..0000000000 --- a/packages/boba/gateway/src/images/dodo.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/domLogo.png b/packages/boba/gateway/src/images/domLogo.png deleted file mode 100644 index 8c4f4da5a8..0000000000 Binary files a/packages/boba/gateway/src/images/domLogo.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/eth.svg b/packages/boba/gateway/src/images/eth.svg deleted file mode 100644 index 04d375101e..0000000000 --- a/packages/boba/gateway/src/images/eth.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/boba/gateway/src/images/ether-icon.png b/packages/boba/gateway/src/images/ether-icon.png deleted file mode 100644 index 860c5290a4..0000000000 Binary files a/packages/boba/gateway/src/images/ether-icon.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/ethereum.svg b/packages/boba/gateway/src/images/ethereum.svg deleted file mode 100644 index bc0c279c76..0000000000 --- a/packages/boba/gateway/src/images/ethereum.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/factory.png b/packages/boba/gateway/src/images/factory.png deleted file mode 100644 index fb61b92393..0000000000 Binary files a/packages/boba/gateway/src/images/factory.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/frax.png b/packages/boba/gateway/src/images/frax.png deleted file mode 100644 index 4f3ff3a71b..0000000000 Binary files a/packages/boba/gateway/src/images/frax.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/ftm.svg b/packages/boba/gateway/src/images/ftm.svg deleted file mode 100644 index 311ac786fb..0000000000 --- a/packages/boba/gateway/src/images/ftm.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/fxs.svg b/packages/boba/gateway/src/images/fxs.svg deleted file mode 100644 index d7ead28c0c..0000000000 --- a/packages/boba/gateway/src/images/fxs.svg +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - image/svg+xml - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/glmr.svg b/packages/boba/gateway/src/images/glmr.svg deleted file mode 100644 index aa8d41ae4c..0000000000 --- a/packages/boba/gateway/src/images/glmr.svg +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/icons/alert-message.svg b/packages/boba/gateway/src/images/icons/alert-message.svg deleted file mode 100644 index feb70417b3..0000000000 --- a/packages/boba/gateway/src/images/icons/alert-message.svg +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/icons/arrow-right.svg b/packages/boba/gateway/src/images/icons/arrow-right.svg deleted file mode 100644 index 41af83dcef..0000000000 --- a/packages/boba/gateway/src/images/icons/arrow-right.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/boba/gateway/src/images/icons/close-modal.svg b/packages/boba/gateway/src/images/icons/close-modal.svg deleted file mode 100644 index c98c435258..0000000000 --- a/packages/boba/gateway/src/images/icons/close-modal.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/boba/gateway/src/images/icons/dark-icon.svg b/packages/boba/gateway/src/images/icons/dark-icon.svg deleted file mode 100644 index 1ecd8b3070..0000000000 --- a/packages/boba/gateway/src/images/icons/dark-icon.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/packages/boba/gateway/src/images/icons/light-icon.svg b/packages/boba/gateway/src/images/icons/light-icon.svg deleted file mode 100644 index 0e7f7be7ba..0000000000 --- a/packages/boba/gateway/src/images/icons/light-icon.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/icons/mm-account.png b/packages/boba/gateway/src/images/icons/mm-account.png deleted file mode 100644 index f3079dae2f..0000000000 Binary files a/packages/boba/gateway/src/images/icons/mm-account.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/icons/mm-account.svg b/packages/boba/gateway/src/images/icons/mm-account.svg deleted file mode 100644 index 8c47d97e17..0000000000 --- a/packages/boba/gateway/src/images/icons/mm-account.svg +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/icons/nav-collapsed.svg b/packages/boba/gateway/src/images/icons/nav-collapsed.svg deleted file mode 100644 index 6298a1b0ab..0000000000 --- a/packages/boba/gateway/src/images/icons/nav-collapsed.svg +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/packages/boba/gateway/src/images/icons/success-message.svg b/packages/boba/gateway/src/images/icons/success-message.svg deleted file mode 100644 index 2c1ccaee80..0000000000 --- a/packages/boba/gateway/src/images/icons/success-message.svg +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/key.svg b/packages/boba/gateway/src/images/key.svg deleted file mode 100644 index ae33f02b9d..0000000000 --- a/packages/boba/gateway/src/images/key.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/boba/gateway/src/images/ledger.png b/packages/boba/gateway/src/images/ledger.png deleted file mode 100644 index a2abb14977..0000000000 Binary files a/packages/boba/gateway/src/images/ledger.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/ledger_connect.png b/packages/boba/gateway/src/images/ledger_connect.png deleted file mode 100644 index 8bdeb85b17..0000000000 Binary files a/packages/boba/gateway/src/images/ledger_connect.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/link.svg b/packages/boba/gateway/src/images/link.svg deleted file mode 100644 index bf4cd5374e..0000000000 --- a/packages/boba/gateway/src/images/link.svg +++ /dev/null @@ -1 +0,0 @@ -Asset 1 \ No newline at end of file diff --git a/packages/boba/gateway/src/images/lock.svg b/packages/boba/gateway/src/images/lock.svg deleted file mode 100644 index e98a674d3a..0000000000 --- a/packages/boba/gateway/src/images/lock.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/packages/boba/gateway/src/images/logo-boba-mini.svg b/packages/boba/gateway/src/images/logo-boba-mini.svg deleted file mode 100644 index e90731bc39..0000000000 --- a/packages/boba/gateway/src/images/logo-boba-mini.svg +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/logo-boba.svg b/packages/boba/gateway/src/images/logo-boba.svg deleted file mode 100644 index f23e9950b6..0000000000 --- a/packages/boba/gateway/src/images/logo-boba.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/logo-dark-omgx.svg b/packages/boba/gateway/src/images/logo-dark-omgx.svg deleted file mode 100644 index 369a795dbf..0000000000 --- a/packages/boba/gateway/src/images/logo-dark-omgx.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/matic.svg b/packages/boba/gateway/src/images/matic.svg deleted file mode 100644 index 952fa61273..0000000000 --- a/packages/boba/gateway/src/images/matic.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/packages/boba/gateway/src/images/nowpayments.svg b/packages/boba/gateway/src/images/nowpayments.svg deleted file mode 100644 index 76c3cd7f1d..0000000000 --- a/packages/boba/gateway/src/images/nowpayments.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/olo.svg b/packages/boba/gateway/src/images/olo.svg deleted file mode 100644 index a174e39882..0000000000 --- a/packages/boba/gateway/src/images/olo.svg +++ /dev/null @@ -1,187 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/omg-icon-circle.png b/packages/boba/gateway/src/images/omg-icon-circle.png deleted file mode 100644 index 8fd2c82fdf..0000000000 Binary files a/packages/boba/gateway/src/images/omg-icon-circle.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/omg.png b/packages/boba/gateway/src/images/omg.png deleted file mode 100644 index 24f7a0b88e..0000000000 Binary files a/packages/boba/gateway/src/images/omg.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/rep.svg b/packages/boba/gateway/src/images/rep.svg deleted file mode 100644 index 23a7df94af..0000000000 --- a/packages/boba/gateway/src/images/rep.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/root.png b/packages/boba/gateway/src/images/root.png deleted file mode 100644 index cdc7ae6160..0000000000 Binary files a/packages/boba/gateway/src/images/root.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/sushi-icon.png b/packages/boba/gateway/src/images/sushi-icon.png deleted file mode 100644 index 223bda9313..0000000000 Binary files a/packages/boba/gateway/src/images/sushi-icon.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/terra.png b/packages/boba/gateway/src/images/terra.png deleted file mode 100644 index ded6f5a2d8..0000000000 Binary files a/packages/boba/gateway/src/images/terra.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/twitter.png b/packages/boba/gateway/src/images/twitter.png deleted file mode 100644 index 992d33cb05..0000000000 Binary files a/packages/boba/gateway/src/images/twitter.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/uma.svg b/packages/boba/gateway/src/images/uma.svg deleted file mode 100644 index ed86f759f6..0000000000 --- a/packages/boba/gateway/src/images/uma.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/images/uni.png b/packages/boba/gateway/src/images/uni.png deleted file mode 100644 index 893ef55cb2..0000000000 Binary files a/packages/boba/gateway/src/images/uni.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/usdc.png b/packages/boba/gateway/src/images/usdc.png deleted file mode 100644 index 99f921121c..0000000000 Binary files a/packages/boba/gateway/src/images/usdc.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/usdt-icon.png b/packages/boba/gateway/src/images/usdt-icon.png deleted file mode 100644 index 447dde6c27..0000000000 Binary files a/packages/boba/gateway/src/images/usdt-icon.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/usdt-icon.svg b/packages/boba/gateway/src/images/usdt-icon.svg deleted file mode 100644 index e530822408..0000000000 --- a/packages/boba/gateway/src/images/usdt-icon.svg +++ /dev/null @@ -1 +0,0 @@ -tether-usdt-logo \ No newline at end of file diff --git a/packages/boba/gateway/src/images/wagmiv0.png b/packages/boba/gateway/src/images/wagmiv0.png deleted file mode 100644 index fbfad25f6f..0000000000 Binary files a/packages/boba/gateway/src/images/wagmiv0.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/wagmiv1.png b/packages/boba/gateway/src/images/wagmiv1.png deleted file mode 100644 index b15b1b0f41..0000000000 Binary files a/packages/boba/gateway/src/images/wagmiv1.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/wagmiv2.png b/packages/boba/gateway/src/images/wagmiv2.png deleted file mode 100644 index c539b74171..0000000000 Binary files a/packages/boba/gateway/src/images/wagmiv2.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/wagmiv2olo.png b/packages/boba/gateway/src/images/wagmiv2olo.png deleted file mode 100644 index c539b74171..0000000000 Binary files a/packages/boba/gateway/src/images/wagmiv2olo.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/wagmiv3.png b/packages/boba/gateway/src/images/wagmiv3.png deleted file mode 100644 index 485f120f33..0000000000 Binary files a/packages/boba/gateway/src/images/wagmiv3.png and /dev/null differ diff --git a/packages/boba/gateway/src/images/wbtc.svg b/packages/boba/gateway/src/images/wbtc.svg deleted file mode 100644 index 676c786b7d..0000000000 --- a/packages/boba/gateway/src/images/wbtc.svg +++ /dev/null @@ -1 +0,0 @@ -wrapped-bitcoin-wbtc \ No newline at end of file diff --git a/packages/boba/gateway/src/images/xboba-token.svg b/packages/boba/gateway/src/images/xboba-token.svg deleted file mode 100644 index 24a5c51083..0000000000 --- a/packages/boba/gateway/src/images/xboba-token.svg +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/boba/gateway/src/images/zrx.svg b/packages/boba/gateway/src/images/zrx.svg deleted file mode 100644 index 9535c543f4..0000000000 --- a/packages/boba/gateway/src/images/zrx.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/boba/gateway/src/layout/routes/routeList.js b/packages/boba/gateway/src/layout/routes/routeList.js index 8731a24244..219b1f45f2 100644 --- a/packages/boba/gateway/src/layout/routes/routeList.js +++ b/packages/boba/gateway/src/layout/routes/routeList.js @@ -2,18 +2,17 @@ import React from 'react'; import { DISABLE_VE_DAO, ROUTES_PATH } from "util/constant"; -import Bridge from "containers/bridge/Bridge"; -import Home from "containers/home/Home"; +import Bridging from 'containers/Bridging'; +import Vote from 'containers/VoteAndDao/Vote/Vote'; +import BobaScope from 'containers/bobaScope/BobaScope'; import OldDao from 'containers/dao/OldDao'; -import History from 'containers/history/History'; +import DevTools from 'containers/devtools/DevTools'; import EarnWrapper from 'containers/earn/EarnWrapper'; +import Home from "containers/home/Home"; import SaveWrapper from 'containers/save/SaveWrapper'; -import { Navigate } from 'react-router-dom'; import Lock from 'containers/veboba/Lock'; -import Vote from 'containers/VoteAndDao/Vote/Vote'; -import BobaScope from 'containers/bobaScope/BobaScope'; -import DevTools from 'containers/devtools/DevTools'; -import Bridging from 'containers/Bridging'; +import { Navigate } from 'react-router-dom'; +import History from 'containers/history/History'; export const COMMON_ROUTES = [ { diff --git a/packages/boba/gateway/src/reducers/balanceReducer.js b/packages/boba/gateway/src/reducers/balanceReducer.js index 74e22ed0dd..fc38ac1855 100644 --- a/packages/boba/gateway/src/reducers/balanceReducer.js +++ b/packages/boba/gateway/src/reducers/balanceReducer.js @@ -56,7 +56,6 @@ function balanceReducer(state = initialState, action) { gas: action.payload } case 'FETCH/L1LP/BALANCE/SUCCESS': - console.log([`FETCH/L1LP/BALANCE/SUCCESS`,action.payload]) return { ...state, l1LpBalanceWeiString: action.payload diff --git a/packages/boba/gateway/src/reducers/networkReducer.js b/packages/boba/gateway/src/reducers/networkReducer.js index 74e8f0c83f..53ade04c53 100644 --- a/packages/boba/gateway/src/reducers/networkReducer.js +++ b/packages/boba/gateway/src/reducers/networkReducer.js @@ -36,6 +36,7 @@ const initialState = { activeNetwork: NETWORK.ETHEREUM, activeNetworkType: NETWORK_TYPE.MAINNET, activeNetworkName: {}, + blockExplorerLinks:[] } function networkReducer(state = initialState, action) { @@ -78,6 +79,12 @@ function networkReducer(state = initialState, action) { activeNetworkName } } + case 'NETWORK/SET/BLOCK_EXPLORER/SUCCESS': { + return { + ...state, + blockExplorerLinks: action.payload + } + } default: return state } diff --git a/packages/boba/gateway/src/reducers/transactionReducer.js b/packages/boba/gateway/src/reducers/transactionReducer.js index b2bde06e41..490f7e6d36 100644 --- a/packages/boba/gateway/src/reducers/transactionReducer.js +++ b/packages/boba/gateway/src/reducers/transactionReducer.js @@ -14,9 +14,6 @@ See the License for the specific language governing permissions and limitations under the License. */ const initialState = { - CDMType: '', - CDMMessage: '', - CDMTransaction: '', } function transactionReducer (state = initialState, action) { diff --git a/packages/boba/gateway/src/reducers/uiReducer.js b/packages/boba/gateway/src/reducers/uiReducer.js index 0462179747..ba36b764aa 100644 --- a/packages/boba/gateway/src/reducers/uiReducer.js +++ b/packages/boba/gateway/src/reducers/uiReducer.js @@ -29,6 +29,7 @@ const initialState = { ledgerConnectModal: false, addNewTokenModal: false, EarnDepositModal: false, + StakeDepositModal: false, EarnWithdrawModal: false, transferDaoModal: false, delegateDaoModal: false, diff --git a/packages/boba/gateway/src/selectors/balanceSelector.js b/packages/boba/gateway/src/selectors/balanceSelector.js index 2db0f1f567..76758abcf2 100644 --- a/packages/boba/gateway/src/selectors/balanceSelector.js +++ b/packages/boba/gateway/src/selectors/balanceSelector.js @@ -108,3 +108,6 @@ export function selectUserAndL2LPBalanceBatch (state) { export function selectExitFee (state) { return state.balance.exitFee } + +export const selectBalance = () => (state) => state.balance + diff --git a/packages/boba/gateway/src/selectors/earnSelector.js b/packages/boba/gateway/src/selectors/earnSelector.js index b3998fa7ab..8f35d8f37a 100644 --- a/packages/boba/gateway/src/selectors/earnSelector.js +++ b/packages/boba/gateway/src/selectors/earnSelector.js @@ -14,13 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ export function selectPoolInfo () { - return function (state) { - return state.earn.poolInfo - } -} + return function (state) { + return state.earn.poolInfo + } + } -export function selectUserInfo () { - return function (state) { - return state.earn.userInfo - } -} + export function selectUserInfo () { + return function (state) { + return state.earn.userInfo + } + } diff --git a/packages/boba/gateway/src/selectors/fixedSelector.ts b/packages/boba/gateway/src/selectors/fixedSelector.ts new file mode 100644 index 0000000000..abfd4929a2 --- /dev/null +++ b/packages/boba/gateway/src/selectors/fixedSelector.ts @@ -0,0 +1,16 @@ +/* +Copyright 2021-present Boba Network. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. */ + +export const selectFixed = () => (state: any) => state.fixed diff --git a/packages/boba/gateway/src/selectors/index.ts b/packages/boba/gateway/src/selectors/index.ts index b8d6a7dcfb..2ac86f5d04 100644 --- a/packages/boba/gateway/src/selectors/index.ts +++ b/packages/boba/gateway/src/selectors/index.ts @@ -14,4 +14,6 @@ export * from 'selectors/transactionSelector' export * from 'selectors/uiSelector' export * from 'selectors/veBobaSelector' export * from 'selectors/verifierSelector' +export * from 'selectors/fixedSelector' + export {} // fixing isolate mode temporarily , after to upgrade all functions to ts, we can remove it. diff --git a/packages/boba/gateway/src/selectors/networkSelector.js b/packages/boba/gateway/src/selectors/networkSelector.js index 60ebf5c1d6..825a54e72e 100644 --- a/packages/boba/gateway/src/selectors/networkSelector.js +++ b/packages/boba/gateway/src/selectors/networkSelector.js @@ -47,3 +47,9 @@ export function selectActiveNetworkName() { return state.network['activeNetworkName'] } } + +export function selectBlockExplorerLinks() { + return function (state) { + return state.network['blockExplorerLinks'] + } +} \ No newline at end of file diff --git a/packages/boba/gateway/src/selectors/setupSelector.js b/packages/boba/gateway/src/selectors/setupSelector.js index 47b36934f9..5d4c0201d5 100644 --- a/packages/boba/gateway/src/selectors/setupSelector.js +++ b/packages/boba/gateway/src/selectors/setupSelector.js @@ -98,3 +98,5 @@ export function selectChainIdChanged () { return state.setup['chainIdChanged'] } } + +export const selectSetup = () => (state) => state.setup diff --git a/packages/boba/gateway/src/selectors/transactionSelector.js b/packages/boba/gateway/src/selectors/transactionSelector.js index 0dabcd5fd2..2579082d12 100644 --- a/packages/boba/gateway/src/selectors/transactionSelector.js +++ b/packages/boba/gateway/src/selectors/transactionSelector.js @@ -10,26 +10,26 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -export function selectTransactions (state) { +export function selectTransactions(state) { return Object.values(state.transaction) } -export function selectErc20Deposits (state) { +export function selectErc20Deposits(state) { return Object.values(state.deposit.erc20) } -export function selectEthDeposits (state) { +export function selectEthDeposits(state) { return Object.values(state.deposit.eth) } -export function selectCDMType (state) { +export function selectCDMType(state) { return state.transaction.CDMType } -export function selectCDMMessage (state) { +export function selectCDMMessage(state) { return state.transaction.CDMMessage } -export function selectCDMTransaction (state) { +export function selectCDMTransaction(state) { return state.transaction.CDMTransaction } diff --git a/packages/boba/gateway/src/services/app.service.js b/packages/boba/gateway/src/services/app.service.js index 24147e29f1..8521cbe412 100644 --- a/packages/boba/gateway/src/services/app.service.js +++ b/packages/boba/gateway/src/services/app.service.js @@ -1,18 +1,18 @@ -import { NETWORK, NETWORK_TYPE } from "util/network/network.util"; +import { NETWORK, NETWORK_TYPE } from 'util/network/network.util' // testnet addresss -import addresses_Goerli from "@boba/register/addresses/addressesGoerli_0x6FF9c8FF8F0B6a0763a3030540c21aFC721A9148" -import addresses_BobaFuji from "@boba/register/addresses/addressBobaFuji_0xcE78de95b85212BC348452e91e0e74c17cf37c79" -import addresses_BobaBnbTestnet from "@boba/register/addresses/addressBobaBnbTestnet_0xAee1fb3f4353a9060aEC3943fE932b6Efe35CdAa" +import addresses_Goerli from '@boba/register/addresses/addressesGoerli_0x6FF9c8FF8F0B6a0763a3030540c21aFC721A9148' +import addresses_BobaFuji from '@boba/register/addresses/addressBobaFuji_0xcE78de95b85212BC348452e91e0e74c17cf37c79' +import addresses_BobaBnbTestnet from '@boba/register/addresses/addressBobaBnbTestnet_0xAee1fb3f4353a9060aEC3943fE932b6Efe35CdAa' // mainnet address -import addresses_Mainnet from "@boba/register/addresses/addressesMainnet_0x8376ac6C3f73a25Dd994E0b0669ca7ee0C02F089" -import addresses_BobaAvax from "@boba/register/addresses/addressBobaAvax_0x00220f8ce1c4be8436574e575fE38558d85e2E6b" -import addresses_BobaBnb from "@boba/register/addresses/addressBobaBnb_0xeb989B25597259cfa51Bd396cE1d4B085EC4c753" +import addresses_Mainnet from '@boba/register/addresses/addressesMainnet_0x8376ac6C3f73a25Dd994E0b0669ca7ee0C02F089' +import addresses_BobaAvax from '@boba/register/addresses/addressBobaAvax_0x00220f8ce1c4be8436574e575fE38558d85e2E6b' +import addresses_BobaBnb from '@boba/register/addresses/addressBobaBnb_0xeb989B25597259cfa51Bd396cE1d4B085EC4c753' // layerzero addresses. -import layerZeroTestnet from "@boba/register/addresses/layerZeroTestnet" -import layerZeroMainnet from "@boba/register/addresses/layerZeroMainnet" -import store from "store"; +import layerZeroTestnet from '@boba/register/addresses/layerZeroTestnet' +import layerZeroMainnet from '@boba/register/addresses/layerZeroMainnet' +import store from 'store' // predeployed contracts. @@ -22,133 +22,176 @@ const L2_BOBA_Address = '0x4200000000000000000000000000000000000006' const L2MessengerAddress = '0x4200000000000000000000000000000000000007' const L2StandardBridgeAddress = '0x4200000000000000000000000000000000000010' // const L2GasOracle = '0x420000000000000000000000000000000000000F' -const L2_SECONDARYFEETOKEN_ADDRESS = '0x4200000000000000000000000000000000000023' +const L2_SECONDARYFEETOKEN_ADDRESS = + '0x4200000000000000000000000000000000000023' const ADDRESS_CONFIG = { - [ NETWORK_TYPE.MAINNET ]: { - [ NETWORK.ETHEREUM ]: { + [NETWORK_TYPE.MAINNET]: { + [NETWORK.ETHEREUM]: { ...addresses_Mainnet, ...layerZeroMainnet.BOBA_Bridges.Mainnet, ...layerZeroMainnet.Layer_Zero_Protocol.Mainnet, - layerZeroTargetChainID: layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId, + layerZeroTargetChainID: + layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId, }, - [ NETWORK.AVAX ]: { + [NETWORK.AVAX]: { ...addresses_BobaAvax, ...layerZeroMainnet.BOBA_Bridges.Avalanche, ...layerZeroMainnet.Layer_Zero_Protocol.Avalanche, - layerZeroTargetChainID: layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId, + layerZeroTargetChainID: + layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId, }, - [ NETWORK.BNB ]: { + [NETWORK.BNB]: { ...addresses_BobaBnb, ...layerZeroMainnet.BOBA_Bridges.BNB, ...layerZeroMainnet.Layer_Zero_Protocol.BNB, - layerZeroTargetChainID: layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId, - } + layerZeroTargetChainID: + layerZeroMainnet.Layer_Zero_Protocol.Mainnet.Layer_Zero_ChainId, + }, }, - [ NETWORK_TYPE.TESTNET ]: { - [ NETWORK.ETHEREUM ]: { + [NETWORK_TYPE.TESTNET]: { + [NETWORK.ETHEREUM]: { ...addresses_Goerli, ...layerZeroTestnet.BOBA_Bridges.Testnet, ...layerZeroTestnet.Layer_Zero_Protocol.Testnet, - layerZeroTargetChainID: layerZeroTestnet.Layer_Zero_Protocol.Testnet.Layer_Zero_ChainId, + layerZeroTargetChainID: + layerZeroTestnet.Layer_Zero_Protocol.Testnet.Layer_Zero_ChainId, }, - [ NETWORK.AVAX ]: { + [NETWORK.AVAX]: { ...addresses_BobaFuji, ...layerZeroTestnet.BOBA_Bridges.Avalanche, ...layerZeroTestnet.Layer_Zero_Protocol.Avalanche, - layerZeroTargetChainID: layerZeroTestnet.Layer_Zero_Protocol.Avalanche.Layer_Zero_ChainId, + layerZeroTargetChainID: + layerZeroTestnet.Layer_Zero_Protocol.Avalanche.Layer_Zero_ChainId, }, - [ NETWORK.BNB ]: { + [NETWORK.BNB]: { ...addresses_BobaBnbTestnet, ...layerZeroTestnet.BOBA_Bridges.BNB, ...layerZeroTestnet.Layer_Zero_Protocol.BNB, - layerZeroTargetChainID: layerZeroTestnet.Layer_Zero_Protocol.BNB.Layer_Zero_ChainId, - } - } + layerZeroTargetChainID: + layerZeroTestnet.Layer_Zero_Protocol.BNB.Layer_Zero_ChainId, + }, + }, } const SUPPORTED_ASSETS = { - [ NETWORK_TYPE.MAINNET ]: { - [ NETWORK.ETHEREUM ]: { + [NETWORK_TYPE.MAINNET]: { + [NETWORK.ETHEREUM]: { tokens: [ - 'USDT', 'DAI', 'USDC', 'WBTC', 'REP', 'BAT', 'ZRX', 'SUSHI', - 'LINK', 'UNI', 'BOBA', 'xBOBA', 'OMG', 'FRAX', 'FXS', 'DODO', - 'UST', 'BUSD', 'BNB', 'FTM', 'MATIC', 'UMA', 'DOM', 'OLO', - 'WAGMIv0', 'WAGMIv1', 'WAGMIv2', 'WAGMIv2-Oolong', 'WAGMIv3', 'WAGMIv3-Oolong', - 'CGT' + 'USDT', + 'DAI', + 'USDC', + 'WBTC', + 'REP', + 'BAT', + 'ZRX', + 'SUSHI', + 'LINK', + 'UNI', + 'BOBA', + 'xBOBA', + 'OMG', + 'FRAX', + 'FXS', + 'DODO', + 'UST', + 'BUSD', + 'BNB', + 'FTM', + 'MATIC', + 'UMA', + 'DOM', + 'OLO', + 'WAGMIv0', + 'WAGMIv1', + 'WAGMIv2', + 'WAGMIv2-Oolong', + 'WAGMIv3', + 'WAGMIv3-Oolong', + 'CGT', ], tokenAddresses: { WAGMIv0: { - 'L1': 'WAGMIv0', - 'L2': '0x8493C4d9Cd1a79be0523791E3331c78Abb3f9672' + L1: 'WAGMIv0', + L2: '0x8493C4d9Cd1a79be0523791E3331c78Abb3f9672', }, WAGMIv1: { - 'L1': 'WAGMIv1', - 'L2': '0xCe055Ea4f29fFB8bf35E852522B96aB67Cbe8197' + L1: 'WAGMIv1', + L2: '0xCe055Ea4f29fFB8bf35E852522B96aB67Cbe8197', }, WAGMIv2: { - 'L1': 'WAGMIv2', - 'L2': '0x76B5908ecd0ae3DB23011ae96b7C1f803D63136c' + L1: 'WAGMIv2', + L2: '0x76B5908ecd0ae3DB23011ae96b7C1f803D63136c', }, 'WAGMIv2-Oolong': { - 'L1': 'WAGMIv2-Oolong', - 'L2': '0x49a3e4a1284829160f95eE785a1A5FfE2DD5Eb1D' + L1: 'WAGMIv2-Oolong', + L2: '0x49a3e4a1284829160f95eE785a1A5FfE2DD5Eb1D', }, - 'WAGMIv3': { - 'L1': 'WAGMIv3', - 'L2': '0xC6158B1989f89977bcc3150fC1F2eB2260F6cabE' + WAGMIv3: { + L1: 'WAGMIv3', + L2: '0xC6158B1989f89977bcc3150fC1F2eB2260F6cabE', }, 'WAGMIv3-Oolong': { - 'L1': 'WAGMIv3-Oolong', - 'L2': '0x70bf3c5B5d80C4Fece8Bde0fCe7ef38B688463d4' + L1: 'WAGMIv3-Oolong', + L2: '0x70bf3c5B5d80C4Fece8Bde0fCe7ef38B688463d4', }, OLO: { - 'L1': 'OLO', - 'L2': '0x5008F837883EA9a07271a1b5eB0658404F5a9610' + L1: 'OLO', + L2: '0x5008F837883EA9a07271a1b5eB0658404F5a9610', }, CGT: { - 'L1': '0xf56b164efd3cfc02ba739b719b6526a6fa1ca32a', - 'L2': '0xf56b164efd3cfc02ba739b719b6526a6fa1ca32a' - } + L1: '0xf56b164efd3cfc02ba739b719b6526a6fa1ca32a', + L2: '0xf56b164efd3cfc02ba739b719b6526a6fa1ca32a', + }, }, - altL1Chains: [ 'BNB', 'Avalanche' ] + altL1Chains: ['BNB', 'Avalanche'], }, - [ NETWORK.AVAX ]: { + [NETWORK.AVAX]: { tokenAddresses: { - 'EVO': { 'L1': '0x42006Ab57701251B580bDFc24778C43c9ff589A1', 'L2': '0xc8849f32138de93F6097199C5721a9EfD91ceE01' } + EVO: { + L1: '0x42006Ab57701251B580bDFc24778C43c9ff589A1', + L2: '0xc8849f32138de93F6097199C5721a9EfD91ceE01', + }, }, - tokens: [ 'BOBA', 'AVAX', 'EVO', 'USDT.e', 'USDt', 'USDC.e', 'BUSD.e', 'BUSD', 'DAI.e' ], - altL1Chains: [ 'Avalanche' ] + tokens: [ + 'BOBA', + 'AVAX', + 'EVO', + 'USDT.e', + 'USDt', + 'USDC.e', + 'BUSD.e', + 'BUSD', + 'DAI.e', + ], + altL1Chains: ['Avalanche'], }, - [ NETWORK.BNB ]: { + [NETWORK.BNB]: { tokenAddresses: {}, - tokens: [ 'BOBA', 'BNB', 'BUSD', 'USDC', 'USDT', 'SUSHI' ], - altL1Chains: [ 'BNB' ] - } + tokens: ['BOBA', 'BNB', 'BUSD', 'USDC', 'USDT', 'SUSHI'], + altL1Chains: ['BNB'], + }, }, - [ NETWORK_TYPE.TESTNET ]: { - [ NETWORK.ETHEREUM ]: { + [NETWORK_TYPE.TESTNET]: { + [NETWORK.ETHEREUM]: { tokenAddresses: {}, - tokens: [ 'BOBA', 'USDC', 'OMG', 'xBOBA' ], - altL1Chains: [ 'BNB', 'Avalanche' ] + tokens: ['BOBA', 'USDC', 'OMG', 'xBOBA'], + altL1Chains: ['BNB', 'Avalanche'], }, - [ NETWORK.AVAX ]: { + [NETWORK.AVAX]: { tokenAddresses: {}, - tokens: [ 'BOBA', 'AVAX' ], - altL1Chains: [ 'Avalanche' ] + tokens: ['BOBA', 'AVAX'], + altL1Chains: ['Avalanche'], }, - [ NETWORK.BNB ]: { + [NETWORK.BNB]: { tokenAddresses: {}, - tokens: [ 'BOBA', 'BNB', 'MMT' ], - altL1Chains: [ 'BNB' ] - } - } + tokens: ['BOBA', 'BNB', 'MMT'], + altL1Chains: ['BNB'], + }, + }, } class AppService { - - - /** * @fetchAddresses * @@ -160,14 +203,10 @@ class AppService { * - L2_ETH_Address * - L1_ETH_Address * - */ - + */ - fetchAddresses({ - networkType, - network - }) { - let addresses = ADDRESS_CONFIG[ networkType ][ network ] || {}; + fetchAddresses({ networkType, network }) { + let addresses = ADDRESS_CONFIG[networkType][network] || {} return { ...addresses, @@ -177,9 +216,8 @@ class AppService { L2MessengerAddress, L2_ETH_Address: L2_BOBA_Address, L2_BOBA_Address, - L1_ETH_Address - }; - + L1_ETH_Address, + } } /** @@ -188,26 +226,19 @@ class AppService { * * will return {supported tokens and token address} * - */ + */ - fetchSupportedAssets({ - networkType, - network - }) { - return SUPPORTED_ASSETS[ networkType ][ network ] || {}; + fetchSupportedAssets({ networkType, network }) { + return SUPPORTED_ASSETS[networkType][network] || {} } /** * @setupInitState * setup initial state of token reducer * - */ - - setupInitState({ - l1Token, - l1TokenName - }) { + */ + setupInitState({ l1Token, l1TokenName }) { store.dispatch({ type: 'TOKEN/GET/SUCCESS', payload: { @@ -219,12 +250,11 @@ class AppService { decimals: 18, name: l1TokenName, redalert: false, - } - }); + }, + }) } +} -}; - -const appService = new AppService(); +const appService = new AppService() -export default appService; +export default appService diff --git a/packages/boba/gateway/src/services/faucet.service.js b/packages/boba/gateway/src/services/faucet.service.js index 09a3c0ac05..a6510ee0a5 100644 --- a/packages/boba/gateway/src/services/faucet.service.js +++ b/packages/boba/gateway/src/services/faucet.service.js @@ -35,7 +35,6 @@ class FaucetService { const response = await metaTransactionAxiosInstance( networkService.networkConfig ).post('/send.getTestnetETH', { hashedMsg, signature, tweetId, walletAddress: networkService.account }) - console.log(["metaTransactionAxiosInstance res",response]) } catch (error) { let errorMsg = error?.response?.data?.error?.error?.body if (errorMsg) { diff --git a/packages/boba/gateway/src/services/networkService.js b/packages/boba/gateway/src/services/networkService.js index b29304b6ea..e66ad9c27c 100644 --- a/packages/boba/gateway/src/services/networkService.js +++ b/packages/boba/gateway/src/services/networkService.js @@ -344,7 +344,6 @@ class NetworkService { const response = await metaTransactionAxiosInstance( this.networkConfig ).post(swapUrl, { owner, spender, value, deadline, signature, data }) - console.log(['meta tx fee res', response]) await this.getBobaFeeChoice() } catch (error) { let errorData = error.response.data.error @@ -2100,7 +2099,6 @@ class NetworkService { //returns total cost in ETH return totalCost } catch (error) { - console.log(['GetExitCost',error]); return 0; } } @@ -4737,6 +4735,15 @@ class NetworkService { return (await this.provider.getBlock(blockNumber)).timestamp; } + async getBlockExplorerLinks() { + if (this.networkConfig) { + const l1Explorer = this.networkConfig.L1.blockExplorerUrl + const l2Explorer = this.networkConfig.L2.blockExplorerUrl + return [l1Explorer, l2Explorer] + } + return [] + } + } const networkService = new NetworkService() diff --git a/packages/boba/gateway/src/services/transaction.service.js b/packages/boba/gateway/src/services/transaction.service.js index 7598633fa6..f4ac451c30 100644 --- a/packages/boba/gateway/src/services/transaction.service.js +++ b/packages/boba/gateway/src/services/transaction.service.js @@ -1,32 +1,33 @@ -import omgxWatcherAxiosInstance from "api/omgxWatcherAxios"; -import networkService from "./networkService"; - +import omgxWatcherAxiosInstance from 'api/omgxWatcherAxios' +import networkService from './networkService' +import {AllNetworkConfigs} from 'util/network/network.util' class TransactionService { - - async getSevens() { - const response = await omgxWatcherAxiosInstance(networkService.networkConfig) - .get('get.l2.pendingexits') + async getSevens(networkConfig = networkService.networkConfig) { + const response = await omgxWatcherAxiosInstance( + networkConfig + ).get('get.l2.pendingexits') if (response.status === 201) { const data = response.data const filtered = data.filter( - (i) => (i.fastRelay === 0) && (i.status === 'pending') + (i) => i.fastRelay === 0 && i.status === 'pending' ) return filtered } else { return [] } - } - async getFastExits() { - const response = await omgxWatcherAxiosInstance(networkService.networkConfig).get('get.l2.pendingexits') + async getFastExits(networkConfig = networkService.networkConfig) { + const response = await omgxWatcherAxiosInstance( + networkConfig + ).get('get.l2.pendingexits') if (response.status === 201) { const data = response.data const filtered = data.filter( - (i) => (i.fastRelay === 1) && (i.status === 'pending') + (i) => i.fastRelay === 1 && i.status === 'pending' ) return filtered } else { @@ -35,72 +36,91 @@ class TransactionService { } // fetch L2 transactions from omgxWatcherAxiosInstance - async fetchL2Tx() { - let L2Txs = []; + async fetchL2Tx(networkConfig = networkService.networkConfig) { + let L2Txs = [] try { - const responseL2 = await omgxWatcherAxiosInstance(networkService.networkConfig) + const responseL2 = await omgxWatcherAxiosInstance( + networkConfig + ) .post('get.l2.transactions', { address: networkService.account, fromRange: 0, toRange: 1000, - }).catch((error) => { console.log('get l2 tx', error) }) + }) + .catch((error) => { + console.log('get l2 tx', error) + }) if (responseL2.status === 201) { - L2Txs = responseL2.data.map(v => ({ ...v, chain: 'L2' })) + L2Txs = responseL2.data.map((v) => ({ + ...v, layer: 'L2', chainName: networkConfig.L2.name, + originChainId: networkConfig.L2.chainId, + destinationChainId: networkConfig.L1.chainId + })) } return L2Txs } catch (error) { - console.log('TS: fetchL2Tx',error) + console.log('TS: fetchL2Tx', error) return L2Txs } } // fetch L0 transactions from omgxWatcherAxiosInstance - async fetchL0Tx() { - let L0Txs = []; + async fetchL0Tx(networkConfig = networkService.networkConfig) { + let L0Txs = [] try { - const responseL0 = await omgxWatcherAxiosInstance(networkService.networkConfig) - .post('get.layerzero.transactions', { - address: networkService.account, - fromRange: 0, - toRange: 1000, - }) + const responseL0 = await omgxWatcherAxiosInstance( + networkConfig + ).post('get.layerzero.transactions', { + address: networkService.account, + fromRange: 0, + toRange: 1000, + }) if (responseL0.status === 201) { L0Txs = responseL0.data.map((v) => ({ ...v, hash: v.tx_hash, blockNumber: parseInt(v.block_number), - timeStamp: parseInt(v.timestamp), //fix bug - sometimes this is string, sometimes an integer - chain: 'L0', + timeStamp: parseInt(v.timestamp), //fix bug - sometimes this is string, sometimes an integer + layer: 'L0', + chainName: networkConfig.L1.name, + originChainId: networkConfig.L1.chainId, altL1: true, })) } return L0Txs } catch (error) { - console.log('TS: fetchL0Tx',error) + console.log('TS: fetchL0Tx', error) return L0Txs } } // fetch L1 pending transactions from omgxWatcherAxiosInstance - async fetchL1PendingTx() { - let txL1pending = []; + async fetchL1PendingTx(networkConfig = networkService.networkConfig) { + let txL1pending = [] try { - const responseL1pending = await omgxWatcherAxiosInstance(networkService.networkConfig) - .post('get.l1.transactions', { - address: networkService.account, - fromRange: 0, - toRange: 1000, - }) + const responseL1pending = await omgxWatcherAxiosInstance( + networkConfig + ).post('get.l1.transactions', { + address: networkService.account, + fromRange: 0, + toRange: 1000, + }) if (responseL1pending.status === 201) { - //add the chain: 'L1pending' field - txL1pending = responseL1pending.data.map(v => ({ ...v, chain: 'L1pending' })) - }; + //add the chain: 'L1pending' field and chainName: field + txL1pending = responseL1pending.data.map((v) => ({ + ...v, + layer: 'L1pending', + chainName: networkConfig.L1.name, + originChainId: networkConfig.L1.chainId, + destinationChainId: networkConfig.L2.chainId + })) + } return txL1pending } catch (error) { - console.log('TS: fetchL1PendingTx',error) + console.log('TS: fetchL1PendingTx', error) return txL1pending } } @@ -109,19 +129,25 @@ class TransactionService { * @getTransactions * - loads L1Txs, l2Txs, l0Txs, L1PendingTxs * - */ - async getTransactions() { - const result = await Promise.all([ - this.fetchL2Tx(), - this.fetchL0Tx(), - this.fetchL1PendingTx() - ]) - return result.reduce((acc, res) => [ ...acc, ...res ], []) - } + */ + async getTransactions(networkConfig = networkService.networkConfig) { + const networksArray = Array.from(Object.values(AllNetworkConfigs)) -}; + const networkConfigsArray = networksArray.flatMap((network) => { + return [network.Testnet, network.Mainnet] + }) + const allNetworksTransactions = await Promise.all(networkConfigsArray.flatMap((config) => { + return [this.fetchL2Tx(config), + this.fetchL1PendingTx(config)] + } + )) + + const filteredResults = allNetworksTransactions.reduce((acc, res) => [...acc, ...res], []) + return filteredResults?.filter((transaction) => transaction.hash) + } +} -const transctionService = new TransactionService(); +const transctionService = new TransactionService() -export default transctionService; +export default transctionService diff --git a/packages/boba/gateway/src/services/wallet.service.js b/packages/boba/gateway/src/services/wallet.service.js index de269460cb..5de24f7d5f 100644 --- a/packages/boba/gateway/src/services/wallet.service.js +++ b/packages/boba/gateway/src/services/wallet.service.js @@ -18,6 +18,8 @@ limitations under the License. */ import WalletConnectProvider from "@walletconnect/web3-provider" import { rpcUrls } from 'util/network/network.util' import store from 'store' + import { CHAIN_ID_LIST, NetworkList } from 'util/network/network.util' +import { setActiveNetwork, setNetwork } from 'actions/networkAction' class WalletService { constructor() { @@ -28,6 +30,8 @@ limitations under the License. */ this.walletType = null } + + async connectMetaMask() { try { await window.ethereum.request({ method: 'eth_requestAccounts' }) @@ -57,8 +61,22 @@ limitations under the License. */ }) window.ethereum.on('chainChanged', (chainId) => { - console.log(`MetaMask chain changed to ${Number(chainId)}`) + const { networkType, chain } = CHAIN_ID_LIST[Number(chainId)] + const { + chain: network, + icon: networkIcon, + name + } = NetworkList[ networkType ].find(network => network.chain === chain); store.dispatch({ type: 'SETUP/CHAINIDCHANGED/SET', payload: Number(chainId) }) + store.dispatch( + setNetwork({ + networkType, + network, + networkIcon, + name + }) + ) + store.dispatch(setActiveNetwork()) }) } @@ -143,10 +161,10 @@ limitations under the License. */ return await this.connectWalletConnect() } } - + async addTokenToMetaMask(token) { const {address,symbol,decimals,logoURI,chain} = token; - window.ethereum + return window.ethereum .request({ method: "wallet_watchAsset", params: { diff --git a/packages/boba/gateway/src/themes/dark.ts b/packages/boba/gateway/src/themes/dark.ts index 1c96767b93..7b43bb336e 100644 --- a/packages/boba/gateway/src/themes/dark.ts +++ b/packages/boba/gateway/src/themes/dark.ts @@ -16,6 +16,7 @@ const dark = { background: '#191919', color: '#EEEEEE', colors: { + modalTransparent: 'transparent', danger: 'red', success: 'green', info: 'blue', diff --git a/packages/boba/gateway/src/themes/light.ts b/packages/boba/gateway/src/themes/light.ts index 512ff77cb3..431d4cb00e 100644 --- a/packages/boba/gateway/src/themes/light.ts +++ b/packages/boba/gateway/src/themes/light.ts @@ -16,6 +16,7 @@ const light = { background: '#FFFFFF', color: '#22221E', colors: { + modalTransparent: '#fff', danger: '#FF0000', success: 'green', info: 'blue', diff --git a/packages/boba/gateway/src/themes/screens.ts b/packages/boba/gateway/src/themes/screens.ts index 9d0dfb646b..872d8d3594 100644 --- a/packages/boba/gateway/src/themes/screens.ts +++ b/packages/boba/gateway/src/themes/screens.ts @@ -1,14 +1,16 @@ import { css } from 'styled-components' const size = { - mobile: '640px', - tablet: '1024px', + mobile: '767px', + tablet: '980px', + smallDesktop: '1023px', desktop: '1200px', } export const screen = { mobile: `(max-width : ${size.mobile})`, tablet: `(max-width : ${size.tablet})`, + smallDesktop: `(max-width : ${size.smallDesktop})`, laptop: `(max-width : ${size.desktop})`, } @@ -22,6 +24,11 @@ export const tablet = (inner: any) => css` ${inner}; } ` +export const sdesktop = (inner: any) => css` + @media (max-width: ${size.smallDesktop}) { + ${inner}; + } +` export const desktop = (inner: any) => css` @media (max-width: ${size.desktop}) { ${inner}; diff --git a/packages/boba/gateway/src/util/coinImage.ts b/packages/boba/gateway/src/util/coinImage.ts index 8d35831b2a..4e9e3f8872 100644 --- a/packages/boba/gateway/src/util/coinImage.ts +++ b/packages/boba/gateway/src/util/coinImage.ts @@ -1,16 +1,16 @@ -import TESTLogo from 'images/test.svg' -import mttLogo from 'images/mtt.png' +import TESTLogo from 'assets/images/test.svg' +import mttLogo from 'assets/images/mtt.png' export const getCoinImage = (symbol: string): string => { const logoURIbase = 'https://raw.githubusercontent.com/bobanetwork/token-list/main/assets' let url = `${logoURIbase}/${symbol?.toLowerCase()}.svg` + if (symbol === 'test') { url = TESTLogo } if (symbol === 'mtt') { url = mttLogo } - return url } diff --git a/packages/boba/gateway/src/util/constant.ts b/packages/boba/gateway/src/util/constant.ts index 6510ab4451..ecb0caf5dd 100644 --- a/packages/boba/gateway/src/util/constant.ts +++ b/packages/boba/gateway/src/util/constant.ts @@ -132,7 +132,7 @@ type DefaultNetworkType = { export const DEFAULT_NETWORK: DefaultNetworkType = { NAME: { L1: 'Ethereum', - L2: 'Boba', + L2: 'Boba ETH', }, ICON: { L1: 'ethereum', diff --git a/packages/boba/gateway/src/util/network/network.util.js b/packages/boba/gateway/src/util/network/network.util.js index ad4d1ac8da..766f48e856 100644 --- a/packages/boba/gateway/src/util/network/network.util.js +++ b/packages/boba/gateway/src/util/network/network.util.js @@ -110,7 +110,7 @@ export const NetworkList = { key: 'ethereum', name: { l1: 'Ethereum', - l2: 'Boba' + l2: 'Boba ETH' } }, { @@ -142,7 +142,7 @@ export const NetworkList = { key: 'ethereum', name: { l1: 'Ethereum (Goerli)', - l2: 'Boba', + l2: 'Boba (Goerli)', } }, { @@ -168,13 +168,13 @@ export const NetworkList = { ] } -const networkConfig = { +export const AllNetworkConfigs = { [NETWORK.ETHEREUM] : ethereumConfig, [NETWORK.BNB] : bnbConfig, [NETWORK.AVAX] : avaxConfig } -export const rpcUrls = Object.values(networkConfig).reduce((networkConfigs, networkConfig) => { +export const rpcUrls = Object.values(AllNetworkConfigs).reduce((networkConfigs, networkConfig) => { networkConfigs[networkConfig.Mainnet.L1.chainId] = networkConfig.Mainnet.L1.rpcUrl[0] networkConfigs[networkConfig.Mainnet.L2.chainId] = networkConfig.Mainnet.L2.rpcUrl networkConfigs[networkConfig.Testnet.L1.chainId] = networkConfig.Testnet.L1.rpcUrl[0] @@ -186,7 +186,7 @@ export const getNetworkDetail = ({ network, networkType }) => { - return networkConfig[network][networkType] + return AllNetworkConfigs[network][networkType] } export const getBlockExplorerUrl = ({ @@ -194,7 +194,7 @@ export const getBlockExplorerUrl = ({ networkType, layer }) => { - return networkConfig[network][networkType][layer]?.blockExplorerUrl + return AllNetworkConfigs[network][networkType][layer]?.blockExplorerUrl } export const pingRpcUrl = async ( diff --git a/packages/boba/gateway/src/util/objectManipulation.ts b/packages/boba/gateway/src/util/objectManipulation.ts new file mode 100644 index 0000000000..a9d01b21e3 --- /dev/null +++ b/packages/boba/gateway/src/util/objectManipulation.ts @@ -0,0 +1,3 @@ +export const ValidValuesFromArray = (array: any): any[] => { + return array.filter((element: any) => element) +} diff --git a/yarn.lock b/yarn.lock index 6d5f478e57..ad45a4ca8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -929,6 +929,17 @@ "@babel/traverse" "^7.20.10" "@babel/types" "^7.20.7" +"@babel/helper-module-transforms@^7.21.5", "@babel/helper-module-transforms@^7.22.5", "@babel/helper-module-transforms@^7.22.9": + version "7.22.9" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz#92dfcb1fbbb2bc62529024f72d942a8c97142129" + integrity sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ== + dependencies: + "@babel/helper-environment-visitor" "^7.22.5" + "@babel/helper-module-imports" "^7.22.5" + "@babel/helper-simple-access" "^7.22.5" + "@babel/helper-split-export-declaration" "^7.22.6" + "@babel/helper-validator-identifier" "^7.22.5" + "@babel/helper-module-transforms@^7.22.1": version "7.22.1" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.1.tgz#e0cad47fedcf3cae83c11021696376e2d5a50c63" @@ -943,17 +954,6 @@ "@babel/traverse" "^7.22.1" "@babel/types" "^7.22.0" -"@babel/helper-module-transforms@^7.22.5", "@babel/helper-module-transforms@^7.22.9": - version "7.22.9" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.22.9.tgz#92dfcb1fbbb2bc62529024f72d942a8c97142129" - integrity sha512-t+WA2Xn5K+rTeGtC8jCsdAH52bjggG5TKRuRrAGNM/mjIbO4GxvlLMFOEz9wXY5I2XQ60PMFsAG2WIcG82dQMQ== - dependencies: - "@babel/helper-environment-visitor" "^7.22.5" - "@babel/helper-module-imports" "^7.22.5" - "@babel/helper-simple-access" "^7.22.5" - "@babel/helper-split-export-declaration" "^7.22.6" - "@babel/helper-validator-identifier" "^7.22.5" - "@babel/helper-optimise-call-expression@^7.18.6": version "7.18.6" resolved "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.18.6.tgz" @@ -6328,11 +6328,6 @@ resolved "https://registry.yarnpkg.com/@popperjs/core/-/core-2.11.8.tgz#6b79032e760a0899cd4204710beede972a3a185f" integrity sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A== -"@popperjs/core@^2.9.2": - version "2.11.6" - resolved "https://registry.npmjs.org/@popperjs/core/-/core-2.11.6.tgz" - integrity sha512-50/17A98tWUfQ176raKiOGXuYpLyyVMkxxG6oylzL3BPOlA6ADGdK7EYunSa4I064xerltq9TGXs8HmOk5E+vw== - "@remix-run/router@1.7.1": version "1.7.1" resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.7.1.tgz#fea7ac35ae4014637c130011f59428f618730498" @@ -7315,7 +7310,7 @@ "@storybook/preview-api" "7.0.18" "@storybook/types" "7.0.18" -"@storybook/api@7.0.18", "@storybook/api@^7.0.17", "@storybook/api@^7.0.2": +"@storybook/api@7.0.18": version "7.0.18" resolved "https://registry.yarnpkg.com/@storybook/api/-/api-7.0.18.tgz#6304f7f5160b404b61e4080da0a952074258cf1f" integrity sha512-gikVJBR2z7LdepljmbvbsrYgywQm3jNEEEmjG0OwYDeYNjWPuoQSffT+LoyouaaCK90d1osJLl3062OkwlIG8g== @@ -7323,6 +7318,14 @@ "@storybook/client-logger" "7.0.18" "@storybook/manager-api" "7.0.18" +"@storybook/api@^7.0.17", "@storybook/api@^7.0.2": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/api/-/api-7.2.1.tgz#034aa2596e241dfba2758b86161da4017d3abea4" + integrity sha512-wPZYOFBFVgzXv7QxwtBYi17tn4bCneV3FO3vNa9JUPrD+NaLkuY73BiuRJ1gk2+FuDnodJyOwNJFCkKUKJZa6Q== + dependencies: + "@storybook/client-logger" "7.2.1" + "@storybook/manager-api" "7.2.1" + "@storybook/blocks@7.0.18", "@storybook/blocks@^7.0.15": version "7.0.18" resolved "https://registry.yarnpkg.com/@storybook/blocks/-/blocks-7.0.18.tgz#996651ac813de2a810ba442ab77266961721d324" @@ -7521,6 +7524,18 @@ telejson "^7.0.3" tiny-invariant "^1.3.1" +"@storybook/channels@7.2.1": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-7.2.1.tgz#06e5f3ea5134bceb64110d36ba4f2eda5855be73" + integrity sha512-3ZogzjwlFG+oarwnI7TTvWvHVOUtJbjrgZkM5QuLMlxNzIR1XuBY8f01yf4K8+VpdNy9DY+7Q/j6tBThfwYvpA== + dependencies: + "@storybook/client-logger" "7.2.1" + "@storybook/core-events" "7.2.1" + "@storybook/global" "^5.0.0" + qs "^6.10.0" + telejson "^7.0.3" + tiny-invariant "^1.3.1" + "@storybook/cli@7.1.1": version "7.1.1" resolved "https://registry.yarnpkg.com/@storybook/cli/-/cli-7.1.1.tgz#ca3d4559be81209cd6e4f1e7eea8f369053c6d31" @@ -7596,7 +7611,7 @@ dependencies: "@storybook/global" "^5.0.0" -"@storybook/client-logger@7.0.27", "@storybook/client-logger@^7.0.0-beta.0 || ^7.0.0-rc.0 || ^7.0.0": +"@storybook/client-logger@7.0.27": version "7.0.27" resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-7.0.27.tgz#22675527cca26e5f275157b8bbc72fd102856177" integrity sha512-t4F0ByHP4MNiyVI5sgqtxSccr4RmPAqTr/h6CeGLJKWzUYobBV5hwKUd/qlfwdjev2u9C7AdLFPBKVcHX5PteA== @@ -7610,6 +7625,13 @@ dependencies: "@storybook/global" "^5.0.0" +"@storybook/client-logger@7.2.1", "@storybook/client-logger@^7.0.0-beta.0 || ^7.0.0-rc.0 || ^7.0.0": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-7.2.1.tgz#6e338185e8c2d1861c0245791c8747a38b0a46e5" + integrity sha512-Lyht/lJg2S65CXRy9rXAZXP/Mgye7jbi/aqQL8z9VRMGChbL+k/3pSZnXTTrD1OVSpCEr4UWA+9bStzT4VjtYA== + dependencies: + "@storybook/global" "^5.0.0" + "@storybook/codemod@7.1.1": version "7.1.1" resolved "https://registry.yarnpkg.com/@storybook/codemod/-/codemod-7.1.1.tgz#3fe3c80d44eb967770bf78d3f34a2b2f3da185e9" @@ -7785,6 +7807,11 @@ resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-7.1.1.tgz#c2c30085bd254a27cdbd266a8e7755876abf9361" integrity sha512-P5iI4zvCJo85de/sghglEHFK/GGkWAQQKzRFrz9kbVBX5LNaosfD7IYHIz/6ZWNPzxWR+RBOKcrRUfcArL4Njg== +"@storybook/core-events@7.2.1": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-7.2.1.tgz#05121c9bac6ac3989acc05b49116107331e0c398" + integrity sha512-EUXYb3gyQ2EzpDAWkgfoDl1EPabj3OE6+zntsD/gwvzQU85BTocs10ksnRyS55bfrQpYbf+Z+gw2CZboyagLgg== + "@storybook/core-server@7.1.1": version "7.1.1" resolved "https://registry.yarnpkg.com/@storybook/core-server/-/core-server-7.1.1.tgz#5e4d9a274bde32eb483d609fe7005382842633db" @@ -7993,7 +8020,7 @@ telejson "^7.0.3" ts-dedent "^2.0.0" -"@storybook/manager-api@7.0.27", "@storybook/manager-api@^7.0.2": +"@storybook/manager-api@7.0.27": version "7.0.27" resolved "https://registry.yarnpkg.com/@storybook/manager-api/-/manager-api-7.0.27.tgz#270e560e791f4275882e844af228ba78450b492e" integrity sha512-CVgy4ti8h0Xc4nxiPujTzhMANl9wmfLGvSA9ZX6YUBbKFV4UOL4oj105iHPW7Ngse6Qoqj0rnhkOSmLczXT03w== @@ -8014,6 +8041,27 @@ telejson "^7.0.3" ts-dedent "^2.0.0" +"@storybook/manager-api@7.2.1", "@storybook/manager-api@^7.0.2": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/manager-api/-/manager-api-7.2.1.tgz#85d6dc521601111a68b942405f425cad1484b0b4" + integrity sha512-jRuYTrsNKq+g1u9kbQRvBsRKVITOdiNu9c633MeCH73oBVo8WNnZF/tW/ER86oTnru0H7EmRdgz3v9ft/wS2GQ== + dependencies: + "@storybook/channels" "7.2.1" + "@storybook/client-logger" "7.2.1" + "@storybook/core-events" "7.2.1" + "@storybook/csf" "^0.1.0" + "@storybook/global" "^5.0.0" + "@storybook/router" "7.2.1" + "@storybook/theming" "7.2.1" + "@storybook/types" "7.2.1" + dequal "^2.0.2" + lodash "^4.17.21" + memoizerific "^1.11.3" + semver "^7.3.7" + store2 "^2.14.2" + telejson "^7.0.3" + ts-dedent "^2.0.0" + "@storybook/manager@7.1.1": version "7.1.1" resolved "https://registry.yarnpkg.com/@storybook/manager/-/manager-7.1.1.tgz#e8f0a56afc3cd6c24e045e1f04c463cefc9c46e2" @@ -8288,6 +8336,15 @@ memoizerific "^1.11.3" qs "^6.10.0" +"@storybook/router@7.2.1": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/router/-/router-7.2.1.tgz#6c3ff9c9fd7e292b9a1328fc0f08223aee2150df" + integrity sha512-9Cn5boUS+7yhrKlSy1kt7ruNs/znk3555kclBD6+uuhH/dD84feGeiGYE4GUuLmcKrDFtNF185/Gr1huJ556tA== + dependencies: + "@storybook/client-logger" "7.2.1" + memoizerific "^1.11.3" + qs "^6.10.0" + "@storybook/store@7.0.18": version "7.0.18" resolved "https://registry.yarnpkg.com/@storybook/store/-/store-7.0.18.tgz#3b9dce8a3fa6ceea5b650254ba284ef6c8bb4740" @@ -8361,6 +8418,16 @@ "@storybook/global" "^5.0.0" memoizerific "^1.11.3" +"@storybook/theming@7.2.1": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-7.2.1.tgz#55a1c27ae3a2c1594126f80853422b9cf4d64bf0" + integrity sha512-cfnNCLvKmzxjmoYKfLl7Q64gSTouLvd23CtvBAOlWcRYnMJ9v4/7A2tK3xQyVRlJYh9OuXiHFLL8AXbN58Hkzw== + dependencies: + "@emotion/use-insertion-effect-with-fallbacks" "^1.0.0" + "@storybook/client-logger" "7.2.1" + "@storybook/global" "^5.0.0" + memoizerific "^1.11.3" + "@storybook/types@7.0.18": version "7.0.18" resolved "https://registry.yarnpkg.com/@storybook/types/-/types-7.0.18.tgz#9418da288db3a1258996aab17fd49ca4eb810b7a" @@ -8411,6 +8478,16 @@ "@types/express" "^4.7.0" file-system-cache "2.3.0" +"@storybook/types@7.2.1": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@storybook/types/-/types-7.2.1.tgz#c10449955a1fc1ef57e270feace2bbd3bd87a1e6" + integrity sha512-YwlIY1uyxfJjijbB5x1d1QOKaUUDJnMX8BSb8oGqU4cyT76X/Is4CbGs+vccFsJo0tZu1GfuahYXl0EDT0nnSQ== + dependencies: + "@storybook/channels" "7.2.1" + "@types/babel__core" "^7.0.0" + "@types/express" "^4.7.0" + file-system-cache "2.3.0" + "@surma/rollup-plugin-off-main-thread@^2.2.3": version "2.2.3" resolved "https://registry.yarnpkg.com/@surma/rollup-plugin-off-main-thread/-/rollup-plugin-off-main-thread-2.2.3.tgz#ee34985952ca21558ab0d952f00298ad2190c053" @@ -12520,6 +12597,14 @@ boolbase@^1.0.0, boolbase@~1.0.0: resolved "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz" integrity sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww== +bootstrap-daterangepicker@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/bootstrap-daterangepicker/-/bootstrap-daterangepicker-3.1.0.tgz#632e6fb2de4b6360c5c0a9d5f6adb9aace051fe8" + integrity sha512-oaQZx6ZBDo/dZNyXGVi2rx5GmFXThyQLAxdtIqjtLlYVaQUfQALl5JZMJJZzyDIX7blfy4ppZPAJ10g8Ma4d/g== + dependencies: + jquery ">=1.10" + moment "^2.9.0" + bowser@^2.11.0: version "2.11.0" resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.11.0.tgz#5ca3c35757a7aa5771500c70a73a9f91ef420a8f" @@ -13155,20 +13240,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001400: - version "1.0.30001442" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001442.tgz" - integrity sha512-239m03Pqy0hwxYPYR5JwOIxRJfLTWtle9FV8zosfV5pHg+/51uD4nxcUlM8+mWWGfwKtt8lJNHnD3cWw9VZ6ow== - -caniuse-lite@^1.0.30001449: - version "1.0.30001462" - resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001462.tgz" - integrity sha512-PDd20WuOBPiasZ7KbFnmQRyuLE7cFXW2PVd7dmALzbkUXEP46upAuCDm9eY9vho8fgNMGmbAX92QBZHzcnWIqw== - -caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001489: - version "1.0.30001495" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001495.tgz#64a0ccef1911a9dcff647115b4430f8eff1ef2d9" - integrity sha512-F6x5IEuigtUfU5ZMQK2jsy5JqUUlEFRVZq8bO2a+ysq5K7jD6PPc9YXZj78xDNS3uNchesp1Jw47YXEqr+Viyg== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30001400, caniuse-lite@^1.0.30001449, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001489: + version "1.0.30001513" + resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001513.tgz" + integrity sha512-pnjGJo7SOOjAGytZZ203Em95MRM8Cr6jhCXNF/FAXTpCTRTECnqQWLpiTRqrFtdYcth8hf4WECUpkezuYsMVww== caniuse-lite@^1.0.30001517: version "1.0.30001517" @@ -14787,12 +14862,7 @@ data-urls@^2.0.0: whatwg-mimetype "^2.3.0" whatwg-url "^8.0.0" -date-fns@^2.24.0: - version "2.29.3" - resolved "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz" - integrity sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA== - -date-fns@^2.29.3: +date-fns@^2.29.3, date-fns@^2.30.0: version "2.30.0" resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-2.30.0.tgz#f367e644839ff57894ec6ac480de40cae4b0f4d0" integrity sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw== @@ -21168,6 +21238,11 @@ joycon@^3.1.1: resolved "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz" integrity sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw== +jquery@>=1.10: + version "3.7.0" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.0.tgz#fe2c01a05da500709006d8790fe21c8a39d75612" + integrity sha512-umpJ0/k8X0MvD1ds0P9SfowREz2LenHsQaxSohMZ5OMNEU2r0tf8pdeEFTHMFxWVxKNyU9rTtK3CWzUCTKJUeQ== + js-sdsl@^4.1.4: version "4.2.0" resolved "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.2.0.tgz" @@ -23677,6 +23752,11 @@ module-error@^1.0.1, module-error@^1.0.2: resolved "https://registry.npmjs.org/module-error/-/module-error-1.0.2.tgz" integrity sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA== +moment@^2.9.0: + version "2.29.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== + morgan@^1.10.0: version "1.10.0" resolved "https://registry.npmjs.org/morgan/-/morgan-1.10.0.tgz" @@ -26793,6 +26873,11 @@ react-app-rewired@^2.2.1: dependencies: semver "^5.6.0" +react-bootstrap-daterangepicker@^8.0.0: + version "8.0.0" + resolved "https://registry.yarnpkg.com/react-bootstrap-daterangepicker/-/react-bootstrap-daterangepicker-8.0.0.tgz#5c60670fae3cf9193fa274e4e12d9c878cb40d63" + integrity sha512-zwEMHq93/a0f2C2Cc/Q1zxN+jYWF4JsWEwVkJ2xVGp++Oc3Ck/fI2F9kiEqY1n8oKV0WFT4+cTcoagG7sWuXXw== + react-card-flip@^1.1.5: version "1.2.0" resolved "https://registry.npmjs.org/react-card-flip/-/react-card-flip-1.2.0.tgz" @@ -26804,16 +26889,21 @@ react-colorful@^5.1.2: integrity sha512-1exovf0uGTGyq5mXQT0zgQ80uvj2PCwvF8zY1RN9/vbJVSjSo3fsB/4L3ObbF7u70NduSiK4xu4Y6q1MHoUGEw== react-datepicker@^4.6.0: - version "4.8.0" - resolved "https://registry.npmjs.org/react-datepicker/-/react-datepicker-4.8.0.tgz" - integrity sha512-u69zXGHMpxAa4LeYR83vucQoUCJQ6m/WBsSxmUMu/M8ahTSVMMyiyQzauHgZA2NUr9y0FUgOAix71hGYUb6tvg== + version "4.16.0" + resolved "https://registry.yarnpkg.com/react-datepicker/-/react-datepicker-4.16.0.tgz#b9dd389bb5611a1acc514bba1dd944be21dd877f" + integrity sha512-hNQ0PAg/LQoVbDUO/RWAdm/RYmPhN3cz7LuQ3hqbs24OSp69QCiKOJRrQ4jk1gv1jNR5oYu8SjjgfDh8q6Q1yw== dependencies: - "@popperjs/core" "^2.9.2" + "@popperjs/core" "^2.11.8" classnames "^2.2.6" - date-fns "^2.24.0" + date-fns "^2.30.0" prop-types "^15.7.2" - react-onclickoutside "^6.12.0" - react-popper "^2.2.5" + react-onclickoutside "^6.12.2" + react-popper "^2.3.0" + +react-day-picker@^8.8.0: + version "8.8.0" + resolved "https://registry.yarnpkg.com/react-day-picker/-/react-day-picker-8.8.0.tgz#582b9d5e54a84926f159be2b4004801707b3c885" + integrity sha512-QIC3uOuyGGbtypbd5QEggsCSqVaPNu8kzUWquZ7JjW9fuWB9yv7WyixKmnaFelTLXFdq7h7zU6n/aBleBqe/dA== react-dev-utils@^12.0.1: version "12.0.1" @@ -26890,9 +26980,9 @@ react-error-overlay@^6.0.11: integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg== react-fast-compare@^3.0.1: - version "3.2.0" - resolved "https://registry.npmjs.org/react-fast-compare/-/react-fast-compare-3.2.0.tgz" - integrity sha512-rtGImPZ0YyLrscKI9xTpV8psd6I8VAtjKCzQDlzyDvqJA8XOW78TXYQwNRNd8g8JZnDu8q9Fu/1v4HPAVwVdHA== + version "3.2.2" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49" + integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ== react-ga4@^1.4.1: version "1.4.1" @@ -26934,14 +27024,14 @@ react-multi-carousel@^2.6.5: resolved "https://registry.yarnpkg.com/react-multi-carousel/-/react-multi-carousel-2.8.4.tgz#eee6493878974e372e5aa9944754602ec0f34968" integrity sha512-7Is5Wr+m2ebkR+oq2Su2tjUdBwpVtB2O6Tjb74KDNfxWe/FrsTQwezTJTk/r9cKCrRp9Li308v822/5bZm7XKg== -react-onclickoutside@^6.12.0: - version "6.12.2" - resolved "https://registry.npmjs.org/react-onclickoutside/-/react-onclickoutside-6.12.2.tgz" - integrity sha512-NMXGa223OnsrGVp5dJHkuKxQ4czdLmXSp5jSV9OqiCky9LOpPATn3vLldc+q5fK3gKbEHvr7J1u0yhBh/xYkpA== +react-onclickoutside@^6.12.2: + version "6.13.0" + resolved "https://registry.yarnpkg.com/react-onclickoutside/-/react-onclickoutside-6.13.0.tgz#e165ea4e5157f3da94f4376a3ab3e22a565f4ffc" + integrity sha512-ty8So6tcUpIb+ZE+1HAhbLROvAIJYyJe/1vRrrcmW+jLsaM+/powDRqxzo6hSh9CuRZGSL1Q8mvcF5WRD93a0A== -react-popper@^2.2.5: +react-popper@^2.3.0: version "2.3.0" - resolved "https://registry.npmjs.org/react-popper/-/react-popper-2.3.0.tgz" + resolved "https://registry.yarnpkg.com/react-popper/-/react-popper-2.3.0.tgz#17891c620e1320dce318bad9fede46a5f71c70ba" integrity sha512-e1hj8lL3uM+sgSR4Lxzn5h1GxBlpa4CQz0XLF8kx4MDrDRWY0Ena4c97PUeSX9i5W3UAfDP0z0FXCTQkoXUl3Q== dependencies: react-fast-compare "^3.0.1" @@ -31433,7 +31523,7 @@ walker@^1.0.7, walker@^1.0.8: warning@^4.0.2: version "4.0.3" - resolved "https://registry.npmjs.org/warning/-/warning-4.0.3.tgz" + resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3" integrity sha512-rpJyN222KWIvHJ/F53XSZv0Zl/accqHR8et1kpaMTD/fLCRxtV8iX8czMzY7sVZupTI3zcUTg8eycS2kNF9l6w== dependencies: loose-envify "^1.0.0"