Return finalAmount as a string with 0 decimal places (rounded)

This commit is contained in:
Alfred Kamanda 2025-06-24 15:11:15 +03:00
parent dabdf7eba2
commit 88926480dc
Signed by: Alfred-mk
GPG Key ID: 7EA3D01708908703

View File

@ -38,11 +38,8 @@ func ParseAndScaleAmount(storedAmount, activeDecimal string) (string, error) {
multiplier := new(big.Float).SetInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(tokenDecimal)), nil)) multiplier := new(big.Float).SetInt(new(big.Int).Exp(big.NewInt(10), big.NewInt(int64(tokenDecimal)), nil))
finalAmount := new(big.Float).Mul(amount, multiplier) finalAmount := new(big.Float).Mul(amount, multiplier)
// Convert finalAmount to a string // Return finalAmount as a string with 0 decimal places (rounded)
finalAmountStr := new(big.Int) return finalAmount.Text('f', 0), nil
finalAmount.Int(finalAmountStr)
return finalAmountStr.String(), nil
} }
func ReadTransactionData(ctx context.Context, store DataStore, sessionId string) (TransactionData, error) { func ReadTransactionData(ctx context.Context, store DataStore, sessionId string) (TransactionData, error) {