diff options
author | iancoleman <1281387+iancoleman@users.noreply.github.com> | 2020-02-17 10:33:08 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-17 10:33:08 +1100 |
commit | ff2940e81e79658434ee851729f1f4eb8405b756 (patch) | |
tree | 965ec8664fe00d01c034bf4ce21b6a1bec64d9de | |
parent | 90f7a5ec9309c755dd06a534190067fa6f1f97fe (diff) | |
parent | f3101bd3f1a808ba2baa6969df2f0158b4b86b15 (diff) | |
download | BIP39-ff2940e81e79658434ee851729f1f4eb8405b756.tar.gz BIP39-ff2940e81e79658434ee851729f1f4eb8405b756.tar.zst BIP39-ff2940e81e79658434ee851729f1f4eb8405b756.zip |
Merge pull request #403 from swtcca/master
add two networks: Jingtum and MOAC
-rw-r--r-- | src/index.html | 1 | ||||
-rw-r--r-- | src/js/index.js | 21 | ||||
-rw-r--r-- | src/js/jingtum-util.js | 10 | ||||
-rw-r--r-- | tests/spec/tests.js | 20 |
4 files changed, 52 insertions, 0 deletions
diff --git a/src/index.html b/src/index.html index d486fa2..1184a0c 100644 --- a/src/index.html +++ b/src/index.html | |||
@@ -963,6 +963,7 @@ | |||
963 | <script src="js/bitcoinjs-extensions.js"></script> | 963 | <script src="js/bitcoinjs-extensions.js"></script> |
964 | <script src="js/segwit-parameters.js"></script> | 964 | <script src="js/segwit-parameters.js"></script> |
965 | <script src="js/ripple-util.js"></script> | 965 | <script src="js/ripple-util.js"></script> |
966 | <script src="js/jingtum-util.js"></script> | ||
966 | <script src="js/casinocoin-util.js"></script> | 967 | <script src="js/casinocoin-util.js"></script> |
967 | <script src="js/eos-util.js"></script> | 968 | <script src="js/eos-util.js"></script> |
968 | <script src="js/sjcl-bip39.js"></script> | 969 | <script src="js/sjcl-bip39.js"></script> |
diff --git a/src/js/index.js b/src/js/index.js index 3981e81..c2d34a7 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -1165,6 +1165,11 @@ | |||
1165 | privkey = convertRipplePriv(privkey); | 1165 | privkey = convertRipplePriv(privkey); |
1166 | address = convertRippleAdrr(address); | 1166 | address = convertRippleAdrr(address); |
1167 | } | 1167 | } |
1168 | // Jingtum values are different | ||
1169 | if (networks[DOM.network.val()].name == "SWTC - Jingtum") { | ||
1170 | privkey = convertJingtumPriv(privkey); | ||
1171 | address = convertJingtumAdrr(address); | ||
1172 | } | ||
1168 | // CasinoCoin values are different | 1173 | // CasinoCoin values are different |
1169 | if (networks[DOM.network.val()].name == "CSC - CasinoCoin") { | 1174 | if (networks[DOM.network.val()].name == "CSC - CasinoCoin") { |
1170 | privkey = convertCasinoCoinPriv(privkey); | 1175 | privkey = convertCasinoCoinPriv(privkey); |
@@ -1832,6 +1837,7 @@ | |||
1832 | || (name == "EWT - EnergyWeb") | 1837 | || (name == "EWT - EnergyWeb") |
1833 | || (name == "PIRL - Pirl") | 1838 | || (name == "PIRL - Pirl") |
1834 | || (name == "MIX - MIX") | 1839 | || (name == "MIX - MIX") |
1840 | || (name == "MOAC - MOAC") | ||
1835 | || (name == "MUSIC - Musicoin") | 1841 | || (name == "MUSIC - Musicoin") |
1836 | || (name == "POA - Poa") | 1842 | || (name == "POA - Poa") |
1837 | || (name == "EXP - Expanse") | 1843 | || (name == "EXP - Expanse") |
@@ -2739,6 +2745,14 @@ | |||
2739 | }, | 2745 | }, |
2740 | }, | 2746 | }, |
2741 | { | 2747 | { |
2748 | name: "MOAC - MOAC", | ||
2749 | segwitAvailable: false, | ||
2750 | onSelect: function() { | ||
2751 | network = libs.bitcoin.networks.bitcoin; | ||
2752 | setHdCoin(314); | ||
2753 | }, | ||
2754 | }, | ||
2755 | { | ||
2742 | name: "MUSIC - Musicoin", | 2756 | name: "MUSIC - Musicoin", |
2743 | segwitAvailable: false, | 2757 | segwitAvailable: false, |
2744 | onSelect: function() { | 2758 | onSelect: function() { |
@@ -3078,6 +3092,13 @@ | |||
3078 | }, | 3092 | }, |
3079 | }, | 3093 | }, |
3080 | { | 3094 | { |
3095 | name: "SWTC - Jingtum", | ||
3096 | onSelect: function() { | ||
3097 | network = libs.bitcoin.networks.bitcoin; | ||
3098 | setHdCoin(315); | ||
3099 | }, | ||
3100 | }, | ||
3101 | { | ||
3081 | name: "TSTRAT - Stratis Testnet", | 3102 | name: "TSTRAT - Stratis Testnet", |
3082 | onSelect: function() { | 3103 | onSelect: function() { |
3083 | network = libs.bitcoin.networks.stratistest; | 3104 | network = libs.bitcoin.networks.stratistest; |
diff --git a/src/js/jingtum-util.js b/src/js/jingtum-util.js new file mode 100644 index 0000000..56dbec6 --- /dev/null +++ b/src/js/jingtum-util.js | |||
@@ -0,0 +1,10 @@ | |||
1 | function convertJingtumAdrr(address) { | ||
2 | return libs.basex('jpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65rkm8oFqi1tuvAxyz').encode( | ||
3 | libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(address) | ||
4 | ) | ||
5 | } | ||
6 | |||
7 | function convertJingtumPriv(priv) { | ||
8 | return libs.basex('123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz').decode(priv).toString("hex").slice(2,66) | ||
9 | } | ||
10 | |||
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 6523ac5..31fa043 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js | |||
@@ -464,6 +464,16 @@ it('Allows selection of ripple', function(done) { | |||
464 | }; | 464 | }; |
465 | testNetwork(done, params); | 465 | testNetwork(done, params); |
466 | }); | 466 | }); |
467 | it('Allows selection of jingtum', function(done) { | ||
468 | var params = { | ||
469 | selectText: "SWTC - Jingtum", | ||
470 | 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", | ||
471 | firstAddress: "jffSYWyxcr9t6DHHdAj2yUXrCsioU66xjm", | ||
472 | firstPubKey: "029dfcb278148874dd7e7109001593d7f410909e7bbcbcc3cc19ecb476c8bf8d84", | ||
473 | firstPrivKey: "02bdfe14bdd75514e714db7b8cbbae87b2ab8d7a050c3e441d687b7c4ef17d1f", | ||
474 | }; | ||
475 | testNetwork(done, params); | ||
476 | }); | ||
467 | it('Allows selection of casinocoin', function(done) { | 477 | it('Allows selection of casinocoin', function(done) { |
468 | var params = { | 478 | var params = { |
469 | selectText: "CSC - CasinoCoin", | 479 | selectText: "CSC - CasinoCoin", |
@@ -1896,6 +1906,16 @@ it('Allows selection of Monkey Project', function(done) { | |||
1896 | testNetwork(done, params); | 1906 | testNetwork(done, params); |
1897 | }); | 1907 | }); |
1898 | 1908 | ||
1909 | it('Allows selection of MOAC', function(done) { | ||
1910 | var params = { | ||
1911 | selectText: "MOAC - MOAC", | ||
1912 | 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", | ||
1913 | firstAddress: "0xa1350EA5707247e0092Ab780A0CDbeA9c8C7Acb5", | ||
1914 | firstPubKey: "0x0376b024c6068c9fda7e91779e115dcd3a70584fd6984e6dd25da144c46ca259c6", | ||
1915 | firstPrivKey: "0x2515f9db03c1e56de393648eabf35d288f730aadce5d30865c52e72b28e303c9", | ||
1916 | }; | ||
1917 | testNetwork(done, params); | ||
1918 | }); | ||
1899 | it('Allows selection of Musicoin', function(done) { | 1919 | it('Allows selection of Musicoin', function(done) { |
1900 | var params = { | 1920 | var params = { |
1901 | selectText: "MUSIC - Musicoin", | 1921 | selectText: "MUSIC - Musicoin", |