diff --git a/src/js/index.js b/src/js/index.js index 0bc2506..4e55511 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1420,11 +1420,19 @@ } if (networks[DOM.network.val()].name == "ATOM - Cosmos Hub") { - address = CosmosBufferToAddress(keyPair.getPublicKeyBuffer()); - pubkey = CosmosBufferToPublic(keyPair.getPublicKeyBuffer()); + const hrp = "cosmos"; + address = CosmosBufferToAddress(keyPair.getPublicKeyBuffer(), hrp); + pubkey = CosmosBufferToPublic(keyPair.getPublicKeyBuffer(), hrp); privkey = keyPair.d.toBuffer().toString("base64"); } + if (networks[DOM.network.val()].name == "LUNA - Terra") { + const hrp = "terra"; + address = CosmosBufferToAddress(keyPair.getPublicKeyBuffer(), hrp); + pubkey = keyPair.getPublicKeyBuffer().toString("hex"); + privkey = keyPair.d.toBuffer().toString("hex"); + } + if (networks[DOM.network.val()].name == "IOV - Starname") { const hrp = "star"; address = CosmosBufferToAddress(keyPair.getPublicKeyBuffer(), hrp); @@ -2953,6 +2961,13 @@ setHdCoin(221); }, }, + { + name: "LUNA - Terra", + onSelect: function() { + network = libs.bitcoin.networks.bitcoin; + setHdCoin(330); + }, + }, { name: "LYNX - Lynx", onSelect: function() { diff --git a/tests/spec/tests.js b/tests/spec/tests.js index e33d618..3b8a053 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js @@ -927,6 +927,16 @@ it('Allows selection of Cosmos Hub', function(done) { }; testNetwork(done, params); }); +it('Allows selection of Terra', function(done) { + var params = { + selectText: "LUNA - Terra", + phrase: "abandon abandon ability", + firstAddress: "terra1txr4jwel3vjl64vrc08pljnjryqkhtffmyp265", + firstPubKey: "028e7658e3debb2d9d458919bfba0e85b0220e845f7552176f30a52acd0f809d71", + firstPrivKey: "d611b211e370aa1edd9743acd6ce537d16fade85d7ae7e88b32f3a0483f52535", + }; + testNetwork(done, params); +}); it('Allows selection of Auroracoin', function(done) { var params = { selectText: "AUR - Auroracoin",