Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

339
Vistas
How to transfer NFT spl-token using phantom wallet and solana web3js

I can transfer the Solana from one account to another account using phantom wallet using this code

const transferTransaction = new Transaction()
  .add(SystemProgram.transfer({
    fromPubkey: alice.publicKey,
    toPubkey: feePayer.publicKey,
    lamports: lamportsToSend
  }))
  
  const network = "https://api.devnet.solana.com";
const connection = new Connection(network);
transferTransaction.recentBlockhash = (await connection.getRecentBlockhash()).blockhash;
transferTransaction.feePayer = alice.publicKey;
const { signature } = await window.solana.signAndSendTransaction(transferTransaction);
await connection.confirmTransaction(signature);

  console.log(signature);

but I am wondering how can I transfer the NFT if I have the nft minted address?

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

To transfer an NFT, you first need to find out the address of the NFT's mint and the owner's address. Then instead of calling SystemProgram.transfer, you'll use Token.createTransferCheckedInstruction.

There's a great example at the Solana Cookbook for transferring SPL tokens: https://solanacookbook.com/references/token.html#transfer-token

7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos