DynamicArray
function DynamicArray<ElementType, ProvableValue, Value>(type: ElementType, __namedParameters: {
capacity: number;
}): typeof DynamicArrayBase & {
provable: ProvableHashable<DynamicArrayBase<ProvableValue, Value>, Value[]>;
from: DynamicArrayBase<ProvableValue, Value>;
};
Defined in: lib/provable/dynamic-array.ts:40
Dynamic-length array type that has a
- constant maximum capacity, but
- dynamic actual length
const Bytes = DynamicArray(UInt8, { capacity: 32 });
capacity
can be any number from 0 to 2^16-1.
Details: Internally, this is represented as a static-sized array, plus a Field element that represents the length. The only requirement on these is that the length is less or equal capacity. In particular, there are no provable guarantees maintained on the content of the static-sized array beyond the actual length. Instead, our methods ensure integrity of array operations within the actual length.
Type Parameters
ElementType
ElementType
extends ProvableType
ProvableValue
ProvableValue
extends any
= InferProvable
<ElementType
>
Value
Value
extends any
= InferValue
<ElementType
>
Parameters
type
ElementType
__namedParameters
capacity
number