diff --git a/packages/relay/src/index.ts b/packages/relay/src/index.ts index 160e0e86fa..708928e6b8 100644 --- a/packages/relay/src/index.ts +++ b/packages/relay/src/index.ts @@ -71,7 +71,7 @@ export interface Eth { getLogs(blockHash: string|null, fromBlock: string|null, toBlock: string|null, address: string|null, topics: any[]|null): Promise; - // getStorageAt(address: string, slot: string, blockNumber: string|null); + getStorageAt(address: string, slot: string, blockNumber: string|null): JsonRpcError; getTransactionByBlockHashAndIndex(hash: string, index: number): Promise; diff --git a/packages/relay/src/lib/eth.ts b/packages/relay/src/lib/eth.ts index 09dd9292b6..328aa797e6 100644 --- a/packages/relay/src/lib/eth.ts +++ b/packages/relay/src/lib/eth.ts @@ -427,6 +427,11 @@ export class EthImpl implements Eth { return predefined.UNSUPPORTED_METHOD; } + getStorageAt(address: string, slot: string, blockNumber: string | null): JsonRpcError { + this.logger.trace('getStorageAt()'); + return predefined.UNSUPPORTED_METHOD; + } + /** * Gets the balance of an account as of the given block. * diff --git a/packages/relay/tests/lib/eth.spec.ts b/packages/relay/tests/lib/eth.spec.ts index 6732354d85..fb7c2e449a 100644 --- a/packages/relay/tests/lib/eth.spec.ts +++ b/packages/relay/tests/lib/eth.spec.ts @@ -1503,7 +1503,8 @@ describe('Eth', async function () { 'sign', 'sendTransaction', 'protocolVersion', - 'coinbase' + 'coinbase', + 'getStorageAt', ]; unsupportedMethods.forEach(method => { diff --git a/packages/server/src/server.ts b/packages/server/src/server.ts index c54b00810a..1021a72ef9 100644 --- a/packages/server/src/server.ts +++ b/packages/server/src/server.ts @@ -361,8 +361,7 @@ rpc.use('eth_getLogs', async (params: any) => { * returns: Value - The storage value */ rpc.use('eth_getStorageAt', async (params: any) => { - return logger.debug("eth_getStorageAt"); - //TODO + return logAndHandleResponse("eth_getStorageAt", () => relay.eth().getStorageAt(params?.[0], params?.[1], params?.[2])); }); /** diff --git a/packages/server/tests/integration/server.spec.ts b/packages/server/tests/integration/server.spec.ts index 8fd00adfe4..05911b589a 100644 --- a/packages/server/tests/integration/server.spec.ts +++ b/packages/server/tests/integration/server.spec.ts @@ -316,6 +316,17 @@ describe('RPC Server', async function() { BaseTest.unsupportedJsonRpcMethodChecks(res); }); + + it('should execute "eth_getStorageAt"', async function() { + const res = await this.testClient.post('/', { + 'id': '2', + 'jsonrpc': '2.0', + 'method': 'eth_getStorageAt', + 'params': [null] + }); + + BaseTest.unsupportedJsonRpcMethodChecks(res); + }); }); class BaseTest {