services
Get a key

library / How to use Solana

Swap API

Swap API in the Carbium Library: 5 working Solana examples, among them Quote mint validation, vendor-neutral, Full-balance swap quote and Swap route breakdown.

  • Quote mint validation, vendor-neutral HS0073

    Catch a WrongSize mint error locally: check that a mint decodes to 32 bytes, exists and is owned by a token program before you request a quote.

  • Full-balance swap quote HS0044

    Read a wallet's full SPL token balance in base units and pass it as the amount of a Carbium swap quote request, in one read-only TypeScript file.

  • Swap route breakdown HS0043

    Read the route behind a Carbium swap quote, leg by leg, at three input sizes, in one read-only TypeScript file.

  • Swap slippage settings HS0042

    Set swap slippage from price drift per second times the seconds before landing, with a read-only TypeScript file that prints the minimum output.

  • Solana swap API quote HS0007

    Request a swap quote from Carbium's quote method on the RPC endpoint with one read-only TypeScript file, then read the reply before you build a swap.