diff --git a/app/src/CustomPropTypes.js b/app/src/CustomPropTypes.js
index 204d72f..62a9087 100644
--- a/app/src/CustomPropTypes.js
+++ b/app/src/CustomPropTypes.js
@@ -1,5 +1,6 @@
import PropTypes from 'prop-types';
+//TODO: Move this file
const GetTopicResult = PropTypes.PropTypes.shape({
0: PropTypes.string,
1: PropTypes.string,
diff --git a/app/src/components/Topic.js b/app/src/components/Topic.js
index cf2f0e6..e4fdc5c 100644
--- a/app/src/components/Topic.js
+++ b/app/src/components/Topic.js
@@ -24,8 +24,8 @@ class Topic extends Component {
const { dispatch, topicData, topicSubject, orbitDB } = this.props;
const { askedForReplication } = this.state;
if(!askedForReplication && orbitDB.ipfsInitialized && orbitDB.orbitdb && dispatch && !topicSubject && topicData) {
- this.setState({ askedForReplication: true });
dispatch(addPeerDatabase(`/orbitdb/${topicData.value[0]}/topics`));
+ this.setState({ askedForReplication: true });
}
}
diff --git a/app/src/containers/LoadingContainer.js b/app/src/containers/LoadingContainer.js
index 090ebbe..b36fe63 100644
--- a/app/src/containers/LoadingContainer.js
+++ b/app/src/containers/LoadingContainer.js
@@ -2,7 +2,6 @@ import React, { Children, Component } from 'react';
import { connect } from 'react-redux';
import ipfs_logo from '../assets/images/ipfs_logo.png';
-
//TODO: Add OrbitDB Loading thingy
class LoadingContainer extends Component {
render() {
@@ -52,7 +51,9 @@ class LoadingContainer extends Component {
⚙
Initializing contracts...
-
If this takes too long please make sure they are deployed to the network.
+
If this takes too long please make sure they are deployed to the network
+ and you are connected to the correct one.
+
diff --git a/app/src/utils/orbitUtils.js b/app/src/utils/orbitUtils.js
index aa34acf..88ecdbd 100644
--- a/app/src/utils/orbitUtils.js
+++ b/app/src/utils/orbitUtils.js
@@ -13,7 +13,11 @@ function initIPFS() {
store.dispatch({
type: IPFS_INITIALIZED, ipfs
});
- console.debug('IPFS initialized.');
+ ipfs.id(function (error, identity) {
+ if (error)
+ console.error(`IPFS id() error: ${error}`);
+ console.debug(`IPFS initialized with id: ${identity.id}`);
+ })
});
}
@@ -22,7 +26,7 @@ async function createDatabases() {
localStorage.clear(); // Perhaps not needed at all when orbit ids are used in Orbit 0.20.x+
console.debug('Creating databases...');
const ipfs = getIPFS();
- const orbitdb = await new OrbitDB(ipfs);
+ const orbitdb = new OrbitDB(ipfs);
const topicsDB = await orbitdb.keyvalue('topics');
const postsDB = await orbitdb.keyvalue('posts');
store.dispatch(
@@ -55,7 +59,7 @@ async function loadDatabases(identityId, identityPublicKey, identityPrivateKey,
}));
const ipfs = getIPFS();
- const orbitdb = await new OrbitDB(ipfs, directory,
+ const orbitdb = new OrbitDB(ipfs, directory,
{
peerId: orbitId, keystore
});
diff --git a/contracts/Posting.sol b/contracts/Posting.sol
deleted file mode 100644
index c5642e5..0000000
--- a/contracts/Posting.sol
+++ /dev/null
@@ -1,81 +0,0 @@
-pragma solidity >=0.5.6 <0.6.0;
-
-contract Posting {
- address forumContractAddress;
-
- function setForumContractAddress() public{
- require(forumContractAddress==address(0));
- forumContractAddress = msg.sender;
- }
-
- struct Topic {
- uint topicID;
- address author;
- uint timestamp;
- uint[] postIDs;
- }
-
- struct Post {
- uint postID;
- address author;
- uint timestamp;
- uint topicID;
- }
-
- uint numTopics; // Total number of topics
- uint numPosts; // Total number of posts
-
- mapping (uint => Topic) topics;
- mapping (uint => Post) posts;
-
- function createTopic(address author) public returns (uint, uint) {
- require(msg.sender==forumContractAddress);
- //Creates topic
- uint topicID = numTopics++;
- topics[topicID] = Topic(topicID, author, block.timestamp, new uint[](0));
-
- //Adds first post to topic
- uint postID = numPosts++;
- posts[postID] = Post(postID, author, block.timestamp, topicID);
- topics[topicID].postIDs.push(postID);
-
- return (topicID, postID);
- }
-
- function createPost(uint topicID, address author) public returns (uint) {
- require(msg.sender==forumContractAddress);
- require(topicID