diff options
author | Chris <chris@SFLiMac.connect> | 2019-07-18 11:50:14 +0100 |
---|---|---|
committer | Chris <chris@SFLiMac.connect> | 2019-07-18 11:50:14 +0100 |
commit | 45e40c288fe0d6cfba2c57a68f421eeb34d41385 (patch) | |
tree | 9a1a9ce811dd5b6144a151a6bfa0c9dd2c625904 | |
parent | c4f4208b95cf6fb85a8d669c0c8dcdb8b12bb2e7 (diff) | |
download | BIP39-45e40c288fe0d6cfba2c57a68f421eeb34d41385.tar.gz BIP39-45e40c288fe0d6cfba2c57a68f421eeb34d41385.tar.zst BIP39-45e40c288fe0d6cfba2c57a68f421eeb34d41385.zip |
Added CSC (CasinoCoin) with test
-rw-r--r-- | src/index.html | 1 | ||||
-rw-r--r-- | src/js/casinocoin-util.js | 10 | ||||
-rw-r--r-- | src/js/index.js | 12 | ||||
-rw-r--r-- | tests/spec/tests.js | 8 |
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 @@ | |||
1 | function convertCasinoCoinAdrr(address) { | ||
2 | return window.basex('cpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2brdeCg65jkm8oFqi1tuvAxyz').encode( | ||
3 | window.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address) | ||
4 | ) | ||
5 | } | ||
6 | |||
7 | function 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 52b0db5..bda124c 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(); |
@@ -1924,6 +1929,13 @@ | |||
1924 | }, | 1929 | }, |
1925 | }, | 1930 | }, |
1926 | { | 1931 | { |
1932 | name: "CSC - CasinoCoin", | ||
1933 | onSelect: function() { | ||
1934 | network = bitcoinjs.bitcoin.networks.bitcoin; | ||
1935 | setHdCoin(359); | ||
1936 | }, | ||
1937 | }, | ||
1938 | { | ||
1927 | name: "DASH - Dash", | 1939 | name: "DASH - Dash", |
1928 | onSelect: function() { | 1940 | onSelect: function() { |
1929 | network = bitcoinjs.bitcoin.networks.dash; | 1941 | network = bitcoinjs.bitcoin.networks.dash; |
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index dd90a66..c21d8b5 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 | }); |
437 | it('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 | }); | ||
437 | it('Allows selection of dogecoin', function(done) { | 445 | it('Allows selection of dogecoin', function(done) { |
438 | var params = { | 446 | var params = { |
439 | selectText: "DOGE - Dogecoin", | 447 | selectText: "DOGE - Dogecoin", |