mirror of https://gitlab.com/ecentrics/concordia
Apostolos Fanakis
4 years ago
29 changed files with 99 additions and 57 deletions
@ -0,0 +1,12 @@ |
|||||
|
# This is an example development configuration for the app |
||||
|
# To create your own configuration, copy this one and ommit the ".example" from the filename, then change the |
||||
|
# environment cariables to the prefered values. |
||||
|
|
||||
|
# Node dev-server host & port |
||||
|
HOST=localhost |
||||
|
PORT=7000 |
||||
|
|
||||
|
# Variables needed in runtime (in browser) |
||||
|
# Carefull, IPFS won't accept localhost as a valid hostname |
||||
|
REACT_APP_RENDEZVOUS_HOST=localhost |
||||
|
REACT_APP_RENDEZVOUS_PORT=9090 |
@ -1,2 +0,0 @@ |
|||||
export const PLACEHOLDER_TYPE_TOPIC = 'PLACEHOLDER_TYPE_TOPIC'; |
|
||||
export const PLACEHOLDER_TYPE_POST = 'PLACEHOLDER_TYPE_POST'; |
|
@ -0,0 +1,7 @@ |
|||||
|
export const WEB3_HOST_DEFAULT = '127.0.0.1'; |
||||
|
export const WEB3_PORT_DEFAULT = '8545'; |
||||
|
export const WEB3_PORT_SOCKET_TIMEOUT_DEFAULT = 30000; |
||||
|
export const WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT = 3; |
||||
|
|
||||
|
export const REACT_APP_RENDEZVOUS_HOST_DEFAULT = '127.0.0.1'; |
||||
|
export const REACT_APP_RENDEZVOUS_PORT_DEFAULT = '9090'; |
@ -0,0 +1,8 @@ |
|||||
|
import { FORUM_CONTRACT } from '../ContractNames'; |
||||
|
import forumContractEvents from './ForumContractEvents'; |
||||
|
|
||||
|
const appEvents = { |
||||
|
[FORUM_CONTRACT]: forumContractEvents, |
||||
|
}; |
||||
|
|
||||
|
export default appEvents; |
@ -1,14 +1,29 @@ |
|||||
import Web3 from 'web3'; |
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_URL, WEB3_PORT } = process.env; |
const { WEB3_HOST, WEB3_PORT, WEBSOCKET_TIMEOUT } = process.env; |
||||
|
|
||||
// We need fallback ws://127.0.0.1:8545 because drizzle has not the patched web3 we use here
|
const web3WebsocketOptions = { |
||||
const web3 = (WEB3_URL && WEB3_PORT) |
keepAlive: true, |
||||
? `ws://${WEB3_URL}:${WEB3_PORT}` |
timeout: WEBSOCKET_TIMEOUT !== undefined ? WEBSOCKET_TIMEOUT : WEB3_PORT_SOCKET_TIMEOUT_DEFAULT, |
||||
: new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider('ws://127.0.0.1:8545')); |
reconnect: { |
||||
|
maxAttempts: WEB3_PORT_SOCKET_CONNECT_MAX_ATTEMPTS_DEFAULT, |
||||
|
}, |
||||
|
}; |
||||
|
|
||||
|
const web3 = (WEB3_HOST !== undefined && WEB3_PORT !== undefined) |
||||
|
? `ws://${WEB3_HOST}:${WEB3_PORT}` |
||||
|
: new Web3(Web3.givenProvider || new Web3.providers.WebsocketProvider( |
||||
|
`ws://${WEB3_HOST_DEFAULT}:${WEB3_PORT_DEFAULT}`, web3WebsocketOptions, |
||||
|
)); |
||||
|
|
||||
const web3Options = { |
const web3Options = { |
||||
web3, |
customProvider: web3, |
||||
}; |
}; |
||||
|
|
||||
export default web3Options; |
export default web3Options; |
||||
|
Loading…
Reference in new issue