Questions tagged [etherjs]
The etherjs tag has no usage guidance.
49 questions
0
votes
0
answers
27
views
USDT token contract on Polygon Mainnet is unable to verify the signature on calling `executeMetaTransaction()`
USDT token contract (Polygon Mainnet): 0xc2132d05d31c914a87c6611c10748aeb04b58e8f
Here's the frontend code that I'm using:
import React, { useState } from "react";
import { ethers } from &...
0
votes
1
answer
24
views
TypeError: X is not a function (Uncaught (in promise) error)
I'm currently working on this specific issue when using state-changing contract methods using ethers 6.13.2. I've tried searching up similar issues and examples of this error but have not gotten any ...
0
votes
1
answer
98
views
Getting Undefined when trying to estimate gas with Etherjs
const escrow = new ethers.Contract(config[network.chainId].escrow.address, Escrow, provider)
const gasEstimate = await escrow.estimateGas.depositEarnest(home.id, true, {
value: ethers....
0
votes
0
answers
174
views
my api key is being signaled as having a syntax error on a script i'm using to send to a private transaction on optimism network
file:///C:/Users/HP/private-sendtx/sendPrivateTx.mjs:7
const { rVCbipD-Y1F, "private_key is here" } = process.env;
SyntaxError: Unexpected token '-'
at ModuleLoader.moduleStrategy (node:...
0
votes
0
answers
26
views
Executing contract function to change Contract state
i am trying to execute function that changing the state of the contract, currently i am testing it on my localhost hardhat node.
this is my function (in my contract)
address owner;
string[] ...
0
votes
0
answers
27
views
How to solve Delay while calling contract method
I have a contract which has a trigger button and am calling that trigger on every 30 seconds so what i need is instant change in the contract as i have conditions to match and it is basically a time ...
0
votes
0
answers
24
views
Public mint but merkle proof exists
I want to programmatically mint this Base Mainnet NFT: NFT Base Scan code
The mint is open to everyone, but when I decode my transaction: TX Link, I can see that there still exits merkle proof that is ...
0
votes
1
answer
168
views
Transaction execution reverted on swapExactTokensForETH
I hope somebody can help
I am trying to sell a token via Uniswap V2 Router02 (Token CA: 0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed) (This token is a legit one, there is no scam here), I have ...
0
votes
1
answer
82
views
SwapRouter02 not working with custom ERC20 token
I am trying to programmatically swap ETH for a custom ERC 20 token (let me take a meme token as an example)
Here is my code that I swapped ETH for USDC:
const { ethers } = require("hardhat");...
0
votes
1
answer
146
views
Invalid parameters: must provide an Ethereum address
I am using ethers.js and Blocknative to connect wallets for my DApp.
I have both MetaMask and OKX Wallet extensions installed on Chrome. Under certain circumstances, when initiating interactions, I ...
0
votes
2
answers
30
views
Gas estimation error when trying to send ERC 20 to multiple addresses
I was trying to programmatically send ERC 20 tokens from one wallet to multiple other wallets
Here is the code from Disperse App that I referenced to:
//SPDX-License-Identifier: UNLICENSED
pragma ...
0
votes
1
answer
67
views
Connected to a proxy function but getting an error when I call the transfer function of the implementation contract
I'm currently working on a project where I can transfer USDC from my account to another directly, provided I have my provider and private key, programmatic. So I connected to a proxy contract on the ...
0
votes
0
answers
196
views
Chain doesn't support EPI-3855 and broke front end?
I'm trying for 3 days now to make this work, but i'm always getting these errors:
Deploying to local:
EIP-3855 is not supported in one or more of the RPCs used.
Unsupported Chain IDs: 31337.
Contracts ...
0
votes
2
answers
39
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 ...
1
vote
0
answers
264
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
164
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
1
answer
509
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) ...
1
vote
1
answer
131
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....
0
votes
1
answer
281
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
588
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
1
answer
426
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
0
answers
180
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:...
1
vote
0
answers
116
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
147
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]
3
votes
1
answer
1k
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?
1
vote
1
answer
428
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 ...
0
votes
1
answer
73
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
565
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()
...
3
votes
1
answer
4k
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/...
1
vote
2
answers
1k
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?
0
votes
1
answer
25
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
498
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
0
answers
274
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 ...
1
vote
0
answers
83
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 ...
0
votes
0
answers
259
views
ether.js ethers.utils.defaultAbiCoder.decode [ [Getter] ] result
ethers.utils.defaultAbiCoder.decode(['address'],'...
1
vote
1
answer
584
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
0
answers
245
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
887
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 ...
0
votes
1
answer
111
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
2
answers
764
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....
1
vote
1
answer
1k
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
1
answer
392
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
2
answers
493
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
2
answers
75
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
132
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.
2
votes
2
answers
1k
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 ...
0
votes
1
answer
536
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 ...
2
votes
0
answers
313
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'}, ...
4
votes
2
answers
5k
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-...