New answers tagged web3js
0
votes
Unit testing a Solidity Library function with a struct memory argument
What about a simple approach?
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;
import "hardhat/console.sol";
library BrickLib {
struct ECSignature {
uint8 v;
}
...
1
vote
web3.js how to call receive() external payable?
The receive() function does not exist but the fallback function exists, it will be triggered when a contract is sent Ether without any data. To interact with this receive() function in web3.js, you ...
1
vote
Accepted
adding BigNumbers with ethers
On ethers V5 the output is usually a object with two fields, isBignumber (boolean) and _hex field with a string representing the hexadecimal value of that number. So you need to pass inside Number(...
0
votes
Does using a very high gas limit somehow get your transactions executed slower?
Common advice would be to choose a comfortable gas limit to ensure your transaction doesn't revert, but don't overdo it. It is rare that you will have a transaction that consumes gas for a whole ...
eth♦
- 83.3k
0
votes
How get network ID with ethers.js?
This is a solution for ^6.3.0 version of ethers.js:
let userProvider = new ethers.BrowserProvider(provider);
let objectNetwork = await userProvider.getNetwork();
// returns a bigint
let chainId = ...
-1
votes
Why web3 and not just call JSON RPC API
Wow, I feel much smarter and way dumber after reading the content and then scrolling back up to the time stamp. Looks like Im about 4 years late to the game but all good! Ya'll take care, be well and ...
1
vote
Accepted
How to read all Transfers on blockchain
Hope I understood correctly the question.
You will see something like this as result for e in events.
I leave comments in this code to explain each part.
AttributeDict({'address': '...
0
votes
Web3py - Getting pending TX's?
The filter method you are trying to use there is actually to filter for event logs; that's why is returning already validated information.
You can learn more about event filters here.
To get ...
0
votes
How would I be able to set slippage for exactInputSingle on Uniswap v3 and Pancakeswap v3?
I somehow found a way to do this by using the sqrtPriceX96 in the token's pool address by querying slot0. The documentation for this is gone but I've searched and saw other people using this formula:
...
0
votes
Contract.methods.transfer is a not a function error using web3
Why are we still dealing with answers to a problem that is still occuring but the answer is four years and four months old. Unfortunately the error is still occuring so there is a flaw some where. ...
1
vote
web3 python - AttributeError: 'Eth' object has no attribute 'abi'
You can use a call to Web3.keccak instead.
The error shows up because the relavant Python modules do not have any function named encodeEventSignature. This is a npm module (JavaScript) function.
...
0
votes
Ethernaut Level 24 - Puzzle Wallet
Or you can setup like this by downloading the UpgradeableProxy-08.sol contract from OpenZeppelin github repo.
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
pragma experimental ABIEncoderV2;
...
2
votes
Accepted
How to know token transfered in pending status from memepool
You need to decode input params.
You can do this if you know ABI of the smart-contract address.
In your case it is not hard.
Smart contract address: 0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B
ABI (go ...
0
votes
Error: network does not support ENS (operation=“ENS”, network=“maticmum”, code=UNSUPPORTED_OPERATION, version=providers/5.5.3 Network doesnot support
The error message you encountered suggests that the address you provided is invalid. This could happen if there are unintended characters such as spaces or numbers included in the address. In your ...
0
votes
Buy token just after the pair deployment?
If the deployment transaction is in the public mempool, you can analyse the to and data parameters to check what it's about, or even simulate the transaction and check the events it generates.
So, ...
1
vote
How do I deposit and restore my Ethereum to my wallet?
You need to import your account into MetaMask. Read this guide on how to.
0
votes
How can I remove custom spending cap on Metamask?
Simple answer, you cannot for good reason.
Find your answer here.
We designed this interface to give you more control and visibility over your token allowances, since you'll be prompted to always ...
1
vote
Solidity's keccak256 hash doesn't match WEB3 keccak hash
I found a way in Python to do this in case you are still looking for the answer. Here is the code below. Here is how you can do this in Python. I'm using the web3.keccak method of brownie which is ...
0
votes
Can't catch all the events using ethers
When I have needed to listen to events in the past, I don’t need to instantiate the contract each time like this.
To be clear, im not sure why the method you’re using doesn’t work consistently - ...
0
votes
What exactly does the 'ethereum' keyword in 'window.ethereum' referring to?
You can think of window.ethereum as an object that let you communicate with a browser extension(in most cases Metamask). Actually, it literally is an object.
The browser extension(let's say Metamask) ...
1
vote
How does one create and send TXs on L2 - Arbitrum and others?
The algorithm should be the same because every L2 Ethereum chain works with the EVM (Ethereum VIrtual Machine). It is the algorithm every L2 ethereum chain uses
1
vote
Accepted
ethers js listening to events doesn't work
Use a targeted listener like 'Transfer', 'Approval', etc.
Also, use a different RPC; Chainstack offers free elastic BSC RPCs that worked perfectly for me here.
After changing these two things, this ...
0
votes
types/value length mismatch (argument="tuple", value='myAddress'
The issue seems to be related to passing the argument to the giveRightToVote function. The error message suggests that the value being passed as an argument is of the wrong type or length, and that it ...
0
votes
Default account is not reflected in Web3 instance created from injected current provider
you can use the following code to get an instance of web3.
import Web3 from "web3";
const getWeb3 = async () => {
let web3Instance;
let accounts;
if (window.ethereum) {
...
1
vote
Is it possibleimpersonate an account using only ethers.js without using Hardhat
here is the solution to impersonate account when we forked the mainnet using foundry. then we can use ether js to transfer eth from any whale account. why is it important because we always have ...
0
votes
Unhandled Exception: Connection refused - Truffle Ganache Connection with Flutter
Add
final String _rpcUrl =
Platform.isAndroid ? 'http://10.0.2.2:7545' : 'http://127.0.0.1:7545';
final String _wsUrl =
Platform.isAndroid ? 'http://10.0.2.2:7545' : 'ws://127.0.0.1:...
0
votes
How to detect if the user cancels a transaction in Metamask?
This migbt be the solution you looked for(Tested with Metamask and Ether.js):
....
}else if(err.code.toString()==='ACTION_REJECTED'){
//Ignore User rejected
}
....
I Know alittle bit dirty, ...
Top 50 recent answers are included
Related Tags
web3js × 6009solidity × 1658
go-ethereum × 758
metamask × 635
javascript × 500
truffle × 477
nodejs × 411
transactions × 357
blockchain × 352
contract-development × 351
ethereumjs × 277
events × 254
ethers.js × 251
dapps × 246
react × 226
ether × 196
erc-20 × 190
contract-deployment × 189
remix × 188
contract-invocation × 187
infura × 182
web3-providers × 170
dapp-development × 159
web3.py × 155
tokens × 147