Skip to main content

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


Midnight.js API Reference v0.2.5 / @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 = 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>

Remove all contract private states.

Returns

Promise<void>


clearSigningKeys()

clearSigningKeys(): Promise<void>

Remove all contract signing keys.

Returns

Promise<void>


get()

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

Retrieve the private state at the given key.

Type parameters

PSK extends string

Parameters

key: PSK

The private state identifier.

Returns

Promise<null | PSS[PSK]>


getSigningKey()

getSigningKey<PSK>(key): Promise<null | string>

Retrieve the signing key for a contract.

Type parameters

PSK extends string

Parameters

key: PSK

The private state identifier.

Returns

Promise<null | string>


remove()

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

Remove the value at the given key.

Type parameters

PSK extends string

Parameters

key: PSK

The private state identifier.

Returns

Promise<void>


removeSigningKey()

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

Remove the signing key for a contract.

Type parameters

PSK extends string

Parameters

key: PSK

The private state identifier.

Returns

Promise<void>


set()

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

Store the given private state at the given key.

Type parameters

PSK extends string

Parameters

key: PSK

The private state identifier.

state: PSS[PSK]

The private state to store.

Returns

Promise<void>


setSigningKey()

setSigningKey<PSK>(key, signingKey): Promise<void>

Store the given private state at the given key.

Type parameters

PSK extends string

Parameters

key: PSK

The private state identifier.

signingKey: string

The signing key to store.

Returns

Promise<void>