Skip to content

assemble

assemble<T>(kvs, opts): T

Defined in: packages/store-kit/src/objects/state.ts:66

Assembles a structured object from a list of key-value pairs, processes the keys by removing a predefined prefix, and parses the values as BigInt.

When opts.schema is supplied, values are decoded via the schema for paths it covers; uncovered paths fall back to the legacy JSON decode. This keeps partial-schema stores fully functional.

Values may be passed either as legacy strings (UTF-8 JSON) or as raw Uint8Array payloads (raw ARC4 bytes) — the schema decides.

Type Parameters

• T

Parameters

kvs

[string, string | Uint8Array<ArrayBufferLike>][]

An array of key-value pairs where each pair contains a key as a string and a value to be processed.

opts

schema?

null | CompiledSchema

Returns

T

A structured object of type T, assembled and sorted by keys.