Skip to content

Commit 68a9f0f

Browse files
authored
Merge pull request #66 from pedroacamargo/dex-swap-conversion-error
Fix: ORCA Dex swap quote conversion error
2 parents b9d84ea + 7af2eae commit 68a9f0f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/Solana.Unity.Dex/Math/Percentage.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ public static Percentage FromDouble(double dValue)
150150
{
151151
double dTemp = dValue;
152152
long iMultiple = 1;
153-
string strTemp = dValue.ToString();
153+
string strTemp = dValue.ToString(System.Globalization.CultureInfo.InvariantCulture);
154154
while (strTemp.IndexOf("E") > 0) // if in the form like 12E-9
155155
{
156156
dTemp *= 10;
157157
iMultiple *= 10;
158-
strTemp = dTemp.ToString();
158+
strTemp = dTemp.ToString(System.Globalization.CultureInfo.InvariantCulture);
159159
}
160160
int i = 0;
161161
while (strTemp[i] != '.')
@@ -176,9 +176,9 @@ public static Percentage FromDouble(double dValue)
176176
{
177177
throw new PercentageException("Conversion not possible due to overflow");
178178
}
179-
catch (Exception)
179+
catch (Exception exp)
180180
{
181-
throw new PercentageException("Conversion not possible");
181+
throw new PercentageException("Conversion not possible: " + exp.Message);
182182
}
183183
}
184184

0 commit comments

Comments
 (0)