1 vote

how to find how much usdc should i want to add if i need to add 1 eth. How to calculate this?

For Uniswap V2 You can use the getAmountIn function of the Uniswap V2 Library, which can be called from the corresponding function of the Uniswap V2 Router and it'll return the minimum input asset ...
SYED ASAD KAZMI's user avatar
1 vote
Accepted

Error in Chainlink Functions source script with EthersJS for Writing to smart contract

Since the FunctionsJsonRpcProvider class is inheriting ethers.JsonRpcProvider and overriding its _send() function. So, it seems to be supporting only read methods, and failing in case of write methods....
SYED ASAD KAZMI's user avatar
1 vote
Accepted

With ethers.js v5, how to get the reverted message string or reverted reason?

(Updated solution) First of all, you can get the txHash this way: const response = await myContract.myMethod(); receipt = await response.wait(); txHash = receipt.transactionHash; // ... This should ...
Mila A's user avatar
  • 1,179
1 vote

ethers.utils.solidityKeccak256 in hardhat test file

If you are on ethers v6, try this: const message = ethers.solidityPackedKeccak256( ['address', 'bytes32', 'uint256'], [userAddr, nonce, ammount] );
user133751's user avatar
1 vote

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

With ethers@v5 const provider = new ethers.providers.JsonRpcProvider(RPC_URL); With ethers@v6 const provider = new ethers.JsonRpcProvider(RPC_URL);
0xcuonghx's user avatar
  • 166
1 vote

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

npm install [email protected] const provider = new thers.providers.JsonRpcProvider("http://127.0.0.1:7545" ); option 2. Have latest version and in use const { ethers, JsonRpcProvider } = require(...
Devloper's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible