Skip to content

Commit ceb0739

Browse files
Bas van Kervelobscuren
authored andcommitted
fixed web3 formatters mismatch
1 parent 6ea28f9 commit ceb0739

File tree

9 files changed

+73
-174
lines changed

9 files changed

+73
-174
lines changed

rpc/api/admin_js.go

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,19 @@ web3._extend({
99
name: 'addPeer',
1010
call: 'admin_addPeer',
1111
params: 1,
12-
inputFormatter: [web3._extend.utils.formatInputString],
13-
outputFormatter: web3._extend.formatters.formatOutputBool
12+
inputFormatter: [null]
1413
}),
1514
new web3._extend.Method({
1615
name: 'exportChain',
1716
call: 'admin_exportChain',
1817
params: 1,
19-
inputFormatter: [web3._extend.utils.formatInputString],
20-
outputFormatter: function(obj) { return obj; }
18+
inputFormatter: [null]
2119
}),
2220
new web3._extend.Method({
2321
name: 'importChain',
2422
call: 'admin_importChain',
2523
params: 1,
26-
inputFormatter: [web3._extend.utils.formatInputString],
27-
outputFormatter: function(obj) { return obj; }
24+
inputFormatter: [null]
2825
}),
2926
new web3._extend.Method({
3027
name: 'sleepBlocks',
@@ -37,22 +34,19 @@ web3._extend({
3734
name: 'verbosity',
3835
call: 'admin_verbosity',
3936
params: 1,
40-
inputFormatter: [web3._extend.utils.formatInputInt],
41-
outputFormatter: web3._extend.formatters.formatOutputBool
37+
inputFormatter: [web3._extend.utils.toDecimal]
4238
}),
4339
new web3._extend.Method({
4440
name: 'setSolc',
4541
call: 'admin_setSolc',
4642
params: 1,
47-
inputFormatter: [web3._extend.utils.formatInputString],
48-
outputFormatter: web3._extend.formatters.formatOutputString
43+
inputFormatter: [null]
4944
}),
5045
new web3._extend.Method({
5146
name: 'startRPC',
5247
call: 'admin_startRPC',
5348
params: 4,
54-
inputFormatter: [web3._extend.utils.formatInputString,web3._extend.utils.formatInputInteger,web3._extend.utils.formatInputString,web3._extend.utils.formatInputString],
55-
outputFormatter: web3._extend.formatters.formatOutputBool
49+
inputFormatter: [null, web3._extend.utils.toDecimal, null, null]
5650
}),
5751
new web3._extend.Method({
5852
name: 'stopRPC',
@@ -114,46 +108,39 @@ web3._extend({
114108
name: 'stopNatSpec',
115109
call: 'admin_stopNatSpec',
116110
params: 0,
117-
inputFormatter: [],
118-
outputFormatter: web3._extend.formatters.formatOutputBool
111+
inputFormatter: []
119112
}),
120113
new web3._extend.Method({
121114
name: 'getContractInfo',
122115
call: 'admin_getContractInfo',
123116
params: 1,
124-
inputFormatter: [web3._extend.utils.formatInputString],
125-
outputFormatter: function(obj) { return json.parse(obj); }
117+
inputFormatter: [null],
126118
}),
127119
new web3._extend.Method({
128120
name: 'httpGet',
129121
call: 'admin_httpGet',
130122
params: 2,
131-
inputFormatter: [web3._extend.utils.formatInputString,web3._extend.utils.formatInputString],
132-
outputFormatter: web3._extend.formatters.formatOutputString
123+
inputFormatter: [null, null]
133124
})
134125
135126
],
136127
properties:
137128
[
138129
new web3._extend.Property({
139130
name: 'nodeInfo',
140-
getter: 'admin_nodeInfo',
141-
outputFormatter: web3._extend.formatters.formatOutputString
131+
getter: 'admin_nodeInfo'
142132
}),
143133
new web3._extend.Property({
144134
name: 'peers',
145-
getter: 'admin_peers',
146-
outputFormatter: function(obj) { return obj; }
135+
getter: 'admin_peers'
147136
}),
148137
new web3._extend.Property({
149138
name: 'datadir',
150-
getter: 'admin_datadir',
151-
outputFormatter: web3._extend.formatters.formatOutputString
139+
getter: 'admin_datadir'
152140
}),
153141
new web3._extend.Property({
154142
name: 'chainSyncStatus',
155-
getter: 'admin_chainSyncStatus',
156-
outputFormatter: function(obj) { return obj; }
143+
getter: 'admin_chainSyncStatus'
157144
})
158145
]
159146
});

rpc/api/db_js.go

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,6 @@ web3._extend({
55
property: 'db',
66
methods:
77
[
8-
new web3._extend.Method({
9-
name: 'getString',
10-
call: 'db_getString',
11-
params: 2,
12-
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
13-
outputFormatter: web3._extend.formatters.formatOutputString
14-
}),
15-
new web3._extend.Method({
16-
name: 'putString',
17-
call: 'db_putString',
18-
params: 3,
19-
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
20-
outputFormatter: web3._extend.formatters.formatOutputBool
21-
}),
22-
new web3._extend.Method({
23-
name: 'getHex',
24-
call: 'db_getHex',
25-
params: 2,
26-
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
27-
outputFormatter: web3._extend.formatters.formatOutputString
28-
}),
29-
new web3._extend.Method({
30-
name: 'putHex',
31-
call: 'db_putHex',
32-
params: 3,
33-
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
34-
outputFormatter: web3._extend.formatters.formatOutputBool
35-
}),
368
],
379
properties:
3810
[

rpc/api/debug_js.go

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,43 @@ web3._extend({
99
name: 'printBlock',
1010
call: 'debug_printBlock',
1111
params: 1,
12-
inputFormatter: [web3._extend.formatters.formatInputInt],
13-
outputFormatter: web3._extend.formatters.formatOutputString
12+
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
1413
}),
1514
new web3._extend.Method({
1615
name: 'getBlockRlp',
1716
call: 'debug_getBlockRlp',
1817
params: 1,
19-
inputFormatter: [web3._extend.formatters.formatInputInt],
20-
outputFormatter: web3._extend.formatters.formatOutputString
18+
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
2119
}),
2220
new web3._extend.Method({
2321
name: 'setHead',
2422
call: 'debug_setHead',
2523
params: 1,
26-
inputFormatter: [web3._extend.formatters.formatInputInt],
27-
outputFormatter: web3._extend.formatters.formatOutputBool
24+
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
2825
}),
2926
new web3._extend.Method({
3027
name: 'processBlock',
3128
call: 'debug_processBlock',
3229
params: 1,
33-
inputFormatter: [web3._extend.formatters.formatInputInt],
34-
outputFormatter: function(obj) { return obj; }
30+
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
3531
}),
3632
new web3._extend.Method({
3733
name: 'seedHash',
3834
call: 'debug_seedHash',
3935
params: 1,
40-
inputFormatter: [web3._extend.formatters.formatInputInt],
41-
outputFormatter: web3._extend.formatters.formatOutputString
42-
}) ,
36+
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
37+
}),
4338
new web3._extend.Method({
4439
name: 'dumpBlock',
4540
call: 'debug_dumpBlock',
4641
params: 1,
47-
inputFormatter: [web3._extend.formatters.formatInputInt],
48-
outputFormatter: function(obj) { return obj; }
42+
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
4943
}),
5044
new web3._extend.Method({
5145
name: 'metrics',
5246
call: 'debug_metrics',
5347
params: 1,
54-
inputFormatter: [web3._extend.formatters.formatInputBool],
55-
outputFormatter: function(obj) { return obj; }
48+
inputFormatter: [null]
5649
})
5750
],
5851
properties:

rpc/api/eth_js.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,20 @@ web3._extend({
1212
name: 'sign',
1313
call: 'eth_sign',
1414
params: 2,
15-
inputFormatter: [web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString],
16-
outputFormatter: web3._extend.formatters.formatOutputString
15+
inputFormatter: [web3._extend.utils.toAddress, null]
1716
}),
1817
new web3._extend.Method({
1918
name: 'resend',
2019
call: 'eth_resend',
2120
params: 3,
22-
inputFormatter: [function(obj) { return obj; },web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString],
23-
outputFormatter: web3._extend.formatters.formatOutputString
21+
inputFormatter: [null, null, null]
2422
})
2523
],
2624
properties:
2725
[
2826
new web3._extend.Property({
2927
name: 'pendingTransactions',
30-
getter: 'eth_pendingTransactions',
31-
outputFormatter: function(obj) { return obj; }
28+
getter: 'eth_pendingTransactions'
3229
})
3330
]
3431
});

rpc/api/miner_js.go

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,50 +9,43 @@ web3._extend({
99
name: 'start',
1010
call: 'miner_start',
1111
params: 1,
12-
inputFormatter: [web3._extend.formatters.formatInputInt],
13-
outputFormatter: web3._extend.formatters.formatOutputBool
12+
inputFormatter: [null]
1413
}),
1514
new web3._extend.Method({
1615
name: 'stop',
1716
call: 'miner_stop',
1817
params: 1,
19-
inputFormatter: [web3._extend.formatters.formatInputInt],
20-
outputFormatter: web3._extend.formatters.formatOutputBool
18+
inputFormatter: [null]
2119
}),
2220
new web3._extend.Method({
2321
name: 'setExtra',
2422
call: 'miner_setExtra',
2523
params: 1,
26-
inputFormatter: [web3._extend.utils.formatInputString],
27-
outputFormatter: web3._extend.formatters.formatOutputBool
24+
inputFormatter: [null]
2825
}),
2926
new web3._extend.Method({
3027
name: 'setGasPrice',
3128
call: 'miner_setGasPrice',
3229
params: 1,
33-
inputFormatter: [web3._extend.utils.formatInputString],
34-
outputFormatter: web3._extend.formatters.formatOutputBool
30+
inputFormatter: [null]
3531
}),
3632
new web3._extend.Method({
3733
name: 'startAutoDAG',
3834
call: 'miner_startAutoDAG',
3935
params: 0,
40-
inputFormatter: [],
41-
outputFormatter: web3._extend.formatters.formatOutputBool
36+
inputFormatter: []
4237
}),
4338
new web3._extend.Method({
4439
name: 'stopAutoDAG',
4540
call: 'miner_stopAutoDAG',
4641
params: 0,
47-
inputFormatter: [],
48-
outputFormatter: web3._extend.formatters.formatOutputBool
42+
inputFormatter: []
4943
}),
5044
new web3._extend.Method({
5145
name: 'makeDAG',
5246
call: 'miner_makeDAG',
5347
params: 1,
54-
inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter],
55-
outputFormatter: web3._extend.formatters.formatOutputBool
48+
inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter]
5649
})
5750
],
5851
properties:

rpc/api/net_js.go

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,25 @@ package api
22

33
const Net_JS = `
44
web3._extend({
5-
property: 'network',
5+
property: 'net',
66
methods:
77
[
88
new web3._extend.Method({
99
name: 'addPeer',
1010
call: 'net_addPeer',
1111
params: 1,
12-
inputFormatter: [web3._extend.utils.formatInputString],
13-
outputFormatter: web3._extend.formatters.formatOutputBool
14-
}),
15-
new web3._extend.Method({
16-
name: 'getPeerCount',
17-
call: 'net_peerCount',
18-
params: 0,
19-
inputFormatter: [],
20-
outputFormatter: web3._extend.formatters.formatOutputString
12+
inputFormatter: [null]
2113
})
2214
],
2315
properties:
2416
[
25-
new web3._extend.Property({
26-
name: 'listening',
27-
getter: 'net_listening',
28-
outputFormatter: web3._extend.formatters.formatOutputBool
29-
}),
30-
new web3._extend.Property({
31-
name: 'peerCount',
32-
getter: 'net_peerCount',
33-
outputFormatter: web3._extend.utils.toDecimal
34-
}),
3517
new web3._extend.Property({
3618
name: 'peers',
37-
getter: 'net_peers',
38-
outputFormatter: function(obj) { return obj; }
19+
getter: 'net_peers'
3920
}),
4021
new web3._extend.Property({
4122
name: 'version',
42-
getter: 'net_version',
43-
outputFormatter: web3._extend.formatters.formatOutputString
23+
getter: 'net_version'
4424
})
4525
]
4626
});

rpc/api/personal_js.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,21 @@ web3._extend({
99
name: 'newAccount',
1010
call: 'personal_newAccount',
1111
params: 1,
12-
inputFormatter: [web3._extend.formatters.formatInputString],
13-
outputFormatter: web3._extend.formatters.formatOutputString
12+
inputFormatter: [null],
13+
outputFormatter: web3._extend.utils.toAddress
1414
}),
1515
new web3._extend.Method({
1616
name: 'unlockAccount',
1717
call: 'personal_unlockAccount',
1818
params: 3,
19-
inputFormatter: [web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputInt],
20-
outputFormatter: web3._extend.formatters.formatOutputBool
19+
inputFormatter: [null, null, null]
2120
})
2221
],
2322
properties:
2423
[
2524
new web3._extend.Property({
2625
name: 'listAccounts',
27-
getter: 'personal_listAccounts',
28-
outputFormatter: function(obj) { return obj; }
26+
getter: 'personal_listAccounts'
2927
})
3028
]
3129
});

rpc/api/ssh_js.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,13 @@ web3._extend({
55
property: 'shh',
66
methods:
77
[
8-
new web3._extend.Method({
9-
name: 'post',
10-
call: 'shh_post',
11-
params: 6,
12-
inputFormatter: [web3._extend.formatters.formatInputString,
13-
web3._extend.formatters.formatInputString,
14-
web3._extend.formatters.formatInputString,
15-
,
16-
, web3._extend.formatters.formatInputInt
17-
, web3._extend.formatters.formatInputInt],
18-
outputFormatter: web3._extend.formatters.formatOutputBool
19-
}),
8+
209
],
2110
properties:
2211
[
2312
new web3._extend.Property({
2413
name: 'version',
25-
getter: 'shh_version',
26-
outputFormatter: web3._extend.formatters.formatOutputInt
14+
getter: 'shh_version'
2715
})
2816
]
2917
});

0 commit comments

Comments
 (0)