Install the jv CLI
Install
Section titled “Install”Requires Node.js 18 or later.
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.
Check connectivity first
Section titled “Check connectivity first”These two commands need no authorization. Run them right after installing to confirm you can reach Jasper Vault:
If you see the market list and a price, the install and your network are fine. All other commands require the authorization below.
Set BASE_HTTP_RPC_URL
Section titled “Set BASE_HTTP_RPC_URL”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:
Add this line to ~/.zshrc or ~/.bashrc so that it applies to every terminal you open from then on.
Authorize: jv enable
Section titled “Authorize: jv enable”- The command first prints a JSON object:
urlis the address of the authorization page, andexpiresAtis when the page expires. - Open
urlin 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:signeris the address of the delegation key just generated on your computer, anddeadlineis when the authorization expires. The authorization is currently valid for 7 days from the time you sign. - 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 isexpiresAt); a larger--timeoutdoes not extend the page. - When you are done, it prints the result:
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.
Multiple wallets: jv wallet
Section titled “Multiple wallets: jv wallet”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:
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.
Local files
Section titled “Local files”~ 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.