Skip to content

Commit

Permalink
cli readme
Browse files Browse the repository at this point in the history
  • Loading branch information
insipx committed Feb 14, 2024
1 parent 81b3380 commit f054a01
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 6 deletions.
56 changes: 53 additions & 3 deletions bin/xps-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,69 @@
### Tool to use XPS from the command line


Install Rust & clone this repository:
##### Install Rust & clone this repository:
```bash
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh && git clone --branch insipx/xps-signed-tx https://github.com/xmtp/xps-gateway
```

##### Navigate to the project directory and build the gateway
```bash
cd xps-gateway && cargo build --release
```

##### Build the CLI
```bash
cargo build --release --bin xps-cli
```

##### Run the gateway in a separate terminal window
```bash
./target/release/xps --port 9944
```

##### Install ethereum to make use of the `ethkey` cli tool
```bash
brew install ethereum
```

##### Generate a JSON wallet ethereum wallet
FILE indicates a file containing the password for the wallet. A file is required on MacOS.
```bash
ethkey generate --passwordfile FILE --json
```

#### Run the xps-cli tool

##### Check gateway information with the `info` flag
```bash
./target/release/xps-cli info
```
Make sure the gateway has some funds on Sepolia Eth

##### Set an attribute
```bash
./target/release/xps-cli -w ./keyfile.json -g ws://localhost:9944 grant -v 0x0000000b7373682d6564323535313900000020b500aebaf8a22c7aa7f6d28deb972a2d9cad5cecb92a92628cfffd824cb13968
```

##### Revoke an Attribute
```bash
./target/release/xps-cli -w ./keyfile.json -g ws://localhost:9944 revoke -v 0x0000000b7373682d6564323535313900000020b500aebaf8a22c7aa7f6d28deb972a2d9cad5cecb92a92628cfffd824cb13968
```

##### Help Flag
use the `--help` flag to get more information about the CLI, and options to set
```bash
./target/release/xps-cli --help
```

```bash
Usage: xps-cli [-n <network>] [-c <contract>] [-w <wallet>] [-g <gateway>] <command> [<args>]

A simple CLI to interact with the EVM-Based DID Registries

Options:
-n, --network the HTTPS network RPC-URL to interact with By-default,
`https://ethereum-sepolia.publicnode.com`
-n, --network the HTTPS network RPC-URL to interact with
(default: `https://ethereum-sepolia.publicnode.com`)
-c, --contract address of the DID Registry contract to interact
with(default: Test deployment on Sepolia)
-w, --wallet path to a local JSON wallet. Ensure usage of a test wallet,
Expand Down
6 changes: 3 additions & 3 deletions bin/xps-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const VALIDITY: u64 = 60 * 60 * 24 * 365;
/// A simple CLI to interact with the XPS Gateway
pub struct App {
/// the HTTPS network RPC-URL to interact with
/// By-default, `https://ethereum-sepolia.publicnode.com`
/// (default: `https://ethereum-sepolia.publicnode.com`)
#[argh(
short = 'n',
option,
Expand All @@ -43,8 +43,8 @@ pub struct App {

/// path to a local JSON wallet. Ensure usage of a test wallet, the
/// security of this binary has not been verified. Use at your own risk. (default:
/// `./wallet.json`)
#[argh(short = 'w', option, default = "PathBuf::from(\"./wallet.json\")")]
/// `./keyfile.json`)
#[argh(short = 'w', option, default = "PathBuf::from(\"./keyfile.json\")")]

Check warning on line 47 in bin/xps-cli/src/main.rs

View check run for this annotation

Codecov / codecov/patch

bin/xps-cli/src/main.rs#L47

Added line #L47 was not covered by tests
wallet: PathBuf,

/// URL of the XPS gateway. Default `ws://localhost:9944`
Expand Down

0 comments on commit f054a01

Please sign in to comment.