Как сделать сразу 2 контракта когда наажимаешь кнопку mint?

const ethereumButton = document.querySelector('.enableEthereumButton');
                const sendEthButton = document.querySelector('.sendEthButton');
                console.log(sendEthButton)
                const amountInput = document.querySelector('.ticketAmount');
                
                window.web3 = new Web3(ethereum);
                let accounts = [];
                
                
                
                document.addEventListener("DOMContentLoaded", function(event) {
                getAccount();
                });
                //Sending Ethereum to an address
                sendEthButton.addEventListener('click', () => {
                let inputAmount = document.getElementById("ticketAmount").value * 0.1 ;
                const amount = web3.utils.toWei((Math.round(inputAmount * 10000) / 10000).toString(), 'ether');
                const value = web3.utils.toHex(amount);
                ethereum
                .request({
                 method: 'eth_sendTransaction',
                 params: [{
                     from: accounts[0],
                     to: '0xEa060460C4dC772D041cC9a20A0C56791f84ddcB',
                     value: web3.utils.toHex(amount),
                
                 }, ],
                })
                .then((txHash) => console.log(txHash))
                .catch((error) => console.error);
                });
                
                // ethereumButton.addEventListener('click', () => {
                //   getAccount();
                // });
                
                async function getAccount() {
                accounts = await ethereum.request({
                method: 'eth_requestAccounts'
                });
                }
                document.querySelector('#mint-options').onsubmit = function() {
                return false;
                }

вот код там есть кнопка MINT и он должен сделать 2 контракта в данном случае с ценой 0.1 а еще 1 сразу с больше ценой которую можно регулировать
  • Вопрос задан
  • 112 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы