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?