From 12ed8dbc8767a9249e5ac423e4722c15a3035fb5 Mon Sep 17 00:00:00 2001 From: Niraj Date: Mon, 2 Dec 2024 17:55:44 +0545 Subject: [PATCH 01/28] chore: Update docs URLs to reflect recent changes in the docs --- .../playwright/lib/constants/docsUrl.ts | 18 +++++++++--------- .../playwright/lib/constants/environments.ts | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts b/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts index b71d3b382..88953c3fa 100644 --- a/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts +++ b/tests/govtool-frontend/playwright/lib/constants/docsUrl.ts @@ -1,15 +1,15 @@ import environments from "./environments"; -export const DELEGATION_DOC_URL = `${environments.docsUrl}/about/what-is-cardano-govtool/govtool-functions/delegating`; -export const REGISTER_DREP_DOC_URL = `${environments.docsUrl}/using-govtool/govtool-functions/dreps/register-as-a-drep`; -export const DIRECT_VOTER_DOC_URL = `${environments.docsUrl}/using-govtool/govtool-functions/direct-voting`; -export const GOVERNANCE_ACTION_DOC_URL = `${environments.docsUrl}/using-govtool/govtool-functions/governance-actions/view-governance-actions`; -export const PROPOSE_GOVERNANCE_ACTION_DOC_URL = `${environments.docsUrl}/using-govtool/govtool-functions/governance-actions/propose-a-governance-action`; -export const ABSTAIN_VOTE_DOC_URL = `${environments.docsUrl}/using-govtool/govtool-functions/delegating/abstain-from-every-vote`; -export const SIGNAL_NO_CONFIDENCE_VOTE_DOC_URL = `${environments.docsUrl}/using-govtool/govtool-functions/delegating/signal-no-confidence-on-every-vote`; +export const DELEGATION_DOC_URL = `${environments.docsUrl}/using-govtool/delegating`; +export const REGISTER_DREP_DOC_URL = `${environments.docsUrl}/using-govtool/dreps/register-as-a-drep`; +export const DIRECT_VOTER_DOC_URL = `${environments.docsUrl}/using-govtool/direct-voting`; +export const GOVERNANCE_ACTION_DOC_URL = `${environments.docsUrl}/using-govtool/governance-actions/view-governance-actions`; +export const PROPOSE_GOVERNANCE_ACTION_DOC_URL = `${environments.docsUrl}/using-govtool/governance-actions/propose-a-governance-action`; +export const ABSTAIN_VOTE_DOC_URL = `${environments.docsUrl}/using-govtool/delegating/abstain-from-every-vote`; +export const SIGNAL_NO_CONFIDENCE_VOTE_DOC_URL = `${environments.docsUrl}/using-govtool/delegating/signal-no-confidence-on-every-vote`; export const FAQS_DOC_URL = `${environments.docsUrl}/faqs`; -export const GUIDES_DOC_URL = `${environments.docsUrl}`; +export const GUIDES_DOC_URL = `${environments.docsUrl}/using-govtool`; export const PRIVACY_POLICY = `https://docs.intersectmbo.org/legal/policies-and-conditions/privacy-policy`; export const TERMS_AND_CONDITIONS = `https://docs.intersectmbo.org/legal/policies-and-conditions/terms-of-use`; export const HELP_DOC_URL = `${environments.docsUrl}/support`; -export const BOOTSTRAP_DOC_URL = `${environments.docsUrl}/about/bootstrapping-phase`; +export const BOOTSTRAP_DOC_URL = `${environments.docsUrl}/faqs/bootstrapping-phase`; diff --git a/tests/govtool-frontend/playwright/lib/constants/environments.ts b/tests/govtool-frontend/playwright/lib/constants/environments.ts index 2982b74fa..8cf2f292e 100644 --- a/tests/govtool-frontend/playwright/lib/constants/environments.ts +++ b/tests/govtool-frontend/playwright/lib/constants/environments.ts @@ -10,7 +10,7 @@ const NETWORK = process.env.NETWORK || "preview"; const environments = { frontendUrl: SERVER_HOST_URL, apiUrl: `${SERVER_HOST_URL}/api`, - docsUrl: process.env.DOCS_URL || "https://docs.gov.tools", + docsUrl: process.env.DOCS_URL || "https://docs.gov.tools/cardano-govtool", pdfUrl: process.env.PDF_URL || "https://dev.api.pdf.gov.tools", networkId: parseInt(process.env.NETWORK_ID) || 0, faucet: { From 655ef8ac9fb4b593c1debcca80d33b76c07087f8 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 3 Dec 2024 13:44:06 +0545 Subject: [PATCH 02/28] feat: add blockfrost service to submit transaction --- .../govtool-frontend/playwright/.env.example | 3 ++ .../playwright/lib/constants/environments.ts | 2 + .../lib/services/blockfrostService.ts | 41 +++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 tests/govtool-frontend/playwright/lib/services/blockfrostService.ts diff --git a/tests/govtool-frontend/playwright/.env.example b/tests/govtool-frontend/playwright/.env.example index 719692bbc..8704197ef 100644 --- a/tests/govtool-frontend/playwright/.env.example +++ b/tests/govtool-frontend/playwright/.env.example @@ -13,6 +13,9 @@ NETWORK_ID=0 FAUCET_API_URL=https://faucet.sanchonet.world.dev.cardano.org FAUCET_API_KEY= +#Blockfrost +BLOCKFROST_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXX + # Kuber KUBER_API_URL=https://sanchonet.kuber.cardanoapi.io KUBER_API_KEY= diff --git a/tests/govtool-frontend/playwright/lib/constants/environments.ts b/tests/govtool-frontend/playwright/lib/constants/environments.ts index 2982b74fa..e4af4ec1e 100644 --- a/tests/govtool-frontend/playwright/lib/constants/environments.ts +++ b/tests/govtool-frontend/playwright/lib/constants/environments.ts @@ -9,6 +9,7 @@ const NETWORK = process.env.NETWORK || "preview"; const environments = { frontendUrl: SERVER_HOST_URL, + blockfrostApiKey: process.env.BLOCKFROST_API_KEY, apiUrl: `${SERVER_HOST_URL}/api`, docsUrl: process.env.DOCS_URL || "https://docs.gov.tools", pdfUrl: process.env.PDF_URL || "https://dev.api.pdf.gov.tools", @@ -35,6 +36,7 @@ const environments = { metadataBucketUrl: `${CARDANO_API_METADATA_HOST_URL}/data`, lockInterceptorUrl: `${CARDANO_API_METADATA_HOST_URL}/lock`, ci: process.env.CI, + network: NETWORK, proposalFaucet: { payment: { private: process.env.PROPOSAL_FAUCET_PAYMENT_PRIVATE, diff --git a/tests/govtool-frontend/playwright/lib/services/blockfrostService.ts b/tests/govtool-frontend/playwright/lib/services/blockfrostService.ts new file mode 100644 index 000000000..0e53438cb --- /dev/null +++ b/tests/govtool-frontend/playwright/lib/services/blockfrostService.ts @@ -0,0 +1,41 @@ +import environments from "@constants/environments"; + +const blockfrostApiUrl = + "https://cardano-" + environments.network + ".blockfrost.io/api"; +const blockfrostApiKey = environments.blockfrostApiKey; + +export async function blockfrostSubmitTransaction(cborSignedTx: Buffer) { + const url = `${blockfrostApiUrl}/v0/tx/submit`; + const res = await fetch(url, { + method: "POST", + headers: { + "Content-Type": "application/cbor", + project_id: blockfrostApiKey, + }, + body: cborSignedTx, + }); + if (res.status === 200) { + return res.json(); + } else { + return res.text().then((txt) => { + let err; + let json: any; + try { + json = JSON.parse(txt); + if (json) { + err = Error( + `BlockFrost [Status ${res.status}] : ${ + json.message ? json.message : txt + }` + ); + } else { + err = Error(`BlockFrost [Status ${res.status}] : ${txt}`); + } + } catch (e) { + err = Error(`BlockFrost [Status ${res.status}] : ${txt}`); + } + err.status = res.status; + throw err; + }); + } +} From c6ec51caa521bae37d3d0ac2b4b4c2ad8b350307 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 3 Dec 2024 13:46:14 +0545 Subject: [PATCH 03/28] chore: sign transaction with Kuber and submit via Blockfrost --- .../playwright/lib/services/kuberService.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/services/kuberService.ts b/tests/govtool-frontend/playwright/lib/services/kuberService.ts index 154b885e1..8de48ce41 100644 --- a/tests/govtool-frontend/playwright/lib/services/kuberService.ts +++ b/tests/govtool-frontend/playwright/lib/services/kuberService.ts @@ -6,11 +6,12 @@ import { WalletAndAnchorType, } from "@types"; import * as blake from "blakejs"; -import environments from "lib/constants/environments"; +import environments from "@constants/environments"; import { LockInterceptor, LockInterceptorInfo } from "lib/lockInterceptor"; import fetch, { BodyInit, RequestInit } from "node-fetch"; -import { cborxDecoder, cborxEncoder } from "../helpers/encodeDecode"; +import { cborxEncoder } from "@helpers/encodeDecode"; import { Logger } from "@helpers/logger"; +import { blockfrostSubmitTransaction } from "@services/blockfrostService"; type CertificateType = "registerstake" | "registerdrep" | "deregisterdrep"; @@ -99,20 +100,17 @@ class Kuber { `Submitting tx: ${JSON.stringify({ lock_id: lockId, tx: signedTx })}` ); - const res = (await callKuber( - `/api/${this.version}/tx?submit=true`, + const response = (await callKuber( + `/api/${this.version}/tx?submit=false`, "POST", JSON.stringify(signedTx) )) as any; - let decodedTx = cborxDecoder.decode(Buffer.from(res.cborHex, "hex")); - const submittedTxBody = Uint8Array.from(cborxEncoder.encode(decodedTx[0])); - const submittedTxHash = Buffer.from( - blake.blake2b(submittedTxBody, undefined, 32) - ).toString("hex"); + const cborSignedTx = Buffer.from(response.cborHex, "hex"); + const submittedTxHash = await blockfrostSubmitTransaction(cborSignedTx); Logger.success(`Tx submitted: ${submittedTxHash}`); return { - cbor: res.cborHex, + cbor: response.cborHex, txId: submittedTxHash, }; } From aa8e27f81a3bed25612291a031e42981f5a108b5 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 3 Dec 2024 13:48:02 +0545 Subject: [PATCH 04/28] chore: add blockfrost api key on workflow env --- .github/workflows/test_integration_playwright.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_integration_playwright.yml b/.github/workflows/test_integration_playwright.yml index e6a3ff358..75175dce3 100644 --- a/.github/workflows/test_integration_playwright.yml +++ b/.github/workflows/test_integration_playwright.yml @@ -85,6 +85,7 @@ jobs: CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}} PROPOSAL_FAUCET_PAYMENT_PRIVATE: ${{secrets.PROPOSAL_FAUCET_PAYMENT_PRIVATE}} PROPOSAL_FAUCET_STAKE_PRIVATE: ${{secrets.PROPOSAL_FAUCET_STAKE_PRIVATE}} + BLOCKFROST_API_KEY: ${{secrets.BLOCKFROST_API_KEY}} publish-report: runs-on: ubuntu-latest From 7bed9e4d54be66d08c752b320d9c6d3fbeeac227 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 3 Dec 2024 15:18:29 +0545 Subject: [PATCH 05/28] chore: use blockfrost apiUrl from env --- .../playwright/lib/constants/environments.ts | 2 +- .../playwright/lib/services/blockfrostService.ts | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/constants/environments.ts b/tests/govtool-frontend/playwright/lib/constants/environments.ts index e4af4ec1e..2c89cce5a 100644 --- a/tests/govtool-frontend/playwright/lib/constants/environments.ts +++ b/tests/govtool-frontend/playwright/lib/constants/environments.ts @@ -10,6 +10,7 @@ const NETWORK = process.env.NETWORK || "preview"; const environments = { frontendUrl: SERVER_HOST_URL, blockfrostApiKey: process.env.BLOCKFROST_API_KEY, + blockfrostApiUrl: "https://cardano-" + NETWORK + ".blockfrost.io/api", apiUrl: `${SERVER_HOST_URL}/api`, docsUrl: process.env.DOCS_URL || "https://docs.gov.tools", pdfUrl: process.env.PDF_URL || "https://dev.api.pdf.gov.tools", @@ -36,7 +37,6 @@ const environments = { metadataBucketUrl: `${CARDANO_API_METADATA_HOST_URL}/data`, lockInterceptorUrl: `${CARDANO_API_METADATA_HOST_URL}/lock`, ci: process.env.CI, - network: NETWORK, proposalFaucet: { payment: { private: process.env.PROPOSAL_FAUCET_PAYMENT_PRIVATE, diff --git a/tests/govtool-frontend/playwright/lib/services/blockfrostService.ts b/tests/govtool-frontend/playwright/lib/services/blockfrostService.ts index 0e53438cb..8e652d13f 100644 --- a/tests/govtool-frontend/playwright/lib/services/blockfrostService.ts +++ b/tests/govtool-frontend/playwright/lib/services/blockfrostService.ts @@ -1,16 +1,12 @@ import environments from "@constants/environments"; -const blockfrostApiUrl = - "https://cardano-" + environments.network + ".blockfrost.io/api"; -const blockfrostApiKey = environments.blockfrostApiKey; - export async function blockfrostSubmitTransaction(cborSignedTx: Buffer) { - const url = `${blockfrostApiUrl}/v0/tx/submit`; + const url = `${environments.blockfrostApiUrl}/v0/tx/submit`; const res = await fetch(url, { method: "POST", headers: { "Content-Type": "application/cbor", - project_id: blockfrostApiKey, + project_id: environments.blockfrostApiKey, }, body: cborSignedTx, }); From 856651aa7cf560f9b21d3a2747468198efdd9797 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 3 Dec 2024 16:21:57 +0545 Subject: [PATCH 06/28] chore: bump cardano-test-wallet version to 3.0.0 --- tests/govtool-frontend/playwright/package-lock.json | 8 ++++---- tests/govtool-frontend/playwright/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/govtool-frontend/playwright/package-lock.json b/tests/govtool-frontend/playwright/package-lock.json index 51252ad2e..74d2b854d 100644 --- a/tests/govtool-frontend/playwright/package-lock.json +++ b/tests/govtool-frontend/playwright/package-lock.json @@ -9,7 +9,7 @@ "version": "1.0.0", "license": "MIT", "dependencies": { - "@cardanoapi/cardano-test-wallet": "^2.1.1", + "@cardanoapi/cardano-test-wallet": "^3.0.0", "@faker-js/faker": "^8.4.1", "@noble/curves": "^1.3.0", "@noble/ed25519": "^2.0.0", @@ -43,9 +43,9 @@ } }, "node_modules/@cardanoapi/cardano-test-wallet": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/@cardanoapi/cardano-test-wallet/-/cardano-test-wallet-2.1.1.tgz", - "integrity": "sha512-K5HISR0GmWiJpZOaWT3PqfP7ez+Ht9+jrW8dSGwEXKfKPnj9g6uqUSnkUbuw3FmPeVRgNcB9EwkwmZzPcg7gZw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@cardanoapi/cardano-test-wallet/-/cardano-test-wallet-3.0.0.tgz", + "integrity": "sha512-5cQPQPrsco8eeDBIQI74jiAVl48hI0E3u2JSmya9PvRL/D18LUPqanmhpDScD8fpWRzS7MKSAhqoqsxTlgWYOw==", "license": "MIT" }, "node_modules/@cbor-extract/cbor-extract-darwin-arm64": { diff --git a/tests/govtool-frontend/playwright/package.json b/tests/govtool-frontend/playwright/package.json index 9edc9eac5..b52c3e5f8 100644 --- a/tests/govtool-frontend/playwright/package.json +++ b/tests/govtool-frontend/playwright/package.json @@ -28,7 +28,7 @@ "generate-wallets": "ts-node ./generate_wallets.ts 17" }, "dependencies": { - "@cardanoapi/cardano-test-wallet": "^2.1.1", + "@cardanoapi/cardano-test-wallet": "^3.0.0", "@faker-js/faker": "^8.4.1", "@noble/curves": "^1.3.0", "@noble/ed25519": "^2.0.0", From e599e7356c977de2b03a37e3f697cb9b7828a9e7 Mon Sep 17 00:00:00 2001 From: Niraj Date: Tue, 3 Dec 2024 16:22:24 +0545 Subject: [PATCH 07/28] chore: add blockfrost url and api key on wallet config --- tests/govtool-frontend/playwright/lib/fixtures/loadExtension.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/govtool-frontend/playwright/lib/fixtures/loadExtension.ts b/tests/govtool-frontend/playwright/lib/fixtures/loadExtension.ts index 41ed3e722..34c508d5b 100644 --- a/tests/govtool-frontend/playwright/lib/fixtures/loadExtension.ts +++ b/tests/govtool-frontend/playwright/lib/fixtures/loadExtension.ts @@ -20,6 +20,8 @@ export default async function loadDemosExtension( enableStakeSigning, kuberApiUrl: environments.kuber.apiUrl, kuberApiKey: environments.kuber.apiKey, + blockfrostApiKey: environments.blockfrostApiKey, + blockfrostApiUrl: environments.blockfrostApiUrl, }; await page.addInitScript( ({ walletConfig, supportedExtensions }) => { From ca8e7fc65591e0bbc018f6d969fac4155370480d Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 12:07:36 +0545 Subject: [PATCH 08/28] chore: update proposal.details type and add additional field types --- tests/govtool-backend/models/TestData.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/govtool-backend/models/TestData.py b/tests/govtool-backend/models/TestData.py index e4eb7e3ec..3f89f4149 100644 --- a/tests/govtool-backend/models/TestData.py +++ b/tests/govtool-backend/models/TestData.py @@ -18,13 +18,14 @@ class Proposal(TypedDict): txHash: str index: int type: str - details: Optional[dict] + details: Optional[dict] | Optional[list] expiryDate: str expiryEpochNo: int createdDate: str createdEpochNo: int url: str metadataHash: str + protocolParams: Optional[dict] title: Optional[str] abstract: Optional[str] motivation: Optional[str] @@ -38,6 +39,8 @@ class Proposal(TypedDict): poolYesVotes: int poolNoVotes: int poolAbstainVotes: int + prevGovActionIndex: Optional[int] + prevGovActionTxHash: Optional[str] class Drep(TypedDict): From 739c227531f9359fbeb30a7c772cd3381b73ecca Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 12:27:41 +0545 Subject: [PATCH 09/28] chore: use kuber api url from github vars --- .github/workflows/test_backend.yml | 2 +- tests/govtool-backend/config.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index faf2cbb86..7d2ebdf6d 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -38,7 +38,7 @@ jobs: env: BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }} FAUCET_API_KEY: ${{ secrets.FAUCET_API_KEY }} - KUBER_API_URL: https://kuber-govtool.cardanoapi.io + KUBER_API_URL: ${{ vars.KUBER_API_URL }} - name: Upload report if: always() diff --git a/tests/govtool-backend/config.py b/tests/govtool-backend/config.py index fb601c31b..2832c42df 100644 --- a/tests/govtool-backend/config.py +++ b/tests/govtool-backend/config.py @@ -11,5 +11,5 @@ RECORD_METRICS_API = os.getenv("RECORD_METRICS_API") METRICS_API_SECRET = os.getenv("METRICS_API_SECRET") -KUBER_API_URL = os.getenv("KUBER_API_URL") +KUBER_API_URL = os.getenv("KUBER_API_URL", "https://preview.kuber.cardanoapi.io") KUBER_API_KEY = os.getenv("KUBER_API_KEY") From 9da2cde27180f3b8951245f2e931594635c0f6fb Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 12:35:59 +0545 Subject: [PATCH 10/28] chore: add missing kuber api key env on backend test workflow --- .github/workflows/test_backend.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index 7d2ebdf6d..e13660cc9 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -39,6 +39,7 @@ jobs: BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }} FAUCET_API_KEY: ${{ secrets.FAUCET_API_KEY }} KUBER_API_URL: ${{ vars.KUBER_API_URL }} + KUBER_API_KEY: ${{ secrets.KUBER_API_KEY }} - name: Upload report if: always() From 6e04854a1ac195ad3ef813f634642f13257d4f40 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 13:53:33 +0545 Subject: [PATCH 11/28] chore: set kuber api url and faucet url based on network --- tests/govtool-backend/.env.example | 3 ++- tests/govtool-backend/config.py | 4 +++- tests/govtool-backend/lib/faucet_api.py | 5 +++-- tests/govtool-backend/lib/kuber_api.py | 6 ++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/govtool-backend/.env.example b/tests/govtool-backend/.env.example index 3bed52954..7e492cd11 100644 --- a/tests/govtool-backend/.env.example +++ b/tests/govtool-backend/.env.example @@ -5,4 +5,5 @@ METRICS_API_SECRET= `api_secret` # required for setup KUBER_API_URL = "https://kuber-govtool.cardanoapi.io" KUBER_API_KEY = "" # optional -FAUCET_API_KEY= """ \ No newline at end of file +FAUCET_API_KEY= """ +NETWORK= preview \ No newline at end of file diff --git a/tests/govtool-backend/config.py b/tests/govtool-backend/config.py index 2832c42df..e40af8b6d 100644 --- a/tests/govtool-backend/config.py +++ b/tests/govtool-backend/config.py @@ -11,5 +11,7 @@ RECORD_METRICS_API = os.getenv("RECORD_METRICS_API") METRICS_API_SECRET = os.getenv("METRICS_API_SECRET") -KUBER_API_URL = os.getenv("KUBER_API_URL", "https://preview.kuber.cardanoapi.io") +KUBER_API_URL = f'https://{os.getenv("NETWORK","preview")}.kuber.cardanoapi.io' KUBER_API_KEY = os.getenv("KUBER_API_KEY") +FAUCET_API_URL = f'https://faucet.${os.getenv("NETWORK","preview")}.world.dev.cardano.org' +FACUET_API_KEY = os.getenv("FAUCET_API_KEY") diff --git a/tests/govtool-backend/lib/faucet_api.py b/tests/govtool-backend/lib/faucet_api.py index ed0150390..b6c63c9de 100644 --- a/tests/govtool-backend/lib/faucet_api.py +++ b/tests/govtool-backend/lib/faucet_api.py @@ -1,3 +1,4 @@ +from config import FAUCET_API_URL,FACUET_API_KEY import os from typing import TypedDict @@ -21,8 +22,8 @@ def __init__(self, api_key: str, base_url: str = "https://faucet.sanchonet.world @staticmethod def from_env(): - api_key = os.getenv("FAUCET_API_KEY") - base_url = os.getenv("FAUCET_API_URL", "https://faucet.sanchonet.world.dev.cardano.org") + api_key = FACUET_API_KEY + base_url = FAUCET_API_URL if not api_key: raise ValueError("FAUCET_API_KEY environment variable not set.") return CardanoFaucet(api_key, base_url) diff --git a/tests/govtool-backend/lib/kuber_api.py b/tests/govtool-backend/lib/kuber_api.py index d70fedca2..788701d12 100644 --- a/tests/govtool-backend/lib/kuber_api.py +++ b/tests/govtool-backend/lib/kuber_api.py @@ -1,4 +1,5 @@ import json +from config import KUBER_API_KEY,KUBER_API_URL import sys import time from typing import Any, Optional @@ -69,11 +70,12 @@ def wait_for_txout(self, txin: str, timeout=400, log: bool = False): @staticmethod def from_env() -> "KuberApi": - api_url = os.environ.get("KUBER_API_URL") + api_url = KUBER_API_URL + print(f"KUBER_API_URL: {api_url}") if api_url is not None: api_url = api_url[:-1] if api_url.endswith("/") else api_url print(f"KUBER_API_URL: {api_url}") - api_key = os.environ.get("KUBER_API_KEY") + api_key = KUBER_API_KEY return KuberApi(api_url, api_key) else: print("KUBER_API_URL environment variable is not set.", file=sys.stderr) From fcf3cf071640b9f9f29475502e72742c8b73b528 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 13:54:10 +0545 Subject: [PATCH 12/28] chore: use faucet api key based on network --- .github/workflows/test_backend.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index e13660cc9..6fd46d86f 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -35,10 +35,16 @@ jobs: pip install -r requirements.txt python ./setup.py python -m pytest --alluredir allure-results + if [[ "${{ env.NETWORK }}" == "preprod" ]]; then + echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREPROD }}" >> $GITHUB_ENV + elif [[ "${{ env.NETWORK }}" == "sanchonet" ]]; then + echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_SANCHONET }}" >> $GITHUB_ENV + else + echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREVIEW }}" >> $GITHUB_ENV + fi env: BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }} - FAUCET_API_KEY: ${{ secrets.FAUCET_API_KEY }} - KUBER_API_URL: ${{ vars.KUBER_API_URL }} + NETWORK: ${{ vars.NETWORK }} KUBER_API_KEY: ${{ secrets.KUBER_API_KEY }} - name: Upload report From 56f70bf41f89d0262f7896cd6fda37f763f80e35 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 14:17:44 +0545 Subject: [PATCH 13/28] refactor: remove unwanted env and get api keys based on network --- .github/workflows/test_integration_playwright.yml | 14 ++++++++++---- tests/govtool-frontend/playwright/.env.example | 2 -- .../playwright/lib/constants/environments.ts | 11 ++--------- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test_integration_playwright.yml b/.github/workflows/test_integration_playwright.yml index 75175dce3..8cafe1f1b 100644 --- a/.github/workflows/test_integration_playwright.yml +++ b/.github/workflows/test_integration_playwright.yml @@ -55,6 +55,16 @@ jobs: chmod +w ./lib/_mock npm run generate-wallets npm test + if [[ "${{ env.NETWORK }}" == "preprod" ]]; then + echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREPROD }}" >> $GITHUB_ENV + echo "BLOCKFROST_API_KEY=${{ secrets.BLOCKFROST_API_KEY_PREPROD }}" >> $GITHUB_ENV + elif [[ "${{ env.NETWORK }}" == "sanchonet" ]]; then + echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_SANCHONET }}" >> $GITHUB_ENV + echo "BLOCKFROST_API_KEY=${{ secrets.BLOCKFROST_API_KEY_SANCHONET }}" >> $GITHUB_ENV + else + echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREVIEW }}" >> $GITHUB_ENV + echo "BLOCKFROST_API_KEY=${{ secrets.BLOCKFROST_API_KEY_PREVIEW }}" >> $GITHUB_ENV + fi - name: Upload report uses: actions/upload-artifact@v3 @@ -74,9 +84,6 @@ jobs: HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }} API_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}/api DOCS_URL: ${{ vars.DOCS_URL }} - FAUCET_API_URL: ${{ vars.FAUCET_API_URL }} - FAUCET_API_KEY: ${{secrets.FAUCET_API_KEY}} - KUBER_API_URL: ${{vars.KUBER_API_URL}} KUBER_API_KEY: ${{secrets.KUBER_API_KEY}} TEST_WORKERS: ${{vars.TEST_WORKERS}} CI: ${{vars.CI}} @@ -85,7 +92,6 @@ jobs: CARDANOAPI_METADATA_URL: ${{vars.CARDANOAPI_METADATA_URL}} PROPOSAL_FAUCET_PAYMENT_PRIVATE: ${{secrets.PROPOSAL_FAUCET_PAYMENT_PRIVATE}} PROPOSAL_FAUCET_STAKE_PRIVATE: ${{secrets.PROPOSAL_FAUCET_STAKE_PRIVATE}} - BLOCKFROST_API_KEY: ${{secrets.BLOCKFROST_API_KEY}} publish-report: runs-on: ubuntu-latest diff --git a/tests/govtool-frontend/playwright/.env.example b/tests/govtool-frontend/playwright/.env.example index 8704197ef..acd2110aa 100644 --- a/tests/govtool-frontend/playwright/.env.example +++ b/tests/govtool-frontend/playwright/.env.example @@ -10,14 +10,12 @@ PDF_URL=https://dev.api.pdf.gov.tools NETWORK_ID=0 # Faucet -FAUCET_API_URL=https://faucet.sanchonet.world.dev.cardano.org FAUCET_API_KEY= #Blockfrost BLOCKFROST_API_KEY=XXXXXXXXXXXXXXXXXXXXXXXX # Kuber -KUBER_API_URL=https://sanchonet.kuber.cardanoapi.io KUBER_API_KEY= # Transaction timeout diff --git a/tests/govtool-frontend/playwright/lib/constants/environments.ts b/tests/govtool-frontend/playwright/lib/constants/environments.ts index 6168e2dde..13622c431 100644 --- a/tests/govtool-frontend/playwright/lib/constants/environments.ts +++ b/tests/govtool-frontend/playwright/lib/constants/environments.ts @@ -16,21 +16,14 @@ const environments = { pdfUrl: process.env.PDF_URL || "https://dev.api.pdf.gov.tools", networkId: parseInt(process.env.NETWORK_ID) || 0, faucet: { - apiUrl: - process.env.FAUCET_API_URL.replace("sanchonet", NETWORK) || - "https://faucet.sanchonet.world.dev.cardano.org".replace( - "sanchonet", - NETWORK - ), + apiUrl:`https://faucet.${NETWORK}.world.dev.cardano.org`, apiKey: process.env.FAUCET_API_KEY || "", address: process.env.FAUCET_ADDRESS || "addr_test1vz0ua2vyk7r4vufmpqh5v44awg8xff26hxlwyrt3uc67maqtql3kl", }, kuber: { - apiUrl: - process.env.KUBER_API_URL.replace("sanchonet", NETWORK) || - "https://sanchonet.kuber.cardanoapi.io".replace("sanchonet", NETWORK), + apiUrl: `https://${NETWORK}.kuber.cardanoapi.io`, apiKey: process.env.KUBER_API_KEY || "", }, txTimeOut: parseInt(process.env.TX_TIMEOUT) || 240000, From 1d043cbda3131e22d2c3b15fa6b342d08c424d12 Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 15:11:23 +0545 Subject: [PATCH 14/28] fix: backend and integration test faucet and blockfrost env --- .github/workflows/test_backend.yml | 7 +++++++ .github/workflows/test_integration_playwright.yml | 15 ++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test_backend.yml b/.github/workflows/test_backend.yml index faf2cbb86..7947fc22c 100644 --- a/.github/workflows/test_backend.yml +++ b/.github/workflows/test_backend.yml @@ -33,6 +33,13 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt + if [[ "${{ env.NETWORK }}" == "preprod" ]]; then + export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_PREPROD }}" + elif [[ "${{ env.NETWORK }}" == "sanchonet" ]]; then + export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_SANCHONET }}" + else + export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_PREVIEW }}" + fi python ./setup.py python -m pytest --alluredir allure-results env: diff --git a/.github/workflows/test_integration_playwright.yml b/.github/workflows/test_integration_playwright.yml index 8cafe1f1b..3f3c5fab1 100644 --- a/.github/workflows/test_integration_playwright.yml +++ b/.github/workflows/test_integration_playwright.yml @@ -54,17 +54,18 @@ jobs: mkdir -p ./lib/_mock chmod +w ./lib/_mock npm run generate-wallets - npm test if [[ "${{ env.NETWORK }}" == "preprod" ]]; then - echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREPROD }}" >> $GITHUB_ENV - echo "BLOCKFROST_API_KEY=${{ secrets.BLOCKFROST_API_KEY_PREPROD }}" >> $GITHUB_ENV + export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_PREPROD }}" + export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_PREPROD }}" elif [[ "${{ env.NETWORK }}" == "sanchonet" ]]; then - echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_SANCHONET }}" >> $GITHUB_ENV - echo "BLOCKFROST_API_KEY=${{ secrets.BLOCKFROST_API_KEY_SANCHONET }}" >> $GITHUB_ENV + export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_SANCHONET }}" + export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_SANCHONET }}" else - echo "FAUCET_API_KEY=${{ secrets.FAUCET_API_KEY_PREVIEW }}" >> $GITHUB_ENV - echo "BLOCKFROST_API_KEY=${{ secrets.BLOCKFROST_API_KEY_PREVIEW }}" >> $GITHUB_ENV + export FAUCET_API_KEY="${{ secrets.FAUCET_API_KEY_PREVIEW }}" + export BLOCKFROST_API_KEY="${{ secrets.BLOCKFROST_API_KEY_PREVIEW }}" fi + npm test + - name: Upload report uses: actions/upload-artifact@v3 From 5254aad552422c103a379a24870a9f9f3e89d678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Tue, 3 Dec 2024 16:23:57 +0100 Subject: [PATCH 15/28] fix(#2398): fix unnecessary node remove in metadata actions --- CHANGELOG.md | 1 + govtool/frontend/src/utils/jsonUtils.ts | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b3ae685..30c8aea4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ changes. - Fix fetching voting power of newly registerd DRep [Issue 2407](https://github.com/IntersectMBO/govtool/issues/2407) - Fix inconsistent voting status [Issue 1713](https://github.com/IntersectMBO/govtool/issues/1713) +- Fix removing a child (link) when is not registed in DOM [Issue 2398](https://github.com/IntersectMBO/govtool/issues/2398) ### Changed diff --git a/govtool/frontend/src/utils/jsonUtils.ts b/govtool/frontend/src/utils/jsonUtils.ts index 04f499ed9..c73856bb0 100644 --- a/govtool/frontend/src/utils/jsonUtils.ts +++ b/govtool/frontend/src/utils/jsonUtils.ts @@ -24,8 +24,6 @@ export const downloadJson = (json: NodeObject, fileName?: string) => { } else { link.click(); } - - document.body.removeChild(link); URL.revokeObjectURL(url); }; @@ -52,6 +50,5 @@ export const downloadTextFile = (text: string, fileName?: string) => { link.click(); } - document.body.removeChild(link); URL.revokeObjectURL(url); }; From 8c2c67b35ec5e440c32110e938a0706196b61a2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Placzy=C5=84ski?= Date: Wed, 4 Dec 2024 23:55:26 +0100 Subject: [PATCH 16/28] [#2450] Initialize Sentry service at application start Updated the application to initialize the Sentry service at the beginning of the app lifecycle rather than during each exception occurrence. This change ensures that the Sentry service is set up once when the application starts, saving resources and potentially increasing the application's performance by avoiding repetitive initializations. The Sentry service is passed to the exception handler during setup and is used consistently throughout the application's uptime. This aligns with the user story's requirement to optimize exception handling efficiency by centralizing Sentry service initialization. --- govtool/backend/app/Main.hs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/govtool/backend/app/Main.hs b/govtool/backend/app/Main.hs index 91a743025..e0dd5d3b8 100644 --- a/govtool/backend/app/Main.hs +++ b/govtool/backend/app/Main.hs @@ -53,7 +53,7 @@ import System.Clock (TimeSpec (TimeSpec)) import System.IO (stderr) import System.Log.Raven (initRaven, register, silentFallback) import System.Log.Raven.Transport.HttpConduit (sendRecord) -import System.Log.Raven.Types (SentryLevel (Error), SentryRecord (..)) +import System.Log.Raven.Types (SentryLevel (Error), SentryRecord (..), SentryService) import System.TimeManager (TimeoutThread (..)) import VVA.API @@ -71,12 +71,18 @@ main :: IO () main = do commandLineConfig <- execParser cmdParser vvaConfig <- loadVVAConfig (clcConfigPath commandLineConfig) + sentryService <- + initRaven + (sentryDSN vvaConfig) + id + sendRecord + silentFallback case clcCommand commandLineConfig of - StartApp -> startApp vvaConfig + StartApp -> startApp vvaConfig sentryService ShowConfig -> Text.putStrLn $ vvaConfigToText vvaConfig -startApp :: VVAConfig -> IO () -startApp vvaConfig = do +startApp :: VVAConfig -> SentryService -> IO () +startApp vvaConfig sentryService = do let vvaPort = serverPort vvaConfig vvaHost = fromString (Text.unpack (serverHost vvaConfig)) settings = @@ -92,7 +98,7 @@ startApp vvaConfig = do ++ show vvaPort ) ) - $ setOnException (exceptionHandler vvaConfig) defaultSettings + $ setOnException (exceptionHandler vvaConfig sentryService) defaultSettings cacheEnv <- do let newCache = Cache.newCache (Just $ TimeSpec (fromIntegral (cacheDurationSeconds vvaConfig)) 0) proposalListCache <- newCache @@ -122,8 +128,8 @@ startApp vvaConfig = do server' <- mkVVAServer appEnv runSettings settings server' -exceptionHandler :: VVAConfig -> Maybe Request -> SomeException -> IO () -exceptionHandler vvaConfig mRequest exception = do +exceptionHandler :: VVAConfig -> SentryService -> Maybe Request -> SomeException -> IO () +exceptionHandler vvaConfig sentryService mRequest exception = do print mRequest print exception let isNotTimeoutThread x = case fromException x of @@ -135,12 +141,6 @@ exceptionHandler vvaConfig mRequest exception = do guard . isNotTimeoutThread $ exception guard . isNotConnectionClosedByPeer $ exception let env = sentryEnv vvaConfig - sentryService <- - initRaven - (sentryDSN vvaConfig) - id - sendRecord - silentFallback register sentryService "vva.be" From 3406fa5d4b9de611cf4dc0492a262bbd53ef0a6e Mon Sep 17 00:00:00 2001 From: Niraj Date: Wed, 4 Dec 2024 20:11:12 +0545 Subject: [PATCH 17/28] fix: use first dRep-eligible governance action in dRep vote dependent tests --- .../lib/pages/governanceActionsPage.ts | 20 ++++++++++++++++++- .../proposalVisibility.dRep.spec.ts | 2 +- .../proposalFunctionality.dRep.spec.ts | 4 ++-- .../proposalSubmission.loggedin.spec.ts | 9 +++++++-- 4 files changed, 29 insertions(+), 6 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts index e12e92e07..357148bdc 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts @@ -1,6 +1,10 @@ import removeAllSpaces from "@helpers/removeAllSpaces"; import { Locator, Page, expect } from "@playwright/test"; -import { GrovernanceActionType, IProposal } from "@types"; +import { + FullGovernanceDRepVoteActionsType, + GrovernanceActionType, + IProposal, +} from "@types"; import environments from "lib/constants/environments"; import GovernanceActionDetailsPage from "./governanceActionDetailsPage"; import { getEnumKeyByValue } from "@helpers/enum"; @@ -47,6 +51,20 @@ export default class GovernanceActionsPage { return new GovernanceActionDetailsPage(this.page); } + async viewFirstDRepVoteEnabledGovernanceAction(): Promise { + for (const governanceAction of Object.keys( + FullGovernanceDRepVoteActionsType + )) { + const result = await this.viewFirstProposalByGovernanceAction( + governanceAction as GrovernanceActionType + ); + if (result) { + return result; + } + } + return null; + } + async viewFirstProposalByGovernanceAction( governanceAction: GrovernanceActionType ): Promise { diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts index c4d2afbec..e30394e65 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts @@ -61,7 +61,7 @@ test.describe("Logged in DRep", () => { ? await govActionsPage.viewFirstProposalByGovernanceAction( GrovernanceActionType.InfoAction ) - : await govActionsPage.viewFirstProposal(); + : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); await govActionDetailsPage.contextBtn.click(); await govActionDetailsPage.contextInput.fill(faker.lorem.sentence(200)); diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts index a801a334d..35990b361 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts @@ -37,7 +37,7 @@ test.describe("Proposal checks", () => { ? await govActionsPage.viewFirstProposalByGovernanceAction( GrovernanceActionType.InfoAction ) - : await govActionsPage.viewFirstProposal(); + : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); test("5A. Should show relevant details about governance action as DRep", async () => { @@ -185,7 +185,7 @@ test.describe("Perform voting", () => { ? await govActionsPage.viewFirstProposalByGovernanceAction( GrovernanceActionType.InfoAction ) - : await govActionsPage.viewFirstProposal(); + : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); test("5E. Should re-vote with new data on a already voted governance action", async ({}, testInfo) => { diff --git a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts index b96e5e2dc..b61e6e3c4 100644 --- a/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts +++ b/tests/govtool-frontend/playwright/tests/7-proposal-submission/proposalSubmission.loggedin.spec.ts @@ -9,7 +9,10 @@ import { import { faker } from "@faker-js/faker"; import { test } from "@fixtures/proposal"; import { setAllureEpic } from "@helpers/allure"; -import { skipIfTreasuryAndBootstrapping, skipIfNotHardFork } from "@helpers/cardano"; +import { + skipIfTreasuryAndBootstrapping, + skipIfNotHardFork, +} from "@helpers/cardano"; import { ShelleyWallet } from "@helpers/crypto"; import { createNewPageWithWallet } from "@helpers/page"; import { invalid, valid as mockValid } from "@mock/index"; @@ -261,7 +264,9 @@ test.describe("Proposal created logged state", () => { }) => { test.slow(); // Brute-force testing with 100 random data for (let i = 0; i < 50; i++) { - await proposalSubmissionPage.metadataUrlInput.fill(invalid.url(false)); + await proposalSubmissionPage.metadataUrlInput.fill( + invalid.url(false) + ); await expect(page.getByTestId("url-input-error-text")).toBeVisible(); } From 99f8f065231c9cc24fb7ae9780474e9a5931abca Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 12:48:38 +0545 Subject: [PATCH 18/28] fix: parallelize bootstrap dRep vote tests and improve visibility checks --- .../proposalFunctionality.dRep.spec.ts | 117 ++++++++---------- 1 file changed, 51 insertions(+), 66 deletions(-) diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts index 35990b361..08cf5c713 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts @@ -271,77 +271,62 @@ test.describe("Check voting power", () => { }); test.describe("Bootstrap phase", () => { - test.use({ storageState: ".auth/dRep01.json", wallet: dRep01Wallet }); test("5L. Should restrict dRep votes to Info Governance actions During Bootstrapping Phase", async ({ - page, - context, + browser, }) => { - await page.route("**/epoch/params", async (route) => { - // Fetch the original response from the server - const response = await route.fetch(); - const json = await response.json(); - - // update protocol major version - json["protocol_major"] = 9; - await route.fulfill({ - status: 200, - contentType: "application/json", - body: JSON.stringify(json), - }); - }); - const voteBlacklistOptions = Object.keys(GrovernanceActionType).filter( (option) => option !== BootstrapGovernanceActionType.InfoAction ); - const govActionsPage = new GovernanceActionsPage(page); - await govActionsPage.goto(); - - // wait until the loading button is hidden - await expect( - page.getByRole("progressbar").getByRole("img") - ).not.toBeVisible({ timeout: 10_000 }); - - for (const voteBlacklistOption of voteBlacklistOptions) { - const governanceActionDetailsPage = - await govActionsPage.viewFirstProposalByGovernanceAction( - voteBlacklistOption as GrovernanceActionType - ); - - if (governanceActionDetailsPage !== null) { - // dRep vote - await expect(governanceActionDetailsPage.dRepYesVotes).toBeVisible(); - await expect( - governanceActionDetailsPage.dRepAbstainVotes - ).toBeVisible(); - await expect(governanceActionDetailsPage.dRepNoVotes).toBeVisible(); - - // sPos vote - await expect(governanceActionDetailsPage.sPosYesVotes).toBeVisible(); - await expect( - governanceActionDetailsPage.sPosAbstainVotes - ).toBeVisible(); - await expect(governanceActionDetailsPage.sPosNoVotes).toBeVisible(); - - // ccCommittee vote - await expect( - governanceActionDetailsPage.ccCommitteeYesVotes - ).toBeVisible(); - await expect( - governanceActionDetailsPage.ccCommitteeAbstainVotes - ).toBeVisible(); - await expect( - governanceActionDetailsPage.ccCommitteeNoVotes - ).toBeVisible(); - - await expect( - governanceActionDetailsPage.yesVoteRadio - ).not.toBeVisible(); - await expect(governanceActionDetailsPage.contextBtn).not.toBeVisible(); - await expect(governanceActionDetailsPage.voteBtn).not.toBeVisible(); - - await governanceActionDetailsPage.backBtn.click(); - } - } + await Promise.all( + voteBlacklistOptions.map(async (voteBlacklistOption) => { + const dRepPage = await createNewPageWithWallet(browser, { + storageState: ".auth/dRep01.json", + wallet: dRep01Wallet, + }); + + await dRepPage.route("**/epoch/params", async (route) => { + // Fetch the original response from the server + const response = await route.fetch(); + const json = await response.json(); + + // update protocol major version + json["protocol_major"] = 9; + await route.fulfill({ + status: 200, + contentType: "application/json", + body: JSON.stringify(json), + }); + }); + + const governanceActionsPage = new GovernanceActionsPage(dRepPage); + await governanceActionsPage.goto(); + + // assert to wait until proposal cards are visible + await expect(dRepPage.getByTestId("voting-power-chips")).toBeVisible(); + // wait until the loading button is hidden + await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + + const governanceActionDetailsPage = + await governanceActionsPage.viewFirstProposalByGovernanceAction( + voteBlacklistOption as GrovernanceActionType + ); + + if (governanceActionDetailsPage) { + await expect( + dRepPage.getByTestId("governance-action-details-card-header") + ).toBeVisible(); + await expect( + governanceActionDetailsPage.yesVoteRadio + ).not.toBeVisible(); + await expect( + governanceActionDetailsPage.contextBtn + ).not.toBeVisible(); + await expect(governanceActionDetailsPage.voteBtn).not.toBeVisible(); + } + }) + ); }); }); From cb148f59df634afa0917e7604a88b49914318625 Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 12:54:26 +0545 Subject: [PATCH 19/28] chore: remove unnecessary async from areCCVoteTotalsDisplayed --- tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts index 6169bfcf5..94781e4cb 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts @@ -45,7 +45,7 @@ export const areSPOVoteTotalsDisplayed = async (proposal: IProposal) => { ); }; -export const areCCVoteTotalsDisplayed = async ( +export const areCCVoteTotalsDisplayed = ( governanceActionType: GrovernanceActionType ) => { return ![ From 368e4486e128116055aafd93e1b5ad3b6e41aa07 Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 13:47:34 +0545 Subject: [PATCH 20/28] fix: governance action type typo --- .../playwright/lib/helpers/featureFlag.ts | 28 +++++++++---------- .../lib/pages/governanceActionsPage.ts | 12 ++++---- .../govtool-frontend/playwright/lib/types.ts | 2 +- .../dRepRegistration.dRep.spec.ts | 6 ++-- .../proposalVisibility.dRep.spec.ts | 8 ++---- .../proposalVisibility.spec.ts | 8 +++--- .../proposalFunctionality.dRep.spec.ts | 10 +++---- 7 files changed, 36 insertions(+), 38 deletions(-) diff --git a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts index 94781e4cb..0a6f1576e 100644 --- a/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts +++ b/tests/govtool-frontend/playwright/lib/helpers/featureFlag.ts @@ -1,4 +1,4 @@ -import { GrovernanceActionType, IProposal } from "@types"; +import { GovernanceActionType, IProposal } from "@types"; import { isBootStrapingPhase } from "./cardano"; import { SECURITY_RELEVANT_PARAMS_MAP } from "@constants/index"; @@ -12,17 +12,17 @@ export const areDRepVoteTotalsDisplayed = async (proposal: IProposal) => { ); if (isInBootstrapPhase) { return !( - proposal.type === GrovernanceActionType.HardFork || - (proposal.type === GrovernanceActionType.ProtocolParameterChange && + proposal.type === GovernanceActionType.HardFork || + (proposal.type === GovernanceActionType.ProtocolParameterChange && !isSecurityGroup) ); } return ![ - GrovernanceActionType.NoConfidence, - GrovernanceActionType.NewCommittee, - GrovernanceActionType.UpdatetotheConstitution, - ].includes(proposal.type as GrovernanceActionType); + GovernanceActionType.NoConfidence, + GovernanceActionType.NewCommittee, + GovernanceActionType.UpdatetotheConstitution, + ].includes(proposal.type as GovernanceActionType); }; export const areSPOVoteTotalsDisplayed = async (proposal: IProposal) => { @@ -34,22 +34,22 @@ export const areSPOVoteTotalsDisplayed = async (proposal: IProposal) => { ] !== null ); if (isInBootstrapPhase) { - return proposal.type !== GrovernanceActionType.ProtocolParameterChange; + return proposal.type !== GovernanceActionType.ProtocolParameterChange; } return !( - proposal.type === GrovernanceActionType.UpdatetotheConstitution || - proposal.type === GrovernanceActionType.TreasuryWithdrawal || - (proposal.type === GrovernanceActionType.ProtocolParameterChange && + proposal.type === GovernanceActionType.UpdatetotheConstitution || + proposal.type === GovernanceActionType.TreasuryWithdrawal || + (proposal.type === GovernanceActionType.ProtocolParameterChange && !isSecurityGroup) ); }; export const areCCVoteTotalsDisplayed = ( - governanceActionType: GrovernanceActionType + governanceActionType: GovernanceActionType ) => { return ![ - GrovernanceActionType.NoConfidence, - GrovernanceActionType.NewCommittee, + GovernanceActionType.NoConfidence, + GovernanceActionType.NewCommittee, ].includes(governanceActionType); }; diff --git a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts index 357148bdc..1bbb69179 100644 --- a/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts +++ b/tests/govtool-frontend/playwright/lib/pages/governanceActionsPage.ts @@ -2,7 +2,7 @@ import removeAllSpaces from "@helpers/removeAllSpaces"; import { Locator, Page, expect } from "@playwright/test"; import { FullGovernanceDRepVoteActionsType, - GrovernanceActionType, + GovernanceActionType, IProposal, } from "@types"; import environments from "lib/constants/environments"; @@ -56,7 +56,7 @@ export default class GovernanceActionsPage { FullGovernanceDRepVoteActionsType )) { const result = await this.viewFirstProposalByGovernanceAction( - governanceAction as GrovernanceActionType + governanceAction as GovernanceActionType ); if (result) { return result; @@ -66,7 +66,7 @@ export default class GovernanceActionsPage { } async viewFirstProposalByGovernanceAction( - governanceAction: GrovernanceActionType + governanceAction: GovernanceActionType ): Promise { const proposalCard = this.page .getByTestId(`govaction-${governanceAction}-card`) @@ -139,7 +139,7 @@ export default class GovernanceActionsPage { async sortAndValidate( sortOption: string, validationFn: (p1: IProposal, p2: IProposal) => boolean, - filterKeys = Object.keys(GrovernanceActionType) + filterKeys = Object.keys(GovernanceActionType) ) { const responsesPromise = Promise.all( filterKeys.map((filterKey) => @@ -147,7 +147,7 @@ export default class GovernanceActionsPage { response .url() .includes( - `&type[]=${GrovernanceActionType[filterKey]}&sort=${sortOption}` + `&type[]=${GovernanceActionType[filterKey]}&sort=${sortOption}` ) ) ) @@ -183,7 +183,7 @@ export default class GovernanceActionsPage { for (let dIdx = 0; dIdx <= proposalsByType.length - 1; dIdx++) { const proposals = proposalsByType[0] as IProposal[]; const filterOptionKey = getEnumKeyByValue( - GrovernanceActionType, + GovernanceActionType, proposals[0].type ); diff --git a/tests/govtool-frontend/playwright/lib/types.ts b/tests/govtool-frontend/playwright/lib/types.ts index 2bde6027d..b20caf09c 100644 --- a/tests/govtool-frontend/playwright/lib/types.ts +++ b/tests/govtool-frontend/playwright/lib/types.ts @@ -74,7 +74,7 @@ export enum ProposalType { treasury = "Treasury", } -export enum GrovernanceActionType { +export enum GovernanceActionType { ProtocolParameterChange = "ParameterChange", InfoAction = "InfoAction", TreasuryWithdrawal = "TreasuryWithdrawals", diff --git a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts index d4842d6ba..9f593c004 100644 --- a/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/3-drep-registration/dRepRegistration.dRep.spec.ts @@ -13,7 +13,7 @@ import GovernanceActionsPage from "@pages/governanceActionsPage"; import { expect } from "@playwright/test"; import walletManager from "lib/walletManager"; import DRepDirectoryPage from "@pages/dRepDirectoryPage"; -import { GrovernanceActionType } from "@types"; +import { GovernanceActionType } from "@types"; test.beforeEach(async () => { await setAllureEpic("3. DRep registration"); @@ -37,12 +37,12 @@ test.describe("Logged in DReps", () => { const governanceActionsPage = new GovernanceActionsPage(page); await governanceActionsPage.goto(); - + await expect(page.getByText(/info action/i).first()).toBeVisible(); const governanceActionDetailsPage = await governanceActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ); await expect(governanceActionDetailsPage.voteBtn).toBeVisible(); diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts index e30394e65..ecb7f1bab 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts @@ -16,7 +16,7 @@ import { invalid as mockInvalid, valid as mockValid } from "@mock/index"; import { BootstrapGovernanceActionType, FullGovernanceDRepVoteActionsType, - GrovernanceActionType, + GovernanceActionType, IProposal, } from "@types"; import walletManager from "lib/walletManager"; @@ -59,7 +59,7 @@ test.describe("Logged in DRep", () => { govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ) : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); @@ -207,9 +207,7 @@ test.describe("Check vote count", () => { // check ccCommittee votes if ( - areCCVoteTotalsDisplayed( - proposalToCheck.type as GrovernanceActionType - ) + areCCVoteTotalsDisplayed(proposalToCheck.type as GovernanceActionType) ) { await expect(govActionDetailsPage.ccCommitteeYesVotes).toHaveText( `${proposalToCheck.ccYesVotes}` diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts index 7918dc968..8b08c93c0 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.spec.ts @@ -9,7 +9,7 @@ import { import GovernanceActionDetailsPage from "@pages/governanceActionDetailsPage"; import GovernanceActionsPage from "@pages/governanceActionsPage"; import { expect, test } from "@playwright/test"; -import { GrovernanceActionType, IProposal } from "@types"; +import { GovernanceActionType, IProposal } from "@types"; test.beforeEach(async () => { await setAllureEpic("4. Proposal visibility"); @@ -39,9 +39,9 @@ test("4K. Should display correct vote counts on governance details page for disc page, browser, }) => { - const responsesPromise = Object.keys(GrovernanceActionType).map((filterKey) => + const responsesPromise = Object.keys(GovernanceActionType).map((filterKey) => page.waitForResponse((response) => - response.url().includes(`&type[]=${GrovernanceActionType[filterKey]}`) + response.url().includes(`&type[]=${GovernanceActionType[filterKey]}`) ) ); @@ -98,7 +98,7 @@ test("4K. Should display correct vote counts on governance details page for disc // check ccCommittee votes if ( - areCCVoteTotalsDisplayed(proposalToCheck.type as GrovernanceActionType) + areCCVoteTotalsDisplayed(proposalToCheck.type as GovernanceActionType) ) { await expect(govActionDetailsPage.ccCommitteeYesVotes).toHaveText( `${proposalToCheck.ccYesVotes}` diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts index 08cf5c713..0f39ea31e 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts @@ -12,7 +12,7 @@ import GovernanceActionDetailsPage from "@pages/governanceActionDetailsPage"; import GovernanceActionsPage from "@pages/governanceActionsPage"; import { Page, expect } from "@playwright/test"; import kuberService from "@services/kuberService"; -import { BootstrapGovernanceActionType, GrovernanceActionType } from "@types"; +import { BootstrapGovernanceActionType, GovernanceActionType } from "@types"; import walletManager from "lib/walletManager"; const invalidInfinityProposals = require("../../lib/_mock/invalidInfinityProposals.json"); @@ -35,7 +35,7 @@ test.describe("Proposal checks", () => { currentPage = page; govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ) : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); @@ -183,7 +183,7 @@ test.describe("Perform voting", () => { govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( - GrovernanceActionType.InfoAction + GovernanceActionType.InfoAction ) : await govActionsPage.viewFirstDRepVoteEnabledGovernanceAction(); }); @@ -274,7 +274,7 @@ test.describe("Bootstrap phase", () => { test("5L. Should restrict dRep votes to Info Governance actions During Bootstrapping Phase", async ({ browser, }) => { - const voteBlacklistOptions = Object.keys(GrovernanceActionType).filter( + const voteBlacklistOptions = Object.keys(GovernanceActionType).filter( (option) => option !== BootstrapGovernanceActionType.InfoAction ); @@ -311,7 +311,7 @@ test.describe("Bootstrap phase", () => { const governanceActionDetailsPage = await governanceActionsPage.viewFirstProposalByGovernanceAction( - voteBlacklistOption as GrovernanceActionType + voteBlacklistOption as GovernanceActionType ); if (governanceActionDetailsPage) { From 20665aec2a04ac04b992dd0139e3e311978729d1 Mon Sep 17 00:00:00 2001 From: Niraj Date: Thu, 5 Dec 2024 14:18:12 +0545 Subject: [PATCH 21/28] chore: add assertion on governance list to wait until loading button is hidden --- .../proposalVisibility.dRep.spec.ts | 5 +++++ .../proposalFunctionality.dRep.spec.ts | 12 +++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts index ecb7f1bab..c066337ff 100644 --- a/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/4-proposal-visibility/proposalVisibility.dRep.spec.ts @@ -57,6 +57,11 @@ test.describe("Logged in DRep", () => { const govActionsPage = new GovernanceActionsPage(page); await govActionsPage.goto(); + // assert to wait until the loading button is hidden + await expect(page.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( GovernanceActionType.InfoAction diff --git a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts index 0f39ea31e..989f9e661 100644 --- a/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts +++ b/tests/govtool-frontend/playwright/tests/5-proposal-functionality/proposalFunctionality.dRep.spec.ts @@ -32,6 +32,11 @@ test.describe("Proposal checks", () => { const govActionsPage = new GovernanceActionsPage(page); await govActionsPage.goto(); + // assert to wait until the loading button is hidden + await expect(page.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + currentPage = page; govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( @@ -181,6 +186,11 @@ test.describe("Perform voting", () => { const govActionsPage = new GovernanceActionsPage(dRepPage); await govActionsPage.goto(); + // assert to wait until the loading button is hidden + await expect(dRepPage.getByTestId("to-vote-tab")).toBeVisible({ + timeout: 15_000, + }); + govActionDetailsPage = (await isBootStrapingPhase()) ? await govActionsPage.viewFirstProposalByGovernanceAction( GovernanceActionType.InfoAction @@ -211,7 +221,7 @@ test.describe("Perform voting", () => { await expect( govActionDetailsPage.currentPage.getByTestId("my-vote").getByText("No") - ).toBeVisible(); + ).toBeVisible({ timeout: 15_000 }); }); test("5F. Should show notification of casted vote after vote", async ({}, testInfo) => { From a2c1820adec3c213d4091db2bb736b3092399bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Tue, 3 Dec 2024 15:46:14 +0100 Subject: [PATCH 22/28] feat(#1806): add support for CIP-119 DRep images --- CHANGELOG.md | 2 +- govtool/frontend/.env.example | 2 + govtool/frontend/Dockerfile | 6 +- govtool/frontend/Dockerfile.qovery | 2 + govtool/frontend/public/icons/DefaultDRep.svg | 5 ++ .../molecules/DataMissingHeader.tsx | 25 ++++++- .../src/components/organisms/DRepCard.tsx | 73 +++++++++++-------- .../organisms/DRepDetailsCardHeader.tsx | 4 +- govtool/frontend/src/consts/icons.ts | 1 + govtool/frontend/src/models/api.ts | 6 ++ govtool/frontend/src/utils/mapDtoToDrep.ts | 31 +++++++- govtool/frontend/src/utils/tests/dRep.test.ts | 2 + scripts/govtool/frontend.mk | 2 + 13 files changed, 124 insertions(+), 37 deletions(-) create mode 100644 govtool/frontend/public/icons/DefaultDRep.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 30c8aea4c..48280e697 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ changes. ### Added -- +- Add support for displaying CIP-119 DRep images [Issue 1806](https://github.com/IntersectMBO/govtool/issues/1806) ### Fixed diff --git a/govtool/frontend/.env.example b/govtool/frontend/.env.example index 5fbb1a97f..2489d65a0 100644 --- a/govtool/frontend/.env.example +++ b/govtool/frontend/.env.example @@ -8,3 +8,5 @@ VITE_IS_DEV=true VITE_USERSNAP_SPACE_API_KEY="" VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED='true' VITE_PDF_API_URL="" +VITE_IPFS_GATEWAY="" +VITE_IPFS_PROJECT_ID="" \ No newline at end of file diff --git a/govtool/frontend/Dockerfile b/govtool/frontend/Dockerfile index 5186b390e..9a12dba06 100644 --- a/govtool/frontend/Dockerfile +++ b/govtool/frontend/Dockerfile @@ -10,6 +10,8 @@ ARG NPMRC_TOKEN ARG VITE_USERSNAP_SPACE_API_KEY ARG VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED='true' ARG VITE_PDF_API_URL +ARG VITE_IPFS_GATEWAY +ARG VITE_IPFS_PROJECT_ID # Ensure all required build arguments are set RUN \ @@ -21,7 +23,9 @@ RUN \ : "${VITE_SENTRY_DSN:?Build argument VITE_SENTRY_DSN is not set}" && \ : "${NPMRC_TOKEN:?Build argument NPMRC_TOKEN is not set}" && \ : "${VITE_USERSNAP_SPACE_API_KEY:?Build argument VITE_USERSNAP_SPACE_API_KEY is not set}" && \ - : "${VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED:?Build argument VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED is not set}" + : "${VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED:?Build argument VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED is not set}" && \ + : "${VITE_IPFS_GATEWAY:?Build argument VITE_IPFS_GATEWAY is not set}" && \ + : "${VITE_IPFS_PROJECT_ID:?Build argument VITE_IPFS_PROJECT_ID is not set}" ENV NODE_OPTIONS=--max_old_space_size=8192 diff --git a/govtool/frontend/Dockerfile.qovery b/govtool/frontend/Dockerfile.qovery index ddc6c1288..f9b562ade 100644 --- a/govtool/frontend/Dockerfile.qovery +++ b/govtool/frontend/Dockerfile.qovery @@ -10,6 +10,8 @@ ARG NPMRC_TOKEN ARG VITE_USERSNAP_SPACE_API_KEY ARG VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED='true' ARG VITE_PDF_API_URL +ARG VITE_IPFS_GATEWAY +ARG VITE_IPFS_PROJECT_ID ENV NODE_OPTIONS=--max_old_space_size=8192 diff --git a/govtool/frontend/public/icons/DefaultDRep.svg b/govtool/frontend/public/icons/DefaultDRep.svg new file mode 100644 index 000000000..00557579b --- /dev/null +++ b/govtool/frontend/public/icons/DefaultDRep.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/govtool/frontend/src/components/molecules/DataMissingHeader.tsx b/govtool/frontend/src/components/molecules/DataMissingHeader.tsx index 6267d8742..ef6e278b4 100644 --- a/govtool/frontend/src/components/molecules/DataMissingHeader.tsx +++ b/govtool/frontend/src/components/molecules/DataMissingHeader.tsx @@ -1,19 +1,24 @@ -import { Box, SxProps } from "@mui/material"; +import { Avatar, Box, SxProps } from "@mui/material"; import { Typography } from "@atoms"; import { MetadataValidationStatus } from "@models"; import { getMetadataDataMissingStatusTranslation } from "@/utils"; +import { ICONS } from "@/consts"; type DataMissingHeaderProps = { isDataMissing: MetadataValidationStatus | null; title?: string; titleStyle?: SxProps; + isDRep?: boolean; + image?: string | null; }; export const DataMissingHeader = ({ title, isDataMissing, titleStyle, + isDRep, + image, }: DataMissingHeaderProps) => ( + {isDRep && ( + + )} - - - {metadataStatus - ? getMetadataDataMissingStatusTranslation(metadataStatus) - : ellipsizeText(givenName ?? "", 25)} - - { - navigator.clipboard.writeText(view); - addSuccessAlert(t("alerts.copiedToClipboard")); - e.stopPropagation(); - }} - sx={{ - gap: 1, - width: "250px", - maxWidth: "100%", - "&:hover": { - opacity: 0.6, - transition: "opacity 0.3s", - }, - }} - > - - {view} + + + + + {metadataStatus + ? getMetadataDataMissingStatusTranslation(metadataStatus) + : ellipsizeText(givenName ?? "", 25)} - - + { + navigator.clipboard.writeText(view); + addSuccessAlert(t("alerts.copiedToClipboard")); + e.stopPropagation(); + }} + sx={{ + gap: 1, + width: "250px", + maxWidth: "100%", + "&:hover": { + opacity: 0.6, + transition: "opacity 0.3s", + }, + }} + > + + {view} + + + + diff --git a/govtool/frontend/src/components/organisms/DRepDetailsCardHeader.tsx b/govtool/frontend/src/components/organisms/DRepDetailsCardHeader.tsx index 77092b30f..ecbb61eba 100644 --- a/govtool/frontend/src/components/organisms/DRepDetailsCardHeader.tsx +++ b/govtool/frontend/src/components/organisms/DRepDetailsCardHeader.tsx @@ -32,7 +32,7 @@ export const DRepDetailsCardHeader = ({ const { votingPower: myVotingPower } = useGetAdaHolderVotingPowerQuery(stakeKey); - const { givenName, metadataStatus } = dRepData; + const { givenName, metadataStatus, image } = dRepData; const navigateToEditDRep = () => { navigate(PATHS.editDrepMetadata, { @@ -121,7 +121,9 @@ export const DRepDetailsCardHeader = ({ )} diff --git a/govtool/frontend/src/consts/icons.ts b/govtool/frontend/src/consts/icons.ts index bd70a2b06..4d8672516 100644 --- a/govtool/frontend/src/consts/icons.ts +++ b/govtool/frontend/src/consts/icons.ts @@ -13,6 +13,7 @@ export const ICONS = { copyWhiteIcon: "/icons/CopyWhite.svg", dashboardActiveIcon: "/icons/DashboardActive.svg", dashboardIcon: "/icons/Dashboard.svg", + defaultDRepIcon: "/icons/DefaultDRep.svg", download: "/icons/Download.svg", drawerIcon: "/icons/DrawerIcon.svg", dRepDirectoryActiveIcon: "/icons/DRepDirectoryActive.svg", diff --git a/govtool/frontend/src/models/api.ts b/govtool/frontend/src/models/api.ts index fff33a0c0..32ef7bcc5 100644 --- a/govtool/frontend/src/models/api.ts +++ b/govtool/frontend/src/models/api.ts @@ -144,6 +144,9 @@ export type DrepDataDTO = { url?: string; view: string; votingPower?: number; + imageUrl: string | null; + // either base64 for IPFS image or URL for regular image + image: string | null; }; export type DRepData = DrepDataDTO & { @@ -156,6 +159,9 @@ export type DRepData = DrepDataDTO & { doNotList: boolean; metadataStatus: MetadataValidationStatus | null; metadataValid: boolean; + imageUrl: string | null; + // either base64 for IPFS image or URL for regular image + image: string | null; }; export type Vote = "yes" | "no" | "abstain"; diff --git a/govtool/frontend/src/utils/mapDtoToDrep.ts b/govtool/frontend/src/utils/mapDtoToDrep.ts index 419973c14..4ab65d9fa 100644 --- a/govtool/frontend/src/utils/mapDtoToDrep.ts +++ b/govtool/frontend/src/utils/mapDtoToDrep.ts @@ -11,7 +11,7 @@ export const mapDtoToDrep = async (dto: DrepDataDTO): Promise => { const emptyMetadata = { paymentAddress: null, givenName: "", - image: null, + imageUrl: null, objectives: null, motivations: null, qualifications: null, @@ -24,6 +24,33 @@ export const mapDtoToDrep = async (dto: DrepDataDTO): Promise => { // DBSync contains wrong representation of DRep view for script based DReps const view = fixViewForScriptBasedDRep(dto.view, dto.isScriptBased); + // We need to prefetch the image, for the IPFS support + let base64Image = null; + const isIPFSImage = dto.imageUrl?.startsWith("ipfs://") || false; + if (dto.imageUrl) { + fetch( + isIPFSImage + ? `${process.env.VITE_IPFS_GATEWAY}/${dto.imageUrl?.slice(7)}` + : dto.imageUrl, + isIPFSImage + ? { + headers: { project_id: import.meta.env.VITE_IPFS_PROJECT_ID }, + } + : {}, + ) + .then(async (res) => { + const blob = await res.blob(); + const reader = new FileReader(); + reader.readAsDataURL(blob); + reader.onloadend = () => { + base64Image = reader.result; + }; + }) + .catch((e) => { + console.error("Fetching the DRep image failed, reason: ", e); + }); + } + if (dto.metadataHash && dto.url) { const validationResponse = await postValidate({ url: dto.url, @@ -36,6 +63,7 @@ export const mapDtoToDrep = async (dto: DrepDataDTO): Promise => { ...validationResponse.metadata, metadataStatus: validationResponse.status || null, metadataValid: validationResponse.valid, + image: isIPFSImage ? base64Image : dto.imageUrl, view, }; } @@ -44,5 +72,6 @@ export const mapDtoToDrep = async (dto: DrepDataDTO): Promise => { ...dto, ...emptyMetadata, view, + image: isIPFSImage ? base64Image : dto.imageUrl, }; }; diff --git a/govtool/frontend/src/utils/tests/dRep.test.ts b/govtool/frontend/src/utils/tests/dRep.test.ts index 104bfe019..66f41fe63 100644 --- a/govtool/frontend/src/utils/tests/dRep.test.ts +++ b/govtool/frontend/src/utils/tests/dRep.test.ts @@ -24,6 +24,8 @@ const EXAMPLE_DREP: DRepData = { qualifications: null, doNotList: false, isScriptBased: false, + imageUrl: null, + image: null, }; describe("isSameDRep function", () => { diff --git a/scripts/govtool/frontend.mk b/scripts/govtool/frontend.mk index 64f5516e8..910cbd030 100644 --- a/scripts/govtool/frontend.mk +++ b/scripts/govtool/frontend.mk @@ -25,6 +25,8 @@ build-frontend: docker-login --build-arg VITE_IS_PROPOSAL_DISCUSSION_FORUM_ENABLED="$${IS_PROPOSAL_DISCUSSION_FORUM_ENABLED}" \ --build-arg NPMRC_TOKEN="$${NPMRC_TOKEN}" \ --build-arg VITE_PDF_API_URL="$${PDF_API_URL}" \ + --build-arg VITE_IPFS_GATEWAY="$${IPFS_GATEWAY}" \ + --build-arg VITE_IPFS_PROJECT_ID="$${IPFS_PROJECT_ID}" \ $(root_dir)/govtool/frontend .PHONY: push-frontend From efd3d7b8fdb514e0ccab22326be66152703b9d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Tue, 3 Dec 2024 16:03:21 +0100 Subject: [PATCH 23/28] fix(#2408): fix app crash on delegation --- CHANGELOG.md | 1 + govtool/frontend/src/hooks/useDelegateToDrep.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48280e697..199dfbe48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ changes. - Fix fetching voting power of newly registerd DRep [Issue 2407](https://github.com/IntersectMBO/govtool/issues/2407) - Fix inconsistent voting status [Issue 1713](https://github.com/IntersectMBO/govtool/issues/1713) - Fix removing a child (link) when is not registed in DOM [Issue 2398](https://github.com/IntersectMBO/govtool/issues/2398) +- Fix blank screen on DRep delegation when UTXos are missing [Issue 2408](https://github.com/IntersectMBO/govtool/issues/2408) ### Changed diff --git a/govtool/frontend/src/hooks/useDelegateToDrep.ts b/govtool/frontend/src/hooks/useDelegateToDrep.ts index 31509d14d..179e17457 100644 --- a/govtool/frontend/src/hooks/useDelegateToDrep.ts +++ b/govtool/frontend/src/hooks/useDelegateToDrep.ts @@ -52,8 +52,12 @@ export const useDelegateTodRep = () => { voter, }); } catch (error) { + console.error({ error }); openWalletErrorModal({ - error, + error: + typeof error === "string" + ? error + : (error as { message: string | null })?.message, dataTestId: "delegate-transaction-error-modal", }); Sentry.setTag("hook", "useDelegateTodRep"); From 97fdf9aea991e40820adbdae599c938f520708f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Tue, 3 Dec 2024 16:07:21 +0100 Subject: [PATCH 24/28] chore(#2411): bump cardano db-sync to 13.6.0.4 --- CHANGELOG.md | 2 +- scripts/govtool/Makefile | 2 +- scripts/govtool/docker-compose.node+dbsync.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 199dfbe48..18a842949 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,7 +23,7 @@ changes. ### Changed -- +- Bump cardano-db-sync to 13.6.0.4 [Issue 2411](https://github.com/IntersectMBO/govtool/issues/2411) ### Removed diff --git a/scripts/govtool/Makefile b/scripts/govtool/Makefile index 9a7e14f03..a4c9bb4cb 100644 --- a/scripts/govtool/Makefile +++ b/scripts/govtool/Makefile @@ -12,7 +12,7 @@ include config.mk # image tags cardano_node_image_tag := 10.1.2 -cardano_db_sync_image_tag := 13.6.0.1 +cardano_db_sync_image_tag := 13.6.0.4 .PHONY: all all: deploy-stack notify diff --git a/scripts/govtool/docker-compose.node+dbsync.yml b/scripts/govtool/docker-compose.node+dbsync.yml index e72f09cfb..c88b4e037 100644 --- a/scripts/govtool/docker-compose.node+dbsync.yml +++ b/scripts/govtool/docker-compose.node+dbsync.yml @@ -65,7 +65,7 @@ services: retries: 10 cardano-db-sync: - image: ghcr.io/intersectmbo/cardano-db-sync:13.6.0.1 + image: ghcr.io/intersectmbo/cardano-db-sync:13.6.0.4 environment: - NETWORK=sanchonet - POSTGRES_HOST=postgres From cbd943044f64184dbfe896715f781776e4daa62e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Wed, 4 Dec 2024 13:37:26 +0100 Subject: [PATCH 25/28] chore: bump @intersect.mbo/pdf-ui to v0.5.3 --- CHANGELOG.md | 1 + govtool/frontend/package-lock.json | 8 ++++---- govtool/frontend/package.json | 2 +- govtool/frontend/yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 18a842949..8079fcebf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ changes. ### Changed - Bump cardano-db-sync to 13.6.0.4 [Issue 2411](https://github.com/IntersectMBO/govtool/issues/2411) +- Bump @intersect.mbo/pdf-ui to v0.5.3 ### Removed diff --git a/govtool/frontend/package-lock.json b/govtool/frontend/package-lock.json index 200ada00e..2dbd8273b 100644 --- a/govtool/frontend/package-lock.json +++ b/govtool/frontend/package-lock.json @@ -14,7 +14,7 @@ "@emurgo/cardano-serialization-lib-asmjs": "^13.1.0", "@hookform/resolvers": "^3.3.1", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", - "@intersect.mbo/pdf-ui": "^0.5.2", + "@intersect.mbo/pdf-ui": "^0.5.3", "@mui/icons-material": "^5.14.3", "@mui/material": "^5.14.4", "@rollup/plugin-babel": "^6.0.4", @@ -3513,9 +3513,9 @@ "license": "ISC" }, "node_modules/@intersect.mbo/pdf-ui": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.2.tgz", - "integrity": "sha512-zKPL3p+rve8GKDlDd9EozvVs/TDnCP6dDOLySeNndaiXaRw32QBdAOt5pSHaE0NGymKahlVV2QwO2vFNiawopA==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.3.tgz", + "integrity": "sha512-wPxOATgCOiwqQtf6iW7fUzmBt+DbpZDWn4bfMfdvCQbDbhT8qr9FUuCZWUU+RifzowQOCibMlN1PB9BkkFaiOQ==", "dependencies": { "@emurgo/cardano-serialization-lib-asmjs": "^12.0.0-beta.2", "@fontsource/poppins": "^5.0.14", diff --git a/govtool/frontend/package.json b/govtool/frontend/package.json index 3144989d1..014d20102 100644 --- a/govtool/frontend/package.json +++ b/govtool/frontend/package.json @@ -28,7 +28,7 @@ "@emurgo/cardano-serialization-lib-asmjs": "^13.1.0", "@hookform/resolvers": "^3.3.1", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", - "@intersect.mbo/pdf-ui": "^0.5.2", + "@intersect.mbo/pdf-ui": "^0.5.3", "@mui/icons-material": "^5.14.3", "@mui/material": "^5.14.4", "@rollup/plugin-babel": "^6.0.4", diff --git a/govtool/frontend/yarn.lock b/govtool/frontend/yarn.lock index dd3772103..74de6b1fd 100644 --- a/govtool/frontend/yarn.lock +++ b/govtool/frontend/yarn.lock @@ -1536,10 +1536,10 @@ resolved "https://registry.npmjs.org/@intersect.mbo/intersectmbo.org-icons-set/-/intersectmbo.org-icons-set-1.1.0.tgz" integrity sha512-sjKEtnK9eLYH/8kCD0YRQCms3byFA/tnSsei9NHTZbBYX9sBpeX6ErfR0sKYjOSxQOxl4FumX9D0X+vHIqxo8g== -"@intersect.mbo/pdf-ui@^0.5.2": - version "0.5.2" - resolved "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.2.tgz" - integrity sha512-zKPL3p+rve8GKDlDd9EozvVs/TDnCP6dDOLySeNndaiXaRw32QBdAOt5pSHaE0NGymKahlVV2QwO2vFNiawopA== +"@intersect.mbo/pdf-ui@^0.5.3": + version "0.5.3" + resolved "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.3.tgz" + integrity sha512-wPxOATgCOiwqQtf6iW7fUzmBt+DbpZDWn4bfMfdvCQbDbhT8qr9FUuCZWUU+RifzowQOCibMlN1PB9BkkFaiOQ== dependencies: "@emurgo/cardano-serialization-lib-asmjs" "^12.0.0-beta.2" "@fontsource/poppins" "^5.0.14" From 7f79d600ff0ee54505df0d0d0eb375359d88cace Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Wed, 4 Dec 2024 14:06:22 +0100 Subject: [PATCH 26/28] fix(#2417): fix broken guides links --- CHANGELOG.md | 1 + README.md | 2 +- docs/architecture/README.md | 2 +- .../molecules/DataMissingInfoBox.tsx | 7 ++--- .../organisms/AutomatedVotingOptions.tsx | 11 ++----- .../StorageInformation.tsx | 5 ++-- .../StoreDataInfo.tsx | 6 ++-- .../DashboardCards/DRepDashboardCard.tsx | 11 ++----- .../DashboardCards/DelegateDashboardCard.tsx | 6 ++-- .../DirectVoterDashboardCard.tsx | 11 ++----- .../ListGovActionsDashboardCard.tsx | 6 ++-- .../ProposeGovActionDashboardCard.tsx | 6 ++-- .../src/components/organisms/DrawerMobile.tsx | 6 ++-- .../EditDRepStorageInformation.tsx | 5 ++-- .../EditDRepStoreDataInfo.tsx | 6 ++-- .../src/components/organisms/Footer.tsx | 6 ++-- .../src/components/organisms/HomeCards.tsx | 18 ++++-------- .../organisms/Modal/ChooseWalletModal.tsx | 7 ++--- .../DRepStorageInformation.tsx | 5 ++-- .../RegisterAsDRepSteps/DRepStoreDataInfo.tsx | 6 ++-- .../RolesAndResponsibilities.tsx | 6 ++-- .../src/components/organisms/TopBanners.tsx | 3 +- .../VoteContextStoringInformation.tsx | 5 ++-- .../VoteContext/VoteContextTerms.tsx | 6 ++-- govtool/frontend/src/consts/links.ts | 29 +++++++++++++++++++ govtool/frontend/src/consts/navItems.tsx | 9 +++--- 26 files changed, 85 insertions(+), 106 deletions(-) create mode 100644 govtool/frontend/src/consts/links.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 8079fcebf..9e5b15b7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ changes. - Fix inconsistent voting status [Issue 1713](https://github.com/IntersectMBO/govtool/issues/1713) - Fix removing a child (link) when is not registed in DOM [Issue 2398](https://github.com/IntersectMBO/govtool/issues/2398) - Fix blank screen on DRep delegation when UTXos are missing [Issue 2408](https://github.com/IntersectMBO/govtool/issues/2408) +- Fix broken guides links [Issue 2417](https://github.com/IntersectMBO/govtool/issues/2417) ### Changed diff --git a/README.md b/README.md index db07e081c..27388fa33 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ The Cardano GovTool enables ada holders to experience the governance features de ### Documentation -Learn more; [docs.gov.tools](https://docs.gov.tools/). +Learn more; [docs.gov.tools](https://docs.gov.tools/cardano-govtool/using-govtool). ## 📍 Navigation diff --git a/docs/architecture/README.md b/docs/architecture/README.md index 66689da9c..8a74d4f8a 100644 --- a/docs/architecture/README.md +++ b/docs/architecture/README.md @@ -23,7 +23,7 @@ utility backend that serves validation of the governance actions metadata. # Description -Frontend is a React application using Vite as a built tool to enhance development speed and optimize production builds. Frontend interacts with the backend service via REST API and with the Cardano blockchain via cardano-serialization-lib and connected supported wallets (for the list of compatible wallets go [here](https://docs.gov.tools/how-to-use-the-govtool/getting-started/get-a-compatible-wallet)). +Frontend is a React application using Vite as a built tool to enhance development speed and optimize production builds. Frontend interacts with the backend service via REST API and with the Cardano blockchain via cardano-serialization-lib and connected supported wallets (for the list of compatible wallets go [here](https://docs.gov.tools/cardano-govtool/using-govtool/getting-started/compatible-wallets)). # Components diff --git a/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx b/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx index 2f5c190c5..4e0deb8ca 100644 --- a/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx +++ b/govtool/frontend/src/components/molecules/DataMissingInfoBox.tsx @@ -4,6 +4,7 @@ import { Typography } from "@atoms"; import { useTranslation } from "@hooks"; import { MetadataValidationStatus } from "@models"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; export const DataMissingInfoBox = ({ isDataMissing, @@ -78,11 +79,7 @@ export const DataMissingInfoBox = ({ {gaMetadataErrorDescription} - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/drep-error-conditions", - ) - } + onClick={() => openInNewTab(LINKS.DREP_ERROR_CONDITIONS)} sx={{ fontFamily: "Poppins", fontSize: "16px", diff --git a/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx b/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx index 4b84380e8..acfcf7c33 100644 --- a/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx +++ b/govtool/frontend/src/components/organisms/AutomatedVotingOptions.tsx @@ -16,6 +16,7 @@ import { AutomatedVotingOptionCurrentDelegation, AutomatedVotingOptionDelegationId, } from "@/types/automatedVotingOptions"; +import { LINKS } from "@/consts/links"; type AutomatedVotingOptionsProps = { currentDelegation?: string | null; @@ -118,11 +119,7 @@ export const AutomatedVotingOptions = ({ onClickDelegate={() => delegate(AutomatedVotingOptionDelegationId.abstain) } - onClickInfo={() => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/delegating/abstain-from-every-vote", - ) - } + onClickInfo={() => openInNewTab(LINKS.ABSTAIN_FROM_EVERY_VOTE)} title={ isDelegatedToAbstain ? t("dRepDirectory.delegatedToAbstainTitle", { @@ -162,9 +159,7 @@ export const AutomatedVotingOptions = ({ delegate(AutomatedVotingOptionDelegationId.no_confidence) } onClickInfo={() => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/delegating/signal-no-confidence-on-every-vote", - ) + openInNewTab(LINKS.SIGNAL_NO_CONFIDENCE_ON_EVERY_VOTE) } title={ isDelegatedToNoConfidence diff --git a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx index 0252327d0..7deecc45d 100644 --- a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx +++ b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StorageInformation.tsx @@ -17,6 +17,7 @@ import { isValidURLLength, openInNewTab, } from "@utils"; +import { LINKS } from "@/consts/links"; type StorageInformationProps = { setStep: Dispatch>; @@ -39,9 +40,7 @@ export const StorageInformation = ({ setStep }: StorageInformationProps) => { const fileName = getValues("governance_action_type") as string; const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isActionButtonDisabled = !watch("storingURL") || !!errors.storingURL; diff --git a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx index 9beb1f9e1..1dc5da480 100644 --- a/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx +++ b/govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/StoreDataInfo.tsx @@ -10,6 +10,7 @@ import { import { CenteredBoxBottomButtons } from "@molecules"; import { ControlledField } from "@organisms"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type StoreDataInfoProps = { setStep: Dispatch>; @@ -20,10 +21,7 @@ export const StoreDataInfo = ({ setStep }: StoreDataInfoProps) => { const { control, errors, watch } = useCreateGovernanceActionForm(); const { isMobile } = useScreenDimension(); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isContinueDisabled = !watch("storeData"); diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx index b9c4338f7..bd9908734 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/DRepDashboardCard.tsx @@ -11,6 +11,7 @@ import { DashboardActionCardProps, } from "@molecules"; import { correctAdaFormat, openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type DRepDashboardCardProps = { dRepID: string; @@ -37,10 +38,7 @@ export const DRepDashboardCard = ({ const learnMoreButton = { children: t("learnMore"), dataTestId: "d-rep-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/register-as-a-drep", - ), + onClick: () => openInNewTab(LINKS.REGISTER_AS_A_DREP), }; const navigateToDrepDirectory = () => { @@ -130,10 +128,7 @@ export const DRepDashboardCard = ({ ? { children: t("learnMore"), dataTestId: "register-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/retire-as-a-drep", - ), + onClick: () => openInNewTab(LINKS.RETIRE_AS_A_DREP), } : learnMoreButton, ]; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx index 16459cd0b..b4a13d090 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/DelegateDashboardCard.tsx @@ -20,6 +20,7 @@ import { AutomatedVotingOptionCurrentDelegation, AutomatedVotingOptionDelegationId, } from "@/types/automatedVotingOptions"; +import { LINKS } from "@/consts/links"; type DelegateDashboardCardProps = { currentDelegation: CurrentDelegation; @@ -45,10 +46,7 @@ export const DelegateDashboardCard = ({ const learnMoreButton = { children: t("learnMore"), dataTestId: "delegate-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/how-to-use-the-govtool/using-govtool/delegating", - ), + onClick: () => openInNewTab(LINKS.DELEGATING), sx: { backgroundColor: "arcticWhite" }, }; diff --git a/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx index a32e9a2f9..386aca6d4 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/DirectVoterDashboardCard.tsx @@ -8,6 +8,7 @@ import { useTranslation } from "@hooks"; import { VoterInfo } from "@models"; import { DashboardActionCard, DashboardActionCardProps } from "@molecules"; import { correctAdaFormat, openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type DirectVoterDashboardCardProps = { pendingTransaction: PendingTransaction; @@ -29,10 +30,7 @@ export const DirectVoterDashboardCard = ({ const learnMoreButton: LoadingButtonProps = { children: t("learnMore"), dataTestId: "direct-voter-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/direct-voting", - ), + onClick: () => openInNewTab(LINKS.DIRECT_VOTING), }; const cardProps: Partial = (() => { @@ -96,10 +94,7 @@ export const DirectVoterDashboardCard = ({ { children: t("learnMore"), dataTestId: "learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/direct-voting", - ), + onClick: () => openInNewTab(LINKS.DIRECT_VOTING), }, ], description: ( diff --git a/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx index 00973c58d..eb59c26c5 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/ListGovActionsDashboardCard.tsx @@ -4,6 +4,7 @@ import { IMAGES, PATHS } from "@consts"; import { useTranslation } from "@hooks"; import { DashboardActionCard } from "@molecules"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; export const ListGovActionsDashboardCards = () => { const navigate = useNavigate(); @@ -21,10 +22,7 @@ export const ListGovActionsDashboardCards = () => { { children: t("learnMore"), dataTestId: "list-gov-actions-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/governance-actions/view-governance-actions", - ), + onClick: () => openInNewTab(LINKS.VIEW_GOVERNANCE_ACTIONS), variant: "outlined", }, ]} diff --git a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx b/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx index 46191b137..165da2787 100644 --- a/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx +++ b/govtool/frontend/src/components/organisms/DashboardCards/ProposeGovActionDashboardCard.tsx @@ -6,6 +6,7 @@ import { useTranslation } from "@hooks"; import { DashboardActionCard } from "@molecules"; import { openInNewTab } from "@utils"; import { useCallback } from "react"; +import { LINKS } from "@/consts/links"; type ProposeGovActionDashboardCardProps = { createGovActionTx: PendingTransaction["createGovAction"]; @@ -52,10 +53,7 @@ export const ProposeGovActionDashboardCard = ({ { children: t("learnMore"), dataTestId: "propose-gov-action-learn-more-button", - onClick: () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/governance-actions/propose-a-governance-action", - ), + onClick: () => openInNewTab(LINKS.PROPOSE_A_GOVERNANCE_ACTION), }, ]} description={t("dashboard.cards.proposeGovernanceAction.description")} diff --git a/govtool/frontend/src/components/organisms/DrawerMobile.tsx b/govtool/frontend/src/components/organisms/DrawerMobile.tsx index b2e107da9..dd48651a0 100644 --- a/govtool/frontend/src/components/organisms/DrawerMobile.tsx +++ b/govtool/frontend/src/components/organisms/DrawerMobile.tsx @@ -7,6 +7,7 @@ import { useFeatureFlag, useModal } from "@context"; import { openInNewTab } from "@utils"; import { DrawerMobileProps } from "./types"; +import { LINKS } from "@/consts/links"; const DRAWER_PADDING = 2; const CALCULATED_DRAWER_PADDING = DRAWER_PADDING * 8 * 2; @@ -21,10 +22,7 @@ export const DrawerMobile = ({ const { openModal } = useModal(); const { t } = useTranslation(); - const onClickHelp = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/support#for-support-you-can-reach-the-team-on-the-intersect-discord-server-at", - ); + const onClickHelp = () => openInNewTab(LINKS.SUPPORT); return ( >; @@ -35,9 +36,7 @@ export const EditDRepStorageInformation = ({ const fileName = getValues("givenName"); const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isActionButtonDisabled = !watch("storingURL") || !!errors.storingURL; diff --git a/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx b/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx index e7fe54d7e..065e8e9e8 100644 --- a/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx +++ b/govtool/frontend/src/components/organisms/EditDRepInfoSteps/EditDRepStoreDataInfo.tsx @@ -11,6 +11,7 @@ import { import { openInNewTab } from "@utils"; import { ControlledField } from ".."; +import { LINKS } from "@/consts/links"; export const EditDRepStoreDataInfo = ({ setStep, @@ -27,10 +28,7 @@ export const EditDRepStoreDataInfo = ({ const isContinueDisabled = !watch("storeData"); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); return ( <> diff --git a/govtool/frontend/src/components/organisms/Footer.tsx b/govtool/frontend/src/components/organisms/Footer.tsx index 79f037d8e..84b1e063d 100644 --- a/govtool/frontend/src/components/organisms/Footer.tsx +++ b/govtool/frontend/src/components/organisms/Footer.tsx @@ -5,6 +5,7 @@ import { ICONS } from "@consts"; import { useUsersnapApi } from "@context"; import { useScreenDimension, useTranslation } from "@hooks"; import { openInNewTab, testIdFromLabel } from "@utils"; +import { LINKS } from "@/consts/links"; type FooterLinkProps = { label: string; @@ -34,10 +35,7 @@ export const Footer = () => { const { t } = useTranslation(); const { openFeedbackWindow } = useUsersnapApi(); - const onClickHelp = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/support#for-support-you-can-reach-the-team-on-the-intersect-discord-server-at", - ); + const onClickHelp = () => openInNewTab(LINKS.SUPPORT); const onClickPrivacyPolicy = () => openInNewTab( diff --git a/govtool/frontend/src/components/organisms/HomeCards.tsx b/govtool/frontend/src/components/organisms/HomeCards.tsx index 59c97b252..8cc1e63f2 100644 --- a/govtool/frontend/src/components/organisms/HomeCards.tsx +++ b/govtool/frontend/src/components/organisms/HomeCards.tsx @@ -7,6 +7,7 @@ import { useFeatureFlag, useModal } from "@context"; import { ActionCard } from "@molecules"; import { useTranslation } from "@hooks"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; export const HomeCards = () => { const { isProposalDiscussionForumEnabled } = useFeatureFlag(); @@ -26,25 +27,16 @@ export const HomeCards = () => { [openModal], ); - const onClickLearnMoreAboutDelegation = () => - openInNewTab( - "https://docs.gov.tools/how-to-use-the-govtool/using-govtool/delegating", - ); + const onClickLearnMoreAboutDelegation = () => openInNewTab(LINKS.DELEGATING); const onClickLearnMoreAboutDRepRegistration = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps/register-as-a-drep", - ); + openInNewTab(LINKS.REGISTER_AS_A_DREP); const onClickLearnMoreAboutDirectVoterRegistration = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/direct-voting", - ); + openInNewTab(LINKS.DIRECT_VOTING); const onClickLearnMoreAboutProposingGovAction = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/governance-actions/governance-actions/propose-a-governance-action", - ); + openInNewTab(LINKS.PROPOSE_A_GOVERNANCE_ACTION); const navigateToGovActions = useCallback( () => navigate(PATHS.governanceActions), diff --git a/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx b/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx index 87a2ed712..16acd5cfa 100644 --- a/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx +++ b/govtool/frontend/src/components/organisms/Modal/ChooseWalletModal.tsx @@ -8,6 +8,7 @@ import { WalletOptionButton } from "@molecules"; import { openInNewTab } from "@utils"; import { useTranslation } from "@hooks"; import { To } from "react-router-dom"; +import { LINKS } from "@/consts/links"; type ChooseWalletModalState = { pathToNavigate?: To; @@ -105,11 +106,7 @@ export const ChooseWalletModal = forwardRef((_, ref) => { - openInNewTab( - "https://docs.gov.tools/how-to-use-the-govtool/getting-started/get-a-compatible-wallet", - ) - } + onClick={() => openInNewTab(LINKS.COMPATIBLE_WALLETS)} sx={{ cursor: "pointer" }} > {t("here")} diff --git a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx index c36e73667..ab52f9882 100644 --- a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx +++ b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStorageInformation.tsx @@ -12,6 +12,7 @@ import { import { CenteredBoxBottomButtons, Step } from "@molecules"; import { ControlledField } from "@organisms"; import { openInNewTab, ellipsizeText } from "@utils"; +import { LINKS } from "@/consts/links"; type StorageInformationProps = { setStep: Dispatch>; @@ -36,9 +37,7 @@ export const DRepStorageInformation = ({ const fileName = getValues("givenName"); const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isActionButtonDisabled = !watch("storingURL") || !!errors.storingURL; diff --git a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx index a05696d7c..e8c31eff1 100644 --- a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx +++ b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/DRepStoreDataInfo.tsx @@ -11,6 +11,7 @@ import { import { openInNewTab } from "@utils"; import { ControlledField } from ".."; +import { LINKS } from "@/consts/links"; export const DRepStoreDataInfo = ({ setStep, @@ -27,10 +28,7 @@ export const DRepStoreDataInfo = ({ const onClickContinue = () => setStep(4); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); return ( <> diff --git a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx index a87883656..932bfe73f 100644 --- a/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx +++ b/govtool/frontend/src/components/organisms/RegisterAsDRepSteps/RolesAndResponsibilities.tsx @@ -11,6 +11,7 @@ import { openInNewTab, PROTOCOL_PARAMS_KEY, } from "@utils"; +import { LINKS } from "@/consts/links"; export const RolesAndResponsibilities = ({ setStep, @@ -24,10 +25,7 @@ export const RolesAndResponsibilities = ({ const onClickContinue = () => setStep(2); - const openLearnMoreAboutDrep = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/dreps", - ); + const openLearnMoreAboutDrep = () => openInNewTab(LINKS.DREPS); return ( <> diff --git a/govtool/frontend/src/components/organisms/TopBanners.tsx b/govtool/frontend/src/components/organisms/TopBanners.tsx index 332a2c440..e27b8138d 100644 --- a/govtool/frontend/src/components/organisms/TopBanners.tsx +++ b/govtool/frontend/src/components/organisms/TopBanners.tsx @@ -1,6 +1,7 @@ import { Box, Link, Typography } from "@mui/material"; import { Trans, useTranslation } from "react-i18next"; import { useAppContext } from "@/context"; +import { LINKS } from "@/consts/links"; export const TopBanners = () => { const { isMainnet, networkName, isInBootstrapPhase, isAppInitializing } = @@ -60,7 +61,7 @@ export const TopBanners = () => { components={{ docs: ( >; @@ -35,9 +36,7 @@ export const VoteContextStoringInformation = ({ } = useVoteContextForm(setSavedHash, setStep, setErrorMessage); const openGuideAboutStoringInformation = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isContinueDisabled = !watch("storingURL"); diff --git a/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx b/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx index a98a948c8..d59d1af38 100644 --- a/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx +++ b/govtool/frontend/src/components/organisms/VoteContext/VoteContextTerms.tsx @@ -5,6 +5,7 @@ import { Spacer, Typography } from "@atoms"; import { useScreenDimension, useTranslation, useVoteContextForm } from "@hooks"; import { ControlledField, VoteContextWrapper } from "@organisms"; import { openInNewTab } from "@utils"; +import { LINKS } from "@/consts/links"; type StoreDataInfoProps = { setStep: Dispatch>; @@ -16,10 +17,7 @@ export const VoteContextTerms = ({ setStep, onCancel }: StoreDataInfoProps) => { const { control, errors, watch } = useVoteContextForm(); const { isMobile } = useScreenDimension(); - const openLink = () => - openInNewTab( - "https://docs.gov.tools/using-govtool/govtool-functions/storing-information-offline", - ); + const openLink = () => openInNewTab(LINKS.STORING_INFORMATION_OFFLINE); const isContinueDisabled = !watch("terms"); diff --git a/govtool/frontend/src/consts/links.ts b/govtool/frontend/src/consts/links.ts new file mode 100644 index 000000000..c053c3001 --- /dev/null +++ b/govtool/frontend/src/consts/links.ts @@ -0,0 +1,29 @@ +export const LINKS = { + USING_GOVTOOL: "https://docs.gov.tools/cardano-govtool/using-govtool", + COMPATIBLE_WALLETS: + "https://docs.gov.tools/cardano-govtool/using-govtool/getting-started/compatible-wallets", + FAQS: "https://docs.gov.tools/cardano-govtool/faqs", + SUPPORT: "https://docs.gov.tools/cardano-govtool/support", + DREP_ERROR_CONDITIONS: + "https://docs.gov.tools/cardano-govtool/using-govtool/dreps/drep-error-conditions", + ABSTAIN_FROM_EVERY_VOTE: + "https://docs.gov.tools/cardano-govtool/using-govtool/delegating/abstain-from-every-vote", + SIGNAL_NO_CONFIDENCE_ON_EVERY_VOTE: + "https://docs.gov.tools/cardano-govtool/using-govtool/delegating/signal-no-confidence-on-every-vote", + REGISTER_AS_A_DREP: + "https://docs.gov.tools/cardano-govtool/using-govtool/dreps/register-as-a-drep", + PROPOSE_A_GOVERNANCE_ACTION: + "https://docs.gov.tools/cardano-govtool/using-govtool/governance-actions/propose-a-governance-action", + BOOTSTRAPPING_PHASE: + "https://docs.gov.tools/cardano-govtool/faqs/bootstrapping-phase", + STORING_INFORMATION_OFFLINE: + "https://docs.gov.tools/cardano-govtool/using-govtool/storing-information-offline", + DELEGATING: "https://docs.gov.tools/cardano-govtool/using-govtool/delegating", + DIRECT_VOTING: + "https://docs.gov.tools/cardano-govtool/using-govtool/direct-voting", + RETIRE_AS_A_DREP: + "https://docs.gov.tools/cardano-govtool/using-govtool/dreps/retire-as-a-drep", + VIEW_GOVERNANCE_ACTIONS: + "https://docs.gov.tools/cardano-govtool/using-govtool/governance-actions/view-governance-actions", + DREPS: "https://docs.gov.tools/cardano-govtool/using-govtool/dreps", +}; diff --git a/govtool/frontend/src/consts/navItems.tsx b/govtool/frontend/src/consts/navItems.tsx index c544fff52..74795d562 100644 --- a/govtool/frontend/src/consts/navItems.tsx +++ b/govtool/frontend/src/consts/navItems.tsx @@ -3,6 +3,7 @@ import i18n from "@/i18n"; import { theme } from "@/theme"; import { ICONS } from "./icons"; +import { LINKS } from "./links"; import { PATHS, PDF_PATHS } from "./paths"; export const NAV_ITEMS = [ @@ -33,13 +34,13 @@ export const NAV_ITEMS = [ dataTestId: "guides-link", navTo: "", label: i18n.t("menu.guides"), - newTabLink: "https://docs.gov.tools/", + newTabLink: LINKS.USING_GOVTOOL, }, { dataTestId: "faqs-link", navTo: "", label: i18n.t("menu.faqs"), - newTabLink: "https://docs.gov.tools/faqs", + newTabLink: LINKS.FAQS, }, ]; @@ -95,7 +96,7 @@ export const CONNECTED_NAV_ITEMS = [ navTo: "", activeIcon: ICONS.guidesActiveIcon, icon: ICONS.guidesIcon, - newTabLink: "https://docs.gov.tools/", + newTabLink: LINKS.USING_GOVTOOL, }, { dataTestId: "faqs-link", @@ -103,6 +104,6 @@ export const CONNECTED_NAV_ITEMS = [ navTo: "", activeIcon: ICONS.faqsActiveIcon, icon: ICONS.faqsIcon, - newTabLink: "https://docs.gov.tools/faqs", + newTabLink: LINKS.FAQS, }, ]; From a2a19cc19e36943a9973093d9dff6c6332680502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Thu, 5 Dec 2024 13:25:44 +0100 Subject: [PATCH 27/28] chore: bump @intersect.mbo/pdf-ui to v0.5.4 --- CHANGELOG.md | 1 + govtool/frontend/package-lock.json | 8 ++++---- govtool/frontend/package.json | 2 +- govtool/frontend/yarn.lock | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e5b15b7a..0181a9224 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ changes. - Bump cardano-db-sync to 13.6.0.4 [Issue 2411](https://github.com/IntersectMBO/govtool/issues/2411) - Bump @intersect.mbo/pdf-ui to v0.5.3 +- Bump @intersect.mbo/pdf-ui to v0.5.4 ### Removed diff --git a/govtool/frontend/package-lock.json b/govtool/frontend/package-lock.json index 2dbd8273b..a0b5f3816 100644 --- a/govtool/frontend/package-lock.json +++ b/govtool/frontend/package-lock.json @@ -14,7 +14,7 @@ "@emurgo/cardano-serialization-lib-asmjs": "^13.1.0", "@hookform/resolvers": "^3.3.1", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", - "@intersect.mbo/pdf-ui": "^0.5.3", + "@intersect.mbo/pdf-ui": "^0.5.4", "@mui/icons-material": "^5.14.3", "@mui/material": "^5.14.4", "@rollup/plugin-babel": "^6.0.4", @@ -3513,9 +3513,9 @@ "license": "ISC" }, "node_modules/@intersect.mbo/pdf-ui": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.3.tgz", - "integrity": "sha512-wPxOATgCOiwqQtf6iW7fUzmBt+DbpZDWn4bfMfdvCQbDbhT8qr9FUuCZWUU+RifzowQOCibMlN1PB9BkkFaiOQ==", + "version": "0.5.4", + "resolved": "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.4.tgz", + "integrity": "sha512-QKaI+0C52/YAagkrRKzQQ/X2DwOHPovappEgeUXmVecvLzbVoJpKY9zGo5sNzmdu5qkYnE5/yIWbHZGVPpbvBA==", "dependencies": { "@emurgo/cardano-serialization-lib-asmjs": "^12.0.0-beta.2", "@fontsource/poppins": "^5.0.14", diff --git a/govtool/frontend/package.json b/govtool/frontend/package.json index 014d20102..2a032a827 100644 --- a/govtool/frontend/package.json +++ b/govtool/frontend/package.json @@ -28,7 +28,7 @@ "@emurgo/cardano-serialization-lib-asmjs": "^13.1.0", "@hookform/resolvers": "^3.3.1", "@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8", - "@intersect.mbo/pdf-ui": "^0.5.3", + "@intersect.mbo/pdf-ui": "^0.5.4", "@mui/icons-material": "^5.14.3", "@mui/material": "^5.14.4", "@rollup/plugin-babel": "^6.0.4", diff --git a/govtool/frontend/yarn.lock b/govtool/frontend/yarn.lock index 74de6b1fd..b78223cc9 100644 --- a/govtool/frontend/yarn.lock +++ b/govtool/frontend/yarn.lock @@ -1536,10 +1536,10 @@ resolved "https://registry.npmjs.org/@intersect.mbo/intersectmbo.org-icons-set/-/intersectmbo.org-icons-set-1.1.0.tgz" integrity sha512-sjKEtnK9eLYH/8kCD0YRQCms3byFA/tnSsei9NHTZbBYX9sBpeX6ErfR0sKYjOSxQOxl4FumX9D0X+vHIqxo8g== -"@intersect.mbo/pdf-ui@^0.5.3": - version "0.5.3" - resolved "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.3.tgz" - integrity sha512-wPxOATgCOiwqQtf6iW7fUzmBt+DbpZDWn4bfMfdvCQbDbhT8qr9FUuCZWUU+RifzowQOCibMlN1PB9BkkFaiOQ== +"@intersect.mbo/pdf-ui@^0.5.4": + version "0.5.4" + resolved "https://registry.npmjs.org/@intersect.mbo/pdf-ui/-/pdf-ui-0.5.4.tgz" + integrity sha512-QKaI+0C52/YAagkrRKzQQ/X2DwOHPovappEgeUXmVecvLzbVoJpKY9zGo5sNzmdu5qkYnE5/yIWbHZGVPpbvBA== dependencies: "@emurgo/cardano-serialization-lib-asmjs" "^12.0.0-beta.2" "@fontsource/poppins" "^5.0.14" From 1c40094825424e9b06bba25f7f3f203e6bce7b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sza=C5=82owski?= Date: Thu, 5 Dec 2024 15:35:10 +0100 Subject: [PATCH 28/28] chore: bump GovTool to v1.0.29 --- CHANGELOG.md | 18 ++++++++++++++++++ govtool/backend/Dockerfile | 2 +- govtool/backend/Dockerfile.qovery | 2 +- govtool/backend/vva-be.cabal | 2 +- govtool/frontend/package.json | 4 ++-- govtool/metadata-validation/package.json | 2 +- govtool/metadata-validation/src/main.ts | 2 +- 7 files changed, 25 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0181a9224..f956c1c23 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,24 @@ changes. ### Added +- + +### Fixed + +- + +### Changed + +- + +### Removed + +- + +## [v1.0.29](https://github.com/IntersectMBO/govtool/releases/tag/v1.0.29) 2024-12-05 + +### Added + - Add support for displaying CIP-119 DRep images [Issue 1806](https://github.com/IntersectMBO/govtool/issues/1806) ### Fixed diff --git a/govtool/backend/Dockerfile b/govtool/backend/Dockerfile index 9c1fabd7f..94b48a425 100644 --- a/govtool/backend/Dockerfile +++ b/govtool/backend/Dockerfile @@ -4,4 +4,4 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG WORKDIR /src COPY . . RUN cabal build -RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.28/x/vva-be/build/vva-be/vva-be /usr/local/bin +RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.29/x/vva-be/build/vva-be/vva-be /usr/local/bin diff --git a/govtool/backend/Dockerfile.qovery b/govtool/backend/Dockerfile.qovery index f7e8fd8ba..53e825921 100644 --- a/govtool/backend/Dockerfile.qovery +++ b/govtool/backend/Dockerfile.qovery @@ -4,7 +4,7 @@ FROM $BASE_IMAGE_REPO:$BASE_IMAGE_TAG WORKDIR /src COPY . . RUN cabal build -RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.28/x/vva-be/build/vva-be/vva-be /usr/local/bin +RUN cp dist-newstyle/build/x86_64-linux/ghc-9.2.7/vva-be-1.0.29/x/vva-be/build/vva-be/vva-be /usr/local/bin # Expose the necessary port EXPOSE 9876 diff --git a/govtool/backend/vva-be.cabal b/govtool/backend/vva-be.cabal index 14c7fcb34..bfc746013 100644 --- a/govtool/backend/vva-be.cabal +++ b/govtool/backend/vva-be.cabal @@ -1,6 +1,6 @@ cabal-version: 3.6 name: vva-be -version: 1.0.28 +version: 1.0.29 -- A short (one-line) description of the package. -- synopsis: diff --git a/govtool/frontend/package.json b/govtool/frontend/package.json index 2a032a827..3df53b084 100644 --- a/govtool/frontend/package.json +++ b/govtool/frontend/package.json @@ -1,7 +1,7 @@ { "name": "@govtool/frontend", "private": true, - "version": "1.0.28", + "version": "1.0.29", "type": "module", "scripts": { "build": "vite build", @@ -108,5 +108,5 @@ "overrides": { "typescript": "^5.0.2" }, - "_id": "govtool@1.0.28" + "_id": "govtool@1.0.29" } diff --git a/govtool/metadata-validation/package.json b/govtool/metadata-validation/package.json index 4e0da8c1e..5ada02dc8 100644 --- a/govtool/metadata-validation/package.json +++ b/govtool/metadata-validation/package.json @@ -1,6 +1,6 @@ { "name": "@govtool/metadata-validation", - "version": "1.0.28", + "version": "1.0.29", "description": "", "author": "", "private": true, diff --git a/govtool/metadata-validation/src/main.ts b/govtool/metadata-validation/src/main.ts index 12ac1fcb2..c975ebc86 100644 --- a/govtool/metadata-validation/src/main.ts +++ b/govtool/metadata-validation/src/main.ts @@ -13,7 +13,7 @@ async function bootstrap() { const config = new DocumentBuilder() .setTitle('Metadata Validation Tool') .setDescription('The Metadata Validation Tool API description') - .setVersion('1.0.28') + .setVersion('1.0.29') .build(); const document = SwaggerModule.createDocument(app, config);