Skip to content

Commit

Permalink
chore: add keysToClass
Browse files Browse the repository at this point in the history
  • Loading branch information
rossbulat committed Jun 17, 2024
1 parent f58b6d6 commit 117105e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/model/Scraper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ export class MetadataScraper extends Trails {
// Maximum recursion depth for scraping types.
#maxDepth: number | '*';

// Map input keys to class.
keysToClass: Record<string, AnyJson> = {};

// Initialize the class with metadata.
constructor(metadata: MetadataVersion, config: ScraperConfig) {
super();
Expand Down Expand Up @@ -161,6 +164,9 @@ export class MetadataScraper extends Trails {
return null;
}

// Update keys to class map.
this.keysToClass[inputKey] = result.class;

return result;
}
}
1 change: 1 addition & 0 deletions src/routes/Chain/ChainState/StorageItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const StorageItems = () => {

const scraper = new PalletScraper(Metadata, { maxDepth: '*' });
const result = scraper.getStorageItem(activePallet, activeItem);

return result;
}, [items, activeItem, activePallet]);

Expand Down

0 comments on commit 117105e

Please sign in to comment.