Closed wuminzhe closed 1 year ago
We currently have no plans to make api-client more generic. What exactly would you need to do?
We want to connect to different substrate chain with different types.
We currently don't have any resources to push that forward, although it should not be that much work. ~ 5-10 hours depending on skill level.
If you feel confident, I could support you in accomplishing that. Do you only need the balance for now, or are other runtime types also affected?
If not, we could simply make the api-client generic over the balance.
Regardless, as more generic types might be wanted by the community in the future, it might make sense to add a more future-proof concept. We could make the api-client generic over a trait Config
- inspired by the runtime's config traits - which defines the current set of generics for the client. With the current setup, this would be something like:
pub Trait Config: {
type Pair: Pair
type MultiSignature: From<Pair::Signature>
type Balance: Codec + Copy + Eq // Maybe just use parity's 'Member' trait
}
Then we could even add a default implementation in the api-client that reflects the node-templates' types, such that people that use the default type, don't need to implement anything.
@clangenb We need different runtime types, not only balance. So I think Trait Config
is what we want. We will try to contribute the codes.
Ok, cool. You can reach out to me, whenever you have questions! 👍
Ok, cool. You can reach out to me, whenever you have questions! 👍
Thank you
Will be done in course of fixing #267
@brenzi