New answers tagged ethers.js
1
vote
Accepted
How to pass struct[] array to solidity contract method using ethers?
You need to use the field types inside the tuple in the exact sequence as they're in the struct.
In the CallObject struct defined in your Solidity contract, gas of type uint256 is the second field and ...
1
vote
Infura Ethers.js jsonrpcprovider failed to detect network and cannot start up
const provider = new ethers.JsonRpcProvider(
process.env.INFURA_PROVIDER_URL
);
I am also getting the same error
JsonRpcProvider failed to detect the network and cannot start up; retry in 1s (perhaps ...
0
votes
Ethers 6 transaction receipt events information
To properly get the event name and parameters from a transaction receipt using Ethers 6 in TypeScript, you should follow these steps:
Ensure Correct Event Decoding:
The result.events array contains ...
0
votes
Cannot read properties of undefined (reading 'JsonRpcProvider') at Object \node_modules\@nomiclabs\hardhat-ethers\src\internal\ethers-provider-wrapper
With the latest Ethers.js v6.13.2
const infuraApiKey = "1234...";
const blockchainStr = "sepolia"; // or "base-sepolia", "mainnet", ...
const provider = new ...
0
votes
TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')
I am using the latest Ethers.js v6.13.2
const infuraApiKey = "1234...";
const blockchainStr = "sepolia"; // or "base-sepolia", "mainnet", ...
const provider = ...
0
votes
How to listen to received transaction coin with ethers + web3modal
Regardless of the eth_newFilter error, which I will explain how to fix later, you have a bigger problem to solve.
Simple transfers between accounts do not produce logs, so you cannot listen for EVM ...
0
votes
Ethers.js: getLogs returning empty results despite existing transactions
In your filter there is a walletAddress to retrieve the logs for. Instead the appropriate contract address should be added.
const filter = {
address: walletAddress,
fromBlock: blockNumber - 20,
...
0
votes
Accepted
Cannot read properties of undefined (reading 'JsonRpcProvider') at Object \node_modules\@nomiclabs\hardhat-ethers\src\internal\ethers-provider-wrapper
Since, the version of your @nomiclabs/hardhat-ethers package is older and referencing the ethers.js v5. So, instead of ethers.js v6, you've to install ethers.js v5.
For doing that, you can just ...
0
votes
App.js:48 Error connecting wallet: TypeError: Cannot read properties of undefined (reading 'Web3Provider')
Ethers.js has changed a lot from version 5 to version 6. You are probably using ethers.js version 6
Fix it with [email protected] version by:
npm uninstall ethers
npm i -S [email protected]
0
votes
App.js:48 Error connecting wallet: TypeError: Cannot read properties of undefined (reading 'Web3Provider')
You seem to be using ethers.js v6, so you've to migrate the provider accordingly, i.e., you've to replace ethers.providers.Web3Provider with ethers.BrowserProvider.
And, in v6, provider.getSigner() ...
0
votes
deploy the smart contract once then run it on multiple devices
It's possible to deploy a smart contract once and run it on multiple devices. Here's how:
1. Deploy the contract: Deploy the contract to any test blockchain network (e.g., Sepolia).
2. Get the ...
0
votes
Accepted
How to connect to a proxy contract with Typechain?
This issue "contract runner does not support calling" means ERC20__factory is missing runner/signer/wallet which is used to execute the function call.
You can take a look inside ...
1
vote
Accepted
Which multi-wallet connect to use in 2024?
Right now Web3Modal is widely used for Web3 marketplaces, supporting a range of wallets like MetaMask, WalletConnect, and Coinbase Wallet. It offers a good user experience, security, and easy ...
0
votes
Which multi-wallet connect to use in 2024?
I don’t think Wagmi is the best choice. As far as I know ethersjs is mostly used for development and depends on the backend.
1
vote
Combine token approval and contract invocation in a single call
Yes, but nothing widely adopted.
Some options:
Another token standard. For example ERC-777 supports callbacks, where adding approval could callback the contract that needs the approval. This standard ...
0
votes
How to create a valid signed message and obtain v, r, s for EIP-712 verification in Solidity?
Your problem can be solved if you change address payable sender,address payable srcReceiver -> address sender,address srcReceiver.
In sign typed data, we don't distinguish address is payable or not....
1
vote
Accepted
How to create a valid signed message and obtain v, r, s for EIP-712 verification in Solidity?
First of all, as mentioned in this answer, you should use the \x19Ethereum Signed Message prefix while recovering the signer of a signed message in Solidity.
So, in the verifyMessage() function of ...
0
votes
Accepted
How I can send FIL in filecoin network
This issue is resolved by increasing the "gasLimit" value to 1723354, which allows the FIL to transfer.
0
votes
Data not fetching from smart contract for the same code in different versions of "ethers"
Since you’re using ethers v5, so it should be Web3Provider instead of BrowserProvider, and you’ve to remove await, as in v5, provider.getSigner() doesn’t return a Promise of signer, instead returns ...
0
votes
Accepted
Cannot read the properties of Undefined (reading 'getContractFactory')
The error indicating that the ethers object doesn't have the getContractFactory method, It's likely due to how you're importing ethers from hardhat or how the packages installed.
1. Install ether.js 5....
0
votes
Accepted
Error: VM Exception while processing transaction: reverted with reason string '36' while running borrow function on Lending Pool contract
Error Code 36 is COLLATERAL_CANNOT_COVER_NEW_BORROW (https://github.com/aave/aave-v3-core/blob/b74526a7bc67a3a117a1963fc871b3eb8cea8435/contracts/protocol/libraries/helpers/Errors.sol#L45)
This code ...
2
votes
ethers.toBigInt(...).eq is not a function
In ethers v6, instead of eq you’ve to use the == operator for equality comparison, like:
value1 = ethers.toBigInt("1000");
value2 = ethers.toBigInt("1000");
isEqual = (value1 == ...
0
votes
ethers.toBigInt(...).eq is not a function
I think You need to try the ether.js 5.7.2 version as it is stable and works.
npm install [email protected]
Or
yarn add [email protected]
Top 50 recent answers are included
Related Tags
ethers.js × 1701solidity × 521
hardhat × 358
web3js × 279
javascript × 195
metamask × 117
react × 117
blockchain × 93
uniswap × 89
ether × 76
nodejs × 75
transactions × 69
hardhat-deploy × 59
events × 58
erc-20 × 50
testing × 50
contract-deployment × 49
web3-providers × 48
contract-development × 47
etherscan × 46
ethereumjs × 42
signature × 39
dapps × 38
uniswapv3 × 38
contract-invocation × 37