Skip to content

Commit

Permalink
fix(substrate-bindings): bytes to skip (polkadot-api#607)
Browse files Browse the repository at this point in the history
  • Loading branch information
tien authored Jul 31, 2024
1 parent 7ab1221 commit 410aa91
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions packages/substrate-bindings/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Fixed

- Incorrect bytes to skip when decoding storage key

## 0.6.2 - 2024-07-25

### Fixed
Expand Down
16 changes: 11 additions & 5 deletions packages/substrate-bindings/src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,18 @@ export const Storage = (pallet: string) => {
const bytesToSkip = encoders
.map((e) => e[1])
.map((x) => {
if (x === Identity) return 0
if (x === Twox64Concat) return 8
if (x === Blake2128Concat) return 16
return null
switch (x) {
case Identity:
return 0
case Twox64Concat:
return 8
case Blake2128Concat:
return 16
default:
return null
}
})
.filter(Boolean) as Array<number>
.filter((x) => x !== null)

const keyDecoder = (
key: string,
Expand Down

0 comments on commit 410aa91

Please sign in to comment.