Skip to main content

Class: Core

moralis-monorepo / @moralisweb3/common-core / Core

Class: Core

@moralisweb3/common-core.Core

Core is used in all Moralis applications This class is required to be implemented in every app

This class is responsible for:

  • registering, removing and accessing modules
  • accessing and changing the config

Table of contents

Methods

Properties

Accessors

Constructors

Methods

create

Static create(): Core

Returns

Core


getModule

getModule<CurrentModule>(name): CurrentModule

Type parameters

NameType
CurrentModuleextends Module<CurrentModule> = Module

Parameters

NameType
namestring

Returns

CurrentModule


registerModule

registerModule(module): void

Register a new module

Parameters

NameType
moduleModule | ModuleFactory

Returns

void


registerModules

registerModules(modules): void

Register all specified modules and configurations

Params

array of all modules (any module that is extended from BaseModule) that you want to include

Parameters

NameType
modules(Module | ModuleFactory)[]

Returns

void


start

start(providedConfig?): Promise<void>

Start all modules, this function should be called before any interaction with a module, as it is responsible for initialising the modules.

This will call start() on every registered module

Parameters

NameType
providedConfig?Partial<MoralisCoreConfigValues>

Returns

Promise<void>

Properties

libVersion

Static Readonly libVersion: "2.27.2"


moduleName

Static Readonly moduleName: "core"


config

Readonly config: Config


logger

Readonly logger: LoggerController


modules

Readonly modules: Modules


name

Readonly name: "core"

Accessors

BigNumber

get BigNumber(): typeof BigNumber

Returns

typeof BigNumber


isStarted

get isStarted(): boolean

Returns

boolean

Constructors

constructor

new Core(modules, config, logger)

Parameters

NameType
modulesModules
configConfig
loggerLoggerController