From da9f6dd9e8a56601993574f1c04d4fa821373939 Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Thu, 29 Aug 2024 12:33:37 +0800 Subject: [PATCH] add state_queryStorageAt impl for genesis (#815) --- packages/core/src/genesis-provider.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/core/src/genesis-provider.ts b/packages/core/src/genesis-provider.ts index 6c5e0542..1d092639 100644 --- a/packages/core/src/genesis-provider.ts +++ b/packages/core/src/genesis-provider.ts @@ -178,6 +178,18 @@ export class GenesisProvider implements ProviderInterface { if (params.length < 1) throw Error('invalid params') return this.#genesis.genesis.raw.top[params[0] as HexString] } + case 'state_queryStorageAt': { + if (params.length < 2) throw Error('invalid params') + const [keys, hash] = params as [HexString[], HexString] + const values: string[] = [] + for (const key of keys) { + const storage = this.#genesis.genesis.raw.top[key as HexString] + if (storage) { + values.push(storage) + } + } + return { block: hash, changes: values } + } default: throw Error(`${method} not implemented`) }