import { createAppConnector } from '@aragon/connect-core' ; import Agreement from './models/Agreement' ; import AgreementConnectorTheGraph , { subgraphUrlFromChainId , } from './thegraph/connector' ; type Config = { pollInterval ? : number ; subgraphUrl ? : string ; } ; export default createAppConnector < Agreement , Config > ( async ( { app , config , connector , network , orgConnector , verbose } ) => { if ( connector !== 'thegraph' ) { console . warn ( `Connector unsupported: ${ connector }. Using "thegraph" instead.` ) ; } const subgraphUrl = config . subgraphUrl ?? subgraphUrlFromChainId ( network . chainId ) ?? undefined ; let pollInterval ; if ( orgConnector . name === 'thegraph' ) { pollInterval = config ?. pollInterval ?? orgConnector . config ?. pollInterval ?? undefined ; } const connectorTheGraph = await AgreementConnectorTheGraph . create ( { pollInterval , subgraphUrl , verbose , } ) ; return new Agreement ( connectorTheGraph , app ) ; } ) ;