diff --git a/src/keystore/SnapKeystore.ts b/src/keystore/SnapKeystore.ts index 26564ab81..3713c75a9 100644 --- a/src/keystore/SnapKeystore.ts +++ b/src/keystore/SnapKeystore.ts @@ -24,9 +24,11 @@ export function SnapKeystore( ) as SnapKeystoreApiEntries) { generatedMethods[method] = async (req?: SnapKeystoreApiRequestValues) => { if (!rpc.req) { - return snapRPC(method, rpc, undefined, snapMeta, snapId) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return snapRPC(method, rpc, undefined, snapMeta, snapId) as any } - return snapRPC(method, rpc, req, snapMeta, snapId) + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return snapRPC(method, rpc, req, snapMeta, snapId) as any } } diff --git a/src/keystore/snapHelpers.ts b/src/keystore/snapHelpers.ts index 292d0ee6e..65ac92f8c 100644 --- a/src/keystore/snapHelpers.ts +++ b/src/keystore/snapHelpers.ts @@ -53,8 +53,9 @@ export async function snapRPC( throw new Error('Unexpected array response') } - const decoder = rpc.res.decode as SnapKeystoreApiResponseDecoders[T] - return decoder(b64Decode(responseString)) + return rpc.res.decode(b64Decode(responseString)) as ReturnType< + SnapKeystoreApiResponseDecoders[T] + > } export async function snapRequest( @@ -78,11 +79,11 @@ export async function snapRequest( }, }) - if (!response || !response.res) { + if (!response || typeof response !== 'object') { throw new Error('No response value') } - return response.res + return (response as SnapResponse).res } export type Snap = {