| 1 |
<script> |
| 2 |
var tipButton = document.querySelector('.tip-button'); |
| 3 |
tipButton.addEventListener('click', function() { |
| 4 |
if (typeof web3 === 'undefined') { |
| 5 |
return alert('You need to install MetaMask to use this feature.') |
| 6 | } |
| 7 |
var user_address = web3.eth.accounts[0]; |
| 8 |
if (typeof user_address === 'undefined') { |
| 9 |
return alert('You need to log in MetaMask to use this feature.') |
| 10 | } |
| 11 |
web3.eth.sendTransaction({ |
| 12 |
to: "0x66454C561Cf137F53321945758b0E4645E9EEae8", |
| 13 |
from: user_address, |
| 14 |
value: web3.toWei('0.005', 'ether'), |
| 15 |
}, function (err, transactionHash) { |
| 16 |
if (err) return alert('Thanks for trying out!'); |
| 17 |
alert('Thanks for the generosity!!'); |
| 18 | }) |
| 19 | }) |
| 20 |
</script> |
Get latest updates news, movies, sports, Technology, Android, How to...and more
Comments
Post a Comment