Created
March 4, 2018 15:52
-
-
Save code-with-sam/7ec28f4cdcbb343f6082ae7cd069a336 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Steem-js 12</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script> | |
<script | |
src="https://code.jquery.com/jquery-3.2.1.min.js" | |
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" | |
crossorigin="anonymous"></script> | |
<script> | |
// START HERE | |
</script> | |
</head> | |
<body> | |
<main class="container"> | |
<h2> Transfers</h2> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th scope="col">From</th> | |
<th scope="col">To</th> | |
<th scope="col">Amount</th> | |
<th scope="col">Memo</th> | |
</tr> | |
</thead> | |
<tbody> | |
</tbody> | |
</table> | |
</main> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Steem-js 12</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script> | |
<script | |
src="https://code.jquery.com/jquery-3.2.1.min.js" | |
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" | |
crossorigin="anonymous"></script> | |
<script> | |
// Tutorial 12 - WALLET | |
const ACCOUNT_NAME = 'blocktrades' | |
const WALLET_FILTER = 'transfer' | |
steem.api.getAccountHistory(ACCOUNT_NAME, -1, 50, (err, result) => { | |
console.log(err,result) | |
let transfers = result.filter( tx => tx[1].op[0] === WALLET_FILTER ) | |
console.log(transfers) | |
displayTransactions(transfers) | |
}); | |
function displayTransactions(transactions){ | |
transactions.forEach((tx) => { | |
let transfer = tx[1].op[1] | |
console.log(transfer) | |
let template = | |
`<tr> | |
<td>${transfer.from}</td> | |
<td>${transfer.to}</td> | |
<td>${transfer.amount}</td> | |
<td>${transfer.memo}</td> | |
</tr>` | |
$('tbody').prepend(template) | |
}); | |
} | |
</script> | |
</head> | |
<body> | |
<main class="container"> | |
<h2> Transfers</h2> | |
<table class="table"> | |
<thead> | |
<tr> | |
<th scope="col">From</th> | |
<th scope="col">To</th> | |
<th scope="col">Amount</th> | |
<th scope="col">Memo</th> | |
</tr> | |
</thead> | |
<tbody> | |
</tbody> | |
</table> | |
</main> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment