diff --git a/.graphclientrc.yml b/.graphclientrc.yml index aa8a2d36..4fcfc705 100644 --- a/.graphclientrc.yml +++ b/.graphclientrc.yml @@ -6,6 +6,6 @@ sources: - name: gs-voting handler: graphql: - endpoint: https://indexer.bigdevenergy.link/c8f8ea8/v1/graphql + endpoint: https://indexer.bigdevenergy.link/6b18ba8/v1/graphql documents: - './src/**/*.graphql' diff --git a/src/.graphclient/index.ts b/src/.graphclient/index.ts index 7c714d4f..3cd289ee 100644 --- a/src/.graphclient/index.ts +++ b/src/.graphclient/index.ts @@ -123,6 +123,10 @@ export type Query = { FactoryEventsSummary: Array; /** fetch data from the table: "FactoryEventsSummary" using primary key columns */ FactoryEventsSummary_by_pk?: Maybe; + /** fetch data from the table: "GSVoter" */ + GSVoter: Array; + /** fetch data from the table: "GSVoter" using primary key columns */ + GSVoter_by_pk?: Maybe; /** fetch data from the table: "GrantShipsVoting" */ GrantShipsVoting: Array; /** fetch data from the table: "GrantShipsVoting" using primary key columns */ @@ -641,6 +645,20 @@ export type QueryFactoryEventsSummary_by_pkArgs = { }; +export type QueryGSVoterArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + + +export type QueryGSVoter_by_pkArgs = { + id: Scalars['String']; +}; + + export type QueryGrantShipsVotingArgs = { distinct_on?: InputMaybe>; limit?: InputMaybe; @@ -983,6 +1001,12 @@ export type Subscription = { FactoryEventsSummary_by_pk?: Maybe; /** fetch data from the table in a streaming manner: "FactoryEventsSummary" */ FactoryEventsSummary_stream: Array; + /** fetch data from the table: "GSVoter" */ + GSVoter: Array; + /** fetch data from the table: "GSVoter" using primary key columns */ + GSVoter_by_pk?: Maybe; + /** fetch data from the table in a streaming manner: "GSVoter" */ + GSVoter_stream: Array; /** fetch data from the table: "GrantShipsVoting" */ GrantShipsVoting: Array; /** fetch data from the table: "GrantShipsVoting" using primary key columns */ @@ -1584,6 +1608,27 @@ export type SubscriptionFactoryEventsSummary_streamArgs = { }; +export type SubscriptionGSVoterArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + + +export type SubscriptionGSVoter_by_pkArgs = { + id: Scalars['String']; +}; + + +export type SubscriptionGSVoter_streamArgs = { + batch_size: Scalars['Int']; + cursor: Array>; + where?: InputMaybe; +}; + + export type SubscriptionGrantShipsVotingArgs = { distinct_on?: InputMaybe>; limit?: InputMaybe; @@ -5072,6 +5117,68 @@ export type FactoryEventsSummary_stream_cursor_value_input = { moduleTemplateCount?: InputMaybe; }; +/** columns and relationships of "GSVoter" */ +export type GSVoter = { + address: Scalars['String']; + db_write_timestamp?: Maybe; + id: Scalars['String']; + /** An array relationship */ + votes: Array; +}; + + +/** columns and relationships of "GSVoter" */ +export type GSVotervotesArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +/** Boolean expression to filter rows from the table "GSVoter". All fields are combined with a logical 'AND'. */ +export type GSVoter_bool_exp = { + _and?: InputMaybe>; + _not?: InputMaybe; + _or?: InputMaybe>; + address?: InputMaybe; + db_write_timestamp?: InputMaybe; + id?: InputMaybe; + votes?: InputMaybe; +}; + +/** Ordering options when selecting data from "GSVoter". */ +export type GSVoter_order_by = { + address?: InputMaybe; + db_write_timestamp?: InputMaybe; + id?: InputMaybe; + votes_aggregate?: InputMaybe; +}; + +/** select columns of table "GSVoter" */ +export type GSVoter_select_column = + /** column name */ + | 'address' + /** column name */ + | 'db_write_timestamp' + /** column name */ + | 'id'; + +/** Streaming cursor of the table "GSVoter" */ +export type GSVoter_stream_cursor_input = { + /** Stream column input with initial value */ + initial_value: GSVoter_stream_cursor_value_input; + /** cursor ordering */ + ordering?: InputMaybe; +}; + +/** Initial value of the column from where the streaming should start */ +export type GSVoter_stream_cursor_value_input = { + address?: InputMaybe; + db_write_timestamp?: InputMaybe; + id?: InputMaybe; +}; + /** columns and relationships of "GrantShipsVoting" */ export type GrantShipsVoting = { /** An array relationship */ @@ -5836,10 +5943,12 @@ export type ShipVote = { contest_id: Scalars['String']; db_write_timestamp?: Maybe; id: Scalars['String']; - isRectractVote: Scalars['Boolean']; + isRetractVote: Scalars['Boolean']; mdPointer: Scalars['String']; mdProtocol: Scalars['numeric']; - voter: Scalars['String']; + /** An object relationship */ + voter?: Maybe; + voter_id: Scalars['String']; }; /** order by aggregate values of table "ShipVote" */ @@ -5875,10 +5984,11 @@ export type ShipVote_bool_exp = { contest_id?: InputMaybe; db_write_timestamp?: InputMaybe; id?: InputMaybe; - isRectractVote?: InputMaybe; + isRetractVote?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter?: InputMaybe; + voter_id?: InputMaybe; }; /** order by max() on columns of table "ShipVote" */ @@ -5890,7 +6000,7 @@ export type ShipVote_max_order_by = { id?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter_id?: InputMaybe; }; /** order by min() on columns of table "ShipVote" */ @@ -5902,7 +6012,7 @@ export type ShipVote_min_order_by = { id?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter_id?: InputMaybe; }; /** Ordering options when selecting data from "ShipVote". */ @@ -5914,10 +6024,11 @@ export type ShipVote_order_by = { contest_id?: InputMaybe; db_write_timestamp?: InputMaybe; id?: InputMaybe; - isRectractVote?: InputMaybe; + isRetractVote?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter?: InputMaybe; + voter_id?: InputMaybe; }; /** select columns of table "ShipVote" */ @@ -5933,13 +6044,13 @@ export type ShipVote_select_column = /** column name */ | 'id' /** column name */ - | 'isRectractVote' + | 'isRetractVote' /** column name */ | 'mdPointer' /** column name */ | 'mdProtocol' /** column name */ - | 'voter'; + | 'voter_id'; /** order by stddev() on columns of table "ShipVote" */ export type ShipVote_stddev_order_by = { @@ -5974,10 +6085,10 @@ export type ShipVote_stream_cursor_value_input = { contest_id?: InputMaybe; db_write_timestamp?: InputMaybe; id?: InputMaybe; - isRectractVote?: InputMaybe; + isRetractVote?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter_id?: InputMaybe; }; /** order by sum() on columns of table "ShipVote" */ @@ -7300,6 +7411,12 @@ export type ResolversTypes = ResolversObject<{ FactoryEventsSummary_select_column: FactoryEventsSummary_select_column; FactoryEventsSummary_stream_cursor_input: FactoryEventsSummary_stream_cursor_input; FactoryEventsSummary_stream_cursor_value_input: FactoryEventsSummary_stream_cursor_value_input; + GSVoter: ResolverTypeWrapper; + GSVoter_bool_exp: GSVoter_bool_exp; + GSVoter_order_by: GSVoter_order_by; + GSVoter_select_column: GSVoter_select_column; + GSVoter_stream_cursor_input: GSVoter_stream_cursor_input; + GSVoter_stream_cursor_value_input: GSVoter_stream_cursor_value_input; GrantShipsVoting: ResolverTypeWrapper; GrantShipsVoting_bool_exp: GrantShipsVoting_bool_exp; GrantShipsVoting_order_by: GrantShipsVoting_order_by; @@ -7572,6 +7689,11 @@ export type ResolversParentTypes = ResolversObject<{ FactoryEventsSummary_order_by: FactoryEventsSummary_order_by; FactoryEventsSummary_stream_cursor_input: FactoryEventsSummary_stream_cursor_input; FactoryEventsSummary_stream_cursor_value_input: FactoryEventsSummary_stream_cursor_value_input; + GSVoter: GSVoter; + GSVoter_bool_exp: GSVoter_bool_exp; + GSVoter_order_by: GSVoter_order_by; + GSVoter_stream_cursor_input: GSVoter_stream_cursor_input; + GSVoter_stream_cursor_value_input: GSVoter_stream_cursor_value_input; GrantShipsVoting: GrantShipsVoting; GrantShipsVoting_bool_exp: GrantShipsVoting_bool_exp; GrantShipsVoting_order_by: GrantShipsVoting_order_by; @@ -7799,6 +7921,8 @@ export type QueryResolvers, ParentType, ContextType, RequireFields>; FactoryEventsSummary?: Resolver, ParentType, ContextType, Partial>; FactoryEventsSummary_by_pk?: Resolver, ParentType, ContextType, RequireFields>; + GSVoter?: Resolver, ParentType, ContextType, Partial>; + GSVoter_by_pk?: Resolver, ParentType, ContextType, RequireFields>; GrantShipsVoting?: Resolver, ParentType, ContextType, Partial>; GrantShipsVoting_by_pk?: Resolver, ParentType, ContextType, RequireFields>; HALParams?: Resolver, ParentType, ContextType, Partial>; @@ -7897,6 +8021,9 @@ export type SubscriptionResolvers, "FactoryEventsSummary", ParentType, ContextType, Partial>; FactoryEventsSummary_by_pk?: SubscriptionResolver, "FactoryEventsSummary_by_pk", ParentType, ContextType, RequireFields>; FactoryEventsSummary_stream?: SubscriptionResolver, "FactoryEventsSummary_stream", ParentType, ContextType, RequireFields>; + GSVoter?: SubscriptionResolver, "GSVoter", ParentType, ContextType, Partial>; + GSVoter_by_pk?: SubscriptionResolver, "GSVoter_by_pk", ParentType, ContextType, RequireFields>; + GSVoter_stream?: SubscriptionResolver, "GSVoter_stream", ParentType, ContextType, RequireFields>; GrantShipsVoting?: SubscriptionResolver, "GrantShipsVoting", ParentType, ContextType, Partial>; GrantShipsVoting_by_pk?: SubscriptionResolver, "GrantShipsVoting_by_pk", ParentType, ContextType, RequireFields>; GrantShipsVoting_stream?: SubscriptionResolver, "GrantShipsVoting_stream", ParentType, ContextType, RequireFields>; @@ -8306,6 +8433,14 @@ export type FactoryEventsSummaryResolvers; }>; +export type GSVoterResolvers = ResolversObject<{ + address?: Resolver; + db_write_timestamp?: Resolver, ParentType, ContextType>; + id?: Resolver; + votes?: Resolver, ParentType, ContextType, Partial>; + __isTypeOf?: IsTypeOfResolverFn; +}>; + export type GrantShipsVotingResolvers = ResolversObject<{ choices?: Resolver, ParentType, ContextType, Partial>; contest?: Resolver, ParentType, ContextType>; @@ -8396,10 +8531,11 @@ export type ShipVoteResolvers; db_write_timestamp?: Resolver, ParentType, ContextType>; id?: Resolver; - isRectractVote?: Resolver; + isRetractVote?: Resolver; mdPointer?: Resolver; mdProtocol?: Resolver; - voter?: Resolver; + voter?: Resolver, ParentType, ContextType>; + voter_id?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }>; @@ -8579,6 +8715,7 @@ export type Resolvers = ResolversObject<{ EnvioTX?: EnvioTXResolvers; EventPost?: EventPostResolvers; FactoryEventsSummary?: FactoryEventsSummaryResolvers; + GSVoter?: GSVoterResolvers; GrantShipsVoting?: GrantShipsVotingResolvers; HALParams?: HALParamsResolvers; HatsPoster?: HatsPosterResolvers; @@ -8672,7 +8809,7 @@ const grantShipsHandler = new GraphqlHandler({ }); const gsVotingHandler = new GraphqlHandler({ name: "gs-voting", - config: {"endpoint":"https://indexer.bigdevenergy.link/c8f8ea8/v1/graphql"}, + config: {"endpoint":"https://indexer.bigdevenergy.link/6b18ba8/v1/graphql"}, baseDir, cache, pubsub, @@ -8848,6 +8985,12 @@ const merger = new(StitchingMerger as any)({ return printWithCache(GetUserVotesDocument); }, location: 'GetUserVotesDocument.graphql' + },{ + document: GetVotersDocument, + get rawSDL() { + return printWithCache(GetVotersDocument); + }, + location: 'GetVotersDocument.graphql' },{ document: ProjectPageQueryDocument, get rawSDL() { @@ -9230,6 +9373,19 @@ export type getUserVotesQueryVariables = Exact<{ export type getUserVotesQuery = { ShipVote: Array> }; +export type getVotersQueryVariables = Exact<{ + contestId: Scalars['String']; +}>; + + +export type getVotersQuery = { GSVoter: Array<( + Pick + & { votes: Array<( + Pick + & { choice?: Maybe> } + )> } + )> }; + export type projectPageQueryQueryVariables = Exact<{ id: Scalars['ID']; }>; @@ -9706,7 +9862,7 @@ ${RawMetadataFragmentDoc} ${FacShipDataFragmentDoc}` as unknown as DocumentNode; export const getUserVotesDocument = gql` query getUserVotes($contestId: String!, $voterAddress: String!) { - ShipVote(where: {voter: {_eq: $voterAddress}, contest_id: {_eq: $contestId}}) { + ShipVote(where: {voter_id: {_eq: $voterAddress}, contest_id: {_eq: $contestId}}) { id choice_id mdPointer @@ -9715,6 +9871,23 @@ export const getUserVotesDocument = gql` } } ` as unknown as DocumentNode; +export const getVotersDocument = gql` + query getVoters($contestId: String!) { + GSVoter(where: {votes: {contest_id: {_eq: $contestId}}}) { + id + votes(where: {contest_id: {_eq: $contestId}, isRetractVote: {_eq: false}}) { + id + amount + mdPointer + mdProtocol + isRetractVote + choice { + id + } + } + } +} + ` as unknown as DocumentNode; export const projectPageQueryDocument = gql` query projectPageQuery($id: ID!) { project(id: $id) { @@ -9771,6 +9944,7 @@ export const ShipsPageQueryDocument = gql` + export type Requester = (doc: DocumentNode, vars?: V, options?: C) => Promise | AsyncIterable @@ -9845,6 +10019,9 @@ export function getSdk(requester: Requester) { getUserVotes(variables: getUserVotesQueryVariables, options?: C): Promise { return requester(getUserVotesDocument, variables, options) as Promise; }, + getVoters(variables: getVotersQueryVariables, options?: C): Promise { + return requester(getVotersDocument, variables, options) as Promise; + }, projectPageQuery(variables: projectPageQueryQueryVariables, options?: C): Promise { return requester(projectPageQueryDocument, variables, options) as Promise; }, diff --git a/src/.graphclient/schema.graphql b/src/.graphclient/schema.graphql index 34d15c2a..38e80b6e 100644 --- a/src/.graphclient/schema.graphql +++ b/src/.graphclient/schema.graphql @@ -639,6 +639,23 @@ type Query { """ FactoryEventsSummary_by_pk(id: String!): FactoryEventsSummary """ + fetch data from the table: "GSVoter" + """ + GSVoter( + """distinct select on columns""" + distinct_on: [GSVoter_select_column!] + """limit the number of rows returned""" + limit: Int + """skip the first n rows. Use only with order_by""" + offset: Int + """sort the rows by one or more columns""" + order_by: [GSVoter_order_by!] + """filter the rows returned""" + where: GSVoter_bool_exp + ): [GSVoter!]! + """fetch data from the table: "GSVoter" using primary key columns""" + GSVoter_by_pk(id: String!): GSVoter + """ fetch data from the table: "GrantShipsVoting" """ GrantShipsVoting( @@ -1650,6 +1667,34 @@ type Subscription { where: FactoryEventsSummary_bool_exp ): [FactoryEventsSummary!]! """ + fetch data from the table: "GSVoter" + """ + GSVoter( + """distinct select on columns""" + distinct_on: [GSVoter_select_column!] + """limit the number of rows returned""" + limit: Int + """skip the first n rows. Use only with order_by""" + offset: Int + """sort the rows by one or more columns""" + order_by: [GSVoter_order_by!] + """filter the rows returned""" + where: GSVoter_bool_exp + ): [GSVoter!]! + """fetch data from the table: "GSVoter" using primary key columns""" + GSVoter_by_pk(id: String!): GSVoter + """ + fetch data from the table in a streaming manner: "GSVoter" + """ + GSVoter_stream( + """maximum number of rows returned in a single batch""" + batch_size: Int! + """cursor to stream the results returned by the query""" + cursor: [GSVoter_stream_cursor_input]! + """filter the rows returned""" + where: GSVoter_bool_exp + ): [GSVoter!]! + """ fetch data from the table: "GrantShipsVoting" """ GrantShipsVoting( @@ -5346,6 +5391,78 @@ input FactoryEventsSummary_stream_cursor_value_input { moduleTemplateCount: numeric } +""" +columns and relationships of "GSVoter" +""" +type GSVoter { + address: String! + db_write_timestamp: timestamp + id: String! + """An array relationship""" + votes( + """distinct select on columns""" + distinct_on: [ShipVote_select_column!] + """limit the number of rows returned""" + limit: Int + """skip the first n rows. Use only with order_by""" + offset: Int + """sort the rows by one or more columns""" + order_by: [ShipVote_order_by!] + """filter the rows returned""" + where: ShipVote_bool_exp + ): [ShipVote!]! +} + +""" +Boolean expression to filter rows from the table "GSVoter". All fields are combined with a logical 'AND'. +""" +input GSVoter_bool_exp { + _and: [GSVoter_bool_exp!] + _not: GSVoter_bool_exp + _or: [GSVoter_bool_exp!] + address: String_comparison_exp + db_write_timestamp: timestamp_comparison_exp + id: String_comparison_exp + votes: ShipVote_bool_exp +} + +"""Ordering options when selecting data from "GSVoter".""" +input GSVoter_order_by { + address: order_by + db_write_timestamp: order_by + id: order_by + votes_aggregate: ShipVote_aggregate_order_by +} + +""" +select columns of table "GSVoter" +""" +enum GSVoter_select_column { + """column name""" + address + """column name""" + db_write_timestamp + """column name""" + id +} + +""" +Streaming cursor of the table "GSVoter" +""" +input GSVoter_stream_cursor_input { + """Stream column input with initial value""" + initial_value: GSVoter_stream_cursor_value_input! + """cursor ordering""" + ordering: cursor_ordering +} + +"""Initial value of the column from where the streaming should start""" +input GSVoter_stream_cursor_value_input { + address: String + db_write_timestamp: timestamp + id: String +} + """ columns and relationships of "GrantShipsVoting" """ @@ -6226,10 +6343,12 @@ type ShipVote { contest_id: String! db_write_timestamp: timestamp id: String! - isRectractVote: Boolean! + isRetractVote: Boolean! mdPointer: String! mdProtocol: numeric! - voter: String! + """An object relationship""" + voter: GSVoter + voter_id: String! } """ @@ -6271,10 +6390,11 @@ input ShipVote_bool_exp { contest_id: String_comparison_exp db_write_timestamp: timestamp_comparison_exp id: String_comparison_exp - isRectractVote: Boolean_comparison_exp + isRetractVote: Boolean_comparison_exp mdPointer: String_comparison_exp mdProtocol: numeric_comparison_exp - voter: String_comparison_exp + voter: GSVoter_bool_exp + voter_id: String_comparison_exp } """ @@ -6288,7 +6408,7 @@ input ShipVote_max_order_by { id: order_by mdPointer: order_by mdProtocol: order_by - voter: order_by + voter_id: order_by } """ @@ -6302,7 +6422,7 @@ input ShipVote_min_order_by { id: order_by mdPointer: order_by mdProtocol: order_by - voter: order_by + voter_id: order_by } """Ordering options when selecting data from "ShipVote".""" @@ -6314,10 +6434,11 @@ input ShipVote_order_by { contest_id: order_by db_write_timestamp: order_by id: order_by - isRectractVote: order_by + isRetractVote: order_by mdPointer: order_by mdProtocol: order_by - voter: order_by + voter: GSVoter_order_by + voter_id: order_by } """ @@ -6335,13 +6456,13 @@ enum ShipVote_select_column { """column name""" id """column name""" - isRectractVote + isRetractVote """column name""" mdPointer """column name""" mdProtocol """column name""" - voter + voter_id } """ @@ -6385,10 +6506,10 @@ input ShipVote_stream_cursor_value_input { contest_id: String db_write_timestamp: timestamp id: String - isRectractVote: Boolean + isRetractVote: Boolean mdPointer: String mdProtocol: numeric - voter: String + voter_id: String } """ diff --git a/src/.graphclient/sources/gs-voting/introspectionSchema.ts b/src/.graphclient/sources/gs-voting/introspectionSchema.ts index c1324acc..25d76ea5 100644 --- a/src/.graphclient/sources/gs-voting/introspectionSchema.ts +++ b/src/.graphclient/sources/gs-voting/introspectionSchema.ts @@ -6478,6 +6478,598 @@ const schemaAST = { ], "directives": [] }, + { + "kind": "ObjectTypeDefinition", + "description": { + "kind": "StringValue", + "value": "columns and relationships of \"GSVoter\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "GSVoter" + }, + "fields": [ + { + "kind": "FieldDefinition", + "name": { + "kind": "Name", + "value": "address" + }, + "arguments": [], + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "name": { + "kind": "Name", + "value": "db_write_timestamp" + }, + "arguments": [], + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "timestamp" + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "name": { + "kind": "Name", + "value": "id" + }, + "arguments": [], + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "An array relationship", + "block": true + }, + "name": { + "kind": "Name", + "value": "votes" + }, + "arguments": [ + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "distinct select on columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "distinct_on" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ShipVote_select_column" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "limit the number of rows returned", + "block": true + }, + "name": { + "kind": "Name", + "value": "limit" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "skip the first n rows. Use only with order_by", + "block": true + }, + "name": { + "kind": "Name", + "value": "offset" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "sort the rows by one or more columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "order_by" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ShipVote_order_by" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "filter the rows returned", + "block": true + }, + "name": { + "kind": "Name", + "value": "where" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ShipVote_bool_exp" + } + }, + "directives": [] + } + ], + "type": { + "kind": "NonNullType", + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ShipVote" + } + } + } + } + }, + "directives": [] + } + ], + "interfaces": [], + "directives": [] + }, + { + "kind": "InputObjectTypeDefinition", + "description": { + "kind": "StringValue", + "value": "Boolean expression to filter rows from the table \"GSVoter\". All fields are combined with a logical 'AND'.", + "block": true + }, + "name": { + "kind": "Name", + "value": "GSVoter_bool_exp" + }, + "fields": [ + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "_and" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "GSVoter_bool_exp" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "_not" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "GSVoter_bool_exp" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "_or" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "GSVoter_bool_exp" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "address" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String_comparison_exp" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "db_write_timestamp" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "timestamp_comparison_exp" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "id" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String_comparison_exp" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "votes" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ShipVote_bool_exp" + } + }, + "directives": [] + } + ], + "directives": [] + }, + { + "kind": "InputObjectTypeDefinition", + "description": { + "kind": "StringValue", + "value": "Ordering options when selecting data from \"GSVoter\".", + "block": true + }, + "name": { + "kind": "Name", + "value": "GSVoter_order_by" + }, + "fields": [ + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "address" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "order_by" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "db_write_timestamp" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "order_by" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "id" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "order_by" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "votes_aggregate" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ShipVote_aggregate_order_by" + } + }, + "directives": [] + } + ], + "directives": [] + }, + { + "kind": "EnumTypeDefinition", + "description": { + "kind": "StringValue", + "value": "select columns of table \"GSVoter\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "GSVoter_select_column" + }, + "values": [ + { + "kind": "EnumValueDefinition", + "description": { + "kind": "StringValue", + "value": "column name", + "block": true + }, + "name": { + "kind": "Name", + "value": "address" + }, + "directives": [] + }, + { + "kind": "EnumValueDefinition", + "description": { + "kind": "StringValue", + "value": "column name", + "block": true + }, + "name": { + "kind": "Name", + "value": "db_write_timestamp" + }, + "directives": [] + }, + { + "kind": "EnumValueDefinition", + "description": { + "kind": "StringValue", + "value": "column name", + "block": true + }, + "name": { + "kind": "Name", + "value": "id" + }, + "directives": [] + } + ], + "directives": [] + }, + { + "kind": "InputObjectTypeDefinition", + "description": { + "kind": "StringValue", + "value": "Streaming cursor of the table \"GSVoter\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "GSVoter_stream_cursor_input" + }, + "fields": [ + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "Stream column input with initial value", + "block": true + }, + "name": { + "kind": "Name", + "value": "initial_value" + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "GSVoter_stream_cursor_value_input" + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "cursor ordering", + "block": true + }, + "name": { + "kind": "Name", + "value": "ordering" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "cursor_ordering" + } + }, + "directives": [] + } + ], + "directives": [] + }, + { + "kind": "InputObjectTypeDefinition", + "description": { + "kind": "StringValue", + "value": "Initial value of the column from where the streaming should start", + "block": true + }, + "name": { + "kind": "Name", + "value": "GSVoter_stream_cursor_value_input" + }, + "fields": [ + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "address" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "db_write_timestamp" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "timestamp" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "id" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + }, + "directives": [] + } + ], + "directives": [] + }, { "kind": "ObjectTypeDefinition", "description": { @@ -14259,7 +14851,7 @@ const schemaAST = { "kind": "FieldDefinition", "name": { "kind": "Name", - "value": "isRectractVote" + "value": "isRetractVote" }, "arguments": [], "type": { @@ -14312,11 +14904,32 @@ const schemaAST = { }, "directives": [] }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "An object relationship", + "block": true + }, + "name": { + "kind": "Name", + "value": "voter" + }, + "arguments": [], + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "GSVoter" + } + }, + "directives": [] + }, { "kind": "FieldDefinition", "name": { "kind": "Name", - "value": "voter" + "value": "voter_id" }, "arguments": [], "type": { @@ -14738,7 +15351,7 @@ const schemaAST = { "kind": "InputValueDefinition", "name": { "kind": "Name", - "value": "isRectractVote" + "value": "isRetractVote" }, "type": { "kind": "NamedType", @@ -14785,6 +15398,21 @@ const schemaAST = { "kind": "Name", "value": "voter" }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "GSVoter_bool_exp" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "voter_id" + }, "type": { "kind": "NamedType", "name": { @@ -14918,7 +15546,7 @@ const schemaAST = { "kind": "InputValueDefinition", "name": { "kind": "Name", - "value": "voter" + "value": "voter_id" }, "type": { "kind": "NamedType", @@ -15053,7 +15681,7 @@ const schemaAST = { "kind": "InputValueDefinition", "name": { "kind": "Name", - "value": "voter" + "value": "voter_id" }, "type": { "kind": "NamedType", @@ -15188,7 +15816,7 @@ const schemaAST = { "kind": "InputValueDefinition", "name": { "kind": "Name", - "value": "isRectractVote" + "value": "isRetractVote" }, "type": { "kind": "NamedType", @@ -15235,6 +15863,21 @@ const schemaAST = { "kind": "Name", "value": "voter" }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "GSVoter_order_by" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "voter_id" + }, "type": { "kind": "NamedType", "name": { @@ -15333,7 +15976,7 @@ const schemaAST = { }, "name": { "kind": "Name", - "value": "isRectractVote" + "value": "isRetractVote" }, "directives": [] }, @@ -15372,7 +16015,7 @@ const schemaAST = { }, "name": { "kind": "Name", - "value": "voter" + "value": "voter_id" }, "directives": [] } @@ -15663,7 +16306,7 @@ const schemaAST = { "kind": "InputValueDefinition", "name": { "kind": "Name", - "value": "isRectractVote" + "value": "isRetractVote" }, "type": { "kind": "NamedType", @@ -15708,7 +16351,7 @@ const schemaAST = { "kind": "InputValueDefinition", "name": { "kind": "Name", - "value": "voter" + "value": "voter_id" }, "type": { "kind": "NamedType", @@ -26212,7 +26855,230 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate_order_by" + "value": "ContestTemplate_order_by" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "filter the rows returned", + "block": true + }, + "name": { + "kind": "Name", + "value": "where" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ContestTemplate_bool_exp" + } + }, + "directives": [] + } + ], + "type": { + "kind": "NonNullType", + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ContestTemplate" + } + } + } + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "fetch data from the table: \"ContestTemplate\" using primary key columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "ContestTemplate_by_pk" + }, + "arguments": [ + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "id" + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + } + }, + "directives": [] + } + ], + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ContestTemplate" + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "fetch data from the table: \"Contest\" using primary key columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "Contest_by_pk" + }, + "arguments": [ + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "id" + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + } + }, + "directives": [] + } + ], + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Contest" + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "fetch data from the table: \"ERCPointParams\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "ERCPointParams" + }, + "arguments": [ + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "distinct select on columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "distinct_on" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ERCPointParams_select_column" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "limit the number of rows returned", + "block": true + }, + "name": { + "kind": "Name", + "value": "limit" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "skip the first n rows. Use only with order_by", + "block": true + }, + "name": { + "kind": "Name", + "value": "offset" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "sort the rows by one or more columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "order_by" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ERCPointParams_order_by" } } } @@ -26234,7 +27100,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate_bool_exp" + "value": "ERCPointParams_bool_exp" } }, "directives": [] @@ -26250,7 +27116,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate" + "value": "ERCPointParams" } } } @@ -26262,52 +27128,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ContestTemplate\" using primary key columns", - "block": true - }, - "name": { - "kind": "Name", - "value": "ContestTemplate_by_pk" - }, - "arguments": [ - { - "kind": "InputValueDefinition", - "name": { - "kind": "Name", - "value": "id" - }, - "type": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" - } - } - }, - "directives": [] - } - ], - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ContestTemplate" - } - }, - "directives": [] - }, - { - "kind": "FieldDefinition", - "description": { - "kind": "StringValue", - "value": "fetch data from the table: \"Contest\" using primary key columns", + "value": "fetch data from the table: \"ERCPointParams\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "Contest_by_pk" + "value": "ERCPointParams_by_pk" }, "arguments": [ { @@ -26333,7 +27159,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest" + "value": "ERCPointParams" } }, "directives": [] @@ -26342,12 +27168,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ERCPointParams\"", + "value": "fetch data from the table: \"EnvioTX\"", "block": true }, "name": { "kind": "Name", - "value": "ERCPointParams" + "value": "EnvioTX" }, "arguments": [ { @@ -26369,7 +27195,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_select_column" + "value": "EnvioTX_select_column" } } } @@ -26435,7 +27261,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_order_by" + "value": "EnvioTX_order_by" } } } @@ -26457,7 +27283,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_bool_exp" + "value": "EnvioTX_bool_exp" } }, "directives": [] @@ -26473,7 +27299,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams" + "value": "EnvioTX" } } } @@ -26485,12 +27311,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ERCPointParams\" using primary key columns", + "value": "fetch data from the table: \"EnvioTX\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "ERCPointParams_by_pk" + "value": "EnvioTX_by_pk" }, "arguments": [ { @@ -26516,7 +27342,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams" + "value": "EnvioTX" } }, "directives": [] @@ -26525,12 +27351,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EnvioTX\"", + "value": "fetch data from the table: \"EventPost\"", "block": true }, "name": { "kind": "Name", - "value": "EnvioTX" + "value": "EventPost" }, "arguments": [ { @@ -26552,7 +27378,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_select_column" + "value": "EventPost_select_column" } } } @@ -26618,7 +27444,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_order_by" + "value": "EventPost_order_by" } } } @@ -26640,7 +27466,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_bool_exp" + "value": "EventPost_bool_exp" } }, "directives": [] @@ -26656,7 +27482,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX" + "value": "EventPost" } } } @@ -26668,12 +27494,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EnvioTX\" using primary key columns", + "value": "fetch data from the table: \"EventPost\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "EnvioTX_by_pk" + "value": "EventPost_by_pk" }, "arguments": [ { @@ -26699,7 +27525,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX" + "value": "EventPost" } }, "directives": [] @@ -26708,12 +27534,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EventPost\"", + "value": "fetch data from the table: \"FactoryEventsSummary\"", "block": true }, "name": { "kind": "Name", - "value": "EventPost" + "value": "FactoryEventsSummary" }, "arguments": [ { @@ -26735,7 +27561,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_select_column" + "value": "FactoryEventsSummary_select_column" } } } @@ -26801,7 +27627,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_order_by" + "value": "FactoryEventsSummary_order_by" } } } @@ -26823,7 +27649,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_bool_exp" + "value": "FactoryEventsSummary_bool_exp" } }, "directives": [] @@ -26839,7 +27665,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost" + "value": "FactoryEventsSummary" } } } @@ -26851,12 +27677,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EventPost\" using primary key columns", + "value": "fetch data from the table: \"FactoryEventsSummary\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "EventPost_by_pk" + "value": "FactoryEventsSummary_by_pk" }, "arguments": [ { @@ -26882,7 +27708,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost" + "value": "FactoryEventsSummary" } }, "directives": [] @@ -26891,12 +27717,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"FactoryEventsSummary\"", + "value": "fetch data from the table: \"GSVoter\"", "block": true }, "name": { "kind": "Name", - "value": "FactoryEventsSummary" + "value": "GSVoter" }, "arguments": [ { @@ -26918,7 +27744,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_select_column" + "value": "GSVoter_select_column" } } } @@ -26984,7 +27810,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_order_by" + "value": "GSVoter_order_by" } } } @@ -27006,7 +27832,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_bool_exp" + "value": "GSVoter_bool_exp" } }, "directives": [] @@ -27022,7 +27848,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary" + "value": "GSVoter" } } } @@ -27034,12 +27860,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"FactoryEventsSummary\" using primary key columns", + "value": "fetch data from the table: \"GSVoter\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "FactoryEventsSummary_by_pk" + "value": "GSVoter_by_pk" }, "arguments": [ { @@ -27065,7 +27891,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary" + "value": "GSVoter" } }, "directives": [] @@ -31869,27 +32695,170 @@ const schemaAST = { } }, "directives": [] - } - ], - "directives": [] - }, - { - "kind": "ObjectTypeDefinition", - "name": { - "kind": "Name", - "value": "subscription_root" - }, - "fields": [ + } + ], + "directives": [] + }, + { + "kind": "ObjectTypeDefinition", + "name": { + "kind": "Name", + "value": "subscription_root" + }, + "fields": [ + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "fetch data from the table: \"Contest\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "Contest" + }, + "arguments": [ + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "distinct select on columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "distinct_on" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Contest_select_column" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "limit the number of rows returned", + "block": true + }, + "name": { + "kind": "Name", + "value": "limit" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "skip the first n rows. Use only with order_by", + "block": true + }, + "name": { + "kind": "Name", + "value": "offset" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "sort the rows by one or more columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "order_by" + }, + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Contest_order_by" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "filter the rows returned", + "block": true + }, + "name": { + "kind": "Name", + "value": "where" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Contest_bool_exp" + } + }, + "directives": [] + } + ], + "type": { + "kind": "NonNullType", + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Contest" + } + } + } + } + }, + "directives": [] + }, { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"Contest\"", + "value": "fetch data from the table: \"ContestClone\"", "block": true }, "name": { "kind": "Name", - "value": "Contest" + "value": "ContestClone" }, "arguments": [ { @@ -31911,7 +32880,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest_select_column" + "value": "ContestClone_select_column" } } } @@ -31977,7 +32946,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest_order_by" + "value": "ContestClone_order_by" } } } @@ -31999,7 +32968,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest_bool_exp" + "value": "ContestClone_bool_exp" } }, "directives": [] @@ -32015,7 +32984,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest" + "value": "ContestClone" } } } @@ -32027,12 +32996,152 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ContestClone\"", + "value": "fetch data from the table: \"ContestClone\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "ContestClone" + "value": "ContestClone_by_pk" + }, + "arguments": [ + { + "kind": "InputValueDefinition", + "name": { + "kind": "Name", + "value": "id" + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" + } + } + }, + "directives": [] + } + ], + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ContestClone" + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "fetch data from the table in a streaming manner: \"ContestClone\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "ContestClone_stream" + }, + "arguments": [ + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "maximum number of rows returned in a single batch", + "block": true + }, + "name": { + "kind": "Name", + "value": "batch_size" + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "cursor to stream the results returned by the query", + "block": true + }, + "name": { + "kind": "Name", + "value": "cursor" + }, + "type": { + "kind": "NonNullType", + "type": { + "kind": "ListType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ContestClone_stream_cursor_input" + } + } + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "filter the rows returned", + "block": true + }, + "name": { + "kind": "Name", + "value": "where" + }, + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ContestClone_bool_exp" + } + }, + "directives": [] + } + ], + "type": { + "kind": "NonNullType", + "type": { + "kind": "ListType", + "type": { + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ContestClone" + } + } + } + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "fetch data from the table: \"ContestTemplate\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "ContestTemplate" }, "arguments": [ { @@ -32054,7 +33163,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone_select_column" + "value": "ContestTemplate_select_column" } } } @@ -32120,7 +33229,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone_order_by" + "value": "ContestTemplate_order_by" } } } @@ -32142,7 +33251,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone_bool_exp" + "value": "ContestTemplate_bool_exp" } }, "directives": [] @@ -32158,7 +33267,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone" + "value": "ContestTemplate" } } } @@ -32170,12 +33279,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ContestClone\" using primary key columns", + "value": "fetch data from the table: \"ContestTemplate\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "ContestClone_by_pk" + "value": "ContestTemplate_by_pk" }, "arguments": [ { @@ -32201,7 +33310,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone" + "value": "ContestTemplate" } }, "directives": [] @@ -32210,12 +33319,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table in a streaming manner: \"ContestClone\"", + "value": "fetch data from the table in a streaming manner: \"ContestTemplate\"", "block": true }, "name": { "kind": "Name", - "value": "ContestClone_stream" + "value": "ContestTemplate_stream" }, "arguments": [ { @@ -32260,7 +33369,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone_stream_cursor_input" + "value": "ContestTemplate_stream_cursor_input" } } } @@ -32282,7 +33391,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone_bool_exp" + "value": "ContestTemplate_bool_exp" } }, "directives": [] @@ -32298,7 +33407,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestClone" + "value": "ContestTemplate" } } } @@ -32310,76 +33419,73 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ContestTemplate\"", + "value": "fetch data from the table: \"Contest\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "ContestTemplate" + "value": "Contest_by_pk" }, "arguments": [ { "kind": "InputValueDefinition", - "description": { - "kind": "StringValue", - "value": "distinct select on columns", - "block": true - }, "name": { "kind": "Name", - "value": "distinct_on" + "value": "id" }, "type": { - "kind": "ListType", + "kind": "NonNullType", "type": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ContestTemplate_select_column" - } + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "String" } } }, "directives": [] - }, - { - "kind": "InputValueDefinition", - "description": { - "kind": "StringValue", - "value": "limit the number of rows returned", - "block": true - }, - "name": { - "kind": "Name", - "value": "limit" - }, - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } - }, - "directives": [] - }, + } + ], + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Contest" + } + }, + "directives": [] + }, + { + "kind": "FieldDefinition", + "description": { + "kind": "StringValue", + "value": "fetch data from the table in a streaming manner: \"Contest\"", + "block": true + }, + "name": { + "kind": "Name", + "value": "Contest_stream" + }, + "arguments": [ { "kind": "InputValueDefinition", "description": { "kind": "StringValue", - "value": "skip the first n rows. Use only with order_by", + "value": "maximum number of rows returned in a single batch", "block": true }, "name": { "kind": "Name", - "value": "offset" + "value": "batch_size" }, "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } } }, "directives": [] @@ -32388,22 +33494,22 @@ const schemaAST = { "kind": "InputValueDefinition", "description": { "kind": "StringValue", - "value": "sort the rows by one or more columns", + "value": "cursor to stream the results returned by the query", "block": true }, "name": { "kind": "Name", - "value": "order_by" + "value": "cursor" }, "type": { - "kind": "ListType", + "kind": "NonNullType", "type": { - "kind": "NonNullType", + "kind": "ListType", "type": { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate_order_by" + "value": "Contest_stream_cursor_input" } } } @@ -32425,7 +33531,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate_bool_exp" + "value": "Contest_bool_exp" } }, "directives": [] @@ -32441,7 +33547,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate" + "value": "Contest" } } } @@ -32453,73 +33559,56 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ContestTemplate\" using primary key columns", + "value": "fetch data from the table: \"ERCPointParams\"", "block": true }, "name": { "kind": "Name", - "value": "ContestTemplate_by_pk" + "value": "ERCPointParams" }, "arguments": [ { "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "distinct select on columns", + "block": true + }, "name": { "kind": "Name", - "value": "id" + "value": "distinct_on" }, "type": { - "kind": "NonNullType", + "kind": "ListType", "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "String" + "kind": "NonNullType", + "type": { + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "ERCPointParams_select_column" + } } } }, "directives": [] - } - ], - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "ContestTemplate" - } - }, - "directives": [] - }, - { - "kind": "FieldDefinition", - "description": { - "kind": "StringValue", - "value": "fetch data from the table in a streaming manner: \"ContestTemplate\"", - "block": true - }, - "name": { - "kind": "Name", - "value": "ContestTemplate_stream" - }, - "arguments": [ + }, { "kind": "InputValueDefinition", "description": { "kind": "StringValue", - "value": "maximum number of rows returned in a single batch", + "value": "limit the number of rows returned", "block": true }, "name": { "kind": "Name", - "value": "batch_size" + "value": "limit" }, "type": { - "kind": "NonNullType", - "type": { - "kind": "NamedType", - "name": { - "kind": "Name", - "value": "Int" - } + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" } }, "directives": [] @@ -32528,22 +33617,42 @@ const schemaAST = { "kind": "InputValueDefinition", "description": { "kind": "StringValue", - "value": "cursor to stream the results returned by the query", + "value": "skip the first n rows. Use only with order_by", "block": true }, "name": { "kind": "Name", - "value": "cursor" + "value": "offset" }, "type": { - "kind": "NonNullType", + "kind": "NamedType", + "name": { + "kind": "Name", + "value": "Int" + } + }, + "directives": [] + }, + { + "kind": "InputValueDefinition", + "description": { + "kind": "StringValue", + "value": "sort the rows by one or more columns", + "block": true + }, + "name": { + "kind": "Name", + "value": "order_by" + }, + "type": { + "kind": "ListType", "type": { - "kind": "ListType", + "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate_stream_cursor_input" + "value": "ERCPointParams_order_by" } } } @@ -32565,7 +33674,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate_bool_exp" + "value": "ERCPointParams_bool_exp" } }, "directives": [] @@ -32581,7 +33690,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ContestTemplate" + "value": "ERCPointParams" } } } @@ -32593,12 +33702,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"Contest\" using primary key columns", + "value": "fetch data from the table: \"ERCPointParams\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "Contest_by_pk" + "value": "ERCPointParams_by_pk" }, "arguments": [ { @@ -32624,7 +33733,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest" + "value": "ERCPointParams" } }, "directives": [] @@ -32633,12 +33742,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table in a streaming manner: \"Contest\"", + "value": "fetch data from the table in a streaming manner: \"ERCPointParams\"", "block": true }, "name": { "kind": "Name", - "value": "Contest_stream" + "value": "ERCPointParams_stream" }, "arguments": [ { @@ -32683,7 +33792,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest_stream_cursor_input" + "value": "ERCPointParams_stream_cursor_input" } } } @@ -32705,7 +33814,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest_bool_exp" + "value": "ERCPointParams_bool_exp" } }, "directives": [] @@ -32721,7 +33830,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "Contest" + "value": "ERCPointParams" } } } @@ -32733,12 +33842,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ERCPointParams\"", + "value": "fetch data from the table: \"EnvioTX\"", "block": true }, "name": { "kind": "Name", - "value": "ERCPointParams" + "value": "EnvioTX" }, "arguments": [ { @@ -32760,7 +33869,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_select_column" + "value": "EnvioTX_select_column" } } } @@ -32826,7 +33935,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_order_by" + "value": "EnvioTX_order_by" } } } @@ -32848,7 +33957,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_bool_exp" + "value": "EnvioTX_bool_exp" } }, "directives": [] @@ -32864,7 +33973,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams" + "value": "EnvioTX" } } } @@ -32876,12 +33985,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"ERCPointParams\" using primary key columns", + "value": "fetch data from the table: \"EnvioTX\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "ERCPointParams_by_pk" + "value": "EnvioTX_by_pk" }, "arguments": [ { @@ -32907,7 +34016,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams" + "value": "EnvioTX" } }, "directives": [] @@ -32916,12 +34025,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table in a streaming manner: \"ERCPointParams\"", + "value": "fetch data from the table in a streaming manner: \"EnvioTX\"", "block": true }, "name": { "kind": "Name", - "value": "ERCPointParams_stream" + "value": "EnvioTX_stream" }, "arguments": [ { @@ -32966,7 +34075,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_stream_cursor_input" + "value": "EnvioTX_stream_cursor_input" } } } @@ -32988,7 +34097,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams_bool_exp" + "value": "EnvioTX_bool_exp" } }, "directives": [] @@ -33004,7 +34113,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "ERCPointParams" + "value": "EnvioTX" } } } @@ -33016,12 +34125,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EnvioTX\"", + "value": "fetch data from the table: \"EventPost\"", "block": true }, "name": { "kind": "Name", - "value": "EnvioTX" + "value": "EventPost" }, "arguments": [ { @@ -33043,7 +34152,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_select_column" + "value": "EventPost_select_column" } } } @@ -33109,7 +34218,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_order_by" + "value": "EventPost_order_by" } } } @@ -33131,7 +34240,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_bool_exp" + "value": "EventPost_bool_exp" } }, "directives": [] @@ -33147,7 +34256,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX" + "value": "EventPost" } } } @@ -33159,12 +34268,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EnvioTX\" using primary key columns", + "value": "fetch data from the table: \"EventPost\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "EnvioTX_by_pk" + "value": "EventPost_by_pk" }, "arguments": [ { @@ -33190,7 +34299,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX" + "value": "EventPost" } }, "directives": [] @@ -33199,12 +34308,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table in a streaming manner: \"EnvioTX\"", + "value": "fetch data from the table in a streaming manner: \"EventPost\"", "block": true }, "name": { "kind": "Name", - "value": "EnvioTX_stream" + "value": "EventPost_stream" }, "arguments": [ { @@ -33249,7 +34358,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_stream_cursor_input" + "value": "EventPost_stream_cursor_input" } } } @@ -33271,7 +34380,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX_bool_exp" + "value": "EventPost_bool_exp" } }, "directives": [] @@ -33287,7 +34396,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EnvioTX" + "value": "EventPost" } } } @@ -33299,12 +34408,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EventPost\"", + "value": "fetch data from the table: \"FactoryEventsSummary\"", "block": true }, "name": { "kind": "Name", - "value": "EventPost" + "value": "FactoryEventsSummary" }, "arguments": [ { @@ -33326,7 +34435,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_select_column" + "value": "FactoryEventsSummary_select_column" } } } @@ -33392,7 +34501,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_order_by" + "value": "FactoryEventsSummary_order_by" } } } @@ -33414,7 +34523,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_bool_exp" + "value": "FactoryEventsSummary_bool_exp" } }, "directives": [] @@ -33430,7 +34539,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost" + "value": "FactoryEventsSummary" } } } @@ -33442,12 +34551,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"EventPost\" using primary key columns", + "value": "fetch data from the table: \"FactoryEventsSummary\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "EventPost_by_pk" + "value": "FactoryEventsSummary_by_pk" }, "arguments": [ { @@ -33473,7 +34582,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost" + "value": "FactoryEventsSummary" } }, "directives": [] @@ -33482,12 +34591,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table in a streaming manner: \"EventPost\"", + "value": "fetch data from the table in a streaming manner: \"FactoryEventsSummary\"", "block": true }, "name": { "kind": "Name", - "value": "EventPost_stream" + "value": "FactoryEventsSummary_stream" }, "arguments": [ { @@ -33532,7 +34641,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_stream_cursor_input" + "value": "FactoryEventsSummary_stream_cursor_input" } } } @@ -33554,7 +34663,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost_bool_exp" + "value": "FactoryEventsSummary_bool_exp" } }, "directives": [] @@ -33570,7 +34679,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "EventPost" + "value": "FactoryEventsSummary" } } } @@ -33582,12 +34691,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"FactoryEventsSummary\"", + "value": "fetch data from the table: \"GSVoter\"", "block": true }, "name": { "kind": "Name", - "value": "FactoryEventsSummary" + "value": "GSVoter" }, "arguments": [ { @@ -33609,7 +34718,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_select_column" + "value": "GSVoter_select_column" } } } @@ -33675,7 +34784,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_order_by" + "value": "GSVoter_order_by" } } } @@ -33697,7 +34806,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_bool_exp" + "value": "GSVoter_bool_exp" } }, "directives": [] @@ -33713,7 +34822,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary" + "value": "GSVoter" } } } @@ -33725,12 +34834,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table: \"FactoryEventsSummary\" using primary key columns", + "value": "fetch data from the table: \"GSVoter\" using primary key columns", "block": true }, "name": { "kind": "Name", - "value": "FactoryEventsSummary_by_pk" + "value": "GSVoter_by_pk" }, "arguments": [ { @@ -33756,7 +34865,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary" + "value": "GSVoter" } }, "directives": [] @@ -33765,12 +34874,12 @@ const schemaAST = { "kind": "FieldDefinition", "description": { "kind": "StringValue", - "value": "fetch data from the table in a streaming manner: \"FactoryEventsSummary\"", + "value": "fetch data from the table in a streaming manner: \"GSVoter\"", "block": true }, "name": { "kind": "Name", - "value": "FactoryEventsSummary_stream" + "value": "GSVoter_stream" }, "arguments": [ { @@ -33815,7 +34924,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_stream_cursor_input" + "value": "GSVoter_stream_cursor_input" } } } @@ -33837,7 +34946,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary_bool_exp" + "value": "GSVoter_bool_exp" } }, "directives": [] @@ -33853,7 +34962,7 @@ const schemaAST = { "kind": "NamedType", "name": { "kind": "Name", - "value": "FactoryEventsSummary" + "value": "GSVoter" } } } diff --git a/src/.graphclient/sources/gs-voting/schema.graphql b/src/.graphclient/sources/gs-voting/schema.graphql index 2d23e52e..0155630e 100644 --- a/src/.graphclient/sources/gs-voting/schema.graphql +++ b/src/.graphclient/sources/gs-voting/schema.graphql @@ -726,6 +726,78 @@ input FactoryEventsSummary_stream_cursor_value_input { moduleTemplateCount: numeric } +""" +columns and relationships of "GSVoter" +""" +type GSVoter { + address: String! + db_write_timestamp: timestamp + id: String! + """An array relationship""" + votes( + """distinct select on columns""" + distinct_on: [ShipVote_select_column!] + """limit the number of rows returned""" + limit: Int + """skip the first n rows. Use only with order_by""" + offset: Int + """sort the rows by one or more columns""" + order_by: [ShipVote_order_by!] + """filter the rows returned""" + where: ShipVote_bool_exp + ): [ShipVote!]! +} + +""" +Boolean expression to filter rows from the table "GSVoter". All fields are combined with a logical 'AND'. +""" +input GSVoter_bool_exp { + _and: [GSVoter_bool_exp!] + _not: GSVoter_bool_exp + _or: [GSVoter_bool_exp!] + address: String_comparison_exp + db_write_timestamp: timestamp_comparison_exp + id: String_comparison_exp + votes: ShipVote_bool_exp +} + +"""Ordering options when selecting data from "GSVoter".""" +input GSVoter_order_by { + address: order_by + db_write_timestamp: order_by + id: order_by + votes_aggregate: ShipVote_aggregate_order_by +} + +""" +select columns of table "GSVoter" +""" +enum GSVoter_select_column { + """column name""" + address + """column name""" + db_write_timestamp + """column name""" + id +} + +""" +Streaming cursor of the table "GSVoter" +""" +input GSVoter_stream_cursor_input { + """Stream column input with initial value""" + initial_value: GSVoter_stream_cursor_value_input! + """cursor ordering""" + ordering: cursor_ordering +} + +"""Initial value of the column from where the streaming should start""" +input GSVoter_stream_cursor_value_input { + address: String + db_write_timestamp: timestamp + id: String +} + """ columns and relationships of "GrantShipsVoting" """ @@ -1606,10 +1678,12 @@ type ShipVote { contest_id: String! db_write_timestamp: timestamp id: String! - isRectractVote: Boolean! + isRetractVote: Boolean! mdPointer: String! mdProtocol: numeric! - voter: String! + """An object relationship""" + voter: GSVoter + voter_id: String! } """ @@ -1651,10 +1725,11 @@ input ShipVote_bool_exp { contest_id: String_comparison_exp db_write_timestamp: timestamp_comparison_exp id: String_comparison_exp - isRectractVote: Boolean_comparison_exp + isRetractVote: Boolean_comparison_exp mdPointer: String_comparison_exp mdProtocol: numeric_comparison_exp - voter: String_comparison_exp + voter: GSVoter_bool_exp + voter_id: String_comparison_exp } """ @@ -1668,7 +1743,7 @@ input ShipVote_max_order_by { id: order_by mdPointer: order_by mdProtocol: order_by - voter: order_by + voter_id: order_by } """ @@ -1682,7 +1757,7 @@ input ShipVote_min_order_by { id: order_by mdPointer: order_by mdProtocol: order_by - voter: order_by + voter_id: order_by } """Ordering options when selecting data from "ShipVote".""" @@ -1694,10 +1769,11 @@ input ShipVote_order_by { contest_id: order_by db_write_timestamp: order_by id: order_by - isRectractVote: order_by + isRetractVote: order_by mdPointer: order_by mdProtocol: order_by - voter: order_by + voter: GSVoter_order_by + voter_id: order_by } """ @@ -1715,13 +1791,13 @@ enum ShipVote_select_column { """column name""" id """column name""" - isRectractVote + isRetractVote """column name""" mdPointer """column name""" mdProtocol """column name""" - voter + voter_id } """ @@ -1765,10 +1841,10 @@ input ShipVote_stream_cursor_value_input { contest_id: String db_write_timestamp: timestamp id: String - isRectractVote: Boolean + isRetractVote: Boolean mdPointer: String mdProtocol: numeric - voter: String + voter_id: String } """ @@ -2979,6 +3055,23 @@ type query_root { """ FactoryEventsSummary_by_pk(id: String!): FactoryEventsSummary """ + fetch data from the table: "GSVoter" + """ + GSVoter( + """distinct select on columns""" + distinct_on: [GSVoter_select_column!] + """limit the number of rows returned""" + limit: Int + """skip the first n rows. Use only with order_by""" + offset: Int + """sort the rows by one or more columns""" + order_by: [GSVoter_order_by!] + """filter the rows returned""" + where: GSVoter_bool_exp + ): [GSVoter!]! + """fetch data from the table: "GSVoter" using primary key columns""" + GSVoter_by_pk(id: String!): GSVoter + """ fetch data from the table: "GrantShipsVoting" """ GrantShipsVoting( @@ -3623,6 +3716,34 @@ type subscription_root { where: FactoryEventsSummary_bool_exp ): [FactoryEventsSummary!]! """ + fetch data from the table: "GSVoter" + """ + GSVoter( + """distinct select on columns""" + distinct_on: [GSVoter_select_column!] + """limit the number of rows returned""" + limit: Int + """skip the first n rows. Use only with order_by""" + offset: Int + """sort the rows by one or more columns""" + order_by: [GSVoter_order_by!] + """filter the rows returned""" + where: GSVoter_bool_exp + ): [GSVoter!]! + """fetch data from the table: "GSVoter" using primary key columns""" + GSVoter_by_pk(id: String!): GSVoter + """ + fetch data from the table in a streaming manner: "GSVoter" + """ + GSVoter_stream( + """maximum number of rows returned in a single batch""" + batch_size: Int! + """cursor to stream the results returned by the query""" + cursor: [GSVoter_stream_cursor_input]! + """filter the rows returned""" + where: GSVoter_bool_exp + ): [GSVoter!]! + """ fetch data from the table: "GrantShipsVoting" """ GrantShipsVoting( diff --git a/src/.graphclient/sources/gs-voting/types.ts b/src/.graphclient/sources/gs-voting/types.ts index 37d13cea..41f44a2a 100644 --- a/src/.graphclient/sources/gs-voting/types.ts +++ b/src/.graphclient/sources/gs-voting/types.ts @@ -653,6 +653,68 @@ export type FactoryEventsSummary_stream_cursor_value_input = { moduleTemplateCount?: InputMaybe; }; +/** columns and relationships of "GSVoter" */ +export type GSVoter = { + address: Scalars['String']; + db_write_timestamp?: Maybe; + id: Scalars['String']; + /** An array relationship */ + votes: Array; +}; + + +/** columns and relationships of "GSVoter" */ +export type GSVotervotesArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + +/** Boolean expression to filter rows from the table "GSVoter". All fields are combined with a logical 'AND'. */ +export type GSVoter_bool_exp = { + _and?: InputMaybe>; + _not?: InputMaybe; + _or?: InputMaybe>; + address?: InputMaybe; + db_write_timestamp?: InputMaybe; + id?: InputMaybe; + votes?: InputMaybe; +}; + +/** Ordering options when selecting data from "GSVoter". */ +export type GSVoter_order_by = { + address?: InputMaybe; + db_write_timestamp?: InputMaybe; + id?: InputMaybe; + votes_aggregate?: InputMaybe; +}; + +/** select columns of table "GSVoter" */ +export type GSVoter_select_column = + /** column name */ + | 'address' + /** column name */ + | 'db_write_timestamp' + /** column name */ + | 'id'; + +/** Streaming cursor of the table "GSVoter" */ +export type GSVoter_stream_cursor_input = { + /** Stream column input with initial value */ + initial_value: GSVoter_stream_cursor_value_input; + /** cursor ordering */ + ordering?: InputMaybe; +}; + +/** Initial value of the column from where the streaming should start */ +export type GSVoter_stream_cursor_value_input = { + address?: InputMaybe; + db_write_timestamp?: InputMaybe; + id?: InputMaybe; +}; + /** columns and relationships of "GrantShipsVoting" */ export type GrantShipsVoting = { /** An array relationship */ @@ -1417,10 +1479,12 @@ export type ShipVote = { contest_id: Scalars['String']; db_write_timestamp?: Maybe; id: Scalars['String']; - isRectractVote: Scalars['Boolean']; + isRetractVote: Scalars['Boolean']; mdPointer: Scalars['String']; mdProtocol: Scalars['numeric']; - voter: Scalars['String']; + /** An object relationship */ + voter?: Maybe; + voter_id: Scalars['String']; }; /** order by aggregate values of table "ShipVote" */ @@ -1456,10 +1520,11 @@ export type ShipVote_bool_exp = { contest_id?: InputMaybe; db_write_timestamp?: InputMaybe; id?: InputMaybe; - isRectractVote?: InputMaybe; + isRetractVote?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter?: InputMaybe; + voter_id?: InputMaybe; }; /** order by max() on columns of table "ShipVote" */ @@ -1471,7 +1536,7 @@ export type ShipVote_max_order_by = { id?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter_id?: InputMaybe; }; /** order by min() on columns of table "ShipVote" */ @@ -1483,7 +1548,7 @@ export type ShipVote_min_order_by = { id?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter_id?: InputMaybe; }; /** Ordering options when selecting data from "ShipVote". */ @@ -1495,10 +1560,11 @@ export type ShipVote_order_by = { contest_id?: InputMaybe; db_write_timestamp?: InputMaybe; id?: InputMaybe; - isRectractVote?: InputMaybe; + isRetractVote?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter?: InputMaybe; + voter_id?: InputMaybe; }; /** select columns of table "ShipVote" */ @@ -1514,13 +1580,13 @@ export type ShipVote_select_column = /** column name */ | 'id' /** column name */ - | 'isRectractVote' + | 'isRetractVote' /** column name */ | 'mdPointer' /** column name */ | 'mdProtocol' /** column name */ - | 'voter'; + | 'voter_id'; /** order by stddev() on columns of table "ShipVote" */ export type ShipVote_stddev_order_by = { @@ -1555,10 +1621,10 @@ export type ShipVote_stream_cursor_value_input = { contest_id?: InputMaybe; db_write_timestamp?: InputMaybe; id?: InputMaybe; - isRectractVote?: InputMaybe; + isRetractVote?: InputMaybe; mdPointer?: InputMaybe; mdProtocol?: InputMaybe; - voter?: InputMaybe; + voter_id?: InputMaybe; }; /** order by sum() on columns of table "ShipVote" */ @@ -2546,6 +2612,10 @@ export type query_root = { FactoryEventsSummary: Array; /** fetch data from the table: "FactoryEventsSummary" using primary key columns */ FactoryEventsSummary_by_pk?: Maybe; + /** fetch data from the table: "GSVoter" */ + GSVoter: Array; + /** fetch data from the table: "GSVoter" using primary key columns */ + GSVoter_by_pk?: Maybe; /** fetch data from the table: "GrantShipsVoting" */ GrantShipsVoting: Array; /** fetch data from the table: "GrantShipsVoting" using primary key columns */ @@ -2717,6 +2787,20 @@ export type query_rootFactoryEventsSummary_by_pkArgs = { }; +export type query_rootGSVoterArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + + +export type query_rootGSVoter_by_pkArgs = { + id: Scalars['String']; +}; + + export type query_rootGrantShipsVotingArgs = { distinct_on?: InputMaybe>; limit?: InputMaybe; @@ -3141,6 +3225,12 @@ export type subscription_root = { FactoryEventsSummary_by_pk?: Maybe; /** fetch data from the table in a streaming manner: "FactoryEventsSummary" */ FactoryEventsSummary_stream: Array; + /** fetch data from the table: "GSVoter" */ + GSVoter: Array; + /** fetch data from the table: "GSVoter" using primary key columns */ + GSVoter_by_pk?: Maybe; + /** fetch data from the table in a streaming manner: "GSVoter" */ + GSVoter_stream: Array; /** fetch data from the table: "GrantShipsVoting" */ GrantShipsVoting: Array; /** fetch data from the table: "GrantShipsVoting" using primary key columns */ @@ -3395,6 +3485,27 @@ export type subscription_rootFactoryEventsSummary_streamArgs = { }; +export type subscription_rootGSVoterArgs = { + distinct_on?: InputMaybe>; + limit?: InputMaybe; + offset?: InputMaybe; + order_by?: InputMaybe>; + where?: InputMaybe; +}; + + +export type subscription_rootGSVoter_by_pkArgs = { + id: Scalars['String']; +}; + + +export type subscription_rootGSVoter_streamArgs = { + batch_size: Scalars['Int']; + cursor: Array>; + where?: InputMaybe; +}; + + export type subscription_rootGrantShipsVotingArgs = { distinct_on?: InputMaybe>; limit?: InputMaybe; @@ -3828,6 +3939,10 @@ export type timestamptz_comparison_exp = { FactoryEventsSummary: InContextSdkMethod, /** fetch data from the table: "FactoryEventsSummary" using primary key columns **/ FactoryEventsSummary_by_pk: InContextSdkMethod, + /** fetch data from the table: "GSVoter" **/ + GSVoter: InContextSdkMethod, + /** fetch data from the table: "GSVoter" using primary key columns **/ + GSVoter_by_pk: InContextSdkMethod, /** fetch data from the table: "GrantShipsVoting" **/ GrantShipsVoting: InContextSdkMethod, /** fetch data from the table: "GrantShipsVoting" using primary key columns **/ @@ -3947,6 +4062,12 @@ export type timestamptz_comparison_exp = { FactoryEventsSummary_by_pk: InContextSdkMethod, /** fetch data from the table in a streaming manner: "FactoryEventsSummary" **/ FactoryEventsSummary_stream: InContextSdkMethod, + /** fetch data from the table: "GSVoter" **/ + GSVoter: InContextSdkMethod, + /** fetch data from the table: "GSVoter" using primary key columns **/ + GSVoter_by_pk: InContextSdkMethod, + /** fetch data from the table in a streaming manner: "GSVoter" **/ + GSVoter_stream: InContextSdkMethod, /** fetch data from the table: "GrantShipsVoting" **/ GrantShipsVoting: InContextSdkMethod, /** fetch data from the table: "GrantShipsVoting" using primary key columns **/ diff --git a/src/components/forms/validationSchemas/votingFormSchema.ts b/src/components/forms/validationSchemas/votingFormSchema.ts index 25fba36a..cd26e08a 100644 --- a/src/components/forms/validationSchemas/votingFormSchema.ts +++ b/src/components/forms/validationSchemas/votingFormSchema.ts @@ -1,11 +1,31 @@ import { z } from 'zod'; +export function validateNumberWithMaxDecimals( + input: string, + maxDecimals: number +) { + if (typeof input !== 'string') return null; + const number = Number(input); + if (Number.isNaN(number)) { + return 'Must be a number'; + } + + const parts = input.split('.'); + if (parts.length === 2 && parts[1].length > maxDecimals) { + return `Must have ${maxDecimals} or fewer decimal places`; + } + + return null; +} export const votingSchema = z.object({ ships: z.array( z.object({ shipId: z.string(), - shipPerc: z.string().regex(/^\d+(\.\d+)?$/, 'Must be a number'), + shipPerc: z.number().min(0).max(100), shipComment: z.string(), }) ), }); +export const voteReasonsSchema = z.object({ + voteReason: z.string(), +}); diff --git a/src/components/voting/ConfirmationPanel.tsx b/src/components/voting/ConfirmationPanel.tsx index f580d0d7..00ebb607 100644 --- a/src/components/voting/ConfirmationPanel.tsx +++ b/src/components/voting/ConfirmationPanel.tsx @@ -1,10 +1,11 @@ import { Avatar, Box, + Divider, Group, + NumberInput, Progress, Text, - TextInput, Textarea, useMantineTheme, } from '@mantine/core'; @@ -21,6 +22,8 @@ import { notifications } from '@mantine/notifications'; import { useTx } from '../../hooks/useTx'; import ContestABI from '../../abi/Contest.json'; import { ADDR } from '../../constants/addresses'; +import { useMemo } from 'react'; +import { FormValidationResult } from '@mantine/form/lib/types'; export const ConfirmationPanel = ({ ships, @@ -43,101 +46,165 @@ export const ConfirmationPanel = ({ ]; const isVotingActive = votingStage === VotingStage.Active; + const totalPercent = useMemo( + () => + form.values.ships.reduce((acc, curr) => { + return acc + Number(curr.shipPerc); + }, 0), + [form.values] + ); + + const exceeds100percent = totalPercent > 100; + const totalVoteAmount = + userTokenData.totalUserTokenBalance && totalPercent + ? formatEther( + (userTokenData.totalUserTokenBalance * + BigInt(Math.floor(Number(totalPercent) * 1e6))) / + BigInt(100 * 1e6) + ) + : 0; + + const userHasVotes = userTokenData.totalUserTokenBalance > 0n; + const handleBatchVote = async () => { - if (!contest) { - notifications.show({ - title: 'Error', - message: 'Failed to submit vote', - color: 'red', - }); - return; - } + try { + if (!contest) { + notifications.show({ + title: 'Error', + message: 'Failed to submit vote', + color: 'red', + }); + return; + } - if (form.values.ships.length !== ships.length) { - notifications.show({ - title: 'Error', - message: 'Please fill out all fields', - color: 'red', - }); - return; - } + if (form.values.ships.length !== ships.length) { + notifications.show({ + title: 'Error', + message: 'Please fill out all fields', + color: 'red', + }); + return; + } - const withParams = await Promise.all( - form.values.ships.map(async (ship) => { - const choiceId = contest.choices.find( - (choice) => choice.shipId === ship.shipId - )?.id; + if (exceeds100percent) { + notifications.show({ + title: 'Error', + message: 'Total vote allocation exceeds 100%', + color: 'red', + }); + return; + } - const tokenAmount = - (userTokenData.totalUserTokenBalance * - BigInt(Number(ship.shipPerc) * 1e6)) / - BigInt(100 * 1e6); + const validationResult: FormValidationResult = form.validate(); - const pinRes = await pinJSONToIPFS({ - voteReason: ship.shipComment, + if (validationResult.hasErrors) { + notifications.show({ + title: 'Error', + message: `Form Validation error `, + color: 'red', }); + return; + } - if (!pinRes) { - throw new Error('Failed to pin to IPFS'); - } - - return { - ...ship, - ipfsPointer: pinRes.IpfsHash, - choiceId, - tokenAmount, - }; - }) - ); - - const choiceIds = withParams.map((ship) => { - return ship.choiceId?.split('-')[1]; - }); - const tokenAmounts = withParams.map((ship) => ship.tokenAmount); - const metadataBytes = withParams.map((ship) => - encodeAbiParameters(parseAbiParameters('(uint256, string)'), [ - [1n, ship.ipfsPointer], - ]) - ); - const tokenSum = tokenAmounts.reduce((acc, curr) => acc + curr, 0n); - - if (tokenSum > userTokenData.totalUserTokenBalance) { - notifications.show({ - title: 'Error', - message: 'Voting amounts exceeds balance', - color: 'red', + const hasFilledInAllRequiredFields = form.values.ships.every( + (ship) => ship.shipId && ship.shipPerc != null + ); + + if (!hasFilledInAllRequiredFields) { + notifications.show({ + title: 'Error', + message: 'Please fill out all required fields', + color: 'red', + }); + return; + } + + const withParams = await Promise.all( + form.values.ships + .filter((ship) => ship.shipPerc !== 0) + .map(async (ship) => { + const choiceId = contest.choices.find( + (choice) => choice.shipId === ship.shipId + )?.id; + + const tokenAmount = + (userTokenData.totalUserTokenBalance * + BigInt(Number(ship.shipPerc) * 1e6)) / + BigInt(100 * 1e6); + + const pinRes = await pinJSONToIPFS({ + voteReason: ship.shipComment, + }); + + if (!pinRes) { + throw new Error('Failed to pin to IPFS'); + } + + return { + ...ship, + ipfsPointer: pinRes.IpfsHash, + choiceId, + tokenAmount, + }; + }) + ); + + const choiceIds = withParams.map((ship) => { + return ship.choiceId?.split('-')[1]; }); - return; - } + const tokenAmounts = withParams.map((ship) => ship.tokenAmount); + const metadataBytes = withParams.map((ship) => + encodeAbiParameters(parseAbiParameters('(uint256, string)'), [ + [1n, ship.ipfsPointer], + ]) + ); + + const tokenSum = tokenAmounts.reduce((acc, curr) => acc + curr, 0n); + + if (tokenSum > userTokenData.totalUserTokenBalance) { + notifications.show({ + title: 'Error', + message: 'Voting amounts exceeds balance', + color: 'red', + }); + return; + } + + if ( + choiceIds.length !== tokenAmounts.length || + tokenAmounts.length !== metadataBytes.length + ) { + notifications.show({ + title: 'Error', + message: 'data length mismatch', + color: 'red', + }); + return; + } - if ( - choiceIds.length !== tokenAmounts.length || - tokenAmounts.length !== metadataBytes.length - ) { + tx({ + viewParams: { + awaitEnvioPoll: true, + }, + writeContractParams: { + abi: ContestABI, + address: ADDR.VOTE_CONTEST, + functionName: 'batchVote', + args: [choiceIds, tokenAmounts, metadataBytes, tokenSum], + }, + writeContractOptions: { + onPollSuccess() { + refetchGsVotes(); + }, + }, + }); + } catch (error: any) { notifications.show({ title: 'Error', - message: 'data length mismatch', + message: `Vote submission failed: ${error.message}`, color: 'red', }); - return; } - - tx({ - viewParams: { - awaitEnvioPoll: true, - }, - writeContractParams: { - abi: ContestABI, - address: ADDR.VOTE_CONTEST, - functionName: 'batchVote', - args: [choiceIds, tokenAmounts, metadataBytes, tokenSum], - }, - writeContractOptions: { - onPollSuccess() { - refetchGsVotes(); - }, - }, - }); }; return ( @@ -148,10 +215,11 @@ export const ConfirmationPanel = ({ userTokenData.totalUserTokenBalance && shipPerc ? formatEther( (userTokenData.totalUserTokenBalance * - BigInt(Number(shipPerc) * 1e6)) / + BigInt(Math.floor(Number(shipPerc) * 1e6))) / BigInt(100 * 1e6) ) : 0n; + return ( @@ -159,12 +227,19 @@ export const ConfirmationPanel = ({ {ship.name} - ); })} + + + Total Vote:{' '} + + {totalPercent}% + + + + Total Vote Amount:{' '} + + {totalVoteAmount} {tokenData.tokenSymbol} + + + + {!userHasVotes && ( + + You have no votes to allocate + + )} + {exceeds100percent && ( + + Total vote allocation exceeds 100% + + )} + Submit diff --git a/src/components/voting/VoteAffix.tsx b/src/components/voting/VoteAffix.tsx index 23d11094..d1461790 100644 --- a/src/components/voting/VoteAffix.tsx +++ b/src/components/voting/VoteAffix.tsx @@ -27,9 +27,9 @@ export const VoteAffix = ({ formValues }: { formValues: VotingFormValues }) => { @@ -47,7 +47,9 @@ export const VoteAffix = ({ formValues }: { formValues: VotingFormValues }) => { } > - {formatEther(userTokenData.totalUserTokenBalance)}{' '} + {Number( + formatEther(userTokenData.totalUserTokenBalance) + ).toFixed(2)}{' '} {tokenData.tokenSymbol}{' '} diff --git a/src/components/voting/VotingFooter.tsx b/src/components/voting/VotingFooter.tsx index 90b54963..ef74f234 100644 --- a/src/components/voting/VotingFooter.tsx +++ b/src/components/voting/VotingFooter.tsx @@ -20,8 +20,9 @@ export const VotingFooter = ({ isVotingActive: boolean; }) => { const shipPercs = form.values.ships.map((s) => s.shipPerc); - const totalPercLeft = - 100 - shipPercs.reduce((acc, perc) => acc + Number(perc), 0); + const totalPercLeft = Number( + (100 - shipPercs.reduce((acc, perc) => acc + Number(perc), 0)).toFixed(2) + ); return ( @@ -39,6 +40,10 @@ export const VotingFooter = ({ maw={298} min={0} max={100} + decimalScale={2} + suffix="%" + allowNegative={false} + clampBehavior="strict" placeholder="30%" disabled={!isVotingActive} {...form.getInputProps(`ships.${index}.shipPerc`)} diff --git a/src/components/voting/VotingWeightProgress.tsx b/src/components/voting/VotingWeightProgress.tsx index f2a6f989..653013fa 100644 --- a/src/components/voting/VotingWeightProgress.tsx +++ b/src/components/voting/VotingWeightProgress.tsx @@ -4,9 +4,9 @@ import { ComponentProps, useMemo } from 'react'; export const VotingWeightProgress = ( props: Omit, 'sections'> & { shipVotePercs: { - ship1: string; - ship2: string; - ship3: string; + ship1: number; + ship2: number; + ship3: number; }; } ) => { diff --git a/src/constants/addresses.ts b/src/constants/addresses.ts index 85bfc471..e1515687 100644 --- a/src/constants/addresses.ts +++ b/src/constants/addresses.ts @@ -8,7 +8,7 @@ export const ADDR_TESTNET: Record = { GM_FACTORY: '0x14e32E7893D6A1fA5f852d8B2fE8c57A2aB670ba', GS_FACTORY: '0x8D994BEef251e30C858e44eCE3670feb998CA77a', HATS_POSTER: '0x4F0dc1C7d91d914d921F3C9C188F4454AE260317', - VOTE_CONTEST: '0x7DBce100202fd643a41E3c5Eee74CEe7D185750E', + VOTE_CONTEST: '0xF55108489EE3FE27AE60795d5816E0C95683B049', } as const; export const ADDR_PROD: Record = { @@ -19,7 +19,7 @@ export const ADDR_PROD: Record = { GM_FACTORY: '0xdc9787b869e22256a4f4f49f484586fcff0d351f', GS_FACTORY: '0xb130175b648d4ce92ca6153eaa138cc69eb1cf4c', HATS_POSTER: '0x363a6eFF03cdAbD5Cf4921d9A85eAf7dFd2A7efD', - VOTE_CONTEST: '0x7823c8E0a562c5034E455228C64D6375C637DC94', + VOTE_CONTEST: '0x413BAaf73db2330639d93e26d8Fdd909C74A1955', } as const; export const ADDR: Record = diff --git a/src/graphql/getUserVote.graphql b/src/graphql/getUserVote.graphql index af3d10bc..fc40627f 100644 --- a/src/graphql/getUserVote.graphql +++ b/src/graphql/getUserVote.graphql @@ -1,6 +1,6 @@ query getUserVotes($contestId: String!, $voterAddress: String!) { ShipVote( - where: { voter: { _eq: $voterAddress }, contest_id: { _eq: $contestId } } + where: { voter_id: { _eq: $voterAddress }, contest_id: { _eq: $contestId } } ) { id choice_id diff --git a/src/graphql/getVoters.graphql b/src/graphql/getVoters.graphql new file mode 100644 index 00000000..97b654b4 --- /dev/null +++ b/src/graphql/getVoters.graphql @@ -0,0 +1,17 @@ +query getVoters($contestId: String!) { + GSVoter(where: { votes: { contest_id: { _eq: $contestId } } }) { + id + votes( + where: { contest_id: { _eq: $contestId }, isRetractVote: { _eq: false } } + ) { + id + amount + mdPointer + mdProtocol + isRetractVote + choice { + id + } + } + } +} diff --git a/src/layout/Layout.tsx b/src/layout/Layout.tsx index d7d97c1e..751be4a1 100644 --- a/src/layout/Layout.tsx +++ b/src/layout/Layout.tsx @@ -7,7 +7,6 @@ import { MobileNav } from './MobileNav/MobileNav'; export const Layout = ({ children }: { children: React.ReactNode }) => { const isMobile = useMobile(); - return ( diff --git a/src/pages/Vote.tsx b/src/pages/Vote.tsx index db4f34ee..019e82cd 100644 --- a/src/pages/Vote.tsx +++ b/src/pages/Vote.tsx @@ -1,6 +1,19 @@ -import { useEffect, useState } from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { MainSection, PageTitle } from '../layout/Sections'; -import { Flex, Stack, Stepper } from '@mantine/core'; +import { + Avatar, + Box, + Divider, + Flex, + Group, + Paper, + Progress, + Spoiler, + Stack, + Stepper, + Text, + useMantineTheme, +} from '@mantine/core'; import { useQuery } from '@tanstack/react-query'; import { getShipsPageData } from '../queries/getShipsPage'; import { useLaptop, useMobile, useTablet } from '../hooks/useBreakpoint'; @@ -11,6 +24,14 @@ import { VoteAffix } from '../components/voting/VoteAffix'; import { VoteTimesIndicator } from '../components/voting/VoteTimesIndicator'; import { ShipVotingPanel } from '../components/voting/ShipVotingPanel'; import { ConfirmationPanel } from '../components/voting/ConfirmationPanel'; +import { useVoting } from '../hooks/useVoting'; +import { ShipsCardUI } from '../types/ui'; +import { formatBigIntPercentage } from '../utils/helpers'; +import { Address, formatEther } from 'viem'; +import classes from '../components/feed/FeedStyles.module.css'; +import { IconChevronDown, IconChevronUp } from '@tabler/icons-react'; +import { GsVoter, getContestVoters } from '../queries/getVoters'; +import { AddressAvatar } from '../components/AddressAvatar'; export type VotingFormValues = z.infer; @@ -21,6 +42,8 @@ export const Vote = () => { queryFn: getShipsPageData, }); + const { userVotes } = useVoting(); + const isLaptop = useLaptop(); const isTablet = useTablet(); @@ -32,6 +55,7 @@ export const Vote = () => { ships: [], } as VotingFormValues, validate: zodResolver(votingSchema), + validateInputOnBlur: true, }); useEffect( @@ -39,7 +63,7 @@ export const Vote = () => { if (!ships) return; const updatedShips = ships?.map((ship) => ({ shipId: ship.id, - shipPerc: '', + shipPerc: 0, shipComment: '', })); form.setValues((prev) => ({ ...prev, ships: updatedShips })); @@ -52,6 +76,12 @@ export const Vote = () => { return null; } + const hasVotes = userVotes && userVotes.length > 0; + + if (hasVotes) { + return ; + } + const nextStep = () => setStep((current) => (current < 3 ? current + 1 : current)); const prevStep = () => @@ -109,3 +139,293 @@ export const Vote = () => { ); }; + +const VoteConfirmationPanel = ({ ships }: { ships: ShipsCardUI[] }) => { + const { contest, userVotes, tokenData } = useVoting(); + + const theme = useMantineTheme(); + + const consolidated = useMemo(() => { + if (!ships || !userVotes || !contest) return []; + + return ships.map((ship) => { + const shipChoice = contest?.choices.find((c) => c.shipId === ship.id); + + const userVote = userVotes.find((v) => v.choice_id === shipChoice?.id); + + return { ...ship, vote: userVote, choice: shipChoice }; + }); + }, [ships, userVotes, contest]); + + const totals = useMemo(() => { + if (!consolidated || !contest) return null; + + const totalUserVotes = + consolidated && consolidated.length > 0 + ? consolidated.reduce((acc, ship) => { + if (!ship.vote) return acc; + return acc + BigInt(ship.vote.amount); + }, 0n) + : 0n; + const totalVotes = contest?.choices?.length + ? contest?.choices.reduce((acc, choice) => { + return acc + BigInt(choice.voteTally); + }, 0n) + : 0n; + + return { + totalUserVotes, + totalVotes, + }; + }, [consolidated, contest]); + + const condensed = useMemo(() => { + return consolidated?.map((ship) => ({ + shipImg: ship.imgUrl, + shipName: ship.name, + id: ship.choice?.id as string, + })); + }, [consolidated]); + + const colors = [ + theme.colors.blue[5], + theme.colors.violet[5], + theme.colors.pink[5], + ]; + return ( + + + + Your vote has been submitted! + + + + + Your Vote + + {consolidated.map((ship, index) => { + const percentage = totals?.totalUserVotes + ? formatBigIntPercentage( + BigInt(ship.vote?.amount || 0), + totals?.totalUserVotes + ) + : '0'; + const tokenAmount = formatEther(BigInt(ship.vote?.amount || 0)); + + return ( + + + + + {ship.name} + + + + + {Number(percentage)}% Voted ({tokenAmount}{' '} + {tokenData.tokenSymbol}) + + + ); + })} + + + Total:{' '} + + {formatEther(totals?.totalUserVotes || 0n)} {tokenData.tokenSymbol} + + + + + Total Vote Results + + {consolidated?.map((ship, index) => { + const percentage = totals?.totalVotes + ? formatBigIntPercentage( + BigInt(ship.choice?.voteTally), + totals?.totalVotes + ) + : '0'; + const tokenAmount = formatEther(BigInt(ship.choice?.voteTally)); + return ( + + + + + {ship.name} + + + + + {Number(percentage)}% ({tokenAmount} {tokenData.tokenSymbol}) + + + ); + })} + + + Total:{' '} + + {formatEther(totals?.totalVotes || 0n)} {tokenData.tokenSymbol} + + + + + + All Votes + + + + ); +}; + +type CondensedChoiceData = { + id: string; + shipName: string; + shipImg: string; +}; + +const AllVotes = ({ choices }: { choices: CondensedChoiceData[] }) => { + const { contest, tokenData } = useVoting(); + const { data: voters } = useQuery({ + queryKey: ['gs-voters'], + queryFn: () => getContestVoters(contest?.id as string), + enabled: !!contest, + }); + + return ( + + {voters?.map((voter) => ( + + ))} + + ); +}; + +const VoteCard = ({ + voter, + choices, + tokenSymbol, +}: { + voter: GsVoter; + choices: CondensedChoiceData[]; + tokenSymbol?: string; +}) => { + const theme = useMantineTheme(); + const colors = [ + theme.colors.blue[5], + theme.colors.violet[5], + theme.colors.pink[5], + ]; + + const totalUserVotes = useMemo(() => { + return voter.votes.reduce((acc, vote) => { + return acc + BigInt(vote?.amount ? vote.amount : 0); + }, 0n); + }, [voter]); + + const consolidated = useMemo(() => { + return choices.map((choice) => { + const vote = voter.votes.find((vote) => choice.id === vote.choice.id); + return { ...choice, vote }; + }); + }, [voter, choices]); + + return ( + + + + + + {consolidated.map((choice, index) => { + return ( + + ); + })} + + ); +}; + +const ShipChoiceVoteBar = ({ + choice, + totalVotes, + voteAmount, + reason, + color, + tokenSymbol, + didVote, +}: { + choice: CondensedChoiceData; + totalVotes: bigint; + voteAmount: bigint; + reason?: string | null; + color: string; + tokenSymbol?: string; + didVote?: boolean; +}) => { + const votePercentage = formatBigIntPercentage(voteAmount, totalVotes); + return ( + + + + + + + {votePercentage}% Voted ({formatEther(voteAmount)}){' '} + {tokenSymbol || ''} + + + + } + showLabel={} + classNames={{ + root: classes.embedTextBox, + control: classes.embedTextControl, + }} + maxHeight={24} + > + {!didVote && ( + + Did not vote + + )} + {didVote && !reason && ( + + No reason given + + )} + {didVote && reason && ( + + {reason} + + )} + + + ); +}; diff --git a/src/queries/getGsVoting.ts b/src/queries/getGsVoting.ts index 3c472407..b7e27806 100644 --- a/src/queries/getGsVoting.ts +++ b/src/queries/getGsVoting.ts @@ -131,7 +131,6 @@ export const getGsVoting = async ({ const contestRes = await getGsVoting({ id: contestId }); const voterRes = await getUserVotes({ contestId, voterAddress: userAddress }); - console.log('contestRes', contestRes); const currentContest = contestRes?.GrantShipsVoting?.[0]; if (!currentContest) { diff --git a/src/queries/getVoters.ts b/src/queries/getVoters.ts new file mode 100644 index 00000000..4de393a5 --- /dev/null +++ b/src/queries/getVoters.ts @@ -0,0 +1,54 @@ +import { getBuiltGraphSDK, getVotersQuery } from '../.graphclient'; +import { voteReasonsSchema } from '../components/forms/validationSchemas/votingFormSchema'; +import { getIpfsJson } from '../utils/ipfs/get'; + +export type GsVote = { + id: string; + amount: string; + choice: { + id: string; + }; + isRetractVote: boolean; + mdPointer: string; + mdProtocol: number; + reason: string | null; +}; + +export type GsVoter = { + id: string; + votes: GsVote[]; +}; + +export const resolveVote = async (res: getVotersQuery) => { + const resolvedVoters = await Promise.all( + res.GSVoter.map(async (voter) => { + const resolvedVotes = await Promise.all( + voter.votes.map(async (vote) => { + const ipfsRes = await getIpfsJson(vote.mdPointer); + + const validated = voteReasonsSchema.safeParse(ipfsRes); + + if (!validated.success) { + console.error('Invalid metadata', validated.error); + return null; + } + + return { ...vote, reason: validated.data.voteReason } as GsVote; + }) + ); + + return { ...voter, votes: resolvedVotes } as GsVoter; + }) + ); + + return resolvedVoters as GsVoter[]; +}; + +export const getContestVoters = async (contestId: string) => { + const { getVoters } = getBuiltGraphSDK(); + + const res = await getVoters({ contestId: contestId }); + const resolved = await resolveVote(res); + + return resolved; +}; diff --git a/src/theme.ts b/src/theme.ts index 51054bae..dbcf30c9 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -1,4 +1,4 @@ -import { Loader, Tooltip, createTheme } from '@mantine/core'; +import { Loader, Modal, Tooltip, createTheme } from '@mantine/core'; import { RingLoader } from './components/loader/RingLoader'; import { BreakPoint } from './constants/style'; @@ -27,6 +27,11 @@ export const theme = createTheme({ color: 'dark.6', }, }), + Modal: Modal.extend({ + defaultProps: { + lockScroll: false, + }, + }), }, breakpoints: { xs: BreakPoint.Xs, diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 6cd89ac4..82030346 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -57,3 +57,23 @@ export const addressToBytes32 = (address: string): string => { export const bytes32toAddress = (bytes32: string): string => { return `0x${bytes32.slice(26)}`; }; + +// export const formatPercentage = ( +// numerator: bigint, +// denominator: bigint, +// scale: bigint = 1000000000000000n // Scale factor to determine decimal places in output +// ): string => { +// const percentage = (numerator * 100n * scale) / denominator / scale; +// return `${Number(percentage) / 100}%`; +// }; +export const formatBigIntPercentage = ( + numerator: bigint, + denominator: bigint, + displayDecimals: number = 2 +) => { + if (numerator === 0n || denominator === 0n) return '0'; + + return ((Number(numerator) / Number(denominator)) * 100).toFixed( + displayDecimals + ); +};