diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts index 46e053b884..53ea9aabf2 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.ts @@ -105,6 +105,7 @@ import type { SuccessNodePromises, ValidateAndSignECDSA, WebAuthnAuthenticationVerificationParams, + ILitNodeClient, } from '@lit-protocol/types'; // TODO: move this to auth-helper for next patch @@ -126,7 +127,7 @@ interface CapacityCreditsRes { export class LitNodeClientNodeJs extends LitCore - implements LitClientSessionManager + implements LitClientSessionManager, ILitNodeClient { defaultAuthCallback?: (authSigParams: AuthCallbackParams) => Promise; diff --git a/packages/lit-node-client/src/lib/lit-node-client.ts b/packages/lit-node-client/src/lib/lit-node-client.ts index 603a451e1a..f74f0db0de 100644 --- a/packages/lit-node-client/src/lib/lit-node-client.ts +++ b/packages/lit-node-client/src/lib/lit-node-client.ts @@ -1,12 +1,12 @@ -import { LitNodeClientNodeJs } from '@lit-protocol/lit-node-client-nodejs'; import { checkAndSignAuthMessage } from '@lit-protocol/auth-browser'; -import { CustomNetwork, LitNodeClientConfig } from '@lit-protocol/types'; +import { EITHER_TYPE } from '@lit-protocol/constants'; +import { LitNodeClientNodeJs } from '@lit-protocol/lit-node-client-nodejs'; import { isNode, log } from '@lit-protocol/misc'; import { getStorageItem } from '@lit-protocol/misc-browser'; -import { EITHER_TYPE } from '@lit-protocol/constants'; +import { CustomNetwork, LitNodeClientConfig } from '@lit-protocol/types'; export class LitNodeClient extends LitNodeClientNodeJs { - constructor(args: any[LitNodeClientConfig | CustomNetwork | any]) { + constructor(args: LitNodeClientConfig | CustomNetwork) { super({ ...args, defaultAuthCallback: checkAndSignAuthMessage, diff --git a/packages/types/src/lib/ILitNodeClient.ts b/packages/types/src/lib/ILitNodeClient.ts index fa083fae52..af3d5dfd0a 100644 --- a/packages/types/src/lib/ILitNodeClient.ts +++ b/packages/types/src/lib/ILitNodeClient.ts @@ -9,13 +9,12 @@ import { GetSignedTokenRequest, HandshakeWithNode, JsonExecutionRequest, - KV, + JsonHandshakeResponse, LitNodeClientConfig, MultipleAccessControlConditions, NodeBlsSigningShare, NodeCommandResponse, NodeCommandServerKeysResponse, - NodeShare, RejectedNodePromises, SendNodeCommand, SignConditionECDSA, @@ -27,8 +26,8 @@ import { SupportedJsonRequests } from './types'; export interface ILitNodeClient { config: LitNodeClientConfig; - connectedNodes: SetConstructor | Set | any; - serverKeys: KV | any; + connectedNodes: Set; + serverKeys: Record; ready: boolean; subnetPubKey: string | null; networkPubKey: string | null; @@ -48,7 +47,7 @@ export interface ILitNodeClient { * @returns { void } * */ - overrideConfigsFromLocalStorage(): void; + overrideConfigsFromLocalStorage?(): void; /** * @@ -86,7 +85,7 @@ export interface ILitNodeClient { * @returns { string } final JWT (convert the sig to base64 and append to the jwt) * */ - combineSharesAndGetJWT(signatureShares: Array): string; + combineSharesAndGetJWT(signatureShares: NodeBlsSigningShare[]): string; /** * @@ -125,18 +124,22 @@ export interface ILitNodeClient { * @returns { Array> } * */ - getNodePromises(callback: Function): Array>; + getNodePromises(callback: Function): Promise[]; /** * Handle node promises * * @param { Array> } nodePromises * + * @param {string} requestId request Id used for logging + * @param {number} minNodeCount The minimum number of nodes we need a successful response from to continue * @returns { Promise | RejectedNodePromises> } * */ handleNodePromises( - nodePromises: Array> + nodePromises: Promise[], + requestId: string, + minNodeCount: number ): Promise | RejectedNodePromises>; /** @@ -160,7 +163,7 @@ export interface ILitNodeClient { * @returns { any } * */ - getSignatures(signedData: Array, requestId: string): any; + getSignatures(signedData: any[], requestId: string): any; /** * @@ -182,7 +185,7 @@ export interface ILitNodeClient { * @returns { string } signature * */ - getSignature(shareData: Array, requestId: string): Promise; + getSignature(shareData: any[], requestId: string): Promise; // ========== API Calls to Nodes ========== sendCommandToNode({ url, data, requestId }: SendNodeCommand): Promise;