From c503e1bfd063e2c88e60cd34e774abc189257859 Mon Sep 17 00:00:00 2001 From: Mahmoud Aboelenein Date: Wed, 28 Feb 2024 17:59:53 +0200 Subject: [PATCH] update signPsbt types and added success response type --- src/request/types/btcMethods.ts | 4 ++-- src/request/types/index.ts | 5 +++-- src/types.ts | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/request/types/btcMethods.ts b/src/request/types/btcMethods.ts index b37621c..5258dad 100644 --- a/src/request/types/btcMethods.ts +++ b/src/request/types/btcMethods.ts @@ -53,7 +53,7 @@ type SignInputsByAddress = { export type SignPsbtParams = { psbt: string; signInputs: number[] | SignInputsByAddress; - allowedSignHash: number; + allowedSignHash?: number; broadcast?: boolean; }; @@ -62,4 +62,4 @@ export type SignPsbtResult = { txid?: string; }; -export type SignPsbt = MethodParamsAndResult; +export type SignPsbt = MethodParamsAndResult; diff --git a/src/request/types/index.ts b/src/request/types/index.ts index 5a3ea5a..cae11bf 100644 --- a/src/request/types/index.ts +++ b/src/request/types/index.ts @@ -1,3 +1,4 @@ +import { RpcSuccessResponse } from 'src/types'; import { GetAddresses, GetInfo, SendTransfer, SignMessage, SignPsbt } from './btcMethods'; import { StxContractCall, @@ -31,8 +32,8 @@ export type Params = Method extends keyof Requests ? Requests[Method]['p export type Request = ( requestMethod: Method, - params: Params -) => Promise>; + param?: Params +) => Promise>; export * from './stxMethods'; export * from './btcMethods'; diff --git a/src/types.ts b/src/types.ts index 5700e57..e1beea9 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,4 +1,5 @@ import type { BitcoinProvider } from './provider'; +import { Requests, Return } from './request'; export enum BitcoinNetworkType { Mainnet = 'Mainnet', @@ -57,3 +58,7 @@ export interface RpcError { export interface RpcErrorResponse extends RpcBase { error: TError; } + +export interface RpcSuccessResponse extends RpcBase { + result: Return; +}