Milan Steiner 4c8b278c1d
Create toBech32 and fromBech32 in @cosmjs/encoding (#1058)
* Create toBech32 and fromBech32

* Add changes to CHANGELOG.md

* Fix linting

* Update packages/encoding/src/bech32.ts

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Update CHANGELOG.md

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Update packages/encoding/src/bech32.ts

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Update bech32.ts

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
2022-02-22 14:05:34 +01:00
..
2021-05-19 15:40:06 +02:00
2022-02-20 22:57:01 +01:00
2021-05-18 15:16:03 +02:00
2021-03-11 15:38:48 +01:00
2021-05-20 13:37:43 +02:00

@cosmjs/encoding

npm version

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'

License

This package is part of the cosmjs repository, licensed under the Apache License 2.0 (see NOTICE and LICENSE).