Skip to main content

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

TypeError: Cannot Read Properties of Undefined (Reading 'registerContractor') in My Ethereum DApp

I'm encountering a TypeError: Cannot Read Properties of Undefined (Reading 'registerContractor') when trying to call the registerContractor function on my smart contract using the ethers.js library. ...
Shureed Shazzad's user avatar
1 vote
1 answer
15 views

Getting storage value of mapping with negative number key in JS/TS/Viem

I'm trying to find out how to access the storage value of mapping keys of negative numbers, say mapping(int => uint), in viem, but anything written in JS or TS should give me a hint of how to do it ...
Alexhandru Titieni's user avatar
1 vote
1 answer
23 views

How to securely interact with a smart contract using Web3.js?

I'm currently developing a decentralized application (dApp) on the Ethereum blockchain, and I'm using Web3.js to interact with my deployed smart contract. Here's the setup I have so far: My smart ...
Fikri Rudiansyah's user avatar
0 votes
0 answers
12 views

how to get source code of contract deployed by evm [duplicate]

I copy and pasted together a very basic contract in 2018 devoid of functionality, someone from the EVM department added what was needed and deployed the contract, I would like to take the contract off ...
Rhonda Dotterer's user avatar
1 vote
0 answers
31 views

How to prevent error(s)? Either "Error: expected 0 constructor arguments, got 1" or "ProviderError: Contract creation without any data provided"

When the contract will deploy locally on developmentChains (hardhat environment) with the following script: deploy.js const { network, ethers } = require("hardhat") const { developmentChains,...
Dennis's user avatar
  • 13
1 vote
1 answer
56 views

How to set AppKit (Web3Modal) provider for web3.js?

Dear smart contract front-end developers, As you know, AppKit is the new verion of Web3Modal. I am using it in a web javascript program to show a dialog to connect the web page to the desired wallet. ...
Alireza Zojaji's user avatar
0 votes
1 answer
28 views

Create/set "subId" by createSubscription() and get "subId" vrfCoordinatorV2_5Mock calling by javascript in hardhat environment

deploy.js: const { network, ethers } = require("hardhat") const { developmentChains, networkConfig } = require("../helper-hardhat-config") const { verify } = require("../...
Dennis's user avatar
  • 13
0 votes
0 answers
29 views

Error: transaction execution reverted in SimpleAccount Contract worldchain

When I try to perform a transaction with my contract for Account Abstraction, I get an transaction execution reverted error Connected to network: Network {} Master wallet: ...
Dylan Leguizamon's user avatar
0 votes
1 answer
25 views

transaction execution reverted worldchain

I'm trying to create a code that sends Worldcoin through Worldchain using a master wallet that pays for the gas, but when I try to send it, I get an error. I’m not sure what’s causing it; this is the ...
Dylan Leguizamon's user avatar
0 votes
0 answers
28 views

Implementing a Meta Transaction Relayer with Separate Gas Fee and Worldcoin Wallets on Worldchain

What changes should I make to my code to create a Meta Transaction Relayer that pays the gas fee with an ETH wallet (on the Worldchain network) different from the one sending the Worldcoin (on the ...
Dylan Leguizamon's user avatar
0 votes
1 answer
79 views

Error: insufficient funds for intrinsic transaction cost Worldchain

I am trying to send Worldcoins via the Worldchain mainnet. I have 4.94 WLD available in my Worldcoin address, but when I call the function to transfer, I get the following error: Error: insufficient ...
Dylan Leguizamon's user avatar
0 votes
1 answer
68 views

How to get the amount of token0 and token1 from a Uniswap V3 pool in JS

I have the following functions based on the Uniswap library, but the result of the amounts I get for the two tokens in the pool are different from those shown by Dexscreener. How can I fix this? const ...
emilts's user avatar
  • 1
0 votes
0 answers
23 views

How to connect trust wallet conection modal in mobile ethersjs?

I have an authorization web3 window but its only opens on desktop but not on mobile apps. How can I solve this problem ? export const getSigner = async () => { let provider; if(window....
Victor's user avatar
  • 1
1 vote
2 answers
36 views

Unit tests are not passing because of ERC20InsufficientAllowance error

Here is a code describe("allowances", () => { const amount = (20 * multiplier).toString() beforeEach(async () => { playerToken = await ethers.getContractAt(&...
EddiePumpin's user avatar
0 votes
0 answers
29 views

My contract in not deploying

Here is the link to the repo: https://github.com/EddiePumpin/My-Hotel $ yarn hardhat deploy yarn run v1.22.22 $ "C:\Users\HP FOLIO\.vscode\My-Hotel\node_modules\.bin\hardhat" deploy Nothing ...
EddiePumpin's user avatar
0 votes
1 answer
31 views

My hardhat smart contract code is not compiling

On compiling, I’m getting this: $ yarn hardhat compile yarn run v1.22.22 $ "C:\Users\HP FOLIO\.vscode\MyHotel\node_modules\.bin\hardhat" compile Nothing to compile Done in 3.66s. Here is ...
EddiePumpin's user avatar
0 votes
0 answers
23 views

setOpenCreatePost Function Not Triggered Despite Click Event Logging "Textarea clicked"

I'm currently facing an issue in my Next.js application where the setOpenCreatePost function does not seem to be triggered when clicking on a . Although the console correctly logs "Textarea ...
Harsha Kumar's user avatar
0 votes
2 answers
38 views

How to Call Solidity Function with Struct Parameter from JavaScript?

I'm trying to execute a Solidity function using JavaScript. The Solidity function accepts a struct as an argument, and I'm not sure how to structure the data in my JavaScript code to make this call ...
adam mr's user avatar
  • 141
0 votes
1 answer
99 views

This method only supports 0x-prefixed hex strings

I signed message with domain, types and value using wagmi module through MetaMask. The code is as follows: import { useChainId } from "wagmi"; import React from 'react'; import { ...
user142655's user avatar
1 vote
1 answer
103 views

How to pass a struct/tuple to viem's `args` field?

I'm trying to call a function that contains a struct as one of its input parameters, however, I can't seem to figure out the correct syntax for passing the arguments to the encodeFunctionData util ...
Rohan Nero's user avatar
  • 1,745
0 votes
0 answers
34 views

TypeError: Cannot read properties of undefined (reading 'toHexString')

I got this error when trying to call handleOps function from ERC-4337. This is the code snippet from EntryPoint.sol contract function handleOps( PackedUserOperation[] calldata ops, ...
tli1275's user avatar
0 votes
1 answer
35 views

Calling `getLendingPool` in a function call `getLendingPool`

The ILendingPoolAddressProvider does not contain the getLendingPool function. async function getLendingPool(account) { const lendingPoolAddressProvider = await ethers.getContractAt( "...
EddiePumpin's user avatar
2 votes
0 answers
28 views

I get `InsufficientFundsError ` when I try to estimate gas fee for token mint function

I am trying to estimate gas for the mint function in a smart contract I created. try { const gas = await publicClient.estimateContractGas({ address: provider.token, ...
Emmanuel Amodu's user avatar
0 votes
0 answers
32 views

How to Convert USD test stripe balance to crypto currency/Matic automatically via code on the Blockchain?

I have integrated stripe code where user pay in USD test funds via stripe on subscription, I want to convert the user USD into MATIC, which should then be deposited into my wallet address on the ...
Awais Ahmad's user avatar
0 votes
1 answer
60 views

My deploy script won't run. Any `console.log` after `module.exports` won't work

Here’s my deploy script: const { network } = require("hardhat") const { developmentChains, networkConfig, INITIAL_SUPPLY, } = require("../helper-hardhat-config") module....
EddiePumpin's user avatar
0 votes
2 answers
120 views

swapExactTokensForTokens error TRANSFER_FROM_FAILED even after approval?

I've read almost every question on here referencing uniswapv2 swapExactTokensForTokens and I'm still getting the same error (below). Here are the specifics: Environment: local node Infrastructure: ...
Trent Kennelly's user avatar
0 votes
1 answer
29 views

`package.json` and node_modules not found

I can't find package.json and node modules folder after running yarn add --dev hardhat
EddiePumpin's user avatar
0 votes
0 answers
32 views

How works auto crypto assets stolen web pages

In my dissertation, I learned about the tactics of Ethereum scammers and I wanted to know how crypto sites automatically detect "cryptopank", "bored monkey", coins, etc., and ...
Eligijus Girdenis's user avatar
0 votes
0 answers
57 views

Is it normal that RPC provider will return error message but transaction is actually successful?

I am currently new here at blockchain. I am currently using a subscribed private rpc ankr and Moralis. So, it is normal that rpc will return us some errors but transaction still manages to be made ...
Alvin Low's user avatar
0 votes
0 answers
35 views

How to custom chain to uniswap interface v3 with swap token?

I encountered an issue when customizing the chain and received the error: { "detail": ""tokenInChainId" must be one of [1, 5, 10, 56, 137, 324, 8453, 42161, 42220, 43114, ...
Trung Vu's user avatar
1 vote
0 answers
30 views

getAllShipment Function Not Fetching Data from Smart Contract Properly

I'm encountering an issue with my getAllShipment function in my JavaScript code. The function is intended to fetch and map shipment data from a smart contract. However, I'm seeing that only the first ...
ALISHA REDDY's user avatar
0 votes
1 answer
42 views

How I can send FIL in filecoin network

My network: filecoin. I use this RPC: https://api.node.glif.io I try send FIL token from A to B address on filecoin network and I got error: { jsonrpc: '2.0', error: { code: 1, message: &...
Eligijus Girdenis's user avatar
0 votes
1 answer
34 views

how to fix this "Deployed contract to: undefined" How do i get the the contract address it got deployed to?

scripts.js // imports const { ethers } = require("hardhat"); //async main async function main() { const SimpleStorageFactory = await ethers.getContractFactory("SimpleStorage&...
Favour Uzoma Uchechukwumere's user avatar
0 votes
0 answers
33 views

Signature to Transfer Assets Error: Insufficients Funds even address has sufficient funds

This is the code which i am using to transfer assets using signature which i have, problem is when i use node transfer.js transaction reverted and said insufficient amount , it's too much gas fees i ...
Lucky Rajput's user avatar
0 votes
1 answer
27 views

Issue with solidity contract mapping

Hi I am trying to do a call between my solidity contract and js file. I have a contract Im providing a portion of: struct Player { uint wins; uint losses; } mapping (address => Player) ...
minttea's user avatar
0 votes
0 answers
16 views

How to Retrieve the Funding Fee for an Open Position via API on HMX?

I am currently working on integrating HMX into my accounting system and need to fetch the funding fee for an open position via API. Despite going through the documentation, I couldn't find a clear ...
Timofey Kupriyanov's user avatar
0 votes
1 answer
38 views

Issue with SafeConnector in Vue.js using wagmi

I'm using Vue.js and trying to implement the SafeConnector to install wallet to my dApp by using wagmi. I'm following this documentation. After installing wagmi core and wagmi connectors, I'm ...
Joy M's user avatar
  • 11
0 votes
1 answer
62 views

Safe transaction - "add to batch" doesn't resolve function

I'm building a Safe app where the users can execute transactions with their Safe Wallets. I use viem to trigger the transaction, it correctly prompts the user to execute the transaction and after the ...
Cláudio Barreira's user avatar
0 votes
1 answer
114 views

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

I'm encountering a timeout error while running a unit test for my Lottery smart contract using Hardhat. The error occurs during the test case that involves picking a winner, resetting the lottery, and ...
ALISHA REDDY's user avatar
0 votes
1 answer
282 views

TypeError: unsupported addressable value (argument="target", value=null, code=INVALID_ARGUMENT, version=6.13.1)

I'm getting the following error while trying to test whether addresses. const { expect } = require('chai'); const { ethers } = require('hardhat'); const tokens = (n) => { return ethers.utils....
Chandima Maduwantha's user avatar
0 votes
0 answers
57 views

Why does the BitKepp (BitGet) wallet display isMetaMask:true in its properties?

I tried it in different browsers with and without MetaMask installed.
Nick's user avatar
  • 1
0 votes
1 answer
59 views

Ethers.js: getLogs returning empty results despite existing transactions

I'm working on a project where I need to track USDT transfers to specific wallet addresses and confirm them after a certain number of blocks. I'm using ethers.js to fetch logs for this purpose. ...
user3362334's user avatar
0 votes
1 answer
156 views

TypeError: chai.deployed is not a function

Error: PS D:\SimpleStorage> npx hardhat run scripts/deploy.js TypeError: chai.deployed is not a function at main (D:\SimpleStorage\scripts\deploy.js:11:16) PS D:\SimpleStorage> deploy.js: ...
Ankon Ahamed's user avatar
0 votes
1 answer
22 views

In which language should i write my deployment code Javascript or Solidity

Which language should I learn to write the deployment code for a smart contract: JavaScript or Solidity (using Foundry)? What should I learn according to today's trends?
saksham mishra's user avatar
0 votes
1 answer
27 views

Calling function on solidity contract fom JS

I have a sample contract running on a remix IDE that im trying to call a function from my js but it doesnt seem to be working. I can print the functions on the contract. But i cannot get the ...
ROY BURSON's user avatar
0 votes
1 answer
42 views

Unable to transfer ether from contract

I am learning Solidity and Blockchain and am following this tutorial I found for creating a Kickstarter campaign and allowing contributors to approve requests. These are my contracts: // SPDX-License-...
Shiv Kumar's user avatar
0 votes
1 answer
29 views

Too Many Arguments Error in Hardhat Test for NFT Marketplace Contract

I'm encountering an issue with my Hardhat test for an NFT marketplace contract, where I'm getting this error while calling the buyItem function in my test file: Nft Marketplace Unit Tests ...
ragz's user avatar
  • 3
0 votes
0 answers
112 views

TypeError: invalid BytesLike value (argument="value", value={ "data": "0" }, code=INVALID_ARGUMENT, version=6.13.0)

Smart contract : // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract UsernameRegistry { // Mapping from address to username mapping(address => string) public addressToUsername;...
Ayush Gupta's user avatar
0 votes
0 answers
19 views

call swapExactTokensForETH in javascript

I have the following function in JavaScript: try { let tx = await router.connect(receiver).swapExactTokensForETH( tokenAmountToSwap, 0, [token.address, await router.WETH()],...
rebwar's user avatar
  • 3
0 votes
0 answers
46 views

Uniswap router V3 exactOutputSingle failing without proper error

I need to make a swap with Javascript web3.js and uniswap V3 router (for testing I use BSC) Here my code import Web3 from 'web3'; import config from './components/config.js'; import BigNumber from '...
Skinsky Gnudy's user avatar

1
2 3 4 5
29