Skip to content

Commit

Permalink
Merge branch 'feat/integration' into feat/packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
angrybayblade committed Feb 22, 2024
2 parents 1fc7e94 + 76ebf9f commit 91c1098
Show file tree
Hide file tree
Showing 83 changed files with 846 additions and 797 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
FORK_URL=
NODE_ENV=
NODE_ENV=
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ For development, we have been using Ubuntu 22.04.

Create an `.env` file in the root directory, or rename `.env.example` to `.env`.

#### NODE_ENV
For development usage, set `NODE_ENV=development`.
For production usage, set `NODE_ENV=production`.

#### HARDHAT_GNOSIS_URL
Only required for forking Gnosis during development.
You can get a Gnosis RPC from [Nodies](https://www.nodies.app/).
Then set `HARDHAT_GNOSIS_URL=https://....`

### Ensure Docker v24 is installed

You can change the ubuntu.XX.XX~XX version to your OS in the following command:
Expand Down Expand Up @@ -131,6 +137,10 @@ Copy any one of these private keys into `/backend/.operate/key.txt`.

Be sure to kill the Hardhat node once you have completed this step.

### Setup hardhat forking RPC (if running development mode)

Update the `hardhat.config.js` file in the root directory to include a Gnosis RPC.

### Run the development app

**If you are using the app in `production` mode** (having set this in your `.env` file), you will need to build the frontend first. You can achieve this by running:
Expand All @@ -152,7 +162,6 @@ This will run Electron which launches NextJS, Backend, and Hardhat as child proc
## Further notes / issues

- Only one agent can be run at a time.
- Hardhat node RPC is pre-populated during Spawn process for ease of development, this will be removed.
- Uncomment `mainWindow.webContents.openDevTools()` in electron/main.js to display Chromium dev tools in the Electron app
- "Delete endpoint" not currently avaiable, you must manually delete the relevant service directories from the /backend/operate/services folder to remove them, the app must be restarted after this.
- Port conflict solution has not been implemented yet.
4 changes: 4 additions & 0 deletions electron/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const ERROR_ADDRESS_IN_USE = "EADDRINUSE";
module.exports = {
ERROR_ADDRESS_IN_USE,
};
4 changes: 3 additions & 1 deletion electron/docker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
const Docker = require("dockerode");

const connectionRefusedCode = "ECONNREFUSED";

const docker = new Docker(
process.platform === "win32"
? { socketPath: "//./pipe/docker_engine" }
Expand All @@ -10,7 +12,7 @@ function isDockerRunning() {
return new Promise((resolve, reject) => {
docker.ping((err) => {
if (err) {
if (err.code === "ECONNREFUSED") {
if (err.code === connectionRefusedCode) {
resolve(false); // Docker is not running
} else {
reject(err); // Error other than connection refused
Expand Down
9 changes: 5 additions & 4 deletions electron/ports.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
const net = require("net");
const { ERROR_ADDRESS_IN_USE } = require("./constants");

const portRange = { startPort: 39152, endPort: 65535 }; //only source dynamic and private ports https://www.arubanetworks.com/techdocs/AOS-S/16.10/MRG/YC/content/common%20files/tcp-por-num-ran.htm

const isPortAvailable = async (port) => {
return new global.Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
const server = net.createServer();

server.once("error", (err) => {
if (err.code === "EADDRINUSE") {
if (err.code === ERROR_ADDRESS_IN_USE) {
resolve(false);
} else {
reject(err);
Expand All @@ -24,11 +25,11 @@ const isPortAvailable = async (port) => {
};

const findAvailablePort = async (startPort, endPort) => {
return new global.Promise((resolve, reject) => {
return new Promise((resolve, reject) => {
const server = net.createServer();

server.on("error", (err) => {
if (err.code === "EADDRINUSE") {
if (err.code === ERROR_ADDRESS_IN_USE) {
if (startPort < endPort) {
findAvailablePort(startPort + 1, endPort)
.then(resolve)
Expand Down
8 changes: 0 additions & 8 deletions forge.config.js

This file was deleted.

3 changes: 2 additions & 1 deletion frontend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
"no-unused-vars": "warn",
"prettier/prettier": ["error", {
"endOfLine": "auto",
"semi": true
"semi": true,
"singleQuote": true
}],
"react/jsx-props-no-spreading": "off",
"react/no-array-index-key": "off",
Expand Down
2 changes: 1 addition & 1 deletion frontend/abi/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from "./multicall3Abi";
export * from './multicall3Abi';
Loading

0 comments on commit 91c1098

Please sign in to comment.