Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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
9 views

How to fetch the transaction amount from Arbiscan using Node.js

I am facing challenges when I try to fetch the transaction amount from Arbiscan (using Arbiscan API). I want to fetch the transaction amount of my latest transaction using Node.js. The following ...
Timofey Kupriyanov's user avatar
0 votes
1 answer
15 views

Error: Timeout of 2400000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves

When I try run my unit test ("hh test" or "yarn hardhat test") in ethersV6, for some reason it doesn't enter in my Promise's test because even doesn't appear the console.log(). The ...
Tucan's user avatar
  • 3
0 votes
1 answer
15 views

Reading Ethereum contract event TypeError: Cannot read properties of undefined (reading 'toHexString')

I have the following js script that i want to use to read events from a smart contract below, but when i run the script I get the following error message TypeError: Cannot read properties of undefined ...
Osemu Aimiosior's user avatar
0 votes
1 answer
13 views

Converting Eth price correctly in JS

I have this snippet const conversionFactor = calculateConversionFactor(amountToSendFloat); console.log('the conversion factor is', ...
ROY BURSON's user avatar
0 votes
2 answers
27 views

JsonRpcProvider not Found in ethers.js

I'm building a JavaScript application where I'm trying to interact with the Ethereum blockchain using ethers.js. However, I'm encountering an error stating that JsonRpcProvider is not found. This ...
Kuldeep Sonara's user avatar
0 votes
0 answers
17 views

Ethereum Transaction Data Decoding

My question is regarding the decoding of transaction data. Specifically, when combing the Ethereum mainnet mempool and getting the transaction data for a transaction. How would I go about getting the ...
Max.Koeg's user avatar
1 vote
1 answer
11 views

Best path search on DEXes

I'm currently working on a project that involves implementing a best path searcher for multi-hop swaps in JavaScript. Specifically, I'm looking for a code sample or library that can efficiently find ...
adam mr's user avatar
  • 121
1 vote
2 answers
35 views

provider.getBalance() always returns "0"

I'm trying to get the BUSD balance of a whale. However the getBalance() function always returns 0 and I get the following error when I run my tests: AssertionError: Expected "0" NOT to be ...
Christopherus's user avatar
0 votes
1 answer
22 views

Is It Possible to Generate a Folder Within Pinata Using JavaScript?

I'm interested in creating a JavaScript script that can automatically generate a folder on Pinata. Is such functionality available? My aim is to streamline the organization of JSON file uploads within ...
Awais Ahmad's user avatar
1 vote
1 answer
21 views

Can't catch Web3.js' contract error when calling a method and cancelling the transaction

I have a very simple React app that calls a Solidity smart contract's method using Web3.js (4.3.2) with some data coming from a form. I'm trying to catch errors while calling the contract method or ...
Danziger's user avatar
  • 131
-1 votes
0 answers
12 views

Cloning a live dApp (_Next/Static + WebPack) (Will Give Reward)

I'm hoping someone could help me out with some answers or simply anything. There are a few sites that are all very similar, they also have very similar sources. My end goal is to "clone" or ...
DevJimmy's user avatar
0 votes
1 answer
128 views

Deploy proxy upgrade pattern contract using hardhat ignition

I have a contract like this: // SPDX-License-Identifier: MIT pragma solidity ^0.8.24; import "@openzeppelin/contracts-upgradeable/token/ERC721/ERC721Upgradeable.sol"; import "@...
user134676's user avatar
0 votes
1 answer
37 views

Cannot find a value for the configuration variable 'INFURA_API_KEY'

I am setting up a npx hardhat project and it can't read my .env vars. Error HH1201: Cannot find a value for the configuration variable 'INFURA_API_KEY'. I looked at example to read the env vars. Any ...
pigfox's user avatar
  • 71
0 votes
1 answer
34 views

web3.js code works on chrome + metamask but dosent work on metamask mobile

i have a few codes that works fine on chrome desktop but dosent work with metamask mobile im using web3.js 1.2.7 here is code for connecting to wallet : import Web3 from 'web3'; var web3 = new Web3(...
Hosein In jast's user avatar
0 votes
2 answers
30 views

Cannot call contract function using ethers.js

I am new to web3 and smart contract development and I am stuck trying to call a function in my smart contract. I have a mintToken function: function mintToken(uint256 tokenId, string memory _type, ...
user134392's user avatar
0 votes
0 answers
23 views

SeatMap.js:21 Error fetching seats: Error: no matching fragment (operation="fragment", info={ "args": [ null ], "key": "seatsTaken" },

I have been try to see the values in my array from a function i created with solidity in my APP.js: mapping(uint256 => uint256[]) public seatsTaken; function getSeatsTaken(uint256 _matchID) public ...
jesse bonsu's user avatar
1 vote
1 answer
17 views

When I try to deploy my smart contract with ganache and try yo conect to the virtual blockchain, this message pop up in the terminal of visual studio

When I try to deploy my smart contract with ganache and try yo conect to the virtual blockchain, this message pop up in the terminal of visual studio. Why? I hope somebody give my a response please. I'...
SeekeyeLobster's user avatar
0 votes
1 answer
47 views

What is the difference (in terms of calculation) between tokens pricing while swapping vs while adding liquidity in Uniswap V3?

In Uniswap V3, getting different prices of 1 WETH to USDC while swapping and adding liquidity, potentially because of fees and other contributing factors. Swap Add Liquidity Programmatically, I'm ...
SYED ASAD KAZMI's user avatar
0 votes
0 answers
18 views

transfer to a wallet while deploying a smart contract

I want to know how to transfer for example 1$ to my address when deploying a smart contract with ethers js v6 here is my code : const provider = new ethers.BrowserProvider(window.ethereum) const ...
diana artist's user avatar
0 votes
4 answers
33 views

A public variable when called returns an object instead of an address in solidity

My Lottery contract code: contract Lottery { address public manager; address[] public players; constructor () { manager = msg.sender; } In the above code, I declared a ...
DarkL's user avatar
  • 3
0 votes
0 answers
26 views

i got "Expected '(' but got identifier"

function addAdmin(address _adminAddress) public onlyAdmin { require(msg.sender == administrateur || isAdmin(msg.sender), "Vous devez être l'administrateur ou un administrateur pour appeler ...
manal's user avatar
  • 1
0 votes
1 answer
31 views

key representation and format, conversion to string, JS

I'm new to blockchain programming. In my application I need to work with keys. I am writing tests in JS and the keys are presented in this form: Buffer.from('...
Artem Hvozdov's user avatar
0 votes
0 answers
13 views

How to get unstoppable domain owned by wallet address?

How to get unstoppable domain owned by user wallet address? I need to obtain all domains that user have. Preferred language js, please tell me what tool will help me
Hahan't's user avatar
  • 103
0 votes
0 answers
116 views

I have no idea how to troubleshoot this: "execution reverted (no data present; likely require(false)" Help?

I'm trying to run an arbitrage bot via local fork using ethers.js and hardhat. I keep getting this error when I run the contract: error on trade instructions emitted V7: Error: execution reverted (no ...
Trent Kennelly's user avatar
0 votes
1 answer
247 views

Layer2: Revert Execution Error when Calling exactInputSingle in Uniswap V3

Hello Stack Overflow Community, I am working on swapping tokens in a base layer2 network using Uniswap V3 and ethers.js. I have successfully approved the transaction using the approve function, but ...
Ghassane Aboughazaouat's user avatar
0 votes
1 answer
50 views

Capture emitted event with web3 v4.7.0

I built a guessing game using an web3 v1.3.0 and it worked great, then I found out that version was deprecated so I upgraded to v4.7.0. The new code is expected to listen for an event: event ...
pigfox's user avatar
  • 71
0 votes
0 answers
9 views

Module not found: Error: Can't resolve './assets/right-arrow-blue.svg' in '/home/bee/code/blockchain-developer-bootcamp/src'

this is my javascript code(I'm new to coding): import '../App.css'; function App() { return ( <div> {/* Navbar */} <main className='exchange grid'> <...
user avatar
0 votes
0 answers
13 views

Web3.js need only in browser version only HTML website

I want to create a simple page to interact with my deployed contract. I don't want to use Node.js. I want to use html + web3.js browser version. I got a link: https://github.com/ethereum/web3.js/tree/...
Rash Gult L's user avatar
0 votes
1 answer
255 views

web3.js methods call producing error Web3 validator found 1 error[s]: value "0" at "/1" must pass "address" validation

I haven't worked with web3.js in two years, and back then I didn't have any of these issues. Now I keep running into this error when calling a contract function that takes an address and a uint256 to ...
bendgame's user avatar
0 votes
2 answers
35 views

contract.events

I am listening on an event that's happening on smart contract. event UpdatedMaxNumber(address indexed player, uint maxNumber, uint256 timestamp); My original code works fine and updates the new number ...
pigfox's user avatar
  • 71
0 votes
0 answers
8 views

How to convert takerRate to readable value from 1inch API OrderBook?

I use 1inch API to get a list of order limits by the specific token. https://portal.1inch.dev/documentation/orderbook/introduction pair AXL/axlUSDC and I get a response something like that: [ { ...
red_space's user avatar
0 votes
1 answer
27 views

Fetch special position in JSON FORMAT

Hellp every body hope all are good today ? I need some help please ... This is my JSON with const = result : [ { asset: 'USDT', free: '35.00', locked: '0' }, { asset: 'USDC', free: '80.99', locked: ...
forexmp45's user avatar
1 vote
0 answers
34 views

Missing Revert Data (Hardhat/Ganache)

shortMessage: 'missing revert data', info: { error: { message: 'VM Exception while processing transaction: invalid opcode', stack: 'RuntimeError: VM Exception while processing ...
Kishor Kumar Paroi's user avatar
0 votes
1 answer
291 views

The error message "TypeError: unsupported addressable value (argument="target", value=null, code=INVALID_ARGUMENT, version=6.11.1)" when run locally

I created a script that fetches the WETH interface and send some test ETH getWeth.js const { getNamedAccounts, ethers } = require("hardhat") const AMOUNT = ethers.parseEther("0.1")...
Raaghav Manivel's user avatar
0 votes
0 answers
13 views

Forking a network to simulate events

I'm trying to simulate an event by forking a network. For example: wss.on('block', async (blockNumber) => { // Your code here }); How can I accomplish this? Any guidance would be ...
adam mr's user avatar
  • 121
0 votes
1 answer
35 views

How to transfer entire address balance to another address

After going through the questions here and here I came up with the code below to transfer the entire balance from one address to another using web3.js. export async function sendTransaction( ...
Zero's user avatar
  • 103
0 votes
1 answer
36 views

contract address field displays null in transaction receipt

I have ran into an issue this is my deploy.js code : const { ethers , run ,network} = require("hardhat"); async function main() { const simpleStorageFactory = await ethers....
Divyanshu Madhav's user avatar
0 votes
1 answer
12 views

Timeleft() function not displaying in frontend (speedrunethereum quest 2)

I'm kinda new here. Started speedrun ethereum. I finished the code for quest 2, but timeleft() is not displaying at the front end. It just shows "0" everytime, even redeploying and changing ...
Patok's user avatar
  • 1
1 vote
1 answer
157 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 (According to Keir Finlow-Bates' suggestion): ...
SYED ASAD KAZMI's user avatar
0 votes
1 answer
34 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
116 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
29 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
89 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
3 votes
2 answers
1k 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
26 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
1 vote
1 answer
2k 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
16 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
61 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
51 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
69 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

1
2 3 4 5
29