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

How to get transaction fees and minus it from balance

I created an auction exchange smart contract using solidity programming language and I am using ganache for testing this is a test file written in JavaScript. seller is the creator of auction and ...
Huzaifa Ahmed's user avatar
0 votes
0 answers
19 views

How to find a variable declaration in an AST object

I'm using Javascript, and I have a Solidity AST object. Is there a library or an example out there to easily find if a text string (variable/function/mapping/struct etc declaration) exists and return ...
Salman Fazal's user avatar
0 votes
0 answers
55 views

Unable to access the function in the contract using hardhat ethers

This is the smart contract code :- // SPDX-License-Identifier: MIT pragma solidity ^0.8.20; interface IUniswapRouter { function swapExactTokensForTokens( uint amountIn, uint ...
kaushik choudhury's user avatar
0 votes
0 answers
26 views

Viem wallet client method does not exist / is not available

I am trying to interact with a smart contract from a front-end web app using viem. I am successfully creating a Wallet Client with my wallet address, but when I call some of its methods, I get the ...
Dimitris Papazacharias's user avatar
0 votes
2 answers
12 views

How relevant is front end knowledge to landing a job coding in solidity, or just coding in Solidity in general?

I am very interested in learning how to code in Solidity and work with smart contracts, but I have much less interest in working with front end. Since I don't want to slog through hours and hours of ...
Wynand Malan's user avatar
0 votes
0 answers
11 views

Getting Quote Exact single input to work on quickswap

So im trying to check how many tokens i'll get before i do a swap on quickswap like (1USDC -> 0.1655....LINK), I've tried to use: try{ const amountOut = await quickquoter.callStatic....
Paucar's user avatar
  • 11
1 vote
1 answer
17 views

Call sendSignedTransaction without waiting for result (execute in background)

My Vue.js code with web3.js: function dreamOn() { await web3.eth.sendSignedTransaction(txFin); return; } I want to send this transaction, but I don't want to wait for the result of ...
user125754's user avatar
0 votes
1 answer
19 views

How can I retrieve the latest locked token from the Ethereum blockchain using JavaScript without knowing Solidity?

I'm a JavaScript developer with limited knowledge of Solidity, and I need to retrieve information about the latest locked token from the Ethereum blockchain. I want to accomplish this task using ...
Ghassane Aboughazaouat's user avatar
0 votes
1 answer
24 views

Trying to access the retrieve method from deployed smart contract but not able to using ether.js

Above is the the error I'm getting when trying to access the retrieve method from the smart contract I've written although I'm able to get the contract object which means I've connected to the ...
Prakhar Srivastava's user avatar
2 votes
1 answer
27 views

What's Wrong With My Polygon Mainnet Aave Flashloan Script? - Fail with error '27' & Fail with error 'ERC20: transfer amount exceeds balance'

I have successfully deployed and executed a flashloan on the Polygon network in testnet and have since adapted it for mainnet. On Mainnet it compiles and gets deployed with no problem, but when I ...
Peter's user avatar
  • 23
1 vote
0 answers
19 views

How to run a script which requires a private key completely in a browser?

For a non-technical person I need to create a page on my website, in the admin area, in which he'd regularly do stuff that normally is done on local machine only. That is, a person doesn't want to go ...
Nondi's user avatar
  • 49
1 vote
1 answer
60 views

Unable to connect to Testnet Sepolia

Command: npx hardhat --network sepolia run scripts/deploy.js Getting error messages: * Invalid account: #0 for network: sepolia - private key too long, expected 32 bytes * Invalid value undefined ...
Frantz M.'s user avatar
1 vote
0 answers
6 views

Data is not updating in the chaincode

This is my HTML form <div class="text-center form-container"> <form id="updateForm" action="" name="updateOwner" style="display: none;&...
Jubayer Hossain's user avatar
1 vote
1 answer
40 views

How to get the amount recieved during swap on Uniswap?

I'm trying to get the amount that I recieved in WETH during swap on Uniswap(can be hardcoded WETH). On the code below, I took random address that did swap, got his transactions and then decoded it ...
Daniel Kotlarov's user avatar
0 votes
0 answers
8 views

Language bar not showing on github repository

Github repository is not showing the language of project. Repo Link :- https://github.com/shubhamextraxyz/Contract_Deployment_Infura_Web3.js The file is a simple repo with 100% Javascript, but why it'...
Shubham's user avatar
  • 13
0 votes
1 answer
82 views

How Can I Filter Ethereum Transactions by Method ID or Name, Similar to Etherscan's Advanced Filter Feature

I am working on a project where I need to retrieve all transactions associated with a specific method within a given block or set of blocks. As an example, Etherscan provides this functionality ...
Daniel Kotlarov's user avatar
0 votes
0 answers
15 views

Can not delete the address from the struct and array in JavaScript

My other functions are working so I guess other codes are fine. I am just getting this error after clicking the delete key: "Error deleting patient: Error: invalid address at v (web3.min.js:2:...
Jubayer Hossain's user avatar
1 vote
1 answer
23 views

"Error: Invalid Argument in getAmountsOut Function Call."

// Get Provider const providers = new ethers.providers.JsonRpcProvider("https://"); // Get Velodrome V1 Router const routerABI = [ "function getAmountsOut(uint amountIn, ...
Mochi Vani's user avatar
1 vote
1 answer
23 views

Smart Contract Working in Remix Testnet but Reverting Transactions in DApp with Metamask

Question: I'm encountering a perplexing issue with my smart contract that's causing transactions to be reverted when interacting with it through a DApp using web3.js and Metamask. Strangely, the same ...
adi farhan's user avatar
1 vote
2 answers
49 views

Why i get evm revert error when calling the method from dapp front end (web3js & metamask)??? but my contract works fine on remix and bscscan

I've created a smartcontract & deployed on bsc testnet. For the past 8 weeks, i have been upgrading and testing the contract on remix and website and they always works fine. I can mint on remix ...
adi farhan's user avatar
1 vote
1 answer
21 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
0 answers
20 views

How is exchange rate calculated on DEX platforms like uniswap and sushiswap?

I started getting into the crypto scene and I read about liquidity pools but I am not sure how to get exchange rates into my javascript code, I looked for API's and SDK's but couldn't find any for the ...
user125002's user avatar
1 vote
1 answer
55 views

How to get correct liquidity amount on UniswapV3 for each token(pair) via web3.js?

I'm trying to create a bot that will send me new LPS notifications on Uniswap V3 and in the future more dexes. I want to contain in the message specific data like amount of token and ETH in the pool, ...
RasmonT's user avatar
  • 131
0 votes
1 answer
21 views

Use of { } when importing libraries?

Can anybody tell me the exact use of { } in import/require library statements? I've seen some other questions where people said it's to import just a part of a library, let's say the 'ethers' part of ...
Andy's user avatar
  • 185
0 votes
1 answer
10 views

Help with “web3 not defined”

I am cloning a tutorial https://github.com/techaddict0x/liquidityminer And when I run the debug console I get the error “web3 is not defined” The code is the exact same, looked all over the internet ...
Jackson T.'s user avatar
1 vote
0 answers
21 views

How would I access a contract's public property (variable) using web3.js?

I'm trying to get a variable called "entryAmount". I've tried many methods, like calling it as a method, but it doesn't work. A part of the solidity code: pragma solidity ^0.8.0; contract ...
Jayden's user avatar
  • 11
1 vote
1 answer
40 views

How to get Factory address from the Router address? Web3.js

I'm trying to get a factory address for Uniswap on base network, unfortunately I'm not able to locate this address anywhere and I'm kind of desperate as without it I'm not able to try my code that ...
RasmonT's user avatar
  • 131
0 votes
0 answers
19 views

What api can i use to find token max per wallet and max per tx

Im trying to make a programm that returns max tokens per wallet and max tokens per transaction after i provide the contract address. What api should i use for this goal?
l1m0n__'s user avatar
0 votes
1 answer
54 views

Reading from a nodejs object

I try to read data from this node js object (I got it from sequencer feed on arbitrum): data = [ BigNumber { _hex: '0x0f634d1e114f4d', _isBigNumber: true }, BigNumber { _hex: '0x01', _isBigNumber: ...
Dani's user avatar
  • 63
0 votes
1 answer
21 views

Sell static error

I keep getting this error when i try to perform a static test call async sellTestTransaction(tokenAmount, gwei) { const token = await Fetcher.fetchTokenData(chainId, this.address, provider); ...
Guruu's user avatar
  • 1
2 votes
1 answer
189 views

Reading transactions from arbitrum sequencer feed

I try to read transactions from arbitrum sequencer feed and decode the transaction data to get information about the transaction, therefore I try to check which function is called for the transaction ...
Dani's user avatar
  • 63
0 votes
0 answers
80 views

How to fix Error: fractional component exceeds decimals?

I cannot seem to be able to fix the error "Error: fractional component exceeds decimals [ See: https://links.ethers.org/v5-errors-NUMERIC_FAULT ] (fault="underflow", operation="...
sunsakis's user avatar
1 vote
0 answers
143 views

Encountering an error with getContractAt using hardhat-ethers and ethers v.6.6.7

I am doing a tutorial on youtube, and I can't figure out why I am getting an error code by running yarn hardhat run scripts/aaveBorrow.js: Error: contract runner does not support calling (operation=&...
Gilbert Lecrado's user avatar
0 votes
0 answers
25 views

We have an own wallet but we don't have an idea how to connect this to other sites?

I had an Wallet created by Own.I need to connect that wallet with active sites like Metamask.If we want to connect the Metamask with Site means we call window.ethereum default as a trigger comment. ...
pemaju02's user avatar
1 vote
0 answers
72 views

How to track ERC20 token creations on Ethereum blockhain with web3.js using Infura API?

I'm trying to fetch new ERC20 tokens from the blockchain transactions, my code is scanning the blocks and when I tried to log transactions it works well, (dumping bunch of logs). However I don't know ...
RasmonT's user avatar
  • 131
0 votes
0 answers
51 views

Contract.on event listener not working (using Ethers.js + Next.js), how come?

got a simple question here for all you ethers.js hackers. Simple code, transactions go through, but why doesn't the contract.on function work? const handleSubmit = async (e) => { e....
sunsakis's user avatar
0 votes
0 answers
12 views

"not logged in" when metamask gets locked by password

I have a pretty standard code used by logging in via MetaMask, something similar to this: const connectWallet = async () => { const provider = new ethers.providers.Web3Provider(window.ethereum) ...
Camila326's user avatar
0 votes
0 answers
103 views

Get ERC20 token buy/sell tax

I am trying to implement a method for calculating token buy/sell tax. The one that devs implement it in the transfer() function. I've done some research and there are 2 options. eth_call - simulate a ...
kakakakakakakk's user avatar
0 votes
0 answers
77 views

Got different prices from SqrtPriceX96 and from Tick on Uniswap

I trying to get price (ratio) from pool on Uniswap v3 by JS with ethers.js. But I got a slightly different prices from SqrtPriceX96 and from Tick, for some reason. SqrtPriceX96 and Tick took from '...
Yurii's user avatar
  • 1
0 votes
1 answer
25 views

Transaction Decoding on Fantom. I can't extract the data I need

This is the first question I post here so I hope my question asked properly. I'm scanning the Fantom mempool searching for specific types of functions that interfere with pairs liquidity. I'm having ...
fil997's user avatar
  • 1
0 votes
1 answer
94 views

unpredictable gas limit error doesn't go away after setting gasLimit manually

I have this contract which is written in solidity and one of the functions (getMyActivity()) returns an array of structs and im trying to call it from my frontend which is written in ReactJS but i get ...
Shadq's user avatar
  • 83
0 votes
2 answers
24 views

How to convert solidity return uint and use it on frontend using Etherjs

// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; contract Lending { // calculating the value of loan on the basis of collateral uint LTV = 20; mapping(address => uint) ...
soumyadeep.eth's user avatar
0 votes
0 answers
207 views

Getting "err: max fee per gas less than block base fee" when estimating gas cost of a transaction

For the last few days, I have some trouble using the eth_estimateGas function from the Quick Node provider. Indeed, after fetching a transaction from the mempool, I want to estimate the gas cost of ...
VeeN's user avatar
  • 101
0 votes
0 answers
5 views

Why is computedFee too small when using function?

I tried to calculate computedFee according to this page: https://www.metacrypt.org/tools/uniswap-v3-calculator-simulator/?network=ethereum&token0=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&...
ethereum's user avatar
1 vote
2 answers
87 views

How to call a smart contract function by passing a struct in it

I would like to call exactInputSingle function of pancakeswap contract: "function exactInputSingle(struct IV3SwapRouter.ExactInputSingleParams params) external payable returns (uint256 amountOut)&...
Shivam Yadav's user avatar
0 votes
2 answers
149 views

TypeError: no matching function (argument="key", value="provider", code=INVALID_ARGUMENT, version=6.6.2)

It seems like the syntax has changed a bit, the course I am following might have outdated syntax but I am unable to find the correct syntax to get the balance. Could someone help me, the code is this -...
Samarth Bagga's user avatar
0 votes
0 answers
199 views

"TypeError: (0 , ethers_1.getAddress) is not a function" when writing tests in hardhat with typescript

i get this error when i run this test: typescript import { expect } from "chai"; import { ethers } from "hardhat"; import { Ballot } from "../typechain-types"; const ...
robberdom's user avatar
0 votes
1 answer
60 views

How to send signed data to backed and verify it?

On a web page I have some 3 fields, name, age and height, which a user authenticated via MetaMask sends to backend along with his wallet address. In JSON. In order to ensure that data that's sent ...
Camila326's user avatar
0 votes
0 answers
16 views

Running test with --grep returns 0 passing

I am using hardhat and trying to run tests with the command- yarn hardhat test --grep "amount funded" FundMe.test.js code- const { deployments, ethers, getNamedAccounts } = require("...
Samarth Bagga's user avatar
1 vote
0 answers
106 views

Cannot solve Error: Invalid Chai property: revertedWith

I am trying to run a test on my contract using hardhat and chai. But I am running into this error. I have tried install ethereum-waffle. But it did not solve the problem. I also added ethereum-waffle ...
Samarth Bagga's user avatar

1
2 3 4 5
28