miner_js.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // Copyright 2015 The go-ethereum Authors
  2. // This file is part of go-ethereum.
  3. //
  4. // go-ethereum 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. // go-ethereum 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 go-ethereum. If not, see <http://www.gnu.org/licenses/>.
  16. package api
  17. const Miner_JS = `
  18. web3._extend({
  19. property: 'miner',
  20. methods:
  21. [
  22. new web3._extend.Method({
  23. name: 'start',
  24. call: 'miner_start',
  25. params: 1,
  26. inputFormatter: [null]
  27. }),
  28. new web3._extend.Method({
  29. name: 'stop',
  30. call: 'miner_stop',
  31. params: 1,
  32. inputFormatter: [null]
  33. }),
  34. new web3._extend.Method({
  35. name: 'setEtherbase',
  36. call: 'miner_setEtherbase',
  37. params: 1,
  38. inputFormatter: [web3._extend.formatters.formatInputInt],
  39. outputFormatter: web3._extend.formatters.formatOutputBool
  40. }),
  41. new web3._extend.Method({
  42. name: 'setExtra',
  43. call: 'miner_setExtra',
  44. params: 1,
  45. inputFormatter: [null]
  46. }),
  47. new web3._extend.Method({
  48. name: 'setGasPrice',
  49. call: 'miner_setGasPrice',
  50. params: 1,
  51. inputFormatter: [web3._extend.utils.fromDecial]
  52. }),
  53. new web3._extend.Method({
  54. name: 'startAutoDAG',
  55. call: 'miner_startAutoDAG',
  56. params: 0,
  57. inputFormatter: []
  58. }),
  59. new web3._extend.Method({
  60. name: 'stopAutoDAG',
  61. call: 'miner_stopAutoDAG',
  62. params: 0,
  63. inputFormatter: []
  64. }),
  65. new web3._extend.Method({
  66. name: 'makeDAG',
  67. call: 'miner_makeDAG',
  68. params: 1,
  69. inputFormatter: [web3._extend.formatters.inputDefaultBlockNumberFormatter]
  70. })
  71. ],
  72. properties:
  73. [
  74. new web3._extend.Property({
  75. name: 'hashrate',
  76. getter: 'miner_hashrate',
  77. outputFormatter: web3._extend.utils.toDecimal
  78. })
  79. ]
  80. });
  81. `