Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jasbanza/convert-bech32-address
Bech32 address converter library for node.js & JavaScript for browsers
https://github.com/jasbanza/convert-bech32-address
bech32 bip32 browser converter cryptocurrency javascript nodejs wallets-management zero-dependency
Last synced: 3 months ago
JSON representation
Bech32 address converter library for node.js & JavaScript for browsers
- Host: GitHub
- URL: https://github.com/jasbanza/convert-bech32-address
- Owner: jasbanza
- License: mit
- Created: 2021-11-21T18:48:40.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-22T14:41:45.000Z (over 1 year ago)
- Last Synced: 2024-10-28T14:51:02.832Z (3 months ago)
- Topics: bech32, bip32, browser, converter, cryptocurrency, javascript, nodejs, wallets-management, zero-dependency
- Language: JavaScript
- Homepage:
- Size: 77.1 KB
- Stars: 9
- Watchers: 1
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-ccamel - jasbanza/convert-bech32-address - Bech32 address converter library for node.js & JavaScript for browsers (JavaScript)
README
# convert-bech32-address
Zero dependancy bech32 address converter for node.js, including browser javascript version.Derives an address with a custom prefix, from a source BIP32 HD wallet address
### Install
From npm repo:
```bash
npm install convert-bech32-address
```
OR clone from GitHub repo:
```bash
git clone https://github.com/jasbanza/convert-bech32-address.git
```### Node.js Usage:
```js
var converter = require('./convert-bech32-address.js');var newAddress = converter.lookup('cosmos1r5qkmvn9hnv0pugejr73639w07d2mughnm7qxa','juno');
console.log(newAddress);
```### Node.js Test:
```bash
node example.js cosmos1r5qkmvn9hnv0pugejr73639w07d2mughnm7qxa juno
```
Output:
```bash
juno1r5qkmvn9hnv0pugejr73639w07d2mugh9fampp
```### Browser Usage:
- include the 3 javascript source files (OR the minified version: `script.min.js`) found in the `src` folder,
- calling the function: `lookup(address,prefix)` (found in `src\address.js`) will generate an address with a prefix derived from the source address### Live Browser Example:
- view [https://jasbanza.github.io/convert-bech32-address/](https://jasbanza.github.io/convert-bech32-address/) or git clone this repo, and open `index.html` in your browser.
- Enter any wallet address, e.g. `cosmos1aaaaa...zzzz` and the prefix of the target address, e.g. `akash`
- Click `Convert` and your target address will be generated: `akash1aaaaa...yyyy`