Flow Cadence 无法在执行节点上执行脚本:rpc 错误:代码 = DeadlineExceeded desc = 超出上下文期限

问题描述

当我尝试使用 JavaScript fcl 包进行交易时收到错误消息。

Unhandled Rejection (Error): failed to execute the script on the execution node: rpc error: code = DeadlineExceeded desc = context deadline exceeded

JavaScript try catch:

const blockResponse = await fcl.send([fcl.getLatestBlock()]);
const block = await fcl.decode(blockResponse);
try {
  const { transactionId } = await fcl.send([
    fcl.transaction(doesNFTExist(addr)),fcl.payer(fcl.authz),fcl.proposer(fcl.authz),fcl.authorizations([fcl.authz]),fcl.ref(block.id)
  ]);
  console.log("transactionId",transactionId);
  setStatus("Transaction sent,waiting for confirmation");

  const unsub = fcl.tx({ transactionId }).subscribe(transaction => {
    setTransaction(transaction);

    if (fcl.tx.isSealed(transaction)) {
      setStatus("Transaction is Sealed");
      unsub();
    }
  });
} catch (error) {
  console.error(error);
  setStatus("Transaction failed");
}

交易(其中地址是 0x6425fdc5c36a607f 之类的东西)


const doesNFTExist = address => `
// pass address as parameter
import ContentNFT from ${address}

// Print the NFTs owned by account with address
pub fun main() {
    // Get the public account object for account
    let nftOwner = getAccount(${address})

    // Find the public Collection capability for their Collection
    let capability = nftOwner.getCapability(/public/ContentNFTCollection)
    .borrow<&{ContentNFT.CollectionPublic}>()!

    // borrow a reference from the capability
    let receiverRef = capability.borrow()
        ?? panic("Could not borrow the receiver reference")

    // Log the NFTs that they own as an array of IDs
    log("Account ${address} NFTs")
    log(receiverRef.getIDs())
}
`;

有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...