Created
          May 27, 2022 13:18 
        
      - 
      
 - 
        
Save javedbaloch4/8bfe33adc15426f6b1dda78b3da28758 to your computer and use it in GitHub Desktop.  
    TypeScript to generate Solana in Devnet
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { PublicKey, Connection, LAMPORTS_PER_SOL } from "@solana/web3.js"; | |
| export const airdrop = async (address: string, amount: number) => { | |
| const publicKey = new PublicKey(address); | |
| const conn = new Connection("https://api.devnet.solana.com", "confirmed"); | |
| const signature = await conn.requestAirdrop( | |
| publicKey, | |
| amount * LAMPORTS_PER_SOL | |
| ); | |
| await conn.confirmTransaction(signature); | |
| }; | |
| airdrop("address", SOL); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment