简体   繁体   English

未捕获(承诺中)错误:需要交易费用付款人

[英]Uncaught (in promise) Error: Transaction fee payer required

I get this error when I try to execute this using phantom wallet and react app当我尝试使用幻像钱包执行此操作并响应应用程序时出现此错误


  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);
const transaction = new Transaction();
transferTransaction.recentBlockhash = (await connection.getRecentBlockhash()).blockhash;

const { signature } = await window.solana.signAndSendTransaction(transferTransaction);
await connection.confirmTransaction(signature);

在此处输入图像描述

i fixed it by transferTransaction.feePayer = alice.publicKey;我通过transferTransaction.feePayer = alice.publicKey;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM