I hereby claim:
- I am zerostatic on github.
- I am zerostatic (https://keybase.io/zerostatic) on keybase.
- I have a public key ASCeo-_0RdUZnF0dp3GeIw4nBm8cWz4R_Yd0h7nQLLB5VQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| fetchData = async () => { | |
| const contractDetails = await getContractHash(this.props.specificNetworkAddress); | |
| const ipfsHash = contractDetails[0]; | |
| if (!ipfsHash) { return } | |
| const timestamp = contractDetails[1].c[0]; | |
| const details = await getJSON(ipfsHash); | |
| this.setState({ ipfsData: details, loading: false, timestamp }) | |
| } |
| handleSubmit = async (e) => { | |
| e.preventDefault(); | |
| this.setState({ loading: true }); | |
| const hash = await setJSON({ myData: this.state.myData }); | |
| try { | |
| await setContractHash(this.props.specificNetworkAddress, hash); | |
| } catch (error) { | |
| this.setState({ loading: false }); | |
| alert("There was an error with the transaction."); | |
| return; |
| const IPFS = require('ipfs-mini'); | |
| const ipfs = new IPFS({ host: 'ipfs.infura.io', port: 5001, protocol: 'https' }); | |
| export const setJSON = (obj) => { | |
| return new Promise((resolve, reject) => { | |
| ipfs.addJSON(obj, (err, result) => { | |
| if (err) { | |
| reject(err) | |
| } else { | |
| resolve(result); |
| pragma solidity ^0.4.18; | |
| contract MyDetails { | |
| mapping (address => string) ipfsHashes; | |
| mapping (address => uint) timestamp; | |
| function setHash(string ipfsHash) public { | |
| ipfsHashes[msg.sender] = ipfsHash; | |
| timestamp[msg.sender] = now; |
| import React, { Component } from 'react'; | |
| import Dashboard from './Dashboard'; | |
| import { Button, Col, Grid, Row } from 'react-bootstrap'; | |
| import { initAccount } from "./util/Uport"; | |
| class App extends Component { | |
| constructor(props) { | |
| super(props) | |
| this.state = { userName: "", avatar: "", specificNetworkAddress: "" } | |
| } |