New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrapping current gas estimators with fetchable gas pricing #25
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for handling this
*/ | ||
open class UrlGasPrices(private val uri: String) : GasPrices { | ||
private val client = HttpClientBuilder.create().build() | ||
private val gson = Gson().newBuilder().create() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no jackson 😹
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jackson wasn't in the current deps. gson was. 🤷
@@ -77,6 +80,12 @@ open class PbClient( | |||
val upgradeClient = cosmos.upgrade.v1beta1.QueryGrpc.newBlockingStub(channel) | |||
val wasmClient = cosmwasm.wasm.v1.QueryGrpc.newBlockingStub(channel) | |||
|
|||
// @TestnetFeaturePreview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtps did you mean to leave this commented out?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed it in the spirit of quick iteration. I like the concept of guarding in this manner though.
|
||
override fun invoke(): CoinOuterClass.Coin { | ||
val result = client.execute(HttpGet(uri)) | ||
require(result.statusLine.statusCode in 200..299) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to have a (optional, use if supplied) fallback default price to use in the event that the uri is unreachable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cached values would still exist for the transaction (if caching is enabled). what would we fall back to? (semi-rhetorical question, i honestly don't know what a good "fallback" value would be).
fromSimulation()
, logic moved into cosmosSimulation estimator.Example Usage: