= ({ daoAddress, proposalAddress, favor }) => {
+ const [open, setOpen] = React.useState(false)
- const { data: proposal, isLoading } = useProposal(
- daoAddress,
- proposalAddress
- );
- const theme = useTheme();
- const [selectedTab, setSelectedTab] = React.useState(0);
- const style = styles();
- const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0);
- const votesData = proposal?.voters;
+ const { data: proposal, isLoading } = useProposal(daoAddress, proposalAddress)
+ const theme = useTheme()
+ const [selectedTab, setSelectedTab] = React.useState(0)
+ const style = styles()
+ const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0)
+ const votesData = proposal?.voters
const { votesSum } = useVotesStats({
quorumThreshold,
upVotes: proposal?.upVotes || new BigNumber(0),
- downVotes: proposal?.downVotes || new BigNumber(0),
- });
+ downVotes: proposal?.downVotes || new BigNumber(0)
+ })
const votes = useMemo(() => {
if (!votesData) {
- return [];
+ return []
}
if (selectedTab === 0) {
- return votesData;
+ return votesData
}
if (selectedTab === 1) {
- return votesData.filter((voteData) => voteData.support);
+ return votesData.filter(voteData => voteData.support)
}
if (selectedTab === 2) {
- return votesData.filter((voteData) => !voteData.support);
+ return votesData.filter(voteData => !voteData.support)
}
- }, [votesData, selectedTab]);
+ }, [votesData, selectedTab])
const handleClickOpen = () => {
- setOpen(true);
- };
+ setOpen(true)
+ }
const handleClose = () => {
- setOpen(false);
- };
+ setOpen(false)
+ }
return (
-
+
VIEW
= ({
-
+
X
@@ -203,9 +187,7 @@ export const UpVotesDialog: React.FC = ({
VOTES{" "}
@@ -215,12 +197,7 @@ export const UpVotesDialog: React.FC = ({
{proposal ? votesSum.toString() : "-"}
-
+
@@ -245,8 +222,7 @@ export const UpVotesDialog: React.FC = ({
- {votes.length}{" "}
- {votes.length !== 1 ? " addresses" : " address"}
+ {votes.length} {votes.length !== 1 ? " addresses" : " address"}
@@ -258,12 +234,7 @@ export const UpVotesDialog: React.FC = ({
{votes.map((vote, index) => {
return (
-
+
@@ -272,27 +243,16 @@ export const UpVotesDialog: React.FC = ({
color="secondary"
variant="determinate"
favor={vote.support}
- value={
- votesSum
- ? vote.value
- .div(votesSum)
- .multipliedBy(100)
- .toNumber()
- : 0
- }
+ value={votesSum ? vote.value.div(votesSum).multipliedBy(100).toNumber() : 0}
/>
-
+
{proposal ? vote.value.toString() : "-"}
- );
+ )
})}
>
) : (
@@ -306,5 +266,5 @@ export const UpVotesDialog: React.FC = ({
- );
-};
+ )
+}
diff --git a/src/modules/explorer/components/VotersProgress.tsx b/src/modules/explorer/components/VotersProgress.tsx
index bd81fe69..14ecee1b 100644
--- a/src/modules/explorer/components/VotersProgress.tsx
+++ b/src/modules/explorer/components/VotersProgress.tsx
@@ -1,90 +1,59 @@
-import React, {useState} from "react";
-import {
- Button,
- Grid,
- Paper,
- styled,
- Typography,
- useMediaQuery,
- useTheme,
-} from "@material-ui/core";
-import {formatNumber} from "../utils/FormatNumber";
-import {MultiColorBar as CustomBar} from "modules/explorer/components/ProgressBar";
-import {useVotesStats} from "../hooks/useVotesStats";
-import BigNumber from "bignumber.js";
-import {useProposal} from "services/indexer/dao/hooks/useProposal";
-import {Proposal} from "services/indexer/dao/mappers/proposal/types";
-import {VotesDetailDialog} from "./VotesDetailDialog";
+import React, { useState } from "react"
+import { Button, Grid, Paper, styled, Typography, useMediaQuery, useTheme } from "@material-ui/core"
+import { formatNumber } from "../utils/FormatNumber"
+import { MultiColorBar as CustomBar } from "modules/explorer/components/ProgressBar"
+import { useVotesStats } from "../hooks/useVotesStats"
+import BigNumber from "bignumber.js"
+import { useProposal } from "services/indexer/dao/hooks/useProposal"
+import { Proposal } from "services/indexer/dao/mappers/proposal/types"
+import { VotesDetailDialog } from "./VotesDetailDialog"
interface VotersData {
- showButton: boolean;
- daoId: string;
- proposalId: string;
- wrapAll?: boolean;
+ showButton: boolean
+ daoId: string
+ proposalId: string
+ wrapAll?: boolean
}
-const GreenDot = styled(Paper)(({theme}) => ({
+const GreenDot = styled(Paper)(({ theme }) => ({
width: 9,
height: 9,
marginRight: 9,
- background: theme.palette.secondary.main,
-}));
+ background: theme.palette.secondary.main
+}))
-const RedDot = styled(Paper)(({theme}) => ({
+const RedDot = styled(Paper)(({ theme }) => ({
width: 9,
height: 9,
marginRight: 9,
- background: theme.palette.error.main,
-}));
+ background: theme.palette.error.main
+}))
const StatusTitle = styled(Typography)({
fontWeight: "bold",
- marginRight: 12,
-});
+ marginRight: 12
+})
-export const VotersProgress: React.FC = ({
- showButton,
- daoId,
- proposalId,
- wrapAll,
- }) => {
- const theme = useTheme();
- const [open, setOpen] = useState(false);
- const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"));
- const {data: proposalData} = useProposal(daoId, proposalId);
- const proposal = proposalData as Proposal | undefined;
- const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0);
- const upVotes = proposal ? proposal.upVotes : new BigNumber(0);
- const downVotes = proposal ? proposal.downVotes : new BigNumber(0);
+export const VotersProgress: React.FC = ({ showButton, daoId, proposalId, wrapAll }) => {
+ const theme = useTheme()
+ const [open, setOpen] = useState(false)
+ const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"))
+ const { data: proposalData } = useProposal(daoId, proposalId)
+ const proposal = proposalData as Proposal | undefined
+ const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0)
+ const upVotes = proposal ? proposal.upVotes : new BigNumber(0)
+ const downVotes = proposal ? proposal.downVotes : new BigNumber(0)
- const {
- upVotesQuorumPercentage,
- downVotesQuorumPercentage,
- upVotesSumPercentage,
- } = useVotesStats({
+ const { upVotesQuorumPercentage, downVotesQuorumPercentage, upVotesSumPercentage } = useVotesStats({
quorumThreshold,
upVotes,
- downVotes,
- });
+ downVotes
+ })
return (
<>
-
-
+
+
= ({
alignItems="baseline"
wrap="nowrap"
>
-
- SUPPORT:
+
+
+ SUPPORT:{" "}
+
{proposal ? upVotes.toString() : "-"} (
- {upVotesQuorumPercentage &&
- upVotesQuorumPercentage.isGreaterThan(100)
+ {upVotesQuorumPercentage && upVotesQuorumPercentage.isGreaterThan(100)
? 100
: formatNumber(upVotesQuorumPercentage)}
%){" "}
-
-
- OPPOSE:
+
+
+
+ OPPOSE:{" "}
+
{proposal ? downVotes.toString() : "-"} (
- {downVotesQuorumPercentage &&
- downVotesQuorumPercentage.isGreaterThan(100)
+ {downVotesQuorumPercentage && downVotesQuorumPercentage.isGreaterThan(100)
? 100
: formatNumber(downVotesQuorumPercentage)}
%){" "}
@@ -126,32 +91,23 @@ export const VotersProgress: React.FC = ({
{showButton ? (
-
+
+ >
+ View
+
) : null}
-
+
- setOpen(false)}/>
+ setOpen(false)} />
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/components/VotesDetailDialog.tsx b/src/modules/explorer/components/VotesDetailDialog.tsx
index ebe60b6f..525058ff 100644
--- a/src/modules/explorer/components/VotesDetailDialog.tsx
+++ b/src/modules/explorer/components/VotesDetailDialog.tsx
@@ -1,22 +1,22 @@
-import React, {useMemo} from "react"
-import {Button, Grid, styled, Typography} from "@material-ui/core";
-import {ResponsiveDialog} from "./ResponsiveDialog";
-import {useVotesStats} from "../hooks/useVotesStats";
-import {BigNumber} from "bignumber.js";
-import {useProposal} from "../../../services/indexer/dao/hooks/useProposal";
-import {VotesTable} from "./VotesTable";
-import {roundNumber} from "../../../utils";
-import {VotersProgress} from "./VotersProgress";
+import React, { useMemo } from "react"
+import { Button, Grid, styled, Typography } from "@material-ui/core"
+import { ResponsiveDialog } from "./ResponsiveDialog"
+import { useVotesStats } from "../hooks/useVotesStats"
+import { BigNumber } from "bignumber.js"
+import { useProposal } from "../../../services/indexer/dao/hooks/useProposal"
+import { VotesTable } from "./VotesTable"
+import { roundNumber } from "../../../utils"
+import { VotersProgress } from "./VotersProgress"
const StyledTab = styled(Button)({
- fontSize: 16,
-});
+ fontSize: 16
+})
interface Props {
- open: boolean;
- onClose: () => void;
- daoAddress: string;
- proposalAddress: string;
+ open: boolean
+ onClose: () => void
+ daoAddress: string
+ proposalAddress: string
}
enum SelectedVotes {
@@ -25,71 +25,66 @@ enum SelectedVotes {
OPPOSE
}
-export const VotesDetailDialog = ({open, onClose, daoAddress, proposalAddress}: Props) => {
- const [selectedTab, setSelectedTab] = React.useState(SelectedVotes.ALL);
+export const VotesDetailDialog = ({ open, onClose, daoAddress, proposalAddress }: Props) => {
+ const [selectedTab, setSelectedTab] = React.useState(SelectedVotes.ALL)
const handleChangeTab = (newValue: number) => {
- setSelectedTab(newValue);
- };
+ setSelectedTab(newValue)
+ }
- const {data: proposal} = useProposal(
- daoAddress,
- proposalAddress
- );
+ const { data: proposal } = useProposal(daoAddress, proposalAddress)
- const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0);
- const votesData = proposal?.voters;
+ const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0)
+ const votesData = proposal?.voters
- const {votesSum} = useVotesStats({
+ const { votesSum } = useVotesStats({
quorumThreshold,
upVotes: proposal?.upVotes || new BigNumber(0),
- downVotes: proposal?.downVotes || new BigNumber(0),
- });
+ downVotes: proposal?.downVotes || new BigNumber(0)
+ })
- const {supportVotes, againstVotes, allVotes} = useMemo(() => {
+ const { supportVotes, againstVotes, allVotes } = useMemo(() => {
if (!votesData) {
return {
- supportVotes: [], againstVotes: [], allVotes: []
+ supportVotes: [],
+ againstVotes: [],
+ allVotes: []
}
}
const allVotes = votesData.map(voter => ({
address: voter.address,
- votes: roundNumber({number: Number(voter.value.toString()), decimals: 2}).toString(),
- support: voter.support,
+ votes: roundNumber({ number: Number(voter.value.toString()), decimals: 2 }).toString(),
+ support: voter.support
}))
- const supportVotes = allVotes.filter(voter => voter.support);
- const againstVotes = allVotes.filter(voter => !voter.support);
+ const supportVotes = allVotes.filter(voter => voter.support)
+ const againstVotes = allVotes.filter(voter => !voter.support)
return {
allVotes,
supportVotes,
againstVotes
}
-
}, [votesData])
- const votesToShow = selectedTab == SelectedVotes.ALL ? allVotes : selectedTab == SelectedVotes.SUPPORT ? supportVotes : againstVotes
+ const votesToShow =
+ selectedTab == SelectedVotes.ALL ? allVotes : selectedTab == SelectedVotes.SUPPORT ? supportVotes : againstVotes
return (
-
-
+
+
- {votesSum.toString()}
+
+ {votesSum.toString()}
+
-
+
-
+
-
+
-
)
-}
\ No newline at end of file
+}
diff --git a/src/modules/explorer/components/VotesTable.tsx b/src/modules/explorer/components/VotesTable.tsx
index 4a1c4d79..c4d96d1d 100644
--- a/src/modules/explorer/components/VotesTable.tsx
+++ b/src/modules/explorer/components/VotesTable.tsx
@@ -1,16 +1,16 @@
-import React from "react";
-import {Table, TableBody, TableCell, TableHead, TableRow, useMediaQuery, useTheme} from "@material-ui/core";
-import {toShortAddress} from "../../../services/contracts/utils";
+import React from "react"
+import { Table, TableBody, TableCell, TableHead, TableRow, useMediaQuery, useTheme } from "@material-ui/core"
+import { toShortAddress } from "../../../services/contracts/utils"
-const titles = ["Address", "Votes"] as const;
+const titles = ["Address", "Votes"] as const
interface RowData {
- address: string;
- votes: string;
+ address: string
+ votes: string
}
-export const VotesTable: React.FC<{ data: RowData[] }> = ({data}) => {
- const theme = useTheme();
+export const VotesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
+ const theme = useTheme()
const isSmall = useMediaQuery(theme.breakpoints.down("sm"))
return (
@@ -33,5 +33,5 @@ export const VotesTable: React.FC<{ data: RowData[] }> = ({data}) => {
>
- );
-};
\ No newline at end of file
+ )
+}
diff --git a/src/modules/explorer/components/WarningDialog.tsx b/src/modules/explorer/components/WarningDialog.tsx
index cdd1f5ae..111b28b8 100644
--- a/src/modules/explorer/components/WarningDialog.tsx
+++ b/src/modules/explorer/components/WarningDialog.tsx
@@ -1,65 +1,52 @@
-import React, {useState} from "react";
-import {
- styled,
- Grid,
- Typography,
- Checkbox,
- FormControlLabel,
- Link,
-} from "@material-ui/core";
-import {SendButton} from "./ProposalFormSendButton";
-import {ResponsiveDialog} from "./ResponsiveDialog";
+import React, { useState } from "react"
+import { styled, Grid, Typography, Checkbox, FormControlLabel, Link } from "@material-ui/core"
+import { SendButton } from "./ProposalFormSendButton"
+import { ResponsiveDialog } from "./ResponsiveDialog"
const CustomDialog = styled(ResponsiveDialog)({
"& .MuiDialog-paperWidthSm": {
- minHeight: "300px !important",
- },
-});
+ minHeight: "300px !important"
+ }
+})
const TableHeader = styled(Grid)({
- padding: "25px 64px",
-});
+ padding: "25px 64px"
+})
const Footer = styled(Grid)({
- padding: "15px 64px",
-});
+ padding: "15px 64px"
+})
export const WarningDialog: React.FC<{
- open: boolean;
- handleClose: () => void;
-}> = ({open, handleClose}) => {
- const [checked, setChecked] = useState(false);
+ open: boolean
+ handleClose: () => void
+}> = ({ open, handleClose }) => {
+ const [checked, setChecked] = useState(false)
return (
- Homebase is currently experimental and its underlying smart
- contracts remain in testing.
-
-
- Expect breaking changes in coming releases. For more on
- Homebase, read {" "}
+ Homebase is currently experimental and its underlying smart contracts remain in testing.
+
+
+ Expect breaking changes in coming releases. For more on Homebase, read{" "}
here
+ >
+ here
+
@@ -67,5 +54,5 @@ export const WarningDialog: React.FC<{
CONFIRM
- );
-};
+ )
+}
diff --git a/src/modules/explorer/components/XTZTransferBadge.tsx b/src/modules/explorer/components/XTZTransferBadge.tsx
index f7a018c6..6377aac0 100644
--- a/src/modules/explorer/components/XTZTransferBadge.tsx
+++ b/src/modules/explorer/components/XTZTransferBadge.tsx
@@ -1,46 +1,41 @@
-import {Grid, GridProps, styled, Typography} from "@material-ui/core";
-import ArrowForward from "@material-ui/icons/ArrowForward";
-import {BigNumber} from "bignumber.js";
-import {HighlightedBadge} from "modules/explorer/components/styled/HighlightedBadge";
-import {UserBadge} from "modules/explorer/components/UserBadge";
-import React from "react";
-import {mutezToXtz} from "services/contracts/utils";
+import { Grid, GridProps, styled, Typography } from "@material-ui/core"
+import ArrowForward from "@material-ui/icons/ArrowForward"
+import { BigNumber } from "bignumber.js"
+import { HighlightedBadge } from "modules/explorer/components/styled/HighlightedBadge"
+import { UserBadge } from "modules/explorer/components/UserBadge"
+import React from "react"
+import { mutezToXtz } from "services/contracts/utils"
-const ArrowContainer = styled(Grid)(({theme}) => ({
- color: theme.palette.text.primary,
-}));
+const ArrowContainer = styled(Grid)(({ theme }) => ({
+ color: theme.palette.text.primary
+}))
interface Props extends GridProps {
- address: string;
- amount: BigNumber;
+ address: string
+ amount: BigNumber
}
-export const XTZTransferBadge: React.FC = ({
- address,
- amount,
- ...props
- }) => {
-
+export const XTZTransferBadge: React.FC = ({ address, amount, ...props }) => {
return (
- {mutezToXtz(amount).toString()}{" "}XTZ
+ {mutezToXtz(amount).toString()} XTZ
-
+
-
+
- );
-};
+ )
+}
diff --git a/src/modules/explorer/components/styled/ErrorText.tsx b/src/modules/explorer/components/styled/ErrorText.tsx
index 60013f6f..23bc010b 100644
--- a/src/modules/explorer/components/styled/ErrorText.tsx
+++ b/src/modules/explorer/components/styled/ErrorText.tsx
@@ -1,6 +1,6 @@
-import { styled, Typography } from "@material-ui/core";
+import { styled, Typography } from "@material-ui/core"
export const ErrorText = styled(Typography)({
fontSize: 14,
- color: "red",
-});
\ No newline at end of file
+ color: "red"
+})
diff --git a/src/modules/explorer/components/styled/HighlightedBadge.tsx b/src/modules/explorer/components/styled/HighlightedBadge.tsx
index 5268813d..f9a6166e 100644
--- a/src/modules/explorer/components/styled/HighlightedBadge.tsx
+++ b/src/modules/explorer/components/styled/HighlightedBadge.tsx
@@ -1,10 +1,10 @@
-import { styled, Grid } from "@material-ui/core";
-import hexToRgba from "hex-to-rgba";
+import { styled, Grid } from "@material-ui/core"
+import hexToRgba from "hex-to-rgba"
export const HighlightedBadge = styled(Grid)(({ theme }) => ({
backgroundColor: hexToRgba(theme.palette.secondary.main, 0.07),
boxSizing: "border-box",
padding: "8px 16px",
width: "fit-content",
- borderRadius: 4,
-}));
+ borderRadius: 4
+}))
diff --git a/src/modules/explorer/components/styled/InfoIcon.tsx b/src/modules/explorer/components/styled/InfoIcon.tsx
index 053721aa..0b46585b 100644
--- a/src/modules/explorer/components/styled/InfoIcon.tsx
+++ b/src/modules/explorer/components/styled/InfoIcon.tsx
@@ -1,8 +1,8 @@
-import { styled } from "@material-ui/core";
-import { InfoOutlined } from "@material-ui/icons";
+import { styled } from "@material-ui/core"
+import { InfoOutlined } from "@material-ui/icons"
export const InfoIcon = styled(InfoOutlined)({
cursor: "default",
marginLeft: 5,
- verticalAlign: "top",
-});
\ No newline at end of file
+ verticalAlign: "top"
+})
diff --git a/src/modules/explorer/components/styled/ProfileAvatar.tsx b/src/modules/explorer/components/styled/ProfileAvatar.tsx
index c4c50dba..88051e27 100644
--- a/src/modules/explorer/components/styled/ProfileAvatar.tsx
+++ b/src/modules/explorer/components/styled/ProfileAvatar.tsx
@@ -1,31 +1,24 @@
-import React from "react";
-import { Avatar } from "@material-ui/core";
-import { styled } from "@material-ui/styles";
-import { Blockie } from "modules/common/Blockie";
-import { useProfileClaim } from "services/tzprofiles/hooks/useProfileClaim";
+import React from "react"
+import { Avatar } from "@material-ui/core"
+import { styled } from "@material-ui/styles"
+import { Blockie } from "modules/common/Blockie"
+import { useProfileClaim } from "services/tzprofiles/hooks/useProfileClaim"
const StyledAvatar = styled(Avatar)(({ size }: { size?: number }) => ({
width: size || 40,
- height: size || 40,
-}));
+ height: size || 40
+}))
-export const ProfileAvatar: React.FC<{ address: string; size?: number }> = ({
- address,
- size,
-}) => {
- const { data: profile } = useProfileClaim(address);
+export const ProfileAvatar: React.FC<{ address: string; size?: number }> = ({ address, size }) => {
+ const { data: profile } = useProfileClaim(address)
return (
<>
{profile ? (
-
+
) : (
)}
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/components/styled/RectangleHeader.tsx b/src/modules/explorer/components/styled/RectangleHeader.tsx
index ff449113..dfa50242 100644
--- a/src/modules/explorer/components/styled/RectangleHeader.tsx
+++ b/src/modules/explorer/components/styled/RectangleHeader.tsx
@@ -1,10 +1,10 @@
-import { Grid, styled } from "@material-ui/core";
+import { Grid, styled } from "@material-ui/core"
export const RectangleContainer = styled(Grid)(({ theme }) => ({
minHeight: 125,
padding: "68px 8%",
borderBottom: `2px solid ${theme.palette.primary.light}`,
[theme.breakpoints.down("sm")]: {
- padding: "35px 8%",
- },
-}));
+ padding: "35px 8%"
+ }
+}))
diff --git a/src/modules/explorer/components/styled/TableHeader.tsx b/src/modules/explorer/components/styled/TableHeader.tsx
index 344ad4fd..8f0ec5da 100644
--- a/src/modules/explorer/components/styled/TableHeader.tsx
+++ b/src/modules/explorer/components/styled/TableHeader.tsx
@@ -1,6 +1,6 @@
-import { styled, Grid } from "@material-ui/core";
+import { styled, Grid } from "@material-ui/core"
export const TableHeader = styled(Grid)(({ theme }) => ({
borderBottom: `2px solid ${theme.palette.primary.light}`,
- paddingBottom: 20,
-}));
+ paddingBottom: 20
+}))
diff --git a/src/modules/explorer/components/tables/RowContainer.tsx b/src/modules/explorer/components/tables/RowContainer.tsx
index b697e1e8..8e2967a6 100644
--- a/src/modules/explorer/components/tables/RowContainer.tsx
+++ b/src/modules/explorer/components/tables/RowContainer.tsx
@@ -1,4 +1,4 @@
-import { Grid, styled } from "@material-ui/core";
+import { Grid, styled } from "@material-ui/core"
export const RowContainer = styled(Grid)(({ theme }) => ({
minHeight: 155,
@@ -6,6 +6,6 @@ export const RowContainer = styled(Grid)(({ theme }) => ({
borderBottom: `2px solid ${theme.palette.primary.light}`,
cursor: "pointer",
[theme.breakpoints.down("md")]: {
- padding: "35px 0",
- },
-}));
+ padding: "35px 0"
+ }
+}))
diff --git a/src/modules/explorer/context/ActionSheets/index.tsx b/src/modules/explorer/context/ActionSheets/index.tsx
index e81534ba..dd09672d 100644
--- a/src/modules/explorer/context/ActionSheets/index.tsx
+++ b/src/modules/explorer/context/ActionSheets/index.tsx
@@ -1,32 +1,30 @@
-import React, { useCallback, useContext, useEffect } from "react";
-import { createContext, useState } from "react";
-import { UserMenuSheet } from "../../components/UserMenuSheet";
-import { NetworkSheet } from "../../components/NetworkSheet";
+import React, { useCallback, useContext, useEffect } from "react"
+import { createContext, useState } from "react"
+import { UserMenuSheet } from "../../components/UserMenuSheet"
+import { NetworkSheet } from "../../components/NetworkSheet"
export enum ActionSheet {
None,
UserMenu,
- Network,
+ Network
}
interface ActionSheetContextState {
- openedModal: ActionSheet;
- setOpenedModal: React.Dispatch>;
- onClose: () => void;
+ openedModal: ActionSheet
+ setOpenedModal: React.Dispatch>
+ onClose: () => void
}
-export const ActionSheetContext = createContext(
- null as any
-);
+export const ActionSheetContext = createContext(null as any)
export const ActionSheetProvider: React.FC = ({ children }) => {
- const [openedModal, setOpenedModal] = useState(ActionSheet.None);
+ const [openedModal, setOpenedModal] = useState(ActionSheet.None)
const onClose = useCallback(() => {
- setOpenedModal(ActionSheet.None);
- }, []);
+ setOpenedModal(ActionSheet.None)
+ }, [])
useEffect(() => {
- if(openedModal === ActionSheet.None) {
+ if (openedModal === ActionSheet.None) {
console.log("ALL CLOSED")
}
}, [openedModal])
@@ -34,27 +32,19 @@ export const ActionSheetProvider: React.FC = ({ children }) => {
console.log(openedModal)
return (
-
+
{children}
-
-
+
+
- );
-};
+ )
+}
export const useActionSheet = (actionSheet: ActionSheet) => {
- const contextValue = useContext(ActionSheetContext);
+ const contextValue = useContext(ActionSheetContext)
return {
open: () => contextValue.setOpenedModal(actionSheet),
- close: contextValue.onClose,
- };
-};
+ close: contextValue.onClose
+ }
+}
diff --git a/src/modules/explorer/hooks/useCanDropProposal.ts b/src/modules/explorer/hooks/useCanDropProposal.ts
index 303386a3..a848d172 100644
--- a/src/modules/explorer/hooks/useCanDropProposal.ts
+++ b/src/modules/explorer/hooks/useCanDropProposal.ts
@@ -1,36 +1,31 @@
-import { useMemo } from "react";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useProposal } from "services/indexer/dao/hooks/useProposal";
-import { ProposalStatus } from "services/indexer/dao/mappers/proposal/types";
+import { useMemo } from "react"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useProposal } from "services/indexer/dao/hooks/useProposal"
+import { ProposalStatus } from "services/indexer/dao/mappers/proposal/types"
export const useCanDropProposal = (daoId: string, proposalId: string) => {
- const { account } = useTezos();
- const { data: dao, cycleInfo } = useDAO(daoId);
- const { data: proposal } = useProposal(daoId, proposalId);
+ const { account } = useTezos()
+ const { data: dao, cycleInfo } = useDAO(daoId)
+ const { data: proposal } = useProposal(daoId, proposalId)
return useMemo(() => {
if (!proposal || !dao) {
- return false;
+ return false
}
- const isProposer =
- proposal.proposer.toLowerCase() === account.toLowerCase();
+ const isProposer = proposal.proposer.toLowerCase() === account.toLowerCase()
- const hasExpired =
- cycleInfo &&
- proposal.getStatus(cycleInfo.currentLevel).status ===
- ProposalStatus.EXPIRED;
+ const hasExpired = cycleInfo && proposal.getStatus(cycleInfo.currentLevel).status === ProposalStatus.EXPIRED
- const isGuardian =
- dao.data.guardian.toLowerCase() === account.toLowerCase();
+ const isGuardian = dao.data.guardian.toLowerCase() === account.toLowerCase()
- const isNotExecutedOrDropped = true;
+ const isNotExecutedOrDropped = true
// dao.data.proposalsToFlush.find(
// (id) => id.toLowerCase() === proposal.id.toLowerCase()
// );
- return isNotExecutedOrDropped && (isProposer || hasExpired || isGuardian);
- }, [account, cycleInfo, dao, proposal]);
-};
+ return isNotExecutedOrDropped && (isProposer || hasExpired || isGuardian)
+ }, [account, cycleInfo, dao, proposal])
+}
diff --git a/src/modules/explorer/hooks/useTimeLeftInCycle.ts b/src/modules/explorer/hooks/useTimeLeftInCycle.ts
index 293924be..adc564e4 100644
--- a/src/modules/explorer/hooks/useTimeLeftInCycle.ts
+++ b/src/modules/explorer/hooks/useTimeLeftInCycle.ts
@@ -1,24 +1,24 @@
-import {useEffect, useState} from "react";
-import {useDAO} from "../../../services/indexer/dao/hooks/useDAO";
-import {useDAOID} from "../pages/DAO/router";
+import { useEffect, useState } from "react"
+import { useDAO } from "../../../services/indexer/dao/hooks/useDAO"
+import { useDAOID } from "../pages/DAO/router"
export const useTimeLeftInCycle = () => {
- const daoID = useDAOID();
- const { cycleInfo } = useDAO(daoID);
+ const daoID = useDAOID()
+ const { cycleInfo } = useDAO(daoID)
- const [counter, setCounter] = useState(0);
- const [oldCycle, setOldCycle] = useState(0);
+ const [counter, setCounter] = useState(0)
+ const [oldCycle, setOldCycle] = useState(0)
const [time, setTime] = useState({ hours: "-", minutes: "-", days: "-" })
useEffect(() => {
- if(cycleInfo) {
- const pendingCycles = cycleInfo.blocksLeft;
- setCounter(pendingCycles * cycleInfo.timeEstimateForNextBlock);
+ if (cycleInfo) {
+ const pendingCycles = cycleInfo.blocksLeft
+ setCounter(pendingCycles * cycleInfo.timeEstimateForNextBlock)
if (cycleInfo.blocksLeft !== oldCycle) {
- setOldCycle(cycleInfo.blocksLeft * cycleInfo.timeEstimateForNextBlock);
+ setOldCycle(cycleInfo.blocksLeft * cycleInfo.timeEstimateForNextBlock)
}
}
- }, [cycleInfo, oldCycle]);
+ }, [cycleInfo, oldCycle])
useEffect(() => {
setTime({
@@ -28,5 +28,5 @@ export const useTimeLeftInCycle = () => {
})
}, [counter])
- return time;
-};
\ No newline at end of file
+ return time
+}
diff --git a/src/modules/explorer/hooks/useVotesStats.ts b/src/modules/explorer/hooks/useVotesStats.ts
index 007cdcc8..8c432aac 100644
--- a/src/modules/explorer/hooks/useVotesStats.ts
+++ b/src/modules/explorer/hooks/useVotesStats.ts
@@ -1,40 +1,24 @@
-import { BigNumber } from "bignumber.js";
-import { useMemo } from "react";
+import { BigNumber } from "bignumber.js"
+import { useMemo } from "react"
interface Props {
- quorumThreshold: BigNumber;
- upVotes: BigNumber;
- downVotes: BigNumber;
+ quorumThreshold: BigNumber
+ upVotes: BigNumber
+ downVotes: BigNumber
}
-export const useVotesStats = ({
- quorumThreshold,
- upVotes,
- downVotes,
-}: Props) => {
+export const useVotesStats = ({ quorumThreshold, upVotes, downVotes }: Props) => {
return useMemo(() => {
- const support = upVotes.isGreaterThanOrEqualTo(downVotes);
+ const support = upVotes.isGreaterThanOrEqualTo(downVotes)
- const votesSum = upVotes.plus(downVotes);
- const votes = support ? upVotes : downVotes;
- const downVotesQuorumPercentage = getRelativeVotePercentage(
- downVotes,
- quorumThreshold
- );
- const upVotesQuorumPercentage = getRelativeVotePercentage(
- upVotes,
- quorumThreshold
- );
- const votesQuorumPercentage = getRelativeVotePercentage(
- votes,
- quorumThreshold
- );
- const downVotesSumPercentage = getRelativeVotePercentage(
- downVotes,
- votesSum
- );
- const upVotesSumPercentage = getRelativeVotePercentage(upVotes, votesSum);
- const votesSumPercentage = getRelativeVotePercentage(votes, votesSum);
+ const votesSum = upVotes.plus(downVotes)
+ const votes = support ? upVotes : downVotes
+ const downVotesQuorumPercentage = getRelativeVotePercentage(downVotes, quorumThreshold)
+ const upVotesQuorumPercentage = getRelativeVotePercentage(upVotes, quorumThreshold)
+ const votesQuorumPercentage = getRelativeVotePercentage(votes, quorumThreshold)
+ const downVotesSumPercentage = getRelativeVotePercentage(downVotes, votesSum)
+ const upVotesSumPercentage = getRelativeVotePercentage(upVotes, votesSum)
+ const votesSumPercentage = getRelativeVotePercentage(votes, votesSum)
return {
support,
@@ -45,12 +29,12 @@ export const useVotesStats = ({
votesQuorumPercentage,
downVotesSumPercentage,
upVotesSumPercentage,
- votesSumPercentage,
- };
- }, [quorumThreshold, upVotes, downVotes]);
-};
+ votesSumPercentage
+ }
+ }, [quorumThreshold, upVotes, downVotes])
+}
const getRelativeVotePercentage = (votes: BigNumber, quorumOrSum: BigNumber) => {
- const result = quorumOrSum ? votes.multipliedBy(100).div(quorumOrSum) : new BigNumber(0);
- return result.isGreaterThan(100) ? new BigNumber(100): result
+ const result = quorumOrSum ? votes.multipliedBy(100).div(quorumOrSum) : new BigNumber(0)
+ return result.isGreaterThan(100) ? new BigNumber(100) : result
}
diff --git a/src/modules/explorer/pages/DAO/index.tsx b/src/modules/explorer/pages/DAO/index.tsx
index a8e51d90..80550e9d 100644
--- a/src/modules/explorer/pages/DAO/index.tsx
+++ b/src/modules/explorer/pages/DAO/index.tsx
@@ -1,55 +1,46 @@
-import React, { useCallback, useMemo } from "react";
-import {
- Grid,
- styled,
- Typography,
- Button,
- useTheme,
- useMediaQuery, Tooltip,
-} from "@material-ui/core";
-
-import { useFlush } from "services/contracts/baseDAO/hooks/useFlush";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useProposals } from "services/indexer/dao/hooks/useProposals";
-import { useDAOID } from "./router";
-
-import { UserBalancesBox } from "../../components/UserBalances";
-import { ContentContainer } from "../../components/ContentContainer";
-import { ProposalsList } from "../../components/ProposalsList";
-import { ProposalStatus } from "services/indexer/dao/mappers/proposal/types";
-import { DAOStatsRow } from "../../components/DAOStatsRow";
-import { UsersTable } from "../../components/UsersTable";
-import BigNumber from "bignumber.js";
-import {InfoIcon} from "../../components/styled/InfoIcon";
-import { SmallButton } from '../../../common/SmallButton';
-
+import React, { useCallback, useMemo } from "react"
+import { Grid, styled, Typography, Button, useTheme, useMediaQuery, Tooltip } from "@material-ui/core"
+
+import { useFlush } from "services/contracts/baseDAO/hooks/useFlush"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useProposals } from "services/indexer/dao/hooks/useProposals"
+import { useDAOID } from "./router"
+
+import { UserBalancesBox } from "../../components/UserBalances"
+import { ContentContainer } from "../../components/ContentContainer"
+import { ProposalsList } from "../../components/ProposalsList"
+import { ProposalStatus } from "services/indexer/dao/mappers/proposal/types"
+import { DAOStatsRow } from "../../components/DAOStatsRow"
+import { UsersTable } from "../../components/UsersTable"
+import BigNumber from "bignumber.js"
+import { InfoIcon } from "../../components/styled/InfoIcon"
+import { SmallButton } from "../../../common/SmallButton"
const HeroContainer = styled(ContentContainer)(({ theme }) => ({
- padding: "38px 38px",
-
-}));
+ padding: "38px 38px"
+}))
const TitleText = styled(Typography)(({ theme }) => ({
fontSize: 40,
fontWeight: 500,
- lineHeight: .8,
+ lineHeight: 0.8,
- ["@media (max-width:642px)"]: {
- fontSize: 35,
+ ["@media (max-width:642px)"]: {
+ fontSize: 35
},
- ["@media (max-width:583px)"]: {
- fontSize: 30,
+ ["@media (max-width:583px)"]: {
+ fontSize: 30
},
- ["@media (max-width:533px)"]: {
- fontSize: 25,
+ ["@media (max-width:533px)"]: {
+ fontSize: 25
},
- ["@media (max-width:462px)"]: {
- fontSize: 22,
- },
-}));
+ ["@media (max-width:462px)"]: {
+ fontSize: 22
+ }
+}))
const SubtitleText = styled(Typography)({
fontSize: 18,
@@ -59,38 +50,37 @@ const SubtitleText = styled(Typography)({
maxHeight: "200px",
overflowY: "scroll",
- ["@media (max-width:1166px)"]: {
- width:"75.3vw"
- },
-
- ["@media (max-width:1138px)"]: {
- width:"100%"
- },
+ ["@media (max-width:1166px)"]: {
+ width: "75.3vw"
+ },
- ["@media (max-width:599.98px)"]: {
- width:"100%",
- margin: "-15px auto 0 auto",
- },
+ ["@media (max-width:1138px)"]: {
+ width: "100%"
+ },
-});
+ ["@media (max-width:599.98px)"]: {
+ width: "100%",
+ margin: "-15px auto 0 auto"
+ }
+})
const TableContainer = styled(ContentContainer)({
- width: "100%",
-});
+ width: "100%"
+})
export const DAO: React.FC = () => {
- const daoId = useDAOID();
- const { data, cycleInfo, ledger } = useDAO(daoId);
- const { mutate } = useFlush();
- const theme = useTheme();
- const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"));
+ const daoId = useDAOID()
+ const { data, cycleInfo, ledger } = useDAO(daoId)
+ const { mutate } = useFlush()
+ const theme = useTheme()
+ const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"))
- const name = data && data.data.name;
- const description = data && data.data.description;
+ const name = data && data.data.name
+ const description = data && data.data.description
- const { data: activeProposals } = useProposals(daoId, ProposalStatus.ACTIVE);
- const { data: executableProposals } = useProposals(daoId, ProposalStatus.EXECUTABLE);
- const { data: expiredProposals } = useProposals(daoId, ProposalStatus.EXPIRED);
+ const { data: activeProposals } = useProposals(daoId, ProposalStatus.ACTIVE)
+ const { data: executableProposals } = useProposals(daoId, ProposalStatus.EXECUTABLE)
+ const { data: expiredProposals } = useProposals(daoId, ProposalStatus.EXPIRED)
const onFlush = useCallback(async () => {
if (executableProposals && expiredProposals && executableProposals.length && data) {
@@ -98,28 +88,26 @@ export const DAO: React.FC = () => {
dao: data,
numOfProposalsToFlush: executableProposals.length,
expiredProposalIds: expiredProposals.map(p => p.id)
- });
- return;
+ })
+ return
}
- }, [data, mutate, expiredProposals, executableProposals]);
+ }, [data, mutate, expiredProposals, executableProposals])
const usersTableData = useMemo(() => {
if (!ledger || !cycleInfo || !data) {
- return [];
+ return []
}
return ledger
.sort((a, b) => b.available_balance.minus(a.available_balance).toNumber())
- .map((p) => ({
+ .map(p => ({
address: p.holder.address,
totalStaked: new BigNumber(p.total_balance).dp(10).toString(),
- availableStaked: new BigNumber(p.available_balance)
- .dp(10)
- .toString(),
+ availableStaked: new BigNumber(p.available_balance).dp(10).toString(),
votes: p.holder.votes_cast.toString(),
proposalsVoted: p.holder.proposals_voted.toString()
- }));
- }, [cycleInfo, data, ledger]);
+ }))
+ }, [cycleInfo, data, ledger])
return (
@@ -139,18 +127,14 @@ export const DAO: React.FC = () => {
>
Execute
-
+
-
-
- {description}
-
+
+ {description}
@@ -166,8 +150,8 @@ export const DAO: React.FC = () => {
/>
)}
-
+
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/DAO/router.tsx b/src/modules/explorer/pages/DAO/router.tsx
index 24ab11e3..2f1cef9d 100644
--- a/src/modules/explorer/pages/DAO/router.tsx
+++ b/src/modules/explorer/pages/DAO/router.tsx
@@ -1,26 +1,19 @@
-import { styled, useTheme } from "@material-ui/core";
-import { NotFound } from "modules/explorer/components/NotFound";
-import { NotIndexed } from "modules/explorer/components/NotIndexed";
-import { DAO } from "modules/explorer/pages/DAO/index";
-import { User } from "modules/explorer/pages/User";
-import React, { useContext, useEffect, useState } from "react";
-import { useHistory } from "react-router";
-import {
- Redirect,
- Route,
- RouteProps,
- Switch,
- useParams,
- useRouteMatch,
-} from "react-router-dom";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { Navbar } from "../../components/Toolbar";
-import { NFTs } from "../NFTs";
-import { ProposalDetails } from "../ProposalDetails";
-import { Proposals } from "../Proposals";
-import { Registry } from "../Registry";
-import { Treasury } from "../Treasury";
+import { styled, useTheme } from "@material-ui/core"
+import { NotFound } from "modules/explorer/components/NotFound"
+import { NotIndexed } from "modules/explorer/components/NotIndexed"
+import { DAO } from "modules/explorer/pages/DAO/index"
+import { User } from "modules/explorer/pages/User"
+import React, { useContext, useEffect, useState } from "react"
+import { useHistory } from "react-router"
+import { Redirect, Route, RouteProps, Switch, useParams, useRouteMatch } from "react-router-dom"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { Navbar } from "../../components/Toolbar"
+import { NFTs } from "../NFTs"
+import { ProposalDetails } from "../ProposalDetails"
+import { Proposals } from "../Proposals"
+import { Registry } from "../Registry"
+import { Treasury } from "../Treasury"
const PageLayout = styled("div")(({ theme }) => ({
background: theme.palette.primary.dark,
@@ -32,51 +25,47 @@ const PageLayout = styled("div")(({ theme }) => ({
["@media (max-width:1335px)"]: {},
["@media (max-width:1167px)"]: {
- width: "86vw",
+ width: "86vw"
},
["@media (max-width:1030px)"]: {},
["@media (max-width:960px)"]: {
- marginTop: 0,
- },
-}));
+ marginTop: 0
+ }
+}))
enum DAOState {
NOT_FOUND = 0,
NOT_INDEXED = 1,
- FOUND = 2,
+ FOUND = 2
}
const DAORouteContent: React.FC = ({ children }) => {
- const daoId = useDAOID();
- const { tezos, network } = useTezos();
- const { data, error } = useDAO(daoId);
- const [state, setState] = useState(DAOState.FOUND);
- const history = useHistory();
+ const daoId = useDAOID()
+ const { tezos, network } = useTezos()
+ const { data, error } = useDAO(daoId)
+ const [state, setState] = useState(DAOState.FOUND)
+ const history = useHistory()
useEffect(() => {
- (async () => {
+ ;(async () => {
if (!data && !!error) {
try {
- await tezos.contract.at(daoId);
- setState(DAOState.NOT_INDEXED);
+ await tezos.contract.at(daoId)
+ setState(DAOState.NOT_INDEXED)
} catch (e) {
- setState(DAOState.NOT_FOUND);
+ setState(DAOState.NOT_FOUND)
}
}
- })();
- }, [data, error, daoId, tezos.contract]);
+ })()
+ }, [data, error, daoId, tezos.contract])
useEffect(() => {
- if (
- history &&
- data &&
- data.data.network.toLowerCase() !== network.toLowerCase()
- ) {
- history.push("/explorer");
+ if (history && data && data.data.network.toLowerCase() !== network.toLowerCase()) {
+ history.push("/explorer")
}
- }, [data, history, network]);
+ }, [data, history, network])
return (
<>
@@ -88,31 +77,31 @@ const DAORouteContent: React.FC = ({ children }) => {
children
)}
>
- );
-};
+ )
+}
const DAORoute: React.FC = ({ children, ...props }) => {
return (
{children}
- );
-};
+ )
+}
-const DAOContext = React.createContext("");
+const DAOContext = React.createContext("")
const DAOProvider: React.FC<{ daoId: string }> = ({ daoId, children }) => {
- return {children};
-};
+ return {children}
+}
export const useDAOID = () => {
- return useContext(DAOContext);
-};
+ return useContext(DAOContext)
+}
export const DAORouter = (): JSX.Element => {
- const match = useRouteMatch();
- const theme = useTheme();
- const { id: daoId } = useParams<{ id: string }>();
+ const match = useRouteMatch()
+ const theme = useTheme()
+ const { id: daoId } = useParams<{ id: string }>()
return (
@@ -144,5 +133,5 @@ export const DAORouter = (): JSX.Element => {
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/DAOList/components/ConnectMessage.tsx b/src/modules/explorer/pages/DAOList/components/ConnectMessage.tsx
index a865e7c6..00842995 100644
--- a/src/modules/explorer/pages/DAOList/components/ConnectMessage.tsx
+++ b/src/modules/explorer/pages/DAOList/components/ConnectMessage.tsx
@@ -1,7 +1,7 @@
-import React from "react";
-import { Grid, Link, Theme, Typography } from "@material-ui/core";
-import { styled } from "@material-ui/styles";
-import { useTezos } from "services/beacon/hooks/useTezos";
+import React from "react"
+import { Grid, Link, Theme, Typography } from "@material-ui/core"
+import { styled } from "@material-ui/styles"
+import { useTezos } from "services/beacon/hooks/useTezos"
const Container = styled(Grid)(({ theme }: { theme: Theme }) => ({
background: theme.palette.primary.main,
@@ -10,25 +10,21 @@ const Container = styled(Grid)(({ theme }: { theme: Theme }) => ({
wordBreak: "break-all",
borderRadius: 8,
boxSizing: "border-box",
- padding: 32,
-}));
+ padding: 32
+}))
export const ConnectMessage: React.FC = () => {
- const { connect } = useTezos();
+ const { connect } = useTezos()
return (
{" "}
- connect()}
- style={{ cursor: "pointer" }}
- >
+ connect()} style={{ cursor: "pointer" }}>
Connect your wallet
{" "}
to see which DAOs you hold a stake in
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/DAOList/components/DAOItem.tsx b/src/modules/explorer/pages/DAOList/components/DAOItem.tsx
index cdc4ee3c..ef6ecf79 100644
--- a/src/modules/explorer/pages/DAOList/components/DAOItem.tsx
+++ b/src/modules/explorer/pages/DAOList/components/DAOItem.tsx
@@ -1,81 +1,66 @@
-import {
- styled,
- Grid,
- Theme,
- Typography,
- Link,
- useTheme,
- useMediaQuery,
-} from "@material-ui/core";
-import { createTheme } from '@material-ui/core/styles';
-import React from "react";
+import { styled, Grid, Theme, Typography, Link, useTheme, useMediaQuery } from "@material-ui/core"
+import { createTheme } from "@material-ui/core/styles"
+import React from "react"
const SectionNames = styled(Grid)(({ theme }: { theme: Theme }) => ({
- width: "55%",
+ width: "55%",
- ["@media (max-width:1030px)"]: {
+ ["@media (max-width:1030px)"]: {
width: "50%"
},
- ["@media (max-width:960px)"]: {
- width: "99%",
-
- },
-}));
+ ["@media (max-width:960px)"]: {
+ width: "99%"
+ }
+}))
const Container = styled(Grid)(({ theme }: { theme: Theme }) => ({
- background: theme.palette.primary.main,
- minHeight: 138,
- wordBreak: "break-all",
- borderRadius: 8,
- boxSizing: "border-box",
- padding: 32,
- cursor: "pointer",
- transition: "0.15s ease-out",
-
- ["@media (max-width:1335px)"]: {
- minHeight: 130,
+ "background": theme.palette.primary.main,
+ "minHeight": 138,
+ "wordBreak": "break-all",
+ "borderRadius": 8,
+ "boxSizing": "border-box",
+ "padding": 32,
+ "cursor": "pointer",
+ "transition": "0.15s ease-out",
+ ["@media (max-width:1335px)"]: {
+ minHeight: 130
},
- ["@media (max-width:1155px)"]: {
- minHeight: 123,
-
+ ["@media (max-width:1155px)"]: {
+ minHeight: 123
},
- ["@media (max-width:1030px)"]: {
-
- },
+ ["@media (max-width:1030px)"]: {},
- ["@media (max-width:960px)"]: {
+ ["@media (max-width:960px)"]: {
minHeight: 210
-
},
- ["@media (max-width:760px)"]: {
+ ["@media (max-width:760px)"]: {
maxWidth: "86vw"
-
},
"&:hover": {
background: theme.palette.secondary.dark,
scale: 1.01,
- transition: "0.15s ease-in",
+ transition: "0.15s ease-in"
},
"& > *": {
- transform: "scale(1.000001)",
+ transform: "scale(1.000001)"
}
-}));
+}))
const SymbolText = styled(Typography)({
fontSize: "18px",
fontWeight: 300,
- ["@media (max-width:1335px)"]: {
- fontSize: "16px",
- },
-});
+ ["@media (max-width:1335px)"]: {
+ fontSize: "16px"
+ }
+})
const NameText = styled(Typography)(({ theme }) => ({
whiteSpace: "nowrap",
@@ -84,97 +69,88 @@ const NameText = styled(Typography)(({ theme }) => ({
overflow: "hidden",
fontSize: "32px",
- ["@media (max-width:1335px)"]: {
- fontSize: "29px",
+ ["@media (max-width:1335px)"]: {
+ fontSize: "29px"
},
- ["@media (max-width:1155px)"]: {
- fontSize: "26px",
+ ["@media (max-width:1155px)"]: {
+ fontSize: "26px"
},
- ["@media (max-width:1030px)"]: {
-
- },
+ ["@media (max-width:1030px)"]: {},
- ["@media (max-width:960px)"]: {
+ ["@media (max-width:960px)"]: {
fontSize: "28px",
marginBottom: "10px"
-
- },
-}));
+ }
+}))
const NumberText = styled(Typography)({
fontSize: "28px",
fontWeight: 300,
- ["@media (max-width:1335px)"]: {
+ ["@media (max-width:1335px)"]: {
fontSize: "26px",
lineHeight: 1.2,
- borderBottom: "7px solid transparent",
+ borderBottom: "7px solid transparent"
},
- ["@media (max-width:1155px)"]: {
+ ["@media (max-width:1155px)"]: {
fontSize: "23px",
borderBottom: "9.5px solid transparent"
},
- ["@media (max-width:960px)"]: {
+ ["@media (max-width:960px)"]: {
fontSize: "26px",
borderBottom: "6px solid transparent"
- },
-});
+ }
+})
const VotingAddressesText = styled(Typography)({
fontSize: "19px",
fontWeight: 300,
- ["@media (max-width:1335px)"]: {
- fontSize: "17px",
-
+ ["@media (max-width:1335px)"]: {
+ fontSize: "17px"
},
- ["@media (max-width:1155px)"]: {
- fontSize: "15.7px",
+ ["@media (max-width:1155px)"]: {
+ fontSize: "15.7px"
},
- ["@media (max-width:960px)"]: {
+ ["@media (max-width:960px)"]: {
fontSize: "17px"
- },
-});
-
+ }
+})
export const DAOItem: React.FC<{
dao: {
- id: string;
- name: string;
- symbol: string;
- votingAddresses: string[];
- };
+ id: string
+ name: string
+ symbol: string
+ votingAddresses: string[]
+ }
}> = ({ dao }) => {
- const theme = useTheme();
- const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"));
-
+ const theme = useTheme()
+ const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"))
+
return (
-
- {dao.symbol.toUpperCase()}
- {dao.name}
+
+ {dao.symbol.toUpperCase()}
+ {dao.name}
-
-
- {dao.votingAddresses.length}
-
-
-
- Voting Addresses
-
+
+ {dao.votingAddresses.length}
+
+ Voting Addresses
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/DAOList/components/Searchbar.tsx b/src/modules/explorer/pages/DAOList/components/Searchbar.tsx
index 58915de3..290a9989 100644
--- a/src/modules/explorer/pages/DAOList/components/Searchbar.tsx
+++ b/src/modules/explorer/pages/DAOList/components/Searchbar.tsx
@@ -1,55 +1,49 @@
-import React from "react";
-import {
- InputAdornment,
- styled,
- TextField,
- Theme,
- withStyles,
-} from "@material-ui/core";
-import { SearchOutlined } from "@material-ui/icons";
+import React from "react"
+import { InputAdornment, styled, TextField, Theme, withStyles } from "@material-ui/core"
+import { SearchOutlined } from "@material-ui/icons"
const StyledInput = withStyles((theme: Theme) => ({
root: {
"& label.MuiInputLabel-root": {
- display: "none",
+ display: "none"
},
"& div.MuiInputBase-root": {
- fontSize: 18,
- height: 54,
- boxSizing: "border-box",
- background: theme.palette.primary.main,
- padding: "18px 22px",
- width: "100%",
- borderRadius: 4,
- marginTop: "0px !important",
- maxWidth: 571,
+ "fontSize": 18,
+ "height": 54,
+ "boxSizing": "border-box",
+ "background": theme.palette.primary.main,
+ "padding": "18px 22px",
+ "width": "100%",
+ "borderRadius": 4,
+ "marginTop": "0px !important",
+ "maxWidth": 571,
"& input": {
- color: theme.palette.text.primary,
- textAlign: "start",
+ "color": theme.palette.text.primary,
+ "textAlign": "start",
"&:placeholder": {
- opacity: 0.8,
- },
+ opacity: 0.8
+ }
},
"&:focus-visible": {
- outline: "none",
- },
+ outline: "none"
+ }
},
"& .MuiInput-underline:before": {
- borderBottomColor: "transparent",
+ borderBottomColor: "transparent"
},
"& .MuiInput-underline:hover:before": {
- borderBottomColor: "transparent",
+ borderBottomColor: "transparent"
},
"& .MuiInput-underline:after": {
- borderBottomColor: "transparent",
- },
+ borderBottomColor: "transparent"
+ }
},
- input: {},
-}))(TextField);
+ input: {}
+}))(TextField)
const SearchIcon = styled(SearchOutlined)({
- marginRight: 5,
-});
+ marginRight: 5
+})
export const SearchInput: React.FC<{ search: any }> = ({ search }) => {
return (
@@ -58,14 +52,14 @@ export const SearchInput: React.FC<{ search: any }> = ({ search }) => {
label="Search field"
type="search"
placeholder="Search"
- onChange={(e) => search(e.target.value)}
+ onChange={e => search(e.target.value)}
InputProps={{
startAdornment: (
- ),
+ )
}}
/>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/DAOList/index.tsx b/src/modules/explorer/pages/DAOList/index.tsx
index a438986f..6d231d4a 100644
--- a/src/modules/explorer/pages/DAOList/index.tsx
+++ b/src/modules/explorer/pages/DAOList/index.tsx
@@ -7,67 +7,55 @@ import {
Typography,
useMediaQuery,
Theme,
- useTheme,
-} from "@material-ui/core";
-import { Navbar } from "../../components/Toolbar";
-import { TabPanel } from "modules/explorer/components/TabPanel";
-import React, { useMemo, useState } from "react";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { useAllDAOs } from "services/indexer/dao/hooks/useAllDAOs";
-import { ConnectMessage } from "./components/ConnectMessage";
-import { DAOItem } from "./components/DAOItem";
-import { SearchInput } from "./components/Searchbar";
-import { MainButton } from '../../../common/MainButton';
-
+ useTheme
+} from "@material-ui/core"
+import { Navbar } from "../../components/Toolbar"
+import { TabPanel } from "modules/explorer/components/TabPanel"
+import React, { useMemo, useState } from "react"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { useAllDAOs } from "services/indexer/dao/hooks/useAllDAOs"
+import { ConnectMessage } from "./components/ConnectMessage"
+import { DAOItem } from "./components/DAOItem"
+import { SearchInput } from "./components/Searchbar"
+import { MainButton } from "../../../common/MainButton"
const PageContainer = styled("div")(({ theme }) => ({
width: "1000px",
height: "100%",
margin: "auto",
- ["@media (max-width: 1425px)"]: {
-
- },
+ ["@media (max-width: 1425px)"]: {},
- ["@media (max-width:1335px)"]: {
-
- },
+ ["@media (max-width:1335px)"]: {},
- ["@media (max-width:1167px)"]: {
- width: "86vw",
-
+ ["@media (max-width:1167px)"]: {
+ width: "86vw"
},
- ["@media (max-width:1030px)"]: {
+ ["@media (max-width:1030px)"]: {},
- },
+ ["@media (max-width:960px)"]: {}
+}))
- ["@media (max-width:960px)"]: {
-
-
- },
-}));
+const StyledTab = styled(Button)(({ theme, isSelected }: { theme: Theme; isSelected: boolean }) => ({
+ "fontSize": 16,
+ "color": isSelected ? theme.palette.primary.dark : "#fff",
-const StyledTab = styled(Button)(({theme, isSelected}: {theme: Theme; isSelected: boolean}) => ({
- fontSize: 16,
- color: isSelected ? theme.palette.primary.dark : "#fff",
-
- backgroundColor: isSelected ? theme.palette.secondary.main : theme.palette.primary.main,
+ "backgroundColor": isSelected ? theme.palette.secondary.main : theme.palette.primary.main,
"&:hover": {
- backgroundColor: isSelected ? theme.palette.secondary.main : theme.palette.secondary.dark,
+ backgroundColor: isSelected ? theme.palette.secondary.main : theme.palette.secondary.dark
}
-}),
-);
+}))
const Search = styled(Grid)({
width: "49.5%",
["@media (max-width: 645px)"]: {
width: "100%",
- marginTop: "14px",
- },
-});
+ marginTop: "14px"
+ }
+})
const DAOItemGrid = styled(Grid)({
gap: "18px",
@@ -76,72 +64,70 @@ const DAOItemGrid = styled(Grid)({
gap: "16px"
},
- ["@media (max-width:960px)"]: {
+ ["@media (max-width:960px)"]: {
gap: "14px"
},
- ["@media (max-width:830px)"]: {
+ ["@media (max-width:830px)"]: {
gap: "12px"
- },
-
-});
+ }
+})
const DAOItemCard = styled(Grid)({
flexBasis: "49%",
- ["@media (max-width:760px)"]: {
- minWidth: "100%",
- },
-
-});
+ ["@media (max-width:760px)"]: {
+ minWidth: "100%"
+ }
+})
export const DAOList: React.FC = () => {
- const { network, account } = useTezos();
- const { data: daos, isLoading } = useAllDAOs(network);
+ const { network, account } = useTezos()
+ const { data: daos, isLoading } = useAllDAOs(network)
- const theme = useTheme();
- const isMobileExtraSmall = useMediaQuery(theme.breakpoints.down("xs"));
- const isMobileSmall = useMediaQuery(theme.breakpoints.down("mobile"));
+ const theme = useTheme()
+ const isMobileExtraSmall = useMediaQuery(theme.breakpoints.down("xs"))
+ const isMobileSmall = useMediaQuery(theme.breakpoints.down("mobile"))
- const [searchText, setSearchText] = useState("");
- const [selectedTab, setSelectedTab] = React.useState(0);
+ const [searchText, setSearchText] = useState("")
+ const [selectedTab, setSelectedTab] = React.useState(0)
const currentDAOs = useMemo(() => {
if (daos) {
- const formattedDAOs = daos.map((dao) => ({
- id: dao.address,
- name: dao.name,
- symbol: dao.token.symbol,
- votingAddresses: dao.ledgers.map((l) => l.holder.address),
- })).sort((a, b) => b.votingAddresses.length - a.votingAddresses.length);
+ const formattedDAOs = daos
+ .map(dao => ({
+ id: dao.address,
+ name: dao.name,
+ symbol: dao.token.symbol,
+ votingAddresses: dao.ledgers.map(l => l.holder.address)
+ }))
+ .sort((a, b) => b.votingAddresses.length - a.votingAddresses.length)
if (searchText) {
return formattedDAOs.filter(
- (formattedDao) =>
- formattedDao.name
- .toLowerCase()
- .includes(searchText.toLowerCase()) ||
+ formattedDao =>
+ formattedDao.name.toLowerCase().includes(searchText.toLowerCase()) ||
formattedDao.symbol.toLowerCase().includes(searchText.toLowerCase())
- );
+ )
}
- return formattedDAOs;
+ return formattedDAOs
}
- return [];
- }, [daos, searchText]);
+ return []
+ }, [daos, searchText])
const filterDAOs = (filter: string) => {
- setSearchText(filter.trim());
- };
+ setSearchText(filter.trim())
+ }
const handleChangeTab = (newValue: number) => {
- setSelectedTab(newValue);
- };
+ setSelectedTab(newValue)
+ }
return (
<>
-
+
@@ -157,12 +143,7 @@ export const DAOList: React.FC = () => {
-
+
{daos?.length || 0} DAOs
@@ -188,7 +169,11 @@ export const DAOList: React.FC = () => {
handleChangeTab(0)}
isSelected={selectedTab === 0}
@@ -197,11 +182,14 @@ export const DAOList: React.FC = () => {
-
handleChangeTab(1)}
isSelected={selectedTab === 1}
>
@@ -214,10 +202,7 @@ export const DAOList: React.FC = () => {
-
+
{currentDAOs.map((dao, i) => (
@@ -232,16 +217,12 @@ export const DAOList: React.FC = () => {
-
+
{!account ? (
) : (
currentDAOs
- .filter((dao) => dao.votingAddresses.includes(account))
+ .filter(dao => dao.votingAddresses.includes(account))
.map((dao, i) => (
@@ -254,5 +235,5 @@ export const DAOList: React.FC = () => {
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/NFTs/index.tsx b/src/modules/explorer/pages/NFTs/index.tsx
index 7f8ac656..c9f85caa 100644
--- a/src/modules/explorer/pages/NFTs/index.tsx
+++ b/src/modules/explorer/pages/NFTs/index.tsx
@@ -1,81 +1,68 @@
-import {
- Box,
- Button,
- Grid,
- styled,
- Tooltip,
- Typography,
- useMediaQuery,
- useTheme,
-} from "@material-ui/core";
-import { NFT as NFTModel } from "models/Token";
-import { CopyAddress } from "modules/common/CopyAddress";
-import { NFT } from "modules/explorer/components/NFT";
-import { NFTDialog } from "modules/explorer/components/NFTDialog";
-import {
- ProposalFormContainer,
- ProposalFormDefaultValues,
-} from "modules/explorer/components/ProposalForm";
-import { UserBadge } from "modules/explorer/components/UserBadge";
+import { Box, Button, Grid, styled, Tooltip, Typography, useMediaQuery, useTheme } from "@material-ui/core"
+import { NFT as NFTModel } from "models/Token"
+import { CopyAddress } from "modules/common/CopyAddress"
+import { NFT } from "modules/explorer/components/NFT"
+import { NFTDialog } from "modules/explorer/components/NFTDialog"
+import { ProposalFormContainer, ProposalFormDefaultValues } from "modules/explorer/components/ProposalForm"
+import { UserBadge } from "modules/explorer/components/UserBadge"
-import React, { useState } from "react";
-import { NFTDAOHolding } from "services/bakingBad/tokenBalances";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { useDAOHoldings } from "services/contracts/baseDAO/hooks/useDAOHoldings";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { ContentContainer } from "../../components/ContentContainer";
-import { Hero } from "../../components/Hero";
-import { HeroTitle } from "../../components/HeroTitle";
-import { useDAOID } from "../DAO/router";
-import { InfoIcon } from "../../components/styled/InfoIcon";
-import { useIsProposalButtonDisabled } from "../../../../services/contracts/baseDAO/hooks/useCycleInfo";
-import { SmallButton } from "../../../common/SmallButton";
-import { MainButton } from "../../../common/MainButton";
+import React, { useState } from "react"
+import { NFTDAOHolding } from "services/bakingBad/tokenBalances"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { useDAOHoldings } from "services/contracts/baseDAO/hooks/useDAOHoldings"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { ContentContainer } from "../../components/ContentContainer"
+import { Hero } from "../../components/Hero"
+import { HeroTitle } from "../../components/HeroTitle"
+import { useDAOID } from "../DAO/router"
+import { InfoIcon } from "../../components/styled/InfoIcon"
+import { useIsProposalButtonDisabled } from "../../../../services/contracts/baseDAO/hooks/useCycleInfo"
+import { SmallButton } from "../../../common/SmallButton"
+import { MainButton } from "../../../common/MainButton"
const Card = styled(ContentContainer)({
boxSizing: "border-box",
padding: 30,
width: 325,
minHeight: 500,
- cursor: "pointer",
-});
+ cursor: "pointer"
+})
const FullWidthContainer = styled(Grid)({
- width: "100%",
-});
+ width: "100%"
+})
const ImgContainer = styled(Box)({
height: 246,
- width: "100%",
-});
+ width: "100%"
+})
const NFTId = styled(Typography)({
- fontSize: 14,
-});
+ fontSize: 14
+})
const NFTTitle = styled(Typography)({
- fontWeight: "bold",
-});
+ fontWeight: "bold"
+})
export const NFTs: React.FC = () => {
- const theme = useTheme();
- const daoId = useDAOID();
- const { data: dao } = useDAO(daoId);
- const { nftHoldings } = useDAOHoldings(daoId);
- const [openTransfer, setOpenTransfer] = useState(false);
- const { account } = useTezos();
- const [defaultValues, setDefaultValues] =
- useState();
- const [selectedNFT, setSelectedNFT] = useState();
- const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"));
+ const theme = useTheme()
+ const daoId = useDAOID()
+ const { data: dao } = useDAO(daoId)
+ const { nftHoldings } = useDAOHoldings(daoId)
+ const [openTransfer, setOpenTransfer] = useState(false)
+ const { account } = useTezos()
+ const [defaultValues, setDefaultValues] = useState()
+ const [selectedNFT, setSelectedNFT] = useState()
+ const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"))
const onClickNFT = (nft: NFTDAOHolding) => {
- setSelectedNFT(nft);
- };
+ setSelectedNFT(nft)
+ }
const onCloseDialog = () => {
- setSelectedNFT(undefined);
- };
+ setSelectedNFT(undefined)
+ }
const onOpenTransferModal = (nft: NFTModel) => {
setDefaultValues({
@@ -85,24 +72,24 @@ export const NFTs: React.FC = () => {
{
recipient: account,
amount: 1,
- asset: nft,
- },
- ],
- },
- });
- setOpenTransfer(true);
- };
+ asset: nft
+ }
+ ]
+ }
+ })
+ setOpenTransfer(true)
+ }
const onClick = (e: any, nft: NFTModel) => {
- e.stopPropagation();
- onOpenTransferModal(nft);
- };
+ e.stopPropagation()
+ onOpenTransferModal(nft)
+ }
const onCloseTransfer = () => {
- setOpenTransfer(false);
- };
+ setOpenTransfer(false)
+ }
- const shouldDisable = useIsProposalButtonDisabled(daoId);
+ const shouldDisable = useIsProposalButtonDisabled(daoId)
return (
<>
@@ -115,7 +102,7 @@ export const NFTs: React.FC = () => {
address={dao.data.address}
justifyContent={isMobileSmall ? "center" : "flex-start"}
typographyProps={{
- variant: "subtitle2",
+ variant: "subtitle2"
}}
/>
)}
@@ -130,21 +117,14 @@ export const NFTs: React.FC = () => {
New Transfer
{shouldDisable && (
-
+
)}
-
+
{nftHoldings.map((nft, i) => (
{
onClick={() => onClickNFT(nft)}
>
-
+
{nft.token.firstCreator ? (
-
+
) : (
Unknown
@@ -177,11 +148,7 @@ export const NFTs: React.FC = () => {
-
+
@@ -203,7 +170,7 @@ export const NFTs: React.FC = () => {
variant="contained"
color="secondary"
size="small"
- onClick={(e) => onClick(e, nft.token)}
+ onClick={e => onClick(e, nft.token)}
disabled={shouldDisable}
>
Propose Transfer
@@ -216,11 +183,7 @@ export const NFTs: React.FC = () => {
-
+
{
defaultTab={1}
/>
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/ProposalDetails/components/QuorumThreshold.tsx b/src/modules/explorer/pages/ProposalDetails/components/QuorumThreshold.tsx
index adde9144..8bcf2d00 100644
--- a/src/modules/explorer/pages/ProposalDetails/components/QuorumThreshold.tsx
+++ b/src/modules/explorer/pages/ProposalDetails/components/QuorumThreshold.tsx
@@ -1,33 +1,31 @@
-import React from "react";
-import { Grid, Typography, Tooltip, styled } from "@material-ui/core";
-import { InfoIcon } from "modules/explorer/components/styled/InfoIcon";
-import ProgressBar from "react-customizable-progressbar";
-import { formatNumber } from "modules/explorer/utils/FormatNumber";
-import { theme } from "theme";
-import BigNumber from "bignumber.js";
+import React from "react"
+import { Grid, Typography, Tooltip, styled } from "@material-ui/core"
+import { InfoIcon } from "modules/explorer/components/styled/InfoIcon"
+import ProgressBar from "react-customizable-progressbar"
+import { formatNumber } from "modules/explorer/utils/FormatNumber"
+import { theme } from "theme"
+import BigNumber from "bignumber.js"
interface Props {
- value: BigNumber;
- tooltipText: string;
+ value: BigNumber
+ tooltipText: string
}
-const ProgressText = styled(Typography)(
- ({ textColor }: { textColor: string }) => ({
- color: textColor,
- display: "flex",
- alignItems: "center",
- position: "absolute",
- width: "100%",
- height: "100%",
- fontSize: 16,
- userSelect: "none",
- boxShadow: "none",
- background: "inherit",
- fontFamily: "Roboto Mono",
- justifyContent: "center",
- top: 0,
- })
-);
+const ProgressText = styled(Typography)(({ textColor }: { textColor: string }) => ({
+ color: textColor,
+ display: "flex",
+ alignItems: "center",
+ position: "absolute",
+ width: "100%",
+ height: "100%",
+ fontSize: 16,
+ userSelect: "none",
+ boxShadow: "none",
+ background: "inherit",
+ fontFamily: "Roboto Mono",
+ justifyContent: "center",
+ top: 0
+}))
export const QuorumThreshold: React.FC = ({ value, tooltipText }) => {
return (
@@ -41,10 +39,7 @@ export const QuorumThreshold: React.FC = ({ value, tooltipText }) => {
-
+
@@ -60,13 +55,11 @@ export const QuorumThreshold: React.FC = ({ value, tooltipText }) => {
trackStrokeColor={theme.palette.primary.light}
>
-
- {formatNumber(value)}
-
+
{formatNumber(value)}
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/ProposalDetails/index.tsx b/src/modules/explorer/pages/ProposalDetails/index.tsx
index 2be0afc1..b087b903 100644
--- a/src/modules/explorer/pages/ProposalDetails/index.tsx
+++ b/src/modules/explorer/pages/ProposalDetails/index.tsx
@@ -1,92 +1,90 @@
-import {Button, Grid, Theme, Tooltip, Typography, useMediaQuery,} from "@material-ui/core";
-import {styled, useTheme} from "@material-ui/styles";
-import ReactHtmlParser from "react-html-parser";
-import {BigNumber} from "bignumber.js";
-import ProgressBar from "react-customizable-progressbar";
-import {StatusBadge} from "modules/explorer/components/StatusBadge";
-import {UserBadge} from "modules/explorer/components/UserBadge";
-import {VotersProgress} from "modules/explorer/components/VotersProgress";
-import {useCanDropProposal} from "modules/explorer/hooks/useCanDropProposal";
-import React, {useCallback, useMemo, useState} from "react";
-import {useParams} from "react-router";
-import {useAgoraTopic} from "services/agora/hooks/useTopic";
-import {BaseDAO} from "services/contracts/baseDAO";
-import {useDropProposal} from "services/contracts/baseDAO/hooks/useDropProposal";
-import {formatUnits, parseUnits, toShortAddress} from "services/contracts/utils";
-import {useDAO} from "services/indexer/dao/hooks/useDAO";
-import {useProposal} from "services/indexer/dao/hooks/useProposal";
-import {ContentContainer} from "../../components/ContentContainer";
-import {useDAOID} from "../DAO/router";
-import {useVotesStats} from "modules/explorer/hooks/useVotesStats";
-import {formatNumber} from "modules/explorer/utils/FormatNumber";
-import {HighlightedBadge} from "modules/explorer/components/styled/HighlightedBadge";
-import {TransferBadge} from "modules/explorer/components/TransferBadge";
+import { Button, Grid, Theme, Tooltip, Typography, useMediaQuery } from "@material-ui/core"
+import { styled, useTheme } from "@material-ui/styles"
+import ReactHtmlParser from "react-html-parser"
+import { BigNumber } from "bignumber.js"
+import ProgressBar from "react-customizable-progressbar"
+import { StatusBadge } from "modules/explorer/components/StatusBadge"
+import { UserBadge } from "modules/explorer/components/UserBadge"
+import { VotersProgress } from "modules/explorer/components/VotersProgress"
+import { useCanDropProposal } from "modules/explorer/hooks/useCanDropProposal"
+import React, { useCallback, useMemo, useState } from "react"
+import { useParams } from "react-router"
+import { useAgoraTopic } from "services/agora/hooks/useTopic"
+import { BaseDAO } from "services/contracts/baseDAO"
+import { useDropProposal } from "services/contracts/baseDAO/hooks/useDropProposal"
+import { formatUnits, parseUnits, toShortAddress } from "services/contracts/utils"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useProposal } from "services/indexer/dao/hooks/useProposal"
+import { ContentContainer } from "../../components/ContentContainer"
+import { useDAOID } from "../DAO/router"
+import { useVotesStats } from "modules/explorer/hooks/useVotesStats"
+import { formatNumber } from "modules/explorer/utils/FormatNumber"
+import { HighlightedBadge } from "modules/explorer/components/styled/HighlightedBadge"
+import { TransferBadge } from "modules/explorer/components/TransferBadge"
import {
FA2Transfer,
Proposal,
ProposalStatus,
RegistryProposal,
- TreasuryProposal,
-} from "services/indexer/dao/mappers/proposal/types";
-import {useDAOHoldings} from "services/contracts/baseDAO/hooks/useDAOHoldings";
-import {VoteDialog} from "../../components/VoteDialog";
-import {XTZTransferBadge} from "../../components/XTZTransferBadge";
-import {InfoIcon} from "../../components/styled/InfoIcon";
-import {ProposalTransferBadge} from "modules/explorer/components/ProposalTransferBadge";
-import {useUnstakeVotes} from "../../../../services/contracts/baseDAO/hooks/useUnstakeVotes";
-import {useTezos} from "../../../../services/beacon/hooks/useTezos";
+ TreasuryProposal
+} from "services/indexer/dao/mappers/proposal/types"
+import { useDAOHoldings } from "services/contracts/baseDAO/hooks/useDAOHoldings"
+import { VoteDialog } from "../../components/VoteDialog"
+import { XTZTransferBadge } from "../../components/XTZTransferBadge"
+import { InfoIcon } from "../../components/styled/InfoIcon"
+import { ProposalTransferBadge } from "modules/explorer/components/ProposalTransferBadge"
+import { useUnstakeVotes } from "../../../../services/contracts/baseDAO/hooks/useUnstakeVotes"
+import { useTezos } from "../../../../services/beacon/hooks/useTezos"
const Container = styled(ContentContainer)({
- padding: "36px 45px",
-});
+ padding: "36px 45px"
+})
-const HistoryItem = styled(Grid)(({theme}: { theme: Theme }) => ({
+const HistoryItem = styled(Grid)(({ theme }: { theme: Theme }) => ({
marginTop: 20,
paddingBottom: 12,
display: "flex",
height: "auto",
[theme.breakpoints.down("sm")]: {
- width: "unset",
- },
-}));
+ width: "unset"
+ }
+}))
const QuorumTitle = styled(Typography)(() => ({
- color: "#3866F9",
-}));
+ color: "#3866F9"
+}))
-const ProgressText = styled(Typography)(
- ({textColor}: { textColor: string }) => ({
- color: textColor,
- display: "flex",
- alignItems: "center",
- position: "absolute",
- width: "100%",
- height: "100%",
- fontSize: 16,
- userSelect: "none",
- boxShadow: "none",
- background: "inherit",
- fontFamily: "Roboto Mono",
- justifyContent: "center",
- top: 0,
- })
-);
+const ProgressText = styled(Typography)(({ textColor }: { textColor: string }) => ({
+ color: textColor,
+ display: "flex",
+ alignItems: "center",
+ position: "absolute",
+ width: "100%",
+ height: "100%",
+ fontSize: 16,
+ userSelect: "none",
+ boxShadow: "none",
+ background: "inherit",
+ fontFamily: "Roboto Mono",
+ justifyContent: "center",
+ top: 0
+}))
const DetailsText = styled(Typography)({
- wordBreak: "break-all",
-});
+ wordBreak: "break-all"
+})
-const VoteButton = styled(Button)(({favor}: { favor: boolean }) => ({
- backgroundColor: favor ? "#3FE888" : "#FF486E",
-}));
+const VoteButton = styled(Button)(({ favor }: { favor: boolean }) => ({
+ backgroundColor: favor ? "#3FE888" : "#FF486E"
+}))
const getReadableConfig = (configKey: keyof Proposal["metadata"]["config"]) => {
switch (configKey) {
case "frozen_extra_value":
- return "Proposal fee";
+ return "Proposal fee"
case "slash_scale_value":
- return "Percentage of tokens returned after rejection";
+ return "Percentage of tokens returned after rejection"
default:
return "Unknown Config parameter"
@@ -94,30 +92,28 @@ const getReadableConfig = (configKey: keyof Proposal["metadata"]["config"]) => {
}
export const ProposalDetails: React.FC = () => {
- const {proposalId} = useParams<{
- proposalId: string;
- }>();
- const daoId = useDAOID();
- const [openVote, setOpenVote] = useState(false);
- const [voteIsSupport, setVoteIsSupport] = useState(false);
- const theme = useTheme();
- const {data: proposal} = useProposal(daoId, proposalId);
- const {data: dao, cycleInfo} = useDAO(daoId);
- const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"));
- const {mutate: dropProposal} = useDropProposal();
- const {data: holdings} = useDAOHoldings(daoId);
+ const { proposalId } = useParams<{
+ proposalId: string
+ }>()
+ const daoId = useDAOID()
+ const [openVote, setOpenVote] = useState(false)
+ const [voteIsSupport, setVoteIsSupport] = useState(false)
+ const theme = useTheme()
+ const { data: proposal } = useProposal(daoId, proposalId)
+ const { data: dao, cycleInfo } = useDAO(daoId)
+ const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"))
+ const { mutate: dropProposal } = useDropProposal()
+ const { data: holdings } = useDAOHoldings(daoId)
const { account } = useTezos()
- const canDropProposal = useCanDropProposal(daoId, proposalId);
- const {data: agoraPost} = useAgoraTopic(
- Number(proposal?.metadata?.agoraPostId)
- );
+ const canDropProposal = useCanDropProposal(daoId, proposalId)
+ const { data: agoraPost } = useAgoraTopic(Number(proposal?.metadata?.agoraPostId))
- const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0);
+ const quorumThreshold = proposal?.quorumThreshold || new BigNumber(0)
const { mutate: mutateUnstake } = useUnstakeVotes()
const onClickVote = (support: boolean) => {
- setVoteIsSupport(support);
- setOpenVote(true);
+ setVoteIsSupport(support)
+ setOpenVote(true)
}
const onCloseVote = () => {
@@ -127,59 +123,59 @@ export const ProposalDetails: React.FC = () => {
const onDropProposal = useCallback(async () => {
await dropProposal({
dao: dao as BaseDAO,
- proposalId,
- });
- }, [dao, dropProposal, proposalId]);
+ proposalId
+ })
+ }, [dao, dropProposal, proposalId])
const onUnstakeVotes = useCallback(async () => {
await mutateUnstake({
dao: dao as BaseDAO,
- proposalId,
- });
- }, [dao, mutateUnstake, proposalId]);
+ proposalId
+ })
+ }, [dao, mutateUnstake, proposalId])
- const proposalCycle = proposal ? proposal.period : "-";
+ const proposalCycle = proposal ? proposal.period : "-"
- const {votesQuorumPercentage} = useVotesStats({
+ const { votesQuorumPercentage } = useVotesStats({
upVotes: proposal?.upVotes || new BigNumber(0),
downVotes: proposal?.downVotes || new BigNumber(0),
- quorumThreshold,
- });
+ quorumThreshold
+ })
const list = useMemo(() => {
if (!proposal || !(proposal instanceof RegistryProposal)) {
- return [];
+ return []
}
- return proposal.metadata.list;
- }, [proposal]);
+ return proposal.metadata.list
+ }, [proposal])
const transfers = useMemo(() => {
if (!holdings || !proposal) {
- return [];
+ return []
}
- return (proposal as TreasuryProposal | RegistryProposal).metadata.transfers;
- }, [holdings, proposal]);
+ return (proposal as TreasuryProposal | RegistryProposal).metadata.transfers
+ }, [holdings, proposal])
- const canVote =
- cycleInfo &&
- proposal?.getStatus(cycleInfo.currentLevel).status ===
- ProposalStatus.ACTIVE;
+ const canVote = cycleInfo && proposal?.getStatus(cycleInfo.currentLevel).status === ProposalStatus.ACTIVE
- const canUnstakeVotes = cycleInfo && proposal && account &&
+ const canUnstakeVotes =
+ cycleInfo &&
+ proposal &&
+ account &&
(proposal.getStatus(cycleInfo.currentLevel).status === ProposalStatus.DROPPED ||
- proposal.getStatus(cycleInfo.currentLevel).status === ProposalStatus.EXECUTED) &&
+ proposal.getStatus(cycleInfo.currentLevel).status === ProposalStatus.EXECUTED) &&
proposal.voters.some(({ address }) => address.toLowerCase() === account.toLowerCase())
const parseReadableConfigValue = (configKey: keyof Proposal["metadata"]["config"], value: BigNumber) => {
- if(dao){
+ if (dao) {
switch (configKey) {
case "frozen_extra_value":
- return parseUnits(value, dao.data.token.decimals).toString();
+ return parseUnits(value, dao.data.token.decimals).toString()
case "slash_scale_value":
- return 100 - value.toNumber();
-
+ return 100 - value.toNumber()
+
default:
return value.toString()
}
@@ -188,69 +184,45 @@ export const ProposalDetails: React.FC = () => {
return (
<>
-
+
-
-
+
+
-
- {agoraPost
- ? agoraPost.title
- : `Proposal ${toShortAddress(proposal?.id || "")}`}
+
+ {agoraPost ? agoraPost.title : `Proposal ${toShortAddress(proposal?.id || "")}`}
-
-
+
Unstake votes
-
+
-
+
{proposal && cycleInfo && (
-
+
-
+
@@ -258,22 +230,30 @@ export const ProposalDetails: React.FC = () => {
-
+
)}
-
+
- onClickVote(true)}
- disabled={!canVote}>
+ onClickVote(true)}
+ disabled={!canVote}
+ >
Vote For
- onClickVote(false)}
- disabled={!canVote}>
+ onClickVote(false)}
+ disabled={!canVote}
+ >
Vote Against
@@ -284,38 +264,26 @@ export const ProposalDetails: React.FC = () => {
-
+
-
+
-
+
Votes
-
- Cycle: {proposalCycle}
-
+ Cycle: {proposalCycle}
-
+
-
+
{
>
- {proposal
- ? `${formatNumber(votesQuorumPercentage)}%`
- : "-"}
+ {proposal ? `${formatNumber(votesQuorumPercentage)}%` : "-"}
@@ -341,23 +307,27 @@ export const ProposalDetails: React.FC = () => {
alignItems="flex-start"
justifyContent="center"
wrap="nowrap"
- style={{height: "100%"}}
+ style={{ height: "100%" }}
>
- {proposal && (
-
- )}
-
- Quorum Threshold:
-
+ {proposal && (
+
+
+
+ )}
+ Quorum Threshold:
-
- {proposal ? quorumThreshold.toString() : "-"}
-
+ {proposal ? quorumThreshold.toString() : "-"}
@@ -366,36 +336,23 @@ export const ProposalDetails: React.FC = () => {
-
+
{agoraPost && (
-
+
{ReactHtmlParser(agoraPost.post_stream.posts[0].cooked)}
)}
-
+
{proposal ? (
<>
{transfers.map((transfer, index) => {
return (
-
+
{transfer.type === "XTZ" ? (
-
+
) : (
{
/>
)}
- );
+ )
})}
- {proposal.metadata.config.map(({key, value}, index) => (
-
-
+ {proposal.metadata.config.map(({ key, value }, index) => (
+
+
- Change {getReadableConfig(key as keyof Proposal["metadata"]["config"])}
- to {parseReadableConfigValue(key as keyof Proposal["metadata"]["config"], value)}
+ Change{" "}
+
+ {getReadableConfig(key as keyof Proposal["metadata"]["config"])}
+ {" "}
+ to{" "}
+
+ {parseReadableConfigValue(key as keyof Proposal["metadata"]["config"], value)}
+
))}
- {proposal.metadata.update_contract_delegate !== '' &&
- }
- {proposal.metadata.update_guardian !== '' &&
- }
- {list.map(({key, value}, index) => (
-
-
+ {proposal.metadata.update_contract_delegate !== "" && (
+
+ )}
+ {proposal.metadata.update_guardian !== "" && (
+
+ )}
+ {list.map(({ key, value }, index) => (
+
+
Set "{key}" to "{value}"
@@ -468,9 +408,7 @@ export const ProposalDetails: React.FC = () => {
{cycleInfo &&
- proposal
- ?.getStatus(cycleInfo.currentLevel)
- .statusHistory.map((item, index) => {
+ proposal?.getStatus(cycleInfo.currentLevel).statusHistory.map((item, index) => {
return (
{
alignItems="baseline"
wrap="nowrap"
xs={12}
- style={{gap: 32}}
+ style={{ gap: 32 }}
>
-
+
@@ -490,13 +428,13 @@ export const ProposalDetails: React.FC = () => {
- );
+ )
})}
-
+
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/Proposals/index.tsx b/src/modules/explorer/pages/Proposals/index.tsx
index 3dc76830..e6fcd4a3 100644
--- a/src/modules/explorer/pages/Proposals/index.tsx
+++ b/src/modules/explorer/pages/Proposals/index.tsx
@@ -1,56 +1,54 @@
-import React, { useCallback, useState } from "react";
-import {Grid, styled, Typography, Button, Tooltip} from "@material-ui/core";
-
-import { useFlush } from "services/contracts/baseDAO/hooks/useFlush";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useProposals } from "services/indexer/dao/hooks/useProposals";
-import { useDAOID } from "../DAO/router";
-
-import { UserBalancesBox } from "../../components/UserBalances";
-import { ContentContainer } from "../../components/ContentContainer";
-import { ProposalsList } from "../../components/ProposalsList";
-import { DAOStatsRow } from "../../components/DAOStatsRow";
-import { ProposalStatus } from "services/indexer/dao/mappers/proposal/types";
+import React, { useCallback, useState } from "react"
+import { Grid, styled, Typography, Button, Tooltip } from "@material-ui/core"
+
+import { useFlush } from "services/contracts/baseDAO/hooks/useFlush"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useProposals } from "services/indexer/dao/hooks/useProposals"
+import { useDAOID } from "../DAO/router"
+
+import { UserBalancesBox } from "../../components/UserBalances"
+import { ContentContainer } from "../../components/ContentContainer"
+import { ProposalsList } from "../../components/ProposalsList"
+import { DAOStatsRow } from "../../components/DAOStatsRow"
+import { ProposalStatus } from "services/indexer/dao/mappers/proposal/types"
// import { ProposalFormContainer } from "modules/explorer/components/ProposalForm";
-import {InfoIcon} from "../../components/styled/InfoIcon";
-import {useIsProposalButtonDisabled} from "../../../../services/contracts/baseDAO/hooks/useCycleInfo";
-import {ProposalSelectionMenu} from "../../components/ProposalSelectionMenu";
-import {useDropAllExpired} from "../../../../services/contracts/baseDAO/hooks/useDropAllExpired";
-import { SmallButton } from '../../../common/SmallButton';
-import { MainButton } from '../../../common/MainButton';
-
+import { InfoIcon } from "../../components/styled/InfoIcon"
+import { useIsProposalButtonDisabled } from "../../../../services/contracts/baseDAO/hooks/useCycleInfo"
+import { ProposalSelectionMenu } from "../../components/ProposalSelectionMenu"
+import { useDropAllExpired } from "../../../../services/contracts/baseDAO/hooks/useDropAllExpired"
+import { SmallButton } from "../../../common/SmallButton"
+import { MainButton } from "../../../common/MainButton"
const HeroContainer = styled(ContentContainer)({
- padding: "38px 38px",
-});
+ padding: "38px 38px"
+})
const TitleText = styled(Typography)({
fontSize: 30,
fontWeight: 500,
- lineHeight: .90,
-
- ["@media (max-width:1030px)"]: {
- fontSize: 25,
- },
-});
+ lineHeight: 0.9,
+ ["@media (max-width:1030px)"]: {
+ fontSize: 25
+ }
+})
export const DropButton = styled(Button)({
verticalAlign: "text-bottom",
- fontSize: "16px",
-});
+ fontSize: "16px"
+})
export const Proposals: React.FC = () => {
- const [openModal, setOpenModal] = useState(false);
- const daoId = useDAOID();
- const { data, cycleInfo } = useDAO(daoId);
- const { mutate } = useFlush();
- const { mutate: dropAllExpired } = useDropAllExpired();
- const shouldDisable = useIsProposalButtonDisabled(daoId);
- const { data: proposals } = useProposals(daoId);
- const { data: activeProposals } = useProposals(daoId, ProposalStatus.ACTIVE);
- const { data: executableProposals } = useProposals(daoId, ProposalStatus.EXECUTABLE);
- const { data: expiredProposals } = useProposals(daoId, ProposalStatus.EXPIRED);
+ const [openModal, setOpenModal] = useState(false)
+ const daoId = useDAOID()
+ const { data, cycleInfo } = useDAO(daoId)
+ const { mutate } = useFlush()
+ const { mutate: dropAllExpired } = useDropAllExpired()
+ const shouldDisable = useIsProposalButtonDisabled(daoId)
+ const { data: proposals } = useProposals(daoId)
+ const { data: activeProposals } = useProposals(daoId, ProposalStatus.ACTIVE)
+ const { data: executableProposals } = useProposals(daoId, ProposalStatus.EXECUTABLE)
+ const { data: expiredProposals } = useProposals(daoId, ProposalStatus.EXPIRED)
const onFlush = useCallback(async () => {
if (executableProposals && expiredProposals && executableProposals.length && data) {
@@ -58,28 +56,28 @@ export const Proposals: React.FC = () => {
dao: data,
numOfProposalsToFlush: executableProposals.length,
expiredProposalIds: expiredProposals.map(p => p.id)
- });
- return;
+ })
+ return
}
- }, [data, mutate, executableProposals, expiredProposals]);
+ }, [data, mutate, executableProposals, expiredProposals])
const onDropAllExpired = useCallback(async () => {
if (expiredProposals && expiredProposals.length && data) {
dropAllExpired({
dao: data,
expiredProposalIds: expiredProposals.map(p => p.id)
- });
- return;
+ })
+ return
}
- }, [data, dropAllExpired, expiredProposals]);
+ }, [data, dropAllExpired, expiredProposals])
const onCloseModal = () => {
- setOpenModal(false);
- };
+ setOpenModal(false)
+ }
const handleProposalModal = () => {
- setOpenModal(true);
- };
+ setOpenModal(true)
+ }
return (
<>
@@ -100,10 +98,7 @@ export const Proposals: React.FC = () => {
>
Execute
-
+
@@ -116,29 +111,18 @@ export const Proposals: React.FC = () => {
>
Drop All Expired
-
+
-
+
New Proposal
{shouldDisable && (
-
+
)}
@@ -149,26 +133,18 @@ export const Proposals: React.FC = () => {
{data && cycleInfo && activeProposals && (
-
+
)}
{data && cycleInfo && proposals && (
-
+
)}
{/**/}
-
+
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/Registry/components/OverflowCell.tsx b/src/modules/explorer/pages/Registry/components/OverflowCell.tsx
index 65885219..bbd6b9d6 100644
--- a/src/modules/explorer/pages/Registry/components/OverflowCell.tsx
+++ b/src/modules/explorer/pages/Registry/components/OverflowCell.tsx
@@ -1,9 +1,9 @@
-import { TableCell } from "@material-ui/core";
-import styled from "@material-ui/core/styles/styled";
+import { TableCell } from "@material-ui/core"
+import styled from "@material-ui/core/styles/styled"
export const OverflowCell = styled(TableCell)({
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
- maxWidth: 300,
-});
\ No newline at end of file
+ maxWidth: 300
+})
diff --git a/src/modules/explorer/pages/Registry/components/RegistryTable.tsx b/src/modules/explorer/pages/Registry/components/RegistryTable.tsx
index 435ad2f6..c39ea771 100644
--- a/src/modules/explorer/pages/Registry/components/RegistryTable.tsx
+++ b/src/modules/explorer/pages/Registry/components/RegistryTable.tsx
@@ -1,4 +1,4 @@
-import React, { useMemo, useState } from "react";
+import React, { useMemo, useState } from "react"
import {
Button,
Grid,
@@ -10,61 +10,61 @@ import {
TableRow,
Typography,
useMediaQuery,
- useTheme,
-} from "@material-ui/core";
-import dayjs from "dayjs";
-import { RegistryItemDialog } from "modules/explorer/components/ItemDialog";
-import { OverflowCell } from "./OverflowCell";
-import { ContentContainer } from "modules/explorer/components/ContentContainer";
+ useTheme
+} from "@material-ui/core"
+import dayjs from "dayjs"
+import { RegistryItemDialog } from "modules/explorer/components/ItemDialog"
+import { OverflowCell } from "./OverflowCell"
+import { ContentContainer } from "modules/explorer/components/ContentContainer"
-const localizedFormat = require("dayjs/plugin/localizedFormat");
-dayjs.extend(localizedFormat);
+const localizedFormat = require("dayjs/plugin/localizedFormat")
+dayjs.extend(localizedFormat)
-const titles = ["Registry Items", "Value", "Last Updated"];
+const titles = ["Registry Items", "Value", "Last Updated"]
interface RowData {
- key: string;
- value: string;
- lastUpdated?: string;
- onClick: () => void;
+ key: string
+ value: string
+ lastUpdated?: string
+ onClick: () => void
}
interface Props {
- data: { row: RowData; onClickItem: (row: RowData) => void }[];
+ data: { row: RowData; onClickItem: (row: RowData) => void }[]
}
const MobileTableHeader = styled(Grid)({
width: "100%",
padding: 20,
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
const MobileTableRow = styled(Grid)({
padding: "30px",
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
const OverflowItem = styled(Grid)({
whiteSpace: "nowrap",
overflow: "hidden",
textOverflow: "ellipsis",
- maxWidth: 300,
-});
+ maxWidth: 300
+})
const TableContainer = styled(ContentContainer)({
- width: "100%",
-});
+ width: "100%"
+})
const titleDataMatcher = (title: typeof titles[number], rowData: RowData) => {
switch (title) {
case "Registry Items":
- return rowData.key;
+ return rowData.key
case "Value":
- return rowData.value;
+ return rowData.value
case "Last Updated":
- return rowData.lastUpdated || "-";
+ return rowData.lastUpdated || "-"
}
-};
+}
const MobileRegistryTable: React.FC = ({ data }) => {
return (
@@ -98,9 +98,9 @@ const MobileRegistryTable: React.FC = ({ data }) => {
{
- e.stopPropagation();
- rowData.row.onClick();
+ onClick={e => {
+ e.stopPropagation()
+ rowData.row.onClick()
}}
>
Edit
@@ -109,8 +109,8 @@ const MobileRegistryTable: React.FC = ({ data }) => {
))}
- );
-};
+ )
+}
const DesktopRegistryTable: React.FC = ({ data }) => {
return (
@@ -124,24 +124,17 @@ const DesktopRegistryTable: React.FC = ({ data }) => {
{data.map((rowData, i) => (
- rowData.onClickItem(rowData.row)}
- >
+ rowData.onClickItem(rowData.row)}>
{rowData.row.key.toUpperCase()}
{rowData.row.value}
-
- {rowData.row.lastUpdated
- ? dayjs(rowData.row.lastUpdated).format("L")
- : "-"}
-
+ {rowData.row.lastUpdated ? dayjs(rowData.row.lastUpdated).format("L") : "-"}
{
- e.stopPropagation();
- rowData.row.onClick();
+ onClick={e => {
+ e.stopPropagation()
+ rowData.row.onClick()
}}
>
Edit
@@ -151,37 +144,31 @@ const DesktopRegistryTable: React.FC = ({ data }) => {
))}
- );
-};
+ )
+}
-export const RegistryTable: React.FC<{ data: RowData[] }> = ({
- data: propsData,
-}) => {
- const theme = useTheme();
- const isSmall = useMediaQuery(theme.breakpoints.down("sm"));
- const [selectedItem, setSelectedItem] = useState();
- const [open, setOpen] = useState(false);
+export const RegistryTable: React.FC<{ data: RowData[] }> = ({ data: propsData }) => {
+ const theme = useTheme()
+ const isSmall = useMediaQuery(theme.breakpoints.down("sm"))
+ const [selectedItem, setSelectedItem] = useState()
+ const [open, setOpen] = useState(false)
const onClickItem = (row: RowData) => {
- setSelectedItem(row);
- setOpen(true);
- };
+ setSelectedItem(row)
+ setOpen(true)
+ }
const data = useMemo(() => {
- return propsData.map((rowData) => ({
+ return propsData.map(rowData => ({
row: rowData,
- onClickItem: onClickItem,
- }));
- }, [propsData]);
+ onClickItem: onClickItem
+ }))
+ }, [propsData])
return (
<>
- {isSmall ? (
-
- ) : (
-
- )}
+ {isSmall ? : }
= ({
handleClose={() => setOpen(false)}
/>
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/Registry/components/UpdatesTable.tsx b/src/modules/explorer/pages/Registry/components/UpdatesTable.tsx
index 5930f281..32d2cfc1 100644
--- a/src/modules/explorer/pages/Registry/components/UpdatesTable.tsx
+++ b/src/modules/explorer/pages/Registry/components/UpdatesTable.tsx
@@ -1,4 +1,4 @@
-import React from "react";
+import React from "react"
import {
Grid,
styled,
@@ -9,53 +9,46 @@ import {
TableRow,
Typography,
useMediaQuery,
- useTheme,
-} from "@material-ui/core";
-import dayjs from "dayjs";
-import { OverflowCell } from "./OverflowCell";
-import { useAgoraTopic } from "services/agora/hooks/useTopic";
-import { toShortAddress } from "services/contracts/utils";
-import { ContentContainer } from "modules/explorer/components/ContentContainer";
+ useTheme
+} from "@material-ui/core"
+import dayjs from "dayjs"
+import { OverflowCell } from "./OverflowCell"
+import { useAgoraTopic } from "services/agora/hooks/useTopic"
+import { toShortAddress } from "services/contracts/utils"
+import { ContentContainer } from "modules/explorer/components/ContentContainer"
-const localizedFormat = require("dayjs/plugin/localizedFormat");
-dayjs.extend(localizedFormat);
+const localizedFormat = require("dayjs/plugin/localizedFormat")
+dayjs.extend(localizedFormat)
-const titles = ["Update History", "Proposal Title", "Last Updated", "Proposal"];
+const titles = ["Update History", "Proposal Title", "Last Updated", "Proposal"]
interface RowData {
- key: string;
- lastUpdated: string;
- proposalId: string;
- agoraPostId: number;
+ key: string
+ lastUpdated: string
+ proposalId: string
+ agoraPostId: number
}
const MobileTableHeader = styled(Grid)({
width: "100%",
padding: 20,
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
const MobileTableRow = styled(Grid)({
padding: "30px",
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
-const ProposalTitle: React.FC<{ agoraPostId: number; proposalId: string }> = ({
- agoraPostId,
- proposalId,
-}) => {
- const { data: agoraPost } = useAgoraTopic(agoraPostId);
+const ProposalTitle: React.FC<{ agoraPostId: number; proposalId: string }> = ({ agoraPostId, proposalId }) => {
+ const { data: agoraPost } = useAgoraTopic(agoraPostId)
- return (
- <>
- {agoraPost ? agoraPost.title : `Proposal ${toShortAddress(proposalId)}`}
- >
- );
-};
+ return <>{agoraPost ? agoraPost.title : `Proposal ${toShortAddress(proposalId)}`}>
+}
const TableContainer = styled(ContentContainer)({
- width: "100%",
-});
+ width: "100%"
+})
const MobileUpdatesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
return (
@@ -87,10 +80,7 @@ const MobileUpdatesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
Proposal Title
-
+
@@ -112,8 +102,8 @@ const MobileUpdatesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
))}
- );
-};
+ )
+}
const DesktopUpdatesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
return (
@@ -131,10 +121,7 @@ const DesktopUpdatesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
{row.key.toUpperCase()}
-
+
{dayjs(row.lastUpdated).format("L")}
{row.proposalId}
@@ -143,20 +130,16 @@ const DesktopUpdatesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
>
- );
-};
+ )
+}
export const UpdatesTable: React.FC<{ data: RowData[] }> = ({ data }) => {
- const theme = useTheme();
- const isSmall = useMediaQuery(theme.breakpoints.down("sm"));
+ const theme = useTheme()
+ const isSmall = useMediaQuery(theme.breakpoints.down("sm"))
return (
- {isSmall ? (
-
- ) : (
-
- )}
+ {isSmall ? : }
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/Registry/index.tsx b/src/modules/explorer/pages/Registry/index.tsx
index 2712817c..c1f24ee7 100644
--- a/src/modules/explorer/pages/Registry/index.tsx
+++ b/src/modules/explorer/pages/Registry/index.tsx
@@ -1,97 +1,87 @@
-import {Button, Grid, Tooltip, useMediaQuery, useTheme} from "@material-ui/core";
-import { CopyAddress } from "modules/common/CopyAddress";
-import {
- ProposalFormContainer,
- ProposalFormDefaultValues,
-} from "modules/explorer/components/ProposalForm";
+import { Button, Grid, Tooltip, useMediaQuery, useTheme } from "@material-ui/core"
+import { CopyAddress } from "modules/common/CopyAddress"
+import { ProposalFormContainer, ProposalFormDefaultValues } from "modules/explorer/components/ProposalForm"
-import React, { useMemo, useState } from "react";
-import { RegistryDAO } from "services/contracts/baseDAO";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useProposals } from "services/indexer/dao/hooks/useProposals";
-import { RegistryProposal } from "services/indexer/dao/mappers/proposal/types";
-import { Hero } from "../../components/Hero";
-import { HeroTitle } from "../../components/HeroTitle";
-import { useDAOID } from "../DAO/router";
-import { RegistryTable } from "./components/RegistryTable";
-import { UpdatesTable } from "./components/UpdatesTable";
-import {useIsProposalButtonDisabled} from "../../../../services/contracts/baseDAO/hooks/useCycleInfo";
-import {InfoIcon} from "../../components/styled/InfoIcon";
-import { MainButton } from '../../../common/MainButton';
+import React, { useMemo, useState } from "react"
+import { RegistryDAO } from "services/contracts/baseDAO"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useProposals } from "services/indexer/dao/hooks/useProposals"
+import { RegistryProposal } from "services/indexer/dao/mappers/proposal/types"
+import { Hero } from "../../components/Hero"
+import { HeroTitle } from "../../components/HeroTitle"
+import { useDAOID } from "../DAO/router"
+import { RegistryTable } from "./components/RegistryTable"
+import { UpdatesTable } from "./components/UpdatesTable"
+import { useIsProposalButtonDisabled } from "../../../../services/contracts/baseDAO/hooks/useCycleInfo"
+import { InfoIcon } from "../../components/styled/InfoIcon"
+import { MainButton } from "../../../common/MainButton"
export const Registry: React.FC = () => {
- const theme = useTheme();
- const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"));
- const daoId = useDAOID();
- const { data: dao } = useDAO(daoId);
- const [updateRegistryOpen, setUpdateRegistryOpen] = useState(false);
- const { data: proposalsData } = useProposals(daoId);
- const [defaultData, setDefaultData] = useState();
- const shouldDisable = useIsProposalButtonDisabled(daoId);
+ const theme = useTheme()
+ const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"))
+ const daoId = useDAOID()
+ const { data: dao } = useDAO(daoId)
+ const [updateRegistryOpen, setUpdateRegistryOpen] = useState(false)
+ const { data: proposalsData } = useProposals(daoId)
+ const [defaultData, setDefaultData] = useState()
+ const shouldDisable = useIsProposalButtonDisabled(daoId)
const onCloseRegistryUpdate = () => {
- setUpdateRegistryOpen(false);
- setDefaultData(undefined);
- };
+ setUpdateRegistryOpen(false)
+ setDefaultData(undefined)
+ }
const proposals = useMemo(() => {
if (!proposalsData || !dao) {
- return [];
+ return []
}
- const registryDAO = dao as RegistryDAO;
- const registryProposalsData = proposalsData as RegistryProposal[];
+ const registryDAO = dao as RegistryDAO
+ const registryProposalsData = proposalsData as RegistryProposal[]
- const registryAffectedKeysProposalIds =
- registryDAO.decoded.decodedRegistryAffected.map((r) => r.proposalId);
+ const registryAffectedKeysProposalIds = registryDAO.decoded.decodedRegistryAffected.map(r => r.proposalId)
return registryProposalsData
- .filter((proposal) =>
- registryAffectedKeysProposalIds.includes(proposal.id)
- )
- .sort(
- (a, b) =>
- new Date(a.startDate).getTime() - new Date(b.startDate).getTime()
- )
- .map((proposal) => ({
+ .filter(proposal => registryAffectedKeysProposalIds.includes(proposal.id))
+ .sort((a, b) => new Date(a.startDate).getTime() - new Date(b.startDate).getTime())
+ .map(proposal => ({
...proposal,
description: "Proposal description",
address: proposal.id,
lastUpdated: proposal.startDate,
list: proposal.metadata.list,
proposalId: proposal.id,
- agoraPostId: Number(proposal.metadata.agoraPostId),
+ agoraPostId: Number(proposal.metadata.agoraPostId)
}))
- .flatMap((proposal) =>
+ .flatMap(proposal =>
proposal.list.map(({ key }) => ({
...proposal,
- key,
+ key
}))
- );
- }, [dao, proposalsData]);
+ )
+ }, [dao, proposalsData])
const onClickItem = (item: { key: string; value: string }) => {
setDefaultData({
registryUpdateForm: {
isBatch: false,
- list: [item],
- },
- });
- setUpdateRegistryOpen(true);
- };
+ list: [item]
+ }
+ })
+ setUpdateRegistryOpen(true)
+ }
const registryList = useMemo(() => {
if (!dao || !proposals) {
- return [];
+ return []
}
- return (dao as RegistryDAO).decoded.decodedRegistry.map((d) => ({
+ return (dao as RegistryDAO).decoded.decodedRegistry.map(d => ({
...d,
- lastUpdated: proposals.find((proposal) => proposal.key === d.key)
- ?.startDate,
+ lastUpdated: proposals.find(proposal => proposal.key === d.key)?.startDate,
onClick: () => onClickItem(d)
- }));
- }, [dao, proposals]);
+ }))
+ }, [dao, proposals])
return (
<>
@@ -104,7 +94,7 @@ export const Registry: React.FC = () => {
address={dao.data.address}
justifyContent={isMobileSmall ? "center" : "flex-start"}
typographyProps={{
- variant: "subtitle2",
+ variant: "subtitle2"
}}
/>
)}
@@ -119,10 +109,7 @@ export const Registry: React.FC = () => {
New Item
{shouldDisable && (
-
+
)}
@@ -142,5 +129,5 @@ export const Registry: React.FC = () => {
defaultValues={defaultData}
/>
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/Treasury/components/BalancesTable.tsx b/src/modules/explorer/pages/Treasury/components/BalancesTable.tsx
index efa59cdb..0d97e224 100644
--- a/src/modules/explorer/pages/Treasury/components/BalancesTable.tsx
+++ b/src/modules/explorer/pages/Treasury/components/BalancesTable.tsx
@@ -1,4 +1,4 @@
-import React, {useMemo, useState} from "react";
+import React, { useMemo, useState } from "react"
import {
Button,
Grid,
@@ -10,94 +10,90 @@ import {
TableRow,
Typography,
useMediaQuery,
- useTheme,
-} from "@material-ui/core";
-import hexToRgba from "hex-to-rgba";
-import {
- ProposalFormContainer,
- ProposalFormDefaultValues,
-} from "modules/explorer/components/ProposalForm";
-import {DAOHolding} from "services/bakingBad/tokenBalances";
-import {useDAOHoldings} from "services/contracts/baseDAO/hooks/useDAOHoldings";
-import {useTezosBalance} from "services/contracts/baseDAO/hooks/useTezosBalance";
-import {useDAOID} from "../../DAO/router";
-import BigNumber from "bignumber.js";
-import {ContentContainer} from "modules/explorer/components/ContentContainer";
-import {useIsProposalButtonDisabled} from "../../../../../services/contracts/baseDAO/hooks/useCycleInfo";
-import { SmallButton } from '../../../../common/SmallButton';
-
+ useTheme
+} from "@material-ui/core"
+import hexToRgba from "hex-to-rgba"
+import { ProposalFormContainer, ProposalFormDefaultValues } from "modules/explorer/components/ProposalForm"
+import { DAOHolding } from "services/bakingBad/tokenBalances"
+import { useDAOHoldings } from "services/contracts/baseDAO/hooks/useDAOHoldings"
+import { useTezosBalance } from "services/contracts/baseDAO/hooks/useTezosBalance"
+import { useDAOID } from "../../DAO/router"
+import BigNumber from "bignumber.js"
+import { ContentContainer } from "modules/explorer/components/ContentContainer"
+import { useIsProposalButtonDisabled } from "../../../../../services/contracts/baseDAO/hooks/useCycleInfo"
+import { SmallButton } from "../../../../common/SmallButton"
-const TokenSymbol = styled(Typography)(({theme}) => ({
+const TokenSymbol = styled(Typography)(({ theme }) => ({
background: hexToRgba(theme.palette.secondary.main, 0.11),
borderRadius: 4,
color: theme.palette.secondary.main,
padding: "1px 8px",
boxSizing: "border-box",
- width: "min-content",
-}));
+ width: "min-content"
+}))
const MobileTableHeader = styled(Grid)({
width: "100%",
padding: 20,
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
const MobileTableRow = styled(Grid)({
padding: "30px",
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
interface RowData {
- symbol: string;
- address: string;
- amount: string;
+ symbol: string
+ address: string
+ amount: string
}
const TableContainer = styled(ContentContainer)({
- width: "100%",
-});
+ width: "100%"
+})
const createData = (daoHolding: DAOHolding): RowData => {
return {
symbol: daoHolding.token.symbol,
address: daoHolding.token.contract,
- amount: daoHolding.balance.dp(10).toString(),
- };
-};
+ amount: daoHolding.balance.dp(10).toString()
+ }
+}
-const titles = ["Token Balances", "Address", "Balance"] as const;
+const titles = ["Token Balances", "Address", "Balance"] as const
const titleDataMatcher = (title: typeof titles[number], rowData: RowData) => {
switch (title) {
case "Token Balances":
- return rowData.symbol;
+ return rowData.symbol
case "Address":
- return rowData.address;
+ return rowData.address
case "Balance":
- return rowData.amount;
+ return rowData.amount
}
-};
+}
interface TableProps {
- rows: RowData[];
- tezosBalance: BigNumber;
- openXTZTransferModal: () => void;
- openTokenTransferModal: (tokenAddress: string) => void;
- shouldDisable: boolean;
+ rows: RowData[]
+ tezosBalance: BigNumber
+ openXTZTransferModal: () => void
+ openTokenTransferModal: (tokenAddress: string) => void
+ shouldDisable: boolean
}
const MobileBalancesTable: React.FC = ({
- rows,
- tezosBalance,
- openTokenTransferModal,
- openXTZTransferModal,
- shouldDisable
- }) => {
+ rows,
+ tezosBalance,
+ openTokenTransferModal,
+ openXTZTransferModal,
+ shouldDisable
+}) => {
const XTZRowData: RowData = {
symbol: "XTZ",
address: "-",
- amount: tezosBalance.toString(),
- };
+ amount: tezosBalance.toString()
+ }
return (
@@ -106,13 +102,7 @@ const MobileBalancesTable: React.FC = ({
Token Balances
-
+
{titles.map((title, j) => (
@@ -142,7 +132,7 @@ const MobileBalancesTable: React.FC = ({
container
direction="column"
alignItems="center"
- style={{gap: 19}}
+ style={{ gap: 19 }}
>
{titles.map((title, j) => (
@@ -168,16 +158,16 @@ const MobileBalancesTable: React.FC = ({
))}
- );
-};
+ )
+}
const DesktopBalancesTable: React.FC = ({
- rows,
- tezosBalance,
- openTokenTransferModal,
- openXTZTransferModal,
- shouldDisable
- }) => {
+ rows,
+ tezosBalance,
+ openTokenTransferModal,
+ openXTZTransferModal,
+ shouldDisable
+}) => {
return (
@@ -228,24 +218,23 @@ const DesktopBalancesTable: React.FC = ({
))}
- );
-};
+ )
+}
export const BalancesTable: React.FC = () => {
- const theme = useTheme();
- const isSmall = useMediaQuery(theme.breakpoints.down("sm"));
- const daoId = useDAOID();
- const shouldDisable = useIsProposalButtonDisabled(daoId);
- const {tokenHoldings} = useDAOHoldings(daoId);
- const {data: tezosBalance} = useTezosBalance(daoId);
- const [openTransfer, setOpenTransfer] = useState(false);
- const [defaultValues, setDefaultValues] =
- useState();
+ const theme = useTheme()
+ const isSmall = useMediaQuery(theme.breakpoints.down("sm"))
+ const daoId = useDAOID()
+ const shouldDisable = useIsProposalButtonDisabled(daoId)
+ const { tokenHoldings } = useDAOHoldings(daoId)
+ const { data: tezosBalance } = useTezosBalance(daoId)
+ const [openTransfer, setOpenTransfer] = useState(false)
+ const [defaultValues, setDefaultValues] = useState()
const onCloseTransfer = () => {
- setOpenTransfer(false);
- setDefaultValues(undefined);
- };
+ setOpenTransfer(false)
+ setDefaultValues(undefined)
+ }
const onOpenXTZTransferModal = () => {
setDefaultValues({
@@ -256,21 +245,20 @@ export const BalancesTable: React.FC = () => {
recipient: "",
amount: 1,
asset: {
- symbol: "XTZ",
- },
- },
- ],
- },
- });
+ symbol: "XTZ"
+ }
+ }
+ ]
+ }
+ })
- setOpenTransfer(true);
- };
+ setOpenTransfer(true)
+ }
const onOpenTokenTransferModal = (tokenAddress: string) => {
const selectedToken = tokenHoldings.find(
- (holding) =>
- holding.token.contract.toLowerCase() === tokenAddress.toLowerCase()
- ) as DAOHolding;
+ holding => holding.token.contract.toLowerCase() === tokenAddress.toLowerCase()
+ ) as DAOHolding
setDefaultValues({
transferForm: {
@@ -278,22 +266,22 @@ export const BalancesTable: React.FC = () => {
{
recipient: "",
amount: 1,
- asset: selectedToken.token,
- },
- ],
- },
- });
+ asset: selectedToken.token
+ }
+ ]
+ }
+ })
- setOpenTransfer(true);
- };
+ setOpenTransfer(true)
+ }
const rows = useMemo(() => {
if (!tokenHoldings) {
- return [];
+ return []
}
- return tokenHoldings.map(createData);
- }, [tokenHoldings]);
+ return tokenHoldings.map(createData)
+ }, [tokenHoldings])
return (
<>
@@ -324,5 +312,5 @@ export const BalancesTable: React.FC = () => {
defaultTab={0}
/>
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/Treasury/components/TransfersTable.tsx b/src/modules/explorer/pages/Treasury/components/TransfersTable.tsx
index ec3f1fa8..9a001a0a 100644
--- a/src/modules/explorer/pages/Treasury/components/TransfersTable.tsx
+++ b/src/modules/explorer/pages/Treasury/components/TransfersTable.tsx
@@ -1,5 +1,5 @@
-import dayjs from "dayjs";
-import React, { useMemo } from "react";
+import dayjs from "dayjs"
+import React, { useMemo } from "react"
import {
Grid,
Link,
@@ -11,26 +11,26 @@ import {
TableRow,
Typography,
useMediaQuery,
- useTheme,
-} from "@material-ui/core";
-import hexToRgba from "hex-to-rgba";
-import { TransferWithBN } from "services/contracts/baseDAO/hooks/useTransfers";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { Network } from "services/beacon";
-import { ContentContainer } from "modules/explorer/components/ContentContainer";
-import { networkNameMap } from "services/bakingBad";
-
-const localizedFormat = require("dayjs/plugin/localizedFormat");
-dayjs.extend(localizedFormat);
-
-const TokenSymbol = styled(Typography)(({theme}) => ({
+ useTheme
+} from "@material-ui/core"
+import hexToRgba from "hex-to-rgba"
+import { TransferWithBN } from "services/contracts/baseDAO/hooks/useTransfers"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { Network } from "services/beacon"
+import { ContentContainer } from "modules/explorer/components/ContentContainer"
+import { networkNameMap } from "services/bakingBad"
+
+const localizedFormat = require("dayjs/plugin/localizedFormat")
+dayjs.extend(localizedFormat)
+
+const TokenSymbol = styled(Typography)(({ theme }) => ({
background: hexToRgba(theme.palette.secondary.main, 0.11),
borderRadius: 4,
color: theme.palette.secondary.main,
padding: "1px 8px",
boxSizing: "border-box",
- width: "min-content",
-}));
+ width: "min-content"
+}))
const createData = (transfer: TransferWithBN, isInbound: boolean) => {
return {
@@ -38,60 +38,55 @@ const createData = (transfer: TransferWithBN, isInbound: boolean) => {
date: dayjs(transfer.date).format("ll"),
amount: transfer.amount.dp(10).toString(),
address: isInbound ? transfer.sender : transfer.recipient,
- hash: transfer.hash,
- };
-};
+ hash: transfer.hash
+ }
+}
const TableContainer = styled(ContentContainer)({
- width: "100%",
-});
+ width: "100%"
+})
interface RowData {
- token: string;
- date: string;
- amount: string;
- address: string;
- hash: string;
+ token: string
+ date: string
+ amount: string
+ address: string
+ hash: string
}
-const outboundTitles = ["Outbound Transfers", "Date", "Recipient", "Amount"];
-const inboundTitles = ["Inbound Transfers", "Date", "Sender", "Amount"];
-
-const titleDataMatcher = (title: typeof outboundTitles[number]
- | typeof inboundTitles[number],
- rowData: RowData
- ) => {
- switch (title) {
- case "Outbound Transfers":
- return rowData.token;
- case "Inbound Transfers":
- return rowData.token;
- case "Date":
- return rowData.date;
- case "Amount":
- return rowData.amount;
- case "Recipient":
- return rowData.address
- case "Sender":
- return rowData.address
- }
+const outboundTitles = ["Outbound Transfers", "Date", "Recipient", "Amount"]
+const inboundTitles = ["Inbound Transfers", "Date", "Sender", "Amount"]
+
+const titleDataMatcher = (title: typeof outboundTitles[number] | typeof inboundTitles[number], rowData: RowData) => {
+ switch (title) {
+ case "Outbound Transfers":
+ return rowData.token
+ case "Inbound Transfers":
+ return rowData.token
+ case "Date":
+ return rowData.date
+ case "Amount":
+ return rowData.amount
+ case "Recipient":
+ return rowData.address
+ case "Sender":
+ return rowData.address
}
-;
-
+}
const MobileTableHeader = styled(Grid)({
width: "100%",
padding: 20,
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
const MobileTableRow = styled(Grid)({
padding: "30px",
- borderBottom: "0.3px solid #3D3D3D",
-});
+ borderBottom: "0.3px solid #3D3D3D"
+})
//TODO: Should mobile table items also redirect to block explorer on click?
-const MobileTransfersTable: React.FC<{ data: RowData[]; isInbound: boolean }> = ({isInbound, data}) => {
+const MobileTransfersTable: React.FC<{ data: RowData[]; isInbound: boolean }> = ({ isInbound, data }) => {
return (
@@ -106,7 +101,7 @@ const MobileTransfersTable: React.FC<{ data: RowData[]; isInbound: boolean }> =
container
direction="column"
alignItems="center"
- style={{gap: 19}}
+ style={{ gap: 19 }}
>
{(isInbound ? inboundTitles : outboundTitles).map((title, j) => (
@@ -121,69 +116,70 @@ const MobileTransfersTable: React.FC<{ data: RowData[]; isInbound: boolean }> =
))}
- );
-};
-
-const DesktopTransfersTable: React.FC<{ isInbound: boolean; data: RowData[]; network: Network }> =
- ({isInbound, data: rows, network}) => {
- return (
- <>
-
-
-
- {(isInbound ? inboundTitles : outboundTitles).map((title, i) => (
- {title}
- ))}
-
-
-
- {rows.map((row, i) => (
-
-
- {row.token}
-
- {row.date}
- {row.address}
- {row.amount}
-
+ )
+}
+
+const DesktopTransfersTable: React.FC<{ isInbound: boolean; data: RowData[]; network: Network }> = ({
+ isInbound,
+ data: rows,
+ network
+}) => {
+ return (
+ <>
+
+
+
+ {(isInbound ? inboundTitles : outboundTitles).map((title, i) => (
+ {title}
))}
-
-
- >
- );
- };
-
-export const TransfersTable: React.FC<{ transfers: TransferWithBN[], isInbound: boolean }> = ({
- isInbound,
- transfers
- }) => {
- const theme = useTheme();
- const isSmall = useMediaQuery(theme.breakpoints.down("sm"));
+
+
+
+ {rows.map((row, i) => (
+
+
+ {row.token}
+
+ {row.date}
+ {row.address}
+ {row.amount}
+
+ ))}
+
+
+ >
+ )
+}
+
+export const TransfersTable: React.FC<{ transfers: TransferWithBN[]; isInbound: boolean }> = ({
+ isInbound,
+ transfers
+}) => {
+ const theme = useTheme()
+ const isSmall = useMediaQuery(theme.breakpoints.down("sm"))
const rows = useMemo(() => {
if (!transfers) {
- return [];
+ return []
}
- return transfers.map((t) => createData(t, isInbound));
- }, [isInbound, transfers]);
+ return transfers.map(t => createData(t, isInbound))
+ }, [isInbound, transfers])
- const {network} = useTezos();
+ const { network } = useTezos()
return (
{isSmall ? (
-
+
) : (
-
+
)}
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/Treasury/index.tsx b/src/modules/explorer/pages/Treasury/index.tsx
index aafc012e..2e371f41 100644
--- a/src/modules/explorer/pages/Treasury/index.tsx
+++ b/src/modules/explorer/pages/Treasury/index.tsx
@@ -1,28 +1,22 @@
-import {
- Button,
- Grid, Tooltip,
- useMediaQuery,
- useTheme,
-} from "@material-ui/core";
-import {CopyAddress} from "modules/common/CopyAddress";
-import {ProposalFormContainer} from "modules/explorer/components/ProposalForm";
-
-import React, {useMemo, useState} from "react";
-import {useDAO} from "services/indexer/dao/hooks/useDAO";
-import {Hero} from "../../components/Hero";
-import {HeroTitle} from "../../components/HeroTitle";
-import {useDAOID} from "../DAO/router";
-import {BalancesTable} from "./components/BalancesTable";
-import {TransfersTable} from "./components/TransfersTable";
-import {useTransfers} from "../../../../services/contracts/baseDAO/hooks/useTransfers";
-import {InfoIcon} from "../../components/styled/InfoIcon";
-import {useIsProposalButtonDisabled} from "../../../../services/contracts/baseDAO/hooks/useCycleInfo";
-import { styled, Typography } from "@material-ui/core";
-import { SmallButton } from '../../../common/SmallButton';
-import { MainButton } from '../../../common/MainButton';
-import { DelegationChangeProposalForm } from "modules/explorer/components/DelegationChangeProposalForm";
-import { useDelegate } from "services/contracts/baseDAO/hooks/useDelegate";
+import { Button, Grid, Tooltip, useMediaQuery, useTheme } from "@material-ui/core"
+import { CopyAddress } from "modules/common/CopyAddress"
+import { ProposalFormContainer } from "modules/explorer/components/ProposalForm"
+import React, { useMemo, useState } from "react"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { Hero } from "../../components/Hero"
+import { HeroTitle } from "../../components/HeroTitle"
+import { useDAOID } from "../DAO/router"
+import { BalancesTable } from "./components/BalancesTable"
+import { TransfersTable } from "./components/TransfersTable"
+import { useTransfers } from "../../../../services/contracts/baseDAO/hooks/useTransfers"
+import { InfoIcon } from "../../components/styled/InfoIcon"
+import { useIsProposalButtonDisabled } from "../../../../services/contracts/baseDAO/hooks/useCycleInfo"
+import { styled, Typography } from "@material-ui/core"
+import { SmallButton } from "../../../common/SmallButton"
+import { MainButton } from "../../../common/MainButton"
+import { DelegationChangeProposalForm } from "modules/explorer/components/DelegationChangeProposalForm"
+import { useDelegate } from "services/contracts/baseDAO/hooks/useDelegate"
const DelegateTitle = styled(Typography)(({ theme }) => ({
fontSize: 18,
@@ -32,148 +26,131 @@ const DelegateTitle = styled(Typography)(({ theme }) => ({
}))
export const Treasury: React.FC = () => {
- const theme = useTheme();
- const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"));
- const daoId = useDAOID();
- const {data: dao} = useDAO(daoId);
- const [openTransfer, setOpenTransfer] = useState(false);
- const [openDelegationChange, setOpenDelegationChange] = useState(false);
+ const theme = useTheme()
+ const isMobileSmall = useMediaQuery(theme.breakpoints.down("sm"))
+ const daoId = useDAOID()
+ const { data: dao } = useDAO(daoId)
+ const [openTransfer, setOpenTransfer] = useState(false)
+ const [openDelegationChange, setOpenDelegationChange] = useState(false)
const onCloseTransfer = () => {
setOpenTransfer(false)
}
- const {data: transfers} = useTransfers(daoId);
- const {data: delegate} = useDelegate(daoId);
+ const { data: transfers } = useTransfers(daoId)
+ const { data: delegate } = useDelegate(daoId)
const inboundTransfers = useMemo(() => {
if (!transfers) {
- return [];
+ return []
}
- return transfers.filter(
- (t) => t.recipient.toLowerCase() === daoId.toLowerCase()
- );
- }, [transfers, daoId]);
+ return transfers.filter(t => t.recipient.toLowerCase() === daoId.toLowerCase())
+ }, [transfers, daoId])
const outboundTransfers = useMemo(() => {
if (!transfers) {
- return [];
+ return []
}
- return transfers.filter(
- (t) => t.recipient.toLowerCase() !== daoId.toLowerCase()
- );
- }, [transfers, daoId]);
+ return transfers.filter(t => t.recipient.toLowerCase() !== daoId.toLowerCase())
+ }, [transfers, daoId])
- const shouldDisable = useIsProposalButtonDisabled(daoId);
+ const shouldDisable = useIsProposalButtonDisabled(daoId)
return (
<>
-
+
-
-
- Treasury
- {dao && (
-
- )}
-
-
-
-
- setOpenTransfer(true)}
- disabled={shouldDisable}
- >
- New Transfer
-
- {shouldDisable && (
-
+
+ Treasury
+ {dao && (
+
+ )}
+
+
+
+
+ setOpenTransfer(true)}
+ disabled={shouldDisable}
>
-
-
- )}
+ New Transfer
+
+ {shouldDisable && (
+
+
+
+ )}
+
-
-
-
-
- Current Delegate
- {delegate ? (
-
- ): (
- dao &&
-
- )}
+
+
+
+ Current Delegate
+ {delegate ? (
+
+ ) : (
+ dao && (
+
+ )
+ )}
-
-
-
- setOpenDelegationChange(true)}
- disabled={shouldDisable}
- >
- Change Delegate
-
- {shouldDisable && (
-
+
+
+ setOpenDelegationChange(true)}
+ disabled={shouldDisable}
>
-
-
- )}
+ Change Delegate
+
+ {shouldDisable && (
+
+
+
+ )}
+
-
-
-
+
-
+
-
+
-
- setOpenDelegationChange(false)}
- />
+
+ setOpenDelegationChange(false)} />
>
- );
-};
+ )
+}
diff --git a/src/modules/explorer/pages/User/index.tsx b/src/modules/explorer/pages/User/index.tsx
index d85e64ea..c886c4b7 100644
--- a/src/modules/explorer/pages/User/index.tsx
+++ b/src/modules/explorer/pages/User/index.tsx
@@ -1,34 +1,26 @@
-import {
- Box,
- Grid,
- Theme,
- Typography,
-} from "@material-ui/core";
-import { styled } from "@material-ui/styles";
-import dayjs from "dayjs";
-import React, { useEffect, useMemo } from "react";
-import { useHistory } from "react-router";
-import { useAgoraTopic } from "services/agora/hooks/useTopic";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { toShortAddress } from "services/contracts/utils";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useProposals } from "services/indexer/dao/hooks/useProposals";
-import {
- Proposal,
- ProposalStatus,
-} from "services/indexer/dao/mappers/proposal/types";
-import { ProfileAvatar } from "../../components/styled/ProfileAvatar";
-import { UserProfileName } from "../../components/UserProfileName";
-import { useDAOID } from "modules/explorer/pages/DAO/router";
-import { FreezeDialog } from "../../components/FreezeDialog";
-import { UserBalances } from "../../components/UserBalances";
-import { StatusBadge } from "../../components/StatusBadge";
-import { ProposalsList } from "../../components/ProposalsList";
+import { Box, Grid, Theme, Typography } from "@material-ui/core"
+import { styled } from "@material-ui/styles"
+import dayjs from "dayjs"
+import React, { useEffect, useMemo } from "react"
+import { useHistory } from "react-router"
+import { useAgoraTopic } from "services/agora/hooks/useTopic"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { toShortAddress } from "services/contracts/utils"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useProposals } from "services/indexer/dao/hooks/useProposals"
+import { Proposal, ProposalStatus } from "services/indexer/dao/mappers/proposal/types"
+import { ProfileAvatar } from "../../components/styled/ProfileAvatar"
+import { UserProfileName } from "../../components/UserProfileName"
+import { useDAOID } from "modules/explorer/pages/DAO/router"
+import { FreezeDialog } from "../../components/FreezeDialog"
+import { UserBalances } from "../../components/UserBalances"
+import { StatusBadge } from "../../components/StatusBadge"
+import { ProposalsList } from "../../components/ProposalsList"
const ContentBlockItem = styled(Grid)({
padding: "35px 52px",
- borderTop: `0.3px solid #5E6969`,
-});
+ borderTop: `0.3px solid #5E6969`
+})
const BalancesHeader = styled(Grid)(({ theme }: { theme: Theme }) => ({
minHeight: "178px",
@@ -36,42 +28,40 @@ const BalancesHeader = styled(Grid)(({ theme }: { theme: Theme }) => ({
background: theme.palette.primary.main,
boxSizing: "border-box",
borderRadius: 8,
- boxShadow: "none",
-}));
+ boxShadow: "none"
+}))
const MainContainer = styled(Box)({
- width: "100%",
-});
+ width: "100%"
+})
const UsernameText = styled(Typography)({
fontSize: 28,
wordBreak: "break-all"
-});
+})
const ProposalTitle = styled(Typography)({
- fontWeight: "bold",
-});
+ fontWeight: "bold"
+})
const StatusText = styled(Typography)({
textTransform: "uppercase",
marginLeft: 10,
fontSize: 18,
- marginRight: 30,
-});
+ marginRight: 30
+})
const VotedText = styled(Typography)({
- fontSize: 18,
-});
+ fontSize: 18
+})
export const ProposalItem: React.FC<{
- proposal: Proposal;
- status: ProposalStatus;
+ proposal: Proposal
+ status: ProposalStatus
}> = ({ proposal, status, children }) => {
- const { data: agoraPost } = useAgoraTopic(
- Number(proposal.metadata.agoraPostId)
- );
+ const { data: agoraPost } = useAgoraTopic(Number(proposal.metadata.agoraPostId))
- const formattedDate = dayjs(proposal.startDate).format("LLL");
+ const formattedDate = dayjs(proposal.startDate).format("LLL")
return (
@@ -79,9 +69,7 @@ export const ProposalItem: React.FC<{
- {agoraPost
- ? agoraPost.title
- : `Proposal ${toShortAddress(proposal.id)}`}
+ {agoraPost ? agoraPost.title : `Proposal ${toShortAddress(proposal.id)}`}
@@ -100,47 +88,40 @@ export const ProposalItem: React.FC<{
{children}
- );
-};
+ )
+}
export const User: React.FC = () => {
- const { account } = useTezos();
- const daoId = useDAOID();
- const { cycleInfo } = useDAO(daoId);
- const { data: proposals } = useProposals(daoId);
- const history = useHistory();
+ const { account } = useTezos()
+ const daoId = useDAOID()
+ const { cycleInfo } = useDAO(daoId)
+ const { data: proposals } = useProposals(daoId)
+ const history = useHistory()
useEffect(() => {
if (!account) {
- history.push(`../${daoId}`);
+ history.push(`../${daoId}`)
}
- }, [account, daoId, history]);
+ }, [account, daoId, history])
const proposalsCreated = useMemo(() => {
if (!proposals) {
- return [];
+ return []
}
- return proposals.filter(
- (p) => p.proposer.toLowerCase() === account.toLowerCase()
- );
- }, [account, proposals]);
+ return proposals.filter(p => p.proposer.toLowerCase() === account.toLowerCase())
+ }, [account, proposals])
const proposalsVoted = useMemo(() => {
if (!proposals) {
- return [];
+ return []
}
- return proposals.filter((p) =>
- p.voters
- .map((voter) => voter.address.toLowerCase())
- .includes(account.toLowerCase())
- );
- }, [account, proposals]);
+ return proposals.filter(p => p.voters.map(voter => voter.address.toLowerCase()).includes(account.toLowerCase()))
+ }, [account, proposals])
const getVoteDecision = (proposal: Proposal) =>
- proposal.voters.find((voter) => voter.address.toLowerCase())
- ?.support as boolean;
+ proposal.voters.find(voter => voter.address.toLowerCase())?.support as boolean
return (
@@ -190,8 +171,8 @@ export const User: React.FC = () => {
title={"Voting History"}
currentLevel={cycleInfo.currentLevel}
proposals={proposalsVoted}
- rightItem={(proposal) => {
- const voteDecision = getVoteDecision(proposal);
+ rightItem={proposal => {
+ const voteDecision = getVoteDecision(proposal)
return (
@@ -203,12 +184,12 @@ export const User: React.FC = () => {
- );
+ )
}}
/>
)}
- );
-};
+ )
+}
diff --git a/src/modules/explorer/router.tsx b/src/modules/explorer/router.tsx
index 7c6ad946..596be76c 100644
--- a/src/modules/explorer/router.tsx
+++ b/src/modules/explorer/router.tsx
@@ -1,10 +1,10 @@
-import React from "react";
-import { Redirect, Route, Switch, useRouteMatch } from "react-router-dom";
-import { DAOList } from "modules/explorer/pages/DAOList";
-import { DAORouter } from "modules/explorer/pages/DAO/router";
+import React from "react"
+import { Redirect, Route, Switch, useRouteMatch } from "react-router-dom"
+import { DAOList } from "modules/explorer/pages/DAOList"
+import { DAORouter } from "modules/explorer/pages/DAO/router"
export const DAOExplorerRouter = (): JSX.Element => {
- const match = useRouteMatch();
+ const match = useRouteMatch()
return (
@@ -16,5 +16,5 @@ export const DAOExplorerRouter = (): JSX.Element => {
- );
-};
+ )
+}
diff --git a/src/modules/explorer/utils/FormatNumber.ts b/src/modules/explorer/utils/FormatNumber.ts
index 0c5377ec..c688907f 100644
--- a/src/modules/explorer/utils/FormatNumber.ts
+++ b/src/modules/explorer/utils/FormatNumber.ts
@@ -1,9 +1,14 @@
-import BigNumber from "bignumber.js";
+import BigNumber from "bignumber.js"
export const formatNumber = (number: BigNumber) => {
- if (number.isLessThan(1e3)) return number.dp(1).toString().replace(/[.,]0$/, "");
- if (number.isGreaterThanOrEqualTo(1e3) && number.isLessThan(1e6)) return +(number.dividedBy(1e3)).dp(1).toString() + "K";
- if (number.isGreaterThanOrEqualTo(1e6) && number.isLessThan(1e9)) return +(number.dividedBy(1e6)).dp(1).toString() + "M";
- if (number.isGreaterThanOrEqualTo(1e9) && number.isLessThan(1e12)) return +(number.dividedBy(1e9)).dp(1).toString() + "B";
- if (number.isGreaterThanOrEqualTo(1e12)) return +(number.dividedBy(1e12)).dp(1).toString() + "T";
-};
+ if (number.isLessThan(1e3))
+ return number
+ .dp(1)
+ .toString()
+ .replace(/[.,]0$/, "")
+ if (number.isGreaterThanOrEqualTo(1e3) && number.isLessThan(1e6)) return +number.dividedBy(1e3).dp(1).toString() + "K"
+ if (number.isGreaterThanOrEqualTo(1e6) && number.isLessThan(1e9)) return +number.dividedBy(1e6).dp(1).toString() + "M"
+ if (number.isGreaterThanOrEqualTo(1e9) && number.isLessThan(1e12))
+ return +number.dividedBy(1e9).dp(1).toString() + "B"
+ if (number.isGreaterThanOrEqualTo(1e12)) return +number.dividedBy(1e12).dp(1).toString() + "T"
+}
diff --git a/src/modules/explorer/utils/debounce.ts b/src/modules/explorer/utils/debounce.ts
index 31553049..0a7b2957 100644
--- a/src/modules/explorer/utils/debounce.ts
+++ b/src/modules/explorer/utils/debounce.ts
@@ -1,14 +1,11 @@
-export const debounce = any>(
- callback: T,
- waitFor: number
-) => {
- let timeout = 0;
+export const debounce = any>(callback: T, waitFor: number) => {
+ let timeout = 0
return (...args: Parameters): ReturnType => {
- let result: any;
- clearTimeout(timeout);
+ let result: any
+ clearTimeout(timeout)
timeout = setTimeout(() => {
- result = callback(...args);
- }, waitFor) as unknown as number;
- return result;
- };
-};
\ No newline at end of file
+ result = callback(...args)
+ }, waitFor) as unknown as number
+ return result
+ }
+}
diff --git a/src/modules/home/FAQ.tsx b/src/modules/home/FAQ.tsx
index 59279119..a9b42189 100644
--- a/src/modules/home/FAQ.tsx
+++ b/src/modules/home/FAQ.tsx
@@ -1,77 +1,75 @@
-import { Grid, Link, styled, Typography, useMediaQuery, useTheme } from "@material-ui/core";
-import React from "react";
-import { Header } from "./Header";
-import { ContentContainer } from "../explorer/components/ContentContainer";
-import { FAQItem } from "./FAQItem";
-import { useGenerateFAQ } from "./hooks/useGenerateFAQ";
+import { Grid, Link, styled, Typography, useMediaQuery, useTheme } from "@material-ui/core"
+import React from "react"
+import { Header } from "./Header"
+import { ContentContainer } from "../explorer/components/ContentContainer"
+import { FAQItem } from "./FAQItem"
+import { useGenerateFAQ } from "./hooks/useGenerateFAQ"
const PageContainer = styled("div")(({ theme }) => ({
background: theme.palette.primary.dark,
width: "1000px",
margin: "auto",
- ["@media (max-width:1167px)"]: {
- width: "86vw",
-
- },
-
-}));
+ ["@media (max-width:1167px)"]: {
+ width: "86vw"
+ }
+}))
const PageGrid = styled(Grid)({
- gap: 46,
-});
+ gap: 46
+})
const TextBlock = styled(ContentContainer)({
padding: "38px",
boxSizing: "border-box",
- fontWeight: 300,
-});
+ fontWeight: 300
+})
const TitleText = styled(Typography)(({ theme }) => ({
fontSize: 30,
fontWeight: 400,
- lineHeight: .8,
- marginBottom: 25,
-}));
+ lineHeight: 0.8,
+ marginBottom: 25
+}))
const BodyText = styled(Typography)(({ theme }) => ({
fontSize: 18,
- fontWeight: 300,
-
-}));
+ fontWeight: 300
+}))
const BodyTextGrid = styled(Grid)({
display: "grid",
- gap: 12,
-});
+ gap: 12
+})
export const FAQ: React.FC = () => {
- const theme = useTheme();
- const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"));
- const faqList = useGenerateFAQ();
+ const theme = useTheme()
+ const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"))
+ const faqList = useGenerateFAQ()
return (
- {!isExtraSmall && (
-
-
-
- )}
-
+ {!isExtraSmall && (
+
+
+
+ )}
+
Welcome to Homebase FAQ
-
- We strive to make Homebase super user-centered. Feel free to reach out to our team at any time on the{" "}
-
- Discord
- .
+
+ We strive to make Homebase super user-centered. Feel free to reach out to our team at any time on the{" "}
+
+ Discord
+
+ .
- Below are questions we’ve received and would like to share the answers to in a direct way for users.
-
+ Below are questions we’ve received and would like to share the answers to in a direct way for users.
+
@@ -80,5 +78,5 @@ export const FAQ: React.FC = () => {
))}
- );
-};
\ No newline at end of file
+ )
+}
diff --git a/src/modules/home/FAQItem.tsx b/src/modules/home/FAQItem.tsx
index 34eb07b3..f39ff4fb 100644
--- a/src/modules/home/FAQItem.tsx
+++ b/src/modules/home/FAQItem.tsx
@@ -1,47 +1,36 @@
-import React from "react";
-import {
- AccordionDetails,
- AccordionSummary,
- Grid,
- Typography,
-} from "@material-ui/core";
-import ExpandMoreIcon from "@material-ui/icons/ExpandMore";
-import { styled } from "@material-ui/core/styles";
-import { ContentContainer } from "../explorer/components/ContentContainer";
-import Accordion from "@material-ui/core/Accordion";
-import Markdown from "modules/common/Markdown";
+import React from "react"
+import { AccordionDetails, AccordionSummary, Grid, Typography } from "@material-ui/core"
+import ExpandMoreIcon from "@material-ui/icons/ExpandMore"
+import { styled } from "@material-ui/core/styles"
+import { ContentContainer } from "../explorer/components/ContentContainer"
+import Accordion from "@material-ui/core/Accordion"
+import Markdown from "modules/common/Markdown"
const TableContainer = styled(ContentContainer)({
- width: "100%",
-});
+ width: "100%"
+})
const AccordionHeader = styled(AccordionSummary)(({ theme }) => ({
minHeight: 40,
padding: "20px 38px",
background: theme.palette.primary.main,
- borderRadius: "8px",
-}));
+ borderRadius: "8px"
+}))
const AccordionContent = styled(AccordionDetails)(({ theme }) => ({
flexDirection: "column",
padding: "38px 38px",
background: theme.palette.primary.light,
- borderRadius: "0 0 8px 8px",
-}));
+ borderRadius: "0 0 8px 8px"
+}))
-export const FAQItem = ({
- question,
- answer,
-}: {
- question: string;
- answer: string;
-}) => {
+export const FAQItem = ({ question, answer }: { question: string; answer: string }) => {
return (
-
+
}
+ expandIcon={}
aria-controls="panel1a-content"
id="panel1a-header"
>
@@ -53,5 +42,5 @@ export const FAQItem = ({
- );
-};
\ No newline at end of file
+ )
+}
diff --git a/src/modules/home/Header.tsx b/src/modules/home/Header.tsx
index ed29f1a3..63e2d314 100644
--- a/src/modules/home/Header.tsx
+++ b/src/modules/home/Header.tsx
@@ -1,18 +1,9 @@
-import {
- AppBar,
- Box,
- Button,
- Grid,
- Link,
- Theme,
- Toolbar,
- Typography,
-} from "@material-ui/core";
-import { styled } from "@material-ui/styles";
-import HomeButton from "assets/logos/homebase_logo.svg";
-import hexToRgba from "hex-to-rgba";
-import React from "react";
-import { MainButton } from '../common/MainButton';
+import { AppBar, Box, Button, Grid, Link, Theme, Toolbar, Typography } from "@material-ui/core"
+import { styled } from "@material-ui/styles"
+import HomeButton from "assets/logos/homebase_logo.svg"
+import hexToRgba from "hex-to-rgba"
+import React from "react"
+import { MainButton } from "../common/MainButton"
const StyledAppBar = styled(AppBar)(({ theme }: { theme: Theme }) => ({
boxShadow: "none",
@@ -20,30 +11,30 @@ const StyledAppBar = styled(AppBar)(({ theme }: { theme: Theme }) => ({
position: "sticky",
["@media (max-height:750px)"]: {
- position: "static",
+ position: "static"
}
-}));
+}))
const LogoItem = styled("img")({
cursor: "pointer",
paddingTop: 8,
- height: "30px",
-});
+ height: "30px"
+})
const LogoText = styled(Typography)({
fontWeight: "bold",
fontSize: "24px",
cursor: "pointer",
fontFamily: "Roboto",
- letterSpacing: "initial",
-});
+ letterSpacing: "initial"
+})
const StyledToolbar = styled(Toolbar)({
- width: "100%",
+ width: "100%",
padding: 0,
boxSizing: "border-box",
justifyContent: "space-between",
- flexWrap: "wrap",
-});
+ flexWrap: "wrap"
+})
const Head = styled(Grid)(({ theme }) => ({
width: "1000px",
@@ -52,26 +43,20 @@ const Head = styled(Grid)(({ theme }) => ({
padding: "28px 0",
flexDirection: "row",
- ["@media (max-width:1167px)"]: {
- width: "86vw",
+ ["@media (max-width:1167px)"]: {
+ width: "86vw"
},
["@media (max-width:645px)"]: {
- flexDirection: "column",
-
+ flexDirection: "column"
}
-}));
+}))
export const Header: React.FC = () => {
return (
-
+
@@ -88,11 +73,13 @@ export const Header: React.FC = () => {
- Enter App
+
+ Enter App
+
- );
-};
+ )
+}
diff --git a/src/modules/home/Landing.tsx b/src/modules/home/Landing.tsx
index 469fb22f..f0df75a1 100644
--- a/src/modules/home/Landing.tsx
+++ b/src/modules/home/Landing.tsx
@@ -1,27 +1,27 @@
-import {Box, Grid, Link, styled, SvgIcon, Theme, Typography, useMediaQuery, useTheme} from '@material-ui/core';
-import React from 'react';
-import {Header} from './LandingHeader';
-import HomebaseLogo from 'assets/logos/homebase_logo.svg';
-import Vector1 from 'assets/vectors/Vector1.svg';
-import Vector2 from 'assets/vectors/Vector2.svg';
-import GitHubIcon from '@material-ui/icons/GitHub';
-import {ReactComponent as DiscordIcon} from 'assets/logos/discord.svg';
-import {MainButton} from '../common/MainButton';
+import { Box, Grid, Link, styled, SvgIcon, Theme, Typography, useMediaQuery, useTheme } from "@material-ui/core"
+import React from "react"
+import { Header } from "./LandingHeader"
+import HomebaseLogo from "assets/logos/homebase_logo.svg"
+import Vector1 from "assets/vectors/Vector1.svg"
+import Vector2 from "assets/vectors/Vector2.svg"
+import GitHubIcon from "@material-ui/icons/GitHub"
+import { ReactComponent as DiscordIcon } from "assets/logos/discord.svg"
+import { MainButton } from "../common/MainButton"
const StyledToolbar = styled(Grid)({
padding: "22px 37px",
boxSizing: "border-box",
- height: "86px",
-});
+ height: "86px"
+})
const IconContainer = styled("div")({
- height: "27px",
- width: "33px",
+ "height": "27px",
+ "width": "33px",
"& > svg": {
- width: "100%",
- },
-});
+ width: "100%"
+ }
+})
// const AnimatedLogoContainer = withStyles({
// "@global @keyframes float": {
@@ -41,15 +41,15 @@ const Background = styled(Grid)({
backgroundImage: `url(${Vector1}), url(${Vector2})`,
backgroundPosition: "top right, bottom right",
backgroundRepeat: "no-repeat",
- height: "100vh",
-});
+ height: "100vh"
+})
const MainContainer = styled(Grid)({
maxWidth: 970,
padding: 30,
boxSizing: "border-box",
- width: "100%",
-});
+ width: "100%"
+})
const LogoContainer = styled(Box)(({ theme }) => ({
width: 408,
@@ -57,39 +57,34 @@ const LogoContainer = styled(Box)(({ theme }) => ({
[theme.breakpoints.down("xs")]: {
width: 290,
- height: 265,
- },
+ height: 265
+ }
// animation: `float 3s infinite ease-in-out`,
-}));
+}))
const BigLogo = styled("img")({
width: "100%",
- height: "100%",
-});
+ height: "100%"
+})
const TitleText = styled(Typography)(({ theme }: { theme: Theme }) => ({
color: theme.palette.text.primary,
fontSize: 40,
- fontWeight: "bold",
-}));
+ fontWeight: "bold"
+}))
const SubtitleText = styled(Typography)(({ theme }: { theme: Theme }) => ({
color: theme.palette.text.primary,
- fontWeight: 300,
-}));
+ fontWeight: 300
+}))
export const Landing: React.FC = () => {
- const theme = useTheme();
- const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"));
+ const theme = useTheme()
+ const isExtraSmall = useMediaQuery(theme.breakpoints.down("xs"))
return (
-
+
{!isExtraSmall && (
@@ -106,12 +101,7 @@ export const Landing: React.FC = () => {
style={isExtraSmall ? { gap: 50 } : {}}
>
-
+
{!isExtraSmall && (
Tezos Homebase
@@ -120,10 +110,9 @@ export const Landing: React.FC = () => {
- Homebase is a web application that enables users to
- create and manage/use DAOs on the Tezos blockchain. This
- application aims to help empower community members and
- developers to launch and participate in Tezos-based DAOs
+ Homebase is a web application that enables users to create and manage/use DAOs on the Tezos
+ blockchain. This application aims to help empower community members and developers to launch and
+ participate in Tezos-based DAOs
@@ -152,13 +141,7 @@ export const Landing: React.FC = () => {
-
+
{isExtraSmall && (
Tezos Homebase
@@ -187,10 +170,7 @@ export const Landing: React.FC = () => {
style={{ gap: 25 }}
>
-
+
@@ -208,5 +188,5 @@ export const Landing: React.FC = () => {
- );
-};
+ )
+}
diff --git a/src/modules/home/LandingHeader.tsx b/src/modules/home/LandingHeader.tsx
index 95f482ec..36f62b36 100644
--- a/src/modules/home/LandingHeader.tsx
+++ b/src/modules/home/LandingHeader.tsx
@@ -1,78 +1,64 @@
-import {
- AppBar,
- Box,
- Button,
- Grid,
- Link,
- Theme,
- Toolbar,
- Typography,
- } from "@material-ui/core";
- import { styled } from "@material-ui/styles";
- import HomeButton from "assets/logos/homebase_logo.svg";
- import hexToRgba from "hex-to-rgba";
- import { MainButton } from "../common/MainButton";
- import React from "react";
-
- const StyledAppBar = styled(AppBar)({
- boxShadow: "none",
- });
-
- const LogoItem = styled("img")({
- cursor: "pointer",
- paddingTop: 8,
- height: "30px",
- });
-
- const LogoText = styled(Typography)({
- fontWeight: "bold",
- fontSize: "24px",
- cursor: "pointer",
- fontFamily: "Roboto",
- letterSpacing: "initial",
- });
-
- const StyledToolbar = styled(Toolbar)({
- display: "flex",
- padding: "22px 37px",
- boxSizing: "border-box",
- justifyContent: "space-between",
- flexWrap: "wrap",
- });
-
- export const Header: React.FC = () => {
- return (
-
-
-
-
-
-
-
-
-
-
-
- Homebase
-
-
+import { AppBar, Box, Button, Grid, Link, Theme, Toolbar, Typography } from "@material-ui/core"
+import { styled } from "@material-ui/styles"
+import HomeButton from "assets/logos/homebase_logo.svg"
+import hexToRgba from "hex-to-rgba"
+import { MainButton } from "../common/MainButton"
+import React from "react"
+
+const StyledAppBar = styled(AppBar)({
+ boxShadow: "none"
+})
+
+const LogoItem = styled("img")({
+ cursor: "pointer",
+ paddingTop: 8,
+ height: "30px"
+})
+
+const LogoText = styled(Typography)({
+ fontWeight: "bold",
+ fontSize: "24px",
+ cursor: "pointer",
+ fontFamily: "Roboto",
+ letterSpacing: "initial"
+})
+
+const StyledToolbar = styled(Toolbar)({
+ display: "flex",
+ padding: "22px 37px",
+ boxSizing: "border-box",
+ justifyContent: "space-between",
+ flexWrap: "wrap"
+})
+
+export const Header: React.FC = () => {
+ return (
+
+
+
+
+
+
+
+
-
-
-
-
- Enter App
-
-
+
+
+ Homebase
+
+
+
+
+
+
+
+
+ Enter App
+
+
-
-
- );
- };
\ No newline at end of file
+
+
+
+ )
+}
diff --git a/src/modules/home/hooks/useGenerateFAQ.tsx b/src/modules/home/hooks/useGenerateFAQ.tsx
index d6ab638d..02e8a201 100644
--- a/src/modules/home/hooks/useGenerateFAQ.tsx
+++ b/src/modules/home/hooks/useGenerateFAQ.tsx
@@ -1,59 +1,59 @@
-import { useEffect, useState } from "react";
+import { useEffect, useState } from "react"
-const FILE_NAME = "faq.md";
-const QUESTION_DELIMITER = "";
-const ANSWER_DELIMITER = "";
+const FILE_NAME = "faq.md"
+const QUESTION_DELIMITER = ""
+const ANSWER_DELIMITER = ""
export const useGenerateFAQ = () => {
- const [faqFile, setFaqFile] = useState("");
- const [questionsToRender, setQuestionToRender] = useState([]);
- const [answersToRender, setAnswerToRender] = useState([]);
- const [faqList, setFaqList] = useState<{ question: string; answer: string }[]>([]);
+ const [faqFile, setFaqFile] = useState("")
+ const [questionsToRender, setQuestionToRender] = useState([])
+ const [answersToRender, setAnswerToRender] = useState([])
+ const [faqList, setFaqList] = useState<{ question: string; answer: string }[]>([])
useEffect(() => {
import(`../utils/${FILE_NAME}`)
- .then((res) => {
+ .then(res => {
fetch(res.default)
- .then((res) => res.text())
- .then((res) => setFaqFile(res));
+ .then(res => res.text())
+ .then(res => setFaqFile(res))
})
- .catch((error) => console.log(error));
- });
+ .catch(error => console.log(error))
+ })
useEffect(() => {
- const questionsList = faqFile.split(QUESTION_DELIMITER);
- const answerList = faqFile.split(ANSWER_DELIMITER);
+ const questionsList = faqFile.split(QUESTION_DELIMITER)
+ const answerList = faqFile.split(ANSWER_DELIMITER)
if (questionsList.length > 0) {
- const questions: string[] = [];
- questionsList.forEach((word) => {
+ const questions: string[] = []
+ questionsList.forEach(word => {
if (word !== "" && !word.includes("\n") && !word.includes(ANSWER_DELIMITER)) {
- questions.push(word);
+ questions.push(word)
}
- });
- setQuestionToRender(questions);
+ })
+ setQuestionToRender(questions)
}
if (answerList.length > 0) {
- const answers: string[] = [];
- answerList.forEach((word) => {
+ const answers: string[] = []
+ answerList.forEach(word => {
if (word !== "" && !word.includes(QUESTION_DELIMITER)) {
- answers.push(word);
+ answers.push(word)
}
- });
- setAnswerToRender(answers.filter((a) => a !== "\n"));
+ })
+ setAnswerToRender(answers.filter(a => a !== "\n"))
}
- }, [faqFile]);
+ }, [faqFile])
useEffect(() => {
if (questionsToRender.length === answersToRender.length) {
const list = questionsToRender.map((question, index) => {
return {
question,
- answer: answersToRender[index],
- };
- });
- setFaqList(list);
+ answer: answersToRender[index]
+ }
+ })
+ setFaqList(list)
}
- }, [questionsToRender, answersToRender]);
+ }, [questionsToRender, answersToRender])
- return faqList;
-};
+ return faqList
+}
diff --git a/src/services/agora/hooks/useTopic.tsx b/src/services/agora/hooks/useTopic.tsx
index fc1c760c..4af9e89d 100644
--- a/src/services/agora/hooks/useTopic.tsx
+++ b/src/services/agora/hooks/useTopic.tsx
@@ -1,17 +1,13 @@
-import { useQuery } from "react-query";
-import { getTopicById } from "../topics";
-import { Topic } from "../topics/types";
+import { useQuery } from "react-query"
+import { getTopicById } from "../topics"
+import { Topic } from "../topics/types"
export const useAgoraTopic = (topicId?: number) => {
- const result = useQuery(
- ["agoraTopic", topicId],
- () => getTopicById(topicId as number),
- {
- enabled: !!topicId,
- cacheTime: Infinity,
- refetchOnWindowFocus: false,
- }
- );
+ const result = useQuery(["agoraTopic", topicId], () => getTopicById(topicId as number), {
+ enabled: !!topicId,
+ cacheTime: Infinity,
+ refetchOnWindowFocus: false
+ })
- return result;
-};
+ return result
+}
diff --git a/src/services/agora/index.ts b/src/services/agora/index.ts
index 2ec9c06f..05125560 100644
--- a/src/services/agora/index.ts
+++ b/src/services/agora/index.ts
@@ -1,3 +1,3 @@
-import { EnvKey, getEnv } from 'services/config';
+import { EnvKey, getEnv } from "services/config"
-export const API_URL = `${getEnv(EnvKey.REACT_APP_CORS_PROXY_URL)}/https://forum.tezosagora.org`;
+export const API_URL = `${getEnv(EnvKey.REACT_APP_CORS_PROXY_URL)}/https://forum.tezosagora.org`
diff --git a/src/services/agora/topics/index.ts b/src/services/agora/topics/index.ts
index f60aaca2..8d667790 100644
--- a/src/services/agora/topics/index.ts
+++ b/src/services/agora/topics/index.ts
@@ -1,20 +1,20 @@
-import { API_URL } from "..";
-import { Topic } from "./types";
+import { API_URL } from ".."
+import { Topic } from "./types"
export const getTopicById = async (topicId: number): Promise => {
if (topicId <= 0) {
- throw new Error("Failed to fetch Agora Topic from Discourse API");
+ throw new Error("Failed to fetch Agora Topic from Discourse API")
}
- const url = `${API_URL}/t/${topicId}.json`;
+ const url = `${API_URL}/t/${topicId}.json`
- const response = await fetch(url);
+ const response = await fetch(url)
if (!response.ok) {
- throw new Error("Failed to fetch Agora Topic from Discourse API");
+ throw new Error("Failed to fetch Agora Topic from Discourse API")
}
- const result: Topic = await response.json();
+ const result: Topic = await response.json()
- return result;
-};
+ return result
+}
diff --git a/src/services/agora/topics/types.ts b/src/services/agora/topics/types.ts
index 63de08d1..96eea3d2 100644
--- a/src/services/agora/topics/types.ts
+++ b/src/services/agora/topics/types.ts
@@ -1,168 +1,168 @@
interface Participant {
- id: number;
- username: string;
- name: string;
- avatar_template: string;
- post_count: number;
- primary_group_name: null;
- flair_name: null;
- flair_url: null;
- flair_color: null;
- flair_bg_color: null;
- moderator: boolean;
- trust_level: number;
+ id: number
+ username: string
+ name: string
+ avatar_template: string
+ post_count: number
+ primary_group_name: null
+ flair_name: null
+ flair_url: null
+ flair_color: null
+ flair_bg_color: null
+ moderator: boolean
+ trust_level: number
}
interface Post {
- id: number;
- name: string;
- username: string;
- avatar_template: string;
- created_at: string;
- cooked: string;
- post_number: number;
- post_type: number;
- updated_at: string;
- reply_count: number;
- reply_to_post_number: null;
- quote_count: number;
- incoming_link_count: number;
- reads: number;
- readers_count: number;
- score: number;
- yours: boolean;
- topic_id: number;
- topic_slug: string;
- display_username: string;
- primary_group_name: null;
- flair_name: null;
- flair_url: null;
- flair_bg_color: null;
- flair_color: null;
- version: number;
- can_edit: boolean;
- can_delete: boolean;
- can_recover: boolean;
- can_wiki: boolean;
+ id: number
+ name: string
+ username: string
+ avatar_template: string
+ created_at: string
+ cooked: string
+ post_number: number
+ post_type: number
+ updated_at: string
+ reply_count: number
+ reply_to_post_number: null
+ quote_count: number
+ incoming_link_count: number
+ reads: number
+ readers_count: number
+ score: number
+ yours: boolean
+ topic_id: number
+ topic_slug: string
+ display_username: string
+ primary_group_name: null
+ flair_name: null
+ flair_url: null
+ flair_bg_color: null
+ flair_color: null
+ version: number
+ can_edit: boolean
+ can_delete: boolean
+ can_recover: boolean
+ can_wiki: boolean
link_counts: {
- url: string;
- internal: boolean;
- reflection: boolean;
- title: string;
- clicks: number;
- }[];
- read: boolean;
- user_title: null;
- bookmarked: boolean;
+ url: string
+ internal: boolean
+ reflection: boolean
+ title: string
+ clicks: number
+ }[]
+ read: boolean
+ user_title: null
+ bookmarked: boolean
actions_summary: {
- id: number;
- count: number;
- can_act: boolean;
- }[];
- moderator: boolean;
- admin: boolean;
- staff: boolean;
- user_id: number;
- hidden: boolean;
- trust_level: number;
- deleted_at: null;
- user_deleted: boolean;
- edit_reason: null;
- can_view_edit_history: boolean;
- wiki: boolean;
- can_vote: boolean;
+ id: number
+ count: number
+ can_act: boolean
+ }[]
+ moderator: boolean
+ admin: boolean
+ staff: boolean
+ user_id: number
+ hidden: boolean
+ trust_level: number
+ deleted_at: null
+ user_deleted: boolean
+ edit_reason: null
+ can_view_edit_history: boolean
+ wiki: boolean
+ can_vote: boolean
}
export interface Topic {
post_stream: {
- posts: Post[];
- stream: number[];
- };
- timeline_lookup: [number, number][];
- tags: string[];
- id: number;
- title: string;
- fancy_title: string;
- posts_count: number;
- created_at: string;
- views: number;
- reply_count: number;
- like_count: number;
- last_posted_at: string;
- visible: boolean;
- closed: boolean;
- archived: boolean;
- has_summary: boolean;
- archetype: string;
- slug: string;
- category_id: number;
- word_count: number;
- deleted_at: null;
- user_id: number;
- featured_link: null;
- pinned_globally: boolean;
- pinned_at: null;
- pinned_until: null;
- image_url: null;
- slow_mode_seconds: number;
- draft: null;
- draft_key: string;
- draft_sequence: number;
- posted: boolean;
- unpinned: null;
- pinned: boolean;
- current_post_number: number;
- highest_post_number: number;
- last_read_post_number: number;
- last_read_post_id: number;
- deleted_by: null;
+ posts: Post[]
+ stream: number[]
+ }
+ timeline_lookup: [number, number][]
+ tags: string[]
+ id: number
+ title: string
+ fancy_title: string
+ posts_count: number
+ created_at: string
+ views: number
+ reply_count: number
+ like_count: number
+ last_posted_at: string
+ visible: boolean
+ closed: boolean
+ archived: boolean
+ has_summary: boolean
+ archetype: string
+ slug: string
+ category_id: number
+ word_count: number
+ deleted_at: null
+ user_id: number
+ featured_link: null
+ pinned_globally: boolean
+ pinned_at: null
+ pinned_until: null
+ image_url: null
+ slow_mode_seconds: number
+ draft: null
+ draft_key: string
+ draft_sequence: number
+ posted: boolean
+ unpinned: null
+ pinned: boolean
+ current_post_number: number
+ highest_post_number: number
+ last_read_post_number: number
+ last_read_post_id: number
+ deleted_by: null
actions_summary: {
- id: number;
- count: number;
- hidden: boolean;
- can_act: boolean;
- }[];
- chunk_size: number;
- bookmarked: boolean;
- bookmarked_posts: null;
- topic_timer: null;
- message_bus_last_id: number;
- participant_count: number;
- show_read_indicator: boolean;
- thumbnails: null;
- slow_mode_enabled_until: null;
- can_vote: boolean;
- vote_count: number;
- user_voted: boolean;
+ id: number
+ count: number
+ hidden: boolean
+ can_act: boolean
+ }[]
+ chunk_size: number
+ bookmarked: boolean
+ bookmarked_posts: null
+ topic_timer: null
+ message_bus_last_id: number
+ participant_count: number
+ show_read_indicator: boolean
+ thumbnails: null
+ slow_mode_enabled_until: null
+ can_vote: boolean
+ vote_count: number
+ user_voted: boolean
details: {
- can_edit: boolean;
- notification_level: number;
- notifications_reason_id: null;
- can_create_post: boolean;
- participants: Participant[];
+ can_edit: boolean
+ notification_level: number
+ notifications_reason_id: null
+ can_create_post: boolean
+ participants: Participant[]
created_by: {
- id: number;
- username: string;
- name: string;
- avatar_template: string;
- };
+ id: number
+ username: string
+ name: string
+ avatar_template: string
+ }
last_poster: {
- id: number;
- username: string;
- name: string;
- avatar_template: string;
- };
+ id: number
+ username: string
+ name: string
+ avatar_template: string
+ }
links: {
- url: string;
- title: string;
- internal: boolean;
- attachment: boolean;
- reflection: boolean;
- clicks: number;
- user_id: number;
- domain: string;
- root_domain: string;
- }[];
- };
- pending_posts: [];
+ url: string
+ title: string
+ internal: boolean
+ attachment: boolean
+ reflection: boolean
+ clicks: number
+ user_id: number
+ domain: string
+ root_domain: string
+ }[]
+ }
+ pending_posts: []
}
diff --git a/src/services/bakingBad/context/TZKTSubscriptions.tsx b/src/services/bakingBad/context/TZKTSubscriptions.tsx
index 2054a696..7f002b88 100644
--- a/src/services/bakingBad/context/TZKTSubscriptions.tsx
+++ b/src/services/bakingBad/context/TZKTSubscriptions.tsx
@@ -1,53 +1,53 @@
-import React, { createContext, useEffect, useRef, useState } from "react";
-import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr";
-import { Network } from "services/beacon";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { networkNameMap } from "../index";
+import React, { createContext, useEffect, useRef, useState } from "react"
+import { HubConnection, HubConnectionBuilder } from "@microsoft/signalr"
+import { Network } from "services/beacon"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { networkNameMap } from "../index"
interface State {
- block: number;
+ block: number
}
const TZKTSubscriptionsContext = createContext<{
- state: State;
+ state: State
}>({
state: {
- block: 0,
- },
-});
+ block: 0
+ }
+})
interface BlockMessage {
- type: number;
- state: number;
+ type: number
+ state: number
}
-const getUrl = (network: Network) => `https://api.${networkNameMap[network]}.tzkt.io/v1/events`;
+const getUrl = (network: Network) => `https://api.${networkNameMap[network]}.tzkt.io/v1/events`
const TZKTSubscriptionsProvider: React.FC = ({ children }) => {
- const [block, setBlock] = useState(0);
- const socketRef = useRef();
- const { network } = useTezos();
+ const [block, setBlock] = useState(0)
+ const socketRef = useRef()
+ const { network } = useTezos()
useEffect(() => {
- (async () => {
- socketRef.current = new HubConnectionBuilder().withUrl(getUrl(network)).build();
+ ;(async () => {
+ socketRef.current = new HubConnectionBuilder().withUrl(getUrl(network)).build()
- await socketRef.current.start();
+ await socketRef.current.start()
// listen for incoming message
socketRef.current.on("blocks", (blockMessage: BlockMessage) => {
- setBlock(blockMessage.state);
- });
+ setBlock(blockMessage.state)
+ })
- await socketRef.current.invoke("SubscribeToBlocks");
- })();
+ await socketRef.current.invoke("SubscribeToBlocks")
+ })()
return () => {
- socketRef.current?.stop();
- };
- }, [network]);
+ socketRef.current?.stop()
+ }
+ }, [network])
- return {children};
-};
+ return {children}
+}
-export { TZKTSubscriptionsProvider, TZKTSubscriptionsContext };
+export { TZKTSubscriptionsProvider, TZKTSubscriptionsContext }
diff --git a/src/services/bakingBad/delegations/index.ts b/src/services/bakingBad/delegations/index.ts
index e4cdff2f..2cab41bd 100644
--- a/src/services/bakingBad/delegations/index.ts
+++ b/src/services/bakingBad/delegations/index.ts
@@ -1,22 +1,19 @@
-import { Network } from "services/beacon";
-import { networkNameMap } from "..";
-import { DelegationDTO } from "./types";
+import { Network } from "services/beacon"
+import { networkNameMap } from ".."
+import { DelegationDTO } from "./types"
-export const getLatestDelegation = async (
- daoAddress: string,
- network: Network,
-) => {
- const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/operations/delegations?sender=${daoAddress}&status=applied`;
- const response = await fetch(url);
+export const getLatestDelegation = async (daoAddress: string, network: Network) => {
+ const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/operations/delegations?sender=${daoAddress}&status=applied`
+ const response = await fetch(url)
if (!response.ok) {
- throw new Error("Failed to fetch delegations from TZKT API");
+ throw new Error("Failed to fetch delegations from TZKT API")
}
- const resultingDelegations: DelegationDTO[] = await response.json();
+ const resultingDelegations: DelegationDTO[] = await response.json()
if (!resultingDelegations.length) {
return null
}
return resultingDelegations[0]
-};
+}
diff --git a/src/services/bakingBad/delegations/types.ts b/src/services/bakingBad/delegations/types.ts
index 555b7dc4..21b8ffea 100644
--- a/src/services/bakingBad/delegations/types.ts
+++ b/src/services/bakingBad/delegations/types.ts
@@ -1,25 +1,25 @@
export interface DelegationDTO {
- type: string;
- id: number;
- level: number;
- timestamp: string;
- block: string;
- hash: string;
- counter: number;
+ type: string
+ id: number
+ level: number
+ timestamp: string
+ block: string
+ hash: string
+ counter: number
initiator: {
- address: string;
- };
+ address: string
+ }
sender: {
- address: string;
- };
- nonce: number;
- gasLimit: number;
- gasUsed: number;
- bakerFee: number;
- amount: number;
+ address: string
+ }
+ nonce: number
+ gasLimit: number
+ gasUsed: number
+ bakerFee: number
+ amount: number
newDelegate: {
- alias?: string;
- address: string;
- };
- status: string;
+ alias?: string
+ address: string
+ }
+ status: string
}
diff --git a/src/services/bakingBad/index.ts b/src/services/bakingBad/index.ts
index b683dc67..502e1bf8 100644
--- a/src/services/bakingBad/index.ts
+++ b/src/services/bakingBad/index.ts
@@ -1,6 +1,6 @@
-import { Network } from "services/beacon";
+import { Network } from "services/beacon"
export const networkNameMap: Record = {
mainnet: "mainnet",
ghostnet: "ghostnet"
-};
+}
diff --git a/src/services/bakingBad/stats/index.ts b/src/services/bakingBad/stats/index.ts
index e77fee2b..cbd6fe27 100644
--- a/src/services/bakingBad/stats/index.ts
+++ b/src/services/bakingBad/stats/index.ts
@@ -1,18 +1,16 @@
-import { Network } from "services/beacon";
-import { BlockchainStats } from "./types";
-import { networkNameMap } from "..";
+import { Network } from "services/beacon"
+import { BlockchainStats } from "./types"
+import { networkNameMap } from ".."
-export const getNetworkStats = async (
- network: Network
-): Promise => {
- const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/protocols/current`;
- const response = await fetch(url);
+export const getNetworkStats = async (network: Network): Promise => {
+ const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/protocols/current`
+ const response = await fetch(url)
if (!response.ok) {
- throw new Error("Failed to fetch contract storage from BakingBad API");
+ throw new Error("Failed to fetch contract storage from BakingBad API")
}
- const result: BlockchainStats = await response.json();
+ const result: BlockchainStats = await response.json()
- return result;
-};
+ return result
+}
diff --git a/src/services/bakingBad/stats/types.ts b/src/services/bakingBad/stats/types.ts
index c8acbf16..7cdd7c05 100644
--- a/src/services/bakingBad/stats/types.ts
+++ b/src/services/bakingBad/stats/types.ts
@@ -1,5 +1,5 @@
export interface BlockchainStats {
- constants: BlockchainStatsConstants;
+ constants: BlockchainStatsConstants
}
export interface BlockchainStatsConstants {
diff --git a/src/services/bakingBad/tokenBalances/index.ts b/src/services/bakingBad/tokenBalances/index.ts
index 2d6cc023..43332b39 100644
--- a/src/services/bakingBad/tokenBalances/index.ts
+++ b/src/services/bakingBad/tokenBalances/index.ts
@@ -1,133 +1,131 @@
-import BigNumber from "bignumber.js";
-import {NFT, Token} from "models/Token";
-import { Network } from "services/beacon";
-import { parseUnits } from "services/contracts/utils";
-import { networkNameMap } from "..";
-import { BalanceTZKT, DAOToken, FA2TokenDTO, NFTDTO, TokenDataTZKT } from "./types";
+import BigNumber from "bignumber.js"
+import { NFT, Token } from "models/Token"
+import { Network } from "services/beacon"
+import { parseUnits } from "services/contracts/utils"
+import { networkNameMap } from ".."
+import { BalanceTZKT, DAOToken, FA2TokenDTO, NFTDTO, TokenDataTZKT } from "./types"
-const isNFTDTO = (value: DAOToken): value is NFTDTO =>
- value.hasOwnProperty("artifact_uri");
+const isNFTDTO = (value: DAOToken): value is NFTDTO => value.hasOwnProperty("artifact_uri")
const isBalanceTzktNFT = (value: BalanceTZKT): boolean => Boolean(value.token.metadata?.artifactUri)
const isTokenTzktNFT = (value: TokenDataTZKT): boolean => Boolean(value.metadata?.artifactUri)
export interface DAOHolding {
- balance: BigNumber;
- token: Token;
+ balance: BigNumber
+ token: Token
}
export interface NFTDAOHolding extends DAOHolding {
- token: NFT;
+ token: NFT
}
const ELEMENTS_PER_REQUEST = 50
interface DAOBalance {
- balance: BigNumber,
+ balance: BigNumber
token: Token
}
-export const getDAOBalances = async (daoId: string, network: Network, offset = 0, balances: DAOBalance[] = []): Promise => {
+export const getDAOBalances = async (
+ daoId: string,
+ network: Network,
+ offset = 0,
+ balances: DAOBalance[] = []
+): Promise => {
const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens/balances?account=${daoId}&limit=${ELEMENTS_PER_REQUEST}&offset=${offset}`
- const response = await fetch(url);
+ const response = await fetch(url)
if (!response.ok) {
- throw new Error("Failed to fetch contract storage from BakingBad API");
+ throw new Error("Failed to fetch contract storage from BakingBad API")
}
- const result: BalanceTZKT[] = await response.json();
+ const result: BalanceTZKT[] = await response.json()
- if(result.length === 0) {
+ if (result.length === 0) {
return balances
}
-
- const tokenBalances: DAOToken[] = await Promise.all(result.map(async (balance: BalanceTZKT) => {
- const urlTokenData = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens?contract=${balance.token.contract.address}&tokenId=${balance.token.tokenId}`
- const responseTokenData = await fetch(urlTokenData);
- const resultTokenDataTzkt: TokenDataTZKT[] = await responseTokenData.json();
- const tokenData = resultTokenDataTzkt[0]
-
- if (isBalanceTzktNFT(balance)){
- const tokenBalance: NFTDTO = {
- id: balance.token.id.toString(),
- supply: tokenData.totalSupply,
- contract: balance.token.contract.address,
- token_id: parseInt(balance.token.tokenId),
- network: network,
- symbol: tokenData.metadata?.symbol || "",
- level: balance.firstLevel,
- name: tokenData.metadata?.name || "",
- decimals: parseInt(tokenData.metadata?.decimals) || 0,
- description: tokenData.metadata?.description || "",
- artifact_uri: tokenData.metadata?.artifactUri || "",
- thumbnail_uri: tokenData.metadata?.thumbnailUri || "",
- is_transferable: tokenData.metadata?.isTransferable,
- creators: tokenData.metadata?.creators || [],
- tags: tokenData.metadata?.tags || [],
- formats: tokenData.metadata.formats || [{
- mimeType: "",
- uri: "",
- }],
- balance: balance.balance,
- }
- return tokenBalance
- } else {
- const tokenBalance: FA2TokenDTO = {
- id: balance.token.id.toString(),
- supply: tokenData.totalSupply,
- contract: balance.token.contract.address,
- token_id: parseInt(balance.token.tokenId),
- network: network,
- symbol: tokenData.metadata?.symbol || "",
- level: balance.firstLevel,
- name: tokenData.metadata?.name || "",
- decimals: parseInt(tokenData.metadata?.decimals) || 0,
- balance: balance.balance,
+
+ const tokenBalances: DAOToken[] = await Promise.all(
+ result.map(async (balance: BalanceTZKT) => {
+ const urlTokenData = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens?contract=${balance.token.contract.address}&tokenId=${balance.token.tokenId}`
+ const responseTokenData = await fetch(urlTokenData)
+ const resultTokenDataTzkt: TokenDataTZKT[] = await responseTokenData.json()
+ const tokenData = resultTokenDataTzkt[0]
+
+ if (isBalanceTzktNFT(balance)) {
+ const tokenBalance: NFTDTO = {
+ id: balance.token.id.toString(),
+ supply: tokenData.totalSupply,
+ contract: balance.token.contract.address,
+ token_id: parseInt(balance.token.tokenId),
+ network: network,
+ symbol: tokenData.metadata?.symbol || "",
+ level: balance.firstLevel,
+ name: tokenData.metadata?.name || "",
+ decimals: parseInt(tokenData.metadata?.decimals) || 0,
+ description: tokenData.metadata?.description || "",
+ artifact_uri: tokenData.metadata?.artifactUri || "",
+ thumbnail_uri: tokenData.metadata?.thumbnailUri || "",
+ is_transferable: tokenData.metadata?.isTransferable,
+ creators: tokenData.metadata?.creators || [],
+ tags: tokenData.metadata?.tags || [],
+ formats: tokenData.metadata.formats || [
+ {
+ mimeType: "",
+ uri: ""
+ }
+ ],
+ balance: balance.balance
+ }
+ return tokenBalance
+ } else {
+ const tokenBalance: FA2TokenDTO = {
+ id: balance.token.id.toString(),
+ supply: tokenData.totalSupply,
+ contract: balance.token.contract.address,
+ token_id: parseInt(balance.token.tokenId),
+ network: network,
+ symbol: tokenData.metadata?.symbol || "",
+ level: balance.firstLevel,
+ name: tokenData.metadata?.name || "",
+ decimals: parseInt(tokenData.metadata?.decimals) || 0,
+ balance: balance.balance
+ }
+ return tokenBalance
}
- return tokenBalance
- }
- }))
+ })
+ )
- const fetchedBalances = tokenBalances.map((daoTokenDTO) =>
+ const fetchedBalances = tokenBalances.map(daoTokenDTO =>
isNFTDTO(daoTokenDTO)
? {
- balance: parseUnits(
- new BigNumber(daoTokenDTO.balance),
- daoTokenDTO.decimals
- ),
- token: new NFT(daoTokenDTO),
- }
+ balance: parseUnits(new BigNumber(daoTokenDTO.balance), daoTokenDTO.decimals),
+ token: new NFT(daoTokenDTO)
+ }
: {
- balance: parseUnits(
- new BigNumber(daoTokenDTO.balance),
- daoTokenDTO.decimals
- ),
- token: new Token(daoTokenDTO),
- }
- );
+ balance: parseUnits(new BigNumber(daoTokenDTO.balance), daoTokenDTO.decimals),
+ token: new Token(daoTokenDTO)
+ }
+ )
return getDAOBalances(daoId, network, offset + ELEMENTS_PER_REQUEST, balances.concat(fetchedBalances))
-};
+}
-export const getTokenMetadata = async (
- contractAddress: string,
- network: Network,
- tokenId: string
-) => {
+export const getTokenMetadata = async (contractAddress: string, network: Network, tokenId: string) => {
const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens?contract=${contractAddress}&tokenId=${tokenId}`
-
- const response = await fetch(url);
+
+ const response = await fetch(url)
if (!response.ok) {
- throw new Error("Failed to fetch proposals from BakingBad API");
+ throw new Error("Failed to fetch proposals from BakingBad API")
}
- const resultTokenDataTzkt: TokenDataTZKT[] = await response.json();
+ const resultTokenDataTzkt: TokenDataTZKT[] = await response.json()
const tokenData = resultTokenDataTzkt[0]
- let result: DAOToken;
+ let result: DAOToken
- if(isTokenTzktNFT(tokenData)){
+ if (isTokenTzktNFT(tokenData)) {
result = {
id: tokenData.id.toString(),
supply: tokenData.totalSupply,
@@ -145,7 +143,7 @@ export const getTokenMetadata = async (
creators: tokenData.metadata?.creators,
tags: tokenData.metadata?.tags,
formats: tokenData.metadata?.formats,
- balance: "",
+ balance: ""
}
} else {
result = {
@@ -158,35 +156,27 @@ export const getTokenMetadata = async (
level: tokenData.firstLevel,
name: tokenData.metadata?.name || "",
decimals: parseInt(tokenData.metadata?.decimals) || 0,
- balance: "",
+ balance: ""
}
}
- return isNFTDTO(result)
- ? new NFT(result)
- :
- new Token(result)
-};
-
-export const getUserTokenBalance = async (
- accountAddress: string,
- network: Network = "mainnet",
- tokenAddress = ""
-) => {
- const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens/balances/?account=${accountAddress}`;
-
- const response = await fetch(url);
-
+ return isNFTDTO(result) ? new NFT(result) : new Token(result)
+}
+
+export const getUserTokenBalance = async (accountAddress: string, network: Network = "mainnet", tokenAddress = "") => {
+ const url = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens/balances/?account=${accountAddress}`
+
+ const response = await fetch(url)
+
if (!response.ok) {
- throw new Error("Failed to fetch user balances");
+ throw new Error("Failed to fetch user balances")
}
-
- const userTokens = await response.json();
- const userTokenBalance = userTokens.filter((token: any) => token.token.contract.address === tokenAddress);
+ const userTokens = await response.json()
+
+ const userTokenBalance = userTokens.filter((token: any) => token.token.contract.address === tokenAddress)
if (userTokenBalance && userTokenBalance[0]) {
- return userTokenBalance[0].balance;
+ return userTokenBalance[0].balance
}
-
}
diff --git a/src/services/bakingBad/tokenBalances/types.ts b/src/services/bakingBad/tokenBalances/types.ts
index 503a0680..ad78f706 100644
--- a/src/services/bakingBad/tokenBalances/types.ts
+++ b/src/services/bakingBad/tokenBalances/types.ts
@@ -1,41 +1,41 @@
-import { Network } from "services/beacon";
+import { Network } from "services/beacon"
-export type DAOToken = FA2TokenDTO | NFTDTO;
+export type DAOToken = FA2TokenDTO | NFTDTO
export interface FA2TokenDTO {
- id: string;
- contract: string;
- level: number;
- token_id: number;
- symbol: string;
- name: string;
- decimals: number;
- network: Network;
- supply: string;
- balance: string;
+ id: string
+ contract: string
+ level: number
+ token_id: number
+ symbol: string
+ name: string
+ decimals: number
+ network: Network
+ supply: string
+ balance: string
}
export interface NFTDTO {
- id: string;
- supply: string;
- contract: string;
- token_id: number;
- network: Network;
- symbol: string;
- level: number;
- name: string;
- decimals: number;
- description: string;
- artifact_uri: string;
- thumbnail_uri: string;
- is_transferable: boolean;
- creators: string[];
- tags: string[];
+ id: string
+ supply: string
+ contract: string
+ token_id: number
+ network: Network
+ symbol: string
+ level: number
+ name: string
+ decimals: number
+ description: string
+ artifact_uri: string
+ thumbnail_uri: string
+ is_transferable: boolean
+ creators: string[]
+ tags: string[]
formats: {
- mimeType: string;
- uri: string;
- }[];
- balance: string;
+ mimeType: string
+ uri: string
+ }[]
+ balance: string
}
export interface BalanceTZKT {
@@ -126,4 +126,4 @@ export interface TokenDataTZKT {
totalBurned: string
totalSupply: string
metadata: Metadata
-}
\ No newline at end of file
+}
diff --git a/src/services/bakingBad/transfers/index.ts b/src/services/bakingBad/transfers/index.ts
index 179ba5c2..40433940 100644
--- a/src/services/bakingBad/transfers/index.ts
+++ b/src/services/bakingBad/transfers/index.ts
@@ -1,68 +1,67 @@
-import { Network } from "services/beacon";
-import { networkNameMap } from "..";
-import { TransactionTzkt, TransferDTO, TransfersDTO, TransferTZKT } from "./types";
+import { Network } from "services/beacon"
+import { networkNameMap } from ".."
+import { TransactionTzkt, TransferDTO, TransfersDTO, TransferTZKT } from "./types"
const ELEMENTS_PER_REQUEST = 20
-export const getDAOTransfers = async (
- daoId: string,
- network: Network
-): Promise => {
+export const getDAOTransfers = async (daoId: string, network: Network): Promise => {
const urlTo = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens/transfers?to=${daoId}&limit=${ELEMENTS_PER_REQUEST}`
- const responseTo = await fetch(urlTo);
+ const responseTo = await fetch(urlTo)
if (!responseTo.ok) {
- throw new Error("Failed to fetch contract storage from BakingBad API");
+ throw new Error("Failed to fetch contract storage from BakingBad API")
}
- const resultsTzktTo: TransferTZKT[] = await responseTo.json();
+ const resultsTzktTo: TransferTZKT[] = await responseTo.json()
const urlFrom = `https://api.${networkNameMap[network]}.tzkt.io/v1/tokens/transfers?from=${daoId}&limit=${ELEMENTS_PER_REQUEST}`
- const responseFrom = await fetch(urlFrom);
+ const responseFrom = await fetch(urlFrom)
if (!responseFrom.ok) {
- throw new Error("Failed to fetch contract storage from BakingBad API");
+ throw new Error("Failed to fetch contract storage from BakingBad API")
}
- const resultsTzktFrom: TransferTZKT[] = await responseFrom.json();
-
+ const resultsTzktFrom: TransferTZKT[] = await responseFrom.json()
+
const resultsTzktAggregated = resultsTzktTo.concat(resultsTzktFrom)
-
- const transfers: TransferDTO[] = await Promise.all(resultsTzktAggregated.map(async (result: TransferTZKT) => {
- const urlId = `https://api.${networkNameMap[network]}.tzkt.io/v1/operations/transactions?id=${result.transactionId}`
- const responseId = await fetch(urlId);
- const resultTzktTxResult: TransactionTzkt[] = await responseId.json();
- const resultTzktTx: TransactionTzkt = resultTzktTxResult[0]
- const transferDTO: TransferDTO = {
- indexed_time: resultTzktTx.id,
- network: network,
- contract: result.token.contract.address,
- initiator: "",
- hash: resultTzktTx.hash,
- status: resultTzktTx.status,
- timestamp: result.timestamp,
- level: result.level,
- from: result.from.address,
- to: result.to.address,
- token_id: parseInt(result.token.tokenId),
- amount: result.amount,
- counter: resultTzktTx.counter,
- token: {
- contract: result.token.contract.address,
+ const transfers: TransferDTO[] = await Promise.all(
+ resultsTzktAggregated.map(async (result: TransferTZKT) => {
+ const urlId = `https://api.${networkNameMap[network]}.tzkt.io/v1/operations/transactions?id=${result.transactionId}`
+ const responseId = await fetch(urlId)
+ const resultTzktTxResult: TransactionTzkt[] = await responseId.json()
+ const resultTzktTx: TransactionTzkt = resultTzktTxResult[0]
+
+ const transferDTO: TransferDTO = {
+ indexed_time: resultTzktTx.id,
network: network,
+ contract: result.token.contract.address,
+ initiator: "",
+ hash: resultTzktTx.hash,
+ status: resultTzktTx.status,
+ timestamp: result.timestamp,
+ level: result.level,
+ from: result.from.address,
+ to: result.to.address,
token_id: parseInt(result.token.tokenId),
- symbol: result.token.metadata?.symbol || "",
- name: result.token.metadata?.name || "",
- decimals: parseInt(result.token.metadata?.decimals || "0")
- },
- alias: result.token.metadata?.name || "",
- to_alias: "",
- }
+ amount: result.amount,
+ counter: resultTzktTx.counter,
+ token: {
+ contract: result.token.contract.address,
+ network: network,
+ token_id: parseInt(result.token.tokenId),
+ symbol: result.token.metadata?.symbol || "",
+ name: result.token.metadata?.name || "",
+ decimals: parseInt(result.token.metadata?.decimals || "0")
+ },
+ alias: result.token.metadata?.name || "",
+ to_alias: ""
+ }
- return transferDTO
- }))
+ return transferDTO
+ })
+ )
const result: TransfersDTO = {
transfers: transfers,
- total: transfers.length,
+ total: transfers.length
}
- return result.transfers;
-};
+ return result.transfers
+}
diff --git a/src/services/bakingBad/transfers/types.ts b/src/services/bakingBad/transfers/types.ts
index 498eb86c..e220ea10 100644
--- a/src/services/bakingBad/transfers/types.ts
+++ b/src/services/bakingBad/transfers/types.ts
@@ -1,34 +1,34 @@
-import BigNumber from "bignumber.js";
+import BigNumber from "bignumber.js"
export interface TransfersDTO {
- transfers: TransferDTO[];
- total: number;
+ transfers: TransferDTO[]
+ total: number
}
export interface TransferDTO {
- indexed_time: number;
- network: string;
- contract: string;
- initiator: string;
- hash: string;
- status: string;
- timestamp: string;
- level: number;
- from: string;
- to: string;
- token_id: number;
- amount: string;
- counter: number;
+ indexed_time: number
+ network: string
+ contract: string
+ initiator: string
+ hash: string
+ status: string
+ timestamp: string
+ level: number
+ from: string
+ to: string
+ token_id: number
+ amount: string
+ counter: number
token: {
- contract: string;
- network: string;
- token_id: number;
- symbol: string;
- name: string;
+ contract: string
+ network: string
+ token_id: number
+ symbol: string
+ name: string
decimals: number
}
- alias: string;
- to_alias: string;
+ alias: string
+ to_alias: string
}
export interface TransferTZKT {
diff --git a/src/services/baseDAODocker/index.ts b/src/services/baseDAODocker/index.ts
index deaaa092..eda9e473 100644
--- a/src/services/baseDAODocker/index.ts
+++ b/src/services/baseDAODocker/index.ts
@@ -1,36 +1,46 @@
-import { Network } from 'services/beacon';
+import { Network } from "services/beacon"
import { DAOTemplate } from "modules/creator/state"
import { BaseStorageParams } from "services/contracts/baseDAO"
import { MetadataDeploymentResult } from "services/contracts/metadataCarrier/deploy"
import { storageParamsToBaseDAODockerArgs } from "./mappers"
import { GeneratorArgs, BaseDAODockerContractsDTO } from "./types"
-import { getTokenMetadata } from 'services/bakingBad/tokenBalances';
+import { getTokenMetadata } from "services/bakingBad/tokenBalances"
export const API_URL = "https://v2-basedao-dockerized.herokuapp.com/steps"
interface BaseDAODockerParams {
- template: DAOTemplate;
- storage: BaseStorageParams;
- originatorAddress: string;
+ template: DAOTemplate
+ storage: BaseStorageParams
+ originatorAddress: string
metadata: MetadataDeploymentResult
network: Network
}
-export const generateStorageContract = async ({ storage, template, originatorAddress, metadata, network }: BaseDAODockerParams): Promise => {
- const tokenMetadata = await getTokenMetadata(storage.governanceToken.address, network, storage.governanceToken.tokenId)
+export const generateStorageContract = async ({
+ storage,
+ template,
+ originatorAddress,
+ metadata,
+ network
+}: BaseDAODockerParams): Promise => {
+ const tokenMetadata = await getTokenMetadata(
+ storage.governanceToken.address,
+ network,
+ storage.governanceToken.tokenId
+ )
const args = storageParamsToBaseDAODockerArgs(storage, metadata, tokenMetadata)
- const url = `${API_URL}/${originatorAddress}/${template}?${Object.keys(args).map(
- (key) => `${key}=${args[key as keyof GeneratorArgs]}`
- ).join("&")}`
+ const url = `${API_URL}/${originatorAddress}/${template}?${Object.keys(args)
+ .map(key => `${key}=${args[key as keyof GeneratorArgs]}`)
+ .join("&")}`
const response = await fetch(url)
if (!response.ok) {
- throw new Error("Failed to make DAO Storage contract from BaseDAO-Dockerized API");
+ throw new Error("Failed to make DAO Storage contract from BaseDAO-Dockerized API")
}
- const result: BaseDAODockerContractsDTO = await response.json();
-
+ const result: BaseDAODockerContractsDTO = await response.json()
+
return result.storage
}
diff --git a/src/services/baseDAODocker/mappers.ts b/src/services/baseDAODocker/mappers.ts
index 21d00d9c..5a80f24d 100644
--- a/src/services/baseDAODocker/mappers.ts
+++ b/src/services/baseDAODocker/mappers.ts
@@ -1,12 +1,16 @@
-import { BaseStorageParams } from "services/contracts/baseDAO";
-import {formatUnits, xtzToMutez} from "services/contracts/utils";
-import { GeneratorArgs } from "./types";
-import { char2Bytes } from '@taquito/tzip16';
-import { MetadataDeploymentResult } from 'services/contracts/metadataCarrier/deploy';
-import { BigNumber } from "bignumber.js";
-import { Token } from "models/Token";
+import { BaseStorageParams } from "services/contracts/baseDAO"
+import { formatUnits, xtzToMutez } from "services/contracts/utils"
+import { GeneratorArgs } from "./types"
+import { char2Bytes } from "@taquito/tzip16"
+import { MetadataDeploymentResult } from "services/contracts/metadataCarrier/deploy"
+import { BigNumber } from "bignumber.js"
+import { Token } from "models/Token"
-export const storageParamsToBaseDAODockerArgs = (storage: BaseStorageParams, metadata: MetadataDeploymentResult, token: Token): GeneratorArgs => ({
+export const storageParamsToBaseDAODockerArgs = (
+ storage: BaseStorageParams,
+ metadata: MetadataDeploymentResult,
+ token: Token
+): GeneratorArgs => ({
admin_address: storage.adminAddress,
guardian_address: storage.guardian,
governance_token_address: `"${storage.governanceToken.address}"`,
@@ -15,7 +19,7 @@ export const storageParamsToBaseDAODockerArgs = (storage: BaseStorageParams, met
slash_division_value: `100n`,
slash_scale_value: `${storage.extra.slashScaleValue.toFixed()}n`,
frozen_extra_value: `${formatUnits(storage.extra.frozenExtraValue, token.decimals).toFixed()}n`,
- frozen_scale_value: '0n',
+ frozen_scale_value: "0n",
metadata_map: formatMetadata(metadata),
quorum_threshold: `${storage.quorumThreshold.toFixed()}n`,
min_quorum: `${storage.minQuorumAmount}n`,
@@ -26,13 +30,13 @@ export const storageParamsToBaseDAODockerArgs = (storage: BaseStorageParams, met
proposal_expired_level: `${storage.proposalExpiryPeriod}n`,
governance_total_supply: `${token.supply.toFixed()}n`,
period: `${storage.votingPeriod}n`,
- start_level: '100n',
+ start_level: "100n",
min_xtz_amount: `${xtzToMutez(new BigNumber(storage.extra.minXtzAmount)).toFixed()}mutez`,
- max_xtz_amount: `${xtzToMutez(new BigNumber(storage.extra.maxXtzAmount)).toFixed()}mutez`,
+ max_xtz_amount: `${xtzToMutez(new BigNumber(storage.extra.maxXtzAmount)).toFixed()}mutez`
})
const formatMetadata = ({ deployAddress, keyName }: MetadataDeploymentResult) => {
return `'(Big_map.literal [
("", 0x${char2Bytes(`tezos-storage://${deployAddress}/${keyName}`)});
- ])'`;
-}
\ No newline at end of file
+ ])'`
+}
diff --git a/src/services/baseDAODocker/types.ts b/src/services/baseDAODocker/types.ts
index 75045b07..9ce623b8 100644
--- a/src/services/baseDAODocker/types.ts
+++ b/src/services/baseDAODocker/types.ts
@@ -16,13 +16,13 @@ export interface GeneratorArgs {
min_xtz_amount: string
max_xtz_amount: string
guardian_address: string
- min_quorum: string;
- max_quorum: string;
- quorum_change: string;
- max_quorum_change: string;
- proposal_flush_level: string;
- proposal_expired_level: string;
- governance_total_supply: string;
- start_level: string;
- period: string;
-}
\ No newline at end of file
+ min_quorum: string
+ max_quorum: string
+ quorum_change: string
+ max_quorum_change: string
+ proposal_flush_level: string
+ proposal_expired_level: string
+ governance_total_supply: string
+ start_level: string
+ period: string
+}
diff --git a/src/services/beacon/actions.ts b/src/services/beacon/actions.ts
index 933ade53..890b1458 100644
--- a/src/services/beacon/actions.ts
+++ b/src/services/beacon/actions.ts
@@ -1,6 +1,6 @@
-import { TezosToolkit } from '@taquito/taquito';
-import { BeaconWallet } from '@taquito/beacon-wallet';
-import { Network } from './utils';
+import { TezosToolkit } from "@taquito/taquito"
+import { BeaconWallet } from "@taquito/beacon-wallet"
+import { Network } from "./utils"
export enum TezosActionType {
UPDATE_TEZOS = "UPDATE_TEZOS",
@@ -8,18 +8,17 @@ export enum TezosActionType {
}
interface UpdateTezos {
- type: TezosActionType.UPDATE_TEZOS;
+ type: TezosActionType.UPDATE_TEZOS
payload: {
- tezos: TezosToolkit;
- network: Network;
- account: string;
- wallet: BeaconWallet | undefined;
- };
+ tezos: TezosToolkit
+ network: Network
+ account: string
+ wallet: BeaconWallet | undefined
+ }
}
interface ResetTezos {
- type: TezosActionType.RESET_TEZOS;
+ type: TezosActionType.RESET_TEZOS
}
-export type TezosAction = UpdateTezos | ResetTezos;
-
+export type TezosAction = UpdateTezos | ResetTezos
diff --git a/src/services/beacon/context.tsx b/src/services/beacon/context.tsx
index f1456cc9..c259a03a 100644
--- a/src/services/beacon/context.tsx
+++ b/src/services/beacon/context.tsx
@@ -1,19 +1,19 @@
-import React, { createContext, useEffect, useReducer } from "react";
-import mixpanel from "mixpanel-browser";
-import { createTezos, createWallet, getTezosNetwork } from './utils';
-import { INITIAL_STATE, reducer, TezosState} from './reducer';
-import {TezosAction, TezosActionType} from './actions';
+import React, { createContext, useEffect, useReducer } from "react"
+import mixpanel from "mixpanel-browser"
+import { createTezos, createWallet, getTezosNetwork } from "./utils"
+import { INITIAL_STATE, reducer, TezosState } from "./reducer"
+import { TezosAction, TezosActionType } from "./actions"
interface TezosProvider {
- state: TezosState;
- dispatch: React.Dispatch;
+ state: TezosState
+ dispatch: React.Dispatch
}
export const TezosContext = createContext({
state: INITIAL_STATE,
// eslint-disable-next-line @typescript-eslint/no-empty-function
- dispatch: () => {},
-});
+ dispatch: () => {}
+})
const getSavedState = async (): Promise => {
try {
@@ -23,16 +23,16 @@ const getSavedState = async (): Promise => {
const activeAccount = await wallet.client.getActiveAccount()
if (!activeAccount?.address) {
- throw new Error ('No wallet address found')
+ throw new Error("No wallet address found")
}
- tezos.setProvider({ wallet });
+ tezos.setProvider({ wallet })
return {
network,
tezos,
wallet,
- account: activeAccount.address,
+ account: activeAccount.address
}
} catch (error) {
return INITIAL_STATE
@@ -40,25 +40,20 @@ const getSavedState = async (): Promise => {
}
export const TezosProvider: React.FC = ({ children }) => {
- const [state, dispatch] = useReducer(reducer, INITIAL_STATE);
+ const [state, dispatch] = useReducer(reducer, INITIAL_STATE)
useEffect(() => {
- mixpanel.register({'Network': state.network });
+ mixpanel.register({ Network: state.network })
}, [state.network])
useEffect(() => {
- getSavedState()
- .then((tezosState) => {
- dispatch({
- type: TezosActionType.UPDATE_TEZOS,
- payload: tezosState,
- });
+ getSavedState().then(tezosState => {
+ dispatch({
+ type: TezosActionType.UPDATE_TEZOS,
+ payload: tezosState
})
+ })
}, [])
- return (
-
- {children}
-
- );
-};
+ return {children}
+}
diff --git a/src/services/beacon/hooks/useTezos.ts b/src/services/beacon/hooks/useTezos.ts
index 6285bbe6..0cce94e5 100644
--- a/src/services/beacon/hooks/useTezos.ts
+++ b/src/services/beacon/hooks/useTezos.ts
@@ -1,78 +1,80 @@
-import { useQueryClient } from 'react-query';
-import { useCallback, useContext } from 'react';
-import { MichelCodecPacker, TezosToolkit } from '@taquito/taquito';
-import { connectWithBeacon, Network, rpcNodes, TezosActionType } from 'services/beacon';
-import { TezosContext } from 'services/beacon/context';
-import { Tzip16Module } from '@taquito/tzip16';
-import mixpanel from 'mixpanel-browser';
+import { useQueryClient } from "react-query"
+import { useCallback, useContext } from "react"
+import { MichelCodecPacker, TezosToolkit } from "@taquito/taquito"
+import { connectWithBeacon, Network, rpcNodes, TezosActionType } from "services/beacon"
+import { TezosContext } from "services/beacon/context"
+import { Tzip16Module } from "@taquito/tzip16"
+import mixpanel from "mixpanel-browser"
type WalletConnectReturn = {
- tezos: TezosToolkit;
- connect: () => Promise;
- changeNetwork: (newNetwork: Network) => void;
- reset: () => void;
- account: string;
- network: Network;
-};
+ tezos: TezosToolkit
+ connect: () => Promise
+ changeNetwork: (newNetwork: Network) => void
+ reset: () => void
+ account: string
+ network: Network
+}
export const useTezos = (): WalletConnectReturn => {
const {
state: { tezos, network, account, wallet },
- dispatch,
- } = useContext(TezosContext);
+ dispatch
+ } = useContext(TezosContext)
const queryClient = useQueryClient()
- const connect = useCallback(async (newNetwork?: Network) => {
- const { wallet } = await connectWithBeacon(newNetwork || network);
+ const connect = useCallback(
+ async (newNetwork?: Network) => {
+ const { wallet } = await connectWithBeacon(newNetwork || network)
- const newTezos = new TezosToolkit(rpcNodes[newNetwork || network]);
- newTezos.setPackerProvider(new MichelCodecPacker());
- newTezos.addExtension(new Tzip16Module());
+ const newTezos = new TezosToolkit(rpcNodes[newNetwork || network])
+ newTezos.setPackerProvider(new MichelCodecPacker())
+ newTezos.addExtension(new Tzip16Module())
- newTezos.setProvider({ wallet });
- const account = await newTezos.wallet.pkh();
+ newTezos.setProvider({ wallet })
+ const account = await newTezos.wallet.pkh()
- dispatch({
- type: TezosActionType.UPDATE_TEZOS,
- payload: {
- network: newNetwork || network,
- tezos: newTezos,
- account,
- wallet
- },
- });
+ dispatch({
+ type: TezosActionType.UPDATE_TEZOS,
+ payload: {
+ network: newNetwork || network,
+ tezos: newTezos,
+ account,
+ wallet
+ }
+ })
- mixpanel.identify(account)
+ mixpanel.identify(account)
- return newTezos;
- }, [dispatch, network]);
+ return newTezos
+ },
+ [dispatch, network]
+ )
return {
tezos,
connect,
reset: useCallback(async () => {
- if(!wallet) {
+ if (!wallet) {
throw new Error("No Wallet Connected")
}
-
+
await wallet.disconnect()
dispatch({
- type: TezosActionType.RESET_TEZOS,
- });
+ type: TezosActionType.RESET_TEZOS
+ })
}, [dispatch, wallet]),
changeNetwork: async (newNetwork: Network) => {
- mixpanel.register({'Network': newNetwork});
+ mixpanel.register({ Network: newNetwork })
- localStorage.setItem("homebase:network", newNetwork);
+ localStorage.setItem("homebase:network", newNetwork)
-
if (!("_pkh" in tezos.wallet)) {
- const Tezos = new TezosToolkit(rpcNodes[newNetwork]);
- Tezos.setPackerProvider(new MichelCodecPacker());
- Tezos.addExtension(new Tzip16Module());
-
+ const Tezos = new TezosToolkit(rpcNodes[newNetwork])
+ Tezos.setPackerProvider(new MichelCodecPacker())
+ Tezos.addExtension(new Tzip16Module())
+
dispatch({
type: TezosActionType.UPDATE_TEZOS,
payload: {
@@ -80,14 +82,14 @@ export const useTezos = (): WalletConnectReturn => {
tezos: Tezos,
account,
wallet: undefined
- },
- });
+ }
+ })
} else {
- await connect(newNetwork);
+ await connect(newNetwork)
}
queryClient.resetQueries()
},
account,
- network,
- };
-};
+ network
+ }
+}
diff --git a/src/services/beacon/index.ts b/src/services/beacon/index.ts
index 2a2e694f..26f9310e 100644
--- a/src/services/beacon/index.ts
+++ b/src/services/beacon/index.ts
@@ -1,5 +1,3 @@
-export * from './actions'
-export * from './context'
-export * from './utils'
-
-
+export * from "./actions"
+export * from "./context"
+export * from "./utils"
diff --git a/src/services/beacon/reducer.ts b/src/services/beacon/reducer.ts
index 079b9ca6..1a3f8047 100644
--- a/src/services/beacon/reducer.ts
+++ b/src/services/beacon/reducer.ts
@@ -1,12 +1,12 @@
-import {TezosToolkit} from '@taquito/taquito';
-import {BeaconWallet} from '@taquito/beacon-wallet';
-import {createTezos, getTezosNetwork, Network} from './utils';
-import {TezosAction, TezosActionType} from 'services/beacon/actions';
+import { TezosToolkit } from "@taquito/taquito"
+import { BeaconWallet } from "@taquito/beacon-wallet"
+import { createTezos, getTezosNetwork, Network } from "./utils"
+import { TezosAction, TezosActionType } from "services/beacon/actions"
export interface TezosState {
- network: Network;
- tezos: TezosToolkit;
- account: string;
+ network: Network
+ tezos: TezosToolkit
+ account: string
wallet: BeaconWallet | undefined
}
@@ -18,8 +18,8 @@ export const INITIAL_STATE: TezosState = {
network,
wallet: undefined,
// @TODO: refactor interface this is actually an address
- account: "",
-};
+ account: ""
+}
export const reducer = (state: TezosState, action: TezosAction): TezosState => {
switch (action.type) {
@@ -30,7 +30,7 @@ export const reducer = (state: TezosState, action: TezosAction): TezosState => {
network: action.payload.network,
account: action.payload.account,
wallet: action.payload.wallet
- };
+ }
case TezosActionType.RESET_TEZOS:
return {
...state,
@@ -39,4 +39,4 @@ export const reducer = (state: TezosState, action: TezosAction): TezosState => {
wallet: undefined
}
}
-};
+}
diff --git a/src/services/beacon/utils.ts b/src/services/beacon/utils.ts
index c0054f0d..c734f0ea 100644
--- a/src/services/beacon/utils.ts
+++ b/src/services/beacon/utils.ts
@@ -1,26 +1,26 @@
-import { NetworkType } from "@airgap/beacon-types";
-import { BeaconWallet } from "@taquito/beacon-wallet";
-import { MichelCodecPacker, TezosToolkit } from "@taquito/taquito";
-import { Tzip16Module } from "@taquito/tzip16";
-import { EnvKey, getEnv } from 'services/config';
+import { NetworkType } from "@airgap/beacon-types"
+import { BeaconWallet } from "@taquito/beacon-wallet"
+import { MichelCodecPacker, TezosToolkit } from "@taquito/taquito"
+import { Tzip16Module } from "@taquito/tzip16"
+import { EnvKey, getEnv } from "services/config"
export type Network = "mainnet" | "ghostnet"
export const rpcNodes: Record = {
mainnet: "https://mainnet.smartpy.io",
ghostnet: "https://ghostnet.ecadinfra.com"
-};
+}
export const getTezosNetwork = (): Network => {
const storageNetwork = window.localStorage.getItem("homebase:network")
- if(storageNetwork) {
+ if (storageNetwork) {
return storageNetwork as Network
}
const envNetwork = getEnv(EnvKey.REACT_APP_NETWORK).toString().toLowerCase() as Network
- if(!envNetwork) {
+ if (!envNetwork) {
throw new Error("No Network ENV set")
}
@@ -29,45 +29,46 @@ export const getTezosNetwork = (): Network => {
return envNetwork
}
-export const createWallet = () => new BeaconWallet({
- name: "Homebase",
- iconUrl: "https://tezostaquito.io/img/favicon.png",
-})
-
-export const createTezos = (network: Network) => {
- const tezos = new TezosToolkit(rpcNodes[network]);
- tezos.setPackerProvider(new MichelCodecPacker());
- tezos.addExtension(new Tzip16Module());
- return tezos;
+export const createWallet = () =>
+ new BeaconWallet({
+ name: "Homebase",
+ iconUrl: "https://tezostaquito.io/img/favicon.png"
+ })
+
+export const createTezos = (network: Network) => {
+ const tezos = new TezosToolkit(rpcNodes[network])
+ tezos.setPackerProvider(new MichelCodecPacker())
+ tezos.addExtension(new Tzip16Module())
+ return tezos
}
export const getNetworkTypeByEnvNetwork = (envNetwork: Network): NetworkType => {
- switch (envNetwork) {
+ switch (envNetwork) {
case "ghostnet":
- return NetworkType.GHOSTNET;
+ return NetworkType.GHOSTNET
case "mainnet":
- return NetworkType.MAINNET;
+ return NetworkType.MAINNET
default:
- return NetworkType.MAINNET;
+ return NetworkType.MAINNET
}
}
export const connectWithBeacon = async (
envNetwork: Network
): Promise<{
- network: Network;
- wallet: BeaconWallet;
+ network: Network
+ wallet: BeaconWallet
}> => {
- const networkType = getNetworkTypeByEnvNetwork(envNetwork);
- const wallet = createWallet();
+ const networkType = getNetworkTypeByEnvNetwork(envNetwork)
+ const wallet = createWallet()
await wallet.requestPermissions({
network: {
- type: networkType,
- },
- });
+ type: networkType
+ }
+ })
const accounts: any[] = JSON.parse(localStorage.getItem("beacon:accounts") as string)
@@ -77,4 +78,4 @@ export const connectWithBeacon = async (
network,
wallet
}
-};
+}
diff --git a/src/services/config/constants.ts b/src/services/config/constants.ts
index fae24067..c8c19b24 100644
--- a/src/services/config/constants.ts
+++ b/src/services/config/constants.ts
@@ -13,4 +13,3 @@ export enum EnvKey {
export enum FeatureFlag {
lambdaDao = "lambdaDao"
}
-
diff --git a/src/services/config/env.ts b/src/services/config/env.ts
index 2407d2ad..fc981cde 100644
--- a/src/services/config/env.ts
+++ b/src/services/config/env.ts
@@ -1,4 +1,4 @@
-import { EnvKey } from './constants';
+import { EnvKey } from "./constants"
export const getEnv = (envKey: EnvKey): string => {
return process.env[envKey] ?? ""
diff --git a/src/services/config/hooks/featureFlags.ts b/src/services/config/hooks/featureFlags.ts
index 6b9f93c0..084cef30 100644
--- a/src/services/config/hooks/featureFlags.ts
+++ b/src/services/config/hooks/featureFlags.ts
@@ -1,5 +1,5 @@
-import { useFlags } from 'launchdarkly-react-client-sdk';
-import { FeatureFlag } from 'services/config/constants';
+import { useFlags } from "launchdarkly-react-client-sdk"
+import { FeatureFlag } from "services/config/constants"
export const useFeatureFlag = (featureFlag: FeatureFlag) => {
const flags = useFlags()
diff --git a/src/services/config/hooks/index.ts b/src/services/config/hooks/index.ts
index a8985507..4734e37c 100644
--- a/src/services/config/hooks/index.ts
+++ b/src/services/config/hooks/index.ts
@@ -1 +1 @@
-export * from './featureFlags'
+export * from "./featureFlags"
diff --git a/src/services/config/index.ts b/src/services/config/index.ts
index dc6fcfff..021be719 100644
--- a/src/services/config/index.ts
+++ b/src/services/config/index.ts
@@ -1,3 +1,3 @@
-export * from './constants'
-export * from './env'
-export * from './hooks'
+export * from "./constants"
+export * from "./env"
+export * from "./hooks"
diff --git a/src/services/contracts/baseDAO/class.ts b/src/services/contracts/baseDAO/class.ts
index 3d3198d7..0d6043bf 100644
--- a/src/services/contracts/baseDAO/class.ts
+++ b/src/services/contracts/baseDAO/class.ts
@@ -1,166 +1,161 @@
-import { ContractAbstraction, TezosToolkit, TransactionWalletOperation, Wallet } from "@taquito/taquito";
-import { DAOTemplate, MigrationParams } from "modules/creator/state";
-import { Network } from "services/beacon";
-import { ConfigProposalParams, fromStateToBaseStorage, getContract } from ".";
-import { MetadataDeploymentResult } from "../metadataCarrier/deploy";
-import { generateStorageContract } from "services/baseDAODocker";
-import baseDAOContractCode from "./michelson/baseDAO";
-import {formatUnits, xtzToMutez} from "../utils";
-import {BigNumber} from "bignumber.js";
-import {Token} from "models/Token";
-import {Ledger} from "services/indexer/types";
-import {Expr, Parser} from "@taquito/michel-codec";
-import {Schema} from "@taquito/michelson-encoder";
+import { ContractAbstraction, TezosToolkit, TransactionWalletOperation, Wallet } from "@taquito/taquito"
+import { DAOTemplate, MigrationParams } from "modules/creator/state"
+import { Network } from "services/beacon"
+import { ConfigProposalParams, fromStateToBaseStorage, getContract } from "."
+import { MetadataDeploymentResult } from "../metadataCarrier/deploy"
+import { generateStorageContract } from "services/baseDAODocker"
+import baseDAOContractCode from "./michelson/baseDAO"
+import { formatUnits, xtzToMutez } from "../utils"
+import { BigNumber } from "bignumber.js"
+import { Token } from "models/Token"
+import { Ledger } from "services/indexer/types"
+import { Expr, Parser } from "@taquito/michel-codec"
+import { Schema } from "@taquito/michelson-encoder"
import proposeCode from "./registryDAO/michelson/propose"
interface DeployParams {
- params: MigrationParams;
- metadata: MetadataDeploymentResult;
- tezos: TezosToolkit;
- network: Network;
+ params: MigrationParams
+ metadata: MetadataDeploymentResult
+ tezos: TezosToolkit
+ network: Network
}
-export type CycleType = "voting" | "proposing";
+export type CycleType = "voting" | "proposing"
export interface CycleInfo {
- blocksLeft: number;
- currentCycle: number;
- currentLevel: number;
- timeEstimateForNextBlock: number;
- type: CycleType;
+ blocksLeft: number
+ currentCycle: number
+ currentLevel: number
+ timeEstimateForNextBlock: number
+ type: CycleType
}
export interface BaseDAOData {
- id: number;
- admin: string;
- address: string;
- frozen_token_id: number;
- token: Token;
- guardian: string;
- ledger: Ledger[];
- max_proposals: string;
- max_quorum_change: string;
- max_quorum_threshold: string;
- min_quorum_threshold: string;
- period: string;
- proposal_expired_level: string;
- proposal_flush_level: string;
- quorum_change: string;
- last_updated_cycle: string;
- quorum_threshold: BigNumber;
- staked: string;
- start_level: number;
- name: string;
- description: string;
- type: DAOTemplate;
- network: Network;
+ id: number
+ admin: string
+ address: string
+ frozen_token_id: number
+ token: Token
+ guardian: string
+ ledger: Ledger[]
+ max_proposals: string
+ max_quorum_change: string
+ max_quorum_threshold: string
+ min_quorum_threshold: string
+ period: string
+ proposal_expired_level: string
+ proposal_flush_level: string
+ quorum_change: string
+ last_updated_cycle: string
+ quorum_threshold: BigNumber
+ staked: string
+ start_level: number
+ name: string
+ description: string
+ type: DAOTemplate
+ network: Network
extra: {
- frozen_extra_value: string;
- };
+ frozen_extra_value: string
+ }
}
export abstract class BaseDAO {
public static baseDeploy = async (
template: DAOTemplate,
- {params, metadata, tezos, network}: DeployParams
+ { params, metadata, tezos, network }: DeployParams
): Promise> => {
- const treasuryParams = fromStateToBaseStorage(params);
+ const treasuryParams = fromStateToBaseStorage(params)
if (!metadata.deployAddress) {
- throw new Error("Error deploying treasury DAO: There's not address of metadata");
+ throw new Error("Error deploying treasury DAO: There's not address of metadata")
}
- const account = await tezos.wallet.pkh();
+ const account = await tezos.wallet.pkh()
try {
- console.log("Making storage contract...");
+ console.log("Making storage contract...")
const storageCode = await generateStorageContract({
network,
template,
storage: treasuryParams,
originatorAddress: account,
- metadata,
- });
- console.log("Originating DAO contract...");
+ metadata
+ })
+ console.log("Originating DAO contract...")
- console.log(baseDAOContractCode);
- console.log(treasuryParams);
- console.log(storageCode);
+ console.log(baseDAOContractCode)
+ console.log(treasuryParams)
+ console.log(storageCode)
const t = tezos.wallet.originate({
code: baseDAOContractCode,
- init: storageCode,
- });
+ init: storageCode
+ })
- const operation = await t.send();
- console.log("Waiting for confirmation on DAO contract...", t);
- const {address} = await operation.contract();
+ const operation = await t.send()
+ console.log("Waiting for confirmation on DAO contract...", t)
+ const { address } = await operation.contract()
- return await tezos.wallet.at(address);
+ return await tezos.wallet.at(address)
} catch (e) {
- console.log("error ", e);
- throw new Error("Error deploying DAO");
+ console.log("error ", e)
+ throw new Error("Error deploying DAO")
}
- };
-
- protected constructor(public data: BaseDAOData) {
}
- public flush = async (
- numerOfProposalsToFlush: number,
- expiredProposalIds: string[],
- tezos: TezosToolkit
- ) => {
- const daoContract = await getContract(tezos, this.data.address);
+ protected constructor(public data: BaseDAOData) {}
+
+ public flush = async (numerOfProposalsToFlush: number, expiredProposalIds: string[], tezos: TezosToolkit) => {
+ const daoContract = await getContract(tezos, this.data.address)
const initialBatch = await tezos.wallet.batch()
const batch = expiredProposalIds.reduce((prev, current) => {
return prev.withContractCall(daoContract.methods.drop_proposal(current))
}, initialBatch)
- batch.withContractCall(daoContract.methods.flush(numerOfProposalsToFlush));
+ batch.withContractCall(daoContract.methods.flush(numerOfProposalsToFlush))
- return await batch.send();
- };
+ return await batch.send()
+ }
public dropProposal = async (proposalId: string, tezos: TezosToolkit) => {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
- return await contract.methods.drop_proposal(proposalId).send();
- };
+ return await contract.methods.drop_proposal(proposalId).send()
+ }
public dropAllExpired = async (expiredProposalIds: string[], tezos: TezosToolkit) => {
- const daoContract = await getContract(tezos, this.data.address);
+ const daoContract = await getContract(tezos, this.data.address)
const initialBatch = await tezos.wallet.batch()
const batch = expiredProposalIds.reduce((prev, current) => {
return prev.withContractCall(daoContract.methods.drop_proposal(current))
}, initialBatch)
- return await batch.send();
+ return await batch.send()
}
public sendXtz = async (xtzAmount: BigNumber, tezos: TezosToolkit) => {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
return await contract.methods.callCustom("receive_xtz", "").send({
amount: xtzToMutez(xtzAmount).toNumber(),
- mutez: true,
- });
- };
+ mutez: true
+ })
+ }
public vote = async ({
- proposalKey,
- amount,
- support,
- tezos,
- }: {
- proposalKey: string;
- amount: BigNumber;
- support: boolean;
- tezos: TezosToolkit;
+ proposalKey,
+ amount,
+ support,
+ tezos
+ }: {
+ proposalKey: string
+ amount: BigNumber
+ support: boolean
+ tezos: TezosToolkit
}) => {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
return await contract.methods
.vote([
{
@@ -168,17 +163,17 @@ export abstract class BaseDAO {
from: await tezos.wallet.pkh(),
proposal_key: proposalKey,
vote_type: support,
- vote_amount: formatUnits(amount, this.data.token.decimals).toString(),
- },
- },
+ vote_amount: formatUnits(amount, this.data.token.decimals).toString()
+ }
+ }
])
- .send();
- };
+ .send()
+ }
public freeze = async (amount: BigNumber, tezos: TezosToolkit) => {
- const daoContract = await getContract(tezos, this.data.address);
- const govTokenContract = await getContract(tezos, this.data.token.contract);
- const tokenMetadata = this.data.token;
+ const daoContract = await getContract(tezos, this.data.address)
+ const govTokenContract = await getContract(tezos, this.data.token.contract)
+ const tokenMetadata = this.data.token
const batch = await tezos.wallet
.batch()
.withContractCall(
@@ -187,9 +182,9 @@ export abstract class BaseDAO {
add_operator: {
owner: await tezos.wallet.pkh(),
operator: this.data.address,
- token_id: this.data.token.token_id,
- },
- },
+ token_id: this.data.token.token_id
+ }
+ }
])
)
.withContractCall(daoContract.methods.freeze(formatUnits(amount, tokenMetadata.decimals).toString()))
@@ -199,75 +194,81 @@ export abstract class BaseDAO {
remove_operator: {
owner: await tezos.wallet.pkh(),
operator: this.data.address,
- token_id: this.data.token.token_id,
- },
- },
+ token_id: this.data.token.token_id
+ }
+ }
])
- );
+ )
- return await batch.send();
- };
+ return await batch.send()
+ }
public unfreeze = async (amount: BigNumber, tezos: TezosToolkit) => {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
- return await contract.methods
- .unfreeze(formatUnits(amount, this.data.token.decimals).toString())
- .send();
- };
+ return await contract.methods.unfreeze(formatUnits(amount, this.data.token.decimals).toString()).send()
+ }
public unstakeVotes = async (proposalId: string, tezos: TezosToolkit) => {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
- return await contract.methods
- .unstake_vote([proposalId])
- .send();
- };
+ return await contract.methods.unstake_vote([proposalId]).send()
+ }
static async encodeProposalMetadata(dataToEncode: any, michelsonSchemaString: string, tezos: TezosToolkit) {
- const parser = new Parser();
+ const parser = new Parser()
- const michelsonType = parser.parseData(michelsonSchemaString);
- const schema = new Schema(michelsonType as Expr);
- const data = schema.Encode(dataToEncode);
+ const michelsonType = parser.parseData(michelsonSchemaString)
+ const schema = new Schema(michelsonType as Expr)
+ const data = schema.Encode(dataToEncode)
- const {packed} = await tezos.rpc.packData({
+ const { packed } = await tezos.rpc.packData({
data,
- type: michelsonType as Expr,
- });
+ type: michelsonType as Expr
+ })
- return packed;
+ return packed
}
public async proposeConfigChange(configParams: ConfigProposalParams, tezos: TezosToolkit) {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
- let formatted_frozen_extra_value: string | undefined;
+ let formatted_frozen_extra_value: string | undefined
if (configParams.frozen_extra_value) {
- formatted_frozen_extra_value = formatUnits(new BigNumber(configParams.frozen_extra_value.toString()), this.data.token.decimals).toString()
+ formatted_frozen_extra_value = formatUnits(
+ new BigNumber(configParams.frozen_extra_value.toString()),
+ this.data.token.decimals
+ ).toString()
}
-
- const proposalMetadata = await BaseDAO.encodeProposalMetadata({
- configuration_proposal: {
- frozen_extra_value: formatted_frozen_extra_value,
- slash_scale_value: configParams.slash_scale_value
- }},
+
+ const proposalMetadata = await BaseDAO.encodeProposalMetadata(
+ {
+ configuration_proposal: {
+ frozen_extra_value: formatted_frozen_extra_value,
+ slash_scale_value: configParams.slash_scale_value
+ }
+ },
proposeCode,
tezos
- );
-
+ )
const contractMethod = contract.methods.propose(
await tezos.wallet.pkh(),
formatUnits(new BigNumber(this.data.extra.frozen_extra_value), this.data.token.decimals),
proposalMetadata
- );
+ )
- return await contractMethod.send();
+ return await contractMethod.send()
}
- public abstract proposeGuardianChange(newGuardianAddress: string, tezos: TezosToolkit): Promise
- public abstract proposeDelegationChange(newGuardianAddress: string, tezos: TezosToolkit): Promise
- public abstract propose(...args: any[]): Promise;
+ public abstract proposeGuardianChange(
+ newGuardianAddress: string,
+ tezos: TezosToolkit
+ ): Promise
+ public abstract proposeDelegationChange(
+ newGuardianAddress: string,
+ tezos: TezosToolkit
+ ): Promise
+ public abstract propose(...args: any[]): Promise
}
diff --git a/src/services/contracts/baseDAO/hooks/useBlockchainInfo.ts b/src/services/contracts/baseDAO/hooks/useBlockchainInfo.ts
index 78a0fb45..e86eb701 100644
--- a/src/services/contracts/baseDAO/hooks/useBlockchainInfo.ts
+++ b/src/services/contracts/baseDAO/hooks/useBlockchainInfo.ts
@@ -1,11 +1,9 @@
-import {getNetworkStats} from "../../../bakingBad/stats";
-import { useQuery } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import {BlockchainStats} from "../../../bakingBad/stats/types";
+import { getNetworkStats } from "../../../bakingBad/stats"
+import { useQuery } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BlockchainStats } from "../../../bakingBad/stats/types"
export const useBlockchainInfo = () => {
- const { network } = useTezos();
- return useQuery(
- ["blockchainStats", network],
- () => getNetworkStats(network))
-}
\ No newline at end of file
+ const { network } = useTezos()
+ return useQuery(["blockchainStats", network], () => getNetworkStats(network))
+}
diff --git a/src/services/contracts/baseDAO/hooks/useCycleInfo.ts b/src/services/contracts/baseDAO/hooks/useCycleInfo.ts
index ae8cbe60..dda0e2b6 100644
--- a/src/services/contracts/baseDAO/hooks/useCycleInfo.ts
+++ b/src/services/contracts/baseDAO/hooks/useCycleInfo.ts
@@ -1,14 +1,14 @@
-import { useMemo } from "react";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
+import { useMemo } from "react"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
export const useIsProposalButtonDisabled = (daoId: string) => {
- const { cycleInfo } = useDAO(daoId);
+ const { cycleInfo } = useDAO(daoId)
return useMemo(() => {
if (cycleInfo && cycleInfo.type === "voting") {
- return true;
+ return true
}
- return false;
- }, [cycleInfo]);
-};
+ return false
+ }, [cycleInfo])
+}
diff --git a/src/services/contracts/baseDAO/hooks/useDAOHoldings.ts b/src/services/contracts/baseDAO/hooks/useDAOHoldings.ts
index 37bb4d07..21f7240f 100644
--- a/src/services/contracts/baseDAO/hooks/useDAOHoldings.ts
+++ b/src/services/contracts/baseDAO/hooks/useDAOHoldings.ts
@@ -1,45 +1,45 @@
-import { BaseDAO } from "..";
-import { useQuery } from "react-query";
-import { DAOHolding, getDAOBalances, NFTDAOHolding } from "services/bakingBad/tokenBalances";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { useMemo } from "react";
-import { NFT } from "models/Token";
+import { BaseDAO } from ".."
+import { useQuery } from "react-query"
+import { DAOHolding, getDAOBalances, NFTDAOHolding } from "services/bakingBad/tokenBalances"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { useMemo } from "react"
+import { NFT } from "models/Token"
export const useDAOHoldings = (contractAddress: string) => {
- const { data: dao } = useDAO(contractAddress);
- const { network } = useTezos();
+ const { data: dao } = useDAO(contractAddress)
+ const { network } = useTezos()
const { data, ...rest } = useQuery(
["balances", contractAddress],
async () => {
- return await getDAOBalances((dao as BaseDAO).data.address, network);
+ return await getDAOBalances((dao as BaseDAO).data.address, network)
},
{
- enabled: !!dao,
+ enabled: !!dao
}
- );
+ )
const nfts = useMemo(() => {
if (!data) {
- return [];
+ return []
}
- return data.filter((holding) => holding.token instanceof NFT && holding.balance.isGreaterThan(0)) as NFTDAOHolding[];
- }, [data]);
+ return data.filter(holding => holding.token instanceof NFT && holding.balance.isGreaterThan(0)) as NFTDAOHolding[]
+ }, [data])
const tokens = useMemo(() => {
if (!data) {
- return [];
+ return []
}
- return data.filter((holding) => !(holding.token instanceof NFT));
- }, [data]);
+ return data.filter(holding => !(holding.token instanceof NFT))
+ }, [data])
return {
tokenHoldings: tokens,
nftHoldings: nfts,
data,
- ...rest,
- };
-};
+ ...rest
+ }
+}
diff --git a/src/services/contracts/baseDAO/hooks/useDelegate.ts b/src/services/contracts/baseDAO/hooks/useDelegate.ts
index 55650011..cefe3356 100644
--- a/src/services/contracts/baseDAO/hooks/useDelegate.ts
+++ b/src/services/contracts/baseDAO/hooks/useDelegate.ts
@@ -1,17 +1,17 @@
-import { useQuery } from "react-query";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { getLatestDelegation } from "services/bakingBad/delegations";
+import { useQuery } from "react-query"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { getLatestDelegation } from "services/bakingBad/delegations"
export const useDelegate = (contractAddress: string) => {
- const { data: dao } = useDAO(contractAddress);
- const { tezos, network } = useTezos();
+ const { data: dao } = useDAO(contractAddress)
+ const { tezos, network } = useTezos()
const result = useQuery<{ address: string; alias?: string } | null, Error>(
["daoDelegate", contractAddress],
async () => {
- const latestDelegation = await getLatestDelegation(contractAddress, network);
-
+ const latestDelegation = await getLatestDelegation(contractAddress, network)
+
if (!latestDelegation) {
return null
}
@@ -19,9 +19,9 @@ export const useDelegate = (contractAddress: string) => {
return latestDelegation.newDelegate
},
{
- enabled: !!dao && !!tezos,
+ enabled: !!dao && !!tezos
}
- );
+ )
- return result;
-};
+ return result
+}
diff --git a/src/services/contracts/baseDAO/hooks/useDropAllExpired.ts b/src/services/contracts/baseDAO/hooks/useDropAllExpired.ts
index f886aada..dec5d635 100644
--- a/src/services/contracts/baseDAO/hooks/useDropAllExpired.ts
+++ b/src/services/contracts/baseDAO/hooks/useDropAllExpired.ts
@@ -1,62 +1,54 @@
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import {networkNameMap} from "../../../bakingBad";
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { networkNameMap } from "../../../bakingBad"
export const useDropAllExpired = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
- return useMutation<
- any | Error,
- Error,
- { dao: BaseDAO; expiredProposalIds: string[] }
- >(
- async (params) => {
- const { key: dropNotification, closeSnackbar: closeFlushNotification } =
- openNotification({
- message: "Please sign the transaction to drop all expired proposals",
- persist: true,
- variant: "info",
- });
+ return useMutation(
+ async params => {
+ const { key: dropNotification, closeSnackbar: closeFlushNotification } = openNotification({
+ message: "Please sign the transaction to drop all expired proposals",
+ persist: true,
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await params.dao.dropAllExpired(
- params.expiredProposalIds,
- tezosToolkit
- );
- closeFlushNotification(dropNotification);
+ const data = await params.dao.dropAllExpired(params.expiredProposalIds, tezosToolkit)
+ closeFlushNotification(dropNotification)
- await data.confirmation(1);
+ await data.confirmation(1)
openNotification({
message: "Execute transaction confirmed!",
autoHideDuration: 5000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
- return data;
+ return data
} catch (e) {
- closeFlushNotification(dropNotification);
+ closeFlushNotification(dropNotification)
openNotification({
message: "An error has happened with execute transaction!",
variant: "error",
- autoHideDuration: 5000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 5000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
\ No newline at end of file
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useDropProposal.ts b/src/services/contracts/baseDAO/hooks/useDropProposal.ts
index 509d96fc..b86d0a33 100644
--- a/src/services/contracts/baseDAO/hooks/useDropProposal.ts
+++ b/src/services/contracts/baseDAO/hooks/useDropProposal.ts
@@ -1,63 +1,55 @@
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import {networkNameMap} from "../../../bakingBad";
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { networkNameMap } from "../../../bakingBad"
export const useDropProposal = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, connect, account } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, connect, account } = useTezos()
- return useMutation<
- TransactionWalletOperation | Error,
- Error,
- { dao: BaseDAO; proposalId: string }
- >(
- async (params) => {
- const { key: dropProposal, closeSnackbar: closeDropProposal } =
- openNotification({
- message: "Please sign the transaction to drop proposal",
- persist: true,
- variant: "info",
- });
+ return useMutation(
+ async params => {
+ const { key: dropProposal, closeSnackbar: closeDropProposal } = openNotification({
+ message: "Please sign the transaction to drop proposal",
+ persist: true,
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await params.dao.dropProposal(
- params.proposalId,
- tezosToolkit
- );
- closeDropProposal(dropProposal);
+ const data = await params.dao.dropProposal(params.proposalId, tezosToolkit)
+ closeDropProposal(dropProposal)
- await data.confirmation(1);
+ await data.confirmation(1)
openNotification({
message: "Drop proposal transaction confirmed!",
autoHideDuration: 5000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
- return data;
+ return data
} catch (e) {
- closeDropProposal(dropProposal);
+ closeDropProposal(dropProposal)
openNotification({
message: "An error has happened with drop proposal transaction!",
variant: "error",
- autoHideDuration: 5000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 5000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useFlush.ts b/src/services/contracts/baseDAO/hooks/useFlush.ts
index 04a71dc5..1d3c40af 100644
--- a/src/services/contracts/baseDAO/hooks/useFlush.ts
+++ b/src/services/contracts/baseDAO/hooks/useFlush.ts
@@ -1,63 +1,54 @@
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import {networkNameMap} from "../../../bakingBad";
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { networkNameMap } from "../../../bakingBad"
export const useFlush = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
- return useMutation<
- any | Error,
- Error,
- { dao: BaseDAO; numOfProposalsToFlush: number, expiredProposalIds: string[] }
- >(
- async (params) => {
- const { key: flushNotification, closeSnackbar: closeFlushNotification } =
- openNotification({
- message: "Please sign the transaction to flush",
- persist: true,
- variant: "info",
- });
+ return useMutation(
+ async params => {
+ const { key: flushNotification, closeSnackbar: closeFlushNotification } = openNotification({
+ message: "Please sign the transaction to flush",
+ persist: true,
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await params.dao.flush(
- params.numOfProposalsToFlush,
- params.expiredProposalIds,
- tezosToolkit
- );
- closeFlushNotification(flushNotification);
+ const data = await params.dao.flush(params.numOfProposalsToFlush, params.expiredProposalIds, tezosToolkit)
+ closeFlushNotification(flushNotification)
- await data.confirmation(1);
+ await data.confirmation(1)
openNotification({
message: "Execute transaction confirmed!",
autoHideDuration: 5000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
- return data;
+ return data
} catch (e) {
- closeFlushNotification(flushNotification);
+ closeFlushNotification(flushNotification)
openNotification({
message: "An error has happened with execute transaction!",
variant: "error",
- autoHideDuration: 5000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 5000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useFreeze.ts b/src/services/contracts/baseDAO/hooks/useFreeze.ts
index da261507..8c95cb5a 100644
--- a/src/services/contracts/baseDAO/hooks/useFreeze.ts
+++ b/src/services/contracts/baseDAO/hooks/useFreeze.ts
@@ -1,79 +1,68 @@
-import BigNumber from "bignumber.js";
-import mixpanel from "mixpanel-browser";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import {networkNameMap} from "../../../bakingBad";
+import BigNumber from "bignumber.js"
+import mixpanel from "mixpanel-browser"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { networkNameMap } from "../../../bakingBad"
interface Params {
- dao: BaseDAO;
- amount: BigNumber;
- freeze: boolean;
+ dao: BaseDAO
+ amount: BigNumber
+ freeze: boolean
}
export const useFreeze = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
return useMutation(
- async (params) => {
- const {
- key: freezeNotification,
- closeSnackbar: closeFreezeNotification,
- } = openNotification({
- message: `${
- params.freeze ? "Deposit" : "Withdrawal"
- } is being processed...`,
+ async params => {
+ const { key: freezeNotification, closeSnackbar: closeFreezeNotification } = openNotification({
+ message: `${params.freeze ? "Deposit" : "Withdrawal"} is being processed...`,
persist: true,
- variant: "info",
- });
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await (params.dao as BaseDAO)[
- params.freeze ? "freeze" : "unfreeze"
- ](params.amount, tezosToolkit);
+ const data = await (params.dao as BaseDAO)[params.freeze ? "freeze" : "unfreeze"](params.amount, tezosToolkit)
- mixpanel.track(`Tokens ${params.freeze? "Deposited": "Withdrawn"}`, {
+ mixpanel.track(`Tokens ${params.freeze ? "Deposited" : "Withdrawn"}`, {
dao: params.dao.data.address,
amount: params.amount
})
- await data.confirmation(1);
+ await data.confirmation(1)
- closeFreezeNotification(freezeNotification);
+ closeFreezeNotification(freezeNotification)
openNotification({
- message: `${
- params.freeze ? "Deposit" : "Withdrawal"
- } transaction confirmed!`,
+ message: `${params.freeze ? "Deposit" : "Withdrawal"} transaction confirmed!`,
autoHideDuration: 10000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
} catch (e) {
- console.log(e);
- closeFreezeNotification(freezeNotification);
+ console.log(e)
+ closeFreezeNotification(freezeNotification)
openNotification({
- message: `An error has happened with ${
- params.freeze ? "deposit" : "withdrawal"
- } transaction!`,
+ message: `An error has happened with ${params.freeze ? "deposit" : "withdrawal"} transaction!`,
variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useOriginate.ts b/src/services/contracts/baseDAO/hooks/useOriginate.ts
index ed7e7695..8959c839 100644
--- a/src/services/contracts/baseDAO/hooks/useOriginate.ts
+++ b/src/services/contracts/baseDAO/hooks/useOriginate.ts
@@ -1,89 +1,80 @@
-import { OriginateParams } from "../types";
-import { DAOTemplate } from "../../../../modules/creator/state/types";
-import { useState } from "react";
-import {
- ContractAbstraction,
- ContractProvider,
- Wallet,
-} from "@taquito/taquito";
-import { useMutation, useQueryClient } from "react-query";
-
-import { deployMetadataCarrier } from "services/contracts/metadataCarrier/deploy";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import { getDAO } from "services/indexer/dao/services";
-import mixpanel from "mixpanel-browser";
+import { OriginateParams } from "../types"
+import { DAOTemplate } from "../../../../modules/creator/state/types"
+import { useState } from "react"
+import { ContractAbstraction, ContractProvider, Wallet } from "@taquito/taquito"
+import { useMutation, useQueryClient } from "react-query"
+
+import { deployMetadataCarrier } from "services/contracts/metadataCarrier/deploy"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { getDAO } from "services/indexer/dao/services"
+import mixpanel from "mixpanel-browser"
const INITIAL_STATES = [
{
activeText: "",
- completedText: "",
+ completedText: ""
},
{
activeText: "",
- completedText: "",
+ completedText: ""
},
{
activeText: "",
- completedText: "",
- },
-];
+ completedText: ""
+ }
+]
const waitForIndexation = async (contractAddress: string) => {
return new Promise(async (resolve, reject) => {
- let tries = 0;
+ let tries = 0
const tryDAOIndexation = async () => {
- const response = await getDAO(contractAddress);
+ const response = await getDAO(contractAddress)
if (response.daos.length > 0) {
- resolve(true);
-
+ resolve(true)
} else {
if (tries > 12) {
- console.log(`DAO indexation timed out`);
- reject(false);
+ console.log(`DAO indexation timed out`)
+ reject(false)
}
- console.log(`Verifying DAO indexation, trial #${tries + 1}`);
+ console.log(`Verifying DAO indexation, trial #${tries + 1}`)
- tries++;
+ tries++
- setTimeout(async () => await tryDAOIndexation(), 10000);
+ setTimeout(async () => await tryDAOIndexation(), 10000)
}
- };
+ }
- await tryDAOIndexation();
- });
-};
+ await tryDAOIndexation()
+ })
+}
export const useOriginate = (template: DAOTemplate) => {
- const queryClient = useQueryClient();
- const [states, setStates] = useState(INITIAL_STATES);
+ const queryClient = useQueryClient()
+ const [states, setStates] = useState(INITIAL_STATES)
- const [activeState, setActiveState] = useState();
- const { tezos, connect, network, account } = useTezos();
+ const [activeState, setActiveState] = useState()
+ const { tezos, connect, network, account } = useTezos()
- const result = useMutation<
- ContractAbstraction,
- Error,
- OriginateParams
- >(
+ const result = useMutation, Error, OriginateParams>(
async ({ metadataParams, params }) => {
- const updatedStates = INITIAL_STATES;
+ const updatedStates = INITIAL_STATES
updatedStates[0] = {
activeText: "Deploying Metadata Carrier Contract",
- completedText: "",
- };
+ completedText: ""
+ }
- setActiveState(0);
- setStates(updatedStates);
+ setActiveState(0)
+ setStates(updatedStates)
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
mixpanel.track("Started DAO origination", {
@@ -95,27 +86,25 @@ export const useOriginate = (template: DAOTemplate) => {
const metadata = await deployMetadataCarrier({
...metadataParams,
tezos: tezosToolkit,
- connect,
- });
+ connect
+ })
if (!metadata) {
- throw new Error(
- `Could not deploy ${template}DAO because MetadataCarrier contract deployment failed`
- );
+ throw new Error(`Could not deploy ${template}DAO because MetadataCarrier contract deployment failed`)
}
updatedStates[0] = {
...updatedStates[0],
- completedText: `Deployed Metadata Carrier with address "${metadata.deployAddress}" and key "${metadata.keyName}"`,
- };
+ completedText: `Deployed Metadata Carrier with address "${metadata.deployAddress}" and key "${metadata.keyName}"`
+ }
updatedStates[1] = {
activeText: `Deploying ${template} DAO Contract`,
- completedText: "",
- };
+ completedText: ""
+ }
- setActiveState(1);
- setStates(updatedStates);
+ setActiveState(1)
+ setStates(updatedStates)
mixpanel.track("Started DAO origination", {
contract: "BaseDAO",
@@ -128,25 +117,25 @@ export const useOriginate = (template: DAOTemplate) => {
tezos: tezosToolkit,
metadata,
params,
- network,
- });
+ network
+ })
if (!contract) {
- throw new Error(`Error deploying ${template}DAO`);
+ throw new Error(`Error deploying ${template}DAO`)
}
updatedStates[1] = {
...updatedStates[1],
- completedText: `Deployed ${template} DAO contract with address "${contract.address}"`,
- };
+ completedText: `Deployed ${template} DAO contract with address "${contract.address}"`
+ }
updatedStates[2] = {
activeText: `Waiting for DAO to be indexed`,
- completedText: "",
- };
+ completedText: ""
+ }
- setActiveState(2);
- setStates(updatedStates);
+ setActiveState(2)
+ setStates(updatedStates)
mixpanel.track("Completed DAO creation", {
daoName: params.orgSettings.name,
@@ -158,33 +147,33 @@ export const useOriginate = (template: DAOTemplate) => {
daoType: params.template
})
- const indexed = await waitForIndexation(contract.address);
+ const indexed = await waitForIndexation(contract.address)
updatedStates[2] = {
...updatedStates[2],
completedText: indexed
? `Deployed ${metadataParams.metadata.unfrozenToken.name} successfully`
- : `Deployed ${metadataParams.metadata.unfrozenToken.name} successfully, but metadata has not been indexed yet. This usually takes a few minutes, your DAO page may not be available yet.`,
- };
+ : `Deployed ${metadataParams.metadata.unfrozenToken.name} successfully, but metadata has not been indexed yet. This usually takes a few minutes, your DAO page may not be available yet.`
+ }
- setActiveState(3);
- setStates(updatedStates);
+ setActiveState(3)
+ setStates(updatedStates)
mixpanel.track("Completed DAO indexation", {
daoName: params.orgSettings.name,
daoType: params.template
})
- return contract;
+ return contract
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
+ )
console.log(result)
- return { mutation: result, states, activeState };
-};
+ return { mutation: result, states, activeState }
+}
diff --git a/src/services/contracts/baseDAO/hooks/useProposeConfigChange.ts b/src/services/contracts/baseDAO/hooks/useProposeConfigChange.ts
index 8ada1e7a..fbc655f2 100644
--- a/src/services/contracts/baseDAO/hooks/useProposeConfigChange.ts
+++ b/src/services/contracts/baseDAO/hooks/useProposeConfigChange.ts
@@ -1,63 +1,56 @@
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { useMutation, useQueryClient } from "react-query";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import {BaseDAO} from "../class";
-import {ConfigProposalParams} from "../types";
-import {networkNameMap} from "../../../bakingBad";
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { useMutation, useQueryClient } from "react-query"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from "../class"
+import { ConfigProposalParams } from "../types"
+import { networkNameMap } from "../../../bakingBad"
export const useProposeConfigChange = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
- return useMutation<
- TransactionWalletOperation | Error,
- Error,
- { dao: BaseDAO; args: ConfigProposalParams }
- >(
- async ({ dao, args }) => {
- const {
- key: proposalNotification,
- closeSnackbar: closeProposalNotification,
- } = openNotification({
- message: "Proposal is being created...",
- persist: true,
- variant: "info",
- });
- try {
- let tezosToolkit = tezos;
+ return useMutation(
+ async ({ dao, args }) => {
+ const { key: proposalNotification, closeSnackbar: closeProposalNotification } = openNotification({
+ message: "Proposal is being created...",
+ persist: true,
+ variant: "info"
+ })
+ try {
+ let tezosToolkit = tezos
- if (!account) {
- tezosToolkit = await connect();
- }
+ if (!account) {
+ tezosToolkit = await connect()
+ }
- const data = await dao.proposeConfigChange(args, tezosToolkit);
- await data.confirmation(1);
- closeProposalNotification(proposalNotification);
+ const data = await dao.proposeConfigChange(args, tezosToolkit)
+ await data.confirmation(1)
+ closeProposalNotification(proposalNotification)
- openNotification({
- message: "Config proposal transaction confirmed!",
- autoHideDuration: 10000,
- variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
- } catch (e) {
- console.log(e);
- closeProposalNotification(proposalNotification);
- openNotification({
- message: "An error has happened with propose transaction!",
- variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
- }
- },
- {
- onSuccess: () => {
- queryClient.resetQueries();
- },
- }
- );
-};
+ openNotification({
+ message: "Config proposal transaction confirmed!",
+ autoHideDuration: 10000,
+ variant: "success",
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
+ } catch (e) {
+ console.log(e)
+ closeProposalNotification(proposalNotification)
+ openNotification({
+ message: "An error has happened with propose transaction!",
+ variant: "error",
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
+ }
+ },
+ {
+ onSuccess: () => {
+ queryClient.resetQueries()
+ }
+ }
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useProposeDelegationChange.ts b/src/services/contracts/baseDAO/hooks/useProposeDelegationChange.ts
index 55a0497c..7cfac5e4 100644
--- a/src/services/contracts/baseDAO/hooks/useProposeDelegationChange.ts
+++ b/src/services/contracts/baseDAO/hooks/useProposeDelegationChange.ts
@@ -1,62 +1,55 @@
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { useMutation, useQueryClient } from "react-query";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import {BaseDAO} from "../class";
-import {networkNameMap} from "../../../bakingBad";
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { useMutation, useQueryClient } from "react-query"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from "../class"
+import { networkNameMap } from "../../../bakingBad"
export const useProposeDelegationChange = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
- return useMutation<
- TransactionWalletOperation | Error,
- Error,
- { dao: BaseDAO; newDelegationAddress: string }
- >(
- async ({ dao, newDelegationAddress }) => {
- const {
- key: proposalNotification,
- closeSnackbar: closeProposalNotification,
- } = openNotification({
- message: "Proposal is being created...",
- persist: true,
- variant: "info",
- });
- try {
- let tezosToolkit = tezos;
+ return useMutation(
+ async ({ dao, newDelegationAddress }) => {
+ const { key: proposalNotification, closeSnackbar: closeProposalNotification } = openNotification({
+ message: "Proposal is being created...",
+ persist: true,
+ variant: "info"
+ })
+ try {
+ let tezosToolkit = tezos
- if (!account) {
- tezosToolkit = await connect();
- }
+ if (!account) {
+ tezosToolkit = await connect()
+ }
- const data = await dao.proposeDelegationChange(newDelegationAddress, tezosToolkit);
- await data.confirmation(1);
- closeProposalNotification(proposalNotification);
+ const data = await dao.proposeDelegationChange(newDelegationAddress, tezosToolkit)
+ await data.confirmation(1)
+ closeProposalNotification(proposalNotification)
- openNotification({
- message: "Delegation change proposal transaction confirmed!",
- autoHideDuration: 10000,
- variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
- } catch (e) {
- console.error(e);
- closeProposalNotification(proposalNotification);
- openNotification({
- message: "An error has happened with propose transaction!",
- variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
- }
- },
- {
- onSuccess: () => {
- queryClient.resetQueries();
- },
- }
- );
-};
\ No newline at end of file
+ openNotification({
+ message: "Delegation change proposal transaction confirmed!",
+ autoHideDuration: 10000,
+ variant: "success",
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
+ } catch (e) {
+ console.error(e)
+ closeProposalNotification(proposalNotification)
+ openNotification({
+ message: "An error has happened with propose transaction!",
+ variant: "error",
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
+ }
+ },
+ {
+ onSuccess: () => {
+ queryClient.resetQueries()
+ }
+ }
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useProposeGuardianChange.ts b/src/services/contracts/baseDAO/hooks/useProposeGuardianChange.ts
index 8270c71d..a77bdc48 100644
--- a/src/services/contracts/baseDAO/hooks/useProposeGuardianChange.ts
+++ b/src/services/contracts/baseDAO/hooks/useProposeGuardianChange.ts
@@ -1,62 +1,55 @@
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { useMutation, useQueryClient } from "react-query";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import {BaseDAO} from "../class";
-import {networkNameMap} from "../../../bakingBad";
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { useMutation, useQueryClient } from "react-query"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from "../class"
+import { networkNameMap } from "../../../bakingBad"
export const useProposeGuardianChange = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
- return useMutation<
- TransactionWalletOperation | Error,
- Error,
- { dao: BaseDAO; newGuardianAddress: string }
- >(
- async ({ dao, newGuardianAddress }) => {
- const {
- key: proposalNotification,
- closeSnackbar: closeProposalNotification,
- } = openNotification({
- message: "Proposal is being created...",
- persist: true,
- variant: "info",
- });
- try {
- let tezosToolkit = tezos;
+ return useMutation(
+ async ({ dao, newGuardianAddress }) => {
+ const { key: proposalNotification, closeSnackbar: closeProposalNotification } = openNotification({
+ message: "Proposal is being created...",
+ persist: true,
+ variant: "info"
+ })
+ try {
+ let tezosToolkit = tezos
- if (!account) {
- tezosToolkit = await connect();
- }
+ if (!account) {
+ tezosToolkit = await connect()
+ }
- const data = await dao.proposeGuardianChange(newGuardianAddress, tezosToolkit);
- await data.confirmation(1);
- closeProposalNotification(proposalNotification);
+ const data = await dao.proposeGuardianChange(newGuardianAddress, tezosToolkit)
+ await data.confirmation(1)
+ closeProposalNotification(proposalNotification)
- openNotification({
- message: "Guardian change proposal transaction confirmed!",
- autoHideDuration: 10000,
- variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
- } catch (e) {
- console.log(e);
- closeProposalNotification(proposalNotification);
- openNotification({
- message: "An error has happened with propose transaction!",
- variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
- }
- },
- {
- onSuccess: () => {
- queryClient.resetQueries();
- },
- }
- );
-};
\ No newline at end of file
+ openNotification({
+ message: "Guardian change proposal transaction confirmed!",
+ autoHideDuration: 10000,
+ variant: "success",
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
+ } catch (e) {
+ console.log(e)
+ closeProposalNotification(proposalNotification)
+ openNotification({
+ message: "An error has happened with propose transaction!",
+ variant: "error",
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
+ }
+ },
+ {
+ onSuccess: () => {
+ queryClient.resetQueries()
+ }
+ }
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useRegistryPropose.ts b/src/services/contracts/baseDAO/hooks/useRegistryPropose.ts
index f945179c..a96933a2 100644
--- a/src/services/contracts/baseDAO/hooks/useRegistryPropose.ts
+++ b/src/services/contracts/baseDAO/hooks/useRegistryPropose.ts
@@ -1,70 +1,63 @@
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { useMutation, useQueryClient } from "react-query";
-import { RegistryProposeArgs } from "../registryDAO/types";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { RegistryDAO } from "../registryDAO";
-import mixpanel from "mixpanel-browser";
-import {networkNameMap} from "../../../bakingBad";
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { useMutation, useQueryClient } from "react-query"
+import { RegistryProposeArgs } from "../registryDAO/types"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { RegistryDAO } from "../registryDAO"
+import mixpanel from "mixpanel-browser"
+import { networkNameMap } from "../../../bakingBad"
export const useRegistryPropose = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
- return useMutation<
- TransactionWalletOperation | Error,
- Error,
- { dao: RegistryDAO; args: RegistryProposeArgs }
- >(
+ return useMutation(
async ({ dao, args }) => {
- const {
- key: proposalNotification,
- closeSnackbar: closeProposalNotification,
- } = openNotification({
+ const { key: proposalNotification, closeSnackbar: closeProposalNotification } = openNotification({
message: "Proposal is being created...",
persist: true,
- variant: "info",
- });
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await dao.propose(args, tezosToolkit);
+ const data = await dao.propose(args, tezosToolkit)
mixpanel.track("Proposal Created", {
dao: dao.data.address,
daoType: "Registry"
})
-
- await data.confirmation(1);
- closeProposalNotification(proposalNotification);
+
+ await data.confirmation(1)
+ closeProposalNotification(proposalNotification)
openNotification({
message: "Registry proposal transaction confirmed!",
autoHideDuration: 10000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
} catch (e) {
- console.log(e);
- closeProposalNotification(proposalNotification);
+ console.log(e)
+ closeProposalNotification(proposalNotification)
openNotification({
message: "An error has happened with propose transaction!",
variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useSendXTZ.ts b/src/services/contracts/baseDAO/hooks/useSendXTZ.ts
index 20e1f0d1..91c8b883 100644
--- a/src/services/contracts/baseDAO/hooks/useSendXTZ.ts
+++ b/src/services/contracts/baseDAO/hooks/useSendXTZ.ts
@@ -1,66 +1,62 @@
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { BigNumber } from "bignumber.js";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import {networkNameMap} from "../../../bakingBad";
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { BigNumber } from "bignumber.js"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { networkNameMap } from "../../../bakingBad"
interface Params {
- dao: BaseDAO;
- amount: BigNumber;
+ dao: BaseDAO
+ amount: BigNumber
}
export const useSendXTZ = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
return useMutation(
- async (params) => {
- const { key: notification, closeSnackbar: closeNotification } =
- openNotification({
- message: "XTZ transfer is being processed...",
- persist: true,
- variant: "info",
- });
+ async params => {
+ const { key: notification, closeSnackbar: closeNotification } = openNotification({
+ message: "XTZ transfer is being processed...",
+ persist: true,
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await (params.dao as BaseDAO).sendXtz(
- params.amount,
- tezosToolkit
- );
+ const data = await (params.dao as BaseDAO).sendXtz(params.amount, tezosToolkit)
- await data.confirmation(1);
+ await data.confirmation(1)
- closeNotification(notification);
+ closeNotification(notification)
openNotification({
message: "XTZ transfer confirmed!",
autoHideDuration: 10000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
} catch (e) {
- console.log(e);
- closeNotification(notification);
+ console.log(e)
+ closeNotification(notification)
openNotification({
message: "An error has happened with XTZ transfer!",
variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useTezosBalance.ts b/src/services/contracts/baseDAO/hooks/useTezosBalance.ts
index 8b351e06..1eac1a05 100644
--- a/src/services/contracts/baseDAO/hooks/useTezosBalance.ts
+++ b/src/services/contracts/baseDAO/hooks/useTezosBalance.ts
@@ -1,24 +1,24 @@
-import { BaseDAO } from "..";
-import { useQuery } from "react-query";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import BigNumber from "bignumber.js";
-import { mutezToXtz } from "services/contracts/utils";
+import { BaseDAO } from ".."
+import { useQuery } from "react-query"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import BigNumber from "bignumber.js"
+import { mutezToXtz } from "services/contracts/utils"
export const useTezosBalance = (contractAddress: string) => {
- const { data: dao } = useDAO(contractAddress);
- const { tezos } = useTezos();
+ const { data: dao } = useDAO(contractAddress)
+ const { tezos } = useTezos()
const result = useQuery(
["tezosBalance", contractAddress],
async () => {
- const balance = await tezos.tz.getBalance((dao as BaseDAO).data.address);
+ const balance = await tezos.tz.getBalance((dao as BaseDAO).data.address)
return mutezToXtz(new BigNumber(balance.toString()))
},
{
- enabled: !!dao && !!tezos,
+ enabled: !!dao && !!tezos
}
- );
+ )
- return result;
-};
+ return result
+}
diff --git a/src/services/contracts/baseDAO/hooks/useTokenHoldersWithVotes.ts b/src/services/contracts/baseDAO/hooks/useTokenHoldersWithVotes.ts
index 46d2aa9d..4916c940 100644
--- a/src/services/contracts/baseDAO/hooks/useTokenHoldersWithVotes.ts
+++ b/src/services/contracts/baseDAO/hooks/useTokenHoldersWithVotes.ts
@@ -1,54 +1,44 @@
-import { BigNumber } from "bignumber.js";
-import { useMemo } from "react";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useProposals } from "services/indexer/dao/hooks/useProposals";
+import { BigNumber } from "bignumber.js"
+import { useMemo } from "react"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useProposals } from "services/indexer/dao/hooks/useProposals"
export const useTokenHoldersWithVotes = (contractAddress: string) => {
- const {
- isLoading: daoIsLoading,
- error: daoError,
- ledger,
- } = useDAO(contractAddress);
-
- const {
- data: proposals,
- isLoading: proposalsIsLoading,
- error: proposalsError,
- } = useProposals(contractAddress);
+ const { isLoading: daoIsLoading, error: daoError, ledger } = useDAO(contractAddress)
+
+ const { data: proposals, isLoading: proposalsIsLoading, error: proposalsError } = useProposals(contractAddress)
const tokenHoldersWithVotes = useMemo(() => {
if (!proposals || !ledger) {
- return [];
+ return []
}
- return ledger.map((tokenHolder) => {
- let proposalsVoted = 0;
- let votes = new BigNumber(0);
+ return ledger.map(tokenHolder => {
+ let proposalsVoted = 0
+ let votes = new BigNumber(0)
- proposals.forEach((proposal) => {
+ proposals.forEach(proposal => {
const voter = proposal.voters.find(
- (voter) =>
- voter.address.toLowerCase() ===
- tokenHolder.holder.address.toLowerCase()
- );
+ voter => voter.address.toLowerCase() === tokenHolder.holder.address.toLowerCase()
+ )
if (voter) {
- votes = votes.plus(voter.value);
- proposalsVoted += 1;
+ votes = votes.plus(voter.value)
+ proposalsVoted += 1
}
- });
+ })
return {
...tokenHolder,
votes,
- proposalsVoted,
- };
- });
- }, [proposals, ledger]);
+ proposalsVoted
+ }
+ })
+ }, [proposals, ledger])
return {
data: tokenHoldersWithVotes,
isLoading: proposalsIsLoading || daoIsLoading,
- error: proposalsError || daoError,
- };
-};
+ error: proposalsError || daoError
+ }
+}
diff --git a/src/services/contracts/baseDAO/hooks/useTokenMetadata.ts b/src/services/contracts/baseDAO/hooks/useTokenMetadata.ts
index c07a6e55..7a3fe91f 100644
--- a/src/services/contracts/baseDAO/hooks/useTokenMetadata.ts
+++ b/src/services/contracts/baseDAO/hooks/useTokenMetadata.ts
@@ -1,19 +1,19 @@
-import { Token } from "models/Token";
-import { useQuery } from "react-query";
-import { getTokenMetadata } from "services/bakingBad/tokenBalances";
+import { Token } from "models/Token"
+import { useQuery } from "react-query"
+import { getTokenMetadata } from "services/bakingBad/tokenBalances"
-import { useTezos } from "services/beacon/hooks/useTezos";
+import { useTezos } from "services/beacon/hooks/useTezos"
export const useTokenMetadata = (address?: string, tokenId?: string) => {
- const { tezos, network } = useTezos();
+ const { tezos, network } = useTezos()
const result = useQuery(
["tokenMetadata", address, tokenId],
() => getTokenMetadata(address as string, network, tokenId as string),
{
- enabled: !!tezos && !!address && !!tokenId,
+ enabled: !!tezos && !!address && !!tokenId
}
- );
+ )
- return result;
-};
+ return result
+}
diff --git a/src/services/contracts/baseDAO/hooks/useTransfers.ts b/src/services/contracts/baseDAO/hooks/useTransfers.ts
index 7484feb6..e2738aad 100644
--- a/src/services/contracts/baseDAO/hooks/useTransfers.ts
+++ b/src/services/contracts/baseDAO/hooks/useTransfers.ts
@@ -1,68 +1,59 @@
-import { BaseDAO } from "..";
-import { useQuery } from "react-query";
-import { useDAO } from "services/indexer/dao/hooks/useDAO";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { getDAOTransfers } from "services/bakingBad/transfers";
-import { mutezToXtz, parseUnits } from "services/contracts/utils";
-import { BigNumber } from "bignumber.js";
-import { getXTZTransfers } from "services/indexer/dao/services";
-import dayjs from "dayjs";
+import { BaseDAO } from ".."
+import { useQuery } from "react-query"
+import { useDAO } from "services/indexer/dao/hooks/useDAO"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { getDAOTransfers } from "services/bakingBad/transfers"
+import { mutezToXtz, parseUnits } from "services/contracts/utils"
+import { BigNumber } from "bignumber.js"
+import { getXTZTransfers } from "services/indexer/dao/services"
+import dayjs from "dayjs"
export interface TransferWithBN {
- name: string;
- amount: BigNumber;
- recipient: string;
- sender: string;
- date: string;
- hash: string;
+ name: string
+ amount: BigNumber
+ recipient: string
+ sender: string
+ date: string
+ hash: string
}
export const useTransfers = (contractAddress: string) => {
- const { data: dao } = useDAO(contractAddress);
- const { network } = useTezos();
+ const { data: dao } = useDAO(contractAddress)
+ const { network } = useTezos()
const result = useQuery(
["transfers", contractAddress],
async () => {
- const tokenTransfersDTO = await getDAOTransfers(
- (dao as BaseDAO).data.address,
- network
- );
+ const tokenTransfersDTO = await getDAOTransfers((dao as BaseDAO).data.address, network)
- const xtzTransfersDTO = await getXTZTransfers(
- (dao as BaseDAO).data.address
- );
+ const xtzTransfersDTO = await getXTZTransfers((dao as BaseDAO).data.address)
- const xtzTransfers: TransferWithBN[] = xtzTransfersDTO.transfer.map(
- (t) => ({
- ...t,
- recipient: contractAddress,
- sender: t.from_address,
- date: t.timestamp,
- name: "XTZ",
- hash: t.hash,
- amount: mutezToXtz(new BigNumber(t.amount)),
- })
- );
+ const xtzTransfers: TransferWithBN[] = xtzTransfersDTO.transfer.map(t => ({
+ ...t,
+ recipient: contractAddress,
+ sender: t.from_address,
+ date: t.timestamp,
+ name: "XTZ",
+ hash: t.hash,
+ amount: mutezToXtz(new BigNumber(t.amount))
+ }))
- const tokenTransfers: TransferWithBN[] = tokenTransfersDTO.map((t) => ({
+ const tokenTransfers: TransferWithBN[] = tokenTransfersDTO.map(t => ({
...t,
recipient: t.to,
sender: t.from,
date: t.timestamp,
- name: t.token.symbol === "OBJKT"? `${t.token.symbol}#${t.token.token_id}` : t.token.symbol || "-",
+ name: t.token.symbol === "OBJKT" ? `${t.token.symbol}#${t.token.token_id}` : t.token.symbol || "-",
hash: t.hash,
- amount: parseUnits(new BigNumber(t.amount), t.token.decimals),
- }));
+ amount: parseUnits(new BigNumber(t.amount), t.token.decimals)
+ }))
- return tokenTransfers
- .concat(xtzTransfers)
- .sort((a, b) => (dayjs(a.date).isAfter(dayjs(b.date)) ? 1 : -1));
+ return tokenTransfers.concat(xtzTransfers).sort((a, b) => (dayjs(a.date).isAfter(dayjs(b.date)) ? 1 : -1))
},
{
- enabled: !!dao,
+ enabled: !!dao
}
- );
+ )
- return result;
-};
+ return result
+}
diff --git a/src/services/contracts/baseDAO/hooks/useTreasuryPropose.ts b/src/services/contracts/baseDAO/hooks/useTreasuryPropose.ts
index 4266fa1f..2e03fe7e 100644
--- a/src/services/contracts/baseDAO/hooks/useTreasuryPropose.ts
+++ b/src/services/contracts/baseDAO/hooks/useTreasuryPropose.ts
@@ -1,71 +1,64 @@
-import { TreasuryDAO } from "services/contracts/baseDAO";
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { TreasuryProposeArgs } from "../treasuryDAO/types";
-import mixpanel from "mixpanel-browser";
-import {networkNameMap} from "../../../bakingBad";
+import { TreasuryDAO } from "services/contracts/baseDAO"
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { TreasuryProposeArgs } from "../treasuryDAO/types"
+import mixpanel from "mixpanel-browser"
+import { networkNameMap } from "../../../bakingBad"
export const useTreasuryPropose = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, connect, account } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, connect, account } = useTezos()
- return useMutation<
- TransactionWalletOperation | Error,
- Error,
- { dao: TreasuryDAO; args: TreasuryProposeArgs }
- >(
+ return useMutation(
async ({ dao, args }) => {
- const {
- key: proposalNotification,
- closeSnackbar: closeProposalNotification,
- } = openNotification({
+ const { key: proposalNotification, closeSnackbar: closeProposalNotification } = openNotification({
message: "Treasury proposal is being created...",
persist: true,
- variant: "info",
- });
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await dao.propose(args, tezosToolkit);
+ const data = await dao.propose(args, tezosToolkit)
mixpanel.track("Proposal Created", {
dao: dao.data.address,
daoType: "Treasury"
})
-
- await data.confirmation(1);
- closeProposalNotification(proposalNotification);
+
+ await data.confirmation(1)
+ closeProposalNotification(proposalNotification)
openNotification({
message: "Treasury proposal transaction confirmed!",
autoHideDuration: 10000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
} catch (e) {
- console.log(e);
- closeProposalNotification(proposalNotification);
+ console.log(e)
+ closeProposalNotification(proposalNotification)
openNotification({
message: "An error has happened with propose transaction!",
variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useUnstakeVotes.ts b/src/services/contracts/baseDAO/hooks/useUnstakeVotes.ts
index 1fe4af99..b4876009 100644
--- a/src/services/contracts/baseDAO/hooks/useUnstakeVotes.ts
+++ b/src/services/contracts/baseDAO/hooks/useUnstakeVotes.ts
@@ -1,69 +1,66 @@
-import mixpanel from "mixpanel-browser";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import {networkNameMap} from "../../../bakingBad";
+import mixpanel from "mixpanel-browser"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { networkNameMap } from "../../../bakingBad"
interface Params {
- dao: BaseDAO;
- proposalId: string;
+ dao: BaseDAO
+ proposalId: string
}
export const useUnstakeVotes = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
return useMutation(
- async (params) => {
- const {
- key: freezeNotification,
- closeSnackbar: closeFreezeNotification,
- } = openNotification({
+ async params => {
+ const { key: freezeNotification, closeSnackbar: closeFreezeNotification } = openNotification({
message: `Unstake is being processed...`,
persist: true,
- variant: "info",
- });
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
- const data = await (params.dao as BaseDAO).unstakeVotes(params.proposalId, tezosToolkit);
+ const data = await (params.dao as BaseDAO).unstakeVotes(params.proposalId, tezosToolkit)
mixpanel.track(`Votes Unstaked`, {
dao: params.dao.data.address,
proposalId: params.proposalId
})
- await data.confirmation(1);
+ await data.confirmation(1)
- closeFreezeNotification(freezeNotification);
+ closeFreezeNotification(freezeNotification)
openNotification({
message: `Unstake transaction confirmed!`,
autoHideDuration: 10000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
} catch (e) {
- console.log(e);
- closeFreezeNotification(freezeNotification);
+ console.log(e)
+ closeFreezeNotification(freezeNotification)
openNotification({
message: `An error has happened with unstake transaction!`,
variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/hooks/useVote.ts b/src/services/contracts/baseDAO/hooks/useVote.ts
index 13671266..a92eb321 100644
--- a/src/services/contracts/baseDAO/hooks/useVote.ts
+++ b/src/services/contracts/baseDAO/hooks/useVote.ts
@@ -1,78 +1,77 @@
-import { TransactionWalletOperation } from "@taquito/taquito";
-import { BigNumber } from "bignumber.js";
-import mixpanel from "mixpanel-browser";
-import { useNotification } from "modules/common/hooks/useNotification";
-import { useMutation, useQueryClient } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { BaseDAO } from "..";
-import {networkNameMap} from "../../../bakingBad";
+import { TransactionWalletOperation } from "@taquito/taquito"
+import { BigNumber } from "bignumber.js"
+import mixpanel from "mixpanel-browser"
+import { useNotification } from "modules/common/hooks/useNotification"
+import { useMutation, useQueryClient } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { BaseDAO } from ".."
+import { networkNameMap } from "../../../bakingBad"
interface Params {
- dao: BaseDAO;
- proposalKey: string;
- amount: BigNumber;
- support: boolean;
+ dao: BaseDAO
+ proposalKey: string
+ amount: BigNumber
+ support: boolean
}
export const useVote = () => {
- const queryClient = useQueryClient();
- const openNotification = useNotification();
- const { network, tezos, account, connect } = useTezos();
+ const queryClient = useQueryClient()
+ const openNotification = useNotification()
+ const { network, tezos, account, connect } = useTezos()
return useMutation(
- async (params) => {
- const { key: voteNotification, closeSnackbar: closeVoteNotification } =
- openNotification({
- message: "Vote is being created...",
- persist: true,
- variant: "info",
- });
+ async params => {
+ const { key: voteNotification, closeSnackbar: closeVoteNotification } = openNotification({
+ message: "Vote is being created...",
+ persist: true,
+ variant: "info"
+ })
try {
- let tezosToolkit = tezos;
+ let tezosToolkit = tezos
if (!account) {
- tezosToolkit = await connect();
+ tezosToolkit = await connect()
}
const data = await (params.dao as BaseDAO).vote({
proposalKey: params.proposalKey,
amount: params.amount,
support: params.support,
- tezos: tezosToolkit,
- });
+ tezos: tezosToolkit
+ })
mixpanel.track("Vote Created", {
dao: (params.dao as BaseDAO).data.address,
proposal: params.proposalKey,
amount: params.amount,
- support: params.support,
+ support: params.support
})
- await data.confirmation(1);
+ await data.confirmation(1)
- closeVoteNotification(voteNotification);
+ closeVoteNotification(voteNotification)
openNotification({
message: "Vote transaction confirmed!",
autoHideDuration: 10000,
variant: "success",
- detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash,
- });
- return data;
+ detailsLink: `https://${networkNameMap[network]}.tzkt.io/` + data.opHash
+ })
+ return data
} catch (e) {
- console.log(e);
- closeVoteNotification(voteNotification);
+ console.log(e)
+ closeVoteNotification(voteNotification)
openNotification({
message: "An error has happened with vote transaction!",
variant: "error",
- autoHideDuration: 10000,
- });
- return new Error((e as Error).message);
+ autoHideDuration: 10000
+ })
+ return new Error((e as Error).message)
}
},
{
onSuccess: () => {
- queryClient.resetQueries();
- },
+ queryClient.resetQueries()
+ }
}
- );
-};
+ )
+}
diff --git a/src/services/contracts/baseDAO/index.ts b/src/services/contracts/baseDAO/index.ts
index 4290962e..1dcd03de 100644
--- a/src/services/contracts/baseDAO/index.ts
+++ b/src/services/contracts/baseDAO/index.ts
@@ -1,5 +1,5 @@
-export * from "./class";
-export * from "./types";
-export * from "./utils";
-export * from "./registryDAO";
-export * from "./treasuryDAO";
+export * from "./class"
+export * from "./types"
+export * from "./utils"
+export * from "./registryDAO"
+export * from "./treasuryDAO"
diff --git a/src/services/contracts/baseDAO/michelson/baseDAO.ts b/src/services/contracts/baseDAO/michelson/baseDAO.ts
index 443cf35a..318a9e6d 100644
--- a/src/services/contracts/baseDAO/michelson/baseDAO.ts
+++ b/src/services/contracts/baseDAO/michelson/baseDAO.ts
@@ -2426,4 +2426,4 @@ code { PUSH nat 1000000 ;
PAIR ;
SWAP ;
PAIR }
-`
\ No newline at end of file
+`
diff --git a/src/services/contracts/baseDAO/registryDAO/index.ts b/src/services/contracts/baseDAO/registryDAO/index.ts
index 53d1702b..d5546b2a 100644
--- a/src/services/contracts/baseDAO/registryDAO/index.ts
+++ b/src/services/contracts/baseDAO/registryDAO/index.ts
@@ -1,155 +1,155 @@
-import { Expr, Parser, unpackDataBytes } from "@taquito/michel-codec";
-import { TezosToolkit } from "@taquito/taquito";
-import { Schema } from "@taquito/michelson-encoder";
-import { BaseDAO, BaseDAOData, getContract } from "..";
-import { RegistryProposeArgs } from "./types";
-import { bytes2Char, char2Bytes } from "@taquito/tzip16";
-import proposeCode from "./michelson/propose";
-import { RegistryExtraDTO } from "services/indexer/types";
-import { mapTransfersArgs } from "services/indexer/dao/mappers/proposal";
-import { BigNumber } from "bignumber.js";
-import { formatUnits } from "../../utils";
-
-const parser = new Parser();
+import { Expr, Parser, unpackDataBytes } from "@taquito/michel-codec"
+import { TezosToolkit } from "@taquito/taquito"
+import { Schema } from "@taquito/michelson-encoder"
+import { BaseDAO, BaseDAOData, getContract } from ".."
+import { RegistryProposeArgs } from "./types"
+import { bytes2Char, char2Bytes } from "@taquito/tzip16"
+import proposeCode from "./michelson/propose"
+import { RegistryExtraDTO } from "services/indexer/types"
+import { mapTransfersArgs } from "services/indexer/dao/mappers/proposal"
+import { BigNumber } from "bignumber.js"
+import { formatUnits } from "../../utils"
+
+const parser = new Parser()
interface RegistryDAOData extends BaseDAOData {
- extra: RegistryExtraDTO;
+ extra: RegistryExtraDTO
}
interface RegistryItemDTO {
- prim: "Pair";
- args: [{ string: string }, { string: string }];
+ prim: "Pair"
+ args: [{ string: string }, { string: string }]
}
interface RegistryAffectedDTO {
- prim: "Elt";
- args: [{ string: string }, { bytes: string }];
+ prim: "Elt"
+ args: [{ string: string }, { bytes: string }]
}
const mapStorageRegistryList = (
listMichelsonString: string
): {
- key: string;
- value: string;
+ key: string
+ value: string
}[] => {
const data = unpackDataBytes({
- bytes: listMichelsonString,
- }) as RegistryItemDTO[];
+ bytes: listMichelsonString
+ }) as RegistryItemDTO[]
- return data.map((item) => ({
+ return data.map(item => ({
key: bytes2Char(item.args[0].string),
- value: bytes2Char(item.args[1].string),
- }));
-};
+ value: bytes2Char(item.args[1].string)
+ }))
+}
const mapStorageRegistryAffectedList = (
listMichelsonString: string
): {
- key: string;
- proposalId: string;
+ key: string
+ proposalId: string
}[] => {
const data = unpackDataBytes({
- bytes: listMichelsonString,
- }) as RegistryAffectedDTO[];
+ bytes: listMichelsonString
+ }) as RegistryAffectedDTO[]
- return data.map((item) => ({
+ return data.map(item => ({
key: bytes2Char(item.args[0].string),
- proposalId: item.args[1].bytes,
- }));
-};
+ proposalId: item.args[1].bytes
+ }))
+}
export class RegistryDAO extends BaseDAO {
public decoded: {
decodedRegistry: {
- key: string;
- value: string;
- }[];
+ key: string
+ value: string
+ }[]
decodedRegistryAffected: {
- key: string;
- proposalId: string;
- }[];
- };
+ key: string
+ proposalId: string
+ }[]
+ }
public constructor(public data: RegistryDAOData) {
- super(data);
+ super(data)
this.decoded = {
decodedRegistry: mapStorageRegistryList(this.data.extra.registry),
- decodedRegistryAffected: mapStorageRegistryAffectedList(this.data.extra.registry_affected),
- };
+ decodedRegistryAffected: mapStorageRegistryAffectedList(this.data.extra.registry_affected)
+ }
this.data.extra.returnedPercentage = new BigNumber(100)
.minus(new BigNumber(this.data.extra.slash_scale_value))
- .toString();
+ .toString()
}
public async proposeGuardianChange(newGuardianAddress: string, tezos: TezosToolkit) {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
const proposalMetadata = await BaseDAO.encodeProposalMetadata(
{
- update_guardian: newGuardianAddress,
+ update_guardian: newGuardianAddress
},
proposeCode,
tezos
- );
+ )
const contractMethod = contract.methods.propose(
await tezos.wallet.pkh(),
formatUnits(new BigNumber(this.data.extra.frozen_extra_value), this.data.token.decimals),
proposalMetadata
- );
+ )
- return await contractMethod.send();
+ return await contractMethod.send()
}
public async proposeDelegationChange(newDelegationAddress: string, tezos: TezosToolkit) {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
const proposalMetadata = await BaseDAO.encodeProposalMetadata(
{
- update_contract_delegate: newDelegationAddress,
+ update_contract_delegate: newDelegationAddress
},
proposeCode,
tezos
- );
+ )
const contractMethod = contract.methods.propose(
await tezos.wallet.pkh(),
formatUnits(new BigNumber(this.data.extra.frozen_extra_value), this.data.token.decimals),
proposalMetadata
- );
+ )
- return await contractMethod.send();
+ return await contractMethod.send()
}
public propose = async ({ agoraPostId, transfer_proposal }: RegistryProposeArgs, tezos: TezosToolkit) => {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
- const michelsonType = parser.parseData(proposeCode);
- const schema = new Schema(michelsonType as Expr);
+ const michelsonType = parser.parseData(proposeCode)
+ const schema = new Schema(michelsonType as Expr)
const dataToEncode = {
transfer_proposal: {
transfers: mapTransfersArgs(transfer_proposal.transfers, this.data.address),
- registry_diff: transfer_proposal.registry_diff.map((item) => [char2Bytes(item.key), char2Bytes(item.value)]),
- agora_post_id: agoraPostId,
- },
- };
+ registry_diff: transfer_proposal.registry_diff.map(item => [char2Bytes(item.key), char2Bytes(item.value)]),
+ agora_post_id: agoraPostId
+ }
+ }
- const data = schema.Encode(dataToEncode);
+ const data = schema.Encode(dataToEncode)
const { packed: proposalMetadata } = await tezos.rpc.packData({
data,
- type: michelsonType as Expr,
- });
+ type: michelsonType as Expr
+ })
const contractMethod = contract.methods.propose(
await tezos.wallet.pkh(),
formatUnits(new BigNumber(this.data.extra.frozen_extra_value), this.data.token.decimals),
proposalMetadata
- );
+ )
- return await contractMethod.send();
- };
+ return await contractMethod.send()
+ }
}
diff --git a/src/services/contracts/baseDAO/registryDAO/michelson/propose.ts b/src/services/contracts/baseDAO/registryDAO/michelson/propose.ts
index 690b528b..61045c7c 100644
--- a/src/services/contracts/baseDAO/registryDAO/michelson/propose.ts
+++ b/src/services/contracts/baseDAO/registryDAO/michelson/propose.ts
@@ -14,4 +14,4 @@ export default `(or (or (or (pair %configuration_proposal
(or (option %update_contract_delegate key_hash) (address %update_guardian)))
(or %update_receivers_proposal
(list %add_receivers address)
- (list %remove_receivers address)))`
\ No newline at end of file
+ (list %remove_receivers address)))`
diff --git a/src/services/contracts/baseDAO/registryDAO/types.ts b/src/services/contracts/baseDAO/registryDAO/types.ts
index 5c0ecf8b..8e1822cc 100644
--- a/src/services/contracts/baseDAO/registryDAO/types.ts
+++ b/src/services/contracts/baseDAO/registryDAO/types.ts
@@ -1,399 +1,406 @@
-import {BigNumber} from "bignumber.js";
-import {Extra, TransferParams} from "..";
+import { BigNumber } from "bignumber.js"
+import { Extra, TransferParams } from ".."
export interface RegistryItem {
- key: string;
- value: string;
+ key: string
+ value: string
}
export interface RegistryExtra extends Extra {
registry: {
- key: string;
- value: string;
- }[];
+ key: string
+ value: string
+ }[]
registryAffected: {
- key: string;
- proposalId: string;
- }[];
+ key: string
+ proposalId: string
+ }[]
}
export interface RegistryProposeArgs {
transfer_proposal: {
- transfers: TransferParams[];
- registry_diff: RegistryItem[];
- };
- agoraPostId: number;
+ transfers: TransferParams[]
+ registry_diff: RegistryItem[]
+ }
+ agoraPostId: number
}
export type RegistryExtraDTOBCD = [
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "registry";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "registry"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: string;
- };
- key_hash: "exprvRcR3Cm2kosqwzqaBDjR3ryxxtrdGheJcrZNHGb97ciQZLjmy2";
- key_string: "registry";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: string
+ }
+ key_hash: "exprvRcR3Cm2kosqwzqaBDjR3ryxxtrdGheJcrZNHGb97ciQZLjmy2"
+ key_string: "registry"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "proposal_receivers";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "proposal_receivers"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "{ {} }";
- };
- key_hash: "exprvGLpp88E6LLPiMexuYNpDi1sUzJ1P7XWQKW9Mnx866ZUgBWxWG";
- key_string: "proposal_receivers";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "{ {} }"
+ }
+ key_hash: "exprvGLpp88E6LLPiMexuYNpDi1sUzJ1P7XWQKW9Mnx866ZUgBWxWG"
+ key_string: "proposal_receivers"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "max_proposal_size";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "max_proposal_size"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "%\u0000";
- };
- key_hash: "exprvEJC172fMCDDBBB38GavfnPBXcp5ZJnP4skfQAw7DwEVVCK82K";
- key_string: "max_proposal_size";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "%\u0000"
+ }
+ key_hash: "exprvEJC172fMCDDBBB38GavfnPBXcp5ZJnP4skfQAw7DwEVVCK82K"
+ key_string: "max_proposal_size"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "registry_affected";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "registry_affected"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: string;
- };
- key_hash: "exprucktJnB8NWESBXCGSndVq5NCGSZYEBJtrdBABH2Pj6ETuiwWwd";
- key_string: "registry_affected";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: string
+ }
+ key_hash: "exprucktJnB8NWESBXCGSndVq5NCGSZYEBJtrdBABH2Pj6ETuiwWwd"
+ key_string: "registry_affected"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "frozen_extra_value";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "frozen_extra_value"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "5";
- };
- key_hash: "expruE4XAPWaDWMBA6AmSi8FnCSAJjCCJATSmBMbnUmieqwgQV1WoE";
- key_string: "frozen_extra_value";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "5"
+ }
+ key_hash: "expruE4XAPWaDWMBA6AmSi8FnCSAJjCCJATSmBMbnUmieqwgQV1WoE"
+ key_string: "frozen_extra_value"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "slash_scale_value";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "slash_scale_value"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "G";
- };
- key_hash: "expruDLFhS5Z5wWdfcPRFopF5rmNfU6Ng3raS7V9w9jex11FU16ao5";
- key_string: "slash_scale_value";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "G"
+ }
+ key_hash: "expruDLFhS5Z5wWdfcPRFopF5rmNfU6Ng3raS7V9w9jex11FU16ao5"
+ key_string: "slash_scale_value"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "min_xtz_amount";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "min_xtz_amount"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "0";
- };
- key_hash: "expru9gtnoVVDCRx9ZB8jhvr688wYWKPCHtAEvfbSei2aMLCqyHKo3";
- key_string: "min_xtz_amount";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "0"
+ }
+ key_hash: "expru9gtnoVVDCRx9ZB8jhvr688wYWKPCHtAEvfbSei2aMLCqyHKo3"
+ key_string: "min_xtz_amount"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "max_xtz_amount";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "max_xtz_amount"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "0";
- };
- key_hash: "exprtpS3eiFbdRb7fHTBtTeLKEpFJqpb1snfeQvi6Erwf4GVMXecc4";
- key_string: "max_xtz_amount";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "0"
+ }
+ key_hash: "exprtpS3eiFbdRb7fHTBtTeLKEpFJqpb1snfeQvi6Erwf4GVMXecc4"
+ key_string: "max_xtz_amount"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "frozen_scale_value";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "frozen_scale_value"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "0";
- };
- key_hash: "exprtextRC1PHYnJYFZ8QDdRYTdR1PC1aEMFyjMjehAytHgwTqr1mH";
- key_string: "frozen_scale_value";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "0"
+ }
+ key_hash: "exprtextRC1PHYnJYFZ8QDdRYTdR1PC1aEMFyjMjehAytHgwTqr1mH"
+ key_string: "frozen_scale_value"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
},
{
data: {
key: {
- prim: "string";
- type: "string";
- name: "@string_8";
- value: "slash_division_value";
- };
+ prim: "string"
+ type: "string"
+ name: "@string_8"
+ value: "slash_division_value"
+ }
value: {
- prim: "bytes";
- type: "bytes";
- name: "@bytes_9";
- value: "100";
- };
- key_hash: "exprtevAuptvU9Bw6HFVB7yCAUygSW4oLV454647xqEmTar5hVzzQ3";
- key_string: "slash_division_value";
- level: 173064;
- timestamp: "2021-05-07T04:44:33Z";
- };
- count: 1;
+ prim: "bytes"
+ type: "bytes"
+ name: "@bytes_9"
+ value: "100"
+ }
+ key_hash: "exprtevAuptvU9Bw6HFVB7yCAUygSW4oLV454647xqEmTar5hVzzQ3"
+ key_string: "slash_division_value"
+ level: 173064
+ timestamp: "2021-05-07T04:44:33Z"
+ }
+ count: 1
}
-];
+]
export type RegistryExtraDTO = [
{
- id: 298021;
- active: true;
- hash: "exprtevAuptvU9Bw6HFVB7yCAUygSW4oLV454647xqEmTar5hVzzQ3";
- key: "slash_division_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298021
+ active: true
+ hash: "exprtevAuptvU9Bw6HFVB7yCAUygSW4oLV454647xqEmTar5hVzzQ3"
+ key: "slash_division_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298022;
- active: true;
- hash: "exprtextRC1PHYnJYFZ8QDdRYTdR1PC1aEMFyjMjehAytHgwTqr1mH";
- key: "frozen_scale_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298022
+ active: true
+ hash: "exprtextRC1PHYnJYFZ8QDdRYTdR1PC1aEMFyjMjehAytHgwTqr1mH"
+ key: "frozen_scale_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298023;
- active: true;
- hash: "exprtpS3eiFbdRb7fHTBtTeLKEpFJqpb1snfeQvi6Erwf4GVMXecc4";
- key: "max_xtz_amount";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298023
+ active: true
+ hash: "exprtpS3eiFbdRb7fHTBtTeLKEpFJqpb1snfeQvi6Erwf4GVMXecc4"
+ key: "max_xtz_amount"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298024;
- active: true;
- hash: "expru9gtnoVVDCRx9ZB8jhvr688wYWKPCHtAEvfbSei2aMLCqyHKo3";
- key: "min_xtz_amount";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298024
+ active: true
+ hash: "expru9gtnoVVDCRx9ZB8jhvr688wYWKPCHtAEvfbSei2aMLCqyHKo3"
+ key: "min_xtz_amount"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298025;
- active: true;
- hash: "expruDLFhS5Z5wWdfcPRFopF5rmNfU6Ng3raS7V9w9jex11FU16ao5";
- key: "slash_scale_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298025
+ active: true
+ hash: "expruDLFhS5Z5wWdfcPRFopF5rmNfU6Ng3raS7V9w9jex11FU16ao5"
+ key: "slash_scale_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298026;
- active: true;
- hash: "expruE4XAPWaDWMBA6AmSi8FnCSAJjCCJATSmBMbnUmieqwgQV1WoE";
- key: "frozen_extra_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298026
+ active: true
+ hash: "expruE4XAPWaDWMBA6AmSi8FnCSAJjCCJATSmBMbnUmieqwgQV1WoE"
+ key: "frozen_extra_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298027;
- active: true;
- hash: "exprucktJnB8NWESBXCGSndVq5NCGSZYEBJtrdBABH2Pj6ETuiwWwd";
- key: "registry_affected";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298027
+ active: true
+ hash: "exprucktJnB8NWESBXCGSndVq5NCGSZYEBJtrdBABH2Pj6ETuiwWwd"
+ key: "registry_affected"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298028;
- active: true;
- hash: "exprvEJC172fMCDDBBB38GavfnPBXcp5ZJnP4skfQAw7DwEVVCK82K";
- key: "max_proposal_size";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298028
+ active: true
+ hash: "exprvEJC172fMCDDBBB38GavfnPBXcp5ZJnP4skfQAw7DwEVVCK82K"
+ key: "max_proposal_size"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298029;
- active: true;
- hash: "exprvGLpp88E6LLPiMexuYNpDi1sUzJ1P7XWQKW9Mnx866ZUgBWxWG";
- key: "proposal_receivers";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298029
+ active: true
+ hash: "exprvGLpp88E6LLPiMexuYNpDi1sUzJ1P7XWQKW9Mnx866ZUgBWxWG"
+ key: "proposal_receivers"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298030;
- active: true;
- hash: "exprvRcR3Cm2kosqwzqaBDjR3ryxxtrdGheJcrZNHGb97ciQZLjmy2";
- key: "registry";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298030
+ active: true
+ hash: "exprvRcR3Cm2kosqwzqaBDjR3ryxxtrdGheJcrZNHGb97ciQZLjmy2"
+ key: "registry"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
}
-];
+]
export interface PMXTZTransferType {
xtz_transfer_type: {
- amount: BigNumber;
- recipient: string;
- };
+ amount: BigNumber
+ recipient: string
+ }
}
export interface PMFA2TransferType {
- contract_address: string;
+ contract_address: string
transfer_list: [
{
- from_: string;
+ from_: string
txs: [
{
- to_: string;
- token_id: string;
- amount: BigNumber;
+ to_: string
+ token_id: string
+ amount: BigNumber
}
- ];
+ ]
}
- ];
+ ]
}
interface ConfigProposalDTO {
- frozen_extra_value?: string;
- frozen_scale_value?: string;
- max_proposal_size?: string;
- slash_division_value?: string;
- slash_scale_value?: string;
+ frozen_extra_value?: string
+ frozen_scale_value?: string
+ max_proposal_size?: string
+ slash_division_value?: string
+ slash_scale_value?: string
}
-export type PMBaseProposal = {
- configuration_proposal: ConfigProposalDTO
-} | {
- update_guardian: string;
-} | {
- update_contract_delegate: string
-}
+export type PMBaseProposal =
+ | {
+ configuration_proposal: ConfigProposalDTO
+ }
+ | {
+ update_guardian: string
+ }
+ | {
+ update_contract_delegate: string
+ }
-export type PMTreasuryProposal = PMBaseProposal | {
- transfer_proposal: {
- agora_post_id: string;
- transfers: (PMXTZTransferType | PMFA2TransferType)[];
- }
-}
+export type PMTreasuryProposal =
+ | PMBaseProposal
+ | {
+ transfer_proposal: {
+ agora_post_id: string
+ transfers: (PMXTZTransferType | PMFA2TransferType)[]
+ }
+ }
-export type PMRegistryProposal = PMBaseProposal | {
- transfer_proposal: {
- agora_post_id: string;
- registry_diff: {
- "0": string;
- "1": string;
- }[];
- transfers: (PMXTZTransferType | PMFA2TransferType)[];
- };
-}
+export type PMRegistryProposal =
+ | PMBaseProposal
+ | {
+ transfer_proposal: {
+ agora_post_id: string
+ registry_diff: {
+ "0": string
+ "1": string
+ }[]
+ transfers: (PMXTZTransferType | PMFA2TransferType)[]
+ }
+ }
diff --git a/src/services/contracts/baseDAO/treasuryDAO/index.ts b/src/services/contracts/baseDAO/treasuryDAO/index.ts
index d5127649..adde6c63 100644
--- a/src/services/contracts/baseDAO/treasuryDAO/index.ts
+++ b/src/services/contracts/baseDAO/treasuryDAO/index.ts
@@ -1,91 +1,91 @@
-import { TezosToolkit } from "@taquito/taquito";
-import { Schema } from "@taquito/michelson-encoder";
-import { Expr, Parser } from "@taquito/michel-codec";
-import { BaseDAO, BaseDAOData, getContract } from "..";
-import { TreasuryProposeArgs } from "./types";
-import proposeCode from "./michelson/propose";
-import { TreasuryExtraDTO } from "services/indexer/types";
-import { mapTransfersArgs } from "services/indexer/dao/mappers/proposal";
-import { BigNumber } from "bignumber.js";
-import { formatUnits } from "../../utils";
-
-const parser = new Parser();
+import { TezosToolkit } from "@taquito/taquito"
+import { Schema } from "@taquito/michelson-encoder"
+import { Expr, Parser } from "@taquito/michel-codec"
+import { BaseDAO, BaseDAOData, getContract } from ".."
+import { TreasuryProposeArgs } from "./types"
+import proposeCode from "./michelson/propose"
+import { TreasuryExtraDTO } from "services/indexer/types"
+import { mapTransfersArgs } from "services/indexer/dao/mappers/proposal"
+import { BigNumber } from "bignumber.js"
+import { formatUnits } from "../../utils"
+
+const parser = new Parser()
interface TreasuryDAOData extends BaseDAOData {
- extra: TreasuryExtraDTO;
+ extra: TreasuryExtraDTO
}
export class TreasuryDAO extends BaseDAO {
constructor(public data: TreasuryDAOData) {
- super(data);
+ super(data)
this.data.extra.returnedPercentage = new BigNumber(100)
.minus(new BigNumber(this.data.extra.slash_scale_value))
- .toString();
+ .toString()
}
public async proposeGuardianChange(newGuardianAddress: string, tezos: TezosToolkit) {
- const contract = await getContract(tezos, this.data.address);
- const parser = new Parser();
- const michelsonType = parser.parseData(proposeCode);
+ const contract = await getContract(tezos, this.data.address)
+ const parser = new Parser()
+ const michelsonType = parser.parseData(proposeCode)
const { packed: proposalMetadata } = await tezos.rpc.packData({
data: { prim: "Right", args: [{ string: newGuardianAddress }] },
- type: michelsonType as Expr,
- });
+ type: michelsonType as Expr
+ })
const contractMethod = contract.methods.propose(
await tezos.wallet.pkh(),
formatUnits(new BigNumber(this.data.extra.frozen_extra_value), this.data.token.decimals),
proposalMetadata
- );
+ )
- return await contractMethod.send();
+ return await contractMethod.send()
}
public async proposeDelegationChange(newDelegationAddress: string, tezos: TezosToolkit) {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
const proposalMetadata = await BaseDAO.encodeProposalMetadata(
{
- update_contract_delegate: newDelegationAddress,
+ update_contract_delegate: newDelegationAddress
},
proposeCode,
tezos
- );
+ )
const contractMethod = contract.methods.propose(
await tezos.wallet.pkh(),
formatUnits(new BigNumber(this.data.extra.frozen_extra_value), this.data.token.decimals),
proposalMetadata
- );
+ )
- return await contractMethod.send();
+ return await contractMethod.send()
}
public propose = async ({ agoraPostId, transfers }: TreasuryProposeArgs, tezos: TezosToolkit) => {
- const contract = await getContract(tezos, this.data.address);
+ const contract = await getContract(tezos, this.data.address)
- const michelsonType = parser.parseData(proposeCode);
- const schema = new Schema(michelsonType as Expr);
+ const michelsonType = parser.parseData(proposeCode)
+ const schema = new Schema(michelsonType as Expr)
const data = schema.Encode({
transfer_proposal: {
agora_post_id: agoraPostId,
- transfers: mapTransfersArgs(transfers, this.data.address),
- },
- });
+ transfers: mapTransfersArgs(transfers, this.data.address)
+ }
+ })
const { packed: proposalMetadata } = await tezos.rpc.packData({
data,
- type: michelsonType as Expr,
- });
+ type: michelsonType as Expr
+ })
const contractMethod = contract.methods.propose(
await tezos.wallet.pkh(),
formatUnits(new BigNumber(this.data.extra.frozen_extra_value), this.data.token.decimals),
proposalMetadata
- );
+ )
- return await contractMethod.send();
- };
+ return await contractMethod.send()
+ }
}
diff --git a/src/services/contracts/baseDAO/treasuryDAO/michelson/propose.ts b/src/services/contracts/baseDAO/treasuryDAO/michelson/propose.ts
index 538c65d8..3d3b42e6 100644
--- a/src/services/contracts/baseDAO/treasuryDAO/michelson/propose.ts
+++ b/src/services/contracts/baseDAO/treasuryDAO/michelson/propose.ts
@@ -8,4 +8,4 @@ export default `(or (or (pair %transfer_proposal
(pair (address %from_)
(list %txs (pair (address %to_) (pair (nat %token_id) (nat %amount))))))))))
(option %update_contract_delegate key_hash))
- (address %update_guardian))`
\ No newline at end of file
+ (address %update_guardian))`
diff --git a/src/services/contracts/baseDAO/treasuryDAO/types.ts b/src/services/contracts/baseDAO/treasuryDAO/types.ts
index 57b8522e..ad5cc399 100644
--- a/src/services/contracts/baseDAO/treasuryDAO/types.ts
+++ b/src/services/contracts/baseDAO/treasuryDAO/types.ts
@@ -1,69 +1,69 @@
-import { TransferParams } from "..";
+import { TransferParams } from ".."
export type TreasuryExtraDTO = [
{
- id: 298021;
- active: true;
- hash: "exprtevAuptvU9Bw6HFVB7yCAUygSW4oLV454647xqEmTar5hVzzQ3";
- key: "slash_division_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298021
+ active: true
+ hash: "exprtevAuptvU9Bw6HFVB7yCAUygSW4oLV454647xqEmTar5hVzzQ3"
+ key: "slash_division_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298022;
- active: true;
- hash: "exprtextRC1PHYnJYFZ8QDdRYTdR1PC1aEMFyjMjehAytHgwTqr1mH";
- key: "frozen_scale_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298022
+ active: true
+ hash: "exprtextRC1PHYnJYFZ8QDdRYTdR1PC1aEMFyjMjehAytHgwTqr1mH"
+ key: "frozen_scale_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298023;
- active: true;
- hash: "exprtpS3eiFbdRb7fHTBtTeLKEpFJqpb1snfeQvi6Erwf4GVMXecc4";
- key: "max_xtz_amount";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298023
+ active: true
+ hash: "exprtpS3eiFbdRb7fHTBtTeLKEpFJqpb1snfeQvi6Erwf4GVMXecc4"
+ key: "max_xtz_amount"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298024;
- active: true;
- hash: "expru9gtnoVVDCRx9ZB8jhvr688wYWKPCHtAEvfbSei2aMLCqyHKo3";
- key: "min_xtz_amount";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298024
+ active: true
+ hash: "expru9gtnoVVDCRx9ZB8jhvr688wYWKPCHtAEvfbSei2aMLCqyHKo3"
+ key: "min_xtz_amount"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298025;
- active: true;
- hash: "expruDLFhS5Z5wWdfcPRFopF5rmNfU6Ng3raS7V9w9jex11FU16ao5";
- key: "slash_scale_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
+ id: 298025
+ active: true
+ hash: "expruDLFhS5Z5wWdfcPRFopF5rmNfU6Ng3raS7V9w9jex11FU16ao5"
+ key: "slash_scale_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
},
{
- id: 298026;
- active: true;
- hash: "expruE4XAPWaDWMBA6AmSi8FnCSAJjCCJATSmBMbnUmieqwgQV1WoE";
- key: "frozen_extra_value";
- value: string;
- firstLevel: 292370;
- lastLevel: 292370;
- updates: 1;
- },
-];
+ id: 298026
+ active: true
+ hash: "expruE4XAPWaDWMBA6AmSi8FnCSAJjCCJATSmBMbnUmieqwgQV1WoE"
+ key: "frozen_extra_value"
+ value: string
+ firstLevel: 292370
+ lastLevel: 292370
+ updates: 1
+ }
+]
export interface TreasuryProposeArgs {
- agoraPostId: number;
- transfers: TransferParams[];
-}
\ No newline at end of file
+ agoraPostId: number
+ transfers: TransferParams[]
+}
diff --git a/src/services/contracts/baseDAO/types.ts b/src/services/contracts/baseDAO/types.ts
index 00553097..a2eb2a8d 100644
--- a/src/services/contracts/baseDAO/types.ts
+++ b/src/services/contracts/baseDAO/types.ts
@@ -1,48 +1,45 @@
-import { ContractAbstraction, TezosToolkit, Wallet } from "@taquito/taquito";
-
-import {
- MetadataCarrierDeploymentData,
- MetadataCarrierParameters,
-} from "services/contracts/metadataCarrier/types";
-import { BigNumber } from "bignumber.js";
-import { MigrationParams } from "modules/creator/state";
+import { ContractAbstraction, TezosToolkit, Wallet } from "@taquito/taquito"
+
+import { MetadataCarrierDeploymentData, MetadataCarrierParameters } from "services/contracts/metadataCarrier/types"
+import { BigNumber } from "bignumber.js"
+import { MigrationParams } from "modules/creator/state"
import { Token as TokenModel } from "models/Token"
-export type Contract = ContractAbstraction | undefined;
+export type Contract = ContractAbstraction | undefined
export interface TokenHolder {
- address: string;
- balance: number;
+ address: string
+ balance: number
}
-export type TransferParams = XTZTransferParams | FA2TransferParams;
+export type TransferParams = XTZTransferParams | FA2TransferParams
export interface XTZTransferParams {
- amount: number;
- recipient: string;
+ amount: number
+ recipient: string
type: "XTZ"
}
export interface FA2TransferParams {
- amount: number;
- recipient: string;
- type: "FA2";
+ amount: number
+ recipient: string
+ type: "FA2"
asset: TokenModel
}
export interface Registry {
- key: string;
- value: string;
+ key: string
+ value: string
}
export interface ProposeParams {
- contractAddress: string;
- tezos: TezosToolkit;
+ contractAddress: string
+ tezos: TezosToolkit
contractParams: {
- tokensToFreeze: BigNumber;
- agoraPostId: number;
- transfers: TransferParams[];
- };
+ tokensToFreeze: BigNumber
+ agoraPostId: number
+ transfers: TransferParams[]
+ }
}
export interface ConfigProposalParams {
@@ -54,85 +51,82 @@ export interface ConfigProposalParams {
}
export interface OriginateParams {
- metadataParams: MetadataCarrierParameters;
- params: MigrationParams;
+ metadataParams: MetadataCarrierParameters
+ params: MigrationParams
}
export interface VoteParams {
- proposalKey: string;
- amount: BigNumber;
- tezos: TezosToolkit;
- contractAddress: string;
- support: boolean;
+ proposalKey: string
+ amount: BigNumber
+ tezos: TezosToolkit
+ contractAddress: string
+ support: boolean
}
export interface FlushParams {
- tezos: TezosToolkit;
- contractAddress: string;
- numerOfProposalsToFlush: number;
+ tezos: TezosToolkit
+ contractAddress: string
+ numerOfProposalsToFlush: number
}
export interface MemberTokenAllocation {
- address: string;
- tokenId: string;
- amount: string;
+ address: string
+ tokenId: string
+ amount: string
}
export interface BaseExtraState {
- frozenExtraValue: BigNumber;
- slashScaleValue: BigNumber;
- maxXtzAmount: BigNumber;
- minXtzAmount: BigNumber;
+ frozenExtraValue: BigNumber
+ slashScaleValue: BigNumber
+ maxXtzAmount: BigNumber
+ minXtzAmount: BigNumber
}
export interface BaseStorageParams {
- adminAddress: string;
+ adminAddress: string
governanceToken: {
- address: string;
- tokenId: string;
- };
- quorumThreshold: BigNumber;
- votingPeriod: number;
- extra: BaseExtraState;
-
- minQuorumAmount: BigNumber;
- maxQuorumAmount: BigNumber;
- guardian: string;
- quorumChange: number;
- quorumMaxChange: number;
- proposalFlushPeriod: number;
- proposalExpiryPeriod: number;
+ address: string
+ tokenId: string
+ }
+ quorumThreshold: BigNumber
+ votingPeriod: number
+ extra: BaseExtraState
+
+ minQuorumAmount: BigNumber
+ maxQuorumAmount: BigNumber
+ guardian: string
+ quorumChange: number
+ quorumMaxChange: number
+ proposalFlushPeriod: number
+ proposalExpiryPeriod: number
}
export type Token = {
- name: string;
- symbol: string;
- decimals: number;
-};
+ name: string
+ symbol: string
+ decimals: number
+}
export interface MetadataStorageState {
- keyName: string;
+ keyName: string
metadata: {
- frozenToken: Token;
- unfrozenToken: Token;
- };
+ frozenToken: Token
+ unfrozenToken: Token
+ }
}
export interface DAOParams {
- storage: BaseStorageParams;
- metadataCarrierDeploymentData: MetadataCarrierDeploymentData;
+ storage: BaseStorageParams
+ metadataCarrierDeploymentData: MetadataCarrierDeploymentData
}
-export type ParamsWithoutMetadata = Omit<
- DAOParams,
- "metadataCarrierDeploymentData"
->;
+export type ParamsWithoutMetadata = Omit
export interface Extra {
- frozenExtraValue: BigNumber;
- slashExtraValue: BigNumber;
- minXtzAmount: BigNumber;
- maxXtzAmount: BigNumber;
- frozenScaleValue: BigNumber;
- slashDivisionScale: BigNumber;
+ frozenExtraValue: BigNumber
+ slashExtraValue: BigNumber
+ minXtzAmount: BigNumber
+ maxXtzAmount: BigNumber
+ frozenScaleValue: BigNumber
+ slashDivisionScale: BigNumber
}
diff --git a/src/services/contracts/baseDAO/utils.ts b/src/services/contracts/baseDAO/utils.ts
index db26ad6f..ec096355 100644
--- a/src/services/contracts/baseDAO/utils.ts
+++ b/src/services/contracts/baseDAO/utils.ts
@@ -1,24 +1,24 @@
-import {TezosToolkit} from "@taquito/taquito";
-import {tzip16} from "@taquito/tzip16";
-import {BigNumber} from "bignumber.js";
-import dayjs from "dayjs";
-import {MigrationParams} from "modules/creator/state";
-import {CycleType} from ".";
-import {BaseStorageParams} from "./types";
-import {unpackDataBytes} from "@taquito/michel-codec";
-import isBetween from "dayjs/plugin/isBetween";
-
-dayjs.extend(isBetween);
+import { TezosToolkit } from "@taquito/taquito"
+import { tzip16 } from "@taquito/tzip16"
+import { BigNumber } from "bignumber.js"
+import dayjs from "dayjs"
+import { MigrationParams } from "modules/creator/state"
+import { CycleType } from "."
+import { BaseStorageParams } from "./types"
+import { unpackDataBytes } from "@taquito/michel-codec"
+import isBetween from "dayjs/plugin/isBetween"
+
+dayjs.extend(isBetween)
export const fromStateToBaseStorage = (info: MigrationParams): BaseStorageParams => {
- const proposalFlush = 2 * info.votingSettings.votingBlocks + info.votingSettings.proposalFlushBlocks;
- const expiryPeriod = proposalFlush + info.votingSettings.proposalExpiryBlocks;
+ const proposalFlush = 2 * info.votingSettings.votingBlocks + info.votingSettings.proposalFlushBlocks
+ const expiryPeriod = proposalFlush + info.votingSettings.proposalExpiryBlocks
return {
adminAddress: info.orgSettings.administrator || "",
governanceToken: {
address: info.orgSettings.governanceToken.address,
- tokenId: info.orgSettings.governanceToken.tokenId,
+ tokenId: info.orgSettings.governanceToken.tokenId
},
guardian: info.orgSettings.guardian,
extra: {
@@ -26,7 +26,7 @@ export const fromStateToBaseStorage = (info: MigrationParams): BaseStorageParams
slashScaleValue: new BigNumber(100 - info.votingSettings.returnedTokenPercentage),
minXtzAmount: new BigNumber(info.votingSettings.minXtzAmount),
- maxXtzAmount: new BigNumber(info.votingSettings.maxXtzAmount || 0),
+ maxXtzAmount: new BigNumber(info.votingSettings.maxXtzAmount || 0)
},
quorumThreshold: new BigNumber(info.quorumSettings.quorumThreshold),
votingPeriod: info.votingSettings.votingBlocks || 0,
@@ -36,28 +36,28 @@ export const fromStateToBaseStorage = (info: MigrationParams): BaseStorageParams
quorumMaxChange: info.quorumSettings.quorumMaxChange,
proposalFlushPeriod: proposalFlush,
- proposalExpiryPeriod: expiryPeriod,
- };
-};
+ proposalExpiryPeriod: expiryPeriod
+ }
+}
export const getContract = async (tezos: TezosToolkit, contractAddress: string) => {
- return await tezos.wallet.at(contractAddress, tzip16);
-};
+ return await tezos.wallet.at(contractAddress, tzip16)
+}
export const calculateCycleInfo = (originationTime: string, votingPeriod: number) => {
- const current = dayjs().unix() - dayjs(originationTime).unix();
- const periodLeftPercentage = (current / votingPeriod) % 1;
- const timeLeftPercentage = votingPeriod * periodLeftPercentage;
- const time = votingPeriod - Number(timeLeftPercentage.toFixed());
- const currentPeriodNumber = Math.floor(current / votingPeriod);
+ const current = dayjs().unix() - dayjs(originationTime).unix()
+ const periodLeftPercentage = (current / votingPeriod) % 1
+ const timeLeftPercentage = votingPeriod * periodLeftPercentage
+ const time = votingPeriod - Number(timeLeftPercentage.toFixed())
+ const currentPeriodNumber = Math.floor(current / votingPeriod)
return {
time: Number(time),
current: currentPeriodNumber,
- type: currentPeriodNumber % 2 === 0 ? "voting" : ("proposing" as CycleType),
- };
-};
+ type: currentPeriodNumber % 2 === 0 ? "voting" : ("proposing" as CycleType)
+ }
+}
export const unpackExtraNumValue = (bytes: string): BigNumber => {
- return new BigNumber((unpackDataBytes({ bytes }) as { int: string }).int);
-};
+ return new BigNumber((unpackDataBytes({ bytes }) as { int: string }).int)
+}
diff --git a/src/services/contracts/metadataCarrier/code.ts b/src/services/contracts/metadataCarrier/code.ts
index a801e00b..b00d90cc 100644
--- a/src/services/contracts/metadataCarrier/code.ts
+++ b/src/services/contracts/metadataCarrier/code.ts
@@ -6,4 +6,4 @@ code { CAR;
UNIT;
PUSH string "EmptySupplied";
PAIR;
- FAILWITH };`;
+ FAILWITH };`
diff --git a/src/services/contracts/metadataCarrier/deploy.ts b/src/services/contracts/metadataCarrier/deploy.ts
index 2e7c41f6..7c22ff12 100644
--- a/src/services/contracts/metadataCarrier/deploy.ts
+++ b/src/services/contracts/metadataCarrier/deploy.ts
@@ -1,62 +1,51 @@
-import {
- ContractAbstraction,
- ContractProvider,
- MichelsonMap,
- TezosToolkit,
- Wallet,
-} from "@taquito/taquito";
-import { char2Bytes } from "@taquito/tzip16";
+import { ContractAbstraction, ContractProvider, MichelsonMap, TezosToolkit, Wallet } from "@taquito/taquito"
+import { char2Bytes } from "@taquito/tzip16"
-import { code } from "services/contracts/metadataCarrier/code";
-import { setMetadataJSON } from "services/contracts/metadataCarrier/metadata";
-import {
- MetadataCarrierParameters,
- MetadataParams,
-} from "services/contracts/metadataCarrier/types";
+import { code } from "services/contracts/metadataCarrier/code"
+import { setMetadataJSON } from "services/contracts/metadataCarrier/metadata"
+import { MetadataCarrierParameters, MetadataParams } from "services/contracts/metadataCarrier/types"
const setMetadataMap = (keyName: string, metadata: MetadataParams) => {
- const map = new MichelsonMap();
- const json = setMetadataJSON(metadata);
+ const map = new MichelsonMap()
+ const json = setMetadataJSON(metadata)
- map.set(keyName, char2Bytes(JSON.stringify(json)));
+ map.set(keyName, char2Bytes(JSON.stringify(json)))
- return map;
-};
+ return map
+}
export interface MetadataDeploymentResult {
- contract: ContractAbstraction;
- keyName: string;
- deployAddress: string;
+ contract: ContractAbstraction
+ keyName: string
+ deployAddress: string
}
interface Tezos {
- tezos: TezosToolkit;
- connect: () => Promise;
+ tezos: TezosToolkit
+ connect: () => Promise
}
export const deployMetadataCarrier = async ({
keyName,
metadata,
- tezos,
-}: MetadataCarrierParameters & Tezos): Promise<
- MetadataDeploymentResult | undefined
-> => {
- const metadataMap = setMetadataMap(keyName, metadata);
+ tezos
+}: MetadataCarrierParameters & Tezos): Promise => {
+ const metadataMap = setMetadataMap(keyName, metadata)
try {
- console.log("Originating Metadata Carrier contract...");
+ console.log("Originating Metadata Carrier contract...")
const t = await tezos.wallet.originate({
code,
storage: {
- metadata: metadataMap,
- },
- });
- console.log("Waiting for confirmation on Metadata Carrier contract...", t);
- const c = await t.send();
- const contract = await c.contract();
- console.log("Metadata Carrier deployment completed", c);
- return { contract, keyName, deployAddress: contract.address };
+ metadata: metadataMap
+ }
+ })
+ console.log("Waiting for confirmation on Metadata Carrier contract...", t)
+ const c = await t.send()
+ const contract = await c.contract()
+ console.log("Metadata Carrier deployment completed", c)
+ return { contract, keyName, deployAddress: contract.address }
} catch (e: Error | any | unknown) {
// This should be handled above!
if (e.name === "UnconfiguredSignerError") {
@@ -64,11 +53,10 @@ export const deployMetadataCarrier = async ({
// Let's connect to a wallet provider and trigger the deployment method again
}
if (e instanceof Error) {
- const error: Error = e;
- console.log(error.name + ": " + error.message + "\n" + error.stack);
- }
- else {
- console.log(e);
+ const error: Error = e
+ console.log(error.name + ": " + error.message + "\n" + error.stack)
+ } else {
+ console.log(e)
}
}
-};
+}
diff --git a/src/services/contracts/metadataCarrier/index.ts b/src/services/contracts/metadataCarrier/index.ts
index 0de47687..47a6d311 100644
--- a/src/services/contracts/metadataCarrier/index.ts
+++ b/src/services/contracts/metadataCarrier/index.ts
@@ -1,24 +1,18 @@
-import {
- MichelsonMap,
- TezosToolkit,
-} from "@taquito/taquito";
-import { bytes2Char } from "@taquito/tzip16";
-import { DAOListMetadata } from "services/contracts/metadataCarrier/types";
-import { getContract } from "../baseDAO";
+import { MichelsonMap, TezosToolkit } from "@taquito/taquito"
+import { bytes2Char } from "@taquito/tzip16"
+import { DAOListMetadata } from "services/contracts/metadataCarrier/types"
+import { getContract } from "../baseDAO"
-export const getDAOListMetadata = async (
- contractAddress: string,
- tezos: TezosToolkit
-): Promise => {
+export const getDAOListMetadata = async (contractAddress: string, tezos: TezosToolkit): Promise => {
const contract = await getContract(tezos, contractAddress)
- const metadata = await contract.tzip16().getMetadata();
- const views = await contract.tzip16().metadataViews();
+ const metadata = await contract.tzip16().getMetadata()
+ const views = await contract.tzip16().metadataViews()
const {
- 1: fa2Map,
+ 1: fa2Map
}: {
- 1: MichelsonMap;
- } = await views.token_metadata().executeView(0);
+ 1: MichelsonMap
+ } = await views.token_metadata().executeView(0)
return {
address: contractAddress,
@@ -29,7 +23,7 @@ export const getDAOListMetadata = async (
unfrozenToken: {
symbol: bytes2Char(fa2Map.get("symbol") as string),
name: bytes2Char(fa2Map.get("name") as string),
- decimals: bytes2Char(fa2Map.get("decimals") as string),
- },
- };
-};
+ decimals: bytes2Char(fa2Map.get("decimals") as string)
+ }
+ }
+}
diff --git a/src/services/contracts/metadataCarrier/metadata.ts b/src/services/contracts/metadataCarrier/metadata.ts
index 1be0f32f..c9bc057e 100644
--- a/src/services/contracts/metadataCarrier/metadata.ts
+++ b/src/services/contracts/metadataCarrier/metadata.ts
@@ -1,12 +1,12 @@
-import { stringToHex } from "services/contracts/utils";
-import { MetadataParams } from "services/contracts/metadataCarrier/types";
+import { stringToHex } from "services/contracts/utils"
+import { MetadataParams } from "services/contracts/metadataCarrier/types"
export const setMetadataJSON = ({
description,
authors,
template,
frozenToken: { name: fName, symbol: fSymbol, decimals: fDecimals },
- unfrozenToken: { name: uName, symbol: uSymbol, decimals: uDecimals },
+ unfrozenToken: { name: uName, symbol: uSymbol, decimals: uDecimals }
}: MetadataParams): Record => ({
homepage: "https://github.com/tqtezos/baseDAO",
name: uName,
@@ -20,36 +20,36 @@ export const setMetadataJSON = ({
{
michelsonStorageView: {
returnType: {
- prim: "nat",
+ prim: "nat"
},
code: [
{
- prim: "DUP",
+ prim: "DUP"
},
{
- prim: "CAR",
+ prim: "CAR"
},
{
args: [
[
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "CAR",
+ prim: "CAR"
},
{
- prim: "CAR",
+ prim: "CAR"
},
{
- prim: "CAR",
- },
- ],
+ prim: "CAR"
+ }
+ ]
],
- prim: "DIP",
+ prim: "DIP"
},
{
- prim: "GET",
+ prim: "GET"
},
{
args: [
@@ -57,39 +57,39 @@ export const setMetadataJSON = ({
{
args: [
{
- prim: "nat",
+ prim: "nat"
},
{
- int: "0",
- },
+ int: "0"
+ }
],
- prim: "PUSH",
- },
+ prim: "PUSH"
+ }
],
- [],
+ []
],
- prim: "IF_NONE",
- },
+ prim: "IF_NONE"
+ }
],
parameter: {
args: [
{
prim: "address",
- annots: ["%owner"],
+ annots: ["%owner"]
},
{
prim: "nat",
- annots: ["%token_id"],
- },
+ annots: ["%token_id"]
+ }
],
- prim: "pair",
- },
- },
- },
+ prim: "pair"
+ }
+ }
+ }
],
name: "get_balance",
pure: true,
- description: "Get balance of an address according to TZIP-12.",
+ description: "Get balance of an address according to TZIP-12."
},
{
implementations: [
@@ -98,139 +98,139 @@ export const setMetadataJSON = ({
returnType: {
args: [
{
- prim: "nat",
- },
+ prim: "nat"
+ }
],
- prim: "list",
+ prim: "list"
},
code: [
{
- prim: "DROP",
+ prim: "DROP"
},
{
args: [
{
args: [
{
- prim: "nat",
- },
+ prim: "nat"
+ }
],
- prim: "list",
+ prim: "list"
},
[
{
- int: "0",
+ int: "0"
},
{
- int: "1",
- },
- ],
+ int: "1"
+ }
+ ]
],
- prim: "PUSH",
- },
- ],
- },
- },
+ prim: "PUSH"
+ }
+ ]
+ }
+ }
],
name: "all_tokens",
pure: true,
- description: "Get all supported tokens according to TZIP-12.",
+ description: "Get all supported tokens according to TZIP-12."
},
{
implementations: [
{
michelsonStorageView: {
returnType: {
- prim: "bool",
+ prim: "bool"
},
code: [
{
- prim: "DUP",
+ prim: "DUP"
},
{
- prim: "CAR",
+ prim: "CAR"
},
{
args: [
[
{
- prim: "CDR",
- },
- ],
+ prim: "CDR"
+ }
+ ]
],
- prim: "DIP",
+ prim: "DIP"
},
{
- prim: "DUP",
+ prim: "DUP"
},
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "CDR",
+ prim: "CDR"
},
{
args: [
[
{
- prim: "DUP",
+ prim: "DUP"
},
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "CAR",
+ prim: "CAR"
},
{
args: [
[
{
- prim: "CAR",
- },
- ],
+ prim: "CAR"
+ }
+ ]
],
- prim: "DIP",
- },
- ],
+ prim: "DIP"
+ }
+ ]
],
- prim: "DIP",
+ prim: "DIP"
},
{
- prim: "DUP",
+ prim: "DUP"
},
{
- prim: "INT",
+ prim: "INT"
},
{
- prim: "EQ",
+ prim: "EQ"
},
{
args: [
[
{
- prim: "DROP",
- },
+ prim: "DROP"
+ }
],
[
{
- prim: "DUP",
+ prim: "DUP"
},
{
args: [
{
- prim: "nat",
+ prim: "nat"
},
{
- int: "1",
- },
+ int: "1"
+ }
],
- prim: "PUSH",
+ prim: "PUSH"
},
{
- prim: "COMPARE",
+ prim: "COMPARE"
},
{
- prim: "EQ",
+ prim: "EQ"
},
{
args: [
@@ -238,105 +238,105 @@ export const setMetadataJSON = ({
{
args: [
{
- prim: "string",
+ prim: "string"
},
{
- string: "OPERATION_PROHIBITED",
- },
+ string: "OPERATION_PROHIBITED"
+ }
],
- prim: "PUSH",
+ prim: "PUSH"
},
{
- prim: "FAILWITH",
- },
+ prim: "FAILWITH"
+ }
],
[
{
- prim: "UNIT",
+ prim: "UNIT"
},
{
args: [
{
- prim: "string",
+ prim: "string"
},
{
- string: "FA2_TOKEN_UNDEFINED",
- },
+ string: "FA2_TOKEN_UNDEFINED"
+ }
],
- prim: "PUSH",
+ prim: "PUSH"
},
{
- prim: "PAIR",
+ prim: "PAIR"
},
{
- prim: "FAILWITH",
- },
- ],
+ prim: "FAILWITH"
+ }
+ ]
],
- prim: "IF",
- },
- ],
+ prim: "IF"
+ }
+ ]
],
- prim: "IF",
+ prim: "IF"
},
{
- prim: "SWAP",
+ prim: "SWAP"
},
{
- prim: "PAIR",
+ prim: "PAIR"
},
{
args: [
[
{
- prim: "CAR",
+ prim: "CAR"
},
{
- prim: "CAR",
+ prim: "CAR"
},
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "CAR",
- },
- ],
+ prim: "CAR"
+ }
+ ]
],
- prim: "DIP",
+ prim: "DIP"
},
{
- prim: "MEM",
- },
+ prim: "MEM"
+ }
],
parameter: {
args: [
{
prim: "address",
- annots: ["%owner"],
+ annots: ["%owner"]
},
{
args: [
{
prim: "address",
- annots: ["%operator"],
+ annots: ["%operator"]
},
{
prim: "nat",
- annots: ["%token_id"],
- },
+ annots: ["%token_id"]
+ }
],
- prim: "pair",
- },
+ prim: "pair"
+ }
],
- prim: "pair",
- },
- },
- },
+ prim: "pair"
+ }
+ }
+ }
],
name: "is_operator",
pure: true,
description:
- "Checks whether given address is allowed to transfer given tokens that belong to given owner - according to TZIP-12.",
+ "Checks whether given address is allowed to transfer given tokens that belong to given owner - according to TZIP-12."
},
{
implementations: [
@@ -345,241 +345,240 @@ export const setMetadataJSON = ({
returnType: {
args: [
{
- prim: "nat",
+ prim: "nat"
},
{
args: [
{
- prim: "string",
+ prim: "string"
},
{
- prim: "bytes",
- },
+ prim: "bytes"
+ }
],
- prim: "map",
- },
+ prim: "map"
+ }
],
- prim: "pair",
+ prim: "pair"
},
code: [
{
- prim: "DUP",
+ prim: "DUP"
},
{
- prim: "CAR",
+ prim: "CAR"
},
{
args: [
[
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "DROP",
+ prim: "DROP"
},
{
args: [
{
args: [
{
- prim: "nat",
+ prim: "nat"
},
{
args: [
{
- prim: "string",
+ prim: "string"
},
{
- prim: "bytes",
- },
+ prim: "bytes"
+ }
],
- prim: "map",
- },
+ prim: "map"
+ }
],
- prim: "map",
+ prim: "map"
},
[
{
args: [
{
- int: "0",
+ int: "0"
},
[
{
args: [
{
- string: "decimals",
+ string: "decimals"
},
{
- bytes: stringToHex(uDecimals.toString()),
- },
+ bytes: stringToHex(uDecimals.toString())
+ }
],
- prim: "Elt",
+ prim: "Elt"
},
{
args: [
{
- string: "name",
+ string: "name"
},
{
- bytes: stringToHex(uName),
- },
+ bytes: stringToHex(uName)
+ }
],
- prim: "Elt",
+ prim: "Elt"
},
{
args: [
{
- string: "symbol",
+ string: "symbol"
},
{
- bytes: stringToHex(uSymbol),
- },
+ bytes: stringToHex(uSymbol)
+ }
],
- prim: "Elt",
- },
- ],
+ prim: "Elt"
+ }
+ ]
],
- prim: "Elt",
+ prim: "Elt"
},
{
args: [
{
- int: "1",
+ int: "1"
},
[
{
args: [
{
- string: "decimals",
+ string: "decimals"
},
{
- bytes: stringToHex(fDecimals.toString()),
- },
+ bytes: stringToHex(fDecimals.toString())
+ }
],
- prim: "Elt",
+ prim: "Elt"
},
{
args: [
{
- string: "name",
+ string: "name"
},
{
- bytes: stringToHex(fName),
- },
+ bytes: stringToHex(fName)
+ }
],
- prim: "Elt",
+ prim: "Elt"
},
{
args: [
{
- string: "symbol",
+ string: "symbol"
},
{
- bytes: stringToHex(fSymbol),
- },
+ bytes: stringToHex(fSymbol)
+ }
],
- prim: "Elt",
- },
- ],
+ prim: "Elt"
+ }
+ ]
],
- prim: "Elt",
- },
- ],
+ prim: "Elt"
+ }
+ ]
],
- prim: "PUSH",
- },
- ],
+ prim: "PUSH"
+ }
+ ]
],
- prim: "DIP",
+ prim: "DIP"
},
{
- prim: "DUP",
+ prim: "DUP"
},
{
args: [
[
{
- prim: "GET",
+ prim: "GET"
},
{
args: [
[
{
- prim: "UNIT",
+ prim: "UNIT"
},
{
args: [
{
- prim: "string",
+ prim: "string"
},
{
- string: "FA2_TOKEN_UNDEFINED",
- },
+ string: "FA2_TOKEN_UNDEFINED"
+ }
],
- prim: "PUSH",
+ prim: "PUSH"
},
{
- prim: "PAIR",
+ prim: "PAIR"
},
{
- prim: "FAILWITH",
- },
+ prim: "FAILWITH"
+ }
],
- [],
+ []
],
- prim: "IF_NONE",
- },
- ],
+ prim: "IF_NONE"
+ }
+ ]
],
- prim: "DIP",
+ prim: "DIP"
},
{
- prim: "PAIR",
- },
+ prim: "PAIR"
+ }
],
parameter: {
- prim: "nat",
- },
- },
- },
+ prim: "nat"
+ }
+ }
+ }
],
name: "token_metadata",
pure: true,
- description: "Returns metadata for given token according to TZIP-12.",
+ description: "Returns metadata for given token according to TZIP-12."
},
{
implementations: [
{
michelsonStorageView: {
returnType: {
- prim: "nat",
+ prim: "nat"
},
code: [
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "CDR",
+ prim: "CDR"
},
{
- prim: "CAR",
- },
- ],
- },
- },
+ prim: "CAR"
+ }
+ ]
+ }
+ }
],
name: "GetCounter",
pure: true,
- description:
- "Returns the next counter value with which a permit should be created.",
- },
+ description: "Returns the next counter value with which a permit should be created."
+ }
],
version: "1.0.0",
license: {
- name: "MIT",
- },
-});
+ name: "MIT"
+ }
+})
diff --git a/src/services/contracts/metadataCarrier/types.ts b/src/services/contracts/metadataCarrier/types.ts
index e59d5724..23cf5be6 100644
--- a/src/services/contracts/metadataCarrier/types.ts
+++ b/src/services/contracts/metadataCarrier/types.ts
@@ -1,55 +1,55 @@
-import { DAOTemplate } from "../../../modules/creator/state/types";
+import { DAOTemplate } from "../../../modules/creator/state/types"
export interface FA2TokenMetadata {
- name: string;
- symbol: string;
- decimals: number;
+ name: string
+ symbol: string
+ decimals: number
}
export interface FA2MetadataParams {
- unfrozenToken: FA2TokenMetadata;
- frozenToken: FA2TokenMetadata;
+ unfrozenToken: FA2TokenMetadata
+ frozenToken: FA2TokenMetadata
}
export interface DAOMetadataParams {
- description: string;
- template: DAOTemplate;
- authors: string[];
+ description: string
+ template: DAOTemplate
+ authors: string[]
}
-export type MetadataParams = FA2MetadataParams & DAOMetadataParams;
+export type MetadataParams = FA2MetadataParams & DAOMetadataParams
export interface MetadataCarrierDeploymentData {
- deployAddress: string;
- keyName: string;
+ deployAddress: string
+ keyName: string
}
export interface MetadataCarrierParameters {
- keyName: string;
- metadata: MetadataParams;
+ keyName: string
+ metadata: MetadataParams
}
export interface DAOMetadataDTO {
- integrityCheckResult: any;
+ integrityCheckResult: any
metadata: {
- authors: string[];
- homepage: string;
- interfaces: string[];
- license: { name: string };
- version: string;
- views: any[];
- };
- sha256Hash: any;
- uri: string;
+ authors: string[]
+ homepage: string
+ interfaces: string[]
+ license: { name: string }
+ version: string
+ views: any[]
+ }
+ sha256Hash: any
+ uri: string
}
export interface DAOListMetadata {
- address: string;
- authors: string[];
- name: string;
- template: DAOTemplate;
- description: string;
+ address: string
+ authors: string[]
+ name: string
+ template: DAOTemplate
+ description: string
unfrozenToken: {
- symbol: string;
- name: string;
- decimals: string;
- };
+ symbol: string
+ name: string
+ decimals: string
+ }
}
diff --git a/src/services/contracts/utils.ts b/src/services/contracts/utils.ts
index bf9f0e5c..0913271e 100644
--- a/src/services/contracts/utils.ts
+++ b/src/services/contracts/utils.ts
@@ -1,30 +1,30 @@
-import { BigNumber } from "bignumber.js";
-import blockies from "blockies-ts";
+import { BigNumber } from "bignumber.js"
+import blockies from "blockies-ts"
export const stringToHex = (value: string): string => {
- let result = "";
+ let result = ""
for (let i = 0; i < value.length; i++) {
- result += value.charCodeAt(i).toString(16).slice(-4);
+ result += value.charCodeAt(i).toString(16).slice(-4)
}
- return result;
-};
+ return result
+}
export const toShortAddress = (address: string, limit = 4): string => {
return address
.slice(0, limit)
.concat("...")
- .concat(address.slice(address.length - limit, address.length));
-};
+ .concat(address.slice(address.length - limit, address.length))
+}
export const mutezToXtz = (mutez: BigNumber) => {
- return parseUnits(mutez, 6);
-};
+ return parseUnits(mutez, 6)
+}
export const xtzToMutez = (xtz: BigNumber) => {
- return formatUnits(xtz, 6);
-};
+ return formatUnits(xtz, 6)
+}
export const parseUnits = (amount: BigNumber, decimals: number | string) => {
return amount.dividedBy(new BigNumber(10).pow(decimals))
@@ -35,28 +35,26 @@ export const formatUnits = (amount: BigNumber, decimals: number | string) => {
}
const b582int = (val: string): string => {
- let rv = new BigNumber(0);
- const alpha = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
+ let rv = new BigNumber(0)
+ const alpha = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
for (let i = 0; i < val.length; i++) {
rv = rv.plus(
- new BigNumber(alpha.indexOf(val[val.length - 1 - i])).multipliedBy(
- new BigNumber(alpha.length).exponentiatedBy(i)
- )
- );
+ new BigNumber(alpha.indexOf(val[val.length - 1 - i])).multipliedBy(new BigNumber(alpha.length).exponentiatedBy(i))
+ )
}
- return rv.toString(16);
-};
+ return rv.toString(16)
+}
export const getBlockie = (address: string): string => {
if (address.startsWith("tz") || address.startsWith("kt")) {
return blockies
.create({
seed: `0${b582int(address)}`,
- spotcolor: "#000",
+ spotcolor: "#000"
})
- .toDataURL();
+ .toDataURL()
}
- return blockies.create({ seed: address }).toDataURL();
-};
+ return blockies.create({ seed: address }).toDataURL()
+}
diff --git a/src/services/indexer/dao/hooks/useAllDAOs.ts b/src/services/indexer/dao/hooks/useAllDAOs.ts
index d7f629d9..38a5d82a 100644
--- a/src/services/indexer/dao/hooks/useAllDAOs.ts
+++ b/src/services/indexer/dao/hooks/useAllDAOs.ts
@@ -1,15 +1,15 @@
-import { useQuery } from "react-query";
-import { Network } from "services/beacon";
-import { getDAOs } from "services/indexer/dao/services";
+import { useQuery } from "react-query"
+import { Network } from "services/beacon"
+import { getDAOs } from "services/indexer/dao/services"
export const useAllDAOs = (network: Network) => {
return useQuery(
["daos", network],
async () => {
- return await getDAOs(network);
+ return await getDAOs(network)
},
{
- enabled: !!network,
+ enabled: !!network
}
- );
-};
+ )
+}
diff --git a/src/services/indexer/dao/hooks/useDAO.ts b/src/services/indexer/dao/hooks/useDAO.ts
index f0b5e8eb..bf00c06e 100644
--- a/src/services/indexer/dao/hooks/useDAO.ts
+++ b/src/services/indexer/dao/hooks/useDAO.ts
@@ -1,58 +1,44 @@
-import BigNumber from "bignumber.js";
-import { Token } from "models/Token";
-import { useState, useContext, useEffect, useMemo } from "react";
-import { useQuery } from "react-query";
-import { TZKTSubscriptionsContext } from "services/bakingBad/context/TZKTSubscriptions";
-import { Network } from "services/beacon";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import {
- TreasuryDAO,
- RegistryDAO,
- unpackExtraNumValue,
- CycleInfo,
-} from "services/contracts/baseDAO";
-import { parseUnits } from "services/contracts/utils";
-import { getDAO } from "services/indexer/dao/services";
-import { useBlockchainInfo } from "../../../contracts/baseDAO/hooks/useBlockchainInfo";
+import BigNumber from "bignumber.js"
+import { Token } from "models/Token"
+import { useState, useContext, useEffect, useMemo } from "react"
+import { useQuery } from "react-query"
+import { TZKTSubscriptionsContext } from "services/bakingBad/context/TZKTSubscriptions"
+import { Network } from "services/beacon"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { TreasuryDAO, RegistryDAO, unpackExtraNumValue, CycleInfo } from "services/contracts/baseDAO"
+import { parseUnits } from "services/contracts/utils"
+import { getDAO } from "services/indexer/dao/services"
+import { useBlockchainInfo } from "../../../contracts/baseDAO/hooks/useBlockchainInfo"
export const useDAO = (address: string) => {
- const [cycleInfo, setCycleInfo] = useState();
- const { network } = useTezos();
- const { data: blockchainInfo } = useBlockchainInfo();
+ const [cycleInfo, setCycleInfo] = useState()
+ const { network } = useTezos()
+ const { data: blockchainInfo } = useBlockchainInfo()
const {
- state: { block },
- } = useContext(TZKTSubscriptionsContext);
+ state: { block }
+ } = useContext(TZKTSubscriptionsContext)
const { data, ...rest } = useQuery(
["dao", address],
async () => {
- const response = await getDAO(address as string);
+ const response = await getDAO(address as string)
- const dao = response.daos[0];
+ const dao = response.daos[0]
const base = {
...dao,
token: new Token({
...dao.token,
id: dao.token.id.toString(),
- network: dao.token.network as Network,
+ network: dao.token.network as Network
}),
- ledger: dao.ledgers.map((ledger) => {
- const current_unstaked = parseUnits(
- new BigNumber(ledger.current_unstaked),
- dao.token.decimals
- );
+ ledger: dao.ledgers.map(ledger => {
+ const current_unstaked = parseUnits(new BigNumber(ledger.current_unstaked), dao.token.decimals)
- const past_unstaked = parseUnits(
- new BigNumber(ledger.past_unstaked),
- dao.token.decimals
- );
+ const past_unstaked = parseUnits(new BigNumber(ledger.past_unstaked), dao.token.decimals)
- const staked = parseUnits(
- new BigNumber(ledger.staked),
- dao.token.decimals
- );
+ const staked = parseUnits(new BigNumber(ledger.staked), dao.token.decimals)
- const current_stage_num = ledger.current_stage_num;
+ const current_stage_num = ledger.current_stage_num
return {
...ledger,
@@ -62,16 +48,13 @@ export const useDAO = (address: string) => {
staked,
holder: {
...ledger.holder,
- proposals_voted:
- ledger.holder.proposals_aggregate?.aggregate.count || 0,
+ proposals_voted: ledger.holder.proposals_aggregate?.aggregate.count || 0,
votes_cast: parseUnits(
- new BigNumber(
- ledger.holder.votes_aggregate?.aggregate.sum.amount || 0
- ),
+ new BigNumber(ledger.holder.votes_aggregate?.aggregate.sum.amount || 0),
dao.token.decimals
- ),
- },
- };
+ )
+ }
+ }
}),
type: dao.dao_type.name,
extra:
@@ -86,7 +69,7 @@ export const useDAO = (address: string) => {
slash_division_value: unpackExtraNumValue((dao.registry_extras[0] as any).slash_division_value),
min_xtz_amount: unpackExtraNumValue((dao.registry_extras[0] as any).min_xtz_amount),
max_xtz_amount: unpackExtraNumValue((dao.registry_extras[0] as any).max_xtz_amount),
- slash_scale_value: unpackExtraNumValue((dao.registry_extras[0] as any).slash_scale_value),
+ slash_scale_value: unpackExtraNumValue((dao.registry_extras[0] as any).slash_scale_value)
} as any)
: ({
...dao.treasury_extras[0],
@@ -98,79 +81,70 @@ export const useDAO = (address: string) => {
slash_division_value: unpackExtraNumValue((dao.treasury_extras[0] as any).slash_division_value),
min_xtz_amount: unpackExtraNumValue((dao.treasury_extras[0] as any).min_xtz_amount),
max_xtz_amount: unpackExtraNumValue((dao.treasury_extras[0] as any).max_xtz_amount),
- slash_scale_value: unpackExtraNumValue((dao.treasury_extras[0] as any).slash_scale_value),
+ slash_scale_value: unpackExtraNumValue((dao.treasury_extras[0] as any).slash_scale_value)
} as any),
- quorum_threshold: parseUnits(
- new BigNumber(dao.quorum_threshold),
- dao.token.decimals
- ),
- };
+ quorum_threshold: parseUnits(new BigNumber(dao.quorum_threshold), dao.token.decimals)
+ }
switch (dao.dao_type.name) {
case "treasury":
- return new TreasuryDAO(base);
+ return new TreasuryDAO(base)
case "registry":
- return new RegistryDAO(base);
+ return new RegistryDAO(base)
default:
- throw new Error(
- `DAO with address '${dao.address}' has an unrecognized type '${dao.dao_type.name}'`
- );
+ throw new Error(`DAO with address '${dao.address}' has an unrecognized type '${dao.dao_type.name}'`)
}
},
{
enabled: !!address,
- refetchInterval: 30000,
+ refetchInterval: 30000
}
- );
+ )
useEffect(() => {
- (async () => {
+ ;(async () => {
if (data && blockchainInfo) {
- const blockTimeAverage = blockchainInfo.constants.timeBetweenBlocks;
- const blocksFromStart = block - data.data.start_level;
- const periodsFromStart = Math.floor(
- blocksFromStart / Number(data.data.period)
- );
- const type = periodsFromStart % 2 == 0 ? "voting" : "proposing";
- const blocksLeft =
- Number(data.data.period) -
- (blocksFromStart % Number(data.data.period));
+ const blockTimeAverage = blockchainInfo.constants.timeBetweenBlocks
+ const blocksFromStart = block - data.data.start_level
+ const periodsFromStart = Math.floor(blocksFromStart / Number(data.data.period))
+ const type = periodsFromStart % 2 == 0 ? "voting" : "proposing"
+ const blocksLeft = Number(data.data.period) - (blocksFromStart % Number(data.data.period))
setCycleInfo({
blocksLeft,
type,
timeEstimateForNextBlock: blockTimeAverage,
currentCycle: periodsFromStart,
- currentLevel: block,
- });
+ currentLevel: block
+ })
}
- })();
- }, [data, blockchainInfo, block, network]);
+ })()
+ }, [data, blockchainInfo, block, network])
const ledgerWithBalances = useMemo(() => {
if (data && cycleInfo) {
- return data.data.ledger.map((l) => {
+ return data.data.ledger.map(l => {
const available_balance =
cycleInfo.currentCycle > Number(l.current_stage_num)
? l.current_unstaked.plus(l.past_unstaked)
- : l.past_unstaked;
+ : l.past_unstaked
- const total_balance = l.current_unstaked.plus(l.past_unstaked);
+ const total_balance = l.current_unstaked.plus(l.past_unstaked)
return {
...l,
available_balance,
pending_balance: total_balance.minus(available_balance),
- total_balance,
- };
- });
+ total_balance
+ }
+ })
}
- }, [data, cycleInfo]);
+ }, [data, cycleInfo])
return {
data,
cycleInfo,
ledger: ledgerWithBalances,
- ...rest,
- };
-};
+ ...rest
+ }
+}
diff --git a/src/services/indexer/dao/hooks/useProposal.ts b/src/services/indexer/dao/hooks/useProposal.ts
index eac410b2..a81e12a8 100644
--- a/src/services/indexer/dao/hooks/useProposal.ts
+++ b/src/services/indexer/dao/hooks/useProposal.ts
@@ -1,59 +1,45 @@
-import { useQuery } from "react-query";
-import { BaseDAO } from "services/contracts/baseDAO";
-import {
- Proposal,
- RegistryProposal,
- TreasuryProposal,
-} from "../mappers/proposal/types";
-import { getProposal } from "../services";
-import { useDAO } from "./useDAO";
+import { useQuery } from "react-query"
+import { BaseDAO } from "services/contracts/baseDAO"
+import { Proposal, RegistryProposal, TreasuryProposal } from "../mappers/proposal/types"
+import { getProposal } from "../services"
+import { useDAO } from "./useDAO"
export const useProposal = (contractAddress: string, proposalKey: string) => {
- const {
- data: daoData,
- isLoading,
- error,
- cycleInfo,
- } = useDAO(contractAddress);
+ const { data: daoData, isLoading, error, cycleInfo } = useDAO(contractAddress)
const queryResults = useQuery(
["proposal", contractAddress, proposalKey],
async () => {
- const dao = daoData as BaseDAO;
- const response = await getProposal(
- contractAddress as string,
- proposalKey
- );
+ const dao = daoData as BaseDAO
+ const response = await getProposal(contractAddress as string, proposalKey)
- const fetched = response.daos[0];
- let proposal: Proposal;
+ const fetched = response.daos[0]
+ let proposal: Proposal
switch (dao.data.type) {
case "treasury":
- proposal = new TreasuryProposal(fetched.proposals[0], dao);
+ proposal = new TreasuryProposal(fetched.proposals[0], dao)
- break;
+ break
case "registry":
- proposal = new RegistryProposal(fetched.proposals[0], dao);
+ proposal = new RegistryProposal(fetched.proposals[0], dao)
- break;
+ break
default:
- throw new Error(
- `DAO with address '${dao.data.address}' has an unrecognized type '${dao.data.type}'`
- );
+ throw new Error(`DAO with address '${dao.data.address}' has an unrecognized type '${dao.data.type}'`)
}
- return proposal;
+ return proposal
},
{
refetchInterval: 30000,
- enabled: !!daoData && !!cycleInfo,
+ enabled: !!daoData && !!cycleInfo
}
- );
+ )
return {
data: queryResults.data,
isLoading: isLoading || queryResults.isLoading,
- error: error || queryResults.error,
- };
-};
+ error: error || queryResults.error
+ }
+}
diff --git a/src/services/indexer/dao/hooks/useProposals.ts b/src/services/indexer/dao/hooks/useProposals.ts
index d4acda3a..ed8f46db 100644
--- a/src/services/indexer/dao/hooks/useProposals.ts
+++ b/src/services/indexer/dao/hooks/useProposals.ts
@@ -1,47 +1,35 @@
-import { useQuery } from "react-query";
-import { BaseDAO, CycleInfo } from "services/contracts/baseDAO";
-import { getProposals } from "services/indexer/dao/services";
-import {
- ProposalStatus,
-} from "services/indexer/dao/mappers/proposal/types";
-import { useDAO } from "./useDAO";
+import { useQuery } from "react-query"
+import { BaseDAO, CycleInfo } from "services/contracts/baseDAO"
+import { getProposals } from "services/indexer/dao/services"
+import { ProposalStatus } from "services/indexer/dao/mappers/proposal/types"
+import { useDAO } from "./useDAO"
-export const useProposals = (
- contractAddress: string,
- status?: ProposalStatus
-) => {
- const {
- data: daoData,
- isLoading,
- error,
- cycleInfo,
- } = useDAO(contractAddress);
+export const useProposals = (contractAddress: string, status?: ProposalStatus) => {
+ const { data: daoData, isLoading, error, cycleInfo } = useDAO(contractAddress)
const queryResults = useQuery(
["proposals", contractAddress, status],
async () => {
- const dao = daoData as BaseDAO;
- const proposals = await getProposals(dao);
+ const dao = daoData as BaseDAO
+ const proposals = await getProposals(dao)
if (!status) {
- return proposals;
+ return proposals
}
return proposals.filter(
- (proposalData) =>
- proposalData.getStatus((cycleInfo as CycleInfo).currentLevel)
- .status === status
- );
+ proposalData => proposalData.getStatus((cycleInfo as CycleInfo).currentLevel).status === status
+ )
},
{
refetchInterval: 30000,
- enabled: !!daoData && !!cycleInfo,
+ enabled: !!daoData && !!cycleInfo
}
- );
+ )
return {
data: queryResults.data,
isLoading: isLoading || queryResults.isLoading,
- error: error || queryResults.error,
- };
-};
+ error: error || queryResults.error
+ }
+}
diff --git a/src/services/indexer/dao/mappers/proposal/index.ts b/src/services/indexer/dao/mappers/proposal/index.ts
index 0543fb76..334dbd3f 100644
--- a/src/services/indexer/dao/mappers/proposal/index.ts
+++ b/src/services/indexer/dao/mappers/proposal/index.ts
@@ -1,50 +1,43 @@
-import { Transfer } from "./types";
-import {
- PMFA2TransferType,
- PMXTZTransferType,
-} from "services/contracts/baseDAO/registryDAO/types";
-import { formatUnits, xtzToMutez } from "services/contracts/utils";
-import BigNumber from "bignumber.js";
-import { FA2TransferParams, TransferParams, XTZTransferParams } from "services/contracts/baseDAO";
+import { Transfer } from "./types"
+import { PMFA2TransferType, PMXTZTransferType } from "services/contracts/baseDAO/registryDAO/types"
+import { formatUnits, xtzToMutez } from "services/contracts/utils"
+import BigNumber from "bignumber.js"
+import { FA2TransferParams, TransferParams, XTZTransferParams } from "services/contracts/baseDAO"
-export const extractTransfersData = (
- transfersDTO: (PMXTZTransferType | PMFA2TransferType)[]
-): Transfer[] => {
+export const extractTransfersData = (transfersDTO: (PMXTZTransferType | PMFA2TransferType)[]): Transfer[] => {
const transfers = transfersDTO.map((transfer: any) => {
if (transfer.hasOwnProperty("xtz_transfer_type")) {
- const xtzTransfer = transfer;
+ const xtzTransfer = transfer
return {
amount: xtzTransfer.xtz_transfer_type.amount,
beneficiary: xtzTransfer.xtz_transfer_type.recipient,
- type: "XTZ" as const,
- };
+ type: "XTZ" as const
+ }
} else {
- const fa2Transfer = transfer;
+ const fa2Transfer = transfer
return {
amount: fa2Transfer.token_transfer_type.transfer_list[0].txs[0].amount,
- beneficiary:
- fa2Transfer.token_transfer_type.transfer_list[0].txs[0].to_,
+ beneficiary: fa2Transfer.token_transfer_type.transfer_list[0].txs[0].to_,
contractAddress: fa2Transfer.token_transfer_type.contract_address,
- tokenId:
- fa2Transfer.token_transfer_type.transfer_list[0].txs[0].token_id,
- type: "FA2" as const,
- };
+ tokenId: fa2Transfer.token_transfer_type.transfer_list[0].txs[0].token_id,
+ type: "FA2" as const
+ }
}
- });
+ })
- return transfers;
-};
+ return transfers
+}
const mapXTZTransfersArgs = (transfer: XTZTransferParams) => {
return {
xtz_transfer_type: {
amount: xtzToMutez(new BigNumber(transfer.amount)).toNumber(),
- recipient: transfer.recipient,
- },
- };
-};
+ recipient: transfer.recipient
+ }
+ }
+}
const mapFA2TransfersArgs = (transfer: FA2TransferParams, daoAddress: string) => {
return {
@@ -57,27 +50,21 @@ const mapFA2TransfersArgs = (transfer: FA2TransferParams, daoAddress: string) =>
{
to_: transfer.recipient,
token_id: transfer.asset.token_id,
- amount: formatUnits(
- new BigNumber(transfer.amount),
- transfer.asset.decimals
- ).toNumber(),
- },
- ],
- },
- ],
- },
- };
-};
+ amount: formatUnits(new BigNumber(transfer.amount), transfer.asset.decimals).toNumber()
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
-export const mapTransfersArgs = (
- transfers: TransferParams[],
- daoAddress: string
-) => {
- return transfers.map((transfer) => {
+export const mapTransfersArgs = (transfers: TransferParams[], daoAddress: string) => {
+ return transfers.map(transfer => {
if (transfer.type === "FA2") {
- return mapFA2TransfersArgs(transfer, daoAddress);
+ return mapFA2TransfersArgs(transfer, daoAddress)
}
- return mapXTZTransfersArgs(transfer);
- });
-};
+ return mapXTZTransfersArgs(transfer)
+ })
+}
diff --git a/src/services/indexer/dao/mappers/proposal/types.ts b/src/services/indexer/dao/mappers/proposal/types.ts
index ed17bcda..2b17ec73 100644
--- a/src/services/indexer/dao/mappers/proposal/types.ts
+++ b/src/services/indexer/dao/mappers/proposal/types.ts
@@ -1,22 +1,22 @@
-import BigNumber from "bignumber.js";
-import dayjs from "dayjs";
-import treasuryProposeCode from "services/contracts/baseDAO/treasuryDAO/michelson/propose";
-import registryProposeCode from "services/contracts/baseDAO/registryDAO/michelson/propose";
-import { Schema } from "@taquito/michelson-encoder";
-import { Parser, Expr, unpackDataBytes } from "@taquito/michel-codec";
-import { parseUnits } from "services/contracts/utils";
-import { ProposalDTO } from "services/indexer/types";
-import { PMRegistryProposal, PMTreasuryProposal } from "services/contracts/baseDAO/registryDAO/types";
-import { extractTransfersData } from ".";
-import { bytes2Char } from "@taquito/tzip16";
-import { BaseDAO } from "services/contracts/baseDAO";
-import { DAOTemplate } from "modules/creator/state";
+import BigNumber from "bignumber.js"
+import dayjs from "dayjs"
+import treasuryProposeCode from "services/contracts/baseDAO/treasuryDAO/michelson/propose"
+import registryProposeCode from "services/contracts/baseDAO/registryDAO/michelson/propose"
+import { Schema } from "@taquito/michelson-encoder"
+import { Parser, Expr, unpackDataBytes } from "@taquito/michel-codec"
+import { parseUnits } from "services/contracts/utils"
+import { ProposalDTO } from "services/indexer/types"
+import { PMRegistryProposal, PMTreasuryProposal } from "services/contracts/baseDAO/registryDAO/types"
+import { extractTransfersData } from "."
+import { bytes2Char } from "@taquito/tzip16"
+import { BaseDAO } from "services/contracts/baseDAO"
+import { DAOTemplate } from "modules/creator/state"
export enum IndexerStatus {
CREATED = "created",
DROPPED = "dropped",
EXECUTED = "executed",
- REJECTED_AND_FLUSHED = "rejected_and_flushed",
+ REJECTED_AND_FLUSHED = "rejected_and_flushed"
}
export enum ProposalStatus {
@@ -32,118 +32,118 @@ export enum ProposalStatus {
DROPPED = "dropped",
EXPIRED = "expired",
- EXECUTED = "executed",
+ EXECUTED = "executed"
}
const INDEXER_TO_PROPOSAL_STATUS_MAP: Record = {
created: ProposalStatus.PENDING,
rejected_and_flushed: ProposalStatus.DROPPED,
dropped: ProposalStatus.DROPPED,
- executed: ProposalStatus.EXECUTED,
-};
+ executed: ProposalStatus.EXECUTED
+}
export abstract class Proposal {
- id: string;
- dao: BaseDAO;
- upVotes: BigNumber;
- downVotes: BigNumber;
- startLevel: number;
- votingPeriodNum: number;
- startDate: string;
- quorumThreshold: BigNumber;
- proposer: string;
- period: number;
- proposerFrozenTokens: string;
+ id: string
+ dao: BaseDAO
+ upVotes: BigNumber
+ downVotes: BigNumber
+ startLevel: number
+ votingPeriodNum: number
+ startDate: string
+ quorumThreshold: BigNumber
+ proposer: string
+ period: number
+ proposerFrozenTokens: string
indexer_status_history: {
- timestamp: string;
- description: IndexerStatus;
- level: number;
- }[];
- packedMetadata: string;
+ timestamp: string
+ description: IndexerStatus
+ level: number
+ }[]
+ packedMetadata: string
voters: {
- address: string;
- value: BigNumber;
- support: boolean;
- }[];
- type: DAOTemplate;
+ address: string
+ value: BigNumber
+ support: boolean
+ }[]
+ type: DAOTemplate
private cachedStatus:
| {
- level: number;
- status: ProposalStatus;
+ level: number
+ status: ProposalStatus
statusHistory: {
- status: ProposalStatus;
- timestamp: string;
- level: number;
- }[];
+ status: ProposalStatus
+ timestamp: string
+ level: number
+ }[]
}
- | undefined;
+ | undefined
constructor(dto: ProposalDTO, dao: BaseDAO) {
- this.type = dao.data.type;
- this.id = dto.key;
- this.dao = dao;
- this.votingPeriodNum = Number(dto.voting_stage_num);
- this.voters = dto.votes.map((vote) => ({
+ this.type = dao.data.type
+ this.id = dto.key
+ this.dao = dao
+ this.votingPeriodNum = Number(dto.voting_stage_num)
+ this.voters = dto.votes.map(vote => ({
address: vote.holder.address,
value: parseUnits(new BigNumber(vote.amount), this.dao.data.token.decimals),
- support: Boolean(vote.support),
- }));
+ support: Boolean(vote.support)
+ }))
this.upVotes = this.voters.reduce((acc, voter) => {
if (voter.support) {
- return BigNumber.sum(acc, voter.value);
+ return BigNumber.sum(acc, voter.value)
}
- return acc;
- }, new BigNumber(0));
+ return acc
+ }, new BigNumber(0))
this.downVotes = this.voters.reduce((acc, voter) => {
if (!voter.support) {
- return BigNumber.sum(acc, voter.value);
+ return BigNumber.sum(acc, voter.value)
}
- return acc;
- }, new BigNumber(0));
- this.proposer = dto.holder.address;
- this.startDate = dto.start_date;
- this.startLevel = dto.start_level;
- this.quorumThreshold = parseUnits(new BigNumber(dto.quorum_threshold), dao.data.token.decimals);
- this.period = Number(dto.voting_stage_num) - 1;
- this.indexer_status_history = dto.status_updates.map((update) => ({
+ return acc
+ }, new BigNumber(0))
+ this.proposer = dto.holder.address
+ this.startDate = dto.start_date
+ this.startLevel = dto.start_level
+ this.quorumThreshold = parseUnits(new BigNumber(dto.quorum_threshold), dao.data.token.decimals)
+ this.period = Number(dto.voting_stage_num) - 1
+ this.indexer_status_history = dto.status_updates.map(update => ({
timestamp: `Block ${update.level} (${dayjs(update.timestamp).format("LLL")})`,
level: update.level,
- description: update.proposal_status.description,
- }));
- this.proposerFrozenTokens = dto.proposer_frozen_token;
- this.packedMetadata = dto.metadata;
+ description: update.proposal_status.description
+ }))
+ this.proposerFrozenTokens = dto.proposer_frozen_token
+ this.packedMetadata = dto.metadata
}
- abstract get metadata(): BaseProposalMetadata;
+ abstract get metadata(): BaseProposalMetadata
public getStatus(currentLevel: number) {
if (!this.cachedStatus || currentLevel !== this.cachedStatus.level) {
- const activeThreshold = this.votingPeriodNum * Number(this.dao.data.period) + this.dao.data.start_level;
+ const activeThreshold = this.votingPeriodNum * Number(this.dao.data.period) + this.dao.data.start_level
- const passedOrRejectedThreshold = activeThreshold + Number(this.dao.data.period);
+ const passedOrRejectedThreshold = activeThreshold + Number(this.dao.data.period)
- const flushThreshold = this.startLevel + Number(this.dao.data.proposal_flush_level);
- const expiredThreshold = this.startLevel + Number(this.dao.data.proposal_expired_level);
+ const flushThreshold = this.startLevel + Number(this.dao.data.proposal_flush_level)
+ const expiredThreshold = this.startLevel + Number(this.dao.data.proposal_expired_level)
const statusHistory: {
- status: ProposalStatus;
- timestamp: string;
- level: number;
- }[] = this.indexer_status_history.map((update) => ({
+ status: ProposalStatus
+ timestamp: string
+ level: number
+ }[] = this.indexer_status_history.map(update => ({
timestamp: update.timestamp,
status: INDEXER_TO_PROPOSAL_STATUS_MAP[update.description],
- level: update.level,
- }));
+ level: update.level
+ }))
if (currentLevel >= activeThreshold) {
statusHistory.push({
status: ProposalStatus.ACTIVE,
timestamp: `Level ${activeThreshold}`,
- level: activeThreshold,
- });
+ level: activeThreshold
+ })
}
if (currentLevel >= passedOrRejectedThreshold) {
@@ -151,63 +151,63 @@ export abstract class Proposal {
statusHistory.push({
status: ProposalStatus.REJECTED,
timestamp: `Level ${passedOrRejectedThreshold}`,
- level: passedOrRejectedThreshold,
- });
+ level: passedOrRejectedThreshold
+ })
} else if (this.upVotes.isGreaterThanOrEqualTo(this.quorumThreshold)) {
statusHistory.push({
status: ProposalStatus.PASSED,
timestamp: `Level ${passedOrRejectedThreshold}`,
- level: passedOrRejectedThreshold,
- });
+ level: passedOrRejectedThreshold
+ })
} else {
statusHistory.push({
status: ProposalStatus.NO_QUORUM,
timestamp: `Level ${passedOrRejectedThreshold}`,
- level: passedOrRejectedThreshold,
- });
+ level: passedOrRejectedThreshold
+ })
}
}
- if (currentLevel >= flushThreshold && statusHistory.some((s) => s.status === ProposalStatus.PASSED)) {
+ if (currentLevel >= flushThreshold && statusHistory.some(s => s.status === ProposalStatus.PASSED)) {
statusHistory.push({
status: ProposalStatus.EXECUTABLE,
timestamp: `Level ${this.startLevel + this.dao.data.proposal_flush_level}`,
- level: flushThreshold,
- });
+ level: flushThreshold
+ })
}
if (currentLevel >= expiredThreshold) {
statusHistory.push({
status: ProposalStatus.EXPIRED,
timestamp: `Level ${this.startLevel + this.dao.data.proposal_expired_level}`,
- level: expiredThreshold,
- });
+ level: expiredThreshold
+ })
}
- const orderedStatusHistory = statusHistory.sort((a, b) => a.level - b.level);
+ const orderedStatusHistory = statusHistory.sort((a, b) => a.level - b.level)
- const finalStatuses = [ProposalStatus.DROPPED, ProposalStatus.EXECUTED];
- const finalStatusIndex = statusHistory.findIndex((a) => finalStatuses.includes(a.status));
+ const finalStatuses = [ProposalStatus.DROPPED, ProposalStatus.EXECUTED]
+ const finalStatusIndex = statusHistory.findIndex(a => finalStatuses.includes(a.status))
const filteredStatusHistory =
- finalStatusIndex > -1 ? orderedStatusHistory.splice(0, finalStatusIndex + 1) : orderedStatusHistory;
+ finalStatusIndex > -1 ? orderedStatusHistory.splice(0, finalStatusIndex + 1) : orderedStatusHistory
this.cachedStatus = {
status: filteredStatusHistory.slice(-1)[0].status,
statusHistory: filteredStatusHistory,
- level: currentLevel,
- };
+ level: currentLevel
+ }
}
- return this.cachedStatus;
+ return this.cachedStatus
}
}
interface TreasuryProposalMetadata extends BaseProposalMetadata {
- transfers: Transfer[];
+ transfers: Transfer[]
}
export class TreasuryProposal extends Proposal {
- private cachedMetadata?: TreasuryProposalMetadata;
+ private cachedMetadata?: TreasuryProposalMetadata
get metadata(): TreasuryProposalMetadata {
let values: TreasuryProposalMetadata = {
@@ -215,40 +215,40 @@ export class TreasuryProposal extends Proposal {
transfers: [],
update_guardian: "",
update_contract_delegate: "",
- agoraPostId: "",
- };
+ agoraPostId: ""
+ }
if (!this.cachedMetadata) {
- const parser = new Parser();
- const micheline = parser.parseMichelineExpression(treasuryProposeCode) as Expr;
- const schema = new Schema(micheline as Expr);
+ const parser = new Parser()
+ const micheline = parser.parseMichelineExpression(treasuryProposeCode) as Expr
+ const schema = new Schema(micheline as Expr)
- const unpackedMetadata = unpackDataBytes({ bytes: this.packedMetadata }, micheline as any) as any;
- const proposalMetadataDTO: PMTreasuryProposal = schema.Execute(unpackedMetadata);
- values = { ...values, ...getBaseMetadata(proposalMetadataDTO) };
+ const unpackedMetadata = unpackDataBytes({ bytes: this.packedMetadata }, micheline as any) as any
+ const proposalMetadataDTO: PMTreasuryProposal = schema.Execute(unpackedMetadata)
+ values = { ...values, ...getBaseMetadata(proposalMetadataDTO) }
if ("transfer_proposal" in proposalMetadataDTO) {
- values.transfers = extractTransfersData(proposalMetadataDTO.transfer_proposal.transfers);
- values.agoraPostId = proposalMetadataDTO.transfer_proposal.agora_post_id.toString();
+ values.transfers = extractTransfersData(proposalMetadataDTO.transfer_proposal.transfers)
+ values.agoraPostId = proposalMetadataDTO.transfer_proposal.agora_post_id.toString()
}
- this.cachedMetadata = values;
+ this.cachedMetadata = values
}
- return this.cachedMetadata;
+ return this.cachedMetadata
}
}
interface RegistryProposalMetadata extends BaseProposalMetadata {
- transfers: Transfer[];
+ transfers: Transfer[]
list: {
- key: string;
- value: string;
- }[];
+ key: string
+ value: string
+ }[]
}
export class RegistryProposal extends Proposal {
- private cachedMetadata?: RegistryProposalMetadata;
+ private cachedMetadata?: RegistryProposalMetadata
get metadata(): RegistryProposalMetadata {
let values: RegistryProposalMetadata = {
@@ -257,59 +257,59 @@ export class RegistryProposal extends Proposal {
update_contract_delegate: "",
update_guardian: "",
agoraPostId: "",
- list: [],
- };
+ list: []
+ }
if (!this.cachedMetadata) {
- const parser = new Parser();
- const micheline = parser.parseMichelineExpression(registryProposeCode) as Expr;
- const schema = new Schema(micheline as Expr);
+ const parser = new Parser()
+ const micheline = parser.parseMichelineExpression(registryProposeCode) as Expr
+ const schema = new Schema(micheline as Expr)
- const unpackedMetadata = unpackDataBytes({ bytes: this.packedMetadata }, micheline as any) as any;
- const proposalMetadataDTO: PMRegistryProposal = schema.Execute(unpackedMetadata);
-
- values = { ...values, ...getBaseMetadata(proposalMetadataDTO) };
+ const unpackedMetadata = unpackDataBytes({ bytes: this.packedMetadata }, micheline as any) as any
+ const proposalMetadataDTO: PMRegistryProposal = schema.Execute(unpackedMetadata)
+
+ values = { ...values, ...getBaseMetadata(proposalMetadataDTO) }
if ("transfer_proposal" in proposalMetadataDTO) {
- const { agora_post_id, registry_diff, transfers } = proposalMetadataDTO.transfer_proposal;
+ const { agora_post_id, registry_diff, transfers } = proposalMetadataDTO.transfer_proposal
- values.agoraPostId = agora_post_id;
+ values.agoraPostId = agora_post_id
if (transfers) {
- values.transfers = extractTransfersData(proposalMetadataDTO.transfer_proposal.transfers);
+ values.transfers = extractTransfersData(proposalMetadataDTO.transfer_proposal.transfers)
}
if (registry_diff) {
- values.list = registry_diff.map((item) => ({
+ values.list = registry_diff.map(item => ({
key: bytes2Char(item[0]),
- value: bytes2Char(item[1]),
- }));
+ value: bytes2Char(item[1])
+ }))
}
}
- this.cachedMetadata = values;
+ this.cachedMetadata = values
}
- return this.cachedMetadata;
+ return this.cachedMetadata
}
}
export interface Transfer {
- amount: BigNumber;
- beneficiary: string;
- type: "XTZ" | "FA2";
+ amount: BigNumber
+ beneficiary: string
+ type: "XTZ" | "FA2"
}
export interface FA2Transfer extends Transfer {
- contractAddress: string;
- tokenId: string;
+ contractAddress: string
+ tokenId: string
}
interface BaseProposalMetadata {
- config: { key: "frozen_extra_value" | "slash_scale_value"; value: BigNumber }[];
- update_guardian: string;
- update_contract_delegate: string;
- agoraPostId: string;
+ config: { key: "frozen_extra_value" | "slash_scale_value"; value: BigNumber }[]
+ update_guardian: string
+ update_contract_delegate: string
+ agoraPostId: string
}
function getBaseMetadata(proposalMetadataDTO: PMTreasuryProposal | PMRegistryProposal): BaseProposalMetadata {
@@ -317,23 +317,23 @@ function getBaseMetadata(proposalMetadataDTO: PMTreasuryProposal | PMRegistryPro
config: [],
update_guardian: "",
update_contract_delegate: "",
- agoraPostId: "-1",
- };
+ agoraPostId: "-1"
+ }
if ("update_contract_delegate" in proposalMetadataDTO) {
- values.update_contract_delegate = proposalMetadataDTO.update_contract_delegate;
+ values.update_contract_delegate = proposalMetadataDTO.update_contract_delegate
}
if ("update_guardian" in proposalMetadataDTO) {
- values.update_guardian = proposalMetadataDTO.update_guardian;
+ values.update_guardian = proposalMetadataDTO.update_guardian
}
if ("configuration_proposal" in proposalMetadataDTO) {
values.config = Object.entries(proposalMetadataDTO.configuration_proposal)
// eslint-disable-next-line @typescript-eslint/no-unused-vars
.filter(([_, value]) => !!value)
- .map(([key, value]) => ({ key: key as BaseProposalMetadata["config"][number]["key"], value }));
+ .map(([key, value]) => ({ key: key as BaseProposalMetadata["config"][number]["key"], value }))
}
- return values;
+ return values
}
diff --git a/src/services/indexer/dao/queries.ts b/src/services/indexer/dao/queries.ts
index e19eb10c..7d32fec6 100644
--- a/src/services/indexer/dao/queries.ts
+++ b/src/services/indexer/dao/queries.ts
@@ -1,4 +1,4 @@
-import { gql } from "graphql-request";
+import { gql } from "graphql-request"
export const GET_DAOS_QUERY = gql`
query getDaos($network: String!) {
@@ -35,7 +35,7 @@ export const GET_DAOS_QUERY = gql`
}
}
}
-`;
+`
export const GET_DAO_QUERY = gql`
query getDao($address: String!) {
@@ -124,7 +124,7 @@ export const GET_DAO_QUERY = gql`
}
}
}
-`;
+`
export const GET_PROPOSALS_QUERY = gql`
query getDao($address: String!) {
@@ -167,7 +167,7 @@ export const GET_PROPOSALS_QUERY = gql`
}
}
}
-`;
+`
export const GET_PROPOSAL_QUERY = gql`
query getDao($address: String!, $proposalKey: String!) {
@@ -210,11 +210,11 @@ export const GET_PROPOSAL_QUERY = gql`
}
}
}
-`;
+`
export const GET_XTZ_TRANSFERS = gql`
query getTransfers($address: String!) {
- transfer(where: {dao: {address: {_eq: $address}}}) {
+ transfer(where: { dao: { address: { _eq: $address } } }) {
decimal_amount
amount
from_address
@@ -222,5 +222,4 @@ export const GET_XTZ_TRANSFERS = gql`
hash
}
}
-`;
-
+`
diff --git a/src/services/indexer/dao/services.ts b/src/services/indexer/dao/services.ts
index 09291688..d1d47ccc 100644
--- a/src/services/indexer/dao/services.ts
+++ b/src/services/indexer/dao/services.ts
@@ -1,99 +1,79 @@
-import { client } from "../graphql";
-import {
- DAOListItem,
- DAOXTZTransferDTO,
- FetchedDAO,
- FetchedProposal,
- FetchedProposals,
-} from "../types";
-import {
- GET_DAOS_QUERY,
- GET_DAO_QUERY,
- GET_PROPOSALS_QUERY,
- GET_PROPOSAL_QUERY,
- GET_XTZ_TRANSFERS,
-} from "./queries";
-import {Proposal, RegistryProposal, TreasuryProposal} from "./mappers/proposal/types";
-import dayjs from "dayjs";
-import {BaseDAO} from "../../contracts/baseDAO";
+import { client } from "../graphql"
+import { DAOListItem, DAOXTZTransferDTO, FetchedDAO, FetchedProposal, FetchedProposals } from "../types"
+import { GET_DAOS_QUERY, GET_DAO_QUERY, GET_PROPOSALS_QUERY, GET_PROPOSAL_QUERY, GET_XTZ_TRANSFERS } from "./queries"
+import { Proposal, RegistryProposal, TreasuryProposal } from "./mappers/proposal/types"
+import dayjs from "dayjs"
+import { BaseDAO } from "../../contracts/baseDAO"
interface GetDAODTO {
- daos: [FetchedDAO];
+ daos: [FetchedDAO]
}
interface GetAllDAOsDTO {
- daos: DAOListItem[];
+ daos: DAOListItem[]
}
interface GetProposalsDTO {
- daos: [FetchedProposals];
+ daos: [FetchedProposals]
}
interface GetProposalDTO {
- daos: [FetchedProposal];
+ daos: [FetchedProposal]
}
interface GetXTZTransfersDTO {
- transfer: [DAOXTZTransferDTO];
+ transfer: [DAOXTZTransferDTO]
}
export const getDAO = async (address: string) => {
return await client.request(GET_DAO_QUERY, {
- address,
- });
-};
+ address
+ })
+}
export const getDAOs = async (network: string) => {
const response = await client.request(GET_DAOS_QUERY, {
- network,
- });
+ network
+ })
- return response.daos;
-};
+ return response.daos
+}
export const getProposals = async (dao: BaseDAO) => {
const response = await client.request(GET_PROPOSALS_QUERY, {
- address: dao.data.address,
- });
+ address: dao.data.address
+ })
- const fetched = response.daos[0];
- let proposals: Proposal[];
+ const fetched = response.daos[0]
+ let proposals: Proposal[]
switch (dao.data.type) {
case "treasury":
- proposals = fetched.proposals.map(
- (proposal) => new TreasuryProposal(proposal, dao)
- );
+ proposals = fetched.proposals.map(proposal => new TreasuryProposal(proposal, dao))
- break;
+ break
case "registry":
- proposals = fetched.proposals.map(
- (proposal) => new RegistryProposal(proposal, dao)
- );
+ proposals = fetched.proposals.map(proposal => new RegistryProposal(proposal, dao))
- break;
+ break
default:
- throw new Error(
- `DAO with address '${dao.data.address}' has an unrecognized type '${dao.data.type}'`
- );
+ throw new Error(`DAO with address '${dao.data.address}' has an unrecognized type '${dao.data.type}'`)
}
- const proposalsWithVoters = proposals.sort((a, b) =>
- dayjs(b.startDate).isAfter(dayjs(a.startDate)) ? 1 : -1
- );
+ const proposalsWithVoters = proposals.sort((a, b) => (dayjs(b.startDate).isAfter(dayjs(a.startDate)) ? 1 : -1))
- return proposalsWithVoters;
-};
+ return proposalsWithVoters
+}
export const getProposal = async (address: string, proposalKey: string) => {
return await client.request(GET_PROPOSAL_QUERY, {
address,
- proposalKey,
- });
-};
+ proposalKey
+ })
+}
export const getXTZTransfers = async (address: string) => {
return await client.request(GET_XTZ_TRANSFERS, {
- address,
- });
-};
+ address
+ })
+}
diff --git a/src/services/indexer/graphql.ts b/src/services/indexer/graphql.ts
index 456c6484..b4bf933c 100644
--- a/src/services/indexer/graphql.ts
+++ b/src/services/indexer/graphql.ts
@@ -1,21 +1,20 @@
-import { GraphQLClient } from "graphql-request";
-import { EnvKey, getEnv } from 'services/config';
+import { GraphQLClient } from "graphql-request"
+import { EnvKey, getEnv } from "services/config"
-
-const BASE_URL = getEnv(EnvKey.REACT_APP_HASURA_URL);
-const HASURA_ADMIN_SECRET = getEnv(EnvKey.REACT_APP_HASURA_ADMIN_SECRET);
+const BASE_URL = getEnv(EnvKey.REACT_APP_HASURA_URL)
+const HASURA_ADMIN_SECRET = getEnv(EnvKey.REACT_APP_HASURA_ADMIN_SECRET)
if (!BASE_URL) {
- throw new Error(`${EnvKey.REACT_APP_HASURA_URL} env variable is missing`);
+ throw new Error(`${EnvKey.REACT_APP_HASURA_URL} env variable is missing`)
}
if (!HASURA_ADMIN_SECRET) {
- throw new Error(`${EnvKey.REACT_APP_HASURA_ADMIN_SECRET} env variable is missing`);
+ throw new Error(`${EnvKey.REACT_APP_HASURA_ADMIN_SECRET} env variable is missing`)
}
export const client = new GraphQLClient(BASE_URL, {
headers: {
"content-type": "application/json",
- "x-hasura-admin-secret": HASURA_ADMIN_SECRET,
- },
-});
+ "x-hasura-admin-secret": HASURA_ADMIN_SECRET
+ }
+})
diff --git a/src/services/indexer/types.ts b/src/services/indexer/types.ts
index a3ade781..cdc9a27e 100644
--- a/src/services/indexer/types.ts
+++ b/src/services/indexer/types.ts
@@ -1,96 +1,96 @@
-import BigNumber from "bignumber.js";
-import { DAOTemplate } from "modules/creator/state";
-import { Network } from "services/beacon";
-import { IndexerStatus } from "./dao/mappers/proposal/types";
+import BigNumber from "bignumber.js"
+import { DAOTemplate } from "modules/creator/state"
+import { Network } from "services/beacon"
+import { IndexerStatus } from "./dao/mappers/proposal/types"
export interface DAOTypeDTO {
- id: number;
- name: DAOTemplate;
- daos?: DAODTO[];
+ id: number
+ name: DAOTemplate
+ daos?: DAODTO[]
}
export interface TokenDTO {
- id: number;
- contract: string;
- network: string;
- level: number;
- timestamp: string;
- token_id: number;
- symbol: string;
- name: string;
- decimals: number;
- is_transferable: boolean;
- should_prefer_symbol: boolean;
- supply: string;
- daos?: DAODTO[];
+ id: number
+ contract: string
+ network: string
+ level: number
+ timestamp: string
+ token_id: number
+ symbol: string
+ name: string
+ decimals: number
+ is_transferable: boolean
+ should_prefer_symbol: boolean
+ supply: string
+ daos?: DAODTO[]
}
export interface DAODTO {
- id: number;
- address: string;
- admin: string;
- frozen_token_id: number;
- token: TokenDTO;
- guardian: string;
- ledgers?: LedgerDTO[];
- proposals?: ProposalDTO[];
- max_proposals: string;
- max_quorum_change: string;
- max_quorum_threshold: string;
- min_quorum_threshold: string;
- period: string;
- proposal_expired_level: string;
- proposal_flush_level: string;
- quorum_change: string;
- last_updated_cycle: string;
- quorum_threshold: string;
- staked: string;
- start_level: number;
- name: string;
- description: string;
- dao_type: DAOTypeDTO;
- network: Network;
- treasury_extras: [TreasuryExtraDTO] | [];
- registry_extras: [RegistryExtraDTO] | [];
+ id: number
+ address: string
+ admin: string
+ frozen_token_id: number
+ token: TokenDTO
+ guardian: string
+ ledgers?: LedgerDTO[]
+ proposals?: ProposalDTO[]
+ max_proposals: string
+ max_quorum_change: string
+ max_quorum_threshold: string
+ min_quorum_threshold: string
+ period: string
+ proposal_expired_level: string
+ proposal_flush_level: string
+ quorum_change: string
+ last_updated_cycle: string
+ quorum_threshold: string
+ staked: string
+ start_level: number
+ name: string
+ description: string
+ dao_type: DAOTypeDTO
+ network: Network
+ treasury_extras: [TreasuryExtraDTO] | []
+ registry_extras: [RegistryExtraDTO] | []
}
export interface RegistryExtraDTO {
- id: number;
- registry: string;
- registry_affected: string;
- frozen_extra_value: string;
- frozen_scale_value: string;
- slash_division_value: string;
- min_xtz_amount: string;
- max_xtz_amount: string;
- slash_scale_value: string;
- returnedPercentage: string;
+ id: number
+ registry: string
+ registry_affected: string
+ frozen_extra_value: string
+ frozen_scale_value: string
+ slash_division_value: string
+ min_xtz_amount: string
+ max_xtz_amount: string
+ slash_scale_value: string
+ returnedPercentage: string
}
export interface TreasuryExtraDTO {
- id: number;
- frozen_extra_value: string;
- frozen_scale_value: string;
- slash_division_value: string;
- min_xtz_amount: string;
- max_xtz_amount: string;
- slash_scale_value: string;
- returnedPercentage: string;
+ id: number
+ frozen_extra_value: string
+ frozen_scale_value: string
+ slash_division_value: string
+ min_xtz_amount: string
+ max_xtz_amount: string
+ slash_scale_value: string
+ returnedPercentage: string
}
export interface HolderDTO {
- id: number;
- address: string;
- ledgers?: LedgerDTO[];
- proposals?: ProposalDTO[];
- votes?: VoteDTO[];
+ id: number
+ address: string
+ ledgers?: LedgerDTO[]
+ proposals?: ProposalDTO[]
+ votes?: VoteDTO[]
proposals_aggregate: {
aggregate: {
count: number | null
}
} | null
-
+
votes_aggregate: {
aggregate: {
sum: {
@@ -101,119 +101,119 @@ export interface HolderDTO {
}
export interface LedgerDTO {
- id: number;
- current_stage_num: string;
- current_unstaked: BigNumber;
- past_unstaked: BigNumber;
- staked: BigNumber;
- holder: HolderDTO;
+ id: number
+ current_stage_num: string
+ current_unstaked: BigNumber
+ past_unstaked: BigNumber
+ staked: BigNumber
+ holder: HolderDTO
}
export interface Holder {
- id: number;
- address: string;
- votes_cast: BigNumber;
+ id: number
+ address: string
+ votes_cast: BigNumber
proposals_voted: number
}
export interface Ledger {
- id: number;
- current_stage_num: string;
- current_unstaked: BigNumber;
- past_unstaked: BigNumber;
- staked: BigNumber;
- holder: Holder;
+ id: number
+ current_stage_num: string
+ current_unstaked: BigNumber
+ past_unstaked: BigNumber
+ staked: BigNumber
+ holder: Holder
}
export interface ProposalStatusDTO {
- id: number;
- description: IndexerStatus;
- proposals?: ProposalDTO[];
+ id: number
+ description: IndexerStatus
+ proposals?: ProposalDTO[]
}
export interface ProposalStatusUpdateDTO {
- id: number;
- timestamp: string;
- level: number;
- proposal_status: ProposalStatusDTO;
+ id: number
+ timestamp: string
+ level: number
+ proposal_status: ProposalStatusDTO
}
export interface ProposalDTO {
- id: number;
- hash: string;
- key: string;
- upvotes: string;
- downvotes: string;
- start_date: string;
- start_level: number;
- metadata: string;
- holder: HolderDTO;
- status_updates: ProposalStatusUpdateDTO[];
- voting_stage_num: string;
- proposer_frozen_token: string;
- quorum_threshold: string;
- votes: VoteDTO[];
+ id: number
+ hash: string
+ key: string
+ upvotes: string
+ downvotes: string
+ start_date: string
+ start_level: number
+ metadata: string
+ holder: HolderDTO
+ status_updates: ProposalStatusUpdateDTO[]
+ voting_stage_num: string
+ proposer_frozen_token: string
+ quorum_threshold: string
+ votes: VoteDTO[]
}
export interface ProposalDTOWithVotes extends ProposalDTO {
- votes: VoteDTO[];
+ votes: VoteDTO[]
}
export interface VoteDTO {
- id: number;
- hash: string;
- key: string;
- amount: string;
- support: boolean;
- holder: HolderDTO;
+ id: number
+ hash: string
+ key: string
+ amount: string
+ support: boolean
+ holder: HolderDTO
}
export interface DAOListItem {
dao_type: {
- name: DAOTemplate;
- };
- description: string;
- address: string;
- frozen_token_id: string;
- governance_token_id: string;
+ name: DAOTemplate
+ }
+ description: string
+ address: string
+ frozen_token_id: string
+ governance_token_id: string
ledgers: {
holder: {
- address: string;
- };
- }[];
- name: string;
- network: Network;
- period: string;
- staked: string;
- start_level: number;
- token: TokenDTO;
+ address: string
+ }
+ }[]
+ name: string
+ network: Network
+ period: string
+ staked: string
+ start_level: number
+ token: TokenDTO
}
export type FetchedDAO = DAODTO & {
- ledgers: LedgerDTO[];
- proposals: ProposalDTO[];
-};
+ ledgers: LedgerDTO[]
+ proposals: ProposalDTO[]
+}
export interface FetchedProposals {
- proposals: ProposalDTOWithVotes[];
+ proposals: ProposalDTOWithVotes[]
}
export interface FetchedProposal {
- proposals: ProposalDTOWithVotes[];
+ proposals: ProposalDTOWithVotes[]
}
export interface DAOXTZTransferDTO {
- amount: string;
- decimal_amount: number;
- from_address: string;
- timestamp: string;
- hash: string;
+ amount: string
+ decimal_amount: number
+ from_address: string
+ timestamp: string
+ hash: string
}
export interface DAOXTZTransfer {
- amount: BigNumber;
- decimal_amount: number;
- from_address: string;
- timestamp: string;
- hash: string;
+ amount: BigNumber
+ decimal_amount: number
+ from_address: string
+ timestamp: string
+ hash: string
}
diff --git a/src/services/ipfs/index.ts b/src/services/ipfs/index.ts
index 825e6afe..6e253b1a 100644
--- a/src/services/ipfs/index.ts
+++ b/src/services/ipfs/index.ts
@@ -1 +1 @@
-export const IPFS_GATEWAY_URI = "https://ipfs.io/ipfs"
\ No newline at end of file
+export const IPFS_GATEWAY_URI = "https://ipfs.io/ipfs"
diff --git a/src/services/tzprofiles/claims/index.ts b/src/services/tzprofiles/claims/index.ts
index 25906edb..d91093a5 100644
--- a/src/services/tzprofiles/claims/index.ts
+++ b/src/services/tzprofiles/claims/index.ts
@@ -1,29 +1,24 @@
-import { Network } from "services/beacon";
-import { API_URL } from "..";
-import { Claim, ClaimsDTO } from "./types";
+import { Network } from "services/beacon"
+import { API_URL } from ".."
+import { Claim, ClaimsDTO } from "./types"
-export const getProfileClaim = async (
- tzAddress: string,
- network: Network
-): Promise => {
- const url = `${API_URL}/${tzAddress}/${network}`;
+export const getProfileClaim = async (tzAddress: string, network: Network): Promise => {
+ const url = `${API_URL}/${tzAddress}/${network}`
- const response = await fetch(url);
+ const response = await fetch(url)
if (!response.ok) {
- throw new Error("Failed to fetch Profile Claim from TZProfile API");
+ throw new Error("Failed to fetch Profile Claim from TZProfile API")
}
- const result: ClaimsDTO = await response.json();
+ const result: ClaimsDTO = await response.json()
const profileClaim = result
- .map((claimArray) => JSON.parse(claimArray[1]) as Claim)
- .find((claim) => claim.type.includes("BasicProfile"));
+ .map(claimArray => JSON.parse(claimArray[1]) as Claim)
+ .find(claim => claim.type.includes("BasicProfile"))
if (!profileClaim) {
- throw new Error(
- `Address ${tzAddress} has no profile in network ${network}`
- );
+ throw new Error(`Address ${tzAddress} has no profile in network ${network}`)
}
- return profileClaim;
-};
+ return profileClaim
+}
diff --git a/src/services/tzprofiles/claims/types.ts b/src/services/tzprofiles/claims/types.ts
index 93db1ae7..14fe80d3 100644
--- a/src/services/tzprofiles/claims/types.ts
+++ b/src/services/tzprofiles/claims/types.ts
@@ -1,18 +1,18 @@
-export type ClaimsDTO = [string[]];
+export type ClaimsDTO = [string[]]
-export type ClaimType = "VerifiableCredential" | "BasicProfile";
+export type ClaimType = "VerifiableCredential" | "BasicProfile"
export interface ClaimSubject {
- id: "did:pkh:tz:tz1PnpYYdcgoVq1RYgj6qSdbzwSJRXXcfU3F";
- website: "https://tezos.domains";
- alias: "Alice";
- logo: "https://i.pinimg.com/originals/32/3c/d5/323cd586eb8f53c45674c70b3d42e44a.jpg";
- description: "Tezos Domains example person";
+ id: "did:pkh:tz:tz1PnpYYdcgoVq1RYgj6qSdbzwSJRXXcfU3F"
+ website: "https://tezos.domains"
+ alias: "Alice"
+ logo: "https://i.pinimg.com/originals/32/3c/d5/323cd586eb8f53c45674c70b3d42e44a.jpg"
+ description: "Tezos Domains example person"
}
export interface Claim {
- id: string;
- type: ClaimType[];
- credentialSubject: ClaimSubject;
- issuer: string;
- issuanceDate: string;
+ id: string
+ type: ClaimType[]
+ credentialSubject: ClaimSubject
+ issuer: string
+ issuanceDate: string
}
diff --git a/src/services/tzprofiles/hooks/useProfileClaim.tsx b/src/services/tzprofiles/hooks/useProfileClaim.tsx
index bb945b08..c09838df 100644
--- a/src/services/tzprofiles/hooks/useProfileClaim.tsx
+++ b/src/services/tzprofiles/hooks/useProfileClaim.tsx
@@ -1,10 +1,10 @@
-import { useQuery } from "react-query";
-import { useTezos } from "services/beacon/hooks/useTezos";
-import { getProfileClaim } from "../claims";
-import { Claim } from "../claims/types";
+import { useQuery } from "react-query"
+import { useTezos } from "services/beacon/hooks/useTezos"
+import { getProfileClaim } from "../claims"
+import { Claim } from "../claims/types"
export const useProfileClaim = (tzAddress: string) => {
- const { network } = useTezos();
+ const { network } = useTezos()
const result = useQuery(
["tzProfile_profile_claim", tzAddress, network],
@@ -12,9 +12,9 @@ export const useProfileClaim = (tzAddress: string) => {
{
enabled: !!network && !!tzAddress,
cacheTime: Infinity,
- refetchOnWindowFocus: false,
+ refetchOnWindowFocus: false
}
- );
+ )
- return result;
-};
+ return result
+}
diff --git a/src/services/tzprofiles/index.ts b/src/services/tzprofiles/index.ts
index a9f5b987..e7d99f52 100644
--- a/src/services/tzprofiles/index.ts
+++ b/src/services/tzprofiles/index.ts
@@ -1 +1 @@
-export const API_URL = "https://api.tzprofiles.com";
+export const API_URL = "https://api.tzprofiles.com"
diff --git a/src/theme/index.ts b/src/theme/index.ts
index 78975148..7667ab83 100644
--- a/src/theme/index.ts
+++ b/src/theme/index.ts
@@ -1,20 +1,20 @@
-import { alpha } from "@material-ui/core";
-import { createTheme } from "@material-ui/core/styles";
-import { ThemeOptions } from "@material-ui/core/styles/createTheme";
+import { alpha } from "@material-ui/core"
+import { createTheme } from "@material-ui/core/styles"
+import { ThemeOptions } from "@material-ui/core/styles/createTheme"
const defaultTheme = createTheme()
const { breakpoints } = defaultTheme
export const theme = createTheme({
props: {
MuiButtonBase: {
- disableRipple: true,
- },
+ disableRipple: true
+ }
},
palette: {
primary: {
main: "#2F3438",
dark: "#1C1F23",
- light: "#383e43",
+ light: "#383e43"
},
secondary: {
main: "#81FEB7",
@@ -22,17 +22,17 @@ export const theme = createTheme({
contrastText: "#1C1F23"
},
text: {
- primary: "#FFFFFF",
+ primary: "#FFFFFF"
},
error: {
- main: "#ED254E",
+ main: "#ED254E"
},
info: {
- main: "#3866F9",
+ main: "#3866F9"
},
warning: {
- main: "#FFC839",
- },
+ main: "#FFC839"
+ }
},
typography: {
fontFamily: "Roboto Mono",
@@ -43,18 +43,18 @@ export const theme = createTheme({
}
},
subtitle1: {
- fontSize: 32,
+ fontSize: 32
},
subtitle2: {
fontSize: 16,
- fontWeight: 400,
+ fontWeight: 400
},
h3: {
fontSize: 21,
- fontWeight: 400,
+ fontWeight: 400
},
h2: {
- fontSize: 24,
+ fontSize: 24
},
h4: {
fontSize: 21,
@@ -87,20 +87,20 @@ export const theme = createTheme({
overrides: {
MuiTypography: {
root: {
- letterSpacing: "-0.03em !important",
+ letterSpacing: "-0.03em !important"
// lineHeight: "1.5 !important",
// wordSpacing: "40",
- },
+ }
},
MuiSlider: {
root: {
- color: "#3D3D3D",
- },
+ color: "#3D3D3D"
+ }
},
MuiTab: {
root: {
- maxWidth: "100%",
- },
+ maxWidth: "100%"
+ }
},
MuiTooltip: {
tooltip: {
@@ -108,225 +108,225 @@ export const theme = createTheme({
fontSize: 14,
padding: "10px 15px",
color: "#1C1F23"
- },
+ }
},
MuiStepLabel: {
label: {
- color: "#fff",
- opacity: 0.5,
- marginLeft: 15,
- lineHeight: "40px",
+ "color": "#fff",
+ "opacity": 0.5,
+ "marginLeft": 15,
+ "lineHeight": "40px",
"&$completed": {
- fontWeight: 300,
+ fontWeight: 300
},
"&$active": {
- fontWeight: 300,
+ fontWeight: 300
},
"& .MuiStepLabel-completed": {
- fontWeight: 300,
- },
+ fontWeight: 300
+ }
},
active: {
color: "#fff !important",
- opacity: 1,
+ opacity: 1
},
completed: {
color: "#fff !important",
opacity: 0.5,
- fontWeight: 300,
- },
+ fontWeight: 300
+ }
},
MuiStepConnector: {
lineVertical: {
- display: "none",
- },
+ display: "none"
+ }
},
MuiStepContent: {
root: {
- borderLeft: "none",
- },
+ borderLeft: "none"
+ }
},
MuiStep: {
root: {
- marginBottom: 15,
- },
+ marginBottom: 15
+ }
},
MuiStepIcon: {
active: {
- color: "#1C1F23 !important",
+ color: "#1C1F23 !important"
},
completed: {
- color: "#fff !important",
+ color: "#fff !important"
},
root: {
- height: 32,
- width: 32,
- color: "#1C1F23",
- border: "1px solid #3D3D3D",
- borderRadius: "50%",
+ "height": 32,
+ "width": 32,
+ "color": "#1C1F23",
+ "border": "1px solid #3D3D3D",
+ "borderRadius": "50%",
"&$active": {
- fill: "#fff",
- border: "1px solid #3D3D3D",
- borderRadius: "50%",
+ "fill": "#fff",
+ "border": "1px solid #3D3D3D",
+ "borderRadius": "50%",
"& $text": {
fill: "#1C1F23",
- border: "1px solid #3D3D3D",
- },
- },
+ border: "1px solid #3D3D3D"
+ }
+ }
},
text: {
- fill: "#fff",
- },
+ fill: "#fff"
+ }
},
MuiInput: {
underline: {
"&:after": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&$focused:after": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&$error:after": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&:before": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&:hover:not($disabled):not($focused):not($error):before": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&$disabled:before": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&:active:not($disabled):not($focused):not($error):before": {
- borderBottom: "none",
- },
- },
+ borderBottom: "none"
+ }
+ }
},
MuiButton: {
root: {
- textTransform: "capitalize",
- fontWeight: 500,
- fontSize: 18,
- padding: "3px 14px",
- letterSpacing: "-0.03em",
- boxShadow: "none",
+ "textTransform": "capitalize",
+ "fontWeight": 500,
+ "fontSize": 18,
+ "padding": "3px 14px",
+ "letterSpacing": "-0.03em",
+ "boxShadow": "none",
"&:hover": {
- boxShadow: "none",
+ boxShadow: "none"
},
"&$disabled": {
color: "#2F3438 !important",
- background: "#41484d !important",
- },
+ background: "#41484d !important"
+ }
},
outlined: {
"&$disabled": {
- border: "2px solid #3d3d3d",
+ border: "2px solid #3d3d3d"
},
- borderWidth: "2px !important",
- borderRadius: "4px",
- padding: "1px 8px",
- fontSize: "1rem",
- },
+ "borderWidth": "2px !important",
+ "borderRadius": "4px",
+ "padding": "1px 8px",
+ "fontSize": "1rem"
+ }
},
MuiInputBase: {
input: {
textAlign: "center",
- color: "#fff",
- },
+ color: "#fff"
+ }
},
MuiDivider: {
root: {
marginTop: 16,
- marginBottom: 16,
- },
+ marginBottom: 16
+ }
},
MuiDialog: {
paper: {
background: "#1C1F23",
width: 615,
- maxWidth: "100%",
+ maxWidth: "100%"
},
root: {
- height: "auto",
+ height: "auto"
},
paperWidthSm: {
maxWidth: 615,
- height: "auto",
- },
+ height: "auto"
+ }
},
MuiFormControl: {
root: {
- width: "100%",
- },
+ width: "100%"
+ }
},
MuiDialogContent: {
root: {
- padding: "42px 54px",
+ "padding": "42px 54px",
"&:first-child": {
paddingTop: "42px"
}
- },
+ }
},
MuiSelect: {
selectMenu: {
- textAlign: "right",
- },
+ textAlign: "right"
+ }
},
MuiDialogContentText: {
root: {
- marginBottom: 0,
- },
+ marginBottom: 0
+ }
},
MuiSwitch: {
root: {
width: 75,
- height: 50,
+ height: 50
},
switchBase: {
- color: "red",
- top: 8,
- left: 8,
+ "color": "red",
+ "top": 8,
+ "left": 8,
"$checked$checked + &": {
opacity: 1,
backgroundColor: "#1C1F23",
- color: "#81FEB7",
- },
+ color: "#81FEB7"
+ }
},
track: {
- borderRadius: "40px",
- backgroundColor: "inherit",
- border: "1px solid #fff",
- opacity: 0.5,
+ "borderRadius": "40px",
+ "backgroundColor": "inherit",
+ "border": "1px solid #fff",
+ "opacity": 0.5,
"$checked$checked + &": {
opacity: 1,
backgroundColor: "#1C1F23",
- color: "#81FEB7",
- },
+ color: "#81FEB7"
+ }
},
thumb: {
- width: 18,
- height: 18,
+ "width": 18,
+ "height": 18,
"$checked$checked + &": {
- color: "#81FEB7",
- },
+ color: "#81FEB7"
+ }
},
colorSecondary: {
- color: "#fff",
+ "color": "#fff",
"$checked$checked + &": {
- color: "#81FEB7",
+ color: "#81FEB7"
},
"& .Mui-checked": {
- color: "#81FEB7",
- },
- },
+ color: "#81FEB7"
+ }
+ }
},
MuiFormHelperText: {
root: {
- display: "none",
- },
+ display: "none"
+ }
},
MuiTable: {
root: {
@@ -354,51 +354,51 @@ export const theme = createTheme({
}
},
MuiTableBody: {
- "root": {
+ root: {
"& > *": {
borderTop: "0.3px solid rgba(125,140,139, 0.2)",
- minHeight: 90,
+ minHeight: 90
}
}
},
MuiTableCell: {
- "root": {
+ root: {
borderBottom: "unset"
}
},
MuiTableRow: {
root: {
- '& th:first-child, & td:first-child': {
- paddingLeft: 46,
- },
- '& th:last-child, & td:last-child': {
- paddingRight: 46,
- },
+ "& th:first-child, & td:first-child": {
+ paddingLeft: 46
+ },
+ "& th:last-child, & td:last-child": {
+ paddingRight: 46
+ }
}
},
MuiGrid: {
- 'align-items-xs-center': {
- alignItems: 'center',
- },
+ "align-items-xs-center": {
+ alignItems: "center"
+ }
},
MuiLinearProgress: {
root: {
borderRadius: 50,
background: "rgba(125,140,139, 0.2) !important"
- },
+ }
},
MuiPaper: {
rounded: {
- borderRadius: "8px",
+ borderRadius: "8px"
}
}
- },
-});
+ }
+})
-declare module '@material-ui/core/styles/createBreakpoints' {
+declare module "@material-ui/core/styles/createBreakpoints" {
interface BreakpointOverrides {
- mobile: true;
- toolbarswitch: true;
+ mobile: true
+ toolbarswitch: true
}
}
@@ -413,5 +413,5 @@ export const themeOptions: ThemeOptions = {
lg: 1200,
xl: 1536
}
- },
-}
\ No newline at end of file
+ }
+}
diff --git a/src/theme/legacy.ts b/src/theme/legacy.ts
index 034a505c..0ba0b8a9 100644
--- a/src/theme/legacy.ts
+++ b/src/theme/legacy.ts
@@ -1,9 +1,9 @@
-import { createMuiTheme } from "@material-ui/core/styles";
+import { createMuiTheme } from "@material-ui/core/styles"
export const legacyTheme = createMuiTheme({
palette: {
primary: {
main: "#1C1F23",
- light: "#3D3D3D",
+ light: "#3D3D3D"
},
secondary: {
main: "#4BCF93",
@@ -14,132 +14,132 @@ export const legacyTheme = createMuiTheme({
secondary: "#fff"
},
error: {
- main: "#ED254E",
+ main: "#ED254E"
},
info: {
- main: "#3866F9",
+ main: "#3866F9"
},
warning: {
- main: "#FFC839",
- },
+ main: "#FFC839"
+ }
},
typography: {
fontFamily: "Roboto Mono",
h1: {
fontSize: 35,
- letterSpacing: "-0.01em",
+ letterSpacing: "-0.01em"
},
subtitle1: {
fontSize: 18,
fontWeight: 400,
lineHeight: "26.33px",
- letterSpacing: "-0.01em",
+ letterSpacing: "-0.01em"
},
subtitle2: {
fontSize: 16,
fontWeight: 400,
lineHeight: "26.33px",
- letterSpacing: "-0.01em",
+ letterSpacing: "-0.01em"
},
h3: {
fontSize: 35,
fontWeight: 500,
- fontFamily: "Roboto Mono",
+ fontFamily: "Roboto Mono"
},
h2: {
color: "#000000",
fontSize: 25,
- fontWeight: 500,
+ fontWeight: 500
},
h4: {
- fontSize: 20,
+ fontSize: 20
},
h5: {
- fontSize: 35,
+ fontSize: 35
},
body1: {
- fontSize: 16,
+ fontSize: 16
},
body2: {
fontSize: 16,
fontWeight: 300,
lineHeight: "413.4%",
- opacity: 0.8,
+ opacity: 0.8
}
},
overrides: {
MuiSlider: {
root: {
- color: "#3D3D3D",
- },
+ color: "#3D3D3D"
+ }
},
MuiTab: {
root: {
- maxWidth: "100%",
- },
+ maxWidth: "100%"
+ }
},
MuiTooltip: {
tooltip: {
backgroundColor: "#4BCF93",
fontSize: 14,
- padding: "10px 15px",
- },
+ padding: "10px 15px"
+ }
},
MuiStepLabel: {
root: {
- marginTop: -3,
+ marginTop: -3
},
label: {
- color: "#fff",
- opacity: 0.5,
- marginLeft: 15,
- fontSize: 14,
- lineHeight: "18.5px",
- height: 40,
- display: "flex",
- alignItems: "center",
+ "color": "#fff",
+ "opacity": 0.5,
+ "marginLeft": 15,
+ "fontSize": 14,
+ "lineHeight": "18.5px",
+ "height": 40,
+ "display": "flex",
+ "alignItems": "center",
"&$completed": {
- fontWeight: 300,
+ fontWeight: 300
},
"&$active": {
- fontWeight: 300,
+ fontWeight: 300
},
"& .MuiStepLabel-completed": {
- fontWeight: 300,
- },
+ fontWeight: 300
+ }
},
active: {
color: "#fff !important",
- opacity: 1,
+ opacity: 1
},
completed: {
color: "#fff !important",
opacity: 0.5,
- fontWeight: 300,
- },
+ fontWeight: 300
+ }
},
MuiStepConnector: {
vertical: {
padding: "0px",
- marginLeft: 17,
+ marginLeft: 17
},
lineVertical: {
borderLeftWidth: 2,
minHeight: 28,
- marginTop: -16,
+ marginTop: -16
},
line: {
borderColor: "#fff",
opacity: 0.2
},
active: {
- '& span': {
+ "& span": {
borderLeftColor: "#81feb7",
opacity: 1
}
},
completed: {
- '& span': {
+ "& span": {
borderLeftColor: "#81feb7",
opacity: 1
}
@@ -147,69 +147,69 @@ export const legacyTheme = createMuiTheme({
},
MuiStepContent: {
root: {
- borderLeft: "none",
- },
+ borderLeft: "none"
+ }
},
MuiStep: {
root: {
- marginBottom: 15,
- },
+ marginBottom: 15
+ }
},
MuiStepIcon: {
active: {
- color: "#1C1F23 !important",
+ color: "#1C1F23 !important"
},
completed: {
- color: "#fff !important",
+ color: "#fff !important"
},
root: {
- height: 32,
- width: 32,
- color: "#2f3438",
- border: "2px solid rgba(255, 255, 255, 0.2)",
- borderRadius: "50%",
+ "height": 32,
+ "width": 32,
+ "color": "#2f3438",
+ "border": "2px solid rgba(255, 255, 255, 0.2)",
+ "borderRadius": "50%",
"&$active": {
- fill: "#81feb7",
- border: "2px solid #81feb7",
- borderRadius: "50%",
+ "fill": "#81feb7",
+ "border": "2px solid #81feb7",
+ "borderRadius": "50%",
"& $text": {
fill: "#1C1F23",
- border: "1px solid #2f3438",
- },
+ border: "1px solid #2f3438"
+ }
},
"&$completed": {
fill: "#81feb7",
- border: "2px solid #81feb7",
+ border: "2px solid #81feb7"
}
},
text: {
- fill: "#fff",
- },
+ fill: "#fff"
+ }
},
MuiInput: {
underline: {
"&:after": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&$focused:after": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&$error:after": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&:before": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&:hover:not($disabled):not($focused):not($error):before": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&$disabled:before": {
- borderBottom: "none",
+ borderBottom: "none"
},
"&:active:not($disabled):not($focused):not($error):before": {
- borderBottom: "none",
- },
- },
+ borderBottom: "none"
+ }
+ }
},
MuiInputAdornment: {
positionStart: {
@@ -219,113 +219,113 @@ export const legacyTheme = createMuiTheme({
MuiButton: {
root: {
"&$disabled": {
- color: "#3d3d3d",
- },
+ color: "#3d3d3d"
+ }
},
outlined: {
"&$disabled": {
- border: "2px solid #3d3d3d",
+ border: "2px solid #3d3d3d"
},
- borderWidth: "2px !important",
- borderRadius: "4px",
- padding: "1px 8px",
- fontSize: "1rem",
- },
+ "borderWidth": "2px !important",
+ "borderRadius": "4px",
+ "padding": "1px 8px",
+ "fontSize": "1rem"
+ }
},
MuiInputBase: {
input: {
textAlign: "start",
- color: "#fff",
- },
+ color: "#fff"
+ }
},
MuiDivider: {
root: {
marginTop: 16,
- marginBottom: 16,
- },
+ marginBottom: 16
+ }
},
MuiDialog: {
paper: {
background: "#1C1F23",
width: 570,
- maxWidth: "100%",
+ maxWidth: "100%"
},
root: {
minHeight: 600,
- height: "auto",
+ height: "auto"
},
paperWidthSm: {
minHeight: 600,
- height: "auto",
- },
+ height: "auto"
+ }
},
MuiFormControl: {
root: {
- width: "100%",
- },
+ width: "100%"
+ }
},
MuiDialogContent: {
root: {
- padding: 0,
- },
+ padding: 0
+ }
},
MuiSelect: {
selectMenu: {
- textAlign: "right",
- },
+ textAlign: "right"
+ }
},
MuiDialogContentText: {
root: {
- marginBottom: 0,
- },
+ marginBottom: 0
+ }
},
MuiSwitch: {
root: {
width: 75,
- height: 50,
+ height: 50
},
switchBase: {
- color: "red",
- top: 8,
- left: 8,
+ "color": "red",
+ "top": 8,
+ "left": 8,
"$checked$checked + &": {
opacity: 1,
backgroundColor: "#1C1F23",
- color: "#81FEB7",
- },
+ color: "#81FEB7"
+ }
},
track: {
- borderRadius: "40px",
- backgroundColor: "inherit",
- border: "1px solid #fff",
- opacity: 0.5,
+ "borderRadius": "40px",
+ "backgroundColor": "inherit",
+ "border": "1px solid #fff",
+ "opacity": 0.5,
"$checked$checked + &": {
opacity: 1,
backgroundColor: "#1C1F23",
- color: "#81FEB7",
- },
+ color: "#81FEB7"
+ }
},
thumb: {
- width: 18,
- height: 18,
+ "width": 18,
+ "height": 18,
"$checked$checked + &": {
- color: "#81FEB7",
- },
+ color: "#81FEB7"
+ }
},
colorSecondary: {
- color: "#fff",
+ "color": "#fff",
"$checked$checked + &": {
- color: "#81FEB7",
+ color: "#81FEB7"
},
"& .Mui-checked": {
- color: "#81FEB7",
- },
- },
+ color: "#81FEB7"
+ }
+ }
},
MuiFormHelperText: {
root: {
- display: "none",
- },
+ display: "none"
+ }
}
- },
-});
\ No newline at end of file
+ }
+})
diff --git a/src/utils.ts b/src/utils.ts
index fa26ad36..16619f98 100644
--- a/src/utils.ts
+++ b/src/utils.ts
@@ -1,7 +1,2 @@
-export const roundNumber = ({
- number,
- decimals,
- }: {
- number: number;
- decimals: number;
-}) => Math.round(number * 10 ** decimals) / 10 ** decimals;
\ No newline at end of file
+export const roundNumber = ({ number, decimals }: { number: number; decimals: number }) =>
+ Math.round(number * 10 ** decimals) / 10 ** decimals
diff --git a/yarn.lock b/yarn.lock
index 1cc054cf..5f298a6d 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2959,6 +2959,11 @@ ansi-regex@^5.0.0, ansi-regex@^5.0.1:
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
+ansi-regex@^6.0.1:
+ version "6.0.1"
+ resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-6.0.1.tgz#3183e38fae9a65d7cb5e53945cd5897d0260a06a"
+ integrity sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==
+
ansi-styles@^3.2.0, ansi-styles@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
@@ -2973,6 +2978,11 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"
+ansi-styles@^6.0.0:
+ version "6.1.1"
+ resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.1.1.tgz#63cd61c72283a71cb30bd881dbb60adada74bc70"
+ integrity sha512-qDOv24WjnYuL+wbwHdlsYZFy+cgPtrYw0Tn7GLORicQp9BkQLzrgI3Pm4VyR9ERZ41YTn7KlMPuL1n05WdZvmg==
+
anymatch@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-2.0.0.tgz#bcb24b4f37934d9aa7ac17b4adaf89e7c76ef2eb"
@@ -3592,7 +3602,7 @@ braces@^2.3.1, braces@^2.3.2:
split-string "^3.0.2"
to-regex "^3.0.1"
-braces@^3.0.1, braces@~3.0.2:
+braces@^3.0.1, braces@^3.0.2, braces@~3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107"
integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==
@@ -4082,6 +4092,14 @@ cli-truncate@^2.1.0:
slice-ansi "^3.0.0"
string-width "^4.2.0"
+cli-truncate@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/cli-truncate/-/cli-truncate-3.1.0.tgz#3f23ab12535e3d73e839bb43e73c9de487db1389"
+ integrity sha512-wfOBkjXteqSnI59oPcJkcPl/ZmwvMMOj340qUIY1SKZCv0B9Cf4D4fAucRkIKQmsIuYK3x1rrgU7MeGRruiuiA==
+ dependencies:
+ slice-ansi "^5.0.0"
+ string-width "^5.0.0"
+
clipboardy@1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-1.2.3.tgz#0526361bf78724c1f20be248d428e365433c07ef"
@@ -4194,6 +4212,11 @@ colorette@^2.0.16:
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.16.tgz#713b9af84fdb000139f04546bd4a93f62a5085da"
integrity sha512-hUewv7oMjCp+wkBv5Rm0v87eJhq4woh5rSR+42YSQJKecCqgIqNkZ6lAlQms/BwHPJA5NKMRlpxPRv0n8HQW6g==
+colorette@^2.0.17:
+ version "2.0.19"
+ resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.19.tgz#cdf044f47ad41a0f4b56b3a0d5b4e6e1a2d5a798"
+ integrity sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==
+
combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
@@ -4216,10 +4239,10 @@ commander@^4.1.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068"
integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==
-commander@^6.2.0:
- version "6.2.1"
- resolved "https://registry.yarnpkg.com/commander/-/commander-6.2.1.tgz#0792eb682dfbc325999bb2b84fddddba110ac73c"
- integrity sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==
+commander@^9.3.0:
+ version "9.4.1"
+ resolved "https://registry.yarnpkg.com/commander/-/commander-9.4.1.tgz#d1dd8f2ce6faf93147295c0df13c7c21141cfbdd"
+ integrity sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==
common-tags@^1.8.0:
version "1.8.2"
@@ -4472,7 +4495,7 @@ cross-fetch@^3.0.6:
dependencies:
node-fetch "2.6.1"
-cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.2:
+cross-spawn@7.0.3, cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
@@ -4807,7 +4830,7 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.0, debug@^2.6.9:
dependencies:
ms "2.0.0"
-debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.2.0, debug@^4.3.1:
+debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1:
version "4.3.2"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.2.tgz#f0a49c18ac8779e31d4a0c6029dfb76873c7428b"
integrity sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==
@@ -4828,6 +4851,13 @@ debug@^4.0.0:
dependencies:
ms "2.1.2"
+debug@^4.3.4:
+ version "4.3.4"
+ resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
+ integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
+ dependencies:
+ ms "2.1.2"
+
decamelize@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
@@ -5168,6 +5198,11 @@ duplexify@^3.4.2, duplexify@^3.6.0:
readable-stream "^2.0.0"
stream-shift "^1.0.0"
+eastasianwidth@^0.2.0:
+ version "0.2.0"
+ resolved "https://registry.yarnpkg.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb"
+ integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==
+
ee-first@1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d"
@@ -5254,7 +5289,7 @@ enhanced-resolve@^4.3.0:
memory-fs "^0.5.0"
tapable "^1.0.0"
-enquirer@^2.3.5, enquirer@^2.3.6:
+enquirer@^2.3.5:
version "2.3.6"
resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d"
integrity sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==
@@ -5481,6 +5516,13 @@ eslint-plugin-jsx-a11y@^6.3.1:
language-tags "^1.0.5"
minimatch "^3.0.4"
+eslint-plugin-prettier@^4.2.1:
+ version "4.2.1"
+ resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-4.2.1.tgz#651cbb88b1dab98bfd42f017a12fa6b2d993f94b"
+ integrity sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==
+ dependencies:
+ prettier-linter-helpers "^1.0.0"
+
eslint-plugin-react-hooks@^4.2.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.3.0.tgz#318dbf312e06fab1c835a4abef00121751ac1172"
@@ -5743,7 +5785,7 @@ execa@^1.0.0:
signal-exit "^3.0.0"
strip-eof "^1.0.0"
-execa@^4.0.0, execa@^4.1.0:
+execa@^4.0.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/execa/-/execa-4.1.0.tgz#4e5491ad1572f2f17a77d388c6c857135b22847a"
integrity sha512-j5W0//W7f8UxAn8hXVnwG8tLwdiUy4FJLcSupCg6maBYZDpyBvTApK7KyuI4bKj8KOh1r2YH+6ucuYtJv1bTZA==
@@ -5758,6 +5800,21 @@ execa@^4.0.0, execa@^4.1.0:
signal-exit "^3.0.2"
strip-final-newline "^2.0.0"
+execa@^6.1.0:
+ version "6.1.0"
+ resolved "https://registry.yarnpkg.com/execa/-/execa-6.1.0.tgz#cea16dee211ff011246556388effa0818394fb20"
+ integrity sha512-QVWlX2e50heYJcCPG0iWtf8r0xjEYfz/OYLGDYH+IyjWezzPNxz63qNFOu0l4YftGWuizFVZHHs8PrLU5p2IDA==
+ dependencies:
+ cross-spawn "^7.0.3"
+ get-stream "^6.0.1"
+ human-signals "^3.0.1"
+ is-stream "^3.0.0"
+ merge-stream "^2.0.0"
+ npm-run-path "^5.1.0"
+ onetime "^6.0.0"
+ signal-exit "^3.0.7"
+ strip-final-newline "^3.0.0"
+
exit@^0.1.2:
version "0.1.2"
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c"
@@ -5880,6 +5937,11 @@ fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
+fast-diff@^1.1.2:
+ version "1.2.0"
+ resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.2.0.tgz#73ee11982d86caaf7959828d519cfe927fac5f03"
+ integrity sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==
+
fast-glob@^3.1.1:
version "3.2.7"
resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.2.7.tgz#fd6cb7a2d7e9aa7a7846111e85a196d6b2f766a1"
@@ -6293,6 +6355,11 @@ get-stream@^5.0.0:
dependencies:
pump "^3.0.0"
+get-stream@^6.0.1:
+ version "6.0.1"
+ resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
+ integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==
+
get-symbol-description@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6"
@@ -6839,10 +6906,15 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
-husky@^5.1.3:
- version "5.2.0"
- resolved "https://registry.yarnpkg.com/husky/-/husky-5.2.0.tgz#fc5e1c2300d34855d47de4753607d00943fc0802"
- integrity sha512-AM8T/auHXRBxlrfPVLKP6jt49GCM2Zz47m8G3FOMsLmTv8Dj/fKVWE0Rh2d4Qrvmy131xEsdQnb3OXRib67PGg==
+human-signals@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-3.0.1.tgz#c740920859dafa50e5a3222da9d3bf4bb0e5eef5"
+ integrity sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==
+
+husky@^8.0.1:
+ version "8.0.1"
+ resolved "https://registry.yarnpkg.com/husky/-/husky-8.0.1.tgz#511cb3e57de3e3190514ae49ed50f6bc3f50b3e9"
+ integrity sha512-xs7/chUH/CKdOCs7Zy0Aev9e/dKOMZf3K1Az1nar3tzlv0jfqnYtu235bstsWTmXOR0EfINrPa97yy4Lz6RiKw==
hyphenate-style-name@^1.0.3:
version "1.0.4"
@@ -7214,6 +7286,11 @@ is-fullwidth-code-point@^3.0.0:
resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz#f116f8064fe90b3f7844a38997c0b75051269f1d"
integrity sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==
+is-fullwidth-code-point@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz#fae3167c729e7463f8461ce512b080a49268aa88"
+ integrity sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==
+
is-generator-fn@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-2.1.0.tgz#7d140adc389aaf3011a8f2a2a4cfa6faadffb118"
@@ -7356,6 +7433,11 @@ is-stream@^2.0.0:
resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.1.tgz#fac1e3d53b97ad5a9d0ae9cef2389f5810a5c077"
integrity sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==
+is-stream@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-3.0.0.tgz#e6bfd7aa6bef69f4f472ce9bb681e3e57b4319ac"
+ integrity sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==
+
is-string@^1.0.5, is-string@^1.0.7:
version "1.0.7"
resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd"
@@ -7375,11 +7457,6 @@ is-typedarray@^1.0.0:
resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a"
integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=
-is-unicode-supported@^0.1.0:
- version "0.1.0"
- resolved "https://registry.yarnpkg.com/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz#3f26c76a809593b52bfa2ecb5710ed2779b522a7"
- integrity sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==
-
is-weakref@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.1.tgz#842dba4ec17fa9ac9850df2d6efbc1737274f2a2"
@@ -8264,43 +8341,46 @@ libsodium@^0.7.0:
resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.10.tgz#c2429a7e4c0836f879d701fec2c8a208af024159"
integrity sha512-eY+z7hDrDKxkAK+QKZVNv92A5KYkxfvIshtBJkmg5TSiCnYqZP3i9OO9whE79Pwgm4jGaoHgkM4ao/b9Cyu4zQ==
+lilconfig@2.0.5:
+ version "2.0.5"
+ resolved "https://registry.yarnpkg.com/lilconfig/-/lilconfig-2.0.5.tgz#19e57fd06ccc3848fd1891655b5a447092225b25"
+ integrity sha512-xaYmXZtTHPAw5m+xLN8ab9C+3a8YmV3asNSPOATITbtwrfbwaLJj8h66H1WMIpALCkqsIzK3h7oQ+PdX+LQ9Eg==
+
lines-and-columns@^1.1.6:
version "1.2.4"
resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.2.4.tgz#eca284f75d2965079309dc0ad9255abb2ebc1632"
integrity sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==
-lint-staged@^10.5.4:
- version "10.5.4"
- resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-10.5.4.tgz#cd153b5f0987d2371fc1d2847a409a2fe705b665"
- integrity sha512-EechC3DdFic/TdOPgj/RB3FicqE6932LTHCUm0Y2fsD9KGlLB+RwJl2q1IYBIvEsKzDOgn0D4gll+YxG5RsrKg==
- dependencies:
- chalk "^4.1.0"
- cli-truncate "^2.1.0"
- commander "^6.2.0"
- cosmiconfig "^7.0.0"
- debug "^4.2.0"
- dedent "^0.7.0"
- enquirer "^2.3.6"
- execa "^4.1.0"
- listr2 "^3.2.2"
- log-symbols "^4.0.0"
- micromatch "^4.0.2"
+lint-staged@^13.0.3:
+ version "13.0.3"
+ resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-13.0.3.tgz#d7cdf03a3830b327a2b63c6aec953d71d9dc48c6"
+ integrity sha512-9hmrwSCFroTSYLjflGI8Uk+GWAwMB4OlpU4bMJEAT5d/llQwtYKoim4bLOyLCuWFAhWEupE0vkIFqtw/WIsPug==
+ dependencies:
+ cli-truncate "^3.1.0"
+ colorette "^2.0.17"
+ commander "^9.3.0"
+ debug "^4.3.4"
+ execa "^6.1.0"
+ lilconfig "2.0.5"
+ listr2 "^4.0.5"
+ micromatch "^4.0.5"
normalize-path "^3.0.0"
- please-upgrade-node "^3.2.0"
- string-argv "0.3.1"
- stringify-object "^3.3.0"
+ object-inspect "^1.12.2"
+ pidtree "^0.6.0"
+ string-argv "^0.3.1"
+ yaml "^2.1.1"
-listr2@^3.2.2:
- version "3.13.5"
- resolved "https://registry.yarnpkg.com/listr2/-/listr2-3.13.5.tgz#105a813f2eb2329c4aae27373a281d610ee4985f"
- integrity sha512-3n8heFQDSk+NcwBn3CgxEibZGaRzx+pC64n3YjpMD1qguV4nWus3Al+Oo3KooqFKTQEJ1v7MmnbnyyNspgx3NA==
+listr2@^4.0.5:
+ version "4.0.5"
+ resolved "https://registry.yarnpkg.com/listr2/-/listr2-4.0.5.tgz#9dcc50221583e8b4c71c43f9c7dfd0ef546b75d5"
+ integrity sha512-juGHV1doQdpNT3GSTs9IUN43QJb7KHdF9uqg7Vufs/tG9VTzpFphqF4pm/ICdAABGQxsyNn9CiYA3StkI6jpwA==
dependencies:
cli-truncate "^2.1.0"
colorette "^2.0.16"
log-update "^4.0.0"
p-map "^4.0.0"
rfdc "^1.3.0"
- rxjs "^7.4.0"
+ rxjs "^7.5.5"
through "^2.3.8"
wrap-ansi "^7.0.0"
@@ -8428,14 +8508,6 @@ lodash.uniq@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
-log-symbols@^4.0.0:
- version "4.1.0"
- resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-4.1.0.tgz#3fbdbb95b4683ac9fc785111e792e558d4abd503"
- integrity sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==
- dependencies:
- chalk "^4.1.0"
- is-unicode-supported "^0.1.0"
-
log-update@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/log-update/-/log-update-4.0.0.tgz#589ecd352471f2a1c0c570287543a64dfd20e0a1"
@@ -9042,6 +9114,14 @@ micromatch@^4.0.2, micromatch@^4.0.4:
braces "^3.0.1"
picomatch "^2.2.3"
+micromatch@^4.0.5:
+ version "4.0.5"
+ resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
+ integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
+ dependencies:
+ braces "^3.0.2"
+ picomatch "^2.3.1"
+
microseconds@0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/microseconds/-/microseconds-0.2.0.tgz#233b25f50c62a65d861f978a4a4f8ec18797dc39"
@@ -9094,6 +9174,11 @@ mimic-fn@^2.1.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
+mimic-fn@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc"
+ integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==
+
mini-create-react-context@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz#072171561bfdc922da08a60c2197a497cc2d1d5e"
@@ -9482,6 +9567,13 @@ npm-run-path@^4.0.0:
dependencies:
path-key "^3.0.0"
+npm-run-path@^5.1.0:
+ version "5.1.0"
+ resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-5.1.0.tgz#bc62f7f3f6952d9894bd08944ba011a6ee7b7e00"
+ integrity sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==
+ dependencies:
+ path-key "^4.0.0"
+
nth-check@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-1.0.2.tgz#b2bd295c37e3dd58a3bf0700376663ba4d9cf05c"
@@ -9525,6 +9617,11 @@ object-inspect@^1.11.0, object-inspect@^1.9.0:
resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1"
integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg==
+object-inspect@^1.12.2:
+ version "1.12.2"
+ resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.12.2.tgz#c0641f26394532f28ab8d796ab954e43c009a8ea"
+ integrity sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==
+
object-is@^1.0.1:
version "1.1.5"
resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac"
@@ -9642,6 +9739,13 @@ onetime@^5.1.0:
dependencies:
mimic-fn "^2.1.0"
+onetime@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/onetime/-/onetime-6.0.0.tgz#7c24c18ed1fd2e9bca4bd26806a33613c77d34b4"
+ integrity sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==
+ dependencies:
+ mimic-fn "^4.0.0"
+
open@^7.0.2, open@^7.3.1:
version "7.4.2"
resolved "https://registry.yarnpkg.com/open/-/open-7.4.2.tgz#b8147e26dcf3e426316c730089fd71edd29c2321"
@@ -9903,6 +10007,11 @@ path-key@^3.0.0, path-key@^3.1.0:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==
+path-key@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/path-key/-/path-key-4.0.0.tgz#295588dc3aee64154f877adb9d780b81c554bf18"
+ integrity sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==
+
path-parse@^1.0.6:
version "1.0.7"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
@@ -9961,6 +10070,16 @@ picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.2, picomatch@^2.2.3:
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972"
integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==
+picomatch@^2.3.1:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42"
+ integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==
+
+pidtree@^0.6.0:
+ version "0.6.0"
+ resolved "https://registry.yarnpkg.com/pidtree/-/pidtree-0.6.0.tgz#90ad7b6d42d5841e69e0a2419ef38f8883aa057c"
+ integrity sha512-eG2dWTVw5bzqGRztnHExczNxt5VGsE6OwTeCG3fdUf9KBsZzO3R5OIIIzWR+iZA0NtZ+RDVdaoE2dK1cn6jH4g==
+
pify@^2.0.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c"
@@ -10018,13 +10137,6 @@ pkg-up@3.1.0:
dependencies:
find-up "^3.0.0"
-please-upgrade-node@^3.2.0:
- version "3.2.0"
- resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942"
- integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==
- dependencies:
- semver-compare "^1.0.0"
-
pnp-webpack-plugin@1.6.4:
version "1.6.4"
resolved "https://registry.yarnpkg.com/pnp-webpack-plugin/-/pnp-webpack-plugin-1.6.4.tgz#c9711ac4dc48a685dabafc86f8b6dd9f8df84149"
@@ -10732,6 +10844,13 @@ prepend-http@^1.0.0:
resolved "https://registry.yarnpkg.com/prepend-http/-/prepend-http-1.0.4.tgz#d4f4562b0ce3696e41ac52d0e002e57a635dc6dc"
integrity sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=
+prettier-linter-helpers@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz#d23d41fe1375646de2d0104d3454a3008802cf7b"
+ integrity sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==
+ dependencies:
+ fast-diff "^1.1.2"
+
prettier@^2.2.0:
version "2.4.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c"
@@ -11756,12 +11875,12 @@ rxjs@^6.6.3:
dependencies:
tslib "^1.9.0"
-rxjs@^7.4.0:
- version "7.4.0"
- resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.4.0.tgz#a12a44d7eebf016f5ff2441b87f28c9a51cebc68"
- integrity sha512-7SQDi7xeTMCJpqViXh8gL/lebcwlp3d831F05+9B44A4B0WfsEwUQHR64gsH1kvJ+Ep/J9K2+n1hVl1CsGN23w==
+rxjs@^7.5.5:
+ version "7.5.7"
+ resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.5.7.tgz#2ec0d57fdc89ece220d2e702730ae8f1e49def39"
+ integrity sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==
dependencies:
- tslib "~2.1.0"
+ tslib "^2.1.0"
sade@^1.7.3:
version "1.8.1"
@@ -11882,11 +12001,6 @@ selfsigned@^1.10.8:
dependencies:
node-forge "^0.10.0"
-semver-compare@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
- integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
-
"semver@2 || 3 || 4 || 5", semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0:
version "5.7.1"
resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7"
@@ -12085,6 +12199,11 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.6.tgz#24e630c4b0f03fea446a2bd299e62b4a6ca8d0af"
integrity sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==
+signal-exit@^3.0.7:
+ version "3.0.7"
+ resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9"
+ integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==
+
simple-swizzle@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
@@ -12120,6 +12239,14 @@ slice-ansi@^4.0.0:
astral-regex "^2.0.0"
is-fullwidth-code-point "^3.0.0"
+slice-ansi@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-5.0.0.tgz#b73063c57aa96f9cd881654b15294d95d285c42a"
+ integrity sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==
+ dependencies:
+ ansi-styles "^6.0.0"
+ is-fullwidth-code-point "^4.0.0"
+
snapdragon-node@^2.0.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/snapdragon-node/-/snapdragon-node-2.1.1.tgz#6c175f86ff14bdb0724563e8f3c1b021a286853b"
@@ -12397,7 +12524,7 @@ strict-uri-encode@^1.0.0:
resolved "https://registry.yarnpkg.com/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz#279b225df1d582b1f54e65addd4352e18faa0713"
integrity sha1-J5siXfHVgrH1TmWt3UNS4Y+qBxM=
-string-argv@0.3.1:
+string-argv@^0.3.1:
version "0.3.1"
resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da"
integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg==
@@ -12441,6 +12568,15 @@ string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
is-fullwidth-code-point "^3.0.0"
strip-ansi "^6.0.1"
+string-width@^5.0.0:
+ version "5.1.2"
+ resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794"
+ integrity sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==
+ dependencies:
+ eastasianwidth "^0.2.0"
+ emoji-regex "^9.2.2"
+ strip-ansi "^7.0.1"
+
string.prototype.matchall@^4.0.6:
version "4.0.6"
resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.6.tgz#5abb5dabc94c7b0ea2380f65ba610b3a544b15fa"
@@ -12529,6 +12665,13 @@ strip-ansi@^6.0.0, strip-ansi@^6.0.1:
dependencies:
ansi-regex "^5.0.1"
+strip-ansi@^7.0.1:
+ version "7.0.1"
+ resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2"
+ integrity sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==
+ dependencies:
+ ansi-regex "^6.0.1"
+
strip-bom@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3"
@@ -12557,6 +12700,11 @@ strip-final-newline@^2.0.0:
resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==
+strip-final-newline@^3.0.0:
+ version "3.0.0"
+ resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-3.0.0.tgz#52894c313fbff318835280aed60ff71ebf12b8fd"
+ integrity sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==
+
strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
@@ -12954,11 +13102,6 @@ tslib@^2.0.3, tslib@^2.1.0:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
-tslib@~2.1.0:
- version "2.1.0"
- resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a"
- integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A==
-
tsutils@^3.17.1, tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
@@ -13982,6 +14125,11 @@ yaml@^1.10.0, yaml@^1.7.2:
resolved "https://registry.yarnpkg.com/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b"
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==
+yaml@^2.1.1:
+ version "2.1.1"
+ resolved "https://registry.yarnpkg.com/yaml/-/yaml-2.1.1.tgz#1e06fb4ca46e60d9da07e4f786ea370ed3c3cfec"
+ integrity sha512-o96x3OPo8GjWeSLF+wOAbrPfhFOGY0W00GNaxCDv+9hkcDJEnev1yh8S7pgHF0ik6zc8sQLuL8hjHjJULZp8bw==
+
yargs-parser@^13.1.2:
version "13.1.2"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38"