1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00
docs/developers/ocean-cli/install.md

78 lines
3.4 KiB
Markdown
Raw Normal View History

2023-10-03 13:30:44 +02:00
# Installation and Configuration 🛠️
2023-09-28 13:02:05 +02:00
To get started with the Ocean CLI, follow these steps for a seamless setup:
## Clone the Repository
Begin by cloning the repository. You can achieve this by executing the following command in your terminal:
2023-09-28 13:02:05 +02:00
2023-09-28 16:26:35 +02:00
```bash
2023-10-05 17:02:53 +02:00
$ git clone https://github.com/oceanprotocol/ocean-cli.git
2023-09-28 13:02:05 +02:00
```
Cloning the repository will create a local copy on your machine, allowing you to access and work with its contents.
## Install NPM Dependencies
After successfully cloning the repository, you should install the necessary npm dependencies to ensure that the project functions correctly. This can be done with the following command:
2023-09-28 13:02:05 +02:00
2023-09-28 16:26:35 +02:00
```bash
2023-09-28 13:02:05 +02:00
npm install
```
## Build the TypeScript code
To compile the TypeScript code and prepare the CLI for use, execute the following command:
2023-09-28 13:02:05 +02:00
2023-09-28 16:26:35 +02:00
```bash
2023-09-28 13:02:05 +02:00
npm run build
```
Now, let's configure the environment variables required for the CLI to function effectively. 🚀
## Setting Environment Variables 🌐
To successfully configure the CLI tool, two essential steps must be undertaken: the setting of the account's private key and the definition of the desired RPC endpoint. These actions are pivotal in enabling the CLI tool to function effectively.
### Private Key Configuration
2023-10-10 16:37:14 +02:00
The CLI tool requires the configuration of the account's 'private key'(by exporting env "PRIVATE_KEY") or a 'mnemonic'(by exporting env "MNEMONIC").
Both serve as the means by which the CLI tool establishes a connection to the associated wallet. It plays a crucial role in authenticating and authorizing operations performed by the tool. You must choose either one option or the other. The tool will not utilize both simultaneously.
```bash
export PRIVATE_KEY="XXXX"
```
2023-10-10 16:37:14 +02:00
or
```bash
export MNEMONIC="XXXX"
```
### RPC Endpoint Specification
Additionally, it is imperative to specify the RPC endpoint that corresponds to the desired network for executing operations. The CLI tool relies on this user-provided RPC endpoint to connect to the network required for its functions. This connection to the network is vital as it enables the CLI tool to interact with the blockchain and execute operations seamlessly.
```bash
export RPC='XXXX'
```
2023-10-05 17:02:53 +02:00
Furthermore, there are additional environment variables that can be configured to enhance the flexibility and customization of the environment. These variables include options such as the metadataCache URL and Provider URL, which can be specified if you prefer to utilize a custom deployment of Aquarius or Provider in contrast to the default settings. Moreover, you have the option to provide a custom address file path if you wish to use customized smart contracts or deployments for your specific use case. Remember setting the next environment variables is optional.
```bash
export AQUARIUS_URL='XXXX'
export PROVIDER_URL='XXXX'
export ADDRESS_FILE='../path/to/your/address-file'
```
## Usage
To explore the commands and option flags available in the Ocean CLI, simply run the following command:
```bash
npm run cli h
```
<figure><img src="../../.gitbook/assets/cli/usage.png" alt=""><figcaption>Available CLI commands & options</figcaption></figure>
2023-10-11 21:22:40 +02:00
With the Ocean CLI successfully installed and configured, you're ready to dive into its capabilities and unlock the full potential of Ocean Protocol. If you encounter any issues during the setup process or have questions, feel free to seek assistance from the [support](https://discord.com/invite/TnXjkR5) team. 🌊