web3ext.go 18 KB

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