Class: Core
moralis-monorepo / @moralisweb3/common-core / Core
Class: 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
getModule
▸ getModule<CurrentModule
>(name
): CurrentModule
Type parameters
Name | Type |
---|---|
CurrentModule | extends Module <CurrentModule > = Module |
Parameters
Name | Type |
---|---|
name | string |
Returns
CurrentModule
registerModule
▸ registerModule(module
): void
Register a new module
Parameters
Name | Type |
---|---|
module | Module | 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
Name | Type |
---|---|
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
Name | Type |
---|---|
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
Name | Type |
---|---|
modules | Modules |
config | Config |
logger | LoggerController |