Skip to content

Commit

Permalink
Merge branch 'main' into fix-tests-for-new-ddo
Browse files Browse the repository at this point in the history
  • Loading branch information
mariacarmina committed Mar 3, 2025
2 parents cbed657 + ed26461 commit a72c090
Show file tree
Hide file tree
Showing 17 changed files with 619 additions and 366 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
node-version: '18.19.0'

- name: Cache node_modules
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
Expand Down
184 changes: 184 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,190 @@ Make sure to update chainId from the assets from `metadata` folder.
npm run cli publish metadata/simpleDownloadDataset.json
```

### Command Usage

The Ocean CLI supports flexible argument ordering. You can supply arguments using:
- **Positional Arguments** (traditional style): Must follow the defined order.
- **Named Options**: Can be provided in any order. These options include flags like `--did`, `--file`, etc.

#### General Format

```bash
npm run cli <command> [options] <arguments>
```

#### Help Commands

- **General help:**
`npm run cli --help` or `npm run cli -h`

- **Command-specific help:**
`npm run cli help <command>`

#### Examples

**Get DDO:**

- **Positional:**
`npm run cli getDDO did:op:123`

- **Named Option:**
`npm run cli getDDO --did did:op:123`

---

**Publish:**

- **Positional:**
`npm run cli publish metadata.json`

- **Named Options:**
`npm run cli publish --file metadata.json`
With encryption disabled:
`npm run cli publish --file metadata.json --encrypt false`
(Note: `--file` and `--encrypt` can be in any order.)

---

**Publish Algorithm:**

- **Positional:**
`npm run cli publishAlgo algorithm.json`

- **Named Options:**
`npm run cli publishAlgo --file algorithm.json`
With encryption disabled:
`npm run cli publishAlgo --encrypt false --file algorithm.json`

---

**Edit Asset:**

- **Positional:**
`npm run cli editAsset did:op:123 metadata.json`

- **Named Options:**
`npm run cli editAsset --did did:op:123 --file metadata.json`
(The flags can be provided in any order, for example:
`npm run cli editAsset --file metadata.json --did did:op:123`)

---

**Download:**

- **Positional:**
`npm run cli download did:op:123 ./custom-folder`

- **Named Options:**
`npm run cli download --did did:op:123 --folder ./custom-folder`
(Order of `--did` and `--folder` does not matter.)

---

**Start Compute:**

- **Positional:**
`npm run cli startCompute did1,did2 algoDid env1`

- **Named Options:**
`npm run cli startCompute --datasets did1,did2 --algo algoDid --env env1`
(Options can be provided in any order.)

---

**Stop Compute:**

- **Positional:**
`npm run cli stopCompute did:op:123 job-123`

- **Named Options:**
`npm run cli stopCompute --dataset did:op:123 --job job-123`
(Optionally, you can also provide an agreement ID using `--agreement`.)

---

**Get Job Status:**

- **Positional:**
`npm run cli getJobStatus did:op:123 job-123`

- **Named Options:**
`npm run cli getJobStatus --dataset did:op:123 --job job-123`
(Optionally, an agreement ID may be provided.)

---

**Download Job Results:**

- **Positional:**
`npm run cli downloadJobResults job-123 0 ./results`

- **Named Options:**
`npm run cli downloadJobResults --job job-123 --index 0 --folder ./results`

---

**Mint Ocean:**

- **Positional:**
`npm run cli mintOcean`
(No arguments are required for this command.)

---

#### Available Named Options Per Command

- **getDDO:**
`-d, --did <did>`

- **publish:**
`-f, --file <metadataFile>`
`-e, --encrypt [boolean]` (Default: `true`)

- **publishAlgo:**
`-f, --file <metadataFile>`
`-e, --encrypt [boolean]` (Default: `true`)

- **editAsset:**
`-d, --did <datasetDid>`
`-f, --file <metadataFile>`
`-e, --encrypt [boolean]` (Default: `true`)

- **download:**
`-d, --did <did>`
`-f, --folder [destinationFolder]` (Default: `.`)

- **startCompute:**
`-d, --datasets <datasetDids>`
`-a, --algo <algoDid>`
`-e, --env <computeEnvId>`

- **stopCompute:**
`-d, --dataset <datasetDid>`
`-j, --job <jobId>`
`-a, --agreement [agreementId]`

- **getJobStatus:**
`-d, --dataset <datasetDid>`
`-j, --job <jobId>`
`-a, --agreement [agreementId]`

- **downloadJobResults:**
`-j, --job <jobId>`
`-i, --index <index>`
`-f, --folder [destinationFolder]`

- **mintOcean:**
No options/arguments required.

---

**Note:**
- When using **named options**, you can write them in any order.
- When relying on **positional arguments**, ensure they follow the exact order as defined by the command.

This flexible approach lets you use the style that best suits your workflow while remaining fully backwards compatible.

## 🏛 License

```
Expand Down
2 changes: 1 addition & 1 deletion metadata/jsAlgo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "",
"nftAddress": "",
"version": "4.1.0",
"chainId": 137,
"chainId": null,
"metadata": {
"created": "2023-08-01T17:09:39Z",
"updated": "2023-08-01T17:09:39Z",
Expand Down
2 changes: 1 addition & 1 deletion metadata/jsIPFSAlgo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "",
"nftAddress": "",
"version": "4.1.0",
"chainId": 8996,
"chainId": null,
"metadata": {
"created": "2023-08-01T17:09:39Z",
"updated": "2023-08-01T17:09:39Z",
Expand Down
2 changes: 1 addition & 1 deletion metadata/pythonAlgo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "",
"nftAddress": "",
"version": "4.1.0",
"chainId": 8996,
"chainId": null,
"metadata": {
"created": "2023-08-01T17:09:39Z",
"updated": "2023-08-01T17:09:39Z",
Expand Down
2 changes: 1 addition & 1 deletion metadata/simpleComputeDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "",
"nftAddress": "",
"version": "4.1.0",
"chainId": 8996,
"chainId": null,
"metadata": {
"created": "2021-12-20T14:35:20Z",
"updated": "2021-12-20T14:35:20Z",
Expand Down
4 changes: 2 additions & 2 deletions metadata/simpleDownloadDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "",
"nftAddress": "",
"version": "4.1.0",
"chainId": 80001,
"chainId": null,
"metadata": {
"created": "2021-12-20T14:35:20Z",
"updated": "2021-12-20T14:35:20Z",
Expand All @@ -31,7 +31,7 @@
"files": [
{
"type": "url",
"url": "https://dumps.wikimedia.org/enwiki/latest/enwiki-latest-abstract10.xml.gz-rss.xml",
"url": "https://raw.githubusercontent.com/oceanprotocol/ocean-node/refs/heads/main/LICENSE",
"method": "GET"
}
]
Expand Down
2 changes: 1 addition & 1 deletion metadata/simpleIPFSComputeDataset.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "",
"nftAddress": "",
"version": "4.1.0",
"chainId": 8996,
"chainId": null,
"metadata": {
"created": "2021-12-20T14:35:20Z",
"updated": "2021-12-20T14:35:20Z",
Expand Down
17 changes: 16 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@
"typescript-eslint": "^7.12.0"
},
"dependencies": {
"@oasisprotocol/sapphire-paratime": "^1.3.2",
"@oceanprotocol/contracts": "^2.0.4",
"@oceanprotocol/lib": "^3.4.6",
"commander": "^13.1.0",
"cross-fetch": "^3.1.5",
"crypto-js": "^4.1.1",
"decimal.js": "^10.4.1",
Expand Down
Loading

0 comments on commit a72c090

Please sign in to comment.