<
 
 
 
 
×
>
hide You are viewing an archived web page, collected at the request of Ethereum Foundation using Archive-It. This page was captured on 15:34:10 May 06, 2021 , and is part of the Community collection. The information on this web page may be out of date. See All versions of this archived page. Loading media information

Error while trying to retrieve past transactions

dotnetjunkiedotnetjunkie Member Posts: 9
Hi!
I'm playing around with DApp development, and I'd like to retrieve from my Web UI the list of transactions belonging to a specific account; I'm trying to use the web3.eth.filter API:

var filter = web3.eth.filter({'fromBlock': 0, 'toBlock': 'latest', 'address': '[the address of the target account here]'}); filter.get(function(error, result) { if(!error) { for (i=0; i<result.length; ++i) { document.getElementById('txs').innerText = result[i]; } } else { document.getElementById('txs').innerText = error.stack; } });

Even if my scenario contains 3 transactions, I'm always getting an empty result.

What am I misunderstanding?

I even tried to use watch to track the ongoing transactions:

var filter = web3.eth.filter({'fromBlock': 0, 'toBlock': 'latest', 'address': '[the address of the target account here]'}); filter.watch<del class="Delete"></del>(function(error, result) { if(!error) { for (i=0; i<result.length; ++i) { document.getElementById('txs').innerText = result[i]; } } else { document.getElementById('txs').innerText = error.stack; } });

but I'm always getting an error:

Erorr: INVALID_PARAMS: Invalid method parameters (invalid name and/or type) recognised at Object.module.exports.InvalidResponse
(qrc:///web3.js:3043:16)
at qrc:///web3.js:6039:40
ar Array.filter(native)
at qrc:///web3.js:6036:12
at XMLHttpRequest.request.onreadystatechange
(qrc:///web3.js:4203:13)

Any idea?
Thank you !
Matteo
Sign In or Register to comment.