@alphscan/sdk-react
Provider & useClient
AlphscanProvider and useClient() hook
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
AlphscanProvider and useClient() hook
| Prop | Type | Description |
|---|---|---|
| apiUrl | string | API base URL (e.g. https://api.alphscan.io). Trailing slashes are removed. |
| apiKey | string | Optional API key. Empty string is treated as no key. |
| children | ReactNode | Tree that can use useClient() and other hooks. |
import { AlphscanProvider } from "@alphscan/sdk-react";
function App() {
const apiUrl = process.env.NEXT_PUBLIC_ALPHSCAN_API_BASE_URL ?? "https://api.alphscan.io";
const apiKey = "";
return (
<AlphscanProvider apiUrl={apiUrl} apiKey={apiKey}>
<YourRoutes />
</AlphscanProvider>
);
}
function useClient(): AlphscanClientApi
import { useClient } from "@alphscan/sdk-react";
function MyComponent() {
const client = useClient();
const handleFetch = async () => {
const { tokens } = await client.token.list({ page: 1, pageSize: 10 });
const { plans } = await client.plan.list();
};
return <button onClick={handleFetch}>Fetch</button>;
}
