github.com/intfoundation/intchain@v0.0.0-20220727031208-4316ad31ca73/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 intchain specific web3.js extensions.
    18  package web3ext
    19  
    20  var Modules = map[string]string{
    21  	"admin":      Admin_JS,
    22  	"chequebook": Chequebook_JS,
    23  	"clique":     Clique_JS,
    24  	"debug":      Debug_JS,
    25  	"eth":        Eth_JS,
    26  	"int":        INT_JS,
    27  	"miner":      Miner_JS,
    28  	"net":        Net_JS,
    29  	"personal":   Personal_JS,
    30  	"rpc":        RPC_JS,
    31  	"shh":        Shh_JS,
    32  	"swarmfs":    SWARMFS_JS,
    33  	"txpool":     TxPool_JS,
    34  	"istanbul":   Istanbul_JS,
    35  	//// IntChain JS
    36  	//"chain": Chain_JS,
    37  	//"tdm":   Tdm_JS,
    38  	//"del":   Del_JS,
    39  }
    40  
    41  const Chequebook_JS = `
    42  web3._extend({
    43  	property: 'chequebook',
    44  	methods: [
    45  		new web3._extend.Method({
    46  			name: 'deposit',
    47  			call: 'chequebook_deposit',
    48  			params: 1,
    49  			inputFormatter: [null]
    50  		}),
    51  		new web3._extend.Property({
    52  			name: 'balance',
    53  			getter: 'chequebook_balance',
    54  			outputFormatter: web3._extend.utils.toDecimal
    55  		}),
    56  		new web3._extend.Method({
    57  			name: 'cash',
    58  			call: 'chequebook_cash',
    59  			params: 1,
    60  			inputFormatter: [null]
    61  		}),
    62  		new web3._extend.Method({
    63  			name: 'issue',
    64  			call: 'chequebook_issue',
    65  			params: 2,
    66  			inputFormatter: [null, null]
    67  		}),
    68  	]
    69  });
    70  `
    71  
    72  const Clique_JS = `
    73  web3._extend({
    74  	property: 'clique',
    75  	methods: [
    76  		new web3._extend.Method({
    77  			name: 'getSnapshot',
    78  			call: 'clique_getSnapshot',
    79  			params: 1,
    80  			inputFormatter: [null]
    81  		}),
    82  		new web3._extend.Method({
    83  			name: 'getSnapshotAtHash',
    84  			call: 'clique_getSnapshotAtHash',
    85  			params: 1
    86  		}),
    87  		new web3._extend.Method({
    88  			name: 'getSigners',
    89  			call: 'clique_getSigners',
    90  			params: 1,
    91  			inputFormatter: [null]
    92  		}),
    93  		new web3._extend.Method({
    94  			name: 'getSignersAtHash',
    95  			call: 'clique_getSignersAtHash',
    96  			params: 1
    97  		}),
    98  		new web3._extend.Method({
    99  			name: 'propose',
   100  			call: 'clique_propose',
   101  			params: 2
   102  		}),
   103  		new web3._extend.Method({
   104  			name: 'discard',
   105  			call: 'clique_discard',
   106  			params: 1
   107  		}),
   108  	],
   109  	properties: [
   110  		new web3._extend.Property({
   111  			name: 'proposals',
   112  			getter: 'clique_proposals'
   113  		}),
   114  	]
   115  });
   116  `
   117  
   118  const Admin_JS = `
   119  web3._extend({
   120  	property: 'admin',
   121  	methods: [
   122  		new web3._extend.Method({
   123  			name: 'addPeer',
   124  			call: 'admin_addPeer',
   125  			params: 1
   126  		}),
   127  		new web3._extend.Method({
   128  			name: 'removePeer',
   129  			call: 'admin_removePeer',
   130  			params: 1
   131  		}),
   132  		new web3._extend.Method({
   133  			name: 'exportChain',
   134  			call: 'admin_exportChain',
   135  			params: 1,
   136  			inputFormatter: [null]
   137  		}),
   138  		new web3._extend.Method({
   139  			name: 'importChain',
   140  			call: 'admin_importChain',
   141  			params: 1
   142  		}),
   143  		new web3._extend.Method({
   144  			name: 'sleepBlocks',
   145  			call: 'admin_sleepBlocks',
   146  			params: 2
   147  		}),
   148  		new web3._extend.Method({
   149  			name: 'startRPC',
   150  			call: 'admin_startRPC',
   151  			params: 4,
   152  			inputFormatter: [null, null, null, null]
   153  		}),
   154  		new web3._extend.Method({
   155  			name: 'stopRPC',
   156  			call: 'admin_stopRPC'
   157  		}),
   158  		new web3._extend.Method({
   159  			name: 'startWS',
   160  			call: 'admin_startWS',
   161  			params: 4,
   162  			inputFormatter: [null, null, null, null]
   163  		}),
   164  		new web3._extend.Method({
   165  			name: 'stopWS',
   166  			call: 'admin_stopWS'
   167  		}),
   168  		new web3._extend.Method({
   169  			name: 'startScanAndPrune',
   170  			call: 'admin_startScanAndPrune'
   171  		}),
   172  	],
   173  	properties: [
   174  		new web3._extend.Property({
   175  			name: 'nodeInfo',
   176  			getter: 'admin_nodeInfo'
   177  		}),
   178  		new web3._extend.Property({
   179  			name: 'peers',
   180  			getter: 'admin_peers'
   181  		}),
   182  		new web3._extend.Property({
   183  			name: 'datadir',
   184  			getter: 'admin_datadir'
   185  		}),
   186  	]
   187  });
   188  `
   189  
   190  const Debug_JS = `
   191  web3._extend({
   192  	property: 'debug',
   193  	methods: [
   194  		new web3._extend.Method({
   195  			name: 'printBlock',
   196  			call: 'debug_printBlock',
   197  			params: 1
   198  		}),
   199  		new web3._extend.Method({
   200  			name: 'getBlockRlp',
   201  			call: 'debug_getBlockRlp',
   202  			params: 1
   203  		}),
   204  		new web3._extend.Method({
   205  			name: 'setHead',
   206  			call: 'debug_setHead',
   207  			params: 1
   208  		}),
   209  		new web3._extend.Method({
   210  			name: 'seedHash',
   211  			call: 'debug_seedHash',
   212  			params: 1
   213  		}),
   214  		new web3._extend.Method({
   215  			name: 'dumpBlock',
   216  			call: 'debug_dumpBlock',
   217  			params: 1
   218  		}),
   219  		new web3._extend.Method({
   220  			name: 'chaindbProperty',
   221  			call: 'debug_chaindbProperty',
   222  			params: 1,
   223  			outputFormatter: console.log
   224  		}),
   225  		new web3._extend.Method({
   226  			name: 'chaindbCompact',
   227  			call: 'debug_chaindbCompact',
   228  		}),
   229  		new web3._extend.Method({
   230  			name: 'metrics',
   231  			call: 'debug_metrics',
   232  			params: 1
   233  		}),
   234  		new web3._extend.Method({
   235  			name: 'verbosity',
   236  			call: 'debug_verbosity',
   237  			params: 1
   238  		}),
   239  		new web3._extend.Method({
   240  			name: 'vmodule',
   241  			call: 'debug_vmodule',
   242  			params: 1
   243  		}),
   244  		new web3._extend.Method({
   245  			name: 'backtraceAt',
   246  			call: 'debug_backtraceAt',
   247  			params: 1,
   248  		}),
   249  		new web3._extend.Method({
   250  			name: 'stacks',
   251  			call: 'debug_stacks',
   252  			params: 0,
   253  			outputFormatter: console.log
   254  		}),
   255  		new web3._extend.Method({
   256  			name: 'freeOSMemory',
   257  			call: 'debug_freeOSMemory',
   258  			params: 0,
   259  		}),
   260  		new web3._extend.Method({
   261  			name: 'setGCPercent',
   262  			call: 'debug_setGCPercent',
   263  			params: 1,
   264  		}),
   265  		new web3._extend.Method({
   266  			name: 'memStats',
   267  			call: 'debug_memStats',
   268  			params: 0,
   269  		}),
   270  		new web3._extend.Method({
   271  			name: 'gcStats',
   272  			call: 'debug_gcStats',
   273  			params: 0,
   274  		}),
   275  		new web3._extend.Method({
   276  			name: 'cpuProfile',
   277  			call: 'debug_cpuProfile',
   278  			params: 2
   279  		}),
   280  		new web3._extend.Method({
   281  			name: 'startCPUProfile',
   282  			call: 'debug_startCPUProfile',
   283  			params: 1
   284  		}),
   285  		new web3._extend.Method({
   286  			name: 'stopCPUProfile',
   287  			call: 'debug_stopCPUProfile',
   288  			params: 0
   289  		}),
   290  		new web3._extend.Method({
   291  			name: 'goTrace',
   292  			call: 'debug_goTrace',
   293  			params: 2
   294  		}),
   295  		new web3._extend.Method({
   296  			name: 'startGoTrace',
   297  			call: 'debug_startGoTrace',
   298  			params: 1
   299  		}),
   300  		new web3._extend.Method({
   301  			name: 'stopGoTrace',
   302  			call: 'debug_stopGoTrace',
   303  			params: 0
   304  		}),
   305  		new web3._extend.Method({
   306  			name: 'blockProfile',
   307  			call: 'debug_blockProfile',
   308  			params: 2
   309  		}),
   310  		new web3._extend.Method({
   311  			name: 'setBlockProfileRate',
   312  			call: 'debug_setBlockProfileRate',
   313  			params: 1
   314  		}),
   315  		new web3._extend.Method({
   316  			name: 'writeBlockProfile',
   317  			call: 'debug_writeBlockProfile',
   318  			params: 1
   319  		}),
   320  		new web3._extend.Method({
   321  			name: 'mutexProfile',
   322  			call: 'debug_mutexProfile',
   323  			params: 2
   324  		}),
   325  		new web3._extend.Method({
   326  			name: 'setMutexProfileRate',
   327  			call: 'debug_setMutexProfileRate',
   328  			params: 1
   329  		}),
   330  		new web3._extend.Method({
   331  			name: 'writeMutexProfile',
   332  			call: 'debug_writeMutexProfile',
   333  			params: 1
   334  		}),
   335  		new web3._extend.Method({
   336  			name: 'writeMemProfile',
   337  			call: 'debug_writeMemProfile',
   338  			params: 1
   339  		}),
   340  		new web3._extend.Method({
   341  			name: 'traceBlock',
   342  			call: 'debug_traceBlock',
   343  			params: 2,
   344  			inputFormatter: [null, null]
   345  		}),
   346  		new web3._extend.Method({
   347  			name: 'traceBlockFromFile',
   348  			call: 'debug_traceBlockFromFile',
   349  			params: 2,
   350  			inputFormatter: [null, null]
   351  		}),
   352  		new web3._extend.Method({
   353  			name: 'traceBlockByNumber',
   354  			call: 'debug_traceBlockByNumber',
   355  			params: 2,
   356  			inputFormatter: [null, null]
   357  		}),
   358  		new web3._extend.Method({
   359  			name: 'traceBlockByHash',
   360  			call: 'debug_traceBlockByHash',
   361  			params: 2,
   362  			inputFormatter: [null, null]
   363  		}),
   364  		new web3._extend.Method({
   365  			name: 'traceTransaction',
   366  			call: 'debug_traceTransaction',
   367  			params: 2,
   368  			inputFormatter: [null, null]
   369  		}),
   370  		new web3._extend.Method({
   371  			name: 'preimage',
   372  			call: 'debug_preimage',
   373  			params: 1,
   374  			inputFormatter: [null]
   375  		}),
   376  		new web3._extend.Method({
   377  			name: 'getBadBlocks',
   378  			call: 'debug_getBadBlocks',
   379  			params: 0,
   380  		}),
   381  		new web3._extend.Method({
   382  			name: 'storageRangeAt',
   383  			call: 'debug_storageRangeAt',
   384  			params: 5,
   385  		}),
   386  		new web3._extend.Method({
   387  			name: 'getModifiedAccountsByNumber',
   388  			call: 'debug_getModifiedAccountsByNumber',
   389  			params: 2,
   390  			inputFormatter: [null, null],
   391  		}),
   392  		new web3._extend.Method({
   393  			name: 'getModifiedAccountsByHash',
   394  			call: 'debug_getModifiedAccountsByHash',
   395  			params: 2,
   396  			inputFormatter:[null, null],
   397  		}),
   398  	],
   399  	properties: []
   400  });
   401  `
   402  
   403  const Eth_JS = `
   404  web3._extend({
   405  	property: 'eth',
   406  	methods: [
   407  		new web3._extend.Method({
   408  			name: 'sign',
   409  			call: 'eth_sign',
   410  			params: 2,
   411  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   412  		}),
   413  		new web3._extend.Method({
   414  			name: 'resend',
   415  			call: 'eth_resend',
   416  			params: 3,
   417  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   418  		}),
   419  		new web3._extend.Method({
   420  			name: 'signTransaction',
   421  			call: 'eth_signTransaction',
   422  			params: 1,
   423  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   424  		}),
   425  		new web3._extend.Method({
   426  			name: 'submitTransaction',
   427  			call: 'eth_submitTransaction',
   428  			params: 1,
   429  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   430  		}),
   431  		new web3._extend.Method({
   432  			name: 'getRawTransaction',
   433  			call: 'eth_getRawTransactionByHash',
   434  			params: 1
   435  		}),
   436  		new web3._extend.Method({
   437  			name: 'getRawTransactionFromBlock',
   438  			call: function(args) {
   439  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
   440  			},
   441  			params: 2,
   442  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   443  		}),
   444  		new web3._extend.Method({
   445  			name: 'getBalanceDetail',
   446  			call: 'eth_getBalanceDetail',
   447  			params: 3,
   448  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter, null]
   449  		}),
   450  	],
   451  	properties: [
   452  		new web3._extend.Property({
   453  			name: 'pendingTransactions',
   454  			getter: 'eth_pendingTransactions',
   455  			outputFormatter: function(txs) {
   456  				var formatted = [];
   457  				for (var i = 0; i < txs.length; i++) {
   458  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   459  					formatted[i].blockHash = null;
   460  				}
   461  				return formatted;
   462  			}
   463  		}),
   464  	]
   465  });
   466  `
   467  
   468  const INT_JS = `
   469  web3._extend({
   470  	property: 'int',
   471  	methods: [
   472  		new web3._extend.Method({
   473  			name: 'sign',
   474  			call: 'int_sign',
   475  			params: 2,
   476  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   477  		}),
   478  		new web3._extend.Method({
   479  			name: 'resend',
   480  			call: 'int_resend',
   481  			params: 3,
   482  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
   483  		}),
   484  		new web3._extend.Method({
   485  			name: 'signTransaction',
   486  			call: 'int_signTransaction',
   487  			params: 1,
   488  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   489  		}),
   490  		new web3._extend.Method({
   491  			name: 'submitTransaction',
   492  			call: 'int_submitTransaction',
   493  			params: 1,
   494  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
   495  		}),
   496  		new web3._extend.Method({
   497  			name: 'getRawTransaction',
   498  			call: 'int_getRawTransactionByHash',
   499  			params: 1
   500  		}),
   501  		new web3._extend.Method({
   502  			name: 'getRawTransactionFromBlock',
   503  			call: function(args) {
   504  				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'int_getRawTransactionByBlockHashAndIndex' : 'int_getRawTransactionByBlockNumberAndIndex';
   505  			},
   506  			params: 2,
   507  			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
   508  		}),
   509  		new web3._extend.Method({
   510  			name: 'getBalanceDetail',
   511  			call: 'int_getBalanceDetail',
   512  			params: 3,
   513  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter, null]
   514  		}),
   515  		new web3._extend.Method({
   516  			name: 'signAddress',
   517  			call: 'int_signAddress',
   518  			params: 2
   519  		}),
   520  		new web3._extend.Method({
   521  			name: 'getBlockReward',
   522  			call: 'int_getBlockReward',
   523  			params: 1
   524  		}),
   525  		new web3._extend.Method({
   526  			name: 'withdrawReward',
   527  			call: 'int_withdrawReward',
   528  			params: 4,
   529  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputAddressFormatter, null, null]
   530  		}),
   531  		new web3._extend.Method({
   532  			name: 'voteNextEpoch',
   533  			call: 'int_voteNextEpoch',
   534  			params: 3
   535  		}),
   536  		new web3._extend.Method({
   537  			name: 'revealVote',
   538  			call: 'int_revealVote',
   539  			params: 6
   540  		}),
   541  		new web3._extend.Method({
   542  			name: 'getCurrentEpochNumber',
   543  			call: 'int_getCurrentEpochNumber'
   544  		}),
   545  		new web3._extend.Method({
   546  			name: 'getEpoch',
   547  			call: 'int_getEpoch',
   548  			params: 1
   549  		}),
   550  		new web3._extend.Method({
   551  			name: 'getNextEpochVote',
   552  			call: 'int_getNextEpochVote'
   553  		}),
   554  		new web3._extend.Method({
   555  			name: 'getNextEpochValidators',
   556  			call: 'int_getNextEpochValidators'
   557  		}),
   558  		new web3._extend.Method({
   559  			name: 'getNextEpochCandidates',
   560  			call: 'int_getNextEpochCandidates'
   561  		}),
   562  		new web3._extend.Method({
   563  			name: 'getEpochCandidates',
   564  			call: 'int_getEpochCandidates',
   565  			params: 1
   566  		}),
   567  		new web3._extend.Method({
   568  			name: 'getValidatorStatus',
   569  			call: 'int_getValidatorStatus',
   570  			params: 1,
   571  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   572  		}),
   573  		new web3._extend.Method({
   574  			name: 'unForbidden',
   575  			call: 'int_unForbidden',
   576  			params: 2,
   577  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   578  		}),
   579  		new web3._extend.Method({
   580  			name: 'editValidator',
   581  			call: 'int_editValidator',
   582  			params: 6,
   583  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, null, null, null, null]
   584  		}),
   585  		new web3._extend.Method({
   586  			name: 'getVoteHash',
   587  			call: 'int_getVoteHash',
   588  			params: 4,
   589  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, null, null]
   590  		}),
   591  		new web3._extend.Method({
   592  			name: 'getConsensusPublicKey',
   593  			call: 'int_getConsensusPublicKey',
   594  			params: 1
   595  		}),
   596  		new web3._extend.Method({
   597  			name: 'decodeExtraData',
   598  			call: 'int_decodeExtraData',
   599  			params: 1
   600  		}),
   601  		new web3._extend.Method({
   602  			name: 'delegate',
   603  			call: 'int_delegate',
   604  			params: 4
   605  		}),
   606  		new web3._extend.Method({
   607  			name: 'unDelegate',
   608  			call: 'int_unDelegate',
   609  			params: 4
   610  		}),
   611  		new web3._extend.Method({
   612  			name: 'register',
   613  			call: 'int_register',
   614  			params: 6,
   615  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, null, null, null]
   616  		}),
   617  		new web3._extend.Method({
   618  			name: 'unRegister',
   619  			call: 'int_unRegister',
   620  			params: 2,
   621  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
   622  		}),
   623  		new web3._extend.Method({
   624  			name: 'checkCandidate',
   625  			call: 'int_checkCandidate',
   626  			params: 2,
   627  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter]
   628  		}),
   629  		new web3._extend.Method({
   630  			name: 'getForbiddenStatus',
   631  			call: 'int_getForbiddenStatus',
   632  			params: 2,
   633  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputDefaultBlockNumberFormatter]
   634  		}),
   635  		new web3._extend.Method({
   636  			name: 'setCommission',
   637  			call: 'int_setCommission',
   638  			params: 3,
   639  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, null]
   640  		}),
   641  		new web3._extend.Method({
   642  			name: 'setAddress',
   643  			call: 'int_setAddress',
   644  			params: 3,
   645  			inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputAddressFormatter, null]
   646  		})
   647  	],
   648  	properties: [
   649  		new web3._extend.Property({
   650  			name: 'pendingTransactions',
   651  			getter: 'eth_pendingTransactions',
   652  			outputFormatter: function(txs) {
   653  				var formatted = [];
   654  				for (var i = 0; i < txs.length; i++) {
   655  					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
   656  					formatted[i].blockHash = null;
   657  				}
   658  				return formatted;
   659  			}
   660  		}),
   661  	]
   662  });
   663  `
   664  
   665  const Miner_JS = `
   666  web3._extend({
   667  	property: 'miner',
   668  	methods: [
   669  		new web3._extend.Method({
   670  			name: 'start',
   671  			call: 'miner_start',
   672  			params: 1,
   673  			inputFormatter: [null]
   674  		}),
   675  		new web3._extend.Method({
   676  			name: 'stop',
   677  			call: 'miner_stop'
   678  		}),
   679  		new web3._extend.Method({
   680  			name: 'setEtherbase',
   681  			call: 'miner_setEtherbase',
   682  			params: 1,
   683  			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
   684  		}),
   685  		new web3._extend.Method({
   686  			name: 'setExtra',
   687  			call: 'miner_setExtra',
   688  			params: 1
   689  		}),
   690  		new web3._extend.Method({
   691  			name: 'setGasPrice',
   692  			call: 'miner_setGasPrice',
   693  			params: 1,
   694  			inputFormatter: [web3._extend.utils.fromDecimal]
   695  		}),
   696  		new web3._extend.Method({
   697  			name: 'getHashrate',
   698  			call: 'miner_getHashrate'
   699  		}),
   700  	],
   701  	properties: []
   702  });
   703  `
   704  
   705  const Net_JS = `
   706  web3._extend({
   707  	property: 'net',
   708  	methods: [],
   709  	properties: [
   710  		new web3._extend.Property({
   711  			name: 'version',
   712  			getter: 'net_version'
   713  		}),
   714  	]
   715  });
   716  `
   717  
   718  const Personal_JS = `
   719  web3._extend({
   720  	property: 'personal',
   721  	methods: [
   722  		new web3._extend.Method({
   723  			name: 'importRawKey',
   724  			call: 'personal_importRawKey',
   725  			params: 2
   726  		}),
   727  		new web3._extend.Method({
   728  			name: 'sign',
   729  			call: 'personal_sign',
   730  			params: 3,
   731  			inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
   732  		}),
   733  		new web3._extend.Method({
   734  			name: 'ecRecover',
   735  			call: 'personal_ecRecover',
   736  			params: 2
   737  		}),
   738  		new web3._extend.Method({
   739  			name: 'openWallet',
   740  			call: 'personal_openWallet',
   741  			params: 2
   742  		}),
   743  		new web3._extend.Method({
   744  			name: 'deriveAccount',
   745  			call: 'personal_deriveAccount',
   746  			params: 3
   747  		}),
   748  		new web3._extend.Method({
   749  			name: 'signTransaction',
   750  			call: 'personal_signTransaction',
   751  			params: 2,
   752  			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
   753  		}),
   754  	],
   755  	properties: [
   756  		new web3._extend.Property({
   757  			name: 'listWallets',
   758  			getter: 'personal_listWallets'
   759  		}),
   760  	]
   761  })
   762  `
   763  
   764  const RPC_JS = `
   765  web3._extend({
   766  	property: 'rpc',
   767  	methods: [],
   768  	properties: [
   769  		new web3._extend.Property({
   770  			name: 'modules',
   771  			getter: 'rpc_modules'
   772  		}),
   773  	]
   774  });
   775  `
   776  
   777  const Shh_JS = `
   778  web3._extend({
   779  	property: 'shh',
   780  	methods: [
   781  	],
   782  	properties:
   783  	[
   784  		new web3._extend.Property({
   785  			name: 'version',
   786  			getter: 'shh_version',
   787  			outputFormatter: web3._extend.utils.toDecimal
   788  		}),
   789  		new web3._extend.Property({
   790  			name: 'info',
   791  			getter: 'shh_info'
   792  		}),
   793  	]
   794  });
   795  `
   796  
   797  const SWARMFS_JS = `
   798  web3._extend({
   799  	property: 'swarmfs',
   800  	methods:
   801  	[
   802  		new web3._extend.Method({
   803  			name: 'mount',
   804  			call: 'swarmfs_mount',
   805  			params: 2
   806  		}),
   807  		new web3._extend.Method({
   808  			name: 'unmount',
   809  			call: 'swarmfs_unmount',
   810  			params: 1
   811  		}),
   812  		new web3._extend.Method({
   813  			name: 'listmounts',
   814  			call: 'swarmfs_listmounts',
   815  			params: 0
   816  		}),
   817  	]
   818  });
   819  `
   820  
   821  const TxPool_JS = `
   822  web3._extend({
   823  	property: 'txpool',
   824  	methods: [],
   825  	properties:
   826  	[
   827  		new web3._extend.Property({
   828  			name: 'content',
   829  			getter: 'txpool_content'
   830  		}),
   831  		new web3._extend.Property({
   832  			name: 'inspect',
   833  			getter: 'txpool_inspect'
   834  		}),
   835  		new web3._extend.Property({
   836  			name: 'status',
   837  			getter: 'txpool_status',
   838  			outputFormatter: function(status) {
   839  				status.pending = web3._extend.utils.toDecimal(status.pending);
   840  				status.queued = web3._extend.utils.toDecimal(status.queued);
   841  				return status;
   842  			}
   843  		}),
   844  	]
   845  });
   846  `
   847  
   848  const Istanbul_JS = `
   849  web3._extend({
   850  	property: 'istanbul',
   851  	methods:
   852  	[
   853  		new web3._extend.Method({
   854  			name: 'getSnapshot',
   855  			call: 'istanbul_getSnapshot',
   856  			params: 1,
   857  			inputFormatter: [null]
   858  		}),
   859  		new web3._extend.Method({
   860  			name: 'getSnapshotAtHash',
   861  			call: 'istanbul_getSnapshotAtHash',
   862  			params: 1
   863  		}),
   864  		new web3._extend.Method({
   865  			name: 'getValidators',
   866  			call: 'istanbul_getValidators',
   867  			params: 1,
   868  			inputFormatter: [null]
   869  		}),
   870  		new web3._extend.Method({
   871  			name: 'getValidatorsAtHash',
   872  			call: 'istanbul_getValidatorsAtHash',
   873  			params: 1
   874  		}),
   875  		new web3._extend.Method({
   876  			name: 'propose',
   877  			call: 'istanbul_propose',
   878  			params: 2
   879  		}),
   880  		new web3._extend.Method({
   881  			name: 'discard',
   882  			call: 'istanbul_discard',
   883  			params: 1
   884  		})
   885  	],
   886  	properties:
   887  	[
   888  		new web3._extend.Property({
   889  			name: 'candidates',
   890  			getter: 'istanbul_candidates'
   891  		}),
   892  	]
   893  });
   894  `