AcalaNetwork / chopsticks

Create parallel reality of your Substrate network.
Apache License 2.0
138 stars 84 forks source link

feat: add chainSpec_v1 group of functions #820

Closed voliva closed 2 months ago

voliva commented 2 months ago

Last missing group of functions to provide support with papi, so this closes #801

I may need help with the genesisHash function - I thought this would be available on the chain object directly, but it's not.

I called getBlockHash(0), which seems to get the job done, it seems to work when starting from genesis and from a wsUrl, but the types say it might return null. I couldn't find any case where this happens, but I'm also not sure what to do in this case.... any ideas?

xlc commented 2 months ago

You can call getBlockHash with a future block number and it will return null, however, for genesis, it should always give you a block hash. It will be an unreachable code path for the null case. You could throw error like "Unexpected null genesis" if it ever happens.