Skip to content

Commit b160c52

Browse files
committed
feat(persistence-ethereum): migrate to separate db schema
- Move all database entities relating to ethereum persistence plugin to a seprate schema. Adjust all the files the test to work as expected after that change. - Remove sample SQL data from GUI package, one from persistence packages should be used instead. - Upgrade web3-utils in persistence-ethereum to fix a bug when running the standalone script. Depends on #3340 Signed-off-by: Michal Bajer <[email protected]>
1 parent d0e4539 commit b160c52

File tree

13 files changed

+611
-1712
lines changed

13 files changed

+611
-1712
lines changed

packages/cacti-ledger-browser/README.md

-10
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,6 @@ npm install
5252
- Execute `yarn run start` or `npm start` in this package directory.
5353
- The running application address: http://localhost:3001/ (can be changed in [Vite configuration](./vite.config.ts))
5454

55-
#### Sample Data
56-
57-
- To preview the GUI without running the persistence plugins you can use historic sample data located at `packages/cacti-ledger-browser/src/test/sql/sample-data.sql`.
58-
- Use `psql` tool to import it to your supabase postgres DB instance.
59-
- example:
60-
61-
```bash
62-
psql "postgres://postgres.DB_NAME:[email protected]:5432/postgres" -f src/test/sql/sample-data.sql
63-
```
64-
6555
## Contributing
6656

6757
We welcome contributions to Hyperledger Cacti in many forms, and there’s always plenty to do!

packages/cacti-ledger-browser/src/main/typescript/apps/eth/queries.ts

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* @todo Move to separate directory if this file becomes too complex.
44
*/
55

6+
import { createClient } from "@supabase/supabase-js";
67
import { queryOptions } from "@tanstack/react-query";
7-
import { supabase, supabaseQueryKey } from "../../common/supabase-client";
88
import {
99
Transaction,
1010
Block,
@@ -13,6 +13,15 @@ import {
1313
TokenERC20,
1414
} from "../../common/supabase-types";
1515

16+
// TODO - Configure for an app
17+
const supabaseQueryKey = "supabase:ethereum";
18+
const supabaseUrl = "__SUPABASE_URL__";
19+
const supabaseKey = "__SUPABASE_KEY__";
20+
21+
export const supabase = createClient(supabaseUrl, supabaseKey, {
22+
schema: "ethereum",
23+
});
24+
1625
function createQueryKey(
1726
tableName: string,
1827
pagination: { page: number; pageSize: number },

packages/cacti-ledger-browser/src/main/typescript/common/hook/use-persistence-app-status.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
22
import { useQuery } from "@tanstack/react-query";
33
import { GetStatusResponse } from "../types/app";
4-
import { useNotification } from "../context/NotificationContext";
54
import { persistencePluginStatus } from "../queries";
65

76
/**
@@ -13,11 +12,9 @@ export function usePersistenceAppStatus(pluginName: string): GetStatusResponse {
1312
const { isError, isPending, data, error } = useQuery(
1413
persistencePluginStatus(pluginName),
1514
);
16-
const { showNotification } = useNotification();
1715

1816
React.useEffect(() => {
19-
isError &&
20-
showNotification(`Could get ${pluginName} status: ${error}`, "error");
17+
isError && console.error(`Could get ${pluginName} status: ${error}`);
2118
}, [isError]);
2219

2320
return {

packages/cacti-ledger-browser/src/main/typescript/components/PersistencePluginStatus/PersistencePluginStatus.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import CircularProgress from "@mui/material/CircularProgress";
66

77
import StackedRowItems from "../ui/StackedRowItems";
88
import { persistencePluginStatus } from "../../common/queries";
9-
import { useNotification } from "../../common/context/NotificationContext";
109

1110
type DateTimeStringProps = {
1211
dateString: string | undefined;
@@ -31,11 +30,9 @@ export default function PersistencePluginStatus({
3130
const { isError, isPending, data, error } = useQuery(
3231
persistencePluginStatus(pluginName),
3332
);
34-
const { showNotification } = useNotification();
3533

3634
React.useEffect(() => {
37-
isError &&
38-
showNotification(`Could get ${pluginName} status: ${error}`, "error");
35+
isError && console.error(`Could get ${pluginName} status: ${error}`);
3936
}, [isError]);
4037

4138
return (

0 commit comments

Comments
 (0)