Fix ADDRESS, check for commiteth, removing `data`
This commit is contained in:
parent
1b7252ed26
commit
5e08f347e0
5
index.js
5
index.js
|
@ -33,14 +33,14 @@ app.use(cors());
|
||||||
var issueData = {};
|
var issueData = {};
|
||||||
|
|
||||||
// Receive a POST request at the address specified by an env. var.
|
// Receive a POST request at the address specified by an env. var.
|
||||||
app.post('/address/:address', jsonParser, function(req, res, next){
|
app.post('/' + address.toString(), jsonParser, function(req, res, next){
|
||||||
if (!req.body)
|
if (!req.body)
|
||||||
return res.sendStatus(400);
|
return res.sendStatus(400);
|
||||||
var commentBody = req.body.comment.body;
|
var commentBody = req.body.comment.body;
|
||||||
var issueId = req.body.issue.id;
|
var issueId = req.body.issue.id;
|
||||||
var namePosition = commentBody.search("@" + name);
|
var namePosition = commentBody.search("@" + name);
|
||||||
// Store toAddress from commiteth
|
// Store toAddress from commiteth
|
||||||
if (namePosition == -1) {
|
if (namePosition == -1 && req.body.comment.user.login == 'commiteth') { // TODO no existence check
|
||||||
issueData[issueId] = {"toAddress": commentBody.substring(commentBody.search("Contract address:") + 18, commentBody.search("Contract address:") + 60)}
|
issueData[issueId] = {"toAddress": commentBody.substring(commentBody.search("Contract address:") + 18, commentBody.search("Contract address:") + 60)}
|
||||||
console.log(issueData);
|
console.log(issueData);
|
||||||
return res.status(204);
|
return res.status(204);
|
||||||
|
@ -66,7 +66,6 @@ app.post('/address/:address', jsonParser, function(req, res, next){
|
||||||
to: issueData[issueId].toAddress, // Address from earlier in the thread
|
to: issueData[issueId].toAddress, // Address from earlier in the thread
|
||||||
gas: 100000,
|
gas: 100000,
|
||||||
value: issueData[issueId].amount,
|
value: issueData[issueId].amount,
|
||||||
data: '0xde5f72fd', // sha3('faucet()')
|
|
||||||
nonce,
|
nonce,
|
||||||
}, (err, txID) => {
|
}, (err, txID) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in New Issue