Skip to content

Commit 5cdecbf

Browse files
committed
[CON-906] Close the three free RPC Test: gaps, and one wrong claim
These were the three remaining assertable and free examples in cli-reference.md. All three now carry a Test: line. Coverage goes from 5 of 33 runnable blocks to 8. Two live findings, both response-shape defects that fail silently. `qn rpc call -o json` prints the JSON-RPC result unwrapped. There is no jsonrpc, id, or result field. Code that reads `.result` on it gets undefined. `qn rpc list-networks -o json` returns `{"networks": [...]}`. That is a sixth distinct CLI response shape and it is not the `data` envelope the other list commands use, so `.data` is undefined. Also corrects a claim this branch added in b4640c0. The piped-output default is not universal. `qn rpc list-networks` prints a bare newline-separated list even when piped, with no JSON, so a script that pipes it and parses JSON fails. Verified: endpoint list, chain list and kv set list all print `{` when piped; rpc list-networks prints `0`. The Test: line now names all four commands and the exception. The asserted network count is dated in the line and marked as growing, because it drifts. The block-object assertion names the key range and the missing envelope rather than a field count, for the same reason. Verified live against account 464482. All calls read-only and free. No resource created.
1 parent b4640c0 commit 5cdecbf

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎plugins/build-web3/skills/build-web3/references/quicknode/cli-reference.md‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,17 @@ Set output with `--format` or `-o`.
6666

6767
With `--format` unset the CLI reads `[output] format` from the config file, then defaults to `table` on a TTY and `json` when stdout is piped. `--wide`/`-w` affects only `table` and `md`.
6868

69+
**The piped default is not universal.** `qn rpc list-networks` prints a bare
70+
newline-separated list of slugs even when piped, with no JSON. A script that
71+
pipes it and parses JSON fails. Pass `-o json` explicitly for that command.
72+
6973
```bash
7074
qn endpoint list --format json
7175
qn usage summary --from 7d -o yaml
7276
qn endpoint list --wide
7377
```
7478

75-
**Test:** `qn endpoint list | head -c 1` — prints `{`. Piped output defaults to `json`, not `table`, so a script never has to pass `-o json`
79+
**Test:** `qn endpoint list | head -c 1`, `qn chain list | head -c 1`, and `qn kv set list | head -c 1` all print `{`; `qn rpc list-networks | head -c 1` prints `0`, the first character of `0g-galileo`. The piped default holds for three of these four commands and not for the fourth
7680

7781
## Exit Codes
7882

@@ -122,6 +126,11 @@ qn auth login
122126
qn rpc call eth_getBlockByNumber '["latest", false]' --network base-mainnet
123127
```
124128

129+
With `-o json` the CLI prints the JSON-RPC `result` **unwrapped**. There is no
130+
`jsonrpc`, `id`, or `result` field to read past.
131+
132+
**Test:** `base-mainnet` · block `latest` — `-o json` prints the block object itself at the top level, keyed `baseFeePerGas` through `withdrawalsRoot`, with no `jsonrpc`, `id`, or `result` wrapper; `transactions` holds hashes, not objects, because the second parameter is `false`
133+
125134
Params: positional (JSON array), by name (JSON object), from a file, or from stdin.
126135

127136
```bash
@@ -142,6 +151,8 @@ qn rpc list-networks
142151
qn rpc list-networks -o json
143152
```
144153

154+
**Test:** `qn rpc list-networks` — one network key per line, sorted, `0g-galileo` first and `zora-mainnet` last (132 keys on 2026-09-04; the count grows, so do not gate on it). With `-o json` the payload is `{"networks": [...]}`. It is **not** the `data` envelope the other list commands use, so `.data` is `undefined`
155+
145156
`--endpoint-url <URL>` sends the call to a self-authenticating URL instead of the Tooling Access endpoint, overriding `[rpc] endpoint_url` in `~/.config/qn/config.toml`. Mutually exclusive with `--network`.
146157

147158
First-run `qn rpc call` prompts `[y/N]` to enable Tooling Access if it isn't provisioned yet. Pass `-y`/`--yes` to auto-confirm non-interactively.
@@ -150,6 +161,8 @@ First-run `qn rpc call` prompts `[y/N]` to enable Tooling Access if it isn't pro
150161
qn rpc call eth_blockNumber --network base-mainnet -y
151162
```
152163

164+
**Test:** `base-mainnet` · block `latest` — returns a bare JSON string such as `"0x308471d"`, not an object. `-y` exits `0` and prompts nothing when Tooling Access is already enabled, so it is safe to pass unconditionally in a script
165+
153166
### Paid RPC (x402 and MPP)
154167

155168
Requires CLI v0.6.0+. `qn rpc call` can pay for a call with stablecoins through the x402 or MPP gateway instead of using the account's API key. This lane requires no Quicknode account, API key, login, Tooling Access, or provisioned endpoint — only a funded local wallet.

0 commit comments

Comments
 (0)