Skip to content

Commit

Permalink
add a link to tx history. close #11
Browse files Browse the repository at this point in the history
  • Loading branch information
hm0429 committed May 12, 2018
1 parent b860f37 commit bfcb90c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
5 changes: 5 additions & 0 deletions public/eth/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ <h5 class="card-title">Send ETH</h5>
<button class="btn btn-primary" id="send-eth-to-confirm-btn" type="button" data-toggle="modal" data-target="#send-eth-confirm-modal">Send Ether</button>
</div>
</div>
<div class="card mb-3">
<div class="card-body">
<h5 class="card-title">Transaction History</h5><a class="btn btn-outline-secondary btn-block" id="etherscan-link" target="_blank">Check tx history in EtherScan</a>
</div>
</div>
</div>
<!-- Send Ether Confirmation Modal-->
<div class="modal fade" id="send-eth-confirm-modal" tabindex="-1" role="dialog" aria-labelledby="send-eth-confirm-modal-label" aria-hidden="true">
Expand Down
15 changes: 9 additions & 6 deletions public/js/eth.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const HTTP_PROVIDERS = [
'',
'https://ropsten.infura.io'
];
const ETHERSCAN_TX_URLS = [
'https://etherscan.io/tx/',
const ETHERSCAN_URLS = [
'https://etherscan.io/',
'',
'https://ropsten.etherscan.io/tx/'
'https://ropsten.etherscan.io/'
]
var chainId = 1;

Expand Down Expand Up @@ -251,8 +251,8 @@ function registerCallbacks() {
$('#send-eth-btn').on('click', function() {
$('#send-eth-confirm-modal').modal('toggle');
sendEther(function(result) {
const baseUrl = ETHERSCAN_TX_URLS[chainId-1];
const url = baseUrl + result;
const baseUrl = ETHERSCAN_URLS[chainId-1];
const url = baseUrl + 'tx/' + result;
const e = $("<a></a>", {
href: url,
target: "_blank",
Expand Down Expand Up @@ -294,7 +294,10 @@ function registerCallbacks() {
}
});


const baseUrl = ETHERSCAN_URLS[chainId-1];
const address = wallet.getAddressString();
const url = baseUrl + 'address/' + address
$('#etherscan-link').attr('href', url);
}

function isChrome() {
Expand Down
4 changes: 4 additions & 0 deletions pug/eth/index.pug
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ html(lang='en')
.input-group-append
span#basic-addon2.input-group-text(readonly='') ETH
button#send-eth-to-confirm-btn.btn.btn-primary(type='button', data-toggle='modal', data-target='#send-eth-confirm-modal') Send Ether
.card.mb-3
.card-body
h5.card-title Transaction History
a#etherscan-link.btn.btn-outline-secondary.btn-block(target='_blank') Check tx history in EtherScan
// Send Ether Confirmation Modal
#send-eth-confirm-modal.modal.fade(tabindex='-1', role='dialog', aria-labelledby='send-eth-confirm-modal-label', aria-hidden='true')
.modal-dialog(role='document')
Expand Down

0 comments on commit bfcb90c

Please sign in to comment.