Skip to content

Commit

Permalink
import hex storage as raw (#610)
Browse files Browse the repository at this point in the history
  • Loading branch information
ermalkaleci authored Dec 29, 2023
1 parent 31fc179 commit 5c81c80
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/utils/set-storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ function objectToStorageItems(meta: DecoratedMeta, storage: StorageConfig): RawS

if (storageEntry.meta.type.isPlain) {
const key = new StorageKey(meta.registry, [storageEntry])
if (storageEntry.meta.modifier.isOptional && storage === '0x') {
storageItems.push([key.toHex(), '0x'])
if (typeof storage === 'string' && storage.startsWith('0x')) {
storageItems.push([key.toHex(), storage])
} else {
storageItems.push([
key.toHex(),
Expand All @@ -49,8 +49,8 @@ function objectToStorageItems(meta: DecoratedMeta, storage: StorageConfig): RawS
} else {
for (const [keys, value] of storage) {
const key = new StorageKey(meta.registry, [storageEntry, keys])
if (storageEntry.meta.modifier.isOptional && value === '0x') {
storageItems.push([key.toHex(), '0x'])
if (typeof value === 'string' && value.startsWith('0x')) {
storageItems.push([key.toHex(), value])
} else {
storageItems.push([
key.toHex(),
Expand Down

0 comments on commit 5c81c80

Please sign in to comment.