Skip to content

DynamicArray

@algorandfoundation/algorand-typescript


@algorandfoundation/algorand-typescript / arc4 / DynamicArray

Class: DynamicArray<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:344

A dynamic sized array of arc4 items

Extends

Type Parameters

TItem extends ARC4Encoded

The type of a single item in the array

Indexable

[index: uint64]: TItem

Constructors

new DynamicArray()

new DynamicArray<TItem>(…items): DynamicArray<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:352

Create a new DynamicArray with the specified items

Parameters

items

TItem[]

The initial items for the array

Returns

DynamicArray<TItem>

Overrides

Arc4ArrayBase.constructor

Accessors

bytes

Get Signature

get bytes(): bytes

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:97

Retrieve the encoded bytes for this type

Returns

bytes

Inherited from

Arc4ArrayBase.bytes


length

Get Signature

get length(): uint64

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:240

Returns the current length of this array

Returns

uint64

Inherited from

Arc4ArrayBase.length

Methods

[iterator]()

[iterator](): IterableIterator<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:277

Returns an iterator for the items in this array

Returns

IterableIterator<TItem>

Inherited from

Arc4ArrayBase.[iterator]


at()

at(index): TItem

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:249

Returns the item at the given index. Negative indexes are taken from the end.

Parameters

index

Uint64Compat

The index of the item to retrieve

Returns

TItem

Inherited from

Arc4ArrayBase.at


concat()

concat(other): DynamicArray<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:382

Returns a new array containing all items from this array, and other array

Parameters

other

Arc4ArrayBase<TItem>

Another array to concat with this one

Returns

DynamicArray<TItem>


copy()

copy(): DynamicArray<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:374

Returns a copy of this array

Returns

DynamicArray<TItem>


entries()

entries(): IterableIterator<readonly [uint64, TItem]>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:284

Returns an iterator for a tuple of the indexes and items in this array

Returns

IterableIterator<readonly [uint64, TItem]>

Inherited from

Arc4ArrayBase.entries


keys()

keys(): IterableIterator<uint64>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:291

Returns an iterator for the indexes in this array

Returns

IterableIterator<uint64>

Inherited from

Arc4ArrayBase.keys


pop()

pop(): TItem

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:367

Pop a single item from this array

Returns

TItem


push()

push(…items): void

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:360

Push a number of items into this array

Parameters

items

TItem[]

The items to be added to this array

Returns

void


slice()

Call Signature

slice(): DynamicArray<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:256

Internal

Create a new Dynamic array with all items from this array

Returns

DynamicArray<TItem>

Inherited from

Arc4ArrayBase.slice

Call Signature

slice(end): DynamicArray<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:262

Internal

Create a new DynamicArray with all items up till end. Negative indexes are taken from the end.

Parameters
end

Uint64Compat

An index in which to stop copying items.

Returns

DynamicArray<TItem>

Inherited from

Arc4ArrayBase.slice

Call Signature

slice(start, end): DynamicArray<TItem>

Defined in: packages/algo-ts/src/arc4/encoded-types.ts:269

Internal

Create a new DynamicArray with items from start, up until end Negative indexes are taken from the end.

Parameters
start

Uint64Compat

An index in which to start copying items.

end

Uint64Compat

An index in which to stop copying items

Returns

DynamicArray<TItem>

Inherited from

Arc4ArrayBase.slice