Interface that should be implemented by ABI serializable objects.

Implements

Constructors

Properties

array: Uint8Array
abiName: string = 'bytes'

Accessors

  • get hexString(): string
  • Hex string representation of this instance.

    Returns string

  • get length(): number
  • Number of bytes in this instance.

    Returns number

  • get utf8String(): string
  • UTF-8 string representation of this instance.

    Returns string

Methods

  • Mutating. Append bytes to this instance.

    Parameters

    • other: AnyBytes

    Returns void

  • Non-mutating, returns a copy of this instance with appended bytes.

    Parameters

    • other: AnyBytes

    Returns Bytes

  • Mutating. Drop bytes from the start of this instance.

    Parameters

    • n: number = 1

    Returns void

  • Non-mutating, returns a copy of this instance with dropped bytes from the start.

    Parameters

    • n: number = 1

    Returns Bytes

  • Mutating. Pad this instance to length.

    Parameters

    • n: number
    • truncate: boolean = false

    Returns void

  • Non-mutating, returns a copy of this instance with zeros padded.

    Parameters

    • n: number
    • truncate: boolean = false

    Returns Bytes

  • Create a new Bytes instance.

    Parameters

    Returns Bytes

    Note

    Make sure to take a [[copy]] before mutating the bytes as the underlying source is not copied here.