From 4dfc663b8523369974a4de24aafba817b5f7d673 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Wed, 11 Dec 2024 18:05:12 +0100 Subject: [PATCH 01/12] add default multisig --- .../ui/cypress/tests/default-Multisigs.cy.ts | 93 +++++++++++++++++++ packages/ui/src/contexts/AccountsContext.tsx | 5 - .../ui/src/contexts/MultiProxyContext.tsx | 33 ++++++- packages/ui/src/hooks/useSwitchAddress.tsx | 6 +- 4 files changed, 127 insertions(+), 10 deletions(-) create mode 100644 packages/ui/cypress/tests/default-Multisigs.cy.ts diff --git a/packages/ui/cypress/tests/default-Multisigs.cy.ts b/packages/ui/cypress/tests/default-Multisigs.cy.ts new file mode 100644 index 000000000..ba32820b3 --- /dev/null +++ b/packages/ui/cypress/tests/default-Multisigs.cy.ts @@ -0,0 +1,93 @@ +import { accountDisplay } from '../support/page-objects/components/accountDisplay' +import { landingPageNetwork } from '../fixtures/landingData' +import { topMenuItems } from '../support/page-objects/topMenuItems' +import { multisigPage } from '../support/page-objects/multisigPage' + +const lolmcshizPubKey = '0x8aee4e164d5d70ac67308f303c7e063e9156903e42c1087bbc530447487fa47f' +// const polkadotFirstMultiproxy = '138zn7kQePVm4P1GuCzPLNtcyyAErZzxLiQkT9KhqrVAmF6s' // EB currator pp +// const alternativeFirstMultiproxy = '14SY6tYF5499yJvCFD4LZ26LG4vWtFEPZLkafUUtGR4RsB3' +const polkadotSelectedMultiproxy = '13EyMuuDHwtq5RD6w3psCJ9WvJFZzDDion6Fd2FVAqxz1g7K' // CD OpenGov + +// const kusamaFirstMultiproxy = 'DCZyhphXsRLcW84G9WmWEXtAA8DKGtVGSFZLJYty8Ajjyfa' // CD ref commision +const kusamaSelectedMultiproxy = 'J7UBNJqKHkRi3NkxMV6Y43cMk1ZjEJWzq4z4XmqmNCcFTfM' + +describe('default Multisigs', () => { + it('can switch to a new multiproxy and remember it', () => { + cy.setupAndVisit({ + url: landingPageNetwork('polkadot'), + watchedAccounts: [lolmcshizPubKey] + }) + + multisigPage.accountHeader().within(() => { + accountDisplay + .addressLabel() + .invoke('text') + .as('defaultPolkadotAddress') + .should('not.contain', polkadotSelectedMultiproxy.slice(0, 6)) + }) + + cy.log('@defaultPolkadotAddress', cy.get('@defaultPolkadotAddress')) + + // select another one + topMenuItems.desktopMenu().within(() => + topMenuItems + .multiproxySelectorDesktop() + .wait(1000) + .click() + .type(`${polkadotSelectedMultiproxy.slice(0, 6)}{downArrow}{enter}`) + ) + + // verify that it's displayed + multisigPage.accountHeader().within(() => { + accountDisplay.addressLabel().should('contain.text', polkadotSelectedMultiproxy.slice(0, 6)) + }) + + // go on Kusama and do the same + // check the default multiproxy + cy.visit(landingPageNetwork('kusama')) + + multisigPage.accountHeader().within(() => { + accountDisplay + .addressLabel() + .invoke('text') + .as('defaultKusamaAddress') + .should('not.contain', kusamaSelectedMultiproxy.slice(0, 6)) + }) + + cy.log('@defaultKusamaAddress', cy.get('@defaultKusamaAddress')) + + // select another one + topMenuItems.desktopMenu().within(() => + topMenuItems + .multiproxySelectorDesktop() + .wait(1000) + .click() + .type(`${kusamaSelectedMultiproxy.slice(0, 6)}{downArrow}{enter}`) + ) + + // verify that it's displayed + multisigPage.accountHeader().within(() => { + accountDisplay.addressLabel().should('contain.text', kusamaSelectedMultiproxy.slice(0, 6)) + }) + + // go back on Polkadot and verify the last used one is selected + cy.visit(landingPageNetwork('polkadot')) + + // verify that it's displayed + multisigPage.accountHeader().within(() => { + accountDisplay.addressLabel().should('contain.text', polkadotSelectedMultiproxy.slice(0, 6)) + }) + + cy.url().should('include', polkadotSelectedMultiproxy) + + // go back on Kusama and verify the last used one is selected + cy.visit(landingPageNetwork('kusama')) + + // verify that it's displayed + multisigPage.accountHeader().within(() => { + accountDisplay.addressLabel().should('contain.text', kusamaSelectedMultiproxy.slice(0, 6)) + }) + + cy.url().should('include', kusamaSelectedMultiproxy) + }) +}) diff --git a/packages/ui/src/contexts/AccountsContext.tsx b/packages/ui/src/contexts/AccountsContext.tsx index 4d4e934ed..a4cb82804 100644 --- a/packages/ui/src/contexts/AccountsContext.tsx +++ b/packages/ui/src/contexts/AccountsContext.tsx @@ -8,7 +8,6 @@ import React, { SetStateAction, useEffect } from 'react' -// import { PolkadotSigner } from 'polkadot-api' import { useAccounts as useRedotAccounts } from '@reactive-dot/react' import { useApi } from './ApiContext' import { encodeAccounts } from '../utils/encodeAccounts' @@ -27,12 +26,8 @@ export interface IAccountContext { ownAddressList: string[] selectAccount: (account: InjectedPolkadotAccount) => void getAccountByAddress: (address: string) => InjectedPolkadotAccount | undefined - // isAccountLoading: boolean - // isExtensionError: boolean - // selectedSigner?: PolkadotSigner allowConnectionToExtension: () => void isAllowedToConnectToExtension: boolean - // isLocalStorageSetupDone: boolean isConnectionDialogOpen: boolean setIsConnectionDialogOpen: Dispatch> } diff --git a/packages/ui/src/contexts/MultiProxyContext.tsx b/packages/ui/src/contexts/MultiProxyContext.tsx index 45a944074..f72d59863 100644 --- a/packages/ui/src/contexts/MultiProxyContext.tsx +++ b/packages/ui/src/contexts/MultiProxyContext.tsx @@ -12,6 +12,7 @@ import { useAccountId } from '../hooks/useAccountId' import { useQueryPure } from '../hooks/useQueryPure' import { getMultiProxyAddress } from '../utils/getMultiProxyAddress' import { useSearchParams } from 'react-router' +import { useNetwork } from './NetworkContext' interface MultisigContextProps { children: React.ReactNode | React.ReactNode[] @@ -77,6 +78,11 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { }, [multisigList, pureProxyList]) const { ownAddressList } = useAccounts() const { watchedAddresses } = useWatchedAddresses() + const { selectedNetwork } = useNetwork() + const LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK = useMemo( + () => selectedNetwork && `multix.lastUsedMultiProxy.${selectedNetwork}`, + [selectedNetwork] + ) const getMultiProxyByAddress = useCallback( (address?: string) => { @@ -279,6 +285,7 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { }) as MultiProxy ) + console.log('multi boom', pureProxyArray) setPureProxyList(pureProxyArray) }, []) @@ -315,6 +322,7 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { (newMulti: typeof selectedMultiProxy | string) => { let multi: string | undefined + console.log('last: selectMultiProxy', newMulti) if (typeof newMulti === 'string') { multi = newMulti } else { @@ -327,11 +335,15 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { return false } + if (multiProxyFound && LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK) { + localStorage.setItem(LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK, multi) + } + setAddressInUrl(multi) setSelectedMultiProxyAddress(multi) return true }, - [getMultiProxyByAddress, setAddressInUrl] + [LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK, getMultiProxyByAddress, setAddressInUrl] ) const refetch = useCallback(() => { @@ -353,6 +365,7 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { return true }, [multisigList, ownAddressList, pureProxyList, watchedAddresses]) + console.log('pureproxyList', pureProxyList) const isLoading = useMemo( () => isMultisigQueryLoading || isPureQueryLoading || !isDoneFetchingIndexerInfo, [isDoneFetchingIndexerInfo, isMultisigQueryLoading, isPureQueryLoading] @@ -363,14 +376,28 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { return undefined } + const lastUsedMultiProxy = + LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK && + localStorage.getItem(LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK) + + console.log('lastUsedMultiProxy', lastUsedMultiProxy) + console.log('multisigList', multiProxyList) + console.log( + 'last getMultiProxyByAddress(lastUsedMultiProxy)', + lastUsedMultiProxy && getMultiProxyByAddress(lastUsedMultiProxy) + ) + if (lastUsedMultiProxy && getMultiProxyByAddress(lastUsedMultiProxy)) { + return lastUsedMultiProxy + } + return multiProxyList?.[0].proxy || multiProxyList?.[0].multisigs[0].address - }, [isLoading, multiProxyList]) + }, [LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK, getMultiProxyByAddress, isLoading, multiProxyList]) return ( { multiProxyList, isLoading: isMultiproxyLoading, selectMultiProxy, - defaultAddress, selectedMultiProxyAddress, - setCanFindMultiProxyFromUrl + setCanFindMultiProxyFromUrl, + defaultAddress } = useMultiProxy() useEffect(() => { @@ -27,6 +27,7 @@ export const useSwitchAddress = () => { } if (!!urlAddress && !selectedMultiProxyAddress) { + console.log('last: 1') // this looks like a first load with an address const isSuccess = selectMultiProxy(urlAddress) setCanFindMultiProxyFromUrl(isSuccess) @@ -35,6 +36,7 @@ export const useSwitchAddress = () => { } if (!urlAddress && !!defaultAddress) { + console.log('last: 2', urlAddress, defaultAddress) // no address in the url, init with the default const isSuccess = selectMultiProxy(defaultAddress) setCanFindMultiProxyFromUrl(isSuccess) From 868fce05edaa037b2b199ec747d032343577ad28 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 14:46:07 +0100 Subject: [PATCH 02/12] back to 1 query --- .../ui/src/contexts/MultiProxyContext.tsx | 240 ++++++++---------- packages/ui/src/gql/gql.ts | 5 + packages/ui/src/gql/graphql.ts | 131 +++++++--- packages/ui/src/gql/index.ts | 4 +- ...=> useQueryMultisigsAndPureByAccounts.tsx} | 6 +- packages/ui/src/hooks/useQueryPure.tsx | 26 -- .../queries/multisigsAndPureByAccount.graphql | 62 +++++ packages/ui/types-and-hooks.tsx | 198 ++++++++++++--- 8 files changed, 437 insertions(+), 235 deletions(-) rename packages/ui/src/hooks/{useQueryMultisigs.tsx => useQueryMultisigsAndPureByAccounts.tsx} (80%) delete mode 100644 packages/ui/src/hooks/useQueryPure.tsx create mode 100644 packages/ui/src/queries/multisigsAndPureByAccount.graphql diff --git a/packages/ui/src/contexts/MultiProxyContext.tsx b/packages/ui/src/contexts/MultiProxyContext.tsx index f72d59863..e5d168f56 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' import { useNetwork } from './NetworkContext' @@ -72,7 +71,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]) @@ -104,8 +102,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 @@ -134,6 +133,7 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { setMultisigList(null) setPureProxyList(null) }, []) + const setAddressInUrl = useCallback( (address: string) => { setSearchParams((prev) => { @@ -160,101 +160,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 ) @@ -267,17 +198,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, @@ -285,20 +274,26 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { }) as MultiProxy ) - console.log('multi boom', pureProxyArray) - 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) => { @@ -346,31 +341,6 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { [LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK, 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]) - - console.log('pureproxyList', pureProxyList) - const isLoading = useMemo( - () => isMultisigQueryLoading || isPureQueryLoading || !isDoneFetchingIndexerInfo, - [isDoneFetchingIndexerInfo, isMultisigQueryLoading, isPureQueryLoading] - ) - const defaultAddress = useMemo(() => { if (multiProxyList?.length === 0 || isLoading) { return undefined @@ -380,12 +350,6 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK && localStorage.getItem(LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK) - console.log('lastUsedMultiProxy', lastUsedMultiProxy) - console.log('multisigList', multiProxyList) - console.log( - 'last getMultiProxyByAddress(lastUsedMultiProxy)', - lastUsedMultiProxy && getMultiProxyByAddress(lastUsedMultiProxy) - ) if (lastUsedMultiProxy && getMultiProxyByAddress(lastUsedMultiProxy)) { return lastUsedMultiProxy } @@ -403,7 +367,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 242845a55..9612ba518 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 b4cbdb991..c8de5e933 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 f9bc8e591..f51599168 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 2f92f1ce9..c747f2ce5 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 9f58f3165..000000000 --- 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 000000000..3a543a885 --- /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 fa43c73a1..ff3ab8712 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) { From 6224bcd9911f97e75dc30c4b84389fa7cc2006af Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 14:51:41 +0100 Subject: [PATCH 03/12] ignore gql linting --- packages/ui/.eslintrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/.eslintrc b/packages/ui/.eslintrc index ec0dfc4af..191d3e83b 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"] } From 420b2d3de8e01ce378646775766ed7a59d6188b9 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 14:54:03 +0100 Subject: [PATCH 04/12] Revert "add default multisig" This reverts commit 4dfc663b8523369974a4de24aafba817b5f7d673. --- .../ui/cypress/tests/default-Multisigs.cy.ts | 93 ------------------- packages/ui/src/contexts/AccountsContext.tsx | 5 + .../ui/src/contexts/MultiProxyContext.tsx | 25 +---- packages/ui/src/hooks/useSwitchAddress.tsx | 6 +- 4 files changed, 10 insertions(+), 119 deletions(-) delete mode 100644 packages/ui/cypress/tests/default-Multisigs.cy.ts diff --git a/packages/ui/cypress/tests/default-Multisigs.cy.ts b/packages/ui/cypress/tests/default-Multisigs.cy.ts deleted file mode 100644 index ba32820b3..000000000 --- a/packages/ui/cypress/tests/default-Multisigs.cy.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { accountDisplay } from '../support/page-objects/components/accountDisplay' -import { landingPageNetwork } from '../fixtures/landingData' -import { topMenuItems } from '../support/page-objects/topMenuItems' -import { multisigPage } from '../support/page-objects/multisigPage' - -const lolmcshizPubKey = '0x8aee4e164d5d70ac67308f303c7e063e9156903e42c1087bbc530447487fa47f' -// const polkadotFirstMultiproxy = '138zn7kQePVm4P1GuCzPLNtcyyAErZzxLiQkT9KhqrVAmF6s' // EB currator pp -// const alternativeFirstMultiproxy = '14SY6tYF5499yJvCFD4LZ26LG4vWtFEPZLkafUUtGR4RsB3' -const polkadotSelectedMultiproxy = '13EyMuuDHwtq5RD6w3psCJ9WvJFZzDDion6Fd2FVAqxz1g7K' // CD OpenGov - -// const kusamaFirstMultiproxy = 'DCZyhphXsRLcW84G9WmWEXtAA8DKGtVGSFZLJYty8Ajjyfa' // CD ref commision -const kusamaSelectedMultiproxy = 'J7UBNJqKHkRi3NkxMV6Y43cMk1ZjEJWzq4z4XmqmNCcFTfM' - -describe('default Multisigs', () => { - it('can switch to a new multiproxy and remember it', () => { - cy.setupAndVisit({ - url: landingPageNetwork('polkadot'), - watchedAccounts: [lolmcshizPubKey] - }) - - multisigPage.accountHeader().within(() => { - accountDisplay - .addressLabel() - .invoke('text') - .as('defaultPolkadotAddress') - .should('not.contain', polkadotSelectedMultiproxy.slice(0, 6)) - }) - - cy.log('@defaultPolkadotAddress', cy.get('@defaultPolkadotAddress')) - - // select another one - topMenuItems.desktopMenu().within(() => - topMenuItems - .multiproxySelectorDesktop() - .wait(1000) - .click() - .type(`${polkadotSelectedMultiproxy.slice(0, 6)}{downArrow}{enter}`) - ) - - // verify that it's displayed - multisigPage.accountHeader().within(() => { - accountDisplay.addressLabel().should('contain.text', polkadotSelectedMultiproxy.slice(0, 6)) - }) - - // go on Kusama and do the same - // check the default multiproxy - cy.visit(landingPageNetwork('kusama')) - - multisigPage.accountHeader().within(() => { - accountDisplay - .addressLabel() - .invoke('text') - .as('defaultKusamaAddress') - .should('not.contain', kusamaSelectedMultiproxy.slice(0, 6)) - }) - - cy.log('@defaultKusamaAddress', cy.get('@defaultKusamaAddress')) - - // select another one - topMenuItems.desktopMenu().within(() => - topMenuItems - .multiproxySelectorDesktop() - .wait(1000) - .click() - .type(`${kusamaSelectedMultiproxy.slice(0, 6)}{downArrow}{enter}`) - ) - - // verify that it's displayed - multisigPage.accountHeader().within(() => { - accountDisplay.addressLabel().should('contain.text', kusamaSelectedMultiproxy.slice(0, 6)) - }) - - // go back on Polkadot and verify the last used one is selected - cy.visit(landingPageNetwork('polkadot')) - - // verify that it's displayed - multisigPage.accountHeader().within(() => { - accountDisplay.addressLabel().should('contain.text', polkadotSelectedMultiproxy.slice(0, 6)) - }) - - cy.url().should('include', polkadotSelectedMultiproxy) - - // go back on Kusama and verify the last used one is selected - cy.visit(landingPageNetwork('kusama')) - - // verify that it's displayed - multisigPage.accountHeader().within(() => { - accountDisplay.addressLabel().should('contain.text', kusamaSelectedMultiproxy.slice(0, 6)) - }) - - cy.url().should('include', kusamaSelectedMultiproxy) - }) -}) diff --git a/packages/ui/src/contexts/AccountsContext.tsx b/packages/ui/src/contexts/AccountsContext.tsx index a4cb82804..4d4e934ed 100644 --- a/packages/ui/src/contexts/AccountsContext.tsx +++ b/packages/ui/src/contexts/AccountsContext.tsx @@ -8,6 +8,7 @@ import React, { SetStateAction, useEffect } from 'react' +// import { PolkadotSigner } from 'polkadot-api' import { useAccounts as useRedotAccounts } from '@reactive-dot/react' import { useApi } from './ApiContext' import { encodeAccounts } from '../utils/encodeAccounts' @@ -26,8 +27,12 @@ export interface IAccountContext { ownAddressList: string[] selectAccount: (account: InjectedPolkadotAccount) => void getAccountByAddress: (address: string) => InjectedPolkadotAccount | undefined + // isAccountLoading: boolean + // isExtensionError: boolean + // selectedSigner?: PolkadotSigner allowConnectionToExtension: () => void isAllowedToConnectToExtension: boolean + // isLocalStorageSetupDone: boolean isConnectionDialogOpen: boolean setIsConnectionDialogOpen: Dispatch> } diff --git a/packages/ui/src/contexts/MultiProxyContext.tsx b/packages/ui/src/contexts/MultiProxyContext.tsx index e5d168f56..8f408fe80 100644 --- a/packages/ui/src/contexts/MultiProxyContext.tsx +++ b/packages/ui/src/contexts/MultiProxyContext.tsx @@ -11,7 +11,6 @@ import { useWatchedAddresses } from './WatchedAddressesContext' import { useAccountId } from '../hooks/useAccountId' import { getMultiProxyAddress } from '../utils/getMultiProxyAddress' import { useSearchParams } from 'react-router' -import { useNetwork } from './NetworkContext' interface MultisigContextProps { children: React.ReactNode | React.ReactNode[] @@ -76,11 +75,6 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { }, [multisigList, pureProxyList]) const { ownAddressList } = useAccounts() const { watchedAddresses } = useWatchedAddresses() - const { selectedNetwork } = useNetwork() - const LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK = useMemo( - () => selectedNetwork && `multix.lastUsedMultiProxy.${selectedNetwork}`, - [selectedNetwork] - ) const getMultiProxyByAddress = useCallback( (address?: string) => { @@ -317,7 +311,6 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { (newMulti: typeof selectedMultiProxy | string) => { let multi: string | undefined - console.log('last: selectMultiProxy', newMulti) if (typeof newMulti === 'string') { multi = newMulti } else { @@ -330,15 +323,11 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { return false } - if (multiProxyFound && LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK) { - localStorage.setItem(LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK, multi) - } - setAddressInUrl(multi) setSelectedMultiProxyAddress(multi) return true }, - [LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK, getMultiProxyByAddress, setAddressInUrl] + [getMultiProxyByAddress, setAddressInUrl] ) const defaultAddress = useMemo(() => { @@ -346,22 +335,14 @@ const MultiProxyContextProvider = ({ children }: MultisigContextProps) => { return undefined } - const lastUsedMultiProxy = - LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK && - localStorage.getItem(LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK) - - if (lastUsedMultiProxy && getMultiProxyByAddress(lastUsedMultiProxy)) { - return lastUsedMultiProxy - } - return multiProxyList?.[0].proxy || multiProxyList?.[0].multisigs[0].address - }, [LOCALSTORAGE_LAST_MULTIPROXY_KEY_NETWORK, getMultiProxyByAddress, isLoading, multiProxyList]) + }, [isLoading, multiProxyList]) return ( { multiProxyList, isLoading: isMultiproxyLoading, selectMultiProxy, + defaultAddress, selectedMultiProxyAddress, - setCanFindMultiProxyFromUrl, - defaultAddress + setCanFindMultiProxyFromUrl } = useMultiProxy() useEffect(() => { @@ -27,7 +27,6 @@ export const useSwitchAddress = () => { } if (!!urlAddress && !selectedMultiProxyAddress) { - console.log('last: 1') // this looks like a first load with an address const isSuccess = selectMultiProxy(urlAddress) setCanFindMultiProxyFromUrl(isSuccess) @@ -36,7 +35,6 @@ export const useSwitchAddress = () => { } if (!urlAddress && !!defaultAddress) { - console.log('last: 2', urlAddress, defaultAddress) // no address in the url, init with the default const isSuccess = selectMultiProxy(defaultAddress) setCanFindMultiProxyFromUrl(isSuccess) From 373a8bd70df83162e2f30c59fab07fb66652f65c Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 15:11:50 +0100 Subject: [PATCH 05/12] fix 1 test --- packages/ui/cypress/tests/watched-accounts.cy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/cypress/tests/watched-accounts.cy.ts b/packages/ui/cypress/tests/watched-accounts.cy.ts index f606e640c..a100cf7f1 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' } ] From b8766ef69a2676325ae1aca2d36ddb48a4b5f7fa Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 15:19:23 +0100 Subject: [PATCH 06/12] I can also wait 1s instead of 500 --- packages/ui/cypress/tests/address-bar.cy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/cypress/tests/address-bar.cy.ts b/packages/ui/cypress/tests/address-bar.cy.ts index deb4b79c1..986075d34 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) From 17a16e4dd6ed4679719023f2ada6d269f647a2a3 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 15:47:35 +0100 Subject: [PATCH 07/12] remove deep tx alert etc. --- packages/ui/src/components/DeepTxAlert.tsx | 594 +++++++++--------- .../Transactions/TransactionList.tsx | 20 +- packages/ui/src/contexts/ModalsContext.tsx | 38 +- packages/ui/src/gql/gql.ts | 15 - packages/ui/src/gql/graphql.ts | 27 +- ...ltisigsByMultisigOrPureSignatories.graphql | 34 +- .../multisigsBySignatoriesOrWatched.graphql | 70 +-- packages/ui/src/queries/pureByIds.graphql | 46 +- packages/ui/types-and-hooks.tsx | 148 ----- 9 files changed, 402 insertions(+), 590 deletions(-) diff --git a/packages/ui/src/components/DeepTxAlert.tsx b/packages/ui/src/components/DeepTxAlert.tsx index 6282d32df..0668a2222 100644 --- a/packages/ui/src/components/DeepTxAlert.tsx +++ b/packages/ui/src/components/DeepTxAlert.tsx @@ -1,297 +1,297 @@ -import { Alert, Grid2 as Grid } from '@mui/material' -import { styled } from '@mui/material/styles' -import { useCallback, useEffect, useMemo, useState } from 'react' -import { useMultisigsByMultisigOrPureSignatoriesQuery } from '../../types-and-hooks' -import { MultisigAggregated, useMultiProxy } from '../contexts/MultiProxyContext' -import { useAccountId } from '../hooks/useAccountId' -import { CallDataInfoFromChain, usePendingTx } from '../hooks/usePendingTx' -import { getIntersection } from '../utils/arrayUtils' -import { useModals } from '../contexts/ModalsContext' -import { Button } from './library' -import { useAccounts } from '../contexts/AccountsContext' -import AccountDisplay from './AccountDisplay/AccountDisplay' - -export interface ParentMultisigInfo { - parentSignatoryAddress: string - parentMultisigAddress: string - involvedMultisigProxyAddress?: string - involvedMultisigAddress: string - isSignatoryProxy: boolean - threshold: number - signatories: string[] -} - -interface Props { - pendingTxCallData: string[] -} - -export const DeepTxAlert = ({ pendingTxCallData }: Props) => { - const { selectedMultiProxy, selectedIsWatched } = useMultiProxy() - const { onOpenDeepTxModal } = useModals() - const { ownAddressList } = useAccounts() - const proxyAndMultisigsIds = useMemo( - () => - [ - selectedMultiProxy?.proxy || '', - ...(selectedMultiProxy?.multisigs.map(({ address }) => address) || []) - ].filter((a) => !!a), - [selectedMultiProxy] - ) - const idsToQuery = useAccountId(proxyAndMultisigsIds) - const { data } = useMultisigsByMultisigOrPureSignatoriesQuery({ - accountIds: idsToQuery - }) - const [parentMultisigs, setParenMultisigs] = useState>({}) - const parentMultisigAddresses = useMemo(() => Object.keys(parentMultisigs), [parentMultisigs]) - - useEffect(() => { - if (!data || data?.accountMultisigs.length === 0) { - setParenMultisigs({}) - return - } - - // the data is the list of multisig with our current - // multisig/pure being a signatory - if (data && data.accountMultisigs.length > 0) { - // Create a map with the parent multisig - // that is involved in a Tx with the current pure/multisig as signatory - const parentInfoMap = data.accountMultisigs.reduce( - (acc: Record, currParentMultisig) => { - const parentMultisigSignatories = currParentMultisig.multisig.signatories.map( - ({ signatory }) => signatory.address - ) - - let signatoryOfParent = { address: '', isSignatoryProxy: false } - let relevantMultisigAddress = '' - - // See if the parent signatories is one of our pure or our current multisig - if ( - selectedMultiProxy?.proxy && - parentMultisigSignatories.includes(selectedMultiProxy?.proxy) - ) { - signatoryOfParent = { address: selectedMultiProxy?.proxy, isSignatoryProxy: true } - } else { - // it must be one of our multisig then - const relevantMultisig = getIntersection( - selectedMultiProxy?.multisigs.map(({ address }) => address), - parentMultisigSignatories - ) - - if (!relevantMultisig.length) { - console.error( - 'Unexpected error: No multisig or proxy found as signatory', - data, - selectedMultiProxy - ) - } - - relevantMultisigAddress = relevantMultisig[0] - - signatoryOfParent = { - // here, we may have several of our current multisigs - // being a signatory of the parent. We go for the first - address: relevantMultisig[0], - isSignatoryProxy: false - } - } - - return { - ...acc, - [currParentMultisig.multisig.address]: { - parentSignatoryAddress: signatoryOfParent.address, - involvedMultisigAddress: relevantMultisigAddress, - involvedMultisigProxyAddress: selectedMultiProxy?.proxy, - isSignatoryProxy: signatoryOfParent.isSignatoryProxy, - threshold: currParentMultisig.multisig.threshold || 0, - signatories: currParentMultisig.multisig.signatories.map( - ({ signatory }) => signatory.address - ) - } as ParentMultisigInfo - } - }, - {} as Record - ) - setParenMultisigs(parentInfoMap) - } - }, [data, selectedMultiProxy]) - - const onClickCreate = useCallback( - (aggregatedData: CallDataInfoFromChain) => { - if (!aggregatedData) return - - let possibleSigners: string[] = [] - let currentMultisigInvolved: MultisigAggregated | undefined - - // if the signatory is the pure we select - // the first multisig as the possible signatory - if (parentMultisigs[aggregatedData.from].isSignatoryProxy) { - currentMultisigInvolved = selectedMultiProxy?.multisigs[0] - possibleSigners = getIntersection(ownAddressList, currentMultisigInvolved?.signatories) - } else { - /// otherwise if it's a specific multisig we should find it - currentMultisigInvolved = selectedMultiProxy?.multisigs.find((add) => { - return add.address === parentMultisigs[aggregatedData.from].parentSignatoryAddress - }) - possibleSigners = getIntersection(ownAddressList, currentMultisigInvolved?.signatories) - } - - if (!possibleSigners.length) { - console.error( - 'Unexpected error: Could not find the possible signatories', - aggregatedData.from, - parentMultisigs, - selectedMultiProxy - ) - } - - if (!currentMultisigInvolved) { - console.error( - 'Unexpected error: Could not find the current multisig involved', - aggregatedData.from, - parentMultisigs, - selectedMultiProxy - ) - - return - } - - onOpenDeepTxModal({ - possibleSigners, - proposalData: aggregatedData, - parentMultisigInfo: parentMultisigs[aggregatedData.from], - currentMultisigInvolved - }) - }, - [onOpenDeepTxModal, ownAddressList, parentMultisigs, selectedMultiProxy] - ) - - const { txWithCallDataByDate } = usePendingTx(parentMultisigAddresses, true) - - if (!parentMultisigAddresses.length || Object.values(txWithCallDataByDate).length === 0) - return null - - return Object.values(txWithCallDataByDate).map((data) => { - const filteredMap = data.filter((call) => { - // filter the tx that are potentially already created and are pending - // when we have the calldata in both (in case it's an as multi) - if ( - call?.callData && - pendingTxCallData.some((pendingCallData) => - pendingCallData.includes(call.callData?.slice(2) as string) - ) - ) { - console.info('filtering call, currently signing (with asMulti)', call) - return false - } - - // filter the tx that are potentially already created and are pending - // when we have the hash of the parent in the current calldata (in case it's an approveAsMulti) - if ( - pendingTxCallData.some((pendingCallData) => { - const isIncluded = pendingCallData.includes(call.hash?.slice(2) as string) - return isIncluded - }) - ) { - console.info('filtering call, currently signing (with approveAsMult)', call) - return false - } - - // filter the tx where we've already signed - if (call.info?.approvals.includes(parentMultisigs[call.from].parentSignatoryAddress)) { - console.info('filtering call, already signed', call) - return false - } - - return true - }) - - return filteredMap.map((data1) => ( - - - - - Pending tx {data1.name} - - - from: - - - - - {!selectedIsWatched && } - - - - )) - }) -} - -const FunctionNameStyled = styled('span')` - padding: 0.5rem; - margin: 0 0.5rem 0 0.5rem; - background-color: ${(props) => props.theme.custom.proxyBadge.multi}; - text-overflow: ellipsis; - overflow: hidden; -` - -const InfoTextStyled = styled(Grid)` - /* flex: 1; - display: flex;*/ - align-items: center; - margin: 0; - - button { - margin-left: auto; - margin-right: 2px; - } - - .gridItem { - padding: 0; - } -` - -const AlertStyled = styled(Alert)` - width: 100%; - margin-top: 0.5rem; - margin-bottom: 0.5rem; - - .MuiAlert-message { - display: flex; - align-items: center; - width: 100%; - } - - .MuiAlert-icon { - align-items: center; - } -` +// import { Alert, Grid2 as Grid } from '@mui/material' +// import { styled } from '@mui/material/styles' +// import { useCallback, useEffect, useMemo, useState } from 'react' +// import { useMultisigsByMultisigOrPureSignatoriesQuery } from '../../types-and-hooks' +// import { MultisigAggregated, useMultiProxy } from '../contexts/MultiProxyContext' +// import { useAccountId } from '../hooks/useAccountId' +// import { CallDataInfoFromChain, usePendingTx } from '../hooks/usePendingTx' +// import { getIntersection } from '../utils/arrayUtils' +// import { useModals } from '../contexts/ModalsContext' +// import { Button } from './library' +// import { useAccounts } from '../contexts/AccountsContext' +// import AccountDisplay from './AccountDisplay/AccountDisplay' + +// export interface ParentMultisigInfo { +// parentSignatoryAddress: string +// parentMultisigAddress: string +// involvedMultisigProxyAddress?: string +// involvedMultisigAddress: string +// isSignatoryProxy: boolean +// threshold: number +// signatories: string[] +// } + +// interface Props { +// pendingTxCallData: string[] +// } + +// export const DeepTxAlert = ({ pendingTxCallData }: Props) => { +// const { selectedMultiProxy, selectedIsWatched } = useMultiProxy() +// const { onOpenDeepTxModal } = useModals() +// const { ownAddressList } = useAccounts() +// const proxyAndMultisigsIds = useMemo( +// () => +// [ +// selectedMultiProxy?.proxy || '', +// ...(selectedMultiProxy?.multisigs.map(({ address }) => address) || []) +// ].filter((a) => !!a), +// [selectedMultiProxy] +// ) +// const idsToQuery = useAccountId(proxyAndMultisigsIds) +// const { data } = useMultisigsByMultisigOrPureSignatoriesQuery({ +// accountIds: idsToQuery +// }) +// const [parentMultisigs, setParenMultisigs] = useState>({}) +// const parentMultisigAddresses = useMemo(() => Object.keys(parentMultisigs), [parentMultisigs]) + +// useEffect(() => { +// if (!data || data?.accountMultisigs.length === 0) { +// setParenMultisigs({}) +// return +// } + +// // the data is the list of multisig with our current +// // multisig/pure being a signatory +// if (data && data.accountMultisigs.length > 0) { +// // Create a map with the parent multisig +// // that is involved in a Tx with the current pure/multisig as signatory +// const parentInfoMap = data.accountMultisigs.reduce( +// (acc: Record, currParentMultisig) => { +// const parentMultisigSignatories = currParentMultisig.multisig.signatories.map( +// ({ signatory }) => signatory.address +// ) + +// let signatoryOfParent = { address: '', isSignatoryProxy: false } +// let relevantMultisigAddress = '' + +// // See if the parent signatories is one of our pure or our current multisig +// if ( +// selectedMultiProxy?.proxy && +// parentMultisigSignatories.includes(selectedMultiProxy?.proxy) +// ) { +// signatoryOfParent = { address: selectedMultiProxy?.proxy, isSignatoryProxy: true } +// } else { +// // it must be one of our multisig then +// const relevantMultisig = getIntersection( +// selectedMultiProxy?.multisigs.map(({ address }) => address), +// parentMultisigSignatories +// ) + +// if (!relevantMultisig.length) { +// console.error( +// 'Unexpected error: No multisig or proxy found as signatory', +// data, +// selectedMultiProxy +// ) +// } + +// relevantMultisigAddress = relevantMultisig[0] + +// signatoryOfParent = { +// // here, we may have several of our current multisigs +// // being a signatory of the parent. We go for the first +// address: relevantMultisig[0], +// isSignatoryProxy: false +// } +// } + +// return { +// ...acc, +// [currParentMultisig.multisig.address]: { +// parentSignatoryAddress: signatoryOfParent.address, +// involvedMultisigAddress: relevantMultisigAddress, +// involvedMultisigProxyAddress: selectedMultiProxy?.proxy, +// isSignatoryProxy: signatoryOfParent.isSignatoryProxy, +// threshold: currParentMultisig.multisig.threshold || 0, +// signatories: currParentMultisig.multisig.signatories.map( +// ({ signatory }) => signatory.address +// ) +// } as ParentMultisigInfo +// } +// }, +// {} as Record +// ) +// setParenMultisigs(parentInfoMap) +// } +// }, [data, selectedMultiProxy]) + +// const onClickCreate = useCallback( +// (aggregatedData: CallDataInfoFromChain) => { +// if (!aggregatedData) return + +// let possibleSigners: string[] = [] +// let currentMultisigInvolved: MultisigAggregated | undefined + +// // if the signatory is the pure we select +// // the first multisig as the possible signatory +// if (parentMultisigs[aggregatedData.from].isSignatoryProxy) { +// currentMultisigInvolved = selectedMultiProxy?.multisigs[0] +// possibleSigners = getIntersection(ownAddressList, currentMultisigInvolved?.signatories) +// } else { +// /// otherwise if it's a specific multisig we should find it +// currentMultisigInvolved = selectedMultiProxy?.multisigs.find((add) => { +// return add.address === parentMultisigs[aggregatedData.from].parentSignatoryAddress +// }) +// possibleSigners = getIntersection(ownAddressList, currentMultisigInvolved?.signatories) +// } + +// if (!possibleSigners.length) { +// console.error( +// 'Unexpected error: Could not find the possible signatories', +// aggregatedData.from, +// parentMultisigs, +// selectedMultiProxy +// ) +// } + +// if (!currentMultisigInvolved) { +// console.error( +// 'Unexpected error: Could not find the current multisig involved', +// aggregatedData.from, +// parentMultisigs, +// selectedMultiProxy +// ) + +// return +// } + +// onOpenDeepTxModal({ +// possibleSigners, +// proposalData: aggregatedData, +// parentMultisigInfo: parentMultisigs[aggregatedData.from], +// currentMultisigInvolved +// }) +// }, +// [onOpenDeepTxModal, ownAddressList, parentMultisigs, selectedMultiProxy] +// ) + +// const { txWithCallDataByDate } = usePendingTx(parentMultisigAddresses, true) + +// if (!parentMultisigAddresses.length || Object.values(txWithCallDataByDate).length === 0) +// return null + +// return Object.values(txWithCallDataByDate).map((data) => { +// const filteredMap = data.filter((call) => { +// // filter the tx that are potentially already created and are pending +// // when we have the calldata in both (in case it's an as multi) +// if ( +// call?.callData && +// pendingTxCallData.some((pendingCallData) => +// pendingCallData.includes(call.callData?.slice(2) as string) +// ) +// ) { +// console.info('filtering call, currently signing (with asMulti)', call) +// return false +// } + +// // filter the tx that are potentially already created and are pending +// // when we have the hash of the parent in the current calldata (in case it's an approveAsMulti) +// if ( +// pendingTxCallData.some((pendingCallData) => { +// const isIncluded = pendingCallData.includes(call.hash?.slice(2) as string) +// return isIncluded +// }) +// ) { +// console.info('filtering call, currently signing (with approveAsMult)', call) +// return false +// } + +// // filter the tx where we've already signed +// if (call.info?.approvals.includes(parentMultisigs[call.from].parentSignatoryAddress)) { +// console.info('filtering call, already signed', call) +// return false +// } + +// return true +// }) + +// return filteredMap.map((data1) => ( +// +// +// +// +// Pending tx {data1.name} +// +// +// from: +// +// +// +// +// {!selectedIsWatched && } +// +// +// +// )) +// }) +// } + +// const FunctionNameStyled = styled('span')` +// padding: 0.5rem; +// margin: 0 0.5rem 0 0.5rem; +// background-color: ${(props) => props.theme.custom.proxyBadge.multi}; +// text-overflow: ellipsis; +// overflow: hidden; +// ` + +// const InfoTextStyled = styled(Grid)` +// /* flex: 1; +// display: flex;*/ +// align-items: center; +// margin: 0; + +// button { +// margin-left: auto; +// margin-right: 2px; +// } + +// .gridItem { +// padding: 0; +// } +// ` + +// const AlertStyled = styled(Alert)` +// width: 100%; +// margin-top: 0.5rem; +// margin-bottom: 0.5rem; + +// .MuiAlert-message { +// display: flex; +// align-items: center; +// width: 100%; +// } + +// .MuiAlert-icon { +// align-items: center; +// } +// ` diff --git a/packages/ui/src/components/Transactions/TransactionList.tsx b/packages/ui/src/components/Transactions/TransactionList.tsx index 91dc1adf3..941316018 100644 --- a/packages/ui/src/components/Transactions/TransactionList.tsx +++ b/packages/ui/src/components/Transactions/TransactionList.tsx @@ -7,7 +7,7 @@ import { useAccounts } from '../../contexts/AccountsContext' import { MdOutlineFlare as FlareIcon } from 'react-icons/md' import Transaction from './Transaction' import { useMemo } from 'react' -import { DeepTxAlert } from '../DeepTxAlert' +// import { DeepTxAlert } from '../DeepTxAlert' interface Props { className?: string @@ -25,18 +25,18 @@ const TransactionList = ({ className }: Props) => { refresh } = usePendingTx(multisigAddresses) const { ownAddressList } = useAccounts() - const pendingTxCallData = useMemo(() => { - return Object.values(txWithCallDataByDate) - .reduce((acc, curr) => { - return [...acc, ...curr] - }, []) - .map(({ callData }) => callData) - .filter((a) => !!a) as string[] - }, [txWithCallDataByDate]) + // const pendingTxCallData = useMemo(() => { + // return Object.values(txWithCallDataByDate) + // .reduce((acc, curr) => { + // return [...acc, ...curr] + // }, []) + // .map(({ callData }) => callData) + // .filter((a) => !!a) as string[] + // }, [txWithCallDataByDate]) return ( - + {/* */}

Transactions

{isLoadingPendingTxs && ( diff --git a/packages/ui/src/contexts/ModalsContext.tsx b/packages/ui/src/contexts/ModalsContext.tsx index c8eb11308..deafc6ded 100644 --- a/packages/ui/src/contexts/ModalsContext.tsx +++ b/packages/ui/src/contexts/ModalsContext.tsx @@ -8,7 +8,7 @@ import WCSessionProposal from '../components/modals/WalletConnectSessionProposal import ProposalSigningModal, { SigningModalProps } from '../components/modals/ProposalSigning' import WalletConnectSigning from '../components/modals/WalletConnectSigning' import { useMultiProxy } from './MultiProxyContext' -import DeepTxCreationModal, { DeepTxCreationProps } from '../components/modals/DeepTxCreation' +// import DeepTxCreationModal, { DeepTxCreationProps } from '../components/modals/DeepTxCreation' interface ModalsContextProps { setIsEditModalOpen: (isOpen: boolean) => void @@ -17,8 +17,8 @@ interface ModalsContextProps { onCloseSendModal: () => void openWalletConnectSessionModal: ({ sessionProposal }: OpenWCModalParams) => void onOpenSigningModal: (info: SigningInfo) => void - onOpenDeepTxModal: (info: DeepTxModalInfo) => void - onCloseDeepTxModal: () => void + // onOpenDeepTxModal: (info: DeepTxModalInfo) => void + // onCloseDeepTxModal: () => void onOpenWalletConnectSigning: (request: SignClientTypes.EventArguments['session_request']) => void } @@ -27,7 +27,7 @@ interface OpenWCModalParams { } type SigningInfo = Omit -type DeepTxModalInfo = Omit +// type DeepTxModalInfo = Omit const ModalsContext = createContext(undefined) @@ -37,8 +37,8 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { const [isSendModalOpen, setIsSendModalOpen] = useState(false) const [isWCModalOpen, setIsWCModalOpen] = useState(false) const [isSigningModalOpen, setIsSigningModalOpen] = useState(false) - const [isDeepTxModalOpen, setIsDeepTxModalOpen] = useState(false) - const [deepTxModalInfo, setDeepTxModalInfo] = useState() + // const [isDeepTxModalOpen, setIsDeepTxModalOpen] = useState(false) + // const [deepTxModalInfo, setDeepTxModalInfo] = useState() const [signingModalInfo, setSigningModalInfo] = useState() const [isOpenWalletConnectSigning, setIsOpenWalletConnectSigning] = useState(false) const [sendModalPreselection, setSendModalPreselection] = useState( @@ -100,15 +100,15 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { setIsSigningModalOpen(true) }, []) - const onOpenDeepTxModal = useCallback((info: DeepTxModalInfo) => { - setDeepTxModalInfo(info) - setIsDeepTxModalOpen(true) - }, []) + // const onOpenDeepTxModal = useCallback((info: DeepTxModalInfo) => { + // setDeepTxModalInfo(info) + // setIsDeepTxModalOpen(true) + // }, []) - const onCloseDeepTxModal = useCallback(() => { - setDeepTxModalInfo(undefined) - setIsDeepTxModalOpen(false) - }, []) + // const onCloseDeepTxModal = useCallback(() => { + // setDeepTxModalInfo(undefined) + // setIsDeepTxModalOpen(false) + // }, []) const onOpenWalletConnectSigning = useCallback( (request: SignClientTypes.EventArguments['session_request']) => { @@ -132,9 +132,9 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { onCloseSendModal, openWalletConnectSessionModal, onOpenSigningModal, - onOpenWalletConnectSigning, - onOpenDeepTxModal, - onCloseDeepTxModal + onOpenWalletConnectSigning + // onOpenDeepTxModal, + // onCloseDeepTxModal }} > {children} @@ -162,7 +162,7 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { onSuccess={signingModalInfo.onSuccess} /> )} - {isDeepTxModalOpen && deepTxModalInfo && ( + {/* {isDeepTxModalOpen && deepTxModalInfo && ( { parentMultisigInfo={deepTxModalInfo.parentMultisigInfo} currentMultisigInvolved={deepTxModalInfo.currentMultisigInvolved} /> - )} + )} */} {isOpenWalletConnectSigning && !!walletConnectRequest && ( , 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']>; -}>; - - -export type MultisigsByMultisigOrPureSignatoriesQuery = { __typename?: 'Query', accountMultisigs: Array<{ __typename?: 'AccountMultisig', id: string, multisig: { __typename?: 'Account', id: string, address: string, threshold?: number | null, signatories: Array<{ __typename?: 'AccountMultisig', id: string, signatory: { __typename?: 'Account', id: string, address: string } }> } }> }; - -export type MultisigsBySignatoriesOrWatchedQueryVariables = Exact<{ - accountIds?: InputMaybe | Scalars['String']['input']>; - watchedAccountIds?: InputMaybe | Scalars['String']['input']>; -}>; - - -export type MultisigsBySignatoriesOrWatchedQuery = { __typename?: 'Query', accountMultisigs: Array<{ __typename?: 'AccountMultisig', id: string, multisig: { __typename?: 'Account', id: string, address: string, 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 } }> } }> }; - -export type PureByIdsQueryVariables = Exact<{ - pureIds?: InputMaybe | Scalars['String']['input']>; -}>; - - -export type PureByIdsQuery = { __typename?: 'Query', accounts: Array<{ __typename?: 'Account', id: string, address: string, 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 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 +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; \ No newline at end of file diff --git a/packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql b/packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql index 1216454e3..b1f0bee70 100644 --- a/packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql +++ b/packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql @@ -1,17 +1,17 @@ -query MultisigsByMultisigOrPureSignatories($accountIds: [String!]) { - accountMultisigs(where: { signatory: { id_in: $accountIds } }, limit: 10) { - id - multisig { - id - address - threshold - signatories(limit: 10) { - id - signatory { - id - address - } - } - } - } -} +# query MultisigsByMultisigOrPureSignatories($accountIds: [String!]) { +# accountMultisigs(where: { signatory: { id_in: $accountIds } }, limit: 10) { +# id +# multisig { +# id +# address +# threshold +# signatories(limit: 10) { +# id +# signatory { +# id +# address +# } +# } +# } +# } +# } diff --git a/packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql b/packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql index d945aadb8..abb859980 100644 --- a/packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql +++ b/packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql @@ -1,35 +1,35 @@ -query MultisigsBySignatoriesOrWatched($accountIds: [String!], $watchedAccountIds: [String!]) { - accountMultisigs( - where: { - OR: [ - { multisig: { id_in: $watchedAccountIds } } - { signatory: { id_in: $accountIds } } - { signatory: { id_in: $watchedAccountIds } } - ] - } - limit: 500 - ) { - id - multisig { - id - address - threshold - signatories(limit: 100) { - id - signatory { - id - address - } - } - delegateeFor(limit: 100) { - id - type - delegator { - id - address - isPureProxy - } - } - } - } -} +# query MultisigsBySignatoriesOrWatched($accountIds: [String!], $watchedAccountIds: [String!]) { +# accountMultisigs( +# where: { +# OR: [ +# { multisig: { id_in: $watchedAccountIds } } +# { signatory: { id_in: $accountIds } } +# { signatory: { id_in: $watchedAccountIds } } +# ] +# } +# limit: 500 +# ) { +# id +# multisig { +# id +# address +# threshold +# signatories(limit: 100) { +# id +# signatory { +# id +# address +# } +# } +# delegateeFor(limit: 100) { +# id +# type +# delegator { +# id +# address +# isPureProxy +# } +# } +# } +# } +# } diff --git a/packages/ui/src/queries/pureByIds.graphql b/packages/ui/src/queries/pureByIds.graphql index 21dbc63a3..a5f72912e 100644 --- a/packages/ui/src/queries/pureByIds.graphql +++ b/packages/ui/src/queries/pureByIds.graphql @@ -1,23 +1,23 @@ -query PureByIds($pureIds: [String!]) { - accounts(where: { AND: [{ id_in: $pureIds }, { isPureProxy_eq: true }] }, limit: 50) { - id - address - delegatorFor(limit: 50) { - id - type - delegatee { - id - address - isMultisig - threshold - signatories(limit: 50) { - id - signatory { - id - address - } - } - } - } - } -} +# query PureByIds($pureIds: [String!]) { +# accounts(where: { AND: [{ id_in: $pureIds }, { isPureProxy_eq: true }] }, limit: 50) { +# id +# address +# delegatorFor(limit: 50) { +# id +# type +# delegatee { +# id +# address +# isMultisig +# threshold +# signatories(limit: 50) { +# id +# signatory { +# id +# address +# } +# } +# } +# } +# } +# } diff --git a/packages/ui/types-and-hooks.tsx b/packages/ui/types-and-hooks.tsx index ff3ab8712..6b750d5af 100644 --- a/packages/ui/types-and-hooks.tsx +++ b/packages/ui/types-and-hooks.tsx @@ -787,28 +787,6 @@ export type MultisigsAndPureByAccountQueryVariables = Exact<{ 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']>; -}>; - - -export type MultisigsByMultisigOrPureSignatoriesQuery = { __typename?: 'Query', accountMultisigs: Array<{ __typename?: 'AccountMultisig', id: string, multisig: { __typename?: 'Account', id: string, address: string, threshold?: number | null, signatories: Array<{ __typename?: 'AccountMultisig', id: string, signatory: { __typename?: 'Account', id: string, address: string } }> } }> }; - -export type MultisigsBySignatoriesOrWatchedQueryVariables = Exact<{ - accountIds?: InputMaybe | Scalars['String']['input']>; - watchedAccountIds?: InputMaybe | Scalars['String']['input']>; -}>; - - -export type MultisigsBySignatoriesOrWatchedQuery = { __typename?: 'Query', accountMultisigs: Array<{ __typename?: 'AccountMultisig', id: string, multisig: { __typename?: 'Account', id: string, address: string, 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 } }> } }> }; - -export type PureByIdsQueryVariables = Exact<{ - pureIds?: InputMaybe | Scalars['String']['input']>; -}>; - - -export type PureByIdsQuery = { __typename?: 'Query', accounts: Array<{ __typename?: 'Account', id: string, address: string, 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 const MultisigByIdDocument = ` @@ -941,129 +919,3 @@ export const useMultisigsAndPureByAccountQuery = < ...options } )}; - -export const MultisigsByMultisigOrPureSignatoriesDocument = ` - query MultisigsByMultisigOrPureSignatories($accountIds: [String!]) { - accountMultisigs(where: {signatory: {id_in: $accountIds}}, limit: 10) { - id - multisig { - id - address - threshold - signatories(limit: 10) { - id - signatory { - id - address - } - } - } - } -} - `; - -export const useMultisigsByMultisigOrPureSignatoriesQuery = < - TData = MultisigsByMultisigOrPureSignatoriesQuery, - TError = unknown - >( - variables?: MultisigsByMultisigOrPureSignatoriesQueryVariables, - options?: Omit, 'queryKey'> & { queryKey?: UseQueryOptions['queryKey'] } - ) => { - - return useQuery( - { - queryKey: variables === undefined ? ['MultisigsByMultisigOrPureSignatories'] : ['MultisigsByMultisigOrPureSignatories', variables], - queryFn: useFetchData(MultisigsByMultisigOrPureSignatoriesDocument).bind(null, variables), - ...options - } - )}; - -export const MultisigsBySignatoriesOrWatchedDocument = ` - query MultisigsBySignatoriesOrWatched($accountIds: [String!], $watchedAccountIds: [String!]) { - accountMultisigs( - where: {OR: [{multisig: {id_in: $watchedAccountIds}}, {signatory: {id_in: $accountIds}}, {signatory: {id_in: $watchedAccountIds}}]} - limit: 500 - ) { - id - multisig { - id - address - threshold - signatories(limit: 100) { - id - signatory { - id - address - } - } - delegateeFor(limit: 100) { - id - type - delegator { - id - address - isPureProxy - } - } - } - } -} - `; - -export const useMultisigsBySignatoriesOrWatchedQuery = < - TData = MultisigsBySignatoriesOrWatchedQuery, - TError = unknown - >( - variables?: MultisigsBySignatoriesOrWatchedQueryVariables, - options?: Omit, 'queryKey'> & { queryKey?: UseQueryOptions['queryKey'] } - ) => { - - return useQuery( - { - queryKey: variables === undefined ? ['MultisigsBySignatoriesOrWatched'] : ['MultisigsBySignatoriesOrWatched', variables], - queryFn: useFetchData(MultisigsBySignatoriesOrWatchedDocument).bind(null, variables), - ...options - } - )}; - -export const PureByIdsDocument = ` - query PureByIds($pureIds: [String!]) { - accounts(where: {AND: [{id_in: $pureIds}, {isPureProxy_eq: true}]}, limit: 50) { - id - address - delegatorFor(limit: 50) { - id - type - delegatee { - id - address - isMultisig - threshold - signatories(limit: 50) { - id - signatory { - id - address - } - } - } - } - } -} - `; - -export const usePureByIdsQuery = < - TData = PureByIdsQuery, - TError = unknown - >( - variables?: PureByIdsQueryVariables, - options?: Omit, 'queryKey'> & { queryKey?: UseQueryOptions['queryKey'] } - ) => { - - return useQuery( - { - queryKey: variables === undefined ? ['PureByIds'] : ['PureByIds', variables], - queryFn: useFetchData(PureByIdsDocument).bind(null, variables), - ...options - } - )}; From a89466a08e87e5e699e81dbf8f00a5bf81bd8f03 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 16:21:36 +0100 Subject: [PATCH 08/12] delete instead of comment --- packages/ui/src/components/DeepTxAlert.tsx | 297 ------------------ .../Transactions/TransactionList.tsx | 10 - packages/ui/src/contexts/ModalsContext.tsx | 27 -- .../ui/src/contexts/MultiProxyContext.tsx | 8 +- ...ltisigsByMultisigOrPureSignatories.graphql | 17 - .../multisigsBySignatoriesOrWatched.graphql | 35 --- packages/ui/src/queries/pureByIds.graphql | 23 -- 7 files changed, 2 insertions(+), 415 deletions(-) delete mode 100644 packages/ui/src/components/DeepTxAlert.tsx delete mode 100644 packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql delete mode 100644 packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql delete mode 100644 packages/ui/src/queries/pureByIds.graphql diff --git a/packages/ui/src/components/DeepTxAlert.tsx b/packages/ui/src/components/DeepTxAlert.tsx deleted file mode 100644 index 0668a2222..000000000 --- a/packages/ui/src/components/DeepTxAlert.tsx +++ /dev/null @@ -1,297 +0,0 @@ -// import { Alert, Grid2 as Grid } from '@mui/material' -// import { styled } from '@mui/material/styles' -// import { useCallback, useEffect, useMemo, useState } from 'react' -// import { useMultisigsByMultisigOrPureSignatoriesQuery } from '../../types-and-hooks' -// import { MultisigAggregated, useMultiProxy } from '../contexts/MultiProxyContext' -// import { useAccountId } from '../hooks/useAccountId' -// import { CallDataInfoFromChain, usePendingTx } from '../hooks/usePendingTx' -// import { getIntersection } from '../utils/arrayUtils' -// import { useModals } from '../contexts/ModalsContext' -// import { Button } from './library' -// import { useAccounts } from '../contexts/AccountsContext' -// import AccountDisplay from './AccountDisplay/AccountDisplay' - -// export interface ParentMultisigInfo { -// parentSignatoryAddress: string -// parentMultisigAddress: string -// involvedMultisigProxyAddress?: string -// involvedMultisigAddress: string -// isSignatoryProxy: boolean -// threshold: number -// signatories: string[] -// } - -// interface Props { -// pendingTxCallData: string[] -// } - -// export const DeepTxAlert = ({ pendingTxCallData }: Props) => { -// const { selectedMultiProxy, selectedIsWatched } = useMultiProxy() -// const { onOpenDeepTxModal } = useModals() -// const { ownAddressList } = useAccounts() -// const proxyAndMultisigsIds = useMemo( -// () => -// [ -// selectedMultiProxy?.proxy || '', -// ...(selectedMultiProxy?.multisigs.map(({ address }) => address) || []) -// ].filter((a) => !!a), -// [selectedMultiProxy] -// ) -// const idsToQuery = useAccountId(proxyAndMultisigsIds) -// const { data } = useMultisigsByMultisigOrPureSignatoriesQuery({ -// accountIds: idsToQuery -// }) -// const [parentMultisigs, setParenMultisigs] = useState>({}) -// const parentMultisigAddresses = useMemo(() => Object.keys(parentMultisigs), [parentMultisigs]) - -// useEffect(() => { -// if (!data || data?.accountMultisigs.length === 0) { -// setParenMultisigs({}) -// return -// } - -// // the data is the list of multisig with our current -// // multisig/pure being a signatory -// if (data && data.accountMultisigs.length > 0) { -// // Create a map with the parent multisig -// // that is involved in a Tx with the current pure/multisig as signatory -// const parentInfoMap = data.accountMultisigs.reduce( -// (acc: Record, currParentMultisig) => { -// const parentMultisigSignatories = currParentMultisig.multisig.signatories.map( -// ({ signatory }) => signatory.address -// ) - -// let signatoryOfParent = { address: '', isSignatoryProxy: false } -// let relevantMultisigAddress = '' - -// // See if the parent signatories is one of our pure or our current multisig -// if ( -// selectedMultiProxy?.proxy && -// parentMultisigSignatories.includes(selectedMultiProxy?.proxy) -// ) { -// signatoryOfParent = { address: selectedMultiProxy?.proxy, isSignatoryProxy: true } -// } else { -// // it must be one of our multisig then -// const relevantMultisig = getIntersection( -// selectedMultiProxy?.multisigs.map(({ address }) => address), -// parentMultisigSignatories -// ) - -// if (!relevantMultisig.length) { -// console.error( -// 'Unexpected error: No multisig or proxy found as signatory', -// data, -// selectedMultiProxy -// ) -// } - -// relevantMultisigAddress = relevantMultisig[0] - -// signatoryOfParent = { -// // here, we may have several of our current multisigs -// // being a signatory of the parent. We go for the first -// address: relevantMultisig[0], -// isSignatoryProxy: false -// } -// } - -// return { -// ...acc, -// [currParentMultisig.multisig.address]: { -// parentSignatoryAddress: signatoryOfParent.address, -// involvedMultisigAddress: relevantMultisigAddress, -// involvedMultisigProxyAddress: selectedMultiProxy?.proxy, -// isSignatoryProxy: signatoryOfParent.isSignatoryProxy, -// threshold: currParentMultisig.multisig.threshold || 0, -// signatories: currParentMultisig.multisig.signatories.map( -// ({ signatory }) => signatory.address -// ) -// } as ParentMultisigInfo -// } -// }, -// {} as Record -// ) -// setParenMultisigs(parentInfoMap) -// } -// }, [data, selectedMultiProxy]) - -// const onClickCreate = useCallback( -// (aggregatedData: CallDataInfoFromChain) => { -// if (!aggregatedData) return - -// let possibleSigners: string[] = [] -// let currentMultisigInvolved: MultisigAggregated | undefined - -// // if the signatory is the pure we select -// // the first multisig as the possible signatory -// if (parentMultisigs[aggregatedData.from].isSignatoryProxy) { -// currentMultisigInvolved = selectedMultiProxy?.multisigs[0] -// possibleSigners = getIntersection(ownAddressList, currentMultisigInvolved?.signatories) -// } else { -// /// otherwise if it's a specific multisig we should find it -// currentMultisigInvolved = selectedMultiProxy?.multisigs.find((add) => { -// return add.address === parentMultisigs[aggregatedData.from].parentSignatoryAddress -// }) -// possibleSigners = getIntersection(ownAddressList, currentMultisigInvolved?.signatories) -// } - -// if (!possibleSigners.length) { -// console.error( -// 'Unexpected error: Could not find the possible signatories', -// aggregatedData.from, -// parentMultisigs, -// selectedMultiProxy -// ) -// } - -// if (!currentMultisigInvolved) { -// console.error( -// 'Unexpected error: Could not find the current multisig involved', -// aggregatedData.from, -// parentMultisigs, -// selectedMultiProxy -// ) - -// return -// } - -// onOpenDeepTxModal({ -// possibleSigners, -// proposalData: aggregatedData, -// parentMultisigInfo: parentMultisigs[aggregatedData.from], -// currentMultisigInvolved -// }) -// }, -// [onOpenDeepTxModal, ownAddressList, parentMultisigs, selectedMultiProxy] -// ) - -// const { txWithCallDataByDate } = usePendingTx(parentMultisigAddresses, true) - -// if (!parentMultisigAddresses.length || Object.values(txWithCallDataByDate).length === 0) -// return null - -// return Object.values(txWithCallDataByDate).map((data) => { -// const filteredMap = data.filter((call) => { -// // filter the tx that are potentially already created and are pending -// // when we have the calldata in both (in case it's an as multi) -// if ( -// call?.callData && -// pendingTxCallData.some((pendingCallData) => -// pendingCallData.includes(call.callData?.slice(2) as string) -// ) -// ) { -// console.info('filtering call, currently signing (with asMulti)', call) -// return false -// } - -// // filter the tx that are potentially already created and are pending -// // when we have the hash of the parent in the current calldata (in case it's an approveAsMulti) -// if ( -// pendingTxCallData.some((pendingCallData) => { -// const isIncluded = pendingCallData.includes(call.hash?.slice(2) as string) -// return isIncluded -// }) -// ) { -// console.info('filtering call, currently signing (with approveAsMult)', call) -// return false -// } - -// // filter the tx where we've already signed -// if (call.info?.approvals.includes(parentMultisigs[call.from].parentSignatoryAddress)) { -// console.info('filtering call, already signed', call) -// return false -// } - -// return true -// }) - -// return filteredMap.map((data1) => ( -// -// -// -// -// Pending tx {data1.name} -// -// -// from: -// -// -// -// -// {!selectedIsWatched && } -// -// -// -// )) -// }) -// } - -// const FunctionNameStyled = styled('span')` -// padding: 0.5rem; -// margin: 0 0.5rem 0 0.5rem; -// background-color: ${(props) => props.theme.custom.proxyBadge.multi}; -// text-overflow: ellipsis; -// overflow: hidden; -// ` - -// const InfoTextStyled = styled(Grid)` -// /* flex: 1; -// display: flex;*/ -// align-items: center; -// margin: 0; - -// button { -// margin-left: auto; -// margin-right: 2px; -// } - -// .gridItem { -// padding: 0; -// } -// ` - -// const AlertStyled = styled(Alert)` -// width: 100%; -// margin-top: 0.5rem; -// margin-bottom: 0.5rem; - -// .MuiAlert-message { -// display: flex; -// align-items: center; -// width: 100%; -// } - -// .MuiAlert-icon { -// align-items: center; -// } -// ` diff --git a/packages/ui/src/components/Transactions/TransactionList.tsx b/packages/ui/src/components/Transactions/TransactionList.tsx index 941316018..3f94e8395 100644 --- a/packages/ui/src/components/Transactions/TransactionList.tsx +++ b/packages/ui/src/components/Transactions/TransactionList.tsx @@ -7,7 +7,6 @@ import { useAccounts } from '../../contexts/AccountsContext' import { MdOutlineFlare as FlareIcon } from 'react-icons/md' import Transaction from './Transaction' import { useMemo } from 'react' -// import { DeepTxAlert } from '../DeepTxAlert' interface Props { className?: string @@ -25,18 +24,9 @@ const TransactionList = ({ className }: Props) => { refresh } = usePendingTx(multisigAddresses) const { ownAddressList } = useAccounts() - // const pendingTxCallData = useMemo(() => { - // return Object.values(txWithCallDataByDate) - // .reduce((acc, curr) => { - // return [...acc, ...curr] - // }, []) - // .map(({ callData }) => callData) - // .filter((a) => !!a) as string[] - // }, [txWithCallDataByDate]) return ( - {/* */}

Transactions

{isLoadingPendingTxs && ( diff --git a/packages/ui/src/contexts/ModalsContext.tsx b/packages/ui/src/contexts/ModalsContext.tsx index deafc6ded..a925f6ddd 100644 --- a/packages/ui/src/contexts/ModalsContext.tsx +++ b/packages/ui/src/contexts/ModalsContext.tsx @@ -8,7 +8,6 @@ import WCSessionProposal from '../components/modals/WalletConnectSessionProposal import ProposalSigningModal, { SigningModalProps } from '../components/modals/ProposalSigning' import WalletConnectSigning from '../components/modals/WalletConnectSigning' import { useMultiProxy } from './MultiProxyContext' -// import DeepTxCreationModal, { DeepTxCreationProps } from '../components/modals/DeepTxCreation' interface ModalsContextProps { setIsEditModalOpen: (isOpen: boolean) => void @@ -17,8 +16,6 @@ interface ModalsContextProps { onCloseSendModal: () => void openWalletConnectSessionModal: ({ sessionProposal }: OpenWCModalParams) => void onOpenSigningModal: (info: SigningInfo) => void - // onOpenDeepTxModal: (info: DeepTxModalInfo) => void - // onCloseDeepTxModal: () => void onOpenWalletConnectSigning: (request: SignClientTypes.EventArguments['session_request']) => void } @@ -37,8 +34,6 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { const [isSendModalOpen, setIsSendModalOpen] = useState(false) const [isWCModalOpen, setIsWCModalOpen] = useState(false) const [isSigningModalOpen, setIsSigningModalOpen] = useState(false) - // const [isDeepTxModalOpen, setIsDeepTxModalOpen] = useState(false) - // const [deepTxModalInfo, setDeepTxModalInfo] = useState() const [signingModalInfo, setSigningModalInfo] = useState() const [isOpenWalletConnectSigning, setIsOpenWalletConnectSigning] = useState(false) const [sendModalPreselection, setSendModalPreselection] = useState( @@ -100,16 +95,6 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { setIsSigningModalOpen(true) }, []) - // const onOpenDeepTxModal = useCallback((info: DeepTxModalInfo) => { - // setDeepTxModalInfo(info) - // setIsDeepTxModalOpen(true) - // }, []) - - // const onCloseDeepTxModal = useCallback(() => { - // setDeepTxModalInfo(undefined) - // setIsDeepTxModalOpen(false) - // }, []) - const onOpenWalletConnectSigning = useCallback( (request: SignClientTypes.EventArguments['session_request']) => { setWalletConnectRequest(request) @@ -133,8 +118,6 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { openWalletConnectSessionModal, onOpenSigningModal, onOpenWalletConnectSigning - // onOpenDeepTxModal, - // onCloseDeepTxModal }} > {children} @@ -162,16 +145,6 @@ const ModalsContextProvider = ({ children }: React.PropsWithChildren) => { onSuccess={signingModalInfo.onSuccess} /> )} - {/* {isDeepTxModalOpen && deepTxModalInfo && ( - - )} */} {isOpenWalletConnectSigning && !!walletConnectRequest && ( (undefined) const getSignatoriesFromAccount = ( - signatories: MultisigsBySignatoriesOrWatchedQuery['accountMultisigs'][0]['multisig']['signatories'] + signatories: MultisigsAndPureByAccountQuery['accounts'][0]['signatories'] ) => { return signatories.map(({ signatory }) => signatory.address) } diff --git a/packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql b/packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql deleted file mode 100644 index b1f0bee70..000000000 --- a/packages/ui/src/queries/multisigsByMultisigOrPureSignatories.graphql +++ /dev/null @@ -1,17 +0,0 @@ -# query MultisigsByMultisigOrPureSignatories($accountIds: [String!]) { -# accountMultisigs(where: { signatory: { id_in: $accountIds } }, limit: 10) { -# id -# multisig { -# id -# address -# threshold -# signatories(limit: 10) { -# id -# signatory { -# id -# address -# } -# } -# } -# } -# } diff --git a/packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql b/packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql deleted file mode 100644 index abb859980..000000000 --- a/packages/ui/src/queries/multisigsBySignatoriesOrWatched.graphql +++ /dev/null @@ -1,35 +0,0 @@ -# query MultisigsBySignatoriesOrWatched($accountIds: [String!], $watchedAccountIds: [String!]) { -# accountMultisigs( -# where: { -# OR: [ -# { multisig: { id_in: $watchedAccountIds } } -# { signatory: { id_in: $accountIds } } -# { signatory: { id_in: $watchedAccountIds } } -# ] -# } -# limit: 500 -# ) { -# id -# multisig { -# id -# address -# threshold -# signatories(limit: 100) { -# id -# signatory { -# id -# address -# } -# } -# delegateeFor(limit: 100) { -# id -# type -# delegator { -# id -# address -# isPureProxy -# } -# } -# } -# } -# } diff --git a/packages/ui/src/queries/pureByIds.graphql b/packages/ui/src/queries/pureByIds.graphql deleted file mode 100644 index a5f72912e..000000000 --- a/packages/ui/src/queries/pureByIds.graphql +++ /dev/null @@ -1,23 +0,0 @@ -# query PureByIds($pureIds: [String!]) { -# accounts(where: { AND: [{ id_in: $pureIds }, { isPureProxy_eq: true }] }, limit: 50) { -# id -# address -# delegatorFor(limit: 50) { -# id -# type -# delegatee { -# id -# address -# isMultisig -# threshold -# signatories(limit: 50) { -# id -# signatory { -# id -# address -# } -# } -# } -# } -# } -# } From 57eaeea83799e6227fd78f791048996edecf803b Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 16:22:52 +0100 Subject: [PATCH 09/12] nit --- packages/ui/src/contexts/ModalsContext.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/ui/src/contexts/ModalsContext.tsx b/packages/ui/src/contexts/ModalsContext.tsx index a925f6ddd..cf7632a4e 100644 --- a/packages/ui/src/contexts/ModalsContext.tsx +++ b/packages/ui/src/contexts/ModalsContext.tsx @@ -24,7 +24,6 @@ interface OpenWCModalParams { } type SigningInfo = Omit -// type DeepTxModalInfo = Omit const ModalsContext = createContext(undefined) From 9288c2f7c8685cc8a762011ad7b5380220cac611 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 16:29:25 +0100 Subject: [PATCH 10/12] clean --- .../src/components/modals/DeepTxCreation.tsx | 355 ------------------ 1 file changed, 355 deletions(-) delete mode 100644 packages/ui/src/components/modals/DeepTxCreation.tsx diff --git a/packages/ui/src/components/modals/DeepTxCreation.tsx b/packages/ui/src/components/modals/DeepTxCreation.tsx deleted file mode 100644 index 961e48854..000000000 --- a/packages/ui/src/components/modals/DeepTxCreation.tsx +++ /dev/null @@ -1,355 +0,0 @@ -import { - Alert, - CircularProgress, - Dialog, - DialogContent, - DialogTitle, - Grid2 as Grid -} from '@mui/material' -import { Button, TextField } from '../library' -import { ChangeEvent, ReactNode, useCallback, useEffect, useMemo, useState } from 'react' -import { styled } from '@mui/material/styles' -import { useAccounts } from '../../contexts/AccountsContext' -import { useApi } from '../../contexts/ApiContext' -import { MultisigAggregated, useMultiProxy } from '../../contexts/MultiProxyContext' -import CallInfo from '../CallInfo' -import SignerSelection from '../select/SignerSelection' -import { useSigningCallback } from '../../hooks/useSigningCallback' -import { useCallInfoFromCallData } from '../../hooks/useCallInfoFromCallData' -import { ModalCloseButton } from '../library/ModalCloseButton' -import { useCheckBalance } from '../../hooks/useCheckBalance' -import { CallDataInfoFromChain } from '../../hooks/usePendingTx' -import { ParentMultisigInfo } from '../DeepTxAlert' -import { useGetMultisigTx } from '../../hooks/useGetMultisigTx' -import { ProxyType } from '../../../types-and-hooks' -import { getErrorMessageReservedFunds } from '../../utils/getErrorMessageReservedFunds' -import { getExtrinsicName } from '../../utils/getExtrinsicName' -import { useMultisigProposalNeededFunds } from '../../hooks/useMultisigProposalNeededFunds' -import { formatBigIntBalance } from '../../utils/formatBnBalance' -import { hashFromTx } from '../../utils/txHash' -import { HexString } from 'polkadot-api' - -export interface DeepTxCreationProps { - onClose: () => void - className?: string - possibleSigners: string[] - proposalData: CallDataInfoFromChain - onSuccess?: () => void - parentMultisigInfo: ParentMultisigInfo - currentMultisigInvolved: MultisigAggregated -} - -const DeepTxCreationModal = ({ - onClose, - className, - possibleSigners, - proposalData, - onSuccess, - parentMultisigInfo, - currentMultisigInvolved -}: DeepTxCreationProps) => { - const { api, chainInfo, compatibilityToken } = useApi() - const [isSubmitting, setIsSubmitting] = useState(false) - const { selectedAccount } = useAccounts() - const [errorMessage, setErrorMessage] = useState('') - const { selectedMultiProxy, getMultisigByAddress, setRefetchMultisigTimeoutMinutes } = - useMultiProxy() - const [addedCallData, setAddedCallData] = useState() - const mustSubmitCallData = useMemo(() => { - if (!parentMultisigInfo.threshold || !proposalData.info?.approvals) return true - - // if it's the last approval call, we must use asMulti and have the call data - // either from the chain, or from users - return proposalData.info?.approvals.length >= parentMultisigInfo.threshold - 1 - }, [parentMultisigInfo.threshold, proposalData.info?.approvals]) - - const { callInfo: parentCallInfo, isGettingCallInfo: isGettingParentCallInfo } = - useCallInfoFromCallData(proposalData.callData || addedCallData) - - // this will never be a proxy, if there's a proxy, it's already in the call - const parentMultisigTx = useGetMultisigTx({ - fromAddress: parentMultisigInfo.parentSignatoryAddress, - extrinsicToCall: (api && parentCallInfo?.call && parentCallInfo?.call) || undefined, - senderAddress: parentMultisigInfo.parentSignatoryAddress, - isProxy: false, - threshold: parentMultisigInfo.threshold, - selectedMultisig: { - address: parentMultisigInfo.parentMultisigAddress, - signatories: parentMultisigInfo.signatories, - threshold: parentMultisigInfo.threshold, - type: ProxyType.Any - }, - approvalLength: proposalData.info?.approvals.length, - weight: parentCallInfo?.weight, - when: proposalData.info?.when, - forceAsMulti: false, - approveAsMultiHash: proposalData.hash as HexString - }) - - // this is the one that we submit to the child multisig - // it contains the first multisig tx (from the child) - // and calls a asMulti because it's a creation - const fullTx = useGetMultisigTx({ - fromAddress: parentMultisigInfo.parentSignatoryAddress, - extrinsicToCall: (api && parentMultisigTx && parentMultisigTx) || undefined, - senderAddress: selectedAccount?.address, - isProxy: !!parentMultisigInfo.isSignatoryProxy, - threshold: currentMultisigInvolved?.threshold, - selectedMultisig: parentMultisigInfo.isSignatoryProxy - ? selectedMultiProxy?.multisigs[0] - : getMultisigByAddress(parentMultisigInfo.involvedMultisigAddress), - forceAsMulti: true - }) - - const { multisigProposalNeededFunds, reserved } = useMultisigProposalNeededFunds({ - threshold: currentMultisigInvolved?.threshold, - signatories: currentMultisigInvolved?.signatories, - call: fullTx - }) - - const { hasEnoughFreeBalance: hasSignerEnoughFunds } = useCheckBalance({ - min: multisigProposalNeededFunds, - address: selectedAccount?.address - }) - - const onSubmitting = useCallback(() => { - setIsSubmitting(false) - onClose() - }, [onClose]) - - const signCallback = useSigningCallback({ - onSuccess: () => { - onSuccess && onSuccess() - // // poll for 1min if the tx may make changes - // // such as creating a proxy, adding/removing a multisig - if (mustSubmitCallData) { - setRefetchMultisigTimeoutMinutes(1) - } - }, - onSubmitting, - onError: () => setIsSubmitting(false) - }) - - useEffect(() => { - if (!compatibilityToken) { - return - } - - const hash = - !!parentCallInfo?.call && - hashFromTx(parentCallInfo?.call?.getEncodedData(compatibilityToken).asHex()) - - if (hash !== proposalData.hash) { - setErrorMessage("The callData provided doesn't match with the on-chain transaction") - return - } - }, [compatibilityToken, parentCallInfo, proposalData]) - - useEffect(() => { - if (multisigProposalNeededFunds !== 0n && !hasSignerEnoughFunds) { - const requiredBalanceString = formatBigIntBalance( - multisigProposalNeededFunds, - chainInfo?.tokenDecimals, - { tokenSymbol: chainInfo?.tokenSymbol } - ) - - const reservedString = formatBigIntBalance(reserved, chainInfo?.tokenDecimals, { - tokenSymbol: chainInfo?.tokenSymbol - }) - const errorWithReservedFunds = getErrorMessageReservedFunds( - '"Signing with" account', - requiredBalanceString, - reservedString - ) - setErrorMessage(errorWithReservedFunds) - } - }, [chainInfo, reserved, hasSignerEnoughFunds, multisigProposalNeededFunds]) - - const onSign = useCallback(async () => { - if (!api) { - const error = 'Api is not ready' - console.error(error) - setErrorMessage(error) - return - } - - if (!selectedAccount) { - const error = 'No selected account' - console.error(error) - setErrorMessage(error) - return - } - - // if the callData is needed, but none was supplied or found - if (mustSubmitCallData && !parentCallInfo?.call) { - const error = 'No callData found or supplied' - console.error(error) - setErrorMessage(error) - return - } - - if (!fullTx) { - const error = 'No extrinsic to call' - console.error(error) - setErrorMessage(error) - return - } - - setIsSubmitting(true) - - fullTx - .signSubmitAndWatch(selectedAccount.polkadotSigner, { at: 'best' }) - .subscribe(signCallback) - }, [api, mustSubmitCallData, parentCallInfo, fullTx, selectedAccount, signCallback]) - - const onAddedCallDataChange = useCallback( - (event: ChangeEvent) => { - setErrorMessage('') - setAddedCallData(event.target.value as HexString) - }, - [] - ) - - return ( - - - Create Transaction - - - - - setErrorMessage('')} - /> - - - <> - - - Call hash -
- - {proposalData.hash} - -
- - {!proposalData.callData && ( - <> - - - - - - - )} - {!!parentCallInfo?.call && ( - <> - - - - - - )} - {!!errorMessage && ( - <> - - - {errorMessage} - - - )} - - {!isGettingParentCallInfo && ( - - )} - {isGettingParentCallInfo && ( - - )} - - -
-
- ) -} - -const HashGridStyled = styled(Grid)` - margin-top: 1rem; - overflow: hidden; - text-overflow: ellipsis; - - .title { - color: ${({ theme }) => theme.custom.text.primary}; - font-weight: 500; - font-size: large; - } - - .hash { - font-size: small; - } -` -export default styled(DeepTxCreationModal)( - ({ theme }) => ` - .buttonContainer { - text-align: right; - margin-top: 1rem; - } - - .errorMessage { - margin-top: 0.5rem; - color: ${theme.custom.error}; - } - - .addedCallData { - margin-top: 1rem; - } -` -) From c433b14648533592931ca322884d9d2f901340b1 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 23:21:11 +0100 Subject: [PATCH 11/12] donot repeat the call for the first --- packages/ui/src/components/CallInfo.tsx | 30 +++++++++++++++++++------ 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/ui/src/components/CallInfo.tsx b/packages/ui/src/components/CallInfo.tsx index 28651cc3a..88f28568c 100644 --- a/packages/ui/src/components/CallInfo.tsx +++ b/packages/ui/src/components/CallInfo.tsx @@ -148,11 +148,18 @@ const eachFieldRendered = (value: Record, chainInfo: ChainInfoHuman return
  • {JSONprint(value)}
  • } -const preparedCall = ( - decodedCall: CreateTreeParams['decodedCall'], - chainInfo: ChainInfoHuman, - isBatch = false -) => { +interface PreparedCallParams { + decodedCall: CreateTreeParams['decodedCall'] + chainInfo: ChainInfoHuman + isBatch?: boolean + isFirstCall?: boolean +} +const preparedCall = ({ + decodedCall, + chainInfo, + isBatch = false, + isFirstCall = false +}: PreparedCallParams) => { if (!decodedCall) return if (isBatchedCall(decodedCall.type, decodedCall.value.type)) { @@ -161,7 +168,11 @@ const preparedCall = ( return lowerLevelCalls.map((call, index) => { return ( - {preparedCall(call as CreateTreeParams['decodedCall'], chainInfo, true)} + {preparedCall({ + decodedCall: call as CreateTreeParams['decodedCall'], + chainInfo, + isBatch: true + })} ) }) @@ -189,6 +200,10 @@ const preparedCall = ( } } + if (isFirstCall) { + return {JSONprint(decodedCall.value.value)} + } + return {JSONprint(decodedCall)} } @@ -197,7 +212,7 @@ const createUlTree = ({ name, decodedCall, chainInfo }: CreateTreeParams) => { if (!name) return if (!chainInfo) return - return preparedCall(decodedCall, chainInfo) + return preparedCall({ decodedCall, chainInfo, isFirstCall: true }) } const filterProxyProxy = (agg: Props['aggregatedData']): Props['aggregatedData'] => { @@ -299,6 +314,7 @@ const LinkStyled = styled(Link)` ` const PreStyled = styled('pre')` + margin-top: 0; overflow: auto; ` From a9cf8050bdfb8924020703b6020eafd7e8330b54 Mon Sep 17 00:00:00 2001 From: Thibaut Sardan Date: Thu, 12 Dec 2024 23:57:14 +0100 Subject: [PATCH 12/12] fix grid --- packages/ui/src/components/layout/Center.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ui/src/components/layout/Center.tsx b/packages/ui/src/components/layout/Center.tsx index fe127489b..e38bb46a4 100644 --- a/packages/ui/src/components/layout/Center.tsx +++ b/packages/ui/src/components/layout/Center.tsx @@ -15,6 +15,6 @@ export const Center = ({ children, className }: Props) => ( justifyContent="center" style={{ height: '100%' }} > - {children} + {children} )