web3ext.go 19.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

17 18
// package web3ext contains geth specific web3.js extensions.
package web3ext
19

20
var Modules = map[string]string{
21 22 23 24 25 26 27 28 29 30 31 32 33 34
	"accounting": AccountingJs,
	"admin":      AdminJs,
	"chequebook": ChequebookJs,
	"clique":     CliqueJs,
	"ethash":     EthashJs,
	"debug":      DebugJs,
	"eth":        EthJs,
	"miner":      MinerJs,
	"net":        NetJs,
	"personal":   PersonalJs,
	"rpc":        RpcJs,
	"shh":        ShhJs,
	"swarmfs":    SwarmfsJs,
	"txpool":     TxpoolJs,
35
	"les":        LESJs,
36
	"vflux":      VfluxJs,
37
}
38

39
const ChequebookJs = `
40
web3._extend({
41 42 43 44 45 46 47 48 49
	property: 'chequebook',
	methods: [
		new web3._extend.Method({
			name: 'deposit',
			call: 'chequebook_deposit',
			params: 1,
			inputFormatter: [null]
		}),
		new web3._extend.Property({
50 51
			name: 'balance',
			getter: 'chequebook_balance',
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
			outputFormatter: web3._extend.utils.toDecimal
		}),
		new web3._extend.Method({
			name: 'cash',
			call: 'chequebook_cash',
			params: 1,
			inputFormatter: [null]
		}),
		new web3._extend.Method({
			name: 'issue',
			call: 'chequebook_issue',
			params: 2,
			inputFormatter: [null, null]
		}),
	]
67 68 69
});
`

70
const CliqueJs = `
71
web3._extend({
72 73
	property: 'clique',
	methods: [
74 75 76 77
		new web3._extend.Method({
			name: 'getSnapshot',
			call: 'clique_getSnapshot',
			params: 1,
78
			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
79
		}),
80 81 82 83 84
		new web3._extend.Method({
			name: 'getSnapshotAtHash',
			call: 'clique_getSnapshotAtHash',
			params: 1
		}),
85 86 87 88
		new web3._extend.Method({
			name: 'getSigners',
			call: 'clique_getSigners',
			params: 1,
89
			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
90
		}),
91 92 93 94 95
		new web3._extend.Method({
			name: 'getSignersAtHash',
			call: 'clique_getSignersAtHash',
			params: 1
		}),
96 97 98 99 100 101 102 103 104
		new web3._extend.Method({
			name: 'propose',
			call: 'clique_propose',
			params: 2
		}),
		new web3._extend.Method({
			name: 'discard',
			call: 'clique_discard',
			params: 1
105
		}),
106 107 108 109 110
		new web3._extend.Method({
			name: 'status',
			call: 'clique_status',
			params: 0
		}),
111 112
	],
	properties: [
113 114 115 116 117 118 119 120
		new web3._extend.Property({
			name: 'proposals',
			getter: 'clique_proposals'
		}),
	]
});
`

121
const EthashJs = `
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
web3._extend({
	property: 'ethash',
	methods: [
		new web3._extend.Method({
			name: 'getWork',
			call: 'ethash_getWork',
			params: 0
		}),
		new web3._extend.Method({
			name: 'getHashrate',
			call: 'ethash_getHashrate',
			params: 0
		}),
		new web3._extend.Method({
			name: 'submitWork',
			call: 'ethash_submitWork',
			params: 3,
		}),
		new web3._extend.Method({
141 142
			name: 'submitHashrate',
			call: 'ethash_submitHashrate',
143 144 145 146 147 148
			params: 2,
		}),
	]
});
`

149
const AdminJs = `
150 151
web3._extend({
	property: 'admin',
152
	methods: [
153 154 155 156 157
		new web3._extend.Method({
			name: 'addPeer',
			call: 'admin_addPeer',
			params: 1
		}),
158 159 160 161 162
		new web3._extend.Method({
			name: 'removePeer',
			call: 'admin_removePeer',
			params: 1
		}),
163 164 165 166 167 168 169 170 171 172
		new web3._extend.Method({
			name: 'addTrustedPeer',
			call: 'admin_addTrustedPeer',
			params: 1
		}),
		new web3._extend.Method({
			name: 'removeTrustedPeer',
			call: 'admin_removeTrustedPeer',
			params: 1
		}),
173 174 175
		new web3._extend.Method({
			name: 'exportChain',
			call: 'admin_exportChain',
176 177
			params: 3,
			inputFormatter: [null, null, null]
178 179 180 181 182 183 184 185 186 187 188
		}),
		new web3._extend.Method({
			name: 'importChain',
			call: 'admin_importChain',
			params: 1
		}),
		new web3._extend.Method({
			name: 'sleepBlocks',
			call: 'admin_sleepBlocks',
			params: 2
		}),
189 190 191 192 193 194 195 196 197 198 199
		new web3._extend.Method({
			name: 'startHTTP',
			call: 'admin_startHTTP',
			params: 5,
			inputFormatter: [null, null, null, null, null]
		}),
		new web3._extend.Method({
			name: 'stopHTTP',
			call: 'admin_stopHTTP'
		}),
		// This method is deprecated.
200 201 202
		new web3._extend.Method({
			name: 'startRPC',
			call: 'admin_startRPC',
203 204
			params: 5,
			inputFormatter: [null, null, null, null, null]
205
		}),
206
		// This method is deprecated.
207 208
		new web3._extend.Method({
			name: 'stopRPC',
209
			call: 'admin_stopRPC'
210 211 212 213
		}),
		new web3._extend.Method({
			name: 'startWS',
			call: 'admin_startWS',
214 215
			params: 4,
			inputFormatter: [null, null, null, null]
216 217 218
		}),
		new web3._extend.Method({
			name: 'stopWS',
219
			call: 'admin_stopWS'
220
		}),
221
	],
222
	properties: [
223 224 225 226 227 228 229 230 231 232 233
		new web3._extend.Property({
			name: 'nodeInfo',
			getter: 'admin_nodeInfo'
		}),
		new web3._extend.Property({
			name: 'peers',
			getter: 'admin_peers'
		}),
		new web3._extend.Property({
			name: 'datadir',
			getter: 'admin_datadir'
234
		}),
235 236 237 238
	]
});
`

239
const DebugJs = `
240 241
web3._extend({
	property: 'debug',
242
	methods: [
243 244 245
		new web3._extend.Method({
			name: 'accountRange',
			call: 'debug_accountRange',
246 247
			params: 6,
			inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter, null, null, null, null, null],
248
		}),
249 250 251
		new web3._extend.Method({
			name: 'printBlock',
			call: 'debug_printBlock',
252 253
			params: 1,
			outputFormatter: console.log
254 255 256 257 258 259
		}),
		new web3._extend.Method({
			name: 'getBlockRlp',
			call: 'debug_getBlockRlp',
			params: 1
		}),
260 261 262
		new web3._extend.Method({
			name: 'testSignCliqueBlock',
			call: 'debug_testSignCliqueBlock',
263
			params: 2,
264
			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null],
265
		}),
266 267 268 269 270 271 272 273 274 275 276 277 278
		new web3._extend.Method({
			name: 'setHead',
			call: 'debug_setHead',
			params: 1
		}),
		new web3._extend.Method({
			name: 'seedHash',
			call: 'debug_seedHash',
			params: 1
		}),
		new web3._extend.Method({
			name: 'dumpBlock',
			call: 'debug_dumpBlock',
279 280
			params: 1,
			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
281
		}),
282 283 284 285 286 287
		new web3._extend.Method({
			name: 'chaindbProperty',
			call: 'debug_chaindbProperty',
			params: 1,
			outputFormatter: console.log
		}),
288 289 290 291
		new web3._extend.Method({
			name: 'chaindbCompact',
			call: 'debug_chaindbCompact',
		}),
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312
		new web3._extend.Method({
			name: 'verbosity',
			call: 'debug_verbosity',
			params: 1
		}),
		new web3._extend.Method({
			name: 'vmodule',
			call: 'debug_vmodule',
			params: 1
		}),
		new web3._extend.Method({
			name: 'backtraceAt',
			call: 'debug_backtraceAt',
			params: 1,
		}),
		new web3._extend.Method({
			name: 'stacks',
			call: 'debug_stacks',
			params: 0,
			outputFormatter: console.log
		}),
313 314 315 316 317
		new web3._extend.Method({
			name: 'freeOSMemory',
			call: 'debug_freeOSMemory',
			params: 0,
		}),
318 319 320 321 322
		new web3._extend.Method({
			name: 'setGCPercent',
			call: 'debug_setGCPercent',
			params: 1,
		}),
323 324 325 326 327 328 329 330 331 332
		new web3._extend.Method({
			name: 'memStats',
			call: 'debug_memStats',
			params: 0,
		}),
		new web3._extend.Method({
			name: 'gcStats',
			call: 'debug_gcStats',
			params: 0,
		}),
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
		new web3._extend.Method({
			name: 'cpuProfile',
			call: 'debug_cpuProfile',
			params: 2
		}),
		new web3._extend.Method({
			name: 'startCPUProfile',
			call: 'debug_startCPUProfile',
			params: 1
		}),
		new web3._extend.Method({
			name: 'stopCPUProfile',
			call: 'debug_stopCPUProfile',
			params: 0
		}),
		new web3._extend.Method({
349 350
			name: 'goTrace',
			call: 'debug_goTrace',
351 352 353
			params: 2
		}),
		new web3._extend.Method({
354 355
			name: 'startGoTrace',
			call: 'debug_startGoTrace',
356 357 358
			params: 1
		}),
		new web3._extend.Method({
359 360
			name: 'stopGoTrace',
			call: 'debug_stopGoTrace',
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
			params: 0
		}),
		new web3._extend.Method({
			name: 'blockProfile',
			call: 'debug_blockProfile',
			params: 2
		}),
		new web3._extend.Method({
			name: 'setBlockProfileRate',
			call: 'debug_setBlockProfileRate',
			params: 1
		}),
		new web3._extend.Method({
			name: 'writeBlockProfile',
			call: 'debug_writeBlockProfile',
			params: 1
		}),
378 379 380 381 382 383
		new web3._extend.Method({
			name: 'mutexProfile',
			call: 'debug_mutexProfile',
			params: 2
		}),
		new web3._extend.Method({
384 385
			name: 'setMutexProfileFraction',
			call: 'debug_setMutexProfileFraction',
386 387 388 389 390 391 392
			params: 1
		}),
		new web3._extend.Method({
			name: 'writeMutexProfile',
			call: 'debug_writeMutexProfile',
			params: 1
		}),
393 394 395 396 397
		new web3._extend.Method({
			name: 'writeMemProfile',
			call: 'debug_writeMemProfile',
			params: 1
		}),
398 399 400 401 402 403 404 405 406 407 408 409
		new web3._extend.Method({
			name: 'traceBlock',
			call: 'debug_traceBlock',
			params: 2,
			inputFormatter: [null, null]
		}),
		new web3._extend.Method({
			name: 'traceBlockFromFile',
			call: 'debug_traceBlockFromFile',
			params: 2,
			inputFormatter: [null, null]
		}),
410 411 412 413 414 415
		new web3._extend.Method({
			name: 'traceBadBlock',
			call: 'debug_traceBadBlock',
			params: 1,
			inputFormatter: [null]
		}),
416 417 418 419
		new web3._extend.Method({
			name: 'standardTraceBadBlockToFile',
			call: 'debug_standardTraceBadBlockToFile',
			params: 2,
420
			inputFormatter: [null, null]
421 422 423 424 425
		}),
		new web3._extend.Method({
			name: 'standardTraceBlockToFile',
			call: 'debug_standardTraceBlockToFile',
			params: 2,
426
			inputFormatter: [null, null]
427
		}),
428 429 430 431
		new web3._extend.Method({
			name: 'traceBlockByNumber',
			call: 'debug_traceBlockByNumber',
			params: 2,
432
			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, null]
433 434 435 436 437 438 439
		}),
		new web3._extend.Method({
			name: 'traceBlockByHash',
			call: 'debug_traceBlockByHash',
			params: 2,
			inputFormatter: [null, null]
		}),
440
		new web3._extend.Method({
441 442
			name: 'traceTransaction',
			call: 'debug_traceTransaction',
443 444
			params: 2,
			inputFormatter: [null, null]
445
		}),
446 447 448 449 450 451
		new web3._extend.Method({
			name: 'traceCall',
			call: 'debug_traceCall',
			params: 3,
			inputFormatter: [null, null, null]
		}),
452 453 454 455 456
		new web3._extend.Method({
			name: 'preimage',
			call: 'debug_preimage',
			params: 1,
			inputFormatter: [null]
457 458 459 460 461 462
		}),
		new web3._extend.Method({
			name: 'getBadBlocks',
			call: 'debug_getBadBlocks',
			params: 0,
		}),
463 464 465 466 467
		new web3._extend.Method({
			name: 'storageRangeAt',
			call: 'debug_storageRangeAt',
			params: 5,
		}),
468 469 470 471 472 473 474 475 476 477 478 479
		new web3._extend.Method({
			name: 'getModifiedAccountsByNumber',
			call: 'debug_getModifiedAccountsByNumber',
			params: 2,
			inputFormatter: [null, null],
		}),
		new web3._extend.Method({
			name: 'getModifiedAccountsByHash',
			call: 'debug_getModifiedAccountsByHash',
			params: 2,
			inputFormatter:[null, null],
		}),
480 481 482 483 484
		new web3._extend.Method({
			name: 'freezeClient',
			call: 'debug_freezeClient',
			params: 1,
		}),
485
	],
486
	properties: []
487 488 489
});
`

490
const EthJs = `
491 492
web3._extend({
	property: 'eth',
493
	methods: [
494 495 496 497 498
		new web3._extend.Method({
			name: 'chainId',
			call: 'eth_chainId',
			params: 0
		}),
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
		new web3._extend.Method({
			name: 'sign',
			call: 'eth_sign',
			params: 2,
			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null]
		}),
		new web3._extend.Method({
			name: 'resend',
			call: 'eth_resend',
			params: 3,
			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal]
		}),
		new web3._extend.Method({
			name: 'signTransaction',
			call: 'eth_signTransaction',
			params: 1,
			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
		}),
517 518 519 520 521 522 523
		new web3._extend.Method({
			name: 'estimateGas',
			call: 'eth_estimateGas',
			params: 2,
			inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
			outputFormatter: web3._extend.utils.toDecimal
		}),
524 525 526 527 528
		new web3._extend.Method({
			name: 'submitTransaction',
			call: 'eth_submitTransaction',
			params: 1,
			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
529
		}),
530 531 532 533 534 535
		new web3._extend.Method({
			name: 'fillTransaction',
			call: 'eth_fillTransaction',
			params: 1,
			inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
		}),
536 537 538
		new web3._extend.Method({
			name: 'getHeaderByNumber',
			call: 'eth_getHeaderByNumber',
539 540
			params: 1,
			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter]
541 542 543 544 545 546 547 548 549
		}),
		new web3._extend.Method({
			name: 'getHeaderByHash',
			call: 'eth_getHeaderByHash',
			params: 1
		}),
		new web3._extend.Method({
			name: 'getBlockByNumber',
			call: 'eth_getBlockByNumber',
550 551
			params: 2,
			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, function (val) { return !!val; }]
552 553 554 555
		}),
		new web3._extend.Method({
			name: 'getBlockByHash',
			call: 'eth_getBlockByHash',
556 557
			params: 2,
			inputFormatter: [null, function (val) { return !!val; }]
558
		}),
559 560 561 562 563 564 565 566 567 568 569 570
		new web3._extend.Method({
			name: 'getRawTransaction',
			call: 'eth_getRawTransactionByHash',
			params: 1
		}),
		new web3._extend.Method({
			name: 'getRawTransactionFromBlock',
			call: function(args) {
				return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex';
			},
			params: 2,
			inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex]
571
		}),
572 573 574 575 576 577
		new web3._extend.Method({
			name: 'getProof',
			call: 'eth_getProof',
			params: 3,
			inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter]
		}),
578 579 580 581 582 583
		new web3._extend.Method({
			name: 'createAccessList',
			call: 'eth_createAccessList',
			params: 2,
			inputFormatter: [null, web3._extend.formatters.inputBlockNumberFormatter],
		}),
584
	],
585
	properties: [
586 587 588 589 590 591 592 593 594 595 596
		new web3._extend.Property({
			name: 'pendingTransactions',
			getter: 'eth_pendingTransactions',
			outputFormatter: function(txs) {
				var formatted = [];
				for (var i = 0; i < txs.length; i++) {
					formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i]));
					formatted[i].blockHash = null;
				}
				return formatted;
			}
597
		}),
598 599 600 601 602
		new web3._extend.Property({
			name: 'maxPriorityFeePerGas',
			getter: 'eth_maxPriorityFeePerGas',
			outputFormatter: web3._extend.utils.toBigNumber
		}),
603 604 605 606
	]
});
`

607
const MinerJs = `
608 609
web3._extend({
	property: 'miner',
610
	methods: [
611 612 613
		new web3._extend.Method({
			name: 'start',
			call: 'miner_start',
614 615
			params: 1,
			inputFormatter: [null]
616 617 618
		}),
		new web3._extend.Method({
			name: 'stop',
619
			call: 'miner_stop'
620 621 622 623 624
		}),
		new web3._extend.Method({
			name: 'setEtherbase',
			call: 'miner_setEtherbase',
			params: 1,
625
			inputFormatter: [web3._extend.formatters.inputAddressFormatter]
626 627 628 629 630 631 632 633 634 635
		}),
		new web3._extend.Method({
			name: 'setExtra',
			call: 'miner_setExtra',
			params: 1
		}),
		new web3._extend.Method({
			name: 'setGasPrice',
			call: 'miner_setGasPrice',
			params: 1,
636
			inputFormatter: [web3._extend.utils.fromDecimal]
637
		}),
638 639 640 641 642
		new web3._extend.Method({
			name: 'setRecommitInterval',
			call: 'miner_setRecommitInterval',
			params: 1,
		}),
643
		new web3._extend.Method({
644 645
			name: 'getHashrate',
			call: 'miner_getHashrate'
646
		}),
647
	],
648
	properties: []
649 650 651
});
`

652
const NetJs = `
653 654 655
web3._extend({
	property: 'net',
	methods: [],
656
	properties: [
657 658 659
		new web3._extend.Property({
			name: 'version',
			getter: 'net_version'
660
		}),
661 662 663 664
	]
});
`

665
const PersonalJs = `
666 667
web3._extend({
	property: 'personal',
668
	methods: [
669 670 671 672
		new web3._extend.Method({
			name: 'importRawKey',
			call: 'personal_importRawKey',
			params: 2
673
		}),
674 675 676 677 678 679 680 681 682 683
		new web3._extend.Method({
			name: 'sign',
			call: 'personal_sign',
			params: 3,
			inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null]
		}),
		new web3._extend.Method({
			name: 'ecRecover',
			call: 'personal_ecRecover',
			params: 2
684
		}),
685 686 687 688 689
		new web3._extend.Method({
			name: 'openWallet',
			call: 'personal_openWallet',
			params: 2
		}),
690 691 692 693
		new web3._extend.Method({
			name: 'deriveAccount',
			call: 'personal_deriveAccount',
			params: 3
694
		}),
695 696 697 698 699 700
		new web3._extend.Method({
			name: 'signTransaction',
			call: 'personal_signTransaction',
			params: 2,
			inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null]
		}),
701 702 703 704 705 706 707 708 709 710
		new web3._extend.Method({
			name: 'unpair',
			call: 'personal_unpair',
			params: 2
		}),
		new web3._extend.Method({
			name: 'initializeWallet',
			call: 'personal_initializeWallet',
			params: 1
		})
711
	],
712
	properties: [
713 714 715
		new web3._extend.Property({
			name: 'listWallets',
			getter: 'personal_listWallets'
716
		}),
717
	]
718
})
719 720
`

721
const RpcJs = `
722 723 724
web3._extend({
	property: 'rpc',
	methods: [],
725
	properties: [
726 727 728
		new web3._extend.Property({
			name: 'modules',
			getter: 'rpc_modules'
729
		}),
730 731 732 733
	]
});
`

734
const ShhJs = `
735 736
web3._extend({
	property: 'shh',
737 738
	methods: [
	],
739 740 741 742
	properties:
	[
		new web3._extend.Property({
			name: 'version',
743 744
			getter: 'shh_version',
			outputFormatter: web3._extend.utils.toDecimal
745 746 747 748 749
		}),
		new web3._extend.Property({
			name: 'info',
			getter: 'shh_info'
		}),
750 751 752
	]
});
`
753

754
const SwarmfsJs = `
755
web3._extend({
756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772
	property: 'swarmfs',
	methods:
	[
		new web3._extend.Method({
			name: 'mount',
			call: 'swarmfs_mount',
			params: 2
		}),
		new web3._extend.Method({
			name: 'unmount',
			call: 'swarmfs_unmount',
			params: 1
		}),
		new web3._extend.Method({
			name: 'listmounts',
			call: 'swarmfs_listmounts',
			params: 0
773
		}),
774
	]
775 776
});
`
777

778
const TxpoolJs = `
779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799
web3._extend({
	property: 'txpool',
	methods: [],
	properties:
	[
		new web3._extend.Property({
			name: 'content',
			getter: 'txpool_content'
		}),
		new web3._extend.Property({
			name: 'inspect',
			getter: 'txpool_inspect'
		}),
		new web3._extend.Property({
			name: 'status',
			getter: 'txpool_status',
			outputFormatter: function(status) {
				status.pending = web3._extend.utils.toDecimal(status.pending);
				status.queued = web3._extend.utils.toDecimal(status.queued);
				return status;
			}
800
		}),
801 802 803
	]
});
`
804

805
const AccountingJs = `
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847
web3._extend({
	property: 'accounting',
	methods: [
		new web3._extend.Property({
			name: 'balance',
			getter: 'account_balance'
		}),
		new web3._extend.Property({
			name: 'balanceCredit',
			getter: 'account_balanceCredit'
		}),
		new web3._extend.Property({
			name: 'balanceDebit',
			getter: 'account_balanceDebit'
		}),
		new web3._extend.Property({
			name: 'bytesCredit',
			getter: 'account_bytesCredit'
		}),
		new web3._extend.Property({
			name: 'bytesDebit',
			getter: 'account_bytesDebit'
		}),
		new web3._extend.Property({
			name: 'msgCredit',
			getter: 'account_msgCredit'
		}),
		new web3._extend.Property({
			name: 'msgDebit',
			getter: 'account_msgDebit'
		}),
		new web3._extend.Property({
			name: 'peerDrops',
			getter: 'account_peerDrops'
		}),
		new web3._extend.Property({
			name: 'selfDrops',
			getter: 'account_selfDrops'
		}),
	]
});
`
848 849 850 851

const LESJs = `
web3._extend({
	property: 'les',
852
	methods:
853 854 855 856 857 858
	[
		new web3._extend.Method({
			name: 'getCheckpoint',
			call: 'les_getCheckpoint',
			params: 1
		}),
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879
		new web3._extend.Method({
			name: 'clientInfo',
			call: 'les_clientInfo',
			params: 1
		}),
		new web3._extend.Method({
			name: 'priorityClientInfo',
			call: 'les_priorityClientInfo',
			params: 3
		}),
		new web3._extend.Method({
			name: 'setClientParams',
			call: 'les_setClientParams',
			params: 2
		}),
		new web3._extend.Method({
			name: 'setDefaultParams',
			call: 'les_setDefaultParams',
			params: 1
		}),
		new web3._extend.Method({
880 881
			name: 'addBalance',
			call: 'les_addBalance',
882
			params: 2
883
		}),
884
	],
885
	properties:
886 887 888 889 890 891 892 893 894
	[
		new web3._extend.Property({
			name: 'latestCheckpoint',
			getter: 'les_latestCheckpoint'
		}),
		new web3._extend.Property({
			name: 'checkpointContractAddress',
			getter: 'les_getCheckpointContractAddress'
		}),
895 896 897 898
		new web3._extend.Property({
			name: 'serverInfo',
			getter: 'les_serverInfo'
		}),
899 900 901
	]
});
`
902

903
const VfluxJs = `
904
web3._extend({
905
	property: 'vflux',
906 907 908 909
	methods:
	[
		new web3._extend.Method({
			name: 'distribution',
910
			call: 'vflux_distribution',
911 912 913 914
			params: 2
		}),
		new web3._extend.Method({
			name: 'timeout',
915
			call: 'vflux_timeout',
916 917 918 919
			params: 2
		}),
		new web3._extend.Method({
			name: 'value',
920
			call: 'vflux_value',
921 922 923 924 925 926 927
			params: 2
		}),
	],
	properties:
	[
		new web3._extend.Property({
			name: 'requestStats',
928
			getter: 'vflux_requestStats'
929 930 931 932
		}),
	]
});
`