Skip to content

Commit

Permalink
execute transaction when the page is fully loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-dc committed Nov 13, 2018
1 parent 43c9b9f commit f1ce5d3
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions views/tx_submit.pug
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@ block content
if message
h3#message #{message}
script.
transaction = !{JSON.stringify(txn)}
console.log("Transaction:\n", transaction)
if (transaction) {
metamask.eth.sendTransaction(transaction, function(e, tx) {
if (!e) {
window.location.href = '/explorer/tx/pending'
} else {
document.getElementById('message').innerHTML = e.message;
}
})
}
window.onload = function() {
transaction = !{JSON.stringify(txn)}
console.log("Transaction:\n", transaction)
if (transaction) {
metamask.eth.sendTransaction(transaction, function(e, tx) {
if (!e) {
window.location.href = '/explorer/tx/pending'
} else {
document.getElementById('message').innerHTML = e.message;
}
})
}
};
else
h3 Submit transaction
form(action="/explorer/tx/submit", method="post")
Expand Down

0 comments on commit f1ce5d3

Please sign in to comment.