Jupiter Dart SDK

pub package documentation

A robust, type-safe Dart SDK for interacting with the Jupiter Ultra API. The simplest and safest way to trade on Solana with support for transaction signing, order routing, execution, balances, and token shield info.

Features

  • Complete Ultra API Integration: All endpoints (order, execute, balances, shield)
  • Real Transaction Signing: Solana versioned transaction support with keypair signing
  • Type Safety: Full type-safe models with JSON serialization
  • Environment Support: .env file integration for Flutter apps
  • Dual Endpoints: Support for both free (lite-api.jup.ag) and paid (api.jup.ag) endpoints
  • Error Handling: Comprehensive error handling with detailed messages
  • Testing: Unit, mock, and integration tests included
  • Examples: Complete examples for all major use cases

Installation

Add this to your package's pubspec.yaml file:

dependencies:
  jupiter: ^1.0.0

Then run:

dart pub get

Quick Start

Set your environment variables:

export PRIVATE_KEY=your_base58_encoded_solana_private_key
export JUP_API_KEY=your_jupiter_api_key_optional

Here's a minimal example to get started:

See the example/ folder for full examples. Here is a minimal order and execute:

import 'package:jupiter/jupiter.dart';
import 'dart:io';

void main() async {
  final client = UltraApiClient(
    apiKey: Platform.environment['JUP_API_KEY'],
    privateKeyEnvVar: 'PRIVATE_KEY',
  );
  final taker = client.getPublicKey();
  final request = UltraOrderRequest(
    inputMint: 'So11111111111111111111111111111111111111112',
    outputMint: 'USDC111111111111111111111111111111111111111',
    amount: 1000,
    taker: taker,
  );
  try {
    final result = await client.orderAndExecute(request);
    print(result);
  } finally {
    client.close();
  }
}

Examples

You can find additional code examples in the example folder:

  • example/order-and-execute/main.dart: Place an order and execute it immediately
  • example/balances/main.dart: Fetch and display account balances
  • example/shield/main.dart: Get token information and warnings

Run examples with:

dart example/order-and-execute/main.dart
dart example/balances/main.dart
dart example/shield/main.dart

For a Flutter UI demonstration, see example/lib/main.dart.

Testing

  • Run all tests: dart test
  • Integration tests require real API key and Solana keypair

Contributing

PRs and issues welcome! See the Python SDK for reference: jup-python-sdk

License

MIT

Libraries

jupiter
Dart SDK for interacting with the Jupiter Ultra API.
ultra_execute_request_model
ultra_order_request_model