Skip to content

feat: add logs to transaction receipts#153

Open
FarajiOranj wants to merge 1 commit into
ryangoree:mainfrom
FarajiOranj:feat/transaction-receipt-logs
Open

feat: add logs to transaction receipts#153
FarajiOranj wants to merge 1 commit into
ryangoree:mainfrom
FarajiOranj:feat/transaction-receipt-logs

Conversation

@FarajiOranj

Copy link
Copy Markdown

Summary

Closes #151.

waitForTransaction returned a TransactionReceipt that exposed logsBloom
but not the actual logs array, so you couldn't read a transaction's emitted
events (e.g. grabbing a newly deployed contract address from a factory event)
without dropping down to a raw client. This wires the logs through on every
adapter.

Changes

  • New Log type in adapter/types/Event.ts: a raw, undecoded log entry
    (address, data, topics, block/transaction position, removed). EventLog is
    now Log & { eventName, args } so the decoded and raw shapes stay in sync,
    and Log is exported from the package root.
  • TransactionReceipt.logs: Log[] added (replacing the existing
    // TODO: logs: Log[]).
  • All adapters populate logs in waitForTransaction:
    • @gud/drift DefaultAdapter (ox TransactionReceipt.fromRpc)
    • @gud/drift-viem
    • @gud/drift-ethers (ethers v6; maps log.index -> logIndex)
    • @gud/drift-ethers-v5
    • @gud/drift-web3 (defensive number/undefined handling for web3's
      formatted receipt)
  • Tests: createStubTransactionReceipt now defaults logs: [], and every
    adapter's receipt assertion checks the new field.
  • Changeset added (minor).

Notes / possible follow-ups

  • WalletCallsReceipt carries the same // TODO: logs: Log[] for EIP-5792
    receipts. I kept this PR focused on waitForTransaction; happy to follow up
    on the wallet-calls receipt in a separate PR if useful.
  • The reporter also asked about reading the drift-configured RPC endpoint back
    out of an adapter. That's a separate feature from this one, so I left it out
    of this PR to keep it focused, but glad to take it on if you'd like.

`waitForTransaction` returned a `TransactionReceipt` that exposed
`logsBloom` but not the actual `logs`, so events emitted by a transaction
(e.g. reading a newly deployed contract address from a factory event)
couldn't be accessed without dropping down to a raw client.

Add a raw `Log` type and a `logs` field on `TransactionReceipt`, and
populate it in every adapter: default (ox), viem, ethers v6, ethers v5,
and web3. `EventLog` now extends `Log`, and `createStubTransactionReceipt`
defaults `logs` to an empty array.
@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b37d6a0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@gud/drift Minor
@gud/drift-ethers-v5 Minor
@gud/drift-ethers Minor
@gud/drift-viem Minor
@gud/drift-web3 Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

waitForTransactionReceipt is missing logs array. Only has logsBloom

1 participant