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

io.provenance.client.common.gas.prices.UrlGasPrices.kt Maven / Gradle / Ivy

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()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy