@saberhq/sail
Version:
Account caching and batched loading for React-based Solana applications.
18 lines • 741 B
JavaScript
import { createContainer } from "unstated-next";
import { useAccountsInternal } from "./accounts/useAccountsInternal";
import { useHandleTXsInternal } from "./tx/useHandleTXs";
const defaultOnError = (err) => console.error(err.message, err);
const useSailInternal = ({ onSailError = defaultOnError, ...args } = {}) => {
const accounts = useAccountsInternal({ ...args, onError: onSailError });
const handleTXs = useHandleTXsInternal({
...args,
onError: onSailError,
refetchMany: accounts.refetchMany,
});
return {
...accounts,
...handleTXs,
};
};
export const { Provider: SailProvider, useContainer: useSail } = createContainer(useSailInternal);
//# sourceMappingURL=provider.js.map