Skip to content

Conversation

k-thornton
Copy link

Adding a new subclass of JsonRpcProvider supporting erigon's ots_ (Otterscan) methods. The ots_ namespace provides some very helpful methods, most importantly being able to quickly fetch a list of all transactions belonging to a given address.

If your node supports the ots_ namespace, this provider will give you access to 11 new RPC methods: ots_getApiLevel, ots_hasCode, ots_getInternalOperations, ots_getTransactionError, ots_traceTransaction, ots_getBlockDetails, ots_getBlockTransactions, ots_searchTransactionsBefore/After, ots_getTransactionBySenderAndNonce, ots_getContractCreator

  • Convenience methods: getTransactionRevertReason() (decodes revert data), ensureOts() (making sure you're running an ots_ compatible node), iterateAddressHistory() (async iterator for pagination)
  • Full TypeScript support: Proper interfaces for all return types (OtsInternalOp, OtsBlockDetails, etc.)
  • 16 new unit tests covering all functionality

…scan) methods

If your node supports the ots_ namespace, you'll have access to 11 new RPC methods: ots_getApiLevel, ots_hasCode, ots_getInternalOperations, ots_getTransactionError, ots_traceTransaction, ots_getBlockDetails, ots_getBlockTransactions,  ots_searchTransactionsBefore/After, ots_getTransactionBySenderAndNonce, ots_getContractCreator

- Convenience methods: getTransactionRevertReason() (decodes revert data), ensureOts() (making sure you're running an ots_ compatible node), iterateAddressHistory() (async iterator for pagination)
- Full TypeScript support: Proper interfaces for all return types (OtsInternalOp, OtsBlockDetails, etc.)
- 16 new unit tests covering all functionality
@k-thornton
Copy link
Author

Hey sorry this kinda just came out of nowhere. I made this for a private project and figured it would be useful to contribute back!

@ricmoo
Copy link
Member

ricmoo commented Aug 22, 2025

I like it. I definitely think it’s useful, but might make a good candidate for the ethers-ext extension packages. I’ll look at it t hi s weekend. :)

…response types. Adding missing getBlockDetailsByHash() method. Added real ots_ raw data to the unit tests to make them more accurate. Added the "reasoning" from the otterscan docs to the JSDoc comments.
Actually utilizing the OtsAddressTransactionsPage type for searchTransactionsBefore/After

Addressing 2 notes from Otterscan maintainer: the page numbers will be ascending/descending based on search direction, and updating the docstrings to note the pageSize limit is a soft limit
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.

2 participants