UNPKG

quasvel

Version:

Access and interact with Aragon Organizations and their apps.

38 lines (31 loc) 985 B
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>( ({ 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 = new AgreementConnectorTheGraph({ pollInterval, subgraphUrl, verbose, }) return new Agreement(connectorTheGraph, app) } )