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