github.com/core-coin/go-core/v2@v2.1.9/internal/web3ext/web3ext.go (about) 1 // Copyright 2015 by the Authors 2 // This file is part of the go-core library. 3 // 4 // The go-core 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-core 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-core library. If not, see <http://www.gnu.org/licenses/>. 16 17 // package web3ext contains gocore 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 "cryptore": CryptoreJs, 26 "debug": DebugJs, 27 "xcb": XcbJs, 28 "miner": MinerJs, 29 "net": NetJs, 30 "personal": PersonalJs, 31 "rpc": RpcJs, 32 "swarmfs": SwarmfsJs, 33 "txpool": TxpoolJs, 34 "les": LESJs, 35 "lespay": LESPayJs, 36 } 37 38 const ChequebookJs = ` 39 web3._extend({ 40 property: 'chequebook', 41 methods: [ 42 new web3._extend.Method({ 43 name: 'deposit', 44 call: 'chequebook_deposit', 45 params: 1, 46 inputFormatter: [null] 47 }), 48 new web3._extend.Property({ 49 name: 'balance', 50 getter: 'chequebook_balance', 51 outputFormatter: web3._extend.utils.toDecimal 52 }), 53 new web3._extend.Method({ 54 name: 'cash', 55 call: 'chequebook_cash', 56 params: 1, 57 inputFormatter: [null] 58 }), 59 new web3._extend.Method({ 60 name: 'issue', 61 call: 'chequebook_issue', 62 params: 2, 63 inputFormatter: [null, null] 64 }), 65 ] 66 }); 67 ` 68 69 const CliqueJs = ` 70 web3._extend({ 71 property: 'clique', 72 methods: [ 73 new web3._extend.Method({ 74 name: 'getSnapshot', 75 call: 'clique_getSnapshot', 76 params: 1, 77 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter] 78 }), 79 new web3._extend.Method({ 80 name: 'getSnapshotAtHash', 81 call: 'clique_getSnapshotAtHash', 82 params: 1 83 }), 84 new web3._extend.Method({ 85 name: 'getSigners', 86 call: 'clique_getSigners', 87 params: 1, 88 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter] 89 }), 90 new web3._extend.Method({ 91 name: 'getSignersAtHash', 92 call: 'clique_getSignersAtHash', 93 params: 1 94 }), 95 new web3._extend.Method({ 96 name: 'propose', 97 call: 'clique_propose', 98 params: 2 99 }), 100 new web3._extend.Method({ 101 name: 'discard', 102 call: 'clique_discard', 103 params: 1 104 }), 105 new web3._extend.Method({ 106 name: 'status', 107 call: 'clique_status', 108 params: 0 109 }), 110 ], 111 properties: [ 112 new web3._extend.Property({ 113 name: 'proposals', 114 getter: 'clique_proposals' 115 }), 116 ] 117 }); 118 ` 119 120 const CryptoreJs = ` 121 web3._extend({ 122 property: 'cryptore', 123 methods: [ 124 new web3._extend.Method({ 125 name: 'getWork', 126 call: 'cryptore_getWork', 127 params: 0 128 }), 129 new web3._extend.Method({ 130 name: 'getHashrate', 131 call: 'cryptore_getHashrate', 132 params: 0 133 }), 134 new web3._extend.Method({ 135 name: 'submitWork', 136 call: 'cryptore_submitWork', 137 params: 3, 138 }), 139 new web3._extend.Method({ 140 name: 'submitHashRate', 141 call: 'cryptore_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: 'addPeer', 154 call: 'admin_addPeer', 155 params: 1 156 }), 157 new web3._extend.Method({ 158 name: 'removePeer', 159 call: 'admin_removePeer', 160 params: 1 161 }), 162 new web3._extend.Method({ 163 name: 'addTrustedPeer', 164 call: 'admin_addTrustedPeer', 165 params: 1 166 }), 167 new web3._extend.Method({ 168 name: 'removeTrustedPeer', 169 call: 'admin_removeTrustedPeer', 170 params: 1 171 }), 172 new web3._extend.Method({ 173 name: 'exportChain', 174 call: 'admin_exportChain', 175 params: 3, 176 inputFormatter: [null, null, null] 177 }), 178 new web3._extend.Method({ 179 name: 'importChain', 180 call: 'admin_importChain', 181 params: 1 182 }), 183 new web3._extend.Method({ 184 name: 'sleepBlocks', 185 call: 'admin_sleepBlocks', 186 params: 2 187 }), 188 new web3._extend.Method({ 189 name: 'startRPC', 190 call: 'admin_startRPC', 191 params: 4, 192 inputFormatter: [null, null, null, null] 193 }), 194 new web3._extend.Method({ 195 name: 'stopRPC', 196 call: 'admin_stopRPC' 197 }), 198 new web3._extend.Method({ 199 name: 'startWS', 200 call: 'admin_startWS', 201 params: 4, 202 inputFormatter: [null, null, null, null] 203 }), 204 new web3._extend.Method({ 205 name: 'stopWS', 206 call: 'admin_stopWS' 207 }), 208 ], 209 properties: [ 210 new web3._extend.Property({ 211 name: 'nodeInfo', 212 getter: 'admin_nodeInfo' 213 }), 214 new web3._extend.Property({ 215 name: 'peers', 216 getter: 'admin_peers' 217 }), 218 new web3._extend.Property({ 219 name: 'datadir', 220 getter: 'admin_datadir' 221 }), 222 ] 223 }); 224 ` 225 226 const DebugJs = ` 227 web3._extend({ 228 property: 'debug', 229 methods: [ 230 new web3._extend.Method({ 231 name: 'accountRange', 232 call: 'debug_accountRange', 233 params: 6, 234 inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter, null, null, null, null, null], 235 }), 236 new web3._extend.Method({ 237 name: 'printBlock', 238 call: 'debug_printBlock', 239 params: 1, 240 outputFormatter: console.log 241 }), 242 new web3._extend.Method({ 243 name: 'getBlockRlp', 244 call: 'debug_getBlockRlp', 245 params: 1 246 }), 247 new web3._extend.Method({ 248 name: 'testSignCliqueBlock', 249 call: 'debug_testSignCliqueBlock', 250 params: 2, 251 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null], 252 }), 253 new web3._extend.Method({ 254 name: 'setHead', 255 call: 'debug_setHead', 256 params: 1 257 }), 258 new web3._extend.Method({ 259 name: 'seedHash', 260 call: 'debug_seedHash', 261 params: 1 262 }), 263 new web3._extend.Method({ 264 name: 'dumpBlock', 265 call: 'debug_dumpBlock', 266 params: 1, 267 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter] 268 }), 269 new web3._extend.Method({ 270 name: 'chaindbProperty', 271 call: 'debug_chaindbProperty', 272 params: 1, 273 outputFormatter: console.log 274 }), 275 new web3._extend.Method({ 276 name: 'chaindbCompact', 277 call: 'debug_chaindbCompact', 278 }), 279 new web3._extend.Method({ 280 name: 'verbosity', 281 call: 'debug_verbosity', 282 params: 1 283 }), 284 new web3._extend.Method({ 285 name: 'vmodule', 286 call: 'debug_vmodule', 287 params: 1 288 }), 289 new web3._extend.Method({ 290 name: 'backtraceAt', 291 call: 'debug_backtraceAt', 292 params: 1, 293 }), 294 new web3._extend.Method({ 295 name: 'stacks', 296 call: 'debug_stacks', 297 params: 0, 298 outputFormatter: console.log 299 }), 300 new web3._extend.Method({ 301 name: 'freeOSMemory', 302 call: 'debug_freeOSMemory', 303 params: 0, 304 }), 305 new web3._extend.Method({ 306 name: 'setGCPercent', 307 call: 'debug_setGCPercent', 308 params: 1, 309 }), 310 new web3._extend.Method({ 311 name: 'memStats', 312 call: 'debug_memStats', 313 params: 0, 314 }), 315 new web3._extend.Method({ 316 name: 'gcStats', 317 call: 'debug_gcStats', 318 params: 0, 319 }), 320 new web3._extend.Method({ 321 name: 'cpuProfile', 322 call: 'debug_cpuProfile', 323 params: 2 324 }), 325 new web3._extend.Method({ 326 name: 'startCPUProfile', 327 call: 'debug_startCPUProfile', 328 params: 1 329 }), 330 new web3._extend.Method({ 331 name: 'stopCPUProfile', 332 call: 'debug_stopCPUProfile', 333 params: 0 334 }), 335 new web3._extend.Method({ 336 name: 'goTrace', 337 call: 'debug_goTrace', 338 params: 2 339 }), 340 new web3._extend.Method({ 341 name: 'startGoTrace', 342 call: 'debug_startGoTrace', 343 params: 1 344 }), 345 new web3._extend.Method({ 346 name: 'stopGoTrace', 347 call: 'debug_stopGoTrace', 348 params: 0 349 }), 350 new web3._extend.Method({ 351 name: 'blockProfile', 352 call: 'debug_blockProfile', 353 params: 2 354 }), 355 new web3._extend.Method({ 356 name: 'setBlockProfileRate', 357 call: 'debug_setBlockProfileRate', 358 params: 1 359 }), 360 new web3._extend.Method({ 361 name: 'writeBlockProfile', 362 call: 'debug_writeBlockProfile', 363 params: 1 364 }), 365 new web3._extend.Method({ 366 name: 'mutexProfile', 367 call: 'debug_mutexProfile', 368 params: 2 369 }), 370 new web3._extend.Method({ 371 name: 'setMutexProfileFraction', 372 call: 'debug_setMutexProfileFraction', 373 params: 1 374 }), 375 new web3._extend.Method({ 376 name: 'writeMutexProfile', 377 call: 'debug_writeMutexProfile', 378 params: 1 379 }), 380 new web3._extend.Method({ 381 name: 'writeMemProfile', 382 call: 'debug_writeMemProfile', 383 params: 1 384 }), 385 new web3._extend.Method({ 386 name: 'traceBlock', 387 call: 'debug_traceBlock', 388 params: 2, 389 inputFormatter: [null, null] 390 }), 391 new web3._extend.Method({ 392 name: 'traceBlockFromFile', 393 call: 'debug_traceBlockFromFile', 394 params: 2, 395 inputFormatter: [null, null] 396 }), 397 new web3._extend.Method({ 398 name: 'traceBadBlock', 399 call: 'debug_traceBadBlock', 400 params: 1, 401 inputFormatter: [null] 402 }), 403 new web3._extend.Method({ 404 name: 'standardTraceBadBlockToFile', 405 call: 'debug_standardTraceBadBlockToFile', 406 params: 2, 407 inputFormatter: [null, null] 408 }), 409 new web3._extend.Method({ 410 name: 'standardTraceBlockToFile', 411 call: 'debug_standardTraceBlockToFile', 412 params: 2, 413 inputFormatter: [null, null] 414 }), 415 new web3._extend.Method({ 416 name: 'traceBlockByNumber', 417 call: 'debug_traceBlockByNumber', 418 params: 2, 419 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, null] 420 }), 421 new web3._extend.Method({ 422 name: 'traceBlockByHash', 423 call: 'debug_traceBlockByHash', 424 params: 2, 425 inputFormatter: [null, null] 426 }), 427 new web3._extend.Method({ 428 name: 'traceTransaction', 429 call: 'debug_traceTransaction', 430 params: 2, 431 inputFormatter: [null, null] 432 }), 433 new web3._extend.Method({ 434 name: 'traceCall', 435 call: 'debug_traceCall', 436 params: 3, 437 inputFormatter: [null, null, null] 438 }), 439 new web3._extend.Method({ 440 name: 'preimage', 441 call: 'debug_preimage', 442 params: 1, 443 inputFormatter: [null] 444 }), 445 new web3._extend.Method({ 446 name: 'getBadBlocks', 447 call: 'debug_getBadBlocks', 448 params: 0, 449 }), 450 new web3._extend.Method({ 451 name: 'storageRangeAt', 452 call: 'debug_storageRangeAt', 453 params: 5, 454 }), 455 new web3._extend.Method({ 456 name: 'getModifiedAccountsByNumber', 457 call: 'debug_getModifiedAccountsByNumber', 458 params: 2, 459 inputFormatter: [null, null], 460 }), 461 new web3._extend.Method({ 462 name: 'getModifiedAccountsByHash', 463 call: 'debug_getModifiedAccountsByHash', 464 params: 2, 465 inputFormatter:[null, null], 466 }), 467 new web3._extend.Method({ 468 name: 'freezeClient', 469 call: 'debug_freezeClient', 470 params: 1, 471 }), 472 ], 473 properties: [] 474 }); 475 ` 476 477 const XcbJs = ` 478 web3._extend({ 479 property: 'xcb', 480 methods: [ 481 new web3._extend.Method({ 482 name: 'networkId', 483 call: 'xcb_networkId', 484 params: 0 485 }), 486 new web3._extend.Method({ 487 name: 'sign', 488 call: 'xcb_sign', 489 params: 2, 490 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null] 491 }), 492 new web3._extend.Method({ 493 name: 'resend', 494 call: 'xcb_resend', 495 params: 3, 496 inputFormatter: [web3._extend.formatters.inputTransactionFormatter, web3._extend.utils.fromDecimal, web3._extend.utils.fromDecimal] 497 }), 498 new web3._extend.Method({ 499 name: 'signTransaction', 500 call: 'xcb_signTransaction', 501 params: 1, 502 inputFormatter: [web3._extend.formatters.inputTransactionFormatter] 503 }), 504 new web3._extend.Method({ 505 name: 'estimateEnergy', 506 call: 'xcb_estimateEnergy', 507 params: 2, 508 inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter], 509 outputFormatter: web3._extend.utils.toDecimal 510 }), 511 new web3._extend.Method({ 512 name: 'submitTransaction', 513 call: 'xcb_submitTransaction', 514 params: 1, 515 inputFormatter: [web3._extend.formatters.inputTransactionFormatter] 516 }), 517 new web3._extend.Method({ 518 name: 'fillTransaction', 519 call: 'xcb_fillTransaction', 520 params: 1, 521 inputFormatter: [web3._extend.formatters.inputTransactionFormatter] 522 }), 523 new web3._extend.Method({ 524 name: 'getHeaderByNumber', 525 call: 'xcb_getHeaderByNumber', 526 params: 1, 527 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter] 528 }), 529 new web3._extend.Method({ 530 name: 'getHeaderByHash', 531 call: 'xcb_getHeaderByHash', 532 params: 1 533 }), 534 new web3._extend.Method({ 535 name: 'getBlockByNumber', 536 call: 'xcb_getBlockByNumber', 537 params: 2, 538 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, function (val) { return !!val; }] 539 }), 540 new web3._extend.Method({ 541 name: 'getBlockByHash', 542 call: 'xcb_getBlockByHash', 543 params: 2, 544 inputFormatter: [null, function (val) { return !!val; }] 545 }), 546 new web3._extend.Method({ 547 name: 'getRawTransaction', 548 call: 'xcb_getRawTransactionByHash', 549 params: 1 550 }), 551 new web3._extend.Method({ 552 name: 'getRawTransactionFromBlock', 553 call: function(args) { 554 return (web3._extend.utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'xcb_getRawTransactionByBlockHashAndIndex' : 'xcb_getRawTransactionByBlockNumberAndIndex'; 555 }, 556 params: 2, 557 inputFormatter: [web3._extend.formatters.inputBlockNumberFormatter, web3._extend.utils.toHex] 558 }), 559 new web3._extend.Method({ 560 name: 'getProof', 561 call: 'xcb_getProof', 562 params: 3, 563 inputFormatter: [web3._extend.formatters.inputAddressFormatter, null, web3._extend.formatters.inputBlockNumberFormatter] 564 }), 565 ], 566 properties: [ 567 new web3._extend.Property({ 568 name: 'pendingTransactions', 569 getter: 'xcb_pendingTransactions', 570 outputFormatter: function(txs) { 571 var formatted = []; 572 for (var i = 0; i < txs.length; i++) { 573 formatted.push(web3._extend.formatters.outputTransactionFormatter(txs[i])); 574 formatted[i].blockHash = null; 575 } 576 return formatted; 577 } 578 }), 579 ] 580 }); 581 ` 582 583 const MinerJs = ` 584 web3._extend({ 585 property: 'miner', 586 methods: [ 587 new web3._extend.Method({ 588 name: 'start', 589 call: 'miner_start', 590 params: 1, 591 inputFormatter: [null] 592 }), 593 new web3._extend.Method({ 594 name: 'stop', 595 call: 'miner_stop' 596 }), 597 new web3._extend.Method({ 598 name: 'setCorebase', 599 call: 'miner_setCorebase', 600 params: 1, 601 inputFormatter: [web3._extend.formatters.inputAddressFormatter] 602 }), 603 new web3._extend.Method({ 604 name: 'setExtra', 605 call: 'miner_setExtra', 606 params: 1 607 }), 608 new web3._extend.Method({ 609 name: 'setEnergyPrice', 610 call: 'miner_setEnergyPrice', 611 params: 1, 612 inputFormatter: [web3._extend.utils.fromDecimal] 613 }), 614 new web3._extend.Method({ 615 name: 'setRecommitInterval', 616 call: 'miner_setRecommitInterval', 617 params: 1, 618 }), 619 new web3._extend.Method({ 620 name: 'getHashrate', 621 call: 'miner_getHashrate' 622 }), 623 ], 624 properties: [] 625 }); 626 ` 627 628 const NetJs = ` 629 web3._extend({ 630 property: 'net', 631 methods: [], 632 properties: [ 633 new web3._extend.Property({ 634 name: 'version', 635 getter: 'net_version' 636 }), 637 ] 638 }); 639 ` 640 641 const PersonalJs = ` 642 web3._extend({ 643 property: 'personal', 644 methods: [ 645 new web3._extend.Method({ 646 name: 'importRawKey', 647 call: 'personal_importRawKey', 648 params: 2 649 }), 650 new web3._extend.Method({ 651 name: 'sign', 652 call: 'personal_sign', 653 params: 3, 654 inputFormatter: [null, web3._extend.formatters.inputAddressFormatter, null] 655 }), 656 new web3._extend.Method({ 657 name: 'ecRecover', 658 call: 'personal_ecRecover', 659 params: 2 660 }), 661 new web3._extend.Method({ 662 name: 'openWallet', 663 call: 'personal_openWallet', 664 params: 2 665 }), 666 new web3._extend.Method({ 667 name: 'deriveAccount', 668 call: 'personal_deriveAccount', 669 params: 3 670 }), 671 new web3._extend.Method({ 672 name: 'signTransaction', 673 call: 'personal_signTransaction', 674 params: 2, 675 inputFormatter: [web3._extend.formatters.inputTransactionFormatter, null] 676 }), 677 new web3._extend.Method({ 678 name: 'unpair', 679 call: 'personal_unpair', 680 params: 2 681 }), 682 new web3._extend.Method({ 683 name: 'initializeWallet', 684 call: 'personal_initializeWallet', 685 params: 1 686 }) 687 ], 688 properties: [ 689 new web3._extend.Property({ 690 name: 'listWallets', 691 getter: 'personal_listWallets' 692 }), 693 ] 694 }) 695 ` 696 697 const RpcJs = ` 698 web3._extend({ 699 property: 'rpc', 700 methods: [], 701 properties: [ 702 new web3._extend.Property({ 703 name: 'modules', 704 getter: 'rpc_modules' 705 }), 706 ] 707 }); 708 ` 709 710 const SwarmfsJs = ` 711 web3._extend({ 712 property: 'swarmfs', 713 methods: 714 [ 715 new web3._extend.Method({ 716 name: 'mount', 717 call: 'swarmfs_mount', 718 params: 2 719 }), 720 new web3._extend.Method({ 721 name: 'unmount', 722 call: 'swarmfs_unmount', 723 params: 1 724 }), 725 new web3._extend.Method({ 726 name: 'listmounts', 727 call: 'swarmfs_listmounts', 728 params: 0 729 }), 730 ] 731 }); 732 ` 733 734 const TxpoolJs = ` 735 web3._extend({ 736 property: 'txpool', 737 methods: [], 738 properties: 739 [ 740 new web3._extend.Property({ 741 name: 'content', 742 getter: 'txpool_content' 743 }), 744 new web3._extend.Property({ 745 name: 'inspect', 746 getter: 'txpool_inspect' 747 }), 748 new web3._extend.Property({ 749 name: 'status', 750 getter: 'txpool_status', 751 outputFormatter: function(status) { 752 status.pending = web3._extend.utils.toDecimal(status.pending); 753 status.queued = web3._extend.utils.toDecimal(status.queued); 754 return status; 755 } 756 }), 757 ] 758 }); 759 ` 760 761 const AccountingJs = ` 762 web3._extend({ 763 property: 'accounting', 764 methods: [ 765 new web3._extend.Property({ 766 name: 'balance', 767 getter: 'account_balance' 768 }), 769 new web3._extend.Property({ 770 name: 'balanceCredit', 771 getter: 'account_balanceCredit' 772 }), 773 new web3._extend.Property({ 774 name: 'balanceDebit', 775 getter: 'account_balanceDebit' 776 }), 777 new web3._extend.Property({ 778 name: 'bytesCredit', 779 getter: 'account_bytesCredit' 780 }), 781 new web3._extend.Property({ 782 name: 'bytesDebit', 783 getter: 'account_bytesDebit' 784 }), 785 new web3._extend.Property({ 786 name: 'msgCredit', 787 getter: 'account_msgCredit' 788 }), 789 new web3._extend.Property({ 790 name: 'msgDebit', 791 getter: 'account_msgDebit' 792 }), 793 new web3._extend.Property({ 794 name: 'peerDrops', 795 getter: 'account_peerDrops' 796 }), 797 new web3._extend.Property({ 798 name: 'selfDrops', 799 getter: 'account_selfDrops' 800 }), 801 ] 802 }); 803 ` 804 805 const LESJs = ` 806 web3._extend({ 807 property: 'les', 808 methods: 809 [ 810 new web3._extend.Method({ 811 name: 'getCheckpoint', 812 call: 'les_getCheckpoint', 813 params: 1 814 }), 815 new web3._extend.Method({ 816 name: 'clientInfo', 817 call: 'les_clientInfo', 818 params: 1 819 }), 820 new web3._extend.Method({ 821 name: 'priorityClientInfo', 822 call: 'les_priorityClientInfo', 823 params: 3 824 }), 825 new web3._extend.Method({ 826 name: 'setClientParams', 827 call: 'les_setClientParams', 828 params: 2 829 }), 830 new web3._extend.Method({ 831 name: 'setDefaultParams', 832 call: 'les_setDefaultParams', 833 params: 1 834 }), 835 new web3._extend.Method({ 836 name: 'addBalance', 837 call: 'les_addBalance', 838 params: 2 839 }), 840 ], 841 properties: 842 [ 843 new web3._extend.Property({ 844 name: 'latestCheckpoint', 845 getter: 'les_latestCheckpoint' 846 }), 847 new web3._extend.Property({ 848 name: 'checkpointContractAddress', 849 getter: 'les_getCheckpointContractAddress' 850 }), 851 new web3._extend.Property({ 852 name: 'serverInfo', 853 getter: 'les_serverInfo' 854 }), 855 ] 856 }); 857 ` 858 859 const LESPayJs = ` 860 web3._extend({ 861 property: 'lespay', 862 methods: 863 [ 864 new web3._extend.Method({ 865 name: 'distribution', 866 call: 'lespay_distribution', 867 params: 2 868 }), 869 new web3._extend.Method({ 870 name: 'timeout', 871 call: 'lespay_timeout', 872 params: 2 873 }), 874 new web3._extend.Method({ 875 name: 'value', 876 call: 'lespay_value', 877 params: 2 878 }), 879 ], 880 properties: 881 [ 882 new web3._extend.Property({ 883 name: 'requestStats', 884 getter: 'lespay_requestStats' 885 }), 886 ] 887 }); 888 `