subsquid / squid-sdk

The main repo of the squid SDK
GNU General Public License v3.0
1.21k stars 147 forks source link

feature request: export typedefs for implementing your own store #260

Closed llllvvuu closed 6 months ago

llllvvuu commented 6 months ago

In this docs page it is shown how to implement your own store for Subsquid: https://docs.subsquid.io/sdk/resources/persisting-data/overview/#custom-database

A minor point, but exporting some of these types like:

would be helpful for the user to get started with their code. Otherwise have to copy/paste them like so: https://github.com/llllvvuu/subsquid-drizzle-store/blob/8c48be016b52e3ff2a7a9db60982f5a1ac8771c9/src/store.ts#L33-L58

In addition it seems like some of the functions like assertStateInvariants and assertChainContinuity which I copy-pasta'd from the TypeORM store could be exported as general utility functions (seems like they apply to any store):

https://github.com/subsquid/squid-sdk/blob/bce36bc36438b4c0024ffc531919508be4d7900d/typeorm/typeorm-store/src/database.ts#L279-L297

eldargab commented 6 months ago

Well, the copy paste is the intended way :)