You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -20,8 +20,7 @@ builds with cardano-serialization-lib and the wallet signs.
20
20
21
21
Vite aliases: @ for src, plus @pages@consts@context@hooks@models@services@utils
22
22
@mock, and @atoms@molecules@organisms for src/components/*. There is no @types or
23
-
@config alias, so use @/types/... and @/config/env. Every folder has an index.ts
24
-
barrel and new files must be added to it.
23
+
@config alias, so use @/types/... and @/config/env. Many feature directories expose files through index.ts barrels. When a directory already uses a barrel, add new public exports to it; otherwise follow the surrounding direct-import pattern.
25
24
26
25
- App.tsx: the route table. Every route registers here.
27
26
- config/env.ts: the only env accessor. Reads window.__ENV__, then import.meta.env.
@@ -30,8 +29,10 @@ barrel and new files must be added to it.
30
29
- consts/queryKeys.ts: QUERY_KEYS and MUTATION_KEYS. Every new key registers here.
31
30
- consts/governanceAction/fields.ts: GA form schemas, driving both rendering and
32
31
hashing
33
-
- services/API.ts: the single axios instance, with the 500-to-error-page interceptor
34
-
- i18n/locales/en.json: all user-facing copy, about 925 lines, the only locale
32
+
- services/API.ts:is the shared Axios instance for the GovTool backend and redirects backend HTTP 500 responses to the error
33
+
page.Metadata validation uses a separate Axios client because it has a separate base URL.
34
+
- i18n/locales/en.json: is the only locale and should be the source of new user-facing copy. Some existing hardcoded strings
35
+
remain.
35
36
- components: atomic design. atoms have no GovTool dependencies, molecules compose
36
37
atoms without fetching, organisms are feature blocks that may use contexts and hooks.
37
38
@@ -46,9 +47,8 @@ Contexts in src/context:
46
47
vote totals show for which GA type
47
48
- pendingTransaction: in-flight txs, so the UI can poll /transaction/status/:txId
48
49
- governanceAction.tsx: GA list and detail state
49
-
- contextProviders.tsx composes all of them. modal, snackbar, pagination and
50
-
dataActionsBar are UI plumbing; adaHandle, usersnap and proposalDiscussion are
51
-
integrations.
50
+
- contextProviders.tsx: composes the main application providers. ChatwootProvider is mounted separately in main.tsx, and
51
+
pending-transaction state is integrated through the wallet context.
52
52
53
53
## govtool/backend
54
54
@@ -91,34 +91,105 @@ into SQL and cache the result rather than holding a connection.
91
91
92
92
## govtool/metadata-validation
93
93
94
-
NestJS. One job: fetch metadata at a URL, canonize the JSON-LD, hash it, validate the
95
-
body against a CIP standard. POST /validate is in app.controller.ts, orchestration in
96
-
app.service.ts, rules in utils/getStandard.ts, utils/validateCIP108body.ts and
97
-
utils/validateMetadataStandard.ts. enums/ValidationError.ts holds the error codes the
98
-
frontend switches on, so grep the frontend before renaming one.
94
+
A NestJS service that validates off-chain metadata. It fetches metadata from a URL,
95
+
parses the JSON, accepts a supplied CIP standard or attempts to identify CIP-108 or
96
+
CIP-119, validates the required fields for a recognized standard, and compares a
97
+
Blake2b-256 hash of the exact fetched content with the submitted hash.
99
98
100
-
utils/canonizeJSON.ts is duplicated at govtool/frontend/src/utils/canonizeJSON.ts and
101
-
must behave identically: the frontend hashes metadata before submission and this
102
-
service re-hashes it. Change one, change both.
99
+
POST /validate is defined in app.controller.ts, orchestration is handled by
100
+
app.service.ts, and validation logic lives in utils/getStandard.ts,
101
+
utils/validateCIP108body.ts, and utils/validateMetadataStandard.ts.
102
+
enums/ValidationError.ts defines the validation statuses consumed by the frontend,
103
+
so check frontend usage before renaming or removing one.
104
+
105
+
Both metadata validation and the frontend contain utils/canonizeJSON.ts. The
106
+
metadata-validation copy is currently unused by the production validation flow. The
107
+
frontend uses canonicalization for signature verification, not for the metadata hash submitted to POST /validate.
103
108
104
109
## Environment variables
105
110
106
-
Frontend. .env.example, src/config/env.ts and docker-entrypoint.sh must all agree.
107
-
108
-
- VITE_BASE_URL: backend REST base URL
109
-
- VITE_METADATA_API_URL: metadata-validation service
0 commit comments