diff --git a/README.md b/README.md index 594a714..a944615 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,11 @@ With the Ocean CLI tool you can: - **Edit** existing assets. - **Consume** data services, ordering datatokens and downloading data. - **Compute to data** on public available datasets using a published algorithm. +- **Manage access control** with access lists for restricting dataset/algorithm access. +- **Handle escrow payments** for compute jobs with deposit, withdrawal, and authorization. +- **Manage authentication** with token generation and invalidation. -Ocean CLI is using ocean.js Javascripti library which is part of the [Ocean Protocol](https://oceanprotocol.com) toolset. +Ocean CLI is using ocean.js JavaScript library which is part of the [Ocean Protocol](https://oceanprotocol.com) toolset. If you run into problems, please open up a [new issue](https://github.com/oceanprotocol/ocean-cli/issues/new?assignees=&labels=Type%3A+Bug&projects=&template=bug_report.md&title=). @@ -272,6 +275,126 @@ e.g.: `'[{"id":"cpu","amount":3},{"id":"ram","amount":16772672536},{"id":"disk", --- +**Generate Auth Token:** + + `npm run cli generateAuthToken` + (No arguments are required for this command.) + +--- + +**Invalidate Auth Token:** + +- **Positional:** + `npm run cli invalidateAuthToken myAuthToken123` + +- **Named Option:** + `npm run cli invalidateAuthToken --token myAuthToken123` + +--- + +**Deposit to Escrow:** + +- **Positional:** + `npm run cli depositEscrow 0x1234...tokenAddress 100` + +- **Named Options:** + `npm run cli depositEscrow --token 0x1234...tokenAddress --amount 100` + +--- + +**Get User Funds in Escrow:** + +- **Positional:** + `npm run cli getUserFundsEscrow 0x1234...tokenAddress` + +- **Named Option:** + `npm run cli getUserFundsEscrow --token 0x1234...tokenAddress` + +--- + +**Withdraw from Escrow:** + +- **Positional:** + `npm run cli withdrawFromEscrow 0x1234...tokenAddress 50` + +- **Named Options:** + `npm run cli withdrawFromEscrow --token 0x1234...tokenAddress --amount 50` + +--- + +**Authorize Escrow Payee:** + +- **Positional:** + `npm run cli authorizeEscrow 0x1234...tokenAddress 0x5678...payeeAddress 1000 3600 10` + +- **Named Options:** + `npm run cli authorizeEscrow --token 0x1234...tokenAddress --payee 0x5678...payeeAddress --maxLockedAmount 1000 --maxLockSeconds 3600 --maxLockCounts 10` + +- Arguments: + - `token`: Address of the token to authorize + - `payee`: Address of the payee to authorize + - `maxLockedAmount`: Maximum amount that can be locked by payee + - `maxLockSeconds`: Maximum lock duration in seconds + - `maxLockCounts`: Maximum number of locks allowed + +--- + +**Get Escrow Authorizations:** + +- **Positional:** + `npm run cli getAuthorizationsEscrow 0x1234...tokenAddress 0x5678...payeeAddress` + +- **Named Options:** + `npm run cli getAuthorizationsEscrow --token 0x1234...tokenAddress --payee 0x5678...payeeAddress` + +--- + +**Create Access List:** + +- **Positional:** + `npm run cli createAccessList "My Access List" "MAL" false "0xUser1,0xUser2"` + +- **Named Options:** + `npm run cli createAccessList --name "My Access List" --symbol "MAL" --transferable false --users "0xUser1,0xUser2"` + +- Arguments: + - `name`: Name for the access list + - `symbol`: Symbol for the access list + - `transferable`: Whether tokens are transferable (true/false) + - `initialUsers`: Comma-separated list of initial user addresses (optional) + +--- + +**Add to Access List:** + +- **Positional:** + `npm run cli addToAccessList 0x1234...accessListAddress "0xUser1,0xUser2"` + +- **Named Options:** + `npm run cli addToAccessList --address 0x1234...accessListAddress --users "0xUser1,0xUser2"` + +--- + +**Check Access List:** + +- **Positional:** + `npm run cli checkAccessList 0x1234...accessListAddress "0xUser1,0xUser2"` + +- **Named Options:** + `npm run cli checkAccessList --address 0x1234...accessListAddress --users "0xUser1,0xUser2"` + +--- + +**Remove from Access List:** + +- **Positional:** + `npm run cli removeFromAccessList 0x1234...accessListAddress "0xUser1,0xUser2"` + +- **Named Options:** + `npm run cli removeFromAccessList --address 0x1234...accessListAddress --users "0xUser1,0xUser2"` + +--- + #### Available Named Options Per Command - **getDDO:** @@ -331,6 +454,52 @@ e.g.: `'[{"id":"cpu","amount":3},{"id":"ram","amount":16772672536},{"id":"disk", - **mintOcean:** No options/arguments required. +- **generateAuthToken:** + No options/arguments required. + +- **invalidateAuthToken:** + `-t, --token ` + +- **depositEscrow:** + `-t, --token ` + `-a, --amount ` + +- **getUserFundsEscrow:** + `-t, --token ` + +- **withdrawFromEscrow:** + `-t, --token ` + `-a, --amount ` + +- **authorizeEscrow:** + `-t, --token ` + `-p, --payee ` + `-m, --maxLockedAmount ` + `-s, --maxLockSeconds ` + `-c, --maxLockCounts ` + +- **getAuthorizationsEscrow:** + `-t, --token ` + `-p, --payee ` + +- **createAccessList:** + `-n, --name ` + `-s, --symbol ` + `-t, --transferable [transferable]` (Default: `false`) + `-u, --users [initialUsers]` (Default: `''`) + +- **addToAccessList:** + `-a, --address ` + `-u, --users ` + +- **checkAccessList:** + `-a, --address ` + `-u, --users ` + +- **removeFromAccessList:** + `-a, --address ` + `-u, --users ` + --- **Note:** @@ -342,7 +511,7 @@ This flexible approach lets you use the style that best suits your workflow whil ## 🏛 License ``` -Copyright ((C)) 2023 Ocean Protocol Foundation +Copyright ((C)) 2025 Ocean Protocol Foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/src/cli.ts b/src/cli.ts index 0b5b3e1..54dcb44 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -484,6 +484,7 @@ export async function createCLI() { .argument('', 'Address of the token to check') .argument('', 'Address of the payee to check') .option('-t, --token ', 'Address of the token to check') + .option('-p, --payee ', 'Address of the payee to check') .action(async (token, payee, options) => { const { signer, chainId } = await initializeSigner(); const commands = new Commands(signer, chainId);