0

I'm working on a custom program that swaps coins on Jupiter Station. Is basically a Go program that connects via gRPC to a Node.js script (written entirely with Typescript) and performs the swap using the Jupiter Station SDK provided by the project.

For my tests, I requested a swap to Jupiter as follows:

running calisto on 0.0.0.0:50051
{
  inputMint: 'So11111111111111111111111111111111111111112',
  outputMint: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
  amount: 1000000,
  slippageBps: 50
}

(here is that transaction on solscan)

But then, my balance shows that I'm 0.1 USDC richer. That's perplexing because I thought that 1000000 was equivalent to 1 USDC, not 0.1.

Checking Circle's quick-start guide for "sending 10 USDC" you can see that such amount equals to 10000000:

// 10. The script calculates the actual amount in the smallest unit (10 USDC would be 10000000 in its smallest unit).
    let value = amount * (10 ** decimals)

I have to say that my balance shows correctly in my program, I checked my private key on Phantom Wallet and they are the same.

What am I doing wrong? How comes that balances show as expected, but Jupiter Station understands, 1000000 to be 0.1 USDC?

1 Answer 1

3

It looks like the amount is not for the outputMint, but instead for the inputMint in lamports, 0.001 SOL since there are 1e9 lamports per SOL. It just happens that SOL is around $100, so it came out to near .001 SOL * 100 USDC/SOL = $0.10.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.