diff --git a/README.md b/README.md index bfb2b3e..5fe0afd 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,9 @@ This package encapsulates the core mechanism, however, complete functionality re ## Dependencies -- [@alien-worlds/api-core](https://github.com/Alien-Worlds/api-core) -- [@alien-worlds/block-reader](https://github.com/Alien-Worlds/block-reader) -- [@alien-worlds/broadcast](https://github.com/Alien-Worlds/broadcast) -- [@alien-worlds/workers](https://github.com/Alien-Worlds/workers) +- [@alien-worlds/aw-core](https://github.com/Alien-Worlds/api-core) +- [@alien-worlds/aw-broadcast](https://github.com/Alien-Worlds/broadcast) +- [@alien-worlds/aw-workers](https://github.com/Alien-Worlds/workers) - [async](https://github.com/caolan/async) - [commander](https://github.com/tj/commander.js) @@ -42,7 +41,7 @@ This package encapsulates the core mechanism, however, complete functionality re To add History Tools to your project, use the following command with your favorite package manager: ```bash -yarn add @alien-worlds/api-history-tools +yarn add @alien-worlds/aw-history ``` @@ -56,7 +55,7 @@ The API process, currently under development, is intended to provide easy access ### Broadcasting -The broadcasting process creates a server for communication between processes, leveraging the @alien-worlds/broadcast module. Processes inform each other about their state, enabling efficient work coordination. The server facilitates the dispatch of messages defining tasks and states, improving performance when processing a high volume of blockchain data. +The broadcasting process creates a server for communication between processes, leveraging the @alien-worlds/aw-broadcast module. Processes inform each other about their state, enabling efficient work coordination. The server facilitates the dispatch of messages defining tasks and states, improving performance when processing a high volume of blockchain data. ### Bootstrap @@ -194,7 +193,7 @@ The Config tools are used for generating configuration objects based on values s ## Tutorials -For tutorials on creating and using the history tools for your specific needs, see the tutorials in the [History Tools Starter Kit](https://github.com/Alien-Worlds/history-tools-starter-kit) repository. If you want to create history tools with `mongodb` and `eosjs` tools, you should go to the mentioned repository. +For tutorials on creating and using the history tools for your specific needs, see the tutorials in the [History Tools Starter Kit](https://github.com/Alien-Worlds/aw-history-starter-kit) repository. If you want to create history tools with `mongodb` and `eosjs` tools, you should go to the mentioned repository. If you want to extend the capabilities of the history tools or take advantage of other third-party resources, please refer to the following tutorial. diff --git a/package.json b/package.json index ec585e5..902d3a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@alien-worlds/api-history-tools", - "version": "0.0.154", + "name": "@alien-worlds/aw-history", + "version": "0.0.0", "description": "", "packageManager": "yarn@3.2.3", "main": "build/index.js", @@ -34,10 +34,9 @@ "typescript": "^4.8.2" }, "dependencies": { - "@alien-worlds/api-core": "^0.0.158", - "@alien-worlds/block-reader": "^0.0.18", - "@alien-worlds/broadcast": "^0.0.13", - "@alien-worlds/workers": "^0.0.7", + "@alien-worlds/aw-broadcast": "^0.0.2", + "@alien-worlds/aw-core": "^0.0.2", + "@alien-worlds/aw-workers": "^0.0.2", "async": "^3.2.4", "commander": "^10.0.1", "crypto": "^1.0.1", diff --git a/src/api/api.dependencies.ts b/src/api/api.dependencies.ts index db32b7d..0f646f7 100644 --- a/src/api/api.dependencies.ts +++ b/src/api/api.dependencies.ts @@ -1,4 +1,4 @@ -import { Container, Result, Route, UnknownObject } from '@alien-worlds/api-core'; +import { Container, Result, Route, UnknownObject } from '@alien-worlds/aw-core'; import { DatabaseConfigBuilder, Dependencies } from '../common'; import { Api } from './api'; import { ApiConfig } from './api.types'; diff --git a/src/api/api.types.ts b/src/api/api.types.ts index 9edfd9b..c3829d0 100644 --- a/src/api/api.types.ts +++ b/src/api/api.types.ts @@ -1,4 +1,4 @@ -import { UnknownObject } from '@alien-worlds/api-core'; +import { UnknownObject } from '@alien-worlds/aw-core'; export type ApiCommandOptions = { port: number; diff --git a/src/api/endpoints/actions/domain/list-actions.controller.ts b/src/api/endpoints/actions/domain/list-actions.controller.ts index 77517ad..310af89 100644 --- a/src/api/endpoints/actions/domain/list-actions.controller.ts +++ b/src/api/endpoints/actions/domain/list-actions.controller.ts @@ -1,4 +1,4 @@ -import { inject, injectable, Result } from '@alien-worlds/api-core'; +import { inject, injectable, Result } from '@alien-worlds/aw-core'; import { ListActionsInput } from './models/list-actions.input'; import { ListActionsOutput } from './models/list-actions.output'; import { ListActionsUseCase } from './use-cases/list-actions.use-case'; diff --git a/src/api/endpoints/actions/domain/models/list-actions.input.ts b/src/api/endpoints/actions/domain/models/list-actions.input.ts index dd9cd32..26df54e 100644 --- a/src/api/endpoints/actions/domain/models/list-actions.input.ts +++ b/src/api/endpoints/actions/domain/models/list-actions.input.ts @@ -1,5 +1,5 @@ import { ListActionsQueryParams } from '../actions.types'; -import { Request, parseToBigInt } from '@alien-worlds/api-core'; +import { Request, parseToBigInt } from '@alien-worlds/aw-core'; /** * @class */ diff --git a/src/api/endpoints/actions/domain/models/list-actions.output.ts b/src/api/endpoints/actions/domain/models/list-actions.output.ts index c8dbc67..5dd06da 100644 --- a/src/api/endpoints/actions/domain/models/list-actions.output.ts +++ b/src/api/endpoints/actions/domain/models/list-actions.output.ts @@ -1,4 +1,4 @@ -import { ContractAction, Result } from '@alien-worlds/api-core'; +import { ContractAction, Result } from '@alien-worlds/aw-core'; export class ListActionsOutput { public static create(result: Result): ListActionsOutput { diff --git a/src/api/endpoints/actions/domain/repositories/contract-action.repository.ts b/src/api/endpoints/actions/domain/repositories/contract-action.repository.ts index 6eb472d..f6b52c5 100644 --- a/src/api/endpoints/actions/domain/repositories/contract-action.repository.ts +++ b/src/api/endpoints/actions/domain/repositories/contract-action.repository.ts @@ -1,4 +1,4 @@ -import { injectable, Repository, ContractAction } from '@alien-worlds/api-core'; +import { injectable, Repository, ContractAction } from '@alien-worlds/aw-core'; /** * @abstract diff --git a/src/api/endpoints/actions/domain/use-cases/list-actions.use-case.ts b/src/api/endpoints/actions/domain/use-cases/list-actions.use-case.ts index 65350cb..d60c6c5 100644 --- a/src/api/endpoints/actions/domain/use-cases/list-actions.use-case.ts +++ b/src/api/endpoints/actions/domain/use-cases/list-actions.use-case.ts @@ -7,7 +7,7 @@ import { injectable, Result, UseCase, -} from '@alien-worlds/api-core'; +} from '@alien-worlds/aw-core'; import { ContractActionRepository } from '../repositories/contract-action.repository'; /*imports*/ diff --git a/src/api/endpoints/actions/routes/list-actions.route.ts b/src/api/endpoints/actions/routes/list-actions.route.ts index 896fd0a..079f7fd 100644 --- a/src/api/endpoints/actions/routes/list-actions.route.ts +++ b/src/api/endpoints/actions/routes/list-actions.route.ts @@ -1,4 +1,4 @@ -import { GetRoute, RouteHandler } from '@alien-worlds/api-core'; +import { GetRoute, RouteHandler } from '@alien-worlds/aw-core'; import { ListActionsInput } from '../domain/models/list-actions.input'; import { ListActionsOutput } from '../domain/models/list-actions.output'; diff --git a/src/api/start-api.ts b/src/api/start-api.ts index f0ce1c1..504f052 100644 --- a/src/api/start-api.ts +++ b/src/api/start-api.ts @@ -1,6 +1,6 @@ import 'reflect-metadata'; -import { ConfigVars, Route } from '@alien-worlds/api-core'; +import { ConfigVars, Route } from '@alien-worlds/aw-core'; import { apiCommand } from './api.command'; import { ApiCommandOptions } from './api.types'; import { buildApiConfig } from '../config'; diff --git a/src/bootstrap/__tests__/bootstrap.utils.unit.test.ts b/src/bootstrap/__tests__/bootstrap.utils.unit.test.ts index 7515e8d..ed94e33 100644 --- a/src/bootstrap/__tests__/bootstrap.utils.unit.test.ts +++ b/src/bootstrap/__tests__/bootstrap.utils.unit.test.ts @@ -1,12 +1,15 @@ -import { Result } from '@alien-worlds/api-core'; +import { Result } from '@alien-worlds/aw-core'; import { createDefaultModeBlockRange, createReplayModeBlockRange, createTestModeBlockRange, } from '../bootstrap.utils'; import { Mode } from '../../common'; -import { EndBlockOutOfRangeError, StartBlockHigherThanEndBlockError, UndefinedStartBlockError } from '../bootstrap.errors'; - +import { + EndBlockOutOfRangeError, + StartBlockHigherThanEndBlockError, + UndefinedStartBlockError, +} from '../bootstrap.errors'; describe('createDefaultModeBlockRange', () => { const originalLog = console.log; diff --git a/src/bootstrap/__tests__/start-bootstrap.unit.test.ts b/src/bootstrap/__tests__/start-bootstrap.unit.test.ts index 948bfa9..74d7634 100644 --- a/src/bootstrap/__tests__/start-bootstrap.unit.test.ts +++ b/src/bootstrap/__tests__/start-bootstrap.unit.test.ts @@ -3,7 +3,7 @@ import { NoAbisError } from '../bootstrap.errors'; import { InternalBroadcastMessageName } from '../../broadcast/internal-broadcast.enums'; import { ReaderBroadcastMessage } from '../../broadcast/messages'; import { Mode } from '../../common'; -import { BroadcastTcpClient } from '@alien-worlds/broadcast'; +import { BroadcastTcpClient } from '@alien-worlds/aw-broadcast'; jest.mock('@alien-worlds/history-tools-common', () => ({ Abis: { diff --git a/src/bootstrap/bootstrap.config.ts b/src/bootstrap/bootstrap.config.ts index ebbc06a..58e60bb 100644 --- a/src/bootstrap/bootstrap.config.ts +++ b/src/bootstrap/bootstrap.config.ts @@ -1,8 +1,8 @@ -import { UnknownObject } from '@alien-worlds/api-core'; +import { UnknownObject } from '@alien-worlds/aw-core'; import { AbisServiceConfig } from '../common'; import { BlockRangeScanConfig } from '../common/block-range-scanner'; import { FeaturedConfig } from '../common/featured'; -import { BroadcastConfig } from '@alien-worlds/broadcast'; +import { BroadcastConfig } from '@alien-worlds/aw-broadcast'; export type BlockchainConfig = { endpoint: string; diff --git a/src/bootstrap/bootstrap.dependencies.ts b/src/bootstrap/bootstrap.dependencies.ts index c289c49..9eba3d1 100644 --- a/src/bootstrap/bootstrap.dependencies.ts +++ b/src/bootstrap/bootstrap.dependencies.ts @@ -1,7 +1,7 @@ -import { BlockchainService, Result } from '@alien-worlds/api-core'; +import { BlockchainService, Result } from '@alien-worlds/aw-core'; import { Dependencies } from '../common/dependencies'; import { FeaturedContracts, FeaturedContractDataCriteria } from '../common/featured'; -import { BroadcastClient } from '@alien-worlds/broadcast'; +import { BroadcastClient } from '@alien-worlds/aw-broadcast'; import { Abis, BlockRangeScanner, BlockState, DatabaseConfigBuilder } from '../common'; import { BootstrapConfig } from './bootstrap.config'; diff --git a/src/bootstrap/bootstrap.utils.ts b/src/bootstrap/bootstrap.utils.ts index 758dfd5..a590ddc 100644 --- a/src/bootstrap/bootstrap.utils.ts +++ b/src/bootstrap/bootstrap.utils.ts @@ -1,4 +1,4 @@ -import { BlockchainService, log, parseToBigInt } from '@alien-worlds/api-core'; +import { BlockchainService, log, parseToBigInt } from '@alien-worlds/aw-core'; import { BlockRangeData } from './bootstrap.types'; import { StartBlockHigherThanEndBlockError, diff --git a/src/bootstrap/start-bootstrap.ts b/src/bootstrap/start-bootstrap.ts index 938bb72..7292639 100644 --- a/src/bootstrap/start-bootstrap.ts +++ b/src/bootstrap/start-bootstrap.ts @@ -13,8 +13,8 @@ import { InternalBroadcastChannel, InternalBroadcastMessageName, } from '../broadcast/internal-broadcast.enums'; -import { ConfigVars, log } from '@alien-worlds/api-core'; -import { BroadcastMessage } from '@alien-worlds/broadcast'; +import { ConfigVars, log } from '@alien-worlds/aw-core'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; import { buildBootstrapConfig } from '../config'; import { bootstrapCommand } from './bootstrap.command'; import { BootstrapConfig } from './bootstrap.config'; @@ -56,14 +56,8 @@ export const bootstrap = async ( throw initResult.failure.error; } - const { - abis, - broadcastClient, - blockState, - blockchain, - featuredContracts, - scanner, - } = dependencies; + const { abis, broadcastClient, blockState, blockchain, featuredContracts, scanner } = + dependencies; let blockRange: ReaderBroadcastMessageData; // fetch latest abis to make sure that the blockchain data will be correctly deserialized diff --git a/src/broadcast/__tests__/internal-broadcast.message.unit.test.ts b/src/broadcast/__tests__/internal-broadcast.message.unit.test.ts index 59cfa9c..66b6056 100644 --- a/src/broadcast/__tests__/internal-broadcast.message.unit.test.ts +++ b/src/broadcast/__tests__/internal-broadcast.message.unit.test.ts @@ -1,4 +1,4 @@ -import { BroadcastTcpMessageType } from '@alien-worlds/broadcast'; +import { BroadcastTcpMessageType } from '@alien-worlds/aw-broadcast'; import { InternalBroadcastMessage } from '../internal-broadcast.message'; describe('InternalBroadcastMessage', () => { diff --git a/src/broadcast/internal-broadcast.message.ts b/src/broadcast/internal-broadcast.message.ts index 71b8f90..06e813f 100644 --- a/src/broadcast/internal-broadcast.message.ts +++ b/src/broadcast/internal-broadcast.message.ts @@ -2,7 +2,7 @@ import { BroadcastTcpMessage, BroadcastTcpMessageContent, BroadcastTcpMessageType, -} from '@alien-worlds/broadcast'; +} from '@alien-worlds/aw-broadcast'; /** * Represents an internal broadcast message. diff --git a/src/broadcast/messages/__tests__/processor-broadcast.message.unit.test.ts b/src/broadcast/messages/__tests__/processor-broadcast.message.unit.test.ts index 2abf217..f4128ea 100644 --- a/src/broadcast/messages/__tests__/processor-broadcast.message.unit.test.ts +++ b/src/broadcast/messages/__tests__/processor-broadcast.message.unit.test.ts @@ -3,7 +3,7 @@ import { InternalBroadcastChannel, InternalBroadcastMessageName, } from '../../internal-broadcast.enums'; -import { BroadcastMessage } from '@alien-worlds/broadcast'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; describe('ProcessorBroadcastMessage', () => { describe('ready', () => { diff --git a/src/broadcast/messages/__tests__/reader-broadcast.message.unit.test.ts b/src/broadcast/messages/__tests__/reader-broadcast.message.unit.test.ts index 7dcaead..91ad230 100644 --- a/src/broadcast/messages/__tests__/reader-broadcast.message.unit.test.ts +++ b/src/broadcast/messages/__tests__/reader-broadcast.message.unit.test.ts @@ -2,7 +2,7 @@ import { ReaderBroadcastMessage, ReaderBroadcastMessageData, } from '../reader-broadcast.message'; -import { BroadcastMessage } from '@alien-worlds/broadcast'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; import { InternalBroadcastChannel, InternalBroadcastMessageName, diff --git a/src/broadcast/messages/filter-broadcast.message.ts b/src/broadcast/messages/filter-broadcast.message.ts index 95a3b0b..f465238 100644 --- a/src/broadcast/messages/filter-broadcast.message.ts +++ b/src/broadcast/messages/filter-broadcast.message.ts @@ -1,4 +1,4 @@ -import { BroadcastMessage } from '@alien-worlds/broadcast'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; import { InternalBroadcastChannel, InternalBroadcastMessageName, diff --git a/src/broadcast/messages/processor-broadcast.message.ts b/src/broadcast/messages/processor-broadcast.message.ts index 748e585..6b83765 100644 --- a/src/broadcast/messages/processor-broadcast.message.ts +++ b/src/broadcast/messages/processor-broadcast.message.ts @@ -1,4 +1,4 @@ -import { BroadcastMessage } from '@alien-worlds/broadcast'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; import { InternalBroadcastChannel, InternalBroadcastMessageName, diff --git a/src/broadcast/messages/reader-broadcast.message.ts b/src/broadcast/messages/reader-broadcast.message.ts index 48e4544..a1d7cbf 100644 --- a/src/broadcast/messages/reader-broadcast.message.ts +++ b/src/broadcast/messages/reader-broadcast.message.ts @@ -1,4 +1,4 @@ -import { BroadcastMessage } from '@alien-worlds/broadcast'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; import { InternalBroadcastChannel, InternalBroadcastMessageName, diff --git a/src/broadcast/start-broadcast.ts b/src/broadcast/start-broadcast.ts index 757a996..bc14f1e 100644 --- a/src/broadcast/start-broadcast.ts +++ b/src/broadcast/start-broadcast.ts @@ -1,5 +1,5 @@ -import { ConfigVars } from '@alien-worlds/api-core'; -import { BroadcastTcpServer, buildBroadcastConfig } from '@alien-worlds/broadcast'; +import { ConfigVars } from '@alien-worlds/aw-core'; +import { BroadcastTcpServer, buildBroadcastConfig } from '@alien-worlds/aw-broadcast'; export const startBroadcast = async () => { const vars = new ConfigVars(); diff --git a/src/common/abis/__tests__/abi.repository-impl.unit.test.ts b/src/common/abis/__tests__/abi.repository-impl.unit.test.ts index ac0e4c9..04be6d2 100644 --- a/src/common/abis/__tests__/abi.repository-impl.unit.test.ts +++ b/src/common/abis/__tests__/abi.repository-impl.unit.test.ts @@ -1,5 +1,5 @@ import { AbisRepositoryImpl } from '../abis.repository-impl'; -import { Result, CountParams, ContractEncodedAbi } from '@alien-worlds/api-core'; +import { Result, CountParams, ContractEncodedAbi } from '@alien-worlds/aw-core'; import { AbisCache } from '../abis.cache'; jest.mock('../abis.cache'); diff --git a/src/common/abis/__tests__/abis.unit.test.ts b/src/common/abis/__tests__/abis.unit.test.ts index b6b07f7..90082e0 100644 --- a/src/common/abis/__tests__/abis.unit.test.ts +++ b/src/common/abis/__tests__/abis.unit.test.ts @@ -1,8 +1,7 @@ import { Abis } from '../abis'; import { AbisRepositoryImpl } from '../abis.repository-impl'; -import { Failure, Result, AbiService } from '@alien-worlds/api-core'; -import { AbisServiceNotSetError } from '../abis.errors'; -import { AbiNotFoundError } from '@alien-worlds/block-reader'; +import { Failure, Result, AbiService } from '@alien-worlds/aw-core'; +import { AbiNotFoundError, AbisServiceNotSetError } from '../abis.errors'; // Mock dependencies jest.mock('../abis.repository-impl'); diff --git a/src/common/abis/abis.cache.ts b/src/common/abis/abis.cache.ts index 95c2340..5e7bb4e 100644 --- a/src/common/abis/abis.cache.ts +++ b/src/common/abis/abis.cache.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { ContractEncodedAbi } from '@alien-worlds/api-core'; +import { ContractEncodedAbi } from '@alien-worlds/aw-core'; /** * A function that filters ABI entries based on the block number being greater than or equal to the start block. diff --git a/src/common/abis/abis.errors.ts b/src/common/abis/abis.errors.ts index 27ec8bc..70da4cc 100644 --- a/src/common/abis/abis.errors.ts +++ b/src/common/abis/abis.errors.ts @@ -5,3 +5,9 @@ export class AbisServiceNotSetError extends Error { ); } } + +export class AbiNotFoundError extends Error { + constructor() { + super(`ABI data not found`); + } +} diff --git a/src/common/abis/abis.repository-impl.ts b/src/common/abis/abis.repository-impl.ts index f18b494..b5bb511 100644 --- a/src/common/abis/abis.repository-impl.ts +++ b/src/common/abis/abis.repository-impl.ts @@ -7,7 +7,7 @@ import { RepositoryImpl, Result, Where, -} from '@alien-worlds/api-core'; +} from '@alien-worlds/aw-core'; import { AbisCache } from './abis.cache'; import { AbisRepository } from './abis.repository'; diff --git a/src/common/abis/abis.repository.ts b/src/common/abis/abis.repository.ts index 49529f5..569e84b 100644 --- a/src/common/abis/abis.repository.ts +++ b/src/common/abis/abis.repository.ts @@ -1,4 +1,4 @@ -import { ContractEncodedAbi, Result } from '@alien-worlds/api-core'; +import { ContractEncodedAbi, Result } from '@alien-worlds/aw-core'; /** * This class manages ContractEncodedAbi entities, providing CRUD operations and additional functionalities such as caching. diff --git a/src/common/abis/abis.ts b/src/common/abis/abis.ts index ec3bd98..b137c70 100644 --- a/src/common/abis/abis.ts +++ b/src/common/abis/abis.ts @@ -1,7 +1,12 @@ -import { AbiService, ContractEncodedAbi, Failure, Result, log } from '@alien-worlds/api-core'; -import { AbisServiceNotSetError } from './abis.errors'; +import { + AbiService, + ContractEncodedAbi, + Failure, + Result, + log, +} from '@alien-worlds/aw-core'; +import { AbiNotFoundError, AbisServiceNotSetError } from './abis.errors'; import { AbisRepository } from './abis.repository'; -import { AbiNotFoundError } from '@alien-worlds/block-reader'; /** * Represents a collection of ABIs (Application Binary Interfaces) for smart contracts. diff --git a/src/common/abis/abis.types.ts b/src/common/abis/abis.types.ts index a71d98a..c6c8201 100644 --- a/src/common/abis/abis.types.ts +++ b/src/common/abis/abis.types.ts @@ -1,4 +1,4 @@ -import { UnknownObject } from '@alien-worlds/api-core'; +import { UnknownObject } from '@alien-worlds/aw-core'; export type AbisServiceConfig = { url: string; diff --git a/src/common/block-range-scanner/block-range-scan.repository.ts b/src/common/block-range-scanner/block-range-scan.repository.ts index 21aa099..3b05fb2 100644 --- a/src/common/block-range-scanner/block-range-scan.repository.ts +++ b/src/common/block-range-scanner/block-range-scan.repository.ts @@ -1,6 +1,6 @@ import { BlockRangeScan } from './block-range-scan'; import { BlockRangeScanSource } from './block-range-scan.source'; -import { Mapper } from '@alien-worlds/api-core'; +import { Mapper } from '@alien-worlds/aw-core'; export type ScanRequest = { error?: Error; diff --git a/src/common/block-range-scanner/block-range-scan.source.ts b/src/common/block-range-scanner/block-range-scan.source.ts index 1b305a8..31bf41b 100644 --- a/src/common/block-range-scanner/block-range-scan.source.ts +++ b/src/common/block-range-scanner/block-range-scan.source.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-unsafe-return */ -import { DataSource } from '@alien-worlds/api-core'; +import { DataSource } from '@alien-worlds/aw-core'; export abstract class BlockRangeScanSource extends DataSource { public abstract startNextScan(scanKey: string): Promise; diff --git a/src/common/block-range-scanner/block-range-scan.ts b/src/common/block-range-scanner/block-range-scan.ts index 77ea5f3..78aec29 100644 --- a/src/common/block-range-scanner/block-range-scan.ts +++ b/src/common/block-range-scanner/block-range-scan.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import crypto from 'crypto'; -import { parseToBigInt, removeUndefinedProperties } from '@alien-worlds/api-core'; +import { parseToBigInt, removeUndefinedProperties } from '@alien-worlds/aw-core'; import { serialize } from 'v8'; export class BlockRangeScanParent { diff --git a/src/common/block-state/__tests__/block-state.unit.test.ts b/src/common/block-state/__tests__/block-state.unit.test.ts index eadfac7..ac7e823 100644 --- a/src/common/block-state/__tests__/block-state.unit.test.ts +++ b/src/common/block-state/__tests__/block-state.unit.test.ts @@ -1,7 +1,7 @@ -import { RepositoryImpl, Failure, Result } from '@alien-worlds/api-core'; +import { RepositoryImpl, Failure, Result } from '@alien-worlds/aw-core'; import { BlockState } from '../block-state'; -jest.mock('@alien-worlds/api-core'); +jest.mock('@alien-worlds/aw-core'); jest.mock('./block-state.types'); describe('BlockState', () => { diff --git a/src/common/block-state/block-state.ts b/src/common/block-state/block-state.ts index 6475cba..a27ae7a 100644 --- a/src/common/block-state/block-state.ts +++ b/src/common/block-state/block-state.ts @@ -6,7 +6,7 @@ import { QueryBuilders, RepositoryImpl, Result, -} from '@alien-worlds/api-core'; +} from '@alien-worlds/aw-core'; import { BlockStateModel } from './block-state.types'; /** diff --git a/src/common/common.types.ts b/src/common/common.types.ts index 2f6fdf3..8765b57 100644 --- a/src/common/common.types.ts +++ b/src/common/common.types.ts @@ -1,4 +1,4 @@ -import { ConfigVars, UnknownObject } from '@alien-worlds/api-core'; +import { ConfigVars, UnknownObject } from '@alien-worlds/aw-core'; export type DatabaseConfigBuilder = ( vars: ConfigVars, diff --git a/src/common/dependencies.ts b/src/common/dependencies.ts index ea2a5df..71c81f3 100644 --- a/src/common/dependencies.ts +++ b/src/common/dependencies.ts @@ -1,4 +1,4 @@ -import { Result } from '@alien-worlds/api-core'; +import { Result } from '@alien-worlds/aw-core'; /** * An abstract class representing a Process dependencies. diff --git a/src/common/featured/featured-contract.ts b/src/common/featured/featured-contract.ts index 0dd6589..69e97ca 100644 --- a/src/common/featured/featured-contract.ts +++ b/src/common/featured/featured-contract.ts @@ -1,4 +1,4 @@ -import { parseToBigInt } from '@alien-worlds/api-core'; +import { parseToBigInt } from '@alien-worlds/aw-core'; /** * Class representing a FeaturedContract diff --git a/src/common/featured/featured-contracts.ts b/src/common/featured/featured-contracts.ts index 4815fea..e5fcd7f 100644 --- a/src/common/featured/featured-contracts.ts +++ b/src/common/featured/featured-contracts.ts @@ -5,7 +5,7 @@ import { SmartContractService, UnknownObject, Where, -} from '@alien-worlds/api-core'; +} from '@alien-worlds/aw-core'; import { FeaturedContract } from './featured-contract'; import { FeaturedUtils } from './featured.utils'; diff --git a/src/common/featured/featured.utils.ts b/src/common/featured/featured.utils.ts index 71138ad..1018326 100644 --- a/src/common/featured/featured.utils.ts +++ b/src/common/featured/featured.utils.ts @@ -1,5 +1,5 @@ import fetch from 'node-fetch'; -import { UnknownObject } from '@alien-worlds/api-core'; +import { UnknownObject } from '@alien-worlds/aw-core'; import { FeaturedContractDataCriteria } from './featured.types'; import { existsSync, readFileSync } from 'fs'; diff --git a/src/common/processor-task-queue/processor-task-queue.ts b/src/common/processor-task-queue/processor-task-queue.ts index 79527d4..2c39011 100644 --- a/src/common/processor-task-queue/processor-task-queue.ts +++ b/src/common/processor-task-queue/processor-task-queue.ts @@ -1,4 +1,4 @@ -import { DataSource, DataSourceError, Mapper, log } from '@alien-worlds/api-core'; +import { DataSource, DataSourceError, Mapper, log } from '@alien-worlds/aw-core'; import { ProcessorTaskSource } from './processor-task.source'; import { ProcessorTask } from './processor-task'; import { ProcessorTaskModel } from './processor-task.types'; diff --git a/src/common/processor-task-queue/processor-task.source.ts b/src/common/processor-task-queue/processor-task.source.ts index f4f416d..2c7fdda 100644 --- a/src/common/processor-task-queue/processor-task.source.ts +++ b/src/common/processor-task-queue/processor-task.source.ts @@ -1,4 +1,4 @@ -import { DataSource } from '@alien-worlds/api-core'; +import { DataSource } from '@alien-worlds/aw-core'; export abstract class ProcessorTaskSource extends DataSource { public abstract nextTask(mode?: string): Promise; diff --git a/src/common/processor-task-queue/processor-task.ts b/src/common/processor-task-queue/processor-task.ts index 8ef2b4d..1afc3b2 100644 --- a/src/common/processor-task-queue/processor-task.ts +++ b/src/common/processor-task-queue/processor-task.ts @@ -3,7 +3,7 @@ import { serialize } from 'v8'; import { DeltaProcessorContentModel, ProcessorTaskError } from './processor-task.types'; import { ActionTrace } from '../types'; import { ProcessorTaskType } from './processor-task.enums'; -import { Row } from '@alien-worlds/api-core'; +import { Row } from '@alien-worlds/aw-core'; export class ProcessorTask { public static createActionProcessorTask( diff --git a/src/common/types/delta.types.ts b/src/common/types/delta.types.ts index 0eeb36a..4c06f9b 100644 --- a/src/common/types/delta.types.ts +++ b/src/common/types/delta.types.ts @@ -1,4 +1,4 @@ -import { Row } from "@alien-worlds/api-core"; +import { Row } from '@alien-worlds/aw-core'; export type Delta = { name?: string; diff --git a/src/common/unprocessed-block-queue/unprocessed-block-queue.source.ts b/src/common/unprocessed-block-queue/unprocessed-block-queue.source.ts index b631975..d0bfebe 100644 --- a/src/common/unprocessed-block-queue/unprocessed-block-queue.source.ts +++ b/src/common/unprocessed-block-queue/unprocessed-block-queue.source.ts @@ -1,4 +1,4 @@ -import { DataSource } from '@alien-worlds/api-core'; +import { DataSource } from '@alien-worlds/aw-core'; export abstract class UnprocessedBlockSource extends DataSource { public abstract next(): Promise; diff --git a/src/common/unprocessed-block-queue/unprocessed-block-queue.ts b/src/common/unprocessed-block-queue/unprocessed-block-queue.ts index 60b9509..e74390e 100644 --- a/src/common/unprocessed-block-queue/unprocessed-block-queue.ts +++ b/src/common/unprocessed-block-queue/unprocessed-block-queue.ts @@ -1,17 +1,17 @@ import { + Block, DataSourceError, Failure, log, Mapper, parseToBigInt, Result, -} from '@alien-worlds/api-core'; +} from '@alien-worlds/aw-core'; import { BlockNotFoundError, DuplicateBlocksError, UnprocessedBlocksOverloadError, } from './unprocessed-block-queue.errors'; -import { Block } from '@alien-worlds/block-reader'; import { UnprocessedBlockSource } from './unprocessed-block-queue.source'; import { BlockModel } from '../types/block.types'; diff --git a/src/config/index.ts b/src/config/index.ts index 3f01753..dd5e610 100644 --- a/src/config/index.ts +++ b/src/config/index.ts @@ -5,7 +5,7 @@ import { BlockchainConfig, BootstrapCommandOptions, BootstrapConfig } from '../b import { ReaderCommandOptions, ReaderConfig } from '../reader'; import { ProcessorCommandOptions, ProcessorConfig } from '../processor'; import { HistoryToolsConfig } from './config.types'; -import { ConfigVars, UnknownObject, parseToBigInt } from '@alien-worlds/api-core'; +import { BlockReaderConfig, ConfigVars, UnknownObject, parseToBigInt } from '@alien-worlds/aw-core'; import { AbisConfig, AbisServiceConfig, @@ -15,9 +15,8 @@ import { ProcessorTaskQueueConfig, UnprocessedBlockQueueConfig, } from '../common'; -import { BlockReaderConfig } from '@alien-worlds/block-reader'; -import { WorkersConfig } from '@alien-worlds/workers'; -import { buildBroadcastConfig } from '@alien-worlds/broadcast'; +import { WorkersConfig } from '@alien-worlds/aw-workers'; +import { buildBroadcastConfig } from '@alien-worlds/aw-broadcast'; export * from './config.types'; diff --git a/src/filter/filter.config.ts b/src/filter/filter.config.ts index 049a6bb..7c346ab 100644 --- a/src/filter/filter.config.ts +++ b/src/filter/filter.config.ts @@ -1,6 +1,6 @@ -import { UnknownObject } from '@alien-worlds/api-core'; -import { BroadcastConfig } from '@alien-worlds/broadcast'; -import { WorkersConfig } from '@alien-worlds/workers'; +import { UnknownObject } from '@alien-worlds/aw-core'; +import { BroadcastConfig } from '@alien-worlds/aw-broadcast'; +import { WorkersConfig } from '@alien-worlds/aw-workers'; import { AbisConfig, FeaturedConfig, diff --git a/src/filter/filter.dependencies.ts b/src/filter/filter.dependencies.ts index 0e7fef3..83a983a 100644 --- a/src/filter/filter.dependencies.ts +++ b/src/filter/filter.dependencies.ts @@ -1,5 +1,5 @@ -import { Result } from '@alien-worlds/api-core'; -import { BroadcastClient } from '@alien-worlds/broadcast'; +import { Result } from '@alien-worlds/aw-core'; +import { BroadcastClient } from '@alien-worlds/aw-broadcast'; import { UnprocessedBlockQueue } from '../common/unprocessed-block-queue'; import { Dependencies } from '../common/dependencies'; import { FilterConfig } from './filter.config'; diff --git a/src/filter/filter.runner.ts b/src/filter/filter.runner.ts index 643a2ab..26eed52 100644 --- a/src/filter/filter.runner.ts +++ b/src/filter/filter.runner.ts @@ -1,6 +1,5 @@ -import { log } from '@alien-worlds/api-core'; -import { BlockJson } from '@alien-worlds/block-reader'; -import { WorkerMessage, WorkerPool } from '@alien-worlds/workers'; +import { BlockJsonModel, log } from '@alien-worlds/aw-core'; +import { WorkerMessage, WorkerPool } from '@alien-worlds/aw-workers'; import { BlockNotFoundError, UnprocessedBlockQueueReader } from '../common'; export class FilterRunner { @@ -46,7 +45,7 @@ export class FilterRunner { this.loop = false; } else { const worker = await workerPool.getWorker(); - worker.onMessage(async (message: WorkerMessage) => { + worker.onMessage(async (message: WorkerMessage) => { if (message.isTaskRejected()) { log(message.error); } else if (message.isTaskResolved() && this.transitionHandler) { diff --git a/src/filter/filter.worker-loader.dependencies.ts b/src/filter/filter.worker-loader.dependencies.ts index d2f7a1e..758ec21 100644 --- a/src/filter/filter.worker-loader.dependencies.ts +++ b/src/filter/filter.worker-loader.dependencies.ts @@ -1,7 +1,6 @@ -import { Serializer } from '@alien-worlds/api-core'; -import { ShipAbis } from '@alien-worlds/block-reader'; +import { Serializer } from '@alien-worlds/aw-core'; import { ProcessorTaskQueue } from '../common/processor-task-queue'; -import { WorkerLoaderDependencies } from '@alien-worlds/workers'; +import { WorkerLoaderDependencies } from '@alien-worlds/aw-workers'; import { FeaturedContracts } from '../common/featured'; import { Abis } from '../common'; import { FilterConfig } from './filter.config'; @@ -13,7 +12,6 @@ import { FilterConfig } from './filter.config'; export abstract class FilterWorkerLoaderDependencies extends WorkerLoaderDependencies { public processorTaskQueue: ProcessorTaskQueue; public abis: Abis; - public shipAbis: ShipAbis; public featuredContracts: FeaturedContracts; public serializer: Serializer; diff --git a/src/filter/filter.worker-loader.ts b/src/filter/filter.worker-loader.ts index fb85846..091c86c 100644 --- a/src/filter/filter.worker-loader.ts +++ b/src/filter/filter.worker-loader.ts @@ -1,4 +1,4 @@ -import { Worker, DefaultWorkerLoader } from '@alien-worlds/workers'; +import { Worker, DefaultWorkerLoader } from '@alien-worlds/aw-workers'; import { FilterSharedData } from './filter.types'; import FilterWorker from './filter.worker'; import { FilterWorkerLoaderDependencies } from './filter.worker-loader.dependencies'; diff --git a/src/filter/filter.worker.ts b/src/filter/filter.worker.ts index 36ca7ff..de6dca4 100644 --- a/src/filter/filter.worker.ts +++ b/src/filter/filter.worker.ts @@ -1,7 +1,7 @@ -import { Worker } from '@alien-worlds/workers'; -import { AbiNotFoundError, ShipAbis } from '@alien-worlds/block-reader'; +import { Worker } from '@alien-worlds/aw-workers'; import { FilterSharedData } from './filter.types'; import { + AbiNotFoundError, Abis, BlockModel, DeltaByName, @@ -12,12 +12,11 @@ import { TraceByName, isSetAbiAction, } from '../common'; -import { Serializer, log, parseToBigInt } from '@alien-worlds/api-core'; +import { Serializer, log, parseToBigInt } from '@alien-worlds/aw-core'; export default class FilterWorker extends Worker { constructor( protected dependencies: { - shipAbis: ShipAbis; abis: Abis; featuredContracts: FeaturedContracts; processorTaskQueue: ProcessorTaskQueue; @@ -130,7 +129,7 @@ export default class FilterWorker extends Worker { for (const [type, delta] of deltas) { const { name, rows } = delta; - + for (const row of rows) { const info = serializer.deserializeTableRow(row); @@ -203,19 +202,13 @@ export default class FilterWorker extends Worker { public async run(json: BlockModel): Promise { try { const { - dependencies: { serializer, shipAbis, processorTaskQueue }, + dependencies: { serializer, processorTaskQueue }, } = this; - const { content: abi, failure } = await shipAbis.getAbi(json.abi_version); - - if (failure) { - log('SHiP Abi not found.'); - this.reject(failure.error); - } const deserializedBlock = serializer.deserializeBlock< BlockModel, BlockModel - >(json, abi); + >(json); const { this_block: { block_num }, } = deserializedBlock; diff --git a/src/filter/start-filter.ts b/src/filter/start-filter.ts index 0f61941..062cafc 100644 --- a/src/filter/start-filter.ts +++ b/src/filter/start-filter.ts @@ -9,9 +9,9 @@ import { FilterBroadcastMessage } from '../broadcast/messages/filter-broadcast.m import { buildFilterConfig } from '../config'; import { filterCommand } from './filter.command'; import { filterWorkerLoaderPath } from './filter.consts'; -import { log, ConfigVars } from '@alien-worlds/api-core'; -import { BroadcastMessage } from '@alien-worlds/broadcast'; -import { WorkerPool } from '@alien-worlds/workers'; +import { log, ConfigVars } from '@alien-worlds/aw-core'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; +import { WorkerPool } from '@alien-worlds/aw-workers'; import { FilterConfig } from './filter.config'; import { FilterDependencies } from './filter.dependencies'; diff --git a/src/index.ts b/src/index.ts index 5fed61b..5eeaddb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -7,7 +7,6 @@ export * from './broadcast'; export * from './processor'; export * from './reader'; -export * from '@alien-worlds/api-core'; -export * from '@alien-worlds/block-reader'; -export * from '@alien-worlds/broadcast'; -export * from '@alien-worlds/workers'; +export * from '@alien-worlds/aw-core'; +export * from '@alien-worlds/aw-broadcast'; +export * from '@alien-worlds/aw-workers'; diff --git a/src/processor/processor.config.ts b/src/processor/processor.config.ts index 269e6f0..b2b7567 100644 --- a/src/processor/processor.config.ts +++ b/src/processor/processor.config.ts @@ -1,7 +1,7 @@ -import { BroadcastConfig } from '@alien-worlds/broadcast'; -import { WorkersConfig } from '@alien-worlds/workers'; +import { BroadcastConfig } from '@alien-worlds/aw-broadcast'; +import { WorkersConfig } from '@alien-worlds/aw-workers'; import { FeaturedConfig, ProcessorMatcher, ProcessorTaskQueueConfig } from '../common'; -import { UnknownObject } from '@alien-worlds/api-core'; +import { UnknownObject } from '@alien-worlds/aw-core'; export type ProcessorConfig = { broadcast: BroadcastConfig; diff --git a/src/processor/processor.dependencies.ts b/src/processor/processor.dependencies.ts index e0df96d..a148df6 100644 --- a/src/processor/processor.dependencies.ts +++ b/src/processor/processor.dependencies.ts @@ -1,4 +1,4 @@ -import { Result, Serializer } from '@alien-worlds/api-core'; +import { Result, Serializer } from '@alien-worlds/aw-core'; import { Dependencies } from '../common/dependencies'; import { ContractDeltaMatchCriteria, @@ -6,7 +6,7 @@ import { Featured, } from '../common/featured'; import { ProcessorTaskQueue } from '../common/processor-task-queue'; -import { BroadcastClient } from '@alien-worlds/broadcast'; +import { BroadcastClient } from '@alien-worlds/aw-broadcast'; import { ProcessorAddons, ProcessorConfig } from './processor.config'; import { DatabaseConfigBuilder } from '../common'; diff --git a/src/processor/processor.model.factory.ts b/src/processor/processor.model.factory.ts index 46ab876..d4c7a4a 100644 --- a/src/processor/processor.model.factory.ts +++ b/src/processor/processor.model.factory.ts @@ -1,4 +1,4 @@ -import { Serializer } from '@alien-worlds/api-core'; +import { Serializer } from '@alien-worlds/aw-core'; import { ActionProcessorContentModel, DeltaProcessorContentModel, diff --git a/src/processor/processor.runner.ts b/src/processor/processor.runner.ts index 9f375de..53d64a8 100644 --- a/src/processor/processor.runner.ts +++ b/src/processor/processor.runner.ts @@ -1,5 +1,5 @@ -import { Serializer, log } from '@alien-worlds/api-core'; -import { WorkerPool, WorkerMessage } from '@alien-worlds/workers'; +import { Serializer, log } from '@alien-worlds/aw-core'; +import { WorkerPool, WorkerMessage } from '@alien-worlds/aw-workers'; import { Featured, ContractTraceMatchCriteria, @@ -21,9 +21,8 @@ export class ProcessorRunner { protected featuredDeltas: Featured, protected workerPool: WorkerPool, protected queue: ProcessorTaskQueue, - serializer: Serializer, + serializer: Serializer ) { - this.modelFactory = new ProcessorModelFactory(serializer); this.interval = setInterval(async () => { diff --git a/src/processor/processor.worker-loader.dependencies.ts b/src/processor/processor.worker-loader.dependencies.ts index 36ef7ac..bc623cc 100644 --- a/src/processor/processor.worker-loader.dependencies.ts +++ b/src/processor/processor.worker-loader.dependencies.ts @@ -1,4 +1,4 @@ -import { WorkerLoaderDependencies } from '@alien-worlds/workers'; +import { WorkerLoaderDependencies } from '@alien-worlds/aw-workers'; import { ProcessorConfig } from './processor.config'; /** diff --git a/src/processor/processor.worker-loader.ts b/src/processor/processor.worker-loader.ts index 4e54324..b60e4fe 100644 --- a/src/processor/processor.worker-loader.ts +++ b/src/processor/processor.worker-loader.ts @@ -1,6 +1,6 @@ -import { Worker, DefaultWorkerLoader, WorkerContainer } from '@alien-worlds/workers'; +import { Worker, DefaultWorkerLoader, WorkerContainer } from '@alien-worlds/aw-workers'; import { ProcessorSharedData } from './processor.types'; -import { Container } from '@alien-worlds/api-core'; +import { Container } from '@alien-worlds/aw-core'; import { ProcessorWorkerLoaderDependencies } from './processor.worker-loader.dependencies'; export default class ProcessorWorkerLoader extends DefaultWorkerLoader< diff --git a/src/processor/processors/action-trace.processor.ts b/src/processor/processors/action-trace.processor.ts index 0dc836f..da61556 100644 --- a/src/processor/processors/action-trace.processor.ts +++ b/src/processor/processors/action-trace.processor.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ import { Processor } from './processor'; import { ActionTraceProcessorModel, ProcessorSharedData } from '../processor.types'; -import { Container, Serializer } from '@alien-worlds/api-core'; +import { Container, Serializer } from '@alien-worlds/aw-core'; export class ActionTraceProcessor< DataType = unknown, diff --git a/src/processor/processors/delta.processor.ts b/src/processor/processors/delta.processor.ts index 78b1a1f..15fc313 100644 --- a/src/processor/processors/delta.processor.ts +++ b/src/processor/processors/delta.processor.ts @@ -1,6 +1,6 @@ import { Processor } from './processor'; import { DeltaProcessorModel, ProcessorSharedData } from '../processor.types'; -import { Container, Serializer } from '@alien-worlds/api-core'; +import { Container, Serializer } from '@alien-worlds/aw-core'; export class DeltaProcessor< DataType = unknown, diff --git a/src/processor/processors/processor.ts b/src/processor/processors/processor.ts index d232964..387fe5d 100644 --- a/src/processor/processors/processor.ts +++ b/src/processor/processors/processor.ts @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/no-unused-vars */ -import { Worker } from '@alien-worlds/workers'; +import { Worker } from '@alien-worlds/aw-workers'; import { ProcessorSharedData } from '../processor.types'; export class Processor< diff --git a/src/processor/start-processor.ts b/src/processor/start-processor.ts index 5e39f70..a723cb7 100644 --- a/src/processor/start-processor.ts +++ b/src/processor/start-processor.ts @@ -8,9 +8,9 @@ import { import { processorCommand } from './processor.command'; import { buildProcessorConfig } from '../config'; import { ProcessorCommandOptions } from './processor.types'; -import { log, ConfigVars } from '@alien-worlds/api-core'; -import { BroadcastMessage } from '@alien-worlds/broadcast'; -import { WorkerPool } from '@alien-worlds/workers'; +import { log, ConfigVars } from '@alien-worlds/aw-core'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; +import { WorkerPool } from '@alien-worlds/aw-workers'; import { ProcessorConfig, ProcessorAddons } from './processor.config'; import { ProcessorDependencies } from './processor.dependencies'; diff --git a/src/reader/reader.config.ts b/src/reader/reader.config.ts index c981220..d2ffbde 100644 --- a/src/reader/reader.config.ts +++ b/src/reader/reader.config.ts @@ -1,8 +1,7 @@ -import { BlockReaderConfig } from '@alien-worlds/block-reader'; -import { BroadcastConfig } from '@alien-worlds/broadcast'; -import { WorkersConfig } from '@alien-worlds/workers'; +import { BroadcastConfig } from '@alien-worlds/aw-broadcast'; +import { WorkersConfig } from '@alien-worlds/aw-workers'; import { BlockRangeScanConfig, UnprocessedBlockQueueConfig } from '../common'; -import { UnknownObject } from '@alien-worlds/api-core'; +import { BlockReaderConfig, UnknownObject } from '@alien-worlds/aw-core'; export type ReaderConfig = { broadcast?: BroadcastConfig; diff --git a/src/reader/reader.dependencies.ts b/src/reader/reader.dependencies.ts index e3d5413..2a2fec2 100644 --- a/src/reader/reader.dependencies.ts +++ b/src/reader/reader.dependencies.ts @@ -1,5 +1,5 @@ -import { BroadcastClient } from '@alien-worlds/broadcast'; -import { Result } from '@alien-worlds/api-core'; +import { BroadcastClient } from '@alien-worlds/aw-broadcast'; +import { Result } from '@alien-worlds/aw-core'; import { Dependencies } from '../common/dependencies'; import { BlockRangeScanner, DatabaseConfigBuilder } from '../common'; import { ReaderConfig } from './reader.config'; diff --git a/src/reader/reader.ts b/src/reader/reader.ts index 6a8b04f..a98be8e 100644 --- a/src/reader/reader.ts +++ b/src/reader/reader.ts @@ -1,8 +1,8 @@ import { ReadCompleteData, ReadTaskData } from './reader.types'; import { FilterBroadcastMessage } from '../broadcast/messages'; -import { log } from '@alien-worlds/api-core'; -import { BroadcastClient } from '@alien-worlds/broadcast'; -import { WorkerPool, WorkerMessage } from '@alien-worlds/workers'; +import { log } from '@alien-worlds/aw-core'; +import { BroadcastClient } from '@alien-worlds/aw-broadcast'; +import { WorkerPool, WorkerMessage } from '@alien-worlds/aw-workers'; import { BlockRangeScanner, Mode } from '../common'; export class Reader { diff --git a/src/reader/reader.worker-loader.dependencies.ts b/src/reader/reader.worker-loader.dependencies.ts index 1e8894d..b6f565f 100644 --- a/src/reader/reader.worker-loader.dependencies.ts +++ b/src/reader/reader.worker-loader.dependencies.ts @@ -1,8 +1,8 @@ -import { WorkerLoaderDependencies } from '@alien-worlds/workers'; -import { BlockReader } from '@alien-worlds/block-reader'; +import { WorkerLoaderDependencies } from '@alien-worlds/aw-workers'; import { UnprocessedBlockQueue } from '../common/unprocessed-block-queue'; import { BlockRangeScanner, BlockState } from '../common'; import { ReaderConfig } from './reader.config'; +import { BlockReader } from '@alien-worlds/aw-core'; /** * An abstract class representing a ReaderWorkerLoader dependencies. diff --git a/src/reader/reader.worker-loader.ts b/src/reader/reader.worker-loader.ts index 27c37da..a204f03 100644 --- a/src/reader/reader.worker-loader.ts +++ b/src/reader/reader.worker-loader.ts @@ -1,6 +1,6 @@ -import { Worker, DefaultWorkerLoader } from '@alien-worlds/workers'; +import { Worker, DefaultWorkerLoader } from '@alien-worlds/aw-workers'; import { ReaderWorkerLoaderDependencies } from './reader.worker-loader.dependencies'; -import { log } from '@alien-worlds/api-core'; +import { log } from '@alien-worlds/aw-core'; import ReaderWorker, { ReaderSharedData } from './reader.worker'; export default class ReaderWorkerLoader extends DefaultWorkerLoader< diff --git a/src/reader/reader.worker.ts b/src/reader/reader.worker.ts index 20356d0..49198c9 100644 --- a/src/reader/reader.worker.ts +++ b/src/reader/reader.worker.ts @@ -1,7 +1,7 @@ -import { Worker } from '@alien-worlds/workers'; +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { Worker } from '@alien-worlds/aw-workers'; import { ReaderConfig } from './reader.config'; -import { log, parseToBigInt } from '@alien-worlds/api-core'; -import { BlockReader } from '@alien-worlds/block-reader'; +import { BlockReader, log, parseToBigInt } from '@alien-worlds/aw-core'; import { UnprocessedBlockQueue, BlockState, BlockRangeScanner, Mode } from '../common'; export type ReaderSharedData = { diff --git a/src/reader/start-reader.ts b/src/reader/start-reader.ts index fa0bcc9..71962e3 100644 --- a/src/reader/start-reader.ts +++ b/src/reader/start-reader.ts @@ -10,9 +10,9 @@ import { Reader } from './reader'; import { readerCommand } from './reader.command'; import { buildReaderConfig } from '../config'; import { readerWorkerLoaderPath } from './reader.consts'; -import { log, ConfigVars } from '@alien-worlds/api-core'; -import { BroadcastMessage } from '@alien-worlds/broadcast'; -import { WorkerPool } from '@alien-worlds/workers'; +import { log, ConfigVars } from '@alien-worlds/aw-core'; +import { BroadcastMessage } from '@alien-worlds/aw-broadcast'; +import { WorkerPool } from '@alien-worlds/aw-workers'; import { Mode } from '../common'; import { ReaderConfig } from './reader.config'; import { ReaderDependencies } from './reader.dependencies'; diff --git a/tutorials/extending-history-tools.md b/tutorials/extending-history-tools.md index e73902d..3834fa4 100644 --- a/tutorials/extending-history-tools.md +++ b/tutorials/extending-history-tools.md @@ -2,7 +2,7 @@ In this tutorial, we'll briefly go over how to extend the history tools and possibly change the resources. Such a situation may occur when the basic construction of the tools does not meet all expectations. in our case, this happened when creating the leaderboard api. We could rely on the available architecture and put all the work of updating the leaderboards in processors, but we wanted to separate this process from others and leave the standard processes (boot, filter, reader, processor) unchanged. We needed another process whose task would be to update the leaderboard database and which would be able to scale properly to increase work efficiency. We called the new process writer and its role is to download records in the leaderboard_updates collection and create updates in the target leaderboar collections (of which we have several). On this own example, we will describe ways to extend the capabilities of history tools. -First, decide how you want to extend the tools. You can download the history-tools repository and add your own implementations of components responsible for communication with the blockchain and the database. The second method is to create a new repository and import history tools along with [Starter Kit](https://github.com/Alien-Worlds/history-tools-starter-kit). Since we will continue to use mongodb and eos we will choose second option. +First, decide how you want to extend the tools. You can download the history-tools repository and add your own implementations of components responsible for communication with the blockchain and the database. The second method is to create a new repository and import history tools along with [Starter Kit](https://github.com/Alien-Worlds/aw-history-starter-kit). Since we will continue to use mongodb and eos we will choose second option. [Back to Readme](../README.md) @@ -51,8 +51,7 @@ Your `package.json` file should look similar to this: }, ... "dependencies": { - "@alien-worlds/api-history-tools": "^0.0.136", - "@alien-worlds/history-tools-default-dependencies": "^0.0.27", + "@alien-worlds/aw-history": "^0.0.136", ... all your contract packages and other typescript dependencies } } @@ -188,7 +187,7 @@ In the `bootstrap` directory, create an `index.ts` file and add the following co import { startBootstrap, DefaultBootstrapDependencies, -} from '@alien-worlds/history-tools-starter-kit'; +} from '@alien-worlds/aw-history-starter-kit'; import path from 'path'; startBootstrap( @@ -203,7 +202,7 @@ startBootstrap( In the `broadcast` directory, create an `index.ts` file and add the following content: ```typescript -import { startBroadcast } from '@alien-worlds/history-tools-starter-kit'; +import { startBroadcast } from '@alien-worlds/aw-history-starter-kit'; startBroadcast(); ``` @@ -216,7 +215,7 @@ In the `reader` directory, create an `index.ts` file and add the following conte import { startReader, DefaultReaderDependencies, -} from '@alien-worlds/history-tools-starter-kit'; +} from '@alien-worlds/aw-history-starter-kit'; startReader(process.argv, new DefaultReaderDependencies()); ``` @@ -229,7 +228,7 @@ In the `filter` directory, create an `index.ts` file and add the following conte import { startFilter, DefaultFilterDependencies, -} from '@alien-worlds/history-tools-starter-kit'; +} from '@alien-worlds/aw-history-starter-kit'; import path from 'path'; startFilter( @@ -247,7 +246,7 @@ In the `processor` directory, create an `index.ts` file and add the following co import { startProcessor, DefaultProcessorDependencies, -} from '@alien-worlds/history-tools-starter-kit'; +} from '@alien-worlds/aw-history-starter-kit'; import path from 'path'; startProcessor( @@ -278,7 +277,7 @@ export { NotifyWorldTraceProcessor } from './notify-world.trace-processor'; ... // ./processors/notify-world.trace-processor.ts -import { ActionTraceProcessor, ProcessorTaskModel } from '@alien-worlds/history-tools-starter-kit'; +import { ActionTraceProcessor, ProcessorTaskModel } from '@alien-worlds/aw-history-starter-kit'; export class NotifyWorldTraceProcessor extends ActionTraceProcessor { public async run(model: ProcessorTaskModel): Promise { @@ -311,6 +310,6 @@ That's it, the examples shown are of course partial but you should get a general ## Using other resources -If, apart from simply adding new processes or modifying existing ones, you want to use another database (replacing the default mongodb) or another blockchain (reading tools). You should check [Starter Kit](https://github.com/Alien-Worlds/history-tools-starter-kit) implementation and write your own based on all interfaces used in [Api Core](https://github.com/Alien-Worlds/api-core), **History Tools**. Check the contents of this package and replace e.g. all mongo.\* components with your own. Theoretically, if you follow the interface guidelines, everything should work fine, including serialization and block reader. The **kit** prepared in this way should be imported into your history tools implementation and then follow the guidelines mentioned above. +If, apart from simply adding new processes or modifying existing ones, you want to use another database (replacing the default mongodb) or another blockchain (reading tools). You should check [Starter Kit](https://github.com/Alien-Worlds/aw-history-starter-kit) implementation and write your own based on all interfaces used in [Api Core](https://github.com/Alien-Worlds/api-core), **History Tools**. Check the contents of this package and replace e.g. all mongo.\* components with your own. Theoretically, if you follow the interface guidelines, everything should work fine, including serialization and block reader. The **kit** prepared in this way should be imported into your history tools implementation and then follow the guidelines mentioned above. Remember, if your **kit** works and meets all requirements, it's worth thinking about sharing it with other users. More _starter-kit_ type repositories may be useful and maybe more users will benefit from your work. Good luck! diff --git a/tutorials/what-is-featured-content.md b/tutorials/what-is-featured-content.md index 0e6c463..c432f07 100644 --- a/tutorials/what-is-featured-content.md +++ b/tutorials/what-is-featured-content.md @@ -117,7 +117,7 @@ _Note: The current solution may change as we are considering different alternati The `FeaturedContracts` is a repository containing the contract data you put in the JSON file. The `FeaturedUtils.readFeaturedContracts` function can be used to extract the names of all contracts and retrieve their data via `SmartContractService`. -To create `FeaturedContracts`, you can use the `FeaturedContractsCreator` available in the [Starter Kit](https://github.com/Alien-Worlds/history-tools-starter-kit). If you want to use other sources and there is no suitable KIT for them, check the wizard implementation from the starter kit and implement it according to your needs. +To create `FeaturedContracts`, you can use the `FeaturedContractsCreator` available in the [Starter Kit](https://github.com/Alien-Worlds/aw-history-starter-kit). If you want to use other sources and there is no suitable KIT for them, check the wizard implementation from the starter kit and implement it according to your needs. ### FeaturedUtils diff --git a/yarn.lock b/yarn.lock index e31f392..032d210 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,34 +2,27 @@ # yarn lockfile v1 -"@alien-worlds/api-core@^0.0.158": - version "0.0.158" - resolved "https://npm.pkg.github.com/download/@alien-worlds/api-core/0.0.158/92cb2bb3a2168e07fa7a8e240895f5133105e0ee#92cb2bb3a2168e07fa7a8e240895f5133105e0ee" - integrity sha512-PIrmouUmomBUTZ1tkNKzU/0cHcvY9L/puAYljvnDlwZ5yAJECgbgVuxEqlQVbMne2kXQwW0c1U7GCfP877Zt6w== +"@alien-worlds/aw-broadcast@^0.0.2": + version "0.0.2" + resolved "https://npm.pkg.github.com/download/@alien-worlds/aw-broadcast/0.0.2/ae8f1ae3485c3c1d0581dc06999cbfcd342803de#ae8f1ae3485c3c1d0581dc06999cbfcd342803de" + integrity sha512-I2X5akaAfvARklvq1fCu6syzEUtBHgyc45wbZKQ3GL7LVP6UAbU765GGR1vFQ+dA3r3wMEe9CdXNKVnZMv7+pA== + dependencies: + "@alien-worlds/aw-core" "^0.0.2" + nanoid "^3.0.0" + +"@alien-worlds/aw-core@^0.0.2": + version "0.0.2" + resolved "https://npm.pkg.github.com/download/@alien-worlds/aw-core/0.0.2/a0ff00b1c50a06173e99a1185af0428a24b4a3ac#a0ff00b1c50a06173e99a1185af0428a24b4a3ac" + integrity sha512-Ld5QrJVhtFqvmgxFYNQUlojPBp4AEw+iqPJ8xX00pFJ2shUO9wJk0cVPMP1a7KADkCYirA9AxPn45C8CXcHKjA== dependencies: inversify "^6.0.1" node-fetch "2.6.6" reflect-metadata "^0.1.13" -"@alien-worlds/block-reader@^0.0.18": - version "0.0.18" - resolved "https://npm.pkg.github.com/download/@alien-worlds/block-reader/0.0.18/f1e0fcb9fde2d25cc2864c5080605bd11daf32e2#f1e0fcb9fde2d25cc2864c5080605bd11daf32e2" - integrity sha512-h8bCBqX8kX4FInyXB9PWHoZf+8urB7/8LsbnOVTjPoAYWdb1uRSV+VPIviGot1xgyV71HLv9ELpweCMqitOIug== - dependencies: - "@alien-worlds/api-core" "^0.0.158" - -"@alien-worlds/broadcast@^0.0.13": - version "0.0.13" - resolved "https://npm.pkg.github.com/download/@alien-worlds/broadcast/0.0.13/03327b557e880e8848a8114f0981d1398c434d71#03327b557e880e8848a8114f0981d1398c434d71" - integrity sha512-HPrvX5OZ/hYyGn/EtmMITLASH4J0OnwuBDoWaD/TYUAvUJ5ZnJutbDDEIekmzK1SekXuOHD+vKTNfOhP8sK8kg== - dependencies: - "@alien-worlds/api-core" "^0.0.158" - nanoid "^3.0.0" - -"@alien-worlds/workers@^0.0.7": - version "0.0.7" - resolved "https://npm.pkg.github.com/download/@alien-worlds/workers/0.0.7/561e152e2c9f3d3ea5777ab413aa50023549006a#561e152e2c9f3d3ea5777ab413aa50023549006a" - integrity sha512-gcAkRpezhsyVHdFbXz7FpXbPd/PAANPyNe2H4su5J/gGrKuYPfoH6AX7elgSHciq9UPVFRkJDu8yWCYi4ARiXA== +"@alien-worlds/aw-workers@^0.0.2": + version "0.0.2" + resolved "https://npm.pkg.github.com/download/@alien-worlds/aw-workers/0.0.2/38b0f98ca4327d71df0e5b21a59b7a13b760a654#38b0f98ca4327d71df0e5b21a59b7a13b760a654" + integrity sha512-Sdm5OI7lTJbBXXxXh3bGsc2fB/I6v55hZKFY8omPIi68M+P9xlfqJDU8AoZ+zfb4G9iH60Mn6kiLLNe0yKqeBQ== dependencies: async "^3.2.4" ts-node "^10.9.1"