mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-10 02:28:13 -07:00
28 lines
712 B
JavaScript
28 lines
712 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 {Object} BlockPreviewTransaction
|
|
* @property {string} txid
|
|
* @property {number} version
|
|
* @property {number} weight
|
|
* @property {number} feeRate
|
|
* @property {boolean} rbf
|
|
* @property {number} inputCount
|
|
* @property {number} outputCount
|
|
*/
|