Skip to content

Commit

Permalink
Merge pull request #89 from decentraland/feat/thegraph-component
Browse files Browse the repository at this point in the history
 feat: thegraph component
  • Loading branch information
nicosantangelo committed May 20, 2022
2 parents 51b720e + d00b568 commit 7722440
Show file tree
Hide file tree
Showing 12 changed files with 170 additions and 89 deletions.
6 changes: 3 additions & 3 deletions .ci/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .ci/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "transactions-server-build",
"devDependencies": {
"@types/node": "^14.6.2"
"@types/node": "^16.11.36"
},
"dependencies": {
"dcl-ops-lib": "^5.0.1"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/node.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Use Node.js 14.x
- name: Use Node.js 16.x
uses: actions/setup-node@v1
with:
node-version: 14.x
node-version: 16.x
- name: install
run: npm ci
- name: build
Expand Down
145 changes: 145 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@well-known-components/interfaces": "^1.1.0",
"@well-known-components/logger": "^1.1.0",
"@well-known-components/metrics": "^1.1.1",
"@well-known-components/thegraph-component": "^1.0.0-20220518223517.commit-bae0ceb",
"ajv": "^8.6.0",
"decentraland-transactions": "^1.36.0",
"ethers": "^5.6.3",
Expand Down
9 changes: 5 additions & 4 deletions src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { createMetricsComponent } from '@well-known-components/metrics'
import { createContractsComponent } from './ports/contracts/component'
import { createDatabaseComponent } from './ports/database/component'
import { createFetchComponent } from './ports/fetcher'
import { createSubgraphComponent } from './ports/subgraph/component'
import { createTransactionComponent } from './ports/transaction/component'
import { metricDeclarations } from './metrics'
import { AppComponents, GlobalContext } from './types'
import { createSubgraphComponent } from '@well-known-components/thegraph-component'

export async function initComponents(): Promise<AppComponents> {
// default config from process.env + .env file
Expand All @@ -34,15 +34,16 @@ export async function initComponents(): Promise<AppComponents> {
{ logs },
{ filename: 'database.db' }
)
const collectionsSubgraph = createSubgraphComponent(
await config.requireString('COLLECTIONS_SUBGRAPH_URL')
)
const statusChecks = await createStatusCheckComponent({ server })
const fetcher = await createFetchComponent()
const metrics = await createMetricsComponent(metricDeclarations, {
server,
config,
})
const collectionsSubgraph = await createSubgraphComponent(
await config.requireString('COLLECTIONS_SUBGRAPH_URL'),
{ config, logs, fetch: fetcher, metrics }
)
const contracts = createContractsComponent({
config,
fetcher,
Expand Down
2 changes: 2 additions & 0 deletions src/metrics.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { IMetricsComponent } from '@well-known-components/interfaces'
import { validateMetricsDeclaration } from '@well-known-components/metrics'
import { metricDeclarations as thegraphMetrics } from '@well-known-components/thegraph-component'

export const metricDeclarations = {
dcl_error_sale_price_too_low: {
Expand Down Expand Up @@ -27,6 +28,7 @@ export const metricDeclarations = {
type: IMetricsComponent.CounterType,
labelNames: ['contract'],
},
...thegraphMetrics,
}

// type assertions
Expand Down
56 changes: 0 additions & 56 deletions src/ports/subgraph/component.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/ports/subgraph/types.ts

This file was deleted.

3 changes: 0 additions & 3 deletions src/ports/subgraph/utils.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IFetchComponent } from '@well-known-components/http-server'
import { ISubgraphComponent } from '@well-known-components/thegraph-component'
import type {
IConfigComponent,
ILoggerComponent,
Expand All @@ -8,7 +9,6 @@ import type {
} from '@well-known-components/interfaces'
import { metricDeclarations } from './metrics'
import { IDatabaseComponent } from './ports/database/types'
import { ISubgraphComponent } from './ports/subgraph/types'
import { ITestFetchComponent } from './ports/fetcher'
import { IContractsComponent } from './ports/contracts/types'
import { ITransactionComponent } from './ports/transaction/types'
Expand Down
Loading

0 comments on commit 7722440

Please sign in to comment.