Open s-bilic opened 2 years ago
@kanav99 Great repo and example of use, very helpful! Thank you.
Some declarations/methods used in this repo are deprecated i.e., this is the current correct way of the airdrop function.
const { connection } = useConnection(); const { publicKey } = useWallet(); const [airdrop, setAirdrop] = useState(false); const getAirdrop = useCallback(async () => { setAirdrop(true); try { const airdropSignature = await connection.requestAirdrop( publicKey, web3.LAMPORTS_PER_SOL ); const latestBlockHash = await connection.getLatestBlockhash(); await connection.confirmTransaction({ blockhash: latestBlockHash.blockhash, lastValidBlockHeight: latestBlockHash.lastValidBlockHeight, signature: airdropSignature, }); } catch (error) { console.log(error); } setAirdrop(false); }, [publicKey, connection]);
@kanav99 Great repo and example of use, very helpful! Thank you.
Some declarations/methods used in this repo are deprecated i.e., this is the current correct way of the airdrop function.