question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is there a way to await a contractCall?

See original GitHub issue

something like

const getMyData = async ()=>{
  const [myData] = await useContractCall(...);
  //use myData here 
}

I mean the nice thing about hooks are that it rerenders the view if needed, but how can I access the data in my logic?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Zaniyarcommented, Feb 20, 2022

alright. I just have to do it the react way; providing the useCall data to a child component as props. thx.

1reaction
nezousecommented, Feb 18, 2022

I mean it’s a solution, but why don’t you just show some loading screen while the data is getting fetched? You can simply check if(!myData) return and then in the component if(!computedData) return <div>Loading...</div>

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why are there so many async and await in smart contract tests?
Not only on smart contract tests, but in Javascript and Nodejs, in general, is common to find many async/await function calls. The ...
Read more >
Testing Solidity with Truffle and Async/Await | by Angello Pozo
The first is to get the deployed contract JavaScript object and sets it to the variable meta . Then it calls the function...
Read more >
web3.eth.contracts.method await function never returns
A better way is to subscribe to either receipt , transactionHash or confirmation event, which is exposed by send . contract.methods.add(ipfsHash ...
Read more >
await is not working with send method · Issue #2837 - GitHub
const response = await contract.methods.get().call(); should get the value that is returned by get method of smart contract in the response.
Read more >
Call a Payable Solidity Function Using Ethers - vsupalov.com
A simple way to call a payable Solidity function, either from your tests or your dApp ... Contract(CONTRACT_ADDRESS, YOUR_ABI.abi, signer); let tx =...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found