net_js.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package api
  2. const Net_JS = `
  3. web3.extend({
  4. property: 'network',
  5. methods:
  6. [
  7. new web3.extend.Method({
  8. name: 'addPeer',
  9. call: 'net_addPeer',
  10. params: 1,
  11. inputFormatter: [web3.extend.utils.formatInputString],
  12. outputFormatter: web3.extend.formatters.formatOutputBool
  13. }),
  14. new web3.extend.Method({
  15. name: 'id',
  16. call: 'net_id',
  17. params: 0,
  18. inputFormatter: [],
  19. outputFormatter: web3.extend.formatters.formatOutputString
  20. }),
  21. new web3.extend.Method({
  22. name: 'getPeerCount',
  23. call: 'net_peerCount',
  24. params: 0,
  25. inputFormatter: [],
  26. outputFormatter: web3.extend.formatters.formatOutputString
  27. }),
  28. new web3.extend.Method({
  29. name: 'peers',
  30. call: 'net_peers',
  31. params: 0,
  32. inputFormatter: [],
  33. outputFormatter: function(obj) { return obj; }
  34. })
  35. ],
  36. properties:
  37. [
  38. new web3.extend.Property({
  39. name: 'listening',
  40. getter: 'net_listening',
  41. outputFormatter: web3.extend.formatters.formatOutputBool
  42. }),
  43. new web3.extend.Property({
  44. name: 'peerCount',
  45. getter: 'net_peerCount',
  46. outputFormatter: web3.extend.utils.toDecimal
  47. })
  48. ]
  49. });
  50. `