Skip to content
🎉 Welcome to the new Aptos Docs! Click here to submit feedback!

Kaptos

Kaptos is a Kotlin Multiplatform SDK for interacting with the Aptos blockchain across various platforms. It offers a consistent API for data requests, transaction submissions, and more, facilitating cross-platform app development with shared business logic. The SDK includes asynchronous Aptos clients for smooth blockchain interactions.

Kaptos also provides platform-specific SDKs for JVM, Android, iOS, JS, Linux, macOS, and Windows.

Android BadgeiOS BadgetvOS BadgewatchOS BadgeNodeJS BadgeJVM BadgeLinux BadgemacOS BadgeWindows Badge
Maven Central

Static Badge

Features

  • Type-safe: The SDK is fully type-safe and provides a rich set of types for all operations.
  • Expressive: Kaptos provides a simple and expressive DSL-style API for building transactions.
  • Multiplatform: Write cross-platform applications with shared business logic.
  • Consistent API: All operations bare a uniform and consistent API across all platforms.
  • BCS Support: The SDK defaults to BCS for serialization and deserialization of transactions.
  • Asynchronous: All blockchain operations are asynchronous.
  • Configurable: The SDK provides highly configurable clients for all platforms.
💡

Kaptos is currently under development, please give feedback here

Installation

commonMain.dependencies {
  implementation("xyz.mcxross.kaptos:kaptos:<version>")
}

Perform a Transaction

Below is an example of how you can perform a transaction using the Kotlin SDK. The snippet demonstrates how to build a transaction to transfer APT. We then sign and submit the transaction to the blockchain in a single step.

  val txn =
    aptos.buildTransaction.simple(
      sender = alice.accountAddress,
      data =
        entryFunctionData {
          function = "0x1::coin::transfer"
          typeArguments = typeArguments { +TypeTagStruct("0x1::aptos_coin::AptosCoin") }
          functionArguments = functionArguments {
            +bob.accountAddress
            +U64(SEND_AMOUNT_UNITS.toULong())
          }
        },
    )

The SDK also provides pre-built methods for common transaction operations. For example, you can use the transferCoinTransaction method to generate a transfer transaction between two accounts as shown below:

val txn = aptos.transferCoinTransaction(
     alice.accountAddress,
     bob.accountAddress,
     SEND_AMOUNT
   )

You can then sign and submit this transaction.

Examples

For more examples on how and what you can do with the Kotlin SDK, check out the following: