JavaScript/TypeScript
Learn more about using JavaScript and TypeScript with Infura.
Guides
Ethers.js How to get the ETH & ERC-20 tokens balance of an address at a particular timestamp
Hello Infura community,
Web3.js How to keep Websocket subscriptions alive and reconnect on failures
Smart contracts are an essential part of the Ethereum ecosystem; Smart contracts emit so-called events when something meaningful happens within the smart contract that the smart contract wants to communicate to dApps and other smart contracts.
Ethers.js: How to retrieve the balance of an ERC-20 token
Hello everyone,
Web3.js: How to Retrieve the Balance of an ERC-20 Token
Most of the tokens we all know and love deployed on the Ethereum network follow the same specification that we call ERC-20.
Ethers.js: How to send batch requests with Infura
Hello Infura frens
Web3.js: How to send batch requests with Infura
This tutorial makes use of Web3.js v1.x.x. Not all functionality might work with Web3.js v4.
Axios: How to send an EIP-1559 raw transaction in js
In general the Javascript libraries like Ethers.js or web3.js have build in methods to sign and send a raw transaction but there might be situations where you’d want interact with the Ethereum API via plain json-rpc requests.
Ethers.js: How to send EIP-1559 transactions
Ethers is pretty cool and is able to send a eip-1559 transaction automatically without a need to do any extra configuration. It will use a maxPriorityFeePerGas of 1.5 Gwei by default, starting with v5.6.0. Also, if you use a signer class that would know also how to manage the nonce for you (of course that if you want to always get the mined transactions count). Here’s a simple script that would send such a transaction:
Ethers.js: How to send ERC-20 Tokens
Hello everyone,
Web3.js: How to Send ERC-20 Tokens
This tutorial makes use of Web3.js v1.x.x. Not all functionality might work with Web3.js v4.
Web3.js How to subscribe to pending transactions using web3.subscribe
This tutorial makes use of Web3.js v1.x.x. Not all functionality might work with Web3.js v4.
Web3.js: How to Track ERC-20 Token Transfers (+ Specific Address/Token)
ERC-20 tokens have become an essential part of the Ethereum ecosystem; if you’ve interacted with DeFi before, you’ve almost definitely interacted with ERC-20 tokens.
Web3.js: How to Track NFT (ERC-721/1155) Transfers and Mints (+ Specific Address/NFT)
This tutorial makes use of Web3.js v1.x.x. Not all functionality might work with Web3.js v4.
React.js & Ethers.js: Demo of using the InfuraProvider vs the Metamask wallet Web3Provider
Hello friends! Today we’re going to take a look at how to connect to Ethereum using the ethers.js InfuraProvider and the Web3Provider which injects a web3 wallet, in this case MetaMask.
Learn
Ethers provider behaviour when hitting the API Key daily limit
When the daily API Key limit is being hit an API request to Infura should return: “exceeded project daily request limit”.