Skip to content

Commit

Permalink
steward asset metadata serializable
Browse files Browse the repository at this point in the history
  • Loading branch information
mfornos committed Oct 24, 2024
1 parent 5de75bd commit 8f8aa78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/server/src/common/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export function asJSON(o: unknown) {
typeof v === 'bigint' ? v.toString() : v instanceof Binary ? v.asHex() : v,
)
}
export function asSerializable(o: unknown) {
return typeof o === 'string' ? o : safeDestr<any>(asJSON(o))
export function asSerializable<T>(o: T) {
return typeof o === 'string' ? o : safeDestr<T>(asJSON(o))
}
export function getEventValue(module: string, name: string | string[], events: Event[]) {
return events.find((e) =>
Expand Down
4 changes: 2 additions & 2 deletions packages/server/src/services/agents/steward/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IngressConsumer, NetworkInfo } from '@/services/ingress/index.js'
import { Scheduled, Scheduler } from '@/services/persistence/level/scheduler.js'
import { LevelDB, Logger, NetworkURN } from '@/services/types.js'

import { stringToUa8 } from '@/common/util.js'
import { asSerializable, stringToUa8 } from '@/common/util.js'
import { HexString } from '@/lib.js'
import {
Agent,
Expand Down Expand Up @@ -263,7 +263,7 @@ export class DataSteward implements Agent, Queryable {
.pipe(
mergeMap((keys) => {
return keys.map((key) =>
this.#ingress.getStorage(chainId, key).pipe(mapEntry(key, this.#ingress)),
this.#ingress.getStorage(chainId, key).pipe(asSerializable(mapEntry(key, this.#ingress))),
)
}),
mergeAll(),
Expand Down

0 comments on commit 8f8aa78

Please sign in to comment.