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