Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bce39f

Browse files
committed
transfer amount details returned (for UX purposes)
1 parent 34a13a7 commit 8bce39f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

server.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ app.use('/hello/', function(req, res) {
4343

4444
// redirect to github pages
4545
app.use('/', function(req, res) {
46-
log.debug("redirecting request : ", req.url);
47-
res.writeHead(302, {'Location': 'https://eth2phone.github.io'});
48-
res.end();
46+
// log.debug("redirecting request : ", req.url);
47+
// res.writeHead(302, {'Location': 'https://eth2phone.github.io'});
48+
// res.end();
49+
res.redirect('https://eth2phone.github.io'+req.url)
4950
});
5051

5152

@@ -93,7 +94,7 @@ if (config.get('HTTPS_ON')) {
9394

9495
// redirect to https
9596
app.get('*',function(req,res){
96-
res.redirect('https://eth2phone.com'+req.url)
97+
res.redirect('https://eth2phone.github.io'+req.url)
9798
})
9899

99100
const portNum = config.get('port');

src/controllers/ReceiverController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function* confirm(req, res) {
7878
throw new BadRequestError('Please provide valid signature (s)');
7979
};
8080

81-
yield VeriedProxyContractService.checkTransferStatusBeforeWithdraw(transferId);
81+
const transferBc = yield VeriedProxyContractService.checkTransferStatusBeforeWithdraw(transferId);
8282

8383
// check that signature is valid
8484
signatureValid = yield VeriedProxyContractService.checkSignature(transferId,
@@ -91,7 +91,7 @@ function* confirm(req, res) {
9191
const pendingTxHash = yield VeriedProxyContractService.withdraw(transferId,
9292
to, v, r, s);
9393

94-
res.json({success: true, pendingTxHash})
94+
res.json({success: true, pendingTxHash, amount: transferBc.amount })
9595
}
9696

9797

src/services/VeriedProxyContractService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function* getByTransferId(transferId) {
4747
id: data[0].toString(),
4848
status: data[1].toNumber(),
4949
from: data[2].toString('hex'),
50-
amount: data[3].toNumber(),
50+
amount: web3.fromWei(data[3], 'ether').toString(10),
5151
blocknumber: data[4].toNumber()
5252
};
5353
}
@@ -73,7 +73,7 @@ function* checkTransferStatusBeforeWithdraw(transferId) {
7373
throw new BadRequestError("Transfer can't be received! Transfer status: " + transferBc.status);
7474
}
7575
}
76-
return true;
76+
return transferBc;
7777
}
7878

7979

0 commit comments

Comments
 (0)