kopia lustrzana https://github.com/bugout-dev/moonstream
Merge branch 'txinfo-component' into merging-streams
commit
71cceb960b
|
@ -0,0 +1,21 @@
|
|||
import { useQuery } from "react-query";
|
||||
import { TxInfoService } from "../services";
|
||||
import { queryCacheProps } from "./hookCommon";
|
||||
import { useToast } from ".";
|
||||
|
||||
const useTxInfo = (transaction) => {
|
||||
const toast = useToast();
|
||||
const getTxInfo = async () => {
|
||||
const data = await TxInfoService.getTxInfo(transaction);
|
||||
return data;
|
||||
}
|
||||
const { data, isLoading, isFetchedAfterMount, refetch, isError, error } =
|
||||
useQuery(["txinfo", {transaction}], getTxInfo, {
|
||||
...queryCacheProps,
|
||||
onError: (error) => toast(error, "error"),
|
||||
});
|
||||
|
||||
return { data, isFetchedAfterMount, isLoading, refetch, isError, error };
|
||||
}
|
||||
|
||||
export default useTxInfo;
|
|
@ -0,0 +1,11 @@
|
|||
import { http } from "../utils";
|
||||
|
||||
const API = process.env.NEXT_PUBLIC_MOONSTREAM_API_URL;
|
||||
|
||||
export const getTxInfo = (tx) => {
|
||||
http({
|
||||
method: "POST",
|
||||
url: `${API}/txinfo/ethereum_blockchain`,
|
||||
tx
|
||||
})
|
||||
}
|
Ładowanie…
Reference in New Issue