Skip to content

Commit

Permalink
add archive_unstable_hashByHeight alias (#853)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tbaut authored Nov 4, 2024
1 parent b78f892 commit 220d375
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/core/src/rpc/substrate/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export const chain_unsubscribeNewHead: Handler<[string], void> = async (_context
unsubscribe(subid)
}

export const archive_unstable_hashByHeight = chain_getBlockHash
export const chain_getHead = chain_getBlockHash
export const chain_subscribeNewHeads = chain_subscribeNewHead
export const chain_unsubscribeNewHeads = chain_unsubscribeNewHead
Expand Down
2 changes: 2 additions & 0 deletions packages/e2e/src/chain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ describe('chain rpc', () => {
expect(await api.rpc('chain_getBlockHash', '0x03e8')).toEqual(hash1000)
expect(await api.rpc('chain_getBlockHash', ['0x03e8'])).toEqual(expect.arrayContaining([hash1000]))
expect(await api.rpc('chain_getBlockHash', ['0x03e8', null])).toEqual(expect.arrayContaining([hash1000, hashHead]))
// alias works
expect(await api.rpc('archive_unstable_hashByHeight', [1000])).toEqual(expect.arrayContaining([hash1000]))

await check(api.rpc.chain.getHeader()).toMatchSnapshot()
await check(api.rpc.chain.getHeader(hashHead)).toMatchSnapshot()
Expand Down

0 comments on commit 220d375

Please sign in to comment.