After installation, to start the CLI run npm run start
and the CLI menu will open
See sections below for detailed instructions of the dfferent options.
- git clone repo.
- run
npm i
from inside the repo. - run
npm run build
from inside the repo.
The Public API can be used directly by following the CLI instructions, for optional values, leaving an empty input will result in discarding these fields form the call.
- You can view all the available calls and their descriptions through 'See Public Method Descriptions' option.
Private API requires API authentication, see Authentication section beefore the first use.
In addition, using the Prviate API requires that the user will finish onboarding through the UI first for it work.
If your API requests fail with API key not found
- that means the onboarding proccess is not done.
Finished the onboarding to dYdX here Private API
- You can view all the available calls and their descriptions through 'See Private Method Descriptions' option.
Let's see how we get the GetMarkets from the Public API:
- Choose 'Call Public Methods':
- Choose 'GetMarkets':
- Enter the required parameters for the 'GetMarkets' method:
- Done:
- Authenticaiton is only required for the Private API. If you're using the Public API then you can simply start using the CLI.
- Authentication is only required once. The authenticaiton credentials will be stored under
config/config.json
for future usage of the CLI.
When first starting, the CLI will show that you're logged out, like so:
- In order to authenticate you CLI against dYdX the wallet private key is required, once, to fetch the dYdX credentials. The key will not be saved, but the dYdX credentials will be stored into the
config/config.json
.
- Go to 'Authentication Options' in the main menu.
- Go to 'Login API Credentials'
- Enter your wallet address.
- Enter your API key.
- Enter your API secret.
- Enter your API passphrase.
Done. When you next open the CLI you should see that you're logged in like so:
- This flow is only availalbe in
developer mode
which can be turned on from the CLI.
- In order to authenticate you CLI against dYdX the wallet private key is required, once, to fetch the dYdX credentials. The key will not be saved, but the dYdX credentials will be stored into the
config/config.json
.
- Go to 'Authentication Options' in the main menu.
- Go to 'Login Using Ethereum Private Key'
- Enter your wallet address.
- Enter your private key.