{"_id":"@conduitxyz/eth-scan","_rev":"7-33253a13ea64537a1519e8f3f7de724d","name":"@conduitxyz/eth-scan","dist-tags":{"latest":"2.1.0"},"versions":{"2.1.0":{"name":"@conduitxyz/eth-scan","version":"2.1.0","keywords":["ethereum","ether","tokens","balance","scanner","web3","ethers.js","smart-contract"],"author":{"name":"MyCrypto"},"license":"MIT","_id":"@conduitxyz/eth-scan@2.1.0","maintainers":[{"name":"kahuang88","email":"k.andrew.huang@gmail.com"}],"contributors":[{"name":"Maarten Zuidhoorn","email":"maarten@zuidhoorn.com"},{"url":"https://luit.me","name":"Luit Hollander","email":"luit@hollander.email"}],"homepage":"https://github.com/conduitxyz/eth-scan#readme","bugs":{"url":"https://github.com/conduitxyz/eth-scan/issues"},"dist":{"shasum":"2567b17077bae8859e6f13fd4d0eaeb2599d42e2","tarball":"https://registry.npmjs.org/@conduitxyz/eth-scan/-/eth-scan-2.1.0.tgz","fileCount":84,"integrity":"sha512-bzM2kvXYv/K8gfoEWuI5LcMb7XFQwkdMXEMzDX+ZnE2CQEYnLddrjXO1QlIfOsLbbIq2Cpbq/YnDE/N3ScOU2Q==","signatures":[{"sig":"MEYCIQCqU3I1C1T2x5VsCLvEg3+rGIK48l1udN8k0axsCl8hjQIhAKQrQCiwgnYbmwLRTRsYLuTvPL6WDckaKfobnSLx08I1","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":126094,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjvcN8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqAjg//UJYdm56XPT7E1AAB1/Kri4v99GwoHU9+VuATRpv39T4vUKh+\r\n4QbpM7LFVVx82jr41CNwJRSJeUZCzi6W1kZ0JDYD+8QVZ/TDW2bP9L7AlBD3\r\nNV53hEkspvzC0LpCBxfauxiIHj65+tG9+LvqUfCM4+84Mc9LN+feOgxnu6NF\r\n9Tgqe9ePwufn+l9TKbjgTLW/PgAGrWVwHWZ9alJhR98H22TM1F/RwFuQVNv8\r\n1LSUVbG890iiFPR8jE/C146NQ4wlWrKQiQlOybPmuHonj/hQX6Qppgkd6FR4\r\ngXKvjNdPZtrKvYYhChxTMCpvp2jhMOY3SyDDxpPeofLW0Z4ciJS9cr84jiqq\r\npz7SePPsqBY5iwkiDtCtgwj/2NDEuWuJWU8ar29JfYYbLg4LeXqsN25PY/ht\r\nsttqJd8j6sGPBx2YyiSahenjp5JBPQlg6lTk9ZeVCoPQadv5JTVbIY01ycQG\r\nfbBSFqeb/3uWG/hIXkHd6FNycqURf5PeM+l4v79EOQdf4a/PsmbdUl1qPpln\r\nityqzc1DLkwk3l2hYkqfq6Y7QyjJxvsElr2XTBGEAwBJtlB5JlkkD89+ApdD\r\naAd99sa3vHxntJLMSljKg/AmshTtW7SzPw8CQUP8mriC5G64xwAnpWr3gfX/\r\noJG5dTYumllf4SmqVfd6WGDMhbFlGi7fwHE=\r\n=wGfy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"lib/cjs/index.js","husky":{"hooks":{"pre-commit":"yarn run test && yarn run lint:ts && lint-staged"}},"module":"lib/es/index.js","gitHead":"7a20ab1b85868bbf20401d1da6349baf79fe7c51","scripts":{"lint":"yarn run lint:ts && yarn run lint:tslint","test":"concurrently -k -s first --raw 'yarn run --silent ganache' 'yarn run truffle:test'","build":"yarn run clean && yarn run build:source && yarn run build:declarations","clean":"rimraf lib","ganache":"ganache-cli > /dev/null","lint:ts":"tsc --noEmit","prepare":"yarn run build","prettier":"prettier --write --config ./.prettierrc --list-different './**/*.ts' './**/*.js'","lint:tslint":"tslint --project .","build:source":"yarn run build:source:cjs && yarn run build:source:es","truffle:test":"cross-env NODE_ENV=test truffle test","prepublishOnly":"","build:source:es":"cross-env NODE_ENV=production BABEL_ENV=es babel src --extensions '.ts' --source-maps --out-dir lib/es","truffle:migrate":"truffle migrate","build:source:cjs":"cross-env NODE_ENV=production BABEL_ENV=cjs babel src --extensions '.ts' --source-maps --out-dir lib/cjs","build:declarations":"tsc -p tsconfig.build.json"},"typings":"typings/index.d.ts","_npmUser":{"name":"kahuang88","email":"k.andrew.huang@gmail.com"},"repository":{"url":"git+https://github.com/conduitxyz/eth-scan.git","type":"git"},"_npmVersion":"6.14.17","description":"An efficient Ether and token balance scanner","directories":{},"lint-staged":{"*.js":["prettier --write --config ./.prettierrc --config-precedence file-override","git add"],"*.ts":["prettier --write --config ./.prettierrc --config-precedence file-override","tslint --project .","git add"]},"sideEffects":false,"_nodeVersion":"14.21.2","dependencies":{"@ethersproject/abi":"^5.0.0-beta.146","isomorphic-unfetch":"^3.0.0","@ethersproject/bignumber":"^5.0.0-beta.135"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"chai":"^4.2.0","web3":"^1.2.4","husky":"^3.0.5","mocha":"^6.1.4","rimraf":"^3.0.0","tslint":"^5.16.0","core-js":"^3.1.3","truffle":"^5.1.17","ts-node":"^8.5.4","prettier":"^1.19.1","ts-mocha":"^6.0.0","cross-env":"^6.0.3","@babel/cli":"^7.7.7","chai-spies":"^1.0.0","typescript":"^3.7.3","@babel/core":"^7.7.7","@types/chai":"^4.1.7","@types/node":"^12.0.3","ganache-cli":"^6.9.1","lint-staged":"^9.2.5","@types/mocha":"^5.2.6","concurrently":"^4.1.0","@babel/register":"^7.7.7","@babel/preset-env":"^7.7.7","@types/chai-spies":"^1.0.0","@types/node-fetch":"^2.5.4","babel-preset-minify":"^0.5.1","@types/ethereumjs-abi":"^0.6.3","tslint-config-prettier":"^1.18.0","@babel/preset-typescript":"^7.7.7","@ethersproject/providers":"^5.0.0-beta.131","tslint-microsoft-contrib":"^6.2.0","@truffle/hdwallet-provider":"^1.0.27","@babel/plugin-proposal-optional-chaining":"^7.7.5","@babel/plugin-transform-modules-commonjs":"^7.7.5","@babel/plugin-proposal-nullish-coalescing-operator":"^7.7.4"},"_npmOperationalInternal":{"tmp":"tmp/eth-scan_2.1.0_1673380732372_0.2383850320505394","host":"s3://npm-registry-packages"}}},"time":{"created":"2023-01-10T19:58:52.308Z","modified":"2026-07-20T19:01:00.922Z","2.1.0":"2023-01-10T19:58:52.609Z"},"bugs":{"url":"https://github.com/conduitxyz/eth-scan/issues"},"author":{"name":"MyCrypto"},"license":"MIT","homepage":"https://github.com/conduitxyz/eth-scan#readme","keywords":["ethereum","ether","tokens","balance","scanner","web3","ethers.js","smart-contract"],"repository":{"url":"git+https://github.com/conduitxyz/eth-scan.git","type":"git"},"description":"An efficient Ether and token balance scanner","contributors":[{"name":"Maarten Zuidhoorn","email":"maarten@zuidhoorn.com"},{"url":"https://luit.me","name":"Luit Hollander","email":"luit@hollander.email"}],"maintainers":[{"email":"k.andrew.huang@gmail.com","name":"kahuang88"},{"email":"email@reiner.systems","name":"mirshko"},{"email":"seungju@conduit.xyz","name":"sjconduit"},{"email":"alexis@conduit.xyz","name":"abezard-conduitxyz"}],"readme":"# eth-scan\n\n`eth-scan` is a library written in TypeScript, to help you fetch Ether or (ERC-20) token balances for multiple addresses in an efficient way. The library uses a smart contract to fetch the balances in a single call to a node. The contract is currently deployed at [0x86f25b64e1fe4c5162cdeed5245575d32ec549db](https://etherscan.io/address/0x86f25b64e1fe4c5162cdeed5245575d32ec549db) on the Ethereum mainnet, Goerli, Kovan, Rinkeby and Ropsten.\n\nIt can use Web3.js, Ethers.js or regular HTTP as provider to get the balances. See [Getting Started](#getting-started) for more info.\n\n**Note**: Even though `eth_call` doesn't use any gas, the block gas limit still applies, and the maximum number of addresses you can fetch in a single call is limited. By default this library batches calls per 1000 addresses.\n\n## Getting started\n\nThe library is published on npm. To install it, use `npm` or `yarn`:\n\n```\nyarn add @mycrypto/eth-scan\n```\n\nor\n\n```\nnpm install @mycrypto/eth-scan\n```\n\n## Example\n\n```typescript\nimport { getEtherBalances } from 'eth-scan';\n\ngetEtherBalances('http://127.0.0.1:8545', [\n  '0x9a0decaffb07fb500ff7e5d253b16892dbec006a',\n  '0xeb65f72a2f5464157288ac15f1bb56c56e6be375',\n  '0x1b96c634f9e9fcfb76932e165984901701352ffd',\n  '0x740539b55ee5dc58efffb88fea44a9008f8daa6f',\n  '0x95d9e32dc03770699a6a5e5858165b174d500015'\n]).then(console.log);\n```\n\nResults in:\n\n```typescript\n{\n  '0x9a0decaffb07fb500ff7e5d253b16892dbec006a': BigNumber(1000000000000000000),\n  '0xeb65f72a2f5464157288ac15f1bb56c56e6be375': BigNumber(1000000000000000000),\n  '0x1b96c634f9e9fcfb76932e165984901701352ffd': BigNumber(1000000000000000000),\n  '0x740539b55ee5dc58efffb88fea44a9008f8daa6f': BigNumber(1000000000000000000),\n  '0x95d9e32dc03770699a6a5e5858165b174d500015': BigNumber(1000000000000000000)\n}\n```\n\n## API\n\n### `getEtherBalances(provider, addresses, options)`\n\nGet Ether balances for `addresses`.\n\n* `provider` \\<[Provider](#providers)\\> - A Web3 instance, Ethers.js provider or JSONRPC endpoint.\n\n* `addresses` \\<string[]\\> - An array of addresses as hexadecimal string.\n\n* `options` \\<[EthScanOptions](#ethscanoptions)\\> (optional) - The options to use.\n\n* Returns: \\<Promise<[BalanceMap](#balancemap)>\\> - A promise with an object with the addresses and the balances.\n\n### `getTokenBalances(provider, addresses, token, options)`\n\nGet ERC-20 token balances from `token` for `addresses`. This does not check if the address specified is a token and will throw an error if it isn't.\n\n* `provider` \\<[Provider](#providers)\\> - A Web3 instance, Ethers.js provider or JSONRPC endpoint.\n\n* `addresses` \\<string[]\\> - An array of addresses as hexadecimal string.\n\n* `token` \\<string\\> - The address of the ERC-20 token.\n\n* `options` \\<[EthScanOptions](#ethscanoptions)\\> (optional) - The options to use.\n\n* Returns: \\<Promise<[BalanceMap](#balancemap)>\\> - A promise with an object with the addresses and the balances.\n\n### `getTokensBalance(provider, address, tokens, options)`\n\nGet ERC-20 token balances from `tokens` for `address`. If one of the token addresses specified is not a token, a balance of 0 will be used.\n\n* `provider` \\<[Provider](#providers)\\> - A Web3 instance, Ethers.js provider or JSONRPC endpoint.\n\n* `address` \\<string\\> - The address to get token balances for.\n\n* `tokens` \\<string[]\\> - An array of ERC-20 token addresses.\n\n* `options` \\<[EthScanOptions](#ethscanoptions)\\> (optional) - The options to use.\n\n* Returns: \\<Promise<[BalanceMap](#balancemap)>\\> - A promise with an object with the addresses and the balances.\n\n## `getTokensBalances(provider, addresses, tokens, options)`\n\n* `provider` \\<[Provider](#providers)\\> - A Web3 instance, Ethers.js provider or JSONRPC endpoint.\n\n* `addresses` \\<string[]\\> - An array of addresses as hexadecimal string.\n\n* `tokens` \\<string[]\\> - An array of ERC-20 token addresses.\n\n* `options` \\<[EthScanOptions](#ethscanoptions)\\> (optional) - The options to use.\n\n* Returns: \\<Promise<[BalanceMap](#balancemap)\\<[BalanceMap](#balancemap)\\>>\\> - A promise with an object with the addresses and the balances.\n\n### `EthScanOptions`\n\n* `contractAddress` \\<string\\> (optional) - The address of the smart contract to use. Defaults to [0x86f25b64e1fe4c5162cdeed5245575d32ec549db](https://etherscan.io/address/0x86f25b64e1fe4c5162cdeed5245575d32ec549db).\n\n* `batchSize` \\<number\\> (optional) - The size of the call batches. Defaults to 1000.\n\n### `BalanceMap`\n\nA `BalanceMap` is an object with an address as key and a [BigNumber](https://github.com/ethers-io/ethers.js/tree/ethers-v5-beta/packages/bignumber) as value.\n\n### Providers\n\nCurrently, `eth-scan` has support for three different providers:\n\n* Ethers.js, by using an existing Ethers.js provider\n* Web3, by using an instance of the `Web3` class\n* HTTP, by using a URL of a JSONRPC endpoint as string\n\n## Compatiblity\n\n`eth-scan` uses ES6+ functionality, which may not be supported on all platforms. If you need compatibility with older browsers or Node.js versions, you can use something like [Babel](https://github.com/babel/babel).\n\nThere is an ES compatible version available, which should work with module bundlers like [Webpack](https://webpack.js.org/) and [Rollup](https://github.com/rollup/rollup).\n","readmeFilename":"README.md"}