-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recommended strategy for compat with a specific substrate version? #1621
Comments
Hey, thanks for the issue! Firstly, just for my own benefit, I'd be curious to know how you are using Subxt in conjunction with a version of Substrate? (Often I imagine it would be used as a client in projects that didn't otherwise care about importing Substrate). If you want to use types exposed in Substrate libraries rather than the Subxt versions, then you have a couple of options:
Type substitutions are always a bit more brittle, because the type you swap must have the same generics and must exactly encode/decode to the original one in order for things not to break (and what if the original type changes in newer codegen for instance). Used with the newtype pattern I'd hope that things should Just Work, though! |
Thanks @jsdw. We have a few client modules for the project (an app, a built-in L2, and a wallet that bridges l2/l1), all of which share a common library. I thought about newtype pattern, but I have a ton of places to replace it, so was hoping for a better way. I also wasn't sure what that would do for things like polkadot-js interface for account ids and the like. Your idea of only using newtype in the client with some conversions is really interesting though! This corner of the rust world feels like it's missing something (adding derives to external types and replacing dependency dependencies). Keep hoping there's some pattern I haven't found yet :) |
Yeah; I'd definitely be open to ideas in this area too! Offhand I can't really think of a better way to manage this sort of thing! |
I'd love a recommendation for how to integrate with specific substrate versions. We're currently linked to a branch release on the polkadot-sdk version. The generated api specification creates classes for boundedVec and many other substrate specific structs, but H256, AccountId32, etc all come from subxt::utils, which means we can't create From/Into converters for them against a locally installed version.
The text was updated successfully, but these errors were encountered: