{"id":21420214,"url":"https://github.com/ethjs/ethjs-query","last_synced_at":"2025-04-10T02:29:21.399Z","repository":{"id":57230981,"uuid":"74796506","full_name":"ethjs/ethjs-query","owner":"ethjs","description":"A simple query module for the Ethereum RPC.","archived":false,"fork":false,"pushed_at":"2023-09-25T15:54:02.000Z","size":768,"stargazers_count":46,"open_issues_count":7,"forks_count":18,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-26T06:53:28.625Z","etag":null,"topics":["ethereum","ethjs","js","query","rpc","web3"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-11-26T00:57:55.000Z","updated_at":"2024-06-18T13:44:25.609Z","dependencies_parsed_at":"2024-06-18T13:44:12.017Z","dependency_job_id":"a5395fcc-1344-4a9c-9f1e-db40c38a3208","html_url":"https://github.com/ethjs/ethjs-query","commit_stats":{"total_commits":36,"total_committers":3,"mean_commits":12.0,"dds":"0.19444444444444442","last_synced_commit":"ca712fac06380548180a73dc480de3cd379e404f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethjs%2Fethjs-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethjs%2Fethjs-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethjs%2Fethjs-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethjs%2Fethjs-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethjs","download_url":"https://codeload.github.com/ethjs/ethjs-query/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248144008,"owners_count":21054865,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","ethjs","js","query","rpc","web3"],"created_at":"2024-11-22T20:13:29.479Z","updated_at":"2025-04-10T02:29:21.367Z","avatar_url":"https://github.com/ethjs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## ethjs-query\n\n\u003cdiv\u003e\n  \u003c!-- Dependency Status --\u003e\n  \u003ca href=\"https://david-dm.org/ethjs/ethjs-query\"\u003e\n    \u003cimg src=\"https://david-dm.org/ethjs/ethjs-query.svg\"\n    alt=\"Dependency Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- devDependency Status --\u003e\n  \u003ca href=\"https://david-dm.org/ethjs/ethjs-query#info=devDependencies\"\u003e\n    \u003cimg src=\"https://david-dm.org/ethjs/ethjs-query/dev-status.svg\" alt=\"devDependency Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Build Status --\u003e\n  \u003ca href=\"https://travis-ci.org/ethjs/ethjs-query\"\u003e\n    \u003cimg src=\"https://travis-ci.org/ethjs/ethjs-query.svg\"\n    alt=\"Build Status\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- NPM Version --\u003e\n  \u003ca href=\"https://www.npmjs.org/package/ethjs-query\"\u003e\n    \u003cimg src=\"http://img.shields.io/npm/v/ethjs-query.svg\"\n    alt=\"NPM version\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Test Coverage --\u003e\n  \u003ca href=\"https://coveralls.io/r/ethjs/ethjs-query\"\u003e\n    \u003cimg src=\"https://coveralls.io/repos/github/ethjs/ethjs-query/badge.svg\" alt=\"Test Coverage\" /\u003e\n  \u003c/a\u003e\n\n  \u003c!-- Javascript Style --\u003e\n  \u003ca href=\"http://airbnb.io/javascript/\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/code%20style-airbnb-brightgreen.svg\" alt=\"js-airbnb-style\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\nA simple module for querying the Ethereum RPC layer.\n\n## Install\n\n```\nnpm install --save ethjs-query\n```\n\n## Usage\n\n```js\nconst BN = require('bn.js');\nconst HttpProvider = require('ethjs-provider-http');\nconst Eth = require('ethjs-query');\nconst eth = new Eth(new HttpProvider('http://localhost:8545'));\n\neth.getBalance('0x407d73d8a49eeb85d32cf465507dd71d507100c1', cb);\n\n// result null \u003cBN ...\u003e\n\neth.sendTransaction({\n  from: '0x407d73d8a49eeb85d32cf465507dd71d507100c1',\n  to: '0x987d73d8a49eeb85d32cf462207dd71d50710033',\n  value: new BN('6500000'),\n  gas: 3000000,\n  data: '0x',\n}).then(cb).catch(cb);\n\n// result null 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\n```\n\n## About\n\nA simple Ethereum RPC module for querying data from an Ethereum node such as a geth (go-etherem), parity (rust-ethereum) or TestRPC (local js-ethereum).\n\nThis module supports all Ethereum RPC methods and is designed completely to specification.\n\n## Amorphic Data Formatting\n\n`ethjs-query` uses the `ethjs-format` module to format incoming and outgoing RPC data payloads. The primary formatting task is numbers. Number values can be inputed as: `BigNumber`, `BN`, `string`, `hex` or `actual numbers`. Because the blockchain does not support decimal or negative numbers, any kind of decimal or negative number will cause an error return. All received number values are returned as BN.js object instances.\n\nRead more about the formatting layer here: [ethjs-format](http://github.com/ethjs/ethjs-format)\n\n## Async Only\n\nAll methods are `async` only, requiring either a callback or promise.\n\n## Error handling\n\nError handling is done through function callbacks or promised catches.\n\n## Debugging Options\n\n`ethjs-query` comes equip with a full debug options for all data inputs and outputs.\n\n```js\nconst HttpProvider = require('ethjs-provider-http');\nconst Eth = require('ethjs-query');\nconst eth = new Eth(new HttpProvider('http://localhost:8545'), { debug: true, logger: console, jsonSpace: 0 });\n\neth.accounts(cb);\n\n/* result\n[ethjs-query 2016-11-27T19:37:54.917Z] attempting method accounts with params [null]\n[ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] callback provided: true\n[ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] attempting input formatting of 0 inputs\n[ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] formatted inputs: []\n[ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] attempting query with formatted inputs...\n[ethjs-query 2016-11-27T19:37:54.919Z] [method 'accounts'] callback success, attempting formatting of raw outputs: [\"0xb88643569c19d05dc67b960f91d9d696eebf808e\",\"0xf...]\n[ethjs-query 2016-11-27T19:37:54.919Z] [method 'accounts'] formatted outputs: [\"0xb88643569c19d05dc67b960f91d9d696eebf808e\",\"0xf...]\n*/\n```\n\n## Supported Methods\n\n`ethjs-query` supports all Ethereum specified RPC methods.\n\n```js\nconst HttpProvider = require('ethjs-provider-http');\nconst Eth = require('ethjs-query');\nconst eth = new Eth(new HttpProvider('http://localhost:8545'));\n\neth.protocolVersion(cb);\n\n// ....\n```\n\n* [eth.protocolVersion](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion)\n* [eth.syncing](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing)\n* [eth.coinbase](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase)\n* [eth.mining](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining)\n* [eth.hashrate](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate)\n* [eth.gasPrice](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice)\n* [eth.accounts](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts)\n* [eth.blockNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber)\n* [eth.getBalance](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance)\n* [eth.getStorageAt](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat)\n* [eth.getTransactionCount](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount)\n* [eth.getBlockTransactionCountByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash)\n* [eth.getBlockTransactionCountByNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber)\n* [eth.getUncleCountByBlockHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash)\n* [eth.getUncleCountByBlockNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber)\n* [eth.getCode](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode)\n* [eth.sign](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign)\n* [eth.sendTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction)\n* [eth.sendRawTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction)\n* [eth.call](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call)\n* [eth.estimateGas](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas)\n* [eth.getBlockByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash)\n* [eth.getBlockByNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber)\n* [eth.getTransactionByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash)\n* [eth.getTransactionByBlockHashAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex)\n* [eth.getTransactionByBlockNumberAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex)\n* [eth.getTransactionReceipt](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt)\n* [eth.getUncleByBlockHashAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex)\n* [eth.getUncleByBlockNumberAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblocknumberandindex)\n* [eth.getCompilers](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcompilers)\n* [eth.compileLLL](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilelll)\n* [eth.compileSolidity](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity)\n* [eth.compileSerpent](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compileserpent)\n* [eth.newFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter)\n* [eth.newBlockFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter)\n* [eth.newPendingTransactionFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter)\n* [eth.uninstallFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter)\n* [eth.getFilterChanges](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges)\n* [eth.getFilterLogs](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs)\n* [eth.getLogs](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs)\n* [eth.getWork](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork)\n* [eth.submitWork](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork)\n* [eth.submitHashrate](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate)\n\n* [eth.web3_clientVersion](https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion)\n* [eth.web3_sha3](https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3)\n\n* [eth.net_version](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version)\n* [eth.net_peerCount](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount)\n* [eth.net_listening](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_listening)\n\n* [eth.db_putString](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_putstring)\n* [eth.db_getString](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_getstring)\n* [eth.db_putHex](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_puthex)\n* [eth.db_getHex](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_gethex)\n\n* [eth.shh_post](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post)\n* [eth.shh_version](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_version)\n* [eth.shh_newIdentity](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newidentity)\n* [eth.shh_hasIdentity](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_hasidentity)\n* [eth.shh_newGroup](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newgroup)\n* [eth.shh_addToGroup](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_addtogroup)\n* [eth.shh_newFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter)\n* [eth.shh_uninstallFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_uninstallfilter)\n* [eth.shh_getFilterChanges](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getfilterchanges)\n* [eth.shh_getMessages](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getmessages)\n\n## Contributing\n\nPlease help better the ecosystem by submitting issues and pull requests to `ethjs-query`. We need all the help we can get to build the absolute best linting standards and utilities. We follow the AirBNB linting standard and the unix philosophy.\n\n## Guides\n\nYou'll find more detailed information on using `ethjs-query` and tailoring it to your needs in our guides:\n\n- [User guide](docs/user-guide.md) - Usage, configuration, FAQ and complementary tools.\n- [Developer guide](docs/developer-guide.md) - Contributing to `ethjs-query` and writing your own code and coverage.\n\n## Help out\n\nThere is always a lot of work to do, and will have many rules to maintain. So please help out in any way that you can:\n\n- Create, enhance, and debug ethjs rules (see our guide to [\"Working on rules\"](./github/CONTRIBUTING.md)).\n- Improve documentation.\n- Chime in on any open issue or pull request.\n- Open new issues about your ideas for making `ethjs-query` better, and pull requests to show us how your idea works.\n- Add new tests to *absolutely anything*.\n- Create or contribute to ecosystem tools, like modules for encoding or contracts.\n- Spread the word.\n\nPlease consult our [Code of Conduct](CODE_OF_CONDUCT.md) docs before helping out.\n\nWe communicate via [issues](https://github.com/ethjs/ethjs-query/issues) and [pull requests](https://github.com/ethjs/ethjs-query/pulls).\n\n## Important documents\n\n- [Changelog](CHANGELOG.md)\n- [Code of Conduct](CODE_OF_CONDUCT.md)\n- [License](https://raw.githubusercontent.com/ethjs/ethjs-query/master/LICENSE)\n\n## Licence\n\nThis project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE.md.\n\n```\nThe MIT License\n\nCopyright (c) 2016 Nick Dodson. nickdodson.com\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethjs%2Fethjs-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethjs%2Fethjs-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethjs%2Fethjs-query/lists"}