• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

decentraland / transactions-server / 12655278890

07 Jan 2025 04:30PM UTC coverage: 61.994% (-0.6%) from 62.577%
12655278890

Pull #123

github

LautaroPetaccio
fix: Build
Pull Request #123: fix: Remove gelato FF

71 of 109 branches covered (65.14%)

Branch coverage included in aggregate %.

6 of 6 new or added lines in 3 files covered. (100.0%)

20 existing lines in 1 file now uncovered.

327 of 533 relevant lines covered (61.35%)

3.22 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/components.ts
1
import path from 'path'
×
2
import { createDotEnvConfigComponent } from '@well-known-components/env-config-provider'
×
3
import {
×
4
  createServerComponent,
5
  createStatusCheckComponent,
6
} from '@well-known-components/http-server'
7
import { createTracerComponent } from '@well-known-components/tracer-component'
×
8
import { createLogComponent } from '@well-known-components/logger'
×
9
import { createMetricsComponent } from '@well-known-components/metrics'
×
10
import { createSubgraphComponent } from '@well-known-components/thegraph-component'
×
11
import { createHttpTracerComponent } from '@well-known-components/http-tracer-component'
×
12
import {
×
13
  instrumentHttpServerWithRequestLogger,
14
  Verbosity,
15
} from '@well-known-components/http-requests-logger-component'
16
import { createPgComponent } from '@well-known-components/pg-component'
×
17
import { createFeaturesComponent } from '@well-known-components/features-component'
×
18
import { createContractsComponent } from './ports/contracts/component'
×
19
import { createFetchComponent } from './ports/fetcher'
×
20
import { createTransactionComponent } from './ports/transaction/component'
×
21
import { metricDeclarations } from './metrics'
×
22
import { AppComponents, GlobalContext } from './types'
23
import { createBiconomyComponent } from './ports/biconomy'
×
24
import { createGelatoComponent } from './ports/gelato'
×
25

UNCOV
26
export async function initComponents(): Promise<AppComponents> {
×
27
  // default config from process.env + .env file
UNCOV
28
  const config = await createDotEnvConfigComponent(
×
29
    { path: ['.env.defaults', '.env'] },
30
    process.env
31
  )
32

UNCOV
33
  const cors = {
×
34
    origin: (await config.requireString('CORS_ORIGIN'))
35
      .split(';')
UNCOV
36
      .map((origin) => new RegExp(origin)),
×
37
    method: await config.getString('CORS_METHOD'),
38
  }
39

UNCOV
40
  const tracer = createTracerComponent()
×
41

42
  const logs = await createLogComponent({ config, tracer })
×
UNCOV
43
  const server = await createServerComponent<GlobalContext>(
×
44
    { config, logs },
45
    { cors, compression: {} }
46
  )
47
  createHttpTracerComponent({ server, tracer })
×
UNCOV
48
  instrumentHttpServerWithRequestLogger(
×
49
    { server, logger: logs },
50
    { verbosity: Verbosity.INFO }
51
  )
52
  const statusChecks = await createStatusCheckComponent({ config, server })
×
53
  const fetcher = await createFetchComponent({ tracer })
×
UNCOV
54
  const features = await createFeaturesComponent(
×
55
    {
56
      config,
57
      logs,
58
      fetch: fetcher,
59
    },
60
    await config.requireString('TRANSACTIONS_SERVER_URL')
61
  )
UNCOV
62
  const metrics = await createMetricsComponent(metricDeclarations, {
×
63
    server,
64
    config,
65
  })
66

UNCOV
67
  let databaseUrl: string | undefined = await config.getString(
×
68
    'PG_COMPONENT_PSQL_CONNECTION_STRING'
69
  )
70

71
  if (!databaseUrl) {
×
72
    const dbUser = await config.requireString('PG_COMPONENT_PSQL_USER')
×
UNCOV
73
    const dbDatabaseName = await config.requireString(
×
74
      'PG_COMPONENT_PSQL_DATABASE'
75
    )
76
    const dbPort = await config.requireString('PG_COMPONENT_PSQL_PORT')
×
77
    const dbHost = await config.requireString('PG_COMPONENT_PSQL_HOST')
×
78
    const dbPassword = await config.requireString('PG_COMPONENT_PSQL_PASSWORD')
×
UNCOV
79
    databaseUrl = `postgres://${dbUser}:${dbPassword}@${dbHost}:${dbPort}/${dbDatabaseName}`
×
80
  }
81

UNCOV
82
  const pg = await createPgComponent(
×
83
    { logs, config, metrics },
84
    {
85
      migration: {
86
        databaseUrl,
87
        dir: path.resolve(__dirname, 'migrations'),
88
        migrationsTable: 'pgmigrations',
89
        ignorePattern: '.*\\.map',
90
        direction: 'up',
91
      },
92
    }
93
  )
UNCOV
94
  const collectionsSubgraph = await createSubgraphComponent(
×
95
    { config, logs, fetch: fetcher, metrics },
96
    await config.requireString('COLLECTIONS_SUBGRAPH_URL')
97
  )
98

UNCOV
99
  const contracts = await createContractsComponent({
×
100
    config,
101
    fetcher,
102
    collectionsSubgraph,
103
  })
104

UNCOV
105
  const biconomy = await createBiconomyComponent({
×
106
    logs,
107
    config,
108
    fetcher,
109
    metrics,
110
  })
UNCOV
111
  const gelato = await createGelatoComponent({ logs, config, fetcher, metrics })
×
112

UNCOV
113
  const transaction = createTransactionComponent({
×
114
    config,
115
    features,
116
    fetcher,
117
    logs,
118
    pg,
119
    gelato,
120
    contracts,
121
    metrics,
122
  })
UNCOV
123
  const globalLogger = logs.getLogger('transactions-server')
×
124

UNCOV
125
  return {
×
126
    config,
127
    logs,
128
    globalLogger,
129
    fetcher,
130
    features,
131
    metrics,
132
    server,
133
    pg,
134
    biconomy,
135
    gelato,
136
    transaction,
137
    contracts,
138
    collectionsSubgraph,
139
    statusChecks,
140
  }
141
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc