Skip to content

Commit 1a82d1d

Browse files
author
H
committed
Merge branch 'develop'
2 parents 7bbd97d + 799da82 commit 1a82d1d

File tree

7 files changed

+33
-34
lines changed

7 files changed

+33
-34
lines changed

package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "zabo-nodejs-quickstart-app",
3-
"version": "0.9.1",
3+
"version": "0.10.0",
44
"private": true,
55
"scripts": {
66
"start": "node ./bin/www"
@@ -14,6 +14,6 @@
1414
"morgan": "~1.9.1",
1515
"open": "^7.0.0",
1616
"pug": "^2.0.4",
17-
"zabo-sdk-js": "^0.9.0"
17+
"zabo-sdk-js": "^0.10.0"
1818
}
19-
}
19+
}

public/scripts/script.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,16 @@
117117
for (let i = 0; i < transactions.length; i++) {
118118
let row = document.createElement('tr')
119119

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) + '...'
124120
let id = document.createElement('td')
125-
id.appendChild(idAnchor)
121+
if ((transactions[i].id || '').substr(0, 2) === '0x') {
122+
let idAnchor = document.createElement('a')
123+
idAnchor.href = Utils.getExplorerUrl(transactions[i].currency, 'tx/' + transactions[i].id)
124+
idAnchor.target = '_blank'
125+
idAnchor.innerText = (transactions[i].id || '').substr(0, 7) + '...'
126+
id.appendChild(idAnchor)
127+
} else {
128+
id.innerText = (transactions[i].id || '').substr(0, 7) + '...'
129+
}
126130
row.appendChild(id)
127131

128132
let currency = document.createElement('td')

public/scripts/utils.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
class 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
37+
case 'ETH':
38+
return 'https://etherscan.io/' + path
4339
default:
44-
return 'https://rinkeby.etherscan.io/' + path
40+
return '' + path
4541
}
4642
}
4743
}

routes/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@ router.post('/accounts', async (req, res) => {
3838
// Docs: https://zabo.com/docs/#get-a-specific-balance
3939
const balances = await zabo.users.getBalances({
4040
userId: myUser.id,
41-
accountId: account.id,
42-
currencies: ['ALL']
41+
accountId: account.id
4342
})
4443

4544
res.send({
4645
accounts: myUser.accounts,
4746
balances: balances.data,
48-
transactions: transactions
47+
transactions: transactions.data
4948
})
5049
} catch (err) {
5150
res.status(500).send({ message: err.message })

views/index.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ block content
6565
table
6666
thead
6767
tr
68-
th Wallet ID
68+
th Transaction ID
6969
th Currency
7070
th Type
7171
th Amount

views/layout.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ html
33
head
44
title= title
55
link(rel='stylesheet', href='/stylesheets/style.css')
6-
script(src='https://cdn.zabo.com/0.9.0/zabo.js')
6+
script(src='https://cdn.zabo.com/develop/0.10.0-beta.5/zabo.js')
77
body
88
block content
99
script(src='/scripts/utils.js')

0 commit comments

Comments
 (0)