chainlink-starknet icon indicating copy to clipboard operation
chainlink-starknet copied to clipboard

Starknet Chain Client: Add Block Methods

Open augustbleeds opened this issue 2 years ago • 3 comments

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

augustbleeds avatar Mar 14 '24 20:03 augustbleeds

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

skippaDaBitFlippa avatar Apr 26 '24 19:04 skippaDaBitFlippa