From 94942559b0be8f9789c7afbb3740924aaab76ab3 Mon Sep 17 00:00:00 2001 From: David Kaplan Date: Wed, 27 Dec 2023 12:18:26 -0500 Subject: [PATCH] fix(abstract-utxo): do not override changeAddressType or txFormat TICKET: BTC-741 --- modules/abstract-utxo/src/abstractUtxoCoin.ts | 9 +++++---- modules/bitgo/test/v2/unit/wallet.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/modules/abstract-utxo/src/abstractUtxoCoin.ts b/modules/abstract-utxo/src/abstractUtxoCoin.ts index 5348ac1416..d5726bfaef 100644 --- a/modules/abstract-utxo/src/abstractUtxoCoin.ts +++ b/modules/abstract-utxo/src/abstractUtxoCoin.ts @@ -1460,9 +1460,10 @@ export abstract class AbstractUtxoCoin extends BaseCoin { async getExtraPrebuildParams(buildParams: ExtraPrebuildParamsOptions & { wallet: Wallet }): Promise<{ txFormat?: 'legacy' | 'psbt'; - addressType?: ScriptType2Of3; + changeAddressType?: ScriptType2Of3; }> { - let txFormat, addressType; + let txFormat = buildParams.txFormat as 'legacy' | 'psbt' | undefined; + let changeAddressType = buildParams.changeAddressType as ScriptType2Of3 | undefined; // if the txFormat is not specified, we need to default to psbt for distributed custody wallets or testnet hot wallets if ( @@ -1481,12 +1482,12 @@ export abstract class AbstractUtxoCoin extends BaseCoin { buildParams.wallet.type() === 'hot' && this.network === utxolib.networks.testnet ) { - addressType = 'p2trMusig2'; + changeAddressType = 'p2trMusig2'; } return { txFormat, - addressType, + changeAddressType, }; } diff --git a/modules/bitgo/test/v2/unit/wallet.ts b/modules/bitgo/test/v2/unit/wallet.ts index dacbcd9244..7af00e3c7f 100644 --- a/modules/bitgo/test/v2/unit/wallet.ts +++ b/modules/bitgo/test/v2/unit/wallet.ts @@ -71,7 +71,7 @@ describe('V2 Wallet:', function () { const bgUrl = common.Environments[bitgo.getEnv()].uri; const address1 = '0x174cfd823af8ce27ed0afee3fcf3c3ba259116be'; const address2 = '0x7e85bdc27c050e3905ebf4b8e634d9ad6edd0de6'; - const tbtcHotWalletDefaultParams = { txFormat: 'psbt', addressType: 'p2trMusig2' }; + const tbtcHotWalletDefaultParams = { txFormat: 'psbt', changeAddressType: 'p2trMusig2' }; afterEach(function () { sinon.restore();