web3.js
web3.js copied to clipboard
non-supported RPC methods guide
2024 H1 Action Items: Expand web3.js documentation with 5 guides explaining common usage and/or best practices
References:
- Create a guide (it can be under the
advancecategory, to add the functionality ofweb3.extendto use it for other RPC methods - Add code samples with common RPC methods not supported by web3.js but supported by some ethereum clients like geth, nethermind, besu, erigon, etc
- The code samples can be done using the
web3.extend()function, but using plugins samples would be highly appreciated - Example
eth_getBlockReceipts() - add a note to encourage use of plugins instead of web3.extend
const { Web3 } = require("web3");
const web3 = new Web3(
"https://nd-422-757-666.p2pify.com/0a9d79d93fb2f4a4b1e04695da2b77a7"
);
async function main() {
web3.extend({
property: "L2Module",
methods: [
{
name: "getBlockReceipts",
call: "eth_getBlockReceipts",
},
],
});
const receipts = await web3.L2Module.getBlockReceipts("latest"); //return all the receipts
console.log(receipts);
}
main();
- This can be added either in
🧠 Advancedcategory or🧩🛠️ Web3 Pluginsection