0

Please help fix an issue with phantom wallet
here is my code

It's writing not enough solana, but I have enough

     var transaction = new solanaWeb3.Transaction().add(
          solanaWeb3.SystemProgram.transfer({
            fromPubkey: fromWallet,
            toPubkey: toWallet,
            lamports: 100  
          }),
        );

        transaction.feePayer = await provider.publicKey;
        let blockhashObj = await connection.getRecentBlockhash();
        transaction.recentBlockhash = await blockhashObj.blockhash;

        // Transaction constructor initialized successfully
        if(transaction) {
          console.log("Txn created successfully");
        }

  
      const { signature } = await provider.signAndSendTransaction(transaction);
     

        console.log("SIGNATURE", signature);
        console.log("SUCCESS");
  

   

enter image description here

enter image description here

enter image description here

enter image description here

1
  • what is fromWallet publickey ? are you sure this account has sol ?
    – Effe2
    Commented Jan 16 at 23:30

1 Answer 1

-1

It appears that your lamport parameter is calculated incorrectly. Try this: lamports: web3.LAMPORTS_PER_SOL / 100

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.