global: opreturn part 3

This commit is contained in:
nym21
2026-07-18 21:34:21 +02:00
parent 10c16335ed
commit 5161ae2012
16 changed files with 912 additions and 412 deletions
@@ -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 };
}