/ksol

Kotlin library for Solana & reference Android wallet app

Primary LanguageKotlinApache License 2.0Apache-2.0

kSol - Kotlin library for Solana

kSol is a kotlin library for interacting with the Solana blockchain.

Features include:

  • First-class Kotlin API for interacting with the Solana JSON-RPC API.
  • Key management, including generate new public/private keys, seed phrases etc
  • Crafting and parsing Solana transactions
  • Signing and sending transactions
  • Subscribing to transaction/account updates
  • SolPay integration (including transfer & transaction requests)

The goal of the library is to provide everything that is needed to integrate with the Solana blockchain without relying on libraries from any other environment (like executing JS or native code). The library could be used in a native Android app, command line tool or as part of a JVM-backend service.

The repository also includes a reference Android wallet - called Solar - that demonstrates how the library can be used to provide basic wallet functionality.

Structure

The repository is structured into 4 high-level gradle modules:

  • lib: Provides the core functionality of the library.
    • The SolanaApi interface provides all the high-level functionality of the JSON RPC.
  • solpay: High-level library for working with SolPay urls.
    • The SolPay interface provides an entry point to all Solpay-related functionality.
  • cli: A Kotlin command line app for using the functionality of the core library.
    • This could be used as a (pointless) replacement for the standard Solana CLI tools.
    • The built in commands also offer a good look at how to use the library. The SendCommand, for example, shows creating, signing and sending a transaction as well as listening for finalization.
  • android: The Solar wallet, a non-custodial Android wallet app
    • Uses the ksol library to generate wallets/send transactions
    • Integrates SolPay
    • Integrates Solana mobile-wallet-adapter to provide wallet functionality to other apps