diff --git a/packages/ui/.eslintrc b/packages/ui/.eslintrc index ec0dfc4a..191d3e83 100644 --- a/packages/ui/.eslintrc +++ b/packages/ui/.eslintrc @@ -61,5 +61,5 @@ } } ], - "ignorePatterns": ["src/interfaces/**/*", "types-and-hooks.tsx", "build"] + "ignorePatterns": ["src/interfaces/**/*", "types-and-hooks.tsx", "build", "src/gql"] } diff --git a/packages/ui/cypress/tests/address-bar.cy.ts b/packages/ui/cypress/tests/address-bar.cy.ts index deb4b79c..986075d3 100644 --- a/packages/ui/cypress/tests/address-bar.cy.ts +++ b/packages/ui/cypress/tests/address-bar.cy.ts @@ -281,7 +281,7 @@ describe('Account address in the address bar', () => { cy.url({ timeout: 3000 }).should('include', address) // react-router takes some time to get the search params inside the links - cy.wait(500) + cy.wait(1000) topMenuItems.homeButton().click() cy.url().should('include', address) diff --git a/packages/ui/cypress/tests/watched-accounts.cy.ts b/packages/ui/cypress/tests/watched-accounts.cy.ts index f606e640..a100cf7f 100644 --- a/packages/ui/cypress/tests/watched-accounts.cy.ts +++ b/packages/ui/cypress/tests/watched-accounts.cy.ts @@ -305,13 +305,13 @@ describe('Watched Accounts', () => { it('can see all multisigs that a watched signatory is a member of', () => { const { publicKey: signatoryPublicKey } = testAccounts['Multisig Member Account 1'] const expectedAddresses = [ - { - address: knownMultisigs['multisig-with-pure'].pureAddress, - expectedBadge: 'pure' - }, { address: knownMultisigs['test-simple-multisig-1'].address, expectedBadge: 'multi' + }, + { + address: knownMultisigs['multisig-with-pure'].pureAddress, + expectedBadge: 'pure' } ] diff --git a/packages/ui/src/contexts/MultiProxyContext.tsx b/packages/ui/src/contexts/MultiProxyContext.tsx index 45a94407..8f408fe8 100644 --- a/packages/ui/src/contexts/MultiProxyContext.tsx +++ b/packages/ui/src/contexts/MultiProxyContext.tsx @@ -1,15 +1,14 @@ import React, { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react' import { + MultisigsAndPureByAccountQuery, MultisigsBySignatoriesOrWatchedQuery, - ProxyType, - PureByIdsQuery + ProxyType } from '../../types-and-hooks' import { AccountBaseInfo } from '../components/select/GenericAccountSelection' -import { useQueryMultisigs } from '../hooks/useQueryMultisigs' +import { useQueryMultisigsAndPureByAccounts } from '../hooks/useQueryMultisigsAndPureByAccounts' import { useAccounts } from './AccountsContext' import { useWatchedAddresses } from './WatchedAddressesContext' import { useAccountId } from '../hooks/useAccountId' -import { useQueryPure } from '../hooks/useQueryPure' import { getMultiProxyAddress } from '../utils/getMultiProxyAddress' import { useSearchParams } from 'react-router' @@ -71,7 +70,6 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { ) // if set to null, it means that it hasn't been initialized yet const [multisigList, setMultisigList] = useState(null) - const [pureLinkedToMultisigs, setPureLinkedToMultisigs] = useState([]) const multiProxyList = useMemo(() => { return [...(pureProxyList || []), ...(multisigList || [])] }, [multisigList, pureProxyList]) @@ -98,8 +96,9 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { return getMultiProxyByAddress(selectedMultiProxyAddress) }, [getMultiProxyByAddress, selectedMultiProxyAddress]) + const selectedHasProxy = useMemo(() => !!selectedMultiProxy?.proxy, [selectedMultiProxy]) - const pureLinkedToMultisigsIds = useAccountId(pureLinkedToMultisigs) + // const pureLinkedToMultisigsIds = useAccountId(pureLinkedToMultisigs) // This is true if the currently Multiproxy passed as param contains no signatory // owned by the user this happens with a watched account @@ -128,6 +127,7 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { setMultisigList(null) setPureProxyList(null) }, []) + const setAddressInUrl = useCallback( (address: string) => { setSearchParams((prev) => { @@ -154,101 +154,32 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { const ownAddressIds = useAccountId(ownAddressList) const watchedAddressesIds = useAccountId(watchedAddresses) - const { - data: multisigData, - isLoading: isMultisigQueryLoading, - error: multisigQueryError, - refetch: refetchMultisigQuery - } = useQueryMultisigs({ - accountIds: ownAddressIds, - watchedAccountIds: watchedAddressesIds, - shouldRefetch: shouldPollMultisigs - }) - const { - data: pureQueryResultData, - isLoading: isPureQueryLoading, - error: isPureQueryError, - refetch: refetchPureQuery - } = useQueryPure({ - pureIds: [...watchedAddressesIds, ...pureLinkedToMultisigsIds], - shouldRefetch: shouldPollMultisigs - }) - const refreshPureToQueryAndMultisigList = useCallback( - (data: MultisigsBySignatoriesOrWatchedQuery) => { - // we do have an answer, but there is no multisig - if (!!data?.accountMultisigs && data.accountMultisigs.length === 0) { - setPureLinkedToMultisigs([]) - setMultisigList([]) - // watched addresses are part of the pure to query though - // only signal we're done querying by setting pureProxyList to [] - // if there are no watched addresses - watchedAddresses.length === 0 && setPureProxyList([]) - } + const refreshAccounList = useCallback((data: MultisigsAndPureByAccountQuery | null) => { + // we have no answer + if (!data) return - if (!!data?.accountMultisigs && data.accountMultisigs.length > 0) { - const pureToQuerySet = new Set() - const multisigMap = new Map() - - // iterate through the multisigs and populate the multiproxy map - // and the list of pure to query - data.accountMultisigs.forEach(({ multisig }) => { - const hasPureDelegation = - multisig.delegateeFor.length > 0 && - multisig.delegateeFor.some(({ delegator }) => delegator.isPureProxy) - // if the multisig is a delegatee for at least one pure - if (hasPureDelegation) { - // add the pures to the list to query if they are pure proxies - multisig.delegateeFor.forEach(({ delegator }) => { - delegator.isPureProxy && pureToQuerySet.add(delegator.address) - }) - } else { - // if this multisig doesn't have a proxy - // we add it to the map and it'll be in the multiproxylist right away - multisigMap.set(multisig.address, { - proxy: undefined, - multisigs: [ - { - address: multisig.address, - signatories: getSignatoriesFromAccount(multisig.signatories), - threshold: multisig.threshold - } - ] - } as MultiProxy) - } - }) - - // flatten out multisigMap - const multisigArray = Array.from(multisigMap.values()) - setMultisigList(multisigArray) - - // add the selection to the pure to query - setPureLinkedToMultisigs(Array.from(pureToQuerySet)) - - // if there is no pure to query, set the PureProxyList to empty array - // to signify that the pure proxies are done loading - pureToQuerySet.size === 0 && watchedAddresses.length === 0 && setPureProxyList([]) - } - }, - [watchedAddresses] - ) + // we do have an answer, but there is no multiproxy + if (data.accounts.length === 0) { + setMultisigList([]) + return + } - const refreshPureList = useCallback((data: PureByIdsQuery) => { + // map of the pure proxy addresses and the multisigs associated const pureProxyMap = new Map>() - // we do have an answer, but there is nothing - if (!!data?.accounts && data.accounts.length === 0) { - setPureProxyList([]) - } + // end result + const res: MultiProxy[] = [] - if (!!data?.accounts && data.accounts.length > 0) { - // any account here should be a pure proxy with some multisigs eventually - data.accounts.forEach((account) => { + // iterate through the multisigs and pure proxies + data.accounts.forEach((account) => { + // if the account is a pure proxy + if (account.isPureProxy) { // find the delegatee that are multisigs and put all the infos right away account.delegatorFor.forEach(({ delegatee, type }) => { if (delegatee.isMultisig) { const previousMultisigsForProxy = pureProxyMap.get(account.address)?.multisigs || [] - const isAlreadyInMultisigList = previousMultisigsForProxy.some( + const isAlreadyInMultisigList = !!previousMultisigsForProxy.find( ({ address }) => address === delegatee.address ) @@ -261,17 +192,75 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { threshold: delegatee?.threshold || undefined, type } - pureProxyMap.set(account.address, { multisigs: [...previousMultisigsForProxy, newMultisigForProxy] }) } }) - }) - } - // flatten out pureProxyMap - const pureProxyArray = Array.from(pureProxyMap.entries()).map( + return + } + + // from this point, we should only be dealing with multisigs + // looking for multisigs being delegatee for pure proxies + const pureProxyAddresses: { + pureAddress: string + type: ProxyType + }[] = [] + + // one multisig could be a delegator for multiple + account.isMultisig && + account.delegateeFor.forEach(({ delegator, type }) => { + // if a pure was already added, e.g because it is watched + // we shouldn't associate this multisig to it twice + const currentMultisigsForProxy = pureProxyMap + .get(delegator.address) + ?.multisigs.map(({ address }) => address) + + // finding all the accounts that are pure proxy and that don't include this multisig already + if (delegator?.isPureProxy && !currentMultisigsForProxy?.includes(account.address)) { + pureProxyAddresses.push({ + pureAddress: delegator.address, + type: type + }) + } + }) + + // if this account is a multisig and is the delegatee for at least a pureProxy + if (account.isMultisig && pureProxyAddresses?.length > 0) { + pureProxyAddresses.forEach(({ pureAddress, type }) => { + const previousMultisigsForProxy = pureProxyMap.get(pureAddress)?.multisigs || [] + const newMultisigForProxy = { + address: account.address, + signatories: getSignatoriesFromAccount(account.signatories), + threshold: account?.threshold || undefined, + type + } + + // add this pureProxy to the Map + pureProxyMap.set(pureAddress, { + multisigs: [...previousMultisigsForProxy, newMultisigForProxy] + }) + }) + } else if (account.isMultisig && pureProxyAddresses.length === 0) { + // if this multisig doesn't have a proxy + res.push({ + proxy: undefined, + multisigs: [ + { + address: account.address, + signatories: getSignatoriesFromAccount(account.signatories), + threshold: account.threshold + } + ] + } as MultiProxy) + } else { + console.error('Unexpected account, it should be a multisig', account) + } + }) + + // flatten out proxyMap + const proxyArray = Array.from(pureProxyMap.entries()).map( ([proxy, agg]) => ({ proxy, @@ -279,19 +268,26 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { }) as MultiProxy ) - setPureProxyList(pureProxyArray) + res.push(...proxyArray) + + setMultisigList(res) }, []) - useEffect(() => { - if (!multisigData) return - refreshPureToQueryAndMultisigList(multisigData) - }, [multisigData, refreshPureToQueryAndMultisigList]) + const { + data, + isLoading, + error: multisigQueryError, + refetch + } = useQueryMultisigsAndPureByAccounts({ + accountIds: ownAddressIds, + watchedAccountIds: watchedAddressesIds, + shouldRefetch: shouldPollMultisigs + }) useEffect(() => { - if (!pureQueryResultData) return - - refreshPureList(pureQueryResultData) - }, [pureQueryResultData, refreshPureList]) + if (!data) return + refreshAccounList(data) + }, [data, refetch, refreshAccounList]) const getMultisigByAddress = useCallback( (address: string) => { @@ -334,30 +330,6 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { [getMultiProxyByAddress, setAddressInUrl] ) - const refetch = useCallback(() => { - refetchMultisigQuery() - refetchPureQuery() - }, [refetchMultisigQuery, refetchPureQuery]) - - const isDoneFetchingIndexerInfo = useMemo(() => { - if (ownAddressList.length === 0 && watchedAddresses.length === 0) { - // nothing to fetch - return true - } - - if (multisigList === null || pureProxyList === null) { - // if any is null, we're still fetching - return false - } - - return true - }, [multisigList, ownAddressList, pureProxyList, watchedAddresses]) - - const isLoading = useMemo( - () => isMultisigQueryLoading || isPureQueryLoading || !isDoneFetchingIndexerInfo, - [isDoneFetchingIndexerInfo, isMultisigQueryLoading, isPureQueryLoading] - ) - const defaultAddress = useMemo(() => { if (multiProxyList?.length === 0 || isLoading) { return undefined @@ -376,7 +348,7 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { selectMultiProxy, isLoading, selectedHasProxy, - error: multisigQueryError || isPureQueryError, + error: multisigQueryError, getMultisigByAddress, getMultisigAsAccountBaseInfo, selectedIsWatched, diff --git a/packages/ui/src/gql/gql.ts b/packages/ui/src/gql/gql.ts index 242845a5..9612ba51 100644 --- a/packages/ui/src/gql/gql.ts +++ b/packages/ui/src/gql/gql.ts @@ -16,6 +16,7 @@ import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/ const documents = { "query MultisigById($id: String!) {\n accounts(where: {id_eq: $id, isMultisig_eq: true}) {\n id\n threshold\n signatories(limit: 50) {\n id\n signatory {\n id\n address\n }\n }\n }\n}": types.MultisigByIdDocument, "query MultisigCallsByMultisigId($multisigs: [String!]) {\n multisigCalls(\n limit: 10\n orderBy: timestamp_DESC\n where: {multisig: {id_in: $multisigs}}\n ) {\n id\n blockHash\n callIndex\n timestamp\n }\n}": types.MultisigCallsByMultisigIdDocument, + "query MultisigsAndPureByAccount($accountIds: [String!], $watchedAccountIds: [String!]) {\n accounts(\n where: {AND: [{OR: [{id_in: $watchedAccountIds}, {signatories_some: {signatory: {id_in: $accountIds}}}, {signatories_some: {signatory: {id_in: $watchedAccountIds}}}]}, {OR: [{isMultisig_eq: true}, {isPureProxy_eq: true}]}]}\n ) {\n id\n address\n isMultisig\n isPureProxy\n threshold\n signatories {\n id\n signatory {\n id\n address\n }\n }\n delegateeFor {\n id\n type\n delegator {\n id\n address\n isPureProxy\n }\n delegatee {\n id\n address\n isPureProxy\n }\n }\n delegatorFor {\n id\n type\n delegatee {\n id\n address\n isMultisig\n threshold\n signatories {\n id\n signatory {\n id\n address\n }\n }\n }\n }\n }\n}": types.MultisigsAndPureByAccountDocument, "query MultisigsByMultisigOrPureSignatories($accountIds: [String!]) {\n accountMultisigs(where: {signatory: {id_in: $accountIds}}, limit: 10) {\n id\n multisig {\n id\n address\n threshold\n signatories(limit: 10) {\n id\n signatory {\n id\n address\n }\n }\n }\n }\n}": types.MultisigsByMultisigOrPureSignatoriesDocument, "query MultisigsBySignatoriesOrWatched($accountIds: [String!], $watchedAccountIds: [String!]) {\n accountMultisigs(\n where: {OR: [{multisig: {id_in: $watchedAccountIds}}, {signatory: {id_in: $accountIds}}, {signatory: {id_in: $watchedAccountIds}}]}\n limit: 500\n ) {\n id\n multisig {\n id\n address\n threshold\n signatories(limit: 100) {\n id\n signatory {\n id\n address\n }\n }\n delegateeFor(limit: 100) {\n id\n type\n delegator {\n id\n address\n isPureProxy\n }\n }\n }\n }\n}": types.MultisigsBySignatoriesOrWatchedDocument, "query PureByIds($pureIds: [String!]) {\n accounts(where: {AND: [{id_in: $pureIds}, {isPureProxy_eq: true}]}, limit: 50) {\n id\n address\n delegatorFor(limit: 50) {\n id\n type\n delegatee {\n id\n address\n isMultisig\n threshold\n signatories(limit: 50) {\n id\n signatory {\n id\n address\n }\n }\n }\n }\n }\n}": types.PureByIdsDocument, @@ -43,6 +44,10 @@ export function graphql(source: "query MultisigById($id: String!) {\n accounts( * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql(source: "query MultisigCallsByMultisigId($multisigs: [String!]) {\n multisigCalls(\n limit: 10\n orderBy: timestamp_DESC\n where: {multisig: {id_in: $multisigs}}\n ) {\n id\n blockHash\n callIndex\n timestamp\n }\n}"): (typeof documents)["query MultisigCallsByMultisigId($multisigs: [String!]) {\n multisigCalls(\n limit: 10\n orderBy: timestamp_DESC\n where: {multisig: {id_in: $multisigs}}\n ) {\n id\n blockHash\n callIndex\n timestamp\n }\n}"]; +/** + * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. + */ +export function graphql(source: "query MultisigsAndPureByAccount($accountIds: [String!], $watchedAccountIds: [String!]) {\n accounts(\n where: {AND: [{OR: [{id_in: $watchedAccountIds}, {signatories_some: {signatory: {id_in: $accountIds}}}, {signatories_some: {signatory: {id_in: $watchedAccountIds}}}]}, {OR: [{isMultisig_eq: true}, {isPureProxy_eq: true}]}]}\n ) {\n id\n address\n isMultisig\n isPureProxy\n threshold\n signatories {\n id\n signatory {\n id\n address\n }\n }\n delegateeFor {\n id\n type\n delegator {\n id\n address\n isPureProxy\n }\n delegatee {\n id\n address\n isPureProxy\n }\n }\n delegatorFor {\n id\n type\n delegatee {\n id\n address\n isMultisig\n threshold\n signatories {\n id\n signatory {\n id\n address\n }\n }\n }\n }\n }\n}"): (typeof documents)["query MultisigsAndPureByAccount($accountIds: [String!], $watchedAccountIds: [String!]) {\n accounts(\n where: {AND: [{OR: [{id_in: $watchedAccountIds}, {signatories_some: {signatory: {id_in: $accountIds}}}, {signatories_some: {signatory: {id_in: $watchedAccountIds}}}]}, {OR: [{isMultisig_eq: true}, {isPureProxy_eq: true}]}]}\n ) {\n id\n address\n isMultisig\n isPureProxy\n threshold\n signatories {\n id\n signatory {\n id\n address\n }\n }\n delegateeFor {\n id\n type\n delegator {\n id\n address\n isPureProxy\n }\n delegatee {\n id\n address\n isPureProxy\n }\n }\n delegatorFor {\n id\n type\n delegatee {\n id\n address\n isMultisig\n threshold\n signatories {\n id\n signatory {\n id\n address\n }\n }\n }\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/packages/ui/src/gql/graphql.ts b/packages/ui/src/gql/graphql.ts index b4cbdb99..c8de5e93 100644 --- a/packages/ui/src/gql/graphql.ts +++ b/packages/ui/src/gql/graphql.ts @@ -94,47 +94,69 @@ export type AccountMultisigEdge = { export enum AccountMultisigOrderByInput { IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', MultisigAddressAsc = 'multisig_address_ASC', MultisigAddressAscNullsFirst = 'multisig_address_ASC_NULLS_FIRST', + MultisigAddressAscNullsLast = 'multisig_address_ASC_NULLS_LAST', MultisigAddressDesc = 'multisig_address_DESC', + MultisigAddressDescNullsFirst = 'multisig_address_DESC_NULLS_FIRST', MultisigAddressDescNullsLast = 'multisig_address_DESC_NULLS_LAST', MultisigIdAsc = 'multisig_id_ASC', MultisigIdAscNullsFirst = 'multisig_id_ASC_NULLS_FIRST', + MultisigIdAscNullsLast = 'multisig_id_ASC_NULLS_LAST', MultisigIdDesc = 'multisig_id_DESC', + MultisigIdDescNullsFirst = 'multisig_id_DESC_NULLS_FIRST', MultisigIdDescNullsLast = 'multisig_id_DESC_NULLS_LAST', MultisigIsMultisigAsc = 'multisig_isMultisig_ASC', MultisigIsMultisigAscNullsFirst = 'multisig_isMultisig_ASC_NULLS_FIRST', + MultisigIsMultisigAscNullsLast = 'multisig_isMultisig_ASC_NULLS_LAST', MultisigIsMultisigDesc = 'multisig_isMultisig_DESC', + MultisigIsMultisigDescNullsFirst = 'multisig_isMultisig_DESC_NULLS_FIRST', MultisigIsMultisigDescNullsLast = 'multisig_isMultisig_DESC_NULLS_LAST', MultisigIsPureProxyAsc = 'multisig_isPureProxy_ASC', MultisigIsPureProxyAscNullsFirst = 'multisig_isPureProxy_ASC_NULLS_FIRST', + MultisigIsPureProxyAscNullsLast = 'multisig_isPureProxy_ASC_NULLS_LAST', MultisigIsPureProxyDesc = 'multisig_isPureProxy_DESC', + MultisigIsPureProxyDescNullsFirst = 'multisig_isPureProxy_DESC_NULLS_FIRST', MultisigIsPureProxyDescNullsLast = 'multisig_isPureProxy_DESC_NULLS_LAST', MultisigThresholdAsc = 'multisig_threshold_ASC', MultisigThresholdAscNullsFirst = 'multisig_threshold_ASC_NULLS_FIRST', + MultisigThresholdAscNullsLast = 'multisig_threshold_ASC_NULLS_LAST', MultisigThresholdDesc = 'multisig_threshold_DESC', + MultisigThresholdDescNullsFirst = 'multisig_threshold_DESC_NULLS_FIRST', MultisigThresholdDescNullsLast = 'multisig_threshold_DESC_NULLS_LAST', SignatoryAddressAsc = 'signatory_address_ASC', SignatoryAddressAscNullsFirst = 'signatory_address_ASC_NULLS_FIRST', + SignatoryAddressAscNullsLast = 'signatory_address_ASC_NULLS_LAST', SignatoryAddressDesc = 'signatory_address_DESC', + SignatoryAddressDescNullsFirst = 'signatory_address_DESC_NULLS_FIRST', SignatoryAddressDescNullsLast = 'signatory_address_DESC_NULLS_LAST', SignatoryIdAsc = 'signatory_id_ASC', SignatoryIdAscNullsFirst = 'signatory_id_ASC_NULLS_FIRST', + SignatoryIdAscNullsLast = 'signatory_id_ASC_NULLS_LAST', SignatoryIdDesc = 'signatory_id_DESC', + SignatoryIdDescNullsFirst = 'signatory_id_DESC_NULLS_FIRST', SignatoryIdDescNullsLast = 'signatory_id_DESC_NULLS_LAST', SignatoryIsMultisigAsc = 'signatory_isMultisig_ASC', SignatoryIsMultisigAscNullsFirst = 'signatory_isMultisig_ASC_NULLS_FIRST', + SignatoryIsMultisigAscNullsLast = 'signatory_isMultisig_ASC_NULLS_LAST', SignatoryIsMultisigDesc = 'signatory_isMultisig_DESC', + SignatoryIsMultisigDescNullsFirst = 'signatory_isMultisig_DESC_NULLS_FIRST', SignatoryIsMultisigDescNullsLast = 'signatory_isMultisig_DESC_NULLS_LAST', SignatoryIsPureProxyAsc = 'signatory_isPureProxy_ASC', SignatoryIsPureProxyAscNullsFirst = 'signatory_isPureProxy_ASC_NULLS_FIRST', + SignatoryIsPureProxyAscNullsLast = 'signatory_isPureProxy_ASC_NULLS_LAST', SignatoryIsPureProxyDesc = 'signatory_isPureProxy_DESC', + SignatoryIsPureProxyDescNullsFirst = 'signatory_isPureProxy_DESC_NULLS_FIRST', SignatoryIsPureProxyDescNullsLast = 'signatory_isPureProxy_DESC_NULLS_LAST', SignatoryThresholdAsc = 'signatory_threshold_ASC', SignatoryThresholdAscNullsFirst = 'signatory_threshold_ASC_NULLS_FIRST', + SignatoryThresholdAscNullsLast = 'signatory_threshold_ASC_NULLS_LAST', SignatoryThresholdDesc = 'signatory_threshold_DESC', + SignatoryThresholdDescNullsFirst = 'signatory_threshold_DESC_NULLS_FIRST', SignatoryThresholdDescNullsLast = 'signatory_threshold_DESC_NULLS_LAST' } @@ -174,23 +196,33 @@ export type AccountMultisigsConnection = { export enum AccountOrderByInput { AddressAsc = 'address_ASC', AddressAscNullsFirst = 'address_ASC_NULLS_FIRST', + AddressAscNullsLast = 'address_ASC_NULLS_LAST', AddressDesc = 'address_DESC', + AddressDescNullsFirst = 'address_DESC_NULLS_FIRST', AddressDescNullsLast = 'address_DESC_NULLS_LAST', IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', IsMultisigAsc = 'isMultisig_ASC', IsMultisigAscNullsFirst = 'isMultisig_ASC_NULLS_FIRST', + IsMultisigAscNullsLast = 'isMultisig_ASC_NULLS_LAST', IsMultisigDesc = 'isMultisig_DESC', + IsMultisigDescNullsFirst = 'isMultisig_DESC_NULLS_FIRST', IsMultisigDescNullsLast = 'isMultisig_DESC_NULLS_LAST', IsPureProxyAsc = 'isPureProxy_ASC', IsPureProxyAscNullsFirst = 'isPureProxy_ASC_NULLS_FIRST', + IsPureProxyAscNullsLast = 'isPureProxy_ASC_NULLS_LAST', IsPureProxyDesc = 'isPureProxy_DESC', + IsPureProxyDescNullsFirst = 'isPureProxy_DESC_NULLS_FIRST', IsPureProxyDescNullsLast = 'isPureProxy_DESC_NULLS_LAST', ThresholdAsc = 'threshold_ASC', ThresholdAscNullsFirst = 'threshold_ASC_NULLS_FIRST', + ThresholdAscNullsLast = 'threshold_ASC_NULLS_LAST', ThresholdDesc = 'threshold_DESC', + ThresholdDescNullsFirst = 'threshold_DESC_NULLS_FIRST', ThresholdDescNullsLast = 'threshold_DESC_NULLS_LAST' } @@ -288,39 +320,57 @@ export type MultisigCallEdge = { export enum MultisigCallOrderByInput { BlockHashAsc = 'blockHash_ASC', BlockHashAscNullsFirst = 'blockHash_ASC_NULLS_FIRST', + BlockHashAscNullsLast = 'blockHash_ASC_NULLS_LAST', BlockHashDesc = 'blockHash_DESC', + BlockHashDescNullsFirst = 'blockHash_DESC_NULLS_FIRST', BlockHashDescNullsLast = 'blockHash_DESC_NULLS_LAST', CallIndexAsc = 'callIndex_ASC', CallIndexAscNullsFirst = 'callIndex_ASC_NULLS_FIRST', + CallIndexAscNullsLast = 'callIndex_ASC_NULLS_LAST', CallIndexDesc = 'callIndex_DESC', + CallIndexDescNullsFirst = 'callIndex_DESC_NULLS_FIRST', CallIndexDescNullsLast = 'callIndex_DESC_NULLS_LAST', IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', MultisigAddressAsc = 'multisig_address_ASC', MultisigAddressAscNullsFirst = 'multisig_address_ASC_NULLS_FIRST', + MultisigAddressAscNullsLast = 'multisig_address_ASC_NULLS_LAST', MultisigAddressDesc = 'multisig_address_DESC', + MultisigAddressDescNullsFirst = 'multisig_address_DESC_NULLS_FIRST', MultisigAddressDescNullsLast = 'multisig_address_DESC_NULLS_LAST', MultisigIdAsc = 'multisig_id_ASC', MultisigIdAscNullsFirst = 'multisig_id_ASC_NULLS_FIRST', + MultisigIdAscNullsLast = 'multisig_id_ASC_NULLS_LAST', MultisigIdDesc = 'multisig_id_DESC', + MultisigIdDescNullsFirst = 'multisig_id_DESC_NULLS_FIRST', MultisigIdDescNullsLast = 'multisig_id_DESC_NULLS_LAST', MultisigIsMultisigAsc = 'multisig_isMultisig_ASC', MultisigIsMultisigAscNullsFirst = 'multisig_isMultisig_ASC_NULLS_FIRST', + MultisigIsMultisigAscNullsLast = 'multisig_isMultisig_ASC_NULLS_LAST', MultisigIsMultisigDesc = 'multisig_isMultisig_DESC', + MultisigIsMultisigDescNullsFirst = 'multisig_isMultisig_DESC_NULLS_FIRST', MultisigIsMultisigDescNullsLast = 'multisig_isMultisig_DESC_NULLS_LAST', MultisigIsPureProxyAsc = 'multisig_isPureProxy_ASC', MultisigIsPureProxyAscNullsFirst = 'multisig_isPureProxy_ASC_NULLS_FIRST', + MultisigIsPureProxyAscNullsLast = 'multisig_isPureProxy_ASC_NULLS_LAST', MultisigIsPureProxyDesc = 'multisig_isPureProxy_DESC', + MultisigIsPureProxyDescNullsFirst = 'multisig_isPureProxy_DESC_NULLS_FIRST', MultisigIsPureProxyDescNullsLast = 'multisig_isPureProxy_DESC_NULLS_LAST', MultisigThresholdAsc = 'multisig_threshold_ASC', MultisigThresholdAscNullsFirst = 'multisig_threshold_ASC_NULLS_FIRST', + MultisigThresholdAscNullsLast = 'multisig_threshold_ASC_NULLS_LAST', MultisigThresholdDesc = 'multisig_threshold_DESC', + MultisigThresholdDescNullsFirst = 'multisig_threshold_DESC_NULLS_FIRST', MultisigThresholdDescNullsLast = 'multisig_threshold_DESC_NULLS_LAST', TimestampAsc = 'timestamp_ASC', TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampAscNullsLast = 'timestamp_ASC_NULLS_LAST', TimestampDesc = 'timestamp_DESC', + TimestampDescNullsFirst = 'timestamp_DESC_NULLS_FIRST', TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST' } @@ -419,67 +469,99 @@ export type ProxyAccountEdge = { export enum ProxyAccountOrderByInput { CreatedAtAsc = 'createdAt_ASC', CreatedAtAscNullsFirst = 'createdAt_ASC_NULLS_FIRST', + CreatedAtAscNullsLast = 'createdAt_ASC_NULLS_LAST', CreatedAtDesc = 'createdAt_DESC', + CreatedAtDescNullsFirst = 'createdAt_DESC_NULLS_FIRST', CreatedAtDescNullsLast = 'createdAt_DESC_NULLS_LAST', CreationBlockNumberAsc = 'creationBlockNumber_ASC', CreationBlockNumberAscNullsFirst = 'creationBlockNumber_ASC_NULLS_FIRST', + CreationBlockNumberAscNullsLast = 'creationBlockNumber_ASC_NULLS_LAST', CreationBlockNumberDesc = 'creationBlockNumber_DESC', + CreationBlockNumberDescNullsFirst = 'creationBlockNumber_DESC_NULLS_FIRST', CreationBlockNumberDescNullsLast = 'creationBlockNumber_DESC_NULLS_LAST', DelayAsc = 'delay_ASC', DelayAscNullsFirst = 'delay_ASC_NULLS_FIRST', + DelayAscNullsLast = 'delay_ASC_NULLS_LAST', DelayDesc = 'delay_DESC', + DelayDescNullsFirst = 'delay_DESC_NULLS_FIRST', DelayDescNullsLast = 'delay_DESC_NULLS_LAST', DelegateeAddressAsc = 'delegatee_address_ASC', DelegateeAddressAscNullsFirst = 'delegatee_address_ASC_NULLS_FIRST', + DelegateeAddressAscNullsLast = 'delegatee_address_ASC_NULLS_LAST', DelegateeAddressDesc = 'delegatee_address_DESC', + DelegateeAddressDescNullsFirst = 'delegatee_address_DESC_NULLS_FIRST', DelegateeAddressDescNullsLast = 'delegatee_address_DESC_NULLS_LAST', DelegateeIdAsc = 'delegatee_id_ASC', DelegateeIdAscNullsFirst = 'delegatee_id_ASC_NULLS_FIRST', + DelegateeIdAscNullsLast = 'delegatee_id_ASC_NULLS_LAST', DelegateeIdDesc = 'delegatee_id_DESC', + DelegateeIdDescNullsFirst = 'delegatee_id_DESC_NULLS_FIRST', DelegateeIdDescNullsLast = 'delegatee_id_DESC_NULLS_LAST', DelegateeIsMultisigAsc = 'delegatee_isMultisig_ASC', DelegateeIsMultisigAscNullsFirst = 'delegatee_isMultisig_ASC_NULLS_FIRST', + DelegateeIsMultisigAscNullsLast = 'delegatee_isMultisig_ASC_NULLS_LAST', DelegateeIsMultisigDesc = 'delegatee_isMultisig_DESC', + DelegateeIsMultisigDescNullsFirst = 'delegatee_isMultisig_DESC_NULLS_FIRST', DelegateeIsMultisigDescNullsLast = 'delegatee_isMultisig_DESC_NULLS_LAST', DelegateeIsPureProxyAsc = 'delegatee_isPureProxy_ASC', DelegateeIsPureProxyAscNullsFirst = 'delegatee_isPureProxy_ASC_NULLS_FIRST', + DelegateeIsPureProxyAscNullsLast = 'delegatee_isPureProxy_ASC_NULLS_LAST', DelegateeIsPureProxyDesc = 'delegatee_isPureProxy_DESC', + DelegateeIsPureProxyDescNullsFirst = 'delegatee_isPureProxy_DESC_NULLS_FIRST', DelegateeIsPureProxyDescNullsLast = 'delegatee_isPureProxy_DESC_NULLS_LAST', DelegateeThresholdAsc = 'delegatee_threshold_ASC', DelegateeThresholdAscNullsFirst = 'delegatee_threshold_ASC_NULLS_FIRST', + DelegateeThresholdAscNullsLast = 'delegatee_threshold_ASC_NULLS_LAST', DelegateeThresholdDesc = 'delegatee_threshold_DESC', + DelegateeThresholdDescNullsFirst = 'delegatee_threshold_DESC_NULLS_FIRST', DelegateeThresholdDescNullsLast = 'delegatee_threshold_DESC_NULLS_LAST', DelegatorAddressAsc = 'delegator_address_ASC', DelegatorAddressAscNullsFirst = 'delegator_address_ASC_NULLS_FIRST', + DelegatorAddressAscNullsLast = 'delegator_address_ASC_NULLS_LAST', DelegatorAddressDesc = 'delegator_address_DESC', + DelegatorAddressDescNullsFirst = 'delegator_address_DESC_NULLS_FIRST', DelegatorAddressDescNullsLast = 'delegator_address_DESC_NULLS_LAST', DelegatorIdAsc = 'delegator_id_ASC', DelegatorIdAscNullsFirst = 'delegator_id_ASC_NULLS_FIRST', + DelegatorIdAscNullsLast = 'delegator_id_ASC_NULLS_LAST', DelegatorIdDesc = 'delegator_id_DESC', + DelegatorIdDescNullsFirst = 'delegator_id_DESC_NULLS_FIRST', DelegatorIdDescNullsLast = 'delegator_id_DESC_NULLS_LAST', DelegatorIsMultisigAsc = 'delegator_isMultisig_ASC', DelegatorIsMultisigAscNullsFirst = 'delegator_isMultisig_ASC_NULLS_FIRST', + DelegatorIsMultisigAscNullsLast = 'delegator_isMultisig_ASC_NULLS_LAST', DelegatorIsMultisigDesc = 'delegator_isMultisig_DESC', + DelegatorIsMultisigDescNullsFirst = 'delegator_isMultisig_DESC_NULLS_FIRST', DelegatorIsMultisigDescNullsLast = 'delegator_isMultisig_DESC_NULLS_LAST', DelegatorIsPureProxyAsc = 'delegator_isPureProxy_ASC', DelegatorIsPureProxyAscNullsFirst = 'delegator_isPureProxy_ASC_NULLS_FIRST', + DelegatorIsPureProxyAscNullsLast = 'delegator_isPureProxy_ASC_NULLS_LAST', DelegatorIsPureProxyDesc = 'delegator_isPureProxy_DESC', + DelegatorIsPureProxyDescNullsFirst = 'delegator_isPureProxy_DESC_NULLS_FIRST', DelegatorIsPureProxyDescNullsLast = 'delegator_isPureProxy_DESC_NULLS_LAST', DelegatorThresholdAsc = 'delegator_threshold_ASC', DelegatorThresholdAscNullsFirst = 'delegator_threshold_ASC_NULLS_FIRST', + DelegatorThresholdAscNullsLast = 'delegator_threshold_ASC_NULLS_LAST', DelegatorThresholdDesc = 'delegator_threshold_DESC', + DelegatorThresholdDescNullsFirst = 'delegator_threshold_DESC_NULLS_FIRST', DelegatorThresholdDescNullsLast = 'delegator_threshold_DESC_NULLS_LAST', ExtrinsicIndexAsc = 'extrinsicIndex_ASC', ExtrinsicIndexAscNullsFirst = 'extrinsicIndex_ASC_NULLS_FIRST', + ExtrinsicIndexAscNullsLast = 'extrinsicIndex_ASC_NULLS_LAST', ExtrinsicIndexDesc = 'extrinsicIndex_DESC', + ExtrinsicIndexDescNullsFirst = 'extrinsicIndex_DESC_NULLS_FIRST', ExtrinsicIndexDescNullsLast = 'extrinsicIndex_DESC_NULLS_LAST', IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', TypeAsc = 'type_ASC', TypeAscNullsFirst = 'type_ASC_NULLS_FIRST', + TypeAscNullsLast = 'type_ASC_NULLS_LAST', TypeDesc = 'type_DESC', + TypeDescNullsFirst = 'type_DESC_NULLS_FIRST', TypeDescNullsLast = 'type_DESC_NULLS_LAST' } @@ -574,23 +656,15 @@ export enum ProxyType { export type Query = { __typename?: 'Query'; accountById?: Maybe; - /** @deprecated Use accountById */ - accountByUniqueInput?: Maybe; accountMultisigById?: Maybe; - /** @deprecated Use accountMultisigById */ - accountMultisigByUniqueInput?: Maybe; accountMultisigs: Array; accountMultisigsConnection: AccountMultisigsConnection; accounts: Array; accountsConnection: AccountsConnection; multisigCallById?: Maybe; - /** @deprecated Use multisigCallById */ - multisigCallByUniqueInput?: Maybe; multisigCalls: Array; multisigCallsConnection: MultisigCallsConnection; proxyAccountById?: Maybe; - /** @deprecated Use proxyAccountById */ - proxyAccountByUniqueInput?: Maybe; proxyAccounts: Array; proxyAccountsConnection: ProxyAccountsConnection; squidStatus?: Maybe; @@ -602,21 +676,11 @@ export type QueryAccountByIdArgs = { }; -export type QueryAccountByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryAccountMultisigByIdArgs = { id: Scalars['String']['input']; }; -export type QueryAccountMultisigByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryAccountMultisigsArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -654,11 +718,6 @@ export type QueryMultisigCallByIdArgs = { }; -export type QueryMultisigCallByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryMultisigCallsArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -680,11 +739,6 @@ export type QueryProxyAccountByIdArgs = { }; -export type QueryProxyAccountByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryProxyAccountsArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -702,14 +756,16 @@ export type QueryProxyAccountsConnectionArgs = { export type SquidStatus = { __typename?: 'SquidStatus'; - /** The height of the processed part of the chain */ + /** The hash of the last processed finalized block */ + finalizedHash?: Maybe; + /** The height of the last processed finalized block */ + finalizedHeight?: Maybe; + /** The hash of the last processed block */ + hash?: Maybe; + /** The height of the last processed block */ height?: Maybe; }; -export type WhereIdInput = { - id: Scalars['String']['input']; -}; - export type MultisigByIdQueryVariables = Exact<{ id: Scalars['String']['input']; }>; @@ -724,6 +780,14 @@ export type MultisigCallsByMultisigIdQueryVariables = Exact<{ export type MultisigCallsByMultisigIdQuery = { __typename?: 'Query', multisigCalls: Array<{ __typename?: 'MultisigCall', id: string, blockHash: string, callIndex: number, timestamp: any }> }; +export type MultisigsAndPureByAccountQueryVariables = Exact<{ + accountIds?: InputMaybe | Scalars['String']['input']>; + watchedAccountIds?: InputMaybe | Scalars['String']['input']>; +}>; + + +export type MultisigsAndPureByAccountQuery = { __typename?: 'Query', accounts: Array<{ __typename?: 'Account', id: string, address: string, isMultisig?: boolean | null, isPureProxy?: boolean | null, threshold?: number | null, signatories: Array<{ __typename?: 'AccountMultisig', id: string, signatory: { __typename?: 'Account', id: string, address: string } }>, delegateeFor: Array<{ __typename?: 'ProxyAccount', id: string, type: ProxyType, delegator: { __typename?: 'Account', id: string, address: string, isPureProxy?: boolean | null }, delegatee: { __typename?: 'Account', id: string, address: string, isPureProxy?: boolean | null } }>, delegatorFor: Array<{ __typename?: 'ProxyAccount', id: string, type: ProxyType, delegatee: { __typename?: 'Account', id: string, address: string, isMultisig?: boolean | null, threshold?: number | null, signatories: Array<{ __typename?: 'AccountMultisig', id: string, signatory: { __typename?: 'Account', id: string, address: string } }> } }> }> }; + export type MultisigsByMultisigOrPureSignatoriesQueryVariables = Exact<{ accountIds?: InputMaybe | Scalars['String']['input']>; }>; @@ -749,6 +813,7 @@ export type PureByIdsQuery = { __typename?: 'Query', accounts: Array<{ __typenam export const MultisigByIdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MultisigById"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"id"}},"type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_eq"},"value":{"kind":"Variable","name":{"kind":"Name","value":"id"}}},{"kind":"ObjectField","name":{"kind":"Name","value":"isMultisig_eq"},"value":{"kind":"BooleanValue","value":true}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"threshold"}},{"kind":"Field","name":{"kind":"Name","value":"signatories"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"50"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signatory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const MultisigCallsByMultisigIdDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MultisigCallsByMultisigId"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"multisigs"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"multisigCalls"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"10"}},{"kind":"Argument","name":{"kind":"Name","value":"orderBy"},"value":{"kind":"EnumValue","value":"timestamp_DESC"}},{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"multisig"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"multisigs"}}}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"blockHash"}},{"kind":"Field","name":{"kind":"Name","value":"callIndex"}},{"kind":"Field","name":{"kind":"Name","value":"timestamp"}}]}}]}}]} as unknown as DocumentNode; +export const MultisigsAndPureByAccountDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MultisigsAndPureByAccount"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"accountIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"watchedAccountIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"AND"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"OR"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"watchedAccountIds"}}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"signatories_some"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"signatory"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"accountIds"}}}]}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"signatories_some"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"signatory"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"watchedAccountIds"}}}]}}]}}]}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"OR"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"isMultisig_eq"},"value":{"kind":"BooleanValue","value":true}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"isPureProxy_eq"},"value":{"kind":"BooleanValue","value":true}}]}]}}]}]}}]}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"isMultisig"}},{"kind":"Field","name":{"kind":"Name","value":"isPureProxy"}},{"kind":"Field","name":{"kind":"Name","value":"threshold"}},{"kind":"Field","name":{"kind":"Name","value":"signatories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signatory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"delegateeFor"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"delegator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"isPureProxy"}}]}},{"kind":"Field","name":{"kind":"Name","value":"delegatee"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"isPureProxy"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"delegatorFor"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"delegatee"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"isMultisig"}},{"kind":"Field","name":{"kind":"Name","value":"threshold"}},{"kind":"Field","name":{"kind":"Name","value":"signatories"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signatory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const MultisigsByMultisigOrPureSignatoriesDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MultisigsByMultisigOrPureSignatories"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"accountIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountMultisigs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"signatory"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"accountIds"}}}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"10"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"multisig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"threshold"}},{"kind":"Field","name":{"kind":"Name","value":"signatories"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"10"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signatory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const MultisigsBySignatoriesOrWatchedDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"MultisigsBySignatoriesOrWatched"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"accountIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}},{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"watchedAccountIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accountMultisigs"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"OR"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"multisig"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"watchedAccountIds"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"signatory"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"accountIds"}}}]}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"signatory"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"watchedAccountIds"}}}]}}]}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"500"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"multisig"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"threshold"}},{"kind":"Field","name":{"kind":"Name","value":"signatories"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"100"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signatory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}}]}}]}},{"kind":"Field","name":{"kind":"Name","value":"delegateeFor"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"100"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"delegator"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"isPureProxy"}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; export const PureByIdsDocument = {"kind":"Document","definitions":[{"kind":"OperationDefinition","operation":"query","name":{"kind":"Name","value":"PureByIds"},"variableDefinitions":[{"kind":"VariableDefinition","variable":{"kind":"Variable","name":{"kind":"Name","value":"pureIds"}},"type":{"kind":"ListType","type":{"kind":"NonNullType","type":{"kind":"NamedType","name":{"kind":"Name","value":"String"}}}}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"accounts"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"where"},"value":{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"AND"},"value":{"kind":"ListValue","values":[{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"id_in"},"value":{"kind":"Variable","name":{"kind":"Name","value":"pureIds"}}}]},{"kind":"ObjectValue","fields":[{"kind":"ObjectField","name":{"kind":"Name","value":"isPureProxy_eq"},"value":{"kind":"BooleanValue","value":true}}]}]}}]}},{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"50"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"delegatorFor"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"50"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"type"}},{"kind":"Field","name":{"kind":"Name","value":"delegatee"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}},{"kind":"Field","name":{"kind":"Name","value":"isMultisig"}},{"kind":"Field","name":{"kind":"Name","value":"threshold"}},{"kind":"Field","name":{"kind":"Name","value":"signatories"},"arguments":[{"kind":"Argument","name":{"kind":"Name","value":"limit"},"value":{"kind":"IntValue","value":"50"}}],"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"signatory"},"selectionSet":{"kind":"SelectionSet","selections":[{"kind":"Field","name":{"kind":"Name","value":"id"}},{"kind":"Field","name":{"kind":"Name","value":"address"}}]}}]}}]}}]}}]}}]}}]} as unknown as DocumentNode; \ No newline at end of file diff --git a/packages/ui/src/gql/index.ts b/packages/ui/src/gql/index.ts index f9bc8e59..f5159916 100644 --- a/packages/ui/src/gql/index.ts +++ b/packages/ui/src/gql/index.ts @@ -1,2 +1,2 @@ -export * from './fragment-masking' -export * from './gql' +export * from "./fragment-masking"; +export * from "./gql"; \ No newline at end of file diff --git a/packages/ui/src/hooks/useQueryMultisigs.tsx b/packages/ui/src/hooks/useQueryMultisigsAndPureByAccounts.tsx similarity index 80% rename from packages/ui/src/hooks/useQueryMultisigs.tsx rename to packages/ui/src/hooks/useQueryMultisigsAndPureByAccounts.tsx index 2f92f1ce..c747f2ce 100644 --- a/packages/ui/src/hooks/useQueryMultisigs.tsx +++ b/packages/ui/src/hooks/useQueryMultisigsAndPureByAccounts.tsx @@ -1,4 +1,4 @@ -import { useMultisigsBySignatoriesOrWatchedQuery } from '../../types-and-hooks' +import { useMultisigsAndPureByAccountQuery } from '../../types-and-hooks' import { useMemo } from 'react' import { useNetwork } from '../contexts/NetworkContext' @@ -10,7 +10,7 @@ interface Args { shouldRefetch?: boolean } -export const useQueryMultisigs = ({ +export const useQueryMultisigsAndPureByAccounts = ({ accountIds, watchedAccountIds, shouldRefetch = false @@ -20,7 +20,7 @@ export const useQueryMultisigs = ({ () => accountIds.length > 0 || watchedAccountIds.length > 0, [accountIds, watchedAccountIds] ) - const { error, data, isLoading, refetch } = useMultisigsBySignatoriesOrWatchedQuery( + const { error, data, isLoading, refetch } = useMultisigsAndPureByAccountQuery( { accountIds, watchedAccountIds }, { enabled: hasSomethingToQuery, diff --git a/packages/ui/src/hooks/useQueryPure.tsx b/packages/ui/src/hooks/useQueryPure.tsx deleted file mode 100644 index 9f58f316..00000000 --- a/packages/ui/src/hooks/useQueryPure.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { usePureByIdsQuery } from '../../types-and-hooks' -import { useMemo } from 'react' -import { useNetwork } from '../contexts/NetworkContext' - -const DEFAULT_REFETCH_INTERVAL = 5000 - -interface Args { - pureIds: string[] - shouldRefetch: boolean -} - -export const useQueryPure = ({ pureIds, shouldRefetch = false }: Args) => { - const { selectedNetwork } = useNetwork() - const hasSomethingToQuery = useMemo(() => pureIds.length > 0, [pureIds]) - - const { error, data, isLoading, refetch } = usePureByIdsQuery( - { pureIds }, - { - enabled: hasSomethingToQuery, - queryKey: [`KeyPureByIde-${pureIds}-${selectedNetwork}`], - refetchInterval: !!shouldRefetch && DEFAULT_REFETCH_INTERVAL - } - ) - - return { data, isLoading: isLoading && hasSomethingToQuery, error, refetch } -} diff --git a/packages/ui/src/queries/multisigsAndPureByAccount.graphql b/packages/ui/src/queries/multisigsAndPureByAccount.graphql new file mode 100644 index 00000000..3a543a88 --- /dev/null +++ b/packages/ui/src/queries/multisigsAndPureByAccount.graphql @@ -0,0 +1,62 @@ +query MultisigsAndPureByAccount($accountIds: [String!], $watchedAccountIds: [String!]) { + accounts( + where: { + AND: [ + { + OR: [ + { id_in: $watchedAccountIds } + { signatories_some: { signatory: { id_in: $accountIds } } } + { signatories_some: { signatory: { id_in: $watchedAccountIds } } } + ] + } + { OR: [{ isMultisig_eq: true }, { isPureProxy_eq: true }] } + ] + } + ) { + # either it's a multisig or proxy, with direct address match from a watch account + # or one of accounts or watch accounts is a signatory + id + address + isMultisig + isPureProxy + threshold + signatories { + id + signatory { + id + address + } + } + delegateeFor { + id + type + delegator { + id + address + isPureProxy + } + delegatee { + id + address + isPureProxy + } + } + delegatorFor { + id + type + delegatee { + id + address + isMultisig + threshold + signatories { + id + signatory { + id + address + } + } + } + } + } +} diff --git a/packages/ui/types-and-hooks.tsx b/packages/ui/types-and-hooks.tsx index fa43c73a..ff3ab871 100644 --- a/packages/ui/types-and-hooks.tsx +++ b/packages/ui/types-and-hooks.tsx @@ -93,47 +93,69 @@ export type AccountMultisigEdge = { export enum AccountMultisigOrderByInput { IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', MultisigAddressAsc = 'multisig_address_ASC', MultisigAddressAscNullsFirst = 'multisig_address_ASC_NULLS_FIRST', + MultisigAddressAscNullsLast = 'multisig_address_ASC_NULLS_LAST', MultisigAddressDesc = 'multisig_address_DESC', + MultisigAddressDescNullsFirst = 'multisig_address_DESC_NULLS_FIRST', MultisigAddressDescNullsLast = 'multisig_address_DESC_NULLS_LAST', MultisigIdAsc = 'multisig_id_ASC', MultisigIdAscNullsFirst = 'multisig_id_ASC_NULLS_FIRST', + MultisigIdAscNullsLast = 'multisig_id_ASC_NULLS_LAST', MultisigIdDesc = 'multisig_id_DESC', + MultisigIdDescNullsFirst = 'multisig_id_DESC_NULLS_FIRST', MultisigIdDescNullsLast = 'multisig_id_DESC_NULLS_LAST', MultisigIsMultisigAsc = 'multisig_isMultisig_ASC', MultisigIsMultisigAscNullsFirst = 'multisig_isMultisig_ASC_NULLS_FIRST', + MultisigIsMultisigAscNullsLast = 'multisig_isMultisig_ASC_NULLS_LAST', MultisigIsMultisigDesc = 'multisig_isMultisig_DESC', + MultisigIsMultisigDescNullsFirst = 'multisig_isMultisig_DESC_NULLS_FIRST', MultisigIsMultisigDescNullsLast = 'multisig_isMultisig_DESC_NULLS_LAST', MultisigIsPureProxyAsc = 'multisig_isPureProxy_ASC', MultisigIsPureProxyAscNullsFirst = 'multisig_isPureProxy_ASC_NULLS_FIRST', + MultisigIsPureProxyAscNullsLast = 'multisig_isPureProxy_ASC_NULLS_LAST', MultisigIsPureProxyDesc = 'multisig_isPureProxy_DESC', + MultisigIsPureProxyDescNullsFirst = 'multisig_isPureProxy_DESC_NULLS_FIRST', MultisigIsPureProxyDescNullsLast = 'multisig_isPureProxy_DESC_NULLS_LAST', MultisigThresholdAsc = 'multisig_threshold_ASC', MultisigThresholdAscNullsFirst = 'multisig_threshold_ASC_NULLS_FIRST', + MultisigThresholdAscNullsLast = 'multisig_threshold_ASC_NULLS_LAST', MultisigThresholdDesc = 'multisig_threshold_DESC', + MultisigThresholdDescNullsFirst = 'multisig_threshold_DESC_NULLS_FIRST', MultisigThresholdDescNullsLast = 'multisig_threshold_DESC_NULLS_LAST', SignatoryAddressAsc = 'signatory_address_ASC', SignatoryAddressAscNullsFirst = 'signatory_address_ASC_NULLS_FIRST', + SignatoryAddressAscNullsLast = 'signatory_address_ASC_NULLS_LAST', SignatoryAddressDesc = 'signatory_address_DESC', + SignatoryAddressDescNullsFirst = 'signatory_address_DESC_NULLS_FIRST', SignatoryAddressDescNullsLast = 'signatory_address_DESC_NULLS_LAST', SignatoryIdAsc = 'signatory_id_ASC', SignatoryIdAscNullsFirst = 'signatory_id_ASC_NULLS_FIRST', + SignatoryIdAscNullsLast = 'signatory_id_ASC_NULLS_LAST', SignatoryIdDesc = 'signatory_id_DESC', + SignatoryIdDescNullsFirst = 'signatory_id_DESC_NULLS_FIRST', SignatoryIdDescNullsLast = 'signatory_id_DESC_NULLS_LAST', SignatoryIsMultisigAsc = 'signatory_isMultisig_ASC', SignatoryIsMultisigAscNullsFirst = 'signatory_isMultisig_ASC_NULLS_FIRST', + SignatoryIsMultisigAscNullsLast = 'signatory_isMultisig_ASC_NULLS_LAST', SignatoryIsMultisigDesc = 'signatory_isMultisig_DESC', + SignatoryIsMultisigDescNullsFirst = 'signatory_isMultisig_DESC_NULLS_FIRST', SignatoryIsMultisigDescNullsLast = 'signatory_isMultisig_DESC_NULLS_LAST', SignatoryIsPureProxyAsc = 'signatory_isPureProxy_ASC', SignatoryIsPureProxyAscNullsFirst = 'signatory_isPureProxy_ASC_NULLS_FIRST', + SignatoryIsPureProxyAscNullsLast = 'signatory_isPureProxy_ASC_NULLS_LAST', SignatoryIsPureProxyDesc = 'signatory_isPureProxy_DESC', + SignatoryIsPureProxyDescNullsFirst = 'signatory_isPureProxy_DESC_NULLS_FIRST', SignatoryIsPureProxyDescNullsLast = 'signatory_isPureProxy_DESC_NULLS_LAST', SignatoryThresholdAsc = 'signatory_threshold_ASC', SignatoryThresholdAscNullsFirst = 'signatory_threshold_ASC_NULLS_FIRST', + SignatoryThresholdAscNullsLast = 'signatory_threshold_ASC_NULLS_LAST', SignatoryThresholdDesc = 'signatory_threshold_DESC', + SignatoryThresholdDescNullsFirst = 'signatory_threshold_DESC_NULLS_FIRST', SignatoryThresholdDescNullsLast = 'signatory_threshold_DESC_NULLS_LAST' } @@ -173,23 +195,33 @@ export type AccountMultisigsConnection = { export enum AccountOrderByInput { AddressAsc = 'address_ASC', AddressAscNullsFirst = 'address_ASC_NULLS_FIRST', + AddressAscNullsLast = 'address_ASC_NULLS_LAST', AddressDesc = 'address_DESC', + AddressDescNullsFirst = 'address_DESC_NULLS_FIRST', AddressDescNullsLast = 'address_DESC_NULLS_LAST', IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', IsMultisigAsc = 'isMultisig_ASC', IsMultisigAscNullsFirst = 'isMultisig_ASC_NULLS_FIRST', + IsMultisigAscNullsLast = 'isMultisig_ASC_NULLS_LAST', IsMultisigDesc = 'isMultisig_DESC', + IsMultisigDescNullsFirst = 'isMultisig_DESC_NULLS_FIRST', IsMultisigDescNullsLast = 'isMultisig_DESC_NULLS_LAST', IsPureProxyAsc = 'isPureProxy_ASC', IsPureProxyAscNullsFirst = 'isPureProxy_ASC_NULLS_FIRST', + IsPureProxyAscNullsLast = 'isPureProxy_ASC_NULLS_LAST', IsPureProxyDesc = 'isPureProxy_DESC', + IsPureProxyDescNullsFirst = 'isPureProxy_DESC_NULLS_FIRST', IsPureProxyDescNullsLast = 'isPureProxy_DESC_NULLS_LAST', ThresholdAsc = 'threshold_ASC', ThresholdAscNullsFirst = 'threshold_ASC_NULLS_FIRST', + ThresholdAscNullsLast = 'threshold_ASC_NULLS_LAST', ThresholdDesc = 'threshold_DESC', + ThresholdDescNullsFirst = 'threshold_DESC_NULLS_FIRST', ThresholdDescNullsLast = 'threshold_DESC_NULLS_LAST' } @@ -287,39 +319,57 @@ export type MultisigCallEdge = { export enum MultisigCallOrderByInput { BlockHashAsc = 'blockHash_ASC', BlockHashAscNullsFirst = 'blockHash_ASC_NULLS_FIRST', + BlockHashAscNullsLast = 'blockHash_ASC_NULLS_LAST', BlockHashDesc = 'blockHash_DESC', + BlockHashDescNullsFirst = 'blockHash_DESC_NULLS_FIRST', BlockHashDescNullsLast = 'blockHash_DESC_NULLS_LAST', CallIndexAsc = 'callIndex_ASC', CallIndexAscNullsFirst = 'callIndex_ASC_NULLS_FIRST', + CallIndexAscNullsLast = 'callIndex_ASC_NULLS_LAST', CallIndexDesc = 'callIndex_DESC', + CallIndexDescNullsFirst = 'callIndex_DESC_NULLS_FIRST', CallIndexDescNullsLast = 'callIndex_DESC_NULLS_LAST', IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', MultisigAddressAsc = 'multisig_address_ASC', MultisigAddressAscNullsFirst = 'multisig_address_ASC_NULLS_FIRST', + MultisigAddressAscNullsLast = 'multisig_address_ASC_NULLS_LAST', MultisigAddressDesc = 'multisig_address_DESC', + MultisigAddressDescNullsFirst = 'multisig_address_DESC_NULLS_FIRST', MultisigAddressDescNullsLast = 'multisig_address_DESC_NULLS_LAST', MultisigIdAsc = 'multisig_id_ASC', MultisigIdAscNullsFirst = 'multisig_id_ASC_NULLS_FIRST', + MultisigIdAscNullsLast = 'multisig_id_ASC_NULLS_LAST', MultisigIdDesc = 'multisig_id_DESC', + MultisigIdDescNullsFirst = 'multisig_id_DESC_NULLS_FIRST', MultisigIdDescNullsLast = 'multisig_id_DESC_NULLS_LAST', MultisigIsMultisigAsc = 'multisig_isMultisig_ASC', MultisigIsMultisigAscNullsFirst = 'multisig_isMultisig_ASC_NULLS_FIRST', + MultisigIsMultisigAscNullsLast = 'multisig_isMultisig_ASC_NULLS_LAST', MultisigIsMultisigDesc = 'multisig_isMultisig_DESC', + MultisigIsMultisigDescNullsFirst = 'multisig_isMultisig_DESC_NULLS_FIRST', MultisigIsMultisigDescNullsLast = 'multisig_isMultisig_DESC_NULLS_LAST', MultisigIsPureProxyAsc = 'multisig_isPureProxy_ASC', MultisigIsPureProxyAscNullsFirst = 'multisig_isPureProxy_ASC_NULLS_FIRST', + MultisigIsPureProxyAscNullsLast = 'multisig_isPureProxy_ASC_NULLS_LAST', MultisigIsPureProxyDesc = 'multisig_isPureProxy_DESC', + MultisigIsPureProxyDescNullsFirst = 'multisig_isPureProxy_DESC_NULLS_FIRST', MultisigIsPureProxyDescNullsLast = 'multisig_isPureProxy_DESC_NULLS_LAST', MultisigThresholdAsc = 'multisig_threshold_ASC', MultisigThresholdAscNullsFirst = 'multisig_threshold_ASC_NULLS_FIRST', + MultisigThresholdAscNullsLast = 'multisig_threshold_ASC_NULLS_LAST', MultisigThresholdDesc = 'multisig_threshold_DESC', + MultisigThresholdDescNullsFirst = 'multisig_threshold_DESC_NULLS_FIRST', MultisigThresholdDescNullsLast = 'multisig_threshold_DESC_NULLS_LAST', TimestampAsc = 'timestamp_ASC', TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampAscNullsLast = 'timestamp_ASC_NULLS_LAST', TimestampDesc = 'timestamp_DESC', + TimestampDescNullsFirst = 'timestamp_DESC_NULLS_FIRST', TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST' } @@ -418,67 +468,99 @@ export type ProxyAccountEdge = { export enum ProxyAccountOrderByInput { CreatedAtAsc = 'createdAt_ASC', CreatedAtAscNullsFirst = 'createdAt_ASC_NULLS_FIRST', + CreatedAtAscNullsLast = 'createdAt_ASC_NULLS_LAST', CreatedAtDesc = 'createdAt_DESC', + CreatedAtDescNullsFirst = 'createdAt_DESC_NULLS_FIRST', CreatedAtDescNullsLast = 'createdAt_DESC_NULLS_LAST', CreationBlockNumberAsc = 'creationBlockNumber_ASC', CreationBlockNumberAscNullsFirst = 'creationBlockNumber_ASC_NULLS_FIRST', + CreationBlockNumberAscNullsLast = 'creationBlockNumber_ASC_NULLS_LAST', CreationBlockNumberDesc = 'creationBlockNumber_DESC', + CreationBlockNumberDescNullsFirst = 'creationBlockNumber_DESC_NULLS_FIRST', CreationBlockNumberDescNullsLast = 'creationBlockNumber_DESC_NULLS_LAST', DelayAsc = 'delay_ASC', DelayAscNullsFirst = 'delay_ASC_NULLS_FIRST', + DelayAscNullsLast = 'delay_ASC_NULLS_LAST', DelayDesc = 'delay_DESC', + DelayDescNullsFirst = 'delay_DESC_NULLS_FIRST', DelayDescNullsLast = 'delay_DESC_NULLS_LAST', DelegateeAddressAsc = 'delegatee_address_ASC', DelegateeAddressAscNullsFirst = 'delegatee_address_ASC_NULLS_FIRST', + DelegateeAddressAscNullsLast = 'delegatee_address_ASC_NULLS_LAST', DelegateeAddressDesc = 'delegatee_address_DESC', + DelegateeAddressDescNullsFirst = 'delegatee_address_DESC_NULLS_FIRST', DelegateeAddressDescNullsLast = 'delegatee_address_DESC_NULLS_LAST', DelegateeIdAsc = 'delegatee_id_ASC', DelegateeIdAscNullsFirst = 'delegatee_id_ASC_NULLS_FIRST', + DelegateeIdAscNullsLast = 'delegatee_id_ASC_NULLS_LAST', DelegateeIdDesc = 'delegatee_id_DESC', + DelegateeIdDescNullsFirst = 'delegatee_id_DESC_NULLS_FIRST', DelegateeIdDescNullsLast = 'delegatee_id_DESC_NULLS_LAST', DelegateeIsMultisigAsc = 'delegatee_isMultisig_ASC', DelegateeIsMultisigAscNullsFirst = 'delegatee_isMultisig_ASC_NULLS_FIRST', + DelegateeIsMultisigAscNullsLast = 'delegatee_isMultisig_ASC_NULLS_LAST', DelegateeIsMultisigDesc = 'delegatee_isMultisig_DESC', + DelegateeIsMultisigDescNullsFirst = 'delegatee_isMultisig_DESC_NULLS_FIRST', DelegateeIsMultisigDescNullsLast = 'delegatee_isMultisig_DESC_NULLS_LAST', DelegateeIsPureProxyAsc = 'delegatee_isPureProxy_ASC', DelegateeIsPureProxyAscNullsFirst = 'delegatee_isPureProxy_ASC_NULLS_FIRST', + DelegateeIsPureProxyAscNullsLast = 'delegatee_isPureProxy_ASC_NULLS_LAST', DelegateeIsPureProxyDesc = 'delegatee_isPureProxy_DESC', + DelegateeIsPureProxyDescNullsFirst = 'delegatee_isPureProxy_DESC_NULLS_FIRST', DelegateeIsPureProxyDescNullsLast = 'delegatee_isPureProxy_DESC_NULLS_LAST', DelegateeThresholdAsc = 'delegatee_threshold_ASC', DelegateeThresholdAscNullsFirst = 'delegatee_threshold_ASC_NULLS_FIRST', + DelegateeThresholdAscNullsLast = 'delegatee_threshold_ASC_NULLS_LAST', DelegateeThresholdDesc = 'delegatee_threshold_DESC', + DelegateeThresholdDescNullsFirst = 'delegatee_threshold_DESC_NULLS_FIRST', DelegateeThresholdDescNullsLast = 'delegatee_threshold_DESC_NULLS_LAST', DelegatorAddressAsc = 'delegator_address_ASC', DelegatorAddressAscNullsFirst = 'delegator_address_ASC_NULLS_FIRST', + DelegatorAddressAscNullsLast = 'delegator_address_ASC_NULLS_LAST', DelegatorAddressDesc = 'delegator_address_DESC', + DelegatorAddressDescNullsFirst = 'delegator_address_DESC_NULLS_FIRST', DelegatorAddressDescNullsLast = 'delegator_address_DESC_NULLS_LAST', DelegatorIdAsc = 'delegator_id_ASC', DelegatorIdAscNullsFirst = 'delegator_id_ASC_NULLS_FIRST', + DelegatorIdAscNullsLast = 'delegator_id_ASC_NULLS_LAST', DelegatorIdDesc = 'delegator_id_DESC', + DelegatorIdDescNullsFirst = 'delegator_id_DESC_NULLS_FIRST', DelegatorIdDescNullsLast = 'delegator_id_DESC_NULLS_LAST', DelegatorIsMultisigAsc = 'delegator_isMultisig_ASC', DelegatorIsMultisigAscNullsFirst = 'delegator_isMultisig_ASC_NULLS_FIRST', + DelegatorIsMultisigAscNullsLast = 'delegator_isMultisig_ASC_NULLS_LAST', DelegatorIsMultisigDesc = 'delegator_isMultisig_DESC', + DelegatorIsMultisigDescNullsFirst = 'delegator_isMultisig_DESC_NULLS_FIRST', DelegatorIsMultisigDescNullsLast = 'delegator_isMultisig_DESC_NULLS_LAST', DelegatorIsPureProxyAsc = 'delegator_isPureProxy_ASC', DelegatorIsPureProxyAscNullsFirst = 'delegator_isPureProxy_ASC_NULLS_FIRST', + DelegatorIsPureProxyAscNullsLast = 'delegator_isPureProxy_ASC_NULLS_LAST', DelegatorIsPureProxyDesc = 'delegator_isPureProxy_DESC', + DelegatorIsPureProxyDescNullsFirst = 'delegator_isPureProxy_DESC_NULLS_FIRST', DelegatorIsPureProxyDescNullsLast = 'delegator_isPureProxy_DESC_NULLS_LAST', DelegatorThresholdAsc = 'delegator_threshold_ASC', DelegatorThresholdAscNullsFirst = 'delegator_threshold_ASC_NULLS_FIRST', + DelegatorThresholdAscNullsLast = 'delegator_threshold_ASC_NULLS_LAST', DelegatorThresholdDesc = 'delegator_threshold_DESC', + DelegatorThresholdDescNullsFirst = 'delegator_threshold_DESC_NULLS_FIRST', DelegatorThresholdDescNullsLast = 'delegator_threshold_DESC_NULLS_LAST', ExtrinsicIndexAsc = 'extrinsicIndex_ASC', ExtrinsicIndexAscNullsFirst = 'extrinsicIndex_ASC_NULLS_FIRST', + ExtrinsicIndexAscNullsLast = 'extrinsicIndex_ASC_NULLS_LAST', ExtrinsicIndexDesc = 'extrinsicIndex_DESC', + ExtrinsicIndexDescNullsFirst = 'extrinsicIndex_DESC_NULLS_FIRST', ExtrinsicIndexDescNullsLast = 'extrinsicIndex_DESC_NULLS_LAST', IdAsc = 'id_ASC', IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdAscNullsLast = 'id_ASC_NULLS_LAST', IdDesc = 'id_DESC', + IdDescNullsFirst = 'id_DESC_NULLS_FIRST', IdDescNullsLast = 'id_DESC_NULLS_LAST', TypeAsc = 'type_ASC', TypeAscNullsFirst = 'type_ASC_NULLS_FIRST', + TypeAscNullsLast = 'type_ASC_NULLS_LAST', TypeDesc = 'type_DESC', + TypeDescNullsFirst = 'type_DESC_NULLS_FIRST', TypeDescNullsLast = 'type_DESC_NULLS_LAST' } @@ -573,23 +655,15 @@ export enum ProxyType { export type Query = { __typename?: 'Query'; accountById?: Maybe; - /** @deprecated Use accountById */ - accountByUniqueInput?: Maybe; accountMultisigById?: Maybe; - /** @deprecated Use accountMultisigById */ - accountMultisigByUniqueInput?: Maybe; accountMultisigs: Array; accountMultisigsConnection: AccountMultisigsConnection; accounts: Array; accountsConnection: AccountsConnection; multisigCallById?: Maybe; - /** @deprecated Use multisigCallById */ - multisigCallByUniqueInput?: Maybe; multisigCalls: Array; multisigCallsConnection: MultisigCallsConnection; proxyAccountById?: Maybe; - /** @deprecated Use proxyAccountById */ - proxyAccountByUniqueInput?: Maybe; proxyAccounts: Array; proxyAccountsConnection: ProxyAccountsConnection; squidStatus?: Maybe; @@ -601,21 +675,11 @@ export type QueryAccountByIdArgs = { }; -export type QueryAccountByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryAccountMultisigByIdArgs = { id: Scalars['String']['input']; }; -export type QueryAccountMultisigByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryAccountMultisigsArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -653,11 +717,6 @@ export type QueryMultisigCallByIdArgs = { }; -export type QueryMultisigCallByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryMultisigCallsArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -679,11 +738,6 @@ export type QueryProxyAccountByIdArgs = { }; -export type QueryProxyAccountByUniqueInputArgs = { - where: WhereIdInput; -}; - - export type QueryProxyAccountsArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -701,14 +755,16 @@ export type QueryProxyAccountsConnectionArgs = { export type SquidStatus = { __typename?: 'SquidStatus'; - /** The height of the processed part of the chain */ + /** The hash of the last processed finalized block */ + finalizedHash?: Maybe; + /** The height of the last processed finalized block */ + finalizedHeight?: Maybe; + /** The hash of the last processed block */ + hash?: Maybe; + /** The height of the last processed block */ height?: Maybe; }; -export type WhereIdInput = { - id: Scalars['String']['input']; -}; - export type MultisigByIdQueryVariables = Exact<{ id: Scalars['String']['input']; }>; @@ -723,6 +779,14 @@ export type MultisigCallsByMultisigIdQueryVariables = Exact<{ export type MultisigCallsByMultisigIdQuery = { __typename?: 'Query', multisigCalls: Array<{ __typename?: 'MultisigCall', id: string, blockHash: string, callIndex: number, timestamp: any }> }; +export type MultisigsAndPureByAccountQueryVariables = Exact<{ + accountIds?: InputMaybe | Scalars['String']['input']>; + watchedAccountIds?: InputMaybe | Scalars['String']['input']>; +}>; + + +export type MultisigsAndPureByAccountQuery = { __typename?: 'Query', accounts: Array<{ __typename?: 'Account', id: string, address: string, isMultisig?: boolean | null, isPureProxy?: boolean | null, threshold?: number | null, signatories: Array<{ __typename?: 'AccountMultisig', id: string, signatory: { __typename?: 'Account', id: string, address: string } }>, delegateeFor: Array<{ __typename?: 'ProxyAccount', id: string, type: ProxyType, delegator: { __typename?: 'Account', id: string, address: string, isPureProxy?: boolean | null }, delegatee: { __typename?: 'Account', id: string, address: string, isPureProxy?: boolean | null } }>, delegatorFor: Array<{ __typename?: 'ProxyAccount', id: string, type: ProxyType, delegatee: { __typename?: 'Account', id: string, address: string, isMultisig?: boolean | null, threshold?: number | null, signatories: Array<{ __typename?: 'AccountMultisig', id: string, signatory: { __typename?: 'Account', id: string, address: string } }> } }> }> }; + export type MultisigsByMultisigOrPureSignatoriesQueryVariables = Exact<{ accountIds?: InputMaybe | Scalars['String']['input']>; }>; @@ -810,6 +874,74 @@ export const useMultisigCallsByMultisigIdQuery = < } )}; +export const MultisigsAndPureByAccountDocument = ` + query MultisigsAndPureByAccount($accountIds: [String!], $watchedAccountIds: [String!]) { + accounts( + where: {AND: [{OR: [{id_in: $watchedAccountIds}, {signatories_some: {signatory: {id_in: $accountIds}}}, {signatories_some: {signatory: {id_in: $watchedAccountIds}}}]}, {OR: [{isMultisig_eq: true}, {isPureProxy_eq: true}]}]} + ) { + id + address + isMultisig + isPureProxy + threshold + signatories { + id + signatory { + id + address + } + } + delegateeFor { + id + type + delegator { + id + address + isPureProxy + } + delegatee { + id + address + isPureProxy + } + } + delegatorFor { + id + type + delegatee { + id + address + isMultisig + threshold + signatories { + id + signatory { + id + address + } + } + } + } + } +} + `; + +export const useMultisigsAndPureByAccountQuery = < + TData = MultisigsAndPureByAccountQuery, + TError = unknown + >( + variables?: MultisigsAndPureByAccountQueryVariables, + options?: Omit, 'queryKey'> & { queryKey?: UseQueryOptions['queryKey'] } + ) => { + + return useQuery( + { + queryKey: variables === undefined ? ['MultisigsAndPureByAccount'] : ['MultisigsAndPureByAccount', variables], + queryFn: useFetchData(MultisigsAndPureByAccountDocument).bind(null, variables), + ...options + } + )}; + export const MultisigsByMultisigOrPureSignatoriesDocument = ` query MultisigsByMultisigOrPureSignatories($accountIds: [String!]) { accountMultisigs(where: {signatory: {id_in: $accountIds}}, limit: 10) {