Lightspark
Lightspark

Lightspark CLI

The lightspark command-line interface is a wrapper around the lightspark-sdk which can simplify testing Lightspark API commands from your terminal. You can install it via npm by running:
npm i -g @lightsparkdev/lightspark-cli

Initializing your environment

The first command you'll need to get set up is init-env.
You'll need to provide your API Token's client ID and client secret. You can set this up from the Lightspark API config page. For more info on API authentication, see the Lightspark SDK Authentication docs.
If you run it without any arguments, it will prompt you for your API token's client ID and client secret:
lightspark init-env
You can also directly pass these on the command line:
lightspark init-env -c <your client ID here> -s <your client secret here>
Once you've run init-env, it will create a .lightsparkapienv config file in your home directory with your API token's client ID and client secret.
There are lots of commands! Check out lightspark --help for more usage info.
Here's full example of how you might use the lightspark CLI to test out the Lightspark SDK:
# Get the balances for the account.
lightspark balances

# Create a bitcoin funding address for the account.
lightspark funding-address

# Fund the account by sending bitcoin to the address you just created.
# Once that transaction is confirmed, you can check the balances again.
lightspark balances

# Create an invoice.
lightspark create-invoice -a 100 -m "Pizza time"

# Pay the invoice with a test payment.
lightspark create-test-mode-payment -i <encoded invoice here>