Skip to content

Commit 0a2ee12

Browse files
nrOfDecimals are trimmed if '0's
1 parent a74256e commit 0a2ee12

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Mx.NET.SDK.Core/Domain/ESDTAmount.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,13 @@ public string ToDenominated(int nrOfDecimals)
157157
start = start < 0 ? 0 : start;
158158

159159
var decimals = padded.Substring(start, Esdt.DecimalPrecision < nrOfDecimals ? Esdt.DecimalPrecision : nrOfDecimals);
160+
decimals = decimals.TrimEnd('0');
160161
var integer = start == 0 ? "0" : padded.Substring(0, start);
161162

162-
return $"{integer}.{decimals}";
163+
if (string.IsNullOrEmpty(decimals))
164+
return integer;
165+
else
166+
return $"{integer}.{decimals}";
163167
}
164168

165169
/// <summary>

0 commit comments

Comments
 (0)