From 05bba7ed4760f2be65adcd7b5b8f32b4087399c3 Mon Sep 17 00:00:00 2001 From: Slava Date: Thu, 7 Nov 2024 12:19:51 +0300 Subject: [PATCH] chore: enable tweak signer for taproot address --- packages/sats-wagmi/src/connectors/base.ts | 2 +- packages/sats-wagmi/src/connectors/unisat.ts | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/sats-wagmi/src/connectors/base.ts b/packages/sats-wagmi/src/connectors/base.ts index 9ddc0ec..643e457 100644 --- a/packages/sats-wagmi/src/connectors/base.ts +++ b/packages/sats-wagmi/src/connectors/base.ts @@ -119,7 +119,7 @@ abstract class SatsConnector { return this.ordinalsAddress; } - /** Convience wrapper around the getAddressInfo function + /** Convenience wrapper around the getAddressInfo function * @param address - The address to get the type of. * @returns The address type of the address. */ diff --git a/packages/sats-wagmi/src/connectors/unisat.ts b/packages/sats-wagmi/src/connectors/unisat.ts index 242e8ba..094cf66 100644 --- a/packages/sats-wagmi/src/connectors/unisat.ts +++ b/packages/sats-wagmi/src/connectors/unisat.ts @@ -1,4 +1,4 @@ -import { Network } from 'bitcoin-address-validation'; +import { AddressType, Network } from 'bitcoin-address-validation'; import { bitgetLogo } from '../assets/bitget'; @@ -200,11 +200,16 @@ class UnisatConnector extends SatsConnector { inputs.push(index); } } + + if (!this.paymentAddress) { + throw new Error('No payment address specified'); + } + const toSignInputs = inputs.map((index) => { return { index, publicKey: this.publicKey, - disableTweakSigner: true + disableTweakSigner: this.getAddressType(this.paymentAddress!) !== AddressType.p2tr }; });