diff --git a/pkgs/frontend/app/components/assistcredit/History.tsx b/pkgs/frontend/app/components/assistcredit/History.tsx index 1827d3b..e9e11d8 100644 --- a/pkgs/frontend/app/components/assistcredit/History.tsx +++ b/pkgs/frontend/app/components/assistcredit/History.tsx @@ -1,5 +1,5 @@ import { Box, HStack, Text, VStack } from "@chakra-ui/react"; -import { TransferFractionToken_OrderBy } from "gql/graphql"; +import { OrderDirection, TransferFractionToken_OrderBy } from "gql/graphql"; import { useNamesByAddresses } from "hooks/useENS"; import { useGetTransferFractionTokens } from "hooks/useFractionToken"; import { useGetHat } from "hooks/useHats"; @@ -91,6 +91,7 @@ export const AssistCreditHistory: FC = ({ treeId, limit }) => { workspaceId: treeId, }, orderBy: TransferFractionToken_OrderBy.BlockTimestamp, + orderDirection: OrderDirection.Desc, first: limit, }); diff --git a/pkgs/frontend/gql/gql.ts b/pkgs/frontend/gql/gql.ts index 78af9d0..1e53b8b 100644 --- a/pkgs/frontend/gql/gql.ts +++ b/pkgs/frontend/gql/gql.ts @@ -14,7 +14,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ * Learn more about it here: https://the-guild.dev/graphql/codegen/plugins/presets/preset-client#reducing-bundle-size */ const documents = { - "\n query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, , $first: Int = 10) {\n transferFractionTokens(where: $where, orderBy: $orderBy, first: $first) {\n amount\n from\n to\n tokenId\n blockNumber\n blockTimestamp\n hatId\n id\n wearer\n workspaceId\n }\n }\n": types.GetTransferFractionTokensDocument, + "\n query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, $orderDirection: OrderDirection = asc, $first: Int = 10) {\n transferFractionTokens(where: $where, orderBy: $orderBy, first: $first) {\n amount\n from\n to\n tokenId\n blockNumber\n blockTimestamp\n hatId\n id\n wearer\n workspaceId\n }\n }\n": types.GetTransferFractionTokensDocument, "\n query GetWorkspaces($where: Workspace_filter) {\n workspaces(where: $where) {\n creator\n topHatId\n splitCreator\n id\n hatterHatId\n hatsTimeFrameModule\n blockTimestamp\n blockNumber\n }\n }\n": types.GetWorkspacesDocument, "\n query GetWorkspace($workspaceId: ID!) {\n workspace(id: $workspaceId) {\n creator\n hatsTimeFrameModule\n hatterHatId\n id\n splitCreator\n topHatId\n blockTimestamp\n blockNumber\n }\n }\n": types.GetWorkspaceDocument, }; @@ -36,7 +36,7 @@ export function graphql(source: string): unknown; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ -export function graphql(source: "\n query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, , $first: Int = 10) {\n transferFractionTokens(where: $where, orderBy: $orderBy, first: $first) {\n amount\n from\n to\n tokenId\n blockNumber\n blockTimestamp\n hatId\n id\n wearer\n workspaceId\n }\n }\n"): (typeof documents)["\n query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, , $first: Int = 10) {\n transferFractionTokens(where: $where, orderBy: $orderBy, first: $first) {\n amount\n from\n to\n tokenId\n blockNumber\n blockTimestamp\n hatId\n id\n wearer\n workspaceId\n }\n }\n"]; +export function graphql(source: "\n query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, $orderDirection: OrderDirection = asc, $first: Int = 10) {\n transferFractionTokens(where: $where, orderBy: $orderBy, first: $first) {\n amount\n from\n to\n tokenId\n blockNumber\n blockTimestamp\n hatId\n id\n wearer\n workspaceId\n }\n }\n"): (typeof documents)["\n query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, $orderDirection: OrderDirection = asc, $first: Int = 10) {\n transferFractionTokens(where: $where, orderBy: $orderBy, first: $first) {\n amount\n from\n to\n tokenId\n blockNumber\n blockTimestamp\n hatId\n id\n wearer\n workspaceId\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/pkgs/frontend/gql/graphql.ts b/pkgs/frontend/gql/graphql.ts index 997960f..dbb8255 100644 --- a/pkgs/frontend/gql/graphql.ts +++ b/pkgs/frontend/gql/graphql.ts @@ -597,6 +597,7 @@ export enum _SubgraphErrorPolicy_ { export type GetTransferFractionTokensQueryVariables = Exact<{ where?: InputMaybe; orderBy?: InputMaybe; + orderDirection?: InputMaybe; first?: InputMaybe; }>; @@ -618,6 +619,6 @@ export type GetWorkspaceQueryVariables = Exact<{ export type GetWorkspaceQuery = { __typename?: 'Query', workspace?: { __typename?: 'Workspace', creator: string, hatsTimeFrameModule: string, hatterHatId: any, id: string, splitCreator: string, topHatId: any, blockTimestamp: any, blockNumber: any } | null }; -export const GetTransferFractionTokensDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransferFractionTokens"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"TransferFractionToken_filter"}},"defaultValue":{"kind":"ObjectValue","fields":[]}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"TransferFractionToken_orderBy"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"10"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transferFractionTokens"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"from"}},{"kind":"Field","name":{"kind":"Name","value":"to"}},{"kind":"Field","name":{"kind":"Name","value":"tokenId"}},{"kind":"Field","name":{"kind":"Name","value":"blockNumber"}},{"kind":"Field","name":{"kind":"Name","value":"blockTimestamp"}},{"kind":"Field","name":{"kind":"Name","value":"hatId"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"wearer"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceId"}}]}}]}}]} as unknown as DocumentNode; +export const GetTransferFractionTokensDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetTransferFractionTokens"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"TransferFractionToken_filter"}},"defaultValue":{"kind":"ObjectValue","fields":[]}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"TransferFractionToken_orderBy"}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderDirection"}},"defaultValue":{"kind":"EnumValue","value":"asc"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}},"defaultValue":{"kind":"IntValue","value":"10"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"transferFractionTokens"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"amount"}},{"kind":"Field","name":{"kind":"Name","value":"from"}},{"kind":"Field","name":{"kind":"Name","value":"to"}},{"kind":"Field","name":{"kind":"Name","value":"tokenId"}},{"kind":"Field","name":{"kind":"Name","value":"blockNumber"}},{"kind":"Field","name":{"kind":"Name","value":"blockTimestamp"}},{"kind":"Field","name":{"kind":"Name","value":"hatId"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"wearer"}},{"kind":"Field","name":{"kind":"Name","value":"workspaceId"}}]}}]}}]} as unknown as DocumentNode; export const GetWorkspacesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspaces"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Workspace_filter"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspaces"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"creator"}},{"kind":"Field","name":{"kind":"Name","value":"topHatId"}},{"kind":"Field","name":{"kind":"Name","value":"splitCreator"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"hatterHatId"}},{"kind":"Field","name":{"kind":"Name","value":"hatsTimeFrameModule"}},{"kind":"Field","name":{"kind":"Name","value":"blockTimestamp"}},{"kind":"Field","name":{"kind":"Name","value":"blockNumber"}}]}}]}}]} as unknown as DocumentNode; export const GetWorkspaceDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"GetWorkspace"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"workspace"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"workspaceId"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"creator"}},{"kind":"Field","name":{"kind":"Name","value":"hatsTimeFrameModule"}},{"kind":"Field","name":{"kind":"Name","value":"hatterHatId"}},{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"splitCreator"}},{"kind":"Field","name":{"kind":"Name","value":"topHatId"}},{"kind":"Field","name":{"kind":"Name","value":"blockTimestamp"}},{"kind":"Field","name":{"kind":"Name","value":"blockNumber"}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/pkgs/frontend/hooks/useFractionToken.ts b/pkgs/frontend/hooks/useFractionToken.ts index 37a9d62..c6a2193 100644 --- a/pkgs/frontend/hooks/useFractionToken.ts +++ b/pkgs/frontend/hooks/useFractionToken.ts @@ -4,6 +4,7 @@ import { FRACTION_TOKEN_ABI } from "abi/fractiontoken"; import type { GetTransferFractionTokensQuery, GetTransferFractionTokensQueryVariables, + OrderDirection, TransferFractionToken_Filter, TransferFractionToken_OrderBy, } from "gql/graphql"; @@ -522,7 +523,7 @@ export const useTransferFractionToken = (hatId: bigint, wearer: Address) => { ///////////////////////////////////// const queryGetTransferFractionTokens = gql(` - query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, , $first: Int = 10) { + query GetTransferFractionTokens($where: TransferFractionToken_filter = {}, $orderBy: TransferFractionToken_orderBy, $orderDirection: OrderDirection = asc, $first: Int = 10) { transferFractionTokens(where: $where, orderBy: $orderBy, first: $first) { amount from @@ -541,6 +542,7 @@ const queryGetTransferFractionTokens = gql(` export const useGetTransferFractionTokens = (params: { where?: TransferFractionToken_Filter; orderBy?: TransferFractionToken_OrderBy; + orderDirection?: OrderDirection; first?: number; }) => { const result = useQuery< @@ -550,6 +552,7 @@ export const useGetTransferFractionTokens = (params: { variables: { where: params.where, orderBy: params.orderBy, + orderDirection: params.orderDirection, first: params.first, }, });