Skip to main content

@midnight-ntwrk/midnight-js-types v0.1.15 • API


Midnight.js API Reference v0.1.15 / @midnight-ntwrk/midnight-js-types / PrivateStateProvider

Interface: PrivateStateProvider<PSS>

Interface for a typed key-valued store containing contract private states.

Type parameters

PSS extends PrivateStateSchema

The schema for the private states stored. Each value is a private state for a particular contract. Each key is the name used to refer to a private state.

Methods

clear()

clear(): Promise<void>

Clear the entire private state store.

Returns

Promise<void>


get()

get<PSK>(key): Promise<null | PSS[PSK]>

Retrieve the private state at the given key.

Type parameters

PSK extends string | number | symbol

Parameters

key: PSK

The key of the private state.

Returns

Promise<null | PSS[PSK]>


remove()

remove<PSK>(key): Promise<void>

Remove the value at the given key.

Type parameters

PSK extends string | number | symbol

Parameters

key: PSK

The key of the private state.

Returns

Promise<void>


set()

set<PSK>(key, state): Promise<void>

Store the given state at the given key.

Type parameters

PSK extends string | number | symbol

Parameters

key: PSK

The key of the private state.

state: PSS[PSK]

The private state to store.

Returns

Promise<void>