> ## Documentation Index
> Fetch the complete documentation index at: https://docs.iris.credit/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Started

> TypeScript SDKs for reading Iris state and building ready-to-send transactions for every protocol flow.

The Iris SDK is a set of TypeScript packages for building on the protocol: typed entities whose math mirrors the Iris contracts, viem-based fetchers that hydrate them from the chain, and a transaction layer that turns every protocol flow (`take`, `repay`, `close`, `supplyCollateral`, `withdrawCollateral`, `supplyBond`, `withdrawBond`, `claim`, `escape` and `refinance`) into a ready-to-send transaction. The solver-side signing helpers an RFQ quote response is made of ship in the same package.

[`@iris-credit/iris-sdk`](https://www.npmjs.com/package/@iris-credit/iris-sdk) is the recommended entry point for all integrations, reads included. The other packages are the layers underneath it: reach for them directly only when `iris-sdk` does not cover your use case.

| Package                                                                                    | Role                                                                                                                                                        |
| ------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`@iris-credit/iris-sdk`](https://www.npmjs.com/package/@iris-credit/iris-sdk)             | **Start here.** Chain-scoped entity over a viem client: reads, transaction building for every flow, and the solver signing helpers                          |
| [`@iris-credit/core-sdk`](https://www.npmjs.com/package/@iris-credit/core-sdk)             | The protocol model: entity classes and their contract-exact math, viem fetchers, ABIs, addresses & registries, EIP-712 payload builders, protocol constants |
| [`@iris-credit/iris-ts`](https://www.npmjs.com/package/@iris-credit/iris-ts)               | Dependency-free time and formatting utilities                                                                                                               |
| [`@iris-credit/evm-simulation`](https://www.npmjs.com/package/@iris-credit/evm-simulation) | Execution preview for built transactions over Tenderly RPC or `eth_simulateV1`, with per-account asset changes                                              |
| [`@iris-credit/test`](https://www.npmjs.com/package/@iris-credit/test)                     | Vitest fixtures that spawn Anvil forks, for integration testing                                                                                             |

## Installation

<CodeGroup>
  ```bash pnpm theme={null}
  pnpm add @iris-credit/iris-sdk viem
  ```

  ```bash npm theme={null}
  npm install @iris-credit/iris-sdk viem
  ```

  ```bash yarn theme={null}
  yarn add @iris-credit/iris-sdk viem
  ```
</CodeGroup>

`viem` (`^2`) is the only peer dependency; `@iris-credit/core-sdk` and `@iris-credit/iris-ts` ship as regular dependencies. Several examples import from them directly. If yours do too, declare them in your own `package.json` rather than relying on hoisting: isolated installs like pnpm's don't resolve undeclared transitive imports.

<Warning>
  The SDK is pre-1.0 and each package is versioned independently. While packages are on `0.x`, a minor bump is the breaking one, so pin exact versions and review the release notes before bumping.
</Warning>

## Quick start

Everything hangs off one chain-scoped entity, created from an extended viem client. The namespace is stateless (no `init()`, no cache, no warm-up) and rides on the viem client you already own, so reads and writes share one transport, chain and account:

```typescript theme={null}
import { createWalletClient, http, publicActions } from "viem";
import { mainnet } from "viem/chains";
import { irisViemExtension } from "@iris-credit/iris-sdk";
import { Time } from "@iris-credit/iris-ts";

const client = createWalletClient({
  chain: mainnet,
  transport: http(),
  account, // the account that will sign and send.
})
  .extend(publicActions)
  .extend(irisViemExtension({ supportSignature: true }));

const iris = client.iris.core(1);

// One call fetches a loan's position, its immutable terms and its venue.
const position = await iris.getPositionData(pod);

const accrued = position.accrueLegs(Time.timestamp());

accrued.repayAmount; // what a full repay costs right now, in debt assets.
accrued.isHealthy; // Iris's collateral health check, undefined when the venue price is unknown.
```

From the same entity, every state-changing flow returns the same pair: `getRequirements()` for the approvals and signatures that must come first, `buildTx()` for the final transaction. [Building Transactions](/sdk/transactions) walks through the pattern.

## Supported networks

| Network                        | Chain ID |
| ------------------------------ | -------- |
| Ethereum mainnet (coming soon) | `1`      |
| VNet (staging fork of mainnet) | `9991`   |

Contract addresses and the enabled protocol configuration ship with the SDK. Resolve them with `getChainAddresses(chainId)` and `getChainRegistry(chainId)` rather than hardcoding. VNet is a disposable staging fork: its Iris deployment and configuration are separate from mainnet's.

## Where to go next

<Columns cols={2}>
  <Card title="Entities & Reads" icon="boxes" href="/sdk/entities">
    The typed model behind every read, and the contract-exact math that runs offline.
  </Card>

  <Card title="Building Transactions" icon="arrow-right-left" href="/sdk/transactions">
    The getRequirements → buildTx pattern, flow by flow.
  </Card>

  <Card title="Solver Signing" icon="signature" href="/sdk/solver-signing">
    Produce the signatures an RFQ quote response carries.
  </Card>

  <Card title="Iris API" icon="server" href="/api/get-started">
    Indexed loans, positions and prices over GraphQL, with no fetchers to run.
  </Card>
</Columns>
