Skip to content

Commit

Permalink
adds ppom sepolia code improvements (#299)
Browse files Browse the repository at this point in the history
  • Loading branch information
seaona authored Mar 6, 2024
1 parent ba12ed1 commit 8295c9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ <h4 class="card-title">
</button>
<button
class="btn btn-primary btn-lg btn-block mb-3"
id="mintERC20"
id="mintSepoliaERC20"
hidden
>
Mint ERC20
Expand Down
18 changes: 10 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ const addEthereumChain = document.getElementById('addEthereumChain');
const switchEthereumChain = document.getElementById('switchEthereumChain');

// PPOM
const mintERC20 = document.getElementById('mintERC20');
const mintSepoliaERC20 = document.getElementById('mintSepoliaERC20');
const maliciousApprovalButton = document.getElementById(
'maliciousApprovalButton',
);
Expand Down Expand Up @@ -362,7 +362,7 @@ const allConnectedButtons = [
maliciousPermit,
maliciousTradeOrder,
maliciousSeaport,
mintERC20,
mintSepoliaERC20,
];

// Buttons that are available after initially connecting an account
Expand Down Expand Up @@ -405,7 +405,7 @@ const initialConnectedButtons = [
maliciousPermit,
maliciousTradeOrder,
maliciousSeaport,
mintERC20,
mintSepoliaERC20,
];

// Buttons that are available after connecting via Wallet Connect
Expand Down Expand Up @@ -440,7 +440,7 @@ const walletConnectButtons = [
maliciousPermit,
maliciousTradeOrder,
maliciousSeaport,
mintERC20,
mintSepoliaERC20,
];

/**
Expand Down Expand Up @@ -659,10 +659,12 @@ const handleNewChain = (chainId) => {

const handleNewNetwork = (networkId) => {
networkDiv.innerHTML = networkId;
if (networkId === ('11155111' || '0xaa36a7')) {
mintERC20.hidden = false;
const isNetworkIdSepolia = networkId === ('11155111' || '0xaa36a7');

if (isNetworkIdSepolia) {
mintSepoliaERC20.hidden = false;
} else {
mintERC20.hidden = true;
mintSepoliaERC20.hidden = true;
}
};

Expand Down Expand Up @@ -1488,7 +1490,7 @@ const initializeFormElements = () => {
*/

// Mint ERC20 in Sepolia
mintERC20.onclick = async () => {
mintSepoliaERC20.onclick = async () => {
const from = accounts[0];
const noPrefixedAddress = from.slice(2);
const result = await provider.request({
Expand Down

0 comments on commit 8295c9a

Please sign in to comment.