Skip to main content

The sb CLI

@safebank/cli is the sb command-line interface — programmable banking from your terminal, built on @safebank/sdk. Use it for scripting, CI, and exploring the API by hand.

Build and run

From the monorepo:

pnpm --filter @safebank/cli build
node packages/cli/bin/sb.js --help

Every command accepts these global flags:

FlagPurpose
--api-key <key>Key for this invocation (overrides profile / env).
--base-url <url>Override the API base URL.
-p, --profile <name>Config profile to use.
--jsonMachine-readable JSON output.

Try the demo (no API key needed)

The fastest way to see the whole choreography — create wallet → on-ramp → issue a card → claim a handle → pay @volt-components (signed locally) → delegate to an agent → stand up a treasury and fire a sweep → off-ramp — is the dry run against an in-memory stub:

node packages/cli/bin/sb.js demo --dry-run

--dry-run makes no network calls and needs no key; it's also the CI gate that keeps the demo from rotting. Drop --dry-run to run it for real against a sandbox profile:

sb demo            # real end-to-end run
sb demo --fast # skip the narration pauses

Log in

Save an API key as a local profile (written to ~/.safebank/config.json). login validates the key by resolving your tenant:

sb login sb_test_...          # saves under the `sandbox` profile by default
sb whoami # show the active profile + tenant

Credentials resolve in order: --api-key flag → SAFEBANK_API_KEY / SAFEBANK_API_URL env → the active profile. On first use a sandbox demo signer is generated and stored (mode 0600) at ~/.safebank/demo-signer.json.

Command tree

sb
├── login [apiKey] Save an API key as a profile
├── whoami Show the active profile + tenant
├── wallets
│ ├── create Create a multisig wallet
│ ├── list List your wallets
│ ├── get <id> Show a wallet with balances
│ └── fund <id> Fund a wallet from the sandbox faucet
├── pay
│ ├── send Send USDC to a @handle or 0x address
│ └── list List payments
├── cards
│ ├── issue Issue a Safe-funded card from a wallet
│ ├── limits show|set View / set spend limits
│ └── freeze | unfreeze Toggle a card
├── agents
│ ├── create | key | limits Agent principals + scoped keys + caps
│ └── suspend | reactivate The agent kill-switch
├── treasury
│ ├── setup | list | status Bucketed treasury accounts
│ ├── rules add|list|toggle|rm Standing sweep rules
│ └── sweep | sign | sweeps Propose / sign / list sweeps
├── ramp
│ ├── on <walletId> On-ramp USDC (fiat simulated)
│ ├── off <walletId> Off-ramp toward fiat (owners sign)
│ └── list List ramps
├── policies
│ ├── create | list | versions Versioned policy documents
│ ├── add-version | attach|detach Commit versions / bind to a subject
│ └── evaluate Deterministic dry-run + rule trace
└── demo Run the scripted end-to-end flow

Scripting with --json

Every command supports --json for piping into jq or other tooling:

WALLET=$(sb wallets create --name CI --json | jq -r .id)
sb wallets fund "$WALLET" --usdc 250 --json
sb pay send --from "$WALLET" --to @volt-components --amount 5 --json | jq .status

See also