-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add totalAssetValue in GetAccount API response #214
feat: add totalAssetValue in GetAccount API response #214
Conversation
@@ -76,6 +77,9 @@ func (l *GetAccountLogic) GetAccount(req *types.ReqGetAccount) (resp *types.Acco | |||
Nonce: account.Nonce, | |||
Assets: make([]*types.AccountAsset, 0, len(account.AssetInfo)), | |||
} | |||
|
|||
totalAssetPrice := big.NewFloat(0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
price
seems to be not a good name. How about totalAssetAmount
or totalAssetValue
? Can you refer to some dapp (e.g., pancake, uniswap) for the name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
totalAssetValue
seems better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, OK.
Thanks 👍
// 1. Convert unit of balance from wei to BNB | ||
// 2. Calculate the result of (BNB balance * price per BNB) | ||
balanceInFloat := new(big.Float).SetInt(asset.Balance) | ||
unitConversion := new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different assets have different units. Decimal
field of asset is for this, i believe.
docs/api_reference.md
Outdated
| pk | string | | Yes | | ||
| nonce | long | | Yes | | ||
| assets | [ [AccountAsset](#accountasset) ] | | Yes | | ||
| total_asset_price | string | | Yes | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to change the doc
Description
Add totalAssetValue in GetAccount API response.
Rationale
Account page need show the value
Example
N/A
Changes
N/A
/update-integration-keyfile