aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/index.html1
-rw-r--r--src/js/cosmos-util.js13
-rw-r--r--src/js/index.js13
3 files changed, 27 insertions, 0 deletions
diff --git a/src/index.html b/src/index.html
index 4b61424..34b43ec 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1101,6 +1101,7 @@
1101 <script src="js/ripple-util.js"></script> 1101 <script src="js/ripple-util.js"></script>
1102 <script src="js/jingtum-util.js"></script> 1102 <script src="js/jingtum-util.js"></script>
1103 <script src="js/casinocoin-util.js"></script> 1103 <script src="js/casinocoin-util.js"></script>
1104 <script src="js/cosmos-util.js"></script>
1104 <script src="js/eos-util.js"></script> 1105 <script src="js/eos-util.js"></script>
1105 <script src="js/fio-util.js"></script> 1106 <script src="js/fio-util.js"></script>
1106 <script src="js/sjcl-bip39.js"></script> 1107 <script src="js/sjcl-bip39.js"></script>
diff --git a/src/js/cosmos-util.js b/src/js/cosmos-util.js
new file mode 100644
index 0000000..a7f4605
--- /dev/null
+++ b/src/js/cosmos-util.js
@@ -0,0 +1,13 @@
1function CosmosBufferToPublic(pubBuf) {
2 const Buffer = libs.buffer.Buffer;
3 const AminoSecp256k1PubkeyPrefix = Buffer.from("EB5AE987", "hex");
4 const AminoSecp256k1PubkeyLength = Buffer.from("21", "hex");
5 pubBuf = Buffer.concat([AminoSecp256k1PubkeyPrefix, AminoSecp256k1PubkeyLength, pubBuf]);
6 return libs.bech32.encode("cosmospub", libs.bech32.toWords(pubBuf));
7}
8
9function CosmosBufferToAddress(pubBuf) {
10 const sha256_ed = libs.createHash("sha256").update(pubBuf).digest();
11 const ripemd160_ed = libs.createHash("rmd160").update(sha256_ed).digest();
12 return libs.bech32.encode("cosmos", libs.bech32.toWords(ripemd160_ed));
13}
diff --git a/src/js/index.js b/src/js/index.js
index 713b5e8..96fc451 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -1419,6 +1419,12 @@
1419 privkey = FIObufferToPrivate(keyPair.d.toBuffer(32)); 1419 privkey = FIObufferToPrivate(keyPair.d.toBuffer(32));
1420 } 1420 }
1421 1421
1422 if (networks[DOM.network.val()].name == "ATOM - Cosmos Hub") {
1423 address = CosmosBufferToAddress(keyPair.getPublicKeyBuffer());
1424 pubkey = CosmosBufferToPublic(keyPair.getPublicKeyBuffer());
1425 privkey = keyPair.d.toBuffer().toString("base64");
1426 }
1427
1422 //Groestlcoin Addresses are different 1428 //Groestlcoin Addresses are different
1423 if(isGRS()) { 1429 if(isGRS()) {
1424 1430
@@ -2235,6 +2241,13 @@
2235 }, 2241 },
2236 }, 2242 },
2237 { 2243 {
2244 name: "ATOM - Cosmos Hub",
2245 onSelect: function() {
2246 network = libs.bitcoin.networks.bitcoin;
2247 setHdCoin(118);
2248 },
2249 },
2250 {
2238 name: "AUR - Auroracoin", 2251 name: "AUR - Auroracoin",
2239 onSelect: function() { 2252 onSelect: function() {
2240 network = libs.bitcoin.networks.auroracoin; 2253 network = libs.bitcoin.networks.auroracoin;