github.com/Gessiux/neatchain@v1.3.1/internal/web3ext/web3ext.go (about)

     1  // Copyright 2015 The go-ethereum Authors
     2  // This file is part of the go-ethereum library.
     3  //
     4  // The go-ethereum library is free software: you can redistribute it and/or modify
     5  // it under the terms of the GNU Lesser General Public License as published by
     6  // the Free Software Foundation, either version 3 of the License, or
     7  // (at your option) any later version.
     8  //
     9  // The go-ethereum library is distributed in the hope that it will be useful,
    10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    12  // GNU Lesser General Public License for more details.
    13  //
    14  // You should have received a copy of the GNU Lesser General Public License
    15  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    16  
    17  // package web3ext contains neatchain specific web3.js extensions.
    18  package web3ext
    19  
    20  var Modules = map[string]string{
    21  	"admin":      Admin_JS,
    22  	"chequebook": Chequebook_JS,
    23  	"clique":     Clique_JS,
    24  	"debug":      Debug_JS,
    25  	"eth":        Eth_JS,
    26  	"neat":       NEAT_JS,
    27  	"miner":      Miner_JS,
    28  	"net":        Net_JS,
    29  	"personal":   Personal_JS,
    30  	"rpc":        RPC_JS,
    31  	"shh":        Shh_JS,
    32  	"swarmfs":    SWARMFS_JS,
    33  	"txpool":     TxPool_JS,
    34  	"istanbul":   Istanbul_JS,
    35  }
    36  
    37  const Chequebook_JS = `
    38  web3._extend({
    39  	property: 'chequebook',
    40  	methods: [
    41  		new web3._extend.Method({
    42  			name: 'deposit',
    43  			call: 'chequebook_deposit',
    44  			params: 1,
    45  			inputFormatter: [null]
    46  		}),
    47  		new web3._extend.Property({
    48  			name: 'balance',
    49  			getter: 'chequebook_balance',
    50  			outputFormatter: web3._extend.utils.toDecimal
    51  		}),
    52  		new web3._extend.Method({
    53  			name: 'cash',
    54  			call: 'chequebook_cash',
    55  			params: 1,
    56  			inputFormatter: [null]
    57  		}),
    58  		new web3._extend.Method({
    59  			name: 'issue',
    60  			call: 'chequebook_issue',
    61  			params: 2,
    62  			inputFormatter: [null, null]
    63  		}),
    64  	]
    65  });
    66  `
    67  
    68  const Clique_JS = `
    69  web3._extend({
    70  	property: 'clique',
    71  	methods: [
    72  		new web3._extend.Method({
    73  			name: 'getSnapshot',
    74  			call: 'clique_getSnapshot',
    75  			params: 1,
    76  			inputFormatter: [null]
    77  		}),
    78  		new web3._extend.Method({
    79  			name: 'getSnapshotAtHash',
    80  			call: 'clique_getSnapshotAtHash',
    81  			params: 1
    82  		}),
    83  		new web3._extend.Method({
    84  			name: 'getSigners',
    85  			call: 'clique_getSigners',
    86  			params: 1,
    87  			inputFormatter: [null]
    88  		}),
    89  		new web3._extend.Method({
    90  			name: 'getSignersAtHash',
    91  			call: 'clique_getSignersAtHash',
    92  			params: 1
    93  		}),
    94  		new web3._extend.Method({
    95  			name: 'propose',
    96  			call: 'clique_propose',
    97  			params: 2
    98  		}),
    99  		new web3._extend.Method({
   100  			name: 'discard',
   101  			call: 'clique_discard',
   102  			params: 1
   103  		}),
   104  	],
   105  	properties: [
   106  		new web3._extend.Property({
   107  			name: 'proposals',
   108  			getter: 'clique_proposals'
   109  		}),
   110  	]
   111  });
   112  `
   113  
   114  const Admin_JS = `
   115  web3._extend({
   116  	property: 'admin',
   117  	methods: [
   118  		new web3._extend.Method({
   119  			name: 'addPeer',
   120  			call: 'admin_addPeer',
   121  			params: 1
   122  		}),
   123  		new web3._extend.Method({
   124  			name: 'removePeer',
   125  			call: 'admin_removePeer',
   126  			params: 1
   127  		}),
   128  		new web3._extend.Method({
   129  			name: 'exportChain',
   130  			call: 'admin_exportChain',
   131  			params: 1,
   132  			inputFormatter: [null]
   133  		}),
   134  		new web3._extend.Method({
   135  			name: 'importChain',
   136  			call: 'admin_importChain',
   137  			params: 1
   138  		}),
   139  		new web3._extend.Method({
   140  			name: 'sleepBlocks',
   141  			call: 'admin_sleepBlocks',
   142  			params: 2
   143  		}),
   144  		new web3._extend.Method({
   145  			name: 'startRPC',
   146  			call: 'admin_startRPC',
   147  			params: 4,
   148  			inputFormatter: [null, null, null, null]
   149  		}),
   150  		new web3._extend.Method({
   151  			name: 'stopRPC',
   152  			call: 'admin_stopRPC'
   153  		}),
   154  		new web3._extend.Method({
   155  			name: 'startWS',
   156  			call: 'admin_startWS',
   157  			params: 4,
   158  			inputFormatter: [null, null, null, null]
   159  		}),
   160  		new web3._extend.Method({
   161  			name: 'stopWS',
   162  			call: 'admin_stopWS'
   163  		}),
   164  		new web3._extend.Method({
   165  			name: 'startScanAndPrune',
   166  			call: 'admin_startScanAndPrune'
   167  		}),
   168  	],
   169  	properties: [
   170  		new web3._extend.Property({
   171  			name: 'nodeInfo',
   172  			getter: 'admin_nodeInfo'
   173  		}),
   174  		new web3._extend.Property({
   175  			name: 'peers',
   176  			getter: 'admin_peers'
   177  		}),
   178  		new web3._extend.Property({
   179  			name: 'datadir',
   180  			getter: 'admin_datadir'
   181  		}),
   182  	]
   183  });
   184  `
   185  
   186  const Debug_JS = `
   187  web3._extend({
   188  	property: 'debug',
   189  	methods: [
   190  		new web3._extend.Method({
   191  			name: 'printBlock',
   192  			call: 'debug_printBlock',
   193  			params: 1
   194  		}),
   195  		new web3._extend.Method({
   196  			name: 'getBlockRlp',
   197  			call: 'debug_getBlockRlp',
   198  			params: 1
   199  		}),
   200  		new web3._extend.Method({
   201  			name: 'setHead',
   202  			call: 'debug_setHead',
   203  			params: 1
   204  		}),
   205  		new web3._extend.Method({
   206  			name: 'seedHash',
   207  			call: 'debug_seedHash',
   208  			params: 1
   209  		}),
   210  		new web3._extend.Method({
   211  			name: 'dumpBlock',
   212  			call: 'debug_dumpBlock',
   213  			params: 1
   214  		}),
   215  		new web3._extend.Method({
   216  			name: 'chaindbProperty',
   217  			call: 'debug_chaindbProperty',
   218  			params: 1,
   219  			outputFormatter: console.log
   220  		}),
   221  		new web3._extend.Method({
   222  			name: 'chaindbCompact',
   223  			call: 'debug_chaindbCompact',
   224  		}),
   225  		new web3._extend.Method({
   226  			name: 'metrics',
   227  			call: 'debug_metrics',
   228  			params: 1
   229  		}),
   230  		new web3._extend.Method({
   231  			name: 'verbosity',
   232  			call: 'debug_verbosity',
   233  			params: 1
   234  		}),
   235  		new web3._extend.Method({
   236  			name: 'vmodule',
   237  			call: 'debug_vmodule',
   238  			params: 1
   239  		}),
   240  		new web3._extend.Method({
   241  			name: 'backtraceAt',
   242  			call: 'debug_backtraceAt',
   243  			params: 1,
   244  		}),
   245  		new web3._extend.Method({
   246  			name: 'stacks',
   247  			call: 'debug_stacks',
   248  			params: 0,
   249  			outputFormatter: console.log
   250  		}),
   251  		new web3._extend.Method({
   252  			name: 'freeOSMemory',
   253  			call: 'debug_freeOSMemory',
   254  			params: 0,
   255  		}),
   256  		new web3._extend.Method({
   257  			name: 'setGCPercent',
   258  			call: 'debug_setGCPercent',
   259  			params: 1,
   260  		}),
   261  		new web3._extend.Method({
   262  			name: 'memStats',
   263  			call: 'debug_memStats',
   264  			params: 0,
   265  		}),
   266  		new web3._extend.Method({
   267  			name: 'gcStats',
   268  			call: 'debug_gcStats',
   269  			params: 0,
   270  		}),
   271  		new web3._extend.Method({
   272  			name: 'cpuProfile',
   273  			call: 'debug_cpuProfile',
   274  			params: 2
   275  		}),
   276  		new web3._extend.Method({
   277  			name: 'startCPUProfile',
   278  			call: 'debug_startCPUProfile',
   279  			params: 1
   280  		}),
   281  		new web3._extend.Method({
   282  			name: 'stopCPUProfile',
   283  			call: 'debug_stopCPUProfile',
   284  			params: 0
   285  		}),
   286  		new web3._extend.Method({
   287  			name: 'goTrace',
   288  			call: 'debug_goTrace',
   289  			params: 2
   290  		}),
   291  		new web3._extend.Method({
   292  			name: 'startGoTrace',
   293  			call: 'debug_startGoTrace',
   294  			params: 1
   295  		}),
   296  		new web3._extend.Method({
   297  			name: 'stopGoTrace',
   298  			call: 'debug_stopGoTrace',
   299  			params: 0
   300  		}),
   301  		new web3._extend.Method({
   302  			name: 'blockProfile',
   303  			call: 'debug_blockProfile',
   304  			params: 2
   305  		}),
   306  		new web3._extend.Method({
   307  			name: 'setBlockProfileRate',
   308  			call: 'debug_setBlockProfileRate',
   309  			params: 1
   310  		}),
   311  		new web3._extend.Method({
   312  			name: 'writeBlockProfile',
   313  			call: 'debug_writeBlockProfile',
   314  			params: 1
   315  		}),
   316  		new web3._extend.Method({
   317  			name: 'mutexProfile',
   318  			call: 'debug_mutexProfile',
   319  			params: 2
   320  		}),
   321  		new web3._extend.Method({
   322  			name: 'setMutexProfileRate',
   323  			call: 'debug_setMutexProfileRate',
   324  			params: 1
   325  		}),
   326  		new web3._extend.Method({
   327  			name: 'writeMutexProfile',
   328  			call: 'debug_writeMutexProfile',
   329  			params: 1
   330  		}),
   331  		new web3._extend.Method({
   332  			name: 'writeMemProfile',
   333  			call: 'debug_writeMemProfile',
   334  			params: 1
   335  		}),
   336  		new web3._extend.Method({
   337  			name: 'traceBlock',
   338  			call: 'debug_traceBlock',
   339  			params: 2,
   340  			inputFormatter: [null, null]
   341  		}),
   342  		new web3._extend.Method({
   343  			name: 'traceBlockFromFile',
   344  			call: 'debug_traceBlockFromFile',
   345  			params: 2,
   346  			inputFormatter: [null, null]
   347  		}),
   348  		new web3._extend.Method({
   349  			name: 'traceBlockByNumber',
   350  			call: 'debug_traceBlockByNumber',
   351  			params: 2,
   352  			inputFormatter: [null, null]
   353  		}),
   354  		new web3._extend.Method({
   355  			name: 'traceBlockByHash',
   356  			call: 'debug_traceBlockByHash',
   357  			params: 2,
   358  			inputFormatter: [null, null]
   359  		}),
   360  		new web3._extend.Method({
   361  			name: 'traceTransaction',
   362  			call: 'debug_traceTransaction',
   363  			params: 2,
   364  			inputFormatter: [null, null]
   365  		}),
   366  		new web3._extend.Method({
   367  			name: 'preimage',
   368  			call: 'debug_preimage',
   369  			params: 1,
   370  			inputFormatter: [null]
   371  		}),
   372  		new web3._extend.Method({
   373  			name: 'getBadBlocks',
   374  			call: 'debug_getBadBlocks',
   375  			params: 0,
   376  		}),
   377  		new web3._extend.Method({
   378  			name: 'storageRangeAt',
   379  			call: 'debug_storageRangeAt',
   380  			params: 5,
   381  		}),
   382  		new web3._extend.Method({
   383  			name: 'getModifiedAccountsByNumber',
   384  			call: 'debug_getModifiedAccountsByNumber',
   385  			params: 2,
   386  			inputFormatter: [null, null],
   387  		}),
   388  		new web3._extend.Method({
   389  			name: 'getModifiedAccountsByHash',
   390  			call: 'debug_getModifiedAccountsByHash',
   391  			params: 2,
   392  			inputFormatter:[null, null],
   393  		}),
   394  	],
   395  	properties: []
   396  });
   397  `
   398  
   399  const Eth_JS = `
   400  web3._extend({
   401  	property: 'eth',
   402  	methods: [
   403  		new web3._extend.Method({
   404  			name: 'sign',
   405  			call: 'eth_sign',
   406  			params: 2,
   407  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   408  		}),
   409  		new web3._extend.Method({
   410  			name: 'resend',
   411  			call: 'eth_resend',
   412  			params: 3,
   413  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   414  		}),
   415  		new web3._extend.Method({
   416  			name: 'signTransaction',
   417  			call: 'eth_signTransaction',
   418  			params: 1,
   419  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   420  		}),
   421  		new web3._extend.Method({
   422  			name: 'submitTransaction',
   423  			call: 'eth_submitTransaction',
   424  			params: 1,
   425  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   426  		}),
   427  		new web3._extend.Method({
   428  			name: 'getRawTransaction',
   429  			call: 'eth_getRawTransactionByHash',
   430  			params: 1
   431  		}),
   432  		new web3._extend.Method({
   433  			name: 'getRawTransactionFromBlock',
   434  			call: function(args) {
   435  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
   436  			},
   437  			params: 2,
   438  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   439  		}),
   440  		new web3._extend.Method({
   441  			name: 'getBalanceDetail',
   442  			call: 'eth_getBalanceDetail',
   443  			params: 3,
   444  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter, null]
   445  		}),
   446  	],
   447  	properties: [
   448  		new web3._extend.Property({
   449  			name: 'pendingTransactions',
   450  			getter: 'eth_pendingTransactions',
   451  			outputFormatter: function(txs) {
   452  				var formatted = [];
   453  				for (var i = 0; i < txs.length; i++) {
   454  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   455  					formatted[i].blockHash = null;
   456  				}
   457  				return formatted;
   458  			}
   459  		}),
   460  	]
   461  });
   462  `
   463  
   464  const NEAT_JS = `
   465  web3._extend({
   466  	property: 'neat',
   467  	methods: [
   468  		new web3._extend.Method({
   469  			name: 'sign',
   470  			call: 'neat_sign',
   471  			params: 2,
   472  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   473  		}),
   474  		new web3._extend.Method({
   475  			name: 'resend',
   476  			call: 'neat_resend',
   477  			params: 3,
   478  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   479  		}),
   480  		new web3._extend.Method({
   481  			name: 'signTransaction',
   482  			call: 'neat_signTransaction',
   483  			params: 1,
   484  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   485  		}),
   486  		new web3._extend.Method({
   487  			name: 'submitTransaction',
   488  			call: 'neat_submitTransaction',
   489  			params: 1,
   490  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   491  		}),
   492  		new web3._extend.Method({
   493  			name: 'getRawTransaction',
   494  			call: 'neat_getRawTransactionByHash',
   495  			params: 1
   496  		}),
   497  		new web3._extend.Method({
   498  			name: 'getRawTransactionFromBlock',
   499  			call: function(args) {
   500  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'neat_getRawTransactionByBlockHashAndIndex' : 'neat_getRawTransactionByBlockNumberAndIndex';
   501  			},
   502  			params: 2,
   503  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   504  		}),
   505  		new web3._extend.Method({
   506  			name: 'getBalanceDetail',
   507  			call: 'neat_getBalanceDetail',
   508  			params: 3,
   509  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter, null]
   510  		}),
   511  		new web3._extend.Method({
   512  			name: 'signAddress',
   513  			call: 'neat_signAddress',
   514  			params: 2
   515  		}),
   516  		new web3._extend.Method({
   517  			name: 'getBlockReward',
   518  			call: 'neat_getBlockReward',
   519  			params: 1
   520  		}),
   521  		new web3._extend.Method({
   522  			name: 'withdrawReward',
   523  			call: 'neat_withdrawReward',
   524  			params: 3,
   525  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputAddressFormatter, null]
   526  		}),
   527  		new web3._extend.Method({
   528  			name: 'voteNextEpoch',
   529  			call: 'neat_voteNextEpoch',
   530  			params: 3
   531  		}),
   532  		new web3._extend.Method({
   533  			name: 'revealVote',
   534  			call: 'neat_revealVote',
   535  			params: 6
   536  		}),
   537  		new web3._extend.Method({
   538  			name: 'getCurrentEpochNumber',
   539  			call: 'neat_getCurrentEpochNumber'
   540  		}),
   541  		new web3._extend.Method({
   542  			name: 'getEpoch',
   543  			call: 'neat_getEpoch',
   544  			params: 1
   545  		}),
   546  		new web3._extend.Method({
   547  			name: 'getNextEpochVote',
   548  			call: 'neat_getNextEpochVote'
   549  		}),
   550  		new web3._extend.Method({
   551  			name: 'getNextEpochValidators',
   552  			call: 'neat_getNextEpochValidators'
   553  		}),
   554  		new web3._extend.Method({
   555  			name: 'getValidatorStatus',
   556  			call: 'neat_getValidatorStatus',
   557  			params: 1,
   558  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   559  		}),
   560  		new web3._extend.Method({
   561  			name: 'unForbidden',
   562  			call: 'neat_unForbidden',
   563  			params: 2,
   564  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   565  		}),
   566  		new web3._extend.Method({
   567  			name: 'editValidator',
   568  			call: 'neat_editValidator',
   569  			params: 6,
   570  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, null, null, null, null]
   571  		}),
   572  		new web3._extend.Method({
   573  			name: 'getVoteHash',
   574  			call: 'neat_getVoteHash',
   575  			params: 4,
   576  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, null, null]
   577  		}),
   578  		new web3._extend.Method({
   579  			name: 'getConsensusPublicKey',
   580  			call: 'neat_getConsensusPublicKey',
   581  			params: 1
   582  		}),
   583  		new web3._extend.Method({
   584  			name: 'decodeExtraData',
   585  			call: 'neat_decodeExtraData',
   586  			params: 1
   587  		}),
   588  		new web3._extend.Method({
   589  			name: 'getCandidateList',
   590  			call: 'neat_getCandidateList',
   591  			params: 0
   592  		}),
   593  		new web3._extend.Method({
   594  			name: 'getForbiddenList',
   595  			call: 'neat_getForbiddenList',
   596  			params: 0
   597  		}),
   598  		new web3._extend.Method({
   599  			name: 'delegate',
   600  			call: 'neat_delegate',
   601  			params: 4
   602  		}),
   603  		new web3._extend.Method({
   604  			name: 'unDelegate',
   605  			call: 'neat_unDelegate',
   606  			params: 4
   607  		}),
   608  		new web3._extend.Method({
   609  			name: 'register',
   610  			call: 'neat_register',
   611  			params: 6
   612  		}),
   613  		new web3._extend.Method({
   614  			name: 'unRegister',
   615  			call: 'neat_unRegister',
   616  			params: 2
   617  		}),
   618  		new web3._extend.Method({
   619  			name: 'checkCandidate',
   620  			call: 'neat_checkCandidate',
   621  			params: 2,
   622  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter]
   623  		}),
   624  		new web3._extend.Method({
   625  			name: 'getForbiddenStatus',
   626  			call: 'neat_getForbiddenStatus',
   627  			params: 2,
   628  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter]
   629  		}),
   630  		new web3._extend.Method({
   631  			name: 'setCommission',
   632  			call: 'neat_setCommission',
   633  			params: 3,
   634  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, null]
   635  		})
   636  	],
   637  	properties: [
   638  		new web3._extend.Property({
   639  			name: 'pendingTransactions',
   640  			getter: 'eth_pendingTransactions',
   641  			outputFormatter: function(txs) {
   642  				var formatted = [];
   643  				for (var i = 0; i < txs.length; i++) {
   644  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   645  					formatted[i].blockHash = null;
   646  				}
   647  				return formatted;
   648  			}
   649  		}),
   650  	]
   651  });
   652  `
   653  
   654  const Miner_JS = `
   655  web3._extend({
   656  	property: 'miner',
   657  	methods: [
   658  		new web3._extend.Method({
   659  			name: 'start',
   660  			call: 'miner_start',
   661  			params: 1,
   662  			inputFormatter: [null]
   663  		}),
   664  		new web3._extend.Method({
   665  			name: 'stop',
   666  			call: 'miner_stop'
   667  		}),
   668  		new web3._extend.Method({
   669  			name: 'setEtherbase',
   670  			call: 'miner_setEtherbase',
   671  			params: 1,
   672  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   673  		}),
   674  		new web3._extend.Method({
   675  			name: 'setExtra',
   676  			call: 'miner_setExtra',
   677  			params: 1
   678  		}),
   679  		new web3._extend.Method({
   680  			name: 'setGasPrice',
   681  			call: 'miner_setGasPrice',
   682  			params: 1,
   683  			inputFormatter: [web3._extend.utils.fromDecimal]
   684  		}),
   685  		new web3._extend.Method({
   686  			name: 'getHashrate',
   687  			call: 'miner_getHashrate'
   688  		}),
   689  	],
   690  	properties: []
   691  });
   692  `
   693  
   694  const Net_JS = `
   695  web3._extend({
   696  	property: 'net',
   697  	methods: [],
   698  	properties: [
   699  		new web3._extend.Property({
   700  			name: 'version',
   701  			getter: 'net_version'
   702  		}),
   703  	]
   704  });
   705  `
   706  
   707  const Personal_JS = `
   708  web3._extend({
   709  	property: 'personal',
   710  	methods: [
   711  		new web3._extend.Method({
   712  			name: 'importRawKey',
   713  			call: 'personal_importRawKey',
   714  			params: 2
   715  		}),
   716  		new web3._extend.Method({
   717  			name: 'sign',
   718  			call: 'personal_sign',
   719  			params: 3,
   720  			inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
   721  		}),
   722  		new web3._extend.Method({
   723  			name: 'ecRecover',
   724  			call: 'personal_ecRecover',
   725  			params: 2
   726  		}),
   727  		new web3._extend.Method({
   728  			name: 'openWallet',
   729  			call: 'personal_openWallet',
   730  			params: 2
   731  		}),
   732  		new web3._extend.Method({
   733  			name: 'deriveAccount',
   734  			call: 'personal_deriveAccount',
   735  			params: 3
   736  		}),
   737  		new web3._extend.Method({
   738  			name: 'signTransaction',
   739  			call: 'personal_signTransaction',
   740  			params: 2,
   741  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
   742  		}),
   743  	],
   744  	properties: [
   745  		new web3._extend.Property({
   746  			name: 'listWallets',
   747  			getter: 'personal_listWallets'
   748  		}),
   749  	]
   750  })
   751  `
   752  
   753  const RPC_JS = `
   754  web3._extend({
   755  	property: 'rpc',
   756  	methods: [],
   757  	properties: [
   758  		new web3._extend.Property({
   759  			name: 'modules',
   760  			getter: 'rpc_modules'
   761  		}),
   762  	]
   763  });
   764  `
   765  
   766  const Shh_JS = `
   767  web3._extend({
   768  	property: 'shh',
   769  	methods: [
   770  	],
   771  	properties:
   772  	[
   773  		new web3._extend.Property({
   774  			name: 'version',
   775  			getter: 'shh_version',
   776  			outputFormatter: web3._extend.utils.toDecimal
   777  		}),
   778  		new web3._extend.Property({
   779  			name: 'info',
   780  			getter: 'shh_info'
   781  		}),
   782  	]
   783  });
   784  `
   785  
   786  const SWARMFS_JS = `
   787  web3._extend({
   788  	property: 'swarmfs',
   789  	methods:
   790  	[
   791  		new web3._extend.Method({
   792  			name: 'mount',
   793  			call: 'swarmfs_mount',
   794  			params: 2
   795  		}),
   796  		new web3._extend.Method({
   797  			name: 'unmount',
   798  			call: 'swarmfs_unmount',
   799  			params: 1
   800  		}),
   801  		new web3._extend.Method({
   802  			name: 'listmounts',
   803  			call: 'swarmfs_listmounts',
   804  			params: 0
   805  		}),
   806  	]
   807  });
   808  `
   809  
   810  const TxPool_JS = `
   811  web3._extend({
   812  	property: 'txpool',
   813  	methods: [],
   814  	properties:
   815  	[
   816  		new web3._extend.Property({
   817  			name: 'content',
   818  			getter: 'txpool_content'
   819  		}),
   820  		new web3._extend.Property({
   821  			name: 'inspect',
   822  			getter: 'txpool_inspect'
   823  		}),
   824  		new web3._extend.Property({
   825  			name: 'status',
   826  			getter: 'txpool_status',
   827  			outputFormatter: function(status) {
   828  				status.pending = web3._extend.utils.toDecimal(status.pending);
   829  				status.queued = web3._extend.utils.toDecimal(status.queued);
   830  				return status;
   831  			}
   832  		}),
   833  	]
   834  });
   835  `
   836  
   837  const Istanbul_JS = `
   838  web3._extend({
   839  	property: 'istanbul',
   840  	methods:
   841  	[
   842  		new web3._extend.Method({
   843  			name: 'getSnapshot',
   844  			call: 'istanbul_getSnapshot',
   845  			params: 1,
   846  			inputFormatter: [null]
   847  		}),
   848  		new web3._extend.Method({
   849  			name: 'getSnapshotAtHash',
   850  			call: 'istanbul_getSnapshotAtHash',
   851  			params: 1
   852  		}),
   853  		new web3._extend.Method({
   854  			name: 'getValidators',
   855  			call: 'istanbul_getValidators',
   856  			params: 1,
   857  			inputFormatter: [null]
   858  		}),
   859  		new web3._extend.Method({
   860  			name: 'getValidatorsAtHash',
   861  			call: 'istanbul_getValidatorsAtHash',
   862  			params: 1
   863  		}),
   864  		new web3._extend.Method({
   865  			name: 'propose',
   866  			call: 'istanbul_propose',
   867  			params: 2
   868  		}),
   869  		new web3._extend.Method({
   870  			name: 'discard',
   871  			call: 'istanbul_discard',
   872  			params: 1
   873  		})
   874  	],
   875  	properties:
   876  	[
   877  		new web3._extend.Property({
   878  			name: 'candidates',
   879  			getter: 'istanbul_candidates'
   880  		}),
   881  	]
   882  });
   883  `