当我尝试使用 JavaScript fcl 包进行事务时收到错误消息。
Unhandled Rejection (Error): failed to execute the script on the execution node: rpc error: code = DeadlineExceeded desc = context deadline exceeded
JavaScript 尝试捕获:
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())
}
`;
有什么想法吗?