Questions tagged [web3js]

Javascript API and library for Ethereum To develop applications on Ethereum, you can use the web3 object provided by the web3.js library. Under the hood it communicates to a local node through RPC calls. web3.js works with any Ethereum node, which exposes an RPC layer. https://github.com/ethereum/wiki/wiki/JavaScript-API

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

how can I get a Block hash before sending?

I'm using tron-api for trx transactions. The obtained raw_data is as follows: [ "visible" => false "txID" => "...
pan's user avatar
  • 1
0 votes
0 answers
11 views

Get all transactions on ethereum

Is there a way to get all transactions on ethereum such that transactions between two unique wallets will be counted as one ?
Loki's user avatar
  • 9
0 votes
0 answers
29 views

Error: Transaction has been reverted by the EVM

I am trying to call the following solidity method from my smart contract in javascript: address[] public investors; function addInvestor(address investor) public { investors.push(investor); ...
Zubair's user avatar
  • 1
0 votes
0 answers
14 views

Get exact Swap price using LP info

I want to calculate the exact price for each swap event that comes through on the blockchain. I gather that the only way to do that is to track the LP balances for WETH and the token. If there is ...
BAR's user avatar
  • 135
0 votes
0 answers
73 views

Decoding the array from the solidity events using web3.js

I want to track an event emitted by the smart contract from the backend using web3.js, But the Problem is there is the array type(uint8[]) in the event ,whenever I try to decode it it gives the ...
shiva sai's user avatar
0 votes
0 answers
39 views

How to get position slot allowance automatic

how to get position slot allowance automatically without looking at the code? because each positive slot allowance in several different tokens, some of the default position is 2 but there are 3 and ...
damartripamungkas's user avatar
0 votes
0 answers
88 views

error the second time I try to Mint: "execution reverted: ERC20: transfer amount exceeds allowance"

I've a problem trying to mint a token in a custom smart-contract. I'm using Nextjs and Wagmi to read/write to the contract const { data, writeAsync: approve } = useErc20Write("approve", [ ...
KreW's user avatar
  • 1
0 votes
0 answers
11 views

Why is it not showing any results in the Table / Collection Section?

this is my transport.request.model import mongoose from "mongoose"; const schema = new mongoose.Schema({ Transport : String, Product : String, Material : String, Capacity : Number, ...
abdou's user avatar
  • 3
1 vote
1 answer
313 views

How would I be able to set slippage for exactInputSingle on Uniswap v3 and Pancakeswap v3?

I'm able to do swap transactions using multicall and exactInputSingle functions on both Uniswap v3 and Pancakeswap v3. However, I have no idea how would I be able to set the slippage. The v2 routers ...
Austin's user avatar
  • 123
1 vote
1 answer
110 views

How to read all Transfers on blockchain

How do I get all transfers occurring on the blockchain and their transaction amounts and to and from addresses? event_signature_hash = web3.keccak(text='Transfer(address,address,uint256)').hex() ...
BAR's user avatar
  • 135
0 votes
1 answer
210 views

web3 python - AttributeError: 'Eth' object has no attribute 'abi'

I am trying to use an example ABI but its not being found. My problem is on last line: AttributeError: 'Eth' object has no attribute 'abi' infura_url = 'https://mainnet.infura.io/v3/xxx' web3 = Web3(...
BAR's user avatar
  • 135
0 votes
1 answer
63 views

Error: network does not support ENS (operation=“ENS”, network=“maticmum”, code=UNSUPPORTED_OPERATION, version=providers/5.5.3 Network doesnot support

Hello I wrote a smart contract for crowd funding Actually I have two contracts One is create a campaign for donate funds and second is created campigns for crowd-funding and store all the campaigns ...
Yasir Saeed's user avatar
1 vote
0 answers
65 views

How to transfer coins between L1 and L2 via web3.js or ethers.js?

How to do it? Programmatically. Does it always require a bridge? Or can it be done in other way too? I haven't found any difinitive answer to this anywhere.
Nondi's user avatar
  • 49
0 votes
0 answers
12 views

A moment when an incoming TX has been complitely settled and the coins may be sent out?

I have 2 wallets. I want to send coins from one to the other (1), and from the 2nd one to an external wallet (2). const wallet = get_wallet(); const balance = await provider.getBalance(wallet.address);...
Kyell's user avatar
  • 91
0 votes
1 answer
21 views

Buy token just after the pair deployment?

Hello i saw this today : I'm wondering if how it's possible for someone to buy a token in same time as pair deployment. If i check into some mempool we do not have the info that a pending order is a ...
Valentin Garreau's user avatar
1 vote
1 answer
157 views

How to know token transfered in pending status from memepool

i'm getting list of data from web3.eth.filter('pending'), here i'm listening uniswap ETH router. If i print one result of the list : AttributeDict({'blockHash': None, 'blockNumber': None, 'from': '...
Valentin Garreau's user avatar
0 votes
0 answers
424 views

Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'args')

I get this error Unhandled Runtime Error TypeError: Cannot read properties of undefined (reading 'args') whenever I want to create an nft on my decentralised application and it only appears after I ...
Eyad Ahmed's user avatar
0 votes
0 answers
211 views

polygon mumbai testnet doesn't revert error reason, instead confirm transaction with status:false

i use web3js to request to the polygon mumbai testnet using quicknode. when i use ganache, i get error revert reson easily but when i use mumbai testnet, it consume gas and return receipt with status ...
xmrrabbitx's user avatar
0 votes
1 answer
24 views

How do I deposit and restore my Ethereum to my wallet?

I want Ethereum to enter my Metamask wallet and I can use it easily to this address. 0x005449873eFD4b886DFDb3dfFeB1fA93817F8449
Shahrzad Mahro's user avatar
0 votes
1 answer
2k views

How can I remove custom spending cap on Metamask?

When I call the approve function of the ERC20 token standard, it asks me to set a custom spending cap, as shown below. But I need to use the default value every time without clicking "use ...
deKaV's user avatar
  • 1
1 vote
1 answer
75 views

Can't catch all the events using ethers

Can't catch all the events. Why? I try to listen to events for several contracts and it is ok. But the more contracts I listen to, the more events are missed? Is there any way to prevent this and why ...
byggy's user avatar
  • 11
1 vote
1 answer
89 views

How does one create and send TXs on L2 - Arbitrum and others?

In ethers.js or web3.js How does one create and send TXs on L2 - Arbitrum and others? Is the algorithm absolutely identical to the one on L1, or not? How does one transfer ETH between L1 and L2?
Kyell's user avatar
  • 91
0 votes
1 answer
192 views

types/value length mismatch (argument="tuple", value='myAddress'

I'm having some problem with the arguments of a function written in solidity and called in JavaScript. I'm using the Remix ballot default example, except I removed the first require in it. It looks ...
marcos's user avatar
  • 1
0 votes
0 answers
21 views

Private blockchain nodes not running in background

Sir I am creating a private blockchain using geth. Doing it on aws ubuntu My geth.service file contains Unit] Description=Ethereum go client [Service] User=root Type=simple Restart=always After=...
quick cricket's user avatar
0 votes
1 answer
258 views

ethers js listening to events doesn't work

What I'm trying to do: I'm trying to listen to any event happening on a contract. Since I'm doing this for the first time, I chose a popular liquidity pool, the "Cake" liquidity pool on ...
你的老师's user avatar
0 votes
0 answers
25 views

Unable to deposit tokens into the contract when the user's balance within the contract is 0

I'm working on a web-based interaction with a smart contract that allows users to deposit and withdraw tokens. I've noticed that when the user's balance within the contract is 0, they cannot deposit ...
user120629's user avatar
0 votes
1 answer
116 views

Is it possibleimpersonate an account using only ethers.js without using Hardhat

Is it possible to impersonate an account using ether js only? I don't want to use Hardhat. Though I have forked mainnet using foundry. Now wants to transfer eth of let's say vitalik to my own account ...
DEEPAK Kumar's user avatar
0 votes
0 answers
48 views

Error: network does not support ENS (operation=“ENS”, network=“maticmum”, code=UNSUPPORTED_OPERATION, version=providers/5.5.3 this error is comingabc

When I try to access address as endpoints on getstaticpaths the error is coming Error: network does not support ENS (operation=“ENS”, network=“maticmum”, code=UNSUPPORTED_OPERATION, version=providers/...
Yasir's user avatar
  • 1
0 votes
0 answers
288 views

window.ethereum.request({method: "eth_requestAccounts"}) automatically picks the connected account when making a transaction

I have multiple accounts on my Metamask wallet(Most of them are connected to the site). But my selected account is not connected to the Dapp. So, when I try to send a transaction it uses one of the ...
Ishmam Tasin's user avatar
0 votes
0 answers
46 views

Error: EACCES: permission denied, mkdir '/root/.config/hardhat-nodejs'

While compiling below errors occurs anyone please look into this Learn more at https://hardhat.org/hardhat-runner/docs/reference/solidity-support An unexpected error occurred: Error: EACCES: ...
Internet and Computer Probe's user avatar
0 votes
1 answer
68 views

Error while compiling contracts: Cannot find module '@nomiclabs/hardhat-truffle5'

Below error occurs while compiling smart contracts through hardhat. npx hardhat compile --show-stack-traces An unexpected error occurred: Error: Cannot find module '@nomiclabs/hardhat-truffle5' ...
Internet and Computer Probe's user avatar
0 votes
1 answer
408 views

Error: Returned error: nonce too low

const Web3 = require('web3'); const { ethers } = require('ethers'); const { Web3Provider } = require('@ethersproject/providers'); // Virtual addresses const fromAddress = '...
Amin Hlel's user avatar
0 votes
0 answers
27 views

Is there any way to get the array length inside a mapping without a getter function or count variable?

mapping(address => uint256[]) public submitterAddressToFormIdsAssigned; This is a mapping from an address to an array of uint256s. I want to get the length of array. I used a count variable before ...
Gaurav Pant's user avatar
1 vote
0 answers
41 views

How to let client side sign the transaction and send it to blockchain

This mint function is giving me this error Uncaught (in promise) Error: Returned error: transaction could not be decoded: unsupported transaction type And if I use ethereum-js/tx module to serialize ...
kaan.py's user avatar
  • 11
0 votes
0 answers
58 views

Error: Keys not exchanged when calling await ethereum.request({method: 'eth_requestAccounts'})

I am trying to connect my React Native app to MetaMask with MetamaskSDK, but I am getting the error "Error: Keys not exchanged" when calling await ethereum.request({method: '...
matanCohen's user avatar
0 votes
1 answer
99 views

CORS policy error when trying to render image from pinata ipfs

pinata.js file const FormData = require("form-data"); export const uploadJSONToIPFS = async (JSONBody) => { const url = `https://api.pinata.cloud/pinning/pinJSONToIPFS`; //making ...
soumyadeep.eth's user avatar
1 vote
2 answers
624 views

Web3ReactProvider || Cannot read properties of undefined (reading 'length') || Error while using web3-react/core

getting this error while consuming the web3provider, Did the same configuration as per the tutorial.
amit perane's user avatar
0 votes
0 answers
60 views

Withdraw USDT or BNB from BSC

how to withdraw USDT (Tether) or BNB from my wallet to a specific address using the Web3j Java Spring framework on the Binance Smart Chain (BSC)?
softweng's user avatar
1 vote
1 answer
42 views

Automate transactions from hardware wallet: Proxy Contract?

I have some scripts (web3.js) running that automatically send transactions for me. I'd like to secure the used funds with my hardware wallet (or really any "real" way), which is of course ...
master_axe's user avatar
0 votes
0 answers
25 views

Get all transactions from a contract in a range of block numbers

I need to get all contract transactions from a range of blocks (startBlock-endBlock). what is the best way to do this? any recommended APIs for this purpose?
Adrin's user avatar
  • 199
0 votes
2 answers
832 views

Is there a way to get the transaction hash from a contract address during contract creation using Ethers js or Web3 js?

I've tried getting the transaction count of the smart contract and tried to return the first transaction of the contract which is during its creation. But currently I can't find anything for this. ...
Jason's user avatar
  • 1
0 votes
1 answer
220 views

Web3Auth method to enter email Id and get the value of wallet address as return value

Is there any web3Auth method which takes email id as input and returns a wallet address as output ? The wallet address returned should be real . By real I mean , if the user logs in with the emailId ...
Gaurav Pant's user avatar
0 votes
0 answers
100 views

Error: Invalid JSON RPC response: "" at Object.InvalidResponse

I am trying to make a voting system using blockchain. I am using ganache to deploy the smart contracts. I made connection using web3.ts import Web3 from "web3"; import data from "../...
Khushi's user avatar
  • 1
0 votes
1 answer
256 views

Convert eth_signTypedData_v4 signature to (v r s) format [duplicate]

I have signature that I signed with "eth_signTypedData_v4" method: signature = "...
Kanopi's user avatar
  • 1
1 vote
1 answer
211 views

web3js how to simulate a transaction without getting it mined

How do I simulate a transaction using web3js? I want to know whether the token is a scam honeypot and find out how much buy and sell tax it has.
kakakakakakakk's user avatar
1 vote
1 answer
39 views

Unexpected return of a function

I have a function on my contract that return true if the address on one list is equal to the msg.sender. The function works fine on remix but when I call it utilizing javascript with next.js and web3....
Hash1's user avatar
  • 13
2 votes
2 answers
687 views

Generate route for Sushi Swap Route Processor processRoute contract method

I'm trying to programically use RouteProcessor smart contract by Sushi Swap. Here you can see contract https://etherscan.io/address/0xF70c086618dcf2b1A461311275e00D6B722ef914. I gathered information ...
Sultan Nasyrov's user avatar
1 vote
2 answers
45 views

Solidity contract returns object rather than a string

I have this contract function function getPrize(string memory data, bytes memory signature) public returns (string memory); I use Mumbai test net if it makes any difference. I send this function and ...
Mary Reznik's user avatar
1 vote
1 answer
25 views

What is a good use case for .call functions' ability to pass a function call?

Following up on this thread, I wish to understand what will be a good use case using the feature to call a function in .call{}() ?
Mrigendra Soni's user avatar
1 vote
1 answer
26 views

sending a method on nodejs with admin account

I want to send a method from the owner's account to which I have the private key. I tried adding the private key int he red rectangle but when I run it I get this error:
Djillali SE's user avatar