Skip to content

Commit

Permalink
Merge branch 'staging' of github.com:valory-xyz/olas-operate-app into…
Browse files Browse the repository at this point in the history
… feature/improve-app-closing-and-kill-procs
  • Loading branch information
solarw committed Oct 1, 2024
2 parents b0731b1 + a471109 commit 54745e3
Show file tree
Hide file tree
Showing 69 changed files with 1,287 additions and 494 deletions.
15 changes: 11 additions & 4 deletions .github/workflows/release_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ on:
jobs:
build-windows:
runs-on: windows-latest
strategy:
matrix:
include:
- env: "production"
rpc: "https://rpc-gate.autonolas.tech/gnosis-rpc/"
- env: "development"
rpc: "https://virtual.gnosis.rpc.tenderly.co/78ca845d-2b24-44a6-9ce2-869a979e8b5b"
defaults:
run:
shell: bash
Expand All @@ -33,15 +40,15 @@ jobs:
- name: Install dependencies
run: poetry install

- name: install node deps
- name: install all deps
run: yarn install-deps

- name: set env vars to prod.env
env:
NODE_ENV: production
DEV_RPC: https://rpc-gate.autonolas.tech/gnosis-rpc/
NODE_ENV: ${{ matrix.env }}
DEV_RPC: ${{ matrix.rpc }}
IS_STAGING: ${{ github.ref != 'refs/heads/main' && 'true' || 'false' }}
FORK_URL: https://rpc-gate.autonolas.tech/gnosis-rpc/
FORK_URL: ${{ matrix.rpc }}
GH_TOKEN: ${{ secrets.github_token}}
run: |
echo NODE_ENV=$NODE_ENV >> prod.env
Expand Down
12 changes: 8 additions & 4 deletions .gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,12 @@ regex = '''(?i)((key|api|token|secret|password)[a-z0-9_ .\-,]{0,25})(=|>|:=|\|\|
entropy = 3.7
secretGroup = 4


[allowlist]
description = "global allow lists"
regexes = ['''219-09-9999''', '''078-05-1120''', '''(9[0-9]{2}|666)-\d{2}-\d{4}''']
paths = ['''(.*?)(jpg|gif|doc|pdf|bin|svg|socket)$''']
description = "allowlist"
regexTarget = "match"
regexes = [
'''\b(0x)?[0-9a-fA-F]{40}\b''', # ignore evm public keys
'''219-09-9999''', # global allow lists
'''078-05-1120''',
'''(9[0-9]{2}|666)-\d{2}-\d{4}'''
]
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.x
20
228 changes: 26 additions & 202 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,223 +2,47 @@
<b>Pearl</b>
</h1>

Pearl is an application used to run autonomous agents powered by the OLAS Network.

## Technologies Used

- Electron
- NodeJS (20.11 LTS)
- AntD (^5)
- NextJS (^14)
- Javascript / TypeScript
- Python (3.10)
- Poetry (^1.7.1)
A cross-platform desktop application used to run autonomous agents powered by the OLAS Network.

## Getting Started

### Installing system dependencies

The following installation steps assume you have the following on each OS:

- Linux: a debian based operating system such as Ubuntu with `apt` to install packages.
- MacOS: [Homebrew](https://brew.sh/)

<details><summary><h4>NodeJS</summary></h4>

NodeJS is best installed and managed through NVM. It allows you to install and select specific versions of NodeJS. Pearl has been built using version 20 LTS.

<h5>Linux</h5>

```bash
sudo apt install curl
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm install --lts
nvm use --lts
```

<h5>MacOS</h5>

```bash
brew install nvm
```

Set up NVM for console usage. Dependant on the shell, you should edit the config file to contain the following code.
If you're using Bash or Zsh, you might add them to your `~/.bash_profile`, `~/.bashrc`, or `~/.zshrc` file:

```bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
```

Close and reopen Terminal, or run `source ~/.bash_profile`, `source ~/.zshrc`, or `source ~/.bashrc` to reload the shell configuration.

Verify your installation by running `nvm --version`. Then run:

```bash
nvm install --lts
nvm use --lts
```

</details>

<details><summary><h4>Yarn</h4></summary>

Yarn is the package manager used for dependency management of the Electron app and NextJS frontend.

```bash
npm install --global yarn
```
</details>

<details><summary><h4>Python</h4></summary>

<h5>Linux</h5>

```bash
sudo apt install python3
```

<h5>MacOS</h5>

```bash
brew install python
```

</details>

<details><summary><h4>PIPX</h4></summary>

<h5>Linux</h5>

```bash
sudo apt install pipx
```

<h5>MacOS</h5>

```bash
brew install pipx
```

</details>

<details><summary><h4>Poetry</h4></summary>

Poetry is used on the backend to install and manage dependencies, and create a virtual environment for the backend API.

```bash
pipx install poetry
```

If promoted to run `pipx ensurepath`, run it.

</details>

<h3>Setting up your .env file</h3>

Create an `.env` file in the root directory, or rename `.env.example` to `.env`.
Then set the following environment variables.

<details><summary><h4>NODE_ENV</h4></summary>

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

</details>

<details><summary><h4>FORK_URL</h4></summary>

**This variable is required for both development and production.**
**Must be a Gnosis Mainnet RPC URL.**

- In `development` this RPC url is only used if/when forking mainnet with Hardhat (covered later). This process allows you to test without losing funds.
- In `production` this RPC URL is used as the main RPC for Pearl.

You can get a Gnosis RPC from [Nodies](https://www.nodies.app/).

Once you have a Gnosis Mainnet RPC URL, set `FORK_URL=YOUR_RPC_URL_HERE` in your .env file.

Note: this must be an external RPC. If you decide to use Hardhat for testing on a mainnet fork, do _not_ set your Hardhat Node URL here.
</details>

<details><summary><h4>DEV_RPC</h4></summary>

This environment variable is only used when `NODE_ENV=development` is set.

In `development` mode, it is used throughout Pearl as the main RPC.

If you're using Hardhat, you can set `DEV_RPC=http://localhost:8545`.
Or, you can use another, external RPC URL that wish to test on, ensuring that the chain ID is 100 (Gnosis Mainnet's chain ID).

</details>

<h3>Installing project dependencies</h3>

Run the following command to install all project dependencies.

```bash
yarn install-deps
```

<h3>Running the application</h3>

Provided your system dependencies are installed, environment variables are set, and your RPC is running.

You can start Pearl by running the following command in the root directory:

```bash
yarn dev
```

This will run Electron, which launches the NextJS frontend and the Python backend as child processes.

<h3>Chain forking (for development)</h3>

In the interest of protecting your funds during development, you can run a forked version of Gnosis Mainnet.

There are two recommended options, choose one:

<details><summary><h4>Tenderly (preferred)</h4></summary>
### For Users

[Tenderly](https://tenderly.co/) is a service with a plethora of useful blockchain development tools. The tool required here gives you the ability to **fork networks**.
#### Downloading the latest release

You can also monitor all transactions, and fund your accounts with any token that you please.
**Note:** The release pages also contain Source Code `.zip` files and `dev-` prefixed builds. These are not intended for general use. Ignore them unless you're a developer!

1. Signup to [Tenderly](https://tenderly.co/), and select the plan you desire. **The Free plan should suffice for most users**.
2. Go to *Forks* under the *Development* tab -- in the left sidebar of your dashboard.
3. Click *Create Fork*, select "Gnosis Chain" as the network, and use Chain ID `100`.
4. Copy the RPC url into the appropriate .env variables in your repository. (Recommended to set both `FORK_URL` & `DEV_RPC` to this RPC url during development).
5. Click the *Fund Accounts* button to fund your accounts with XDAI (native token) and [OLAS](https://gnosisscan.io/token/0xce11e14225575945b8e6dc0d4f2dd4c570f79d9f).
- Go to the [Releases](https://github.com/valory-xyz/olas-operate-app/releases) page.
- Download the latest release for your operating system.
- If you're on Windows, download the `.exe` file.
- If you're on MacOS, download the `.dmg` file.
- Both Intel x64 and Apple Silicon ARM64 builds are available.
- Install the application by running the downloaded file.

</details>
### For Developers

<details><summary><h4>Hardhat</h4></summary>
Note: using Hardhat will result in the loss of chain state once your Hardhat node is turned off.
#### Setting up your development environment

Run the following command in the root of your project folder to start your Hardhat node:
- [Ubuntu Setup Guide](docs/dev/ubuntu-setup.md)
- [MacOS Setup Guide](docs/dev/macos-setup.md)
- [Windows Setup Guide](docs/dev/windows-setup.md)

```bash
npx hardhat node
```
#### Setting up a development RPC endpoint

**Once Hardhat is running, you will be able to use `http://localhost:8545` as your development RPC.**
- [RPC Setup Guide](docs/dev/rpcs.md)

<h5>Funding your addresses with Hardhat</h5>
## Project Dependencies

There are scripts to fund addresses during testing/development:
There are three parts to the project: the Electron app (CommonJS), the NextJS frontend (TypeScript), and the Python backend/middleware.

- XDAI funding:
- [Electron dependencies](package.json)
- [Frontend dependencies](package.json)
- [Backend dependencies](backend/pyproject.toml)

```bash
poetry run python scripts/fund.py 0xYOURADDRESS
```
## License

- OLAS funding:
- [Apache 2.0](LICENSE)

```bash
poetry run python scripts/transfer_olas.py PATH_TO_KEY_CONTAINING_OLAS ADDRESS_TO_TRANSFER AMOUNT
```
## Security

</details>
- [Security Policy](SECURITY.md)
Loading

0 comments on commit 54745e3

Please sign in to comment.