LookupSet

collections/lookup-setDocs


near-sdk-js v2.0.0 / collections/lookup-set / LookupSet

Class: LookupSet<DataType>

A lookup set collection that stores entries in NEAR storage.

Type Parameters

DataType

Constructors

new LookupSet()

new LookupSet<DataType>(keyPrefix): LookupSet<DataType>

Parameters

keyPrefix: string

The byte prefix to use when storing elements inside this collection.

Returns

LookupSet<DataType>

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:12

Properties

keyPrefix

readonly keyPrefix: string

The byte prefix to use when storing elements inside this collection.

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:12

Methods

contains()

contains(key, options?): boolean

Checks whether the collection contains the value.

Parameters

key: DataType

The value for which to check the presence.

options?: Pick<GetOptions<DataType>, "serializer">

Options for storing data.

Returns

boolean

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:20


extend()

extend(keys, options?): void

Extends the current collection with the passed in array of elements.

Parameters

keys: DataType[]

The elements to extend the collection with.

options?: Pick<GetOptions<DataType>, "serializer">

Options for storing the data.

Returns

void

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:63


remove()

remove(key, options?): boolean

Returns true if the element was present in the set.

Parameters

key: DataType

The entry to remove.

options?: Pick<GetOptions<DataType>, "serializer">

Options for storing data.

Returns

boolean

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:34


serialize()

serialize(options?): Uint8Array

Serialize the collection.

Parameters

options?: Pick<GetOptions<DataType>, "serializer">

Options for storing the data.

Returns

Uint8Array

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:75


set()

set(key, options?): boolean

If the set did not have this value present, true is returned. If the set did have this value present, false is returned.

Parameters

key: DataType

The value to store in the collection.

options?: Pick<GetOptions<DataType>, "serializer">

Options for storing the data.

Returns

boolean

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:49


reconstruct()

static reconstruct<DataType>(data): LookupSet<DataType>

Converts the deserialized data from storage to a JavaScript instance of the collection.

Type Parameters

DataType

Parameters

data: LookupSet<unknown>

The deserialized data to create an instance from.

Returns

LookupSet<DataType>

Defined in

packages/near-sdk-js/src/collections/lookup-set.ts:84

Last updated