@pngfi/react-hooks
v0.6.3
Published
react hooks for pngfi.
Downloads
26
Maintainers
Readme
@pngfi/react-hooks
Docs Link
Installation
yarn add @pngfi/react-hooks
// or
npm i @pngfi/react-hooks --save
Usage
- 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
Api Host
- Staging Version https://api-staging.png.fi
- Online Version https://api.png.fi
react hooks base api
[[PngfiProvider]]
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>
)
}
[[usePngfiConfig]]
import { usePngfiConfig } from '@pngfi/react-hooks';
const {
fallback: {
cluster,
pngfiApi,
userPublicKey
//...
}
//...
} = usePngfiConfig()
[[useAnchorProvider]]
import { useAnchorProvider } from '@pngfi/react-hooks';
const provider = useAnchorProvider({
connection,
wallet,
connected
});
Distributors
[[useDistributors]]
import { useDistributors } from '@pngfi/react-hooks';
const { data, error, loading } = useDistributors(user: string);
[[useMerkleRewards]]
import { useMerkleRewards } from '@pngfi/react-hooks';
const { data, error, loading } = useMerkleRewards(user: string);
[[useDistributorEpochs]]
import { useDistributorEpochs } from '@pngfi/react-hooks';
const { data, error, loading } = useDistributorEpochs(distributor: string);
[[useMerkleRewardsDistributor]]
import { useMerkleRewardsDistributor } from '@pngfi/react-hooks';
const { data, error, loading } = useMerkleRewardsDistributor(distributor: string);
[[useDistributorRewardsEpoch]]
import { useDistributorRewardsEpoch } from '@pngfi/react-hooks';
const { data, error, loading } = useDistributorRewardsEpoch(distributor: string, epoch: string);
[[useTokens]]
import { useTokens } from '@pngfi/react-hooks';
const { data, error, loading } = useTokens();
[[usePools]]
import { usePools } from '@pngfi/react-hooks';
const { data, error, loading } = usePools();
[[useMarkets]]
import { useMarkets } from '@pngfi/react-hooks';
const { data, error, loading } = useMarkets();
[[usePrices]]
import { usePrices } from '@pngfi/react-hooks';
const { data, error, loading } = usePrices(['SOL', 'UST']);
[[useBonding]]
import { useBonding } from '@pngfi/react-hooks';
const { data, error, loading } = useBonding();
[[useStaking]]
import { useStaking } from '@pngfi/react-hooks';
const { data, error, loading } = useStaking();
[[useBalances]]
import { useBalances } from '@pngfi/react-hooks';
const { data, error, loading } = useBalances(user);
[[useUserVesting]]
import { useUserVesting } from '@pngfi/react-hooks';
const { data, error, loading } = useUserVesting(owner, vestConfig);
[[useRewards]]
[[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]]
[[useBond]]
[[include:How-to-bond.md]]
[[useStake]]
[[include:How-to-stake.md]]