Declaring Initialization in the Application Class
class FncyApplication : Application() {
override fun onCreate() {
super.onCreate()
FncyWalletSDK.initSDK(
environment = Environment.Testnet // Testnet or Mainnet
)
}
}
val fncyWallet = FncyWalletSDK(token)
class FncyViewModel() : ViewModel() {
fun getWallet() {
viewModelScope.launch {
val fncyWallet = FncyWalletSDK("token")
val result = fncyWallet.getWallet()
result
.onSuccess { wallet ->
// Handling Success
}.onFailure { throwable ->
// Handling Fail
}
}
}
}
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 {
...
}
}
}
}