github.com/inklabsfoundation/inkchain@v0.17.1-0.20181025012015-c3cef8062f19/examples/xc/qtum/dapp/public/index.html (about) 1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>XC TEST</title> 6 <script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"> 7 </script> 8 </head> 9 <body> 10 <div style="border:1px #0d47a1 solid;padding: 20px;"> 11 <h2>INIT</h2> 12 <label style="width: 200px;display: inline-block;">platform:</label> 13 <select style="width: 500px;" id="platform" name="platform"> 14 <option value="494e4b0000000000000000000000000000000000000000000000000000000000"> 15 INK:494e4b0000000000000000000000000000000000000000000000000000000000 16 </option> 17 <option disabled value="494e4b0000000000000000000000000000000000000000000000000000000000"> 18 A:4100000000000000000000000000000000000000000000000000000000000000 19 </option> 20 </select><br/> 21 <label style="width: 200px;display: inline-block;">publicKey:</label> 22 <input style="width: 500px;" readonly name="publicKey" 23 value="4230a12f5b0693dd88bb35c79d7e56a68614b199"/><br/> 24 <label style="width: 200px;display: inline-block;">publicKey2:</label> 25 <input style="width: 500px;" readonly name="publicKey2" 26 value="07caf88941eafcaaa3370657fccc261acb75dfba"/><br/> 27 <button id="submit1">Submit</button> 28 </div> 29 <br/> 30 <div style="border:1px #0d47a1 solid;padding: 20px;"> 31 <h2>OUT</h2> 32 <label style="width: 200px;display: inline-block;">fromPlatform:</label> 33 <input style="width: 500px;" readonly name="fromPlatform" 34 value="QTUM:5154554d00000000000000000000000000000000000000000000000000000000"/><br/> 35 <label style="width: 200px;display: inline-block;">fromAccount:</label> 36 <input style="width: 500px;" readonly name="fromAccount" 37 value="INK.sender"/><br/> 38 <label style="width: 200px;display: inline-block;">toPlatform:</label> 39 <select style="width: 500px;" id="toPlatform" name="toPlatform"> 40 <option value="494e4b0000000000000000000000000000000000000000000000000000000000"> 41 INK:494e4b0000000000000000000000000000000000000000000000000000000000 42 </option> 43 <option disabled value="494e4b0000000000000000000000000000000000000000000000000000000000"> 44 A:4100000000000000000000000000000000000000000000000000000000000000 45 </option> 46 </select><br/> 47 <label style="width: 200px;display: inline-block;">toAccount:</label> 48 <input style="width: 500px;" name="toAccount" 49 value="d6b39eb631df8ee60e46a576231ccf1fcd204a5e"/><br/> 50 <label style="width: 200px;display: inline-block;">value:</label> 51 <input style="width: 500px;" name="value" value="10000"/><br/> 52 <button id="submit2">Submit</button> 53 </div> 54 <br/> 55 56 <div style="border:1px #0d47a1 solid;padding: 20px;"> 57 <h2>IN</h2> 58 <label style="width: 200px;display: inline-block;">fromPlatform:</label> 59 <select style="width: 500px;" id="fromPlatform2" name="fromPlatform2"> 60 <option value="494e4b0000000000000000000000000000000000000000000000000000000000"> 61 INK:494e4b0000000000000000000000000000000000000000000000000000000000 62 </option> 63 <option disabled value="4100000000000000000000000000000000000000000000000000000000000000"> 64 A:4100000000000000000000000000000000000000000000000000000000000000 65 </option> 66 </select><br/> 67 <label style="width: 200px;display: inline-block;">fromAccount:</label> 68 <input style="width: 500px;" name="fromAccount2" 69 value="4230a12f5b0693dd88bb35c79d7e56a68614b199"/><br/> 70 <label style="width: 200px;display: inline-block;">toPlatform:</label> 71 <input style="width: 500px;" readonly name="toPlatform2" 72 value="QTUM:5154554d00000000000000000000000000000000000000000000000000000000"/><br/> 73 <label style="width: 200px;display: inline-block;">toAccount:</label> 74 <input style="width: 500px;" name="toAccount2" 75 value="42cae74a99da4cea4c1c6b9e783f858aa9fe16bb"/><br/> 76 <label style="width: 200px;display: inline-block;">value: </label> 77 <input style="width: 500px;" name="value2" value="500"/><br/> 78 <label style="width: 200px;display: inline-block;">txid:</label> 79 <input style="width: 500px;" name="txid" 80 value="ec286f7dd3463a6a9c5384747bc64a8685de44b2c3d3a1156dc0085f758fcd28"/><br/> 81 <label style="width: 200px;display: inline-block;">sign:</label> 82 <input style="width: 500px;" name="sign" 83 value="c7ecd49384a51d5fb610423a30dfcbc963645c1dc37ddab598cb89555d9110f25d9569fdaafe9a3928649c32806332f4716ccc9fdd740cf6ef8678b97258653e00"/><br/> 84 <button id="submit3">complete Submit</button> 85 <br/> 86 { 87 <button id="voter">voter</button> 88 <button id="verifyProposal">verifyProposal</button> 89 <button id="unlock">unlock</button> } 90 </div> 91 <br/> 92 <div style="border:1px #0d47a1 solid;padding: 20px;"> 93 <h2>LockBalance</h2> 94 <button id="LockBalance">LockBalance</button> 95 </div> 96 <br/> 97 <div style="border:1px #0d47a1 solid;padding: 20px;"> 98 <h2>balanceOf</h2> 99 <label style="width: 200px;display: inline-block;">account:</label> 100 <input style="width: 500px;" name="account" 101 value="42cae74a99da4cea4c1c6b9e783f858aa9fe16bb"/><br/> 102 <button id="balanceOf">balanceOf</button> 103 </div> 104 <br/> 105 <div style="border:1px #0d47a1 solid;padding: 20px;"> 106 <h2>setWeight</h2> 107 <label style="width: 200px;display: inline-block;">platformName:</label> 108 <input style="width: 500px;" readonly name="platformName" 109 value="INK:494e4b0000000000000000000000000000000000000000000000000000000000"/><br/> 110 <label style="width: 200px;display: inline-block;">weight:</label> 111 <input style="width: 500px;" name="weight" 112 value=""/><br/> 113 <button id="setWeight">setWeight</button> 114 </div> 115 <br/> 116 <div style="border:1px #0d47a1 solid;padding: 20px;"> 117 <h2>getWeight</h2> 118 <label style="width: 200px;display: inline-block;">platformName:</label> 119 <input style="width: 500px;" readonly name="platformName" 120 value="INK:494e4b0000000000000000000000000000000000000000000000000000000000"/><br/> 121 <button id="getWeight">getWeight</button> 122 </div> 123 </body> 124 <script> 125 $(function () { 126 $("#submit1").click(function () { 127 var platform = $.trim($("select[name=platform]").find("option:selected").text()); 128 platform = platform.substr(platform.length - 64, 64) 129 var publicKey = $.trim($("input[name=publicKey]").val()) 130 var publicKey2 = $.trim($("input[name=publicKey2]").val()) 131 132 $.post("/xc/init", { 133 platform: platform, 134 publicKey: publicKey, 135 publicKey2: publicKey2 136 }, function (data, status) { 137 alert("数据: \n" + data + "\n状态: " + status); 138 }); 139 }); 140 $("#submit2").click(function () { 141 var toPlatform = $.trim($("select[name=toPlatform]").find("option:selected").text()); 142 toPlatform = toPlatform.substr(toPlatform.length - 64, 64) 143 var toAccount = $.trim($("input[name=toAccount]").val()) 144 var value = $("input[name=value]").val() 145 $.post("/xc/out", { 146 toPlatform: toPlatform, 147 toAccount: toAccount, 148 value: value 149 }, function (data, status) { 150 alert("数据: \n" + data + "\n状态: " + status); 151 }); 152 }); 153 $("#submit3").click(function () { 154 var fromPlatform = $.trim($("select[name=fromPlatform2]").find("option:selected").text()); 155 fromPlatform = fromPlatform.substr(fromPlatform.length - 64, 64) 156 // alert(fromPlatform) 157 var fromAccount = $.trim($("input[name=fromAccount2]").val()) 158 // alert(fromAccount) 159 var toAccount = $.trim($("input[name=toAccount2]").val()) 160 // alert(toAccount) 161 var value = $("input[name=value2]").val() 162 // alert(value) 163 var txid = $.trim($("input[name=txid]").val()) 164 // alert(txid) 165 var sign = $.trim($("input[name=sign]").val()) 166 167 $.post("/xc/in", { 168 fromPlatform: fromPlatform, 169 fromAccount: fromAccount, 170 toAccount: toAccount, 171 value: value, 172 txid: txid, 173 sign: sign, 174 }, function (data, status) { 175 alert("Data: \n" + data + "\nStatus: " + status); 176 }); 177 }); 178 179 $("#voter").click(function () { 180 var fromPlatform = $.trim($("select[name=fromPlatform2]").find("option:selected").text()); 181 fromPlatform = fromPlatform.substr(fromPlatform.length - 64, 64) 182 // alert(fromPlatform) 183 var fromAccount = $.trim($("input[name=fromAccount2]").val()) 184 // alert(fromAccount) 185 var toAccount = $.trim($("input[name=toAccount2]").val()) 186 // alert(toAccount) 187 var value = $("input[name=value2]").val() 188 // alert(value) 189 var txid = $.trim($("input[name=txid]").val()) 190 // alert(txid) 191 var sign = $.trim($("input[name=sign]").val()) 192 193 $.post("/xc/voter", { 194 fromPlatform: fromPlatform, 195 fromAccount: fromAccount, 196 toAccount: toAccount, 197 value: value, 198 txid: txid, 199 sign: sign, 200 }, function (data, status) { 201 alert("Data: \n" + data + "\nStatus: " + status); 202 }); 203 }); 204 205 $("#verifyProposal").click(function () { 206 var fromPlatform = $.trim($("select[name=fromPlatform2]").find("option:selected").text()); 207 fromPlatform = fromPlatform.substr(fromPlatform.length - 64, 64) 208 // alert(fromPlatform) 209 var fromAccount = $.trim($("input[name=fromAccount2]").val()) 210 // alert(fromAccount) 211 var toAccount = $.trim($("input[name=toAccount2]").val()) 212 // alert(toAccount) 213 var value = $("input[name=value2]").val() 214 // alert(value) 215 var txid = $.trim($("input[name=txid]").val()) 216 // alert(txid) 217 var sign = $.trim($("input[name=sign]").val()) 218 219 $.post("/xc/verifyProposal", { 220 fromPlatform: fromPlatform, 221 fromAccount: fromAccount, 222 toAccount: toAccount, 223 value: value, 224 txid: txid, 225 sign: sign, 226 }, function (data, status) { 227 alert("Data: \n" + data + "\nStatus: " + status); 228 }); 229 }); 230 231 $("#unlock").click(function () { 232 var fromPlatform = $.trim($("select[name=fromPlatform2]").find("option:selected").text()); 233 fromPlatform = fromPlatform.substr(fromPlatform.length - 64, 64) 234 // alert(fromPlatform) 235 var fromAccount = $.trim($("input[name=fromAccount2]").val()) 236 // alert(fromAccount) 237 var toAccount = $.trim($("input[name=toAccount2]").val()) 238 // alert(toAccount) 239 var value = $("input[name=value2]").val() 240 // alert(value) 241 var txid = $.trim($("input[name=txid]").val()) 242 // alert(txid) 243 var sign = $.trim($("input[name=sign]").val()) 244 245 $.post("/xc/unlock", { 246 fromPlatform: fromPlatform, 247 fromAccount: fromAccount, 248 toAccount: toAccount, 249 value: value, 250 txid: txid, 251 sign: sign, 252 }, function (data, status) { 253 alert("Data: \n" + data + "\nStatus: " + status); 254 }); 255 }); 256 257 $("#LockBalance").click(function () { 258 $.post("/xc/lockBalance", {}, function (data, status) { 259 alert("Data: \n" + data + "\nStatus: " + status); 260 }); 261 }); 262 263 $("#balanceOf").click(function () { 264 var account = $.trim($("input[name=account]").val()) 265 $.post("/xc/balanceOf", { 266 account: account 267 }, function (data, status) { 268 alert("Data: \n" + data + "\nStatus: " + status); 269 }); 270 }); 271 272 $("#setWeight").click(function () { 273 var platformName = $.trim($("input[name=platformName]").val()); 274 platformName = platformName.substr(platformName.length - 64, 64) 275 var weight = $.trim($("input[name=weight]").val()) 276 $.post("/xc/setWeight", { 277 platformName: platformName, 278 weight: weight 279 }, function (data, status) { 280 alert("Data: \n" + data + "\nStatus: " + status); 281 }); 282 }); 283 284 $("#getWeight").click(function () { 285 var platformName = $.trim($("input[name=platformName]").val()); 286 platformName = platformName.substr(platformName.length - 64, 64) 287 $.post("/xc/getWeight", { 288 platformName: platformName 289 }, function (data, status) { 290 alert("Data: \n" + data + "\nStatus: " + status); 291 }); 292 }); 293 294 }) 295 296 </script> 297 </html>