Skip to main content

Module: @moralisweb3/common-core

moralis-monorepo / @moralisweb3/common-core

Module: @moralisweb3/common-core

Table of contents

Type Aliases

Enumerations

DataType Classes

Other Classes

Interfaces

Variables

Functions

Type Aliases

AnyBaseClass

Ƭ AnyBaseClass: Module | ApiModule


BigNumberInput

Ƭ BigNumberInput: BigNumber | BigNumberPrimitive


BigNumberJSON

Ƭ BigNumberJSON: string


BigNumberPrimitive

Ƭ BigNumberPrimitive: number | string | bigint

Valid input types for a BigNumber. This can be a number, string, or bigint.


BigNumberish

Ƭ BigNumberish: BigNumberInput

Valid input for a new BigNumber instance. This can be an existing BigNumber or a valid BigNumberPrimitive type


BuildEnvironment

Ƭ BuildEnvironment: "browser" | "node" | "react-native"


Camelize

Ƭ Camelize<Data>: { [Key in keyof Data as CamelCase<string & Key>]: Data[Key] extends (infer Value)[] ? Value extends Object ? Camelize<Value>[] : Data[Key] : Data[Key] extends Object ? Camelize<Data[Key]> : Data[Key] }

Type parameters

Name
Data

ConfigKeyValidator

Ƭ ConfigKeyValidator<Value>: (value: Value) => string | null

Type parameters

Name
Value

Type declaration

▸ (value): string | null

Parameters
NameType
valueValue
Returns

string | null


CoreConfigValues

Ƭ CoreConfigValues: Omit<{ [Key in keyof CoreConfigType]: CoreConfigType[Key]["defaultValue"] }, "product">


DateInput

Ƭ DateInput: string | Date


EvmChainish

Ƭ EvmChainish: EvmChainable | string | number


EvmConnector

Ƭ EvmConnector: string


LogLevel

Ƭ LogLevel: "verbose" | "debug" | "info" | "warning" | "error" | "off"


MoralisCoreConfigValues

Ƭ MoralisCoreConfigValues: CoreConfigValues | EvmUtilsConfigValues | EvmApiConfigValues | SolApiConfigValues | { [key: string]: string | number; }


MoralisDataFormatted

Ƭ MoralisDataFormatted: Primitive | MoralisDataObjectValue


MoralisDataObjectValue

Ƭ MoralisDataObjectValue: { [key: string]: Primitive | MoralisDataObjectValue | Primitive[] | (Primitive | Primitive[])[] | MoralisDataObjectValue[] | ArrayLike<Primitive> | ArrayLike<MoralisDataObjectValue> | Record<string, MoralisDataObjectValue> | [string, MoralisDataObjectValue][] | [string, Primitive[]][]; } | MoralisDataObjectValue[]


MoralisErrorCode

Ƭ MoralisErrorCode: CoreErrorCode | ApiErrorCode | AuthErrorCode | StreamErrorCode


MoralisErrorDetails

Ƭ MoralisErrorDetails: Record<string, unknown>


Network

Ƭ Network: "Evm" | "Solana" | "Aptos"


OperationBodyType

Ƭ OperationBodyType: "properties" | "raw"


OperationRequestBody

Ƭ OperationRequestBody: OperationRequestPropertiesBody | OperationRequestRawBody


OperationRequestMethod

Ƭ OperationRequestMethod: "GET" | "POST" | "PUT" | "DELETE"


OperationRequestPropertiesBody

Ƭ OperationRequestPropertiesBody: Record<string, unknown>


OperationRequestRawBody

Ƭ OperationRequestRawBody: string | number | boolean | object


OperationRequestUrlParams

Ƭ OperationRequestUrlParams: Record<string, string | string[] | boolean | undefined>


SolNetworkName

Ƭ SolNetworkName: typeof solNetworkNames[number]


SolNetworkish

Ƭ SolNetworkish: SolNetworkable | string


UnknownOperation

Ƭ UnknownOperation: Operation<unknown, unknown, unknown, unknown>

Variables

CoreConfig

Const CoreConfig: Object

Type declaration

NameTypeDescription
buidEnvironmentConfigKey<BuildEnvironment>-
defaultNetworkConfigKey<Network>-
logLevelConfigKey<LogLevel>-
maxRetriesConfigKey<number>Description Maximal number of request retries.
productConfigKey<undefined | string>-

UnreachableError

Const UnreachableError: CoreError


solNetworkNames

Const solNetworkNames: readonly ["mainnet", "devnet"]

Note this is just an interface, used in the core config. The implementations are located in the @moralisweb3/common-sol-utils package.

Functions

assertUnreachable

assertUnreachable(x): never

Typesafe check, to make sure that code never reaches a certain point. Can be used as an exhaustive check in swtich/if-else statements

When used properly with Typescript, this code should never reach, as it is typed as 'never'

If the code does reach this assertion an UnreachableError is thrown

Parameters

NameType
xnever

Returns

never


dateInputToDate

dateInputToDate(value): Date

Parameters

NameType
valueDateInput

Returns

Date


determineOperationType

determineOperationType(operation): OperationType

Parameters

NameType
operationOperation<unknown, unknown, unknown, unknown>

Returns

OperationType


isApiModule

isApiModule(moralisClass): moralisClass is ApiModule

Verify if the provided class is a api type. Should be used as a Typescript type-guard

Example

if(isApiModule(module)){
// module is types as ApiModule here
}

Parameters

NameType
moralisClassModule

Returns

moralisClass is ApiModule


isMoralisError

isMoralisError(error): error is MoralisError

Parameters

NameType
errorunknown

Returns

error is MoralisError


maybe

maybe<Value>(value): Value | undefined

Converts null or undefined values to undefined Optionally, the value gets transformed by the second argument

Type parameters

Name
Value

Parameters

NameType
valueundefined | null | Value

Returns

Value | undefined

maybe<Value, Output>(value, transform): Output | undefined

Type parameters

Name
Value
Output

Parameters

NameType
valueundefined | null | Value
transform(value: Value) => Output

Returns

Output | undefined


toCamel

toCamel(value): string

Parameters

NameType
valuestring

Returns

string


toCamelCase

toCamelCase<Data>(data): Camelize<Data>

Type parameters

NameType
Dataextends object

Parameters

NameType
dataData

Returns

Camelize<Data>