Skip to main content
The Kotlin SDK is for Android apps running Android 10 / API 29 or newer. You need a publishable key to create the client.

Install

Add the SDK dependency from Maven Central to your app module.
dependencies {
    implementation("io.github.0xsequence:oms-client-kotlin-sdk:0.1.0-alpha.4")
}
No additional SDK artifacts are required.

Create The Client

Use the Android constructor so the SDK can persist sessions securely.
import com.omsclient.kotlin_sdk.OMSClient

val client = OMSClient(
    context = context,
    publishableKey = "YOUR_PUBLISHABLE_KEY",
)
The publishableKey selects the matching OMS Wallet environment for client SDK calls. Create the client once for the app session. The client exposes:
PropertyUse
client.walletAuthentication, wallet selection, signing, signature verification, ID tokens, and transactions.
client.indexerToken balance and transaction history reads.
client.sessionCompleted wallet-session state restored from Android-backed storage.
client.supportedNetworksNetworks supported by this SDK build.

Authenticate With Email

Email auth is a two-step OTP flow.
import com.omsclient.kotlin_sdk.wallet.CompleteAuthResult

if (client.wallet.walletAddress == null) {
    client.wallet.startEmailAuth("user@example.com")

    // Show your OTP input, then complete auth with the user-entered code.
    val result = client.wallet.completeEmailAuth("123456")
    check(result is CompleteAuthResult.WalletSelected)

    println("Wallet address: ${result.walletAddress}")
}
completeEmailAuth uses automatic wallet selection by default: it selects the first wallet matching WalletType.Ethereum, or creates one if no matching wallet exists. Use walletSelection = WalletSelectionBehavior.Manual when your app should let the user choose between wallets.

Send A Transaction

After authentication, send a native token transaction with client.wallet.sendTransaction. Values are raw base-unit integers. Polygon Amoy is a good first network for testing.
import com.omsclient.kotlin_sdk.Network
import java.math.BigInteger

val tx = client.wallet.sendTransaction(
    network = Network.AMOY,
    to = "0x1111111111111111111111111111111111111111",
    value = BigInteger.ZERO,
)

println("Transaction id: ${tx.txnId}")
println("Transaction hash: ${tx.txnHash}")