This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ProfileHover | |
className='option' | |
orientation='left' | |
showName | |
noTheme | |
address={user.ethAddress} | |
> | |
<div className='option'> | |
{user.userProfile.name ? user.userProfile.name : user.ethAddress} | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<EditProfile | |
box={user.box} | |
space={user.dappSpace} | |
currentUserAddr={user.ethAddress} | |
currentUser3BoxProfile={user.userProfile} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ThreeBoxComments | |
spaceName={user.dappSpace._name} | |
threadName={posts.currentResult} | |
adminEthAddr='0x55c4eb985536f74f354dbaf7dd2d8891e9373504' | |
members={false} | |
showCommentCount={15} | |
box={user.box} | |
currentUserAddr={user.ethAddress} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addTo3Box = async () => { | |
const { petHash, imageDescription } = this.state; | |
const { user } = this.props; | |
const dappSpace = user.dappSpace; | |
try { | |
await dappSpace.public.set(petHash, imageDescription); | |
} catch(err) { | |
console.err(err); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Pet = artifacts.require("Pet"); | |
module.exports = function(deployer) { | |
deployer.deploy(Pet); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getContractAndPosts = async () => { | |
const { setCurrentIPFS, setContract } = this.props | |
const contract = await new web3.eth // eslint-disable-line | |
.Contract(Pet.abi, '0x892de2063c8F898E21A9A1d4b981F7446a561Fe3'); | |
await setContract(contract) | |
const petHashes = await contract.methods.getHashes().call() | |
await setCurrentIPFS(petHashes) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadWeb3 = async () => { | |
const { setEthAddress } = this.props; | |
if (window.ethereum) { | |
window.web3 = new Web3(window.ethereum) | |
const ethAddresses = await window.ethereum.enable() | |
const ethAddress = ethAddresses[0] | |
await setEthAddress(ethAddress) | |
} | |
else if (window.web3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loadWeb3 = async () => { | |
const { setEthAddress } = this.props; | |
if (window.ethereum) { | |
window.web3 = new Web3(window.ethereum) | |
const ethAddresses = await window.ethereum.enable() | |
const ethAddress = ethAddresses[0] | |
await setEthAddress(ethAddress) | |
} | |
else if (window.web3) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
pragma experimental ABIEncoderV2; | |
contract Pet { | |
string[] petHashes; | |
function addPetHash(string memory _petHash) public { | |
string memory toPost = _petHash; | |
petHashes.push(toPost); | |
} |