---
title: '@0xintuition/protocol'
description: Choose explicit read, encode, or write behavior for core Intuition contracts using typed viem wrappers.
url: https://docs.intuition.systems/docs/reference/packages/protocol
markdown_url: https://docs.intuition.systems/docs/reference/packages/protocol.md
version: V2
llms_index: https://docs.intuition.systems/llms.txt
kind: reference
reader:
  - app
packages:
  - '@0xintuition/protocol@4.1.0'
---

## What it's for

Typed wrappers, encoders, ABIs, and receipt parsers for core contracts including MultiVault, TrustBonding, WrappedTrust, and emissions controllers. It reads and writes chain state; it does not serve the indexed graph from a Core node.

## When to use it

Use a read wrapper for RPC state, an `Encode` helper for calldata, or a write wrapper when your application is ready to request a transaction. Use [SDK actions](https://docs.intuition.systems/docs/reference/packages/sdk) for higher-level plans and [periphery](https://docs.intuition.systems/docs/reference/packages/periphery) for FeeProxy and bridges. For indexed graph reads, [query a Core node](https://docs.intuition.systems/docs/build/query-core).

## Install

```sh
npm install @0xintuition/protocol@4.1.0 viem@2.31.4
```

Use ESM `import` or CommonJS `require()` on Node 20+, including the `contracts` subpath. ESM also works in a compatible browser. Configure matching chain, address, public client, and wallet client when needed. See [module-format compatibility](https://docs.intuition.systems/docs/reference/compatibility#runtime-requirements).

## Entry points

| Subpath | Purpose |
| --- | --- |
| `.` | Core wrappers, encoders, ABIs, events, deployments, networks, and types |
| `./contracts` | Named ABI and bytecode re-exports from deployments |

The root does not export deployment bytecode or curve math. Import pure math from [curves](https://docs.intuition.systems/docs/reference/packages/curves).

## Depends on and works with

Runtime package dependency: [deployments](https://docs.intuition.systems/docs/reference/packages/deployments). Peer dependency: `viem ^2.0.0`.

`ReadConfig` contains `address` and `publicClient`; `WriteConfig` also contains `walletClient`. Contract artifacts target MultiVault v1.1.0, but a recorded address alone does not prove that the deployed implementation supports every artifact function. Verify capability on the intended deployment before a write.

## @0xintuition/protocol - Example

This pure function encodes an existing term's deposit call from caller-supplied values. It returns hex calldata without RPC or a wallet request.

```ts
import { multiVaultDepositEncode } from '@0xintuition/protocol';
import type { Address, Hex } from 'viem';

// Caller-supplied values must describe an existing term and chosen curve.
export function encodeDeposit(
  receiver: Address,
  termId: Hex,
  curveId: bigint,
  minShares: bigint,
) {
  return multiVaultDepositEncode(receiver, termId, curveId, minShares);
}
```

`multiVaultDepositEncode` takes receiver, term ID, curve ID, and minimum shares in that order. The deposit assets are the transaction's separate native `value`, not another encoder argument. ABI encoding can reject malformed values; it cannot verify term existence, current fees, available funds, or slippage.

Read wrappers make RPC calls and can fail on transport, address, ABI, or contract errors. Write wrappers have real side effects. For example, `multiVaultCreateAtomsWithUris(config, inputs)` accepts `inputs.args` as creator, atom-data array, asset array, and URI arrays, plus `value` equal to the sum of assets; it validates locally, simulates, and then calls the wallet. Optional `uriLimits` validate supplied live limits. Simulation remains authoritative for duplicates, approvals, cost, and live configuration.

Receipt parsers fetch and filter logs. Supply the expected emitter where supported and handle empty results before reading an event. A hash or an encoded call alone is not confirmation.

## Related concepts

- [Atoms](https://docs.intuition.systems/docs/concepts/atoms)
- [Triples, counter-triples and nested triples](https://docs.intuition.systems/docs/concepts/triples)
- [Vaults, shares and positions](https://docs.intuition.systems/docs/concepts/vaults)
- [Bonding curves](https://docs.intuition.systems/docs/concepts/bonding-curves)
- [Fees, epochs and rewards](https://docs.intuition.systems/docs/concepts/fees-and-rewards)
- [Protocol writes](https://docs.intuition.systems/docs/concepts/protocol-writes)

## Source

[Package README](https://github.com/0xIntuition/packages/blob/ccae0f0d0277cddd8490b72c49d3771866e7ffea/packages/protocol/README.md), [root exports](https://github.com/0xIntuition/packages/blob/ccae0f0d0277cddd8490b72c49d3771866e7ffea/packages/protocol/src/index.ts), [deposit encoder](https://github.com/0xIntuition/packages/blob/ccae0f0d0277cddd8490b72c49d3771866e7ffea/packages/protocol/src/core/multivault/deposit-encode.ts), and [URI-aware creation wrapper](https://github.com/0xIntuition/packages/blob/ccae0f0d0277cddd8490b72c49d3771866e7ffea/packages/protocol/src/core/multivault/create-atoms-with-uris.ts).

Applies to V2 · `@0xintuition/protocol` 4.1.0
