JSPM

  • Created
  • Published
  • Downloads 2965
  • Score
    100M100P100Q121762F
  • License Apache-2.0

Encoding helpers for blockchain projects

Package Exports

  • @interchainjs/encoding
  • @interchainjs/encoding/esm/index.js
  • @interchainjs/encoding/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@interchainjs/encoding) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@interchainjs/encoding

This package is an extension to the JavaScript standard library that is not bound to blockchain products. It provides basic hex/base64/ascii encoding to Uint8Array that doesn't rely on Buffer and also provides better error messages on invalid input.

Convert between bech32 and hex addresses

>> toBech32("tiov", fromHex("1234ABCD0000AA0000FFFF0000AA00001234ABCD"))
'tiov1zg62hngqqz4qqq8lluqqp2sqqqfrf27dzrrmea'
>> toHex(fromBech32("tiov1zg62hngqqz4qqq8lluqqp2sqqqfrf27dzrrmea").data)
'1234abcd0000aa0000ffff0000aa00001234abcd'