> For the complete documentation index, see [llms.txt](https://hinkal-team.gitbook.io/hinkal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hinkal-team.gitbook.io/hinkal/hinkal-mobile-sdk/android/getting-started.md).

# Getting Started

This guide walks you through integrating the Hinkal Android SDK into your app.

{% hint style="info" %}
New to the SDK? Start with the Installation guide, then follow the steps below.
{% endhint %}

### Prerequisites

* The SDK added to your project (Installation)
* A wallet your app can sign with (EVM, Solana, or Tron)
* A chain id and token address to work with

### Overview

1. Implement a host wallet so the SDK can sign without holding the key.
2. Create a client and connect - this derives the shielded identity.
3. Call operations: deposit, transfer, withdraw, swap.

### Basic Setup

#### Import the SDK

```kotlin
import io.hinkal.mobile.Mobile
```

#### Create a client

```kotlin
val client = Mobile.newClient()
```

### Connecting a Wallet

Implement `HostWallet` so the SDK can read the address and request signatures. The key stays in your wallet.

```kotlin
class WalletHost(private val wallet: YourWalletImplementation) : HostWallet {
    override fun address(): String = wallet.address
    override fun chainID(): Long = wallet.chainId
    override fun personalSign(message: String): String = wallet.personalSign(message)
    override fun sendTransaction(toHex: String, dataHex: String, valueDec: String, gasLimit: Long): String =
        wallet.sendTransaction(toHex, dataHex, valueDec, gasLimit)
    override fun switchChain(chainID: Long) = wallet.switchChain(chainID)
}
```

Connect - the wallet signs a session message and the SDK derives the shielded identity:

```kotlin
val address = client.connect(WalletHost(yourWallet))
val hinkal = client.hinkal()
```

### Core Operations

#### Check Balance

```kotlin
val balance = hinkal.getTotalBalance(chainId, signature, address, false, false)
```

#### Deposit Tokens

```kotlin
val wei = Mobile.amountToWei(chainId, tokenAddress, "1.0")
val deposit = hinkal.deposit(chainId, "[\"$tokenAddress\"]", "[\"$wei\"]", true, false)
```

#### Private Transfer

```kotlin
val transferWei = Mobile.amountToWei(chainId, tokenAddress, "0.5")
val transfer = hinkal.transfer(chainId, "[\"$tokenAddress\"]", "[\"$transferWei\"]",
                               recipientPrivateAddress, tokenAddress, "")
```

#### Withdraw Tokens

```kotlin
val withdrawWei = Mobile.amountToWei(chainId, tokenAddress, "0.25")
val withdraw = hinkal.withdraw(chainId, "[\"$tokenAddress\"]", "[\"$withdrawWei\"]",
                               recipientPublicAddress, false, tokenAddress, "")
```

#### Swap Tokens

```kotlin
// Get quote first
val quoteJson = hinkal.getEvmSwapPrices(chainId, inWei, inToken, outToken)

// Perform swap
val swap = hinkal.swap(chainId, "[\"$inToken\", \"$outToken\"]", "[\"$inWei\"]",
                       actionID, swapData, inToken, "")
```
