diff --git a/.changeset/nine-berries-float.md b/.changeset/nine-berries-float.md new file mode 100644 index 00000000..bc1f814c --- /dev/null +++ b/.changeset/nine-berries-float.md @@ -0,0 +1,5 @@ +--- +"@caravan/wallets": patch +--- + +include addressType for accurate PSBT translation in SignMultisigTransaction diff --git a/packages/caravan-wallets/src/index.ts b/packages/caravan-wallets/src/index.ts index 7fef3746..86291cad 100644 --- a/packages/caravan-wallets/src/index.ts +++ b/packages/caravan-wallets/src/index.ts @@ -440,6 +440,7 @@ export function SignMultisigTransaction({ bip32Paths, psbt, keyDetails, + addressType: walletConfig.addressType, returnSignatureArray, }); default: diff --git a/packages/caravan-wallets/src/ledger.ts b/packages/caravan-wallets/src/ledger.ts index d307da16..ed6f5ca4 100644 --- a/packages/caravan-wallets/src/ledger.ts +++ b/packages/caravan-wallets/src/ledger.ts @@ -990,7 +990,7 @@ export class LedgerSignMultisigTransaction extends LedgerBitcoinInteraction { const translatedPsbt = translatePSBT( network, - P2SH, + v2Options?.addressType || P2SH, this.psbt, keyDetails ); diff --git a/packages/caravan-wallets/src/trezor.test.ts b/packages/caravan-wallets/src/trezor.test.ts index f936ac6b..19acbeff 100644 --- a/packages/caravan-wallets/src/trezor.test.ts +++ b/packages/caravan-wallets/src/trezor.test.ts @@ -301,7 +301,12 @@ describe("trezor", () => { }); }); - function psbtInteractionBuilder(tx, keyDetails, returnSignatureArray) { + function psbtInteractionBuilder( + tx, + keyDetails, + returnSignatureArray, + addressType + ) { return new TrezorSignMultisigTransaction({ network: tx.network, inputs: [], @@ -310,6 +315,7 @@ describe("trezor", () => { psbt: tx.psbt, keyDetails, returnSignatureArray, + addressType, }); } @@ -319,7 +325,7 @@ describe("trezor", () => { xfp: ROOT_FINGERPRINT, path: "m/45'/1'/100'", }; - const interaction = psbtInteractionBuilder(tx, keyDetails, false); + const interaction = psbtInteractionBuilder(tx, keyDetails, false, tx.braidDetails.addressType); const [method, params] = interaction.connectParams(); expect(method).toEqual(TrezorConnect.signTransaction); expect((params as any).coin).toEqual(trezorCoin(tx.network)); @@ -337,7 +343,7 @@ describe("trezor", () => { xfp: ROOT_FINGERPRINT, path: "m/45'/0'/100'", }; - const interaction = psbtInteractionBuilder(tx, keyDetails, true); + const interaction = psbtInteractionBuilder(tx, keyDetails, true, tx.braidDetails.addressType); const [method, params] = interaction.connectParams(); expect(method).toEqual(TrezorConnect.signTransaction); expect((params as any).coin).toEqual(trezorCoin(tx.network)); diff --git a/packages/caravan-wallets/src/trezor.ts b/packages/caravan-wallets/src/trezor.ts index 036c90de..30d6a7d5 100644 --- a/packages/caravan-wallets/src/trezor.ts +++ b/packages/caravan-wallets/src/trezor.ts @@ -701,6 +701,7 @@ export class TrezorSignMultisigTransaction extends TrezorInteraction { psbt, keyDetails, returnSignatureArray, + addressType, }) { super({ network }); if (!psbt || !keyDetails) { @@ -715,7 +716,7 @@ export class TrezorSignMultisigTransaction extends TrezorInteraction { } const translatedPsbt = translatePSBT( network, - P2SH, + addressType, this.psbt, keyDetails );