Package Exports
- @xweb3/react-hooks
- @xweb3/react-hooks/dist/index.esm.js
- @xweb3/react-hooks/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@xweb3/react-hooks) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@pngfi/react-hooks
Docs Link
Installation
yarn add @pngfi/react-hooks
// or
npm i @pngfi/react-hooks --saveUsage
Api Host
- Dev Version https://chain.png.fi/api-testing
- Staging Version https://chain.png.fi/api-staging
- Online Version https://chain.png.fi/api
react hooks base api
[[PngfiProvider]]
import { PngfiProvider } from '@pngfi/react-hooks';
const App = ({ children }) => {
const wallet = useWallet();
return (
<PngfiProvider
cluster="mainnet-beta"
publicKey={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]]
[[useBond]]
[[include:How-to-bond.md]]
[[useStake]]
[[include:How-to-stake.md]]