Questions tagged [javascript]

JavaScript is a dynamic, weakly-typed language used for client-side as well as server-side scripting.

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

Getting incorrect signer address on verifying the signature with the generated hash of the signed message in solidity

Basically on verifying the signature with the generated hash of the signed message, I'm getting the correct signer on JS, but not on Solidity. JS Code: const ethers = require('ethers'); const ...
SYED ASAD KAZMI's user avatar
0 votes
1 answer
15 views

getPublicKey is not a function

I'm trying to generate public key from private key using secp256k1, but I'm getting error saying: getPublicKey is not a function const { getPublicKey, ecdsaSign } = require("ethereum-cryptography/...
That Web3 Guy's user avatar
2 votes
1 answer
40 views

Need help with abi decode and encode

the solidity data structure and code is as follows : struct Order { bytes32 sender; int128 priceX18; int128 amount; uint64 expiration; uint64 nonce; } ...
Invented Most's user avatar
1 vote
1 answer
26 views

Solidity Error; TypeError: Struct containing a (nested) mapping cannot be constructed

I tried modify the castVote function to allow voters to change their vote on a particular proposal.I also tried to figure out a new way to track which addresses have already voted on which proposal. ...
uninoved's user avatar
1 vote
0 answers
27 views

Web3 Provider not available. Use `.setProvider` or `.provider=` to initialize the provider

Modified today Viewed 2 times 0 Hi i cain't get my code to work as it use to a few months back and I caint figure out why can anyone support I appreciate it, I tried a few things but none worked. I ...
David Dacruz's user avatar
2 votes
2 answers
204 views

TypeError: invalid BytesLike value (argument="value", value=[ ], code=INVALID_ARGUMENT, version=6.10.0) in testing Raffle Contract

While testing the Raffle contract, I am getting error in the line written "await network.provider.send("evm_increaseTime", [Number(interval) + 1]); await network.provider.send("...
Nikhil Raj's user avatar
0 votes
1 answer
18 views

I met an issue when I tried to test my smart contract, which is :AssertionError: expected undefined to equal 17

This is smart contract. // SPDX-License-Identifier: MIT pragma solidity ^0.8.7; contract SimpleStorage { uint256 favoriteNumber; Person public person = Person({favoriteNumber: 2, name: "...
rocco zha's user avatar
0 votes
1 answer
543 views

Instead change the require of chai.js in to a dynamic import() which is available in all CommonJS modules

.js file const { expect } = require('chai'); describe("Token contract",function(){ it("Deployment should assign the total supply of the owner", async function(){ const[owner] =...
Vaibhav_01's user avatar
0 votes
0 answers
14 views

Declaration "ERC721" not found in "c:/Users/

//SPDX-License-Identifier: Unlicense pragma solidity >=0.8.0; import {ERC721} from "@openzeppelin/contracts/utils/Counters.sol"; // i get error in this line import {ERC721} from "@...
Royhan Nulloh's user avatar
0 votes
1 answer
37 views

Getting EVM error when trying to call a basic contract using Javascript

I am a complete beginner when it comes to writing javascript so bear with me. I want to write a basic .js file that I can run that will be able to sell something for BNB (in this case a very small ...
Jewbacca79's user avatar
0 votes
1 answer
26 views

ethers sendTransaction times out

I am using Remix IDE with the Remix VM (Shanghai) environment. In a Javascript unit test, I would like to send Ether from the main account to another account. Here is a minimal reproducible example: /*...
Max Poofing's user avatar
0 votes
1 answer
19 views

Why do i keep getting some transaction failed CALL_EXCEPTION error when sending a transaction through client

i have created a function that should allow me to join a channel for a price. this is like some on and off type of thing. It worked yesterday and now it doesnt want to work. I am pulling my hair out ...
lyub12's user avatar
  • 1
0 votes
0 answers
58 views

Error HH19: Your project is an ESM project (I already tried to changed chai from ^5.0.0 to ^4.3.7 but still failed)

When I tried to npx hardhat compile, error HH19 showed up I already changed the chai from ^5.0.0 to ^4.3.7 and changed the file name from js to cjs, and the error still shows up. Any ideas on how to ...
aoki's user avatar
  • 1
0 votes
1 answer
518 views

Error HH19: Your project is an ESM project (you have "type": "module" set in your package.json) but your Hardhat config file uses the .js extension

Error: Error HH19: Your project is an ESM project (you have "type": "module" set in your package.json) but your Hardhat config file uses the .js extension. Rename the file to use ...
Plair's user avatar
  • 21
0 votes
1 answer
38 views

Unable to connect ganache with Hardhat

I am not being able to connect hardhat to the local ganache network. I have already connected the ganache to the metamask. Here is my hardhat.config.js code: /** @type import('hardhat/config')....
imbot's user avatar
  • 11
0 votes
1 answer
30 views

Where Do I Get A WETH Flashloan On Goerli Ethereum?

I'm trying to test a flashloan on goerli ethereum. It seems AAVE may no longer be supporting this for WETH flashloans (if they ever did). Anybody know how I can run test Flashloans on Goerli ...
Trent Kennelly's user avatar
0 votes
0 answers
10 views

console.table return undefined and can't show value returned from a function?

Hello everybody hope all is good ? I need help please, I have 2 functions : 1st return a value after fetching and url(api) and 2nd it log in table value returned but it didn't work :( This is my code :...
forexmp45's user avatar
0 votes
1 answer
31 views

Liquidity transfer from A user to B user

How can I make option for user transfering his liquidity pool value (withdraw it) to user B? Maybe it’s uniswap router, transfering LP tokens from wallet or what?
Hahan't's user avatar
  • 103
0 votes
1 answer
20 views

I want to know a Contract address verified or not by programatically

I am having Token Names , Token Symbols and token addresses , I want to know that a Particular Contract address is verified or not by programmatically , but I don't want to use BSCSCAN API endpoint , ...
Bhushan Dhiware's user avatar
1 vote
0 answers
26 views

How are Ethereum 2.0 (post merge) block hashes computed?

I found in this link on Ethereum Stack Exchange that a block hash is calculated by using const blockData = [ block.parentHash, block.sha3Uncles, block.miner, block....
jistro's user avatar
  • 11
0 votes
1 answer
47 views

TransactionRevertedWithoutReasonError - How Do You Debug This‽

I've seen the question countless times on here, but it's always unique to the smart contract, so I feel like I need to ask it again. This is based off of a smart contract I'm testing on Goerli. I ...
Trent Kennelly's user avatar
1 vote
3 answers
23 views

Frontend & Solidity union skills learning [duplicate]

if I'm going to learn solidity, but I don't know for sure whether I want to be a blockchain developer or a front-end developer, what skills are in demand in that area, so that learning solidity will ...
iippuf's user avatar
  • 11
0 votes
0 answers
66 views

Ethers Js v6 vs v5

What is the current consensus on the stability of Ethers.js v6 for development, and are there any recommended reasons or scenarios where using Ethers.js v5 might be preferable over v6? Or is Ethers ...
Jenin Immanuel J's user avatar
0 votes
0 answers
45 views

Error: Package subpath './lib/utils' is not defined by "exports" in

yasstns@DESKTOP-LJ7VL5E:~/hh-fcc/hardhat-fund-me-fcc$ yarn hardhat yarn run v1.22.15 warning package.json: No license field $ /home/yasstns/hh-fcc/hardhat-fund-me-fcc/node_modules/.bin/hardhat An ...
Yassine's user avatar
1 vote
0 answers
21 views

Contract Call unrecognized-selector

function initiateBet(uint256 amount) external { require(amount > 0, "Betrag muss groesser als 0 sein"); //require(choice != BetOutcome.NotSet, "Ungueltige Wahl"); //...
Domenico Sanfilippo's user avatar
0 votes
0 answers
43 views

Getting error when connecting my ether js websocket provider to local node web socket server

So I am building my backend to listen for events. So I used the websocket provider of ether js to listen. Since it requires a websocket server url so I built my local websocket server. But I am ...
Arnab Chatterjee's user avatar
0 votes
0 answers
21 views

Error: cannot estimate gas; transaction may fail or may require manual gas limit. I cannot see which gas limit it refers

I am trying to deploy a SimpleStorage solidity contract using javascript on WSL studio and Ganache. The terminal talks about gas fees though neither my solidity code nor my javascript code talks about ...
Samuel's user avatar
  • 1
0 votes
0 answers
84 views

ERC20 Multisend works on Sepolia Testnet but Fails on Mainnet

I've got a smart contract function that takes an erc20 contract address, an array of addresses and an array of amounts and then sends the each amount to each address of the specified token. I've got ...
nultinator's user avatar
0 votes
1 answer
27 views

Methods not appearing when printing contract but do appear on Etherscan

I have a goerli testnet contract you can check out here. I'm trying to call executeFlashLoan using a javascript function using web3js, but the code acts as if the function doesn't exist. However, it'...
Trent Kennelly's user avatar
0 votes
0 answers
22 views

Is there documentation for web3 .request(...) method?

I created a js web3 app that sends a transaction with the final line of code: const receipt = await web3.eth.sendSignedTransaction(tx); Now, I would like to send multiple transactions via web3's ...
deniskov's user avatar
0 votes
1 answer
89 views

typeError: Cannot read properties of undefined (reading 'format')

I am getting this error whenever I run my hardhat deploy script for uniswap pool contract : TypeError: Cannot read properties of undefined (reading 'format') at Function.from (/home/abdulaleem/token/...
Abdul Aleem's user avatar
0 votes
0 answers
85 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
1 answer
16 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
0 answers
42 views

InvalidResponseError: Returned error: The method eth_sendTransaction does not exist/is not available

I'm trying to interact with a smart contract on BSCtest using web3. I think the error occurs in this line rs = await TokenContract.methods.transfer(receiverAddress, 100000).send({ from: myAddress, ...
Ngọc Minh Nguyễn's user avatar
0 votes
0 answers
39 views

React Dapp, Wont notify user after successful TX

This is my "Test" dapp which i am building, i am struggling to call an event handler to check if the user has approved spending on a certain contract, in this case USDt ...
Jim Mike's user avatar
0 votes
0 answers
73 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
2 answers
128 views

Callback After Dapp Approval

I have had a contract made for me, and a dapp set up by a developer. My question is how can i produce an event on my website when the user has approved spend of a certain token? Can i use a javascript ...
Jim Mike's user avatar
0 votes
1 answer
51 views

Signature verification using web3js

I am using web3 library to sign a transaction and then verify it from the smart contract. The signature is not verifying. This is the frontend code const DomainSeparator = ethers.keccak256( ...
Abdul Samad's user avatar
1 vote
1 answer
56 views

Getting error when I trying to test my contract

I started coding project and I got error when trying to test him. When I trying to call some contract function from js tester i got error: Error: call revert exception [ See: https://links.ethers.org/...
Victor's user avatar
  • 35
0 votes
0 answers
20 views

Cant get metamask accounts balances in right way I want

I 'm making a website for faucet and purchasing nft just for practice and get better at solidity and js cant get metamask accounts balance in the right way I want which is string or integer. JS CODE ...
seojunchian's user avatar
0 votes
2 answers
31 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
3 answers
62 views

Solidity - Trouble Installing Foundry: SSL Connection Timeout"

I'm encountering an issue while trying to install Foundry using the command curl -L https://foundry.paradigm.xyz | bash. The process times out with the error message: % Total % Received % Xferd ...
Temisan Momodu's user avatar
1 vote
1 answer
12 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
0 votes
1 answer
130 views

Error with npm run start. code: 'MODULE_NOT_FOUND',

npm run start > [email protected] start > react-scripts --openssl-legacy-provider start node:internal/modules/cjs/loader:1051 throw err; ^ Error: Cannot find module './nodes' Require ...
imbot's user avatar
  • 11
2 votes
0 answers
30 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
0 votes
0 answers
19 views

Swap Box and Token modal stopped rendering on the browser

Originally, it was a swap built on Ethereum fetching token quotes & prices via api. That version functions as intended Now, I am working implementing conditional logic to fect the token list and ...
Dorian_Gallo's user avatar
2 votes
1 answer
83 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
50 views

Rejecting the transaction doesn't catch the error in try-catch block

I am working on a Dapp porject ,Where I have to catch the metamask error. Here is my code: import React, { createContext, useContext, useEffect, useRef, useState, } from "react"; ...
Asir Shahriar Roudra's user avatar
1 vote
0 answers
11 views

I can't create a new instance of a contract from a factory contract when using a js script but unit test ok

I have 2 SC: Factory contract that creates new instance of the 2nd contract via a function: function createCollection(string memory _name, string memory _symbol, uint16 _maxNFT) public onlyOwner { ...
Noa's user avatar
  • 11
1 vote
1 answer
147 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
  • 103

1
2 3 4 5
28