Skip to content

Commit 4b8b110

Browse files
refactor(abstract-utxo): inline ScriptType2Of3 type definition
Replace the utxolib.bitgo.outputScripts.ScriptType2Of3 type re-export with an inline literal union. The values are identical to the utxolib export ('p2sh' | 'p2shP2wsh' | 'p2wsh' | 'p2tr' | 'p2trMusig2'). This removes the last utxolib type reference and the top-level utxolib import from abstractUtxoCoin.ts. Refs: T1-3279
1 parent da490f1 commit 4b8b110

2 files changed

Lines changed: 1 addition & 9 deletions

File tree

modules/abstract-utxo/src/abstractUtxoCoin.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import assert from 'assert';
22
import { randomBytes } from 'crypto';
33

44
import _ from 'lodash';
5-
import * as utxolib from '@bitgo/utxo-lib';
65
import { address as wasmAddress, BIP32, fixedScriptWallet, hasPsbtMagic } from '@bitgo/wasm-utxo';
76
import {
87
AddressCoinSpecific,
@@ -87,7 +86,7 @@ import { isUtxoWalletData, UtxoWallet } from './wallet';
8786
import { isDescriptorWalletData } from './descriptor/descriptorWallet';
8887
import type { Unspent } from './unspent';
8988

90-
import ScriptType2Of3 = utxolib.bitgo.outputScripts.ScriptType2Of3;
89+
type ScriptType2Of3 = 'p2sh' | 'p2shP2wsh' | 'p2wsh' | 'p2tr' | 'p2trMusig2';
9190

9291
export type TxFormat =
9392
// This is a legacy transaction format based around the bitcoinjs-lib serialization of unsigned transactions
@@ -133,8 +132,6 @@ type UtxoCustomSigningFunction<TNumber extends number | bigint> = {
133132
}): Promise<SignedTransaction>;
134133
};
135134

136-
const { ChainCode } = fixedScriptWallet;
137-
138135
/**
139136
* Check if a decoded transaction has at least one taproot key path spend (MuSig2) input.
140137
*/

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,6 @@ describe('Verify Transaction', function () {
318318
needsCustomChangeKeySignatureVerification: false,
319319
});
320320

321-
const bitcoinMock = sinon
322-
.stub(coin, 'createTransactionFromHex')
323-
.returns({ ins: [] } as unknown as utxolib.bitgo.UtxoTransaction);
324-
325321
const result = await coin.verifyTransaction({
326322
txParams: {
327323
walletPassphrase: passphrase,
@@ -338,7 +334,6 @@ describe('Verify Transaction', function () {
338334
assert.strictEqual(result, true);
339335

340336
coinMock.restore();
341-
bitcoinMock.restore();
342337
});
343338

344339
it('should reject a bridging transaction whose implicit external output does not match the bridge amount', async () => {

0 commit comments

Comments
 (0)