yarn add @pngfi/react-hooks
// or
npm i @pngfi/react-hooks --save
- How to claim rewards
- How to create distributor
- How to get distributor
- How to update distributor
- How to delete distributor
- How to bond
- How to stake
- Staging Version https://api-staging.png.fi
- Online Version https://api.png.fi
import { PngfiProvider } from '@pngfi/react-hooks';
const App = ({ children }) => {
const wallet = useWallet();
return (
<PngfiProvider
cluster="mainnet-beta"
userPublicKey={wallet.publicKey}
>
{/* You can use useBonding in children now */}
{children}
</PngfiProvider>
)
}
import { usePngfiConfig } from '@pngfi/react-hooks';
const {
fallback: {
cluster,
pngfiApi,
userPublicKey
//...
}
//...
} = usePngfiConfig()
import { useAnchorProvider } from '@pngfi/react-hooks';
const provider = useAnchorProvider({
connection,
wallet,
connected
});
import { useDistributors } from '@pngfi/react-hooks';
const { data, error, loading } = useDistributors(user: string);
import { useMerkleRewards } from '@pngfi/react-hooks';
const { data, error, loading } = useMerkleRewards(user: string);
import { useDistributorEpochs } from '@pngfi/react-hooks';
const { data, error, loading } = useDistributorEpochs(distributor: string);
import { useMerkleRewardsDistributor } from '@pngfi/react-hooks';
const { data, error, loading } = useMerkleRewardsDistributor(distributor: string);
import { useDistributorRewardsEpoch } from '@pngfi/react-hooks';
const { data, error, loading } = useDistributorRewardsEpoch(distributor: string, epoch: string);
import { useTokens } from '@pngfi/react-hooks';
const { data, error, loading } = useTokens();
import { usePools } from '@pngfi/react-hooks';
const { data, error, loading } = usePools();
import { useMarkets } from '@pngfi/react-hooks';
const { data, error, loading } = useMarkets();
import { usePrices } from '@pngfi/react-hooks';
const { data, error, loading } = usePrices(['SOL', 'UST']);
import { useBonding } from '@pngfi/react-hooks';
const { data, error, loading } = useBonding();
import { useStaking } from '@pngfi/react-hooks';
const { data, error, loading } = useStaking();
import { useBalances } from '@pngfi/react-hooks';
const { data, error, loading } = useBalances(user);
import { useUserVesting } from '@pngfi/react-hooks';
const { data, error, loading } = useUserVesting(owner, vestConfig);
[[include:How-to-claim-rewards.md]]
[[include:How-to-create-distributor.md]]
[[include:How-to-get-distributor.md]]
[[include:How-to-update-distributor.md]]
[[include:How-to-delete-distributor.md]]
[[include:How-to-bond.md]]
[[include:How-to-stake.md]]