Function convertDecStringToHexString

Arbitrary length decimal to hexadecimal conversion

Negative numbers are expressed as Two's Complement (https://en.wikipedia.org/wiki/Two's_complement)

Credits to AJ ONeal for the two's complements stuff https://coolaj86.com/articles/convert-decimal-to-hex-with-js-bigints/

  • Parameters

    • decimal: string | BigNumber

      A decimal string or BigNumber representation

    • padding: number = 2

      If set the hex string will be padded to given number, 8 or 16 or more

    Returns string

    A hexadecimal string