For the complete documentation index, see llms.txt. This page is also available as Markdown.

Create a client

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

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.

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,
});

Last updated