@buildonspark/cli
v0.0.106
Published
Spark CLI
Keywords
Readme
Spark CLI
An interactive CLI for interacting with the Spark SDK.
Quick Start
npx @buildonspark/cliOr install globally:
npm install -g @buildonspark/cli
spark-cliOptions
spark-cli [options]
--network <network> Network to connect to (mainnet, regtest, local) [default: regtest]
--config <path> Path to a JSON config file
-v, --version Print version
-h, --help Show this help messageExamples
spark-cli --network mainnet
spark-cli --network regtest
spark-cli --config ./my-config.jsonExample Flow
Here is an example flow that initializes a Spark wallet, deposits funds from the L1 faucet, and transfers sats to a different wallet:
initwalletgetdepositaddress- Open the regtest faucet and paste in the deposit address from step 2. Press 'Send Funds' to get a transaction hash.
- Back in the CLI, enter
claimdeposit <txid>where<txid>is the transaction hash from step 3. Your wallet is now funded! (this may take a few seconds; if it doesn't show up, reinitializing your wallet with the mnemonic from step 1 will re-run the claim) - Run
getbalanceto see your balance, orgetleavesto see details about your leaves. - Open another terminal and start the CLI again on the same network.
- Init another wallet and get its spark address with
getsparkaddress. - Back in the first wallet, send a transfer with
sendtransfer <amount> <sparkAddress>. - In the second wallet, run
getbalanceorgetleavesto confirm the transfer was received.
Local Development
If developing from the monorepo, you can run the CLI directly with tsx:
yarn cli # regtest (default)
yarn cli:mainnet # mainnet
yarn cli:local # local network