solana_kit_rpc_api 0.9.1 copy "solana_kit_rpc_api: ^0.9.1" to clipboard
solana_kit_rpc_api: ^0.9.1 copied to clipboard

RPC method type definitions for the Solana Kit Dart SDK.

solana_kit_rpc_api #

pub package docs website CI coverage

RPC method type definitions and parameter builders for the Solana Kit Dart SDK.

This package defines the request and response shapes for every Solana JSON-RPC method: config classes like GetBalanceConfig, parameter builders like getBalanceParams, and the response types those calls return. solana_kit_rpc composes these into the typed client you call directly.

Installation #

Install the package directly:

dependencies:
  "solana_kit_rpc_api": ^0.9.1

If your app uses several Solana Kit packages together, you can also depend on the umbrella package instead:

dart pub add solana_kit

Inside this monorepo, Dart workspace resolution uses the local package automatically.

Documentation #

For architecture notes, getting-started guides, and cross-package examples, start with the workspace docs site and then drill down into the package README and API reference.

Usage #

Building method parameters #

Each RPC method has a get<Method>Params function that turns typed arguments into the JSON-RPC params list.

import 'package:solana_kit_addresses/solana_kit_addresses.dart';
import 'package:solana_kit_rpc_api/solana_kit_rpc_api.dart';
import 'package:solana_kit_rpc_types/solana_kit_rpc_types.dart';

void main() {
  const target = Address('11111111111111111111111111111111');
  const config = GetBalanceConfig(commitment: Commitment.finalized);

  final params = getBalanceParams(target, config);

  print('RPC method params: $params');
}

Composing an API #

createSolanaRpcApi assembles the full set of method builders into a map you can pass to an Rpc implementation.

import 'package:solana_kit_rpc_api/solana_kit_rpc_api.dart';

void main() {
  final api = createSolanaRpcApi();
  print(api.runtimeType);
}

Key APIs #

  • Config classes: GetBalanceConfig, GetLatestBlockhashConfig, GetAccountInfoConfig, and the rest of the method configs.
  • Parameter builders: getBalanceParams, getLatestBlockhashParams, getAccountInfoParams, and so on.
  • createSolanaRpcApi(): the composed method map.

Example #

Use example/main.dart as a runnable starting point for solana_kit_rpc_api.

  • Import path: package:solana_kit_rpc_api/solana_kit_rpc_api.dart
  • This section is centrally maintained with mdt to keep package guidance aligned.
  • After updating shared docs templates, run docs:update from the repo root.

Maintenance #

  • Validate docs in CI and locally with docs:check.
  • Keep examples focused on one workflow and reference package README sections for deeper API details.