Skip to main content

Midnight.js API Reference v1.0.0


Midnight.js API Reference / @midnight-ntwrk/midnight-js-contracts / getStates

Function: getStates()

getStates<PS>(publicDataProvider, privateStateProvider, contractAddress, privateStateId): Promise<ContractStates<PS>>

Retrieves the Zswap, ledger, and private states of the contract corresponding to the given identifier using the given providers.

Type Parameters

PS

PS

Parameters

publicDataProvider

PublicDataProvider

The provider to use to fetch the public states (Zswap and ledger) from the blockchain.

privateStateProvider

PrivateStateProvider<string, PS>

The provider to use to fetch the private state.

contractAddress

string

The ledger address of the contract.

privateStateId

string

The identifier for the private state of the contract.

Returns

Promise<ContractStates<PS>>