-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from IntersectMBO/v1.1
Version 1.1
- Loading branch information
Showing
12 changed files
with
484 additions
and
266 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,6 @@ on: | |
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build-and-lint: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { Box, Typography } from "@mui/material"; | ||
|
||
interface TransactionChecksProps { | ||
isPartOfSigners: boolean; | ||
isOneVote: boolean; | ||
hasCertificates: boolean; | ||
isSameNetwork: boolean; | ||
hasICCCredentials: boolean; | ||
isInOutputPlutusData: boolean; | ||
} | ||
|
||
export const TransactionChecks = ({ | ||
isPartOfSigners, | ||
isOneVote, | ||
hasCertificates, | ||
isSameNetwork, | ||
hasICCCredentials, | ||
isInOutputPlutusData, | ||
}: TransactionChecksProps) => { | ||
return ( | ||
|
||
<Box display="flex" flexWrap="wrap" gap={2}> | ||
<Typography display="flex" flexDirection="column" width="45%" variant="body1" fontWeight="bold"> | ||
Wallet needs to sign?: {isPartOfSigners ? "✅" : "❌"} | ||
</Typography> | ||
|
||
<Typography display="flex" flexDirection="column" width="45%" variant="body1" fontWeight="bold"> | ||
Signing one vote?: {isOneVote ? "✅" : "❌"} | ||
</Typography> | ||
|
||
<Typography display="flex" flexDirection="column" width="45%" variant="body1" fontWeight="bold"> | ||
Has no certificates?: {hasCertificates ? "❌" : "✅"} | ||
</Typography> | ||
|
||
<Typography display="flex" flexDirection="column" width="45%" variant="body1" fontWeight="bold"> | ||
Is the transaction in the same network?: {isSameNetwork ? "✅" : "❌"} | ||
</Typography> | ||
|
||
<Typography display="flex" flexDirection="column" width="45%" variant="body1" fontWeight="bold"> | ||
Has Intersect CC credentials?: {hasICCCredentials ? "✅" : "❌"} | ||
</Typography> | ||
|
||
<Typography display="flex" flexDirection="column" width="45%" variant="body1" fontWeight="bold"> | ||
Is stake credential in plutus data?: {isInOutputPlutusData ? "✅" : "❌"} | ||
</Typography> | ||
</Box> | ||
|
||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import {Table, TableBody, TableCell, TableContainer, TableRow, Paper, Link } from "@mui/material"; | ||
import { openInNewTab } from "../utils/txUtils"; | ||
|
||
interface VotingDetailsProps { | ||
govActionID: string; | ||
voteChoice: string; | ||
cardanoscan: string; | ||
metadataAnchorURL: string; | ||
metadataAnchorHash: string; | ||
} | ||
|
||
export const VotingDetails = ({ | ||
govActionID, | ||
voteChoice, | ||
cardanoscan, | ||
metadataAnchorURL, | ||
metadataAnchorHash | ||
}: VotingDetailsProps) => { | ||
return ( | ||
<TableContainer sx={{ mb: 3 }}> | ||
<Table sx={{ mt: 3 }}> | ||
<TableBody> | ||
<TableRow> | ||
<TableCell sx={{ fontWeight: "bold" }}> | ||
Governance Action ID{" "} | ||
</TableCell> | ||
<TableCell > | ||
<a href={`${cardanoscan}`} target="_blank" style={{ color: 'blue', textDecoration: 'underline' }}> | ||
{govActionID} | ||
</a> | ||
</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell sx={{ fontWeight: "bold" }}> | ||
Vote Choice{" "} | ||
</TableCell> | ||
<TableCell>{voteChoice}</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell sx={{ fontWeight: "bold" }}> | ||
Metadata Anchor URL | ||
</TableCell> | ||
<TableCell> | ||
<Link | ||
onClick={() => openInNewTab(metadataAnchorURL||"")} | ||
style={{ color: "blue", textDecoration: "underline" }} | ||
> | ||
{metadataAnchorURL} | ||
</Link> | ||
</TableCell> | ||
</TableRow> | ||
<TableRow> | ||
<TableCell sx={{ fontWeight: "bold" }}> | ||
Metadata Anchor Hash | ||
</TableCell> | ||
<TableCell>{metadataAnchorHash}</TableCell> | ||
</TableRow> | ||
</TableBody> | ||
</Table> | ||
</TableContainer> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,14 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
.background-container { | ||
background-image: url('/background.png'); | ||
background-size: cover; | ||
background-position: center; | ||
min-height: 100vh; | ||
display: flex; | ||
justify-content: center; | ||
align-items: flex-start; | ||
padding: 2rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import * as CLS from "@emurgo/cardano-serialization-lib-browser"; | ||
import { deserializeAddress } from "@meshsdk/core"; | ||
import dotevn from "dotenv"; | ||
dotevn.config(); | ||
const NEXT_PUBLIC_REST_IPFS_GATEWAY=process.env.NEXT_PUBLIC_REST_IPFS_GATEWAY; | ||
|
||
/** | ||
* Decodes a transaction from a hex string to a CardanoSerializationLib Transaction object. | ||
* @param unsignedTransactionHex hex string of the unsigned transaction. | ||
* @returns {CLS.Transaction} the decoded transaction object, or null if the decoding fails. | ||
*/ | ||
|
||
export const decodeHextoTx = (unsignedTransactionHex: string) => { | ||
console.log("decodeHextoTx"); | ||
try { | ||
const unsignedTransaction = CLS.Transaction.from_hex(unsignedTransactionHex); | ||
return unsignedTransaction; | ||
} catch (error) { | ||
console.error("Error decoding transaction:", error); | ||
return null; | ||
} | ||
}; | ||
|
||
|
||
// convert basic GA ID to Bech32 as per CIP129 standard | ||
// https://github.com/cardano-foundation/CIPs/tree/master/CIP-0129 | ||
export const convertGAToBech = (gaTxHash : string, gaTxIndex : number) => { | ||
const bech32 = require('bech32-buffer'); | ||
|
||
// convert value index value to hex | ||
const indexHex = gaTxIndex.toString(16).padStart(2, '0'); | ||
|
||
// return bech32 encoded GA ID | ||
return bech32.encode("gov_action", Buffer.from(gaTxHash+indexHex, 'hex')).toString(); | ||
} | ||
|
||
/** | ||
* Get the CardanoScan URL for a given Bech32 string which can be an address or a gov id. | ||
* @param bech32 Bech32 string. | ||
* @param txNetworkID Network ID of the transaction. | ||
* @returns URL of the CardanoScan page. | ||
*/ | ||
export const getCardanoScanURL = (bech32String: string, networkID: number): string => { | ||
const baseURL = networkID === 0 ? "https://preprod.cardanoscan.io/" : "https://cardanoscan.io/"; | ||
const isAddress = bech32String.startsWith("addr"); | ||
const isGovAction = bech32String.startsWith("gov_action"); | ||
if (isAddress) { | ||
return `${baseURL}address/${bech32String}`; | ||
} else if (isGovAction) { | ||
console.log('CardanoScan URL:'+`${baseURL}govAction/${bech32String}`); | ||
return `${baseURL}govAction/${bech32String}`; | ||
} | ||
return ""; | ||
}; | ||
|
||
export const openInNewTab = (url: string) => { | ||
// Ensure the URL is absolute | ||
const fullUrl = | ||
url.startsWith("http://") || url.startsWith("https://") | ||
? url | ||
: url.startsWith("ipfs") | ||
? "https://" + NEXT_PUBLIC_REST_IPFS_GATEWAY + url?.slice(7) | ||
: "https://" + url; | ||
window.open(fullUrl, "_blank", "noopener,noreferrer"); | ||
}; |
Oops, something went wrong.