@subql/node-stellar 2.9.3-2 → 2.9.3-3
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/dist/.tsbuildinfo +1 -1
- package/dist/configure/SubqueryProject.d.ts +1 -0
- package/dist/configure/SubqueryProject.js +18 -2
- package/dist/configure/SubqueryProject.js.map +1 -1
- package/dist/configure/configure.module.d.ts +4 -1
- package/dist/configure/configure.module.js +1 -0
- package/dist/configure/configure.module.js.map +1 -1
- package/dist/indexer/blockDispatcher/block-dispatcher.service.js +1 -1
- package/dist/indexer/blockDispatcher/block-dispatcher.service.js.map +1 -1
- package/dist/indexer/fetch.module.js.map +1 -1
- package/dist/indexer/fetch.service.js +97 -0
- package/dist/indexer/fetch.service.js.map +1 -1
- package/dist/indexer/fetch.service.spec.js +121 -47
- package/dist/indexer/fetch.service.spec.js.map +1 -1
- package/dist/indexer/indexer.manager.d.ts +24 -5
- package/dist/indexer/indexer.manager.js +62 -4
- package/dist/indexer/indexer.manager.js.map +1 -1
- package/dist/indexer/unfinalizedBlocks.service.js +1 -1
- package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
- package/dist/indexer/worker/worker.unfinalizedBlocks.service.js +1 -1
- package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -1
- package/dist/meta/meta.module.js.map +1 -1
- package/dist/meta/meta.service.d.ts +4 -0
- package/dist/meta/meta.service.js +6 -1
- package/dist/meta/meta.service.js.map +1 -1
- package/dist/stellar/api.connection.d.ts +2 -1
- package/dist/stellar/api.connection.js +4 -3
- package/dist/stellar/api.connection.js.map +1 -1
- package/dist/stellar/api.connection.spec.js +32 -36
- package/dist/stellar/api.connection.spec.js.map +1 -1
- package/dist/stellar/api.service.stellar.js +5 -1
- package/dist/stellar/api.service.stellar.js.map +1 -1
- package/dist/stellar/api.service.stellar.spec.d.ts +2 -2
- package/dist/stellar/api.service.stellar.spec.js +20 -22
- package/dist/stellar/api.service.stellar.spec.js.map +1 -1
- package/dist/stellar/api.stellar.d.ts +18 -8
- package/dist/stellar/api.stellar.js +160 -28
- package/dist/stellar/api.stellar.js.map +1 -1
- package/dist/stellar/api.stellar.spec.js +26 -38
- package/dist/stellar/api.stellar.spec.js.map +1 -1
- package/dist/stellar/block.stellar.d.ts +15 -5
- package/dist/stellar/block.stellar.js +50 -2
- package/dist/stellar/block.stellar.js.map +1 -1
- package/dist/stellar/block.stellar.spec.js +150 -46
- package/dist/stellar/block.stellar.spec.js.map +1 -1
- package/dist/stellar/safe-api.d.ts +2 -2
- package/dist/stellar/safe-api.js +3 -3
- package/dist/stellar/safe-api.js.map +1 -1
- package/dist/stellar/soroban.server.d.ts +8 -0
- package/dist/stellar/soroban.server.js +72 -0
- package/dist/stellar/soroban.server.js.map +1 -0
- package/dist/stellar/{stellar.server.spec.js → soroban.server.spec.js} +4 -4
- package/dist/stellar/{stellar.server.spec.js.map → soroban.server.spec.js.map} +1 -1
- package/dist/stellar/stellar.server.d.ts +6 -6
- package/dist/stellar/stellar.server.js +9 -61
- package/dist/stellar/stellar.server.js.map +1 -1
- package/dist/utils/project.d.ts +0 -2
- package/dist/utils/project.js +1 -12
- package/dist/utils/project.js.map +1 -1
- package/dist/yargs.d.ts +6 -1
- package/dist/yargs.js +5 -0
- package/dist/yargs.js.map +1 -1
- package/package.json +5 -4
- /package/dist/stellar/{stellar.server.spec.d.ts → soroban.server.spec.d.ts} +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors
|
|
3
|
+
// SPDX-License-Identifier: GPL-3.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.SorobanServer = void 0;
|
|
6
|
+
const node_core_1 = require("@subql/node-core");
|
|
7
|
+
const lodash_1 = require("lodash");
|
|
8
|
+
const soroban_client_1 = require("soroban-client");
|
|
9
|
+
const logger = (0, node_core_1.getLogger)('stellar-server');
|
|
10
|
+
const DEFAULT_PAGE_SIZE = 100;
|
|
11
|
+
class SorobanServer extends soroban_client_1.Server {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.eventsCache = {};
|
|
15
|
+
}
|
|
16
|
+
async fetchEventsForSequence(sequence, request, accEvents = []) {
|
|
17
|
+
var _a;
|
|
18
|
+
const response = await super.getEvents(request);
|
|
19
|
+
// Separate the events for the current sequence and the subsequent sequences
|
|
20
|
+
const groupedEvents = (0, lodash_1.groupBy)(response.events, (event) => parseInt(event.ledger) === sequence ? 'events' : 'eventsToCache');
|
|
21
|
+
const events = (0, lodash_1.compact)(groupedEvents.events);
|
|
22
|
+
let eventsToCache = (0, lodash_1.compact)(groupedEvents.eventsToCache);
|
|
23
|
+
// Update the accumulated events with the events from the current sequence
|
|
24
|
+
const newEvents = accEvents.concat(events);
|
|
25
|
+
if (eventsToCache === null || eventsToCache === void 0 ? void 0 : eventsToCache.length) {
|
|
26
|
+
if (response.events.length === DEFAULT_PAGE_SIZE) {
|
|
27
|
+
const lastSequence = (0, lodash_1.last)(response.events).ledger;
|
|
28
|
+
eventsToCache = eventsToCache.filter((event) => event.ledger !== lastSequence);
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
events: { events: newEvents },
|
|
32
|
+
eventsToCache: { events: eventsToCache },
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (response.events.length < DEFAULT_PAGE_SIZE) {
|
|
36
|
+
return { events: { events: newEvents }, eventsToCache: { events: [] } };
|
|
37
|
+
}
|
|
38
|
+
// Prepare the next request
|
|
39
|
+
const nextRequest = Object.assign(Object.assign({}, request), { cursor: (_a = response.events[response.events.length - 1]) === null || _a === void 0 ? void 0 : _a.pagingToken, startLedger: undefined });
|
|
40
|
+
// Continue fetching events for the sequence
|
|
41
|
+
return this.fetchEventsForSequence(sequence, nextRequest, newEvents);
|
|
42
|
+
}
|
|
43
|
+
updateEventCache(response, ignoreHeight) {
|
|
44
|
+
response.events.forEach((event) => {
|
|
45
|
+
if (ignoreHeight && ignoreHeight === parseInt(event.ledger))
|
|
46
|
+
return;
|
|
47
|
+
const ledger = parseInt(event.ledger);
|
|
48
|
+
if (!this.eventsCache[ledger]) {
|
|
49
|
+
this.eventsCache[ledger] = {
|
|
50
|
+
events: [],
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const eventExists = this.eventsCache[ledger].events.some((existingEvent) => existingEvent.id === event.id);
|
|
54
|
+
if (!eventExists) {
|
|
55
|
+
this.eventsCache[ledger].events.push(event);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async getEvents(request) {
|
|
60
|
+
const sequence = request.startLedger;
|
|
61
|
+
if (this.eventsCache[sequence]) {
|
|
62
|
+
const cachedEvents = this.eventsCache[sequence];
|
|
63
|
+
delete this.eventsCache[sequence];
|
|
64
|
+
return cachedEvents;
|
|
65
|
+
}
|
|
66
|
+
const response = await this.fetchEventsForSequence(sequence, request);
|
|
67
|
+
this.updateEventCache(response.eventsToCache, sequence);
|
|
68
|
+
return response.events;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
exports.SorobanServer = SorobanServer;
|
|
72
|
+
//# sourceMappingURL=soroban.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soroban.server.js","sourceRoot":"","sources":["../../src/stellar/soroban.server.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;AAEnC,gDAA6C;AAC7C,mCAAgD;AAChD,mDAAoD;AAGpD,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,gBAAgB,CAAC,CAAC;AAC3C,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,MAAa,aAAc,SAAQ,uBAAM;IAAzC;;QACU,gBAAW,GAAoD,EAAE,CAAC;IAuF5E,CAAC;IArFS,KAAK,CAAC,sBAAsB,CAClC,QAAgB,EAChB,OAAyB,EACzB,YAAwC,EAAE;;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AAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YAClC,OAAO,YAAY,CAAC;SACrB;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtE,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAExD,OAAO,QAAQ,CAAC,MAAM,CAAC;IACzB,CAAC;CACF;AAxFD,sCAwFC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { getLogger } from '@subql/node-core';\nimport { compact, groupBy, last } from 'lodash';\nimport { Server, SorobanRpc } from 'soroban-client';\nimport { GetEventsRequest } from 'soroban-client/lib/server';\n\nconst logger = getLogger('stellar-server');\nconst DEFAULT_PAGE_SIZE = 100;\n\nexport class SorobanServer extends Server {\n private eventsCache: { [key: number]: SorobanRpc.GetEventsResponse } = {};\n\n private async fetchEventsForSequence(\n sequence: number,\n request: GetEventsRequest,\n accEvents: SorobanRpc.EventResponse[] = [],\n ): Promise<{\n events: SorobanRpc.GetEventsResponse;\n eventsToCache: SorobanRpc.GetEventsResponse;\n }> {\n const response = await super.getEvents(request);\n\n // Separate the events for the current sequence and the subsequent sequences\n const groupedEvents = groupBy(response.events, (event) =>\n parseInt(event.ledger) === sequence ? 'events' : 'eventsToCache',\n );\n const events = compact(groupedEvents.events);\n let eventsToCache = compact(groupedEvents.eventsToCache);\n\n // Update the accumulated events with the events from the current sequence\n const newEvents = accEvents.concat(events);\n\n if (eventsToCache?.length) {\n if (response.events.length === DEFAULT_PAGE_SIZE) {\n const lastSequence = last(response.events).ledger;\n eventsToCache = eventsToCache.filter(\n (event) => event.ledger !== lastSequence,\n );\n }\n return {\n events: { events: newEvents },\n eventsToCache: { events: eventsToCache },\n };\n }\n\n if (response.events.length < DEFAULT_PAGE_SIZE) {\n return { events: { events: newEvents }, eventsToCache: { events: [] } };\n }\n\n // Prepare the next request\n const nextRequest = {\n ...request,\n cursor: response.events[response.events.length - 1]?.pagingToken,\n startLedger: undefined,\n };\n\n // Continue fetching events for the sequence\n return this.fetchEventsForSequence(sequence, nextRequest, newEvents);\n }\n\n private updateEventCache(\n response: SorobanRpc.GetEventsResponse,\n ignoreHeight?: number,\n ): void {\n response.events.forEach((event) => {\n if (ignoreHeight && ignoreHeight === parseInt(event.ledger)) return;\n const ledger = parseInt(event.ledger);\n if (!this.eventsCache[ledger]) {\n this.eventsCache[ledger] = {\n events: [],\n } as SorobanRpc.GetEventsResponse;\n }\n const eventExists = this.eventsCache[ledger].events.some(\n (existingEvent) => existingEvent.id === event.id,\n );\n if (!eventExists) {\n this.eventsCache[ledger].events.push(event);\n }\n });\n }\n\n async getEvents(\n request: GetEventsRequest,\n ): Promise<SorobanRpc.GetEventsResponse> {\n const sequence = request.startLedger;\n\n if (this.eventsCache[sequence]) {\n const cachedEvents = this.eventsCache[sequence];\n delete this.eventsCache[sequence];\n return cachedEvents;\n }\n\n const response = await this.fetchEventsForSequence(sequence, request);\n this.updateEventCache(response.eventsToCache, sequence);\n\n return response.events;\n }\n}\n"]}
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
// SPDX-License-Identifier: GPL-3.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
const server_1 = require("soroban-client/lib/server");
|
|
6
|
-
const
|
|
6
|
+
const soroban_server_1 = require("./soroban.server");
|
|
7
7
|
const DEFAULT_PAGE_SIZE = 100;
|
|
8
|
-
describe('
|
|
8
|
+
describe('SorobanServer', () => {
|
|
9
9
|
let server;
|
|
10
10
|
const url = 'https://example.com';
|
|
11
11
|
let spy;
|
|
12
12
|
beforeEach(() => {
|
|
13
|
-
server = new
|
|
13
|
+
server = new soroban_server_1.SorobanServer(url);
|
|
14
14
|
spy = jest.spyOn(server_1.Server.prototype, 'getEvents');
|
|
15
15
|
});
|
|
16
16
|
afterEach(() => {
|
|
@@ -129,4 +129,4 @@ describe('StellarServer', () => {
|
|
|
129
129
|
expect(spy).toHaveBeenCalledTimes(1);
|
|
130
130
|
});
|
|
131
131
|
});
|
|
132
|
-
//# sourceMappingURL=
|
|
132
|
+
//# sourceMappingURL=soroban.server.spec.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"soroban.server.spec.js","sourceRoot":"","sources":["../../src/stellar/soroban.server.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;AAEnC,sDAAqE;AACrE,qDAAiD;AAEjD,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,IAAI,MAAqB,CAAC;IAC1B,MAAM,GAAG,GAAG,qBAAqB,CAAC;IAClC,IAAI,GAAqB,CAAC;IAE1B,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,IAAI,8BAAa,CAAC,GAAG,CAAC,CAAC;QAChC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,eAAM,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,GAAG,CAAC,WAAW,EAAE,CAAC;IACpB,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACzC,GAAG,CAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QAEtC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC;YACtC,WAAW,EAAE,CAAC;SACK,CAAC,CAAC;QAEvB,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;QACzC,MAAM,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;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AE,GAAG,CAAC,EAAE;iBACpB,CAAC,CAAC;gBACH,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE;aAC7C;SACF,CAAC;aACD,qBAAqB,CAAC;YACrB,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;SACvD,CAAC,CAAC;QAEL,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC;YACtC,WAAW,EAAE,CAAC;SACK,CAAC,CAAC;QAEvB,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;YACvB,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,iBAAiB,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;oBAC1D,EAAE,EAAE,GAAG,CAAC,EAAE;oBACV,MAAM,EAAE,GAAG;oBACX,WAAW,EAAE,GAAG,CAAC,EAAE;iBACpB,CAAC,CAAC;aACJ;SACF,CAAC,CAAC;QACH,MAAM,CAAE,MAAc,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC;QACrD,MAAM,CAAC,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { GetEventsRequest, Server } from 'soroban-client/lib/server';\nimport { SorobanServer } from './soroban.server';\n\nconst DEFAULT_PAGE_SIZE = 100;\n\ndescribe('SorobanServer', () => {\n let server: SorobanServer;\n const url = 'https://example.com';\n let spy: jest.SpyInstance;\n\n beforeEach(() => {\n server = new SorobanServer(url);\n spy = jest.spyOn(Server.prototype, 'getEvents');\n });\n\n afterEach(() => {\n spy.mockRestore();\n });\n\n test('should handle no events', async () => {\n spy.mockResolvedValue({ events: [] });\n\n const response = await server.getEvents({\n startLedger: 1,\n } as GetEventsRequest);\n\n expect(response).toEqual({ events: [] });\n expect(spy).toHaveBeenCalledTimes(1);\n });\n\n test('should handle events from different ledgers', async () => {\n spy.mockResolvedValue({\n events: [\n { id: '1', ledger: '1', pagingToken: '1' },\n { id: '2', ledger: '2', pagingToken: '2' },\n ],\n });\n\n const response = await server.getEvents({\n startLedger: 1,\n } as GetEventsRequest);\n\n expect(response).toEqual({\n events: [{ id: '1', ledger: '1', pagingToken: '1' }],\n });\n expect(spy).toHaveBeenCalledTimes(1);\n });\n\n test('should handle response length less than DEFAULT_PAGE_SIZE', async () => {\n spy.mockResolvedValue({\n events: Array.from({ length: DEFAULT_PAGE_SIZE - 1 }, (_, i) => ({\n id: `${i}`,\n ledger: '1',\n pagingToken: `${i}`,\n })),\n });\n\n const response = await server.getEvents({\n startLedger: 1,\n } as GetEventsRequest);\n\n expect(response.events.length).toBe(DEFAULT_PAGE_SIZE - 1);\n expect(spy).toHaveBeenCalledTimes(1);\n });\n\n test('should handle no matching ledger', async () => {\n spy.mockResolvedValue({\n events: [\n { id: '1', ledger: '2', pagingToken: '1' },\n { id: '1', ledger: '3', pagingToken: '2' },\n ],\n });\n\n const response = await server.getEvents({\n startLedger: 1,\n } as GetEventsRequest);\n\n expect(response).toEqual({ events: [] });\n expect(spy).toHaveBeenCalledTimes(1);\n });\n\n test('should return cached events for given startLedger', async () => {\n (server as any).eventsCache[1] = {\n events: [{ ledger: '1', pagingToken: '1' }],\n };\n\n const response = await server.getEvents({\n startLedger: 1,\n } as GetEventsRequest);\n\n expect(response).toEqual({ events: [{ ledger: '1', pagingToken: '1' }] });\n expect(spy).toHaveBeenCalledTimes(0);\n });\n\n test('should handle startLedger events greater than DEFAULT_PAGE_SIZE', async () => {\n spy\n .mockResolvedValueOnce({\n events: Array.from({ length: DEFAULT_PAGE_SIZE }, (_, i) => ({\n id: `${i}`,\n ledger: '1',\n pagingToken: `${i}`,\n })),\n })\n .mockResolvedValueOnce({\n events: Array.from({ length: 5 }, (_, i) => ({\n id: `${i + DEFAULT_PAGE_SIZE}`,\n ledger: '1',\n pagingToken: `${i + DEFAULT_PAGE_SIZE}`,\n })),\n });\n\n const response = await server.getEvents({\n startLedger: 1,\n } as GetEventsRequest);\n\n expect(response.events.length).toBe(DEFAULT_PAGE_SIZE + 5);\n expect(spy).toHaveBeenCalledTimes(2);\n });\n\n test('should handle last block of otherEvents on next page', async () => {\n spy\n .mockResolvedValueOnce({\n events: [\n ...Array.from({ length: DEFAULT_PAGE_SIZE - 1 }, (_, i) => ({\n id: `${i}`,\n ledger: '1',\n pagingToken: `${i}`,\n })),\n { id: '2-1', ledger: '2', pagingToken: '1' },\n ],\n })\n .mockResolvedValueOnce({\n events: [{ id: '2-2', ledger: '2', pagingToken: '2' }],\n });\n\n const response = await server.getEvents({\n startLedger: 1,\n } as GetEventsRequest);\n\n expect(response).toEqual({\n events: [\n ...Array.from({ length: DEFAULT_PAGE_SIZE - 1 }, (_, i) => ({\n id: `${i}`,\n ledger: '1',\n pagingToken: `${i}`,\n })),\n ],\n });\n expect((server as any).eventsCache[2]).toBeUndefined;\n expect(spy).toHaveBeenCalledTimes(1);\n });\n});\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Server
|
|
2
|
-
|
|
1
|
+
import { Server } from 'stellar-sdk';
|
|
2
|
+
export interface StellarNetwork {
|
|
3
|
+
network_passphrase: string;
|
|
4
|
+
history_latest_ledger: string;
|
|
5
|
+
}
|
|
3
6
|
export declare class StellarServer extends Server {
|
|
4
|
-
|
|
5
|
-
private fetchEventsForSequence;
|
|
6
|
-
private updateEventCache;
|
|
7
|
-
getEvents(request: GetEventsRequest): Promise<SorobanRpc.GetEventsResponse>;
|
|
7
|
+
getNetwork(): Promise<StellarNetwork>;
|
|
8
8
|
}
|
|
@@ -1,71 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors
|
|
3
3
|
// SPDX-License-Identifier: GPL-3.0
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
4
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
8
|
exports.StellarServer = void 0;
|
|
6
9
|
const node_core_1 = require("@subql/node-core");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
10
|
+
const stellar_sdk_1 = require("stellar-sdk");
|
|
11
|
+
const urijs_1 = __importDefault(require("urijs"));
|
|
9
12
|
const logger = (0, node_core_1.getLogger)('stellar-server');
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
this.eventsCache = {};
|
|
15
|
-
}
|
|
16
|
-
async fetchEventsForSequence(sequence, request, accEvents = []) {
|
|
17
|
-
var _a;
|
|
18
|
-
const response = await super.getEvents(request);
|
|
19
|
-
// Separate the events for the current sequence and the subsequent sequences
|
|
20
|
-
const groupedEvents = (0, lodash_1.groupBy)(response.events, (event) => parseInt(event.ledger) === sequence ? 'events' : 'eventsToCache');
|
|
21
|
-
const events = (0, lodash_1.compact)(groupedEvents.events);
|
|
22
|
-
let eventsToCache = (0, lodash_1.compact)(groupedEvents.eventsToCache);
|
|
23
|
-
// Update the accumulated events with the events from the current sequence
|
|
24
|
-
const newEvents = accEvents.concat(events);
|
|
25
|
-
if (eventsToCache === null || eventsToCache === void 0 ? void 0 : eventsToCache.length) {
|
|
26
|
-
if (response.events.length === DEFAULT_PAGE_SIZE) {
|
|
27
|
-
const lastSequence = (0, lodash_1.last)(response.events).ledger;
|
|
28
|
-
eventsToCache = eventsToCache.filter((event) => event.ledger !== lastSequence);
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
events: { events: newEvents },
|
|
32
|
-
eventsToCache: { events: eventsToCache },
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
if (response.events.length < DEFAULT_PAGE_SIZE) {
|
|
36
|
-
return { events: { events: newEvents }, eventsToCache: { events: [] } };
|
|
37
|
-
}
|
|
38
|
-
// Prepare the next request
|
|
39
|
-
const nextRequest = Object.assign(Object.assign({}, request), { cursor: (_a = response.events[response.events.length - 1]) === null || _a === void 0 ? void 0 : _a.pagingToken, startLedger: undefined });
|
|
40
|
-
// Continue fetching events for the sequence
|
|
41
|
-
return this.fetchEventsForSequence(sequence, nextRequest, newEvents);
|
|
42
|
-
}
|
|
43
|
-
updateEventCache(response, ignoreHeight) {
|
|
44
|
-
response.events.forEach((event) => {
|
|
45
|
-
if (ignoreHeight && ignoreHeight === parseInt(event.ledger))
|
|
46
|
-
return;
|
|
47
|
-
const ledger = parseInt(event.ledger);
|
|
48
|
-
if (!this.eventsCache[ledger]) {
|
|
49
|
-
this.eventsCache[ledger] = {
|
|
50
|
-
events: [],
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
const eventExists = this.eventsCache[ledger].events.some((existingEvent) => existingEvent.id === event.id);
|
|
54
|
-
if (!eventExists) {
|
|
55
|
-
this.eventsCache[ledger].events.push(event);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
async getEvents(request) {
|
|
60
|
-
const sequence = request.startLedger;
|
|
61
|
-
if (this.eventsCache[sequence]) {
|
|
62
|
-
const cachedEvents = this.eventsCache[sequence];
|
|
63
|
-
delete this.eventsCache[sequence];
|
|
64
|
-
return cachedEvents;
|
|
65
|
-
}
|
|
66
|
-
const response = await this.fetchEventsForSequence(sequence, request);
|
|
67
|
-
this.updateEventCache(response.eventsToCache, sequence);
|
|
68
|
-
return response.events;
|
|
13
|
+
class StellarServer extends stellar_sdk_1.Server {
|
|
14
|
+
async getNetwork() {
|
|
15
|
+
const network = (await stellar_sdk_1.HorizonAxiosClient.get((0, urijs_1.default)(this.serverURL).toString())).data;
|
|
16
|
+
return network;
|
|
69
17
|
}
|
|
70
18
|
}
|
|
71
19
|
exports.StellarServer = StellarServer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stellar.server.js","sourceRoot":"","sources":["../../src/stellar/stellar.server.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC
|
|
1
|
+
{"version":3,"file":"stellar.server.js","sourceRoot":"","sources":["../../src/stellar/stellar.server.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;AAEnC,gDAA6C;AAC7C,6CAAyD;AACzD,kDAAwB;AAExB,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,gBAAgB,CAAC,CAAC;AAO3C,MAAa,aAAc,SAAQ,oBAAM;IACvC,KAAK,CAAC,UAAU;QACd,MAAM,OAAO,GAAmB,CAC9B,MAAM,gCAAkB,CAAC,GAAG,CAAC,IAAA,eAAG,EAAC,IAAI,CAAC,SAAgB,CAAC,CAAC,QAAQ,EAAE,CAAC,CACpE,CAAC,IAAI,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAPD,sCAOC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { getLogger } from '@subql/node-core';\nimport { HorizonAxiosClient, Server } from 'stellar-sdk';\nimport URI from 'urijs';\n\nconst logger = getLogger('stellar-server');\n\nexport interface StellarNetwork {\n network_passphrase: string;\n history_latest_ledger: string;\n}\n\nexport class StellarServer extends Server {\n async getNetwork(): Promise<StellarNetwork> {\n const network: StellarNetwork = (\n await HorizonAxiosClient.get(URI(this.serverURL as any).toString())\n ).data;\n return network;\n }\n}\n"]}
|
package/dist/utils/project.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { SubqlRuntimeHandler, SubqlCustomHandler, SubqlHandler } from '@subql/common-stellar';
|
|
2
|
-
import { SubqlProjectDs } from '../configure/SubqueryProject';
|
|
3
2
|
export declare function isBaseHandler(handler: SubqlHandler): handler is SubqlRuntimeHandler;
|
|
4
3
|
export declare function isCustomHandler(handler: SubqlHandler): handler is SubqlCustomHandler;
|
|
5
4
|
export declare function retryOnFailEth<T>(request: () => Promise<T>, errors?: string[]): Promise<T>;
|
|
6
|
-
export declare function onlyHasEventDataSources(dataSources: SubqlProjectDs[]): boolean;
|
package/dist/utils/project.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors
|
|
3
3
|
// SPDX-License-Identifier: GPL-3.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.
|
|
5
|
+
exports.retryOnFailEth = exports.isCustomHandler = exports.isBaseHandler = void 0;
|
|
6
6
|
const common_stellar_1 = require("@subql/common-stellar");
|
|
7
7
|
const node_core_1 = require("@subql/node-core");
|
|
8
8
|
function isBaseHandler(handler) {
|
|
@@ -19,15 +19,4 @@ async function retryOnFailEth(request, errors = handledErrors) {
|
|
|
19
19
|
return (0, node_core_1.retryOnFail)(request, (e) => !!errors.find((t) => t === (e === null || e === void 0 ? void 0 : e.reason)));
|
|
20
20
|
}
|
|
21
21
|
exports.retryOnFailEth = retryOnFailEth;
|
|
22
|
-
function onlyHasEventDataSources(dataSources) {
|
|
23
|
-
for (const ds of dataSources) {
|
|
24
|
-
for (const handler of ds.mapping.handlers) {
|
|
25
|
-
if (handler.kind !== common_stellar_1.StellarHandlerKind.Event) {
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
exports.onlyHasEventDataSources = onlyHasEventDataSources;
|
|
33
22
|
//# sourceMappingURL=project.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project.js","sourceRoot":"","sources":["../../src/utils/project.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;AAEnC,0DAM+B;AAC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AAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,MAAK,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,MAAM,CAAA,CAAC,CAAC,CAAC;AAC5E,CAAC;AALD,wCAKC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport {\n SubqlRuntimeHandler,\n SubqlCustomHandler,\n SubqlHandler,\n StellarHandlerKind,\n isCustomDs,\n} from '@subql/common-stellar';\nimport { retryOnFail } from '@subql/node-core';\nimport { SubqlProjectDs } from '../configure/SubqueryProject';\n\nexport function isBaseHandler(\n handler: SubqlHandler,\n): handler is SubqlRuntimeHandler {\n return Object.values<string>(StellarHandlerKind).includes(handler.kind);\n}\n\nexport function isCustomHandler(\n handler: SubqlHandler,\n): handler is SubqlCustomHandler {\n return !isBaseHandler(handler);\n}\n\nconst handledErrors = ['timeout'];\n// eslint-disable-next-line @typescript-eslint/require-await\nexport async function retryOnFailEth<T>(\n request: () => Promise<T>,\n errors = handledErrors,\n): Promise<T> {\n return retryOnFail(request, (e) => !!errors.find((t) => t === e?.reason));\n}\n"]}
|
package/dist/yargs.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<imp
|
|
|
75
75
|
describe: string;
|
|
76
76
|
type: "string";
|
|
77
77
|
};
|
|
78
|
-
}>, "unsafe" | "mmr-store-type" | "mmr-path" | "db-schema" | "subquery" | "batch-size" | "block-confirmations" | "config" | "debug" | "dictionary-resolver" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "multi-chain" | "network-dictionary" | "network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "query-limit" | "scale-batch-size" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold" | "store-cache-upper-limit" | "store-get-cache-size" | "store-cache-async" | "store-flush-interval" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "workers" | "root" | "query-address-limit"> & import("yargs").InferredOptionTypes<{
|
|
78
|
+
}>, "unsafe" | "mmr-store-type" | "mmr-path" | "db-schema" | "subquery" | "batch-size" | "block-confirmations" | "config" | "debug" | "dictionary-resolver" | "dictionary-timeout" | "disable-historical" | "ipfs" | "local" | "log-level" | "multi-chain" | "network-dictionary" | "network-endpoint" | "soroban-network-endpoint" | "output-fmt" | "port" | "profiler" | "proof-of-index" | "query-limit" | "scale-batch-size" | "pg-ca" | "pg-key" | "pg-cert" | "store-cache-threshold" | "store-cache-upper-limit" | "store-get-cache-size" | "store-cache-async" | "store-flush-interval" | "subquery-name" | "subscription" | "timeout" | "timestamp-field" | "unfinalized-blocks" | "workers" | "root" | "query-address-limit"> & import("yargs").InferredOptionTypes<{
|
|
79
79
|
'batch-size': {
|
|
80
80
|
demandOption: false;
|
|
81
81
|
describe: string;
|
|
@@ -160,6 +160,11 @@ export declare const yargsOptions: import("yargs").Argv<import("yargs").Omit<imp
|
|
|
160
160
|
type: "string";
|
|
161
161
|
describe: string;
|
|
162
162
|
};
|
|
163
|
+
'soroban-network-endpoint': {
|
|
164
|
+
demandOption: false;
|
|
165
|
+
type: "string";
|
|
166
|
+
describe: string;
|
|
167
|
+
};
|
|
163
168
|
'output-fmt': {
|
|
164
169
|
demandOption: false;
|
|
165
170
|
describe: string;
|
package/dist/yargs.js
CHANGED
|
@@ -235,6 +235,11 @@ exports.yargsOptions = (0, yargs_1.default)((0, helpers_1.hideBin)(process.argv)
|
|
|
235
235
|
type: 'string',
|
|
236
236
|
describe: 'Blockchain network endpoint to connect',
|
|
237
237
|
},
|
|
238
|
+
'soroban-network-endpoint': {
|
|
239
|
+
demandOption: false,
|
|
240
|
+
type: 'string',
|
|
241
|
+
describe: 'Blockchain network endpoint to connect',
|
|
242
|
+
},
|
|
238
243
|
'output-fmt': {
|
|
239
244
|
demandOption: false,
|
|
240
245
|
describe: 'Print log as json or plain text',
|
package/dist/yargs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/yargs.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;AAEnC,oDAAqD;AACrD,2CAAwC;AACxC,wDAAgC;AAEnB,QAAA,YAAY,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACrD,GAAG,CAAC,YAAY,CAAC;KACjB,OAAO,CAAC;IACP,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,sCAAsC;IAChD,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QACF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAC9D,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,aAAa;IACtB,QAAQ,EACN,mIAAmI;IACrI,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QAEF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;QACpE,OAAO,cAAc,EAAE,CAAC;IAC1B,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,SAAS;IAClB,QAAQ,EACN,gMAAgM;IAClM,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CACjB,KAAK,C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AAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;IACD,IAAI,EAAE;QACJ,QAAQ,EACN,wKAAwK;QAC1K,IAAI,EAAE,QAAQ;KACf;IACD,qBAAqB,EAAE;QACrB,QAAQ,EACN,yEAAyE;QAC3E,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG;KACb;CACF,CAAC;KACD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,8CAA8C","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'test',\n describe: 'Run tests for a SubQuery application',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { testingInit } = require('./subcommands/testing.init');\n return testingInit();\n },\n })\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .command({\n command: 'mmr-regen',\n describe:\n 'Re-generate mmr between Filebased/Postgres mmr and Proof of index',\n builder: (yargs) =>\n yargs.options({\n probe: {\n type: 'boolean',\n description:\n 'Fetch latest mmr height information from file based/postgres DB and Poi table',\n demandOption: false,\n default: false,\n },\n targetHeight: {\n type: 'number',\n description: 'Re-genrate mmr value from this block height',\n demandOption: false,\n },\n resetOnly: {\n type: 'boolean',\n description:\n 'Only reset the mmr value in both POI and file based/postgres DB to target height',\n demandOption: false,\n default: false,\n },\n unsafe: {\n type: 'boolean',\n description: 'Allow sync mmr from Poi table to file or a postgres DB',\n demandOption: false,\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe:\n 'When regenerate MMR store in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe:\n 'File based only : local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrRegenerateInit } = require('./subcommands/mmrRegenerate.init');\n return mmrRegenerateInit(\n argv.probe,\n argv.resetOnly,\n argv.unsafe,\n argv.targetHeight,\n );\n },\n })\n .command({\n command: 'mmr-migrate',\n describe: 'Migrate MMR data from storage file to postgres DB',\n builder: (yargs) =>\n yargs.options({\n direction: {\n type: 'string',\n description: 'set direction of migration (file -> DB or DB -> file)',\n demandOption: false,\n choices: ['dbToFile', 'fileToDb'],\n default: 'dbToFile',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrMigrateInit } = require('./subcommands/mmrMigrate.init');\n return mmrMigrateInit(argv.direction);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n 'block-confirmations': {\n demandOption: false,\n default: 20,\n describe:\n 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use SubQuery Network dictionary resolver',\n type: 'string',\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe: 'Store MMR in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enable TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush data to the database when number of records excess this threshold',\n type: 'number',\n },\n 'store-cache-upper-limit': {\n demandOption: false,\n describe:\n 'Defines the upper limit to the store cache size. When this limit is reached indexing will wait for the cache to be flushed before continuing.',\n type: 'number',\n },\n 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\n type: 'number',\n },\n 'store-cache-async': {\n demandOption: false,\n describe:\n 'If enabled the store cache will flush data asyncronously relative to indexing data',\n type: 'boolean',\n },\n 'store-flush-interval': {\n demandOption: false,\n describe:\n 'The interval, in seconds, at which data is flushed from the cache. ' +\n 'This ensures that data is persisted regularly when there is either not much data or the project is up to date.',\n type: 'number',\n default: 5,\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n root: {\n describe:\n 'This is a hidden flag only used from the main thread to workers. It provides a root directory for the project. This is a temp directory with IPFS and GitHub projects.',\n type: 'string',\n },\n 'query-address-limit': {\n describe:\n 'Set the limit for address on dictionary queries for dynamic datasources',\n type: 'number',\n default: 100,\n },\n })\n .hide('root'); // root is hidden because its for internal use\n"]}
|
|
1
|
+
{"version":3,"file":"yargs.js","sourceRoot":"","sources":["../src/yargs.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;AAEnC,oDAAqD;AACrD,2CAAwC;AACxC,wDAAgC;AAEnB,QAAA,YAAY,GAAG,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;KACrD,GAAG,CAAC,YAAY,CAAC;KACjB,OAAO,CAAC;IACP,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,sCAAsC;IAChD,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QACF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,4BAA4B,CAAC,CAAC;QAC9D,OAAO,WAAW,EAAE,CAAC;IACvB,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,aAAa;IACtB,QAAQ,EACN,mIAAmI;IACrI,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAA,mBAAU,EACR,IAAI,CAAC,KAAgB,EACrB,IAAI,CAAC,SAA+B,EACpC,IAAI,CAAC,QAA8B,CACpC,CAAC;QAEF,4EAA4E;QAC5E,8DAA8D;QAC9D,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;QACpE,OAAO,cAAc,EAAE,CAAC;IAC1B,CAAC;CACF,CAAC;KACD,OAAO,CAAC;IACP,OAAO,EAAE,SAAS;IAClB,QAAQ,EACN,gMA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EAAE;QACpB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,KAAK;QACd,QAAQ,EAAE,8CAA8C;QACxD,IAAI,EAAE,SAAS;KAChB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,SAAS;QACf,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,wDAAwD;KACnE;IACD,OAAO,EAAE;QACP,KAAK,EAAE,GAAG;QACV,YAAY,EAAE,KAAK;QACnB,QAAQ,EACN,0FAA0F;QAC5F,IAAI,EAAE,QAAQ;KACf;IACD,IAAI,EAAE;QACJ,QAAQ,EACN,wKAAwK;QAC1K,IAAI,EAAE,QAAQ;KACf;IACD,qBAAqB,EAAE;QACrB,QAAQ,EACN,yEAAyE;QAC3E,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,GAAG;KACb;CACF,CAAC;KACD,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,8CAA8C","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { initLogger } from '@subql/node-core/logger';\nimport { hideBin } from 'yargs/helpers';\nimport yargs from 'yargs/yargs';\n\nexport const yargsOptions = yargs(hideBin(process.argv))\n .env('SUBQL_NODE')\n .command({\n command: 'test',\n describe: 'Run tests for a SubQuery application',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { testingInit } = require('./subcommands/testing.init');\n return testingInit();\n },\n })\n .command({\n command: 'force-clean',\n describe:\n 'Clean the database dropping project schemas and tables. Once the command is executed, the application would exit upon completion.',\n builder: {},\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { forceCleanInit } = require('./subcommands/forceClean.init');\n return forceCleanInit();\n },\n })\n .command({\n command: 'reindex',\n describe:\n 'Reindex to specified block height. Historical must be enabled for the targeted project (--disable-historical=false). Once the command is executed, the application would exit upon completion.',\n builder: (yargs) =>\n yargs.options('targetHeight', {\n type: 'number',\n description: 'set targetHeight',\n require: true,\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { reindexInit } = require('./subcommands/reindex.init');\n return reindexInit(argv.targetHeight);\n },\n })\n .command({\n command: 'mmr-regen',\n describe:\n 'Re-generate mmr between Filebased/Postgres mmr and Proof of index',\n builder: (yargs) =>\n yargs.options({\n probe: {\n type: 'boolean',\n description:\n 'Fetch latest mmr height information from file based/postgres DB and Poi table',\n demandOption: false,\n default: false,\n },\n targetHeight: {\n type: 'number',\n description: 'Re-genrate mmr value from this block height',\n demandOption: false,\n },\n resetOnly: {\n type: 'boolean',\n description:\n 'Only reset the mmr value in both POI and file based/postgres DB to target height',\n demandOption: false,\n default: false,\n },\n unsafe: {\n type: 'boolean',\n description: 'Allow sync mmr from Poi table to file or a postgres DB',\n demandOption: false,\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe:\n 'When regenerate MMR store in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe:\n 'File based only : local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrRegenerateInit } = require('./subcommands/mmrRegenerate.init');\n return mmrRegenerateInit(\n argv.probe,\n argv.resetOnly,\n argv.unsafe,\n argv.targetHeight,\n );\n },\n })\n .command({\n command: 'mmr-migrate',\n describe: 'Migrate MMR data from storage file to postgres DB',\n builder: (yargs) =>\n yargs.options({\n direction: {\n type: 'string',\n description: 'set direction of migration (file -> DB or DB -> file)',\n demandOption: false,\n choices: ['dbToFile', 'fileToDb'],\n default: 'dbToFile',\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n }),\n handler: (argv) => {\n initLogger(\n argv.debug as boolean,\n argv.outputFmt as 'json' | 'colored',\n argv.logLevel as string | undefined,\n );\n\n // lazy import to make sure logger is instantiated before all other services\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const { mmrMigrateInit } = require('./subcommands/mmrMigrate.init');\n return mmrMigrateInit(argv.direction);\n },\n })\n .options({\n 'batch-size': {\n demandOption: false,\n describe: 'Batch size of blocks to fetch in one round',\n type: 'number',\n },\n 'block-confirmations': {\n demandOption: false,\n default: 20,\n describe:\n 'The number of blocks behind the head to be considered finalized, this has no effect with Ethereum',\n type: 'number',\n },\n config: {\n alias: 'c',\n demandOption: false,\n describe: 'Specify configuration file',\n type: 'string',\n },\n 'db-schema': {\n demandOption: false,\n describe: 'Db schema name of the project',\n type: 'string',\n },\n debug: {\n demandOption: false,\n describe:\n 'Show debug information to console output. will forcefully set log level to debug',\n type: 'boolean',\n default: false,\n },\n 'dictionary-resolver': {\n demandOption: false,\n describe: 'Use SubQuery Network dictionary resolver',\n type: 'string',\n },\n 'dictionary-timeout': {\n demandOption: false,\n describe: 'Max timeout for dictionary query',\n type: 'number',\n },\n 'disable-historical': {\n demandOption: false,\n default: false,\n describe: 'Disable storing historical state entities',\n type: 'boolean',\n },\n ipfs: {\n demandOption: false,\n describe: 'IPFS gateway endpoint',\n type: 'string',\n },\n local: {\n deprecated: true,\n type: 'boolean',\n demandOption: false,\n describe: 'Use local mode',\n },\n 'log-level': {\n demandOption: false,\n describe: 'Specify log level to print. Ignored when --debug is used',\n type: 'string',\n choices: ['fatal', 'error', 'warn', 'info', 'debug', 'trace', 'silent'],\n },\n 'mmr-path': {\n alias: 'm',\n demandOption: false,\n describe: 'Local path of the merkle mountain range (.mmr) file',\n type: 'string',\n },\n 'multi-chain': {\n demandOption: false,\n default: false,\n describe:\n 'Enables indexing multiple subquery projects into the same database schema',\n type: 'boolean',\n },\n 'network-dictionary': {\n alias: 'd',\n demandOption: false,\n describe: 'Specify the dictionary api for this network',\n type: 'string',\n },\n 'network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'soroban-network-endpoint': {\n demandOption: false,\n type: 'string',\n describe: 'Blockchain network endpoint to connect',\n },\n 'output-fmt': {\n demandOption: false,\n describe: 'Print log as json or plain text',\n type: 'string',\n choices: ['json', 'colored'],\n },\n port: {\n alias: 'p',\n demandOption: false,\n describe: 'The port the service will bind to',\n type: 'number',\n },\n profiler: {\n demandOption: false,\n describe: 'Show profiler information to console output',\n type: 'boolean',\n default: false,\n },\n 'proof-of-index': {\n demandOption: false,\n describe: 'Enable/disable proof of index',\n type: 'boolean',\n default: false,\n },\n 'mmr-store-type': {\n demandOption: false,\n describe: 'Store MMR in either a file or a postgres DB',\n type: 'string',\n choices: ['file', 'postgres'],\n default: 'postgres',\n },\n 'query-limit': {\n demandOption: false,\n describe:\n 'The limit of items a project can query with store.getByField at once',\n type: 'number',\n default: 100,\n },\n 'scale-batch-size': {\n type: 'boolean',\n demandOption: false,\n describe: 'scale batch size based on memory usage',\n default: false,\n },\n 'pg-ca': {\n demandOption: false,\n describe:\n 'Postgres ca certificate - to enable TLS/SSL connections to your PostgreSQL, path to the server certificate file are required, e.g /path/to/server-certificates/root.crt',\n type: 'string',\n },\n 'pg-key': {\n demandOption: false,\n describe:\n 'Postgres client key - Path to key file e.g /path/to/client-key/postgresql.key',\n type: 'string',\n },\n 'pg-cert': {\n demandOption: false,\n describe:\n 'Postgres client certificate - Path to client certificate e.g /path/to/client-certificates/postgresql.crt',\n type: 'string',\n },\n 'store-cache-threshold': {\n demandOption: false,\n describe:\n 'Store cache will flush data to the database when number of records excess this threshold',\n type: 'number',\n },\n 'store-cache-upper-limit': {\n demandOption: false,\n describe:\n 'Defines the upper limit to the store cache size. When this limit is reached indexing will wait for the cache to be flushed before continuing.',\n type: 'number',\n },\n 'store-get-cache-size': {\n demandOption: false,\n describe: 'Store get cache size for each model',\n type: 'number',\n },\n 'store-cache-async': {\n demandOption: false,\n describe:\n 'If enabled the store cache will flush data asyncronously relative to indexing data',\n type: 'boolean',\n },\n 'store-flush-interval': {\n demandOption: false,\n describe:\n 'The interval, in seconds, at which data is flushed from the cache. ' +\n 'This ensures that data is persisted regularly when there is either not much data or the project is up to date.',\n type: 'number',\n default: 5,\n },\n subquery: {\n alias: 'f',\n demandOption: true,\n default: process.cwd(),\n describe: 'Local path or IPFS cid of the subquery project',\n type: 'string',\n },\n 'subquery-name': {\n deprecated: true,\n demandOption: false,\n describe: 'Name of the subquery project',\n type: 'string',\n },\n subscription: {\n demandOption: false,\n describe: 'Enable subscription by create notification triggers',\n type: 'boolean',\n default: false,\n },\n timeout: {\n demandOption: false,\n describe: 'Timeout for indexer sandbox to execute the mapping functions',\n type: 'number',\n },\n 'timestamp-field': {\n demandOption: false,\n describe: 'Enable/disable created_at and updated_at in schema',\n type: 'boolean',\n default: false,\n },\n 'unfinalized-blocks': {\n demandOption: false,\n default: false,\n describe: 'Enable to fetch and index unfinalized blocks',\n type: 'boolean',\n },\n unsafe: {\n type: 'boolean',\n demandOption: false,\n describe: 'Allows usage of any built-in module within the sandbox',\n },\n workers: {\n alias: 'w',\n demandOption: false,\n describe:\n 'Number of worker threads to use for fetching and processing blocks. Disabled by default.',\n type: 'number',\n },\n root: {\n describe:\n 'This is a hidden flag only used from the main thread to workers. It provides a root directory for the project. This is a temp directory with IPFS and GitHub projects.',\n type: 'string',\n },\n 'query-address-limit': {\n describe:\n 'Set the limit for address on dictionary queries for dynamic datasources',\n type: 'number',\n default: 100,\n },\n })\n .hide('root'); // root is hidden because its for internal use\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@subql/node-stellar",
|
|
3
|
-
"version": "2.9.3-
|
|
3
|
+
"version": "2.9.3-3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"author": "Ian He",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"@nestjs/platform-express": "^9.4.0",
|
|
26
26
|
"@nestjs/schedule": "^3.0.1",
|
|
27
27
|
"@subql/common": "^2.3.1-1",
|
|
28
|
-
"@subql/common-stellar": "2.2.1-
|
|
28
|
+
"@subql/common-stellar": "2.2.1-2",
|
|
29
29
|
"@subql/node-core": "4.0.2-0",
|
|
30
30
|
"@subql/testing": "^2.0.0",
|
|
31
31
|
"@subql/types": "^2.1.2",
|
|
32
|
-
"@subql/types-stellar": "2.2.3-
|
|
32
|
+
"@subql/types-stellar": "2.2.3-4",
|
|
33
33
|
"@willsoto/nestjs-prometheus": "^4.4.0",
|
|
34
34
|
"cacheable-lookup": "6",
|
|
35
35
|
"cron-converter": "^1.0.2",
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"rimraf": "^3.0.2",
|
|
42
42
|
"rxjs": "^7.5.2",
|
|
43
43
|
"soroban-client": "^0.9.1",
|
|
44
|
+
"stellar-sdk": "^10.4.1",
|
|
44
45
|
"yargs": "^16.2.0"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
@@ -65,5 +66,5 @@
|
|
|
65
66
|
"/dist",
|
|
66
67
|
"/bin"
|
|
67
68
|
],
|
|
68
|
-
"stableVersion": "2.9.3-
|
|
69
|
+
"stableVersion": "2.9.3-2"
|
|
69
70
|
}
|
|
File without changes
|