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

feat(rgbpp-sdk/btc): add mempool.space api to provide default fee rate #46

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

ShookLyngs
Copy link
Collaborator

Changes

  • Add DataSource.getRecommendedFeeRates and DataSource.getAverageFeeRate APIs
  • When the feeRate prop in TxBuilder is undefined, get a fee rate from DataSource.getAverageFeeRate

Details

The getRecommendedFeeRates API returns a FeesRecommended object, which offers several levels of fee rates for users to choose from. The overall ranking on satoshi costing from high to low, or confirm time spent from fastest to slowest, is as follows:

fastestFee > halfHourFee > economyFee > hourFee > minimumFee > minimumFee

On the other hand, the getAverageFeeRate API returns the halfHourFee. This means that if the user leaves the feeRate empty while initializing a TxBuilder, it uses the halfHourFee as the default fee rate.

Types

getRecommendedFeeRates and getAverageFeeRate:

interface DataSource {
  // ... other apis
  getRecommendedFeeRates(): Promise<FeesRecommended>;
  getAverageFeeRate(): Promise<number>;
}

FeesRecommended:

interface FeesRecommended {
  fastestFee: number;
  halfHourFee: number;
  hourFee: number;
  minimumFee: number;
}

@ShookLyngs ShookLyngs self-assigned this Mar 24, 2024
@ShookLyngs ShookLyngs changed the title feat: add mempool.space api to provide default fee rate feat(rgbpp-sdk/btc): add mempool.space api to provide default fee rate Mar 24, 2024
@duanyytop duanyytop requested a review from yuche March 24, 2024 12:30
@ShookLyngs ShookLyngs force-pushed the feat/automated-fee-rate branch from 010fa46 to 5bffa90 Compare March 25, 2024 08:31
packages/btc/tests/DataSource.test.ts Outdated Show resolved Hide resolved
@Flouse Flouse merged commit 77a4788 into main Mar 26, 2024
1 check passed
@Flouse Flouse deleted the feat/automated-fee-rate branch March 26, 2024 12:12
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.

3 participants