Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add EIP1559 send that does not suggest any fees #119

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ <h4 class="card-title">
>
Send EIP 1559 Transaction
</button>

<button
class="btn btn-primary btn-lg btn-block mb-3"
id="sendFeelessEIP1559Button"
disabled
hidden
>
Send Feeless EIP 1559 Transaction
</button>

<hr />
<h4 class="card-title">
Contract
Expand Down
24 changes: 23 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ const contractStatus = document.getElementById('contractStatus');
// Send Eth Section
const sendButton = document.getElementById('sendButton');
const sendEIP1559Button = document.getElementById('sendEIP1559Button');
const sendFeelessEIP1559Button = document.getElementById(
'sendFeelessEIP1559Button',
);

// Send Tokens Section
const tokenAddress = document.getElementById('tokenAddress');
Expand Down Expand Up @@ -335,7 +338,7 @@ const initialize = async () => {
{
from: accounts[0],
to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970',
value: '0x29a2241af62c0000',
value: '0x0',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this change related? 🤔 Not that I'm opposed - it just seems out of place.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danjm ?

gasLimit: '0x5028',
maxFeePerGas: '0x2540be400',
maxPriorityFeePerGas: '0x3b9aca00',
Expand All @@ -345,6 +348,21 @@ const initialize = async () => {
console.log(result);
};

sendFeelessEIP1559Button.onclick = async () => {
const result = await ethereum.request({
method: 'eth_sendTransaction',
params: [
{
from: accounts[0],
to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970',
value: '0x29a2241af62c0000',
gasLimit: '0x5028',
},
],
});
console.log(result);
};

/**
* ERC20 Token
*/
Expand Down Expand Up @@ -986,11 +1004,15 @@ const initialize = async () => {
function handleEIP1559Support(supported) {
if (supported && Array.isArray(accounts) && accounts.length >= 1) {
sendEIP1559Button.disabled = false;
sendFeelessEIP1559Button.disabled = false;
sendEIP1559Button.hidden = false;
sendFeelessEIP1559Button.hidden = false;
sendButton.innerText = 'Send Legacy Transaction';
} else {
sendEIP1559Button.disabled = true;
sendFeelessEIP1559Button.disabled = true;
sendEIP1559Button.hidden = true;
sendFeelessEIP1559Button.hidden = true;
sendButton.innerText = 'Send';
}
}
Expand Down