Browse Source

Merge branch 'feature/112-add-shared-package' into 'develop'

feat: init shared package

See merge request ecentrics/concordia!13
develop
Apostolos Fanakis 4 years ago
parent
commit
418ac629c1
  1. 2
      .gitignore
  2. 1
      packages/concordia-app/package.json
  3. 0
      packages/concordia-app/patches/web3-eth+1.3.4.patch
  4. 2
      packages/concordia-app/src/components/InitializationScreen/index.jsx
  5. 6
      packages/concordia-app/src/components/PostCreate/index.jsx
  6. 4
      packages/concordia-app/src/components/PostList/PostListRow/index.jsx
  7. 2
      packages/concordia-app/src/components/PostList/index.jsx
  8. 4
      packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx
  9. 2
      packages/concordia-app/src/components/TopicList/index.jsx
  10. 2
      packages/concordia-app/src/components/UsernameSelector.jsx
  11. 16
      packages/concordia-app/src/constants/configuration/defaults.js
  12. 11
      packages/concordia-app/src/constants/contracts/ContractNames.js
  13. 13
      packages/concordia-app/src/constants/contracts/events/ForumContractEvents.js
  14. 8
      packages/concordia-app/src/constants/contracts/events/index.js
  15. 42
      packages/concordia-app/src/options/breezeOptions.js
  16. 9
      packages/concordia-app/src/options/drizzleOptions.js
  17. 29
      packages/concordia-app/src/options/web3Options.js
  18. 2
      packages/concordia-app/src/redux/actions/contractEventActions.js
  19. 2
      packages/concordia-app/src/redux/sagas/orbitSaga.js
  20. 2
      packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js
  21. 2
      packages/concordia-app/src/redux/sagas/userSaga.js
  22. 9
      packages/concordia-app/src/redux/store.js
  23. 28
      packages/concordia-app/src/utils/drizzleUtils.js
  24. 2
      packages/concordia-app/src/views/Home/index.jsx
  25. 4
      packages/concordia-app/src/views/Profile/GeneralTab/EditInformationModal/index.jsx
  26. 2
      packages/concordia-app/src/views/Profile/GeneralTab/index.jsx
  27. 2
      packages/concordia-app/src/views/Profile/index.jsx
  28. 2
      packages/concordia-app/src/views/Register/PersonalInformationStep/index.jsx
  29. 2
      packages/concordia-app/src/views/Register/SignUpStep/index.jsx
  30. 6
      packages/concordia-app/src/views/Topic/TopicCreate/index.jsx
  31. 4
      packages/concordia-app/src/views/Topic/TopicView/index.jsx
  32. 4
      packages/concordia-contracts-provider/package.json
  33. 2
      packages/concordia-contracts-provider/src/constants.js
  34. 6
      packages/concordia-contracts-provider/src/index.js
  35. 21
      packages/concordia-contracts/constants/config/defaults.js
  36. 1
      packages/concordia-contracts/package.json
  37. 19
      packages/concordia-contracts/truffle-config.js
  38. 8
      packages/concordia-contracts/utils/contractsProviderUtils.js
  39. 5
      packages/concordia-pinner/package.json
  40. 16
      packages/concordia-pinner/src/app.js
  41. 15
      packages/concordia-pinner/src/constants.js
  42. 8
      packages/concordia-pinner/src/index.js
  43. 60
      packages/concordia-shared/.eslintrc.js
  44. 16
      packages/concordia-shared/package.json
  45. 33
      packages/concordia-shared/src/configuration/breezeConfiguration.js
  46. 25
      packages/concordia-shared/src/configuration/web3Configuration.js
  47. 46
      packages/concordia-shared/src/constants/configuration/defaults.js
  48. 16
      packages/concordia-shared/src/constants/contracts/ContractNames.js
  49. 19
      packages/concordia-shared/src/constants/contracts/events/ForumContractEvents.js
  50. 8
      packages/concordia-shared/src/constants/contracts/events/index.js
  51. 13
      packages/concordia-shared/src/constants/orbit/OrbitDatabases.js
  52. 14
      packages/concordia-shared/src/environment/contractsProviderEnv.js
  53. 21
      packages/concordia-shared/src/environment/interpolated/contractsProvider.js
  54. 12
      packages/concordia-shared/src/environment/interpolated/pinner.js
  55. 15
      packages/concordia-shared/src/environment/interpolated/rendezvous.js
  56. 9
      packages/concordia-shared/src/environment/interpolated/shared.js
  57. 37
      packages/concordia-shared/src/environment/interpolated/web3.js
  58. 7
      packages/concordia-shared/src/environment/pinnerEnv.js
  59. 9
      packages/concordia-shared/src/environment/rendezvousEnv.js
  60. 9
      packages/concordia-shared/src/environment/sharedEnv.js
  61. 24
      packages/concordia-shared/src/environment/web3Env.js
  62. 5
      packages/concordia-shared/src/utils/rendezvous.js
  63. 6
      packages/concordia-shared/src/utils/web3.js
  64. 6
      yarn.lock

2
.gitignore

@ -36,3 +36,5 @@ docker/env/contracts.env
# Lerna # Lerna
*.lerna_backup *.lerna_backup
yarn-clean.sh

1
packages/concordia-app/package.json

@ -30,6 +30,7 @@
"@reduxjs/toolkit": "~1.4.0", "@reduxjs/toolkit": "~1.4.0",
"@welldone-software/why-did-you-render": "^6.0.0-rc.1", "@welldone-software/why-did-you-render": "^6.0.0-rc.1",
"concordia-contracts": "~0.1.0", "concordia-contracts": "~0.1.0",
"concordia-shared": "~0.1.0",
"i18next": "^19.8.3", "i18next": "^19.8.3",
"i18next-browser-languagedetector": "^6.0.1", "i18next-browser-languagedetector": "^6.0.1",
"i18next-http-backend": "^1.0.21", "i18next-http-backend": "^1.0.21",

0
packages/concordia-app/patches/web3-eth+1.3.3.patch → packages/concordia-app/patches/web3-eth+1.3.4.patch

2
packages/concordia-app/src/components/InitializationScreen/index.jsx

@ -1,11 +1,11 @@
import React, { Children } from 'react'; import React, { Children } from 'react';
import { breezeConstants } from '@ezerous/breeze'; import { breezeConstants } from '@ezerous/breeze';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import CustomLoader from './CustomLoader'; import CustomLoader from './CustomLoader';
// CSS // CSS
import '../../assets/css/loading-component.css'; import '../../assets/css/loading-component.css';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames';
const InitializationLoader = ({ children }) => { const InitializationLoader = ({ children }) => {
const initializing = useSelector((state) => state.drizzleStatus.initializing); const initializing = useSelector((state) => state.drizzleStatus.initializing);

6
packages/concordia-app/src/components/PostCreate/index.jsx

@ -7,16 +7,16 @@ import {
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { POSTS_DATABASE, USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import { POST_CREATED_EVENT } from 'concordia-shared/src/constants/contracts/events/ForumContractEvents';
import determineKVAddress from '../../utils/orbitUtils'; import determineKVAddress from '../../utils/orbitUtils';
import { POSTS_DATABASE, USER_DATABASE } from '../../constants/orbit/OrbitDatabases';
import { FETCH_USER_DATABASE } from '../../redux/actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE } from '../../redux/actions/peerDbReplicationActions';
import { USER_PROFILE_PICTURE } from '../../constants/orbit/UserDatabaseKeys'; import { USER_PROFILE_PICTURE } from '../../constants/orbit/UserDatabaseKeys';
import { breeze, drizzle } from '../../redux/store'; import { breeze, drizzle } from '../../redux/store';
import './styles.css'; import './styles.css';
import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../constants/TransactionStatus'; import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../constants/TransactionStatus';
import { POST_CONTENT } from '../../constants/orbit/PostsDatabaseKeys'; import { POST_CONTENT } from '../../constants/orbit/PostsDatabaseKeys';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames';
import { POST_CREATED_EVENT } from '../../constants/contracts/events/ForumContractEvents';
const { contracts: { [FORUM_CONTRACT]: { methods: { createPost } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { createPost } } } } = drizzle;
const { orbit } = breeze; const { orbit } = breeze;

4
packages/concordia-app/src/components/PostList/PostListRow/index.jsx

@ -9,14 +9,14 @@ import { useTranslation } from 'react-i18next';
import TimeAgo from 'react-timeago'; import TimeAgo from 'react-timeago';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { POSTS_DATABASE, USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions';
import { breeze } from '../../../redux/store'; import { breeze } from '../../../redux/store';
import './styles.css'; import './styles.css';
import { POSTS_DATABASE, USER_DATABASE } from '../../../constants/orbit/OrbitDatabases';
import determineKVAddress from '../../../utils/orbitUtils'; import determineKVAddress from '../../../utils/orbitUtils';
import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys';
import { POST_CONTENT } from '../../../constants/orbit/PostsDatabaseKeys'; import { POST_CONTENT } from '../../../constants/orbit/PostsDatabaseKeys';
import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames';
const { orbit } = breeze; const { orbit } = breeze;

2
packages/concordia-app/src/components/PostList/index.jsx

@ -4,9 +4,9 @@ import React, {
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { Dimmer, Feed, Loader } from 'semantic-ui-react'; import { Dimmer, Feed, Loader } from 'semantic-ui-react';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import PostListRow from './PostListRow'; import PostListRow from './PostListRow';
import { drizzle } from '../../redux/store'; import { drizzle } from '../../redux/store';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames';
const { contracts: { [FORUM_CONTRACT]: { methods: { getPost: { cacheCall: getPostChainData } } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { getPost: { cacheCall: getPostChainData } } } } } = drizzle;

4
packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx

@ -10,14 +10,14 @@ import TimeAgo from 'react-timeago';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { TOPICS_DATABASE, USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions';
import { breeze } from '../../../redux/store'; import { breeze } from '../../../redux/store';
import './styles.css'; import './styles.css';
import { TOPICS_DATABASE, USER_DATABASE } from '../../../constants/orbit/OrbitDatabases';
import determineKVAddress from '../../../utils/orbitUtils'; import determineKVAddress from '../../../utils/orbitUtils';
import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys';
import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys'; import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys';
import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames';
const { orbit } = breeze; const { orbit } = breeze;

2
packages/concordia-app/src/components/TopicList/index.jsx

@ -4,9 +4,9 @@ import React, {
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { List } from 'semantic-ui-react'; import { List } from 'semantic-ui-react';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import TopicListRow from './TopicListRow'; import TopicListRow from './TopicListRow';
import { drizzle } from '../../redux/store'; import { drizzle } from '../../redux/store';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames';
const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { cacheCall: getTopicChainData } } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { cacheCall: getTopicChainData } } } } } = drizzle;

2
packages/concordia-app/src/components/UsernameSelector.jsx

@ -6,8 +6,8 @@ import throttle from 'lodash/throttle';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { drizzle } from '../redux/store'; import { drizzle } from '../redux/store';
import { FORUM_CONTRACT } from '../constants/contracts/ContractNames';
const { contracts: { [FORUM_CONTRACT]: { methods: { isUserNameTaken } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { isUserNameTaken } } } } = drizzle;

16
packages/concordia-app/src/constants/configuration/defaults.js

@ -1,14 +1,2 @@
export const WEB3_HOST_DEFAULT = '127.0.0.1'; export const CONCORDIA_HOST_DEFAULT = '127.0.0.1';
export const WEB3_PORT_DEFAULT = '8545'; export const CONCORDIA_PORT_DEFAULT = '7000';
export const WEB3_PORT_SOCKET_TIMEOUT_DEFAULT = 30000;
export const WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT = 3;
export const REACT_APP_CONCORDIA_HOST_DEFAULT = '127.0.0.1';
export const REACT_APP_CONCORDIA_PORT_DEFAULT = '7000';
export const REACT_APP_RENDEZVOUS_HOST_DEFAULT = '127.0.0.1';
export const REACT_APP_RENDEZVOUS_PORT_DEFAULT = '9090';
export const REACT_APP_CONTRACTS_SUPPLIER_HOST_DEFAULT = '127.0.0.1';
export const REACT_APP_CONTRACTS_SUPPLIER_PORT_DEFAULT = '8400';
export const REACT_APP_CONTRACTS_VERSION_HASH_DEFAULT = 'latest';

11
packages/concordia-app/src/constants/contracts/ContractNames.js

@ -1,11 +0,0 @@
export const FORUM_CONTRACT = 'Forum';
export const POST_VOTING_CONTRACT = 'PostVoting';
export const VOTING_CONTRACT = 'Voting';
const CONTRACTS = [
FORUM_CONTRACT,
POST_VOTING_CONTRACT,
VOTING_CONTRACT,
];
export default CONTRACTS;

13
packages/concordia-app/src/constants/contracts/events/ForumContractEvents.js

@ -1,13 +0,0 @@
export const USER_SIGNED_UP_EVENT = 'UserSignedUp';
export const USERNAME_UPDATED_EVENT = 'UsernameUpdated';
export const TOPIC_CREATED_EVENT = 'TopicCreated';
export const POST_CREATED_EVENT = 'PostCreated';
const forumContractEvents = [
USER_SIGNED_UP_EVENT,
USERNAME_UPDATED_EVENT,
TOPIC_CREATED_EVENT,
POST_CREATED_EVENT,
];
export default forumContractEvents;

8
packages/concordia-app/src/constants/contracts/events/index.js

@ -1,8 +0,0 @@
import { FORUM_CONTRACT } from '../ContractNames';
import forumContractEvents from './ForumContractEvents';
const appEvents = {
[FORUM_CONTRACT]: forumContractEvents,
};
export default appEvents;

42
packages/concordia-app/src/options/breezeOptions.js

@ -1,42 +0,0 @@
import { EthereumContractIdentityProvider } from '@ezerous/eth-identity-provider';
import databases from '../constants/orbit/OrbitDatabases';
import {
REACT_APP_RENDEZVOUS_HOST_DEFAULT,
REACT_APP_RENDEZVOUS_PORT_DEFAULT,
} from '../constants/configuration/defaults';
const REACT_APP_RENDEZVOUS_HOST = process.env.REACT_APP_RENDEZVOUS_HOST || REACT_APP_RENDEZVOUS_HOST_DEFAULT;
const REACT_APP_RENDEZVOUS_PORT = process.env.REACT_APP_RENDEZVOUS_PORT || REACT_APP_RENDEZVOUS_PORT_DEFAULT;
export const RENDEZVOUS_URL = `http://${REACT_APP_RENDEZVOUS_HOST}:${REACT_APP_RENDEZVOUS_PORT}`;
const breezeOptions = {
ipfs: {
repo: 'concordia',
config: {
Addresses: {
Swarm: [
// Use local signaling server (see also rendezvous script in package.json)
// For more information: https://github.com/libp2p/js-libp2p-webrtc-star
`/ip4/${REACT_APP_RENDEZVOUS_HOST}/tcp/${REACT_APP_RENDEZVOUS_PORT}/wss/p2p-webrtc-star`,
// Use the following public servers if needed
// '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
// '/dns4/ wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star'
],
},
},
preload: {
enabled: false,
},
init: {
emptyRepo: true,
},
},
orbit: {
identityProvider: EthereumContractIdentityProvider,
databases,
},
};
export default breezeOptions;

9
packages/concordia-app/src/options/drizzleOptions.js

@ -1,17 +1,18 @@
// Check out the documentation: https://truffleframework.com/docs/drizzle/reference/drizzle-options // Check out the documentation: https://truffleframework.com/docs/drizzle/reference/drizzle-options
import { contracts } from 'concordia-contracts'; import { contracts } from 'concordia-contracts';
import web3Options from './web3Options'; import { getWeb3Configuration } from 'concordia-shared/src/configuration/web3Configuration';
import appEvents from '../constants/contracts/events'; import Web3 from 'web3';
import appEvents from 'concordia-shared/src/constants/contracts/events';
import downloadContractArtifactsSync from '../utils/drizzleUtils'; import downloadContractArtifactsSync from '../utils/drizzleUtils';
const drizzleOptions = { const drizzleOptions = {
web3: web3Options, web3: getWeb3Configuration(Web3),
events: { ...appEvents }, events: { ...appEvents },
reloadWindowOnNetworkChange: true, reloadWindowOnNetworkChange: true,
reloadWindowOnAccountChange: true, // We need it to reinitialize breeze and create new Orbit databases reloadWindowOnAccountChange: true, // We need it to reinitialize breeze and create new Orbit databases
}; };
if (process.env.REACT_APP_USE_EXTERNAL_CONTRACTS_SUPPLIER) { if (process.env.REACT_APP_USE_EXTERNAL_CONTRACTS_PROVIDER) {
drizzleOptions.contracts = downloadContractArtifactsSync(); drizzleOptions.contracts = downloadContractArtifactsSync();
} else { } else {
drizzleOptions.contracts = contracts; drizzleOptions.contracts = contracts;

29
packages/concordia-app/src/options/web3Options.js

@ -1,29 +0,0 @@
import Web3 from 'web3';
import {
WEB3_HOST_DEFAULT,
WEB3_PORT_DEFAULT,
WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT,
WEB3_PORT_SOCKET_TIMEOUT_DEFAULT,
} from '../constants/configuration/defaults';
const { WEB3_HOST, WEB3_PORT, WEBSOCKET_TIMEOUT } = process.env;
const web3WebsocketOptions = {
keepAlive: true,
timeout: WEBSOCKET_TIMEOUT !== undefined ? WEBSOCKET_TIMEOUT : WEB3_PORT_SOCKET_TIMEOUT_DEFAULT,
reconnect: {
maxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT,
},
};
const web3 = (WEB3_HOST !== undefined && WEB3_PORT !== undefined)
? new Web3(new Web3.providers.WebsocketProvider(`ws://${WEB3_HOST}:${WEB3_PORT}`))
: new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider(
`ws://${WEB3_HOST_DEFAULT}:${WEB3_PORT_DEFAULT}`, web3WebsocketOptions,
));
const web3Options = {
customProvider: web3,
};
export default web3Options;

2
packages/concordia-app/src/redux/actions/contractEventActions.js

@ -3,7 +3,7 @@ import {
TOPIC_CREATED_EVENT, TOPIC_CREATED_EVENT,
USER_SIGNED_UP_EVENT, USER_SIGNED_UP_EVENT,
USERNAME_UPDATED_EVENT, USERNAME_UPDATED_EVENT,
} from '../../constants/contracts/events/ForumContractEvents'; } from 'concordia-shared/src/constants/contracts/events/ForumContractEvents';
export const FORUM_EVENT_USER_SIGNED_UP = 'FORUM_EVENT_USER_SIGNED_UP'; export const FORUM_EVENT_USER_SIGNED_UP = 'FORUM_EVENT_USER_SIGNED_UP';
export const FORUM_EVENT_USERNAME_UPDATED = 'FORUM_EVENT_USERNAME_UPDATED'; export const FORUM_EVENT_USERNAME_UPDATED = 'FORUM_EVENT_USERNAME_UPDATED';

2
packages/concordia-app/src/redux/sagas/orbitSaga.js

@ -7,7 +7,7 @@ import { drizzleActions } from '@ezerous/drizzle';
import { contracts } from 'concordia-contracts'; import { contracts } from 'concordia-contracts';
import { EthereumContractIdentityProvider } from '@ezerous/eth-identity-provider'; import { EthereumContractIdentityProvider } from '@ezerous/eth-identity-provider';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames'; import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
function* initOrbitDatabases(action) { function* initOrbitDatabases(action) {
const { account, breeze } = action; const { account, breeze } = action;

2
packages/concordia-app/src/redux/sagas/peerDbReplicationSaga.js

@ -7,9 +7,9 @@ import {
ORBIT_DB_REPLICATED, ORBIT_DB_REPLICATED,
ORBIT_DB_WRITE, ORBIT_DB_WRITE,
} from '@ezerous/breeze/src/orbit/orbitActions'; } from '@ezerous/breeze/src/orbit/orbitActions';
import { POSTS_DATABASE, TOPICS_DATABASE, USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import determineKVAddress from '../../utils/orbitUtils'; import determineKVAddress from '../../utils/orbitUtils';
import { FETCH_USER_DATABASE, UPDATE_ORBIT_DATA } from '../actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE, UPDATE_ORBIT_DATA } from '../actions/peerDbReplicationActions';
import { POSTS_DATABASE, TOPICS_DATABASE, USER_DATABASE } from '../../constants/orbit/OrbitDatabases';
import userDatabaseKeys from '../../constants/orbit/UserDatabaseKeys'; import userDatabaseKeys from '../../constants/orbit/UserDatabaseKeys';
import { TOPIC_SUBJECT } from '../../constants/orbit/TopicsDatabaseKeys'; import { TOPIC_SUBJECT } from '../../constants/orbit/TopicsDatabaseKeys';
import { POST_CONTENT } from '../../constants/orbit/PostsDatabaseKeys'; import { POST_CONTENT } from '../../constants/orbit/PostsDatabaseKeys';

2
packages/concordia-app/src/redux/sagas/userSaga.js

@ -3,9 +3,9 @@ import {
all, call, put, take, takeLatest, all, call, put, take, takeLatest,
} from 'redux-saga/effects'; } from 'redux-saga/effects';
import { drizzleActions } from '@ezerous/drizzle'; import { drizzleActions } from '@ezerous/drizzle';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { USER_DATA_UPDATED, USER_DATA_ERROR } from '../actions/userActions'; import { USER_DATA_UPDATED, USER_DATA_ERROR } from '../actions/userActions';
import { FORUM_EVENT_USER_SIGNED_UP } from '../actions/contractEventActions'; import { FORUM_EVENT_USER_SIGNED_UP } from '../actions/contractEventActions';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames';
function* fetchUserData({ drizzle, account }) { function* fetchUserData({ drizzle, account }) {
const contract = drizzle.contracts[FORUM_CONTRACT]; const contract = drizzle.contracts[FORUM_CONTRACT];

9
packages/concordia-app/src/redux/store.js

@ -4,11 +4,12 @@ import {
} from '@ezerous/drizzle'; } from '@ezerous/drizzle';
import { Breeze, breezeReducers } from '@ezerous/breeze'; import { Breeze, breezeReducers } from '@ezerous/breeze';
import createSagaMiddleware from 'redux-saga'; import createSagaMiddleware from 'redux-saga';
import getBreezeConfiguration from 'concordia-shared/src/configuration/breezeConfiguration';
import { EthereumContractIdentityProvider } from '@ezerous/eth-identity-provider';
import userReducer from './reducers/userReducer'; import userReducer from './reducers/userReducer';
import rootSaga from './sagas/rootSaga'; import rootSaga from './sagas/rootSaga';
import drizzleOptions from '../options/drizzleOptions'; import drizzleOptions from '../options/drizzleOptions';
import peerDbReplicationReducer from './reducers/peerDbReplicationReducer'; import peerDbReplicationReducer from './reducers/peerDbReplicationReducer';
import breezeOptions from '../options/breezeOptions';
const initialState = { const initialState = {
contracts: generateContractsInitialState(drizzleOptions), contracts: generateContractsInitialState(drizzleOptions),
@ -27,8 +28,12 @@ const store = configureStore({
preloadedState: initialState, preloadedState: initialState,
}); });
const breezeConfiguration = getBreezeConfiguration(EthereumContractIdentityProvider,
process.env.REACT_APP_RENDEZVOUS_HOST,
process.env.REACT_APP_RENDEZVOUS_PORT);
export const drizzle = new Drizzle(drizzleOptions, store); export const drizzle = new Drizzle(drizzleOptions, store);
export const breeze = new Breeze(breezeOptions, store); export const breeze = new Breeze(breezeConfiguration, store);
sagaMiddleware.run(rootSaga); sagaMiddleware.run(rootSaga);
export default store; export default store;

28
packages/concordia-app/src/utils/drizzleUtils.js

@ -1,26 +1,22 @@
import { CONTRACTS } from 'concordia-shared/src/constants/contracts/ContractNames';
import { import {
REACT_APP_CONCORDIA_HOST_DEFAULT, contractsProviderHost,
REACT_APP_CONCORDIA_PORT_DEFAULT, contractsProviderPort,
REACT_APP_CONTRACTS_SUPPLIER_HOST_DEFAULT, contractsVersionHash,
REACT_APP_CONTRACTS_SUPPLIER_PORT_DEFAULT, } from 'concordia-shared/src/environment/interpolated/contractsProvider';
REACT_APP_CONTRACTS_VERSION_HASH_DEFAULT, import {
CONCORDIA_HOST_DEFAULT,
CONCORDIA_PORT_DEFAULT,
} from '../constants/configuration/defaults'; } from '../constants/configuration/defaults';
import CONTRACTS from '../constants/contracts/ContractNames';
function getContractsDownloadRequest() { function getContractsDownloadRequest() {
const CONTRACTS_SUPPLIER_HOST = process.env.REACT_APP_CONTRACTS_SUPPLIER_HOST const HOST = process.env.REACT_APP_CONCORDIA_HOST || CONCORDIA_HOST_DEFAULT;
|| REACT_APP_CONTRACTS_SUPPLIER_HOST_DEFAULT; const PORT = process.env.REACT_APP_CONCORDIA_PORT || CONCORDIA_PORT_DEFAULT;
const CONTRACTS_SUPPLIER_PORT = process.env.REACT_APP_CONTRACTS_SUPPLIER_PORT
|| REACT_APP_CONTRACTS_SUPPLIER_PORT_DEFAULT;
const CONTRACTS_VERSION_HASH = process.env.REACT_APP_CONTRACTS_VERSION_HASH
|| REACT_APP_CONTRACTS_VERSION_HASH_DEFAULT;
const HOST = process.env.REACT_APP_CONCORDIA_HOST || REACT_APP_CONCORDIA_HOST_DEFAULT;
const PORT = process.env.REACT_APP_CONCORDIA_PORT || REACT_APP_CONCORDIA_PORT_DEFAULT;
const xhrRequest = new XMLHttpRequest(); const xhrRequest = new XMLHttpRequest();
xhrRequest.open('GET', xhrRequest.open('GET',
`http://${CONTRACTS_SUPPLIER_HOST}:${CONTRACTS_SUPPLIER_PORT}/contracts/${CONTRACTS_VERSION_HASH}`, `http://${contractsProviderHost}:${contractsProviderPort}/contracts/${contractsVersionHash}`,
false); false);
xhrRequest.setRequestHeader('Access-Control-Allow-Origin', `${HOST}:${PORT}`); xhrRequest.setRequestHeader('Access-Control-Allow-Origin', `${HOST}:${PORT}`);
xhrRequest.setRequestHeader('Access-Control-Allow-Credentials', 'true'); xhrRequest.setRequestHeader('Access-Control-Allow-Credentials', 'true');
@ -40,7 +36,7 @@ function validateRemoteContracts(remoteContracts) {
})); }));
if (contractsPresentStatus.reduce((accumulator, contract) => accumulator && contract.present, true)) { if (contractsPresentStatus.reduce((accumulator, contract) => accumulator && contract.present, true)) {
throw new Error(`Contracts missing from artifacts. Supplier didn't bring ${contractsPresentStatus throw new Error(`Contracts missing from artifacts. Provider didn't bring ${contractsPresentStatus
.filter((contractPresentStatus) => contractPresentStatus.present === false) .filter((contractPresentStatus) => contractPresentStatus.present === false)
.map((contractPresentStatus) => contractPresentStatus.contract) .map((contractPresentStatus) => contractPresentStatus.contract)
.join(', ')}.`); .join(', ')}.`);

2
packages/concordia-app/src/views/Home/index.jsx

@ -3,10 +3,10 @@ import React, {
} from 'react'; } from 'react';
import { Container } from 'semantic-ui-react'; import { Container } from 'semantic-ui-react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import Board from './Board'; import Board from './Board';
import './styles.css'; import './styles.css';
import { drizzle } from '../../redux/store'; import { drizzle } from '../../redux/store';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames';
const { contracts: { [FORUM_CONTRACT]: { methods: { numTopics } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { numTopics } } } } = drizzle;

4
packages/concordia-app/src/views/Profile/GeneralTab/EditInformationModal/index.jsx

@ -6,12 +6,12 @@ import {
} from 'semantic-ui-react'; } from 'semantic-ui-react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import checkUrlValid from '../../../../utils/urlUtils'; import checkUrlValid from '../../../../utils/urlUtils';
import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../../constants/orbit/UserDatabaseKeys'; import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../../constants/orbit/UserDatabaseKeys';
import { USER_DATABASE } from '../../../../constants/orbit/OrbitDatabases';
import { breeze, drizzle } from '../../../../redux/store'; import { breeze, drizzle } from '../../../../redux/store';
import UsernameSelector from '../../../../components/UsernameSelector'; import UsernameSelector from '../../../../components/UsernameSelector';
import { FORUM_CONTRACT } from '../../../../constants/contracts/ContractNames';
const { orbit: { stores } } = breeze; const { orbit: { stores } } = breeze;
const { contracts: { [FORUM_CONTRACT]: { methods: { updateUsername } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { updateUsername } } } } = drizzle;

2
packages/concordia-app/src/views/Profile/GeneralTab/index.jsx

@ -5,8 +5,8 @@ import {
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { USER_DATABASE, databases } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import determineKVAddress from '../../../utils/orbitUtils'; import determineKVAddress from '../../../utils/orbitUtils';
import databases, { USER_DATABASE } from '../../../constants/orbit/OrbitDatabases';
import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions';
import { breeze } from '../../../redux/store'; import { breeze } from '../../../redux/store';
import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys';

2
packages/concordia-app/src/views/Profile/index.jsx

@ -5,8 +5,8 @@ import { Container, Header, Tab } from 'semantic-ui-react';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { useHistory, useRouteMatch } from 'react-router'; import { useHistory, useRouteMatch } from 'react-router';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { drizzle } from '../../redux/store'; import { drizzle } from '../../redux/store';
import { FORUM_CONTRACT } from '../../constants/contracts/ContractNames';
import CustomLoadingTabPane from '../../components/CustomLoadingTabPane'; import CustomLoadingTabPane from '../../components/CustomLoadingTabPane';
import TopicList from '../../components/TopicList'; import TopicList from '../../components/TopicList';
import PostList from '../../components/PostList'; import PostList from '../../components/PostList';

2
packages/concordia-app/src/views/Register/PersonalInformationStep/index.jsx

@ -7,10 +7,10 @@ import {
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import checkUrlValid from '../../../utils/urlUtils'; import checkUrlValid from '../../../utils/urlUtils';
import { breeze } from '../../../redux/store'; import { breeze } from '../../../redux/store';
import './styles.css'; import './styles.css';
import { USER_DATABASE } from '../../../constants/orbit/OrbitDatabases';
import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; import { USER_LOCATION, USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys';
const { orbit: { stores } } = breeze; const { orbit: { stores } } = breeze;

2
packages/concordia-app/src/views/Register/SignUpStep/index.jsx

@ -6,9 +6,9 @@ import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { drizzle } from '../../../redux/store'; import { drizzle } from '../../../redux/store';
import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../../constants/TransactionStatus'; import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../../constants/TransactionStatus';
import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames';
import UsernameSelector from '../../../components/UsernameSelector'; import UsernameSelector from '../../../components/UsernameSelector';
const { contracts: { [FORUM_CONTRACT]: { methods: { signUp } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { signUp } } } } = drizzle;

6
packages/concordia-app/src/views/Topic/TopicCreate/index.jsx

@ -8,13 +8,13 @@ import { useTranslation } from 'react-i18next';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import { useSelector } from 'react-redux'; import { useSelector } from 'react-redux';
import './styles.css'; import './styles.css';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { TOPIC_CREATED_EVENT } from 'concordia-shared/src/constants/contracts/events/ForumContractEvents';
import { POSTS_DATABASE, TOPICS_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import { drizzle, breeze } from '../../../redux/store'; import { drizzle, breeze } from '../../../redux/store';
import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../../constants/TransactionStatus'; import { TRANSACTION_ERROR, TRANSACTION_SUCCESS } from '../../../constants/TransactionStatus';
import { POSTS_DATABASE, TOPICS_DATABASE } from '../../../constants/orbit/OrbitDatabases';
import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys'; import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys';
import { POST_CONTENT } from '../../../constants/orbit/PostsDatabaseKeys'; import { POST_CONTENT } from '../../../constants/orbit/PostsDatabaseKeys';
import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames';
import { TOPIC_CREATED_EVENT } from '../../../constants/contracts/events/ForumContractEvents';
const { contracts: { [FORUM_CONTRACT]: { methods: { createTopic } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { createTopic } } } } = drizzle;
const { orbit: { stores } } = breeze; const { orbit: { stores } } = breeze;

4
packages/concordia-app/src/views/Topic/TopicView/index.jsx

@ -7,16 +7,16 @@ import {
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { useHistory } from 'react-router'; import { useHistory } from 'react-router';
import TimeAgo from 'react-timeago'; import TimeAgo from 'react-timeago';
import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import { TOPICS_DATABASE, USER_DATABASE } from 'concordia-shared/src/constants/orbit/OrbitDatabases';
import { breeze, drizzle } from '../../../redux/store'; import { breeze, drizzle } from '../../../redux/store';
import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions'; import { FETCH_USER_DATABASE } from '../../../redux/actions/peerDbReplicationActions';
import './styles.css'; import './styles.css';
import PostList from '../../../components/PostList'; import PostList from '../../../components/PostList';
import { TOPICS_DATABASE, USER_DATABASE } from '../../../constants/orbit/OrbitDatabases';
import determineKVAddress from '../../../utils/orbitUtils'; import determineKVAddress from '../../../utils/orbitUtils';
import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys'; import { USER_PROFILE_PICTURE } from '../../../constants/orbit/UserDatabaseKeys';
import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys'; import { TOPIC_SUBJECT } from '../../../constants/orbit/TopicsDatabaseKeys';
import PostCreate from '../../../components/PostCreate'; import PostCreate from '../../../components/PostCreate';
import { FORUM_CONTRACT } from '../../../constants/contracts/ContractNames';
const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { cacheCall: getTopicChainData } } } } } = drizzle; const { contracts: { [FORUM_CONTRACT]: { methods: { getTopic: { cacheCall: getTopicChainData } } } } } = drizzle;
const { orbit } = breeze; const { orbit } = breeze;

4
packages/concordia-contracts-provider/package.json

@ -5,10 +5,12 @@
"private": true, "private": true,
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"start": "node -r esm src/index.js" "start": "node -r esm src/index.js",
"lint": "eslint --ext js,jsx . --format table"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"concordia-shared": "~0.1.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"esm": "~3.2.25", "esm": "~3.2.25",
"express": "^4.17.1", "express": "^4.17.1",

2
packages/concordia-contracts-provider/src/constants.js

@ -1,11 +1,9 @@
import path from 'path'; import path from 'path';
const PROVIDER_PORT = '8400';
const UPLOAD_CONTRACTS_DIRECTORY = path.join(__dirname, '..', 'contracts-uploads'); const UPLOAD_CONTRACTS_DIRECTORY = path.join(__dirname, '..', 'contracts-uploads');
const CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:7000', 'http://localhost:7000']; const CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:7000', 'http://localhost:7000'];
export default { export default {
port: PROVIDER_PORT,
uploadsDirectory: UPLOAD_CONTRACTS_DIRECTORY, uploadsDirectory: UPLOAD_CONTRACTS_DIRECTORY,
corsAllowedOrigins: CORS_ALLOWED_ORIGINS, corsAllowedOrigins: CORS_ALLOWED_ORIGINS,
}; };

6
packages/concordia-contracts-provider/src/index.js

@ -1,9 +1,9 @@
import express from 'express'; import express from 'express';
import cors from 'cors'; import cors from 'cors';
import { contractsProviderPort } from 'concordia-shared/src/environment/interpolated/contractsProvider';
import initRoutes from './routes/web'; import initRoutes from './routes/web';
import constants from './constants'; import constants from './constants';
const PROVIDER_PORT = process.env.CONTRACTS_PROVIDER_PORT || constants.port;
const ALLOWED_ORIGINS = process.env.CORS_ALLOWED_ORIGINS const ALLOWED_ORIGINS = process.env.CORS_ALLOWED_ORIGINS
? process.env.CORS_ALLOWED_ORIGINS.split(';') ? process.env.CORS_ALLOWED_ORIGINS.split(';')
: constants.corsAllowedOrigins; : constants.corsAllowedOrigins;
@ -20,6 +20,6 @@ app.use(cors(corsOptions));
initRoutes(app); initRoutes(app);
app.listen(PROVIDER_PORT, () => { app.listen(contractsProviderPort, () => {
console.log(`Contracts provider listening at http://127.0.0.1:${PROVIDER_PORT}`); console.log(`Contracts provider listening at http://127.0.0.1:${contractsProviderPort}`);
}); });

21
packages/concordia-contracts/constants/config/defaults.js

@ -1,21 +0,0 @@
const DEVELOP_CHAIN_HOST_DEFAULT = '127.0.0.1';
const DEVELOP_CHAIN_PORT_DEFAULT = '8545';
const TEST_CHAIN_HOST_DEFAULT = '127.0.0.1';
const TEST_CHAIN_PORT_DEFAULT = '8546';
const CONTRACTS_PROVIDER_HOST_DEFAULT = '127.0.0.1';
const CONTRACTS_PROVIDER_PORT_DEFAULT = '8400';
module.exports = {
develop: {
chainHost: DEVELOP_CHAIN_HOST_DEFAULT,
chainPort: DEVELOP_CHAIN_PORT_DEFAULT,
},
test: {
chainHost: TEST_CHAIN_HOST_DEFAULT,
chainPort: TEST_CHAIN_PORT_DEFAULT,
},
contractsProviderHost: CONTRACTS_PROVIDER_HOST_DEFAULT,
contractsProviderPort: CONTRACTS_PROVIDER_PORT_DEFAULT,
};

1
packages/concordia-contracts/package.json

@ -17,6 +17,7 @@
}, },
"dependencies": { "dependencies": {
"@openzeppelin/contracts": "~3.3.0", "@openzeppelin/contracts": "~3.3.0",
"concordia-shared": "~0.1.0",
"truffle": "~5.1.58", "truffle": "~5.1.58",
"unirest": "^0.6.0" "unirest": "^0.6.0"
}, },

19
packages/concordia-contracts/truffle-config.js

@ -1,9 +1,6 @@
const path = require('path'); const path = require('path');
const defaults = require('./constants/config/defaults'); const web3EnvInterpolated = require('concordia-shared/src/environment/interpolated/web3');
const configurationDefaults = require('concordia-shared/src/constants/configuration/defaults');
const {
CHAIN_HOST, CHAIN_PORT,
} = process.env;
module.exports = { module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration> // See <http://truffleframework.com/docs/advanced/configuration>
@ -16,18 +13,18 @@ module.exports = {
contracts_build_directory: path.join(__dirname, 'build/'), contracts_build_directory: path.join(__dirname, 'build/'),
networks: { networks: {
develop: { develop: {
host: defaults.develop.chainHost, host: configurationDefaults.web3.develop.chainHost,
port: defaults.develop.chainPort, port: configurationDefaults.web3.develop.chainPort,
network_id: '*', network_id: '*',
}, },
test: { test: {
host: defaults.test.chainHost, host: configurationDefaults.web3.test.chainHost,
port: defaults.test.chainPort, port: configurationDefaults.web3.test.chainPort,
network_id: '*', network_id: '*',
}, },
env: { env: {
host: CHAIN_HOST, host: web3EnvInterpolated.web3Host,
port: CHAIN_PORT, port: web3EnvInterpolated.web3Port,
network_id: '*', network_id: '*',
}, },
}, },

8
packages/concordia-contracts/utils/contractsProviderUtils.js

@ -1,13 +1,11 @@
const path = require('path'); const path = require('path');
const unirest = require('unirest'); const unirest = require('unirest');
const { contractsProviderHost } = require('concordia-shared/src/environment/interpolated/contractsProvider');
const { contractsProviderPort } = require('concordia-shared/src/environment/interpolated/contractsProvider');
const { contracts } = require('../index'); const { contracts } = require('../index');
const defaults = require('../constants/config/defaults');
const uploadContractsToProviderUnirest = (versionHash, tag) => { const uploadContractsToProviderUnirest = (versionHash, tag) => {
const CONTRACTS_PROVIDER_HOST = process.env.CONTRACTS_PROVIDER_HOST || defaults.contractsProviderHost; const uploadPath = `http://${contractsProviderHost}:${contractsProviderPort}/contracts/${versionHash}`;
const CONTRACTS_PROVIDER_PORT = process.env.CONTRACTS_PROVIDER_PORT || defaults.contractsProviderPort;
const uploadPath = `http://${CONTRACTS_PROVIDER_HOST}:${CONTRACTS_PROVIDER_PORT}/contracts/${versionHash}`;
const request = unirest('POST', uploadPath) const request = unirest('POST', uploadPath)
.field('tag', tag); .field('tag', tag);

5
packages/concordia-pinner/package.json

@ -6,13 +6,14 @@
"main": "src/index.js", "main": "src/index.js",
"scripts": { "scripts": {
"start": "node -r esm src/index.js", "start": "node -r esm src/index.js",
"clean": "rimraf ipfs orbitdb" "clean": "rimraf ipfs orbitdb",
"lint": "eslint --ext js,jsx . --format table"
}, },
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@ezerous/eth-identity-provider": "~0.1.2", "@ezerous/eth-identity-provider": "~0.1.2",
"concordia-app": "~0.1.0",
"concordia-contracts": "~0.1.0", "concordia-contracts": "~0.1.0",
"concordia-shared": "~0.1.0",
"esm": "~3.2.25", "esm": "~3.2.25",
"express": "^4.17.1", "express": "^4.17.1",
"ipfs": "~0.52.1", "ipfs": "~0.52.1",

16
packages/concordia-pinner/src/app.js

@ -1,7 +1,9 @@
import express from 'express'; import express from 'express';
import _ from 'lodash'; import _ from 'lodash';
import isReachable from 'is-reachable'; import isReachable from 'is-reachable';
import { API_PORT, RENDEZVOUS_URL, WEB3_PROVIDER_URL } from './constants'; import { pinnerApiPort } from 'concordia-shared/src/environment/interpolated/pinner';
import getWeb3ProviderUrl from 'concordia-shared/src/utils/web3';
import getRendezvousUrl from 'concordia-shared/src/utils/rendezvous';
const POLLING_INTERVAL = 1000; const POLLING_INTERVAL = 1000;
@ -10,8 +12,8 @@ const responseBody = {
id: '', localAddresses: [], peers: [], totalPeers: 0, repoStats: {}, id: '', localAddresses: [], peers: [], totalPeers: 0, repoStats: {},
}, },
orbit: { identity: {}, databases: [] }, orbit: { identity: {}, databases: [] },
web3: { url: WEB3_PROVIDER_URL, reachable: false }, web3: { url: getWeb3ProviderUrl(), reachable: false },
rendezvous: { url: RENDEZVOUS_URL, reachable: false }, rendezvous: { url: getRendezvousUrl(), reachable: false },
timestamp: 0, timestamp: 0,
}; };
@ -26,8 +28,8 @@ async function getStats(orbit) {
const uniquePeers = _.uniqBy(peers, 'peer'); const uniquePeers = _.uniqBy(peers, 'peer');
const orbitIdentity = orbit.identity; const orbitIdentity = orbit.identity;
const databases = Object.keys(orbit.stores); const databases = Object.keys(orbit.stores);
const isWeb3Reachable = await isReachable(WEB3_PROVIDER_URL); const isWeb3Reachable = await isReachable(getWeb3ProviderUrl());
const isRendezvousReachable = await isReachable(RENDEZVOUS_URL); const isRendezvousReachable = await isReachable(getRendezvousUrl());
const timestamp = +new Date(); const timestamp = +new Date();
responseBody.ipfs.id = id; responseBody.ipfs.id = id;
@ -51,8 +53,8 @@ const startAPI = (orbit) => {
res.send(responseBody); res.send(responseBody);
}); });
app.listen(API_PORT, () => { app.listen(pinnerApiPort, () => {
console.log(`Pinner API at http://localhost:${API_PORT}!`); console.log(`Pinner API at http://localhost:${pinnerApiPort}!`);
}); });
setInterval(getStats, POLLING_INTERVAL, orbit); setInterval(getStats, POLLING_INTERVAL, orbit);

15
packages/concordia-pinner/src/constants.js

@ -1,17 +1,6 @@
import breezeOptions, { RENDEZVOUS_URL } from 'concordia-app/src/options/breezeOptions';
import { WEB3_HOST_DEFAULT, WEB3_PORT_DEFAULT } from 'concordia-app/src/constants/configuration/defaults';
import path from 'path'; import path from 'path';
import getBreezeConfiguration from 'concordia-shared/src/configuration/breezeConfiguration';
const { WEB3_HOST, WEB3_PORT } = process.env; export const swarmAddresses = getBreezeConfiguration().ipfs.config.Addresses.Swarm;
const API_PORT = process.env.PINNER_API_PORT || 4444;
const WEB3_PROVIDER_URL = (WEB3_HOST !== undefined && WEB3_PORT !== undefined)
? `ws://${WEB3_HOST}:${WEB3_PORT}`
: `ws://${WEB3_HOST_DEFAULT}:${WEB3_PORT_DEFAULT}`;
export const swarmAddresses = breezeOptions.ipfs.config.Addresses.Swarm;
export const ORBIT_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'orbitdb'); export const ORBIT_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'orbitdb');
export { API_PORT, WEB3_PROVIDER_URL, RENDEZVOUS_URL };

8
packages/concordia-pinner/src/index.js

@ -2,10 +2,10 @@ import Web3 from 'web3';
import Contract from 'web3-eth-contract'; import Contract from 'web3-eth-contract';
import IPFS from 'ipfs'; import IPFS from 'ipfs';
import { contracts } from 'concordia-contracts'; import { contracts } from 'concordia-contracts';
import { FORUM_CONTRACT } from 'concordia-app/src/constants/contracts/ContractNames'; import { FORUM_CONTRACT } from 'concordia-shared/src/constants/contracts/ContractNames';
import getWeb3ProviderUrl from 'concordia-shared/src/utils/web3';
import { createOrbitInstance, getPeerDatabases, openKVDBs } from './utils/orbitUtils'; import { createOrbitInstance, getPeerDatabases, openKVDBs } from './utils/orbitUtils';
import ipfsOptions from './options/ipfsOptions'; import ipfsOptions from './options/ipfsOptions';
import { WEB3_PROVIDER_URL } from './constants';
import startAPI from './app'; import startAPI from './app';
process.on('unhandledRejection', (error) => { process.on('unhandledRejection', (error) => {
@ -26,7 +26,7 @@ const getDeployedContract = async (web3) => {
return web3.eth.net.getId() return web3.eth.net.getId()
.then((networkId) => forumContract.networks[networkId].address) .then((networkId) => forumContract.networks[networkId].address)
.then((contractAddress) => { .then((contractAddress) => {
Contract.setProvider(WEB3_PROVIDER_URL); Contract.setProvider(getWeb3ProviderUrl());
const contract = new Contract(forumContract.abi, contractAddress); const contract = new Contract(forumContract.abi, contractAddress);
return { contract, contractAddress }; return { contract, contractAddress };
@ -54,7 +54,7 @@ const handleWeb3LogEvent = (web3, eventJsonInterface, orbit) => (error, result)
const main = async () => { const main = async () => {
console.log('Initializing...'); console.log('Initializing...');
const web3 = new Web3(new Web3.providers.WebsocketProvider(WEB3_PROVIDER_URL)); const web3 = new Web3(new Web3.providers.WebsocketProvider(getWeb3ProviderUrl()));
getDeployedContract(web3) getDeployedContract(web3)
.then(({ contract, contractAddress }) => IPFS.create(ipfsOptions) .then(({ contract, contractAddress }) => IPFS.create(ipfsOptions)

60
packages/concordia-shared/.eslintrc.js

@ -0,0 +1,60 @@
module.exports = {
'env': {
'browser': true,
'es6': true,
'jest': true
},
'extends': [
'plugin:react/recommended',
'airbnb'
],
'globals': {
'Atomics': 'readonly',
'SharedArrayBuffer': 'readonly'
},
parser: 'babel-eslint',
'parserOptions': {
'ecmaFeatures': {
'jsx': true
},
'ecmaVersion': 2018,
'sourceType': 'module'
},
'plugins': [
'react',
'react-hooks',
],
'rules': {
'react/jsx-props-no-spreading': 'off',
'import/extensions': 'off',
"react/jsx-indent": [
'error',
4,
{
checkAttributes: true,
indentLogicalExpressions: true
}
],
'react/require-default-props': 'off',
'react/prop-types': 'off',
'react-hooks/rules-of-hooks': 'error',
'react-hooks/exhaustive-deps': 'error',
'max-len': ['warn', {'code': 120, 'tabWidth': 4}],
'no-unused-vars': 'warn',
'no-console': 'warn',
'no-shadow': 'warn',
"no-multi-str": "warn",
"jsx-a11y/label-has-associated-control": [ 2, {
"labelAttributes": ["label"],
"controlComponents": ["Input"],
"depth": 3,
}],
},
'settings': {
'import/resolver': {
'node': {
'extensions': ['.js', '.jsx']
}
}
},
};

16
packages/concordia-shared/package.json

@ -0,0 +1,16 @@
{
"name": "concordia-shared",
"version": "0.1.0",
"private": true,
"scripts": {
"lint": "eslint --ext js,jsx . --format table"
},
"devDependencies": {
"eslint": "^6.8.0",
"eslint-config-airbnb": "^18.1.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-jsx-a11y": "^6.2.3",
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^4.2.0"
}
}

33
packages/concordia-shared/src/configuration/breezeConfiguration.js

@ -0,0 +1,33 @@
const { databases } = require('../constants/orbit/OrbitDatabases');
const { rendezvousHost, rendezvousPort } = require('../environment/interpolated/rendezvous');
const getBreezeConfiguration = (identityProvider) => ({
ipfs: {
repo: 'concordia',
config: {
Addresses: {
Swarm: [
// Use local signaling server (see also rendezvous script in package.json)
// For more information: https://github.com/libp2p/js-libp2p-webrtc-star
`/ip4/${rendezvousHost}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`,
// Use the following public servers if needed
// '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',
// '/dns4/ wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star'
],
},
},
preload: {
enabled: false,
},
init: {
emptyRepo: true,
},
},
orbit: {
identityProvider,
databases,
},
});
module.exports = getBreezeConfiguration;

25
packages/concordia-shared/src/configuration/web3Configuration.js

@ -0,0 +1,25 @@
const getWeb3ProviderUrl = require('../utils/web3');
const { web3PortSocketConnectMaxAttempts, web3PortSocketTimeout } = require('../environment/interpolated/web3');
const { web3HostEnv, web3PortEnv } = require('../environment/web3Env');
const getWeb3Configuration = (Web3) => {
const web3WebsocketOptions = {
keepAlive: true,
timeout: web3PortSocketTimeout,
reconnect: {
maxAttempts: web3PortSocketConnectMaxAttempts,
},
};
const web3 = (web3HostEnv !== undefined && web3PortEnv !== undefined)
? new Web3(new Web3.providers.WebsocketProvider(getWeb3ProviderUrl()))
: new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider(getWeb3ProviderUrl(), web3WebsocketOptions));
return {
customProvider: web3,
};
};
module.exports = {
getWeb3Configuration,
};

46
packages/concordia-shared/src/constants/configuration/defaults.js

@ -0,0 +1,46 @@
// Contracts provider
const CONTRACTS_PROVIDER_HOST_DEFAULT = '127.0.0.1';
const CONTRACTS_PROVIDER_PORT_DEFAULT = '8400';
const CONTRACTS_VERSION_HASH_DEFAULT = 'latest';
// Pinner
const PINNER_API_PORT_DEFAULT = 4444;
// Rendezvous
const RENDEZVOUS_HOST_DEFAULT = '127.0.0.1';
const RENDEZVOUS_PORT_DEFAULT = '9090';
// Web3 (probably ganache)
const WEB3_HOST_DEFAULT = '127.0.0.1';
const WEB3_PORT_DEFAULT = '8545';
const WEB3_HOST_TEST_DEFAULT = '127.0.0.1';
const WEB3_PORT_TEST_DEFAULT = '8546';
const WEB3_PORT_SOCKET_TIMEOUT_DEFAULT = 30000;
const WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT = 3;
module.exports = Object.freeze({
contractsProvider: {
host: CONTRACTS_PROVIDER_HOST_DEFAULT,
port: CONTRACTS_PROVIDER_PORT_DEFAULT,
hash: CONTRACTS_VERSION_HASH_DEFAULT,
},
pinner: {
port: PINNER_API_PORT_DEFAULT,
},
rendezvous: {
host: RENDEZVOUS_HOST_DEFAULT,
port: RENDEZVOUS_PORT_DEFAULT,
},
web3: {
develop: {
chainHost: WEB3_HOST_DEFAULT,
chainPort: WEB3_PORT_DEFAULT,
},
test: {
chainHost: WEB3_HOST_TEST_DEFAULT,
chainPort: WEB3_PORT_TEST_DEFAULT,
},
socketTimeout: WEB3_PORT_SOCKET_TIMEOUT_DEFAULT,
socketConnectMaxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT,
},
});

16
packages/concordia-shared/src/constants/contracts/ContractNames.js

@ -0,0 +1,16 @@
const FORUM_CONTRACT = 'Forum';
const POST_VOTING_CONTRACT = 'PostVoting';
const VOTING_CONTRACT = 'Voting';
const CONTRACTS = [
FORUM_CONTRACT,
POST_VOTING_CONTRACT,
VOTING_CONTRACT,
];
module.exports = Object.freeze({
FORUM_CONTRACT,
POST_VOTING_CONTRACT,
VOTING_CONTRACT,
CONTRACTS,
});

19
packages/concordia-shared/src/constants/contracts/events/ForumContractEvents.js

@ -0,0 +1,19 @@
const USER_SIGNED_UP_EVENT = 'UserSignedUp';
const USERNAME_UPDATED_EVENT = 'UsernameUpdated';
const TOPIC_CREATED_EVENT = 'TopicCreated';
const POST_CREATED_EVENT = 'PostCreated';
const forumContractEvents = Object.freeze([
USER_SIGNED_UP_EVENT,
USERNAME_UPDATED_EVENT,
TOPIC_CREATED_EVENT,
POST_CREATED_EVENT,
]);
module.exports = {
USER_SIGNED_UP_EVENT,
USERNAME_UPDATED_EVENT,
TOPIC_CREATED_EVENT,
POST_CREATED_EVENT,
forumContractEvents,
};

8
packages/concordia-shared/src/constants/contracts/events/index.js

@ -0,0 +1,8 @@
const forumContractEvents = require('./ForumContractEvents');
const { FORUM_CONTRACT } = require('../ContractNames');
const appEvents = Object.freeze({
[FORUM_CONTRACT]: forumContractEvents,
});
module.exports = appEvents;

13
packages/concordia-app/src/constants/orbit/OrbitDatabases.js → packages/concordia-shared/src/constants/orbit/OrbitDatabases.js

@ -1,6 +1,6 @@
export const USER_DATABASE = 'user'; const USER_DATABASE = 'user';
export const TOPICS_DATABASE = 'topics'; const TOPICS_DATABASE = 'topics';
export const POSTS_DATABASE = 'posts'; const POSTS_DATABASE = 'posts';
const databases = [ const databases = [
{ {
@ -17,4 +17,9 @@ const databases = [
}, },
]; ];
export default databases; module.exports = Object.freeze({
USER_DATABASE,
TOPICS_DATABASE,
POSTS_DATABASE,
databases,
});

14
packages/concordia-shared/src/environment/contractsProviderEnv.js

@ -0,0 +1,14 @@
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
// the REACT_APP_ prefix or not
const contractsProviderHostEnv = process.env.REACT_APP_CONTRACTS_PROVIDER_HOST
|| process.env.CONTRACTS_PROVIDER_HOST;
const contractsProviderPortEnv = process.env.REACT_APP_CONTRACTS_PROVIDER_PORT
|| process.env.CONTRACTS_PROVIDER_PORT;
const contractsVersionHashEnv = process.env.REACT_APP_CONTRACTS_VERSION_HASH
|| process.env.CONTRACTS_VERSION_HASH;
module.exports = {
contractsProviderHostEnv,
contractsProviderPortEnv,
contractsVersionHashEnv,
};

21
packages/concordia-shared/src/environment/interpolated/contractsProvider.js

@ -0,0 +1,21 @@
const {
contractsProviderHostEnv, contractsProviderPortEnv, contractsVersionHashEnv,
} = require('../contractsProviderEnv');
const {
contractsProvider: {
host: CONTRACTS_PROVIDER_HOST_DEFAULT,
port: CONTRACTS_PROVIDER_PORT_DEFAULT,
hash: CONTRACTS_VERSION_HASH_DEFAULT,
},
} = require('../../constants/configuration/defaults');
const contractsProviderHost = contractsProviderHostEnv || CONTRACTS_PROVIDER_HOST_DEFAULT;
const contractsProviderPort = contractsProviderPortEnv || CONTRACTS_PROVIDER_PORT_DEFAULT;
const contractsVersionHash = contractsVersionHashEnv || CONTRACTS_VERSION_HASH_DEFAULT;
module.exports = {
contractsProviderHost,
contractsProviderPort,
contractsVersionHash,
};

12
packages/concordia-shared/src/environment/interpolated/pinner.js

@ -0,0 +1,12 @@
const {
pinner: {
port: PINNER_API_PORT_DEFAULT,
},
} = require('../../constants/configuration/defaults');
const { pinnerApiPortEnv } = require('../pinnerEnv');
const pinnerApiPort = pinnerApiPortEnv || PINNER_API_PORT_DEFAULT;
module.exports = {
pinnerApiPort,
};

15
packages/concordia-shared/src/environment/interpolated/rendezvous.js

@ -0,0 +1,15 @@
const { rendezvousHostEnv, rendezvousPortEnv } = require('../rendezvousEnv');
const {
rendezvous: {
host: RENDEZVOUS_HOST_DEFAULT,
port: RENDEZVOUS_PORT_DEFAULT,
},
} = require('../../constants/configuration/defaults');
const rendezvousHost = rendezvousHostEnv || RENDEZVOUS_HOST_DEFAULT;
const rendezvousPort = rendezvousPortEnv || RENDEZVOUS_PORT_DEFAULT;
module.exports = {
rendezvousHost,
rendezvousPort,
};

9
packages/concordia-shared/src/environment/interpolated/shared.js

@ -0,0 +1,9 @@
const contractsProvider = require('./contractsProvider');
const rendezvous = require('./rendezvous');
const web3 = require('./web3');
module.exports = {
contractsProvider,
rendezvous,
web3,
};

37
packages/concordia-shared/src/environment/interpolated/web3.js

@ -0,0 +1,37 @@
const {
web3: {
develop: {
chainHost: WEB3_HOST_DEFAULT,
chainPort: WEB3_PORT_DEFAULT,
},
test: {
chainHost: WEB3_HOST_TEST_DEFAULT,
chainPort: WEB3_PORT_TEST_DEFAULT,
},
socketConnectMaxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT,
socketTimeout: WEB3_PORT_SOCKET_TIMEOUT_DEFAULT,
},
} = require('../../constants/configuration/defaults');
const {
web3HostEnv, web3HostTestEnv, web3PortEnv, web3PortSocketConnectMaxAttemptsEnv, web3PortSocketTimeoutEnv,
web3PortTestEnv,
} = require('../web3Env');
const web3Host = web3HostEnv || WEB3_HOST_DEFAULT;
const web3Port = web3PortEnv || WEB3_PORT_DEFAULT;
const web3HostTest = web3HostTestEnv || WEB3_HOST_TEST_DEFAULT;
const web3PortTest = web3PortTestEnv || WEB3_PORT_TEST_DEFAULT;
const web3PortSocketTimeout = web3PortSocketTimeoutEnv || WEB3_PORT_SOCKET_TIMEOUT_DEFAULT;
const web3PortSocketConnectMaxAttempts = web3PortSocketConnectMaxAttemptsEnv
|| WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT;
module.exports = {
web3Host,
web3Port,
web3HostTest,
web3PortTest,
web3PortSocketTimeout,
web3PortSocketConnectMaxAttempts,
};

7
packages/concordia-shared/src/environment/pinnerEnv.js

@ -0,0 +1,7 @@
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
// the REACT_APP_ prefix or not
const pinnerApiPortEnv = process.env.REACT_APP_PINNER_API_PORT || process.env.PINNER_API_PORT;
module.exports = {
pinnerApiPortEnv,
};

9
packages/concordia-shared/src/environment/rendezvousEnv.js

@ -0,0 +1,9 @@
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
// the REACT_APP_ prefix or not
const rendezvousHostEnv = process.env.REACT_APP_RENDEZVOUS_HOST || process.env.RENDEZVOUS_HOST;
const rendezvousPortEnv = process.env.REACT_APP_RENDEZVOUS_PORT || process.env.RENDEZVOUS_PORT;
module.exports = {
rendezvousHostEnv,
rendezvousPortEnv,
};

9
packages/concordia-shared/src/environment/sharedEnv.js

@ -0,0 +1,9 @@
const contractsProvider = require('./contractsProviderEnv');
const rendezvous = require('./rendezvousEnv');
const web3 = require('./web3Env');
module.exports = {
contractsProvider,
rendezvous,
web3,
};

24
packages/concordia-shared/src/environment/web3Env.js

@ -0,0 +1,24 @@
// Depending on the package user (app in contrast to any of the other packages) the env var names should either include
// the REACT_APP_ prefix or not
const web3HostEnv = process.env.REACT_APP_WEB3_HOST
|| process.env.WEB3_HOST;
const web3PortEnv = process.env.REACT_APP_WEB3_PORT
|| process.env.WEB3_PORT;
// Web3 test environment shouldn't be available to the react app
const web3HostTestEnv = process.env.WEB3_HOST_TEST;
const web3PortTestEnv = process.env.WEB3_PORT_TEST;
const web3PortSocketTimeoutEnv = process.env.REACT_APP_WEB3_PORT_SOCKET_TIMEOUT
|| process.env.WEB3_PORT_SOCKET_TIMEOUT;
const web3PortSocketConnectMaxAttemptsEnv = process.env.REACT_APP_WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS
|| process.env.WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS;
module.exports = {
web3HostEnv,
web3PortEnv,
web3HostTestEnv,
web3PortTestEnv,
web3PortSocketTimeoutEnv,
web3PortSocketConnectMaxAttemptsEnv,
};

5
packages/concordia-shared/src/utils/rendezvous.js

@ -0,0 +1,5 @@
const { rendezvousHost, rendezvousPort } = require('../environment/interpolated/rendezvous');
const getRendezvousUrl = () => `http://${rendezvousHost}:${rendezvousPort}`;
module.exports = getRendezvousUrl;

6
packages/concordia-shared/src/utils/web3.js

@ -0,0 +1,6 @@
const { web3Port } = require('../environment/interpolated/web3');
const { web3Host } = require('../environment/interpolated/web3');
const getWeb3ProviderUrl = () => `ws://${web3Host}:${web3Port}`;
module.exports = getWeb3ProviderUrl;

6
yarn.lock

@ -5762,9 +5762,9 @@ ee-first@1.1.1:
integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=
ejs@^3.1.5: ejs@^3.1.5:
version "3.1.5" version "3.1.6"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.5.tgz#aed723844dc20acb4b170cd9ab1017e476a0d93b" resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.6.tgz#5bfd0a0689743bb5268b3550cceeebbc1702822a"
integrity sha512-dldq3ZfFtgVTJMLjOe+/3sROTzALlL9E34V4/sDtUd/KlBSS0s6U1/+WPE1B4sj9CXHJpL1M6rhNJnc9Wbal9w== integrity sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==
dependencies: dependencies:
jake "^10.6.1" jake "^10.6.1"

Loading…
Cancel
Save