@macalinao/grill
Version:
Modern Solana development kit for React applications with automatic account batching, caching, and transaction notifications
21 lines • 673 B
JavaScript
import { createPdaQueryKey } from "../query-keys.js";
/**
* Creates a query configuration for computing a PDA
*/
export function createPdaQuery(pdaFn, queryKeyPrefix, args) {
return {
queryKey: createPdaQueryKey(queryKeyPrefix, args),
queryFn: async () => {
if (!args) {
return null;
}
const [pda] = await pdaFn(args);
return pda;
},
enabled: args !== undefined,
// PDAs are deterministic, so we can cache them indefinitely
staleTime: Number.POSITIVE_INFINITY,
gcTime: Number.POSITIVE_INFINITY,
};
}
//# sourceMappingURL=pda-query-utils.js.map