UNPKG

txq

Version:

TXQ: Bitcoin Transaction Storage Queue Service

47 lines (46 loc) 1 kB
<html> <head> <style> body { margin: 0; } pre{ width: 100%; height: 100%; background: rgba(0,0,0,0.9); color: yellowgreen; font-size: 12px; padding: 10px; font-family: Menlo, monaco, courier; } </style> <script src="../dist/minercraft.min.js"></script> <script> // Base64 encode your bitquery const b64 = btoa(JSON.stringify({ "v": 3, "q": { "find": {} } })) // Subscribe const miner = new Minercraft({ "url": "https://merchantapi.taal.com" }) const sock = new EventSource('https://txo.bitsocket.network/s/'+b64) sock.onmessage = function(e) { let d = JSON.parse(e.data) if (d.type === 'push') { console.log(d.data) d.data.forEach((d) => { console.log(d.tx.h) miner.tx.status(d.tx.h).then((res) => { let text = document.querySelector("pre").innerHTML document.querySelector("pre").innerHTML = "# txid: " + d.tx.h + "\n" + JSON.stringify(res, null, 2) + "\n" + text }) }) } } </script> </head> <body> <pre></pre> </body> </html>