Skip to content

Commit 3c6d2f1

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): make transaction explanation fields optional
Allow fee and locktime to be undefined in transaction explanations, improving flexibility for edge cases. Issue: BTC-2732 Co-authored-by: llm-git <[email protected]>
1 parent 6229861 commit 3c6d2f1

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ export function isWalletOutput(output: Output): output is FixedScriptWalletOutpu
200200
);
201201
}
202202

203-
export interface TransactionExplanation extends BaseTransactionExplanation<string, string> {
204-
locktime: number;
203+
export interface TransactionExplanation extends BaseTransactionExplanation<string | number | undefined, string> {
204+
locktime?: number;
205205
/** NOTE: this actually only captures external outputs */
206206
outputs: Output[];
207207
changeOutputs: Output[];

modules/abstract-utxo/src/offlineVault/TransactionExplanation.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export interface TransactionExplanation {
1313
changeOutputs: ExplanationOutput[];
1414
fee: {
1515
/* network fee */
16-
fee: string | number;
16+
fee: string | number | undefined;
1717
payGoFeeString: string | number | undefined;
1818
payGoFeeAddress: string | undefined;
1919
};

modules/abstract-utxo/src/transaction/fixedScript/explainTransaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export function explainPsbt(
345345
inputSignatures: inputSignaturesCount,
346346
signatures: inputSignaturesCount.reduce((prev, curr) => (curr > prev ? curr : prev), 0),
347347
messages,
348-
} as TransactionExplanation;
348+
};
349349
}
350350

351351
export function explainLegacyTx<TNumber extends number | bigint>(
@@ -363,5 +363,5 @@ export function explainLegacyTx<TNumber extends number | bigint>(
363363
...common,
364364
inputSignatures: inputSignaturesCount,
365365
signatures: inputSignaturesCount.reduce((prev, curr) => (curr > prev ? curr : prev), 0),
366-
} as TransactionExplanation;
366+
};
367367
}

0 commit comments

Comments
 (0)