github.com/kisexp/xdchain@v0.0.0-20211206025815-490d6b732aa7/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  	"accounting":       AccountingJs,
    22  	"admin":            AdminJs,
    23  	"chequebook":       ChequebookJs,
    24  	"clique":           CliqueJs,
    25  	"ethash":           EthashJs,
    26  	"debug":            DebugJs,
    27  	"eth":              EthJs,
    28  	"miner":            MinerJs,
    29  	"net":              NetJs,
    30  	"personal":         PersonalJs,
    31  	"rpc":              RpcJs,
    32  	"shh":              ShhJs,
    33  	"swarmfs":          SwarmfsJs,
    34  	"txpool":           TxpoolJs,
    35  	"les":              LESJs,
    36  	"lespay":           LESPayJs,
    37  	"raft":             Raft_JS,
    38  	"istanbul":         Istanbul_JS,
    39  	"quorumPermission": QUORUM_NODE_JS,
    40  	"quorumExtension":  Extension_JS,
    41  	"plugin_account":   Account_Plugin_Js,
    42  }
    43  
    44  const ChequebookJs = `
    45  web3._extend({
    46  	property: 'chequebook',
    47  	methods: [
    48  		new web3._extend.Method({
    49  			name: 'deposit',
    50  			call: 'chequebook_deposit',
    51  			params: 1,
    52  			inputFormatter: [null]
    53  		}),
    54  		new web3._extend.Property({
    55  			name: 'balance',
    56  			getter: 'chequebook_balance',
    57  			outputFormatter: web3._extend.utils.toDecimal
    58  		}),
    59  		new web3._extend.Method({
    60  			name: 'cash',
    61  			call: 'chequebook_cash',
    62  			params: 1,
    63  			inputFormatter: [null]
    64  		}),
    65  		new web3._extend.Method({
    66  			name: 'issue',
    67  			call: 'chequebook_issue',
    68  			params: 2,
    69  			inputFormatter: [null, null]
    70  		}),
    71  	]
    72  });
    73  `
    74  
    75  const CliqueJs = `
    76  web3._extend({
    77  	property: 'clique',
    78  	methods: [
    79  		new web3._extend.Method({
    80  			name: 'getSnapshot',
    81  			call: 'clique_getSnapshot',
    82  			params: 1,
    83  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
    84  		}),
    85  		new web3._extend.Method({
    86  			name: 'getSnapshotAtHash',
    87  			call: 'clique_getSnapshotAtHash',
    88  			params: 1
    89  		}),
    90  		new web3._extend.Method({
    91  			name: 'getSigners',
    92  			call: 'clique_getSigners',
    93  			params: 1,
    94  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
    95  		}),
    96  		new web3._extend.Method({
    97  			name: 'getSignersAtHash',
    98  			call: 'clique_getSignersAtHash',
    99  			params: 1
   100  		}),
   101  		new web3._extend.Method({
   102  			name: 'propose',
   103  			call: 'clique_propose',
   104  			params: 2
   105  		}),
   106  		new web3._extend.Method({
   107  			name: 'discard',
   108  			call: 'clique_discard',
   109  			params: 1
   110  		}),
   111  		new web3._extend.Method({
   112  			name: 'status',
   113  			call: 'clique_status',
   114  			params: 2,
   115              inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.formatters.inputBlockNumberFormatter]
   116  		}),
   117  	],
   118  	properties: [
   119  		new web3._extend.Property({
   120  			name: 'proposals',
   121  			getter: 'clique_proposals'
   122  		}),
   123  	]
   124  });
   125  `
   126  
   127  const EthashJs = `
   128  web3._extend({
   129  	property: 'ethash',
   130  	methods: [
   131  		new web3._extend.Method({
   132  			name: 'getWork',
   133  			call: 'ethash_getWork',
   134  			params: 0
   135  		}),
   136  		new web3._extend.Method({
   137  			name: 'getHashrate',
   138  			call: 'ethash_getHashrate',
   139  			params: 0
   140  		}),
   141  		new web3._extend.Method({
   142  			name: 'submitWork',
   143  			call: 'ethash_submitWork',
   144  			params: 3,
   145  		}),
   146  		new web3._extend.Method({
   147  			name: 'submitHashRate',
   148  			call: 'ethash_submitHashRate',
   149  			params: 2,
   150  		}),
   151  	]
   152  });
   153  `
   154  
   155  const AdminJs = `
   156  web3._extend({
   157  	property: 'admin',
   158  	methods: [
   159  		new web3._extend.Method({
   160  			name: 'reloadPlugin',
   161  			call: 'admin_reloadPlugin',
   162  			params: 1
   163  		}),
   164  		new web3._extend.Method({
   165  			name: 'addPeer',
   166  			call: 'admin_addPeer',
   167  			params: 1
   168  		}),
   169  		new web3._extend.Method({
   170  			name: 'removePeer',
   171  			call: 'admin_removePeer',
   172  			params: 1
   173  		}),
   174  		new web3._extend.Method({
   175  			name: 'addTrustedPeer',
   176  			call: 'admin_addTrustedPeer',
   177  			params: 1
   178  		}),
   179  		new web3._extend.Method({
   180  			name: 'removeTrustedPeer',
   181  			call: 'admin_removeTrustedPeer',
   182  			params: 1
   183  		}),
   184  		new web3._extend.Method({
   185  			name: 'exportChain',
   186  			call: 'admin_exportChain',
   187  			params: 3,
   188  			inputFormatter: [null, null, null]
   189  		}),
   190  		new web3._extend.Method({
   191  			name: 'importChain',
   192  			call: 'admin_importChain',
   193  			params: 1
   194  		}),
   195  		new web3._extend.Method({
   196  			name: 'sleepBlocks',
   197  			call: 'admin_sleepBlocks',
   198  			params: 2
   199  		}),
   200  		new web3._extend.Method({
   201  			name: 'startRPC',
   202  			call: 'admin_startRPC',
   203  			params: 4,
   204  			inputFormatter: [null, null, null, null]
   205  		}),
   206  		new web3._extend.Method({
   207  			name: 'stopRPC',
   208  			call: 'admin_stopRPC'
   209  		}),
   210  		new web3._extend.Method({
   211  			name: 'startWS',
   212  			call: 'admin_startWS',
   213  			params: 4,
   214  			inputFormatter: [null, null, null, null]
   215  		}),
   216  		new web3._extend.Method({
   217  			name: 'stopWS',
   218  			call: 'admin_stopWS'
   219  		}),
   220  	],
   221  	properties: [
   222  		new web3._extend.Property({
   223  			name: 'nodeInfo',
   224  			getter: 'admin_nodeInfo'
   225  		}),
   226  		new web3._extend.Property({
   227  			name: 'peers',
   228  			getter: 'admin_peers'
   229  		}),
   230  		new web3._extend.Property({
   231  			name: 'datadir',
   232  			getter: 'admin_datadir'
   233  		}),
   234  	]
   235  });
   236  `
   237  
   238  const DebugJs = `
   239  web3._extend({
   240  	property: 'debug',
   241  	methods: [
   242  		new web3._extend.Method({
   243  			name: 'accountRange',
   244  			call: 'debug_accountRange',
   245  			params: 6,
   246  			inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter, null, null, null, null, null],
   247  		}),
   248  		new web3._extend.Method({
   249  			name: 'printBlock',
   250  			call: 'debug_printBlock',
   251  			params: 1,
   252  			outputFormatter: console.log
   253  		}),
   254  		new web3._extend.Method({
   255  			name: 'getBlockRlp',
   256  			call: 'debug_getBlockRlp',
   257  			params: 1
   258  		}),
   259  		new web3._extend.Method({
   260  			name: 'testSignCliqueBlock',
   261  			call: 'debug_testSignCliqueBlock',
   262  			params: 2,
   263  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null],
   264  		}),
   265  		new web3._extend.Method({
   266  			name: 'setHead',
   267  			call: 'debug_setHead',
   268  			params: 1
   269  		}),
   270  		new web3._extend.Method({
   271  			name: 'seedHash',
   272  			call: 'debug_seedHash',
   273  			params: 1
   274  		}),
   275  		new web3._extend.Method({
   276  			name: 'dumpBlock',
   277  			call: 'debug_dumpBlock',
   278  			params: 1,
   279  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   280  		}),
   281  		new web3._extend.Method({
   282  			name: 'privateStateRoot',
   283  			call: 'debug_privateStateRoot',
   284  			params: 1,
   285  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   286  		}),
   287  		new web3._extend.Method({
   288  			name: 'defaultStateRoot',
   289  			call: 'debug_defaultStateRoot',
   290  			params: 1,
   291  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   292  		}),
   293  		new web3._extend.Method({
   294  			name: 'dumpAddress',
   295  			call: 'debug_dumpAddress',
   296  			params: 2,
   297  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputBlockNumberFormatter]
   298  		}),
   299  		new web3._extend.Method({
   300  			name: 'chaindbProperty',
   301  			call: 'debug_chaindbProperty',
   302  			params: 1,
   303  			outputFormatter: console.log
   304  		}),
   305  		new web3._extend.Method({
   306  			name: 'chaindbCompact',
   307  			call: 'debug_chaindbCompact',
   308  		}),
   309  		new web3._extend.Method({
   310  			name: 'verbosity',
   311  			call: 'debug_verbosity',
   312  			params: 1
   313  		}),
   314  		new web3._extend.Method({
   315  			name: 'vmodule',
   316  			call: 'debug_vmodule',
   317  			params: 1
   318  		}),
   319  		new web3._extend.Method({
   320  			name: 'backtraceAt',
   321  			call: 'debug_backtraceAt',
   322  			params: 1,
   323  		}),
   324  		new web3._extend.Method({
   325  			name: 'stacks',
   326  			call: 'debug_stacks',
   327  			params: 0,
   328  			outputFormatter: console.log
   329  		}),
   330  		new web3._extend.Method({
   331  			name: 'freeOSMemory',
   332  			call: 'debug_freeOSMemory',
   333  			params: 0,
   334  		}),
   335  		new web3._extend.Method({
   336  			name: 'setGCPercent',
   337  			call: 'debug_setGCPercent',
   338  			params: 1,
   339  		}),
   340  		new web3._extend.Method({
   341  			name: 'memStats',
   342  			call: 'debug_memStats',
   343  			params: 0,
   344  		}),
   345  		new web3._extend.Method({
   346  			name: 'gcStats',
   347  			call: 'debug_gcStats',
   348  			params: 0,
   349  		}),
   350  		new web3._extend.Method({
   351  			name: 'cpuProfile',
   352  			call: 'debug_cpuProfile',
   353  			params: 2
   354  		}),
   355  		new web3._extend.Method({
   356  			name: 'startCPUProfile',
   357  			call: 'debug_startCPUProfile',
   358  			params: 1
   359  		}),
   360  		new web3._extend.Method({
   361  			name: 'stopCPUProfile',
   362  			call: 'debug_stopCPUProfile',
   363  			params: 0
   364  		}),
   365  		new web3._extend.Method({
   366  			name: 'goTrace',
   367  			call: 'debug_goTrace',
   368  			params: 2
   369  		}),
   370  		new web3._extend.Method({
   371  			name: 'startGoTrace',
   372  			call: 'debug_startGoTrace',
   373  			params: 1
   374  		}),
   375  		new web3._extend.Method({
   376  			name: 'stopGoTrace',
   377  			call: 'debug_stopGoTrace',
   378  			params: 0
   379  		}),
   380  		new web3._extend.Method({
   381  			name: 'blockProfile',
   382  			call: 'debug_blockProfile',
   383  			params: 2
   384  		}),
   385  		new web3._extend.Method({
   386  			name: 'setBlockProfileRate',
   387  			call: 'debug_setBlockProfileRate',
   388  			params: 1
   389  		}),
   390  		new web3._extend.Method({
   391  			name: 'writeBlockProfile',
   392  			call: 'debug_writeBlockProfile',
   393  			params: 1
   394  		}),
   395  		new web3._extend.Method({
   396  			name: 'mutexProfile',
   397  			call: 'debug_mutexProfile',
   398  			params: 2
   399  		}),
   400  		new web3._extend.Method({
   401  			name: 'setMutexProfileFraction',
   402  			call: 'debug_setMutexProfileFraction',
   403  			params: 1
   404  		}),
   405  		new web3._extend.Method({
   406  			name: 'writeMutexProfile',
   407  			call: 'debug_writeMutexProfile',
   408  			params: 1
   409  		}),
   410  		new web3._extend.Method({
   411  			name: 'writeMemProfile',
   412  			call: 'debug_writeMemProfile',
   413  			params: 1
   414  		}),
   415  		new web3._extend.Method({
   416  			name: 'traceBlock',
   417  			call: 'debug_traceBlock',
   418  			params: 2,
   419  			inputFormatter: [null, null]
   420  		}),
   421  		new web3._extend.Method({
   422  			name: 'traceBlockFromFile',
   423  			call: 'debug_traceBlockFromFile',
   424  			params: 2,
   425  			inputFormatter: [null, null]
   426  		}),
   427  		new web3._extend.Method({
   428  			name: 'traceBadBlock',
   429  			call: 'debug_traceBadBlock',
   430  			params: 1,
   431  			inputFormatter: [null]
   432  		}),
   433  		new web3._extend.Method({
   434  			name: 'standardTraceBadBlockToFile',
   435  			call: 'debug_standardTraceBadBlockToFile',
   436  			params: 2,
   437  			inputFormatter: [null, null]
   438  		}),
   439  		new web3._extend.Method({
   440  			name: 'standardTraceBlockToFile',
   441  			call: 'debug_standardTraceBlockToFile',
   442  			params: 2,
   443  			inputFormatter: [null, null]
   444  		}),
   445  		new web3._extend.Method({
   446  			name: 'traceBlockByNumber',
   447  			call: 'debug_traceBlockByNumber',
   448  			params: 2,
   449  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, null]
   450  		}),
   451  		new web3._extend.Method({
   452  			name: 'traceBlockByHash',
   453  			call: 'debug_traceBlockByHash',
   454  			params: 2,
   455  			inputFormatter: [null, null]
   456  		}),
   457  		new web3._extend.Method({
   458  			name: 'traceTransaction',
   459  			call: 'debug_traceTransaction',
   460  			params: 2,
   461  			inputFormatter: [null, null]
   462  		}),
   463  		new web3._extend.Method({
   464  			name: 'traceCall',
   465  			call: 'debug_traceCall',
   466  			params: 3,
   467  			inputFormatter: [null, null, null]
   468  		}),
   469  		new web3._extend.Method({
   470  			name: 'preimage',
   471  			call: 'debug_preimage',
   472  			params: 1,
   473  			inputFormatter: [null]
   474  		}),
   475  		new web3._extend.Method({
   476  			name: 'getBadBlocks',
   477  			call: 'debug_getBadBlocks',
   478  			params: 0,
   479  		}),
   480  		new web3._extend.Method({
   481  			name: 'storageRangeAt',
   482  			call: 'debug_storageRangeAt',
   483  			params: 5,
   484  		}),
   485  		new web3._extend.Method({
   486  			name: 'getModifiedAccountsByNumber',
   487  			call: 'debug_getModifiedAccountsByNumber',
   488  			params: 2,
   489  			inputFormatter: [null, null],
   490  		}),
   491  		new web3._extend.Method({
   492  			name: 'getModifiedAccountsByHash',
   493  			call: 'debug_getModifiedAccountsByHash',
   494  			params: 2,
   495  			inputFormatter:[null, null],
   496  		}),
   497  		new web3._extend.Method({
   498  			name: 'freezeClient',
   499  			call: 'debug_freezeClient',
   500  			params: 1,
   501  		}),
   502  	],
   503  	properties: []
   504  });
   505  `
   506  
   507  const EthJs = `
   508  web3._extend({
   509  	property: 'eth',
   510  	methods: [
   511  		new web3._extend.Method({
   512  			name: 'sendRawPrivateTransaction',
   513  			call: 'eth_sendRawPrivateTransaction',
   514  			params: 2,
   515  			inputFormatter: [null, null]
   516  		}),
   517  		new web3._extend.Method({
   518  			name: 'distributePrivateTransaction',
   519  			call: 'eth_distributePrivateTransaction',
   520  			params: 2,
   521  			inputFormatter: [null, null]
   522  		}),
   523  		new web3._extend.Method({
   524  			name: 'getPrivacyPrecompileAddress',
   525  			call: 'eth_getPrivacyPrecompileAddress',
   526  			params: 0,
   527  		}),
   528  		new web3._extend.Method({
   529  			name: 'getContractPrivacyMetadata',
   530  			call: 'eth_getContractPrivacyMetadata',
   531  			params: 1
   532  		}),
   533  		new web3._extend.Method({
   534  			name: 'chainId',
   535  			call: 'eth_chainId',
   536  			params: 0
   537  		}),
   538  		new web3._extend.Method({
   539  			name: 'sign',
   540  			call: 'eth_sign',
   541  			params: 2,
   542  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   543  		}),
   544  		new web3._extend.Method({
   545  			name: 'resend',
   546  			call: 'eth_resend',
   547  			params: 3,
   548  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   549  		}),
   550  		new web3._extend.Method({
   551  			name: 'signTransaction',
   552  			call: 'eth_signTransaction',
   553  			params: 1,
   554  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   555  		}),
   556  		new web3._extend.Method({
   557  			name: 'estimateGas',
   558  			call: 'eth_estimateGas',
   559  			params: 2,
   560  			inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
   561  			outputFormatter: web3._extend.utils.toDecimal
   562  		}),
   563  		new web3._extend.Method({
   564  			name: 'submitTransaction',
   565  			call: 'eth_submitTransaction',
   566  			params: 1,
   567  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   568  		}),
   569  		new web3._extend.Method({
   570  			name: 'fillTransaction',
   571  			call: 'eth_fillTransaction',
   572  			params: 1,
   573  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   574  		}),
   575  		new web3._extend.Method({
   576  			name: 'getHeaderByNumber',
   577  			call: 'eth_getHeaderByNumber',
   578  			params: 1,
   579  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
   580  		}),
   581  		new web3._extend.Method({
   582  			name: 'getHeaderByHash',
   583  			call: 'eth_getHeaderByHash',
   584  			params: 1
   585  		}),
   586  		new web3._extend.Method({
   587  			name: 'getBlockByNumber',
   588  			call: 'eth_getBlockByNumber',
   589  			params: 2,
   590  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, function (val) { return !!val; }]
   591  		}),
   592  		new web3._extend.Method({
   593  			name: 'getBlockByHash',
   594  			call: 'eth_getBlockByHash',
   595  			params: 2,
   596  			inputFormatter: [null, function (val) { return !!val; }]
   597  		}),
   598  		new web3._extend.Method({
   599  			name: 'getRawTransaction',
   600  			call: 'eth_getRawTransactionByHash',
   601  			params: 1
   602  		}),
   603  		new web3._extend.Method({
   604  			name: 'getRawTransactionFromBlock',
   605  			call: function(args) {
   606  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
   607  			},
   608  			params: 2,
   609  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   610  		}),
   611  		new web3._extend.Method({
   612  			name: 'getProof',
   613  			call: 'eth_getProof',
   614  			params: 3,
   615  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter]
   616  		}),
   617  		new web3._extend.Method({
   618  			name: 'storageRoot',
   619  			call: 'eth_storageRoot',
   620  			params: 2,
   621  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   622  		}),
   623  		// QUORUM
   624  		new web3._extend.Method({
   625  			name: 'sendTransactionAsync',
   626  			call: 'eth_sendTransactionAsync',
   627  			params: 1,
   628  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   629  		}),
   630  		new web3._extend.Method({
   631  			name: 'getQuorumPayload',
   632  			call: 'eth_getQuorumPayload',
   633  			params: 1,
   634  			inputFormatter: [null]
   635  		}),
   636  		new web3._extend.Method({
   637  			name: 'getPSI',
   638  			call: 'eth_getPSI',
   639  			params: 0
   640  		}),
   641  		new web3._extend.Method({
   642              name: 'getPrivateTransaction',
   643              call: 'eth_getPrivateTransactionByHash',
   644              params: 1,
   645              outputFormatter: web3._extend.formatters.outputTransactionFormatter
   646          }),
   647  		new web3._extend.Method({
   648              name: 'getPrivateTransactionReceipt',
   649              call: 'eth_getPrivateTransactionReceipt',
   650              params: 1,
   651              outputFormatter: web3._extend.formatters.outputTransactionReceiptFormatter
   652          }),
   653  		// END-QUORUM
   654  	],
   655  	properties: [
   656  		new web3._extend.Property({
   657  			name: 'pendingTransactions',
   658  			getter: 'eth_pendingTransactions',
   659  			outputFormatter: function(txs) {
   660  				var formatted = [];
   661  				for (var i = 0; i < txs.length; i++) {
   662  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   663  					formatted[i].blockHash = null;
   664  				}
   665  				return formatted;
   666  			}
   667  		}),
   668  	]
   669  });
   670  `
   671  
   672  const MinerJs = `
   673  web3._extend({
   674  	property: 'miner',
   675  	methods: [
   676  		new web3._extend.Method({
   677  			name: 'start',
   678  			call: 'miner_start',
   679  			params: 1,
   680  			inputFormatter: [null]
   681  		}),
   682  		new web3._extend.Method({
   683  			name: 'stop',
   684  			call: 'miner_stop'
   685  		}),
   686  		new web3._extend.Method({
   687  			name: 'setEtherbase',
   688  			call: 'miner_setEtherbase',
   689  			params: 1,
   690  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   691  		}),
   692  		new web3._extend.Method({
   693  			name: 'setExtra',
   694  			call: 'miner_setExtra',
   695  			params: 1
   696  		}),
   697  		new web3._extend.Method({
   698  			name: 'setGasPrice',
   699  			call: 'miner_setGasPrice',
   700  			params: 1,
   701  			inputFormatter: [web3._extend.utils.fromDecimal]
   702  		}),
   703  		new web3._extend.Method({
   704  			name: 'setRecommitInterval',
   705  			call: 'miner_setRecommitInterval',
   706  			params: 1,
   707  		}),
   708  		new web3._extend.Method({
   709  			name: 'getHashrate',
   710  			call: 'miner_getHashrate'
   711  		}),
   712  	],
   713  	properties: []
   714  });
   715  `
   716  
   717  const NetJs = `
   718  web3._extend({
   719  	property: 'net',
   720  	methods: [],
   721  	properties: [
   722  		new web3._extend.Property({
   723  			name: 'version',
   724  			getter: 'net_version'
   725  		}),
   726  	]
   727  });
   728  `
   729  
   730  const PersonalJs = `
   731  web3._extend({
   732  	property: 'personal',
   733  	methods: [
   734  		new web3._extend.Method({
   735  			name: 'importRawKey',
   736  			call: 'personal_importRawKey',
   737  			params: 2
   738  		}),
   739  		new web3._extend.Method({
   740  			name: 'sign',
   741  			call: 'personal_sign',
   742  			params: 3,
   743  			inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
   744  		}),
   745  		new web3._extend.Method({
   746  			name: 'ecRecover',
   747  			call: 'personal_ecRecover',
   748  			params: 2
   749  		}),
   750  		new web3._extend.Method({
   751  			name: 'openWallet',
   752  			call: 'personal_openWallet',
   753  			params: 2
   754  		}),
   755  		new web3._extend.Method({
   756  			name: 'deriveAccount',
   757  			call: 'personal_deriveAccount',
   758  			params: 3
   759  		}),
   760  		new web3._extend.Method({
   761  			name: 'signTransaction',
   762  			call: 'personal_signTransaction',
   763  			params: 2,
   764  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
   765  		}),
   766  		new web3._extend.Method({
   767  			name: 'unpair',
   768  			call: 'personal_unpair',
   769  			params: 2
   770  		}),
   771  		new web3._extend.Method({
   772  			name: 'initializeWallet',
   773  			call: 'personal_initializeWallet',
   774  			params: 1
   775  		})
   776  	],
   777  	properties: [
   778  		new web3._extend.Property({
   779  			name: 'listWallets',
   780  			getter: 'personal_listWallets'
   781  		}),
   782  	]
   783  })
   784  `
   785  
   786  const RpcJs = `
   787  web3._extend({
   788  	property: 'rpc',
   789  	methods: [],
   790  	properties: [
   791  		new web3._extend.Property({
   792  			name: 'modules',
   793  			getter: 'rpc_modules'
   794  		}),
   795  	]
   796  });
   797  `
   798  
   799  const ShhJs = `
   800  web3._extend({
   801  	property: 'shh',
   802  	methods: [
   803  	],
   804  	properties:
   805  	[
   806  		new web3._extend.Property({
   807  			name: 'version',
   808  			getter: 'shh_version',
   809  			outputFormatter: web3._extend.utils.toDecimal
   810  		}),
   811  		new web3._extend.Property({
   812  			name: 'info',
   813  			getter: 'shh_info'
   814  		}),
   815  	]
   816  });
   817  `
   818  
   819  const SwarmfsJs = `
   820  web3._extend({
   821  	property: 'swarmfs',
   822  	methods:
   823  	[
   824  		new web3._extend.Method({
   825  			name: 'mount',
   826  			call: 'swarmfs_mount',
   827  			params: 2
   828  		}),
   829  		new web3._extend.Method({
   830  			name: 'unmount',
   831  			call: 'swarmfs_unmount',
   832  			params: 1
   833  		}),
   834  		new web3._extend.Method({
   835  			name: 'listmounts',
   836  			call: 'swarmfs_listmounts',
   837  			params: 0
   838  		}),
   839  	]
   840  });
   841  `
   842  
   843  const TxpoolJs = `
   844  web3._extend({
   845  	property: 'txpool',
   846  	methods: [],
   847  	properties:
   848  	[
   849  		new web3._extend.Property({
   850  			name: 'content',
   851  			getter: 'txpool_content'
   852  		}),
   853  		new web3._extend.Property({
   854  			name: 'inspect',
   855  			getter: 'txpool_inspect'
   856  		}),
   857  		new web3._extend.Property({
   858  			name: 'status',
   859  			getter: 'txpool_status',
   860  			outputFormatter: function(status) {
   861  				status.pending = web3._extend.utils.toDecimal(status.pending);
   862  				status.queued = web3._extend.utils.toDecimal(status.queued);
   863  				return status;
   864  			}
   865  		}),
   866  	]
   867  });
   868  `
   869  
   870  const Raft_JS = `
   871  web3._extend({
   872         property: 'raft',
   873         methods:
   874         [
   875         ],
   876         properties:
   877         [
   878                 new web3._extend.Property({
   879                         name: 'role',
   880                         getter: 'raft_role'
   881                 }),
   882                 new web3._extend.Method({
   883                         name: 'addPeer',
   884                         call: 'raft_addPeer',
   885                         params: 1
   886                 }),
   887                 new web3._extend.Method({
   888                         name: 'addLearner',
   889                         call: 'raft_addLearner',
   890                         params: 1
   891                 }),
   892                 new web3._extend.Method({
   893                         name: 'promoteToPeer',
   894                         call: 'raft_promoteToPeer',
   895                         params: 1
   896                 }),
   897                 new web3._extend.Method({
   898                         name: 'removePeer',
   899                         call: 'raft_removePeer',
   900                         params: 1
   901                 }),
   902                 new web3._extend.Property({
   903                         name: 'leader',
   904                         getter: 'raft_leader'
   905                 }),
   906                 new web3._extend.Property({
   907                         name: 'cluster',
   908                         getter: 'raft_cluster'
   909                 }),
   910         ]
   911  })
   912  `
   913  
   914  const QUORUM_NODE_JS = `
   915  web3._extend({
   916         property: 'quorumPermission',
   917         methods:
   918         [
   919  				new web3._extend.Method({
   920                         name: 'addOrg',
   921                         call: 'quorumPermission_addOrg',
   922                         params: 4,
   923                         inputFormatter: [null,null,web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputTransactionFormatter]
   924                 }),
   925  			   new web3._extend.Method({
   926                         name: 'approveOrg',
   927                         call: 'quorumPermission_approveOrg',
   928                         params: 4,
   929                         inputFormatter: [null,null,web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputTransactionFormatter]
   930                 }),
   931  				new web3._extend.Method({
   932                         name: 'addSubOrg',
   933                         call: 'quorumPermission_addSubOrg',
   934                         params: 4,
   935                         inputFormatter: [null,null,null,web3._extend.formatters.inputTransactionFormatter]
   936                 }),
   937                 new web3._extend.Method({
   938                         name: 'updateOrgStatus',
   939                         call: 'quorumPermission_updateOrgStatus',
   940                         params: 3,
   941                         inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter]
   942                 }),
   943                 new web3._extend.Method({
   944                         name: 'approveOrgStatus',
   945                         call: 'quorumPermission_approveOrgStatus',
   946                         params: 3,
   947                         inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter]
   948                 }),
   949                 new web3._extend.Method({
   950                         name: 'addNode',
   951                         call: 'quorumPermission_addNode',
   952                         params: 3,
   953                         inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter]
   954                 }),
   955                 new web3._extend.Method({
   956                         name: 'updateNodeStatus',
   957                         call: 'quorumPermission_updateNodeStatus',
   958                         params: 4,
   959                         inputFormatter: [null,null,null,web3._extend.formatters.inputTransactionFormatter]
   960                 }),
   961                 new web3._extend.Method({
   962                         name: 'assignAdminRole',
   963                         call: 'quorumPermission_assignAdminRole',
   964                         params: 4,
   965                         inputFormatter: [null,web3._extend.formatters.inputAddressFormatter,null, web3._extend.formatters.inputTransactionFormatter]
   966                 }),
   967                 new web3._extend.Method({
   968                         name: 'approveAdminRole',
   969                         call: 'quorumPermission_approveAdminRole',
   970                         params: 3,
   971                         inputFormatter: [null, web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputTransactionFormatter]
   972                 }),
   973                 new web3._extend.Method({
   974                         name: 'addNewRole',
   975                         call: 'quorumPermission_addNewRole',
   976                         params: 6,
   977                         inputFormatter: [null,null,null,null,null,web3._extend.formatters.inputTransactionFormatter]
   978                 }),
   979                 new web3._extend.Method({
   980                         name: 'removeRole',
   981                         call: 'quorumPermission_removeRole',
   982                         params: 3,
   983                         inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter]
   984                 }),
   985                 new web3._extend.Method({
   986                         name: 'addAccountToOrg',
   987                         call: 'quorumPermission_addAccountToOrg',
   988                         params: 4,
   989                         inputFormatter: [web3._extend.formatters.inputAddressFormatter,null,null,web3._extend.formatters.inputTransactionFormatter]
   990                 }),
   991                 new web3._extend.Method({
   992                         name: 'changeAccountRole',
   993                         call: 'quorumPermission_changeAccountRole',
   994                         params: 4,
   995                         inputFormatter: [web3._extend.formatters.inputAddressFormatter,null,null,web3._extend.formatters.inputTransactionFormatter]
   996                 }),	
   997  			   new web3._extend.Method({
   998                         name: 'updateAccountStatus',
   999                         call: 'quorumPermission_updateAccountStatus',
  1000                         params: 4,
  1001                         inputFormatter: [null, web3._extend.formatters.inputAddressFormatter,null,web3._extend.formatters.inputTransactionFormatter]
  1002                 }),
  1003  			   new web3._extend.Method({
  1004                         name: 'recoverBlackListedNode',
  1005                         call: 'quorumPermission_recoverBlackListedNode',
  1006                         params: 3,
  1007                         inputFormatter: [null, null, web3._extend.formatters.inputTransactionFormatter]
  1008                 }),
  1009  			   new web3._extend.Method({
  1010                         name: 'approveBlackListedNodeRecovery',
  1011                         call: 'quorumPermission_approveBlackListedNodeRecovery',
  1012                         params: 3,
  1013                         inputFormatter: [null, null, web3._extend.formatters.inputTransactionFormatter]
  1014                 }),
  1015  			   new web3._extend.Method({
  1016                         name: 'recoverBlackListedAccount',
  1017                         call: 'quorumPermission_recoverBlackListedAccount',
  1018                         params: 3,
  1019                         inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter]
  1020                 }),
  1021  			   new web3._extend.Method({
  1022                         name: 'approveBlackListedAccountRecovery',
  1023                         call: 'quorumPermission_approveBlackListedAccountRecovery',
  1024                         params: 3,
  1025                         inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter]
  1026                 }),
  1027                 new web3._extend.Method({
  1028                         name: 'getOrgDetails',
  1029                         call: 'quorumPermission_getOrgDetails',
  1030                         params: 1,
  1031                         inputFormatter: [null]
  1032                 }),
  1033                 new web3._extend.Method({
  1034                         name: 'transactionAllowed',
  1035                         call: 'quorumPermission_transactionAllowed',
  1036                         params: 1,
  1037                         inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
  1038                 }),
  1039                 new web3._extend.Method({
  1040                         name: 'connectionAllowed',
  1041                         call: 'quorumPermission_connectionAllowed',
  1042                         params: 4,
  1043                         inputFormatter: [null, null, null, null]
  1044                 }),
  1045  
  1046         ],
  1047         properties:
  1048         [
  1049  			  new web3._extend.Property({
  1050  					   name: 'orgList',
  1051  				       getter: 'quorumPermission_orgList'
  1052  			  }), 
  1053                new web3._extend.Property({
  1054  					   name: 'nodeList',
  1055  				       getter: 'quorumPermission_nodeList'
  1056  			  }), 
  1057                new web3._extend.Property({
  1058  					   name: 'roleList',
  1059  				       getter: 'quorumPermission_roleList'
  1060  			  }),
  1061                new web3._extend.Property({
  1062  					   name: 'acctList',
  1063  				       getter: 'quorumPermission_acctList'
  1064  			  }), 
  1065         ]
  1066  })
  1067  `
  1068  
  1069  const Istanbul_JS = `
  1070  web3._extend({
  1071  	property: 'istanbul',
  1072  	methods:
  1073  	[
  1074  		new web3._extend.Method({
  1075  			name: 'getSnapshot',
  1076  			call: 'istanbul_getSnapshot',
  1077  			params: 1,
  1078  			inputFormatter: [null]
  1079  		}),
  1080  		new web3._extend.Method({
  1081  			name: 'getSnapshotAtHash',
  1082  			call: 'istanbul_getSnapshotAtHash',
  1083  			params: 1
  1084  		}),
  1085  		new web3._extend.Method({
  1086  			name: 'getValidators',
  1087  			call: 'istanbul_getValidators',
  1088  			params: 1,
  1089  			inputFormatter: [null]
  1090  		}),
  1091  		new web3._extend.Method({
  1092  			name: 'getValidatorsAtHash',
  1093  			call: 'istanbul_getValidatorsAtHash',
  1094  			params: 1
  1095  		}),
  1096  		new web3._extend.Method({
  1097  			name: 'propose',
  1098  			call: 'istanbul_propose',
  1099  			params: 2
  1100  		}),
  1101  		new web3._extend.Method({
  1102  			name: 'discard',
  1103  			call: 'istanbul_discard',
  1104  			params: 1
  1105  		}),
  1106  
  1107  		new web3._extend.Method({
  1108  			name: 'getSignersFromBlock',
  1109  			call: 'istanbul_getSignersFromBlock',
  1110  			params: 1,
  1111  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
  1112  		}),
  1113  		new web3._extend.Method({
  1114  			name: 'getSignersFromBlockByHash',
  1115  			call: 'istanbul_getSignersFromBlockByHash',
  1116  			params: 1
  1117  		}),
  1118  		new web3._extend.Method({
  1119  			name: 'status',
  1120  			call: 'istanbul_status',
  1121  			params: 2,
  1122              inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.formatters.inputBlockNumberFormatter]
  1123  		}),
  1124  		new web3._extend.Method({
  1125  			name: 'isValidator',
  1126  			call: 'istanbul_isValidator',
  1127  			params: 1,
  1128              inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
  1129  		}),
  1130  
  1131  	],
  1132  	properties:
  1133  	[
  1134  		new web3._extend.Property({
  1135  			name: 'candidates',
  1136  			getter: 'istanbul_candidates'
  1137  		}),
  1138  		new web3._extend.Property({
  1139  			name: 'nodeAddress',
  1140  			getter: 'istanbul_nodeAddress'
  1141  		}),
  1142  	]
  1143  });
  1144  `
  1145  
  1146  const AccountingJs = `
  1147  web3._extend({
  1148  	property: 'accounting',
  1149  	methods: [
  1150  		new web3._extend.Property({
  1151  			name: 'balance',
  1152  			getter: 'account_balance'
  1153  		}),
  1154  		new web3._extend.Property({
  1155  			name: 'balanceCredit',
  1156  			getter: 'account_balanceCredit'
  1157  		}),
  1158  		new web3._extend.Property({
  1159  			name: 'balanceDebit',
  1160  			getter: 'account_balanceDebit'
  1161  		}),
  1162  		new web3._extend.Property({
  1163  			name: 'bytesCredit',
  1164  			getter: 'account_bytesCredit'
  1165  		}),
  1166  		new web3._extend.Property({
  1167  			name: 'bytesDebit',
  1168  			getter: 'account_bytesDebit'
  1169  		}),
  1170  		new web3._extend.Property({
  1171  			name: 'msgCredit',
  1172  			getter: 'account_msgCredit'
  1173  		}),
  1174  		new web3._extend.Property({
  1175  			name: 'msgDebit',
  1176  			getter: 'account_msgDebit'
  1177  		}),
  1178  		new web3._extend.Property({
  1179  			name: 'peerDrops',
  1180  			getter: 'account_peerDrops'
  1181  		}),
  1182  		new web3._extend.Property({
  1183  			name: 'selfDrops',
  1184  			getter: 'account_selfDrops'
  1185  		}),
  1186  	]
  1187  });
  1188  `
  1189  
  1190  const LESJs = `
  1191  web3._extend({
  1192  	property: 'les',
  1193  	methods:
  1194  	[
  1195  		new web3._extend.Method({
  1196  			name: 'getCheckpoint',
  1197  			call: 'les_getCheckpoint',
  1198  			params: 1
  1199  		}),
  1200  	],
  1201  	properties:
  1202  	[
  1203  		new web3._extend.Property({
  1204  			name: 'latestCheckpoint',
  1205  			getter: 'les_latestCheckpoint'
  1206  		}),
  1207  		new web3._extend.Property({
  1208  			name: 'checkpointContractAddress',
  1209  			getter: 'les_getCheckpointContractAddress'
  1210  		}),
  1211  	]
  1212  });
  1213  `
  1214  
  1215  const Extension_JS = `
  1216  web3._extend({
  1217  	property: 'quorumExtension',
  1218  	methods:
  1219  	[
  1220  		new web3._extend.Method({
  1221  			name: 'approveExtension',
  1222  			call: 'quorumExtension_approveExtension',
  1223  			params: 3,
  1224  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputTransactionFormatter]
  1225  		}),
  1226  		new web3._extend.Method({
  1227  			name: 'extendContract',
  1228  			call: 'quorumExtension_extendContract',
  1229  			params: 4,
  1230  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter]
  1231  		}),
  1232  		new web3._extend.Method({
  1233  			name: 'cancelExtension',
  1234  			call: 'quorumExtension_cancelExtension',
  1235  			params: 2,
  1236  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter]
  1237  		}),
  1238  		new web3._extend.Method({
  1239  			name: 'addBalance',
  1240  			call: 'les_addBalance',
  1241  			params: 2
  1242  		}),
  1243  		new web3._extend.Method({
  1244  			name: 'getExtensionStatus',
  1245  			call: 'quorumExtension_getExtensionStatus',
  1246  			params: 1,
  1247  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
  1248  		}),
  1249  
  1250  	],
  1251  	properties:
  1252  	[
  1253  		new web3._extend.Property({
  1254  			name: 'activeExtensionContracts',
  1255  			getter: 'quorumExtension_activeExtensionContracts'
  1256  		})
  1257  	]
  1258  });
  1259  `
  1260  
  1261  const Account_Plugin_Js = `
  1262  web3._extend({
  1263  	property: 'plugin_account',
  1264  	methods:
  1265  	[
  1266  		new web3._extend.Method({
  1267  			name: 'newAccount',
  1268  			call: 'plugin@account_newAccount',
  1269  			params: 1
  1270  		}),
  1271  		new web3._extend.Method({
  1272  			name: 'importRawKey',
  1273  			call: 'plugin@account_importRawKey',
  1274  			params: 2
  1275  		})
  1276  	]
  1277  });
  1278  `
  1279  
  1280  const LESPayJs = `
  1281  web3._extend({
  1282  	property: 'lespay',
  1283  	methods:
  1284  	[
  1285  		new web3._extend.Method({
  1286  			name: 'distribution',
  1287  			call: 'lespay_distribution',
  1288  			params: 2
  1289  		}),
  1290  		new web3._extend.Method({
  1291  			name: 'timeout',
  1292  			call: 'lespay_timeout',
  1293  			params: 2
  1294  		}),
  1295  		new web3._extend.Method({
  1296  			name: 'value',
  1297  			call: 'lespay_value',
  1298  			params: 2
  1299  		}),
  1300  	],
  1301  	properties:
  1302  	[
  1303  		new web3._extend.Property({
  1304  			name: 'requestStats',
  1305  			getter: 'lespay_requestStats'
  1306  		}),
  1307  	]
  1308  });
  1309  `