@sentio/runtime 1.40.0 → 1.40.1-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/endpoints.d.ts +1 -0
- package/lib/endpoints.js +1 -0
- package/lib/endpoints.js.map +1 -1
- package/lib/processor-runner.js +7 -1
- package/lib/processor-runner.js.map +1 -1
- package/package.json +5 -4
- package/src/endpoints.ts +2 -0
- package/src/processor-runner.ts +9 -1
package/lib/endpoints.d.ts
CHANGED
package/lib/endpoints.js
CHANGED
package/lib/endpoints.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IACpB,MAAM,CAAC,QAAQ,GAAc,IAAI,SAAS,EAAE,CAAA;IAE5C,MAAM,CAAC,KAAK;QACV,SAAS,CAAC,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAA;IACtC,CAAC;IACD,gBAAgB;IAChB,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAA;IAEvC,aAAa,GAAG,EAAE,CAAA;IAClB,YAAY,GAAG,EAAE,CAAA;;
|
1
|
+
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":";;;AAEA,MAAa,SAAS;IACpB,MAAM,CAAC,QAAQ,GAAc,IAAI,SAAS,EAAE,CAAA;IAE5C,MAAM,CAAC,KAAK;QACV,SAAS,CAAC,QAAQ,GAAG,IAAI,SAAS,EAAE,CAAA;IACtC,CAAC;IACD,gBAAgB;IAChB,SAAS,GAAG,IAAI,GAAG,EAAoB,CAAA;IAEvC,aAAa,GAAG,EAAE,CAAA;IAClB,YAAY,GAAG,EAAE,CAAA;IAEjB,WAAW,GAAG,IAAI,GAAG,EAAkB,CAAA;;AAZzC,8BAaC","sourcesContent":["import { Provider } from '@ethersproject/providers'\n\nexport class Endpoints {\n static INSTANCE: Endpoints = new Endpoints()\n\n static reset() {\n Endpoints.INSTANCE = new Endpoints()\n }\n // evm providers\n providers = new Map<number, Provider>()\n\n chainQueryAPI = ''\n priceFeedAPI = ''\n\n chainServer = new Map<string, string>()\n}\n"]}
|
package/lib/processor-runner.js
CHANGED
@@ -71,7 +71,7 @@ if (options['log-format'] === 'json') {
|
|
71
71
|
},
|
72
72
|
};
|
73
73
|
const logger = (0, winston_1.createLogger)({
|
74
|
-
format: winston_1.format.combine(winston_1.format.timestamp({ format: 'YYYY-MM-DDTHH:mm:
|
74
|
+
format: winston_1.format.combine(winston_1.format.timestamp({ format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' }), utilFormatter, winston_1.format.errors({ stack: true }), winston_1.format.json()),
|
75
75
|
transports: [new winston_1.transports.Console()],
|
76
76
|
});
|
77
77
|
console.log = (...args) => logger.info.call(logger, ...args);
|
@@ -88,6 +88,12 @@ const chainsConfig = fs_extra_1.default.readJsonSync(fullPath);
|
|
88
88
|
(0, provider_1.setProvider)(chainsConfig, options.concurrency, options['use-chainserver']);
|
89
89
|
endpoints_1.Endpoints.INSTANCE.chainQueryAPI = options['chainquery-server'];
|
90
90
|
endpoints_1.Endpoints.INSTANCE.priceFeedAPI = options['pricefeed-server'];
|
91
|
+
for (const [id, config] of Object.entries(chainsConfig)) {
|
92
|
+
const chainConfig = config;
|
93
|
+
if (chainConfig.ChainServer) {
|
94
|
+
endpoints_1.Endpoints.INSTANCE.chainServer.set(id, chainConfig.ChainServer);
|
95
|
+
}
|
96
|
+
}
|
91
97
|
if (options.debug) {
|
92
98
|
console.log('Starting Server', options);
|
93
99
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"processor-runner.js","sourceRoot":"","sources":["../src/processor-runner.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,gDAAuB;AACvB,wDAAyB;AACzB,2CAA4B;AAE5B,0EAA+C;AAC/C,yCAAwC;AACxC,qCAA0D;AAC1D,2FAAsF;A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AAI,OAAO,CAAC,KAAK,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,OAAO,CAAC,CAAA;CACxC;AAED,MAAM,MAAM,GAAG,IAAA,wBAAY,EAAC;IAC1B,8BAA8B,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IACjD,iCAAiC,EAAE,GAAG,GAAG,IAAI,GAAG,IAAI;IACpD,oCAAoC,EAAE,8CAAqB,CAAC,IAAI;CACjE,CAAC,CAAA;AAEF,MAAM,WAAW,GAAG,IAAI,8BAAoB,CAAC,GAAG,EAAE,CAAC,IAAA,aAAI,EAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAA;AACzF,MAAM,OAAO,GAAG,IAAI,uCAAwB,CAAC,WAAW,CAAC,CAAA;AAEzD,MAAM,CAAC,GAAG,CAAC,4BAAmB,EAAE,OAAO,CAAC,CAAA;AAExC,MAAM,CAAC,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;AAExC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAA","sourcesContent":["#!/usr/bin/env node\n\nimport path from 'path'\nimport fs from 'fs-extra'\nimport * as util from 'util'\n\nimport commandLineArgs from 'command-line-args'\nimport { createServer } from 'nice-grpc'\nimport { createLogger, transports, format } from 'winston'\nimport { CompressionAlgorithms } from '@grpc/grpc-js/build/src/compression-algorithms'\n\nimport { ProcessorDefinition } from '@sentio/protos'\nimport { ProcessorServiceImpl } from './service'\nimport { setProvider } from './provider'\nimport { State } from './state'\nimport { Endpoints } from './endpoints'\n\nimport { load } from './loader'\nimport { FullProcessorServiceImpl } from './full-service'\nimport { ChainConfig } from './chain-config'\n\nState.reset()\nEndpoints.reset()\n\nconst optionDefinitions = [\n { name: 'target', type: String, defaultOption: true },\n { name: 'port', alias: 'p', type: String, defaultValue: '4000' },\n { name: 'concurrency', type: Number, defaultValue: 4 },\n { name: 'use-chainserver', type: Boolean, defaultValue: false },\n {\n name: 'chains-config',\n alias: 'c',\n type: String,\n defaultValue: 'chains-config.json',\n },\n { name: 'chainquery-server', type: String, defaultValue: '' },\n { name: 'pricefeed-server', type: String, defaultValue: '' },\n { name: 'log-format', type: String, defaultValue: 'console' },\n { name: 'debug', type: Boolean, defaultValue: false },\n]\n\nconst options = commandLineArgs(optionDefinitions, { partial: true })\n\nif (options['log-format'] === 'json') {\n const utilFormatter = {\n transform: (info: any) => {\n const args = info[Symbol.for('splat')]\n if (args) {\n info.message = util.format(info.message, ...args)\n }\n return info\n },\n }\n const logger = createLogger({\n format: format.combine(\n format.timestamp({ format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' }),\n utilFormatter,\n format.errors({ stack: true }),\n format.json()\n ),\n transports: [new transports.Console()],\n })\n\n console.log = (...args) => logger.info.call(logger, ...args)\n console.info = (...args) => logger.info.call(logger, ...args)\n console.warn = (...args) => logger.warn.call(logger, ...args)\n console.error = (...args) => logger.error.call(logger, ...args)\n console.debug = (...args) => logger.debug.call(logger, ...args)\n}\nif (options.debug) {\n console.log('Starting with', options.target)\n}\n\nconst fullPath = path.resolve(options['chains-config'])\nconst chainsConfig = fs.readJsonSync(fullPath)\n\nsetProvider(chainsConfig, options.concurrency, options['use-chainserver'])\nEndpoints.INSTANCE.chainQueryAPI = options['chainquery-server']\nEndpoints.INSTANCE.priceFeedAPI = options['pricefeed-server']\n\nfor (const [id, config] of Object.entries(chainsConfig)) {\n const chainConfig = config as ChainConfig\n if (chainConfig.ChainServer) {\n Endpoints.INSTANCE.chainServer.set(id, chainConfig.ChainServer)\n }\n}\n\nif (options.debug) {\n console.log('Starting Server', options)\n}\n\nconst server = createServer({\n 'grpc.max_send_message_length': 128 * 1024 * 1024,\n 'grpc.max_receive_message_length': 128 * 1024 * 1024,\n 'grpc.default_compression_algorithm': CompressionAlgorithms.gzip,\n})\n\nconst baseService = new ProcessorServiceImpl(() => load(options.target), server.shutdown)\nconst service = new FullProcessorServiceImpl(baseService)\n\nserver.add(ProcessorDefinition, service)\n\nserver.listen('0.0.0.0:' + options.port)\n\nconsole.log('Processor Server Started')\n"]}
|
package/package.json
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
{
|
2
2
|
"name": "@sentio/runtime",
|
3
3
|
"license": "Apache-2.0",
|
4
|
-
"version": "1.40.
|
4
|
+
"version": "1.40.1-rc.2",
|
5
5
|
"scripts": {
|
6
6
|
"compile": "tsc -p .",
|
7
7
|
"build": "yarn compile",
|
8
8
|
"build_all": "yarn lerna run --scope=@sentio/runtime build --include-dependencies",
|
9
|
-
"test": "jest"
|
9
|
+
"test": "jest",
|
10
|
+
"run": "ts-node --files src/processor-runner.ts --log-format=json"
|
10
11
|
},
|
11
12
|
"dependencies": {
|
12
13
|
"@ethersproject/providers": "~5.7.0",
|
13
|
-
"@sentio/protos": "^1.40.
|
14
|
+
"@sentio/protos": "^1.40.1-rc.2",
|
14
15
|
"bignumber.js": "^9.1.0",
|
15
16
|
"command-line-args": "^5.2.1",
|
16
17
|
"command-line-usage": "^6.1.3",
|
@@ -46,5 +47,5 @@
|
|
46
47
|
"!{lib,src}/tests",
|
47
48
|
"!**/*.test.{js,ts}"
|
48
49
|
],
|
49
|
-
"gitHead": "
|
50
|
+
"gitHead": "8878c327716e56df804c1894c7f062a2c181c5d6"
|
50
51
|
}
|
package/src/endpoints.ts
CHANGED
package/src/processor-runner.ts
CHANGED
@@ -17,6 +17,7 @@ import { Endpoints } from './endpoints'
|
|
17
17
|
|
18
18
|
import { load } from './loader'
|
19
19
|
import { FullProcessorServiceImpl } from './full-service'
|
20
|
+
import { ChainConfig } from './chain-config'
|
20
21
|
|
21
22
|
State.reset()
|
22
23
|
Endpoints.reset()
|
@@ -52,7 +53,7 @@ if (options['log-format'] === 'json') {
|
|
52
53
|
}
|
53
54
|
const logger = createLogger({
|
54
55
|
format: format.combine(
|
55
|
-
format.timestamp({ format: 'YYYY-MM-DDTHH:mm:
|
56
|
+
format.timestamp({ format: 'YYYY-MM-DDTHH:mm:ss.SSSZ' }),
|
56
57
|
utilFormatter,
|
57
58
|
format.errors({ stack: true }),
|
58
59
|
format.json()
|
@@ -77,6 +78,13 @@ setProvider(chainsConfig, options.concurrency, options['use-chainserver'])
|
|
77
78
|
Endpoints.INSTANCE.chainQueryAPI = options['chainquery-server']
|
78
79
|
Endpoints.INSTANCE.priceFeedAPI = options['pricefeed-server']
|
79
80
|
|
81
|
+
for (const [id, config] of Object.entries(chainsConfig)) {
|
82
|
+
const chainConfig = config as ChainConfig
|
83
|
+
if (chainConfig.ChainServer) {
|
84
|
+
Endpoints.INSTANCE.chainServer.set(id, chainConfig.ChainServer)
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
80
88
|
if (options.debug) {
|
81
89
|
console.log('Starting Server', options)
|
82
90
|
}
|