Options
All
  • Public
  • Public/Protected
  • All
Menu

@cosmjs/encoding Documentation

Index

Functions

  • fromAscii(data: Uint8Array): string
  • Parameters

    • data: Uint8Array

    Returns string

  • fromBase64(base64String: string): Uint8Array
  • Parameters

    • base64String: string

    Returns Uint8Array

  • fromBech32(address: string, limit?: number): { data: Uint8Array; prefix: string }
  • Parameters

    • address: string
    • limit: number = Infinity

    Returns { data: Uint8Array; prefix: string }

    • Readonly data: Uint8Array
    • Readonly prefix: string
  • fromHex(hexstring: string): Uint8Array
  • Parameters

    • hexstring: string

    Returns Uint8Array

  • fromRfc3339(str: string): Date
  • fromUtf8(data: Uint8Array, lossy?: boolean): string
  • Takes UTF-8 data and decodes it to a string.

    In lossy mode, the replacement character � is used to substitude invalid encodings. By default lossy mode is off and invalid data will lead to exceptions.

    Parameters

    • data: Uint8Array
    • lossy: boolean = false

    Returns string

  • normalizeBech32(address: string): string
  • Takes a bech32 address and returns a normalized (i.e. lower case) representation of it.

    The input is validated along the way, which makes this significantly safer than using address.toLowerCase().

    Parameters

    • address: string

    Returns string

  • toAscii(input: string): Uint8Array
  • Parameters

    • input: string

    Returns Uint8Array

  • toBase64(data: Uint8Array): string
  • Parameters

    • data: Uint8Array

    Returns string

  • toBech32(prefix: string, data: Uint8Array, limit?: number): string
  • Parameters

    • prefix: string
    • data: Uint8Array
    • Optional limit: number

    Returns string

  • toHex(data: Uint8Array): string
  • Parameters

    • data: Uint8Array

    Returns string

  • toRfc3339(date: Date | ReadonlyDate): string
  • Parameters

    • date: Date | ReadonlyDate

    Returns string

  • toUtf8(str: string): Uint8Array
  • Parameters

    • str: string

    Returns Uint8Array

Generated using TypeDoc