From 10f5e1ab37d2bea6acd93f94defbe786e4a027b9 Mon Sep 17 00:00:00 2001 From: Luis Covarrubias Date: Fri, 20 Oct 2023 12:21:55 -0700 Subject: [PATCH] feat: use psbt for prebuild when wallet is distributedCustody When the wallet is of type distributed custody want to always use 'psbt' as the transaction format. Ticket: BTC-558 --- modules/abstract-utxo/src/abstractUtxoCoin.ts | 6 +++++- modules/sdk-core/src/bitgo/wallet/wallet.ts | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/modules/abstract-utxo/src/abstractUtxoCoin.ts b/modules/abstract-utxo/src/abstractUtxoCoin.ts index 28084b9d1d..0289c6a8df 100644 --- a/modules/abstract-utxo/src/abstractUtxoCoin.ts +++ b/modules/abstract-utxo/src/abstractUtxoCoin.ts @@ -1442,7 +1442,11 @@ export abstract class AbstractUtxoCoin extends BaseCoin { }; } - async getExtraPrebuildParams(buildParams: ExtraPrebuildParamsOptions): Promise { + async getExtraPrebuildParams(buildParams: ExtraPrebuildParamsOptions & { wallet: Wallet }): Promise { + if (buildParams.wallet.subType() === 'distributedCustody') { + return { txFormat: 'psbt' }; + } + return {}; } diff --git a/modules/sdk-core/src/bitgo/wallet/wallet.ts b/modules/sdk-core/src/bitgo/wallet/wallet.ts index abbd326cb8..97de9bdffe 100644 --- a/modules/sdk-core/src/bitgo/wallet/wallet.ts +++ b/modules/sdk-core/src/bitgo/wallet/wallet.ts @@ -72,6 +72,7 @@ import { ShareWalletOptions, SimulateWebhookOptions, SubmitTransactionOptions, + SubWalletType, SweepOptions, TransferBySequenceIdOptions, TransferCommentOptions, @@ -251,6 +252,10 @@ export class Wallet implements IWallet { return this._wallet.multisigType; } + subType(): SubWalletType | undefined { + return this._wallet.subType; + } + /** * Get the label (name) for this wallet */