Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Allows non RSK checksumed addresses

  • Loading branch information
alepc253 committed Dec 3, 2018
1 parent a1a87ed commit 555988c7bdc5058a268d20ba8dea7e46bff4caaa
Showing with 9 additions and 7 deletions.
  1. +1 −1 lib/rsk-helper.js
  2. +8 −6 rsk-faucet.js
@@ -35,7 +35,7 @@ document.addEventListener("DOMContentLoaded", function() {
cache: false,
data: {"rskAddress" : rskAddress, "captcha": captchaText},
success: function callFunction(result) {
$("#toRskResult").html('<h3>Successfully sent some RBTCs to that address</h3>');
$("#toRskResult").html('<h3>' + result + '</h3>');
$("#toRskForm").hide();
},
error: function (xhr, status, error) {
@@ -197,11 +197,6 @@ app.get('/balance', function (req, res) {
});

app.post('/', function (req, res) {
if (!isValidRSKAddress(req.body.rskAddress, 31)) {
console.log('Invalid RSK address format ', req.body.rskAddress);
return res.status(400).send('Invalid RSK address format.');
}

if (accountAlreadyUsed(req.body.rskAddress)) {
console.log('Address already used today:', req.body.rskAddress);
return res.status(400).send('Address already used today.');
@@ -225,7 +220,14 @@ app.post('/', function (req, res) {
executeTransfer(req.body.rskAddress)

faucetHistory[req.body.rskAddress.toLowerCase()] = {timestamp: new Date().getTime()};
res.send('Successfully sent some RBTCs to ' + req.body.rskAddress + '.');
if (isValidRSKAddress(req.body.rskAddress, 31)) {
res.send('Successfully sent some RBTCs to ' + req.body.rskAddress + '.');
} else {
console.log(rskUtil.toChecksumAddress(req.body.rskAddress.toLowerCase(), 31));
res.send('Successfully sent some RBTCs to ' + req.body.rskAddress + '. </br>' +
'Please consider using this address with RSK Testnet checksum: ' + rskUtil.toChecksumAddress(req.body.rskAddress.toLowerCase(), 31));
}

} else {
res.status(400).send('We can not tranfer any amount right now. Try again later.' + req.body.rskAddress + '.');
}

0 comments on commit 555988c

Please sign in to comment.
You can’t perform that action at this time.