Refactor totalTokens to usedTokens in API

pull/187/head^2
Martin Boehm 2019-05-24 16:24:34 +02:00
parent 42d3ecdd41
commit 6ec0175937
5 changed files with 16 additions and 16 deletions

View File

@ -248,7 +248,7 @@ type Address struct {
Transactions []*Tx `json:"transactions,omitempty"`
Txids []string `json:"txids,omitempty"`
Nonce string `json:"nonce,omitempty"`
TotalTokens int `json:"totalTokens,omitempty"`
UsedTokens int `json:"usedTokens,omitempty"`
Tokens []Token `json:"tokens,omitempty"`
Erc20Contract *bchain.Erc20Contract `json:"erc20Contract,omitempty"`
// helpers for explorer

View File

@ -505,7 +505,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc
} else {
txCount = int(data.txCountEstimate)
}
totalTokens := 0
usedTokens := 0
var tokens []Token
var xpubAddresses map[string]struct{}
if option > AccountDetailsBasic {
@ -516,7 +516,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc
for i := range da {
ad := &da[i]
if ad.balance != nil {
totalTokens++
usedTokens++
}
if option > AccountDetailsBasic {
token := w.tokenFromXpubAddress(data, ad, ci, i, option)
@ -542,7 +542,7 @@ func (w *Worker) GetXpubAddress(xpub string, page int, txsOnPage int, option Acc
UnconfirmedTxs: unconfirmedTxs,
Transactions: txs,
Txids: txids,
TotalTokens: totalTokens,
UsedTokens: usedTokens,
Tokens: tokens,
XPubAddresses: xpubAddresses,
}

View File

@ -366,7 +366,7 @@ Response:
"57833d50969208091bd6c950599a1b5cf9d66d992ae8a8d3560fb943b98ebb23",
"9cfd6295f20e74ddca6dd816c8eb71a91e4da70fe396aca6f8ce09dc2947839f",
],
"totalTokens": 2,
"usedTokens": 2,
"tokens": [
{
"type": "XPUBAddress",
@ -392,7 +392,7 @@ Response:
}
```
Note: *totalTokens* always returns total number of **used** addresses of xpub.
Note: *usedTokens* always returns total number of **used** addresses of xpub.
#### Get utxo

File diff suppressed because one or more lines are too long

View File

@ -27,10 +27,10 @@
</tr>
<tr>
<td>Used XPUB Addresses</td>
<td class="data">{{$addr.TotalTokens}}</td>
<td class="data">{{$addr.UsedTokens}}</td>
</tr>
<tr>
{{- if or $addr.Tokens $addr.TotalTokens -}}
{{- if or $addr.Tokens $addr.UsedTokens -}}
<td>{{if $data.NonZeroBalanceTokens}}XPUB Addresses with Balance{{else}}XPUB Addresses{{end}}</td>
<td style="padding: 0;">
<table class="table data-table">