Skip to main content

utils

Index

Functions

abiSchemaToJsonSchema

codePointToInt

  • codePointToInt(codePoint: number): number
  • Code points to int


    Parameters

    • codePoint: number

    Returns number

ensureIfUint8Array

  • ensureIfUint8Array<T>(data: T): Uint8Array | T
  • Type parameters

    • T = any

    Parameters

    • data: T

    Returns Uint8Array | T

ethAbiToJsonSchema

fetchArrayElement

  • fetchArrayElement(data: unknown[], level: number): unknown
  • Parameters

    • data: unknown[]
    • level: number

    Returns unknown

hexToNumber

  • hexToNumber(value: string): number | bigint
  • Converts value to it's number representation


    Parameters

    • value: string

    Returns number | bigint

hexToUint8Array

  • hexToUint8Array(hex: string): Uint8Array
  • Parameters

    • hex: string

    Returns Uint8Array

numberToHex

  • Converts value to it's hex representation


    Parameters

    Returns string

padLeft

  • padLeft(value: ValidInputTypes, characterAmount: number, sign?: string): string
  • Adds a padding on the left of a string, if value is a integer or bigInt will be converted to a hex string.


    Parameters

    Returns string

parseBaseType

  • parseBaseType<T>(type: string): { arraySizes: number[]; baseType?: T; baseTypeSize: undefined | number; isArray: boolean }
  • Type parameters

    • T = string

    Parameters

    • type: string

    Returns { arraySizes: number[]; baseType?: T; baseTypeSize: undefined | number; isArray: boolean }

    • arraySizes: number[]
    • optionalbaseType?: T
    • baseTypeSize: undefined | number
    • isArray: boolean

transformJsonDataToAbiFormat

  • transformJsonDataToAbiFormat(abis: FullValidationSchema, data: Record<string, unknown> | readonly unknown[], transformedData?: unknown[]): unknown[]
  • Parameters

    • abis: FullValidationSchema
    • data: Record<string, unknown> | readonly unknown[]
    • optionaltransformedData: unknown[]

    Returns unknown[]

uint8ArrayToHexString

  • uint8ArrayToHexString(uint8Array: Uint8Array): string
  • Parameters

    • uint8Array: Uint8Array

    Returns string