web3ext.go 18 KB

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