-
Create Proposal
-
-
-
-
-
-
-
-
Select proposal action
-
-
{changeActionType(ActionType.Signaling)}}
- className={`rounded-xl border border-solid border-2 bg-neutral-0 hover:bg-neutral-50 flex flex-col items-center cursor-pointer ${actionType === ActionType.Signaling ? 'border-primary-300' : 'border-neutral-100'}`}>
-
- Signaling
-
-
changeActionType(ActionType.Withdrawal)}
- className={`rounded-xl border border-solid border-2 bg-neutral-0 hover:bg-neutral-50 flex flex-col items-center cursor-pointer ${actionType === ActionType.Withdrawal ? 'border-primary-300' : 'border-neutral-100'}`}>
-
- DAO Payment
-
-
changeActionType(ActionType.Custom)}
- className={`rounded-xl border border-solid border-2 bg-neutral-0 hover:bg-neutral-50 flex flex-col items-center cursor-pointer ${actionType === ActionType.Custom ? 'border-primary-300' : 'border-neutral-100'}`}>
-
- Custom action
-
-
-
- {actionType === ActionType.Withdrawal && ()}
- {actionType === ActionType.Custom && ()}
-
-
-
-
-
-
-
-
-
-
-
+ const proposalMetadataJsonObject = { title, summary };
+ const blob = new Blob([JSON.stringify(proposalMetadataJsonObject)], {
+ type: "application/json",
+ });
+
+ const ipfsPin = await uploadToIPFS(ipfsClient, blob);
+ createProposalWrite({
+ abi: TokenVotingAbi,
+ address: PUB_TOKEN_VOTING_PLUGIN_ADDRESS,
+ functionName: "createProposal",
+ args: [toHex(ipfsPin), actions, 0, 0, 0, 0, 0],
+ });
+ };
+
+ const handleTitleInput = (event: React.ChangeEvent
) => {
+ setTitle(event?.target?.value);
+ };
+
+ const showLoading = status === "pending" || isConfirming;
+
+ return (
+
+
+
+ Create Proposal
+
+
+
+
+
+
+
+
+
+ Select proposal action
+
+
+
{
+ changeActionType(ActionType.Signaling);
+ }}
+ className={`rounded-xl border border-solid border-2 bg-neutral-0 hover:bg-neutral-50 flex flex-col items-center cursor-pointer ${
+ actionType === ActionType.Signaling
+ ? "border-primary-300"
+ : "border-neutral-100"
+ }`}
+ >
+
+
+ Signaling
+
-
- )
-}
+
changeActionType(ActionType.Withdrawal)}
+ className={`rounded-xl border border-solid border-2 bg-neutral-0 hover:bg-neutral-50 flex flex-col items-center cursor-pointer ${
+ actionType === ActionType.Withdrawal
+ ? "border-primary-300"
+ : "border-neutral-100"
+ }`}
+ >
+
+
+ DAO Payment
+
+
+
changeActionType(ActionType.Custom)}
+ className={`rounded-xl border border-solid border-2 bg-neutral-0 hover:bg-neutral-50 flex flex-col items-center cursor-pointer ${
+ actionType === ActionType.Custom
+ ? "border-primary-300"
+ : "border-neutral-100"
+ }`}
+ >
+
+
+ Custom action
+
+
+
+
+ {actionType === ActionType.Withdrawal && (
+
+ )}
+ {actionType === ActionType.Custom && (
+
+ )}
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/plugins/tokenVoting/pages/proposal.tsx b/plugins/tokenVoting/pages/proposal.tsx
index 1f927327..85bf7ca8 100644
--- a/plugins/tokenVoting/pages/proposal.tsx
+++ b/plugins/tokenVoting/pages/proposal.tsx
@@ -99,19 +99,32 @@ export default function ProposalDetail({ id: proposalId }: { id: string }) {
useEffect(() => {
if (status === "idle" || status === "pending") return;
else if (status === "error") {
- if (error?.message?.startsWith("User rejected the request")) return;
- alert("Could not create the proposal");
+ if (error?.message?.startsWith("User rejected the request")) {
+ addAlert("Transaction rejected by the user", {
+ timeout: 4 * 1000,
+ });
+ } else {
+ addAlert("Could not create the proposal", { type: "error" });
+ }
return;
}
// success
if (!votingTxHash) return;
else if (isConfirming) {
- addAlert("The vote has been submitted", votingTxHash);
+ addAlert("Vote submitted", {
+ description: "Waiting for the transaction to be validated",
+ txHash: votingTxHash,
+ });
return;
} else if (!isConfirmed) return;
- // addAlert("The vote has been registered", votingTxHash);
+ addAlert("Vote registered", {
+ description: "The transaction has been validated",
+ type: "success",
+ txHash: votingTxHash,
+ });
+
reload();
}, [status, votingTxHash, isConfirming, isConfirmed]);
diff --git a/utils/types.ts b/utils/types.ts
index 3a169a4f..be83054a 100644
--- a/utils/types.ts
+++ b/utils/types.ts
@@ -2,10 +2,12 @@ export type Action = {
to: string;
value: bigint;
data: string;
-}
+};
export interface IAlert {
- message: string;
- txHash: string;
id: number;
+ type: "success" | "info" | "error";
+ message: string;
+ description?: string;
+ explorerLink?: string;
}