Skip to content

Commit

Permalink
chore(order): fix signable psbt
Browse files Browse the repository at this point in the history
  • Loading branch information
kodemon committed Jul 10, 2023
1 parent d4348af commit 6faaef8
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/Methods/Order/CreateSignablePsbt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,21 @@ export const createSignablePsbt = method({
}

const psbt = new Psbt({ network: btcNetwork });
const type = utils.bitcoin.getAddressType(maker);

if (tapInternalKey !== undefined) {
if (type === "bech32") {
psbt.addInput({
hash,
index,
witnessUtxo: {
script: Buffer.from(vout.scriptPubKey.hex, "hex"),
value: 0,
},
});
} else if (type === "taproot") {
if (tapInternalKey === undefined) {
throw new BadRequestError("Taproot address requires a pubkey");
}
psbt.addInput({
hash,
index,
Expand Down

0 comments on commit 6faaef8

Please sign in to comment.