Hot answers tagged

6 votes
Accepted

Uniswap Universal Router - Decoding the Execute function parameters

You are correct that the V3_SWAP_EXACT_IN itself takes in 5 parameters. But the 4th parameter(path) is a bytes array, and they also include fees and a number of offsets to properly build the path. You ...
tetsuroba's user avatar
  • 161
5 votes
Accepted

How to mock smart contract function for testing (in hardhat)

make sure you have installed the extra packages npm install --save-dev @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers ethers and then use Waffle for that. waffle provides a ...
Majd TL's user avatar
  • 3,207
3 votes

Difference between provider.sendTransaction vs signer.sendTransaction?

Hi Developer advocate from Chainstack here. Basically provider.sendTransaction takes in a hexed string of signed tx as its parameter. signer.sendTransaction takes a transaction object as the parameter....
Wuzhong - Chainstack DevEx's user avatar
2 votes
Accepted

Mismatch in WETH shown in Metamask wallet and shown by code

It seems you are checking balance of contract in code , whereas in metamask , you are chcking balance of weth in the user address.
Ashish kumar's user avatar
2 votes
Accepted

How do node providers (e.g. Infura, Alchemy) determine gas pricing on contract writes?

yes, ethers.js .getFeeData() returns hardcoded values and they are used as defaults to send a type2 (eip-1559) transaction if the network supports it, otherwise, gasPrice is used with the legacy ...
ihor.eth's user avatar
  • 195
2 votes
Accepted

How to read a transaction in human readable format using web3?

it's not difficult. try this. To convert the gas and value fields from a hash to Gwei or Ether, you can use the web3.utils.fromWei() method provided by the Web3 library. This method takes the value in ...
david fnck's user avatar
2 votes

Difference between provider.sendTransaction vs signer.sendTransaction?

A signer is a concept from ethersjs ( check their docs). Basically, it's a provider (another ethersjs concept, perhaps a little more transparent, that is just an abstraction of a connection to the ETH ...
Foxxxey's user avatar
  • 4,287
2 votes
Accepted

Can someone explain me providers and the different types of it?

The main difference between then is the infrastructure they use to connect to the Ethereum network - they also offer different features. Think of them as different services that will allow you to ...
timsntech's user avatar
  • 618
2 votes

Please somebody help me with this error in getting transactionReceipt : "TypeError: contract.deploymentTransaction.wait is not a function"

remove this line: const transactionReceipt = await contract.deploymentTransaction.wait(1); And replace it by this: const transactionReceipt = await contract.deploymentTransaction().wait(1); ...
Al-Qa'qa''s user avatar
  • 296
2 votes
Accepted

simulate a transaction considering another pending transaction

Ethers6 staticCall, same as Ethers5 callStatic method, sends the eth_call RPC request. The nonce parameter is not supported, so it has no effect. The mempool for eth_call is completely ignored, and by ...
tenbits's user avatar
  • 2,104
1 vote

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

UPDATE to above question! So after several attempts, it seems I have found the culprit. For some reason, the network provider name ("sepolia") I entered with getDefaultProvider function does ...
David Blake's user avatar
1 vote

Is it possibleimpersonate an account using only ethers.js without using Hardhat

here is the solution to impersonate account when we forked the mainnet using foundry. then we can use ether js to transfer eth from any whale account. why is it important because we always have ...
DEEPAK Kumar's user avatar
1 vote
Accepted

Why am I facing error here? Related to signing transactions

GasLimit should be a number, not a string.
Nal Luksic's user avatar
  • 1,087
1 vote
Accepted

InvalidInputError: Received invalid block tag 642829559307850963015472508762062935916233390536. Latest block number is 1

There are two things at issue here, Function sendWei is not payable. Since you are transferring funds the function should be payable. While sending some funds, it is not passed as a parameter to the ...
vampireAb's user avatar
  • 148
1 vote

I am getting this error when I deploy my contract in ganache using the command node deploy.js

The provider declaration should have been: const provider = new ethers.providers.... new keyword was missing.
HARI SUDARSAN's user avatar
1 vote
Accepted

How to get ABI from the source code programmatically?

In theory, you could create your own code that creates the ABI of a contract given the source code of that contract, reading the function's name and parameters and producing a javascript/JSON output, ...
Jeremy Then's user avatar
  • 4,579
1 vote

How to Call a payable function I am getting error={"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":3,"message":"execution reverted"}

when you call await contract.buy(0), you are passing 0 as the param (which is _tokenId) and not the value. The first thing it excecute is require(msg.value == 1, 'Incorrect value'); msg.value here is ...
femanzo's user avatar
  • 11

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