mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-21 16:08:10 -07:00
global: opreturn part 3
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { FEE_RATE_PERCENTILES } from "../../fee-rates.js";
|
||||
import { packCells } from "./pack.js";
|
||||
|
||||
/**
|
||||
* @param {number[]} feeRates
|
||||
@@ -25,3 +26,20 @@ export function orderTransactions(weights, feeRates) {
|
||||
|
||||
return order.sort((a, b) => feeRates[b] - feeRates[a] || weights[b] - weights[a]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @template {{ span: number }} Cell
|
||||
* @param {readonly Cell[]} cells
|
||||
* @param {number} columns
|
||||
* @param {number} rows
|
||||
*/
|
||||
export function packTransactions(cells, columns, rows) {
|
||||
let layouts = packCells(cells, columns, rows);
|
||||
|
||||
while (layouts === null) {
|
||||
rows += 1;
|
||||
layouts = packCells(cells, columns, rows);
|
||||
}
|
||||
|
||||
return { layouts, resolvedCells: cells };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user