Skip to content

Commit

Permalink
Add type for method names
Browse files Browse the repository at this point in the history
  • Loading branch information
aryzing committed Mar 1, 2024
1 parent a217a6b commit bd411f8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/request/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export interface StxRequests {
stx_getAddresses: StxGetAddresses;
}

export type StxRequestMethod = keyof StxRequests;

export interface BtcRequests {
getInfo: GetInfo;
getAddresses: GetAddresses;
Expand All @@ -30,6 +32,8 @@ export interface BtcRequests {
signPsbt: SignPsbt;
}

export type BtcRequestMethod = keyof BtcRequests;

export type Requests = BtcRequests & StxRequests;

export type Return<Method> = Method extends keyof Requests ? Requests[Method]['result'] : unknown;
Expand Down

0 comments on commit bd411f8

Please sign in to comment.