Skip to content

Instantly share code, notes, and snippets.

@ryanpedersen42
Last active December 23, 2019 06:46
Show Gist options
  • Save ryanpedersen42/24d91b69674e8cf7ee7167776a7cfe2d to your computer and use it in GitHub Desktop.
Save ryanpedersen42/24d91b69674e8cf7ee7167776a7cfe2d to your computer and use it in GitHub Desktop.
Get Contract in App.jsx
getContractAndPosts = async () => {
const { setCurrentIPFS, setContract } = this.props
const contract = await new web3.eth // eslint-disable-line
.Contract(Pet.abi, '<your-contract-hash>');
await setContract(contract)
const petHashes = await contract.methods.getHashes().call()
await setCurrentIPFS(petHashes)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment