Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

297
Views
"TypeError: x.pubkey.toBase58 is not a function" in phantom wallet...transfer sol to another account in JavaScript with@solana/web3.js
let transaction = new solanalib.Transaction().add(
  solanalib.SystemProgram.transfer({
    fromPubkey: publicKey,
    toPubkey: 'GJ7bZskjGFqph51T88W2E1A1TeT1YVuuFM8atQAtVhSz',
    lamports: solanalib.LAMPORTS_PER_SOL,
  }),
);
transaction.feePayer = publicKey;
let blockhashObj = await connection.getRecentBlockhash();
transaction.recentBlockhash = await blockhashObj.blockhash;
if (transaction) {
  console.log('Txn created successfully');
} else {
  console.log('Sorry');
}

const signedTransaction = await window.solana.signTransaction(transaction);
const signature = await connection.sendRawTransaction(signedTransaction.serialize());
console.log('Signature: ', signature);
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I've just managed to solve this issue. The problem is that you are passing a string as the toPubKey - should be a PublicKey instance. Try this:

let transaction = new solanalib.Transaction().add(
  solanalib.SystemProgram.transfer({
    fromPubkey: publicKey,
    toPubkey: new solanalib.PublicKey('GJ7bZskjGFqph51T88W2E1A1TeT1YVuuFM8atQAtVhSz'),
    lamports: solanalib.LAMPORTS_PER_SOL,
  })
);
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!