> For the complete documentation index, see [llms.txt](https://gabriel-j-shapiro.gitbook.io/metalex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-how-to-guides/integrate-from-frontend.md).

# Integrate from a frontend

This guide covers calling the protocol from a TypeScript / React app. The reference UIs live in [`metalex-webapp`](https://github.com/MetaLex-Tech/metalex-webapp).

## Recommended stack

* **wagmi + viem** for contract calls and typed ABIs.
* A wallet connector (injected wallets, WalletConnect).
* An **indexer** for list/aggregate reads (cap tables, rounds) rather than many direct contract reads.

## Reading contract state

```ts
import { useReadContract } from "wagmi";
import { cyberCorpAbi } from "@/abis";

const { data: name } = useReadContract({
  abi: cyberCorpAbi,
  address: cyberCorpAddress,
  functionName: "cyberCORPName",
});
```

Note the real getters: `cyberCORPName`, `cyberCORPType`, `cyberCORPJurisdiction` on `CyberCorp`; `legalOwnerOf` vs `ownerOf` on `CyberCertPrinter`.

## Writing transactions

Use `useWriteContract`. State-changing calls go through the cyberCORP's manager contracts — `IssuanceManager`, `DealManager`, `RoundManager` — not directly to `CyberCertPrinter` / `CyberScrip` (those are `onlyIssuanceManager`).

## EIP-712 signatures

cyberRAISE EOIs, deal counter-signatures, and cyberSign agreements are EIP-712 typed-data signatures, produced with `viem`'s `signTypedData`. The `CyberAgreementRegistry` underlies all of them — a round EOI and a deal both resolve to a registry contract identified by a `bytes32` id.

## Rendering a cyberCERT

`CyberCertPrinter.tokenURI(tokenId)` returns a base64 `data:` JSON whose `image` is an onchain-rendered SVG. Decode the JSON, then render the SVG.

## ABIs

Keep your ABIs in sync with the deployed contracts (`DEPLOY_VERSION` `"4"` at time of writing). The protocol is under active development; regenerate ABIs when implementations change.

## Related

* [Application stack](/metalex-docs/protocol-explanation/application-stack.md).
* The Web App section of these docs covers the live apps from a user's perspective.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://gabriel-j-shapiro.gitbook.io/metalex-docs/protocol-how-to-guides/integrate-from-frontend.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
