1.0 React Hooks
Overview
Our React Hooks library uses react-query under the hood & will expose request parameters & response objects that mimic react-query functionality. For instance, in the request parameters you can pass the { enabled: boolean } object and other request parameters found in react-query's documentation. The response objects will also mimic react-query with { data, isLoading, isSuccess } etc.
Functions with example uses are shown below. All the examples below use wagmi functions alongside @r3vl/sdk, but this is not a requirement. Notably, the following example is using wagmi 0.10.8
Integrating the sdk into your frontend
Add the package to your frontend app:
yarn add @r3vl/sdk
--------- or ---------
npm install @r3vl/sdkAdd the provider to your frontend (below is a next.js example):
import { R3vlProvider, createClient as r3vlCreateClient } from "@r3vl/sdk";
import { WagmiConfig, createClient } from "wagmi";
const r3vlClient = r3vlCreateClient();
const wagmiClient = createClient({
// per wagmi instructions: https://wagmi.sh/examples/connect-wallet
});
const App = ({ Component, pageProps }: AppProps) => {
return (
<WagmiConfig client={wagmiClient}>
<R3vlProvider client={r3vlClient}>
<Component {...pageProps} />
</R3vlProvider>
</WagmiConfig>
)
}Creating Revenue Path (code subject to change)
At the moment, @r3vl/sdk is compatible with the following chains:
Ethereum (mainnet & goerli)
Polygon (mainnet & mumbai)
Arbitrum (one & testnet)
Optimism (mainnet & goerli)
Aurora (mainnet & testnet)
Here a live example of a NextJS implementation of the R3VL SDK
Withdrawing From Revenue Path
Get Revenue Path Balances
Get Revenue Path Tiers
Updating Revenue Path
Last updated