title: How to send solana via my app in vanilla js?
body: <p>Trying to do a simple send and receive function in Solana with vanilla JS.</p>
  <p>Below is my send function that works fine, and now I want a receive function.
  Where the provider would get Solana transferred from my treasury wallet.</p>
  <p>I'm not sure what approach I should have, just starting out. Is there a way to just move things around in this function? Or do I have to have a totally different approach?</p>
  <p>Thanks!</p>
  <pre><code>async function transferSOL() {
    // Detecing and storing the phantom wallet of the user (creator in this case)
    var provider = phantom;
  
    // Establishing connection
    var connection = new web3.Connection(
      web3.clusterApiUrl('devnet'),
    );
  
    var transaction = new web3.Transaction().add(
      web3.SystemProgram.transfer({
        fromPubkey: provider.publicKey,
        toPubkey: treasuryWallet.publicKey,
        lamports: 0.1 * web3.LAMPORTS_PER_SOL - 100  
      }),
    );
    // Setting the variables for the transaction
    transaction.feePayer = await provider.publicKey;
    let blockhashObj = await connection.getRecentBlockhash();
    transaction.recentBlockhash = await blockhashObj.blockhash;
  
    // Request creator to sign the transaction (allow the transaction)
    let signed = await provider.signTransaction(transaction);
    let signature = await connection.sendRawTransaction(signed.serialize());
    await connection.confirmTransaction(signature);
  }
  </code></pre>