mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-10 02:28:13 -07:00
19 lines
539 B
JavaScript
19 lines
539 B
JavaScript
import { createFeeRateRange } from "../../fee-rates.js";
|
|
|
|
/**
|
|
* @param {BlockPreviewTransaction[]} transactions
|
|
*/
|
|
export function createPreviewFeeRange(transactions) {
|
|
return createFeeRateRange(transactions.map(({ feeRate }) => feeRate));
|
|
}
|
|
|
|
/**
|
|
* @param {BlockPreviewTransaction[]} transactions
|
|
*/
|
|
export function orderTransactions(transactions) {
|
|
return transactions
|
|
.toSorted((a, b) => b.feeRate - a.feeRate || b.weight - a.weight);
|
|
}
|
|
|
|
/** @typedef {import("../data.js").BlockPreviewTransaction} BlockPreviewTransaction */
|