2015-12-16 01:58:01 -08:00
|
|
|
// Copyright 2015 The go-ethereum Authors
|
|
|
|
// This file is part of the go-ethereum library.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2016-04-15 08:36:01 -07:00
|
|
|
// package web3ext contains geth specific web3.js extensions.
|
|
|
|
package web3ext
|
2015-12-16 01:58:01 -08:00
|
|
|
|
2016-04-15 08:36:01 -07:00
|
|
|
var Modules = map[string]string{
|
2016-08-29 12:18:00 -07:00
|
|
|
"admin": Admin_JS,
|
|
|
|
"chequebook": Chequebook_JS,
|
2017-04-10 03:24:12 -07:00
|
|
|
"clique": Clique_JS,
|
2016-08-29 12:18:00 -07:00
|
|
|
"debug": Debug_JS,
|
|
|
|
"eth": Eth_JS,
|
|
|
|
"miner": Miner_JS,
|
|
|
|
"net": Net_JS,
|
|
|
|
"personal": Personal_JS,
|
|
|
|
"rpc": RPC_JS,
|
|
|
|
"shh": Shh_JS,
|
2017-03-23 06:56:06 -07:00
|
|
|
"swarmfs": SWARMFS_JS,
|
2016-08-29 12:18:00 -07:00
|
|
|
"txpool": TxPool_JS,
|
2016-04-15 08:36:01 -07:00
|
|
|
}
|
2015-12-16 01:58:01 -08:00
|
|
|
|
2016-08-29 12:18:00 -07:00
|
|
|
const Chequebook_JS = `
|
|
|
|
web3._extend({
|
2017-09-11 00:33:18 -07:00
|
|
|
property: 'chequebook',
|
|
|
|
methods: [
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'deposit',
|
|
|
|
call: 'chequebook_deposit',
|
|
|
|
params: 1,
|
|
|
|
inputFormatter: [null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Property({
|
2016-08-29 12:18:00 -07:00
|
|
|
name: 'balance',
|
|
|
|
getter: 'chequebook_balance',
|
2017-09-11 00:33:18 -07:00
|
|
|
outputFormatter: web3._extend.utils.toDecimal
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'cash',
|
|
|
|
call: 'chequebook_cash',
|
|
|
|
params: 1,
|
|
|
|
inputFormatter: [null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'issue',
|
|
|
|
call: 'chequebook_issue',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [null, null]
|
|
|
|
}),
|
|
|
|
]
|
2016-08-29 12:18:00 -07:00
|
|
|
});
|
|
|
|
`
|
|
|
|
|
2017-04-10 03:24:12 -07:00
|
|
|
const Clique_JS = `
|
|
|
|
web3._extend({
|
2017-09-11 00:33:18 -07:00
|
|
|
property: 'clique',
|
|
|
|
methods: [
|
2017-04-10 03:24:12 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getSnapshot',
|
|
|
|
call: 'clique_getSnapshot',
|
|
|
|
params: 1,
|
2017-09-11 00:33:18 -07:00
|
|
|
inputFormatter: [null]
|
2017-04-10 03:24:12 -07:00
|
|
|
}),
|
2017-04-12 05:37:10 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getSnapshotAtHash',
|
|
|
|
call: 'clique_getSnapshotAtHash',
|
|
|
|
params: 1
|
|
|
|
}),
|
2017-09-11 00:33:18 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getSigners',
|
|
|
|
call: 'clique_getSigners',
|
|
|
|
params: 1,
|
|
|
|
inputFormatter: [null]
|
|
|
|
}),
|
2017-04-12 05:37:10 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getSignersAtHash',
|
|
|
|
call: 'clique_getSignersAtHash',
|
|
|
|
params: 1
|
|
|
|
}),
|
2017-04-10 03:24:12 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'propose',
|
|
|
|
call: 'clique_propose',
|
|
|
|
params: 2
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'discard',
|
|
|
|
call: 'clique_discard',
|
|
|
|
params: 1
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
|
|
|
],
|
|
|
|
properties: [
|
2017-04-10 03:24:12 -07:00
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'proposals',
|
|
|
|
getter: 'clique_proposals'
|
|
|
|
}),
|
|
|
|
]
|
|
|
|
});
|
|
|
|
`
|
|
|
|
|
2015-12-16 01:58:01 -08:00
|
|
|
const Admin_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'admin',
|
2017-09-11 00:33:18 -07:00
|
|
|
methods: [
|
2015-12-16 01:58:01 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'addPeer',
|
|
|
|
call: 'admin_addPeer',
|
|
|
|
params: 1
|
|
|
|
}),
|
2016-06-24 13:27:55 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'removePeer',
|
|
|
|
call: 'admin_removePeer',
|
|
|
|
params: 1
|
|
|
|
}),
|
2015-12-16 01:58:01 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'exportChain',
|
|
|
|
call: 'admin_exportChain',
|
|
|
|
params: 1,
|
|
|
|
inputFormatter: [null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'importChain',
|
|
|
|
call: 'admin_importChain',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'sleepBlocks',
|
|
|
|
call: 'admin_sleepBlocks',
|
|
|
|
params: 2
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'startRPC',
|
|
|
|
call: 'admin_startRPC',
|
2016-03-14 01:38:54 -07:00
|
|
|
params: 4,
|
|
|
|
inputFormatter: [null, null, null, null]
|
2015-12-16 01:58:01 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'stopRPC',
|
2016-03-14 01:38:54 -07:00
|
|
|
call: 'admin_stopRPC'
|
2015-12-16 01:58:01 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'startWS',
|
|
|
|
call: 'admin_startWS',
|
2016-03-14 01:38:54 -07:00
|
|
|
params: 4,
|
|
|
|
inputFormatter: [null, null, null, null]
|
2015-12-16 01:58:01 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'stopWS',
|
2016-03-14 01:38:54 -07:00
|
|
|
call: 'admin_stopWS'
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2015-12-16 01:58:01 -08:00
|
|
|
],
|
2017-09-11 00:33:18 -07:00
|
|
|
properties: [
|
2015-12-16 01:58:01 -08:00
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'nodeInfo',
|
|
|
|
getter: 'admin_nodeInfo'
|
|
|
|
}),
|
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'peers',
|
|
|
|
getter: 'admin_peers'
|
|
|
|
}),
|
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'datadir',
|
|
|
|
getter: 'admin_datadir'
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2015-12-16 01:58:01 -08:00
|
|
|
]
|
|
|
|
});
|
|
|
|
`
|
|
|
|
|
|
|
|
const Debug_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'debug',
|
2017-09-11 00:33:18 -07:00
|
|
|
methods: [
|
2015-12-16 01:58:01 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'printBlock',
|
|
|
|
call: 'debug_printBlock',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getBlockRlp',
|
|
|
|
call: 'debug_getBlockRlp',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'setHead',
|
|
|
|
call: 'debug_setHead',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'seedHash',
|
|
|
|
call: 'debug_seedHash',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'dumpBlock',
|
|
|
|
call: 'debug_dumpBlock',
|
|
|
|
params: 1
|
|
|
|
}),
|
2016-02-20 05:36:34 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'chaindbProperty',
|
|
|
|
call: 'debug_chaindbProperty',
|
|
|
|
params: 1,
|
|
|
|
outputFormatter: console.log
|
|
|
|
}),
|
2016-10-20 05:36:48 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'chaindbCompact',
|
|
|
|
call: 'debug_chaindbCompact',
|
|
|
|
}),
|
2015-12-16 01:58:01 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'metrics',
|
|
|
|
call: 'debug_metrics',
|
|
|
|
params: 1
|
2016-01-26 05:39:21 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'verbosity',
|
|
|
|
call: 'debug_verbosity',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'vmodule',
|
|
|
|
call: 'debug_vmodule',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'backtraceAt',
|
|
|
|
call: 'debug_backtraceAt',
|
|
|
|
params: 1,
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'stacks',
|
|
|
|
call: 'debug_stacks',
|
|
|
|
params: 0,
|
|
|
|
outputFormatter: console.log
|
|
|
|
}),
|
2017-09-11 00:33:18 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'freeOSMemory',
|
|
|
|
call: 'debug_freeOSMemory',
|
|
|
|
params: 0,
|
|
|
|
}),
|
2017-09-11 03:29:47 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'setGCPercent',
|
|
|
|
call: 'debug_setGCPercent',
|
|
|
|
params: 1,
|
|
|
|
}),
|
2016-02-20 06:42:22 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'memStats',
|
|
|
|
call: 'debug_memStats',
|
|
|
|
params: 0,
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'gcStats',
|
|
|
|
call: 'debug_gcStats',
|
|
|
|
params: 0,
|
|
|
|
}),
|
2016-01-26 05:39:21 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'cpuProfile',
|
|
|
|
call: 'debug_cpuProfile',
|
|
|
|
params: 2
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'startCPUProfile',
|
|
|
|
call: 'debug_startCPUProfile',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'stopCPUProfile',
|
|
|
|
call: 'debug_stopCPUProfile',
|
|
|
|
params: 0
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
2016-05-06 01:24:16 -07:00
|
|
|
name: 'goTrace',
|
|
|
|
call: 'debug_goTrace',
|
2016-01-26 05:39:21 -08:00
|
|
|
params: 2
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
2016-05-06 02:15:05 -07:00
|
|
|
name: 'startGoTrace',
|
|
|
|
call: 'debug_startGoTrace',
|
2016-01-26 05:39:21 -08:00
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
2016-05-06 02:15:05 -07:00
|
|
|
name: 'stopGoTrace',
|
|
|
|
call: 'debug_stopGoTrace',
|
2016-01-26 05:39:21 -08:00
|
|
|
params: 0
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'blockProfile',
|
|
|
|
call: 'debug_blockProfile',
|
|
|
|
params: 2
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'setBlockProfileRate',
|
|
|
|
call: 'debug_setBlockProfileRate',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'writeBlockProfile',
|
|
|
|
call: 'debug_writeBlockProfile',
|
|
|
|
params: 1
|
|
|
|
}),
|
2018-03-02 15:52:21 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'mutexProfile',
|
|
|
|
call: 'debug_mutexProfile',
|
|
|
|
params: 2
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'setMutexProfileRate',
|
|
|
|
call: 'debug_setMutexProfileRate',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'writeMutexProfile',
|
|
|
|
call: 'debug_writeMutexProfile',
|
|
|
|
params: 1
|
|
|
|
}),
|
2016-01-26 05:39:21 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'writeMemProfile',
|
|
|
|
call: 'debug_writeMemProfile',
|
|
|
|
params: 1
|
|
|
|
}),
|
cmd, core, eth/tracers: support fancier js tracing (#15516)
* cmd, core, eth/tracers: support fancier js tracing
* eth, internal/web3ext: rework trace API, concurrency, chain tracing
* eth/tracers: add three more JavaScript tracers
* eth/tracers, vendor: swap ottovm to duktape for tracing
* core, eth, internal: finalize call tracer and needed extras
* eth, tests: prestate tracer, call test suite, rewinding
* vendor: fix windows builds for tracer js engine
* vendor: temporary duktape fix
* eth/tracers: fix up 4byte and evmdis tracer
* vendor: pull in latest duktape with my upstream fixes
* eth: fix some review comments
* eth: rename rewind to reexec to make it more obvious
* core/vm: terminate tracing using defers
2017-12-21 03:56:11 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'traceBlock',
|
|
|
|
call: 'debug_traceBlock',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [null, null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'traceBlockFromFile',
|
|
|
|
call: 'debug_traceBlockFromFile',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [null, null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'traceBlockByNumber',
|
|
|
|
call: 'debug_traceBlockByNumber',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [null, null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'traceBlockByHash',
|
|
|
|
call: 'debug_traceBlockByHash',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [null, null]
|
|
|
|
}),
|
2016-01-28 10:21:05 -08:00
|
|
|
new web3._extend.Method({
|
2016-02-03 14:47:58 -08:00
|
|
|
name: 'traceTransaction',
|
|
|
|
call: 'debug_traceTransaction',
|
2016-08-22 07:03:30 -07:00
|
|
|
params: 2,
|
|
|
|
inputFormatter: [null, null]
|
2017-01-17 03:19:50 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'preimage',
|
|
|
|
call: 'debug_preimage',
|
|
|
|
params: 1,
|
|
|
|
inputFormatter: [null]
|
2017-02-13 12:44:06 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getBadBlocks',
|
|
|
|
call: 'debug_getBadBlocks',
|
|
|
|
params: 0,
|
|
|
|
}),
|
2017-04-19 03:09:04 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'storageRangeAt',
|
|
|
|
call: 'debug_storageRangeAt',
|
|
|
|
params: 5,
|
|
|
|
}),
|
2017-11-20 07:18:50 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getModifiedAccountsByNumber',
|
|
|
|
call: 'debug_getModifiedAccountsByNumber',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [null, null],
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getModifiedAccountsByHash',
|
|
|
|
call: 'debug_getModifiedAccountsByHash',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter:[null, null],
|
|
|
|
}),
|
2015-12-16 01:58:01 -08:00
|
|
|
],
|
2016-03-01 09:22:26 -08:00
|
|
|
properties: []
|
2015-12-16 01:58:01 -08:00
|
|
|
});
|
|
|
|
`
|
|
|
|
|
2016-05-11 01:49:44 -07:00
|
|
|
const Eth_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'eth',
|
2017-09-11 00:33:18 -07:00
|
|
|
methods: [
|
2016-05-11 01:49:44 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'sign',
|
|
|
|
call: 'eth_sign',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'resend',
|
|
|
|
call: 'eth_resend',
|
|
|
|
params: 3,
|
|
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'signTransaction',
|
|
|
|
call: 'eth_signTransaction',
|
|
|
|
params: 1,
|
|
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'submitTransaction',
|
|
|
|
call: 'eth_submitTransaction',
|
|
|
|
params: 1,
|
|
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
|
2016-10-06 15:38:00 -07:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getRawTransaction',
|
|
|
|
call: 'eth_getRawTransactionByHash',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'getRawTransactionFromBlock',
|
|
|
|
call: function(args) {
|
|
|
|
return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
|
|
|
|
},
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2016-05-11 01:49:44 -07:00
|
|
|
],
|
2017-09-11 00:33:18 -07:00
|
|
|
properties: [
|
2016-05-11 01:49:44 -07:00
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'pendingTransactions',
|
|
|
|
getter: 'eth_pendingTransactions',
|
|
|
|
outputFormatter: function(txs) {
|
|
|
|
var formatted = [];
|
|
|
|
for (var i = 0; i < txs.length; i++) {
|
|
|
|
formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
|
|
|
|
formatted[i].blockHash = null;
|
|
|
|
}
|
|
|
|
return formatted;
|
|
|
|
}
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2016-05-11 01:49:44 -07:00
|
|
|
]
|
|
|
|
});
|
|
|
|
`
|
|
|
|
|
2015-12-16 01:58:01 -08:00
|
|
|
const Miner_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'miner',
|
2017-09-11 00:33:18 -07:00
|
|
|
methods: [
|
2015-12-16 01:58:01 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'start',
|
|
|
|
call: 'miner_start',
|
2016-03-14 01:38:54 -07:00
|
|
|
params: 1,
|
|
|
|
inputFormatter: [null]
|
2015-12-16 01:58:01 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'stop',
|
2016-03-14 01:38:54 -07:00
|
|
|
call: 'miner_stop'
|
2015-12-16 01:58:01 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'setEtherbase',
|
|
|
|
call: 'miner_setEtherbase',
|
|
|
|
params: 1,
|
2016-03-14 01:38:54 -07:00
|
|
|
inputFormatter: [web3._extend.formatters.inputAddressFormatter]
|
2015-12-16 01:58:01 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'setExtra',
|
|
|
|
call: 'miner_setExtra',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'setGasPrice',
|
|
|
|
call: 'miner_setGasPrice',
|
|
|
|
params: 1,
|
2016-05-11 01:49:44 -07:00
|
|
|
inputFormatter: [web3._extend.utils.fromDecimal]
|
2015-12-16 01:58:01 -08:00
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
2017-03-06 07:20:25 -08:00
|
|
|
name: 'getHashrate',
|
|
|
|
call: 'miner_getHashrate'
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2015-12-16 01:58:01 -08:00
|
|
|
],
|
2016-03-01 09:22:26 -08:00
|
|
|
properties: []
|
2015-12-16 01:58:01 -08:00
|
|
|
});
|
|
|
|
`
|
|
|
|
|
2016-05-11 01:49:44 -07:00
|
|
|
const Net_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'net',
|
|
|
|
methods: [],
|
2017-09-11 00:33:18 -07:00
|
|
|
properties: [
|
2016-05-11 01:49:44 -07:00
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'version',
|
|
|
|
getter: 'net_version'
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2016-05-11 01:49:44 -07:00
|
|
|
]
|
|
|
|
});
|
|
|
|
`
|
|
|
|
|
|
|
|
const Personal_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'personal',
|
2017-09-11 00:33:18 -07:00
|
|
|
methods: [
|
2016-05-11 01:49:44 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'importRawKey',
|
|
|
|
call: 'personal_importRawKey',
|
|
|
|
params: 2
|
2016-05-12 10:32:04 -07:00
|
|
|
}),
|
2016-10-28 12:25:49 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'sign',
|
|
|
|
call: 'personal_sign',
|
|
|
|
params: 3,
|
|
|
|
inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'ecRecover',
|
|
|
|
call: 'personal_ecRecover',
|
|
|
|
params: 2
|
2017-02-07 02:47:34 -08:00
|
|
|
}),
|
2017-08-01 08:45:17 -07:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'openWallet',
|
|
|
|
call: 'personal_openWallet',
|
|
|
|
params: 2
|
|
|
|
}),
|
2017-02-07 02:47:34 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'deriveAccount',
|
|
|
|
call: 'personal_deriveAccount',
|
|
|
|
params: 3
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2018-01-26 09:32:43 -08:00
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'signTransaction',
|
|
|
|
call: 'personal_signTransaction',
|
|
|
|
params: 2,
|
|
|
|
inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
|
|
|
|
}),
|
2017-02-07 02:47:34 -08:00
|
|
|
],
|
2017-09-11 00:33:18 -07:00
|
|
|
properties: [
|
2017-02-07 02:47:34 -08:00
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'listWallets',
|
|
|
|
getter: 'personal_listWallets'
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2016-05-11 01:49:44 -07:00
|
|
|
]
|
2016-10-28 12:25:49 -07:00
|
|
|
})
|
2016-05-11 01:49:44 -07:00
|
|
|
`
|
|
|
|
|
|
|
|
const RPC_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'rpc',
|
|
|
|
methods: [],
|
2017-09-11 00:33:18 -07:00
|
|
|
properties: [
|
2016-05-11 01:49:44 -07:00
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'modules',
|
|
|
|
getter: 'rpc_modules'
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2016-05-11 01:49:44 -07:00
|
|
|
]
|
|
|
|
});
|
|
|
|
`
|
|
|
|
|
2015-12-16 01:58:01 -08:00
|
|
|
const Shh_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'shh',
|
2017-04-28 02:57:15 -07:00
|
|
|
methods: [
|
|
|
|
],
|
2015-12-16 01:58:01 -08:00
|
|
|
properties:
|
|
|
|
[
|
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'version',
|
2016-05-11 01:49:44 -07:00
|
|
|
getter: 'shh_version',
|
|
|
|
outputFormatter: web3._extend.utils.toDecimal
|
2017-06-13 02:49:07 -07:00
|
|
|
}),
|
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'info',
|
|
|
|
getter: 'shh_info'
|
|
|
|
}),
|
2016-05-11 01:49:44 -07:00
|
|
|
]
|
|
|
|
});
|
|
|
|
`
|
2017-04-28 02:57:15 -07:00
|
|
|
|
2017-03-23 06:56:06 -07:00
|
|
|
const SWARMFS_JS = `
|
|
|
|
web3._extend({
|
2017-03-31 03:11:01 -07:00
|
|
|
property: 'swarmfs',
|
|
|
|
methods:
|
|
|
|
[
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'mount',
|
|
|
|
call: 'swarmfs_mount',
|
|
|
|
params: 2
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'unmount',
|
|
|
|
call: 'swarmfs_unmount',
|
|
|
|
params: 1
|
|
|
|
}),
|
|
|
|
new web3._extend.Method({
|
|
|
|
name: 'listmounts',
|
|
|
|
call: 'swarmfs_listmounts',
|
|
|
|
params: 0
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2017-03-31 03:11:01 -07:00
|
|
|
]
|
2017-03-23 06:56:06 -07:00
|
|
|
});
|
|
|
|
`
|
2016-05-11 01:49:44 -07:00
|
|
|
|
|
|
|
const TxPool_JS = `
|
|
|
|
web3._extend({
|
|
|
|
property: 'txpool',
|
|
|
|
methods: [],
|
|
|
|
properties:
|
|
|
|
[
|
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'content',
|
|
|
|
getter: 'txpool_content'
|
|
|
|
}),
|
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'inspect',
|
|
|
|
getter: 'txpool_inspect'
|
|
|
|
}),
|
|
|
|
new web3._extend.Property({
|
|
|
|
name: 'status',
|
|
|
|
getter: 'txpool_status',
|
|
|
|
outputFormatter: function(status) {
|
|
|
|
status.pending = web3._extend.utils.toDecimal(status.pending);
|
|
|
|
status.queued = web3._extend.utils.toDecimal(status.queued);
|
|
|
|
return status;
|
|
|
|
}
|
2017-09-11 00:33:18 -07:00
|
|
|
}),
|
2015-12-16 01:58:01 -08:00
|
|
|
]
|
|
|
|
});
|
|
|
|
`
|