genlayer 0.18.2-beta.0 → 0.18.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/CONTRIBUTING.md +117 -0
- package/README.md +233 -35
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Contributing to GenLayer CLI
|
|
2
|
+
|
|
3
|
+
We're thrilled that you're interested in contributing to the GenLayer CLI! This document will guide you through the contribution process.
|
|
4
|
+
|
|
5
|
+
## What is the GenLayer CLI?
|
|
6
|
+
|
|
7
|
+
The GenLayer CLI is a command-line tool designed to:
|
|
8
|
+
1. Streamline the setup and local execution of the GenLayer simulator. It automates the process of downloading and launching the GenLayer simulator, making it easy to start simulating and testing locally with minimal setup.
|
|
9
|
+
2. Deploy Intelligent Contracts on any network, read their state and send transactions to them.
|
|
10
|
+
3. Perform Validators operations
|
|
11
|
+
|
|
12
|
+
## How You Can Contribute?
|
|
13
|
+
|
|
14
|
+
Contributions to the GenLayer CLI are welcome in several forms:
|
|
15
|
+
|
|
16
|
+
### Testing the CLI and Providing Feedback
|
|
17
|
+
|
|
18
|
+
Help us make the CLI better by testing and giving feedback:
|
|
19
|
+
|
|
20
|
+
- Start by installing the CLI globally using the command:
|
|
21
|
+
```sh
|
|
22
|
+
$ npm install -g genlayer
|
|
23
|
+
```
|
|
24
|
+
- Try out the CLI features and tell us what you think through our [feedback form](https://forms.gle/ZbbxHsZrJxKucurB7) or on our [Discord Channel](https://discord.gg/8Jm4v89VAu).
|
|
25
|
+
- If you find any issues, please report them on our [GitHub issues page](https://github.com/yeagerai/genlayer-cli/issues).
|
|
26
|
+
|
|
27
|
+
### Sharing New Ideas and Use Cases
|
|
28
|
+
|
|
29
|
+
Have ideas for new features or use cases? We're eager to hear them! But first:
|
|
30
|
+
|
|
31
|
+
- Ensure you have the CLI installed to explore existing functionality.
|
|
32
|
+
- After familiarizing yourself with the CLI, contribute your unique use case and share your ideas in our [Discord channel](https://discord.gg/8Jm4v89VAu).
|
|
33
|
+
|
|
34
|
+
### Bug fixing and Feature development
|
|
35
|
+
|
|
36
|
+
#### 1. Set yourself up to start coding
|
|
37
|
+
|
|
38
|
+
- **1.1. Pick an issue**: Select one from the project GitHub repository [issue list](https://github.com/yeagerai/genlayer-cli/issues) and assign it to yourself.
|
|
39
|
+
|
|
40
|
+
- **1.2. Create a branch**: create the branch that you will work on by using the link provided in the issue details page (right panel at the bottom - section "Development")
|
|
41
|
+
|
|
42
|
+
- **1.3. Setup the CLI locally**: clone the repository and install dependencies
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
$ git clone https://github.com/yeagerai/genlayer-cli.git
|
|
46
|
+
$ cd genlayer-cli
|
|
47
|
+
$ npm install
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
- **1.4. Run the CLI in dev mode**: to run the CLI in development mode with hot reload enabled:
|
|
51
|
+
|
|
52
|
+
```sh
|
|
53
|
+
$ npm run dev
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
- **1.5. Test the CLI locally**: to test the CLI commands locally during development:
|
|
57
|
+
|
|
58
|
+
```sh
|
|
59
|
+
$ node dist/index.js <command>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
For example:
|
|
63
|
+
```sh
|
|
64
|
+
$ node dist/index.js init
|
|
65
|
+
$ node dist/index.js up
|
|
66
|
+
$ node dist/index.js validators get
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **1.6. Run unit tests**:
|
|
70
|
+
The GenLayer CLI uses Jest in combination with ts-jest to handle testing of TypeScript files. The configuration is tailored to support ES Modules (ESM), aligning with the latest JavaScript standards and ensuring compatibility with modern tooling and Node.js features.
|
|
71
|
+
|
|
72
|
+
##### Running Tests
|
|
73
|
+
|
|
74
|
+
To run the tests, use the following command:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run test
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This command sets the appropriate Node.js options to handle ES Modules and watches for changes in the test files, making it suitable for development.
|
|
81
|
+
|
|
82
|
+
##### Test Configuration
|
|
83
|
+
|
|
84
|
+
Our `jest.config.js` is set up as follows:
|
|
85
|
+
|
|
86
|
+
- ES Module Support: Configured to treat .ts files as ES Modules.
|
|
87
|
+
- Test Environment: Uses Node.js as the testing environment.
|
|
88
|
+
- Transformation: Utilizes ts-jest with an ESM preset to process TypeScript files.
|
|
89
|
+
|
|
90
|
+
Tests are located in the tests/ directory and should be named using the following pattern: [filename].test.ts. When writing tests, you can use all Jest functionalities such as describe, test, expect, and Jest mocks for testing asynchronous functions, component interactions, or API calls.
|
|
91
|
+
|
|
92
|
+
#### 2. Submit your solution
|
|
93
|
+
|
|
94
|
+
- **2.1. Prettier Formatter on Save File**: Configure IDE extensions to format your code with [Prettier](https://prettier.io/) before submitting it.
|
|
95
|
+
- **2.2. Code solution**: implement the solution in the code.
|
|
96
|
+
- **2.3. Run tests**: Ensure all tests pass before submitting:
|
|
97
|
+
```sh
|
|
98
|
+
$ npm run test
|
|
99
|
+
```
|
|
100
|
+
- **2.4. Pull Request**: Submit your changes through a pull request (PR). Fill the entire PR template and set the PR title as a valid conventional commit.
|
|
101
|
+
- **2.5. Check PR and issue linking**: if the issue and the PR are not linked, you can do it manually in the right panel of the Pull Request details page.
|
|
102
|
+
- **2.6. Peer Review**: One or more core contributors will review your PR. They may suggest changes or improvements.
|
|
103
|
+
- **2.7. Approval and Merge**: After approval from the reviewers, you can merge your PR with a squash and merge type of action.
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Improving Documentation
|
|
107
|
+
|
|
108
|
+
To contribute to our docs, visit our [Documentation Repository](https://github.com/yeagerai/genlayer-docs) to create new issues or contribute to existing issues.
|
|
109
|
+
|
|
110
|
+
## Community
|
|
111
|
+
|
|
112
|
+
Connect with the GenLayer community to discuss, collaborate, and share insights:
|
|
113
|
+
|
|
114
|
+
- **[Discord Channel](https://discord.gg/8Jm4v89VAu)**: Our primary hub for discussions, support, and announcements.
|
|
115
|
+
- **[Telegram Group](https://t.me/genlayer)**: For more informal chats and quick updates.
|
|
116
|
+
|
|
117
|
+
Your continuous feedback drives better product development. Please engage with us regularly to test, discuss, and improve the GenLayer CLI.
|
package/README.md
CHANGED
|
@@ -14,77 +14,275 @@ npm install -g genlayer
|
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Each command includes syntax, usage information, and examples to help you effectively use the CLI for interacting with the GenLayer environment.
|
|
18
|
+
|
|
19
|
+
### Command line syntax
|
|
20
|
+
|
|
21
|
+
General syntax for using the GenLayer CLI:
|
|
18
22
|
|
|
19
23
|
```bash
|
|
20
|
-
genlayer
|
|
24
|
+
genlayer command [command options] [arguments...]
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
### Commands and usage
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
#### Initialize
|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
Prepares and verifies your environment to run the GenLayer Studio.
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
```bash
|
|
34
|
+
USAGE:
|
|
35
|
+
genlayer init [options]
|
|
36
|
+
|
|
37
|
+
OPTIONS:
|
|
38
|
+
--numValidators <numValidators> Number of validators (default: "5")
|
|
39
|
+
--headless Headless mode (default: false)
|
|
40
|
+
--reset-db Reset Database (default: false)
|
|
41
|
+
--localnet-version <localnetVersion> Select a specific localnet version
|
|
42
|
+
--ollama Enable Ollama container (default: false)
|
|
43
|
+
|
|
44
|
+
EXAMPLES:
|
|
45
|
+
genlayer init
|
|
46
|
+
genlayer init --numValidators 10 --headless --reset-db --localnet-version v0.10.2
|
|
47
|
+
genlayer init --ollama
|
|
48
|
+
```
|
|
30
49
|
|
|
31
|
-
|
|
50
|
+
##### Version Compatibility
|
|
51
|
+
|
|
52
|
+
The GenLayer CLI always uses the latest compatible version of the environment, ensuring that you benefit from the most recent features, bug fixes, and optimizations without requiring manual updates. If a specific version is needed, you can specify it using the --localnet-version option when initializing the environment.
|
|
32
53
|
|
|
33
54
|
```bash
|
|
34
|
-
|
|
35
|
-
npm run dev
|
|
55
|
+
genlayer init --localnet-version v0.10.2
|
|
36
56
|
```
|
|
37
57
|
|
|
38
|
-
|
|
58
|
+
#### Start GenLayer environment
|
|
39
59
|
|
|
40
|
-
|
|
60
|
+
Launches the GenLayer environment and the Studio, initializing a fresh set of database and accounts.
|
|
41
61
|
|
|
42
62
|
```bash
|
|
43
|
-
|
|
63
|
+
USAGE:
|
|
64
|
+
genlayer up [options]
|
|
65
|
+
|
|
66
|
+
OPTIONS:
|
|
67
|
+
--reset-validators Remove all current validators and create new random ones (default: false)
|
|
68
|
+
--numValidators <numValidators> Number of validators (default: "5")
|
|
69
|
+
--headless Headless mode (default: false)
|
|
70
|
+
--reset-db Reset Database (default: false)
|
|
71
|
+
--ollama Enable Ollama container (default: false)
|
|
72
|
+
|
|
73
|
+
EXAMPLES:
|
|
74
|
+
genlayer up
|
|
75
|
+
genlayer up --reset-validators --numValidators 8 --headless --reset-db
|
|
76
|
+
genlayer up --ollama
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Stop GenLayer environment
|
|
80
|
+
|
|
81
|
+
Stops all running GenLayer Localnet services.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
USAGE:
|
|
85
|
+
genlayer stop
|
|
44
86
|
```
|
|
45
87
|
|
|
46
|
-
|
|
88
|
+
#### Create a New GenLayer Project
|
|
89
|
+
|
|
90
|
+
Initialize a new GenLayer project using a local template.
|
|
47
91
|
|
|
48
|
-
|
|
92
|
+
```bash
|
|
93
|
+
USAGE:
|
|
94
|
+
genlayer new <projectName> [options]
|
|
49
95
|
|
|
50
|
-
|
|
96
|
+
OPTIONS:
|
|
97
|
+
--path <directory> Specify the directory for the new project (default: ".")
|
|
98
|
+
--overwrite Overwrite existing directory if it exists (default: false)
|
|
99
|
+
|
|
100
|
+
EXAMPLES:
|
|
101
|
+
genlayer new myProject
|
|
102
|
+
genlayer new myProject --path ./customDir
|
|
103
|
+
genlayer new myProject --overwrite
|
|
104
|
+
```
|
|
51
105
|
|
|
52
|
-
|
|
106
|
+
#### Manage CLI Configuration
|
|
53
107
|
|
|
54
|
-
|
|
108
|
+
Configure the GenLayer CLI settings.
|
|
55
109
|
|
|
56
110
|
```bash
|
|
57
|
-
|
|
111
|
+
USAGE:
|
|
112
|
+
genlayer config <command> [options]
|
|
113
|
+
|
|
114
|
+
COMMANDS:
|
|
115
|
+
set <key=value> Set a configuration value
|
|
116
|
+
get [key] Get the current configuration
|
|
117
|
+
reset <key> Reset a configuration value to its default
|
|
118
|
+
|
|
119
|
+
EXAMPLES:
|
|
120
|
+
genlayer config get
|
|
121
|
+
genlayer config get defaultOllamaModel
|
|
122
|
+
genlayer config set defaultOllamaModel=deepseek-r1
|
|
123
|
+
genlayer config reset keyPairPath
|
|
58
124
|
```
|
|
59
125
|
|
|
60
|
-
|
|
126
|
+
#### Network Management
|
|
61
127
|
|
|
62
|
-
|
|
128
|
+
Set the network to use for contract operations.
|
|
63
129
|
|
|
64
|
-
|
|
130
|
+
```bash
|
|
131
|
+
USAGE:
|
|
132
|
+
genlayer network [network]
|
|
65
133
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
134
|
+
EXAMPLES:
|
|
135
|
+
genlayer network
|
|
136
|
+
genlayer network testnet
|
|
137
|
+
genlayer network mainnet
|
|
138
|
+
```
|
|
69
139
|
|
|
70
|
-
|
|
140
|
+
#### Deploy and Call Intelligent Contracts
|
|
71
141
|
|
|
72
|
-
|
|
142
|
+
Deploy and interact with intelligent contracts.
|
|
73
143
|
|
|
74
|
-
|
|
144
|
+
```bash
|
|
145
|
+
USAGE:
|
|
146
|
+
genlayer deploy [options]
|
|
147
|
+
genlayer call <contractAddress> <method> [options]
|
|
148
|
+
genlayer write <contractAddress> <method> [options]
|
|
149
|
+
|
|
150
|
+
OPTIONS (deploy):
|
|
151
|
+
--contract <contractPath> (Optional) Path to the intelligent contract to deploy
|
|
152
|
+
--rpc <rpcUrl> RPC URL for the network
|
|
153
|
+
--args <args...> Positional arguments for the contract (space-separated, use quotes for multi-word arguments)
|
|
154
|
+
|
|
155
|
+
OPTIONS (call):
|
|
156
|
+
--rpc <rpcUrl> RPC URL for the network
|
|
157
|
+
--args <args...> Positional arguments for the method (space-separated, use quotes for multi-word arguments)
|
|
158
|
+
|
|
159
|
+
OPTIONS (write):
|
|
160
|
+
--rpc <rpcUrl> RPC URL for the network
|
|
161
|
+
--args <args...> Positional arguments for the method (space-separated, use quotes for multi-word arguments)
|
|
162
|
+
|
|
163
|
+
EXAMPLES:
|
|
164
|
+
genlayer deploy
|
|
165
|
+
genlayer deploy --contract ./my_contract.gpy
|
|
166
|
+
genlayer deploy --contract ./my_contract.gpy --args "arg1" "arg2" 123
|
|
167
|
+
genlayer call 0x123456789abcdef greet --args "Hello World!"
|
|
168
|
+
genlayer write 0x123456789abcdef updateValue --args 42
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
##### Deploy Behavior
|
|
172
|
+
- If `--contract` is specified, the command will **deploy the given contract**.
|
|
173
|
+
- If `--contract` is omitted, the CLI will **search for scripts inside the `deploy` folder**, sort them, and execute them sequentially.
|
|
174
|
+
|
|
175
|
+
##### Call vs Write
|
|
176
|
+
- `call` - Calls a contract method without sending a transaction or changing the state (read-only)
|
|
177
|
+
- `write` - Sends a transaction to a contract method that modifies the state
|
|
178
|
+
|
|
179
|
+
#### Keypair Management
|
|
180
|
+
|
|
181
|
+
Generate and manage keypairs.
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
USAGE:
|
|
185
|
+
genlayer keygen create [options]
|
|
75
186
|
|
|
76
|
-
|
|
187
|
+
OPTIONS:
|
|
188
|
+
--output <path> Path to save the keypair (default: "./keypair.json")
|
|
189
|
+
--overwrite Overwrite the existing file if it already exists (default: false)
|
|
77
190
|
|
|
78
|
-
|
|
191
|
+
EXAMPLES:
|
|
192
|
+
genlayer keygen create
|
|
193
|
+
genlayer keygen create --output ./my_key.json --overwrite
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
#### Update Resources
|
|
197
|
+
|
|
198
|
+
Manage and update models or configurations.
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
USAGE:
|
|
202
|
+
genlayer update ollama [options]
|
|
203
|
+
|
|
204
|
+
OPTIONS:
|
|
205
|
+
--model [model-name] Specify the model to update or pull
|
|
206
|
+
--remove Remove the specified model instead of updating
|
|
207
|
+
|
|
208
|
+
EXAMPLES:
|
|
209
|
+
genlayer update ollama
|
|
210
|
+
genlayer update ollama --model deepseek-r1
|
|
211
|
+
genlayer update ollama --model deepseek-r1 --remove
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### Validator Management
|
|
215
|
+
|
|
216
|
+
Manage validator operations.
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
USAGE:
|
|
220
|
+
genlayer validators <command> [options]
|
|
221
|
+
|
|
222
|
+
COMMANDS:
|
|
223
|
+
get [--address <validatorAddress>] Retrieve details of a specific validator or all validators
|
|
224
|
+
delete [--address <validatorAddress>] Delete a specific validator or all validators
|
|
225
|
+
count Count all validators
|
|
226
|
+
update <validatorAddress> [options] Update a validator details
|
|
227
|
+
create-random [options] Create random validators
|
|
228
|
+
create [options] Create a new validator
|
|
229
|
+
|
|
230
|
+
OPTIONS (update):
|
|
231
|
+
--stake <stake> New stake for the validator
|
|
232
|
+
--provider <provider> New provider for the validator
|
|
233
|
+
--model <model> New model for the validator
|
|
234
|
+
--config <config> New JSON config for the validator
|
|
235
|
+
|
|
236
|
+
OPTIONS (create-random):
|
|
237
|
+
--count <count> Number of validators to create (default: "1")
|
|
238
|
+
--providers <providers...> Space-separated list of provider names (e.g., openai ollama)
|
|
239
|
+
--models <models...> Space-separated list of model names (e.g., gpt-4 gpt-4o)
|
|
240
|
+
|
|
241
|
+
OPTIONS (create):
|
|
242
|
+
--stake <stake> Stake amount for the validator (default: "1")
|
|
243
|
+
--config <config> Optional JSON configuration for the validator
|
|
244
|
+
--provider <provider> Specify the provider for the validator
|
|
245
|
+
--model <model> Specify the model for the validator
|
|
246
|
+
|
|
247
|
+
EXAMPLES:
|
|
248
|
+
genlayer validators get
|
|
249
|
+
genlayer validators get --address 0x123456789abcdef
|
|
250
|
+
|
|
251
|
+
genlayer validators count
|
|
252
|
+
genlayer validators delete --address 0x123456789abcdef
|
|
253
|
+
genlayer validators update 0x123456789abcdef --stake 100 --provider openai --model gpt-4
|
|
254
|
+
|
|
255
|
+
genlayer validators create
|
|
256
|
+
genlayer validators create --stake 50 --provider openai --model gpt-4
|
|
257
|
+
genlayer validators create-random --count 3 --providers openai --models gpt-4 gpt-4o
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### Running the CLI from the repository
|
|
261
|
+
|
|
262
|
+
First, install the dependencies and start the build process
|
|
79
263
|
|
|
80
|
-
|
|
264
|
+
```bash
|
|
265
|
+
npm install
|
|
266
|
+
npm run dev
|
|
267
|
+
```
|
|
81
268
|
|
|
82
|
-
|
|
269
|
+
This will continuously rebuild the CLI from the source
|
|
83
270
|
|
|
84
|
-
|
|
271
|
+
Then in another window execute the CLI commands like so:
|
|
85
272
|
|
|
86
|
-
|
|
273
|
+
```bash
|
|
274
|
+
node dist/index.js init
|
|
275
|
+
```
|
|
87
276
|
|
|
88
|
-
##
|
|
277
|
+
## Documentation
|
|
278
|
+
|
|
279
|
+
For detailed information on how to use GenLayer CLI, please refer to our [documentation](https://docs.genlayer.com/).
|
|
280
|
+
|
|
281
|
+
## Contributing
|
|
282
|
+
|
|
283
|
+
We welcome contributions to GenLayerJS SDK! Whether it's new features, improved infrastructure, or better documentation, your input is valuable. Please read our [CONTRIBUTING](https://github.com/yeagerai/genlayer-js/blob/main/CONTRIBUTING.md) guide for guidelines on how to submit your contributions.
|
|
284
|
+
|
|
285
|
+
## License
|
|
286
|
+
|
|
287
|
+
This project is licensed under the ... License - see the [LICENSE](LICENSE) file for details.
|
|
89
288
|
|
|
90
|
-
If you have any feedback, please reach out to us at the contact provided above.
|
package/dist/index.js
CHANGED
|
@@ -17723,7 +17723,7 @@ var require_semver2 = __commonJS({
|
|
|
17723
17723
|
import { program } from "commander";
|
|
17724
17724
|
|
|
17725
17725
|
// package.json
|
|
17726
|
-
var version = "0.18.
|
|
17726
|
+
var version = "0.18.3";
|
|
17727
17727
|
var package_default = {
|
|
17728
17728
|
name: "genlayer",
|
|
17729
17729
|
version,
|