From 84236fa23fcd12c297eb20c20067bdf1128da4f9 Mon Sep 17 00:00:00 2001 From: kyranjamie Date: Wed, 26 Jul 2023 10:45:51 +0100 Subject: [PATCH] fix: full sighash types --- src/shared/rpc/methods/sign-psbt.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/shared/rpc/methods/sign-psbt.ts b/src/shared/rpc/methods/sign-psbt.ts index 3f40f565..3e9321dd 100644 --- a/src/shared/rpc/methods/sign-psbt.ts +++ b/src/shared/rpc/methods/sign-psbt.ts @@ -1,5 +1,4 @@ import { DefineRpcMethod, RpcRequest, RpcResponse } from '@btckit/types'; -import * as btc from '@scure/btc-signer'; import * as yup from 'yup'; import { WalletDefaultNetworkConfigurationIds } from '@shared/constants'; @@ -12,9 +11,11 @@ import { validateRpcParams, } from './validation.utils'; +const sigHashTypes = [0x01, 0x02, 0x03, 0x80, 0x81, 0x82, 0x83]; + const rpcSignPsbtParamsSchema = yup.object().shape({ account: accountSchema, - allowedSighash: yup.array().of(yup.mixed().oneOf(Object.values(btc.SignatureHash))), + allowedSighash: yup.array().of(yup.mixed().oneOf(Object.values(sigHashTypes))), hex: yup.string().required(), network: yup.string().oneOf(Object.values(WalletDefaultNetworkConfigurationIds)), signAtIndex: yup.mixed().test(testIsNumberOrArrayOfNumbers),