io.provenance.client.common.gas.prices.CachedGasPrices.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pb-grpc-client-common-kotlin Show documentation
Show all versions of pb-grpc-client-common-kotlin Show documentation
A GRPC client for communicating with the Provenance Blockchain
The newest version!
package io.provenance.client.common.gas.prices
import io.provenance.caching.cached
import kotlin.time.Duration
/**
* Cache the gas prices for a determined period of time
*/
fun cachedGasPrice(gasPrices: GasPrices, duration: Duration) : GasPrices {
val cached = cached(duration) { gasPrices() }
return gasPrices { cached.get() }
}