Skip to content

Install the jv CLI

Requires Node.js 18 or later.

npm i -g jaspervault_cli
jv --version

To upgrade to the latest version later, run jv update, which runs npm update -g jaspervault_cli.

jv update only works for a global install. To uninstall, run npm uninstall -g jaspervault_cli.

These two commands need no authorization. Run them right after installing to confirm you can reach Jasper Vault:

jv market list
jv price --symbol JVBTC

If you see the market list and a price, the install and your network are fine. All other commands require the authorization below.

jv enable and jv withdraw require the environment variable BASE_HTTP_RPC_URL, set to a Base mainnet RPC URL. If it is not set, these two commands exit with an error right away. You can use Base’s official public node or your own node provider’s URL:

export BASE_HTTP_RPC_URL=https://mainnet.base.org

Add this line to ~/.zshrc or ~/.bashrc so that it applies to every terminal you open from then on.

jv enable --pretty
  1. The command first prints a JSON object: url is the address of the authorization page, and expiresAt is when the page expires.
  2. Open url in your browser, connect your wallet, and sign as the page instructs. This authorization message is signed for the Base chain (chainId 8453); if your wallet asks you to switch networks, switch to Base. Before signing, you can check two fields: signer is the address of the delegation key just generated on your computer, and deadline is when the authorization expires. The authorization is currently valid for 7 days from the time you sign.
  3. The command waits until you finish, up to 900 seconds by default; adjust this with --timeout <seconds>. While it waits, it prints a status line to stderr every 10 seconds. The authorization page itself expires 15 minutes after it is created (this is expiresAt); a larger --timeout does not extend the page.
  4. When you are done, it prints the result:
{
  "success": true,
  "message": "Vault setup completed",
  "walletAddress": "0x…",
  "delegationAddress": "0x…",
  "marginAccount": "0x…",
  "vaults": [ … ],
  "transactionHash": "0x…"
}
  • walletAddress: your wallet address.
  • delegationAddress: the address of the delegation key.
  • marginAccount: your margin account on Jasper Vault; deposits go to this address.
  • vaults: your position accounts, which hold your positions. The CLI picks them automatically when you place orders; deposits and withdrawals only involve the margin account.

If the page expires or signing is not completed, the command prints "success": false and exits with code 3. Just run it again.

After the authorization expires, run jv enable again with the same wallet profile to renew it. For what the delegation key can and cannot do, see the Trader Integration Overview.

Each jv enable saves a wallet profile named <name>@beta; the default is default@beta. To authorize another wallet, give it a new name with --name:

jv enable --name hedge

This creates hedge@beta and makes it the active wallet profile. All trading and query commands use the active wallet profile. beta is the CLI’s name for the Jasper Vault production environment.

Command What it does
jv wallet list Lists all wallet profiles; the one with * under active is the one in use
jv wallet info Shows the active wallet profile’s wallet address (eoa), delegation key address, margin account, and position accounts
jv wallet switch <name> Switches the active wallet profile; without a name, it asks you to choose interactively, so pass a name in scripts
jv wallet rename <old-name> <new-name> Renames a profile; if the new name has no @beta suffix, it is added automatically the next time you run the CLI
jv wallet remove <name> Deletes a wallet profile and its local key file; you cannot delete the one currently in use

Deleting a wallet profile only deletes files on your computer; the on-chain authorization remains valid until it expires. If you lose the key file and run jv enable again, the CLI generates a new delegation key and authorizes it; the old key’s authorization likewise stays valid until it expires.

~/.jaspervault/
├── active.json              name of the wallet profile currently in use
├── update-check.json        cache for new-version checks
└── profiles/
    └── default@beta/
        ├── keys.json        delegation key (private key in plain text)
        └── profile.json     wallet address, delegation key address, margin account and position account addresses

~ means $HOME; on Windows, it is %USERPROFILE%. keys.json and profile.json are set so that only the current user can read and write them. Guard keys.json as you would a password.

Next: Deposit and Withdraw with the CLI.