mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 11:38:12 +00:00
add newblockfilter Proposal
This commit is contained in:
parent
08f3aaea8c
commit
3af8e27255
17
dist/web3-light.js
vendored
17
dist/web3-light.js
vendored
@ -2441,7 +2441,7 @@ var inputTransactionFormatter = function (options){
|
||||
delete options.code;
|
||||
}
|
||||
|
||||
['gasPrice', 'gas', 'value'].filter(function (key) {
|
||||
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
|
||||
return options[key] !== undefined;
|
||||
}).forEach(function(key){
|
||||
options[key] = utils.fromDecimal(options[key]);
|
||||
@ -3578,7 +3578,20 @@ var Method = require('./method');
|
||||
/// @returns an array of objects describing web3.eth.filter api methods
|
||||
var eth = function () {
|
||||
var newFilterCall = function (args) {
|
||||
return typeof args[0] === 'string' ? 'eth_newBlockFilter' : 'eth_newFilter';
|
||||
var type = args[0];
|
||||
|
||||
switch(type) {
|
||||
case 'latest':
|
||||
args.pop();
|
||||
this.params = 0;
|
||||
return 'eth_newBlockFilter';
|
||||
case 'pending':
|
||||
args.pop();
|
||||
this.params = 0;
|
||||
return 'eth_newPendingTransactionFilter';
|
||||
default:
|
||||
return 'eth_newFilter';
|
||||
}
|
||||
};
|
||||
|
||||
var newFilter = new Method({
|
||||
|
6
dist/web3-light.js.map
vendored
6
dist/web3-light.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/web3-light.min.js
vendored
4
dist/web3-light.min.js
vendored
File diff suppressed because one or more lines are too long
17
dist/web3.js
vendored
17
dist/web3.js
vendored
@ -2441,7 +2441,7 @@ var inputTransactionFormatter = function (options){
|
||||
delete options.code;
|
||||
}
|
||||
|
||||
['gasPrice', 'gas', 'value'].filter(function (key) {
|
||||
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
|
||||
return options[key] !== undefined;
|
||||
}).forEach(function(key){
|
||||
options[key] = utils.fromDecimal(options[key]);
|
||||
@ -3578,7 +3578,20 @@ var Method = require('./method');
|
||||
/// @returns an array of objects describing web3.eth.filter api methods
|
||||
var eth = function () {
|
||||
var newFilterCall = function (args) {
|
||||
return typeof args[0] === 'string' ? 'eth_newBlockFilter' : 'eth_newFilter';
|
||||
var type = args[0];
|
||||
|
||||
switch(type) {
|
||||
case 'latest':
|
||||
args.pop();
|
||||
this.params = 0;
|
||||
return 'eth_newBlockFilter';
|
||||
case 'pending':
|
||||
args.pop();
|
||||
this.params = 0;
|
||||
return 'eth_newPendingTransactionFilter';
|
||||
default:
|
||||
return 'eth_newFilter';
|
||||
}
|
||||
};
|
||||
|
||||
var newFilter = new Method({
|
||||
|
6
dist/web3.js.map
vendored
6
dist/web3.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/web3.min.js
vendored
4
dist/web3.min.js
vendored
File diff suppressed because one or more lines are too long
@ -25,7 +25,20 @@ var Method = require('./method');
|
||||
/// @returns an array of objects describing web3.eth.filter api methods
|
||||
var eth = function () {
|
||||
var newFilterCall = function (args) {
|
||||
return typeof args[0] === 'string' ? 'eth_newBlockFilter' : 'eth_newFilter';
|
||||
var type = args[0];
|
||||
|
||||
switch(type) {
|
||||
case 'latest':
|
||||
args.pop();
|
||||
this.params = 0;
|
||||
return 'eth_newBlockFilter';
|
||||
case 'pending':
|
||||
args.pop();
|
||||
this.params = 0;
|
||||
return 'eth_newPendingTransactionFilter';
|
||||
default:
|
||||
return 'eth_newFilter';
|
||||
}
|
||||
};
|
||||
|
||||
var newFilter = new Method({
|
||||
|
@ -6,15 +6,26 @@ var utils = require('../lib/utils/utils');
|
||||
|
||||
var tests = [{
|
||||
protocol: 'eth',
|
||||
args: ['pending'],
|
||||
args: ['latest'],
|
||||
firstResult: 1,
|
||||
firstPayload: {
|
||||
method: "eth_newBlockFilter",
|
||||
params: [
|
||||
"pending"
|
||||
]
|
||||
params: []
|
||||
},
|
||||
secondResult: [null],
|
||||
secondResult: ['0x1234'],
|
||||
secondPayload: {
|
||||
method: "eth_getFilterChanges"
|
||||
}
|
||||
},
|
||||
{
|
||||
protocol: 'eth',
|
||||
args: ['pending'],
|
||||
firstResult: 1,
|
||||
firstPayload: {
|
||||
method: "eth_newPendingTransactionFilter",
|
||||
params: []
|
||||
},
|
||||
secondResult: ['0x1234'],
|
||||
secondPayload: {
|
||||
method: "eth_getFilterChanges"
|
||||
}
|
||||
|
@ -37,11 +37,17 @@ var tests = [{
|
||||
formattedResult: '0xf',
|
||||
call: 'eth_newFilter'
|
||||
},{
|
||||
args: ['pending'],
|
||||
formattedArgs: ['pending'],
|
||||
args: ['latest'],
|
||||
formattedArgs: [],
|
||||
result: '0xf',
|
||||
formattedResult: '0xf',
|
||||
call: 'eth_newBlockFilter'
|
||||
},{
|
||||
args: ['pending'],
|
||||
formattedArgs: [],
|
||||
result: '0xf',
|
||||
formattedResult: '0xf',
|
||||
call: 'eth_newPendingTransactionFilter'
|
||||
}];
|
||||
|
||||
describe('web3.eth', function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user