aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoriancoleman <1281387+iancoleman@users.noreply.github.com>2019-08-01 10:02:07 +1000
committerGitHub <noreply@github.com>2019-08-01 10:02:07 +1000
commite440d504fbc80fe11366e24dccf945c43aaf52df (patch)
tree1bdd8b74a0ab6cb5c99365cd08d0a79c96f22003
parent786cd442cdb9f185b8b3fdcb8c54a9cb8fed9290 (diff)
parent45e40c288fe0d6cfba2c57a68f421eeb34d41385 (diff)
downloadBIP39-e440d504fbc80fe11366e24dccf945c43aaf52df.tar.gz
BIP39-e440d504fbc80fe11366e24dccf945c43aaf52df.tar.zst
BIP39-e440d504fbc80fe11366e24dccf945c43aaf52df.zip
Merge pull request #345 from flyfoxuk/master
Added CSC (CasinoCoin) with test
-rw-r--r--src/index.html1
-rw-r--r--src/js/casinocoin-util.js10
-rw-r--r--src/js/index.js12
-rw-r--r--tests/spec/tests.js8
4 files changed, 31 insertions, 0 deletions
diff --git a/src/index.html b/src/index.html
index 8cd4518..7dd3e9e 100644
--- a/src/index.html
+++ b/src/index.html
@@ -926,6 +926,7 @@
926 <script src="js/segwit-parameters.js"></script> 926 <script src="js/segwit-parameters.js"></script>
927 <script src="js/ethereumjs-util.js"></script> 927 <script src="js/ethereumjs-util.js"></script>
928 <script src="js/ripple-util.js"></script> 928 <script src="js/ripple-util.js"></script>
929 <script src="js/casinocoin-util.js"></script>
929 <script src="js/bchaddrjs-0.2.1.js"></script> 930 <script src="js/bchaddrjs-0.2.1.js"></script>
930 <script src="js/nebulas-account.js"></script> 931 <script src="js/nebulas-account.js"></script>
931 <script src="js/eos-util.js"></script> 932 <script src="js/eos-util.js"></script>
diff --git a/src/js/casinocoin-util.js b/src/js/casinocoin-util.js
new file mode 100644
index 0000000..f76e989
--- /dev/null
+++ b/src/js/casinocoin-util.js
@@ -0,0 +1,10 @@
1function convertCasinoCoinAdrr(address) {
2 return window.basex('cpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2brdeCg65jkm8oFqi1tuvAxyz').encode(
3 window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address)
4 )
5 }
6
7function convertCasinoCoinPriv(priv) {
8 return window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66)
9}
10
diff --git a/src/js/index.js b/src/js/index.js
index 3afa598..4fac6f1 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -959,6 +959,11 @@
959 privkey = convertRipplePriv(privkey); 959 privkey = convertRipplePriv(privkey);
960 address = convertRippleAdrr(address); 960 address = convertRippleAdrr(address);
961 } 961 }
962 // CasinoCoin values are different
963 if (networks[DOM.network.val()].name == "CSC - CasinoCoin") {
964 privkey = convertCasinoCoinPriv(privkey);
965 address = convertCasinoCoinAdrr(address);
966 }
962 // Bitcoin Cash address format may vary 967 // Bitcoin Cash address format may vary
963 if (networks[DOM.network.val()].name == "BCH - Bitcoin Cash") { 968 if (networks[DOM.network.val()].name == "BCH - Bitcoin Cash") {
964 var bchAddrType = DOM.bitcoinCashAddressType.filter(":checked").val(); 969 var bchAddrType = DOM.bitcoinCashAddressType.filter(":checked").val();
@@ -1931,6 +1936,13 @@
1931 }, 1936 },
1932 }, 1937 },
1933 { 1938 {
1939 name: "CSC - CasinoCoin",
1940 onSelect: function() {
1941 network = bitcoinjs.bitcoin.networks.bitcoin;
1942 setHdCoin(359);
1943 },
1944 },
1945 {
1934 name: "DASH - Dash", 1946 name: "DASH - Dash",
1935 onSelect: function() { 1947 onSelect: function() {
1936 network = bitcoinjs.bitcoin.networks.dash; 1948 network = bitcoinjs.bitcoin.networks.dash;
diff --git a/tests/spec/tests.js b/tests/spec/tests.js
index 91a9bec..6f9fd4f 100644
--- a/tests/spec/tests.js
+++ b/tests/spec/tests.js
@@ -434,6 +434,14 @@ it('Allows selection of ripple', function(done) {
434 }; 434 };
435 testNetwork(done, params); 435 testNetwork(done, params);
436}); 436});
437it('Allows selection of casinocoin', function(done) {
438 var params = {
439 selectText: "CSC - CasinoCoin",
440 firstAddress: "c3P5EUb27Pzk9dcGt4s7zQDQj4sC6Y81mT",
441 phrase: "ill clump only blind unit burden thing track silver cloth review awake useful craft whale all satisfy else trophy sunset walk vanish hope valve",
442 };
443 testNetwork(done, params);
444});
437it('Allows selection of dogecoin', function(done) { 445it('Allows selection of dogecoin', function(done) {
438 var params = { 446 var params = {
439 selectText: "DOGE - Dogecoin", 447 selectText: "DOGE - Dogecoin",