Skip to content

Commit

Permalink
remove eth_sign (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
adonesky1 authored Jul 26, 2024
1 parent b418bf3 commit c66e899
Showing 1 changed file with 0 additions and 36 deletions.
36 changes: 0 additions & 36 deletions src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ export interface WalletMiddlewareOptions {
address: string,
req: JsonRpcRequest,
) => Promise<string>;
processEthSignMessage?: (
msgParams: MessageParams,
req: JsonRpcRequest,
) => Promise<string>;
processPersonalMessage?: (
msgParams: MessageParams,
req: JsonRpcRequest,
Expand Down Expand Up @@ -92,7 +88,6 @@ export function createWalletMiddleware({
getAccounts,
processDecryptMessage,
processEncryptionPublicKey,
processEthSignMessage,
processPersonalMessage,
processTransaction,
processSignTransaction,
Expand All @@ -113,7 +108,6 @@ WalletMiddlewareOptions): JsonRpcMiddleware<any, Block> {
eth_sendTransaction: createAsyncMiddleware(sendTransaction),
eth_signTransaction: createAsyncMiddleware(signTransaction),
// message signatures
eth_sign: createAsyncMiddleware(ethSign),
eth_signTypedData: createAsyncMiddleware(signTypedData),
eth_signTypedData_v3: createAsyncMiddleware(signTypedDataV3),
eth_signTypedData_v4: createAsyncMiddleware(signTypedDataV4),
Expand Down Expand Up @@ -195,36 +189,6 @@ WalletMiddlewareOptions): JsonRpcMiddleware<any, Block> {
//
// message signatures
//

async function ethSign(
req: JsonRpcRequest,
res: PendingJsonRpcResponse<Json>,
): Promise<void> {
if (!processEthSignMessage) {
throw rpcErrors.methodNotSupported();
}
if (
!req?.params ||
!Array.isArray(req.params) ||
!(req.params.length >= 2)
) {
throw rpcErrors.invalidInput();
}

const params = req.params as [string, string, Record<string, string>?];
const address: string = await validateAndNormalizeKeyholder(params[0], req);
const message = params[1];
const extraParams = params[2] || {};
const msgParams: MessageParams = {
...extraParams,
from: address,
data: message,
signatureMethod: 'eth_sign',
};

res.result = await processEthSignMessage(msgParams, req);
}

async function signTypedData(
req: JsonRpcRequest,
res: PendingJsonRpcResponse<Json>,
Expand Down

0 comments on commit c66e899

Please sign in to comment.