Skip to content

Commit

Permalink
Refactor totalTokens to usedTokens in API
Browse files Browse the repository at this point in the history
  • Loading branch information
martinboehm committed May 27, 2019
1 parent 42d3ecd commit 6ec0175
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions api/xpub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand All @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ Response:
"57833d50969208091bd6c950599a1b5cf9d66d992ae8a8d3560fb943b98ebb23",
"9cfd6295f20e74ddca6dd816c8eb71a91e4da70fe396aca6f8ce09dc2947839f",
],
"totalTokens": 2,
"usedTokens": 2,
"tokens": [
{
"type": "XPUBAddress",
Expand All @@ -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

Expand Down
Loading

0 comments on commit 6ec0175

Please sign in to comment.