Skip to main content

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


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

Function: getStates()

getStates<PSS, PSK>(publicDataProvider, privateStateProvider, contractAddress, privateStateKey): Promise<ContractStates<PSS[PSK]>>

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

Type parameters

PSS extends PrivateStateSchema

PSK extends string

Parameters

publicDataProvider: PublicDataProvider

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

privateStateProvider: PrivateStateProvider<PSS>

The provider to use to fetch the private state.

contractAddress: string

The ledger address of the contract.

privateStateKey: PSK

The identifier for the private state of the contract.

Returns

Promise<ContractStates<PSS[PSK]>>