io.provenance.client.common.gas.prices.UrlGasPrices.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 cosmos.base.v1beta1.CoinOuterClass
import java.io.InputStream
/**
* When provided with a url, fetches an object of shape '{"gasPrice":nnn,"gasPriceDenom":"denom"}'
*/
open class UrlGasPrices(
uri: String,
fetch: (uri: String) -> InputStream,
marshal: (body: InputStream) -> CoinOuterClass.Coin,
) : GasPrices {
private val gasPrices = gasPrices { fetch(uri).let(marshal) }
override fun invoke(): CoinOuterClass.Coin = gasPrices()
}