github.com/DxChainNetwork/dxc@v0.8.1-0.20220824085222-1162e304b6e7/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  	"dpos":     DposJs,
    24  	"ethash":   EthashJs,
    25  	"debug":    DebugJs,
    26  	"eth":      EthJs,
    27  	"miner":    MinerJs,
    28  	"net":      NetJs,
    29  	"personal": PersonalJs,
    30  	"rpc":      RpcJs,
    31  	"txpool":   TxpoolJs,
    32  	"les":      LESJs,
    33  	"vflux":    VfluxJs,
    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 DposJs = `
    94  web3._extend({
    95  	property: 'dpos',
    96  	methods: [
    97  		new web3._extend.Method({
    98  			name: 'getSnapshot',
    99  			call: 'dpos_getSnapshot',
   100  			params: 1,
   101  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   102  		}),
   103  		new web3._extend.Method({
   104  			name: 'getSnapshotAtHash',
   105  			call: 'dpos_getSnapshotAtHash',
   106  			params: 1
   107  		}),
   108  		new web3._extend.Method({
   109  			name: 'getValidators',
   110  			call: 'dpos_getValidators',
   111  			params: 1,
   112  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   113  		}),
   114  		new web3._extend.Method({
   115  			name: 'getValidatorsAtHash',
   116  			call: 'dpos_getValidatorsAtHash',
   117  			params: 1
   118  		}),
   119  		new web3._extend.Method({
   120  			name: 'base',
   121  			call: 'dpos_getBaseInfos',
   122  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   123  			params: 1
   124  		}),
   125  		new web3._extend.Method({
   126  			name: 'validator',
   127  			call: 'dpos_getValidator',
   128  			params: 2,
   129  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter]
   130  		}),
   131  		new web3._extend.Method({
   132  			name: 'totalDeposit',
   133  			call: 'dpos_getTotalDeposit',
   134  			params: 1,
   135  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   136  		}),
   137  		new web3._extend.Method({
   138  			name: 'totalVotes',
   139  			call: 'dpos_getTotalVotes',
   140  			params: 1,
   141  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   142  		}),
   143  		new web3._extend.Method({
   144  			name: 'currentEpochValidators',
   145  			call: 'dpos_getCurrentEpochValidators',
   146  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   147  			params: 1
   148  		}),
   149  		new web3._extend.Method({
   150  			name: 'effictiveValidators',
   151  			call: 'dpos_getEffictiveValidators',
   152  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   153  			params: 1
   154  		}),
   155  		new web3._extend.Method({
   156  			name: 'cancelQueueValidators',
   157  			call: 'dpos_getCancelQueueValidators',
   158  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   159  			params: 1
   160  		}),
   161  		new web3._extend.Method({
   162  			name: 'invalidValidators',
   163  			call: 'dpos_getInvalidValidators',
   164  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   165  			params: 1
   166  		}),
   167  		new web3._extend.Method({
   168  			name: 'validatorVoters',
   169  			call: 'dpos_getValidatorVoters',
   170  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   171  			params: 2
   172  		}),
   173  		new web3._extend.Method({
   174  			name: 'effictiveValsLength',
   175  			call: 'dpos_effictiveValsLength',
   176  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   177  			params: 1
   178  		}),
   179  		new web3._extend.Method({
   180  			name: 'invalidValsLength',
   181  			call: 'dpos_invalidValsLength',
   182  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   183  			params: 1
   184  		}),
   185  		new web3._extend.Method({
   186  			name: 'cancelQueueValsLength',
   187  			call: 'dpos_cancelQueueValidatorsLength',
   188  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   189  			params: 1
   190  		}),
   191  		new web3._extend.Method({
   192  			name: 'validatorVotersLength',
   193  			call: 'dpos_validatorVotersLength',
   194  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   195  			params: 2
   196  		}),
   197  		new web3._extend.Method({
   198  			name: 'isEffictiveValidator',
   199  			call: 'dpos_isEffictiveValidator',
   200  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   201  			params: 2
   202  		}),
   203  		new web3._extend.Method({
   204  			name: 'allProposalIds',
   205  			call: 'dpos_getAllProposalSets',
   206  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   207  			params: 1
   208  		}),
   209  		new web3._extend.Method({
   210  			name: 'addressProposalIds',
   211  			call: 'dpos_getAddressProposalSets',
   212  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   213  			params: 2
   214  		}),
   215  		new web3._extend.Method({
   216  			name: 'allProposals',
   217  			call: 'dpos_getAllProposals',
   218  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   219  			params: 1
   220  		}),
   221  		new web3._extend.Method({
   222  			name: 'proposal',
   223  			call: 'dpos_getProposal',
   224  			inputFormatter: [null,web3._extend.formatters.inputBlockNumberFormatter],
   225  			params: 2
   226  		}),
   227  		new web3._extend.Method({
   228  			name: 'addressProposals',
   229  			call: 'dpos_getAddressProposals',
   230  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   231  			params: 2
   232  		}),
   233  		new web3._extend.Method({
   234  			name: 'allProposalsCount',
   235  			call: 'dpos_getProposalCount',
   236  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter],
   237  			params: 1
   238  		}),
   239  		new web3._extend.Method({
   240  			name: 'addressProposalsCount',
   241  			call: 'dpos_getAddressProposalCount',
   242  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   243  			params: 2
   244  		}),
   245  		new web3._extend.Method({
   246  			name: 'pendingVoteReward',
   247  			call: 'dpos_pendingVoteReward',
   248  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   249  			params: 3
   250  		}),
   251  		new web3._extend.Method({
   252  			name: 'pendingVoteRedeem',
   253  			call: 'dpos_pendingVoteRedeem',
   254  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   255  			params: 3
   256  		}),
   257  		new web3._extend.Method({
   258  			name: 'voteListLength',
   259  			call: 'dpos_voteListLength',
   260  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   261  			params: 2
   262  		}),
   263  		new web3._extend.Method({
   264  			name: 'votesRewardRedeemInfo',
   265  			call: 'dpos_votesRewardRedeemInfo',
   266  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   267  			params: 3
   268  		}),
   269  		new web3._extend.Method({
   270  			name: 'votesRewardRedeemInfos',
   271  			call: 'dpos_votesRewardRedeemInfos',
   272  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   273  			params: 2
   274  		}),
   275  		new web3._extend.Method({
   276  			name: 'epochInfo',
   277  			call: 'dpos_epochInfo',
   278  			inputFormatter: [null,web3._extend.formatters.inputBlockNumberFormatter],
   279  			params: 2
   280  		}),
   281  		new web3._extend.Method({
   282  			name: 'kickoutInfo',
   283  			call: 'dpos_kickoutInfo',
   284  			inputFormatter: [null,web3._extend.formatters.inputBlockNumberFormatter],
   285  			params: 2
   286  		}),
   287  		new web3._extend.Method({
   288  			name: 'punishInfo',
   289  			call: 'dpos_punishInfo',
   290  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,null,web3._extend.formatters.inputBlockNumberFormatter],
   291  			params: 3
   292  		}),
   293  		new web3._extend.Method({
   294  			name: 'validatorRewardInfoByEpoch',
   295  			call: 'dpos_validatorRewardInfoByEpoch',
   296  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,null,web3._extend.formatters.inputBlockNumberFormatter],
   297  			params: 3
   298  		}),
   299  		new web3._extend.Method({
   300  			name: 'pendingValidatorReward',
   301  			call: 'dpos_pendingValidatorReward',
   302  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   303  			params: 2
   304  		}),
   305  		new web3._extend.Method({
   306  			name: 'validatorRewardsInfo',
   307  			call: 'dpos_validatorRewardsInfo',
   308  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputBlockNumberFormatter],
   309  			params: 2
   310  		}),
   311  		new web3._extend.Method({
   312  			name: 'initProposal',
   313  			call: 'dpos_initProposal',
   314  			inputFormatter: [null,null,null,null,function(options) {
   315  				options = options == undefined? {} : options
   316  				return web3._extend.formatters.inputCallFormatter(options)
   317  			}],
   318  			params: 5
   319  		}),
   320  		new web3._extend.Method({
   321  			name: 'updateProposal',
   322  			call: 'dpos_updateProposal',
   323  			inputFormatter: [null,null,web3.fromDecimal, null, null, function(options) {
   324  				options = options == undefined? {} : options
   325  				return web3._extend.formatters.inputCallFormatter(options)
   326  			}],
   327  			params: 6
   328  		}),
   329  		new web3._extend.Method({
   330  			name: 'cancelProposal',
   331  			call: 'dpos_cancelProposal',
   332  			inputFormatter: [null,function(options) {
   333  				options = options == undefined? {} : options
   334  				return web3._extend.formatters.inputCallFormatter(options)
   335  			}],
   336  			params: 2
   337  		}),
   338  		new web3._extend.Method({
   339  			name: 'guarantee',
   340  			call: 'dpos_guarantee',
   341  			inputFormatter: [null,function(options) {
   342  				options = options == undefined? {} : options
   343  				return web3._extend.formatters.inputCallFormatter(options)
   344  			}],
   345  			params: 2
   346  		}),
   347  		new web3._extend.Method({
   348  			name: 'updateValidatorDeposit',
   349  			call: 'dpos_updateValidatorDeposit',
   350  			inputFormatter: [web3.fromDecimal,function(options) {
   351  				options = options == undefined? {} : options
   352  				return web3._extend.formatters.inputCallFormatter(options)
   353  			}],
   354  			params: 2
   355  		}),
   356  		new web3._extend.Method({
   357  			name: 'updateValidatorRate',
   358  			call: 'dpos_updateValidatorRate',
   359  			inputFormatter: [null,function(options) {
   360  				options = options == undefined? {} : options
   361  				return web3._extend.formatters.inputCallFormatter(options)
   362  			}],
   363  			params: 2
   364  		}),
   365  		new web3._extend.Method({
   366  			name: 'updateValidatorNameDetails',
   367  			call: 'dpos_updateValidatorNameDetails',
   368  			inputFormatter: [null,null,function(options) {
   369  				options = options == undefined? {} : options
   370  				return web3._extend.formatters.inputCallFormatter(options)
   371  			}],
   372  			params: 3
   373  		}),
   374  		new web3._extend.Method({
   375  			name: 'unstake',
   376  			call: 'dpos_unstake',
   377  			inputFormatter: [function(options) {
   378  				options = options == undefined? {} : options
   379  				return web3._extend.formatters.inputCallFormatter(options)
   380  			}],
   381  			params: 1
   382  		}),
   383  		new web3._extend.Method({
   384  			name: 'restore',
   385  			call: 'dpos_restore',
   386  			inputFormatter: [function(options) {
   387  				options = options == undefined? {} : options
   388  				return web3._extend.formatters.inputCallFormatter(options)
   389  			}],
   390  			params: 1
   391  		}),
   392  		new web3._extend.Method({
   393  			name: 'validatorRedeem',
   394  			call: 'dpos_validatorRedeem',
   395  			inputFormatter: [function(options) {
   396  				options = options == undefined? {} : options
   397  				return web3._extend.formatters.inputCallFormatter(options)
   398  			}],
   399  			params: 1
   400  		}),
   401  		new web3._extend.Method({
   402  			name: 'earnValidatorReward',
   403  			call: 'dpos_earnValidatorReward',
   404  			inputFormatter: [function(options) {
   405  				options = options == undefined? {} : options
   406  				return web3._extend.formatters.inputCallFormatter(options)
   407  			}],
   408  			params: 1
   409  		}),
   410  		new web3._extend.Method({
   411  			name: 'earnVoteReward',
   412  			call: 'dpos_earnVoteReward',
   413  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,function(options) {
   414  				options = options == undefined? {} : options
   415  				return web3._extend.formatters.inputCallFormatter(options)
   416  			}],
   417  			params: 2
   418  		}),
   419  		new web3._extend.Method({
   420  			name: 'vote',
   421  			call: 'dpos_vote',
   422  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,function(options) {
   423  				options = options == undefined? {} : options
   424  				return web3._extend.formatters.inputCallFormatter(options)
   425  			}],
   426  			params: 2
   427  		}),
   428  		new web3._extend.Method({
   429  			name: 'cancelVote',
   430  			call: 'dpos_cancelVote',
   431  			inputFormatter: [web3._extend.formatters.inputAddressFormatter,web3.fromDecimal,function(options) {
   432  				options = options == undefined? {} : options
   433  				return web3._extend.formatters.inputCallFormatter(options)
   434  			}],
   435  			params: 3
   436  		}),
   437  		new web3._extend.Method({
   438  			name: 'voterRedeem',
   439  			call: 'dpos_voterRedeem',
   440  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, function(options) {
   441  				options = options == undefined? {} : options
   442  				return web3._extend.formatters.inputCallFormatter(options)
   443  			}],
   444  			params: 2
   445  		}),
   446  	],
   447  });
   448  `
   449  
   450  const EthashJs = `
   451  web3._extend({
   452  	property: 'ethash',
   453  	methods: [
   454  		new web3._extend.Method({
   455  			name: 'getWork',
   456  			call: 'ethash_getWork',
   457  			params: 0
   458  		}),
   459  		new web3._extend.Method({
   460  			name: 'getHashrate',
   461  			call: 'ethash_getHashrate',
   462  			params: 0
   463  		}),
   464  		new web3._extend.Method({
   465  			name: 'submitWork',
   466  			call: 'ethash_submitWork',
   467  			params: 3,
   468  		}),
   469  		new web3._extend.Method({
   470  			name: 'submitHashrate',
   471  			call: 'ethash_submitHashrate',
   472  			params: 2,
   473  		}),
   474  	]
   475  });
   476  `
   477  
   478  const AdminJs = `
   479  web3._extend({
   480  	property: 'admin',
   481  	methods: [
   482  		new web3._extend.Method({
   483  			name: 'addPeer',
   484  			call: 'admin_addPeer',
   485  			params: 1
   486  		}),
   487  		new web3._extend.Method({
   488  			name: 'removePeer',
   489  			call: 'admin_removePeer',
   490  			params: 1
   491  		}),
   492  		new web3._extend.Method({
   493  			name: 'addTrustedPeer',
   494  			call: 'admin_addTrustedPeer',
   495  			params: 1
   496  		}),
   497  		new web3._extend.Method({
   498  			name: 'removeTrustedPeer',
   499  			call: 'admin_removeTrustedPeer',
   500  			params: 1
   501  		}),
   502  		new web3._extend.Method({
   503  			name: 'exportChain',
   504  			call: 'admin_exportChain',
   505  			params: 3,
   506  			inputFormatter: [null, null, null]
   507  		}),
   508  		new web3._extend.Method({
   509  			name: 'importChain',
   510  			call: 'admin_importChain',
   511  			params: 1
   512  		}),
   513  		new web3._extend.Method({
   514  			name: 'sleepBlocks',
   515  			call: 'admin_sleepBlocks',
   516  			params: 2
   517  		}),
   518  		new web3._extend.Method({
   519  			name: 'startHTTP',
   520  			call: 'admin_startHTTP',
   521  			params: 5,
   522  			inputFormatter: [null, null, null, null, null]
   523  		}),
   524  		new web3._extend.Method({
   525  			name: 'stopHTTP',
   526  			call: 'admin_stopHTTP'
   527  		}),
   528  		// This method is deprecated.
   529  		new web3._extend.Method({
   530  			name: 'startRPC',
   531  			call: 'admin_startRPC',
   532  			params: 5,
   533  			inputFormatter: [null, null, null, null, null]
   534  		}),
   535  		// This method is deprecated.
   536  		new web3._extend.Method({
   537  			name: 'stopRPC',
   538  			call: 'admin_stopRPC'
   539  		}),
   540  		new web3._extend.Method({
   541  			name: 'startWS',
   542  			call: 'admin_startWS',
   543  			params: 4,
   544  			inputFormatter: [null, null, null, null]
   545  		}),
   546  		new web3._extend.Method({
   547  			name: 'stopWS',
   548  			call: 'admin_stopWS'
   549  		}),
   550  	],
   551  	properties: [
   552  		new web3._extend.Property({
   553  			name: 'nodeInfo',
   554  			getter: 'admin_nodeInfo'
   555  		}),
   556  		new web3._extend.Property({
   557  			name: 'peers',
   558  			getter: 'admin_peers'
   559  		}),
   560  		new web3._extend.Property({
   561  			name: 'datadir',
   562  			getter: 'admin_datadir'
   563  		}),
   564  	]
   565  });
   566  `
   567  
   568  const DebugJs = `
   569  web3._extend({
   570  	property: 'debug',
   571  	methods: [
   572  		new web3._extend.Method({
   573  			name: 'accountRange',
   574  			call: 'debug_accountRange',
   575  			params: 6,
   576  			inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter, null, null, null, null, null],
   577  		}),
   578  		new web3._extend.Method({
   579  			name: 'printBlock',
   580  			call: 'debug_printBlock',
   581  			params: 1,
   582  			outputFormatter: console.log
   583  		}),
   584  		new web3._extend.Method({
   585  			name: 'getBlockRlp',
   586  			call: 'debug_getBlockRlp',
   587  			params: 1
   588  		}),
   589  		new web3._extend.Method({
   590  			name: 'testSignCliqueBlock',
   591  			call: 'debug_testSignCliqueBlock',
   592  			params: 2,
   593  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null],
   594  		}),
   595  		new web3._extend.Method({
   596  			name: 'setHead',
   597  			call: 'debug_setHead',
   598  			params: 1
   599  		}),
   600  		new web3._extend.Method({
   601  			name: 'seedHash',
   602  			call: 'debug_seedHash',
   603  			params: 1
   604  		}),
   605  		new web3._extend.Method({
   606  			name: 'dumpBlock',
   607  			call: 'debug_dumpBlock',
   608  			params: 1,
   609  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   610  		}),
   611  		new web3._extend.Method({
   612  			name: 'chaindbProperty',
   613  			call: 'debug_chaindbProperty',
   614  			params: 1,
   615  			outputFormatter: console.log
   616  		}),
   617  		new web3._extend.Method({
   618  			name: 'chaindbCompact',
   619  			call: 'debug_chaindbCompact',
   620  		}),
   621  		new web3._extend.Method({
   622  			name: 'verbosity',
   623  			call: 'debug_verbosity',
   624  			params: 1
   625  		}),
   626  		new web3._extend.Method({
   627  			name: 'vmodule',
   628  			call: 'debug_vmodule',
   629  			params: 1
   630  		}),
   631  		new web3._extend.Method({
   632  			name: 'backtraceAt',
   633  			call: 'debug_backtraceAt',
   634  			params: 1,
   635  		}),
   636  		new web3._extend.Method({
   637  			name: 'stacks',
   638  			call: 'debug_stacks',
   639  			params: 0,
   640  			outputFormatter: console.log
   641  		}),
   642  		new web3._extend.Method({
   643  			name: 'freeOSMemory',
   644  			call: 'debug_freeOSMemory',
   645  			params: 0,
   646  		}),
   647  		new web3._extend.Method({
   648  			name: 'setGCPercent',
   649  			call: 'debug_setGCPercent',
   650  			params: 1,
   651  		}),
   652  		new web3._extend.Method({
   653  			name: 'memStats',
   654  			call: 'debug_memStats',
   655  			params: 0,
   656  		}),
   657  		new web3._extend.Method({
   658  			name: 'gcStats',
   659  			call: 'debug_gcStats',
   660  			params: 0,
   661  		}),
   662  		new web3._extend.Method({
   663  			name: 'cpuProfile',
   664  			call: 'debug_cpuProfile',
   665  			params: 2
   666  		}),
   667  		new web3._extend.Method({
   668  			name: 'startCPUProfile',
   669  			call: 'debug_startCPUProfile',
   670  			params: 1
   671  		}),
   672  		new web3._extend.Method({
   673  			name: 'stopCPUProfile',
   674  			call: 'debug_stopCPUProfile',
   675  			params: 0
   676  		}),
   677  		new web3._extend.Method({
   678  			name: 'goTrace',
   679  			call: 'debug_goTrace',
   680  			params: 2
   681  		}),
   682  		new web3._extend.Method({
   683  			name: 'startGoTrace',
   684  			call: 'debug_startGoTrace',
   685  			params: 1
   686  		}),
   687  		new web3._extend.Method({
   688  			name: 'stopGoTrace',
   689  			call: 'debug_stopGoTrace',
   690  			params: 0
   691  		}),
   692  		new web3._extend.Method({
   693  			name: 'blockProfile',
   694  			call: 'debug_blockProfile',
   695  			params: 2
   696  		}),
   697  		new web3._extend.Method({
   698  			name: 'setBlockProfileRate',
   699  			call: 'debug_setBlockProfileRate',
   700  			params: 1
   701  		}),
   702  		new web3._extend.Method({
   703  			name: 'writeBlockProfile',
   704  			call: 'debug_writeBlockProfile',
   705  			params: 1
   706  		}),
   707  		new web3._extend.Method({
   708  			name: 'mutexProfile',
   709  			call: 'debug_mutexProfile',
   710  			params: 2
   711  		}),
   712  		new web3._extend.Method({
   713  			name: 'setMutexProfileFraction',
   714  			call: 'debug_setMutexProfileFraction',
   715  			params: 1
   716  		}),
   717  		new web3._extend.Method({
   718  			name: 'writeMutexProfile',
   719  			call: 'debug_writeMutexProfile',
   720  			params: 1
   721  		}),
   722  		new web3._extend.Method({
   723  			name: 'writeMemProfile',
   724  			call: 'debug_writeMemProfile',
   725  			params: 1
   726  		}),
   727  		new web3._extend.Method({
   728  			name: 'traceBlock',
   729  			call: 'debug_traceBlock',
   730  			params: 2,
   731  			inputFormatter: [null, null]
   732  		}),
   733  		new web3._extend.Method({
   734  			name: 'traceBlockFromFile',
   735  			call: 'debug_traceBlockFromFile',
   736  			params: 2,
   737  			inputFormatter: [null, null]
   738  		}),
   739  		new web3._extend.Method({
   740  			name: 'traceBadBlock',
   741  			call: 'debug_traceBadBlock',
   742  			params: 1,
   743  			inputFormatter: [null]
   744  		}),
   745  		new web3._extend.Method({
   746  			name: 'standardTraceBadBlockToFile',
   747  			call: 'debug_standardTraceBadBlockToFile',
   748  			params: 2,
   749  			inputFormatter: [null, null]
   750  		}),
   751  		new web3._extend.Method({
   752  			name: 'standardTraceBlockToFile',
   753  			call: 'debug_standardTraceBlockToFile',
   754  			params: 2,
   755  			inputFormatter: [null, null]
   756  		}),
   757  		new web3._extend.Method({
   758  			name: 'traceBlockByNumber',
   759  			call: 'debug_traceBlockByNumber',
   760  			params: 2,
   761  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, null]
   762  		}),
   763  		new web3._extend.Method({
   764  			name: 'traceBlockByHash',
   765  			call: 'debug_traceBlockByHash',
   766  			params: 2,
   767  			inputFormatter: [null, null]
   768  		}),
   769  		new web3._extend.Method({
   770  			name: 'traceTransaction',
   771  			call: 'debug_traceTransaction',
   772  			params: 2,
   773  			inputFormatter: [null, null]
   774  		}),
   775  		new web3._extend.Method({
   776  			name: 'traceCall',
   777  			call: 'debug_traceCall',
   778  			params: 3,
   779  			inputFormatter: [null, null, null]
   780  		}),
   781  		new web3._extend.Method({
   782  			name: 'preimage',
   783  			call: 'debug_preimage',
   784  			params: 1,
   785  			inputFormatter: [null]
   786  		}),
   787  		new web3._extend.Method({
   788  			name: 'getBadBlocks',
   789  			call: 'debug_getBadBlocks',
   790  			params: 0,
   791  		}),
   792  		new web3._extend.Method({
   793  			name: 'storageRangeAt',
   794  			call: 'debug_storageRangeAt',
   795  			params: 5,
   796  		}),
   797  		new web3._extend.Method({
   798  			name: 'getModifiedAccountsByNumber',
   799  			call: 'debug_getModifiedAccountsByNumber',
   800  			params: 2,
   801  			inputFormatter: [null, null],
   802  		}),
   803  		new web3._extend.Method({
   804  			name: 'getModifiedAccountsByHash',
   805  			call: 'debug_getModifiedAccountsByHash',
   806  			params: 2,
   807  			inputFormatter:[null, null],
   808  		}),
   809  		new web3._extend.Method({
   810  			name: 'freezeClient',
   811  			call: 'debug_freezeClient',
   812  			params: 1,
   813  		}),
   814  	],
   815  	properties: []
   816  });
   817  `
   818  
   819  const EthJs = `
   820  web3._extend({
   821  	property: 'eth',
   822  	methods: [
   823  		new web3._extend.Method({
   824  			name: 'chainId',
   825  			call: 'eth_chainId',
   826  			params: 0
   827  		}),
   828  		new web3._extend.Method({
   829  			name: 'sign',
   830  			call: 'eth_sign',
   831  			params: 2,
   832  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   833  		}),
   834  		new web3._extend.Method({
   835  			name: 'resend',
   836  			call: 'eth_resend',
   837  			params: 3,
   838  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   839  		}),
   840  		new web3._extend.Method({
   841  			name: 'signTransaction',
   842  			call: 'eth_signTransaction',
   843  			params: 1,
   844  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   845  		}),
   846  		new web3._extend.Method({
   847  			name: 'estimateGas',
   848  			call: 'eth_estimateGas',
   849  			params: 2,
   850  			inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
   851  			outputFormatter: web3._extend.utils.toDecimal
   852  		}),
   853  		new web3._extend.Method({
   854  			name: 'submitTransaction',
   855  			call: 'eth_submitTransaction',
   856  			params: 1,
   857  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   858  		}),
   859  		new web3._extend.Method({
   860  			name: 'fillTransaction',
   861  			call: 'eth_fillTransaction',
   862  			params: 1,
   863  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   864  		}),
   865  		new web3._extend.Method({
   866  			name: 'getHeaderByNumber',
   867  			call: 'eth_getHeaderByNumber',
   868  			params: 1,
   869  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   870  		}),
   871  		new web3._extend.Method({
   872  			name: 'getHeaderByHash',
   873  			call: 'eth_getHeaderByHash',
   874  			params: 1
   875  		}),
   876  		new web3._extend.Method({
   877  			name: 'getBlockByNumber',
   878  			call: 'eth_getBlockByNumber',
   879  			params: 2,
   880  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, function (val) { return !!val; }]
   881  		}),
   882  		new web3._extend.Method({
   883  			name: 'getBlockByHash',
   884  			call: 'eth_getBlockByHash',
   885  			params: 2,
   886  			inputFormatter: [null, function (val) { return !!val; }]
   887  		}),
   888  		new web3._extend.Method({
   889  			name: 'getRawTransaction',
   890  			call: 'eth_getRawTransactionByHash',
   891  			params: 1
   892  		}),
   893  		new web3._extend.Method({
   894  			name: 'getRawTransactionFromBlock',
   895  			call: function(args) {
   896  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
   897  			},
   898  			params: 2,
   899  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   900  		}),
   901  		new web3._extend.Method({
   902  			name: 'getProof',
   903  			call: 'eth_getProof',
   904  			params: 3,
   905  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter]
   906  		}),
   907  		new web3._extend.Method({
   908  			name: 'createAccessList',
   909  			call: 'eth_createAccessList',
   910  			params: 2,
   911  			inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter],
   912  		}),
   913  		new web3._extend.Method({
   914  			name: 'feeHistory',
   915  			call: 'eth_feeHistory',
   916  			params: 3,
   917  			inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter, null]
   918  		}),
   919  		new web3._extend.Method({
   920  			name: 'getSysTransactionsByBlockNumber',
   921  			call: 'eth_getSysTransactionsByBlockNumber',
   922  			params: 1,
   923  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   924  		}),
   925  		new web3._extend.Method({
   926  			name: 'getSysTransactionsByBlockHash',
   927  			call: 'eth_getSysTransactionsByBlockHash',
   928  			params: 1
   929  		}),
   930  	],
   931  	properties: [
   932  		new web3._extend.Property({
   933  			name: 'pendingTransactions',
   934  			getter: 'eth_pendingTransactions',
   935  			outputFormatter: function(txs) {
   936  				var formatted = [];
   937  				for (var i = 0; i < txs.length; i++) {
   938  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   939  					formatted[i].blockHash = null;
   940  				}
   941  				return formatted;
   942  			}
   943  		}),
   944  		new web3._extend.Property({
   945  			name: 'maxPriorityFeePerGas',
   946  			getter: 'eth_maxPriorityFeePerGas',
   947  			outputFormatter: web3._extend.utils.toBigNumber
   948  		}),
   949  		new web3._extend.Property({
   950  			name: 'gasPricePrediction',
   951  			getter: 'eth_gasPricePrediction'
   952  		}),
   953  	]
   954  });
   955  `
   956  
   957  const MinerJs = `
   958  web3._extend({
   959  	property: 'miner',
   960  	methods: [
   961  		new web3._extend.Method({
   962  			name: 'start',
   963  			call: 'miner_start',
   964  			params: 1,
   965  			inputFormatter: [null]
   966  		}),
   967  		new web3._extend.Method({
   968  			name: 'stop',
   969  			call: 'miner_stop'
   970  		}),
   971  		new web3._extend.Method({
   972  			name: 'setEtherbase',
   973  			call: 'miner_setEtherbase',
   974  			params: 1,
   975  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   976  		}),
   977  		new web3._extend.Method({
   978  			name: 'setExtra',
   979  			call: 'miner_setExtra',
   980  			params: 1
   981  		}),
   982  		new web3._extend.Method({
   983  			name: 'setGasPrice',
   984  			call: 'miner_setGasPrice',
   985  			params: 1,
   986  			inputFormatter: [web3._extend.utils.fromDecimal]
   987  		}),
   988  		new web3._extend.Method({
   989  			name: 'setGasLimit',
   990  			call: 'miner_setGasLimit',
   991  			params: 1,
   992  			inputFormatter: [web3._extend.utils.fromDecimal]
   993  		}),
   994  		new web3._extend.Method({
   995  			name: 'setRecommitInterval',
   996  			call: 'miner_setRecommitInterval',
   997  			params: 1,
   998  		}),
   999  		new web3._extend.Method({
  1000  			name: 'getHashrate',
  1001  			call: 'miner_getHashrate'
  1002  		}),
  1003  	],
  1004  	properties: []
  1005  });
  1006  `
  1007  
  1008  const NetJs = `
  1009  web3._extend({
  1010  	property: 'net',
  1011  	methods: [],
  1012  	properties: [
  1013  		new web3._extend.Property({
  1014  			name: 'version',
  1015  			getter: 'net_version'
  1016  		}),
  1017  	]
  1018  });
  1019  `
  1020  
  1021  const PersonalJs = `
  1022  web3._extend({
  1023  	property: 'personal',
  1024  	methods: [
  1025  		new web3._extend.Method({
  1026  			name: 'importRawKey',
  1027  			call: 'personal_importRawKey',
  1028  			params: 2
  1029  		}),
  1030  		new web3._extend.Method({
  1031  			name: 'sign',
  1032  			call: 'personal_sign',
  1033  			params: 3,
  1034  			inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
  1035  		}),
  1036  		new web3._extend.Method({
  1037  			name: 'ecRecover',
  1038  			call: 'personal_ecRecover',
  1039  			params: 2
  1040  		}),
  1041  		new web3._extend.Method({
  1042  			name: 'openWallet',
  1043  			call: 'personal_openWallet',
  1044  			params: 2
  1045  		}),
  1046  		new web3._extend.Method({
  1047  			name: 'deriveAccount',
  1048  			call: 'personal_deriveAccount',
  1049  			params: 3
  1050  		}),
  1051  		new web3._extend.Method({
  1052  			name: 'signTransaction',
  1053  			call: 'personal_signTransaction',
  1054  			params: 2,
  1055  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
  1056  		}),
  1057  		new web3._extend.Method({
  1058  			name: 'unpair',
  1059  			call: 'personal_unpair',
  1060  			params: 2
  1061  		}),
  1062  		new web3._extend.Method({
  1063  			name: 'initializeWallet',
  1064  			call: 'personal_initializeWallet',
  1065  			params: 1
  1066  		})
  1067  	],
  1068  	properties: [
  1069  		new web3._extend.Property({
  1070  			name: 'listWallets',
  1071  			getter: 'personal_listWallets'
  1072  		}),
  1073  	]
  1074  })
  1075  `
  1076  
  1077  const RpcJs = `
  1078  web3._extend({
  1079  	property: 'rpc',
  1080  	methods: [],
  1081  	properties: [
  1082  		new web3._extend.Property({
  1083  			name: 'modules',
  1084  			getter: 'rpc_modules'
  1085  		}),
  1086  	]
  1087  });
  1088  `
  1089  
  1090  const TxpoolJs = `
  1091  web3._extend({
  1092  	property: 'txpool',
  1093  	methods: [],
  1094  	properties:
  1095  	[
  1096  		new web3._extend.Property({
  1097  			name: 'content',
  1098  			getter: 'txpool_content'
  1099  		}),
  1100  		new web3._extend.Property({
  1101  			name: 'inspect',
  1102  			getter: 'txpool_inspect'
  1103  		}),
  1104  		new web3._extend.Property({
  1105  			name: 'status',
  1106  			getter: 'txpool_status',
  1107  			outputFormatter: function(status) {
  1108  				status.pending = web3._extend.utils.toDecimal(status.pending);
  1109  				status.queued = web3._extend.utils.toDecimal(status.queued);
  1110  				return status;
  1111  			}
  1112  		}),
  1113  		new web3._extend.Method({
  1114  			name: 'contentFrom',
  1115  			call: 'txpool_contentFrom',
  1116  			params: 1,
  1117  		}),
  1118  		new web3._extend.Property({
  1119  			name: 'jamIndex',
  1120  			getter: 'txpool_jamIndex'
  1121  		}),
  1122  	]
  1123  });
  1124  `
  1125  
  1126  const LESJs = `
  1127  web3._extend({
  1128  	property: 'les',
  1129  	methods:
  1130  	[
  1131  		new web3._extend.Method({
  1132  			name: 'getCheckpoint',
  1133  			call: 'les_getCheckpoint',
  1134  			params: 1
  1135  		}),
  1136  		new web3._extend.Method({
  1137  			name: 'clientInfo',
  1138  			call: 'les_clientInfo',
  1139  			params: 1
  1140  		}),
  1141  		new web3._extend.Method({
  1142  			name: 'priorityClientInfo',
  1143  			call: 'les_priorityClientInfo',
  1144  			params: 3
  1145  		}),
  1146  		new web3._extend.Method({
  1147  			name: 'setClientParams',
  1148  			call: 'les_setClientParams',
  1149  			params: 2
  1150  		}),
  1151  		new web3._extend.Method({
  1152  			name: 'setDefaultParams',
  1153  			call: 'les_setDefaultParams',
  1154  			params: 1
  1155  		}),
  1156  		new web3._extend.Method({
  1157  			name: 'addBalance',
  1158  			call: 'les_addBalance',
  1159  			params: 2
  1160  		}),
  1161  	],
  1162  	properties:
  1163  	[
  1164  		new web3._extend.Property({
  1165  			name: 'latestCheckpoint',
  1166  			getter: 'les_latestCheckpoint'
  1167  		}),
  1168  		new web3._extend.Property({
  1169  			name: 'checkpointContractAddress',
  1170  			getter: 'les_getCheckpointContractAddress'
  1171  		}),
  1172  		new web3._extend.Property({
  1173  			name: 'serverInfo',
  1174  			getter: 'les_serverInfo'
  1175  		}),
  1176  	]
  1177  });
  1178  `
  1179  
  1180  const VfluxJs = `
  1181  web3._extend({
  1182  	property: 'vflux',
  1183  	methods:
  1184  	[
  1185  		new web3._extend.Method({
  1186  			name: 'distribution',
  1187  			call: 'vflux_distribution',
  1188  			params: 2
  1189  		}),
  1190  		new web3._extend.Method({
  1191  			name: 'timeout',
  1192  			call: 'vflux_timeout',
  1193  			params: 2
  1194  		}),
  1195  		new web3._extend.Method({
  1196  			name: 'value',
  1197  			call: 'vflux_value',
  1198  			params: 2
  1199  		}),
  1200  	],
  1201  	properties:
  1202  	[
  1203  		new web3._extend.Property({
  1204  			name: 'requestStats',
  1205  			getter: 'vflux_requestStats'
  1206  		}),
  1207  	]
  1208  });
  1209  `