Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md file #89

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Galoy CLI
Galoy CLI is a Rust-based CLI client that can interact with the Galoy backend using GraphQL queries and mutations.

## Installation
To install Galoy CLI locally and set up a local environment:

1. Clone the repository using git clone `https://github.com/GaloyMoney/galoy-cli.git`.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Clone the /galoy-cli repository using git clone https://github.com/GaloyMoney/galoy-cli.git

2. Install Rust in your local machine and run cargo build to build all binary and library targets of the selected packages.
3. Run cargo run command to run all tests of the Galoy CLI repository and see the usage, commands, and options available to interact.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
3. Run cargo run command to run all tests of the Galoy CLI repository and see the usage, commands, and options available to interact.
3. Run `cargo run` command to run all tests of the Galoy CLI repository and see the usage, commands, and options available to interact.

command should be within ` "brackets"

4. Interact with the CLI yourself to become familiar with it. After building, try the following command:

`GALOY_API=https://api.staging.galoy.io/graphql ./target/debug/galoy-client getinfo`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally we would want to highlight that the backend can also be run locally by running https://github.com/GaloyMoney/galoy (so you don't have to fetch our staging environment). the captcha can also be deactivated with the local dev environment

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So i need to remove this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolasburtey i think i should update the readme with providing the link to galoy backend(https://github.com/GaloyMoney/galoy) in place of these commands.

This command will retrieve the global values from the Galoy instance.

You can also test if the "GALOY CLI CAPTCHA SERVER" is running or not by running the following command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not very clear.


`GALOY_API=https://api.staging.galoy.io/graphql ./target/debug/galoy-client request-phone-code +16505554321`

## Usage
To use the Galoy CLI, you need to run it with the desired command and options.

### Commands:
getinfo:&#9; &#9; &#9;Get global values from the instance. <br/>
default-wallet: Get WalletId for an account. <br/>
me: Execute Me query. <br/>
send-intraledger: Do an intraledger transaction. <br/>
request-phone-code: Request a code from a Phone number. <br/>
login: Get JWT of an account. <br/>
batch: Execute a batch payment.

To see the available options for each command, run galoy-client <COMMAND> --help.


### Options
The available options for the Galoy CLI are:

-a, --api <API>: Set the API URL (default: http://localhost:4002/graphql) <br/>
-d, --debug: Enable debug mode<br/>
-j, --jwt <JWT>: Set the JWT for authorization<br/>
Copy link
Contributor

@thevaibhav-dixit thevaibhav-dixit Mar 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think jwt is not a valid term for the access token we get when we login ? I even got error when I tired to set in access token as JWT in the cli. @nicolasburtey

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also getting error. basically showing "jwt syntax issue".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup long story short, there should no longer be a JWT stored, but a kratos token. it should also be passed as a Authorization header to the backend.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it probably means this command line should be update. maybe there is no code change necessary because functionally if we assumed the JWT was an opaque token (ie: we were not trying to decode it), then it should be functionally the same with the kratos token

Copy link
Contributor

@thevaibhav-dixit thevaibhav-dixit Mar 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imho to make this functional we need to remove this https://github.com/GaloyMoney/galoy-cli/blob/main/src/main.rs#L84-L86 . Here we are trying to check for a valid JWT. I tried to this way and it worked for me. Maybe we can replace this with a simple check if the token adheres to a fix length ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup this should not longer work with the new way we authenticate query. this should be removed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolasburtey if we remove the part mentioned by @thevaibhav-dixit then how to authenticate, like based on the length of JWT?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the error in checks coming due to old version of remove_dir_all that is 0.5.3 as it is supported with version above 0.8.0. but there is no crate "remove_dir_all" in cargo.toml that need to be updated. how to solve this issue can you please guide me?

-h, --help: Display help information <br/>
-V, --version: Display version information


## Contributing
If you would like to contribute to Galoy CLI, please open a pull request on GitHub.