Options
All
  • Public
  • Public/Protected
  • All
Menu

@stacks/common

Common utilities used by Stacks.js packages.

Installation

npm install @stacks/common

Index

Type aliases

IntegerType

IntegerType: number | string | bigint | Uint8Array | BN

Variables

Const Buffer

Buffer: typeof NodeJSBuffer = ...

Functions

getBase64OutputLength

  • getBase64OutputLength(inputByteLength: number): number
  • Calculate the base64 encoded string length for a given input length. This is equivalent to the byte length when the string is ASCII or UTF8-8 encoded.

    Parameters

    • inputByteLength: number

    Returns number

hexToBigInt

  • hexToBigInt(hex: string): bigint
  • Converts hex input string to bigint

    example

    "6c7cde4d702830c1db34ef7c19e2776f59107afef39084776fc88bc78dbb9656"

    Parameters

    • hex: string

      hex input string without 0x prefix and in big endian format

    Returns bigint

intToBN

  • Parameters

    Returns BN

intToBigInt

  • intToBigInt(value: IntegerType, signed: boolean): bigint
  • Parameters

    Returns bigint

intToBytes

  • intToBytes(value: IntegerType, signed: boolean, byteLength: number): Buffer
  • Parameters

    • value: IntegerType
    • signed: boolean
    • byteLength: number

    Returns Buffer

utf8ToBytes

  • utf8ToBytes(content: string): Uint8Array
  • Parameters

    • content: string

    Returns Uint8Array

with0x

  • with0x(value: string): string
  • Parameters

    • value: string

    Returns string

Generated using TypeDoc