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
@xweb3/react-hooks
Link
Api Host
- Dev Version https://api-dev.png.fi
- Staging Version https://api-staging.png.fi
- Online Version https://api.png.fi
react hooks base api
[[Xweb3Provider]]
import { Xweb3Provider } from '@xweb3/react-hooks';
const App = ({ children }) => {
const wallet = useWallet();
return (
<Xweb3Provider
cluster="mainnet-beta"
publicKey={wallet.publicKey}
>
{/* You can use useBonding in children now */}
{children}
</Xweb3Provider>
)
}[[usePngfiConfig]]
import { usePngfiConfig } from '@xweb3/react-hooks';
const {
fallback: {
cluster,
xweb3Api,
userPublicKey
//...
}
//...
} = usePngfiConfig()[[useAnchorProvider]]
import { useAnchorProvider } from '@xweb3/react-hooks';
const provider = useAnchorProvider()Distributors
[[useInsertDistributorMerkleRewards]]
const { data, error, loading }: {
data: IMerkleRewardsInsertResponse,
error: IError,
loading: boolean
} = useInsertDistributorMerkleRewards(options: IMerkleRewardsInsertRequest);[[useDistributors]]
import { useDistributors } from '@xweb3/react-hooks';
const { data, error, loading } = useDistributors(user: string);[[useMerkleRewards]]
import { useMerkleRewards } from '@xweb3/react-hooks';
const { data, error, loading } = useMerkleRewards(user: string);[[useDistributorEpochs]]
import { useDistributorEpochs } from '@xweb3/react-hooks';
const { data, error, loading } = useDistributorEpochs(distributor: string);[[useMerkleRewardsDistributor]]
import { useMerkleRewardsDistributor } from '@xweb3/react-hooks';
const { data, error, loading } = useMerkleRewardsDistributor(distributor: string);[[useDistributorRewardsEpoch]]
import { useDistributorRewardsEpoch } from '@xweb3/react-hooks';
const { data, error, loading } = useDistributorRewardsEpoch(distributor: string, epoch: string);[[useTokens]]
import { useTokens } from '@xweb3/react-hooks';
const { data, error, loading } = useTokens();[[usePools]]
import { usePools } from '@xweb3/react-hooks';
const { data, error, loading } = usePools();[[useMarkets]]
import { useMarkets } from '@xweb3/react-hooks';
const { data, error, loading } = useMarkets();[[usePrices]]
import { usePrices } from '@xweb3/react-hooks';
const { data, error, loading } = usePrices(['SOL', 'UST']);[[useBonding]]
import { useBonding } from '@xweb3/react-hooks';
const { data, error, loading } = useBonding();[[useStaking]]
import { useStaking } from '@xweb3/react-hooks';
const { data, error, loading } = useStaking();[[useBalances]]
import { useBalances } from '@xweb3/react-hooks';
const { data, error, loading } = useBalances(user);[[useUserVesting]]
import { useUserVesting } from '@xweb3/react-hooks';
const { data, error, loading } = useUserVesting(owner, vestConfig);[[useRewards]]
[[include:How-to-claim-rewards.md]]