Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(persistence-ethereum): migrate to separate db schema #3347

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions packages/cacti-ledger-browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,6 @@ npm install
- Execute `yarn run start` or `npm start` in this package directory.
- The running application address: http://localhost:3001/ (can be changed in [Vite configuration](./vite.config.ts))

#### Sample Data

- 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`.
- Use `psql` tool to import it to your supabase postgres DB instance.
- example:

```bash
psql "postgres://postgres.DB_NAME:DB_PASS@aws-0-eu-central-1.pooler.supabase.com:5432/postgres" -f src/test/sql/sample-data.sql
```

## Contributing

We welcome contributions to Hyperledger Cacti in many forms, and there’s always plenty to do!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* @todo Move to separate directory if this file becomes too complex.
*/

import { createClient } from "@supabase/supabase-js";
import { queryOptions } from "@tanstack/react-query";
import { supabase, supabaseQueryKey } from "../../common/supabase-client";
import {
Transaction,
Block,
Expand All @@ -13,6 +13,15 @@ import {
TokenERC20,
} from "../../common/supabase-types";

// TODO - Configure for an app
const supabaseQueryKey = "supabase:ethereum";
const supabaseUrl = "__SUPABASE_URL__";
const supabaseKey = "__SUPABASE_KEY__";

export const supabase = createClient(supabaseUrl, supabaseKey, {
schema: "ethereum",
});

function createQueryKey(
tableName: string,
pagination: { page: number; pageSize: number },
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { useQuery } from "@tanstack/react-query";
import { GetStatusResponse } from "../types/app";
import { useNotification } from "../context/NotificationContext";
import { persistencePluginStatus } from "../queries";

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

React.useEffect(() => {
isError &&
showNotification(`Could get ${pluginName} status: ${error}`, "error");
isError && console.error(`Could get ${pluginName} status: ${error}`);
}, [isError]);

return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import CircularProgress from "@mui/material/CircularProgress";

import StackedRowItems from "../ui/StackedRowItems";
import { persistencePluginStatus } from "../../common/queries";
import { useNotification } from "../../common/context/NotificationContext";

type DateTimeStringProps = {
dateString: string | undefined;
Expand All @@ -31,11 +30,9 @@ export default function PersistencePluginStatus({
const { isError, isPending, data, error } = useQuery(
persistencePluginStatus(pluginName),
);
const { showNotification } = useNotification();

React.useEffect(() => {
isError &&
showNotification(`Could get ${pluginName} status: ${error}`, "error");
isError && console.error(`Could get ${pluginName} status: ${error}`);
}, [isError]);

return (
Expand Down
Loading
Loading