Skip to content

Commit 4c23213

Browse files
OttoAllmendingerllm-git
andcommitted
feat(abstract-utxo): use defaultTxFormat in tests instead of hardcoded chain list
Replace hardcoded list of non-PSBT coin types with a direct call to getDefaultTxFormat method, making tests more maintainable and accurate. Issue: BTC-2732 Co-authored-by: llm-git <[email protected]>
1 parent 6681c74 commit 4c23213

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/abstract-utxo/test/unit/prebuildAndSign.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ function run(coin: AbstractUtxoCoin, inputScripts: ScriptType[], txFormat: TxFor
214214

215215
[true, false].forEach((useWebauthn) => {
216216
it(`should succeed with ${useWebauthn ? 'webauthn encryptedPrv' : 'encryptedPrv'}`, async function () {
217-
const txCoins = ['tzec', 'zec', 'ltc', 'bcha', 'doge', 'dash', 'btg', 'bch'];
217+
// Check if this wallet/coin combination defaults to psbt
218+
const defaultTxFormat = coin.getDefaultTxFormat(wallet);
218219
const nocks = createNocks({
219220
bgUrl,
220221
wallet,
@@ -223,7 +224,7 @@ function run(coin: AbstractUtxoCoin, inputScripts: ScriptType[], txFormat: TxFor
223224
recipient,
224225
addressInfo,
225226
nockOutputAddresses: txFormat !== 'psbt',
226-
txFormat: !txCoins.includes(coin.getChain()) ? 'psbt' : undefined,
227+
txFormat: defaultTxFormat,
227228
});
228229

229230
// call prebuild and sign, nocks should be consumed
@@ -261,7 +262,8 @@ function run(coin: AbstractUtxoCoin, inputScripts: ScriptType[], txFormat: TxFor
261262
it(`should be able to build, sign, & verify a replacement transaction with selfSend: ${selfSend}`, async function () {
262263
const rbfTxIds = ['tx-to-be-replaced'],
263264
feeMultiplier = 1.5;
264-
const txCoins = ['tzec', 'zec', 'ltc', 'bcha', 'doge', 'dash', 'btg', 'bch'];
265+
// Check if this wallet/coin combination defaults to psbt
266+
const defaultTxFormat = coin.getDefaultTxFormat(wallet);
265267
const nocks = createNocks({
266268
bgUrl,
267269
wallet,
@@ -273,7 +275,7 @@ function run(coin: AbstractUtxoCoin, inputScripts: ScriptType[], txFormat: TxFor
273275
feeMultiplier,
274276
selfSend,
275277
nockOutputAddresses: txFormat !== 'psbt',
276-
txFormat: !txCoins.includes(coin.getChain()) ? 'psbt' : undefined,
278+
txFormat: defaultTxFormat,
277279
});
278280

279281
// call prebuild and sign, nocks should be consumed

0 commit comments

Comments
 (0)