Skip to main content

Questions tagged [etherjs]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
13 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:...
Y2kidris's user avatar
0 votes
0 answers
15 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[] ...
omerbar97's user avatar
0 votes
0 answers
22 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 ...
Roy's user avatar
  • 1
0 votes
0 answers
13 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 ...
duyanhhz's user avatar
0 votes
1 answer
42 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 ...
duyanhhz's user avatar
0 votes
1 answer
32 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");...
duyanhhz's user avatar
0 votes
1 answer
41 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 ...
R L's user avatar
  • 1
0 votes
2 answers
26 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 ...
duyanhhz's user avatar
0 votes
1 answer
35 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 ...
Eyang Daniel's user avatar
0 votes
0 answers
117 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 ...
Patok's user avatar
  • 1
0 votes
0 answers
150 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 ...
hammad ali's user avatar
0 votes
0 answers
103 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 ...
Elham Bahrami's user avatar
0 votes
2 answers
38 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 ...
forexmp45's user avatar
0 votes
0 answers
100 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, ...
shyam sharma's user avatar
0 votes
0 answers
95 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);...
shyam sharma's user avatar
0 votes
1 answer
126 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 ' ...
9192_AltonDsilva's user avatar
0 votes
1 answer
332 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) ...
David Blake's user avatar
1 vote
1 answer
90 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....
imbot's user avatar
  • 11
0 votes
1 answer
227 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. ...
Majd TL's user avatar
  • 3,237
0 votes
0 answers
100 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 ...
bero's user avatar
  • 1
0 votes
2 answers
374 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 ...
Yasir Saeed's user avatar
0 votes
1 answer
332 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 ...
DEEPAK Kumar's user avatar
0 votes
0 answers
162 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:...
Kashif Sattar's user avatar
1 vote
0 answers
110 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 ...
Rakesh Bhatt's user avatar
1 vote
0 answers
130 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]
RichMond's user avatar
2 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?
amit's user avatar
  • 390
1 vote
1 answer
363 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 ...
Yakshesh Gupta's user avatar
0 votes
1 answer
59 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 ...
heustfd gehsgd's user avatar
0 votes
1 answer
494 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() ...
Franrey Saycon's user avatar
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/...
python_rok's user avatar
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?
amit's user avatar
  • 390
0 votes
1 answer
24 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?
amit's user avatar
  • 390
0 votes
1 answer
360 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 ...
Sprint's user avatar
  • 3
0 votes
0 answers
245 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 ...
Nunce.ether's user avatar
1 vote
0 answers
77 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 ...
Hamza Yasin's user avatar
0 votes
0 answers
235 views

ether.js ethers.utils.defaultAbiCoder.decode [ [Getter] ] result

ethers.utils.defaultAbiCoder.decode(['address'],'...
user10834730's user avatar
1 vote
1 answer
452 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', ...
Neo Liu's user avatar
  • 117
1 vote
0 answers
237 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:/...
user6894661's user avatar
1 vote
0 answers
714 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 ...
smenir443's user avatar
  • 125
0 votes
1 answer
109 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
HARI SUDARSAN's user avatar
0 votes
2 answers
637 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....
VDS-Atomic's user avatar
1 vote
1 answer
908 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 ...
Ad-h0c's user avatar
  • 978
1 vote
1 answer
366 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 : ...
CodeGuru's user avatar
  • 111
0 votes
2 answers
442 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 `...
Abhishek Yadav's user avatar
0 votes
2 answers
71 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?
Rohit Mittal's user avatar
0 votes
1 answer
116 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.
Syed Murtaza Ali Shah's user avatar
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 ...
Reginal's user avatar
  • 75
0 votes
1 answer
469 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 ...
crypto S.'s user avatar
  • 345
2 votes
0 answers
300 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'}, ...
d3f2's user avatar
  • 31
4 votes
2 answers
4k 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-...
Majd TL's user avatar
  • 3,237