Skip to content

Instantly share code, notes, and snippets.

@icodragon
icodragon / convertToDipAddress.js
Created September 12, 2022 21:21
Script that converts from an ethereum address to a ethermint cosmos project address
const { bech32 } = require('bech32')
function convertToDipAddress(eip55Address, prefix) {
const words = convertBits(hex2a(eip55Address), 8, 5, false);
return bech32.encode(prefix, words);
}
function hex2a(hex) {
let a = [];
if (hex.length <= 2) return a