Skip to content

docs: clarify Log.index vs Log.transactionIndex JSDoc comments#5145

Open
0xAxiom wants to merge 1 commit into
ethers-io:mainfrom
0xAxiom:docs/fix-log-transactionindex-comment
Open

docs: clarify Log.index vs Log.transactionIndex JSDoc comments#5145
0xAxiom wants to merge 1 commit into
ethers-io:mainfrom
0xAxiom:docs/fix-log-transactionindex-comment

Conversation

@0xAxiom

@0xAxiom 0xAxiom commented May 25, 2026

Copy link
Copy Markdown

Problem

The JSDoc for Log.transactionIndex currently says:

The index within the transaction of this log.

This is backwardstransactionIndex is the position of the transaction in its block (JSON-RPC transactionIndex), not the log's position inside the transaction. Issue #4960 identified this confusion; a prior fix attempt (#4962) was closed without merging.

Fix

Rewrote both sibling comments so the distinction is explicit:

Property What it is
index Log's position within the block (logIndex in JSON-RPC)
transactionIndex Transaction's position within the block (transactionIndex in JSON-RPC)

Added JSON-RPC term cross-references and a [[Log-index]] back-link in the transactionIndex doc so readers can immediately orient themselves.

Testing

Docs-only change; no behaviour altered.

Fixes #4960

The JSDoc for transactionIndex said "The index within the transaction
of this log", which is the opposite of what the property actually
represents.  transactionIndex is the position of the *transaction*
inside its block (JSON-RPC transactionIndex), not the log's position
inside the transaction.

Fix both sibling comments together so the distinction is unambiguous:

  index           — log's position within the block (logIndex in RPC)
  transactionIndex — transaction's position within the block

Cross-references [[Log-index]] from the transactionIndex doc so readers
looking at either property can quickly orient themselves.

Fixes ethers-io#4960
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrong (Unclear?) property specification in ethers.Log

1 participant