web3.js/test/web3.eth.getBalance.js

72 lines
2.6 KiB
JavaScript
Raw Normal View History

2015-03-24 06:50:42 +01:00
var BigNumber = require('bignumber.js');
2015-10-07 04:32:32 +02:00
var Web3 = require('../index');
var web3 = new Web3();
2015-03-24 06:50:42 +01:00
var testMethod = require('./helpers/test.method.js');
2015-03-23 14:08:59 +01:00
var method = 'getBalance';
var tests = [{
2015-08-08 21:22:01 +02:00
args: ['0x000000000000000000000000000000000000012d', 2],
2015-04-02 13:08:40 +02:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x2'],
2015-03-23 17:02:34 +01:00
result: '0x31981',
2015-03-24 06:50:42 +01:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 17:27:14 +01:00
call: 'eth_'+ method
2015-03-23 17:02:34 +01:00
},{
2015-08-08 21:22:01 +02:00
args: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-04-02 13:08:40 +02:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-03-23 14:08:59 +01:00
result: '0x31981',
2015-03-24 06:50:42 +01:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 17:27:14 +01:00
call: 'eth_'+ method
2015-03-23 14:23:45 +01:00
}, {
2015-08-08 21:22:01 +02:00
args: ['0x000000000000000000000000000000000000012d', 0x1],
2015-04-02 13:08:40 +02:00
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
2015-03-23 14:23:45 +01:00
result: '0x31981',
2015-03-24 06:50:42 +01:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 17:27:14 +01:00
call: 'eth_'+ method
2015-03-23 14:23:45 +01:00
}, {
2015-08-08 21:22:01 +02:00
args: ['0x000000000000000000000000000000000000012d'],
2015-04-02 13:08:40 +02:00
formattedArgs: ['0x000000000000000000000000000000000000012d', web3.eth.defaultBlock],
2015-03-23 14:23:45 +01:00
result: '0x31981',
2015-03-24 06:50:42 +01:00
formattedResult: new BigNumber('0x31981', 16),
2015-03-23 17:27:14 +01:00
call: 'eth_'+ method
2015-03-29 21:54:53 +02:00
}, {
args: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-04-02 14:04:06 +02:00
}, {
args: ['dbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', 0x1],
formattedArgs: ['0xdbdbdb2cbd23b783741e8d7fcf51e459b497e4a6', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-03-29 21:54:53 +02:00
}, {
2015-08-08 21:22:01 +02:00
args: ['0x000000000000000000000000000000000000012d', 0x1],
formattedArgs: ['0x000000000000000000000000000000000000012d', '0x1'],
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
}, {
args: ['0x000000000000000000000000000000000000012d'],
formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
2015-03-29 21:54:53 +02:00
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
}, {
2015-08-08 21:22:01 +02:00
args: ['000000000000000000000000000000000000012d'],
formattedArgs: ['0x000000000000000000000000000000000000012d', 'latest'],
2015-03-29 21:54:53 +02:00
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-04-02 13:08:40 +02:00
}, {
2015-08-08 21:22:01 +02:00
args: ['XE7338O073KYGTWWZN0F2WZ0R8PX5ZPPZS'],
formattedArgs: ['0x00c5496aee77c1ba1f0854206a26dda82a81d6d8', 'latest'],
2015-04-02 13:08:40 +02:00
result: '0x31981',
formattedResult: new BigNumber('0x31981', 16),
call: 'eth_'+ method
2015-03-23 14:08:59 +01:00
}];
2015-03-24 11:44:33 +01:00
testMethod.runTests('eth', method, tests);
2015-03-23 14:08:59 +01:00