github.com/RobustRoundRobin/quorum@v20.10.0+incompatible/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 "raft": Raft_JS, 37 "istanbul": Istanbul_JS, 38 "quorumPermission": QUORUM_NODE_JS, 39 "quorumExtension": Extension_JS, 40 "plugin_account": Account_Plugin_Js, 41 } 42 43 const ChequebookJs = ` 44 web3._extend({ 45 property: 'chequebook', 46 methods: [ 47 new web3._extend.Method({ 48 name: 'deposit', 49 call: 'chequebook_deposit', 50 params: 1, 51 inputFormatter: [null] 52 }), 53 new web3._extend.Property({ 54 name: 'balance', 55 getter: 'chequebook_balance', 56 outputFormatter: web3._extend.utils.toDecimal 57 }), 58 new web3._extend.Method({ 59 name: 'cash', 60 call: 'chequebook_cash', 61 params: 1, 62 inputFormatter: [null] 63 }), 64 new web3._extend.Method({ 65 name: 'issue', 66 call: 'chequebook_issue', 67 params: 2, 68 inputFormatter: [null, null] 69 }), 70 ] 71 }); 72 ` 73 74 const CliqueJs = ` 75 web3._extend({ 76 property: 'clique', 77 methods: [ 78 new web3._extend.Method({ 79 name: 'getSnapshot', 80 call: 'clique_getSnapshot', 81 params: 1, 82 inputFormatter: [null] 83 }), 84 new web3._extend.Method({ 85 name: 'getSnapshotAtHash', 86 call: 'clique_getSnapshotAtHash', 87 params: 1 88 }), 89 new web3._extend.Method({ 90 name: 'getSigners', 91 call: 'clique_getSigners', 92 params: 1, 93 inputFormatter: [null] 94 }), 95 new web3._extend.Method({ 96 name: 'getSignersAtHash', 97 call: 'clique_getSignersAtHash', 98 params: 1 99 }), 100 new web3._extend.Method({ 101 name: 'propose', 102 call: 'clique_propose', 103 params: 2 104 }), 105 new web3._extend.Method({ 106 name: 'discard', 107 call: 'clique_discard', 108 params: 1 109 }), 110 ], 111 properties: [ 112 new web3._extend.Property({ 113 name: 'proposals', 114 getter: 'clique_proposals' 115 }), 116 ] 117 }); 118 ` 119 120 const EthashJs = ` 121 web3._extend({ 122 property: 'ethash', 123 methods: [ 124 new web3._extend.Method({ 125 name: 'getWork', 126 call: 'ethash_getWork', 127 params: 0 128 }), 129 new web3._extend.Method({ 130 name: 'getHashrate', 131 call: 'ethash_getHashrate', 132 params: 0 133 }), 134 new web3._extend.Method({ 135 name: 'submitWork', 136 call: 'ethash_submitWork', 137 params: 3, 138 }), 139 new web3._extend.Method({ 140 name: 'submitHashRate', 141 call: 'ethash_submitHashRate', 142 params: 2, 143 }), 144 ] 145 }); 146 ` 147 148 const AdminJs = ` 149 web3._extend({ 150 property: 'admin', 151 methods: [ 152 new web3._extend.Method({ 153 name: 'reloadPlugin', 154 call: 'admin_reloadPlugin', 155 params: 1 156 }), 157 new web3._extend.Method({ 158 name: 'addPeer', 159 call: 'admin_addPeer', 160 params: 1 161 }), 162 new web3._extend.Method({ 163 name: 'removePeer', 164 call: 'admin_removePeer', 165 params: 1 166 }), 167 new web3._extend.Method({ 168 name: 'addTrustedPeer', 169 call: 'admin_addTrustedPeer', 170 params: 1 171 }), 172 new web3._extend.Method({ 173 name: 'removeTrustedPeer', 174 call: 'admin_removeTrustedPeer', 175 params: 1 176 }), 177 new web3._extend.Method({ 178 name: 'exportChain', 179 call: 'admin_exportChain', 180 params: 1, 181 inputFormatter: [null] 182 }), 183 new web3._extend.Method({ 184 name: 'importChain', 185 call: 'admin_importChain', 186 params: 1 187 }), 188 new web3._extend.Method({ 189 name: 'sleepBlocks', 190 call: 'admin_sleepBlocks', 191 params: 2 192 }), 193 new web3._extend.Method({ 194 name: 'startRPC', 195 call: 'admin_startRPC', 196 params: 4, 197 inputFormatter: [null, null, null, null] 198 }), 199 new web3._extend.Method({ 200 name: 'stopRPC', 201 call: 'admin_stopRPC' 202 }), 203 new web3._extend.Method({ 204 name: 'startWS', 205 call: 'admin_startWS', 206 params: 4, 207 inputFormatter: [null, null, null, null] 208 }), 209 new web3._extend.Method({ 210 name: 'stopWS', 211 call: 'admin_stopWS' 212 }), 213 ], 214 properties: [ 215 new web3._extend.Property({ 216 name: 'nodeInfo', 217 getter: 'admin_nodeInfo' 218 }), 219 new web3._extend.Property({ 220 name: 'peers', 221 getter: 'admin_peers' 222 }), 223 new web3._extend.Property({ 224 name: 'datadir', 225 getter: 'admin_datadir' 226 }), 227 ] 228 }); 229 ` 230 231 const DebugJs = ` 232 web3._extend({ 233 property: 'debug', 234 methods: [ 235 new web3._extend.Method({ 236 name: 'accountRange', 237 call: 'debug_accountRange', 238 params: 2 239 }), 240 new web3._extend.Method({ 241 name: 'printBlock', 242 call: 'debug_printBlock', 243 params: 1 244 }), 245 new web3._extend.Method({ 246 name: 'getBlockRlp', 247 call: 'debug_getBlockRlp', 248 params: 1 249 }), 250 new web3._extend.Method({ 251 name: 'testSignCliqueBlock', 252 call: 'debug_testSignCliqueBlock', 253 params: 2, 254 inputFormatters: [web3._extend.formatters.inputAddressFormatter, null], 255 }), 256 new web3._extend.Method({ 257 name: 'setHead', 258 call: 'debug_setHead', 259 params: 1 260 }), 261 new web3._extend.Method({ 262 name: 'seedHash', 263 call: 'debug_seedHash', 264 params: 1 265 }), 266 new web3._extend.Method({ 267 name: 'dumpBlock', 268 call: 'debug_dumpBlock', 269 params: 2, 270 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, ""] 271 }), 272 new web3._extend.Method({ 273 name: 'dumpAddress', 274 call: 'debug_dumpAddress', 275 params: 2, 276 inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputBlockNumberFormatter] 277 }), 278 new web3._extend.Method({ 279 name: 'chaindbProperty', 280 call: 'debug_chaindbProperty', 281 params: 1, 282 outputFormatter: console.log 283 }), 284 new web3._extend.Method({ 285 name: 'chaindbCompact', 286 call: 'debug_chaindbCompact', 287 }), 288 new web3._extend.Method({ 289 name: 'verbosity', 290 call: 'debug_verbosity', 291 params: 1 292 }), 293 new web3._extend.Method({ 294 name: 'vmodule', 295 call: 'debug_vmodule', 296 params: 1 297 }), 298 new web3._extend.Method({ 299 name: 'backtraceAt', 300 call: 'debug_backtraceAt', 301 params: 1, 302 }), 303 new web3._extend.Method({ 304 name: 'stacks', 305 call: 'debug_stacks', 306 params: 0, 307 outputFormatter: console.log 308 }), 309 new web3._extend.Method({ 310 name: 'freeOSMemory', 311 call: 'debug_freeOSMemory', 312 params: 0, 313 }), 314 new web3._extend.Method({ 315 name: 'setGCPercent', 316 call: 'debug_setGCPercent', 317 params: 1, 318 }), 319 new web3._extend.Method({ 320 name: 'memStats', 321 call: 'debug_memStats', 322 params: 0, 323 }), 324 new web3._extend.Method({ 325 name: 'gcStats', 326 call: 'debug_gcStats', 327 params: 0, 328 }), 329 new web3._extend.Method({ 330 name: 'cpuProfile', 331 call: 'debug_cpuProfile', 332 params: 2 333 }), 334 new web3._extend.Method({ 335 name: 'startCPUProfile', 336 call: 'debug_startCPUProfile', 337 params: 1 338 }), 339 new web3._extend.Method({ 340 name: 'stopCPUProfile', 341 call: 'debug_stopCPUProfile', 342 params: 0 343 }), 344 new web3._extend.Method({ 345 name: 'goTrace', 346 call: 'debug_goTrace', 347 params: 2 348 }), 349 new web3._extend.Method({ 350 name: 'startGoTrace', 351 call: 'debug_startGoTrace', 352 params: 1 353 }), 354 new web3._extend.Method({ 355 name: 'stopGoTrace', 356 call: 'debug_stopGoTrace', 357 params: 0 358 }), 359 new web3._extend.Method({ 360 name: 'blockProfile', 361 call: 'debug_blockProfile', 362 params: 2 363 }), 364 new web3._extend.Method({ 365 name: 'setBlockProfileRate', 366 call: 'debug_setBlockProfileRate', 367 params: 1 368 }), 369 new web3._extend.Method({ 370 name: 'writeBlockProfile', 371 call: 'debug_writeBlockProfile', 372 params: 1 373 }), 374 new web3._extend.Method({ 375 name: 'mutexProfile', 376 call: 'debug_mutexProfile', 377 params: 2 378 }), 379 new web3._extend.Method({ 380 name: 'setMutexProfileFraction', 381 call: 'debug_setMutexProfileFraction', 382 params: 1 383 }), 384 new web3._extend.Method({ 385 name: 'writeMutexProfile', 386 call: 'debug_writeMutexProfile', 387 params: 1 388 }), 389 new web3._extend.Method({ 390 name: 'writeMemProfile', 391 call: 'debug_writeMemProfile', 392 params: 1 393 }), 394 new web3._extend.Method({ 395 name: 'traceBlock', 396 call: 'debug_traceBlock', 397 params: 2, 398 inputFormatter: [null, null] 399 }), 400 new web3._extend.Method({ 401 name: 'traceBlockFromFile', 402 call: 'debug_traceBlockFromFile', 403 params: 2, 404 inputFormatter: [null, null] 405 }), 406 new web3._extend.Method({ 407 name: 'traceBadBlock', 408 call: 'debug_traceBadBlock', 409 params: 1, 410 inputFormatter: [null] 411 }), 412 new web3._extend.Method({ 413 name: 'standardTraceBadBlockToFile', 414 call: 'debug_standardTraceBadBlockToFile', 415 params: 2, 416 inputFormatter: [null, null] 417 }), 418 new web3._extend.Method({ 419 name: 'standardTraceBlockToFile', 420 call: 'debug_standardTraceBlockToFile', 421 params: 2, 422 inputFormatter: [null, null] 423 }), 424 new web3._extend.Method({ 425 name: 'traceBlockByNumber', 426 call: 'debug_traceBlockByNumber', 427 params: 2, 428 inputFormatter: [null, null] 429 }), 430 new web3._extend.Method({ 431 name: 'traceBlockByHash', 432 call: 'debug_traceBlockByHash', 433 params: 2, 434 inputFormatter: [null, null] 435 }), 436 new web3._extend.Method({ 437 name: 'traceTransaction', 438 call: 'debug_traceTransaction', 439 params: 2, 440 inputFormatter: [null, null] 441 }), 442 new web3._extend.Method({ 443 name: 'preimage', 444 call: 'debug_preimage', 445 params: 1, 446 inputFormatter: [null] 447 }), 448 new web3._extend.Method({ 449 name: 'getBadBlocks', 450 call: 'debug_getBadBlocks', 451 params: 0, 452 }), 453 new web3._extend.Method({ 454 name: 'storageRangeAt', 455 call: 'debug_storageRangeAt', 456 params: 5, 457 }), 458 new web3._extend.Method({ 459 name: 'getModifiedAccountsByNumber', 460 call: 'debug_getModifiedAccountsByNumber', 461 params: 2, 462 inputFormatter: [null, null], 463 }), 464 new web3._extend.Method({ 465 name: 'getModifiedAccountsByHash', 466 call: 'debug_getModifiedAccountsByHash', 467 params: 2, 468 inputFormatter:[null, null], 469 }), 470 ], 471 properties: [] 472 }); 473 ` 474 475 const EthJs = ` 476 web3._extend({ 477 property: 'eth', 478 methods: [ 479 new web3._extend.Method({ 480 name: 'sendRawPrivateTransaction', 481 call: 'eth_sendRawPrivateTransaction', 482 params: 2, 483 inputFormatter: [null, null] 484 }), 485 new web3._extend.Method({ 486 name: 'getContractPrivacyMetadata', 487 call: 'eth_getContractPrivacyMetadata', 488 params: 1 489 }), 490 new web3._extend.Method({ 491 name: 'chainId', 492 call: 'eth_chainId', 493 params: 0 494 }), 495 new web3._extend.Method({ 496 name: 'sign', 497 call: 'eth_sign', 498 params: 2, 499 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null] 500 }), 501 new web3._extend.Method({ 502 name: 'resend', 503 call: 'eth_resend', 504 params: 3, 505 inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal] 506 }), 507 new web3._extend.Method({ 508 name: 'signTransaction', 509 call: 'eth_signTransaction', 510 params: 1, 511 inputFormatter: [web3._extend.formatters.inputTransactionFormatter] 512 }), 513 new web3._extend.Method({ 514 name: 'submitTransaction', 515 call: 'eth_submitTransaction', 516 params: 1, 517 inputFormatter: [web3._extend.formatters.inputTransactionFormatter] 518 }), 519 new web3._extend.Method({ 520 name: 'fillTransaction', 521 call: 'eth_fillTransaction', 522 params: 1, 523 inputFormatter: [web3._extend.formatters.inputTransactionFormatter] 524 }), 525 new web3._extend.Method({ 526 name: 'getHeaderByNumber', 527 call: 'eth_getHeaderByNumber', 528 params: 1 529 }), 530 new web3._extend.Method({ 531 name: 'getHeaderByHash', 532 call: 'eth_getHeaderByHash', 533 params: 1 534 }), 535 new web3._extend.Method({ 536 name: 'getBlockByNumber', 537 call: 'eth_getBlockByNumber', 538 params: 2 539 }), 540 new web3._extend.Method({ 541 name: 'getBlockByHash', 542 call: 'eth_getBlockByHash', 543 params: 2 544 }), 545 new web3._extend.Method({ 546 name: 'getRawTransaction', 547 call: 'eth_getRawTransactionByHash', 548 params: 1 549 }), 550 new web3._extend.Method({ 551 name: 'getRawTransactionFromBlock', 552 call: function(args) { 553 return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getRawTransactionByBlockHashAndIndex' : 'eth_getRawTransactionByBlockNumberAndIndex'; 554 }, 555 params: 2, 556 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex] 557 }), 558 new web3._extend.Method({ 559 name: 'getProof', 560 call: 'eth_getProof', 561 params: 3, 562 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter] 563 }), 564 new web3._extend.Method({ 565 name: 'storageRoot', 566 call: 'eth_storageRoot', 567 params: 2, 568 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null] 569 }), 570 // QUORUM 571 new web3._extend.Method({ 572 name: 'sendTransactionAsync', 573 call: 'eth_sendTransactionAsync', 574 params: 1, 575 inputFormatter: [web3._extend.formatters.inputTransactionFormatter] 576 }), 577 new web3._extend.Method({ 578 name: 'getQuorumPayload', 579 call: 'eth_getQuorumPayload', 580 params: 1, 581 inputFormatter: [null] 582 }), 583 // END-QUORUM 584 ], 585 properties: [ 586 new web3._extend.Property({ 587 name: 'pendingTransactions', 588 getter: 'eth_pendingTransactions', 589 outputFormatter: function(txs) { 590 var formatted = []; 591 for (var i = 0; i < txs.length; i++) { 592 formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i])); 593 formatted[i].blockHash = null; 594 } 595 return formatted; 596 } 597 }), 598 ] 599 }); 600 ` 601 602 const MinerJs = ` 603 web3._extend({ 604 property: 'miner', 605 methods: [ 606 new web3._extend.Method({ 607 name: 'start', 608 call: 'miner_start', 609 params: 1, 610 inputFormatter: [null] 611 }), 612 new web3._extend.Method({ 613 name: 'stop', 614 call: 'miner_stop' 615 }), 616 new web3._extend.Method({ 617 name: 'setEtherbase', 618 call: 'miner_setEtherbase', 619 params: 1, 620 inputFormatter: [web3._extend.formatters.inputAddressFormatter] 621 }), 622 new web3._extend.Method({ 623 name: 'setExtra', 624 call: 'miner_setExtra', 625 params: 1 626 }), 627 new web3._extend.Method({ 628 name: 'setGasPrice', 629 call: 'miner_setGasPrice', 630 params: 1, 631 inputFormatter: [web3._extend.utils.fromDecimal] 632 }), 633 new web3._extend.Method({ 634 name: 'setRecommitInterval', 635 call: 'miner_setRecommitInterval', 636 params: 1, 637 }), 638 new web3._extend.Method({ 639 name: 'getHashrate', 640 call: 'miner_getHashrate' 641 }), 642 ], 643 properties: [] 644 }); 645 ` 646 647 const NetJs = ` 648 web3._extend({ 649 property: 'net', 650 methods: [], 651 properties: [ 652 new web3._extend.Property({ 653 name: 'version', 654 getter: 'net_version' 655 }), 656 ] 657 }); 658 ` 659 660 const PersonalJs = ` 661 web3._extend({ 662 property: 'personal', 663 methods: [ 664 new web3._extend.Method({ 665 name: 'importRawKey', 666 call: 'personal_importRawKey', 667 params: 2 668 }), 669 new web3._extend.Method({ 670 name: 'sign', 671 call: 'personal_sign', 672 params: 3, 673 inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null] 674 }), 675 new web3._extend.Method({ 676 name: 'ecRecover', 677 call: 'personal_ecRecover', 678 params: 2 679 }), 680 new web3._extend.Method({ 681 name: 'openWallet', 682 call: 'personal_openWallet', 683 params: 2 684 }), 685 new web3._extend.Method({ 686 name: 'deriveAccount', 687 call: 'personal_deriveAccount', 688 params: 3 689 }), 690 new web3._extend.Method({ 691 name: 'signTransaction', 692 call: 'personal_signTransaction', 693 params: 2, 694 inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null] 695 }), 696 new web3._extend.Method({ 697 name: 'unpair', 698 call: 'personal_unpair', 699 params: 2 700 }), 701 new web3._extend.Method({ 702 name: 'initializeWallet', 703 call: 'personal_initializeWallet', 704 params: 1 705 }) 706 ], 707 properties: [ 708 new web3._extend.Property({ 709 name: 'listWallets', 710 getter: 'personal_listWallets' 711 }), 712 ] 713 }) 714 ` 715 716 const RpcJs = ` 717 web3._extend({ 718 property: 'rpc', 719 methods: [], 720 properties: [ 721 new web3._extend.Property({ 722 name: 'modules', 723 getter: 'rpc_modules' 724 }), 725 ] 726 }); 727 ` 728 729 const ShhJs = ` 730 web3._extend({ 731 property: 'shh', 732 methods: [ 733 ], 734 properties: 735 [ 736 new web3._extend.Property({ 737 name: 'version', 738 getter: 'shh_version', 739 outputFormatter: web3._extend.utils.toDecimal 740 }), 741 new web3._extend.Property({ 742 name: 'info', 743 getter: 'shh_info' 744 }), 745 ] 746 }); 747 ` 748 749 const SwarmfsJs = ` 750 web3._extend({ 751 property: 'swarmfs', 752 methods: 753 [ 754 new web3._extend.Method({ 755 name: 'mount', 756 call: 'swarmfs_mount', 757 params: 2 758 }), 759 new web3._extend.Method({ 760 name: 'unmount', 761 call: 'swarmfs_unmount', 762 params: 1 763 }), 764 new web3._extend.Method({ 765 name: 'listmounts', 766 call: 'swarmfs_listmounts', 767 params: 0 768 }), 769 ] 770 }); 771 ` 772 773 const TxpoolJs = ` 774 web3._extend({ 775 property: 'txpool', 776 methods: [], 777 properties: 778 [ 779 new web3._extend.Property({ 780 name: 'content', 781 getter: 'txpool_content' 782 }), 783 new web3._extend.Property({ 784 name: 'inspect', 785 getter: 'txpool_inspect' 786 }), 787 new web3._extend.Property({ 788 name: 'status', 789 getter: 'txpool_status', 790 outputFormatter: function(status) { 791 status.pending = web3._extend.utils.toDecimal(status.pending); 792 status.queued = web3._extend.utils.toDecimal(status.queued); 793 return status; 794 } 795 }), 796 ] 797 }); 798 ` 799 800 const Raft_JS = ` 801 web3._extend({ 802 property: 'raft', 803 methods: 804 [ 805 ], 806 properties: 807 [ 808 new web3._extend.Property({ 809 name: 'role', 810 getter: 'raft_role' 811 }), 812 new web3._extend.Method({ 813 name: 'addPeer', 814 call: 'raft_addPeer', 815 params: 1 816 }), 817 new web3._extend.Method({ 818 name: 'addLearner', 819 call: 'raft_addLearner', 820 params: 1 821 }), 822 new web3._extend.Method({ 823 name: 'promoteToPeer', 824 call: 'raft_promoteToPeer', 825 params: 1 826 }), 827 new web3._extend.Method({ 828 name: 'removePeer', 829 call: 'raft_removePeer', 830 params: 1 831 }), 832 new web3._extend.Property({ 833 name: 'leader', 834 getter: 'raft_leader' 835 }), 836 new web3._extend.Property({ 837 name: 'cluster', 838 getter: 'raft_cluster' 839 }), 840 ] 841 }) 842 ` 843 844 const QUORUM_NODE_JS = ` 845 web3._extend({ 846 property: 'quorumPermission', 847 methods: 848 [ 849 new web3._extend.Method({ 850 name: 'addOrg', 851 call: 'quorumPermission_addOrg', 852 params: 4, 853 inputFormatter: [null,null,web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputTransactionFormatter] 854 }), 855 new web3._extend.Method({ 856 name: 'approveOrg', 857 call: 'quorumPermission_approveOrg', 858 params: 4, 859 inputFormatter: [null,null,web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputTransactionFormatter] 860 }), 861 new web3._extend.Method({ 862 name: 'addSubOrg', 863 call: 'quorumPermission_addSubOrg', 864 params: 4, 865 inputFormatter: [null,null,null,web3._extend.formatters.inputTransactionFormatter] 866 }), 867 new web3._extend.Method({ 868 name: 'updateOrgStatus', 869 call: 'quorumPermission_updateOrgStatus', 870 params: 3, 871 inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter] 872 }), 873 new web3._extend.Method({ 874 name: 'approveOrgStatus', 875 call: 'quorumPermission_approveOrgStatus', 876 params: 3, 877 inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter] 878 }), 879 new web3._extend.Method({ 880 name: 'addNode', 881 call: 'quorumPermission_addNode', 882 params: 3, 883 inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter] 884 }), 885 new web3._extend.Method({ 886 name: 'updateNodeStatus', 887 call: 'quorumPermission_updateNodeStatus', 888 params: 4, 889 inputFormatter: [null,null,null,web3._extend.formatters.inputTransactionFormatter] 890 }), 891 new web3._extend.Method({ 892 name: 'assignAdminRole', 893 call: 'quorumPermission_assignAdminRole', 894 params: 4, 895 inputFormatter: [null,web3._extend.formatters.inputAddressFormatter,null, web3._extend.formatters.inputTransactionFormatter] 896 }), 897 new web3._extend.Method({ 898 name: 'approveAdminRole', 899 call: 'quorumPermission_approveAdminRole', 900 params: 3, 901 inputFormatter: [null, web3._extend.formatters.inputAddressFormatter,web3._extend.formatters.inputTransactionFormatter] 902 }), 903 new web3._extend.Method({ 904 name: 'addNewRole', 905 call: 'quorumPermission_addNewRole', 906 params: 6, 907 inputFormatter: [null,null,null,null,null,web3._extend.formatters.inputTransactionFormatter] 908 }), 909 new web3._extend.Method({ 910 name: 'removeRole', 911 call: 'quorumPermission_removeRole', 912 params: 3, 913 inputFormatter: [null,null,web3._extend.formatters.inputTransactionFormatter] 914 }), 915 new web3._extend.Method({ 916 name: 'addAccountToOrg', 917 call: 'quorumPermission_addAccountToOrg', 918 params: 4, 919 inputFormatter: [web3._extend.formatters.inputAddressFormatter,null,null,web3._extend.formatters.inputTransactionFormatter] 920 }), 921 new web3._extend.Method({ 922 name: 'changeAccountRole', 923 call: 'quorumPermission_changeAccountRole', 924 params: 4, 925 inputFormatter: [web3._extend.formatters.inputAddressFormatter,null,null,web3._extend.formatters.inputTransactionFormatter] 926 }), 927 new web3._extend.Method({ 928 name: 'updateAccountStatus', 929 call: 'quorumPermission_updateAccountStatus', 930 params: 4, 931 inputFormatter: [null, web3._extend.formatters.inputAddressFormatter,null,web3._extend.formatters.inputTransactionFormatter] 932 }), 933 new web3._extend.Method({ 934 name: 'recoverBlackListedNode', 935 call: 'quorumPermission_recoverBlackListedNode', 936 params: 3, 937 inputFormatter: [null, null, web3._extend.formatters.inputTransactionFormatter] 938 }), 939 new web3._extend.Method({ 940 name: 'approveBlackListedNodeRecovery', 941 call: 'quorumPermission_approveBlackListedNodeRecovery', 942 params: 3, 943 inputFormatter: [null, null, web3._extend.formatters.inputTransactionFormatter] 944 }), 945 new web3._extend.Method({ 946 name: 'recoverBlackListedAccount', 947 call: 'quorumPermission_recoverBlackListedAccount', 948 params: 3, 949 inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter] 950 }), 951 new web3._extend.Method({ 952 name: 'approveBlackListedAccountRecovery', 953 call: 'quorumPermission_approveBlackListedAccountRecovery', 954 params: 3, 955 inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter] 956 }), 957 new web3._extend.Method({ 958 name: 'getOrgDetails', 959 call: 'quorumPermission_getOrgDetails', 960 params: 1, 961 inputFormatter: [null] 962 }), 963 964 ], 965 properties: 966 [ 967 new web3._extend.Property({ 968 name: 'orgList', 969 getter: 'quorumPermission_orgList' 970 }), 971 new web3._extend.Property({ 972 name: 'nodeList', 973 getter: 'quorumPermission_nodeList' 974 }), 975 new web3._extend.Property({ 976 name: 'roleList', 977 getter: 'quorumPermission_roleList' 978 }), 979 new web3._extend.Property({ 980 name: 'acctList', 981 getter: 'quorumPermission_acctList' 982 }), 983 ] 984 }) 985 ` 986 987 const Istanbul_JS = ` 988 web3._extend({ 989 property: 'istanbul', 990 methods: 991 [ 992 new web3._extend.Method({ 993 name: 'getSnapshot', 994 call: 'istanbul_getSnapshot', 995 params: 1, 996 inputFormatter: [null] 997 }), 998 new web3._extend.Method({ 999 name: 'getSnapshotAtHash', 1000 call: 'istanbul_getSnapshotAtHash', 1001 params: 1 1002 }), 1003 new web3._extend.Method({ 1004 name: 'getValidators', 1005 call: 'istanbul_getValidators', 1006 params: 1, 1007 inputFormatter: [null] 1008 }), 1009 new web3._extend.Method({ 1010 name: 'getValidatorsAtHash', 1011 call: 'istanbul_getValidatorsAtHash', 1012 params: 1 1013 }), 1014 new web3._extend.Method({ 1015 name: 'propose', 1016 call: 'istanbul_propose', 1017 params: 2 1018 }), 1019 new web3._extend.Method({ 1020 name: 'discard', 1021 call: 'istanbul_discard', 1022 params: 1 1023 }), 1024 1025 new web3._extend.Method({ 1026 name: 'getSignersFromBlock', 1027 call: 'istanbul_getSignersFromBlock', 1028 params: 1, 1029 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter] 1030 }), 1031 new web3._extend.Method({ 1032 name: 'getSignersFromBlockByHash', 1033 call: 'istanbul_getSignersFromBlockByHash', 1034 params: 1 1035 }), 1036 ], 1037 properties: 1038 [ 1039 new web3._extend.Property({ 1040 name: 'candidates', 1041 getter: 'istanbul_candidates' 1042 }), 1043 new web3._extend.Property({ 1044 name: 'nodeAddress', 1045 getter: 'istanbul_nodeAddress' 1046 }), 1047 ] 1048 }); 1049 ` 1050 1051 const AccountingJs = ` 1052 web3._extend({ 1053 property: 'accounting', 1054 methods: [ 1055 new web3._extend.Property({ 1056 name: 'balance', 1057 getter: 'account_balance' 1058 }), 1059 new web3._extend.Property({ 1060 name: 'balanceCredit', 1061 getter: 'account_balanceCredit' 1062 }), 1063 new web3._extend.Property({ 1064 name: 'balanceDebit', 1065 getter: 'account_balanceDebit' 1066 }), 1067 new web3._extend.Property({ 1068 name: 'bytesCredit', 1069 getter: 'account_bytesCredit' 1070 }), 1071 new web3._extend.Property({ 1072 name: 'bytesDebit', 1073 getter: 'account_bytesDebit' 1074 }), 1075 new web3._extend.Property({ 1076 name: 'msgCredit', 1077 getter: 'account_msgCredit' 1078 }), 1079 new web3._extend.Property({ 1080 name: 'msgDebit', 1081 getter: 'account_msgDebit' 1082 }), 1083 new web3._extend.Property({ 1084 name: 'peerDrops', 1085 getter: 'account_peerDrops' 1086 }), 1087 new web3._extend.Property({ 1088 name: 'selfDrops', 1089 getter: 'account_selfDrops' 1090 }), 1091 ] 1092 }); 1093 ` 1094 1095 const LESJs = ` 1096 web3._extend({ 1097 property: 'les', 1098 methods: 1099 [ 1100 new web3._extend.Method({ 1101 name: 'getCheckpoint', 1102 call: 'les_getCheckpoint', 1103 params: 1 1104 }), 1105 ], 1106 properties: 1107 [ 1108 new web3._extend.Property({ 1109 name: 'latestCheckpoint', 1110 getter: 'les_latestCheckpoint' 1111 }), 1112 new web3._extend.Property({ 1113 name: 'checkpointContractAddress', 1114 getter: 'les_getCheckpointContractAddress' 1115 }), 1116 ] 1117 }); 1118 ` 1119 1120 const Extension_JS = ` 1121 web3._extend({ 1122 property: 'quorumExtension', 1123 methods: 1124 [ 1125 new web3._extend.Method({ 1126 name: 'approveExtension', 1127 call: 'quorumExtension_approveExtension', 1128 params: 3, 1129 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputTransactionFormatter] 1130 }), 1131 new web3._extend.Method({ 1132 name: 'extendContract', 1133 call: 'quorumExtension_extendContract', 1134 params: 4, 1135 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter] 1136 }), 1137 new web3._extend.Method({ 1138 name: 'cancelExtension', 1139 call: 'quorumExtension_cancelExtension', 1140 params: 2, 1141 inputFormatter: [web3._extend.formatters.inputAddressFormatter, web3._extend.formatters.inputTransactionFormatter] 1142 }), 1143 new web3._extend.Method({ 1144 name: 'getExtensionStatus', 1145 call: 'quorumExtension_getExtensionStatus', 1146 params: 1, 1147 inputFormatter: [web3._extend.formatters.inputAddressFormatter] 1148 }), 1149 1150 ], 1151 properties: 1152 [ 1153 new web3._extend.Property({ 1154 name: 'activeExtensionContracts', 1155 getter: 'quorumExtension_activeExtensionContracts' 1156 }) 1157 ] 1158 }); 1159 ` 1160 1161 const Account_Plugin_Js = ` 1162 web3._extend({ 1163 property: 'plugin_account', 1164 methods: 1165 [ 1166 new web3._extend.Method({ 1167 name: 'newAccount', 1168 call: 'plugin@account_newAccount', 1169 params: 1 1170 }), 1171 new web3._extend.Method({ 1172 name: 'importRawKey', 1173 call: 'plugin@account_importRawKey', 1174 params: 2 1175 }) 1176 ] 1177 }); 1178 `