-
Notifications
You must be signed in to change notification settings - Fork 24
/
history.html
199 lines (183 loc) · 6.83 KB
/
history.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title id="pageTitle"></title>
<link rel="shortcut icon" href="img/xcpblackyellow.ico">
<link href="settings/styles.css" rel="stylesheet">
<script src="settings/general.txt"></script>
<script src="settings/assets.txt"></script>
<script src="settings/menu.txt"></script>
<script src="settings/encryptedpp.txt"></script>
<script src="settings/asset_list.txt"></script>
<script src="drawmenus.js"></script>
<script src="lib/jquery/jquery-2.1.4.js"></script>
<!--<script src="lib/cryptojs v3.1.2/rollups/aes.js"></script>-->
<script src="lib/cryptojs v3.1.2/rollups/sha256.js"></script>
<script src="lib/seedrandom/seedrandom.min.js"></script>
<script src="lib/chrome-wallet-mod/js/bitcore/bitcore.min.js"></script>
<script src="lib/xcp-toolbox/passphrase.js"></script>
<script src="lib/xcp-toolbox/password.js"></script>
<script src="lib/xcp-toolbox/api.js"></script>
<script src="lib/xcp-toolbox/misc.js"></script>
<script src="lib/qrcodejs/qrcode.js"></script>
<script src="lib/chrome-wallet-mod/js/aes.js"></script>
<script src="lib/chrome-wallet-mod/tipsplash.js"></script>
<script src="lib/chrome-wallet-mod/issueticker.js"></script>
<script src="lib/chrome-wallet-mod/js/mnemonic.js"></script>
<script src="lib/chrome-wallet-mod/js/utxo.js"></script>
<script src="lib/chrome-wallet-mod/js/xcp-js/transactions.js"></script>
<script src="lib/chrome-wallet-mod/js/xcp-js/issuance.js"></script>
<script src="lib/chrome-wallet-mod/js/xcp-js/rc4.js"></script>
<script src="lib/chrome-wallet-mod/js/xcp-js/convert-type.js"></script>
<script src="lib/chrome-wallet-mod/js/xcp-js/decode.js"></script>
<script src="lib/chrome-wallet-mod/js/biginteger.js"></script>
<script src="lib/chrome-wallet-mod/js/hex2dec-cs.js"></script>
<!--<script src="lib/chrome-wallet-mod/js/brainlite.js"></script>-->
<script src="lib/chrome-wallet-mod/js/bitcoinsig.js"></script>
<script src="lib/chrome-wallet-mod/js/bitcoinjs-min.js"></script>
<script src="lib/chrome-wallet-mod/js/detect.js"></script>
<script src="lib/cryptojs v3.1.2/components/enc-base64-min.js"></script>
<style>
section table {
border-collapse: collapse;
width:100%;
}
section th {
background-color: Silver;
}
section td {
font-family: "Lucida Console", Monaco, monospace;
}
section th {
padding:4px 7px 4px 7px; /*top right bottom left*/
text-align:left;
}
section td {
padding:3px 7px 3px 7px; /*top right bottom left*/
text-align:left;
}
section #transactions th:nth-child(3) {
text-align:center;
}
section #transactions td:nth-child(3) {
text-align:right;
}
section #broadcasts th:nth-child(3) {
text-align:center;
}
section #broadcasts td:nth-child(3) {
text-align:right;
}
section #broadcasts th:nth-child(4) {
text-align:center;
}
section #broadcasts td:nth-child(4) {
text-align:right;
}
section tr:nth-child(even) {
background-color: PeachPuff;
}
section tr:nth-child(odd) {
background-color: LightBlue;
}
section a {
text-decoration:none;
color:inherit;
}
</style>
<script>
function initalize() {
var numAddr = Math.min(NUM_ADDR_DISPLAY, MY_ADDR.length);
var optionsList = "<select id=\"viewaddress\" onchange=\"showHistory()\">";
for(i=0; i < numAddr; i++) {
optionsList += "<option>"+MY_ADDR[i]+"</option>";
}
optionsList += "</select>";
document.getElementById('optionslist').innerHTML = optionsList;
updateBoxInfo(MY_ADDR[0]);
showHistory(MY_ADDR[0]);
}
function showHistory() {
var e = document.getElementById("viewaddress");
var address = e.options[e.selectedIndex].text;
updateBoxInfo(address);
var output = '';
var historyTx = getTransactionHistory(address);
output += "<h2>Latest Transactions</h2><table id=\"transactions\"><tr><th>Time</th><th>Type</th><th>Amount</th><th>Asset</th><th>To/From</th></tr>";
if (historyTx == '?') {
output += "<tr><td colspan=\"5\">API call failed. Please try again later.</td></tr>";
} else if (historyTx == 'none') {
output += "<tr><td colspan=\"5\">No transactions recorded</td></tr>";
} else {
var timeNow = new Date();
var today = timeNow.toDateString();
for(var i=0; i < historyTx.length; i++){
output += "<tr>";
//output += "<td>"+historyTx[i].block+"</td>";
var date = new Date(historyTx[i].time*1000);
if (date.toDateString() == today) {
output += "<td>"+date.toLocaleTimeString()+"</td>";
} else {
output += "<td>"+date.toLocaleDateString()+"</td>";
}
if (historyTx[i].amount > 0) {
output += "<td>Receive</td>";
} else {
output += "<td>Send</td>";
}
output += "<td>"+walletFormat(Math.abs(historyTx[i].amount))+"</td>";
output += "<td><a href=\"https://counterpartychain.io/asset/"+historyTx[i].asset+"\" target=\"_blank\">"+assetReadable(historyTx[i].asset,4,2,'..',10)+"</a></td>";
output += "<td><a href=\"http://blockscan.com/address?q="+historyTx[i].address+"\" target=\"_blank\">"+addressReadable(historyTx[i].address,5,2)+"</a></td>";
output += "</tr>";
}
}
output += "</table>";
var historyBc = getBroadcastHistory(address);
output += " <br> <br><h2>Latest Broadcasts</h2><table id=\"broadcasts\"><tr><th>Time</th><th>Text</th><th>Value</th><th>Fee</th></tr>";
if (historyBc == '?') {
output += "<tr><td colspan=\"4\">API call failed. Please try again later.</td></tr>";
} else if (historyBc == 'none') {
output += "<tr><td colspan=\"4\">No broadcasts recorded</td></tr>";
} else {
var timeNow = new Date();
var today = timeNow.toDateString();
for(var i=0; i < historyBc.length; i++){
output += "<tr>";
//output += "<td>"+historyBc[i].block+"</td>";
var date = new Date(historyBc[i].time*1000);
if (date.toDateString() == today) {
output += "<td>"+date.toLocaleTimeString()+"</td>";
} else {
output += "<td>"+date.toLocaleDateString()+"</td>";
}
output += "<td>"+historyBc[i].text.substring(0,46)+"</td>";
output += "<td>"+displayNumber(historyBc[i].value, 2)+"</td>";
output += "<td>"+(historyBc[i].fee*100).toFixed(2)+"%</td>";
output += "</tr>";
}
}
output += "</table> <br> <br>";
document.getElementById('addresshistory').innerHTML = output;
}
function updateBoxInfo(address) {
var output = "View the most recent transactions and broadcasts.<br><br>Go to <u><a href=\"http://blockscan.com/address?q="+address+"\" target=\"_blank\">Blockscan</a></u> or <u><a href=\"https://counterpartychain.io/address/"+address+"\" target=\"_blank\">Counterpartychain</a></u> for a more extensive history.";
document.getElementById('infobox').innerHTML = output;
}
</script>
</head>
<body onload="drawMenus();initalize();">
<div id="container">
<header id="topHeader"></header>
<nav id="leftMenu"></nav>
<section id="mainSection">
<div class="boxInfo" id="infobox"> </div>
<h1>Address History</h1>
Select Address<br>
<span id="optionslist"></span><br>
<div id="addresshistory"> </div>
</section>
<footer id="bottomFooter"></footer>
</div>
</body>
</html>