web3ext.go 18 KB

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