gitlab.com/yannislg/go-pulse@v0.0.0-20210722055913-a3e24e95638d/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  }
    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: 'startRPC',
   191  			call: 'admin_startRPC',
   192  			params: 4,
   193  			inputFormatter: [null, null, null, null]
   194  		}),
   195  		new web3._extend.Method({
   196  			name: 'stopRPC',
   197  			call: 'admin_stopRPC'
   198  		}),
   199  		new web3._extend.Method({
   200  			name: 'startWS',
   201  			call: 'admin_startWS',
   202  			params: 4,
   203  			inputFormatter: [null, null, null, null]
   204  		}),
   205  		new web3._extend.Method({
   206  			name: 'stopWS',
   207  			call: 'admin_stopWS'
   208  		}),
   209  	],
   210  	properties: [
   211  		new web3._extend.Property({
   212  			name: 'nodeInfo',
   213  			getter: 'admin_nodeInfo'
   214  		}),
   215  		new web3._extend.Property({
   216  			name: 'peers',
   217  			getter: 'admin_peers'
   218  		}),
   219  		new web3._extend.Property({
   220  			name: 'datadir',
   221  			getter: 'admin_datadir'
   222  		}),
   223  	]
   224  });
   225  `
   226  
   227  const DebugJs = `
   228  web3._extend({
   229  	property: 'debug',
   230  	methods: [
   231  		new web3._extend.Method({
   232  			name: 'accountRange',
   233  			call: 'debug_accountRange',
   234  			params: 2
   235  		}),
   236  		new web3._extend.Method({
   237  			name: 'printBlock',
   238  			call: 'debug_printBlock',
   239  			params: 1
   240  		}),
   241  		new web3._extend.Method({
   242  			name: 'getBlockRlp',
   243  			call: 'debug_getBlockRlp',
   244  			params: 1
   245  		}),
   246  		new web3._extend.Method({
   247  			name: 'testSignCliqueBlock',
   248  			call: 'debug_testSignCliqueBlock',
   249  			params: 2,
   250  			inputFormatters: [web3._extend.formatters.inputAddressFormatter, null],
   251  		}),
   252  		new web3._extend.Method({
   253  			name: 'setHead',
   254  			call: 'debug_setHead',
   255  			params: 1
   256  		}),
   257  		new web3._extend.Method({
   258  			name: 'seedHash',
   259  			call: 'debug_seedHash',
   260  			params: 1
   261  		}),
   262  		new web3._extend.Method({
   263  			name: 'dumpBlock',
   264  			call: 'debug_dumpBlock',
   265  			params: 1
   266  		}),
   267  		new web3._extend.Method({
   268  			name: 'chaindbProperty',
   269  			call: 'debug_chaindbProperty',
   270  			params: 1,
   271  			outputFormatter: console.log
   272  		}),
   273  		new web3._extend.Method({
   274  			name: 'chaindbCompact',
   275  			call: 'debug_chaindbCompact',
   276  		}),
   277  		new web3._extend.Method({
   278  			name: 'verbosity',
   279  			call: 'debug_verbosity',
   280  			params: 1
   281  		}),
   282  		new web3._extend.Method({
   283  			name: 'vmodule',
   284  			call: 'debug_vmodule',
   285  			params: 1
   286  		}),
   287  		new web3._extend.Method({
   288  			name: 'backtraceAt',
   289  			call: 'debug_backtraceAt',
   290  			params: 1,
   291  		}),
   292  		new web3._extend.Method({
   293  			name: 'stacks',
   294  			call: 'debug_stacks',
   295  			params: 0,
   296  			outputFormatter: console.log
   297  		}),
   298  		new web3._extend.Method({
   299  			name: 'freeOSMemory',
   300  			call: 'debug_freeOSMemory',
   301  			params: 0,
   302  		}),
   303  		new web3._extend.Method({
   304  			name: 'setGCPercent',
   305  			call: 'debug_setGCPercent',
   306  			params: 1,
   307  		}),
   308  		new web3._extend.Method({
   309  			name: 'memStats',
   310  			call: 'debug_memStats',
   311  			params: 0,
   312  		}),
   313  		new web3._extend.Method({
   314  			name: 'gcStats',
   315  			call: 'debug_gcStats',
   316  			params: 0,
   317  		}),
   318  		new web3._extend.Method({
   319  			name: 'cpuProfile',
   320  			call: 'debug_cpuProfile',
   321  			params: 2
   322  		}),
   323  		new web3._extend.Method({
   324  			name: 'startCPUProfile',
   325  			call: 'debug_startCPUProfile',
   326  			params: 1
   327  		}),
   328  		new web3._extend.Method({
   329  			name: 'stopCPUProfile',
   330  			call: 'debug_stopCPUProfile',
   331  			params: 0
   332  		}),
   333  		new web3._extend.Method({
   334  			name: 'goTrace',
   335  			call: 'debug_goTrace',
   336  			params: 2
   337  		}),
   338  		new web3._extend.Method({
   339  			name: 'startGoTrace',
   340  			call: 'debug_startGoTrace',
   341  			params: 1
   342  		}),
   343  		new web3._extend.Method({
   344  			name: 'stopGoTrace',
   345  			call: 'debug_stopGoTrace',
   346  			params: 0
   347  		}),
   348  		new web3._extend.Method({
   349  			name: 'blockProfile',
   350  			call: 'debug_blockProfile',
   351  			params: 2
   352  		}),
   353  		new web3._extend.Method({
   354  			name: 'setBlockProfileRate',
   355  			call: 'debug_setBlockProfileRate',
   356  			params: 1
   357  		}),
   358  		new web3._extend.Method({
   359  			name: 'writeBlockProfile',
   360  			call: 'debug_writeBlockProfile',
   361  			params: 1
   362  		}),
   363  		new web3._extend.Method({
   364  			name: 'mutexProfile',
   365  			call: 'debug_mutexProfile',
   366  			params: 2
   367  		}),
   368  		new web3._extend.Method({
   369  			name: 'setMutexProfileFraction',
   370  			call: 'debug_setMutexProfileFraction',
   371  			params: 1
   372  		}),
   373  		new web3._extend.Method({
   374  			name: 'writeMutexProfile',
   375  			call: 'debug_writeMutexProfile',
   376  			params: 1
   377  		}),
   378  		new web3._extend.Method({
   379  			name: 'writeMemProfile',
   380  			call: 'debug_writeMemProfile',
   381  			params: 1
   382  		}),
   383  		new web3._extend.Method({
   384  			name: 'traceBlock',
   385  			call: 'debug_traceBlock',
   386  			params: 2,
   387  			inputFormatter: [null, null]
   388  		}),
   389  		new web3._extend.Method({
   390  			name: 'traceBlockFromFile',
   391  			call: 'debug_traceBlockFromFile',
   392  			params: 2,
   393  			inputFormatter: [null, null]
   394  		}),
   395  		new web3._extend.Method({
   396  			name: 'traceBadBlock',
   397  			call: 'debug_traceBadBlock',
   398  			params: 1,
   399  			inputFormatter: [null]
   400  		}),
   401  		new web3._extend.Method({
   402  			name: 'standardTraceBadBlockToFile',
   403  			call: 'debug_standardTraceBadBlockToFile',
   404  			params: 2,
   405  			inputFormatter: [null, null]
   406  		}),
   407  		new web3._extend.Method({
   408  			name: 'standardTraceBlockToFile',
   409  			call: 'debug_standardTraceBlockToFile',
   410  			params: 2,
   411  			inputFormatter: [null, null]
   412  		}),
   413  		new web3._extend.Method({
   414  			name: 'traceBlockByNumber',
   415  			call: 'debug_traceBlockByNumber',
   416  			params: 2,
   417  			inputFormatter: [null, null]
   418  		}),
   419  		new web3._extend.Method({
   420  			name: 'traceBlockByHash',
   421  			call: 'debug_traceBlockByHash',
   422  			params: 2,
   423  			inputFormatter: [null, null]
   424  		}),
   425  		new web3._extend.Method({
   426  			name: 'traceTransaction',
   427  			call: 'debug_traceTransaction',
   428  			params: 2,
   429  			inputFormatter: [null, null]
   430  		}),
   431  		new web3._extend.Method({
   432  			name: 'preimage',
   433  			call: 'debug_preimage',
   434  			params: 1,
   435  			inputFormatter: [null]
   436  		}),
   437  		new web3._extend.Method({
   438  			name: 'getBadBlocks',
   439  			call: 'debug_getBadBlocks',
   440  			params: 0,
   441  		}),
   442  		new web3._extend.Method({
   443  			name: 'storageRangeAt',
   444  			call: 'debug_storageRangeAt',
   445  			params: 5,
   446  		}),
   447  		new web3._extend.Method({
   448  			name: 'getModifiedAccountsByNumber',
   449  			call: 'debug_getModifiedAccountsByNumber',
   450  			params: 2,
   451  			inputFormatter: [null, null],
   452  		}),
   453  		new web3._extend.Method({
   454  			name: 'getModifiedAccountsByHash',
   455  			call: 'debug_getModifiedAccountsByHash',
   456  			params: 2,
   457  			inputFormatter:[null, null],
   458  		}),
   459  		new web3._extend.Method({
   460  			name: 'freezeClient',
   461  			call: 'debug_freezeClient',
   462  			params: 1,
   463  		}),
   464  	],
   465  	properties: []
   466  });
   467  `
   468  
   469  const EthJs = `
   470  web3._extend({
   471  	property: 'eth',
   472  	methods: [
   473  		new web3._extend.Method({
   474  			name: 'chainId',
   475  			call: 'eth_chainId',
   476  			params: 0
   477  		}),
   478  		new web3._extend.Method({
   479  			name: 'sign',
   480  			call: 'eth_sign',
   481  			params: 2,
   482  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   483  		}),
   484  		new web3._extend.Method({
   485  			name: 'resend',
   486  			call: 'eth_resend',
   487  			params: 3,
   488  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   489  		}),
   490  		new web3._extend.Method({
   491  			name: 'signTransaction',
   492  			call: 'eth_signTransaction',
   493  			params: 1,
   494  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   495  		}),
   496  		new web3._extend.Method({
   497  			name: 'estimateGas',
   498  			call: 'eth_estimateGas',
   499  			params: 2,
   500  			inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
   501  			outputFormatter: web3._extend.utils.toDecimal
   502  		}),
   503  		new web3._extend.Method({
   504  			name: 'submitTransaction',
   505  			call: 'eth_submitTransaction',
   506  			params: 1,
   507  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   508  		}),
   509  		new web3._extend.Method({
   510  			name: 'fillTransaction',
   511  			call: 'eth_fillTransaction',
   512  			params: 1,
   513  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   514  		}),
   515  		new web3._extend.Method({
   516  			name: 'getHeaderByNumber',
   517  			call: 'eth_getHeaderByNumber',
   518  			params: 1
   519  		}),
   520  		new web3._extend.Method({
   521  			name: 'getHeaderByHash',
   522  			call: 'eth_getHeaderByHash',
   523  			params: 1
   524  		}),
   525  		new web3._extend.Method({
   526  			name: 'getBlockByNumber',
   527  			call: 'eth_getBlockByNumber',
   528  			params: 2
   529  		}),
   530  		new web3._extend.Method({
   531  			name: 'getBlockByHash',
   532  			call: 'eth_getBlockByHash',
   533  			params: 2
   534  		}),
   535  		new web3._extend.Method({
   536  			name: 'getRawTransaction',
   537  			call: 'eth_getRawTransactionByHash',
   538  			params: 1
   539  		}),
   540  		new web3._extend.Method({
   541  			name: 'getRawTransactionFromBlock',
   542  			call: function(args) {
   543  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
   544  			},
   545  			params: 2,
   546  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   547  		}),
   548  		new web3._extend.Method({
   549  			name: 'getProof',
   550  			call: 'eth_getProof',
   551  			params: 3,
   552  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter]
   553  		}),
   554  	],
   555  	properties: [
   556  		new web3._extend.Property({
   557  			name: 'pendingTransactions',
   558  			getter: 'eth_pendingTransactions',
   559  			outputFormatter: function(txs) {
   560  				var formatted = [];
   561  				for (var i = 0; i < txs.length; i++) {
   562  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   563  					formatted[i].blockHash = null;
   564  				}
   565  				return formatted;
   566  			}
   567  		}),
   568  	]
   569  });
   570  `
   571  
   572  const MinerJs = `
   573  web3._extend({
   574  	property: 'miner',
   575  	methods: [
   576  		new web3._extend.Method({
   577  			name: 'start',
   578  			call: 'miner_start',
   579  			params: 1,
   580  			inputFormatter: [null]
   581  		}),
   582  		new web3._extend.Method({
   583  			name: 'stop',
   584  			call: 'miner_stop'
   585  		}),
   586  		new web3._extend.Method({
   587  			name: 'setEtherbase',
   588  			call: 'miner_setEtherbase',
   589  			params: 1,
   590  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   591  		}),
   592  		new web3._extend.Method({
   593  			name: 'setExtra',
   594  			call: 'miner_setExtra',
   595  			params: 1
   596  		}),
   597  		new web3._extend.Method({
   598  			name: 'setGasPrice',
   599  			call: 'miner_setGasPrice',
   600  			params: 1,
   601  			inputFormatter: [web3._extend.utils.fromDecimal]
   602  		}),
   603  		new web3._extend.Method({
   604  			name: 'setRecommitInterval',
   605  			call: 'miner_setRecommitInterval',
   606  			params: 1,
   607  		}),
   608  		new web3._extend.Method({
   609  			name: 'getHashrate',
   610  			call: 'miner_getHashrate'
   611  		}),
   612  	],
   613  	properties: []
   614  });
   615  `
   616  
   617  const NetJs = `
   618  web3._extend({
   619  	property: 'net',
   620  	methods: [],
   621  	properties: [
   622  		new web3._extend.Property({
   623  			name: 'version',
   624  			getter: 'net_version'
   625  		}),
   626  	]
   627  });
   628  `
   629  
   630  const PersonalJs = `
   631  web3._extend({
   632  	property: 'personal',
   633  	methods: [
   634  		new web3._extend.Method({
   635  			name: 'importRawKey',
   636  			call: 'personal_importRawKey',
   637  			params: 2
   638  		}),
   639  		new web3._extend.Method({
   640  			name: 'sign',
   641  			call: 'personal_sign',
   642  			params: 3,
   643  			inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
   644  		}),
   645  		new web3._extend.Method({
   646  			name: 'ecRecover',
   647  			call: 'personal_ecRecover',
   648  			params: 2
   649  		}),
   650  		new web3._extend.Method({
   651  			name: 'openWallet',
   652  			call: 'personal_openWallet',
   653  			params: 2
   654  		}),
   655  		new web3._extend.Method({
   656  			name: 'deriveAccount',
   657  			call: 'personal_deriveAccount',
   658  			params: 3
   659  		}),
   660  		new web3._extend.Method({
   661  			name: 'signTransaction',
   662  			call: 'personal_signTransaction',
   663  			params: 2,
   664  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
   665  		}),
   666  		new web3._extend.Method({
   667  			name: 'unpair',
   668  			call: 'personal_unpair',
   669  			params: 2
   670  		}),
   671  		new web3._extend.Method({
   672  			name: 'initializeWallet',
   673  			call: 'personal_initializeWallet',
   674  			params: 1
   675  		})
   676  	],
   677  	properties: [
   678  		new web3._extend.Property({
   679  			name: 'listWallets',
   680  			getter: 'personal_listWallets'
   681  		}),
   682  	]
   683  })
   684  `
   685  
   686  const RpcJs = `
   687  web3._extend({
   688  	property: 'rpc',
   689  	methods: [],
   690  	properties: [
   691  		new web3._extend.Property({
   692  			name: 'modules',
   693  			getter: 'rpc_modules'
   694  		}),
   695  	]
   696  });
   697  `
   698  
   699  const ShhJs = `
   700  web3._extend({
   701  	property: 'shh',
   702  	methods: [
   703  	],
   704  	properties:
   705  	[
   706  		new web3._extend.Property({
   707  			name: 'version',
   708  			getter: 'shh_version',
   709  			outputFormatter: web3._extend.utils.toDecimal
   710  		}),
   711  		new web3._extend.Property({
   712  			name: 'info',
   713  			getter: 'shh_info'
   714  		}),
   715  	]
   716  });
   717  `
   718  
   719  const SwarmfsJs = `
   720  web3._extend({
   721  	property: 'swarmfs',
   722  	methods:
   723  	[
   724  		new web3._extend.Method({
   725  			name: 'mount',
   726  			call: 'swarmfs_mount',
   727  			params: 2
   728  		}),
   729  		new web3._extend.Method({
   730  			name: 'unmount',
   731  			call: 'swarmfs_unmount',
   732  			params: 1
   733  		}),
   734  		new web3._extend.Method({
   735  			name: 'listmounts',
   736  			call: 'swarmfs_listmounts',
   737  			params: 0
   738  		}),
   739  	]
   740  });
   741  `
   742  
   743  const TxpoolJs = `
   744  web3._extend({
   745  	property: 'txpool',
   746  	methods: [],
   747  	properties:
   748  	[
   749  		new web3._extend.Property({
   750  			name: 'content',
   751  			getter: 'txpool_content'
   752  		}),
   753  		new web3._extend.Property({
   754  			name: 'inspect',
   755  			getter: 'txpool_inspect'
   756  		}),
   757  		new web3._extend.Property({
   758  			name: 'status',
   759  			getter: 'txpool_status',
   760  			outputFormatter: function(status) {
   761  				status.pending = web3._extend.utils.toDecimal(status.pending);
   762  				status.queued = web3._extend.utils.toDecimal(status.queued);
   763  				return status;
   764  			}
   765  		}),
   766  	]
   767  });
   768  `
   769  
   770  const AccountingJs = `
   771  web3._extend({
   772  	property: 'accounting',
   773  	methods: [
   774  		new web3._extend.Property({
   775  			name: 'balance',
   776  			getter: 'account_balance'
   777  		}),
   778  		new web3._extend.Property({
   779  			name: 'balanceCredit',
   780  			getter: 'account_balanceCredit'
   781  		}),
   782  		new web3._extend.Property({
   783  			name: 'balanceDebit',
   784  			getter: 'account_balanceDebit'
   785  		}),
   786  		new web3._extend.Property({
   787  			name: 'bytesCredit',
   788  			getter: 'account_bytesCredit'
   789  		}),
   790  		new web3._extend.Property({
   791  			name: 'bytesDebit',
   792  			getter: 'account_bytesDebit'
   793  		}),
   794  		new web3._extend.Property({
   795  			name: 'msgCredit',
   796  			getter: 'account_msgCredit'
   797  		}),
   798  		new web3._extend.Property({
   799  			name: 'msgDebit',
   800  			getter: 'account_msgDebit'
   801  		}),
   802  		new web3._extend.Property({
   803  			name: 'peerDrops',
   804  			getter: 'account_peerDrops'
   805  		}),
   806  		new web3._extend.Property({
   807  			name: 'selfDrops',
   808  			getter: 'account_selfDrops'
   809  		}),
   810  	]
   811  });
   812  `
   813  
   814  const LESJs = `
   815  web3._extend({
   816  	property: 'les',
   817  	methods:
   818  	[
   819  		new web3._extend.Method({
   820  			name: 'getCheckpoint',
   821  			call: 'les_getCheckpoint',
   822  			params: 1
   823  		}),
   824  		new web3._extend.Method({
   825  			name: 'clientInfo',
   826  			call: 'les_clientInfo',
   827  			params: 1
   828  		}),
   829  		new web3._extend.Method({
   830  			name: 'priorityClientInfo',
   831  			call: 'les_priorityClientInfo',
   832  			params: 3
   833  		}),
   834  		new web3._extend.Method({
   835  			name: 'setClientParams',
   836  			call: 'les_setClientParams',
   837  			params: 2
   838  		}),
   839  		new web3._extend.Method({
   840  			name: 'setDefaultParams',
   841  			call: 'les_setDefaultParams',
   842  			params: 1
   843  		}),
   844  		new web3._extend.Method({
   845  			name: 'addBalance',
   846  			call: 'les_addBalance',
   847  			params: 3
   848  		}),
   849  	],
   850  	properties:
   851  	[
   852  		new web3._extend.Property({
   853  			name: 'latestCheckpoint',
   854  			getter: 'les_latestCheckpoint'
   855  		}),
   856  		new web3._extend.Property({
   857  			name: 'checkpointContractAddress',
   858  			getter: 'les_getCheckpointContractAddress'
   859  		}),
   860  		new web3._extend.Property({
   861  			name: 'serverInfo',
   862  			getter: 'les_serverInfo'
   863  		}),
   864  	]
   865  });
   866  `
   867  
   868  const LESPayJs = `
   869  web3._extend({
   870  	property: 'lespay',
   871  	methods:
   872  	[
   873  		new web3._extend.Method({
   874  			name: 'distribution',
   875  			call: 'lespay_distribution',
   876  			params: 2
   877  		}),
   878  		new web3._extend.Method({
   879  			name: 'timeout',
   880  			call: 'lespay_timeout',
   881  			params: 2
   882  		}),
   883  		new web3._extend.Method({
   884  			name: 'value',
   885  			call: 'lespay_value',
   886  			params: 2
   887  		}),
   888  	],
   889  	properties:
   890  	[
   891  		new web3._extend.Property({
   892  			name: 'requestStats',
   893  			getter: 'lespay_requestStats'
   894  		}),
   895  	]
   896  });
   897  `