I use web3.eth.getBalance to get balance of a specific address. I want to get how amount of unconfirmed ETH the address has.
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://xxx:xxxx"));
var balance = web3.eth.getBalance("0xbddf0bf3ac858d7fb8a2bdda55884d61779ba5a9");
console.log(balance.toNumber()); // Only confirmed balance is showed. I want to know unconfirmed balance
Update 1
Thanks to @niksmac. I tried to use web3.eth.filter. It seems that pending txes are showed. But it is a little bit strange. I set 0x11fd3ffc4243cac293ee3d349ec906a2786087fe as a specific address, however the address was not showed in the result. And I may have to get the amount of ETH by the transactionHash.
filter.js
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://xxx:xxx"));
var options = web3.eth.filter({address: "0x11fd3ffc4243cac293ee3d349ec906a2786087fe"});
var filter = web3.eth.filter(options);
var myResults = filter.get(function(error, logs){ console.log(logs); });
result
[ { address: '0x2a98c5f40bfa3dee83431103c535f6fae9a8ad38',
topics:
[ '0x5a690ecd0cb15c1c1fd6b6f8a32df0d4f56cb41a54fea7e94020f013595de796',
'0x0000000000000000000000000000000000000000000000000000000000000002',
'0x0000000000000000000000002e8520ef2806ea0c0c3f02b24dddf0d23e58b5f8',
'0x0000000000000000000000000000000000000000000000000000000000000000' ],
data: '0x58425455534400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000',
blockNumber: 1620014,
transactionHash: '0xfc93b988bc65686b7f01f5f522ce13cd80c800674de386a82512d77246721b07',
transactionIndex: 0,
blockHash: '0x1e932b4902300dd352e5a0f1a446c92ac1d6373c1551acfc83d4b458171009ee',
logIndex: 0,
removed: false },
{ address: '0x2a98c5f40bfa3dee83431103c535f6fae9a8ad38',
topics:
[ '0xa9c6cbc4bd352a6940479f6d802a1001550581858b310d7f68f7bea51218cda6',
'0x5842545553440000000000000000000000000000000000000000000000000000' ],
data: '0x0000000000000000000000000000000000000000000000f53bab9c227ae40000',
blockNumber: 1620014,
transactionHash: '0xfc93b988bc65686b7f01f5f522ce13cd80c800674de386a82512d77246721b07',
transactionIndex: 0,
blockHash: '0x1e932b4902300dd352e5a0f1a446c92ac1d6373c1551acfc83d4b458171009ee',
logIndex: 1,
removed: false },
{ address: '0x2e8520ef2806ea0c0c3f02b24dddf0d23e58b5f8',
topics:
[ '0xa609f6bd4ad0b4f419ddad4ac9f0d02c2b9295c5e6891469055cf73c2b568fff',
'0x0000000000000000000000002e8520ef2806ea0c0c3f02b24dddf0d23e58b5f8' ],
data: '0x0000000000000000000000000000000000000000000000f3f22f14ecd9910000',
blockNumber: 1620014,
transactionHash: '0xfc93b988bc65686b7f01f5f522ce13cd80c800674de386a82512d77246721b07',
transactionIndex: 0,
blockHash: '0x1e932b4902300dd352e5a0f1a446c92ac1d6373c1551acfc83d4b458171009ee',
logIndex: 2,
removed: false }
]