Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

283
Vistas
"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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda