diff --git a/apps/playground/src/pages/about/index.tsx b/apps/playground/src/pages/about/index.tsx
index 49ede155..7965fca3 100644
--- a/apps/playground/src/pages/about/index.tsx
+++ b/apps/playground/src/pages/about/index.tsx
@@ -1,6 +1,6 @@
import AboutHero from "./about-us/hero";
import AboutIncorporation from "./about-us/incorporation";
-import AboutMeeting from "./about-us/meeting";
+// import AboutMeeting from "./about-us/meeting";
import AboutStatus from "./about-us/status";
import AboutTeam from "./about-us/team";
@@ -8,7 +8,7 @@ export default function AboutPage() {
return (
<>
-
+ {/* */}
diff --git a/apps/playground/src/pages/apis/txbuilder/governance/index.tsx b/apps/playground/src/pages/apis/txbuilder/governance/index.tsx
index 00eddb50..e8a454b3 100644
--- a/apps/playground/src/pages/apis/txbuilder/governance/index.tsx
+++ b/apps/playground/src/pages/apis/txbuilder/governance/index.tsx
@@ -46,7 +46,7 @@ const ReactPage: NextPage = () => {
the Mesh SDK.
-
+
diff --git a/apps/playground/src/pages/apis/txbuilder/governance/registration.tsx b/apps/playground/src/pages/apis/txbuilder/governance/registration.tsx
index 672e2ba7..27ac6f38 100644
--- a/apps/playground/src/pages/apis/txbuilder/governance/registration.tsx
+++ b/apps/playground/src/pages/apis/txbuilder/governance/registration.tsx
@@ -153,8 +153,17 @@ function Right() {
throw new Error("No DRep key found, this wallet does not support CIP95");
const dRepId = dRep.dRepIDCip105;
- const anchorHash = await getMeshJsonHash(anchorUrl);
+ let anchor: { anchorUrl: string; anchorDataHash: string } | undefined =
+ undefined;
+ if (anchorUrl.length > 0) {
+ const anchorHash = await getMeshJsonHash(anchorUrl);
+ anchor = {
+ anchorUrl: anchorUrl,
+ anchorDataHash: anchorHash,
+ };
+ }
+
// get utxo to pay for the registration
const utxos = await wallet.getUtxos();
const registrationFee = "500000000";
@@ -166,10 +175,7 @@ function Right() {
const txBuilder = getTxBuilder();
txBuilder
- .drepRegistrationCertificate(dRepId, {
- anchorUrl: anchorUrl,
- anchorDataHash: anchorHash,
- })
+ .drepRegistrationCertificate(dRepId, anchor)
.changeAddress(changeAddress)
.selectUtxosFrom(selectedUtxos);
diff --git a/apps/playground/src/pages/apis/txbuilder/governance/vote.tsx b/apps/playground/src/pages/apis/txbuilder/governance/vote.tsx
index 98603e3f..54d4bcd1 100644
--- a/apps/playground/src/pages/apis/txbuilder/governance/vote.tsx
+++ b/apps/playground/src/pages/apis/txbuilder/governance/vote.tsx
@@ -1,12 +1,16 @@
import { useWallet } from "@meshsdk/react";
-import { getProvider } from "~/components/cardano/mesh-wallet";
+// import { getProvider } from "~/components/cardano/mesh-wallet";
import Link from "~/components/link";
import LiveCodeDemo from "~/components/sections/live-code-demo";
import TwoColumnsScroll from "~/components/sections/two-columns-scroll";
import Codeblock from "~/components/text/codeblock";
import { getTxBuilder } from "../common";
+const govActionTxHash =
+ "aff2909f8175ee02a8c1bf96ff516685d25bf0c6b95aac91f4dfd53a5c0867cc";
+const govActionTxIndex = 0;
+
export default function GovernanceVote() {
return (
-
- {/* "Yes" | "No" | "Abstain" */}
+ Each vote transaction consists of the following:
+
+ - a governance action ID
+ - a role - constitutional committee member, DRep, or SPO
+ - a governance credential witness for the role
+ -
+ an optional anchor (as defined above) for information that is relevant
+ to the vote
+
+ - a 'Yes'/'No'/'Abstain' vote
+
+
+ First, we get the DRep ID from the wallet, the DRep ID voting for this
+ governance action.
+
+ Then we get the utxos and the change address from the wallet.
+
+
+ We then create the vote transaction using the vote()
{" "}
+ function.
+
+
+
+ The vote()
takes 3 parameters:
+
+
+ -
+ voter — The voter, can be a Constitutional Commitee, a DRep or a
+ StakePool
+
+ -
+ govActionId — The transaction hash and transaction id of the
+ governance action
+
+ -
+ votingProcedure — The voting kind (Yes, No, Abstain) with an optional
+ anchor
+
+
+
+ Check the{" "}
+
+ full documentation
+ {" "}
+ or the source code for more details.
+
+ Finally, we sign the transaction and submit it to the blockchain.
+
+
+
+ You can check{" "}
+
+ here
+ {" "}
+ a successful vote transaction for this{" "}
+
+ governance action
+
+ .
+
+
+ Here is another example of a vote transaction:
+
+
+
+ And another example of a vote transaction with a Plutus script and a
+ redeemer:
+
+
>
);
}
@@ -38,18 +230,8 @@ function Right() {
const { wallet, connected } = useWallet();
async function runDemo() {
- const govActionTxHash =
- "0ecc74fe26532cec1ab9a299f082afc436afc888ca2dc0fc6acda431c52dc60d";
- const govActionTxIndex = 0;
-
// const blockchainProvider = getProvider();
// const proposals = await blockchainProvider.get(`governance/proposals`);
- // console.log(1, proposals);
-
- // const votes = await blockchainProvider.get(`governance/proposals/${govActionTxHash}/${govActionTxIndex}/votes`);
- // console.log(1, votes);
-
- // return '';
const dRep = await wallet.getDRep();
@@ -81,15 +263,39 @@ function Right() {
const unsignedTx = await txBuilder.complete();
const signedTx = await wallet.signTx(unsignedTx);
- console.log(1, signedTx);
- return signedTx
- // const txHash = await wallet.submitTx(signedTx);
- // return txHash;
-
- return "";
+ const txHash = await wallet.submitTx(signedTx);
+ return txHash;
}
let codeSnippet = ``;
+ codeSnippet += `const dRep = await wallet.getDRep();\n`;
+ codeSnippet += `const dRepId = dRep.dRepIDCip105;\n`;
+ codeSnippet += `\n`;
+ codeSnippet += `const utxos = await wallet.getUtxos();\n`;
+ codeSnippet += `const changeAddress = await wallet.getChangeAddress();\n`;
+ codeSnippet += `\n`;
+ codeSnippet += `const txBuilder = getTxBuilder();\n`;
+ codeSnippet += `txBuilder\n`;
+ codeSnippet += ` .vote(\n`;
+ codeSnippet += ` {\n`;
+ codeSnippet += ` type: "DRep",\n`;
+ codeSnippet += ` drepId: dRepId,\n`;
+ codeSnippet += ` },\n`;
+ codeSnippet += ` {\n`;
+ codeSnippet += ` txHash: '${govActionTxHash}',\n`;
+ codeSnippet += ` txIndex: ${govActionTxIndex},\n`;
+ codeSnippet += ` },\n`;
+ codeSnippet += ` {\n`;
+ codeSnippet += ` voteKind: "Yes",\n`;
+ codeSnippet += ` },\n`;
+ codeSnippet += ` )\n`;
+ codeSnippet += ` .selectUtxosFrom(utxos)\n`;
+ codeSnippet += ` .changeAddress(changeAddress);\n`;
+ codeSnippet += `\n`;
+ codeSnippet += `const unsignedTx = await txBuilder.complete();\n`;
+ codeSnippet += `const signedTx = await wallet.signTx(unsignedTx);\n`;
+ codeSnippet += `const txHash = await wallet.submitTx(signedTx);\n`;
+
return (