mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-07-20 07:28:11 -07:00
26 lines
599 B
JavaScript
26 lines
599 B
JavaScript
import { resolveCapacityCells } from "./capacity.js";
|
|
import { packTransactions } from "./fees.js";
|
|
|
|
/**
|
|
* @template {{ weight: number }} Cell
|
|
* @param {readonly Cell[]} cells
|
|
* @param {number} blockWeight
|
|
* @param {number} capacity
|
|
* @param {number} columns
|
|
*/
|
|
export function createSquareLayout(cells, blockWeight, capacity, columns) {
|
|
const capacityLayout = resolveCapacityCells(
|
|
cells,
|
|
blockWeight,
|
|
capacity,
|
|
columns,
|
|
);
|
|
const packed = packTransactions(
|
|
capacityLayout.resolvedCells,
|
|
columns,
|
|
capacityLayout.rows,
|
|
);
|
|
|
|
return { columns, ...packed };
|
|
}
|