@subql/node-stellar 2.9.3-2 → 2.9.3-4

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.
Files changed (64) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/configure/SubqueryProject.d.ts +1 -0
  3. package/dist/configure/SubqueryProject.js +18 -2
  4. package/dist/configure/SubqueryProject.js.map +1 -1
  5. package/dist/configure/configure.module.d.ts +4 -1
  6. package/dist/configure/configure.module.js +1 -0
  7. package/dist/configure/configure.module.js.map +1 -1
  8. package/dist/indexer/blockDispatcher/block-dispatcher.service.js +1 -1
  9. package/dist/indexer/blockDispatcher/block-dispatcher.service.js.map +1 -1
  10. package/dist/indexer/fetch.module.js.map +1 -1
  11. package/dist/indexer/fetch.service.js +97 -0
  12. package/dist/indexer/fetch.service.js.map +1 -1
  13. package/dist/indexer/fetch.service.spec.js +121 -47
  14. package/dist/indexer/fetch.service.spec.js.map +1 -1
  15. package/dist/indexer/indexer.manager.d.ts +24 -5
  16. package/dist/indexer/indexer.manager.js +62 -4
  17. package/dist/indexer/indexer.manager.js.map +1 -1
  18. package/dist/indexer/unfinalizedBlocks.service.js +1 -1
  19. package/dist/indexer/unfinalizedBlocks.service.js.map +1 -1
  20. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js +1 -1
  21. package/dist/indexer/worker/worker.unfinalizedBlocks.service.js.map +1 -1
  22. package/dist/meta/meta.module.js.map +1 -1
  23. package/dist/meta/meta.service.d.ts +4 -0
  24. package/dist/meta/meta.service.js +6 -1
  25. package/dist/meta/meta.service.js.map +1 -1
  26. package/dist/stellar/api.connection.d.ts +2 -1
  27. package/dist/stellar/api.connection.js +4 -3
  28. package/dist/stellar/api.connection.js.map +1 -1
  29. package/dist/stellar/api.connection.spec.js +32 -36
  30. package/dist/stellar/api.connection.spec.js.map +1 -1
  31. package/dist/stellar/api.service.stellar.js +5 -1
  32. package/dist/stellar/api.service.stellar.js.map +1 -1
  33. package/dist/stellar/api.service.stellar.spec.d.ts +2 -2
  34. package/dist/stellar/api.service.stellar.spec.js +20 -22
  35. package/dist/stellar/api.service.stellar.spec.js.map +1 -1
  36. package/dist/stellar/api.stellar.d.ts +18 -8
  37. package/dist/stellar/api.stellar.js +160 -28
  38. package/dist/stellar/api.stellar.js.map +1 -1
  39. package/dist/stellar/api.stellar.spec.js +26 -38
  40. package/dist/stellar/api.stellar.spec.js.map +1 -1
  41. package/dist/stellar/block.stellar.d.ts +15 -5
  42. package/dist/stellar/block.stellar.js +50 -2
  43. package/dist/stellar/block.stellar.js.map +1 -1
  44. package/dist/stellar/block.stellar.spec.js +150 -46
  45. package/dist/stellar/block.stellar.spec.js.map +1 -1
  46. package/dist/stellar/safe-api.d.ts +2 -2
  47. package/dist/stellar/safe-api.js +3 -3
  48. package/dist/stellar/safe-api.js.map +1 -1
  49. package/dist/stellar/soroban.server.d.ts +8 -0
  50. package/dist/stellar/soroban.server.js +72 -0
  51. package/dist/stellar/soroban.server.js.map +1 -0
  52. package/dist/stellar/{stellar.server.spec.js → soroban.server.spec.js} +4 -4
  53. package/dist/stellar/{stellar.server.spec.js.map → soroban.server.spec.js.map} +1 -1
  54. package/dist/stellar/stellar.server.d.ts +6 -6
  55. package/dist/stellar/stellar.server.js +9 -61
  56. package/dist/stellar/stellar.server.js.map +1 -1
  57. package/dist/utils/project.d.ts +0 -2
  58. package/dist/utils/project.js +1 -12
  59. package/dist/utils/project.js.map +1 -1
  60. package/dist/yargs.d.ts +6 -1
  61. package/dist/yargs.js +5 -0
  62. package/dist/yargs.js.map +1 -1
  63. package/package.json +7 -6
  64. /package/dist/stellar/{stellar.server.spec.d.ts → soroban.server.spec.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.service.spec.js","sourceRoot":"","sources":["../../src/indexer/fetch.service.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;AAGnC,wDAI8B;AAC9B,qCAAwC;AAOxC,mDAA4E;AAE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X-License-Identifier: GPL-3.0\n\nimport { NodeConfig } from '@subql/node-core';\nimport {\n StellarDatasourceKind,\n StellarHandlerKind,\n SubqlRuntimeDatasource,\n} from '@subql/types-stellar';\nimport { GraphQLSchema } from 'graphql';\nimport {\n SubqlProjectDsTemplate,\n SubqueryProject,\n} from '../configure/SubqueryProject';\nimport { DsProcessorService } from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { buildDictionaryQueryEntries, FetchService } from './fetch.service';\n\nconst HTTP_ENDPOINT = 'https://rpc-futurenet.stellar.org:443';\n\nfunction testSubqueryProject(endpoint: string, ds: any): SubqueryProject {\n return {\n network: {\n endpoint,\n chainId: '1',\n },\n dataSources: ds as any,\n id: 'test',\n root: './',\n schema: new GraphQLSchema({}),\n templates: null,\n };\n}\n\ndescribe('Dictioanry queries', () => {\n describe('Correct dictionary query with dynamic ds', () => {\n it('Build correct counter increment single query', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: StellarDatasourceKind.Runtime,\n assets: new Map(),\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleDyanmicDs',\n kind: StellarHandlerKind.Event,\n filter: {\n topics: ['COUNTER'],\n },\n },\n ],\n },\n };\n const result = buildDictionaryQueryEntries([ds], 1);\n expect(result).toEqual([\n {\n entity: 'events',\n conditions: [\n {\n field: 'topics0',\n value: 'COUNTER',\n matcher: 'equalTo',\n },\n ],\n },\n ]);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"fetch.service.spec.js","sourceRoot":"","sources":["../../src/indexer/fetch.service.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;AAEnC,wDAI8B;AAC9B,mDAA8D;AAE9D,QAAQ,CAAC,6BAA6B,EAAE,GAAG,EAAE;IAC3C,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,EAAE,GAA2B;YACjC,IAAI,EAAE,qCAAqB,CAAC,OAAO;YACnC,UAAU,EAAE,CAA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CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QACpD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC7B,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 {\n StellarDatasourceKind,\n StellarHandlerKind,\n SubqlRuntimeDatasource,\n} from '@subql/types-stellar';\nimport { buildDictionaryQueryEntries } from './fetch.service';\n\ndescribe('buildDictionaryQueryEntries', () => {\n it('should correctly build dictionary query entries for transactions', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: StellarDatasourceKind.Runtime,\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransactions',\n kind: StellarHandlerKind.Transaction,\n filter: {\n account: 'test_account',\n },\n },\n ],\n },\n };\n const result = buildDictionaryQueryEntries([ds], 1);\n expect(result).toEqual([\n {\n entity: 'transactions',\n conditions: [\n {\n field: 'account',\n value: 'test_account',\n matcher: 'equalTo',\n },\n ],\n },\n ]);\n });\n\n it('should correctly build dictionary query entries for operations', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: StellarDatasourceKind.Runtime,\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleOperations',\n kind: StellarHandlerKind.Operation,\n filter: {\n sourceAccount: 'source_account',\n type: 'operation_type',\n },\n } as any,\n ],\n },\n };\n const result = buildDictionaryQueryEntries([ds], 1);\n expect(result).toEqual([\n {\n entity: 'operations',\n conditions: [\n {\n field: 'type',\n value: 'operation_type',\n matcher: 'equalTo',\n },\n {\n field: 'sourceAccount',\n value: 'source_account',\n matcher: 'equalTo',\n },\n ],\n },\n ]);\n });\n\n it('should correctly build dictionary query entries for effects', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: StellarDatasourceKind.Runtime,\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleEffects',\n kind: StellarHandlerKind.Effects,\n filter: {\n account: 'effect_account',\n type: 'effect_type',\n },\n },\n ],\n },\n };\n const result = buildDictionaryQueryEntries([ds], 1);\n expect(result).toEqual([\n {\n entity: 'effects',\n conditions: [\n {\n field: 'type',\n value: 'effect_type',\n matcher: 'equalTo',\n },\n {\n field: 'account',\n value: 'effect_account',\n matcher: 'equalTo',\n },\n ],\n },\n ]);\n });\n\n it('should return an empty array when no filters are provided', () => {\n const ds: SubqlRuntimeDatasource = {\n kind: StellarDatasourceKind.Runtime,\n startBlock: 1,\n mapping: {\n file: '',\n handlers: [\n {\n handler: 'handleTransactions',\n kind: StellarHandlerKind.Transaction,\n filter: {},\n },\n ],\n },\n };\n const result = buildDictionaryQueryEntries([ds], 1);\n expect(result).toEqual([]);\n });\n});\n"]}
@@ -1,6 +1,6 @@
1
- import { isEventHandlerProcessor, isCustomDs, isRuntimeDs, SubqlStellarCustomDataSource, StellarHandlerKind, StellarRuntimeHandlerInputMap, SubqlStellarDataSource } from '@subql/common-stellar';
1
+ import { isCustomDs, isRuntimeDs, SubqlStellarCustomDataSource, StellarHandlerKind, StellarRuntimeHandlerInputMap, SubqlStellarDataSource, isBlockHandlerProcessor, isTransactionHandlerProcessor, isOperationHandlerProcessor, isEffectHandlerProcessor, isEventHandlerProcessor, isSorobanTransactionHandlerProcessor } from '@subql/common-stellar';
2
2
  import { NodeConfig, IndexerSandbox, ProcessBlockResponse, BaseIndexerManager, ApiService } from '@subql/node-core';
3
- import { StellarEvent, StellarEventFilter, StellarBlockWrapper, SubqlDatasource } from '@subql/types-stellar';
3
+ import { StellarBlockWrapper, SubqlDatasource, StellarTransaction, StellarOperation, StellarEffect, StellarBlock, StellarBlockFilter, StellarTransactionFilter, StellarOperationFilter, StellarEffectFilter, SorobanEvent, SorobanEventFilter } from '@subql/types-stellar';
4
4
  import { SubqlProjectDs } from '../configure/SubqueryProject';
5
5
  import { StellarApi } from '../stellar';
6
6
  import SafeStellarProvider from '../stellar/safe-api';
@@ -20,17 +20,36 @@ export declare class IndexerManager extends BaseIndexerManager<SafeStellarProvid
20
20
  getBlockHeight(block: StellarBlockWrapper): number;
21
21
  getBlockHash(block: StellarBlockWrapper): string;
22
22
  private getApi;
23
- protected indexBlockData({ events }: StellarBlockWrapper, dataSources: SubqlProjectDs[], getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>): Promise<void>;
23
+ protected indexBlockData({ block, effects, operations, transactions }: StellarBlockWrapper, dataSources: SubqlProjectDs[], getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>): Promise<void>;
24
+ private indexBlockContent;
25
+ private indexTransaction;
26
+ private indexOperation;
27
+ private indexEffect;
24
28
  private indexEvent;
25
29
  protected prepareFilteredData<T = any>(kind: StellarHandlerKind, data: T, ds: SubqlDatasource): Promise<T>;
26
30
  }
27
31
  type ProcessorTypeMap = {
32
+ [StellarHandlerKind.Block]: typeof isBlockHandlerProcessor;
33
+ [StellarHandlerKind.Transaction]: typeof isTransactionHandlerProcessor;
34
+ [StellarHandlerKind.SorobanTransaction]: typeof isSorobanTransactionHandlerProcessor;
35
+ [StellarHandlerKind.Operation]: typeof isOperationHandlerProcessor;
36
+ [StellarHandlerKind.Effects]: typeof isEffectHandlerProcessor;
28
37
  [StellarHandlerKind.Event]: typeof isEventHandlerProcessor;
29
38
  };
30
39
  declare const ProcessorTypeMap: {
31
- "stellar/EventHandler": typeof isEventHandlerProcessor;
40
+ "stellar/BlockHandler": typeof isBlockHandlerProcessor;
41
+ "stellar/TransactionHandler": typeof isTransactionHandlerProcessor;
42
+ "soroban/TransactionHandler": typeof isSorobanTransactionHandlerProcessor;
43
+ "stellar/OperationHandler": typeof isOperationHandlerProcessor;
44
+ "stellar/EffectHandler": typeof isEffectHandlerProcessor;
45
+ "soroban/EventHandler": typeof isEventHandlerProcessor;
32
46
  };
33
47
  declare const FilterTypeMap: {
34
- "stellar/EventHandler": (data: StellarEvent, filter: StellarEventFilter, ds: SubqlStellarDataSource) => boolean;
48
+ "stellar/BlockHandler": (data: StellarBlock, filter: StellarBlockFilter, ds: SubqlStellarDataSource) => boolean;
49
+ "stellar/TransactionHandler": (data: StellarTransaction, filter: StellarTransactionFilter, ds: SubqlStellarDataSource) => boolean;
50
+ "soroban/TransactionHandler": (data: StellarTransaction, filter: StellarTransactionFilter, ds: SubqlStellarDataSource) => boolean;
51
+ "stellar/OperationHandler": (data: StellarOperation, filter: StellarOperationFilter, ds: SubqlStellarDataSource) => boolean;
52
+ "stellar/EffectHandler": (data: StellarEffect, filter: StellarEffectFilter, ds: SubqlStellarDataSource) => boolean;
53
+ "soroban/EventHandler": (data: SorobanEvent, filter: SorobanEventFilter, ds: SubqlStellarDataSource) => boolean;
35
54
  };
36
55
  export {};
@@ -41,7 +41,7 @@ let IndexerManager = class IndexerManager extends node_core_1.BaseIndexerManager
41
41
  return super.internalIndexBlock(block, dataSources, () => this.getApi(block));
42
42
  }
43
43
  getBlockHeight(block) {
44
- return block.block.ledger;
44
+ return block.block.sequence;
45
45
  }
46
46
  getBlockHash(block) {
47
47
  return block.block.hash;
@@ -51,9 +51,42 @@ let IndexerManager = class IndexerManager extends node_core_1.BaseIndexerManager
51
51
  // return this.apiService.safeApi(this.getBlockHeight(block));
52
52
  return null;
53
53
  }
54
- async indexBlockData({ events }, dataSources, getVM) {
55
- for (const event of events) {
56
- await this.indexEvent(event, dataSources, getVM);
54
+ async indexBlockData({ block, effects, operations, transactions }, dataSources, getVM) {
55
+ await this.indexBlockContent(block, dataSources, getVM);
56
+ for (const tx of transactions) {
57
+ await this.indexTransaction(tx, dataSources, getVM);
58
+ for (const operation of tx.operations) {
59
+ await this.indexOperation(operation, dataSources, getVM);
60
+ for (const effect of operation.effects) {
61
+ await this.indexEffect(effect, dataSources, getVM);
62
+ }
63
+ for (const event of operation.events) {
64
+ await this.indexEvent(event, dataSources, getVM);
65
+ }
66
+ }
67
+ }
68
+ }
69
+ async indexBlockContent(block, dataSources, getVM) {
70
+ for (const ds of dataSources) {
71
+ await this.indexData(common_stellar_1.StellarHandlerKind.Block, block, ds, getVM);
72
+ }
73
+ }
74
+ async indexTransaction(transaction, dataSources, getVM) {
75
+ for (const ds of dataSources) {
76
+ await this.indexData(common_stellar_1.StellarHandlerKind.Transaction, transaction, ds, getVM);
77
+ if (transaction.operations.some((op) => op.type.toString() === 'invoke_host_function')) {
78
+ await this.indexData(common_stellar_1.StellarHandlerKind.SorobanTransaction, transaction, ds, getVM);
79
+ }
80
+ }
81
+ }
82
+ async indexOperation(operation, dataSources, getVM) {
83
+ for (const ds of dataSources) {
84
+ await this.indexData(common_stellar_1.StellarHandlerKind.Operation, operation, ds, getVM);
85
+ }
86
+ }
87
+ async indexEffect(effect, dataSources, getVM) {
88
+ for (const ds of dataSources) {
89
+ await this.indexData(common_stellar_1.StellarHandlerKind.Effects, effect, ds, getVM);
57
90
  }
58
91
  }
59
92
  async indexEvent(event, dataSources, getVM) {
@@ -84,9 +117,34 @@ IndexerManager = __decorate([
84
117
  ], IndexerManager);
85
118
  exports.IndexerManager = IndexerManager;
86
119
  const ProcessorTypeMap = {
120
+ [common_stellar_1.StellarHandlerKind.Block]: common_stellar_1.isBlockHandlerProcessor,
121
+ [common_stellar_1.StellarHandlerKind.Transaction]: common_stellar_1.isTransactionHandlerProcessor,
122
+ [common_stellar_1.StellarHandlerKind.SorobanTransaction]: common_stellar_1.isSorobanTransactionHandlerProcessor,
123
+ [common_stellar_1.StellarHandlerKind.Operation]: common_stellar_1.isOperationHandlerProcessor,
124
+ [common_stellar_1.StellarHandlerKind.Effects]: common_stellar_1.isEffectHandlerProcessor,
87
125
  [common_stellar_1.StellarHandlerKind.Event]: common_stellar_1.isEventHandlerProcessor,
88
126
  };
89
127
  const FilterTypeMap = {
128
+ [common_stellar_1.StellarHandlerKind.Block]: (data, filter, ds) => {
129
+ var _a;
130
+ return block_stellar_1.StellarBlockWrapped.filterBlocksProcessor(data, filter, (_a = ds.options) === null || _a === void 0 ? void 0 : _a.address);
131
+ },
132
+ [common_stellar_1.StellarHandlerKind.Transaction]: (data, filter, ds) => {
133
+ var _a;
134
+ return block_stellar_1.StellarBlockWrapped.filterTransactionProcessor(data, filter, (_a = ds.options) === null || _a === void 0 ? void 0 : _a.address);
135
+ },
136
+ [common_stellar_1.StellarHandlerKind.SorobanTransaction]: (data, filter, ds) => {
137
+ var _a;
138
+ return block_stellar_1.StellarBlockWrapped.filterTransactionProcessor(data, filter, (_a = ds.options) === null || _a === void 0 ? void 0 : _a.address);
139
+ },
140
+ [common_stellar_1.StellarHandlerKind.Operation]: (data, filter, ds) => {
141
+ var _a;
142
+ return block_stellar_1.StellarBlockWrapped.filterOperationProcessor(data, filter, (_a = ds.options) === null || _a === void 0 ? void 0 : _a.address);
143
+ },
144
+ [common_stellar_1.StellarHandlerKind.Effects]: (data, filter, ds) => {
145
+ var _a;
146
+ return block_stellar_1.StellarBlockWrapped.filterEffectProcessor(data, filter, (_a = ds.options) === null || _a === void 0 ? void 0 : _a.address);
147
+ },
90
148
  [common_stellar_1.StellarHandlerKind.Event]: (data, filter, ds) => { var _a; return block_stellar_1.StellarBlockWrapped.filterEventProcessor(data, filter, (_a = ds.options) === null || _a === void 0 ? void 0 : _a.address); },
91
149
  };
92
150
  //# sourceMappingURL=indexer.manager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"indexer.manager.js","sourceRoot":"","sources":["../../src/indexer/indexer.manager.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AACpD,0DAQ+B;AAC/B,gDAQ0B;AAS1B,4DAA+D;AAE/D,iEAGgC;AAChC,6DAAwD;AACxD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AAEvE,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,SAAS,CAAC,CAAC;AAG7B,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,8BAUnC;IAKC,YACE,UAAsB,EACtB,UAAsB,EACtB,cAA8B,EAC9B,kBAAsC,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AI,WAAW,EAAE;YAC5B,MAAM,IAAI,CAAC,SAAS,CAAC,mCAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SAClE;IACH,CAAC;IAES,KAAK,CAAC,mBAAmB,CACjC,IAAwB,EACxB,IAAO,EACP,EAAmB;QAEnB,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;CACF,CAAA;AApDO;IADL,IAAA,oBAAQ,GAAE;;;;gDAQV;AAjDU,cAAc;IAD1B,IAAA,mBAAU,GAAE;IAuBR,WAAA,IAAA,eAAM,EAAC,iBAAiB,CAAC,CAAA;qCANd,sBAAU;QACV,sBAAU;QACN,gCAAc;QACV,yCAAkB;QACpB,qCAAgB;QACR,oDAAwB;QACC,gCAAc;GAtBxD,cAAc,CA8F1B;AA9FY,wCAAc;AAoG3B,MAAM,gBAAgB,GAAG;IACvB,CAAC,mCAAkB,CAAC,KAAK,CAAC,EAAE,wCAAuB;CACpD,CAAC;AAEF,MAAM,aAAa,GAAG;IACpB,CAAC,mCAAkB,CAAC,KAAK,CAAC,EAAE,CAC1B,IAAkB,EAClB,MAA0B,EAC1B,EAA0B,EAC1B,EAAE,WACF,OAAA,mCAAmB,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAA,EAAE,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAA,EAAA;CAC9E,CAAC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n isEventHandlerProcessor,\n isCustomDs,\n isRuntimeDs,\n SubqlStellarCustomDataSource,\n StellarHandlerKind,\n StellarRuntimeHandlerInputMap,\n SubqlStellarDataSource,\n} from '@subql/common-stellar';\nimport {\n NodeConfig,\n getLogger,\n profiler,\n IndexerSandbox,\n ProcessBlockResponse,\n BaseIndexerManager,\n ApiService,\n} from '@subql/node-core';\nimport {\n StellarEvent,\n StellarEventFilter,\n StellarBlockWrapper,\n SubqlDatasource,\n} from '@subql/types-stellar';\nimport { SubqlProjectDs } from '../configure/SubqueryProject';\nimport { StellarApi } from '../stellar';\nimport { StellarBlockWrapped } from '../stellar/block.stellar';\nimport SafeStellarProvider from '../stellar/safe-api';\nimport {\n asSecondLayerHandlerProcessor_1_0_0,\n DsProcessorService,\n} from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\nconst logger = getLogger('indexer');\n\n@Injectable()\nexport class IndexerManager extends BaseIndexerManager<\n SafeStellarProvider,\n StellarApi,\n StellarBlockWrapper,\n ApiService,\n SubqlStellarDataSource,\n SubqlStellarCustomDataSource,\n typeof FilterTypeMap,\n typeof ProcessorTypeMap,\n StellarRuntimeHandlerInputMap\n> {\n protected isRuntimeDs = isRuntimeDs;\n protected isCustomDs = isCustomDs;\n protected updateCustomProcessor = asSecondLayerHandlerProcessor_1_0_0;\n\n constructor(\n apiService: ApiService,\n nodeConfig: NodeConfig,\n sandboxService: SandboxService,\n dsProcessorService: DsProcessorService,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocksService: UnfinalizedBlocksService,\n @Inject('IProjectService') private projectService: ProjectService,\n ) {\n super(\n apiService,\n nodeConfig,\n sandboxService,\n dsProcessorService,\n dynamicDsService,\n unfinalizedBlocksService,\n FilterTypeMap,\n ProcessorTypeMap,\n );\n }\n\n async start(): Promise<void> {\n await this.projectService.init();\n logger.info('indexer manager started');\n }\n\n @profiler()\n async indexBlock(\n block: StellarBlockWrapper,\n dataSources: SubqlStellarDataSource[],\n ): Promise<ProcessBlockResponse> {\n return super.internalIndexBlock(block, dataSources, () =>\n this.getApi(block),\n );\n }\n\n getBlockHeight(block: StellarBlockWrapper): number {\n return block.block.ledger;\n }\n\n getBlockHash(block: StellarBlockWrapper): string {\n return block.block.hash;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n private async getApi(\n block: StellarBlockWrapper,\n ): Promise<SafeStellarProvider> {\n // return this.apiService.safeApi(this.getBlockHeight(block));\n return null;\n }\n\n protected async indexBlockData(\n { events }: StellarBlockWrapper,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const event of events) {\n await this.indexEvent(event, dataSources, getVM);\n }\n }\n\n private async indexEvent(\n event: StellarEvent,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(StellarHandlerKind.Event, event, ds, getVM);\n }\n }\n\n protected async prepareFilteredData<T = any>(\n kind: StellarHandlerKind,\n data: T,\n ds: SubqlDatasource,\n ): Promise<T> {\n return Promise.resolve(data);\n }\n}\n\ntype ProcessorTypeMap = {\n [StellarHandlerKind.Event]: typeof isEventHandlerProcessor;\n};\n\nconst ProcessorTypeMap = {\n [StellarHandlerKind.Event]: isEventHandlerProcessor,\n};\n\nconst FilterTypeMap = {\n [StellarHandlerKind.Event]: (\n data: StellarEvent,\n filter: StellarEventFilter,\n ds: SubqlStellarDataSource,\n ) =>\n StellarBlockWrapped.filterEventProcessor(data, filter, ds.options?.address),\n};\n"]}
1
+ {"version":3,"file":"indexer.manager.js","sourceRoot":"","sources":["../../src/indexer/indexer.manager.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;;;;AAEnC,2CAAoD;AACpD,0DAa+B;AAC/B,gDAQ0B;AAiB1B,4DAA+D;AAE/D,iEAGgC;AAChC,6DAAwD;AACxD,uDAAmD;AACnD,uDAAmD;AACnD,2EAAuE;AAEvE,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,SAAS,CAAC,CAAC;AAG7B,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,8BAUnC;IAKC,YACE,UAAs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qBAAqB,CACvC,IAAI,EACJ,MAAM,EACN,MAAA,EAAE,CAAC,OAAO,0CAAE,OAAO,CACpB,CAAA;KAAA;IAEH,CAAC,mCAAkB,CAAC,KAAK,CAAC,EAAE,CAC1B,IAAkB,EAClB,MAA0B,EAC1B,EAA0B,EAC1B,EAAE,WACF,OAAA,mCAAmB,CAAC,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAA,EAAE,CAAC,OAAO,0CAAE,OAAO,CAAC,CAAA,EAAA;CAC9E,CAAC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Inject, Injectable } from '@nestjs/common';\nimport {\n isCustomDs,\n isRuntimeDs,\n SubqlStellarCustomDataSource,\n StellarHandlerKind,\n StellarRuntimeHandlerInputMap,\n SubqlStellarDataSource,\n isBlockHandlerProcessor,\n isTransactionHandlerProcessor,\n isOperationHandlerProcessor,\n isEffectHandlerProcessor,\n isEventHandlerProcessor,\n isSorobanTransactionHandlerProcessor,\n} from '@subql/common-stellar';\nimport {\n NodeConfig,\n getLogger,\n profiler,\n IndexerSandbox,\n ProcessBlockResponse,\n BaseIndexerManager,\n ApiService,\n} from '@subql/node-core';\nimport {\n StellarBlockWrapper,\n SubqlDatasource,\n StellarTransaction,\n StellarOperation,\n StellarEffect,\n StellarBlock,\n StellarBlockFilter,\n StellarTransactionFilter,\n StellarOperationFilter,\n StellarEffectFilter,\n SorobanEvent,\n SorobanEventFilter,\n} from '@subql/types-stellar';\nimport { SubqlProjectDs } from '../configure/SubqueryProject';\nimport { StellarApi } from '../stellar';\nimport { StellarBlockWrapped } from '../stellar/block.stellar';\nimport SafeStellarProvider from '../stellar/safe-api';\nimport {\n asSecondLayerHandlerProcessor_1_0_0,\n DsProcessorService,\n} from './ds-processor.service';\nimport { DynamicDsService } from './dynamic-ds.service';\nimport { ProjectService } from './project.service';\nimport { SandboxService } from './sandbox.service';\nimport { UnfinalizedBlocksService } from './unfinalizedBlocks.service';\n\nconst logger = getLogger('indexer');\n\n@Injectable()\nexport class IndexerManager extends BaseIndexerManager<\n SafeStellarProvider,\n StellarApi,\n StellarBlockWrapper,\n ApiService,\n SubqlStellarDataSource,\n SubqlStellarCustomDataSource,\n typeof FilterTypeMap,\n typeof ProcessorTypeMap,\n StellarRuntimeHandlerInputMap\n> {\n protected isRuntimeDs = isRuntimeDs;\n protected isCustomDs = isCustomDs;\n protected updateCustomProcessor = asSecondLayerHandlerProcessor_1_0_0;\n\n constructor(\n apiService: ApiService,\n nodeConfig: NodeConfig,\n sandboxService: SandboxService,\n dsProcessorService: DsProcessorService,\n dynamicDsService: DynamicDsService,\n unfinalizedBlocksService: UnfinalizedBlocksService,\n @Inject('IProjectService') private projectService: ProjectService,\n ) {\n super(\n apiService,\n nodeConfig,\n sandboxService,\n dsProcessorService,\n dynamicDsService,\n unfinalizedBlocksService,\n FilterTypeMap,\n ProcessorTypeMap,\n );\n }\n\n async start(): Promise<void> {\n await this.projectService.init();\n logger.info('indexer manager started');\n }\n\n @profiler()\n async indexBlock(\n block: StellarBlockWrapper,\n dataSources: SubqlStellarDataSource[],\n ): Promise<ProcessBlockResponse> {\n return super.internalIndexBlock(block, dataSources, () =>\n this.getApi(block),\n );\n }\n\n getBlockHeight(block: StellarBlockWrapper): number {\n return block.block.sequence;\n }\n\n getBlockHash(block: StellarBlockWrapper): string {\n return block.block.hash;\n }\n\n // eslint-disable-next-line @typescript-eslint/require-await\n private async getApi(\n block: StellarBlockWrapper,\n ): Promise<SafeStellarProvider> {\n // return this.apiService.safeApi(this.getBlockHeight(block));\n return null;\n }\n\n protected async indexBlockData(\n { block, effects, operations, transactions }: StellarBlockWrapper,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n await this.indexBlockContent(block, dataSources, getVM);\n\n for (const tx of transactions) {\n await this.indexTransaction(tx, dataSources, getVM);\n\n for (const operation of tx.operations) {\n await this.indexOperation(operation, dataSources, getVM);\n\n for (const effect of operation.effects) {\n await this.indexEffect(effect, dataSources, getVM);\n }\n\n for (const event of operation.events) {\n await this.indexEvent(event, dataSources, getVM);\n }\n }\n }\n }\n\n private async indexBlockContent(\n block: StellarBlock,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(StellarHandlerKind.Block, block, ds, getVM);\n }\n }\n\n private async indexTransaction(\n transaction: StellarTransaction,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(\n StellarHandlerKind.Transaction,\n transaction,\n ds,\n getVM,\n );\n\n if (\n transaction.operations.some(\n (op) => op.type.toString() === 'invoke_host_function',\n )\n ) {\n await this.indexData(\n StellarHandlerKind.SorobanTransaction,\n transaction,\n ds,\n getVM,\n );\n }\n }\n }\n\n private async indexOperation(\n operation: StellarOperation,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(StellarHandlerKind.Operation, operation, ds, getVM);\n }\n }\n\n private async indexEffect(\n effect: StellarEffect,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(StellarHandlerKind.Effects, effect, ds, getVM);\n }\n }\n\n private async indexEvent(\n event: SorobanEvent,\n dataSources: SubqlProjectDs[],\n getVM: (d: SubqlProjectDs) => Promise<IndexerSandbox>,\n ): Promise<void> {\n for (const ds of dataSources) {\n await this.indexData(StellarHandlerKind.Event, event, ds, getVM);\n }\n }\n\n protected async prepareFilteredData<T = any>(\n kind: StellarHandlerKind,\n data: T,\n ds: SubqlDatasource,\n ): Promise<T> {\n return Promise.resolve(data);\n }\n}\n\ntype ProcessorTypeMap = {\n [StellarHandlerKind.Block]: typeof isBlockHandlerProcessor;\n [StellarHandlerKind.Transaction]: typeof isTransactionHandlerProcessor;\n [StellarHandlerKind.SorobanTransaction]: typeof isSorobanTransactionHandlerProcessor;\n [StellarHandlerKind.Operation]: typeof isOperationHandlerProcessor;\n [StellarHandlerKind.Effects]: typeof isEffectHandlerProcessor;\n [StellarHandlerKind.Event]: typeof isEventHandlerProcessor;\n};\n\nconst ProcessorTypeMap = {\n [StellarHandlerKind.Block]: isBlockHandlerProcessor,\n [StellarHandlerKind.Transaction]: isTransactionHandlerProcessor,\n [StellarHandlerKind.SorobanTransaction]: isSorobanTransactionHandlerProcessor,\n [StellarHandlerKind.Operation]: isOperationHandlerProcessor,\n [StellarHandlerKind.Effects]: isEffectHandlerProcessor,\n [StellarHandlerKind.Event]: isEventHandlerProcessor,\n};\n\nconst FilterTypeMap = {\n [StellarHandlerKind.Block]: (\n data: StellarBlock,\n filter: StellarBlockFilter,\n ds: SubqlStellarDataSource,\n ) =>\n StellarBlockWrapped.filterBlocksProcessor(\n data,\n filter,\n ds.options?.address,\n ),\n\n [StellarHandlerKind.Transaction]: (\n data: StellarTransaction,\n filter: StellarTransactionFilter,\n ds: SubqlStellarDataSource,\n ) =>\n StellarBlockWrapped.filterTransactionProcessor(\n data,\n filter,\n ds.options?.address,\n ),\n\n [StellarHandlerKind.SorobanTransaction]: (\n data: StellarTransaction,\n filter: StellarTransactionFilter,\n ds: SubqlStellarDataSource,\n ) =>\n StellarBlockWrapped.filterTransactionProcessor(\n data,\n filter,\n ds.options?.address,\n ),\n\n [StellarHandlerKind.Operation]: (\n data: StellarOperation,\n filter: StellarOperationFilter,\n ds: SubqlStellarDataSource,\n ) =>\n StellarBlockWrapped.filterOperationProcessor(\n data,\n filter,\n ds.options?.address,\n ),\n\n [StellarHandlerKind.Effects]: (\n data: StellarEffect,\n filter: StellarEffectFilter,\n ds: SubqlStellarDataSource,\n ) =>\n StellarBlockWrapped.filterEffectProcessor(\n data,\n filter,\n ds.options?.address,\n ),\n\n [StellarHandlerKind.Event]: (\n data: SorobanEvent,\n filter: SorobanEventFilter,\n ds: SubqlStellarDataSource,\n ) =>\n StellarBlockWrapped.filterEventProcessor(data, filter, ds.options?.address),\n};\n"]}
@@ -29,7 +29,7 @@ let UnfinalizedBlocksService = class UnfinalizedBlocksService extends node_core_
29
29
  this.apiService = apiService;
30
30
  }
31
31
  blockToHeader(block) {
32
- return blockToHeader(block.block.ledger);
32
+ return blockToHeader(block.block.sequence);
33
33
  }
34
34
  async getFinalizedHead() {
35
35
  const finalizedHeight = await this.apiService.api.getFinalizedBlockHeight();
@@ -1 +1 @@
1
- {"version":3,"file":"unfinalizedBlocks.service.js","sourceRoot":"","sources":["../../src/indexer/unfinalizedBlocks.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAC5C,gDAO0B;AAG1B,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,aAAa,CAAC,CAAC;AAExC,SAAgB,aAAa,CAAC,WAAmB;IAC/C,OAAO;QACL,WAAW,EAAE,WAAW;QACxB,SAAS,EAAE,WAAW,CAAC,QAAQ,EAAE;QACjC,UAAU,EAAE,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;KACzC,CAAC;AACJ,CAAC;AAND,sCAMC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,wCAA0C;IACtF,YACmB,UAAsB,EACvC,UAAsB,EACtB,UAA6B;QAE7B,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAJb,eAAU,GAAV,UAAU,CAAY;IAKzC,CAAC;IAES,aAAa,CAAC,KAAmB;QACzC,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;IAES,KAAK,CAAC,gBAAgB;QAC9B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;QAC5E,OAAO,aAAa,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,IAAY;QAC3C,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;IAES,KAAK,CAAC,kBAAkB,CAAC,MAAc;QAC/C,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AAzBY,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAGoB,sBAAU;QAC3B,sBAAU;QACV,6BAAiB;GAJpB,wBAAwB,CAyBpC;AAzBY,4DAAwB","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport {\n ApiService,\n BaseUnfinalizedBlocksService,\n Header,\n NodeConfig,\n StoreCacheService,\n getLogger,\n} from '@subql/node-core';\nimport { BlockWrapper } from '@subql/types-stellar';\n\nconst logger = getLogger('unfinalized');\n\nexport function blockToHeader(blockHeight: number): Header {\n return {\n blockHeight: blockHeight,\n blockHash: blockHeight.toString(),\n parentHash: (blockHeight - 1).toString(),\n };\n}\n\n@Injectable()\nexport class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService<BlockWrapper> {\n constructor(\n private readonly apiService: ApiService,\n nodeConfig: NodeConfig,\n storeCache: StoreCacheService,\n ) {\n super(nodeConfig, storeCache);\n }\n\n protected blockToHeader(block: BlockWrapper): Header {\n return blockToHeader(block.block.ledger);\n }\n\n protected async getFinalizedHead(): Promise<Header> {\n const finalizedHeight = await this.apiService.api.getFinalizedBlockHeight();\n return blockToHeader(finalizedHeight);\n }\n\n protected async getHeaderForHash(hash: string): Promise<Header> {\n return this.getHeaderForHeight(parseInt(hash, 10));\n }\n\n protected async getHeaderForHeight(height: number): Promise<Header> {\n return Promise.resolve(blockToHeader(height));\n }\n}\n"]}
1
+ {"version":3,"file":"unfinalizedBlocks.service.js","sourceRoot":"","sources":["../../src/indexer/unfinalizedBlocks.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAC5C,gDAO0B;AAG1B,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,aAAa,CAAC,CAAC;AAExC,SAAgB,aAAa,CAAC,WAAmB;IAC/C,OAAO;QACL,WAAW,EAAE,WAAW;QACxB,SAAS,EAAE,WAAW,CAAC,QAAQ,EAAE;QACjC,UAAU,EAAE,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE;KACzC,CAAC;AACJ,CAAC;AAND,sCAMC;AAGM,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,wCAA0C;IACtF,YACmB,UAAsB,EACvC,UAAsB,EACtB,UAA6B;QAE7B,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;QAJb,eAAU,GAAV,UAAU,CAAY;IAKzC,CAAC;IAES,aAAa,CAAC,KAAmB;QACzC,OAAO,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7C,CAAC;IAES,KAAK,CAAC,gBAAgB;QAC9B,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC;QAC5E,OAAO,aAAa,CAAC,eAAe,CAAC,CAAC;IACxC,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,IAAY;QAC3C,OAAO,IAAI,CAAC,kBAAkB,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACrD,CAAC;IAES,KAAK,CAAC,kBAAkB,CAAC,MAAc;QAC/C,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;IAChD,CAAC;CACF,CAAA;AAzBY,wBAAwB;IADpC,IAAA,mBAAU,GAAE;qCAGoB,sBAAU;QAC3B,sBAAU;QACV,6BAAiB;GAJpB,wBAAwB,CAyBpC;AAzBY,4DAAwB","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport {\n ApiService,\n BaseUnfinalizedBlocksService,\n Header,\n NodeConfig,\n StoreCacheService,\n getLogger,\n} from '@subql/node-core';\nimport { BlockWrapper } from '@subql/types-stellar';\n\nconst logger = getLogger('unfinalized');\n\nexport function blockToHeader(blockHeight: number): Header {\n return {\n blockHeight: blockHeight,\n blockHash: blockHeight.toString(),\n parentHash: (blockHeight - 1).toString(),\n };\n}\n\n@Injectable()\nexport class UnfinalizedBlocksService extends BaseUnfinalizedBlocksService<BlockWrapper> {\n constructor(\n private readonly apiService: ApiService,\n nodeConfig: NodeConfig,\n storeCache: StoreCacheService,\n ) {\n super(nodeConfig, storeCache);\n }\n\n protected blockToHeader(block: BlockWrapper): Header {\n return blockToHeader(block.block.sequence);\n }\n\n protected async getFinalizedHead(): Promise<Header> {\n const finalizedHeight = await this.apiService.api.getFinalizedBlockHeight();\n return blockToHeader(finalizedHeight);\n }\n\n protected async getHeaderForHash(hash: string): Promise<Header> {\n return this.getHeaderForHeight(parseInt(hash, 10));\n }\n\n protected async getHeaderForHeight(height: number): Promise<Header> {\n return Promise.resolve(blockToHeader(height));\n }\n}\n"]}
@@ -25,7 +25,7 @@ let WorkerUnfinalizedBlocksService = class WorkerUnfinalizedBlocksService {
25
25
  return this.host.unfinalizedBlocksProcess(header);
26
26
  }
27
27
  async processUnfinalizedBlocks({ block, }) {
28
- return this.host.unfinalizedBlocksProcess((0, unfinalizedBlocks_service_1.blockToHeader)(block.ledger));
28
+ return this.host.unfinalizedBlocksProcess((0, unfinalizedBlocks_service_1.blockToHeader)(block.sequence));
29
29
  }
30
30
  // eslint-disable-next-line @typescript-eslint/promise-function-async
31
31
  init(reindex) {
@@ -1 +1 @@
1
- {"version":3,"file":"worker.unfinalizedBlocks.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.unfinalizedBlocks.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAG5C,4EAA6D;AAMhD,QAAA,yBAAyB,GAAoC;IACxE,0BAA0B;CAC3B,CAAC;AAGK,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGzC,YAAoB,IAA2B;QAA3B,SAAI,GAAJ,IAAI,CAAuB;IAAG,CAAC;IAEnD,KAAK,CAAC,6BAA6B,CAAC,MAAc;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,EAC7B,KAAK,GACQ;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAA,yCAAa,EAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,OAAgD;QACnD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,sBAAsB;QACpB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,gCAAgC;QAC9B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,qEAAqE;IACrE,4BAA4B;QAC1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AA7BY,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;;GACA,8BAA8B,CA6B1C;AA7BY,wEAA8B","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport { Header, IUnfinalizedBlocksService } from '@subql/node-core';\nimport { BlockWrapper } from '@subql/types-stellar';\nimport { blockToHeader } from '../unfinalizedBlocks.service';\n\nexport type HostUnfinalizedBlocks = {\n unfinalizedBlocksProcess: (header: Header) => Promise<number | null>;\n};\n\nexport const hostUnfinalizedBlocksKeys: (keyof HostUnfinalizedBlocks)[] = [\n 'unfinalizedBlocksProcess',\n];\n\n@Injectable()\nexport class WorkerUnfinalizedBlocksService\n implements IUnfinalizedBlocksService<BlockWrapper>\n{\n constructor(private host: HostUnfinalizedBlocks) {}\n\n async processUnfinalizedBlockHeader(header: Header): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess(header);\n }\n\n async processUnfinalizedBlocks({\n block,\n }: BlockWrapper): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess(blockToHeader(block.ledger));\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n init(reindex: (targetHeight: number) => Promise<void>): Promise<number> {\n throw new Error('This method should not be called from a worker');\n }\n resetUnfinalizedBlocks(): void {\n throw new Error('This method should not be called from a worker');\n }\n resetLastFinalizedVerifiedHeight(): void {\n throw new Error('This method should not be called from a worker');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getMetadataUnfinalizedBlocks(): Promise<Header[]> {\n throw new Error('This method should not be called from a worker');\n }\n}\n"]}
1
+ {"version":3,"file":"worker.unfinalizedBlocks.service.js","sourceRoot":"","sources":["../../../src/indexer/worker/worker.unfinalizedBlocks.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAG5C,4EAA6D;AAMhD,QAAA,yBAAyB,GAAoC;IACxE,0BAA0B;CAC3B,CAAC;AAGK,IAAM,8BAA8B,GAApC,MAAM,8BAA8B;IAGzC,YAAoB,IAA2B;QAA3B,SAAI,GAAJ,IAAI,CAAuB;IAAG,CAAC;IAEnD,KAAK,CAAC,6BAA6B,CAAC,MAAc;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,wBAAwB,CAAC,EAC7B,KAAK,GACQ;QACb,OAAO,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAA,yCAAa,EAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,OAAgD;QACnD,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,sBAAsB;QACpB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,gCAAgC;QAC9B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,qEAAqE;IACrE,4BAA4B;QAC1B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;CACF,CAAA;AA7BY,8BAA8B;IAD1C,IAAA,mBAAU,GAAE;;GACA,8BAA8B,CA6B1C;AA7BY,wEAA8B","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport { Header, IUnfinalizedBlocksService } from '@subql/node-core';\nimport { BlockWrapper } from '@subql/types-stellar';\nimport { blockToHeader } from '../unfinalizedBlocks.service';\n\nexport type HostUnfinalizedBlocks = {\n unfinalizedBlocksProcess: (header: Header) => Promise<number | null>;\n};\n\nexport const hostUnfinalizedBlocksKeys: (keyof HostUnfinalizedBlocks)[] = [\n 'unfinalizedBlocksProcess',\n];\n\n@Injectable()\nexport class WorkerUnfinalizedBlocksService\n implements IUnfinalizedBlocksService<BlockWrapper>\n{\n constructor(private host: HostUnfinalizedBlocks) {}\n\n async processUnfinalizedBlockHeader(header: Header): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess(header);\n }\n\n async processUnfinalizedBlocks({\n block,\n }: BlockWrapper): Promise<number | null> {\n return this.host.unfinalizedBlocksProcess(blockToHeader(block.sequence));\n }\n\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n init(reindex: (targetHeight: number) => Promise<void>): Promise<number> {\n throw new Error('This method should not be called from a worker');\n }\n resetUnfinalizedBlocks(): void {\n throw new Error('This method should not be called from a worker');\n }\n resetLastFinalizedVerifiedHeight(): void {\n throw new Error('This method should not be called from a worker');\n }\n // eslint-disable-next-line @typescript-eslint/promise-function-async\n getMetadataUnfinalizedBlocks(): Promise<Header[]> {\n throw new Error('This method should not be called from a worker');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"meta.module.js","sourceRoot":"","sources":["../../src/meta/meta.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,gDAAiE;AACjE,mEAA+D;AAC/D,0DAAsD;AACtD,uDAAmD;AACnD,iDAA6C;AAOtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IALtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,oCAAgB,CAAC,QAAQ,EAAE,EAAE,0BAAW,CAAC;QACnD,WAAW,EAAE,CAAC,GAAG,2BAAe,EAAE,gCAAc,CAAC;QACjD,SAAS,EAAE,CAAC,GAAG,wBAAY,EAAE,0BAAW,CAAC;KAC1C,CAAC;GACW,UAAU,CAAG;AAAb,gCAAU","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport { metaControllers, metaServices } from '@subql/node-core';\nimport { PrometheusModule } from '@willsoto/nestjs-prometheus';\nimport { FetchModule } from '../indexer/fetch.module';\nimport { MetaController } from './meta.controller';\nimport { MetaService } from './meta.service';\n\n@Module({\n imports: [PrometheusModule.register(), FetchModule],\n controllers: [...metaControllers, MetaController],\n providers: [...metaServices, MetaService],\n})\nexport class MetaModule {}\n"]}
1
+ {"version":3,"file":"meta.module.js","sourceRoot":"","sources":["../../src/meta/meta.module.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;AAEnC,2CAAwC;AACxC,gDAI0B;AAC1B,mEAA+D;AAC/D,0DAAsD;AACtD,uDAAmD;AACnD,iDAA6C;AAOtC,IAAM,UAAU,GAAhB,MAAM,UAAU;CAAG,CAAA;AAAb,UAAU;IALtB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,oCAAgB,CAAC,QAAQ,EAAE,EAAE,0BAAW,CAAC;QACnD,WAAW,EAAE,CAAC,GAAG,2BAAe,EAAE,gCAAc,CAAC;QACjD,SAAS,EAAE,CAAC,GAAG,wBAAY,EAAE,0BAAW,CAAC;KAC1C,CAAC;GACW,UAAU,CAAG;AAAb,gCAAU","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Module } from '@nestjs/common';\nimport {\n metaControllers,\n metaServices,\n NodeConfig as BaseNodeConfig,\n} from '@subql/node-core';\nimport { PrometheusModule } from '@willsoto/nestjs-prometheus';\nimport { FetchModule } from '../indexer/fetch.module';\nimport { MetaController } from './meta.controller';\nimport { MetaService } from './meta.service';\n\n@Module({\n imports: [PrometheusModule.register(), FetchModule],\n controllers: [...metaControllers, MetaController],\n providers: [...metaServices, MetaService],\n})\nexport class MetaModule {}\n"]}
@@ -16,6 +16,10 @@ export declare class MetaService extends BaseMetaService {
16
16
  name: string;
17
17
  version: string;
18
18
  };
19
+ protected sorobanSdkVersion(): {
20
+ name: string;
21
+ version: string;
22
+ };
19
23
  handleEnqueueBlocks(size: number): void;
20
24
  handleFilteringBlocks(height: number): void;
21
25
  handleFetchBlock(): void;
@@ -17,7 +17,9 @@ const event_emitter_1 = require("@nestjs/event-emitter");
17
17
  const schedule_1 = require("@nestjs/schedule");
18
18
  const node_core_1 = require("@subql/node-core");
19
19
  // eslint-disable-next-line @typescript-eslint/no-var-requires
20
- const { version: stellarSdkVersion } = require('soroban-client/package.json');
20
+ const { version: sorobanSdkVersion } = require('soroban-client/package.json');
21
+ const { version: stellarSdkVersion } = require('stellar-sdk/package.json');
22
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
21
23
  // eslint-disable-next-line @typescript-eslint/no-var-requires
22
24
  const { version: packageVersion } = require('../../package.json');
23
25
  const logger = (0, node_core_1.getLogger)('profiler');
@@ -38,6 +40,9 @@ let MetaService = class MetaService extends node_core_1.BaseMetaService {
38
40
  sdkVersion() {
39
41
  return { name: 'stellarSdkVersion', version: stellarSdkVersion };
40
42
  }
43
+ sorobanSdkVersion() {
44
+ return { name: 'sorobanSdkVersion', version: sorobanSdkVersion };
45
+ }
41
46
  handleEnqueueBlocks(size) {
42
47
  this.accEnqueueBlocks += size;
43
48
  if (!this.lastStatsReportedTs) {
@@ -1 +1 @@
1
- {"version":3,"file":"meta.service.js","sourceRoot":"","sources":["../../src/meta/meta.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAC5C,yDAAgD;AAChD,+CAA4C;AAC5C,gDAK0B;AAE1B,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC9E,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,IAAA,qBAAS,EAAC,UAAU,CAAC,CAAC;AAG9B,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,2BAAe;IAW9C,YACU,UAAsB,EAC9B,iBAAoC;QAEpC,KAAK,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;QAH7B,eAAU,GAAV,UAAU,CAAY;QAXxB,qBAAgB,GAAG,CAAC,CAAC;QACrB,mBAAc,GAAG,CAAC,CAAC;QACnB,6BAAwB,GAAG,CAAC,C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,uBAAO,EAAC,SAAS,CAAC;;;;gDAMlB;AAED;IAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC;;;;sDAwBf;AA/EU,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAaW,sBAAU;QACX,6BAAiB;GAb3B,WAAW,CAgFvB;AAhFY,kCAAW","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport { OnEvent } from '@nestjs/event-emitter';\nimport { Interval } from '@nestjs/schedule';\nimport {\n BaseMetaService,\n getLogger,\n NodeConfig,\n StoreCacheService,\n} from '@subql/node-core';\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: stellarSdkVersion } = require('soroban-client/package.json');\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: packageVersion } = require('../../package.json');\nconst logger = getLogger('profiler');\n\n@Injectable()\nexport class MetaService extends BaseMetaService {\n private accEnqueueBlocks = 0;\n private accFetchBlocks = 0;\n private currentFilteringBlockNum = 0;\n private accRpcCalls = 0;\n private lastReportedFilteringBlockNum = 0;\n private lastReportedEnqueueBlocks = 0;\n private lastReportedFetchBlocks = 0;\n private lastReportedRpcCalls = 0;\n private lastStatsReportedTs: Date;\n\n constructor(\n private nodeConfig: NodeConfig,\n storeCacheService: StoreCacheService,\n ) {\n super(storeCacheService, nodeConfig);\n }\n\n protected packageVersion = packageVersion;\n protected sdkVersion(): { name: string; version: string } {\n return { name: 'stellarSdkVersion', version: stellarSdkVersion };\n }\n\n @OnEvent('enqueueBlocks')\n handleEnqueueBlocks(size: number): void {\n this.accEnqueueBlocks += size;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('filteringBlocks')\n handleFilteringBlocks(height: number): void {\n this.currentFilteringBlockNum = height;\n if (!this.lastStatsReportedTs) {\n this.lastReportedFilteringBlockNum = height;\n }\n }\n\n @OnEvent('fetchBlock')\n handleFetchBlock(): void {\n this.accFetchBlocks++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('rpcCall')\n handleRpcCall(): void {\n this.accRpcCalls++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @Interval(10000)\n blockFilteringSpeed(): void {\n if (!this.nodeConfig.profiler) {\n return;\n }\n const count = this.accEnqueueBlocks - this.lastReportedEnqueueBlocks;\n this.lastReportedEnqueueBlocks = this.accEnqueueBlocks;\n const filteringCount =\n this.currentFilteringBlockNum - this.lastReportedFilteringBlockNum;\n const now = new Date();\n const timepass = now.getTime() - this.lastStatsReportedTs.getTime();\n this.lastStatsReportedTs = now;\n this.lastReportedFilteringBlockNum = this.currentFilteringBlockNum;\n const rpcCalls = this.accRpcCalls - this.lastReportedRpcCalls;\n this.lastReportedRpcCalls = this.accRpcCalls;\n const fetchCount = this.accFetchBlocks - this.lastReportedFetchBlocks;\n this.lastReportedFetchBlocks = this.accFetchBlocks;\n logger.info(`actual block filtering: ${(count / (timepass / 1000)).toFixed(\n 2,\n )}/sec, \\\nseeming speed: ${(filteringCount / (timepass / 1000)).toFixed(\n 2,\n )}/sec, rpcCalls: ${(rpcCalls / (timepass / 1000)).toFixed(2)}/sec \\\nfetch speed: ${(fetchCount / (timepass / 1000)).toFixed(2)}/sec`);\n }\n}\n"]}
1
+ {"version":3,"file":"meta.service.js","sourceRoot":"","sources":["../../src/meta/meta.service.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;;;;;;;AAEnC,2CAA4C;AAC5C,yDAAgD;AAChD,+CAA4C;AAC5C,gDAK0B;AAE1B,8DAA8D;AAC9D,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAC9E,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;AAC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,CAAC,CAAC,OAAO,CACxE,CAAC,CACF;iBACY,CAAC,cAAc,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CACvD,CAAC,CACF,mBAAmB,CAAC,QAAQ,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;eAClD,CAAC,UAAU,GAAG,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;CACF,CAAA;AAzDC;IAAC,IAAA,uBAAO,EAAC,eAAe,CAAC;;;;sDAMxB;AAED;IAAC,IAAA,uBAAO,EAAC,iBAAiB,CAAC;;;;wDAM1B;AAED;IAAC,IAAA,uBAAO,EAAC,YAAY,CAAC;;;;mDAMrB;AAED;IAAC,IAAA,uBAAO,EAAC,SAAS,CAAC;;;;gDAMlB;AAED;IAAC,IAAA,mBAAQ,EAAC,KAAK,CAAC;;;;sDAwBf;AAlFU,WAAW;IADvB,IAAA,mBAAU,GAAE;qCAaW,sBAAU;QACX,6BAAiB;GAb3B,WAAW,CAmFvB;AAnFY,kCAAW","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { Injectable } from '@nestjs/common';\nimport { OnEvent } from '@nestjs/event-emitter';\nimport { Interval } from '@nestjs/schedule';\nimport {\n BaseMetaService,\n getLogger,\n NodeConfig,\n StoreCacheService,\n} from '@subql/node-core';\n\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: sorobanSdkVersion } = require('soroban-client/package.json');\nconst { version: stellarSdkVersion } = require('stellar-sdk/package.json');\n// eslint-disable-next-line @typescript-eslint/no-var-requires\n// eslint-disable-next-line @typescript-eslint/no-var-requires\nconst { version: packageVersion } = require('../../package.json');\nconst logger = getLogger('profiler');\n\n@Injectable()\nexport class MetaService extends BaseMetaService {\n private accEnqueueBlocks = 0;\n private accFetchBlocks = 0;\n private currentFilteringBlockNum = 0;\n private accRpcCalls = 0;\n private lastReportedFilteringBlockNum = 0;\n private lastReportedEnqueueBlocks = 0;\n private lastReportedFetchBlocks = 0;\n private lastReportedRpcCalls = 0;\n private lastStatsReportedTs: Date;\n\n constructor(\n private nodeConfig: NodeConfig,\n storeCacheService: StoreCacheService,\n ) {\n super(storeCacheService, nodeConfig);\n }\n\n protected packageVersion = packageVersion;\n protected sdkVersion(): { name: string; version: string } {\n return { name: 'stellarSdkVersion', version: stellarSdkVersion };\n }\n protected sorobanSdkVersion(): { name: string; version: string } {\n return { name: 'sorobanSdkVersion', version: sorobanSdkVersion };\n }\n\n @OnEvent('enqueueBlocks')\n handleEnqueueBlocks(size: number): void {\n this.accEnqueueBlocks += size;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('filteringBlocks')\n handleFilteringBlocks(height: number): void {\n this.currentFilteringBlockNum = height;\n if (!this.lastStatsReportedTs) {\n this.lastReportedFilteringBlockNum = height;\n }\n }\n\n @OnEvent('fetchBlock')\n handleFetchBlock(): void {\n this.accFetchBlocks++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @OnEvent('rpcCall')\n handleRpcCall(): void {\n this.accRpcCalls++;\n if (!this.lastStatsReportedTs) {\n this.lastStatsReportedTs = new Date();\n }\n }\n\n @Interval(10000)\n blockFilteringSpeed(): void {\n if (!this.nodeConfig.profiler) {\n return;\n }\n const count = this.accEnqueueBlocks - this.lastReportedEnqueueBlocks;\n this.lastReportedEnqueueBlocks = this.accEnqueueBlocks;\n const filteringCount =\n this.currentFilteringBlockNum - this.lastReportedFilteringBlockNum;\n const now = new Date();\n const timepass = now.getTime() - this.lastStatsReportedTs.getTime();\n this.lastStatsReportedTs = now;\n this.lastReportedFilteringBlockNum = this.currentFilteringBlockNum;\n const rpcCalls = this.accRpcCalls - this.lastReportedRpcCalls;\n this.lastReportedRpcCalls = this.accRpcCalls;\n const fetchCount = this.accFetchBlocks - this.lastReportedFetchBlocks;\n this.lastReportedFetchBlocks = this.accFetchBlocks;\n logger.info(`actual block filtering: ${(count / (timepass / 1000)).toFixed(\n 2,\n )}/sec, \\\nseeming speed: ${(filteringCount / (timepass / 1000)).toFixed(\n 2,\n )}/sec, rpcCalls: ${(rpcCalls / (timepass / 1000)).toFixed(2)}/sec \\\nfetch speed: ${(fetchCount / (timepass / 1000)).toFixed(2)}/sec`);\n }\n}\n"]}
@@ -3,13 +3,14 @@ import { ApiConnectionError, IApiConnectionSpecific, NetworkMetadataPayload } fr
3
3
  import { StellarBlockWrapper } from '@subql/types-stellar';
4
4
  import { StellarApi } from './api.stellar';
5
5
  import SafeStellarProvider from './safe-api';
6
+ import { SorobanServer } from './soroban.server';
6
7
  type FetchFunc = (api: StellarApi, batch: number[]) => Promise<StellarBlockWrapper[]>;
7
8
  export declare class StellarApiConnection implements IApiConnectionSpecific<StellarApi, SafeStellarProvider, StellarBlockWrapper> {
8
9
  unsafeApi: StellarApi;
9
10
  private fetchBlocksBatches;
10
11
  readonly networkMeta: NetworkMetadataPayload;
11
12
  constructor(unsafeApi: StellarApi, fetchBlocksBatches: FetchFunc);
12
- static create(endpoint: string, fetchBlockBatches: FetchFunc, eventEmitter: EventEmitter2): Promise<StellarApiConnection>;
13
+ static create(endpoint: string, fetchBlockBatches: FetchFunc, eventEmitter: EventEmitter2, soroban?: SorobanServer): Promise<StellarApiConnection>;
13
14
  safeApi(height: number): SafeStellarProvider;
14
15
  apiConnect(): Promise<void>;
15
16
  apiDisconnect(): Promise<void>;
@@ -20,13 +20,14 @@ class StellarApiConnection {
20
20
  genesisHash: unsafeApi.getGenesisHash(),
21
21
  };
22
22
  }
23
- static async create(endpoint, fetchBlockBatches, eventEmitter) {
24
- const api = new api_stellar_1.StellarApi(endpoint, eventEmitter);
23
+ static async create(endpoint, fetchBlockBatches, eventEmitter, soroban) {
24
+ const api = new api_stellar_1.StellarApi(endpoint, eventEmitter, soroban);
25
25
  await api.init();
26
26
  return new StellarApiConnection(api, fetchBlockBatches);
27
27
  }
28
28
  safeApi(height) {
29
- return new safe_api_1.default(this.unsafeApi.api, height);
29
+ //safe api not implemented
30
+ return new safe_api_1.default(null, height);
30
31
  }
31
32
  async apiConnect() {
32
33
  await this.unsafeApi.connect();
@@ -1 +1 @@
1
- {"version":3,"file":"api.connection.js","sourceRoot":"","sources":["../../src/stellar/api.connection.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;AAGnC,gDAS0B;AAE1B,+CAA2C;AAC3C,0DAA6C;AAO7C,MAAa,oBAAoB;IAU/B,YACS,SAAqB,EACpB,kBAA6B;QAD9B,cAAS,GAAT,SAAS,CAAY;QACpB,uBAAkB,GAAlB,kBAAkB,CAAW;QAsCvC,gBAAW,GAAG,oBAAoB,CAAC,WAAW,CAAC;QApC7C,IAAI,CAAC,WAAW,GAAG;YACjB,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE;YAC7B,QAAQ,EAAE,SAAS,CAAC,WAAW,EAAE;YACjC,WAAW,EAAE,SAAS,CAAC,cAAc,EAAE;SACxC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,QAAgB,EAChB,iBAA4B,EAC5B,YAA2B;QAE3B,MAAM,GAAG,GAAG,IAAI,wBAAU,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEnD,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAEjB,OAAO,IAAI,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,CAAC,MAAc;QACpB,OAAO,IAAI,kBAAmB,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC7D,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAiB;QACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IAChB,CAAC;IAID,MAAM,CAAC,WAAW,CAAC,CAAQ;QACzB,IAAI,eAAmC,CAAC;QACxC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YACjC,eAAe,GAAG,IAAI,wBAAY,CAAC,CAAC,CAAC,CAAC;SACvC;aAAM,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE;YACrD,eAAe,GAAG,IAAI,8BAAkB,CAAC,CAAC,CAAC,CAAC;SAC7C;aAAM,IACL,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC;YACzC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EACvC;YACA,eAAe,GAAG,IAAI,0BAAc,CAAC,CAAC,CAAC,CAAC;SACzC;aAAM,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE;YACtD,eAAe,GAAG,IAAI,8BAAkB,CAAC,CAAC,CAAC,CAAC;SAC7C;aAAM;YACL,eAAe,GAAG,IAAI,8BAAkB,CACtC,CAAC,CAAC,IAAI,EACN,CAAC,CAAC,OAAO,EACT,wBAAY,CAAC,OAAO,CACrB,CAAC;SACH;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AA1ED,oDA0EC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n ApiConnectionError,\n ApiErrorType,\n IApiConnectionSpecific,\n NetworkMetadataPayload,\n TimeoutError,\n RateLimitError,\n DisconnectionError,\n LargeResponseError,\n} from '@subql/node-core';\nimport { StellarBlockWrapper } from '@subql/types-stellar';\nimport { StellarApi } from './api.stellar';\nimport SafeStellarProvider from './safe-api';\n\ntype FetchFunc = (\n api: StellarApi,\n batch: number[],\n) => Promise<StellarBlockWrapper[]>;\n\nexport class StellarApiConnection\n implements\n IApiConnectionSpecific<\n StellarApi,\n SafeStellarProvider,\n StellarBlockWrapper\n >\n{\n readonly networkMeta: NetworkMetadataPayload;\n\n constructor(\n public unsafeApi: StellarApi,\n private fetchBlocksBatches: FetchFunc,\n ) {\n this.networkMeta = {\n chain: unsafeApi.getChainId(),\n specName: unsafeApi.getSpecName(),\n genesisHash: unsafeApi.getGenesisHash(),\n };\n }\n\n static async create(\n endpoint: string,\n fetchBlockBatches: FetchFunc,\n eventEmitter: EventEmitter2,\n ): Promise<StellarApiConnection> {\n const api = new StellarApi(endpoint, eventEmitter);\n\n await api.init();\n\n return new StellarApiConnection(api, fetchBlockBatches);\n }\n\n safeApi(height: number): SafeStellarProvider {\n return new SafeStellarProvider(this.unsafeApi.api, height);\n }\n\n async apiConnect(): Promise<void> {\n await this.unsafeApi.connect();\n }\n\n async apiDisconnect(): Promise<void> {\n await this.unsafeApi.disconnect();\n }\n\n async fetchBlocks(heights: number[]): Promise<StellarBlockWrapper[]> {\n const blocks = await this.fetchBlocksBatches(this.unsafeApi, heights);\n return blocks;\n }\n\n handleError = StellarApiConnection.handleError;\n\n static handleError(e: Error): ApiConnectionError {\n let formatted_error: ApiConnectionError;\n if (e.message.includes(`Timeout`)) {\n formatted_error = new TimeoutError(e);\n } else if (e.message.startsWith(`disconnected from `)) {\n formatted_error = new DisconnectionError(e);\n } else if (\n e.message.includes(`Rate Limit Exceeded`) ||\n e.message.includes('Too Many Requests')\n ) {\n formatted_error = new RateLimitError(e);\n } else if (e.message.includes(`limit must not exceed`)) {\n formatted_error = new LargeResponseError(e);\n } else {\n formatted_error = new ApiConnectionError(\n e.name,\n e.message,\n ApiErrorType.Default,\n );\n }\n return formatted_error;\n }\n}\n"]}
1
+ {"version":3,"file":"api.connection.js","sourceRoot":"","sources":["../../src/stellar/api.connection.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;;AAGnC,gDAS0B;AAE1B,+CAA2C;AAC3C,0DAA6C;AAQ7C,MAAa,oBAAoB;IAU/B,YACS,SAAqB,EACpB,kBAA6B;QAD9B,cAAS,GAAT,SAAS,CAAY;QACpB,uBAAkB,GAAlB,kBAAkB,CAAW;QAwCvC,gBAAW,GAAG,oBAAoB,CAAC,WAAW,CAAC;QAtC7C,IAAI,CAAC,WAAW,GAAG;YACjB,KAAK,EAAE,SAAS,CAAC,UAAU,EAAE;YAC7B,QAAQ,EAAE,SAAS,CAAC,WAAW,EAAE;YACjC,WAAW,EAAE,SAAS,CAAC,cAAc,EAAE;SACxC,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,QAAgB,EAChB,iBAA4B,EAC5B,YAA2B,EAC3B,OAAuB;QAEvB,MAAM,GAAG,GAAG,IAAI,wBAAU,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QAE5D,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAEjB,OAAO,IAAI,oBAAoB,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC;IAC1D,CAAC;IAED,OAAO,CAAC,MAAc;QACpB,0BAA0B;QAC1B,OAAO,IAAI,kBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,UAAU;QACd,MAAM,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,MAAM,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAAiB;QACjC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACtE,OAAO,MAAM,CAAC;IAChB,CAAC;IAID,MAAM,CAAC,WAAW,CAAC,CAAQ;QACzB,IAAI,eAAmC,CAAC;QACxC,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;YACjC,eAAe,GAAG,IAAI,wBAAY,CAAC,CAAC,CAAC,CAAC;SACvC;aAAM,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE;YACrD,eAAe,GAAG,IAAI,8BAAkB,CAAC,CAAC,CAAC,CAAC;SAC7C;aAAM,IACL,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC;YACzC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EACvC;YACA,eAAe,GAAG,IAAI,0BAAc,CAAC,CAAC,CAAC,CAAC;SACzC;aAAM,IAAI,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE;YACtD,eAAe,GAAG,IAAI,8BAAkB,CAAC,CAAC,CAAC,CAAC;SAC7C;aAAM;YACL,eAAe,GAAG,IAAI,8BAAkB,CACtC,CAAC,CAAC,IAAI,EACN,CAAC,CAAC,OAAO,EACT,wBAAY,CAAC,OAAO,CACrB,CAAC;SACH;QACD,OAAO,eAAe,CAAC;IACzB,CAAC;CACF;AA5ED,oDA4EC","sourcesContent":["// Copyright 2020-2023 SubQuery Pte Ltd authors & contributors\n// SPDX-License-Identifier: GPL-3.0\n\nimport { EventEmitter2 } from '@nestjs/event-emitter';\nimport {\n ApiConnectionError,\n ApiErrorType,\n IApiConnectionSpecific,\n NetworkMetadataPayload,\n TimeoutError,\n RateLimitError,\n DisconnectionError,\n LargeResponseError,\n} from '@subql/node-core';\nimport { StellarBlockWrapper } from '@subql/types-stellar';\nimport { StellarApi } from './api.stellar';\nimport SafeStellarProvider from './safe-api';\nimport { SorobanServer } from './soroban.server';\n\ntype FetchFunc = (\n api: StellarApi,\n batch: number[],\n) => Promise<StellarBlockWrapper[]>;\n\nexport class StellarApiConnection\n implements\n IApiConnectionSpecific<\n StellarApi,\n SafeStellarProvider,\n StellarBlockWrapper\n >\n{\n readonly networkMeta: NetworkMetadataPayload;\n\n constructor(\n public unsafeApi: StellarApi,\n private fetchBlocksBatches: FetchFunc,\n ) {\n this.networkMeta = {\n chain: unsafeApi.getChainId(),\n specName: unsafeApi.getSpecName(),\n genesisHash: unsafeApi.getGenesisHash(),\n };\n }\n\n static async create(\n endpoint: string,\n fetchBlockBatches: FetchFunc,\n eventEmitter: EventEmitter2,\n soroban?: SorobanServer,\n ): Promise<StellarApiConnection> {\n const api = new StellarApi(endpoint, eventEmitter, soroban);\n\n await api.init();\n\n return new StellarApiConnection(api, fetchBlockBatches);\n }\n\n safeApi(height: number): SafeStellarProvider {\n //safe api not implemented\n return new SafeStellarProvider(null, height);\n }\n\n async apiConnect(): Promise<void> {\n await this.unsafeApi.connect();\n }\n\n async apiDisconnect(): Promise<void> {\n await this.unsafeApi.disconnect();\n }\n\n async fetchBlocks(heights: number[]): Promise<StellarBlockWrapper[]> {\n const blocks = await this.fetchBlocksBatches(this.unsafeApi, heights);\n return blocks;\n }\n\n handleError = StellarApiConnection.handleError;\n\n static handleError(e: Error): ApiConnectionError {\n let formatted_error: ApiConnectionError;\n if (e.message.includes(`Timeout`)) {\n formatted_error = new TimeoutError(e);\n } else if (e.message.startsWith(`disconnected from `)) {\n formatted_error = new DisconnectionError(e);\n } else if (\n e.message.includes(`Rate Limit Exceeded`) ||\n e.message.includes('Too Many Requests')\n ) {\n formatted_error = new RateLimitError(e);\n } else if (e.message.includes(`limit must not exceed`)) {\n formatted_error = new LargeResponseError(e);\n } else {\n formatted_error = new ApiConnectionError(\n e.name,\n e.message,\n ApiErrorType.Default,\n );\n }\n return formatted_error;\n }\n}\n"]}
@@ -9,70 +9,66 @@ const node_core_1 = require("@subql/node-core");
9
9
  const eventemitter2_1 = __importDefault(require("eventemitter2"));
10
10
  const api_connection_1 = require("./api.connection");
11
11
  const api_stellar_1 = require("./api.stellar");
12
- const safe_api_1 = __importDefault(require("./safe-api"));
13
- const HTTP_ENDPOINT = 'https://rpc-futurenet.stellar.org:443';
12
+ const soroban_server_1 = require("./soroban.server");
13
+ const HTTP_ENDPOINT = 'https://horizon-futurenet.stellar.org';
14
+ const SOROBAN_ENDPOINT = 'https://rpc-futurenet.stellar.org';
14
15
  describe('StellarApiConnection', () => {
15
16
  let apiConnection;
16
17
  let unsafeApi;
18
+ let sorobanApi;
17
19
  const mockBlocks = [
18
20
  {
19
- ledger: 1,
20
- hash: 'hash1',
21
- events: [],
21
+ block: { sequence: 1, hash: 'hash1' },
22
+ transactions: [],
23
+ operations: [],
24
+ effects: [],
22
25
  },
23
26
  {
24
- ledger: 2,
25
- hash: 'hash2',
26
- events: [],
27
+ block: { sequence: 2, hash: 'hash2' },
28
+ transactions: [],
29
+ operations: [],
30
+ effects: [],
27
31
  },
28
32
  ];
29
- const mockBlockWrappers = mockBlocks.map((_block) => {
30
- return { block: _block, events: [] };
31
- });
32
- const fetchBlockBatches = jest.fn().mockResolvedValue(mockBlockWrappers);
33
+ const fetchBlockBatches = jest.fn().mockResolvedValue(mockBlocks);
33
34
  beforeEach(async () => {
34
- unsafeApi = new api_stellar_1.StellarApi(HTTP_ENDPOINT, new eventemitter2_1.default());
35
+ sorobanApi = new soroban_server_1.SorobanServer(SOROBAN_ENDPOINT);
36
+ unsafeApi = new api_stellar_1.StellarApi(HTTP_ENDPOINT, new eventemitter2_1.default(), sorobanApi);
35
37
  await unsafeApi.init();
36
38
  apiConnection = new api_connection_1.StellarApiConnection(unsafeApi, fetchBlockBatches);
37
39
  });
38
- it('calling apiConnect throws error', async () => {
39
- await expect(apiConnection.apiConnect()).rejects.toThrow();
40
- });
41
- it('calling apiDisconnect throws error', async () => {
42
- await expect(apiConnection.apiDisconnect()).rejects.toThrow();
40
+ it('creates a connection', async () => {
41
+ expect(await api_connection_1.StellarApiConnection.create(HTTP_ENDPOINT, fetchBlockBatches, new eventemitter2_1.default(), sorobanApi)).toBeInstanceOf(api_connection_1.StellarApiConnection);
43
42
  });
44
- it('should fetch blocks', async () => {
43
+ it('fetches blocks', async () => {
45
44
  const result = await apiConnection.fetchBlocks([1, 2]);
46
- expect(result).toEqual(mockBlockWrappers);
47
- expect(fetchBlockBatches).toHaveBeenCalledWith(apiConnection.unsafeApi, [1, 2]);
48
- });
49
- it('should safely provide API at a given height', () => {
50
- const height = 10;
51
- const safeApi = apiConnection.safeApi(height);
52
- expect(safeApi).toBeInstanceOf(safe_api_1.default);
45
+ expect(result).toEqual(mockBlocks);
46
+ expect(fetchBlockBatches).toHaveBeenCalledWith(unsafeApi, [1, 2]);
53
47
  });
54
48
  describe('Error handling', () => {
55
- it('should handle timeout errors', () => {
49
+ it('handles timeout errors', () => {
56
50
  const error = new Error('Timeout');
57
51
  const handledError = api_connection_1.StellarApiConnection.handleError(error);
58
- expect(handledError).toBeInstanceOf(node_core_1.ApiConnectionError);
59
- expect(handledError.errorType).toEqual(node_core_1.ApiErrorType.Timeout);
52
+ expect(handledError).toBeInstanceOf(node_core_1.TimeoutError);
60
53
  });
61
- it('should handle disconnection errors', () => {
54
+ it('handles disconnection errors', () => {
62
55
  const error = new Error('disconnected from ');
63
56
  const handledError = api_connection_1.StellarApiConnection.handleError(error);
64
- expect(handledError).toBeInstanceOf(node_core_1.ApiConnectionError);
65
- expect(handledError.errorType).toEqual(node_core_1.ApiErrorType.Connection);
57
+ expect(handledError).toBeInstanceOf(node_core_1.DisconnectionError);
66
58
  });
67
- it('should handle rate limit errors', () => {
59
+ it('handles rate limit errors', () => {
68
60
  const error = new Error('Rate Limit Exceeded');
69
61
  const handledError = api_connection_1.StellarApiConnection.handleError(error);
70
- expect(handledError).toBeInstanceOf(node_core_1.ApiConnectionError);
71
- expect(handledError.errorType).toEqual(node_core_1.ApiErrorType.RateLimit);
62
+ expect(handledError).toBeInstanceOf(node_core_1.RateLimitError);
72
63
  });
73
- it('should handle large response errors', () => {
64
+ it('handles large response errors', () => {
74
65
  const error = new Error('limit must not exceed');
75
66
  const handledError = api_connection_1.StellarApiConnection.handleError(error);
67
+ expect(handledError).toBeInstanceOf(node_core_1.LargeResponseError);
68
+ });
69
+ it('handles default errors', () => {
70
+ const error = new Error('default error');
71
+ const handledError = api_connection_1.StellarApiConnection.handleError(error);
76
72
  expect(handledError).toBeInstanceOf(node_core_1.ApiConnectionError);
77
73
  expect(handledError.errorType).toEqual(node_core_1.ApiErrorType.Default);
78
74
  });
@@ -1 +1 @@
1
- {"version":3,"file":"api.connection.spec.js","sourceRoot":"","sources":["../../src/stellar/api.connection.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;AAEnC,gDAAoE;AAEpE,kEAA0C;AAC1C,qDAAwD;AACxD,+CAA2C;AAC3C,0DAA6C;AAE7C,MAAM,aAAa,GAAG,uCAAuC,CAAC;AAE9D,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,aAAmC,CAAC;IACxC,IAAI,SAAqB,CAAC;IAC1B,MAAM,UAAU,GAAmB;QACjC;YACE,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,EAAE;SACX;QACD;YACE,MAAM,EAAE,CAAC;YACT,IAAI,EAAE,OAAO;YACb,MAAM,EAAE,EAAE;SACX;KACF,CAAC;IAEF,MAAM,iBAAiB,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAClD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAyB,CAAC;IAC9D,CAAC,CAAC,CAAC;IAEH,MAAM,iBAAiB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAEzE,UAAU,CA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KAAK,CAAC,CAAC;YAC7D,MAAM,CAAC,YAAY,CAAC,CAAC,cAAc,CAAC,8BAAkB,CAAC,CAAC;YACxD,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,wBAAY,CAAC,OAAO,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,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 { ApiConnectionError, ApiErrorType } from '@subql/node-core';\nimport { StellarBlock, StellarBlockWrapper } from '@subql/types-stellar';\nimport EventEmitter2 from 'eventemitter2';\nimport { StellarApiConnection } from './api.connection';\nimport { StellarApi } from './api.stellar';\nimport SafeStellarProvider from './safe-api';\n\nconst HTTP_ENDPOINT = 'https://rpc-futurenet.stellar.org:443';\n\ndescribe('StellarApiConnection', () => {\n let apiConnection: StellarApiConnection;\n let unsafeApi: StellarApi;\n const mockBlocks: StellarBlock[] = [\n {\n ledger: 1,\n hash: 'hash1',\n events: [],\n },\n {\n ledger: 2,\n hash: 'hash2',\n events: [],\n },\n ];\n\n const mockBlockWrappers = mockBlocks.map((_block) => {\n return { block: _block, events: [] } as StellarBlockWrapper;\n });\n\n const fetchBlockBatches = jest.fn().mockResolvedValue(mockBlockWrappers);\n\n beforeEach(async () => {\n unsafeApi = new StellarApi(HTTP_ENDPOINT, new EventEmitter2());\n await unsafeApi.init();\n apiConnection = new StellarApiConnection(unsafeApi, fetchBlockBatches);\n });\n\n it('calling apiConnect throws error', async () => {\n await expect(apiConnection.apiConnect()).rejects.toThrow();\n });\n\n it('calling apiDisconnect throws error', async () => {\n await expect(apiConnection.apiDisconnect()).rejects.toThrow();\n });\n\n it('should fetch blocks', async () => {\n const result = await apiConnection.fetchBlocks([1, 2]);\n expect(result).toEqual(mockBlockWrappers);\n expect(fetchBlockBatches).toHaveBeenCalledWith(\n apiConnection.unsafeApi,\n [1, 2],\n );\n });\n\n it('should safely provide API at a given height', () => {\n const height = 10;\n const safeApi = apiConnection.safeApi(height);\n expect(safeApi).toBeInstanceOf(SafeStellarProvider);\n });\n\n describe('Error handling', () => {\n it('should handle timeout errors', () => {\n const error = new Error('Timeout');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(ApiConnectionError);\n expect(handledError.errorType).toEqual(ApiErrorType.Timeout);\n });\n\n it('should handle disconnection errors', () => {\n const error = new Error('disconnected from ');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(ApiConnectionError);\n expect(handledError.errorType).toEqual(ApiErrorType.Connection);\n });\n\n it('should handle rate limit errors', () => {\n const error = new Error('Rate Limit Exceeded');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(ApiConnectionError);\n expect(handledError.errorType).toEqual(ApiErrorType.RateLimit);\n });\n\n it('should handle large response errors', () => {\n const error = new Error('limit must not exceed');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(ApiConnectionError);\n expect(handledError.errorType).toEqual(ApiErrorType.Default);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"api.connection.spec.js","sourceRoot":"","sources":["../../src/stellar/api.connection.spec.ts"],"names":[],"mappings":";AAAA,8DAA8D;AAC9D,mCAAmC;;;;;AAEnC,gDAO0B;AAE1B,kEAA0C;AAC1C,qDAAwD;AACxD,+CAA2C;AAE3C,qDAAiD;AAEjD,MAAM,aAAa,GAAG,uCAAuC,CAAC;AAC9D,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;AAE7D,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,IAAI,aAAmC,CAAC;IACxC,IAAI,SAAqB,CAAC;IAC1B,IAAI,UAAyB,CAAC;IAC9B,MAAM,UAAU,GAA0B;QACxC;YACE,KAAK,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAA6B;YAChE,YAAY,EAA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,GAAG,qCAAoB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YAC7D,MAAM,CAAC,YAAY,CAAC,CAAC,cAAc,CAAC,8BAAkB,CAAC,CAAC;YACxD,MAAM,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,wBAAY,CAAC,OAAO,CAAC,CAAC;QAC/D,CAAC,CAAC,CAAC;IACL,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 {\n ApiConnectionError,\n ApiErrorType,\n DisconnectionError,\n LargeResponseError,\n RateLimitError,\n TimeoutError,\n} from '@subql/node-core';\nimport { StellarBlock, StellarBlockWrapper } from '@subql/types-stellar';\nimport EventEmitter2 from 'eventemitter2';\nimport { StellarApiConnection } from './api.connection';\nimport { StellarApi } from './api.stellar';\nimport SafeStellarProvider from './safe-api';\nimport { SorobanServer } from './soroban.server';\n\nconst HTTP_ENDPOINT = 'https://horizon-futurenet.stellar.org';\nconst SOROBAN_ENDPOINT = 'https://rpc-futurenet.stellar.org';\n\ndescribe('StellarApiConnection', () => {\n let apiConnection: StellarApiConnection;\n let unsafeApi: StellarApi;\n let sorobanApi: SorobanServer;\n const mockBlocks: StellarBlockWrapper[] = [\n {\n block: { sequence: 1, hash: 'hash1' } as unknown as StellarBlock,\n transactions: [],\n operations: [],\n effects: [],\n },\n {\n block: { sequence: 2, hash: 'hash2' } as unknown as StellarBlock,\n transactions: [],\n operations: [],\n effects: [],\n },\n ];\n\n const fetchBlockBatches = jest.fn().mockResolvedValue(mockBlocks);\n\n beforeEach(async () => {\n sorobanApi = new SorobanServer(SOROBAN_ENDPOINT);\n unsafeApi = new StellarApi(HTTP_ENDPOINT, new EventEmitter2(), sorobanApi);\n await unsafeApi.init();\n apiConnection = new StellarApiConnection(unsafeApi, fetchBlockBatches);\n });\n\n it('creates a connection', async () => {\n expect(\n await StellarApiConnection.create(\n HTTP_ENDPOINT,\n fetchBlockBatches,\n new EventEmitter2(),\n sorobanApi,\n ),\n ).toBeInstanceOf(StellarApiConnection);\n });\n\n it('fetches blocks', async () => {\n const result = await apiConnection.fetchBlocks([1, 2]);\n expect(result).toEqual(mockBlocks);\n expect(fetchBlockBatches).toHaveBeenCalledWith(unsafeApi, [1, 2]);\n });\n\n describe('Error handling', () => {\n it('handles timeout errors', () => {\n const error = new Error('Timeout');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(TimeoutError);\n });\n\n it('handles disconnection errors', () => {\n const error = new Error('disconnected from ');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(DisconnectionError);\n });\n\n it('handles rate limit errors', () => {\n const error = new Error('Rate Limit Exceeded');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(RateLimitError);\n });\n\n it('handles large response errors', () => {\n const error = new Error('limit must not exceed');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(LargeResponseError);\n });\n\n it('handles default errors', () => {\n const error = new Error('default error');\n const handledError = StellarApiConnection.handleError(error);\n expect(handledError).toBeInstanceOf(ApiConnectionError);\n expect(handledError.errorType).toEqual(ApiErrorType.Default);\n });\n });\n});\n"]}
@@ -27,6 +27,7 @@ const event_emitter_1 = require("@nestjs/event-emitter");
27
27
  const node_core_1 = require("@subql/node-core");
28
28
  const SubqueryProject_1 = require("../configure/SubqueryProject");
29
29
  const api_connection_1 = require("./api.connection");
30
+ const soroban_server_1 = require("./soroban.server");
30
31
  const logger = (0, node_core_1.getLogger)('api');
31
32
  const MAX_RECONNECT_ATTEMPTS = 5;
32
33
  let StellarApiService = class StellarApiService extends node_core_1.ApiService {
@@ -46,6 +47,9 @@ let StellarApiService = class StellarApiService extends node_core_1.ApiService {
46
47
  logger.error(Object.keys(e));
47
48
  process.exit(1);
48
49
  }
50
+ const sorobanClient = network.soroban
51
+ ? new soroban_server_1.SorobanServer(network.soroban)
52
+ : undefined;
49
53
  const endpoints = Array.isArray(network.endpoint)
50
54
  ? network.endpoint
51
55
  : [network.endpoint];
@@ -56,7 +60,7 @@ let StellarApiService = class StellarApiService extends node_core_1.ApiService {
56
60
  _d = false;
57
61
  try {
58
62
  const [i, endpoint] = _c;
59
- const connection = await api_connection_1.StellarApiConnection.create(endpoint, this.fetchBlockBatches, this.eventEmitter);
63
+ const connection = await api_connection_1.StellarApiConnection.create(endpoint, this.fetchBlockBatches, this.eventEmitter, sorobanClient);
60
64
  const api = connection.unsafeApi;
61
65
  this.eventEmitter.emit(node_core_1.IndexerEvent.ApiConnected, {
62
66
  value: 1,