Skip to content

Commit

Permalink
Merge pull request #4172 from BitGo/BTC-741-fix-unspent-sending
Browse files Browse the repository at this point in the history
fix(abstract-utxo): do not override build params
  • Loading branch information
bitgoAaron authored Dec 27, 2023
2 parents 007af71 + 9494255 commit 1048249
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions modules/abstract-utxo/src/abstractUtxoCoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -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,
};
}

Expand Down
2 changes: 1 addition & 1 deletion modules/bitgo/test/v2/unit/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 1048249

Please sign in to comment.