diff --git a/typescript/src/services/redemptions/redemptions-service.ts b/typescript/src/services/redemptions/redemptions-service.ts index 363f0454a..03673ce8b 100644 --- a/typescript/src/services/redemptions/redemptions-service.ts +++ b/typescript/src/services/redemptions/redemptions-service.ts @@ -7,6 +7,7 @@ import { BitcoinAddressConverter, BitcoinClient, BitcoinNetwork, + BitcoinScriptUtils, BitcoinTxOutput, BitcoinUtxo, } from "../../lib/bitcoin" @@ -58,7 +59,14 @@ export class RedemptionsService { bitcoinNetwork ) - // TODO: Validate the given script is supported for redemption. + if ( + !BitcoinScriptUtils.isP2PKHScript(redeemerOutputScript) && + !BitcoinScriptUtils.isP2WPKHScript(redeemerOutputScript) && + !BitcoinScriptUtils.isP2SHScript(redeemerOutputScript) && + !BitcoinScriptUtils.isP2WSHScript(redeemerOutputScript) + ) { + throw new Error("Redeemer output script must be of standard type") + } const { walletPublicKey, mainUtxo } = await this.findWalletForRedemption( redeemerOutputScript,