Skip to content

Commit

Permalink
Merge pull request #34 from hollow-leaf/fix/showTzHash
Browse files Browse the repository at this point in the history
fix: show tz hash
  • Loading branch information
kidneyweakx authored Aug 25, 2023
2 parents eb0b8a5 + 4bd9334 commit 4fbb9c5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/web/src/components/Contract/VoteConfirm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, { useState } from 'react'
import { vote } from "../../service/kamui/contract";
import { voteProposal } from 'tezos-interact'
import KamuiLoading from '../../components/Loading/KamuiLoading'
import Link from 'next/link'


interface VoteContent {
Expand All @@ -16,12 +17,14 @@ interface VoteContent {
const VoteProposal = ({ proposalId, action, proof, onClose }: VoteContent) => {
const [isProcess, setProcess] = useState(false)
const [isLoading, setIsLoading] = useState(false);
const [tzResultHash, setResultHash] = useState('')

const handleVote = async () => {
try {
setIsLoading(true)
await vote(proof, proposalId, action)
await voteProposal(proposalId+1, action ? 1 : 2)
const tzHash = await voteProposal(proposalId+1, action ? 1 : 2)
setResultHash(tzHash)
setIsLoading(false)
setProcess(true)
} catch (error) {
Expand All @@ -39,6 +42,7 @@ const VoteProposal = ({ proposalId, action, proof, onClose }: VoteContent) => {
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="green" className="w-24 h-24">
<path fillRule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.007 6.387a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clipRule="evenodd" />
</svg>
<Link href={`https://better-call.dev/ghostnet/opg/${tzResultHash}`}>{tzResultHash}</Link>
</div>
<div className="btn" onClick={onClose} >OK</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/ZK/GenerateProof.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import React, { useState } from 'react';
import { formatAddress } from 'helper'
import { formatAddress, sleep } from 'helper'
import { zkproof, getModelWeight } from '../../service/kamui/verify'
import ProcessLoading from '../../components/Loading/ProcessLoading'

Expand Down Expand Up @@ -55,6 +55,7 @@ const GenerateProof = ({ imgSrc, handleCopyClick, setProof, onClose }: GenerateP
setLoadingText(`Downloading model weight`)
setLoadingSecondaryText(ipfsKey)
const modelWeight = await getModelWeight(ipfsKey)
await sleep (2000)
setLoadingSecondaryText(null)
setLoadingText(`Generating Proof`)
const result = await zkproof(grayScaleBuffer, modelWeight)
Expand Down

0 comments on commit 4fbb9c5

Please sign in to comment.