unpack
unpack(
packed,opts):any
Defined in: packages/store-kit/src/objects/state.ts:133
Decode a value previously stored in a box.
- Schema-typed path +
Uint8Arraypayload → decode via ARC4. - Schema-typed path +
stringpayload → could be a legacy envelope-wrapped ARC4 (versions ≤ 0.0.3); detect and decode. - Otherwise (untyped path or no schema) → parse as JSON, with
fallback to the legacy
{v,t}envelope or a bare numeric value.
This ordering means boxes written before a schema was attached still decode correctly, and schema-typed boxes coexist with untyped legacy boxes in the same app.
Parameters
packed
string | Uint8Array<ArrayBufferLike>
opts
PackOptions = {}
Returns
any