magicblock-labs / magicblock-labs/Solana.Unity-Core
[Bug] ORCA get swap quote not working
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 53
- Forks
- 23
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
Swap quote with ORCA dex is not working properly.
When using the method `GetSwapQuote(...)`, an error with message "Conversion not possible" appears.
This is preventing swaps to work properly with ORCA.
**To Reproduce**
There are 2 ways to reproduce:
- **Simple approach:** Go to https://magicblock-labs.github.io/Solana.Unity-SDK/ and try to do a swap
- **Technical approach:** Write the code below and try to do a swap
```cs
try {
TokenData tokenA = await dex.GetTokenByMint("So11111111111111111111111111111111111111112");
TokenData tokenB = await dex.GetTokenByMint("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
SwapQuote _swapQuote = await dex.GetSwapQuote(
tokenA.MintAddress,
tokenB.MintAddress,
DecimalUtil.ToUlong(amountInSol, tokenA.Decimals)
);
}
catch (Exception ex)
{
Debug.LogError(JsonConvert.SerializeObject(ex));
}
```
**Expected behavior**
The error comes from the method `public static Percentage FromDouble(double dValue)` present in **src/Solana.Unity.Dex/Math/Percentage.cs**
This method should return a Percentage value instead of throwing an error.
**Screenshots**
**Desktop (please complete the following information):**
- OS: Linux Ubuntu 25.04
- Unity version: 6000.0.65f1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/Solana.Unity.Dex/Math/Percentage.cs at Percentage.FromDouble(double dValue), then follow the GetSwapQuote(...) path used by the ORCA example. Reproduce with the Solana Unity SDK swap page or the token mint code in the issue. Done means FromDouble returns a Percentage value and the ORCA quote no longer reports "Conversion not possible".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, unity
- Domain
- blockchain
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100