diff --git a/backend/moonstream/api.py b/backend/moonstream/api.py index 60429dec..4881fa94 100644 --- a/backend/moonstream/api.py +++ b/backend/moonstream/api.py @@ -42,3 +42,4 @@ async def version_handler() -> data.VersionResponse: app.mount("/subscriptions", subscriptions_api) app.mount("/users", users_api) app.mount("/streams", streams_api) +app.mount("/txinfo", txinfo_api) \ No newline at end of file diff --git a/backend/requirements.txt b/backend/requirements.txt index 9d5a15f3..ce0e1d66 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -11,7 +11,7 @@ fastapi==0.66.0 h11==0.12.0 idna==3.2 jmespath==0.10.0 --e git+https://git@github.com/bugout-dev/moonstream.git@3326379b174a626cf876c7b60dd7db8afe2daba9#egg=moonstreamdb&subdirectory=db +-e git+https://git@github.com/bugout-dev/moonstream.git@5946abb75bb91f27dbcf93dc15be205700dc7a51#egg=moonstreamdb&subdirectory=db mypy==0.910 mypy-extensions==0.4.3 pathspec==0.9.0 diff --git a/frontend/pages/stream/[entryId].js b/frontend/pages/stream/[entryId].js index a1823db0..db7517b1 100644 --- a/frontend/pages/stream/[entryId].js +++ b/frontend/pages/stream/[entryId].js @@ -42,7 +42,12 @@ const raw_transaction = { "value": 0 } } - const test = useTxInfo(raw_transaction) + async function test() { + const testt = await useTxInfo(raw_transaction) + console.log(testt) + + } + test() console.log(test) let isFetchedAfterMount = false; let isLoading = false; diff --git a/frontend/src/components/StreamEntry.js b/frontend/src/components/StreamEntry.js index f1c9fe0c..a3a7ee5e 100644 --- a/frontend/src/components/StreamEntry.js +++ b/frontend/src/components/StreamEntry.js @@ -13,7 +13,7 @@ const StreamEntry = ({ entry, filterCallback, filterConstants }) => { ui.setEntryId(entryId); ui.setEntriesViewMode("entry"); router.push({ - pathname: `/stream/${entry.id}`, + pathname: `/stream/${entry.hash}`, query: router.query, }); }; @@ -92,7 +92,7 @@ const StreamEntry = ({ entry, filterCallback, filterConstants }) => { boxSize="32px" colorScheme="primary" icon={} - onClick={() => handleViewClicked(entry.id)} + onClick={() => handleViewClicked(entry)} /> ); diff --git a/frontend/src/core/hooks/useTxInfo.js b/frontend/src/core/hooks/useTxInfo.js index 77a9bef4..ba717456 100644 --- a/frontend/src/core/hooks/useTxInfo.js +++ b/frontend/src/core/hooks/useTxInfo.js @@ -4,13 +4,14 @@ import { queryCacheProps } from "./hookCommon"; import { useToast } from "."; const useTxInfo = (transaction) => { + console.log("Use hook", transaction) const toast = useToast(); const getTxInfo = async () => { - const data = await TxInfoService.getTxInfo(transaction); - return data; + const response = await TxInfoService.getTxInfo(transaction); + return response.data; } const { data, isLoading, isFetchedAfterMount, refetch, isError, error } = - useQuery(["txinfo", {transaction}], getTxInfo, { + useQuery(["txinfo", transaction.tx.hash ], getTxInfo, { ...queryCacheProps, onError: (error) => toast(error, "error"), }); diff --git a/frontend/src/core/services/txinfo.service.js b/frontend/src/core/services/txinfo.service.js index f4825b96..6a8fdf4a 100644 --- a/frontend/src/core/services/txinfo.service.js +++ b/frontend/src/core/services/txinfo.service.js @@ -2,10 +2,9 @@ import { http } from "../utils"; const API = process.env.NEXT_PUBLIC_MOONSTREAM_API_URL; -export const getTxInfo = (tx) => { +export const getTxInfo = (tx) => http({ method: "POST", url: `${API}/txinfo/ethereum_blockchain`, - tx - }) -} \ No newline at end of file + data: tx + });