Skip to content

[Bug] ORCA get swap quote not working #65

@pedroacamargo

Description

@pedroacamargo

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:

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

Image

Desktop (please complete the following information):

  • OS: Linux Ubuntu 25.04
  • Unity version: 6000.0.65f1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions