diff --git a/apps/core-app/src/components/FilterDropdown.tsx b/apps/core-app/src/components/FilterDropdown.tsx index 7bfc9b0fd..0f74577b8 100644 --- a/apps/core-app/src/components/FilterDropdown.tsx +++ b/apps/core-app/src/components/FilterDropdown.tsx @@ -39,7 +39,7 @@ const FilterDropdown = ({ filter, toggleFilter }: FilterDropdownProps) => { spacing=".6rem" trigger={ } > diff --git a/apps/core-app/src/components/proposalCards/ActionPrimitives.tsx b/apps/core-app/src/components/proposalCards/ActionPrimitives.tsx index 3eb7c1e48..f1af6009d 100644 --- a/apps/core-app/src/components/proposalCards/ActionPrimitives.tsx +++ b/apps/core-app/src/components/proposalCards/ActionPrimitives.tsx @@ -173,6 +173,7 @@ export const ActionTemplate = ({ return helperDisplay; }, [helperDisplay, theme]); + const hideQuorum = proposal.dao.quorumPercent === '0'; const yesPerc = percentage( Number(proposal.yesBalance), Number(proposal.dao.totalShares) @@ -182,7 +183,7 @@ export const ActionTemplate = ({
{displayUI} - {isMobile || ( + {isMobile || hideQuorum || ( { return ( diff --git a/apps/core-app/src/components/proposalCards/Expired.tsx b/apps/core-app/src/components/proposalCards/Expired.tsx index d5bf75f81..e20b5f7e0 100644 --- a/apps/core-app/src/components/proposalCards/Expired.tsx +++ b/apps/core-app/src/components/proposalCards/Expired.tsx @@ -6,7 +6,7 @@ export const Expired = ({ proposal }: { proposal: ITransformedProposal }) => { return ( diff --git a/apps/core-app/src/pages/Members.tsx b/apps/core-app/src/pages/Members.tsx index 94b4576eb..201648f14 100644 --- a/apps/core-app/src/pages/Members.tsx +++ b/apps/core-app/src/pages/Members.tsx @@ -1,4 +1,4 @@ -import { MouseEvent, useMemo } from 'react'; +import { useMemo } from 'react'; import styled from 'styled-components'; import { Column, Row } from 'react-table'; import { @@ -25,7 +25,6 @@ import { useDao, TMembers, useConnectedMembership, - defaultDaoData, } from '@daohaus/dao-context'; import { MembersOverview } from '../components/MembersOverview'; import { ProfileLink } from '../components/ProfileLink'; @@ -33,6 +32,7 @@ import { DaoTable } from '../components/DaohausTable'; import { useParams } from 'react-router-dom'; import { MemberProfileMenu } from '../components/MemberProfileMenu'; import { ButtonLink } from '../components/ButtonLink'; +import { Member_OrderBy } from '@daohaus/dao-data'; const Actions = styled.div` display: flex; @@ -76,13 +76,8 @@ export type MembersTableType = TMembers[number]; export function Members() { const { dao } = useDao(); - const { - members, - setMembersPaging, - membersNextPaging, - setMembersSort, - setMembers, - } = useMembers(); + const { members, membersNextPaging, loadMoreMembers, sortMembers } = + useMembers(); const { connectedMembership } = useConnectedMembership(); const isMobile = useBreakpoint(widthQuery.sm); const { daoid, daochain } = useParams(); @@ -222,24 +217,11 @@ export function Members() { [dao] ); - // TODO: Move these into the context as new hooks: - // - loadMoreMembers (adds on to current members list - this is default) - // - loadNextPageMembers (replaces current list) - // - sort/filter (replaces current list) - const handleLoadMore = (event: MouseEvent) => { - setMembersPaging(membersNextPaging); - }; - const handleColumnSort = ( orderBy: string, orderDirection: 'asc' | 'desc' ) => { - // TODO: how can we dynamically pass the proper order by here - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - setMembersSort({ orderBy, orderDirection }); - setMembersPaging(defaultDaoData.membersPaging); - setMembers(undefined); + sortMembers(orderBy as Member_OrderBy, orderDirection); }; return ( @@ -274,7 +256,7 @@ export function Members() { tableData={tableData} columns={columns} hasNextPaging={membersNextPaging !== undefined} - handleLoadMore={handleLoadMore} + handleLoadMore={loadMoreMembers} handleColumnSort={handleColumnSort} sortableColumns={ isMobile diff --git a/apps/core-app/src/pages/NewProposal.tsx b/apps/core-app/src/pages/NewProposal.tsx index 69ded665e..f81edbc4e 100644 --- a/apps/core-app/src/pages/NewProposal.tsx +++ b/apps/core-app/src/pages/NewProposal.tsx @@ -1,5 +1,5 @@ import { useMemo } from 'react'; -import { useLocation } from 'react-router-dom'; +import { useLocation, useNavigate, useParams } from 'react-router-dom'; import { FormBuilder } from '@daohaus/haus-form-builder'; import { getFormLegoById } from '../legos/form'; @@ -8,10 +8,13 @@ import { useDao } from '@daohaus/dao-context'; export function NewProposal() { const location = useLocation(); + const navigate = useNavigate(); + const { daoid, daochain } = useParams(); const { refreshAll } = useDao(); const onFormComplete = () => { refreshAll?.(); + navigate(`/molochV3/${daochain}/${daoid}/proposals`); }; const formLego = useMemo(() => { diff --git a/apps/core-app/src/pages/Proposals.tsx b/apps/core-app/src/pages/Proposals.tsx index 6454171a9..ae0dbfa5c 100644 --- a/apps/core-app/src/pages/Proposals.tsx +++ b/apps/core-app/src/pages/Proposals.tsx @@ -11,7 +11,7 @@ import { import { statusFilter } from '@daohaus/dao-data'; import { BsPlusLg } from 'react-icons/bs'; -import { defaultDaoData, useDao, useProposals } from '@daohaus/dao-context'; +import { useDao, useProposals } from '@daohaus/dao-context'; import { NewProposalList } from '../components/NewProposalList'; import { PROPOSAL_FORMS } from '../legos/form'; import SearchInput from '../components/SearchInput'; @@ -39,13 +39,8 @@ const SearchFilterContainer = styled.div` `; export function Proposals() { - const { - proposals, - setProposalsPaging, - proposalsNextPaging, - setProposalsFilter, - setProposals, - } = useProposals(); + const { proposals, proposalsNextPaging, loadMoreProposals, filterProposals } = + useProposals(); const { dao } = useDao(); const [searchTerm, setSearchTerm] = useState(''); const [filter, setFilter] = useState(''); @@ -64,17 +59,13 @@ export function Proposals() { ) : undefined; - if (searchTerm && searchTerm.length > 0) { - setProposals(undefined); - setProposalsFilter({ + if (term && term.length > 0) { + filterProposals({ ...filterQuery, - title_contains_nocase: searchTerm, + title_contains_nocase: term, }); - setProposalsPaging(defaultDaoData.proposalsPaging); } else { - setProposals(undefined); - setProposalsFilter(filterQuery); - setProposalsPaging(defaultDaoData.proposalsPaging); + filterProposals(filterQuery); } }; @@ -83,9 +74,7 @@ export function Proposals() { searchTerm !== '' ? { title_contains_nocase: searchTerm } : undefined; setFilter((prevState) => { if (prevState === event.currentTarget.value) { - setProposalsFilter(searchQuery); - setProposalsPaging(defaultDaoData.proposalsPaging); - setProposals(undefined); + filterProposals(searchQuery); return ''; } else { const votingPlusGraceDuration = @@ -94,18 +83,12 @@ export function Proposals() { PROPOSAL_STATUS[event.currentTarget.value], votingPlusGraceDuration ); - setProposalsFilter({ ...filterQuery, ...searchQuery }); - setProposalsPaging(defaultDaoData.proposalsPaging); - setProposals(undefined); + filterProposals({ ...filterQuery, ...searchQuery }); return event.currentTarget.value; } }); }; - const handleLoadMore = (event: MouseEvent) => { - setProposalsPaging(proposalsNextPaging); - }; - return ( @@ -133,7 +116,7 @@ export function Proposals() { ))} {proposalsNextPaging !== undefined && ( - )} diff --git a/apps/core-app/src/utils/dataFetchHelpers.ts b/apps/core-app/src/utils/dataFetchHelpers.ts index a17c73e22..3661ed3b5 100644 --- a/apps/core-app/src/utils/dataFetchHelpers.ts +++ b/apps/core-app/src/utils/dataFetchHelpers.ts @@ -1,62 +1,10 @@ import { Keychain, ReactSetter } from '@daohaus/common-utilities'; import { - DaoWithTokenDataQuery, FindMemberQuery, Haus, - ITransformedProposalListQuery, ITransformedProposalQuery, - ListConnectedMemberProposalsQuery, - ListMembersQuery, - Member_Filter, - Member_OrderBy, - Ordering, - Paging, - Proposal_Filter, - Proposal_OrderBy, } from '@daohaus/dao-data'; import { ErrorMessage } from '@daohaus/ui'; -import deepEqual from 'deep-eql'; - -export const loadDao = async ({ - daoid, - daochain, - setDao, - setDaoLoading, - shouldUpdate, -}: { - daoid: string; - daochain: keyof Keychain; - setDao: ReactSetter; - setDaoLoading: ReactSetter; - shouldUpdate: boolean; -}) => { - try { - setDaoLoading(true); - const haus = Haus.create(); - const daoRes = await haus.query.findDao({ - networkId: daochain, - dao: daoid, - includeTokens: true, - }); - - if (daoRes?.data?.dao && shouldUpdate) { - const daoData: DaoWithTokenDataQuery['dao'] = { - tokenBalances: [], - fiatTotal: 0, - ...daoRes.data.dao, - }; - - setDao(daoData); - } - } catch (error) { - console.error(error); - setDao(undefined); - } finally { - if (shouldUpdate) { - setDaoLoading(false); - } - } -}; export const loadMember = async ({ daoid, @@ -139,57 +87,6 @@ export const loadProposal = async ({ } }; -export const loadMembersList = async ({ - filter, - ordering, - paging, - daochain, - setData, - setLoading, - setNextPaging, - shouldUpdate, -}: { - filter: Member_Filter; - ordering?: Ordering; - paging?: Paging; - daochain: keyof Keychain; - setData: ReactSetter; - setLoading: ReactSetter; - setNextPaging: ReactSetter; - shouldUpdate: boolean; -}) => { - try { - setLoading(true); - const haus = Haus.create(); - const res = await haus.query.listMembers({ - networkId: daochain, - filter, - ordering, - paging, - }); - - if (shouldUpdate) { - setNextPaging(res.nextPaging); - - setData((prevState) => { - if (deepEqual(prevState, res.items)) return res.items; - if (prevState) { - return [...prevState, ...res.items]; - } else { - return res.items; - } - }); - } - } catch (error) { - console.error(error); - setData(undefined); - } finally { - if (shouldUpdate) { - setLoading(false); - } - } -}; - export const isActiveMember = async ({ daoid, daochain, @@ -218,10 +115,7 @@ export const isActiveMember = async ({ member: memberRes.data.member, }; } - if ( - memberRes?.data?.member && - Number(memberRes?.data?.member?.loot) > 0 - ) { + if (memberRes?.data?.member && Number(memberRes?.data?.member?.loot) > 0) { return { member: memberRes.data.member, error: { @@ -248,105 +142,3 @@ export const isActiveMember = async ({ setMemberLoading(false); } }; - -export const loadProposalsList = async ({ - filter, - ordering, - paging, - daochain, - setData, - setLoading, - setNextPaging, - shouldUpdate, -}: { - filter: Proposal_Filter; - ordering?: Ordering; - paging?: Paging; - daochain: keyof Keychain; - setData: ReactSetter; - setLoading: ReactSetter; - setNextPaging: ReactSetter; - shouldUpdate: boolean; -}) => { - try { - setLoading(true); - const haus = Haus.create(); - const res = await haus.query.listProposals({ - networkId: daochain, - filter, - ordering, - paging, - }); - - if (shouldUpdate) { - setNextPaging(res.nextPaging); - - setData((prevState) => { - if (deepEqual(prevState, res.items)) return res.items; - if (prevState) { - return [...prevState, ...res.items]; - } else { - return res.items; - } - }); - } - } catch (error) { - console.error(error); - setData(undefined); - } finally { - if (shouldUpdate) { - setLoading(false); - } - } -}; - -export const loadConnectedMemberVotesList = async ({ - filter, - ordering, - paging, - daochain, - setData, - setLoading, - shouldUpdate, - memberAddress, -}: { - filter: Proposal_Filter; - ordering?: Ordering; - paging?: Paging; - daochain: keyof Keychain; - setData: ReactSetter< - ListConnectedMemberProposalsQuery['proposals'] | undefined - >; - setLoading: ReactSetter; - shouldUpdate: boolean; - memberAddress: string; -}) => { - try { - setLoading(true); - const haus = Haus.create(); - const res = await haus.profile.listProposalVotesByMember({ - networkId: daochain, - filter, - ordering, - paging, - memberAddress, - }); - if (shouldUpdate) { - setData((prevState) => { - if (deepEqual(prevState, res.items)) return res.items; - if (prevState) { - return [...prevState, ...res.items]; - } else { - return res.items; - } - }); - } - } catch (error) { - console.error(error); - setData(undefined); - } finally { - if (shouldUpdate) { - setLoading(false); - } - } -}; diff --git a/apps/v3-subgraph/README.md b/apps/v3-subgraph/README.md index e285f4856..c437d921c 100644 --- a/apps/v3-subgraph/README.md +++ b/apps/v3-subgraph/README.md @@ -23,9 +23,8 @@ To generate subgraph code, run the following command: ## Deployment - -`nx run v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-goerli` -`nx run v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-gnosis` +`nx run v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-goerli --network=goerli` +`nx run v3-subgraph:graph-deploy --name=hausdao/daohaus-v3-gnosis --network=xdai` _These require installing the graph cli locally_ `npm install -g @graphprotocol/graph-cli` diff --git a/apps/v3-subgraph/project.json b/apps/v3-subgraph/project.json index b1d1dec76..f08f023e1 100644 --- a/apps/v3-subgraph/project.json +++ b/apps/v3-subgraph/project.json @@ -63,7 +63,7 @@ "options": { "commands": [ { - "command": "graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ {args.name}", + "command": "node manifests/deploy-prep.js {args.network} && graph deploy --node https://api.thegraph.com/deploy/ --ipfs https://api.thegraph.com/ipfs/ {args.name}", "forwardAllArgs": true } ], diff --git a/apps/v3-subgraph/schema.graphql b/apps/v3-subgraph/schema.graphql index 70354e394..46a5021e8 100644 --- a/apps/v3-subgraph/schema.graphql +++ b/apps/v3-subgraph/schema.graphql @@ -101,6 +101,8 @@ type Proposal @entity { graceEnds: BigInt! "unix timestamp after which proposal should be considered invalid and skipped" expiration: BigInt! + "proposal expiration time or if there is no expiration this will be a huge number to aid in querying unexpired proposals" + expirationQueryField: BigInt! "estimated gas needed to execute the proposal actions" actionGasEstimate: BigInt! "string with human readable description of the proposal" diff --git a/apps/v3-subgraph/src/baal-mapping.ts b/apps/v3-subgraph/src/baal-mapping.ts index 269b29566..b8c2fdd24 100644 --- a/apps/v3-subgraph/src/baal-mapping.ts +++ b/apps/v3-subgraph/src/baal-mapping.ts @@ -173,6 +173,10 @@ export function handleSubmitProposal(event: SubmitProposal): void { dao.gracePeriod ); proposal.expiration = event.params.expiration; + proposal.expirationQueryField = + event.params.expiration === constants.BIGINT_ZERO + ? constants.FUTURE_TIMESTAMP + : event.params.expiration; proposal.actionGasEstimate = event.params.baalGas; proposal.cancelled = false; proposal.processed = false; diff --git a/apps/v3-subgraph/src/util/constants.ts b/apps/v3-subgraph/src/util/constants.ts index 2250efc78..2e11fae41 100644 --- a/apps/v3-subgraph/src/util/constants.ts +++ b/apps/v3-subgraph/src/util/constants.ts @@ -4,6 +4,7 @@ export namespace constants { export const BIGINT_ONE_HUNDRED = BigInt.fromI32(100); export const BIGINT_ZERO = BigInt.fromI32(0); export const BIGINT_ONE = BigInt.fromI32(1); + export const FUTURE_TIMESTAMP = BigInt.fromI64(9999999999); export const BIGDECIMAL_ZERO = new BigDecimal(constants.BIGINT_ZERO); export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'; export const BYTES32_ZERO = diff --git a/libs/dao-context/src/DaoContext.tsx b/libs/dao-context/src/DaoContext.tsx index 87620e774..b3dd26e69 100644 --- a/libs/dao-context/src/DaoContext.tsx +++ b/libs/dao-context/src/DaoContext.tsx @@ -1,3 +1,4 @@ +import { createContext, ReactNode, useEffect, useState, useRef } from 'react'; import { Keychain } from '@daohaus/common-utilities'; import { DaoWithTokenDataQuery, @@ -12,16 +13,6 @@ import { Proposal_Filter, Proposal_OrderBy, } from '@daohaus/dao-data'; -import { - createContext, - ReactNode, - useContext, - useEffect, - useState, - SetStateAction, - Dispatch, - useRef, -} from 'react'; import { DEFAULT_MEMBERS_PAGE_SIZE, DEFAULT_PROPOSAL_PAGE_SIZE, @@ -34,11 +25,7 @@ import { loadMembersList, loadProposalsList, } from './utils/fetchHelpers'; - -export type TDao = DaoWithTokenDataQuery['dao']; -export type TMembers = ListMembersQuery['members']; -export type TProposals = ITransformedProposalListQuery['proposals']; -export type TMembership = FindMemberQuery['member']; +import { DaoConnectType } from './utils/types'; export const defaultDaoData = { dao: null, @@ -106,67 +93,6 @@ export const defaultDaoData = { }, }; -export type DaoConnectDaoType = { - dao: DaoWithTokenDataQuery['dao'] | null | undefined; - isDaoLoading: boolean; - refreshDao: () => Promise; - refreshAll: () => Promise; -}; - -export type DaoConnectConnectedMembershipType = { - connectedMembership: FindMemberQuery['member'] | null | undefined; - isConnectedMembershipLoading: boolean; - refreshConnectedMembership: () => Promise; - connectedMembershipProposalVotes: - | ListConnectedMemberProposalsQuery['proposals'] - | null - | undefined; - isConnectedMembershipProposalVotesLoading: boolean; - refreshConnectedMembershipProposalVotes: () => Promise; -}; - -export type DaoConnectMembersType = { - members: ListMembersQuery['members'] | null | undefined; - setMembers: Dispatch>; - isMembersLoading: boolean; - refreshMembers: () => Promise; - membersFilter: Member_Filter | undefined; - setMembersFilter: Dispatch>; - membersSort: Ordering | undefined; - setMembersSort: Dispatch< - SetStateAction | undefined> - >; - membersPaging: Paging | undefined; - membersNextPaging: Paging | undefined; - setMembersPaging: Dispatch>; - getNextPage: (entity: string) => Promise; -}; - -export type DaoConnectProposalsType = { - proposals: ITransformedProposalListQuery['proposals'] | null | undefined; - setProposals: Dispatch< - SetStateAction - >; - isProposalsLoading: boolean; - refreshProposals: () => Promise; - proposalsFilter: Proposal_Filter | undefined; - setProposalsFilter: Dispatch>; - proposalsSort: Ordering | undefined; - setProposalsSort: Dispatch< - SetStateAction | undefined> - >; - proposalsPaging: Paging | undefined; - proposalsNextPaging: Paging | undefined; - setProposalsPaging: Dispatch>; - getNextPage: (entity: string) => Promise; -}; - -interface DaoConnectType - extends DaoConnectDaoType, - DaoConnectConnectedMembershipType, - DaoConnectMembersType, - DaoConnectProposalsType {} - export const DaoContext = createContext(defaultDaoData); type DaoContextProviderProps = { @@ -237,6 +163,7 @@ export const DaoContextProvider = ({ useEffect(() => { let shouldUpdate = true; if (daochain && daoid) { + setDaoLoading(true); loadDao({ daoid, daochain: daochain as keyof Keychain, @@ -410,6 +337,7 @@ export const DaoContextProvider = ({ const refreshProposals = async () => { if (daochain && daoid) { setProposals(undefined); + loadProposalsList({ filter: { dao: daoid, ...proposalsFilter }, ordering: proposalsSort, @@ -489,91 +417,3 @@ export const DaoContextProvider = ({ ); }; - -export const useDao = (): DaoConnectDaoType => { - const { dao, isDaoLoading, refreshDao, refreshAll } = useContext(DaoContext); - return { - dao, - isDaoLoading, - refreshDao, - refreshAll, - }; -}; -export const useConnectedMembership = (): DaoConnectConnectedMembershipType => { - const { - connectedMembership, - isConnectedMembershipLoading, - refreshConnectedMembership, - connectedMembershipProposalVotes, - isConnectedMembershipProposalVotesLoading, - refreshConnectedMembershipProposalVotes, - } = useContext(DaoContext); - return { - connectedMembership, - isConnectedMembershipLoading, - refreshConnectedMembership, - connectedMembershipProposalVotes, - isConnectedMembershipProposalVotesLoading, - refreshConnectedMembershipProposalVotes, - }; -}; -export const useMembers = (): DaoConnectMembersType => { - const { - members, - setMembers, - isMembersLoading, - refreshMembers, - membersFilter, - setMembersFilter, - membersSort, - setMembersSort, - membersPaging, - setMembersPaging, - membersNextPaging, - getNextPage, - } = useContext(DaoContext); - return { - members, - setMembers, - isMembersLoading, - refreshMembers, - membersFilter, - setMembersFilter, - membersSort, - setMembersSort, - membersPaging, - setMembersPaging, - membersNextPaging, - getNextPage, - }; -}; -export const useProposals = (): DaoConnectProposalsType => { - const { - proposals, - setProposals, - isProposalsLoading, - refreshProposals, - proposalsFilter, - setProposalsFilter, - proposalsSort, - setProposalsSort, - proposalsPaging, - setProposalsPaging, - proposalsNextPaging, - getNextPage, - } = useContext(DaoContext); - return { - proposals, - setProposals, - isProposalsLoading, - refreshProposals, - proposalsFilter, - setProposalsFilter, - proposalsSort, - setProposalsSort, - proposalsPaging, - setProposalsPaging, - proposalsNextPaging, - getNextPage, - }; -}; diff --git a/libs/dao-context/src/hooks/index.ts b/libs/dao-context/src/hooks/index.ts new file mode 100644 index 000000000..e274c82fc --- /dev/null +++ b/libs/dao-context/src/hooks/index.ts @@ -0,0 +1,4 @@ +export * from './useDao'; +export * from './useConnectedMembership'; +export * from './useMembers'; +export * from './useProposals'; diff --git a/libs/dao-context/src/hooks/useConnectedMembership.tsx b/libs/dao-context/src/hooks/useConnectedMembership.tsx new file mode 100644 index 000000000..b401f6eaa --- /dev/null +++ b/libs/dao-context/src/hooks/useConnectedMembership.tsx @@ -0,0 +1,22 @@ +import { useContext } from 'react'; +import { DaoContext } from '../DaoContext'; +import { DaoConnectConnectedMembershipType } from '../utils/types'; + +export const useConnectedMembership = (): DaoConnectConnectedMembershipType => { + const { + connectedMembership, + isConnectedMembershipLoading, + refreshConnectedMembership, + connectedMembershipProposalVotes, + isConnectedMembershipProposalVotesLoading, + refreshConnectedMembershipProposalVotes, + } = useContext(DaoContext); + return { + connectedMembership, + isConnectedMembershipLoading, + refreshConnectedMembership, + connectedMembershipProposalVotes, + isConnectedMembershipProposalVotesLoading, + refreshConnectedMembershipProposalVotes, + }; +}; diff --git a/libs/dao-context/src/hooks/useDao.tsx b/libs/dao-context/src/hooks/useDao.tsx new file mode 100644 index 000000000..a8c3f63cc --- /dev/null +++ b/libs/dao-context/src/hooks/useDao.tsx @@ -0,0 +1,13 @@ +import { useContext } from 'react'; +import { DaoContext } from '../DaoContext'; +import { DaoConnectDaoType } from '../utils/types'; + +export const useDao = (): DaoConnectDaoType => { + const { dao, isDaoLoading, refreshDao, refreshAll } = useContext(DaoContext); + return { + dao, + isDaoLoading, + refreshDao, + refreshAll, + }; +}; diff --git a/libs/dao-context/src/hooks/useMembers.tsx b/libs/dao-context/src/hooks/useMembers.tsx new file mode 100644 index 000000000..80d3be47c --- /dev/null +++ b/libs/dao-context/src/hooks/useMembers.tsx @@ -0,0 +1,59 @@ +import { Member_OrderBy } from '@daohaus/dao-data'; +import { useContext } from 'react'; +import { DaoContext, defaultDaoData } from '../DaoContext'; +import { DaoConnectMembersType } from '../utils/types'; + +type MembersHookTypes = { + loadMoreMembers: () => Promise; + sortMembers: ( + orderBy: Member_OrderBy, + orderDirection: 'asc' | 'desc' + ) => Promise; +}; + +export const useMembers = (): DaoConnectMembersType & MembersHookTypes => { + const { + members, + setMembers, + isMembersLoading, + refreshMembers, + membersFilter, + setMembersFilter, + membersSort, + setMembersSort, + membersPaging, + setMembersPaging, + membersNextPaging, + getNextPage, + } = useContext(DaoContext); + + const loadMoreMembers = async () => { + setMembersPaging(membersNextPaging); + }; + + const sortMembers = async ( + orderBy: Member_OrderBy, + orderDirection: 'asc' | 'desc' + ) => { + setMembersSort({ orderBy, orderDirection }); + setMembersPaging(defaultDaoData.membersPaging); + setMembers(undefined); + }; + + return { + members, + setMembers, + isMembersLoading, + refreshMembers, + membersFilter, + setMembersFilter, + membersSort, + setMembersSort, + membersPaging, + setMembersPaging, + membersNextPaging, + getNextPage, + loadMoreMembers, + sortMembers, + }; +}; diff --git a/libs/dao-context/src/hooks/useProposals.tsx b/libs/dao-context/src/hooks/useProposals.tsx new file mode 100644 index 000000000..db0406435 --- /dev/null +++ b/libs/dao-context/src/hooks/useProposals.tsx @@ -0,0 +1,54 @@ +import { Proposal_Filter } from '@daohaus/dao-data'; +import { useContext } from 'react'; +import { DaoContext, defaultDaoData } from '../DaoContext'; +import { DaoConnectProposalsType } from '../utils/types'; + +type ProposalsHookTypes = { + loadMoreProposals: () => Promise; + filterProposals: (filterQuery?: Proposal_Filter) => Promise; +}; + +export const useProposals = (): DaoConnectProposalsType & + ProposalsHookTypes => { + const { + proposals, + setProposals, + isProposalsLoading, + refreshProposals, + proposalsFilter, + setProposalsFilter, + proposalsSort, + setProposalsSort, + proposalsPaging, + setProposalsPaging, + proposalsNextPaging, + getNextPage, + } = useContext(DaoContext); + + const loadMoreProposals = async () => { + setProposalsPaging(proposalsNextPaging); + }; + + const filterProposals = async (filterQuery?: Proposal_Filter) => { + setProposals(undefined); + setProposalsFilter(filterQuery); + setProposalsPaging(defaultDaoData.proposalsPaging); + }; + + return { + proposals, + setProposals, + isProposalsLoading, + refreshProposals, + proposalsFilter, + setProposalsFilter, + proposalsSort, + setProposalsSort, + proposalsPaging, + setProposalsPaging, + proposalsNextPaging, + getNextPage, + loadMoreProposals, + filterProposals, + }; +}; diff --git a/libs/dao-context/src/index.ts b/libs/dao-context/src/index.ts index 5d871a9cc..dbcda0e64 100644 --- a/libs/dao-context/src/index.ts +++ b/libs/dao-context/src/index.ts @@ -1,2 +1,3 @@ export * from './DaoContext'; export * from './utils'; +export * from './hooks'; diff --git a/libs/dao-context/src/utils/index.ts b/libs/dao-context/src/utils/index.ts index 97ee7fb05..3e6cbbafc 100644 --- a/libs/dao-context/src/utils/index.ts +++ b/libs/dao-context/src/utils/index.ts @@ -1,2 +1,3 @@ export * from './constants'; export * from './fetchHelpers'; +export * from './types'; diff --git a/libs/dao-context/src/utils/types.ts b/libs/dao-context/src/utils/types.ts new file mode 100644 index 000000000..7abc6ebdc --- /dev/null +++ b/libs/dao-context/src/utils/types.ts @@ -0,0 +1,81 @@ +import { + DaoWithTokenDataQuery, + FindMemberQuery, + ITransformedProposalListQuery, + ListConnectedMemberProposalsQuery, + ListMembersQuery, + Member_Filter, + Member_OrderBy, + Ordering, + Paging, + Proposal_Filter, + Proposal_OrderBy, +} from '@daohaus/dao-data'; +import { Dispatch, SetStateAction } from 'react'; + +export type TDao = DaoWithTokenDataQuery['dao']; +export type TMembers = ListMembersQuery['members']; +export type TProposals = ITransformedProposalListQuery['proposals']; +export type TMembership = FindMemberQuery['member']; + +export type DaoConnectDaoType = { + dao: DaoWithTokenDataQuery['dao'] | null | undefined; + isDaoLoading: boolean; + refreshDao: () => Promise; + refreshAll: () => Promise; +}; + +export type DaoConnectConnectedMembershipType = { + connectedMembership: FindMemberQuery['member'] | null | undefined; + isConnectedMembershipLoading: boolean; + refreshConnectedMembership: () => Promise; + connectedMembershipProposalVotes: + | ListConnectedMemberProposalsQuery['proposals'] + | null + | undefined; + isConnectedMembershipProposalVotesLoading: boolean; + refreshConnectedMembershipProposalVotes: () => Promise; +}; + +export type DaoConnectMembersType = { + members: ListMembersQuery['members'] | null | undefined; + setMembers: Dispatch>; + isMembersLoading: boolean; + refreshMembers: () => Promise; + membersFilter: Member_Filter | undefined; + setMembersFilter: Dispatch>; + membersSort: Ordering | undefined; + setMembersSort: Dispatch< + SetStateAction | undefined> + >; + membersPaging: Paging | undefined; + membersNextPaging: Paging | undefined; + setMembersPaging: Dispatch>; + getNextPage: (entity: string) => Promise; + // loadMoreMembers: () => Promise; +}; + +export type DaoConnectProposalsType = { + proposals: ITransformedProposalListQuery['proposals'] | null | undefined; + setProposals: Dispatch< + SetStateAction + >; + isProposalsLoading: boolean; + refreshProposals: () => Promise; + proposalsFilter: Proposal_Filter | undefined; + setProposalsFilter: Dispatch>; + proposalsSort: Ordering | undefined; + setProposalsSort: Dispatch< + SetStateAction | undefined> + >; + proposalsPaging: Paging | undefined; + proposalsNextPaging: Paging | undefined; + setProposalsPaging: Dispatch>; + getNextPage: (entity: string) => Promise; +}; + +export interface DaoConnectType + extends DaoConnectDaoType, + DaoConnectConnectedMembershipType, + DaoConnectMembersType, + DaoConnectProposalsType {} diff --git a/libs/dao-data/src/subgraph/queries/proposals.generated.ts b/libs/dao-data/src/subgraph/queries/proposals.generated.ts index cf295fba1..6ca8cd3da 100644 --- a/libs/dao-data/src/subgraph/queries/proposals.generated.ts +++ b/libs/dao-data/src/subgraph/queries/proposals.generated.ts @@ -11,7 +11,7 @@ export type ListProposalsQueryVariables = Types.Exact<{ }>; -export type ListProposalsQuery = { proposals: Array<{ id: string, createdAt: string, createdBy: string, txHash: string, proposalId: string, prevProposalId: string, proposalDataHash: string, proposalData: string, actionGasEstimate: string, details: string, title?: string | undefined, description?: string | undefined, proposalType: string, contentURI?: string | undefined, contentURIType?: string | undefined, sponsorTxHash?: string | undefined, sponsored: boolean, selfSponsor: boolean, sponsor?: string | undefined, sponsorTxAt?: string | undefined, votingPeriod: string, votingStarts: string, votingEnds: string, gracePeriod: string, graceEnds: string, expiration: string, cancelledTxHash?: string | undefined, cancelledBy?: string | undefined, cancelled: boolean, cancelledTxAt?: string | undefined, yesBalance: string, noBalance: string, yesVotes: string, noVotes: string, processTxHash?: string | undefined, processedBy?: string | undefined, processed: boolean, processTxAt?: string | undefined, actionFailed: boolean, passed: boolean, proposalOffering: string, maxTotalSharesAndLootAtYesVote: string, tributeToken?: string | undefined, tributeOffered?: string | undefined, tributeTokenSymbol?: string | undefined, tributeTokenDecimals?: string | undefined, tributeEscrowRecipient?: string | undefined, sponsorMembership?: { memberAddress: string, shares: string } | undefined, dao: { totalShares: string, quorumPercent: string }, votes?: Array<{ id: string, txHash: string, createdAt: string, daoAddress: string, approved: boolean, balance: string, member: { id: string, memberAddress: string } }> | undefined }> }; +export type ListProposalsQuery = { proposals: Array<{ id: string, createdAt: string, createdBy: string, txHash: string, proposalId: string, prevProposalId: string, proposalDataHash: string, proposalData: string, actionGasEstimate: string, details: string, title?: string | undefined, description?: string | undefined, proposalType: string, contentURI?: string | undefined, contentURIType?: string | undefined, sponsorTxHash?: string | undefined, sponsored: boolean, selfSponsor: boolean, sponsor?: string | undefined, sponsorTxAt?: string | undefined, votingPeriod: string, votingStarts: string, votingEnds: string, gracePeriod: string, graceEnds: string, expiration: string, expirationQueryField: string, cancelledTxHash?: string | undefined, cancelledBy?: string | undefined, cancelled: boolean, cancelledTxAt?: string | undefined, yesBalance: string, noBalance: string, yesVotes: string, noVotes: string, processTxHash?: string | undefined, processedBy?: string | undefined, processed: boolean, processTxAt?: string | undefined, actionFailed: boolean, passed: boolean, proposalOffering: string, maxTotalSharesAndLootAtYesVote: string, tributeToken?: string | undefined, tributeOffered?: string | undefined, tributeTokenSymbol?: string | undefined, tributeTokenDecimals?: string | undefined, tributeEscrowRecipient?: string | undefined, sponsorMembership?: { memberAddress: string, shares: string } | undefined, dao: { totalShares: string, quorumPercent: string }, votes?: Array<{ id: string, txHash: string, createdAt: string, daoAddress: string, approved: boolean, balance: string, member: { id: string, memberAddress: string } }> | undefined }> }; export type ListConnectedMemberProposalsQueryVariables = Types.Exact<{ where?: Types.Proposal_Filter; @@ -32,9 +32,9 @@ export type FindProposalQueryVariables = Types.Exact<{ }>; -export type FindProposalQuery = { proposal?: { id: string, createdAt: string, createdBy: string, txHash: string, proposalId: string, prevProposalId: string, proposalDataHash: string, proposalData: string, actionGasEstimate: string, details: string, title?: string | undefined, description?: string | undefined, proposalType: string, contentURI?: string | undefined, contentURIType?: string | undefined, sponsorTxHash?: string | undefined, sponsored: boolean, selfSponsor: boolean, sponsor?: string | undefined, sponsorTxAt?: string | undefined, votingPeriod: string, votingStarts: string, votingEnds: string, gracePeriod: string, graceEnds: string, expiration: string, cancelledTxHash?: string | undefined, cancelledBy?: string | undefined, cancelled: boolean, cancelledTxAt?: string | undefined, yesBalance: string, noBalance: string, yesVotes: string, noVotes: string, processTxHash?: string | undefined, processedBy?: string | undefined, processed: boolean, processTxAt?: string | undefined, actionFailed: boolean, passed: boolean, proposalOffering: string, maxTotalSharesAndLootAtYesVote: string, tributeToken?: string | undefined, tributeOffered?: string | undefined, tributeTokenSymbol?: string | undefined, tributeTokenDecimals?: string | undefined, tributeEscrowRecipient?: string | undefined, sponsorMembership?: { memberAddress: string, shares: string } | undefined, dao: { totalShares: string, quorumPercent: string }, votes?: Array<{ id: string, txHash: string, createdAt: string, daoAddress: string, approved: boolean, balance: string, member: { id: string, memberAddress: string } }> | undefined, connectedMemberVotes?: Array<{ id: string, txHash: string, createdAt: string, daoAddress: string, approved: boolean, balance: string, member: { id: string, memberAddress: string } }> | undefined } | undefined }; +export type FindProposalQuery = { proposal?: { id: string, createdAt: string, createdBy: string, txHash: string, proposalId: string, prevProposalId: string, proposalDataHash: string, proposalData: string, actionGasEstimate: string, details: string, title?: string | undefined, description?: string | undefined, proposalType: string, contentURI?: string | undefined, contentURIType?: string | undefined, sponsorTxHash?: string | undefined, sponsored: boolean, selfSponsor: boolean, sponsor?: string | undefined, sponsorTxAt?: string | undefined, votingPeriod: string, votingStarts: string, votingEnds: string, gracePeriod: string, graceEnds: string, expiration: string, expirationQueryField: string, cancelledTxHash?: string | undefined, cancelledBy?: string | undefined, cancelled: boolean, cancelledTxAt?: string | undefined, yesBalance: string, noBalance: string, yesVotes: string, noVotes: string, processTxHash?: string | undefined, processedBy?: string | undefined, processed: boolean, processTxAt?: string | undefined, actionFailed: boolean, passed: boolean, proposalOffering: string, maxTotalSharesAndLootAtYesVote: string, tributeToken?: string | undefined, tributeOffered?: string | undefined, tributeTokenSymbol?: string | undefined, tributeTokenDecimals?: string | undefined, tributeEscrowRecipient?: string | undefined, sponsorMembership?: { memberAddress: string, shares: string } | undefined, dao: { totalShares: string, quorumPercent: string }, votes?: Array<{ id: string, txHash: string, createdAt: string, daoAddress: string, approved: boolean, balance: string, member: { id: string, memberAddress: string } }> | undefined, connectedMemberVotes?: Array<{ id: string, txHash: string, createdAt: string, daoAddress: string, approved: boolean, balance: string, member: { id: string, memberAddress: string } }> | undefined } | undefined }; -export const ListProposalsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"listProposals"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Proposal_filter"}}},"defaultValue":{"kind":"ObjectValue","fields":[]}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"skip"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},"defaultValue":{"kind":"IntValue","value":"0"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},"defaultValue":{"kind":"IntValue","value":"100"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Proposal_orderBy"}}},"defaultValue":{"kind":"EnumValue","value":"id"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderDirection"}}},"defaultValue":{"kind":"EnumValue","value":"asc"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"connectedAddress"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposals"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"skip"},"value":{"kind":"Variable","name":{"kind":"Name","value":"skip"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalId"}},{"kind":"Field","name":{"kind":"Name","value":"prevProposalId"}},{"kind":"Field","name":{"kind":"Name","value":"proposalDataHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalData"}},{"kind":"Field","name":{"kind":"Name","value":"actionGasEstimate"}},{"kind":"Field","name":{"kind":"Name","value":"details"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"proposalType"}},{"kind":"Field","name":{"kind":"Name","value":"contentURI"}},{"kind":"Field","name":{"kind":"Name","value":"contentURIType"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"sponsored"}},{"kind":"Field","name":{"kind":"Name","value":"selfSponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"votingPeriod"}},{"kind":"Field","name":{"kind":"Name","value":"votingStarts"}},{"kind":"Field","name":{"kind":"Name","value":"votingEnds"}},{"kind":"Field","name":{"kind":"Name","value":"gracePeriod"}},{"kind":"Field","name":{"kind":"Name","value":"graceEnds"}},{"kind":"Field","name":{"kind":"Name","value":"expiration"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledBy"}},{"kind":"Field","name":{"kind":"Name","value":"cancelled"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"yesBalance"}},{"kind":"Field","name":{"kind":"Name","value":"noBalance"}},{"kind":"Field","name":{"kind":"Name","value":"yesVotes"}},{"kind":"Field","name":{"kind":"Name","value":"noVotes"}},{"kind":"Field","name":{"kind":"Name","value":"processTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"processedBy"}},{"kind":"Field","name":{"kind":"Name","value":"processed"}},{"kind":"Field","name":{"kind":"Name","value":"processTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"actionFailed"}},{"kind":"Field","name":{"kind":"Name","value":"passed"}},{"kind":"Field","name":{"kind":"Name","value":"proposalOffering"}},{"kind":"Field","name":{"kind":"Name","value":"maxTotalSharesAndLootAtYesVote"}},{"kind":"Field","name":{"kind":"Name","value":"tributeToken"}},{"kind":"Field","name":{"kind":"Name","value":"tributeOffered"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenSymbol"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenDecimals"}},{"kind":"Field","name":{"kind":"Name","value":"tributeEscrowRecipient"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorMembership"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}},{"kind":"Field","name":{"kind":"Name","value":"shares"}}]}},{"kind":"Field","name":{"kind":"Name","value":"dao"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalShares"}},{"kind":"Field","name":{"kind":"Name","value":"quorumPercent"}}]}},{"kind":"Field","name":{"kind":"Name","value":"votes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"daoAddress"}},{"kind":"Field","name":{"kind":"Name","value":"approved"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}},{"kind":"Field","name":{"kind":"Name","value":"member"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}}]}}]}}]}}]}}]} as unknown as DocumentNode; +export const ListProposalsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"listProposals"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Proposal_filter"}}},"defaultValue":{"kind":"ObjectValue","fields":[]}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"skip"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},"defaultValue":{"kind":"IntValue","value":"0"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},"defaultValue":{"kind":"IntValue","value":"100"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Proposal_orderBy"}}},"defaultValue":{"kind":"EnumValue","value":"id"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderDirection"}}},"defaultValue":{"kind":"EnumValue","value":"asc"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"connectedAddress"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposals"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"skip"},"value":{"kind":"Variable","name":{"kind":"Name","value":"skip"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalId"}},{"kind":"Field","name":{"kind":"Name","value":"prevProposalId"}},{"kind":"Field","name":{"kind":"Name","value":"proposalDataHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalData"}},{"kind":"Field","name":{"kind":"Name","value":"actionGasEstimate"}},{"kind":"Field","name":{"kind":"Name","value":"details"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"proposalType"}},{"kind":"Field","name":{"kind":"Name","value":"contentURI"}},{"kind":"Field","name":{"kind":"Name","value":"contentURIType"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"sponsored"}},{"kind":"Field","name":{"kind":"Name","value":"selfSponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"votingPeriod"}},{"kind":"Field","name":{"kind":"Name","value":"votingStarts"}},{"kind":"Field","name":{"kind":"Name","value":"votingEnds"}},{"kind":"Field","name":{"kind":"Name","value":"gracePeriod"}},{"kind":"Field","name":{"kind":"Name","value":"graceEnds"}},{"kind":"Field","name":{"kind":"Name","value":"expiration"}},{"kind":"Field","name":{"kind":"Name","value":"expirationQueryField"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledBy"}},{"kind":"Field","name":{"kind":"Name","value":"cancelled"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"yesBalance"}},{"kind":"Field","name":{"kind":"Name","value":"noBalance"}},{"kind":"Field","name":{"kind":"Name","value":"yesVotes"}},{"kind":"Field","name":{"kind":"Name","value":"noVotes"}},{"kind":"Field","name":{"kind":"Name","value":"processTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"processedBy"}},{"kind":"Field","name":{"kind":"Name","value":"processed"}},{"kind":"Field","name":{"kind":"Name","value":"processTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"actionFailed"}},{"kind":"Field","name":{"kind":"Name","value":"passed"}},{"kind":"Field","name":{"kind":"Name","value":"proposalOffering"}},{"kind":"Field","name":{"kind":"Name","value":"maxTotalSharesAndLootAtYesVote"}},{"kind":"Field","name":{"kind":"Name","value":"tributeToken"}},{"kind":"Field","name":{"kind":"Name","value":"tributeOffered"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenSymbol"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenDecimals"}},{"kind":"Field","name":{"kind":"Name","value":"tributeEscrowRecipient"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorMembership"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}},{"kind":"Field","name":{"kind":"Name","value":"shares"}}]}},{"kind":"Field","name":{"kind":"Name","value":"dao"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalShares"}},{"kind":"Field","name":{"kind":"Name","value":"quorumPercent"}}]}},{"kind":"Field","name":{"kind":"Name","value":"votes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"daoAddress"}},{"kind":"Field","name":{"kind":"Name","value":"approved"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}},{"kind":"Field","name":{"kind":"Name","value":"member"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const ListConnectedMemberProposalsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"listConnectedMemberProposals"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"where"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Proposal_filter"}}},"defaultValue":{"kind":"ObjectValue","fields":[]}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"memberWhere"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Member_filter"}}},"defaultValue":{"kind":"ObjectValue","fields":[]}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"skip"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},"defaultValue":{"kind":"IntValue","value":"0"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"first"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Int"}}},"defaultValue":{"kind":"IntValue","value":"100"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"Proposal_orderBy"}}},"defaultValue":{"kind":"EnumValue","value":"id"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"OrderDirection"}}},"defaultValue":{"kind":"EnumValue","value":"asc"}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"connectedAddress"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposals"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"Variable","name":{"kind":"Name","value":"where"}}},{"kind":"Argument","name":{"kind":"Name","value":"skip"},"value":{"kind":"Variable","name":{"kind":"Name","value":"skip"}}},{"kind":"Argument","name":{"kind":"Name","value":"first"},"value":{"kind":"Variable","name":{"kind":"Name","value":"first"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderBy"}}},{"kind":"Argument","name":{"kind":"Name","value":"orderDirection"},"value":{"kind":"Variable","name":{"kind":"Name","value":"orderDirection"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","alias":{"kind":"Name","value":"connectedMemberVotes"},"name":{"kind":"Name","value":"votes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"member_"},"value":{"kind":"Variable","name":{"kind":"Name","value":"memberWhere"}}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"daoAddress"}},{"kind":"Field","name":{"kind":"Name","value":"approved"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}},{"kind":"Field","name":{"kind":"Name","value":"member"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}}]}}]}}]}}]}}]} as unknown as DocumentNode; -export const FindProposalDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"findProposal"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"connectedAddress"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposal"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalId"}},{"kind":"Field","name":{"kind":"Name","value":"prevProposalId"}},{"kind":"Field","name":{"kind":"Name","value":"proposalDataHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalData"}},{"kind":"Field","name":{"kind":"Name","value":"actionGasEstimate"}},{"kind":"Field","name":{"kind":"Name","value":"details"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"proposalType"}},{"kind":"Field","name":{"kind":"Name","value":"contentURI"}},{"kind":"Field","name":{"kind":"Name","value":"contentURIType"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"sponsored"}},{"kind":"Field","name":{"kind":"Name","value":"selfSponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"votingPeriod"}},{"kind":"Field","name":{"kind":"Name","value":"votingStarts"}},{"kind":"Field","name":{"kind":"Name","value":"votingEnds"}},{"kind":"Field","name":{"kind":"Name","value":"gracePeriod"}},{"kind":"Field","name":{"kind":"Name","value":"graceEnds"}},{"kind":"Field","name":{"kind":"Name","value":"expiration"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledBy"}},{"kind":"Field","name":{"kind":"Name","value":"cancelled"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"yesBalance"}},{"kind":"Field","name":{"kind":"Name","value":"noBalance"}},{"kind":"Field","name":{"kind":"Name","value":"yesVotes"}},{"kind":"Field","name":{"kind":"Name","value":"noVotes"}},{"kind":"Field","name":{"kind":"Name","value":"processTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"processedBy"}},{"kind":"Field","name":{"kind":"Name","value":"processed"}},{"kind":"Field","name":{"kind":"Name","value":"processTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"actionFailed"}},{"kind":"Field","name":{"kind":"Name","value":"passed"}},{"kind":"Field","name":{"kind":"Name","value":"proposalOffering"}},{"kind":"Field","name":{"kind":"Name","value":"maxTotalSharesAndLootAtYesVote"}},{"kind":"Field","name":{"kind":"Name","value":"tributeToken"}},{"kind":"Field","name":{"kind":"Name","value":"tributeOffered"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenSymbol"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenDecimals"}},{"kind":"Field","name":{"kind":"Name","value":"tributeEscrowRecipient"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorMembership"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}},{"kind":"Field","name":{"kind":"Name","value":"shares"}}]}},{"kind":"Field","name":{"kind":"Name","value":"dao"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalShares"}},{"kind":"Field","name":{"kind":"Name","value":"quorumPercent"}}]}},{"kind":"Field","name":{"kind":"Name","value":"votes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"daoAddress"}},{"kind":"Field","name":{"kind":"Name","value":"approved"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}},{"kind":"Field","name":{"kind":"Name","value":"member"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"connectedMemberVotes"},"name":{"kind":"Name","value":"votes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"member_"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"memberAddress"},"value":{"kind":"Variable","name":{"kind":"Name","value":"connectedAddress"}}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"daoAddress"}},{"kind":"Field","name":{"kind":"Name","value":"approved"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}},{"kind":"Field","name":{"kind":"Name","value":"member"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}}]}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file +export const FindProposalDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"findProposal"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"ID"}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"connectedAddress"}},"type":{"kind":"NamedType","name":{"kind":"Name","value":"Bytes"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"proposal"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"id"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"createdBy"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalId"}},{"kind":"Field","name":{"kind":"Name","value":"prevProposalId"}},{"kind":"Field","name":{"kind":"Name","value":"proposalDataHash"}},{"kind":"Field","name":{"kind":"Name","value":"proposalData"}},{"kind":"Field","name":{"kind":"Name","value":"actionGasEstimate"}},{"kind":"Field","name":{"kind":"Name","value":"details"}},{"kind":"Field","name":{"kind":"Name","value":"title"}},{"kind":"Field","name":{"kind":"Name","value":"description"}},{"kind":"Field","name":{"kind":"Name","value":"proposalType"}},{"kind":"Field","name":{"kind":"Name","value":"contentURI"}},{"kind":"Field","name":{"kind":"Name","value":"contentURIType"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"sponsored"}},{"kind":"Field","name":{"kind":"Name","value":"selfSponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsor"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"votingPeriod"}},{"kind":"Field","name":{"kind":"Name","value":"votingStarts"}},{"kind":"Field","name":{"kind":"Name","value":"votingEnds"}},{"kind":"Field","name":{"kind":"Name","value":"gracePeriod"}},{"kind":"Field","name":{"kind":"Name","value":"graceEnds"}},{"kind":"Field","name":{"kind":"Name","value":"expiration"}},{"kind":"Field","name":{"kind":"Name","value":"expirationQueryField"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledBy"}},{"kind":"Field","name":{"kind":"Name","value":"cancelled"}},{"kind":"Field","name":{"kind":"Name","value":"cancelledTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"yesBalance"}},{"kind":"Field","name":{"kind":"Name","value":"noBalance"}},{"kind":"Field","name":{"kind":"Name","value":"yesVotes"}},{"kind":"Field","name":{"kind":"Name","value":"noVotes"}},{"kind":"Field","name":{"kind":"Name","value":"processTxHash"}},{"kind":"Field","name":{"kind":"Name","value":"processedBy"}},{"kind":"Field","name":{"kind":"Name","value":"processed"}},{"kind":"Field","name":{"kind":"Name","value":"processTxAt"}},{"kind":"Field","name":{"kind":"Name","value":"actionFailed"}},{"kind":"Field","name":{"kind":"Name","value":"passed"}},{"kind":"Field","name":{"kind":"Name","value":"proposalOffering"}},{"kind":"Field","name":{"kind":"Name","value":"maxTotalSharesAndLootAtYesVote"}},{"kind":"Field","name":{"kind":"Name","value":"tributeToken"}},{"kind":"Field","name":{"kind":"Name","value":"tributeOffered"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenSymbol"}},{"kind":"Field","name":{"kind":"Name","value":"tributeTokenDecimals"}},{"kind":"Field","name":{"kind":"Name","value":"tributeEscrowRecipient"}},{"kind":"Field","name":{"kind":"Name","value":"sponsorMembership"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}},{"kind":"Field","name":{"kind":"Name","value":"shares"}}]}},{"kind":"Field","name":{"kind":"Name","value":"dao"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"totalShares"}},{"kind":"Field","name":{"kind":"Name","value":"quorumPercent"}}]}},{"kind":"Field","name":{"kind":"Name","value":"votes"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"daoAddress"}},{"kind":"Field","name":{"kind":"Name","value":"approved"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}},{"kind":"Field","name":{"kind":"Name","value":"member"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}}]}}]}},{"kind":"Field","alias":{"kind":"Name","value":"connectedMemberVotes"},"name":{"kind":"Name","value":"votes"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"member_"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"memberAddress"},"value":{"kind":"Variable","name":{"kind":"Name","value":"connectedAddress"}}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"txHash"}},{"kind":"Field","name":{"kind":"Name","value":"createdAt"}},{"kind":"Field","name":{"kind":"Name","value":"daoAddress"}},{"kind":"Field","name":{"kind":"Name","value":"approved"}},{"kind":"Field","name":{"kind":"Name","value":"balance"}},{"kind":"Field","name":{"kind":"Name","value":"member"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"memberAddress"}}]}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/libs/dao-data/src/subgraph/queries/proposals.graphql b/libs/dao-data/src/subgraph/queries/proposals.graphql index 5d500a605..8a645516e 100644 --- a/libs/dao-data/src/subgraph/queries/proposals.graphql +++ b/libs/dao-data/src/subgraph/queries/proposals.graphql @@ -96,6 +96,7 @@ fragment proposalFields on Proposal { gracePeriod graceEnds expiration + expirationQueryField cancelledTxHash cancelledBy cancelled diff --git a/libs/dao-data/src/subgraph/schema-lens.generated.ts b/libs/dao-data/src/subgraph/schema-lens.generated.ts index cb88f246c..385b6a4f2 100644 --- a/libs/dao-data/src/subgraph/schema-lens.generated.ts +++ b/libs/dao-data/src/subgraph/schema-lens.generated.ts @@ -162,6 +162,16 @@ export interface BurnProfileRequest { profileId: Scalars['ProfileId']; } +export interface CanCommentResponse { + __typename?: 'CanCommentResponse'; + result: Scalars['Boolean']; +} + +export interface CanMirrorResponse { + __typename?: 'CanMirrorResponse'; + result: Scalars['Boolean']; +} + /** The challenge request */ export interface ChallengeRequest { /** The ethereum address you want to login with */ @@ -225,6 +235,8 @@ export interface Comment { __typename?: 'Comment'; /** ID of the source */ appId?: Maybe; + canComment: CanCommentResponse; + canMirror: CanMirrorResponse; /** The collect module */ collectModule: CollectModule; /** The contract address for the collect nft.. if its null it means nobody collected yet as it lazy deployed */ @@ -259,6 +271,18 @@ export interface Comment { } +/** The social comment */ +export interface CommentCanCommentArgs { + profileId?: InputMaybe; +} + + +/** The social comment */ +export interface CommentCanMirrorArgs { + profileId?: InputMaybe; +} + + /** The social comment */ export interface CommentMirrorsArgs { by?: InputMaybe; @@ -816,10 +840,36 @@ export interface CreateUnfollowBroadcastItemResult { typedData: CreateBurnEip712TypedData; } +/** The custom filters types */ +export type CustomFiltersTypes = + | 'GARDENERS'; + export interface DefaultProfileRequest { ethereumAddress: Scalars['EthereumAddress']; } +export interface DegreesOfSeparationReferenceModuleParams { + /** Applied to comments */ + commentsRestricted: Scalars['Boolean']; + /** Degrees of separation */ + degreesOfSeparation: Scalars['Int']; + /** Applied to mirrors */ + mirrorsRestricted: Scalars['Boolean']; +} + +export interface DegreesOfSeparationReferenceModuleSettings { + __typename?: 'DegreesOfSeparationReferenceModuleSettings'; + /** Applied to comments */ + commentsRestricted: Scalars['Boolean']; + contractAddress: Scalars['ContractAddress']; + /** Degrees of separation */ + degreesOfSeparation: Scalars['Int']; + /** Applied to mirrors */ + mirrorsRestricted: Scalars['Boolean']; + /** The reference modules enum */ + type: ReferenceModules; +} + /** The dispatcher */ export interface Dispatcher { __typename?: 'Dispatcher'; @@ -930,6 +980,7 @@ export interface ExploreProfileResult { export interface ExploreProfilesRequest { cursor?: InputMaybe; + customFilters?: InputMaybe>; limit?: InputMaybe; sortCriteria: ProfileSortCriteria; timestamp?: InputMaybe; @@ -937,6 +988,7 @@ export interface ExploreProfilesRequest { export interface ExplorePublicationRequest { cursor?: InputMaybe; + customFilters?: InputMaybe>; /** If you wish to exclude any results for profile ids */ excludeProfileIds?: InputMaybe>; limit?: InputMaybe; @@ -1371,6 +1423,8 @@ export interface Mirror { __typename?: 'Mirror'; /** ID of the source */ appId?: Maybe; + canComment: CanCommentResponse; + canMirror: CanMirrorResponse; /** The collect module */ collectModule: CollectModule; /** The contract address for the collect nft.. if its null it means nobody collected yet as it lazy deployed */ @@ -1398,6 +1452,18 @@ export interface Mirror { } +/** The social mirror */ +export interface MirrorCanCommentArgs { + profileId?: InputMaybe; +} + + +/** The social mirror */ +export interface MirrorCanMirrorArgs { + profileId?: InputMaybe; +} + + /** The social mirror */ export interface MirrorReactionArgs { request?: InputMaybe; @@ -1793,6 +1859,7 @@ export type Notification = NewCollectNotification | NewCommentNotification | New export interface NotificationRequest { cursor?: InputMaybe; + customFilters?: InputMaybe>; limit?: InputMaybe; metadata?: InputMaybe; /** The profile id */ @@ -1922,6 +1989,8 @@ export interface Post { __typename?: 'Post'; /** ID of the source */ appId?: Maybe; + canComment: CanCommentResponse; + canMirror: CanMirrorResponse; /** The collect module */ collectModule: CollectModule; /** The contract address for the collect nft.. if its null it means nobody collected yet as it lazy deployed */ @@ -1950,6 +2019,18 @@ export interface Post { } +/** The social post */ +export interface PostCanCommentArgs { + profileId?: InputMaybe; +} + + +/** The social post */ +export interface PostCanMirrorArgs { + profileId?: InputMaybe; +} + + /** The social post */ export interface PostMirrorsArgs { by?: InputMaybe; @@ -2468,6 +2549,7 @@ export interface PublicationsQueryRequest { /** The publication id you wish to get comments for */ commentsOf?: InputMaybe; cursor?: InputMaybe; + customFilters?: InputMaybe>; limit?: InputMaybe; metadata?: InputMaybe; /** Profile id */ @@ -2755,9 +2837,11 @@ export interface RecommendedProfileOptions { disableML?: InputMaybe; } -export type ReferenceModule = FollowOnlyReferenceModuleSettings | UnknownReferenceModuleSettings; +export type ReferenceModule = DegreesOfSeparationReferenceModuleSettings | FollowOnlyReferenceModuleSettings | UnknownReferenceModuleSettings; export interface ReferenceModuleParams { + /** The degrees of seperation reference module */ + degreesOfSeparationReferenceModule?: InputMaybe; /** The follower only reference module */ followerOnlyReferenceModule?: InputMaybe; /** A unknown reference module */ @@ -2766,6 +2850,7 @@ export interface ReferenceModuleParams { /** The reference module types */ export type ReferenceModules = + | 'DegreesOfSeparationReferenceModule' | 'FollowerOnlyReferenceModule' | 'UnknownReferenceModule'; @@ -2846,6 +2931,7 @@ export interface RevertFollowModuleSettings { export interface SearchQueryRequest { cursor?: InputMaybe; + customFilters?: InputMaybe>; limit?: InputMaybe; /** The search term */ query: Scalars['Search']; diff --git a/libs/dao-data/src/subgraph/schema-lens.graphql b/libs/dao-data/src/subgraph/schema-lens.graphql index 0b42d639d..dbb31389f 100644 --- a/libs/dao-data/src/subgraph/schema-lens.graphql +++ b/libs/dao-data/src/subgraph/schema-lens.graphql @@ -89,6 +89,14 @@ input BurnProfileRequest { profileId: ProfileId! } +type CanCommentResponse { + result: Boolean! +} + +type CanMirrorResponse { + result: Boolean! +} + """ChainId custom scalar type""" scalar ChainId @@ -219,6 +227,8 @@ type Comment { collectedBy: Wallet reaction(request: ReactionFieldResolverRequest): ReactionTypes hasCollectedByMe: Boolean! + canComment(profileId: ProfileId): CanCommentResponse! + canMirror(profileId: ProfileId): CanMirrorResponse! mirrors(by: ProfileId): [InternalPublicationId!]! } @@ -795,6 +805,11 @@ type CreateUnfollowBroadcastItemResult { """Cursor custom scalar type""" scalar Cursor +"""The custom filters types""" +enum CustomFiltersTypes { + GARDENERS +} + """ The javascript `Date` as string. Type represents date and time as the ISO Date string. """ @@ -804,6 +819,32 @@ input DefaultProfileRequest { ethereumAddress: EthereumAddress! } +input DegreesOfSeparationReferenceModuleParams { + """Applied to comments""" + commentsRestricted: Boolean! + + """Applied to mirrors""" + mirrorsRestricted: Boolean! + + """Degrees of separation""" + degreesOfSeparation: Int! +} + +type DegreesOfSeparationReferenceModuleSettings { + """The reference modules enum""" + type: ReferenceModules! + contractAddress: ContractAddress! + + """Applied to comments""" + commentsRestricted: Boolean! + + """Applied to mirrors""" + mirrorsRestricted: Boolean! + + """Degrees of separation""" + degreesOfSeparation: Int! +} + """The dispatcher""" type Dispatcher { """The dispatcher address""" @@ -925,6 +966,7 @@ input ExploreProfilesRequest { cursor: Cursor timestamp: TimestampScalar sortCriteria: ProfileSortCriteria! + customFilters: [CustomFiltersTypes!] = [] } input ExplorePublicationRequest { @@ -945,6 +987,7 @@ input ExplorePublicationRequest { """If you wish to exclude any results for profile ids""" excludeProfileIds: [ProfileId!] metadata: PublicationMetadataFilters + customFilters: [CustomFiltersTypes!] = [] } """The paginated publication result""" @@ -1488,6 +1531,8 @@ type Mirror { mirrorOf: MirrorablePublication! reaction(request: ReactionFieldResolverRequest): ReactionTypes hasCollectedByMe: Boolean! + canComment(profileId: ProfileId): CanCommentResponse! + canMirror(profileId: ProfileId): CanMirrorResponse! } union MirrorablePublication = Post | Comment @@ -1757,6 +1802,7 @@ input NotificationRequest { """The App Id""" sources: [Sources!] = [] metadata: PublicationMetadataFilters + customFilters: [CustomFiltersTypes!] = [] } type OnChainIdentity { @@ -1912,6 +1958,8 @@ type Post { collectedBy: Wallet reaction(request: ReactionFieldResolverRequest): ReactionTypes hasCollectedByMe: Boolean! + canComment(profileId: ProfileId): CanCommentResponse! + canMirror(profileId: ProfileId): CanMirrorResponse! mirrors(by: ProfileId): [InternalPublicationId!]! } @@ -2457,6 +2505,7 @@ input PublicationsQueryRequest { """The publication id""" publicationIds: [InternalPublicationId!] metadata: PublicationMetadataFilters + customFilters: [CustomFiltersTypes!] = [] } """The publication stats""" @@ -2581,7 +2630,7 @@ input RecommendedProfileOptions { disableML: Boolean = false } -union ReferenceModule = FollowOnlyReferenceModuleSettings | UnknownReferenceModuleSettings +union ReferenceModule = FollowOnlyReferenceModuleSettings | UnknownReferenceModuleSettings | DegreesOfSeparationReferenceModuleSettings """reference module data scalar type""" scalar ReferenceModuleData @@ -2592,11 +2641,15 @@ input ReferenceModuleParams { """A unknown reference module""" unknownReferenceModule: UnknownReferenceModuleParams + + """The degrees of seperation reference module""" + degreesOfSeparationReferenceModule: DegreesOfSeparationReferenceModuleParams } """The reference module types""" enum ReferenceModules { FollowerOnlyReferenceModule + DegreesOfSeparationReferenceModule UnknownReferenceModule } @@ -2683,6 +2736,7 @@ input SearchQueryRequest { """The search term""" query: Search! type: SearchRequestTypes! + customFilters: [CustomFiltersTypes!] = [] """The App Id""" sources: [Sources!] = [] diff --git a/libs/dao-data/src/subgraph/schema.generated.ts b/libs/dao-data/src/subgraph/schema.generated.ts index f86a20473..9822f49ee 100644 --- a/libs/dao-data/src/subgraph/schema.generated.ts +++ b/libs/dao-data/src/subgraph/schema.generated.ts @@ -732,6 +732,8 @@ export interface Proposal { details: Scalars['String']; /** unix timestamp after which proposal should be considered invalid and skipped */ expiration: Scalars['BigInt']; + /** proposal expiration time or if there is no expiration this will be a huge number to aid in querying unexpired proposals */ + expirationQueryField: Scalars['BigInt']; /** unix timestamp of when the grace period ends */ graceEnds: Scalars['BigInt']; /** duration in seconds of the grace period for this proposal in seconds */ @@ -981,6 +983,14 @@ export interface Proposal_Filter { details_starts_with?: InputMaybe; details_starts_with_nocase?: InputMaybe; expiration?: InputMaybe; + expirationQueryField?: InputMaybe; + expirationQueryField_gt?: InputMaybe; + expirationQueryField_gte?: InputMaybe; + expirationQueryField_in?: InputMaybe>; + expirationQueryField_lt?: InputMaybe; + expirationQueryField_lte?: InputMaybe; + expirationQueryField_not?: InputMaybe; + expirationQueryField_not_in?: InputMaybe>; expiration_gt?: InputMaybe; expiration_gte?: InputMaybe; expiration_in?: InputMaybe>; @@ -1331,6 +1341,7 @@ export type Proposal_OrderBy = | 'description' | 'details' | 'expiration' + | 'expirationQueryField' | 'graceEnds' | 'gracePeriod' | 'id' @@ -2249,8 +2260,8 @@ export interface _Block_ { hash?: Maybe; /** The block number */ number: Scalars['Int']; - /** Timestamp of the block if available, format depends on the chain */ - timestamp?: Maybe; + /** Integer representation of the timestamp stored in blocks for the chain */ + timestamp?: Maybe; } /** The type for the top-level _meta field */ diff --git a/libs/dao-data/src/subgraph/schema.graphql b/libs/dao-data/src/subgraph/schema.graphql index d61410b4e..3c00d9a85 100644 --- a/libs/dao-data/src/subgraph/schema.graphql +++ b/libs/dao-data/src/subgraph/schema.graphql @@ -19,8 +19,8 @@ type _Block_ { """The block number""" number: Int! - """Timestamp of the block if available, format depends on the chain""" - timestamp: String + """Integer representation of the timestamp stored in blocks for the chain""" + timestamp: Int } """The type for the top-level _meta field""" @@ -791,6 +791,11 @@ type Proposal { """ expiration: BigInt! + """ + proposal expiration time or if there is no expiration this will be a huge number to aid in querying unexpired proposals + """ + expirationQueryField: BigInt! + """estimated gas needed to execute the proposal actions""" actionGasEstimate: BigInt! @@ -1063,6 +1068,14 @@ input Proposal_filter { expiration_lte: BigInt expiration_in: [BigInt!] expiration_not_in: [BigInt!] + expirationQueryField: BigInt + expirationQueryField_not: BigInt + expirationQueryField_gt: BigInt + expirationQueryField_lt: BigInt + expirationQueryField_gte: BigInt + expirationQueryField_lte: BigInt + expirationQueryField_in: [BigInt!] + expirationQueryField_not_in: [BigInt!] actionGasEstimate: BigInt actionGasEstimate_not: BigInt actionGasEstimate_gt: BigInt @@ -1420,6 +1433,7 @@ enum Proposal_orderBy { votingPlusGraceDuration graceEnds expiration + expirationQueryField actionGasEstimate details selfSponsor diff --git a/libs/dao-data/src/utils/proposalFilters.ts b/libs/dao-data/src/utils/proposalFilters.ts index 9c292e59a..c1c6659c2 100644 --- a/libs/dao-data/src/utils/proposalFilters.ts +++ b/libs/dao-data/src/utils/proposalFilters.ts @@ -18,23 +18,23 @@ export const statusFilter = ( return { sponsored: false, cancelled: false, - expiration_gt: `${expirationTime}`, + expirationQueryField_gt: expirationTime, }; } case PROPOSAL_STATUS['cancelled']: { return { cancelled: true }; } case PROPOSAL_STATUS['passed']: { - return { passed: true }; + return { passed: true, actionFailed: false }; } case PROPOSAL_STATUS['actionFailed']: { return { actionFailed: true }; } case PROPOSAL_STATUS['voting']: { - return { votingStarts_lte: now, votingEnds_lte: now }; + return { votingStarts_lte: now, votingEnds_gt: now }; } case PROPOSAL_STATUS['grace']: { - return { votingEnds_gt: now, graceEnds_lte: now }; + return { votingEnds_lte: now, graceEnds_gt: now }; } case PROPOSAL_STATUS['expired']: { if (!votingPlusGraceDuration) { @@ -44,17 +44,24 @@ export const statusFilter = ( Number(now) + Number(votingPlusGraceDuration) ).toFixed(); return { - processed: false, cancelled: false, expiration_gt: '0', expiration_lt: `${expirationTime}`, }; } case PROPOSAL_STATUS['needsProcessing']: { - return { processed: false, currentlyPassing: true, graceEnds_gt: now }; + return { processed: false, currentlyPassing: true, graceEnds_lt: now }; } case PROPOSAL_STATUS['failed']: { - return { currentlyPassing: false, graceEnds_lte: now }; + if (!votingPlusGraceDuration) { + return; + } + return { + currentlyPassing: false, + graceEnds_lt: now, + sponsored: true, + passed: false, + }; } default: { return; diff --git a/libs/dao-data/src/utils/proposalsStatus.ts b/libs/dao-data/src/utils/proposalsStatus.ts index b4d401d8a..26a99299a 100644 --- a/libs/dao-data/src/utils/proposalsStatus.ts +++ b/libs/dao-data/src/utils/proposalsStatus.ts @@ -6,13 +6,9 @@ import { import { QueryProposal } from '../types'; export const isProposalUnsponsored = (proposal: QueryProposal): boolean => { - const notExpired = - Number(proposal.expiration) > 0 || - Number(proposal.expiration) < - Number(proposal.votingPeriod) + - Number(proposal.gracePeriod) + - nowInSeconds(); - return !proposal.sponsored && !proposal.cancelled && notExpired; + return ( + !proposal.sponsored && !proposal.cancelled && !isProposalExpired(proposal) + ); }; export const isProposalCancelled = (proposal: QueryProposal): boolean => diff --git a/libs/tx-builder-feature/src/utils/multicall.ts b/libs/tx-builder-feature/src/utils/multicall.ts index 35f1f4444..60bbf573b 100644 --- a/libs/tx-builder-feature/src/utils/multicall.ts +++ b/libs/tx-builder-feature/src/utils/multicall.ts @@ -20,7 +20,7 @@ import { import { LOCAL_ABI } from '@daohaus/abi-utilities'; import { encodeMultiSend, MetaTransaction } from '@gnosis.pm/safe-contracts'; import { getAddress } from 'ethers/lib/utils'; -import { isSearchArg, processArg } from './args'; +import { processArg } from './args'; import { BaalContractBase, basicDetails, @@ -140,12 +140,12 @@ export const handleMulticallArg = async ({ if (data) { return { to: processedContract.address, - data: await processArg({ + data: (await processArg({ arg: data, chainId, localABIs, appState, - }) as string, + })) as string, value: processValue.toString(), operation: Number(processedOperations), };