You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add rpc function to fetch transactions by hashes (#202)
### TL;DR
Added support for fetching transactions by hash through the RPC client.
### What changed?
- Added a new `RawTransaction` type alias in the common package
- Generalized the `RPCFetchBatch` function to `RPCFetchSingleBatch` to work with any key type, not just block numbers
- Added `GetTransactionParams` function to support transaction hash parameters
- Implemented `GetTransactions` method in the RPC client to fetch transactions by hash
- Added `SerializeTransactions` function to convert raw transaction data to the internal format
- Added `Close` method to the `IRPCClient` interface and updated the mock accordingly
### How to test?
1. Fetch transactions using the new method:
```go
client := rpc.NewClient(...)
transactions := client.GetTransactions([]string{"0x123...", "0x456..."})
```
2. Verify that transaction data is properly serialized and contains the expected fields
3. Test with both valid and invalid transaction hashes to ensure error handling works correctly
### Why make this change?
This change enables direct fetching of transactions by hash, which is useful for scenarios where we need to retrieve specific transactions without fetching entire blocks. This improves efficiency when only transaction data is needed and the containing block is not relevant.
0 commit comments