// Assign API if valid value passed
static async #getValidApi (input: Record<string, unknown>): Promise<ApiSupportedTypes> {
- if (input.api != null) {
+ if (input != null && input.api != null) {
if (typeof input.api === 'string') {
try {
input.api = input.api.toLowerCase()
// Assign debug if valid value passed
static #getValidDebug (input: Record<string, unknown>): boolean {
- if (input.debug != null) {
+ if (input != null && input.debug != null) {
if (typeof input.debug === 'bigint' || typeof input.debug === 'number') {
input.debug = input.debug.toString()
}
// Assign difficulty if valid value passed
static #getValidDifficulty (input: Record<string, unknown>): bigint {
- if (input.difficulty != null) {
+ if (input != null && input.difficulty != null) {
if (typeof input.difficulty === 'string') {
try {
input.difficulty = bigintFrom(input.difficulty, 'hex')
// Assign effort if valid value passed
static #getValidEffort (input: Record<string, unknown>): number {
- if (input.effort != null) {
+ if (input != null && input.effort != null) {
if (typeof input.effort !== 'number') {
throw new Error(`Invalid effort (${typeof input.effort})${input.effort}`)
}