Skip to content
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

(Thorchain) Replace rpc tx_search with midgard transaction query #822

Merged
merged 4 commits into from
Sep 5, 2024

Conversation

peachbits
Copy link
Contributor

@peachbits peachbits commented Aug 27, 2024

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Copy link
Collaborator

@samholmes samholmes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit on the any type usage needed.

src/cosmos/engine/ThorchainEngine.ts Show resolved Hide resolved
src/cosmos/engine/ThorchainEngine.ts Outdated Show resolved Hide resolved
src/cosmos/info/thorchainruneInfo.ts Outdated Show resolved Hide resolved
src/cosmos/engine/ThorchainEngine.ts Outdated Show resolved Hide resolved
src/cosmos/engine/ThorchainEngine.ts Outdated Show resolved Hide resolved
src/cosmos/engine/CosmosEngine.ts Show resolved Hide resolved
Comment on lines +809 to +820
let gasPrice = average
switch (opts.networkFeeOption) {
case 'low': {
gasPrice = low
break
}
case 'high': {
gasPrice = high
break
}
case 'custom': {
throw new Error('Custom fee not supported')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't ignore this comment

If only this was valid JS code:

const gasPrice = match opts.networkFeeOption === {
  'low': low,
  'high': high,
  'custom': throw new Error('Custom fee not supported')
}

It's called pattern matching, but the syntax idea that I just thought of seems nice and elegant. But this is in TC39's hands.

const gasPrice = match(opts.networkFeeOption)(
  (case = Type('low')) => low,
  (case = Type('high')) => high,
  (case = Type('custom')) => { throw new Error(...) }
)

^ This API is doable though ^

whatever

Thorchain has enough unique functionality to warrant its own engine. So far, this engine can handle a planned hard fork. Future commits will move transaction query, balance query, transaction fees, and future PRs can move other methods and registry entries
Will be called from multiple transaction query functions
@peachbits peachbits merged commit 9081e69 into master Sep 5, 2024
2 checks passed
@peachbits peachbits deleted the matthew/thorchain-engine branch September 5, 2024 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants