Module: @moralisweb3/common-core
moralis-monorepo / @moralisweb3/common-core
Module: @moralisweb3/common-core
Table of contents
Type Aliases
- AnyBaseClass
- BigNumberInput
- BigNumberJSON
- BigNumberPrimitive
- BigNumberish
- BuildEnvironment
- Camelize
- ConfigKeyValidator
- CoreConfigValues
- DateInput
- EvmChainish
- EvmConnector
- LogLevel
- MoralisCoreConfigValues
- MoralisDataFormatted
- MoralisDataObjectValue
- MoralisErrorCode
- MoralisErrorDetails
- Network
- OperationBodyType
- OperationRequestBody
- OperationRequestMethod
- OperationRequestPropertiesBody
- OperationRequestRawBody
- OperationRequestUrlParams
- SolNetworkName
- SolNetworkish
- UnknownOperation
Enumerations
DataType Classes
Other Classes
- ApiModule
- AxiosRetry
- Config
- Core
- CoreError
- CoreProvider
- LoggerController
- Module
- Modules
- MoralisApiError
- MoralisAuthError
- MoralisDataObject
- MoralisError
- MoralisStreamError
- NextPaginatedRequestResolver
- OperationRequestValidator
- PaginatedResponseAdapter
- PaginationReader
- RequestController
- ResponseAdapter
Interfaces
- AxiosRetryConfig
- ConfigKey
- ConfigValues
- EvmApiConfigValues
- EvmChainable
- EvmUtilsConfigValues
- ModuleFactory
- MoralisErrorOptions
- Operation
- OperationV3
- PaginatedJSONResponse
- PaginatedOperation
- PaginatedRequest
- Pagination
- RequestOptions
- SolApiConfigValues
- SolNetworkable
Variables
Functions
- assertUnreachable
- dateInputToDate
- determineOperationType
- isApiModule
- isMoralisError
- maybe
- toCamel
- toCamelCase
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
Name | Type |
---|---|
value | Value |
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
Name | Type | Description |
---|---|---|
buidEnvironment | ConfigKey <BuildEnvironment > | - |
defaultNetwork | ConfigKey <Network > | - |
logLevel | ConfigKey <LogLevel > | - |
maxRetries | ConfigKey <number > | Description Maximal number of request retries. |
product | ConfigKey <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
Name | Type |
---|---|
x | never |
Returns
never
dateInputToDate
▸ dateInputToDate(value
): Date
Parameters
Name | Type |
---|---|
value | DateInput |
Returns
Date
determineOperationType
▸ determineOperationType(operation
): OperationType
Parameters
Name | Type |
---|---|
operation | Operation <unknown , unknown , unknown , unknown > |
Returns
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
Name | Type |
---|---|
moralisClass | Module |
Returns
moralisClass is ApiModule
isMoralisError
▸ isMoralisError(error
): error is MoralisError
Parameters
Name | Type |
---|---|
error | unknown |
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
Name | Type |
---|---|
value | undefined | null | Value |
Returns
Value
| undefined
▸ maybe<Value
, Output
>(value
, transform
): Output
| undefined
Type parameters
Name |
---|
Value |
Output |
Parameters
Name | Type |
---|---|
value | undefined | null | Value |
transform | (value : Value ) => Output |
Returns
Output
| undefined
toCamel
▸ toCamel(value
): string
Parameters
Name | Type |
---|---|
value | string |
Returns
string
toCamelCase
▸ toCamelCase<Data
>(data
): Camelize
<Data
>
Type parameters
Name | Type |
---|---|
Data | extends object |
Parameters
Name | Type |
---|---|
data | Data |
Returns
Camelize
<Data
>