@poolzfinance/api4
v1.16.8
Published
Bridge between front and back
Readme
InterfaceAPI4
InterfaceAPI4 provides a small React wrapper around the Poolz GraphQL API. It exposes an API4Provider component and a collection of hooks for querying and mutating data.
Installation
pnpm installBuilding the package
pnpm buildRunning tests
pnpm testBasic usage
Wrap your application with API4Provider and pass it your GraphQL endpoint and a function that signs messages for authentication:
import API4Provider from "@poolzfinance/api4/dist/components/API4Provider";
const App = () => (
<API4Provider
account={address}
options={{
uri: "https://api4.poolz.finance/graphql",
siweCallBack: async () => ({
eip4361message: "...",
signature: "..."
})
}}
>
{/** your routes */}
</API4Provider>
);After the provider is configured you can start using the generated hooks:
import { useGetCurrentTime } from "@poolzfinance/api4";
const { data, loading } = useGetCurrentTime();The project also includes many other hooks located in src/endpoints for interacting with different parts of the API.
