Initialize

This document describes the initialization steps for using Android SDK in your project.

Obtaining Fncy AuthToken

  • Link for instructions on how to get your AuthToken.

Declaring Initialization in the Application Class

class FncyApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        FncyWalletSDK.initSDK(
            environment = Environment.Testnet // Testnet or Mainnet
        )
    }
}
  • application: application context

Create FncyWallet Object

val fncyWallet = FncyWalletSDK(token)

Usding FncyWallet

class FncyViewModel() : ViewModel() {

    fun getWallet() {
        viewModelScope.launch {
            val fncyWallet = FncyWalletSDK("token")
            val result = fncyWallet.getWallet()
            result
                .onSuccess { wallet ->
                    // Handling Success
                }.onFailure { throwable ->
                    // Handling Fail
                }
        }
    }

} 

with Paging

class FncyViewModel() : ViewModel() {

    fun getAssetList() {
        viewModelScope.launch {
            val wallet = FncyWalletSDK("token")
            val result = wallet.getAssetList(wid)
            result.onSuccess { it ->
                it.data // Result Data
                it.paging // Paging Data
            }.onFailure {
                ...
            }
        }
    }

}