Skip to content

Commit

Permalink
Return count info instead of display flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Argeric committed Apr 16, 2024
1 parent 4aff656 commit 6d67aff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
18 changes: 6 additions & 12 deletions api/account_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,12 @@ func getAccountInfo(c *gin.Context) (interface{}, error) {
}

accountInfo := AccountInfo{
Balance: decimal.NewFromBigInt(balance, 0),
FileCount: submitStat.FileCount,
TxCount: submitStat.TxCount,
DataSize: submitStat.DataSize,
StorageFee: submitStat.BaseFee,
}

if accountInfo.TxCount > 0 {
accountInfo.TxTab = 1
}
if rewardStat.RewardCount > 0 {
accountInfo.RewardTab = 1
Balance: decimal.NewFromBigInt(balance, 0),
FileCount: submitStat.FileCount,
TxCount: submitStat.TxCount,
DataSize: submitStat.DataSize,
StorageFee: submitStat.BaseFee,
RewardCount: rewardStat.RewardCount,
}

return accountInfo, nil
Expand Down
3 changes: 1 addition & 2 deletions api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,5 @@ type AccountInfo struct {
DataSize uint64 `json:"dataTotal"` // Total Size of storage data
StorageFee decimal.Decimal `json:"storageFeeTotal"` // Total storage fee

TxTab uint8 `json:"txTab"` // Flag to display the tx list, 1 - has tx list, 0 - hasn't tx list
RewardTab uint8 `json:"rewardTab"` // Flag to display the reward list, 1 - has reward list, 0 - hasn't reward list
RewardCount uint64 `json:"rewardCount"` // Number of distributed reward recodes
}

0 comments on commit 6d67aff

Please sign in to comment.