All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.money.terra.sdk.amino.wallet.ConnectedAminoTerraWallet.kt Maven / Gradle / Ivy

There is a newer version: 0.20.6-alpha1
Show newest version
package money.terra.sdk.amino.wallet

import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Deferred
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import money.terra.sdk.amino.AminoTerra
import money.terra.sdk.tools.transaction.AccountInfo
import money.terra.sdk.wallet.ConnectedTerraWallet
import money.terra.wallet.TerraWallet

class ConnectedAminoTerraWallet(terra: AminoTerra, origin: TerraWallet) : ConnectedTerraWallet(terra, origin) {

    val aminoTerra = terra

    override fun getAccountInfo(): Deferred = CoroutineScope(Dispatchers.Default).async {
        aminoTerra.client.authApi.getAccountInfo(address).await().result.value?.let {
            AccountInfo(
                it.address,
                it.accountNumber,
                it.publicKey,
                it.sequence,
            )
        } ?: AccountInfo(address)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy