github.com/tirogen/go-ethereum@v1.10.12-0.20221226051715-250cfede41b6/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 geth specific web3.js extensions.
    18  package web3ext
    19  
    20  var Modules = map[string]string{
    21  	"admin":    AdminJs,
    22  	"clique":   CliqueJs,
    23  	"ethash":   EthashJs,
    24  	"debug":    DebugJs,
    25  	"eth":      EthJs,
    26  	"miner":    MinerJs,
    27  	"net":      NetJs,
    28  	"personal": PersonalJs,
    29  	"rpc":      RpcJs,
    30  	"txpool":   TxpoolJs,
    31  	"les":      LESJs,
    32  	"vflux":    VfluxJs,
    33  }
    34  
    35  const CliqueJs = `
    36  web3._extend({
    37  	property: 'clique',
    38  	methods: [
    39  		new web3._extend.Method({
    40  			name: 'getSnapshot',
    41  			call: 'clique_getSnapshot',
    42  			params: 1,
    43  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
    44  		}),
    45  		new web3._extend.Method({
    46  			name: 'getSnapshotAtHash',
    47  			call: 'clique_getSnapshotAtHash',
    48  			params: 1
    49  		}),
    50  		new web3._extend.Method({
    51  			name: 'getSigners',
    52  			call: 'clique_getSigners',
    53  			params: 1,
    54  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
    55  		}),
    56  		new web3._extend.Method({
    57  			name: 'getSignersAtHash',
    58  			call: 'clique_getSignersAtHash',
    59  			params: 1
    60  		}),
    61  		new web3._extend.Method({
    62  			name: 'propose',
    63  			call: 'clique_propose',
    64  			params: 2
    65  		}),
    66  		new web3._extend.Method({
    67  			name: 'discard',
    68  			call: 'clique_discard',
    69  			params: 1
    70  		}),
    71  		new web3._extend.Method({
    72  			name: 'status',
    73  			call: 'clique_status',
    74  			params: 0
    75  		}),
    76  		new web3._extend.Method({
    77  			name: 'getSigner',
    78  			call: 'clique_getSigner',
    79  			params: 1,
    80  			inputFormatter: [null]
    81  		}),
    82  	],
    83  	properties: [
    84  		new web3._extend.Property({
    85  			name: 'proposals',
    86  			getter: 'clique_proposals'
    87  		}),
    88  	]
    89  });
    90  `
    91  
    92  const EthashJs = `
    93  web3._extend({
    94  	property: 'ethash',
    95  	methods: [
    96  		new web3._extend.Method({
    97  			name: 'getWork',
    98  			call: 'ethash_getWork',
    99  			params: 0
   100  		}),
   101  		new web3._extend.Method({
   102  			name: 'getHashrate',
   103  			call: 'ethash_getHashrate',
   104  			params: 0
   105  		}),
   106  		new web3._extend.Method({
   107  			name: 'submitWork',
   108  			call: 'ethash_submitWork',
   109  			params: 3,
   110  		}),
   111  		new web3._extend.Method({
   112  			name: 'submitHashrate',
   113  			call: 'ethash_submitHashrate',
   114  			params: 2,
   115  		}),
   116  	]
   117  });
   118  `
   119  
   120  const AdminJs = `
   121  web3._extend({
   122  	property: 'admin',
   123  	methods: [
   124  		new web3._extend.Method({
   125  			name: 'addPeer',
   126  			call: 'admin_addPeer',
   127  			params: 1
   128  		}),
   129  		new web3._extend.Method({
   130  			name: 'removePeer',
   131  			call: 'admin_removePeer',
   132  			params: 1
   133  		}),
   134  		new web3._extend.Method({
   135  			name: 'addTrustedPeer',
   136  			call: 'admin_addTrustedPeer',
   137  			params: 1
   138  		}),
   139  		new web3._extend.Method({
   140  			name: 'removeTrustedPeer',
   141  			call: 'admin_removeTrustedPeer',
   142  			params: 1
   143  		}),
   144  		new web3._extend.Method({
   145  			name: 'exportChain',
   146  			call: 'admin_exportChain',
   147  			params: 3,
   148  			inputFormatter: [null, null, null]
   149  		}),
   150  		new web3._extend.Method({
   151  			name: 'importChain',
   152  			call: 'admin_importChain',
   153  			params: 1
   154  		}),
   155  		new web3._extend.Method({
   156  			name: 'sleepBlocks',
   157  			call: 'admin_sleepBlocks',
   158  			params: 2
   159  		}),
   160  		new web3._extend.Method({
   161  			name: 'startHTTP',
   162  			call: 'admin_startHTTP',
   163  			params: 5,
   164  			inputFormatter: [null, null, null, null, null]
   165  		}),
   166  		new web3._extend.Method({
   167  			name: 'stopHTTP',
   168  			call: 'admin_stopHTTP'
   169  		}),
   170  		// This method is deprecated.
   171  		new web3._extend.Method({
   172  			name: 'startRPC',
   173  			call: 'admin_startRPC',
   174  			params: 5,
   175  			inputFormatter: [null, null, null, null, null]
   176  		}),
   177  		// This method is deprecated.
   178  		new web3._extend.Method({
   179  			name: 'stopRPC',
   180  			call: 'admin_stopRPC'
   181  		}),
   182  		new web3._extend.Method({
   183  			name: 'startWS',
   184  			call: 'admin_startWS',
   185  			params: 4,
   186  			inputFormatter: [null, null, null, null]
   187  		}),
   188  		new web3._extend.Method({
   189  			name: 'stopWS',
   190  			call: 'admin_stopWS'
   191  		}),
   192  	],
   193  	properties: [
   194  		new web3._extend.Property({
   195  			name: 'nodeInfo',
   196  			getter: 'admin_nodeInfo'
   197  		}),
   198  		new web3._extend.Property({
   199  			name: 'peers',
   200  			getter: 'admin_peers'
   201  		}),
   202  		new web3._extend.Property({
   203  			name: 'datadir',
   204  			getter: 'admin_datadir'
   205  		}),
   206  	]
   207  });
   208  `
   209  
   210  const DebugJs = `
   211  web3._extend({
   212  	property: 'debug',
   213  	methods: [
   214  		new web3._extend.Method({
   215  			name: 'accountRange',
   216  			call: 'debug_accountRange',
   217  			params: 6,
   218  			inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter, null, null, null, null, null],
   219  		}),
   220  		new web3._extend.Method({
   221  			name: 'printBlock',
   222  			call: 'debug_printBlock',
   223  			params: 1,
   224  			outputFormatter: console.log
   225  		}),
   226  		new web3._extend.Method({
   227  			name: 'getRawHeader',
   228  			call: 'debug_getRawHeader',
   229  			params: 1
   230  		}),
   231  		new web3._extend.Method({
   232  			name: 'getRawBlock',
   233  			call: 'debug_getRawBlock',
   234  			params: 1
   235  		}),
   236  		new web3._extend.Method({
   237  			name: 'getRawReceipts',
   238  			call: 'debug_getRawReceipts',
   239  			params: 1
   240  		}),
   241  		new web3._extend.Method({
   242  			name: 'getRawTransaction',
   243  			call: 'debug_getRawTransaction',
   244  			params: 1
   245  		}),
   246  		new web3._extend.Method({
   247  			name: 'setHead',
   248  			call: 'debug_setHead',
   249  			params: 1
   250  		}),
   251  		new web3._extend.Method({
   252  			name: 'seedHash',
   253  			call: 'debug_seedHash',
   254  			params: 1
   255  		}),
   256  		new web3._extend.Method({
   257  			name: 'dumpBlock',
   258  			call: 'debug_dumpBlock',
   259  			params: 1,
   260  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   261  		}),
   262  		new web3._extend.Method({
   263  			name: 'chaindbProperty',
   264  			call: 'debug_chaindbProperty',
   265  			params: 1,
   266  			outputFormatter: console.log
   267  		}),
   268  		new web3._extend.Method({
   269  			name: 'chaindbCompact',
   270  			call: 'debug_chaindbCompact',
   271  		}),
   272  		new web3._extend.Method({
   273  			name: 'verbosity',
   274  			call: 'debug_verbosity',
   275  			params: 1
   276  		}),
   277  		new web3._extend.Method({
   278  			name: 'vmodule',
   279  			call: 'debug_vmodule',
   280  			params: 1
   281  		}),
   282  		new web3._extend.Method({
   283  			name: 'backtraceAt',
   284  			call: 'debug_backtraceAt',
   285  			params: 1,
   286  		}),
   287  		new web3._extend.Method({
   288  			name: 'stacks',
   289  			call: 'debug_stacks',
   290  			params: 1,
   291  			inputFormatter: [null],
   292  			outputFormatter: console.log
   293  		}),
   294  		new web3._extend.Method({
   295  			name: 'freeOSMemory',
   296  			call: 'debug_freeOSMemory',
   297  			params: 0,
   298  		}),
   299  		new web3._extend.Method({
   300  			name: 'setGCPercent',
   301  			call: 'debug_setGCPercent',
   302  			params: 1,
   303  		}),
   304  		new web3._extend.Method({
   305  			name: 'memStats',
   306  			call: 'debug_memStats',
   307  			params: 0,
   308  		}),
   309  		new web3._extend.Method({
   310  			name: 'gcStats',
   311  			call: 'debug_gcStats',
   312  			params: 0,
   313  		}),
   314  		new web3._extend.Method({
   315  			name: 'cpuProfile',
   316  			call: 'debug_cpuProfile',
   317  			params: 2
   318  		}),
   319  		new web3._extend.Method({
   320  			name: 'startCPUProfile',
   321  			call: 'debug_startCPUProfile',
   322  			params: 1
   323  		}),
   324  		new web3._extend.Method({
   325  			name: 'stopCPUProfile',
   326  			call: 'debug_stopCPUProfile',
   327  			params: 0
   328  		}),
   329  		new web3._extend.Method({
   330  			name: 'goTrace',
   331  			call: 'debug_goTrace',
   332  			params: 2
   333  		}),
   334  		new web3._extend.Method({
   335  			name: 'startGoTrace',
   336  			call: 'debug_startGoTrace',
   337  			params: 1
   338  		}),
   339  		new web3._extend.Method({
   340  			name: 'stopGoTrace',
   341  			call: 'debug_stopGoTrace',
   342  			params: 0
   343  		}),
   344  		new web3._extend.Method({
   345  			name: 'blockProfile',
   346  			call: 'debug_blockProfile',
   347  			params: 2
   348  		}),
   349  		new web3._extend.Method({
   350  			name: 'setBlockProfileRate',
   351  			call: 'debug_setBlockProfileRate',
   352  			params: 1
   353  		}),
   354  		new web3._extend.Method({
   355  			name: 'writeBlockProfile',
   356  			call: 'debug_writeBlockProfile',
   357  			params: 1
   358  		}),
   359  		new web3._extend.Method({
   360  			name: 'mutexProfile',
   361  			call: 'debug_mutexProfile',
   362  			params: 2
   363  		}),
   364  		new web3._extend.Method({
   365  			name: 'setMutexProfileFraction',
   366  			call: 'debug_setMutexProfileFraction',
   367  			params: 1
   368  		}),
   369  		new web3._extend.Method({
   370  			name: 'writeMutexProfile',
   371  			call: 'debug_writeMutexProfile',
   372  			params: 1
   373  		}),
   374  		new web3._extend.Method({
   375  			name: 'writeMemProfile',
   376  			call: 'debug_writeMemProfile',
   377  			params: 1
   378  		}),
   379  		new web3._extend.Method({
   380  			name: 'traceBlock',
   381  			call: 'debug_traceBlock',
   382  			params: 2,
   383  			inputFormatter: [null, null]
   384  		}),
   385  		new web3._extend.Method({
   386  			name: 'traceBlockFromFile',
   387  			call: 'debug_traceBlockFromFile',
   388  			params: 2,
   389  			inputFormatter: [null, null]
   390  		}),
   391  		new web3._extend.Method({
   392  			name: 'traceBadBlock',
   393  			call: 'debug_traceBadBlock',
   394  			params: 1,
   395  			inputFormatter: [null]
   396  		}),
   397  		new web3._extend.Method({
   398  			name: 'standardTraceBadBlockToFile',
   399  			call: 'debug_standardTraceBadBlockToFile',
   400  			params: 2,
   401  			inputFormatter: [null, null]
   402  		}),
   403  		new web3._extend.Method({
   404  			name: 'intermediateRoots',
   405  			call: 'debug_intermediateRoots',
   406  			params: 2,
   407  			inputFormatter: [null, null]
   408  		}),
   409  		new web3._extend.Method({
   410  			name: 'standardTraceBlockToFile',
   411  			call: 'debug_standardTraceBlockToFile',
   412  			params: 2,
   413  			inputFormatter: [null, null]
   414  		}),
   415  		new web3._extend.Method({
   416  			name: 'traceBlockByNumber',
   417  			call: 'debug_traceBlockByNumber',
   418  			params: 2,
   419  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, null]
   420  		}),
   421  		new web3._extend.Method({
   422  			name: 'traceBlockByHash',
   423  			call: 'debug_traceBlockByHash',
   424  			params: 2,
   425  			inputFormatter: [null, null]
   426  		}),
   427  		new web3._extend.Method({
   428  			name: 'traceTransaction',
   429  			call: 'debug_traceTransaction',
   430  			params: 2,
   431  			inputFormatter: [null, null]
   432  		}),
   433  		new web3._extend.Method({
   434  			name: 'traceCall',
   435  			call: 'debug_traceCall',
   436  			params: 3,
   437  			inputFormatter: [null, null, null]
   438  		}),
   439  		new web3._extend.Method({
   440  			name: 'preimage',
   441  			call: 'debug_preimage',
   442  			params: 1,
   443  			inputFormatter: [null]
   444  		}),
   445  		new web3._extend.Method({
   446  			name: 'getBadBlocks',
   447  			call: 'debug_getBadBlocks',
   448  			params: 0,
   449  		}),
   450  		new web3._extend.Method({
   451  			name: 'storageRangeAt',
   452  			call: 'debug_storageRangeAt',
   453  			params: 5,
   454  		}),
   455  		new web3._extend.Method({
   456  			name: 'getModifiedAccountsByNumber',
   457  			call: 'debug_getModifiedAccountsByNumber',
   458  			params: 2,
   459  			inputFormatter: [null, null],
   460  		}),
   461  		new web3._extend.Method({
   462  			name: 'getModifiedAccountsByHash',
   463  			call: 'debug_getModifiedAccountsByHash',
   464  			params: 2,
   465  			inputFormatter:[null, null],
   466  		}),
   467  		new web3._extend.Method({
   468  			name: 'freezeClient',
   469  			call: 'debug_freezeClient',
   470  			params: 1,
   471  		}),
   472  		new web3._extend.Method({
   473  			name: 'getAccessibleState',
   474  			call: 'debug_getAccessibleState',
   475  			params: 2,
   476  			inputFormatter:[web3._extend.formatters.inputBlockNumberFormatter, web3._extend.formatters.inputBlockNumberFormatter],
   477  		}),
   478  		new web3._extend.Method({
   479  			name: 'dbGet',
   480  			call: 'debug_dbGet',
   481  			params: 1
   482  		}),
   483  		new web3._extend.Method({
   484  			name: 'dbAncient',
   485  			call: 'debug_dbAncient',
   486  			params: 2
   487  		}),
   488  		new web3._extend.Method({
   489  			name: 'dbAncients',
   490  			call: 'debug_dbAncients',
   491  			params: 0
   492  		}),
   493  		new web3._extend.Method({
   494  			name: 'setTrieFlushInterval',
   495  			call: 'debug_setTrieFlushInterval',
   496  			params: 1
   497  		}),
   498  	],
   499  	properties: []
   500  });
   501  `
   502  
   503  const EthJs = `
   504  web3._extend({
   505  	property: 'eth',
   506  	methods: [
   507  		new web3._extend.Method({
   508  			name: 'chainId',
   509  			call: 'eth_chainId',
   510  			params: 0
   511  		}),
   512  		new web3._extend.Method({
   513  			name: 'sign',
   514  			call: 'eth_sign',
   515  			params: 2,
   516  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   517  		}),
   518  		new web3._extend.Method({
   519  			name: 'resend',
   520  			call: 'eth_resend',
   521  			params: 3,
   522  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   523  		}),
   524  		new web3._extend.Method({
   525  			name: 'signTransaction',
   526  			call: 'eth_signTransaction',
   527  			params: 1,
   528  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   529  		}),
   530  		new web3._extend.Method({
   531  			name: 'estimateGas',
   532  			call: 'eth_estimateGas',
   533  			params: 2,
   534  			inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
   535  			outputFormatter: web3._extend.utils.toDecimal
   536  		}),
   537  		new web3._extend.Method({
   538  			name: 'submitTransaction',
   539  			call: 'eth_submitTransaction',
   540  			params: 1,
   541  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   542  		}),
   543  		new web3._extend.Method({
   544  			name: 'fillTransaction',
   545  			call: 'eth_fillTransaction',
   546  			params: 1,
   547  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   548  		}),
   549  		new web3._extend.Method({
   550  			name: 'getHeaderByNumber',
   551  			call: 'eth_getHeaderByNumber',
   552  			params: 1,
   553  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   554  		}),
   555  		new web3._extend.Method({
   556  			name: 'getHeaderByHash',
   557  			call: 'eth_getHeaderByHash',
   558  			params: 1
   559  		}),
   560  		new web3._extend.Method({
   561  			name: 'getBlockByNumber',
   562  			call: 'eth_getBlockByNumber',
   563  			params: 2,
   564  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, function (val) { return !!val; }]
   565  		}),
   566  		new web3._extend.Method({
   567  			name: 'getBlockByHash',
   568  			call: 'eth_getBlockByHash',
   569  			params: 2,
   570  			inputFormatter: [null, function (val) { return !!val; }]
   571  		}),
   572  		new web3._extend.Method({
   573  			name: 'getRawTransaction',
   574  			call: 'eth_getRawTransactionByHash',
   575  			params: 1
   576  		}),
   577  		new web3._extend.Method({
   578  			name: 'getRawTransactionFromBlock',
   579  			call: function(args) {
   580  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
   581  			},
   582  			params: 2,
   583  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   584  		}),
   585  		new web3._extend.Method({
   586  			name: 'getProof',
   587  			call: 'eth_getProof',
   588  			params: 3,
   589  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter]
   590  		}),
   591  		new web3._extend.Method({
   592  			name: 'createAccessList',
   593  			call: 'eth_createAccessList',
   594  			params: 2,
   595  			inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter],
   596  		}),
   597  		new web3._extend.Method({
   598  			name: 'feeHistory',
   599  			call: 'eth_feeHistory',
   600  			params: 3,
   601  			inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter, null]
   602  		}),
   603  		new web3._extend.Method({
   604  			name: 'getLogs',
   605  			call: 'eth_getLogs',
   606  			params: 1,
   607  		}),
   608  		new web3._extend.Method({
   609  			name: 'call',
   610  			call: 'eth_call',
   611  			params: 3,
   612  			inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter, null],
   613  		}),
   614  	],
   615  	properties: [
   616  		new web3._extend.Property({
   617  			name: 'pendingTransactions',
   618  			getter: 'eth_pendingTransactions',
   619  			outputFormatter: function(txs) {
   620  				var formatted = [];
   621  				for (var i = 0; i < txs.length; i++) {
   622  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   623  					formatted[i].blockHash = null;
   624  				}
   625  				return formatted;
   626  			}
   627  		}),
   628  		new web3._extend.Property({
   629  			name: 'maxPriorityFeePerGas',
   630  			getter: 'eth_maxPriorityFeePerGas',
   631  			outputFormatter: web3._extend.utils.toBigNumber
   632  		}),
   633  	]
   634  });
   635  `
   636  
   637  const MinerJs = `
   638  web3._extend({
   639  	property: 'miner',
   640  	methods: [
   641  		new web3._extend.Method({
   642  			name: 'start',
   643  			call: 'miner_start',
   644  			params: 1,
   645  			inputFormatter: [null]
   646  		}),
   647  		new web3._extend.Method({
   648  			name: 'stop',
   649  			call: 'miner_stop'
   650  		}),
   651  		new web3._extend.Method({
   652  			name: 'setEtherbase',
   653  			call: 'miner_setEtherbase',
   654  			params: 1,
   655  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   656  		}),
   657  		new web3._extend.Method({
   658  			name: 'setExtra',
   659  			call: 'miner_setExtra',
   660  			params: 1
   661  		}),
   662  		new web3._extend.Method({
   663  			name: 'setGasPrice',
   664  			call: 'miner_setGasPrice',
   665  			params: 1,
   666  			inputFormatter: [web3._extend.utils.fromDecimal]
   667  		}),
   668  		new web3._extend.Method({
   669  			name: 'setGasLimit',
   670  			call: 'miner_setGasLimit',
   671  			params: 1,
   672  			inputFormatter: [web3._extend.utils.fromDecimal]
   673  		}),
   674  		new web3._extend.Method({
   675  			name: 'setRecommitInterval',
   676  			call: 'miner_setRecommitInterval',
   677  			params: 1,
   678  		}),
   679  		new web3._extend.Method({
   680  			name: 'getHashrate',
   681  			call: 'miner_getHashrate'
   682  		}),
   683  	],
   684  	properties: []
   685  });
   686  `
   687  
   688  const NetJs = `
   689  web3._extend({
   690  	property: 'net',
   691  	methods: [],
   692  	properties: [
   693  		new web3._extend.Property({
   694  			name: 'version',
   695  			getter: 'net_version'
   696  		}),
   697  	]
   698  });
   699  `
   700  
   701  const PersonalJs = `
   702  web3._extend({
   703  	property: 'personal',
   704  	methods: [
   705  		new web3._extend.Method({
   706  			name: 'importRawKey',
   707  			call: 'personal_importRawKey',
   708  			params: 2
   709  		}),
   710  		new web3._extend.Method({
   711  			name: 'sign',
   712  			call: 'personal_sign',
   713  			params: 3,
   714  			inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
   715  		}),
   716  		new web3._extend.Method({
   717  			name: 'ecRecover',
   718  			call: 'personal_ecRecover',
   719  			params: 2
   720  		}),
   721  		new web3._extend.Method({
   722  			name: 'openWallet',
   723  			call: 'personal_openWallet',
   724  			params: 2
   725  		}),
   726  		new web3._extend.Method({
   727  			name: 'deriveAccount',
   728  			call: 'personal_deriveAccount',
   729  			params: 3
   730  		}),
   731  		new web3._extend.Method({
   732  			name: 'signTransaction',
   733  			call: 'personal_signTransaction',
   734  			params: 2,
   735  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
   736  		}),
   737  		new web3._extend.Method({
   738  			name: 'unpair',
   739  			call: 'personal_unpair',
   740  			params: 2
   741  		}),
   742  		new web3._extend.Method({
   743  			name: 'initializeWallet',
   744  			call: 'personal_initializeWallet',
   745  			params: 1
   746  		})
   747  	],
   748  	properties: [
   749  		new web3._extend.Property({
   750  			name: 'listWallets',
   751  			getter: 'personal_listWallets'
   752  		}),
   753  	]
   754  })
   755  `
   756  
   757  const RpcJs = `
   758  web3._extend({
   759  	property: 'rpc',
   760  	methods: [],
   761  	properties: [
   762  		new web3._extend.Property({
   763  			name: 'modules',
   764  			getter: 'rpc_modules'
   765  		}),
   766  	]
   767  });
   768  `
   769  
   770  const TxpoolJs = `
   771  web3._extend({
   772  	property: 'txpool',
   773  	methods: [],
   774  	properties:
   775  	[
   776  		new web3._extend.Property({
   777  			name: 'content',
   778  			getter: 'txpool_content'
   779  		}),
   780  		new web3._extend.Property({
   781  			name: 'inspect',
   782  			getter: 'txpool_inspect'
   783  		}),
   784  		new web3._extend.Property({
   785  			name: 'status',
   786  			getter: 'txpool_status',
   787  			outputFormatter: function(status) {
   788  				status.pending = web3._extend.utils.toDecimal(status.pending);
   789  				status.queued = web3._extend.utils.toDecimal(status.queued);
   790  				return status;
   791  			}
   792  		}),
   793  		new web3._extend.Method({
   794  			name: 'contentFrom',
   795  			call: 'txpool_contentFrom',
   796  			params: 1,
   797  		}),
   798  	]
   799  });
   800  `
   801  
   802  const LESJs = `
   803  web3._extend({
   804  	property: 'les',
   805  	methods:
   806  	[
   807  		new web3._extend.Method({
   808  			name: 'getCheckpoint',
   809  			call: 'les_getCheckpoint',
   810  			params: 1
   811  		}),
   812  		new web3._extend.Method({
   813  			name: 'clientInfo',
   814  			call: 'les_clientInfo',
   815  			params: 1
   816  		}),
   817  		new web3._extend.Method({
   818  			name: 'priorityClientInfo',
   819  			call: 'les_priorityClientInfo',
   820  			params: 3
   821  		}),
   822  		new web3._extend.Method({
   823  			name: 'setClientParams',
   824  			call: 'les_setClientParams',
   825  			params: 2
   826  		}),
   827  		new web3._extend.Method({
   828  			name: 'setDefaultParams',
   829  			call: 'les_setDefaultParams',
   830  			params: 1
   831  		}),
   832  		new web3._extend.Method({
   833  			name: 'addBalance',
   834  			call: 'les_addBalance',
   835  			params: 2
   836  		}),
   837  	],
   838  	properties:
   839  	[
   840  		new web3._extend.Property({
   841  			name: 'latestCheckpoint',
   842  			getter: 'les_latestCheckpoint'
   843  		}),
   844  		new web3._extend.Property({
   845  			name: 'checkpointContractAddress',
   846  			getter: 'les_getCheckpointContractAddress'
   847  		}),
   848  		new web3._extend.Property({
   849  			name: 'serverInfo',
   850  			getter: 'les_serverInfo'
   851  		}),
   852  	]
   853  });
   854  `
   855  
   856  const VfluxJs = `
   857  web3._extend({
   858  	property: 'vflux',
   859  	methods:
   860  	[
   861  		new web3._extend.Method({
   862  			name: 'distribution',
   863  			call: 'vflux_distribution',
   864  			params: 2
   865  		}),
   866  		new web3._extend.Method({
   867  			name: 'timeout',
   868  			call: 'vflux_timeout',
   869  			params: 2
   870  		}),
   871  		new web3._extend.Method({
   872  			name: 'value',
   873  			call: 'vflux_value',
   874  			params: 2
   875  		}),
   876  	],
   877  	properties:
   878  	[
   879  		new web3._extend.Property({
   880  			name: 'requestStats',
   881  			getter: 'vflux_requestStats'
   882  		}),
   883  	]
   884  });
   885  `