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

Web3.js => _data.trim() is not a function?

Trying to deploy to ganache but keeps giving this error. Error : TypeError: _data.trim is not a function at ContractBuilder.deploy (C:\Users\user\Desktop\lotteryv2\node_modules\web3-eth-contract\lib\...
seojunchian's user avatar
0 votes
0 answers
5 views

Subscribing once to a smart contract event

I am trying to subscribe and then unsubscribe right after using the .once as stated on the web3 1.2.0 documentation (there is none for 4.7.0 which I am using). But it throws off an error: Error ...
Yazi's user avatar
  • 1
0 votes
1 answer
10 views

How can i connect okx wallet (web3-react v6)?

I am still using web3-reactv6, and I want to use both MetaMask and OKX wallets in my Dapp. However, I am using the Injected connector for both, so I am currently unable to distinguish between them. ...
lucia's user avatar
  • 1
0 votes
1 answer
16 views

What is the best way to monitor all token balances of wallet address?

Context I'm developing a personal project to monitor token balances of all wallet addresses in my service . I can monitor token balances of several addresses by multicall. I designed my workflow of ...
CT95's user avatar
  • 386
0 votes
0 answers
41 views

Why is the transaction fee very high?

I am sending transaction to Sepolia testnet from browser. The code I have is: await provider.request({ method: 'eth_sendTransaction', params: [ { from: account....
Joey Yi Zhao's user avatar
0 votes
1 answer
14 views

My web3 js transaction has a gas estimate of $0.02 displayed with rainbow wallet, but with metamask it displays as $2.00

The more accurate is $0.02, is there anything I can do to make metamask look better. This is on base chain.
NimChimpsky's user avatar
0 votes
0 answers
17 views

Web3 validator found 1 error[s]: must NOT have fewer than 1 items

I am using wagmi web3 modal in my project. Recently, I have been getting error in my code. Code: const gasLimit: any = await contract.methods[method] .apply(null, Array.prototype....
Shubham Sharma's user avatar
0 votes
1 answer
21 views

How can I get the correct pair price from Uniswap v3 pool?

Code showing me token price in wrong format. How to solve it? From the code I got: 1 WETH = -3.30628482e-9 USDC 1 USDC = -302454281.60057910558352924961 WETH But the real/expected values were: 1 ...
shakil khan's user avatar
0 votes
0 answers
12 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
1 answer
14 views

deflationary tokens vs inflationary tokens

Why do deflationary tokens exist? What are the advantages? How they are different from inflationary tokens?
Saikat Karmakar's user avatar
0 votes
1 answer
41 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
  • 51
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'> <...
jawad alkazzaz's user avatar
0 votes
0 answers
11 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
38 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
0 answers
9 views

Scan transfers of token on ethereum using web3.py

I am trying getting specific token transfers value using web3.py library. I succeeded getting all transactions where in the transaction there is the token transferred. My problem is that the value ...
Joel van der Boom's user avatar
0 votes
0 answers
9 views

Got metamask connection disconnect when sending a transaction

I am building a dapp with web3 and call smart contract running in sepolia testnet. I have below code to send transaction: provider.request({ method: 'eth_sendTransaction', params: [ ...
Joey Yi Zhao's user avatar
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
0 answers
12 views

How to send entire account balance to another address on Base

The below code is what I used to transfer entire account balance to other address on the ERC20 network and it works fine on it, but not on Base. Maybe it's because Base has different transaction fee ...
Zero's user avatar
  • 103
0 votes
0 answers
11 views

Replacement fee too low, Base Sepolia

This is the code I have for sending a transaction on Base Sepolia. I am using this to split the balance in my account into two halves and sending each half to an address one by one. export async ...
Zero's user avatar
  • 103
1 vote
1 answer
96 views

How can I decode the output of the first call and use it to send a transaction?

I am attempting to call view function “0x…” with argument of value “3…” to a specific address “0x…” and also send X wei to that address I am looking to acquire the hash of the successful tx. Tools/...
QuantumDomain's user avatar
0 votes
1 answer
20 views

Get unknown account when sending transaction to ethereum testnet network

I am using web3 library to send transaction to Ethereum testnet network. Below is the code: const w = new web3(process.env.NEXT_PUBLIC_ETHEREUM_NETWORK); const transaction: Transaction = { ...
Joey Yi Zhao's user avatar
1 vote
0 answers
9 views

Currently I am on Lesson: 9 of PatrickCollins Course- Error: VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()'

Could someone please help me understand and resolve the following error in my code? Error: VM Exception while processing transaction: reverted with custom error 'InvalidConsumer()' Here is the Raffle....
Hrithik's user avatar
  • 11
0 votes
0 answers
9 views

DNS using blockchain (how can i hashed my domain name ) in the code below help me to complete this code

import Web3 from "web3"; import Registry from "./contracts/Registry.json"; import Resolver from "./contracts/Resolver.json"; import Cache from "./contracts/Cache....
Zain Alramahi's user avatar
0 votes
0 answers
11 views

Facing this error "Error: transaction has been reverted by the evm, fail to send transaction"

This is my web console error: web3.min.js:22 Uncaught (in promise) Error: Transaction has been reverted by the EVM: { "blockHash": "...
noemotions's user avatar
1 vote
0 answers
17 views

Optimism Swap problem in Web3.py

Error in code when trying to swap from Optimism to usdt or usdc via Web3.py library I have code that swap successfully to Arbitrum, Polygon but error in Optimism. I am using MetaAggregationRouterV2 ...
patifon's user avatar
  • 11
0 votes
1 answer
20 views

Web3.js does not include extra data with the function?

I encountered a problem where the included hex data is not visible on the blockchain. Here's the code snippet I used: const tx = { from: wallet.address, to: to, chainId: 44445, value: ...
Toni Dev's user avatar
  • 120
0 votes
2 answers
31 views

uniswapRouter.getAmountsOut returns less value of token B than present in reverses when provide full amounts of token A

I have the next code to get familiar with uniswap mechanics: create pair contract get reserves invoke getAmountsOut and provide all UNI token reserves const pairAddress = await _V2Factory.getPair(...
user133422's user avatar
0 votes
0 answers
17 views

How find in bytecodes part of the code?

If with this code I can find the signature of a function in a solidity contract: const hash = Web3.utils.sha3(word).slice(0, 10).substring(2); How could I find another one? ex: assert(a == 0 || c / a ...
Cazs's user avatar
  • 1
0 votes
0 answers
25 views

How can I get private key from metamask when sending a transaction?

I am using web3 to send a transaction to smart contract in ethereum network. web3 library has a method web3.eth.accounts.signTransaction(tx, privateKey [, callback]); to sign a transaction but it ...
Joey Yi Zhao's user avatar
0 votes
1 answer
12 views

ethers read WETH allowance throwing call revert exception

I am trying to read the WETH allowance of an account on blast (blast.io). So far I have tried different ABIs but all of them result in errors. const WETH_ADDRESS = "...
sha237's user avatar
  • 1
0 votes
1 answer
26 views

Feeding a Smart contract with large Data

I want to feed a smart contract with multiple 5000 or more wallet addresses (for whitelisting purposes) in an array in a single transaction. How can I achieve that without sending data in chunks? ...
Bhushan Dhiware's user avatar
0 votes
2 answers
36 views

Is it possible to make an atomic transaction using web3.js only?

I am currently working on a project using web3.js that invloves making 2 transactions atomically. Is it possible to pass those 2 transactions in a single transaction object to make it atomic or is the ...
John's user avatar
  • 1
1 vote
0 answers
18 views

Solidity: getStudentNotifications Retrieves notifications to other metamask account instead of one metamask account

I have two metamask accounts, one is Vamshi (student) and Mike(University). I use Vamshi's account to call the function sendRecordsToUniversity and the university address, I use here is Mike's. so the ...
Robert Downey Jr.'s user avatar
0 votes
1 answer
31 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
2 votes
3 answers
52 views

How does Etherscan decode unverified contracts events?

Etherscan is able to decode event data from unverified contracts, even without an exposed ABI. Below is an example screenshot. No signature available for this event. I've been able to replicate the ...
user130657's user avatar
0 votes
1 answer
20 views

Etherscans ABI and transaction receipt topic[0] are different. Bug?

I need simply to get Transfer data values from transaction with 1 log https://etherscan.io/tx/0x6465187a7bb43a6db42ee63e5f5cc30fb094393957a7f1ce6c08b5afddf3e0bc. It sends +7,601.747 LINK. The problem ...
sirjay's user avatar
  • 111
0 votes
1 answer
21 views

InvalidResponseError: Returned error: unknown account

I'm attempting to sign a transaction using an account stored locally on my system. In the code below, you can see that I'm reading the file of that account and all other accounts stored using the ...
Alireza's user avatar
  • 533
1 vote
1 answer
122 views

Web3 Contract (React) - SafeERC20 Low Level Call failed with ERC20 Token (USDT)

I am working since 8 days on a problem with my smart contract and / or with my Web3 App. If I try to use the contract with ETH it works well in the moment I try to use it with an ERC20 token (USDT) it ...
Aleksandar's user avatar
1 vote
1 answer
39 views

Cannot send USDT on Polygon : Error happened while trying to execute a function inside a smart contract

//token_address is the adress of the contract : 0xc2132D05D31c914a87C6611C10748AEb04B58e8F //because USDT on polygon is a Proxy contract, minABI is the abi of the contract where it redirect : https://...
Francois's user avatar
1 vote
1 answer
23 views

How to integrate a web3 browser in my crypto wallet expo app

I have created a crypto wallet using Expo and now want to integrate a web3 browser like they have in metamask or trustwallet. i don't know how to start, any guidance or article or help will be highly ...
Shivam Yadav's user avatar
0 votes
1 answer
21 views

Transaction fees too high for swapExactETHForTokens

I've written a script to buy tokens in javascript. The issue is I keep getting an error showing abnormally high transaction fees. This is my script const buyFunction = this.pancakeContract.methods....
ahabsy's user avatar
  • 1
0 votes
0 answers
23 views

Swapping tokens with code

how do I swap tokens using java script in pancake swap v3 I'm looking for source code but not finding it anywhere
RichMond's user avatar
1 vote
2 answers
26 views

How does the real Ether work in ERC20 protocol?

I am reading ERC20 protocol and learning how that is implemented from OpenZeppelin: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol The code demoed ...
Joey Yi Zhao's user avatar
0 votes
1 answer
16 views

Why is the gas fee shown on Ether scan is different than the transaction I sent?

I sent a transaction to Ethereum test network sepolia as below code: const transaction = { from: account.address, to: contractAddress, gas: 202419, ...
Joey Yi Zhao's user avatar
1 vote
1 answer
43 views

How to get revert message in Web3js?

I want to get the revert massage from a send method call to a smart contract. So I use: receipt.logs[0].data that is a string containing a hexadecimal value. Now I want to to decode this value to get ...
Alireza Zojaji's user avatar
0 votes
1 answer
12 views

Metamask Mobile problem

code: if (!$metamask.states.connected || !connectedAddress.value) { errorMessage.value = 'Please connect your wallet first.'; showModalError.value = true; return; } let ...
brok 3's user avatar
  • 1
0 votes
0 answers
10 views

Unhandled Rejection (Error): ENS is not supported on network private

Unhandled Rejection (Error): ENS is not supported on network private l.<anonymous> /packages/web3-eth-ens/lib/ENS.js:481 478 | if (!this._detectedAddress) { 479 | var networkType = await ...
Nishant Patil's user avatar
0 votes
0 answers
23 views

The 'myEvent' is not being set in the getPastEvents function of web3.js

I am using "web3" : "4.5.0" I am trying to use the getPastEvents function in accordance with the official documentation of web3.js to view the emitted events for a specific event. ...
권승미's user avatar
0 votes
2 answers
49 views

Send a transaciton to Sepolia network but it can't be found from `sepolia.etherscan.io`

I am using below code to call a smart contract deployed in Sepolia network. const w = new Web3('https://rpc.sepolia.org'); await w.eth.accounts.signTransaction( { from: ...
Joey Yi Zhao's user avatar
0 votes
0 answers
31 views

Etherscan API doesn't return internal transaction (although it has)

Here is transaction https://etherscan.io/tx/0x33e0dab83aa27ba8b2a08b3c69d61a34911a4adb6e7a35dd30cf11383f43fcc3 with simple Transfer() some GALA tokens. Etherscan shows 1 internal transaction: But it'...
sirjay's user avatar
  • 111

1
2 3 4 5
123