@@ -6,6 +6,17 @@ import { toOutputScriptWithCoin } from "../address.js";
66
77type FromInputParams = { chain : number ; signPath ?: SignPath } | { scriptType : InputScriptType } ;
88
9+ /**
10+ * Options for input dimension calculation
11+ */
12+ export type FromInputOptions = {
13+ /**
14+ * When true, use @bitgo/unspents-compatible signature sizes (72 bytes)
15+ * for the "max" calculation instead of true maximum (73 bytes).
16+ */
17+ utxolibCompat ?: boolean ;
18+ } ;
19+
920/**
1021 * Dimensions class for estimating transaction virtual size.
1122 *
@@ -39,13 +50,20 @@ export class Dimensions {
3950 * Create dimensions for a single input
4051 *
4152 * @param params - Either `{ chain, signPath? }` or `{ scriptType }`
53+ * @param options - Optional settings like `{ utxolibCompat: true }` for @bitgo/unspents-compatible sizing
4254 */
43- static fromInput ( params : FromInputParams ) : Dimensions {
55+ static fromInput ( params : FromInputParams , options ?: FromInputOptions ) : Dimensions {
56+ const compat = options ?. utxolibCompat ;
4457 if ( "scriptType" in params ) {
45- return new Dimensions ( WasmDimensions . from_input_script_type ( params . scriptType ) ) ;
58+ return new Dimensions ( WasmDimensions . from_input_script_type ( params . scriptType , compat ) ) ;
4659 }
4760 return new Dimensions (
48- WasmDimensions . from_input ( params . chain , params . signPath ?. signer , params . signPath ?. cosigner ) ,
61+ WasmDimensions . from_input (
62+ params . chain ,
63+ params . signPath ?. signer ,
64+ params . signPath ?. cosigner ,
65+ compat ,
66+ ) ,
4967 ) ;
5068 }
5169
0 commit comments