# getPublicStates

> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

[**Midnight.js API Reference v4.1.0**](https://docs.midnight.network/api-reference/midnight-js.md)

***

[Midnight.js API Reference](https://docs.midnight.network/api-reference/midnight-js/packages.md) / [@midnight-ntwrk/midnight-js-contracts](https://docs.midnight.network/api-reference/midnight-js/@midnight-ntwrk/midnight-js-contracts.md) / getPublicStates

# Function: getPublicStates()

> **getPublicStates**(`publicDataProvider`, `contractAddress`): `Promise`<[`PublicContractStates`](https://docs.midnight.network/api-reference/midnight-js/@midnight-ntwrk/midnight-js-contracts/type-aliases/PublicContractStates.md)>

Fetches only the public visible (Zswap and ledger) states of a contract.

## Parameters[​](#parameters "Direct link to Parameters")

### publicDataProvider[​](#publicdataprovider "Direct link to publicDataProvider")

[`PublicDataProvider`](#)

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

### contractAddress[​](#contractaddress "Direct link to contractAddress")

`string`

The ledger address of the contract.

## Returns[​](#returns "Direct link to Returns")

`Promise`<[`PublicContractStates`](https://docs.midnight.network/api-reference/midnight-js/@midnight-ntwrk/midnight-js-contracts/type-aliases/PublicContractStates.md)>
