Skip to content

Commit

Permalink
Merge pull request #285 from blocto/feat/disable-eth_sign-method
Browse files Browse the repository at this point in the history
feat: disable eth_sign method
  • Loading branch information
q20274982 authored Oct 26, 2023
2 parents 9a2ad18 + c3cb257 commit 063451c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/smooth-coats-sit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blocto/sdk': minor
---

disable eth_sign method
11 changes: 4 additions & 7 deletions packages/blocto-sdk/src/providers/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,12 @@ export default class EthereumProvider
case 'eth_signTypedData_v3':
case 'eth_signTypedData':
case 'eth_signTypedData_v4':
case 'personal_sign':
case 'eth_sign': {
case 'personal_sign': {
result = await this.handleSign(payload);
break;
}
case 'eth_sign':
throw ethErrors.rpc.methodNotFound('Method Not Supported: eth_sign has been disabled');
case 'eth_sendTransaction':
result = await this.handleSendTransaction(payload);
break;
Expand Down Expand Up @@ -649,11 +650,7 @@ export default class EthereumProvider
async handleSign({ method, params }: EIP1193RequestPayload): Promise<string> {
let message = '';
if (Array.isArray(params)) {
if (method === 'eth_sign') {
message = isHexString(params[1])
? params[1].slice(2)
: utf8ToHex(params[1]);
} else if (method === 'personal_sign') {
if (method === 'personal_sign') {
message = isHexString(params[0])
? params[0].slice(2)
: utf8ToHex(params[0]);
Expand Down

0 comments on commit 063451c

Please sign in to comment.