diff --git a/package.json b/package.json index db54760..0bcf314 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ghost-dao-interface", "private": true, - "version": "0.5.12", + "version": "0.5.13", "type": "module", "scripts": { "dev": "vite", diff --git a/src/containers/Governance/NewProposal.jsx b/src/containers/Governance/NewProposal.jsx index ed0a7f9..76017bc 100644 --- a/src/containers/Governance/NewProposal.jsx +++ b/src/containers/Governance/NewProposal.jsx @@ -137,6 +137,7 @@ const NewProposal = ({ config, address, connect, chainId }) => { Function Target + Calldata Value diff --git a/src/containers/Governance/components/functions/index.jsx b/src/containers/Governance/components/functions/index.jsx index 4f44cec..c460313 100644 --- a/src/containers/Governance/components/functions/index.jsx +++ b/src/containers/Governance/components/functions/index.jsx @@ -1,6 +1,7 @@ -import { useRef, useMemo } from "react"; +import { useRef, useMemo, useState } from "react"; import { Box, Typography, Link, TableCell, TableRow, useTheme } from "@mui/material"; import { decodeFunctionData } from 'viem'; +import toast from "react-hot-toast"; import { StyledInputBase } from "../../../../components/Swap/SwapCard"; import { TertiaryButton } from "../../../../components/Button"; @@ -56,6 +57,7 @@ export const parseFunctionCalldata = (metadata, index, chainId, nativeCoin, remo return { + const [isCopied, setIsCopied] = useState(false); + const etherscanLink = useMemo(() => { const client = config.getClient(); let url = client?.chain?.blockExplorers?.default?.url; @@ -256,6 +263,19 @@ export const ParsedCell = (props) => { return url; }, [props]); + const handleCalldataCopy = async () => { + try { + await navigator.clipboard.writeText(props.calldata); + setIsCopied(true); + toast.success("Calldata successfully copied to your clipboard.", { duration: 2000 }); + + setTimeout(() => setIsCopied(false), 2000); + } catch (err) { + toast.error("Could not copy calldata to clipboard, check logs for error details.", { duration: 5000 }); + console.error(err); + } + }; + return ( @@ -268,6 +288,12 @@ export const ParsedCell = (props) => { + + + {shorten(props.calldata)} + + + {formatCurrency(props.value, 2, props.nativeCoin)}