-
Notifications
You must be signed in to change notification settings - Fork 7
Feature Support & Comparison
Taylor Dawson edited this page Jul 24, 2019
·
10 revisions
Details about web3.js & ethers.js
- Web3.js: https://web3js.readthedocs.io/en/1.0/web3-eth.html
- Ethers.js: https://docs.ethers.io/ethers.js/html/api-providers.html#network
Feature | Web3.js | Ethers.js | Planned for Web3data.js | Supported | Notes |
---|---|---|---|---|---|
getAccount | ✓ | ✓ | ✓ | blocked | |
getHashrate | ✓ | × | × | - | |
getGasPrice | ✓ | ✓ | ✓ | pending | Web3.js returns "20000000000", ethers returns: "20000000000", use endpoint: https://docs.amberdata.io/reference/transactions#get-gas-predictions using fastest or average Namespace: transactions
|
getAccounts | ✓ | ✓ | × | - | |
getBlockNumber | ✓ | ✓ | ✓ | pending |
Web3.js — type number , 7280000 Ethers — type number , 7280000 Endpoint— /block/:id using the blocks.current
|
getBalance | ✓ | ✓ | ✓ | pending - partial imp waiting on api |
Web3.js — type string Ethers — type BigNumber Endpoint — /addresses/:hash/account-balances/latest .value
|
getStorageAt | ✓ | ✓ | × | - | |
getCode | ✓ | ✓ | ✓ | pending |
Web3.js — type string Ethers — type string Endpoint— /contracts/:hash .bytecode
|
getBlock † | ✓ | ✓ | ✓ | pending |
Web3.js — type object response Ethers — type object response Endpoint— /blocks/:id?validationMethod=full |
getBlockTransactionCount | ✓ | × | ✓ | pending |
Web3.js — type number Endpoint— /blocks/:id .numTransactions
|
getUncle † | ✓ | × | ✓ | pending |
Web3.js — type object response Endpoint— /blocks/:id?validationMethod=full .validations.unlces This should be evaluated since we just want uncles but it returns a lot of extra data; it also seems like this is subject to change. See AL-1874. |
getTransaction † | ✓ | ✓ | ✓ | PR #9 |
Web3.js — type object response Ethers — type object response Endpoint— /transactions/:hash |
getPendingTransactions | ✓ | × | ✓ | PR #9 |
Web3.js — type object response Endpoint— /transactions?status=pending |
getTransactionFromBlock | ✓ | × | ✓ | PR #9 |
Web3.js — type object response Endpoint— /blocks/:id/transactions payload.records[index] to retrieve by block and index |
getTransactionReceipt | ✓ | ✓ | ? | ? | |
getTransactionCount | ✓ | ✓ | ✓ | blocked |
Web3.js — type number Ethers — type BigNumber Endpoint— currently I don't think this is possible |
sendTransaction | ✓ | ✓ | × | - | |
sendSignedTransaction | ✓ | × | × | - | |
sign | ✓ | ✓ | × | - | |
signTransaction | ✓ | ✓ | × | - | |
call | ✓ | ✓ | × | - | |
estimateGas | ✓ | ✓ | × | - | |
getPastLogs † | ✓ | ✓ | ✓ | blocked |
Web3.js — type array of object s response Ethers getLogs() — type array of Log object s response Endpoint— /addresses/:hash/logs This one is really wonky, web3js gets ALL past logs. ethersjs can only get past logs of a specific contract, same with our endpoint as seen above. Only this /search/logs endpoint can do that. |
getWork | ✓ | × | × | - | |
submitWork | ✓ | × | × | - | |
getChainId | ✓ | ✓ | ✓ | blocked |
Web3.js — type string Ethers — type object network.chainId Endpoint— ??????????? |
Contract.getPastEvents | ✓ | × | ✓ | blocked |
Web3.js — type array of object s response Ethers getLogs() — type array of Log object s response Endpoint— /addresses/:hash/logs |
utils | ✓ | ✓ | ? | ||
getEtherPrice | × | × | ✓ | pending | Web3.js — type Ethers — type didn’t see this for ethersjs Endpoint getEtherPrice([currency])
|
† All endpoints return lots of data points that may require direct comparisons.
Feature | Web3.js | Ethers.js | Planned for Web3data.js | Supported | Notes |
---|---|---|---|---|---|
Contract.on | ✓ | ✓ | ✓ | done | |
Contract.once | ✓ | ✓ | ✓ | done | |
Contract.events.MyEvent | ✓ | ✓^ | ? | ? | Ethers.js - Only available via filters |
Contract.events.allEvents | ✓ | ✓^ | ? | ? | Ethers.js - Only available via filters |