Questions tagged [etherjs]
The etherjs tag has no usage guidance.
40
questions
4
votes
2
answers
3k
views
How to mock smart contract function for testing (in hardhat)
In my Test I want to mock an external function that I call inside my smart contract to test both conditions without writing and deploying an extra fake smart contract.
My Contract
//SPDX-License-...
2
votes
1
answer
2k
views
Uniswap Universal Router - Decoding the Execute function parameters
I used the method described in this thread (Decode Uniswap Universal Router transaction in ethers.js) and decoded most of the data of a transaction at this link: https://arbiscan.io/tx/...
2
votes
1
answer
794
views
Can someone explain me providers and the different types of it?
I can make providers using ether-hardhat, alchemy, and metamask. What is the difference between these?
2
votes
2
answers
908
views
How do node providers (e.g. Infura, Alchemy) determine gas pricing on contract writes?
When writing to a smart contract, we can specify the priority and fee per gas.
await contract.connect(owner).foo({
maxFeePerGas: "<YOUR FEE>"
maxPriorityFeePerGas: "<YOUR ...
2
votes
0
answers
290
views
How to listen for multiple smart contract events?
Using Web3.py I understand that I can create a new smart contract event filter with:
Contract.events.your_event_name.createFilter(fromBlock=block, toBlock=block, argument_filters={'arg1': 'value'}, ...
1
vote
2
answers
670
views
Difference between provider.sendTransaction vs signer.sendTransaction?
I am finding it difficult to see the difference between these two, what are their respective use cases?
1
vote
1
answer
31
views
Please somebody help me with this error in getting transactionReceipt : "TypeError: contract.deploymentTransaction.wait is not a function"
const ethers = require("ethers");
const fs = require("fs-extra");
async function main() {
// http://127.0.0.1:7545
let provider = new ethers.JsonRpcProvider("http://127.0....
1
vote
1
answer
299
views
How to read a transaction in human readable format using web3?
I am using Alchemy API as my web3 provider and got a transaction data like this below:
{
blockHash: null,
blockNumber: null,
from: '0xa12e1462d0ced572f396f58b6e2d03894cd7c8a4',
gas: '0x440f0',
...
1
vote
1
answer
668
views
How to get ABI from the source code programmatically?
Is it possible to get an ABI from the source code without using solc compiler? Like I can get source code of verified contracts through etherscan API and I want to convert it into ABI.
Are there any ...
1
vote
0
answers
86
views
Unable to run concurrent contract executions on polygon mainnet (Alchemy)
I'm currently encountering a peculiar issue on the Polygon Mainnet, which doesn't seem to occur on the Testnet. When running two or more parallel node processes which have two different wallets with ...
1
vote
0
answers
98
views
Sushi swap Flash swap [closed]
I'm trying to arbitrage between sushi and uniswap whats the smart contract to arbitrage from sushi swap to uniswap , [fl
ash loan from sushi]
1
vote
1
answer
236
views
Not able to send transaction using alchemy sdk
Hey i have to build a ERC20 contract and using alchemy sdk to send transactions onchain
For eg mint or burn tokens. But i am not able to send a transaction as its showing an error of cannot estimate ...
1
vote
0
answers
69
views
Getting wrong signature while using etherjs in react native
I'm trying to get the signature using etherjs in a react native project which should be compatible with ECDSA.sol,
When i try to get the signature with metamask it returns totally fine. but when i try ...
1
vote
0
answers
228
views
nextjs, etherjs, invalid address or ENS name
I'm using Nextjs.
on sample.jsx
console.log(address)// 0xd56A6DB7d844722627473C07f840c2604E622161
console.log(typeof(address)) // string
const ethers = require('ethers')
let url = "https:/...
1
vote
0
answers
519
views
getCreate2Address (create2) UNABLE to get correct contract address :(
UPDATE: I think the real question is what to use as Init code? The contract has no constructor. Can someone help on this?
Basically i am using openzeppelin Clones.sol contract to determine the ...
1
vote
1
answer
321
views
Contract Factory Deploy Function Variables
I noticed you can actually put 3 arg into the deploy functions
.deploy(0,0,0)
min 3 , what is the purpose of the 3 variables. I. can't seem to find it on the documentation
Documentation Reference : ...
0
votes
1
answer
133
views
simulate a transaction considering another pending transaction
I have the following problem and have hard time to simulate it to get the answer.
Let say I have a 5 WETH tokens.
I sent transaction X with nonce 1 to transfer 5 tokens from Account A to Account B. ...
0
votes
2
answers
66
views
Mismatch in WETH shown in Metamask wallet and shown by code
tokenContractAddress is 0xc778417E063141139Fce010982780140Aa0cD5Ab
on execution, returns
but balance of WETH in my wallet is 2 WETH as i can see.
How is it possible?
0
votes
1
answer
90
views
TypeError: Cannot read properties of undefined (reading 'match')
I'm new to Solidity and ether js. I'm stuck with error below in VSCode. Can anybody help explain what this error means and advise how to fix this? Thank you so much!
ERROR BELOW:
(node:5884) ...
0
votes
1
answer
162
views
Is it possibleimpersonate an account using only ethers.js without using Hardhat
Is it possible to impersonate an account using ether js only? I don't want to use Hardhat. Though I have forked mainnet using foundry. Now wants to transfer eth of let's say vitalik to my own account ...
0
votes
1
answer
20
views
Why am I facing error here? Related to signing transactions
Why this error occuring?? Can someone direct me to some good resources where I can see what units to provide in the parameters?
0
votes
1
answer
213
views
InvalidInputError: Received invalid block tag 642829559307850963015472508762062935916233390536. Latest block number is 1
After compiling the below dead-simple contract
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.9;
contract SendWei {
function sendWei(address payable recipient, uint256 amount) public ...
0
votes
1
answer
95
views
I am getting this error when I deploy my contract in ganache using the command node deploy.js
I am getting this error when I deploy my contract in ganache using the command node deploy.js
0
votes
1
answer
364
views
How to Call a payable function I am getting error={"code":-32603,"message":"Internal JSON-RPC error.","data":{"code":3,"message":"execution reverted"}
I am trying to call buy function which is a payable function using metamask signer method. I am getting error for sending incorrect ether value. Here I have set the price as 1 which is 0x01 in hex ...
0
votes
0
answers
22
views
Signature verification using ecsign and ecrecover
I am using web3.js library to sign a transaction and then verify it from the smart contract. The Signature generated on FrontEnd and as well as from the smart contract are not same..
This is the ...
0
votes
0
answers
27
views
Cannot read properties of undefined (reading 'getDefaultChain')
in this code when i want call the function from contract i get this error: Cannot read properties of undefined (reading 'getDefaultChain')
i use walletConnect V2 for connecting wallet and use etherjs ...
0
votes
2
answers
24
views
Js result into HTML
Hello hope everybody is good ?
I need some help please ..
I run my JS file and it return in my console with await function = 56
How can i parse the return (56) into my HTML in a <div ?
This is my ...
0
votes
0
answers
24
views
hardhat simple storage. Getting ProviderError: Must be authenticated!
**I am going through freecodecamp's course on fullstack web3 development. Can anyone help me with this error. Am not able to resolve this issue. **
Deploy.js code :
// imports
const { ethers, run, ...
0
votes
0
answers
28
views
code: 'UNPREDICTABLE_GAS_LIMIT, Error: cannot estimate gas
Error:
Code:
const ethers = require("ethers");
const fs = require("fs-extra");
require("dotenv").config();
async function main() {
console.log(process.env.PRIVATE_KEY);...
0
votes
1
answer
44
views
Help! Getting Error ' Cannot read properties of undefined (reading 'then')' How do I make a Contract Transaction using EtherJS v6
I tried making request to the contract using 'contract.otherFunction()' and they are working fine but just the 'placeBid' function where I have to use add value is giving the error 'Getting Error ' ...
0
votes
0
answers
59
views
Seeking Help with React Typescript App and Ether.js - Trouble with Tuple Arguments
I'm currently working on a React Typescript app that involves interacting with contracts on the blockchain using Ether.js. While making progress, I've encountered a hurdle that has me scratching my ...
0
votes
1
answer
103
views
Error: network does not support ENS (operation=“ENS”, network=“maticmum”, code=UNSUPPORTED_OPERATION, version=providers/5.5.3 Network doesnot support
Hello I wrote a smart contract for crowd funding Actually I have two contracts One is create a campaign for donate funds and second is created campigns for crowd-funding and store all the campaigns ...
0
votes
0
answers
131
views
Error: cannot override "to" (operation="overrides", overrides=["to"], code=UNSUPPORTED_OPERATION, version=contracts/5.6.2)
I'm facing this error while I'm trying to mint with sending transaction
const tx = {
from: accounts[0],
to: ContractAddress,
value:...
0
votes
1
answer
44
views
reactjs get contract call fees
Chain used: Poylgon/mainnet or mumbai
I am trying to get gas fees for a contract call.
I should be able to let user chose if : Medium or High
Same as metamask does it:
but this should be done on user ...
0
votes
1
answer
375
views
Signatures created in metamask with ledger is being rejected by ECDSA.recover
Some context.
The frontend right now is using wagmi under the hood, we are using the signMessageAsync method to generate a signature. Code is below
const { signMessageAsync } = useSignMessage()
...
0
votes
0
answers
184
views
why am i getting this big number error. I have tried everything but cannot figure it out
I am trying to run the scripts for uniswap V3. I am able to mint the positions and check the position but I cannot increase or decrease the liquidity by calling these functions. I get the following ...
0
votes
0
answers
187
views
ether.js ethers.utils.defaultAbiCoder.decode [ [Getter] ] result
ethers.utils.defaultAbiCoder.decode(['address'],'...
0
votes
2
answers
473
views
Deployed an ERC20 with Hardhat, trying to mint token but getting "TypeError: _mint is not a function"
A bit of messing around with Hardhat and ERC20 deployments. I've deployed a created and tried to mint tokens for an account using this small snippet of code:
const ERC20 = await hre.ethers....
0
votes
2
answers
368
views
I am getting this error everytime i test my contract using hardhat
This is the error i am getting while testing my contract with hardhat pls help me to get this
PS E:\vs code files> npx hardhat test
npm WARN config global `--global`, `--local` are deprecated. Use `...
0
votes
1
answer
94
views
Can I make a transaction using Etherjs without signer?
Is it possible in EtherJS to execute a transaction/s without using signer ? Or If we could setup the signer one time and use that signer indefinitely.