web3ext.go 18 KB

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