Skip to content

Commit

Permalink
add state_queryStorageAt impl for genesis (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweiii authored Aug 29, 2024
1 parent 9b27af0 commit da9f6dd
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/core/src/genesis-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`)
}
Expand Down

0 comments on commit da9f6dd

Please sign in to comment.