fixed web3 formatters mismatch

This commit is contained in:
Bas van Kervel 2015-07-06 13:08:08 +02:00 committed by Jeffrey Wilcke
parent 6ea28f93b9
commit ceb0739ba1
9 changed files with 75 additions and 176 deletions

View File

@ -9,22 +9,19 @@ web3._extend({
name: 'addPeer', name: 'addPeer',
call: 'admin_addPeer', call: 'admin_addPeer',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'exportChain', name: 'exportChain',
call: 'admin_exportChain', call: 'admin_exportChain',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null]
outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'importChain', name: 'importChain',
call: 'admin_importChain', call: 'admin_importChain',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null]
outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'sleepBlocks', name: 'sleepBlocks',
@ -37,22 +34,19 @@ web3._extend({
name: 'verbosity', name: 'verbosity',
call: 'admin_verbosity', call: 'admin_verbosity',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputInt], inputFormatter: [web3._extend.utils.toDecimal]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setSolc', name: 'setSolc',
call: 'admin_setSolc', call: 'admin_setSolc',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null]
outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'startRPC', name: 'startRPC',
call: 'admin_startRPC', call: 'admin_startRPC',
params: 4, params: 4,
inputFormatter: [web3._extend.utils.formatInputString,web3._extend.utils.formatInputInteger,web3._extend.utils.formatInputString,web3._extend.utils.formatInputString], inputFormatter: [null, web3._extend.utils.toDecimal, null, null]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'stopRPC', name: 'stopRPC',
@ -114,22 +108,19 @@ web3._extend({
name: 'stopNatSpec', name: 'stopNatSpec',
call: 'admin_stopNatSpec', call: 'admin_stopNatSpec',
params: 0, params: 0,
inputFormatter: [], inputFormatter: []
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getContractInfo', name: 'getContractInfo',
call: 'admin_getContractInfo', call: 'admin_getContractInfo',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null],
outputFormatter: function(obj) { return json.parse(obj); }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'httpGet', name: 'httpGet',
call: 'admin_httpGet', call: 'admin_httpGet',
params: 2, params: 2,
inputFormatter: [web3._extend.utils.formatInputString,web3._extend.utils.formatInputString], inputFormatter: [null, null]
outputFormatter: web3._extend.formatters.formatOutputString
}) })
], ],
@ -137,23 +128,19 @@ web3._extend({
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'nodeInfo', name: 'nodeInfo',
getter: 'admin_nodeInfo', getter: 'admin_nodeInfo'
outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'peers', name: 'peers',
getter: 'admin_peers', getter: 'admin_peers'
outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'datadir', name: 'datadir',
getter: 'admin_datadir', getter: 'admin_datadir'
outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'chainSyncStatus', name: 'chainSyncStatus',
getter: 'admin_chainSyncStatus', getter: 'admin_chainSyncStatus'
outputFormatter: function(obj) { return obj; }
}) })
] ]
}); });

View File

@ -5,34 +5,6 @@ web3._extend({
property: 'db', property: 'db',
methods: methods:
[ [
new web3._extend.Method({
name: 'getString',
call: 'db_getString',
params: 2,
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputString
}),
new web3._extend.Method({
name: 'putString',
call: 'db_putString',
params: 3,
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputBool
}),
new web3._extend.Method({
name: 'getHex',
call: 'db_getHex',
params: 2,
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputString
}),
new web3._extend.Method({
name: 'putHex',
call: 'db_putHex',
params: 3,
inputFormatter: [web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString, web3._extend.formatters.formatInputString],
outputFormatter: web3._extend.formatters.formatOutputBool
}),
], ],
properties: properties:
[ [

View File

@ -9,50 +9,43 @@ web3._extend({
name: 'printBlock', name: 'printBlock',
call: 'debug_printBlock', call: 'debug_printBlock',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'getBlockRlp', name: 'getBlockRlp',
call: 'debug_getBlockRlp', call: 'debug_getBlockRlp',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setHead', name: 'setHead',
call: 'debug_setHead', call: 'debug_setHead',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'processBlock', name: 'processBlock',
call: 'debug_processBlock', call: 'debug_processBlock',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'seedHash', name: 'seedHash',
call: 'debug_seedHash', call: 'debug_seedHash',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
outputFormatter: web3._extend.formatters.formatOutputString }),
}) ,
new web3._extend.Method({ new web3._extend.Method({
name: 'dumpBlock', name: 'dumpBlock',
call: 'debug_dumpBlock', call: 'debug_dumpBlock',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'metrics', name: 'metrics',
call: 'debug_metrics', call: 'debug_metrics',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputBool], inputFormatter: [null]
outputFormatter: function(obj) { return obj; }
}) })
], ],
properties: properties:

View File

@ -12,23 +12,20 @@ web3._extend({
name: 'sign', name: 'sign',
call: 'eth_sign', call: 'eth_sign',
params: 2, params: 2,
inputFormatter: [web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString], inputFormatter: [web3._extend.utils.toAddress, null]
outputFormatter: web3._extend.formatters.formatOutputString
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'resend', name: 'resend',
call: 'eth_resend', call: 'eth_resend',
params: 3, params: 3,
inputFormatter: [function(obj) { return obj; },web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString], inputFormatter: [null, null, null]
outputFormatter: web3._extend.formatters.formatOutputString
}) })
], ],
properties: properties:
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'pendingTransactions', name: 'pendingTransactions',
getter: 'eth_pendingTransactions', getter: 'eth_pendingTransactions'
outputFormatter: function(obj) { return obj; }
}) })
] ]
}); });

View File

@ -9,50 +9,43 @@ web3._extend({
name: 'start', name: 'start',
call: 'miner_start', call: 'miner_start',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [null]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'stop', name: 'stop',
call: 'miner_stop', call: 'miner_stop',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputInt], inputFormatter: [null]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setExtra', name: 'setExtra',
call: 'miner_setExtra', call: 'miner_setExtra',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'setGasPrice', name: 'setGasPrice',
call: 'miner_setGasPrice', call: 'miner_setGasPrice',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null]
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'startAutoDAG', name: 'startAutoDAG',
call: 'miner_startAutoDAG', call: 'miner_startAutoDAG',
params: 0, params: 0,
inputFormatter: [], inputFormatter: []
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'stopAutoDAG', name: 'stopAutoDAG',
call: 'miner_stopAutoDAG', call: 'miner_stopAutoDAG',
params: 0, params: 0,
inputFormatter: [], inputFormatter: []
outputFormatter: web3._extend.formatters.formatOutputBool
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'makeDAG', name: 'makeDAG',
call: 'miner_makeDAG', call: 'miner_makeDAG',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter], inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter]
outputFormatter: web3._extend.formatters.formatOutputBool
}) })
], ],
properties: properties:

View File

@ -2,45 +2,25 @@ package api
const Net_JS = ` const Net_JS = `
web3._extend({ web3._extend({
property: 'network', property: 'net',
methods: methods:
[ [
new web3._extend.Method({ new web3._extend.Method({
name: 'addPeer', name: 'addPeer',
call: 'net_addPeer', call: 'net_addPeer',
params: 1, params: 1,
inputFormatter: [web3._extend.utils.formatInputString], inputFormatter: [null]
outputFormatter: web3._extend.formatters.formatOutputBool
}),
new web3._extend.Method({
name: 'getPeerCount',
call: 'net_peerCount',
params: 0,
inputFormatter: [],
outputFormatter: web3._extend.formatters.formatOutputString
}) })
], ],
properties: properties:
[ [
new web3._extend.Property({
name: 'listening',
getter: 'net_listening',
outputFormatter: web3._extend.formatters.formatOutputBool
}),
new web3._extend.Property({
name: 'peerCount',
getter: 'net_peerCount',
outputFormatter: web3._extend.utils.toDecimal
}),
new web3._extend.Property({ new web3._extend.Property({
name: 'peers', name: 'peers',
getter: 'net_peers', getter: 'net_peers'
outputFormatter: function(obj) { return obj; }
}), }),
new web3._extend.Property({ new web3._extend.Property({
name: 'version', name: 'version',
getter: 'net_version', getter: 'net_version'
outputFormatter: web3._extend.formatters.formatOutputString
}) })
] ]
}); });

View File

@ -9,23 +9,21 @@ web3._extend({
name: 'newAccount', name: 'newAccount',
call: 'personal_newAccount', call: 'personal_newAccount',
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.formatInputString], inputFormatter: [null],
outputFormatter: web3._extend.formatters.formatOutputString outputFormatter: web3._extend.utils.toAddress
}), }),
new web3._extend.Method({ new web3._extend.Method({
name: 'unlockAccount', name: 'unlockAccount',
call: 'personal_unlockAccount', call: 'personal_unlockAccount',
params: 3, params: 3,
inputFormatter: [web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputString,web3._extend.formatters.formatInputInt], inputFormatter: [null, null, null]
outputFormatter: web3._extend.formatters.formatOutputBool
}) })
], ],
properties: properties:
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'listAccounts', name: 'listAccounts',
getter: 'personal_listAccounts', getter: 'personal_listAccounts'
outputFormatter: function(obj) { return obj; }
}) })
] ]
}); });

View File

@ -5,25 +5,13 @@ web3._extend({
property: 'shh', property: 'shh',
methods: methods:
[ [
new web3._extend.Method({
name: 'post',
call: 'shh_post',
params: 6,
inputFormatter: [web3._extend.formatters.formatInputString,
web3._extend.formatters.formatInputString,
web3._extend.formatters.formatInputString,
,
, web3._extend.formatters.formatInputInt
, web3._extend.formatters.formatInputInt],
outputFormatter: web3._extend.formatters.formatOutputBool
}),
], ],
properties: properties:
[ [
new web3._extend.Property({ new web3._extend.Property({
name: 'version', name: 'version',
getter: 'shh_version', getter: 'shh_version'
outputFormatter: web3._extend.formatters.formatOutputInt
}) })
] ]
}); });

View File

@ -36,6 +36,7 @@ var (
"debug": []string{ "debug": []string{
"dumpBlock", "dumpBlock",
"getBlockRlp", "getBlockRlp",
"metrics",
"printBlock", "printBlock",
"processBlock", "processBlock",
"seedHash", "seedHash",
@ -44,49 +45,38 @@ var (
"eth": []string{ "eth": []string{
"accounts", "accounts",
"blockNumber", "blockNumber",
"getBalance",
"protocolVersion",
"coinbase",
"mining",
"gasPrice",
"getStorage",
"storageAt",
"getStorageAt",
"getTransactionCount",
"getBlockTransactionCountByHash",
"getBlockTransactionCountByNumber",
"getUncleCountByBlockHash",
"getUncleCountByBlockNumber",
"getData",
"getCode",
"sign",
"sendRawTransaction",
"sendTransaction",
"transact",
"estimateGas",
"call", "call",
"flush", "contract",
"getBlockByHash", "coinbase",
"getBlockByNumber", "compile.lll",
"getTransactionByHash", "compile.serpent",
"getTransactionByBlockHashAndIndex", "compile.solidity",
"getUncleByBlockHashAndIndex", "contract",
"getUncleByBlockNumberAndIndex", "defaultAccount",
"defaultBlock",
"estimateGas",
"filter",
"getBalance",
"getBlock",
"getBlockTransactionCount",
"getBlockUncleCount",
"getCode",
"getCompilers", "getCompilers",
"compileSolidity", "gasPrice",
"newFilter", "getStorageAt",
"newBlockFilter", "getTransaction",
"newPendingTransactionFilter", "getTransactionCount",
"uninstallFilter", "getTransactionFromBlock",
"getFilterChanges", "getTransactionReceipt",
"getFilterLogs", "getUncle",
"getLogs",
"hashrate", "hashrate",
"getWork", "mining",
"submitWork", "namereg",
"pendingTransactions", "pendingTransactions",
"resend", "resend",
"getTransactionReceipt", "sendRawTransaction",
"sendTransaction",
"sign",
}, },
"miner": []string{ "miner": []string{
"hashrate", "hashrate",
@ -101,6 +91,8 @@ var (
"net": []string{ "net": []string{
"peerCount", "peerCount",
"listening", "listening",
"version",
"peers",
}, },
"personal": []string{ "personal": []string{
"listAccounts", "listAccounts",
@ -109,13 +101,12 @@ var (
"unlockAccount", "unlockAccount",
}, },
"shh": []string{ "shh": []string{
"version",
"post", "post",
"newIdentify",
"hasIdentity", "hasIdentity",
"newIdentity", "newGroup",
"newFilter", "addToGroup",
"uninstallFilter", "filter",
"getFilterChanges",
}, },
"txpool": []string{ "txpool": []string{
"status", "status",