Added txinfo service

pull/43/head
yhtiyar 2021-08-02 15:10:41 +03:00
rodzic 89524bb238
commit dc697028d0
2 zmienionych plików z 32 dodań i 0 usunięć

Wyświetl plik

@ -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;

Wyświetl plik

@ -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
})
}