diff options
-rw-r--r-- | src/js/bitcoinjs-extensions.js | 37 | ||||
-rw-r--r-- | src/js/index.js | 27 | ||||
-rw-r--r-- | tests/spec/tests.js | 23 |
3 files changed, 82 insertions, 5 deletions
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js index 16e9385..f7e708b 100644 --- a/src/js/bitcoinjs-extensions.js +++ b/src/js/bitcoinjs-extensions.js | |||
@@ -47,14 +47,14 @@ bitcoinjs.bitcoin.networks.crown = { | |||
47 | 47 | ||
48 | var addrBytes = b58.decode(oldAddress); | 48 | var addrBytes = b58.decode(oldAddress); |
49 | 49 | ||
50 | var hash160 = new Uint16Array(23); | 50 | var hash160 = new Uint16Array(23); |
51 | hash160[0]= 0x01; //C | 51 | hash160[0]= 0x01; //C |
52 | hash160[1]= 0x75; //R | 52 | hash160[1]= 0x75; //R |
53 | hash160[2]= 0x07; //W | 53 | hash160[2]= 0x07; //W |
54 | addrBytes.copy(hash160, 3, 1, 21); | 54 | addrBytes.copy(hash160, 3, 1, 21); |
55 | 55 | ||
56 | var checksum = bitcoinjs.bitcoin.crypto.hash256(hash160).subarray(0, 4); | 56 | var checksum = bitcoinjs.bitcoin.crypto.hash256(hash160).subarray(0, 4); |
57 | var binaryAddr = new Uint16Array(27); | 57 | var binaryAddr = new Uint16Array(27); |
58 | binaryAddr.set(hash160,0); | 58 | binaryAddr.set(hash160,0); |
59 | checksum.copy(binaryAddr, 23, 0, 4); | 59 | checksum.copy(binaryAddr, 23, 0, 4); |
60 | var newAddress = b58.encode(binaryAddr); | 60 | var newAddress = b58.encode(binaryAddr); |
@@ -172,6 +172,17 @@ bitcoinjs.bitcoin.networks.dogecoin = { | |||
172 | wif: 0x9e | 172 | wif: 0x9e |
173 | }; | 173 | }; |
174 | 174 | ||
175 | bitcoinjs.bitcoin.networks.dogecointestnet = { | ||
176 | messagePrefix: '\x19Dogecoin Signed Message:\n', | ||
177 | bip32: { | ||
178 | public: 0x043587cf, | ||
179 | private: 0x04358394 | ||
180 | }, | ||
181 | pubKeyHash: 0x71, | ||
182 | scriptHash: 0xc4, | ||
183 | wif: 0xf1 | ||
184 | }; | ||
185 | |||
175 | bitcoinjs.bitcoin.networks.denarius = { | 186 | bitcoinjs.bitcoin.networks.denarius = { |
176 | messagePrefix: '\x19Denarius Signed Message:\n', | 187 | messagePrefix: '\x19Denarius Signed Message:\n', |
177 | bip32: { | 188 | bip32: { |
@@ -878,6 +889,17 @@ bitcoinjs.bitcoin.networks.linx = { | |||
878 | wif: 0xcb, | 889 | wif: 0xcb, |
879 | }; | 890 | }; |
880 | 891 | ||
892 | |||
893 | bitcoinjs.bitcoin.networks.litecointestnet = { | ||
894 | messagePrefix: '\x18Litecoin Signed Message:\n', | ||
895 | bip32: { | ||
896 | public: 0x043587cf, | ||
897 | private: 0x04358394, | ||
898 | }, | ||
899 | pubKeyHash: 0x6f, | ||
900 | scriptHash: 0xc4, | ||
901 | wif: 0xef, | ||
902 | }; | ||
881 | bitcoinjs.bitcoin.networks.litecoincash = { | 903 | bitcoinjs.bitcoin.networks.litecoincash = { |
882 | messagePrefix: '\x18Litecoin Signed Message:\n', | 904 | messagePrefix: '\x18Litecoin Signed Message:\n', |
883 | bip32: { | 905 | bip32: { |
@@ -1549,3 +1571,14 @@ bitcoinjs.bitcoin.networks.deeponion = { | |||
1549 | scriptHash: 0x4E, | 1571 | scriptHash: 0x4E, |
1550 | wif: 0x9F, | 1572 | wif: 0x9F, |
1551 | }; | 1573 | }; |
1574 | |||
1575 | bitcoinjs.bitcoin.networks.monkey = { | ||
1576 | messagePrefix: 'x18DarkNet Signed Message:\n', | ||
1577 | bip32: { | ||
1578 | public: 0x0488B21E, | ||
1579 | private: 0x0488ADE4, | ||
1580 | }, | ||
1581 | pubKeyHash: 0x7F, | ||
1582 | scriptHash: 0xC4, | ||
1583 | wif: 0x3F, | ||
1584 | }; | ||
diff --git a/src/js/index.js b/src/js/index.js index 3b3ebed..f54ff71 100644 --- a/src/js/index.js +++ b/src/js/index.js | |||
@@ -980,11 +980,12 @@ | |||
980 | address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network) | 980 | address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network) |
981 | } | 981 | } |
982 | } | 982 | } |
983 | 983 | ||
984 | if ((networks[DOM.network.val()].name == "CRW - Crown")) { | 984 | if ((networks[DOM.network.val()].name == "CRW - Crown")) { |
985 | address = bitcoinjs.bitcoin.networks.crown.toNewAddress(address); | 985 | address = bitcoinjs.bitcoin.networks.crown.toNewAddress(address); |
986 | } | 986 | } |
987 | if (networks[DOM.network.val()].name == "EOS - EOSIO") { | 987 | |
988 | if (networks[DOM.network.val()].name == "EOS - EOSIO") { | ||
988 | address = "" | 989 | address = "" |
989 | pubkey = eosUtil.bufferToPublic(keyPair.getPublicKeyBuffer()); | 990 | pubkey = eosUtil.bufferToPublic(keyPair.getPublicKeyBuffer()); |
990 | privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32)); | 991 | privkey = eosUtil.bufferToPrivate(keyPair.d.toBuffer(32)); |
@@ -1965,6 +1966,13 @@ | |||
1965 | }, | 1966 | }, |
1966 | }, | 1967 | }, |
1967 | { | 1968 | { |
1969 | name: "DOGEt - Dogecoin Testnet", | ||
1970 | onSelect: function() { | ||
1971 | network = bitcoinjs.bitcoin.networks.dogecointestnet; | ||
1972 | setHdCoin(1); | ||
1973 | }, | ||
1974 | }, | ||
1975 | { | ||
1968 | name: "DXN - DEXON", | 1976 | name: "DXN - DEXON", |
1969 | onSelect: function() { | 1977 | onSelect: function() { |
1970 | network = bitcoinjs.bitcoin.networks.bitcoin; | 1978 | network = bitcoinjs.bitcoin.networks.bitcoin; |
@@ -2225,6 +2233,14 @@ | |||
2225 | }, | 2233 | }, |
2226 | }, | 2234 | }, |
2227 | { | 2235 | { |
2236 | name: "LTCt - Litecoin Testnet", | ||
2237 | onSelect: function() { | ||
2238 | network = bitcoinjs.bitcoin.networks.litecointestnet; | ||
2239 | setHdCoin(1); | ||
2240 | DOM.litecoinLtubContainer.removeClass("hidden"); | ||
2241 | }, | ||
2242 | }, | ||
2243 | { | ||
2228 | name: "LTZ - LitecoinZ", | 2244 | name: "LTZ - LitecoinZ", |
2229 | onSelect: function() { | 2245 | onSelect: function() { |
2230 | network = bitcoinjs.bitcoin.networks.litecoinz; | 2246 | network = bitcoinjs.bitcoin.networks.litecoinz; |
@@ -2768,6 +2784,13 @@ | |||
2768 | setHdCoin(121); | 2784 | setHdCoin(121); |
2769 | }, | 2785 | }, |
2770 | }, | 2786 | }, |
2787 | { | ||
2788 | name: "MONK - Monkey Project", | ||
2789 | ` onSelect: function() { | ||
2790 | network = bitcoinjs.bitcoin.networks.monkey; | ||
2791 | setHdCoin(214); | ||
2792 | }, | ||
2793 | } | ||
2771 | ] | 2794 | ] |
2772 | 2795 | ||
2773 | var clients = [ | 2796 | var clients = [ |
diff --git a/tests/spec/tests.js b/tests/spec/tests.js index 3d72abd..2685fa6 100644 --- a/tests/spec/tests.js +++ b/tests/spec/tests.js | |||
@@ -419,6 +419,13 @@ it('Allows selection of litecoin', function(done) { | |||
419 | }; | 419 | }; |
420 | testNetwork(done, params); | 420 | testNetwork(done, params); |
421 | }); | 421 | }); |
422 | it('Allows selection of litecoin testnet', function(done) { | ||
423 | var params = { | ||
424 | selectText: "LTCt - Litecoin Testnet", | ||
425 | firstAddress: "mucaU5iiDaJDb69BHLeDv8JFfGiyg2nJKi", | ||
426 | }; | ||
427 | testNetwork(done, params); | ||
428 | }); | ||
422 | it('Allows selection of ripple', function(done) { | 429 | it('Allows selection of ripple', function(done) { |
423 | var params = { | 430 | var params = { |
424 | selectText: "XRP - Ripple", | 431 | selectText: "XRP - Ripple", |
@@ -434,6 +441,13 @@ it('Allows selection of dogecoin', function(done) { | |||
434 | }; | 441 | }; |
435 | testNetwork(done, params); | 442 | testNetwork(done, params); |
436 | }); | 443 | }); |
444 | it('Allows selection of dogecoin testnet', function(done) { | ||
445 | var params = { | ||
446 | selectText: "DOGEt - Dogecoin testnet", | ||
447 | firstAddress: "niHnSJKHdwDyDxRMLBJrtNqpvHEsAFWe6B", | ||
448 | }; | ||
449 | testNetwork(done, params); | ||
450 | }); | ||
437 | it('Allows selection of denarius', function(done) { | 451 | it('Allows selection of denarius', function(done) { |
438 | var params = { | 452 | var params = { |
439 | selectText: "DNR - Denarius", | 453 | selectText: "DNR - Denarius", |
@@ -486,7 +500,7 @@ it('Allows selection of clam', function(done) { | |||
486 | it('Allows selection of crown', function(done) { | 500 | it('Allows selection of crown', function(done) { |
487 | var params = { | 501 | var params = { |
488 | selectText: "CRW - Crown (Legacy)", | 502 | selectText: "CRW - Crown (Legacy)", |
489 | firstAddress: "18pWSwSUAQdiwMHUfFZB1fM2xue9X1FqE5", | 503 | firstAddress: "18pWSwSUAQdiwMHUfFZB1fM2xue9X1FqE5", |
490 | }; | 504 | }; |
491 | testNetwork(done, params); | 505 | testNetwork(done, params); |
492 | }); | 506 | }); |
@@ -1480,6 +1494,13 @@ it('Allows selection of Ethersocial Network', function(done) { | |||
1480 | }; | 1494 | }; |
1481 | testNetwork(done, params); | 1495 | testNetwork(done, params); |
1482 | }); | 1496 | }); |
1497 | it('Allows selection of Monkey Project', function(done) { | ||
1498 | var params = { | ||
1499 | selectText: "MONK - Monkey Project", | ||
1500 | firstAddress: "MnLrcnnUzKnf7TzufjRe5DLZqQJz18oYyu", | ||
1501 | }; | ||
1502 | testNetwork(done, params); | ||
1503 | }); | ||
1483 | 1504 | ||
1484 | // BIP39 seed is set from phrase | 1505 | // BIP39 seed is set from phrase |
1485 | it('Sets the bip39 seed from the prhase', function(done) { | 1506 | it('Sets the bip39 seed from the prhase', function(done) { |