Comments (7)
Thanks @umbecanessa. The team will review this soon and get back with you.
from web3.js.
similar issue here. The method mentioned by OP doesn't seem to let Metamask handle gas dynamically.
In my case the following example seems to set the correct gas fee, but Metamask shows the transaction as failed, even though the transaction was actually successful. So I'd prefer to just let Metamask handle gas completely.
const gasEstimate = await erc20Contract.methods.approve(contractAddress, maxAllowance).estimateGas({ from: account });
const gasPrice = await web3.eth.getGasPrice();
const result = await erc20Contract.methods.approve(contractAddress, maxAllowance).send({
from: account,
gas: gasEstimate,
gasPrice: gasPrice
If we do this and then set "market" within Metamask gas settings, the transaction doesn't show as failed.
from web3.js.
Hey there, this is something we definitely can fix. Will probably be added as a flag to allow metamask to make suggestions. What methods were u using?
from web3.js.
Here's a very basic example:
import React from 'react';
import Web3 from 'web3';
const SimpleTransaction = () => {
const sendTransaction = async () => {
const web3 = new Web3(window.ethereum);
await window.ethereum.request({ method: 'eth_requestAccounts' });
const fromAccount = (await web3.eth.getAccounts())[0];
const transactionParameters = {
to: '0x.....',
from: fromAccount,
value: web3.utils.toWei('0.05', 'ether'),
maxPriorityFeePerGas: undefined,
maxFeePerGas: undefined
};
web3.eth.sendTransaction(transactionParameters);
};
return (
<div className="flex flex-col items-center">
<h1>Send Simple Transaction</h1>
<button onClick={sendTransaction}>
Send Transaction
</button>
</div>
);
};
export default SimpleTransaction;
This is a snapshot of Metamask showing wrong gas fee instead of using "market" suggested gas:
from web3.js.
web3.js/packages/web3-eth/src/web3_eth.ts
Line 1086 in 4c36f55
web3.js/packages/web3-eth/src/types.ts
Line 70 in 4c36f55
can you use above?
from web3.js.
use boolean flag to ignore gas price
from web3.js.
@umbecanessa @Cam-B Hey there sorry this needs to be clearer in the docs, but you can use the ignoreGasPricing flag
const transaction = await web3.eth.sendTransaction(
{
from: accounts[0],
to: 'address',
value: '1',
data: '0x01',
},
{ bytes: ETH_DATA_FORMAT.bytes, number: ETH_DATA_FORMAT.number },
{ ignoreGasPricing: true }
We'll close this issue now, but let us know if there are any other issues and we'll open it again
from web3.js.
Related Issues (20)
- create browser tests HOT 1
- Implement at `Contract` the parsing of the logs similar to `new ethers.Interface(ABI).parseLog(...)` HOT 1
- Implement a utility helper class that ease dealing with Ethereum Signature and support something similar to `ethers.Signature.from({r, s, v} | string)` HOT 3
- Add few utility functions like: numberToBytes, concat(Bytes[]) and contractFunctionId HOT 2
- Quicknodes provider
- How to setup a keepalive WebSocket connection with web3-providers-ws 4.x HOT 7
- encodeFunctionSignature returned signature is not identical with online HOT 2
- Invalid type for block transactions HOT 1
- The from address changes when the transaction gets signed and hashed. HOT 5
- Quicknode provider error rate limit
- Create documentation for Quicknode provider feature HOT 1
- Web3.js Wikipedia Page
- Add Http and ws options to web3-rpc-provider
- {Ethereum / Web3.js} TransactionRevertInstructionError: Transaction has been reverted by the EVM HOT 1
- failing suite - release canary
- Metamask Tutorial (using React)
- hello
- Circullar dependencies (Svelte + Rollup) HOT 2
- Tx middleware - Contracts support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from web3.js.