forked from Prompt-Hash-Stellar/prompt-hash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuseCheckTxSignatures.ts
More file actions
36 lines (34 loc) · 805 Bytes
/
Copy pathuseCheckTxSignatures.ts
File metadata and controls
36 lines (34 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { useQuery } from "@tanstack/react-query";
import { fetchTxSignatures } from "../util/fetchTxSignatures";
import { NetworkHeaders } from "../types/types";
export const useCheckTxSignatures = ({
xdr,
networkPassphrase,
networkUrl,
headers,
}: {
xdr: string;
networkPassphrase: string;
networkUrl: string;
headers: NetworkHeaders;
}) => {
const query = useQuery({
queryKey: ["tx", "signatures"],
queryFn: async () => {
try {
return await fetchTxSignatures({
txXdr: xdr,
networkPassphrase,
networkUrl,
headers,
});
} catch (e) {
throw new Error(
`There was a problem checking transaction signatures: ${e as Error}`,
);
}
},
enabled: false,
});
return query;
};