juice-sdk-react
v5.0.2
Published
Wagmi hooks for Juicebox V4
Readme
juice-sdk-react
Wagmi hooks for Juicebox. Useful data contexts and helpers for building React applications.
Installation
Install the juice-sdk-react for React, and it's peer dependency, juice-sdk-core.
npm install juice-sdk-react juice-sdk-coreUsage
Fetching all of the commonly used data for Juicebox projects can be cumbersome. We expose the JBProjectProvider to fetch a bunch of data about a juicebox project, including (but not limited to):
- important contracts (like payment terminals, stores etc.)
- project metadata (ipfs)
- current ruleset
- project token details
JBProjectProvider is used in the following example:
import { JBProjectProvider } from "juice-sdk-react";
function MyPage() {
const projectId = 1n;
return (
<JBProjectProvider
chainId={1}
projectId={projectId}
version={5}
ctxProps={{
metadata: {
ipfsGatewayHostname: "jbm.infura-ipfs.io", // your custom gateway. Defaults to `ipfs.io`
},
}}
>
<MyPageComponents />
</JBProjectProvider>
);
}