SHARE
TWEET

Untitled

a guest Feb 16th, 2020 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let listen_slp = async function () {
  2.     var query = {
  3.         "v": 3,
  4.         "q": {"find": {}},
  5.         "r": {"f": "[ .[] | { txid: .tx.h, out: .slp.detail.outputs?, in: .in[0].e.a, token: .slp.detail.tokenIdHex, valid: .slp.valid }]"}
  6.     }
  7.  
  8.     var socket = new EventSource('https://slpstream.fountainhead.cash/s/'+btoa(JSON.stringify(query)))
  9.  
  10.     socket.onopen = function() {console.log('Connected to SLPStream at ' + (new Date().getTime()))}
  11.     socket.onmessage = function(event) {
  12.         var event = JSON.parse(event.data)
  13.         if(event.type == 'mempool' && event.data[0].valid) {
  14.  
  15.         }
  16.     }
  17.     socket.onerror = function(err) {
  18.         console.error('[Error SLPStream at ' + (new Date().getTime()) + ']:')
  19.         console.error(err)
  20.     }
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top