For the complete documentation index, see llms.txt. This page is also available as Markdown.

Querying Safe data

Read-only commands to inspect Safes and transactions. Nothing on this page consumes a signer or costs gas. You can run these commands without a Ledger and without ever calling lem connect, with one exception (lem safe scan, which needs the cached signer address to know what to scan for).

This page is the CLI counterpart to 1. Querying Safe Data and produces the same JSON shapes as the underlying Safe API Kit.

What you'll learn

  • List Safes owned by the connected signer.

  • Fetch Safe configuration, balances, and next nonce.

  • List pending and historical transactions for a Safe.

  • Fetch a specific transaction by its safeTxHash.

Prerequisites

  • lem installed (see Installation).

  • For lem safe scan: a paired signer (see Configuring a signer). Every other command on this page only needs a Safe address.

Step-by-step

1. Scan Safes you own

Lists every Safe (across every supported chain) where the connected signer is an owner.

lem safe scan --pretty

Output:

This is the standard way to discover Safes from an agent harness. Feed the output into whichever workflow comes next.

2. Get Safe info

Retrieve owners, threshold, on-chain nonce, version, modules, fallback handler, and guard.

The shape mirrors the Safe Client Gateway's Safe info response and matches what apiKit.getSafeInfo() returns in the TS guides.

3. Fetch balances

Native ETH + ERC-20 balances held by the Safe.

Each entry contains tokenAddress, token (with symbol and decimals), and a raw integer balance. Format to a human-readable value using the decimals field. See Guide 1, step 3 for a worked example.

4. Get the next nonce

Returns the next Safe nonce, accounting for any pending (not-yet-executed) transactions. Use this when you want to queue a new transaction behind everything already proposed.

Output is a single integer printed to stdout. It is easy to capture into a shell variable:

5. List transactions

By default lem tx list returns only pending transactions. This is most useful for "what needs my signature?" workflows. Pass --all for the full history.

--limit and --offset work for pagination. Each result includes safeTxHash, nonce, to, value, data, isExecuted, isSuccessful, and the array of confirmations collected so far.

6. Show a transaction

Fetch the full record for one transaction by its safeTxHash.

The output is identical to a Safe API Kit getTransaction response: full transaction data, every collected confirmation (with signer address and signature), and the execution status / on-chain hash once executed.

Key concepts

The Safe Transaction Service is an off-chain index. It tracks on-chain Safe state (owners, threshold, nonce) and stores proposals before they hit chain. lem queries Ledger's hosted instance of this service, so any transaction proposed via the Ledger Multisig UI is visible to the CLI, and vice versa.

Tips and pitfalls

  • Pipe everything through jq. lem prints minified JSON by default, so commands compose cleanly:

  • Indexer lag. After an execute, expect 10–60 seconds before lem tx show flips isExecuted to true.

  • Pagination. Large Safes can have many transactions. lem tx list --all --limit 50 --offset 0 is the right way to page through history.

Next steps

  • Proposing, signing & executing

  • Command reference

Last updated