Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

Historical/Real-time Transactions

node v10.24.1
version: 1.0.0
endpointsharetweet
const Web3Data = require("web3data-js@0.6.1") // Create the Web3Data instances passing in your API Key (Get one! -> amberdata.io/onboarding) const w3d = new Web3Data(process.env.API_KEY) const ADDRESS = '0x06012c8cf97bead5deae237070f9587f8e7a266d' // Get date from 7 days ago const startDate = new Date() startDate.setDate(startDate.getDate() - 7) // Get the transactions of the address starting from 7 days ago const transactions = await w3d.address.getTransactions(ADDRESS, {startDate: startDate.toISOString()}) console.log({transactions}) // Listen for new transactions to arrive w3d.connect() w3d.on({eventName: 'address:transaction', filters: {address: ADDRESS}}, (txn) => { console.log(`New transaction: ${txn.hash.split(0, 10)}`) })
Loading…

no comments

    sign in to comment