aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/js/bitcoinjs-extensions.js22
-rw-r--r--src/js/index.js12
2 files changed, 33 insertions, 1 deletions
diff --git a/src/js/bitcoinjs-extensions.js b/src/js/bitcoinjs-extensions.js
index 5347e83..e4eef0c 100644
--- a/src/js/bitcoinjs-extensions.js
+++ b/src/js/bitcoinjs-extensions.js
@@ -39,7 +39,27 @@ bitcoinjs.bitcoin.networks.crown = {
39 }, 39 },
40 pubKeyHash: 0x00, 40 pubKeyHash: 0x00,
41 scriptHash: 0x05, 41 scriptHash: 0x05,
42 wif: 0x80 42 wif: 0x80,
43 toNewAddress: function(oldAddress)
44 {
45 var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
46 var b58 = basex(ALPHABET);
47
48 var addrBytes = b58.decode(oldAddress);
49
50 var hash160 = new Uint16Array(23);
51 hash160[0]= 0x01; //C
52 hash160[1]= 0x75; //R
53 hash160[2]= 0x07; //W
54 addrBytes.copy(hash160, 3, 1, 21);
55
56 var checksum = bitcoinjs.bitcoin.crypto.hash256(hash160).subarray(0, 4);
57 var binaryAddr = new Uint16Array(27);
58 binaryAddr.set(hash160,0);
59 checksum.copy(binaryAddr, 23, 0, 4);
60 var newAddress = b58.encode(binaryAddr);
61 return newAddress;
62 }
43}; 63};
44 64
45bitcoinjs.bitcoin.networks.dash = { 65bitcoinjs.bitcoin.networks.dash = {
diff --git a/src/js/index.js b/src/js/index.js
index 057d709..8262947 100644
--- a/src/js/index.js
+++ b/src/js/index.js
@@ -977,6 +977,11 @@
977 address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network) 977 address = bitcoinjs.bitcoin.address.fromOutputScript(scriptpubkey, network)
978 } 978 }
979 } 979 }
980
981 if ((networks[DOM.network.val()].name == "CRW - Crown")) {
982 address = bitcoinjs.bitcoin.networks.crown.toNewAddress(address);
983 }
984
980 addAddressToList(indexText, address, pubkey, privkey); 985 addAddressToList(indexText, address, pubkey, privkey);
981 if (isLast) { 986 if (isLast) {
982 hidePending(); 987 hidePending();
@@ -1875,6 +1880,13 @@
1875 }, 1880 },
1876 }, 1881 },
1877 { 1882 {
1883 name: "CRW - Crown (Legacy)",
1884 onSelect: function() {
1885 network = bitcoinjs.bitcoin.networks.crown;
1886 setHdCoin(72);
1887 },
1888 },
1889 {
1878 name: "CRW - Crown", 1890 name: "CRW - Crown",
1879 onSelect: function() { 1891 onSelect: function() {
1880 network = bitcoinjs.bitcoin.networks.crown; 1892 network = bitcoinjs.bitcoin.networks.crown;