File tree Expand file tree Collapse file tree 2 files changed +17
-17
lines changed
Expand file tree Collapse file tree 2 files changed +17
-17
lines changed Original file line number Diff line number Diff line change 115115 for ( let i = 0 ; i < transactions . length ; i ++ ) {
116116 let row = document . createElement ( 'tr' )
117117
118- let idAnchor = document . createElement ( 'a' )
119- idAnchor . href = Utils . getExplorerUrl ( transactions [ i ] . currency , 'tx/' + transactions [ i ] . id )
120- idAnchor . target = '_blank'
121- idAnchor . innerText = ( transactions [ i ] . id || '' ) . substr ( 0 , 7 ) + '...'
122118 let id = document . createElement ( 'td' )
123- id . appendChild ( idAnchor )
119+ if ( ( transactions [ i ] . id || '' ) . substr ( 0 , 1 ) === '0x' ) {
120+ let idAnchor = document . createElement ( 'a' )
121+ idAnchor . href = Utils . getExplorerUrl ( transactions [ i ] . currency , 'tx/' + transactions [ i ] . id )
122+ idAnchor . target = '_blank'
123+ idAnchor . innerText = ( transactions [ i ] . id || '' ) . substr ( 0 , 7 ) + '...'
124+ id . appendChild ( idAnchor )
125+ } else {
126+ id . innerText = ( transactions [ i ] . id || '' ) . substr ( 0 , 7 ) + '...'
127+ }
124128 row . appendChild ( id )
125129
126130 let currency = document . createElement ( 'td' )
Original file line number Diff line number Diff line change 11class Utils {
2- show ( selector ) {
2+ show ( selector ) {
33 let elem = document . querySelector ( selector )
44
55 if ( elem ) {
66 elem . hidden = false
77 }
88 }
99
10- hide ( selector ) {
10+ hide ( selector ) {
1111 let elem = document . querySelector ( selector )
1212
1313 if ( elem ) {
1414 elem . hidden = true
1515 }
1616 }
1717
18- get ( url ) {
18+ get ( url ) {
1919 return window . fetch ( url )
2020 . then ( resp => resp . json ( ) )
2121 }
2222
23- post ( url , data ) {
23+ post ( url , data ) {
2424 return window . fetch ( url , {
2525 method : 'POST' ,
2626 headers : {
@@ -32,16 +32,12 @@ class Utils {
3232 . then ( resp => resp . json ( ) )
3333 }
3434
35- getExplorerUrl ( currency , path ) {
35+ getExplorerUrl ( currency , path ) {
3636 switch ( currency ) {
37- case 'HBAR' :
38- return ''
39- case 'BTC' :
40- return 'https://www.blockchain.com/btctest/' + path
41- case 'BCH' :
42- return 'https://explorer.bitcoin.com/tbch/' + path
43- default :
37+ case 'ETH' :
4438 return 'https://rinkeby.etherscan.io/' + path
39+ default :
40+ return '' + path
4541 }
4642 }
4743}
You can’t perform that action at this time.
0 commit comments