Skip to content

Instantly share code, notes, and snippets.

@sharafian
Created September 20, 2017 00:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharafian/6d79e3c0c28468daffef967c84237081 to your computer and use it in GitHub Desktop.
Save sharafian/6d79e3c0c28468daffef967c84237081 to your computer and use it in GitHub Desktop.
XRP TX log for an account
<html><script src="https://cdnjs.cloudflare.com/ajax/libs/cell/1.1.0/cell.js"></script><link href="https://gliechtenstein.github.io/hehehe/hehehe.css" rel="stylesheet"><script>
var myAccount = 'rwE8hT4CK5REwiJ2WMPnRrMVrSFxxnvKB4' // change this to your account
var cell = {
$components: [
{ $components: [], class: "container",
_add: function(data) {
this.$components = [this._item(data)].concat(this.$components).slice(0,50)
},
$init: function() {
this._ws = new WebSocket('wss://s.altnet.rippletest.net:51233')
this._ws
.addEventListener('message', (event) => {
const data = JSON.parse(event.data)
if (data.engine_result !== 'tesSUCCESS') return
this._add(data)
})
this._ws.onopen = () => {
this._ws.send(JSON.stringify({
command: 'subscribe',
accounts: [ myAccount ]
}))
}
},
_item: function(data) {
return {
class: "item hidden",
$init: function() {
this.class = "item"
},
$components: [
{ style: "display: block;", $components: [ {$type: "img", style: 'border-radius: 0px;', class: "avatar", src: 'https://ripple.com/wp-content/uploads/2014/10/mark.png' } ] },
{ class: "body",
$components: [
{ style: 'color: #27a2db;',
$type: "h5", $text: data.transaction.TransactionType +
(data.transaction.Amount ? (" (" + ((+data.transaction.Amount) / 1000000) + " XRP)") : '') },
{ $type: "text", $text: "by " + data.transaction.Account +
(data.transaction.Destination ? (" to " + data.transaction.Destination) : '') }
]
}
]
}
}
}
],
$cell: true
}
</script></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment