如何解决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 举报,一经查实,本站将立刻删除。