Skip to content

Instantly share code, notes, and snippets.

@cre-mer
Last active October 11, 2022 21:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cre-mer/f8fd231c93b5cd9ce1a9024d0f8a2ad4 to your computer and use it in GitHub Desktop.
Save cre-mer/f8fd231c93b5cd9ce1a9024d0f8a2ad4 to your computer and use it in GitHub Desktop.
JavaScript snippet to run from the browser console in https://faucet.polygon.technology/ to auto recharge an address.

How to

  1. Go to https://faucet.polygon.technology/
  2. Paste your address
  3. Copy and paste the script in the browser console
  4. Press enter and enjoy

Notes

Loop runs max 20 times. The faucet funds 0.5 MATIC each time and the faucet doesn't fund if address balance is bigger than 10 MATIC. After 20 runs an alert pops up with the message that it's done.

Attention

This gist only maintained as long as I'm using it. It's a very basic script that is not guaranteed to work.

function rechargeAccount() {
// submit
document.querySelector("#app > div > div > div.index > div > div > div:nth-child(1) > div > div > div > div:nth-child(7) > div > div > button").click();
// confirm
setTimeout(() => {
document.querySelector("#app > div > div > div.index > div > div > div:nth-child(1) > div > div.section.position-absolute > div.modal.show > div > div > div:nth-child(2) > div.ps-t-12 > div > button").click();
}, 1000);
// close after 2 sec
setTimeout(() => {
document.querySelector("#app > div > div > div.index > div > div > div:nth-child(1) > div > div.section.position-absolute > div.modal.show > div > div > div.row.top-section > a > img").click()
}, 2000);
};
var i = 0;
function rechargeAccountLoop() {
setTimeout(function() {
rechargeAccount();
i++;
if (i < 20) {
rechargeAccountLoop();
} else {
alert("done");
}
}, 65000)
}
rechargeAccount();
rechargeAccountLoop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment