diff --git a/.github/workflows/contracts-testing.yml b/.github/workflows/contracts-testing.yml index bdf30660a..2a8c224a5 100644 --- a/.github/workflows/contracts-testing.yml +++ b/.github/workflows/contracts-testing.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index f490a5c96..cdb65e5b6 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -12,7 +12,7 @@ jobs: if: ${{ github.actor == 'dependabot[bot]' }} steps: - name: Harden Runner - uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 with: disable-sudo: true egress-policy: block diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 5cd106d49..1a666f5bb 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -24,6 +24,8 @@ jobs: allowed-endpoints: > api.github.com:443 github.com:443 + pipelinesghubeus2.actions.githubusercontent.com:443 + acghubeus1.actions.githubusercontent.com:443 - name: 'Checkout Repository' uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 diff --git a/.github/workflows/deploy-bots.yml b/.github/workflows/deploy-bots.yml index 8a17c3704..8d8da880c 100644 --- a/.github/workflows/deploy-bots.yml +++ b/.github/workflows/deploy-bots.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Harden Runner - uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 with: egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs diff --git a/.github/workflows/deploy-subgraph.yml b/.github/workflows/deploy-subgraph.yml index 41eba9a17..09d5c986a 100644 --- a/.github/workflows/deploy-subgraph.yml +++ b/.github/workflows/deploy-subgraph.yml @@ -26,7 +26,7 @@ jobs: environment: kleros-org-subgraph steps: - name: Harden Runner - uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 with: egress-policy: audit diff --git a/.github/workflows/scorecards.yml b/.github/workflows/scorecards.yml index 11d634118..0d7875366 100644 --- a/.github/workflows/scorecards.yml +++ b/.github/workflows/scorecards.yml @@ -32,7 +32,7 @@ jobs: steps: - name: Harden Runner - uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 with: disable-sudo: true egress-policy: block @@ -86,6 +86,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@489225d82a57396c6f426a40e66d461b16b3461d # v2.20.4 + uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3 with: sarif_file: results.sarif diff --git a/.github/workflows/sentry-release.yml b/.github/workflows/sentry-release.yml index 42db411cb..624dd9e81 100644 --- a/.github/workflows/sentry-release.yml +++ b/.github/workflows/sentry-release.yml @@ -17,7 +17,7 @@ jobs: version: ${{ steps.set-version.outputs.version }} steps: - name: Harden Runner - uses: step-security/harden-runner@55d479fb1c5bcad5a4f9099a5d9f37c8857b2845 # v2.4.1 + uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # v2.5.0 with: disable-sudo: true egress-policy: block diff --git a/bot-pinner/package.json b/bot-pinner/package.json index 6c7dc5d86..c006fd899 100644 --- a/bot-pinner/package.json +++ b/bot-pinner/package.json @@ -6,7 +6,7 @@ "license": "MIT", "packageManager": "yarn@3.3.1", "volta": { - "node": "16.13.0" + "node": "16.20.1" }, "scripts": { "build:local": "docker compose build", diff --git a/contracts/deploy/03-vea-mock.ts b/contracts/deploy/03-vea-mock.ts index 908eecadb..1b1309196 100644 --- a/contracts/deploy/03-vea-mock.ts +++ b/contracts/deploy/03-vea-mock.ts @@ -18,7 +18,6 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) console.log("Deploying to chainId %s with deployer %s", HARDHAT_NETWORK, deployer); const klerosCore = await deployments.get("KlerosCore"); - const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry"); const vea = await deploy("VeaMock", { from: deployer, @@ -62,6 +61,12 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) await execute("ForeignGatewayOnEthereum", { from: deployer, log: true }, "changeCourtJurorFee", courtId, fee); // TODO: set up the correct fees for the lower courts + const disputeTemplateRegistry = await deploy("DisputeTemplateRegistry", { + from: deployer, + args: [], + log: true, + }); + // TODO: debug why this extraData fails but "0x00" works // const extraData = // "0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003"; // General court, 3 jurors diff --git a/contracts/package.json b/contracts/package.json index 0d6016a53..95268cf0d 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -11,7 +11,7 @@ "node": ">=16.0.0" }, "volta": { - "node": "16.18.1", + "node": "16.20.1", "yarn": "3.3.1" }, "scripts": { diff --git a/package.json b/package.json index 522409951..3035a4f53 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ ], "packageManager": "yarn@3.3.1", "volta": { - "node": "16.18.1", + "node": "16.20.1", "yarn": "3.3.1" }, "devDependencies": { diff --git a/services/graph-node/docker-compose.yml b/services/graph-node/docker-compose.yml index aa97ea449..7833b0780 100644 --- a/services/graph-node/docker-compose.yml +++ b/services/graph-node/docker-compose.yml @@ -25,7 +25,7 @@ services: GRAPH_LOG: info stop_grace_period: 5s ipfs: - image: ipfs/go-ipfs:v0.10.0 + image: ipfs/go-ipfs:v0.22.0 ports: - "5001:5001" volumes: diff --git a/subgraph/package.json b/subgraph/package.json index f7cf2416e..3f5b8a1da 100644 --- a/subgraph/package.json +++ b/subgraph/package.json @@ -16,14 +16,14 @@ "stop-local-indexer": "docker compose -f ../services/graph-node/docker-compose.yml down && rm -rf ../services/graph-node/data" }, "volta": { - "node": "16.18.1", + "node": "16.20.1", "yarn": "3.3.1" }, "dependencies": { "@graphprotocol/graph-ts": "^0.31.0" }, "devDependencies": { - "@graphprotocol/graph-cli": "^0.51.2", + "@graphprotocol/graph-cli": "^0.54.0", "@kleros/kleros-v2-eslint-config": "workspace:^", "@kleros/kleros-v2-prettier-config": "workspace:^", "gluegun": "^5.1.2" diff --git a/web/package.json b/web/package.json index 0825483ff..b5fc55b60 100644 --- a/web/package.json +++ b/web/package.json @@ -41,8 +41,8 @@ "@kleros/kleros-v2-prettier-config": "workspace:^", "@kleros/kleros-v2-tsconfig": "workspace:^", "@netlify/functions": "^1.6.0", - "@parcel/transformer-svg-react": "~2.8.0", - "@parcel/watcher": "~2.1.0", + "@parcel/transformer-svg-react": "~2.9.0", + "@parcel/watcher": "~2.2.0", "@types/amqplib": "^0.10.1", "@types/busboy": "^1.5.0", "@types/react": "^18.2.14", @@ -61,7 +61,7 @@ "typescript": "^4.9.5" }, "dependencies": { - "@filebase/client": "^0.0.4", + "@filebase/client": "^0.0.5", "@kleros/kleros-v2-contracts": "workspace:^", "@kleros/ui-components-library": "^2.6.1", "@sentry/react": "^7.55.2", @@ -76,9 +76,9 @@ "core-js": "^3.31.0", "ethers": "^5.7.2", "graphql": "^16.7.1", - "graphql-request": "~5.1.0", + "graphql-request": "~6.1.0", "moment": "^2.29.4", - "parcel": "~2.8.0", + "parcel": "~2.9.0", "react": "^18.2.0", "react-chartjs-2": "^4.3.1", "react-dom": "^18.2.0", @@ -97,7 +97,7 @@ "wagmi": "^1.1.0" }, "volta": { - "node": "16.18.1", + "node": "16.20.1", "yarn": "3.3.1" } } diff --git a/web/src/components/Popup/Description/VoteWithCommit.tsx b/web/src/components/Popup/Description/VoteWithCommit.tsx index 789840385..98f7dfacc 100644 --- a/web/src/components/Popup/Description/VoteWithCommit.tsx +++ b/web/src/components/Popup/Description/VoteWithCommit.tsx @@ -1,26 +1,5 @@ import React from "react"; -import styled from "styled-components"; - -const Container = styled.div` - display: flex; - flex-direction: column; -`; - -const StyledDescription = styled.div` - margin-bottom: calc(16px + (32 - 16) * ((100vw - 300px) / (1250 - 300))); - margin-left: calc(8px + (32 - 8) * ((100vw - 300px) / (1250 - 300))); - margin-right: calc(8px + (32 - 8) * ((100vw - 300px) / (1250 - 300))); - color: ${({ theme }) => theme.secondaryText}; - text-align: center; - line-height: 21.8px; -`; - -const EmphasizedDate = styled.span` - font-size: 16px; - font-weight: 400; - line-height: 21.8px; - color: ${({ theme }) => theme.primaryText}; -`; +import VoteDescriptionEmphasizedDate from "components/Popup"; interface IVoteWithCommit { date: string; @@ -28,12 +7,12 @@ interface IVoteWithCommit { const VoteWithCommit: React.FC = ({ date }) => { return ( - - - Your vote is confirmed. It's kept secret until all jurors have cast their votes. - You'll need to justify and reveal your vote on {date} - - + <> + Your vote is confirmed. It's kept secret until all jurors have cast their votes. + + You'll need to justify and reveal your vote on {date} + + ); }; export default VoteWithCommit; diff --git a/web/src/components/Popup/Description/VoteWithoutCommit.tsx b/web/src/components/Popup/Description/VoteWithoutCommit.tsx index a5b445130..30ea81bd7 100644 --- a/web/src/components/Popup/Description/VoteWithoutCommit.tsx +++ b/web/src/components/Popup/Description/VoteWithoutCommit.tsx @@ -1,26 +1,5 @@ import React from "react"; -import styled from "styled-components"; - -const Container = styled.div` - display: flex; - flex-direction: column; -`; - -const StyledDescription = styled.div` - margin-bottom: calc(16px + (32 - 16) * ((100vw - 300px) / (1250 - 300))); - margin-left: calc(8px + (32 - 8) * ((100vw - 300px) / (1250 - 300))); - margin-right: calc(8px + (32 - 8) * ((100vw - 300px) / (1250 - 300))); - color: ${({ theme }) => theme.secondaryText}; - text-align: center; - line-height: 21.8px; -`; - -const EmphasizedDate = styled.span` - font-size: 16px; - font-weight: 400; - line-height: 21.8px; - color: ${({ theme }) => theme.primaryText}; -`; +import VoteDescriptionEmphasizedDate from "components/Popup"; interface IVoteWithoutCommit { date: string; @@ -28,12 +7,10 @@ interface IVoteWithoutCommit { const VoteWithoutCommit: React.FC = ({ date }) => { return ( - - - The decision date is {date} with the possibility for appeals. After that time - you will be informed about the jury decision. - - + <> + The decision date is {date} with the possibility + for appeals. After that time you will be informed about the jury decision. + ); }; export default VoteWithoutCommit; diff --git a/web/src/components/Popup/index.tsx b/web/src/components/Popup/index.tsx index f9433f1a2..313f5db1b 100644 --- a/web/src/components/Popup/index.tsx +++ b/web/src/components/Popup/index.tsx @@ -52,28 +52,31 @@ type PopupProps = IStakeWithdraw | IVoteWithoutCommit | IVoteWithCommit | IAppea const Header = styled.h1` display: flex; - margin-top: calc(12px + (32 - 12) * ((100vw - 300px) / (1250 - 300))); - margin-bottom: calc(12px + (24 - 12) * ((100vw - 300px) / (1250 - 300))); + margin-top: calc(12px + (32 - 12) * ((100vw - 375px) / (1250 - 375))); + margin-bottom: calc(12px + (24 - 12) * ((100vw - 375px) / (1250 - 375))); + margin-left: calc(8px + (12 - 8) * ((100vw - 375px) / (1250 - 375))); + margin-right: calc(8px + (12 - 8) * ((100vw - 375px) / (1250 - 375))); + text-align: center; font-size: 24px; font-weight: 600; line-height: 32.68px; `; const IconContainer = styled.div` - width: calc(150px + (350 - 150) * (100vw - 375px) / (1250 - 375)); + width: calc(150px + (228 - 150) * (100vw - 375px) / (1250 - 375)); display: flex; align-items: center; justify-content: center; svg { display: inline-block; - width: calc(150px + (350 - 150) * (100vw - 375px) / (1250 - 375)); - height: calc(150px + (350 - 150) * (100vw - 375px) / (1250 - 375)); + width: calc(150px + (228 - 150) * (100vw - 375px) / (1250 - 375)); + height: calc(150px + (228 - 150) * (100vw - 375px) / (1250 - 375)); } `; const StyledButton = styled(Button)` - margin: calc(16px + (32 - 16) * ((100vw - 300px) / (1250 - 300))); + margin: calc(16px + (32 - 16) * ((100vw - 375px) / (1250 - 375))); `; const Container = styled.div` @@ -99,6 +102,24 @@ const Container = styled.div` } `; +const VoteDescriptionContainer = styled.div` + display: flex; + flex-direction: column; + margin-bottom: calc(16px + (32 - 16) * ((100vw - 375px) / (1250 - 375))); + margin-left: calc(8px + (32 - 8) * ((100vw - 375px) / (1250 - 375))); + margin-right: calc(8px + (32 - 8) * ((100vw - 375px) / (1250 - 375))); + color: ${({ theme }) => theme.secondaryText}; + text-align: center; + line-height: 21.8px; +`; + +export const VoteDescriptionEmphasizedDate = styled.span` + font-size: 16px; + font-weight: 400; + line-height: 21.8px; + color: ${({ theme }) => theme.primaryText}; +`; + const Popup: React.FC = ({ title, icon: Icon, @@ -128,12 +149,20 @@ const Popup: React.FC = ({ } case PopupType.VOTE_WITHOUT_COMMIT: { const { date } = props as IVoteWithoutCommit; - PopupComponent = ; + PopupComponent = ( + + + + ); break; } case PopupType.VOTE_WITH_COMMIT: { const { date } = props as IVoteWithCommit; - PopupComponent = ; + PopupComponent = ( + + + + ); break; } case PopupType.APPEAL: { diff --git a/web/src/components/Verdict/DisputeTimeline.tsx b/web/src/components/Verdict/DisputeTimeline.tsx index d53b88520..193164cd3 100644 --- a/web/src/components/Verdict/DisputeTimeline.tsx +++ b/web/src/components/Verdict/DisputeTimeline.tsx @@ -4,6 +4,7 @@ import styled, { useTheme } from "styled-components"; import { _TimelineItem1, CustomTimeline } from "@kleros/ui-components-library"; import { Periods } from "consts/periods"; import { ClassicRound } from "src/graphql/graphql"; +import { getVoteChoice } from "pages/Cases/CaseDetails/Voting/VotingHistory"; import { DisputeDetailsQuery, useDisputeDetailsQuery } from "queries/useDisputeDetailsQuery"; import { useDisputeTemplate } from "queries/useDisputeTemplate"; import { useVotingHistory } from "queries/useVotingHistory"; @@ -78,13 +79,13 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string return localRounds?.reduce( (acc, { winningChoice }, index) => { const parsedRoundChoice = parseInt(winningChoice); + const eventDate = getCaseEventTimes(lastPeriodChange, currentPeriodIndex, courtTimePeriods, false); const icon = dispute.ruled && !rulingOverride && index === localRounds.length - 1 ? ClosedCaseIcon : ""; - + const answers = disputeTemplate?.answers; acc.push({ title: `Jury Decision - Round ${index + 1}`, - party: - parsedRoundChoice !== 0 ? disputeTemplate?.answers?.[parsedRoundChoice - 1].title : "Refuse to Arbitrate", + party: getVoteChoice(parsedRoundChoice, answers), subtitle: eventDate, rightSided: true, variant: theme.secondaryPurple, @@ -102,10 +103,7 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string } else if (rulingOverride && parsedDisputeFinalRuling !== parsedRoundChoice) { acc.push({ title: "Won by Appeal", - party: - parsedDisputeFinalRuling !== 0 - ? disputeTemplate?.answers?.[parsedDisputeFinalRuling - 1].title - : "Refuse to Arbitrate", + party: getVoteChoice(parsedDisputeFinalRuling, answers), subtitle: eventDate, rightSided: true, Icon: ClosedCaseIcon, diff --git a/web/src/components/Verdict/FinalDecision.tsx b/web/src/components/Verdict/FinalDecision.tsx index 39a4bcb27..fc6f56550 100644 --- a/web/src/components/Verdict/FinalDecision.tsx +++ b/web/src/components/Verdict/FinalDecision.tsx @@ -101,7 +101,7 @@ const FinalDecision: React.FC = ({ arbitrable }) => { {answer.description} ) : ( -

Refuse to Arbitrate

+ <>{currentRuling !== 0 ?

Answer 0x{currentRuling}

:

Refuse to Arbitrate

} )} diff --git a/web/src/consts/index.ts b/web/src/consts/index.ts index 8e23a4fcd..e07bbb9b0 100644 --- a/web/src/consts/index.ts +++ b/web/src/consts/index.ts @@ -2,3 +2,4 @@ export const ONE_BASIS_POINT = 10000n; export const KLEROS_CONTRACT_ADDRESS = "ethereum:0x93ed3fbe21207ec2e8f2d3c3de6e058cb73bc04d"; export const WETH_CONTRACT_ADDRESS = "ethereum:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"; +export const PNK_FAUCET_CONTRACT_ADDRESS = "0x120C48fcB2343ccCD4Fa4Dc81CF48fcf8538bFc9"; diff --git a/web/src/context/Web3Provider.tsx b/web/src/context/Web3Provider.tsx index bf3596cd3..d83567cb6 100644 --- a/web/src/context/Web3Provider.tsx +++ b/web/src/context/Web3Provider.tsx @@ -42,8 +42,7 @@ const Web3Provider: React.FC<{ children: React.ReactNode }> = ({ children }) => "--w3m-background-color": theme.primaryPurple, "--w3m-overlay-background-color": "rgba(0, 0, 0, 0.6)", "--w3m-overlay-backdrop-filter": "blur(3px)", - "--w3m-logo-image-url": - "https://github.com/kleros/kleros-v2/blob/feat(web)/wallet-connect-themes/docs/kleros-logo-white.png?raw=true", + "--w3m-logo-image-url": "https://github.com/kleros/kleros-v2/blob/dev/docs/kleros-logo-white.png?raw=true", "--w3m-color-bg-1": theme.lightBackground, }} {...{ projectId, ethereumClient }} diff --git a/web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx b/web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx index 12ab41015..9c522b952 100644 --- a/web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx +++ b/web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx @@ -84,12 +84,13 @@ const Fund: React.FC = ({ amount, setAmount, setIsOpen }) => { onClick={() => { if (fundAppeal) { setIsSending(true); - wrapWithToast(async () => await fundAppeal().then((response) => response.hash), publicClient).finally( - () => { - setIsSending(false); + wrapWithToast(async () => await fundAppeal().then((response) => response.hash), publicClient) + .then(() => { setIsOpen(true); - } - ); + }) + .finally(() => { + setIsSending(false); + }); } }} /> diff --git a/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx b/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx index 3fc351993..86ff554e0 100644 --- a/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx +++ b/web/src/pages/Cases/CaseDetails/Voting/VotingHistory.tsx @@ -8,6 +8,7 @@ import BalanceIcon from "svgs/icons/law-balance.svg"; import { useVotingHistory } from "queries/useVotingHistory"; import { useDisputeTemplate } from "queries/useDisputeTemplate"; import { shortenAddress } from "utils/shortenAddress"; +import { isUndefined } from "utils/index"; const Container = styled.div``; @@ -86,19 +87,36 @@ const JustificationContainer = styled.div` } `; -const VotingHistory: React.FC<{ arbitrable?: `0x${string}` }> = ({ arbitrable }) => { +export const getVoteChoice = (vote, answers) => { + const selectedAnswer = answers?.[vote - 1]?.title; + if (vote === 0) { + return "Refuse to arbitrate"; + } else if (!isUndefined(selectedAnswer)) { + return selectedAnswer; + } else { + return `Answer 0x${vote}`; + } +}; + +const VotingHistory: React.FC<{ arbitrable?: `0x${string}`; isQuestion: boolean }> = ({ arbitrable, isQuestion }) => { const { id } = useParams(); const { data: votingHistory } = useVotingHistory(id); const [currentTab, setCurrentTab] = useState(0); const { data: disputeTemplate } = useDisputeTemplate(id, arbitrable); const rounds = votingHistory?.dispute?.rounds; const localRounds = votingHistory?.dispute?.disputeKitDispute?.localRounds; + const answers = disputeTemplate?.answers; + return (

Voting History

{rounds && localRounds && disputeTemplate && ( <> - {disputeTemplate.question} + {isQuestion && disputeTemplate.question ? ( + {disputeTemplate.question} + ) : ( + The dispute's template is not correct please vote refuse to arbitrate + )} ({ @@ -124,7 +142,7 @@ const VotingHistory: React.FC<{ arbitrable?: `0x${string}` }> = ({ arbitrable }) icon: , body: ( ), diff --git a/web/src/pages/Cases/CaseDetails/Voting/index.tsx b/web/src/pages/Cases/CaseDetails/Voting/index.tsx index d9c8ada77..92c86a263 100644 --- a/web/src/pages/Cases/CaseDetails/Voting/index.tsx +++ b/web/src/pages/Cases/CaseDetails/Voting/index.tsx @@ -49,7 +49,7 @@ const Voting: React.FC<{ 0 && !voted ? ( - draw.voteID)} /> + <> + + draw.voteID)} /> + ) : ( - + )} ); diff --git a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx index 962c44184..7b5c85187 100644 --- a/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx +++ b/web/src/pages/Courts/CourtDetails/StakePanel/StakeWithdrawButton.tsx @@ -34,7 +34,6 @@ interface IActionButton { const StakeWithdrawButton: React.FC = ({ parsedAmount, action, - setAmount, isSending, setIsSending, setIsPopupOpen, @@ -92,17 +91,18 @@ const StakeWithdrawButton: React.FC = ({ }; const { config: setStakeConfig } = usePrepareKlerosCoreSetStake({ - enabled: !isUndefined(targetStake) && !isUndefined(id), + enabled: !isUndefined(targetStake) && !isUndefined(id) && isStaking && !isAllowance, args: [BigInt(id ?? 0), targetStake], }); const { writeAsync: setStake } = useKlerosCoreSetStake(setStakeConfig); const handleStake = () => { if (typeof setStake !== "undefined") { setIsSending(true); - wrapWithToast(async () => await setStake().then((response) => response.hash), publicClient).finally(() => { - setIsSending(false); - setIsPopupOpen(true); - }); + wrapWithToast(async () => await setStake().then((response) => response.hash), publicClient) + .then(() => setIsPopupOpen(true)) + .finally(() => { + setIsSending(false); + }); } }; @@ -130,7 +130,13 @@ const StakeWithdrawButton: React.FC = ({