Skip to content

Commit

Permalink
send: devnet sol
Browse files Browse the repository at this point in the history
  • Loading branch information
berzanorg committed Oct 18, 2023
1 parent e4274f2 commit a508f5e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion app/contexts/DappProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,20 @@ export const DappProvider = ({ children }: { children: ReactNode }) => {


const getDemoAssets = useCallback(async () => {
if (!pda || !program) return
if (!pda || !program || !publicKey) return

(async () => {
const tx = await connection.requestAirdrop(
publicKey,
web3.LAMPORTS_PER_SOL * 1
);
const latestBlockHash = await connection.getLatestBlockhash();
await connection.confirmTransaction({
blockhash: latestBlockHash.blockhash,
lastValidBlockHeight: latestBlockHash.lastValidBlockHeight,
signature: tx
});
})()

await program.methods.getDemoAssets()
.accounts({ pawnShopUser: pda })
Expand Down

0 comments on commit a508f5e

Please sign in to comment.