Created
October 18, 2019 01:03
-
-
Save w3kim/f393c4144b7c98c7bb04059c373f65d2 to your computer and use it in GitHub Desktop.
Filtering transactions that are included in a block
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
const Caver = require('caver-js'); | |
const caver = new Caver('https://api.baobab.klaytn.net:8651/'); | |
// getBlock's second parameter is boolean; if true, getBlock returns a block with transaction objects. | |
caver.klay.getBlock(9660831, true).then((resp) => { | |
const { transactions } = resp; | |
const filtered = transactions.filter((e) => { return e['to'] === 'address_you_are_looking_for' }); | |
console.log(filtered); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment