Starknet Chain Client: Add Block Methods
https://smartcontract-it.atlassian.net/browse/BCI-2676
Adding 3 block-related methods so RTSP can begin playing around with fetching blocks and the Batch() method to lay the groundwork for the rest of the methods. Rest of the process should be straightforward after this PR.
Added the ChainId method as well. Turns out the starknet.go provider automatically caches the chainId after first request, so our implementation uses the batchCall always
Original Design Doc: https://docs.google.com/document/d/10jsfp7_VqDv2GFGILmTX2ey-p_yaFyvxPaVszL6kg6g/edit
Open Questions:
- ~For batch calls, the user will need to iterate through the batchElem array and cast the Result interface to the expected return type. This seems like a weird user experience so I'm open to feedback on how to improve this.~ RESOLVED
Quality Gate passed
Issues
0 New issues
0 Fixed issues
0 Accepted issues
Measures
0 Security Hotspots
90.6% Coverage on New Code
0.0% Duplication on New Code
For batch calls, the user will need to iterate through the batchElem array and cast the Result interface to the expected return type. This seems like a weird user experience so I'm open to feedback on how to improve this.
Based on our previous patterns, we typically develop separate apps for different pieces of chain information—such as one app for fetching blocks and another for fetching logs. Therefore, for the app designed to fetch blocks, I anticipate that we will use a StarknetBatchBuilder to batch together multiple BlockByNumber calls. This approach ensures that all calls are of the same type, facilitating consistent data casting. So I think for us, deducing return type should be easy since they should all be the same type
Quality Gate passed
Issues
0 New issues
0 Fixed issues
0 Accepted issues
Measures
0 Security Hotspots
87.4% Coverage on New Code
0.0% Duplication on New Code