convert-bech32-address
Version:
Zero dependancy bech32 address converter for node.js, including browser javascript version.
46 lines (40 loc) • 1.23 kB
HTML
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="./convert-bech32-address-browser.js"></script><!-- include this file in browser.-->
<title>Test convert</title>
</head>
<body>
<style>
label {
display: inline-block;
width: 150px;
}
input {
width: 200px;
}
</style>
<label for="address">Source address: </label>
<input type="text" name="address" id="address" value="" placeholder="cosmos1....">
<br>
<label for="prefix">new address prefix:</label>
<input type="text" name="prefix" id="prefix" value="" placeholder="akash / sent / osmo / ...">
<br>
<br>
<button type="button" name="button" onclick="btnConvert_onClick()">Convert</button>
<br>
<br>
Output:
<div id="output">
</div>
<script type="text/javascript">
function btnConvert_onClick() {
var address = document.getElementById("address").value;
var prefix = document.getElementById("prefix").value;
var output = lookup(address, prefix); // use this "lookup" function in browser
document.getElementById("output").innerHTML = output;
}
</script>
</body>
</html>