aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/javascript.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2016-04-12 20:03:21 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2016-04-12 20:03:21 +0800
commit8627680e24a29abd5f2aaaeaa2c1c852d8fb693b (patch)
tree1ad39e8b43d04e5a17c17c0b7314eece80620dd5 /rpc/javascript.go
parent934f587bd5c38a36e8b8c8647a9e600d1751ff2f (diff)
parentaa9fff3e68b1def0a9a22009c233150bf9ba481f (diff)
downloaddexon-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar.gz
dexon-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.tar.zst
dexon-8627680e24a29abd5f2aaaeaa2c1c852d8fb693b.zip
Merge pull request #2359 from bas-vk/rpc-optional-args
rpc: several fixes and support for optional arguments
Diffstat (limited to 'rpc/javascript.go')
-rw-r--r--rpc/javascript.go68
1 files changed, 17 insertions, 51 deletions
diff --git a/rpc/javascript.go b/rpc/javascript.go
index 211a6644e..d6ffcdf22 100644
--- a/rpc/javascript.go
+++ b/rpc/javascript.go
@@ -19,48 +19,15 @@ package rpc
var (
// Holds geth specific RPC extends which can be used to extend web3
WEB3Extensions = map[string]string{
- "personal": Personal_JS,
- "txpool": TxPool_JS,
- "admin": Admin_JS,
- "eth": Eth_JS,
- "miner": Miner_JS,
- "debug": Debug_JS,
- "net": Net_JS,
+ "txpool": TxPool_JS,
+ "admin": Admin_JS,
+ "eth": Eth_JS,
+ "miner": Miner_JS,
+ "debug": Debug_JS,
+ "net": Net_JS,
}
)
-const Personal_JS = `
-web3._extend({
- property: 'personal',
- methods:
- [
- new web3._extend.Method({
- name: 'newAccount',
- call: 'personal_newAccount',
- params: 1,
- outputFormatter: web3._extend.utils.toAddress
- }),
- new web3._extend.Method({
- name: 'unlockAccount',
- call: 'personal_unlockAccount',
- params: 3,
- }),
- new web3._extend.Method({
- name: 'lockAccount',
- call: 'personal_lockAccount',
- params: 1
- })
- ],
- properties:
- [
- new web3._extend.Property({
- name: 'listAccounts',
- getter: 'personal_listAccounts'
- })
- ]
-});
-`
-
const TxPool_JS = `
web3._extend({
property: 'txpool',
@@ -124,22 +91,22 @@ web3._extend({
new web3._extend.Method({
name: 'startRPC',
call: 'admin_startRPC',
- params: 4
+ params: 4,
+ inputFormatter: [null, null, null, null]
}),
new web3._extend.Method({
name: 'stopRPC',
- call: 'admin_stopRPC',
- params: 0
+ call: 'admin_stopRPC'
}),
new web3._extend.Method({
name: 'startWS',
call: 'admin_startWS',
- params: 4
+ params: 4,
+ inputFormatter: [null, null, null, null]
}),
new web3._extend.Method({
name: 'stopWS',
- call: 'admin_stopWS',
- params: 0
+ call: 'admin_stopWS'
}),
new web3._extend.Method({
name: 'setGlobalRegistrar',
@@ -219,7 +186,7 @@ web3._extend({
name: 'sign',
call: 'eth_sign',
params: 2,
- inputFormatter: [web3._extend.utils.toAddress, null]
+ inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
}),
new web3._extend.Method({
name: 'resend',
@@ -422,19 +389,18 @@ web3._extend({
new web3._extend.Method({
name: 'start',
call: 'miner_start',
- params: 1
+ params: 1,
+ inputFormatter: [null]
}),
new web3._extend.Method({
name: 'stop',
- call: 'miner_stop',
- params: 1
+ call: 'miner_stop'
}),
new web3._extend.Method({
name: 'setEtherbase',
call: 'miner_setEtherbase',
params: 1,
- inputFormatter: [web3._extend.formatters.formatInputInt],
- outputFormatter: web3._extend.formatters.formatOutputBool
+ inputFormatter: [web3._extend.formatters.inputAddressFormatter]
}),
new web3._extend.Method({
name: 'setExtra',