> For the complete documentation index, see [llms.txt](https://city-protocol.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://city-protocol.gitbook.io/docs/developers/city-protocol-sdk/lending-and-borrowing/create-a-client.md).

# Create a client

Create the CityLendingClient with a public client, a wallet client and an account.

```bash
bun add @cityprotocol/core viem
```

`CityLendingClient` requires a Viem `publicClient` for onchain reads alongside a `walletClient` for signing transactions, and you pass in the active `account` explicitly. `CityClient` needs only a wallet client.

```typescript
import { CityLendingClient } from "@cityprotocol/core";
import { createPublicClient, createWalletClient, custom, http } from "viem";
import { mainnet } from "viem/chains";

const publicClient = createPublicClient({
  chain: mainnet,
  transport: http(),
});

const walletClient = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum),
});

const [account] = await walletClient.getAddresses();

const lendingClient = new CityLendingClient({
  publicClient,
  walletClient,
  account,
});
```
