Questions tagged [ethers.js]

A lightweight JavaScript library which can be used as an alternative to Web3.js to build your JavaScript front-end and interact with the Ethereum blockchain.

Filter by
Sorted by
Tagged with
0 votes
0 answers
5 views

Verify signature from dApp on contract

I am creating a signed message using a user address, nonce and number (amount of eth to send) like this: const message = ethers.utils.solidityKeccak256( ['address', 'bytes32', 'uint256'], ...
Jesse Jacob's user avatar
0 votes
0 answers
28 views

How do I get the amount of asset i have on the pool?

I' am trying to retrieve the amount of token i have on my liquidity pool but i don't know how should i do it i've been trying to use the NonFungiblePositionManager but i can't use the token amount ...
Paucar's user avatar
  • 11
0 votes
0 answers
14 views

Setting High Gas Limit

I hope you guys are doing well! I am new to the Web3 space, so please excuse my ignorance. After viewing numerous tutorials, many of the tutorials like to do this when setting the gas limit const ...
Matt Gates's user avatar
0 votes
0 answers
30 views

How to swap tonkens in pancakeSwap using nodeJS

I need to write a script to swap tokens in PancakeSwap using NodeJS. I'm new to web3 development, so maybe I'm misunderstanding some of what I'm seeing in the various docs. I know PancakeSwap doesn't ...
Oleh's user avatar
  • 1
0 votes
0 answers
7 views

Why Get Error When Getting TX From Bianace-smart-chain(testnet) using ether.js

this is my code: import { ethers } from "ethers"; const bsc_url = 'https://data-seed-prebsc-1-s1.bnbchain.org:8545'; const provider = new ethers.providers.JsonRpcProvider(bsc_url); console....
sy liu's user avatar
  • 1
0 votes
1 answer
13 views

in cloud window.ehtereumundefined,in local window.ehtereum is object

I am developing a dapp now, deploy the dapp in local PC, it can connect with browser extension, window.ehtereum is Object, but deploy it in aws cloud, it cann't connect with browser extension, window....
spencer's user avatar
0 votes
1 answer
24 views

Ethers is not decoding the indexed parameters

I want to get the value from the first indexed parameter of the TokensTransferred event from the transaction logs which can look like this. You can see that the TokensTransferred event has the first ...
Rishabh Raghwendra's user avatar
0 votes
0 answers
21 views

Smart/Auto Slippage

Is there a typescript library which can automatically calculate your slippage for you or does someone know how to calculate it? I'm aware that we can manually fill in slippage but what I need is a ...
Arctic's user avatar
  • 1
0 votes
1 answer
14 views

React (opts:) not working, am i missing dependency?

I have a basic walletconnect web3 module here. I am following a video from https://www.youtube.com/watch?v=L65gP0cGC30 but it errors (opts:) on the example video the text actually is grayed out so it ...
Jim Mike's user avatar
1 vote
1 answer
18 views

If blockhash changes, did block become uncle?

if I first get the block hash of a block at height A. Later on I get the block hash of the block at height A again, if the block hashes differ, does that mean the first block became uncle? Example ...
Filipe Aleixo's user avatar
1 vote
1 answer
33 views

How to fetch events emitted in a deployment transaction using ethers JS?

The newest Transparent Proxy from Openzeppelin deploys the admin contract by itself and emits an event from where we can find the admin contract's address. This event is emitted during the deployment ...
Zartaj Afser's user avatar
  • 2,095
0 votes
0 answers
27 views

Hardhat MetaMask Error: Transaction decoding is not available for chainId 31337

I created a Real-Estate Decentralized Contract and connected it with Vite-React using ethers.js. I'm using Meta Mask and HardHat local network for Hardhat free Ether. I import 5 wallets of Hardhat to ...
Huzaifa Ahmed's user avatar
0 votes
1 answer
15 views

Cannot read properties of null (reading 'constructor') Etherjs error

I am trying to interact with a deployed contract at Sepolia in a hardhat test. Here's how I do it: const provider= new ethers.providers.JsonRpcProvider(process.env.ALCHEMY_API_KEY); const ...
Rishabh Raghwendra's user avatar
0 votes
0 answers
21 views

Does anyone know what uniswapRouterAddress and uniswap abi is on Sepolia network?

I am working on react native project, using v6 of ethers.js and infuria as my node. I initiate the contract like this: const uniswapRouterAddress = '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45'; ...
Scott's user avatar
  • 5
0 votes
1 answer
102 views

Uniswap - swap between Sepolia and my own erc-20 token

I am working on a React-Native crypto application for fun, and I am trying to swap my Sepolia native token with my erc-20 token that I recently deployed on remix ide on the sepolia network using ...
Scott's user avatar
  • 5
0 votes
2 answers
35 views

Gas estimation errored with the following message (see below). The transaction execution will likely fail. Returned error: invalid opcode

Unable to deploy this code on any chain. I have done all i could, cleared my browser and restarted my pc and still could not deploy. what could be the issue please. // SPDX-License-Identifier: MIT ...
Bamu Gift's user avatar
0 votes
1 answer
14 views

Verify signature result return 0x

The return signature result from signMessage method obtained is 0x. How do we handle 0x signer result from frontend? const signer = new ethers.providers.Web3Provider(provider).getSigner(); try { ...
Edwin Chen's user avatar
1 vote
2 answers
22 views

Why I can't get meta data of USDC in ethereum?

I tried to get USDC's meta data specifically symbol, name, decimals with ethers.js. However I caught below data name: '', symbol: '', decimals: 0 Are there who meet the same situation? I call ...
ttt's user avatar
  • 97
0 votes
3 answers
34 views

How to encode param of type address

I have this function in my contract: function removeRes(address _res) public onlyOwner { . . . } I'm encoding ABI like: const contractAddress = "...
stuckoverflow's user avatar
0 votes
1 answer
9 views

How do I obtain a signer object from a named account address in a Hardhat project?

In my Hardhat project, I'm using the hardhat-deploy plugin to manage named accounts, and I need to obtain signer objects associated with these named account addresses to interact with my smart ...
MShakeG's user avatar
  • 1,398
0 votes
1 answer
44 views

Infura Ethers.js jsonrpcprovider failed to detect network and cannot start up

I have tried to make Ethers.js 6.8.0 to work with Infura: endpoint = "https://sepolia.infura.io/v3/" + infuraApiKey; provider = new ethers.JsonRpcProvider(endpoint); but got this ...
Russo's user avatar
  • 1,764
1 vote
1 answer
4 views

Can anyone help me to solve this error (TypeError: contractInstance.isComplete is not a function)?

My Solidity code: // SPDX-License-Identifier: MIT pragma solidity^0.8.17; contract Lottery { address public manager; address payable[] public players; address payable winner; bool ...
balamurugan kesavan's user avatar
1 vote
2 answers
71 views

Unable to fetch events using Ethers js

I am trying to fetch two events from a contract on Goerli. One of them is being fetched correctly but the other one doesn't. The working one : let eventFilter = Core.filters.AddChannel();//Core is ...
Zartaj Afser's user avatar
  • 2,095
0 votes
0 answers
41 views

sending a transaction requires a signer (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=contracts/5.7.0)

import React from 'react'; import './App.css'; import { useState, useEffect } from 'react'; // import { ethers } from 'ethers'; import contract from './RPSLS.sol/RPSLS.json' const { ethers, ...
Indul's user avatar
  • 9
2 votes
0 answers
14 views

Why are my EIP-712 signatures different in Ruby and JavaScript?

I'm trying to sign data using EIP-712 standard and my signatures from Ruby and JavaScript don't match when the data is in bytes. They work fine when the data is a string. I'm using eth.rb in Ruby and ...
Bolo's user avatar
  • 121
1 vote
0 answers
57 views

How do you sell an ERC20 Token for ETH with Uniswap Universal Router?

I'm attempting to swap ERC20 tokens for ETH with the Uniswap Unviersal Router. When doing an ETH -> ERC20 swap everything works fine, but with the code below (Function where it is going wrong) ...
Bobby's user avatar
  • 11
0 votes
1 answer
49 views

Error while deploying on sepolia network

hardhat.config.js -> require("@nomicfoundation/hardhat-toolbox"); require("@nomicfoundation/hardhat-ethers"); require("dotenv").config(); console.log("1"); ...
Indul's user avatar
  • 9
0 votes
1 answer
29 views

Error deploying contracts: Error: incorrect number of arguments to constructor at ContractFactory.getDeployTransaction

const hre = require("hardhat"); // async function main(){ // const RPSLS = await hre.ethers.getContractFactory("RPSLS"); // const RPSLSF = await RPSLS.deploy(); // await ...
Indul's user avatar
  • 9
0 votes
0 answers
24 views

Calculate transaction fee for send transaction on Arbitrum

Trying to implement send transaction i already acknowledge that gasLimit != 21_000 for arbitrum so i also changed my approach having following script for estimating: const [feeData, to] = await ...
Andon Mitev's user avatar
2 votes
0 answers
17 views

Calculate max sendable with eip1559 fees

Fetching fees using provider rpc.getFeeData() which returns FeeData FeeData consist of 3 props: gasPrice, maxFeePerGas, maxPriorityFeePerGas gasPrice - represents legacy transaction fee ...
Andon Mitev's user avatar
0 votes
0 answers
28 views

NFT-Marketplace-Tutorial

I try to do example this tutorial. I run succesfully this. But I take error that "Upload errorTypeError: str is undefined". How can ı solve his? I did before: -> I deleted artifacts the ı ...
Kayhan's user avatar
  • 1
1 vote
0 answers
46 views

ContractFunctionExecutionError: The contract function "createCommitment" returned no data ("0x")

I am using WalletConnect's Web3Modal together with Wagmi. I am trying to use the hook provided by Wagmi -- usePrepareContractWrite and useContractWrite. Here is their documentation I applied the code ...
0xNike's user avatar
  • 13
0 votes
1 answer
18 views

Error HH8: There's one or more errors in your config file: * Invalid account: #0 for network: sepolia - private key too short, expected 32 bytes

import { HardhatUserConfig } from "hardhat/config"; import "@nomicfoundation/hardhat-toolbox"; require('dotenv').config(); const {API_URL, PRIVATE_KEY} = process.env; const ...
Indul's user avatar
  • 9
2 votes
1 answer
40 views

ethers.js library version to use to learn Ethereum development

Which version of the Ethers.js library, either v5 or v6, is recommended for me to learn and work with? I'm seeking advice on which version would be more beneficial for my current needs and future ...
Israel Ogunsola's user avatar
0 votes
1 answer
24 views

When deploying a contract on a custom blockchain using hardhat, i get BroadcastedTxDifferentHash error?

I am trying to deploy a contract to a custom EVM chain using hardhat and i get the following error BroadcastedTxDifferentHash: Expected broadcasted transaction to have hash '...
master chief's user avatar
0 votes
1 answer
21 views

tokens transfered out after swap in

I am learning ethers.js and try swap tokens via ethers.js, and my transaction succeed buy my wallet had 0 tokens. Then i checked on bscscan and found that after my 'swap' transaction succeed, the ...
Roy Fong's user avatar
0 votes
1 answer
52 views

Display token balance of test tokens

I am working on a React-Native crypto application for fun, and I am trying to show the test tokens that I have inside my metamask wallet to display on my app to display the token balances. I have ...
Scott's user avatar
  • 5
1 vote
1 answer
21 views

How does etherscan checks that the contract is ERC20, ERC721, ERC1155 standard implementation?

Suppose I created any ERC20 contract, how does etherscan recognise that the deployed contract is an ERC20?
UPENDRA SINGH's user avatar
0 votes
1 answer
48 views

Automatically getting implementation contract for eip 1967 proxy

Let's say I wanted to write code which looks at a smart contract, detects whether it is an upgradeable proxy, and then fetches the contract address. Something like so: const functionNames = abi.map((...
Abraham P's user avatar
1 vote
0 answers
10 views

error when executing swap via TG bot

Hey I’ve been getting this error trying to execute a swap with my telegram bot. I’ve tried to figure it out myself but I’m sure posting here will get to a solution quicker than I can. This is the ...
Web3Assassin's user avatar
0 votes
0 answers
15 views

Installing hardhat on an Amzon EC2 instance or on any live server

I want to deploy and maintain contracts from an ec2 instance, didn't choose lambda for time constraints reasons. I could translate everything to ethers js except contract verification which proves a ...
Ionut Țiplea's user avatar
0 votes
0 answers
27 views

Generating input data with Ethers for low level call to Uniswap Router

I'm trying to generate the input data necessary to execute a low level contract call to the Uniswap SwapRouter.exactInput method. I've done the same for the exactInputSingle successfully but can't get ...
TommyF's user avatar
  • 152
0 votes
1 answer
35 views

How to get rid of the gas estimation error in ethers.js

const fs = require("fs-extra"); const { ethers, JsonRpcProvider } = require("ethers"); async function main() { const provider = new ethers.providers.JsonRpcProvider( "...
Mahami's user avatar
  • 1
0 votes
1 answer
26 views

Send Function is not working in test file using ethers.js

I write a wallet smart contract in which one address can send ethers to other addresses. I'm using the HardHat framework and this package. when i use await addr1.sendTransaction( {to: addr2, value: ...
Huzaifa Ahmed's user avatar
0 votes
1 answer
27 views

how can i decode this transactions and see what it contain?

I'm interested in decoding the information within this transaction, which can be found at the following link: https://etherscan.io/tx/0x1013929251687ff7f6a7e2e0c7e3caae6fd93a2342dd5ad9793ff33c5802269f ...
PandaKungFuu's user avatar
1 vote
1 answer
48 views

Metatransaction EIP-712 compliant reverted on Tether USDT Polygon contract

I have a problem with the execution of a metatransaction EIP-712 compliant, I show you the backend code with ethers.js and the link of the contract on mainnet :slight_smile: Contract : https://...
Giovanni Maria Mazza's user avatar
0 votes
0 answers
29 views

Generating Ethereum Address from Mnemonic Seed Phrase in Java

I hope you're doing well. I have a question related to Ethereum address generation in Java. I'm currently working on a project and I need to generate an Ethereum address using a mnemonic seed phrase. ...
Abdul Moiz's user avatar
1 vote
1 answer
85 views

How to decode a bytes value from Ethereum event with ethers.js

I've got the following event declaration in my Solidity contract: event RemoteOrderCreated(bytes32 indexed id, uint32 indexed nonce, address indexed sender, bytes input); And I capture the event ...
Milkncookiez's user avatar
0 votes
1 answer
47 views

Error when deploying my contract and interact with him

Here is the error message : Deploying, please wait... BaseContract { target: '0x80f4D1df2Da11Ca9437A01519d3972d07E54A43E', interface: Interface { fragments: [ [ConstructorFragment], ...
Marsattak's user avatar
0 votes
1 answer
46 views

NFT transfer to a contract in ERC1155 standard

NFTS transfer from minter to contract isn't working, below is the detailed problem. NFT.sol // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.19; import {ERC1155} from "@openzeppelin/...
Shubham's user avatar
  • 13

1
2 3 4 5
32