-
Notifications
You must be signed in to change notification settings - Fork 15
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
Adding type and version to graphQL pool models: #456
Conversation
lgahdl
commented
Sep 15, 2023
- GqlPoolBase;
- GqlPoolWeighted;
- GqlPoolStable;
- GqlPoolPhantomStable;
- GqlPoolMetaStable;
- ..and all the other Pools of GqlPoolUnion type
- GqlPoolBase; - GqlPoolWeighted; - GqlPoolStable; - GqlPoolPhantomStable; - GqlPoolMetaStable; - ..and all the other Pools of GqlPoolUnion type
What is the reason for this? |
The type of the pool is a required parameter for the b-sdk: export type PoolState = {
id: Address;
address: Address;
type: string;
tokens: {
address: Address;
decimals: number;
index: number;
}[]; |
you can query the type via |
It would work, but, for example, to check if a Gyro Pool is Gyro2, Gyro3 or GyroE, it would need to look what factory created the pool, because all of them has the __typename "GqlPoolGyro", in my opinion it's easier to use this "type" parameter, and I'm thinking about the same thing for the "version", that is also not in the models, maybe it would be good to add "version" as well in the gql models, because some pool versions has different token ordering than others, what do you think? |
Ok, makes sense. But it doesnt work like this.
You want to give that a shot? |
Hi @franzns! I made the changes to add "version" to all types, and I already tested for poolGetPools and poolGetPool methods, it's working fine. It wasn't necessary to populate these fields on "pool-gql-loader.service.ts", they come automatically populated because they're already part of "GqlPoolMinimal" and "GqlPoolBase" at schema.ts, so these fields don't need to be included manually, just like "id", "name", "symbol", and other base fields. About the "1. You only need to add it to GqlPoolBase, as all others extend that model", this type of inheritance is not available in the basic graphQL, the interface "implements" keyword requires the child type to have inherited fields written(like id, name, chain, and others), but there are some packages that make possible to create directives and implement this type of functionality for graphQL, I can search further if you like, the most trustable one seems to be "@graphql-tools/utils". StackOverflow Question about graphQL inheritance: https://stackoverflow.com/questions/47523384/how-to-inherit-or-extend-typedefs-in-graphql |
Thanks luiz! |