-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace GraphQL subscriptions (WS) by queries with polling (HTTP) (#203)
The Graph is having issues with GraphQL subscriptions, so we are temporarily moving to queries with polling for the time being. Once subscriptions get enabled again on The Graph, we will move back to GraphQL subscriptions. This commit also adds the possibility to consume the organization connector from any app connector, allowing to retrieve its options for example. This was done so that app connectors using TheGraph can inherit from the pollInterval defined in the main connector. This commit also updates the nodejs/ demos.
- Loading branch information
Showing
38 changed files
with
438 additions
and
211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,37 @@ | ||
import { createAppConnector } from '@aragon/connect-core' | ||
|
||
import Agreement from './models/Agreement' | ||
import AgreementConnectorTheGraph, { | ||
subgraphUrlFromChainId, | ||
} from './thegraph/connector' | ||
|
||
type Config = { | ||
subgraphUrl: string | ||
pollInterval?: number | ||
subgraphUrl?: string | ||
} | ||
|
||
export default createAppConnector<Agreement, Config>( | ||
({ app, config, connector, network, verbose }) => { | ||
({ app, config, connector, network, orgConnector, verbose }) => { | ||
if (connector !== 'thegraph') { | ||
console.warn( | ||
`Connector unsupported: ${connector}. Using "thegraph" instead.` | ||
) | ||
} | ||
|
||
const subgraphUrl = | ||
config.subgraphUrl ?? subgraphUrlFromChainId(network.chainId) | ||
const agreementConnector = new AgreementConnectorTheGraph( | ||
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(agreementConnector, app.address) | ||
verbose, | ||
}) | ||
|
||
return new Agreement(connectorTheGraph, app.address) | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.