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