Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function CustomAlert(){
- this.render = function(dialog){
- var winW = window.innerWidth;
- var winH = window.innerHeight;
- var dialogoverlay = document.getElementById('dialogoverlay');
- var dialogbox = document.getElementById('dialogbox');
- dialogoverlay.style.display = "block";
- dialogoverlay.style.height = winH+"px";
- dialogbox.style.left = (winW/2) - (550 * .5)+"px";
- dialogbox.style.top = "100px";
- dialogbox.style.display = "block";
- document.getElementById('dialogboxhead').innerHTML = "Transaction Confirmation";
- document.getElementById('dialogboxbody').innerHTML = dialog;
- document.getElementById('dialogboxfoot').innerHTML = '<button class="btn btn-warning" onclick="Alert.ok()">OK</button>';
- }
- this.ok = function(){
- document.getElementById('dialogbox').style.display = "none";
- document.getElementById('dialogoverlay').style.display = "none";
- }
- }
- var Alert = new CustomAlert();
- function buy() {
- var value = document.getElementById('ethAmountBuy').value;
- tokenContract.buy({
- from: user_address,
- value: Eth.toWei(parseInt(value), 'ether'),
- gasPrice: gasprice
- })
- .then(txHash => eth.getTransactionSuccess(txHash))
- .then(receipt => {
- Alert.render(`Transaction Sent\nTx Hash: ${receipt.transactionHash}`)
- })
- .catch((err) => {
- console.log(err);
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment