Migrate from V1
Move an existing integration to the V2 package boundaries without silently changing historical atom bytes, IDs, claims, or positions.
Before you start
Keep your existing lockfile and a fixture set of stored atom data, atom IDs, and ordered triples. Read representation profiles, compatibility, and installation. Add readers for new representations before enabling new writers.
What changed
V1 covers the intuition-ts packages and intuition-rs services. V2 covers the packages in the release manifest and Intuition Core. The generation label is independent of package semver.
Since the stable release on November 12, 2026, an untagged or latest install of the SDK or protocol selects the V2 package. To maintain V1, preserve @0xintuition/sdk 3.0.1, @0xintuition/protocol 2.0.3, and @0xintuition/graphql 3.0.1 in your lockfile. Frozen V1 pages still contain some untagged installs; do not assume every historical install command preserves those versions.
The V2 SDK root no longer exports the entire protocol or ID surface. Atom builders, shared predicates, identity selection, and transaction planning now have focused public packages. Core is a source application you fork and run; it is separate from installing the libraries.
Steps
1. Map your packages
| V1 responsibility | V2 replacement | Migration check |
|---|---|---|
@0xintuition/sdk | sdk plus ids, predicates, and primitives | Replace removed root exports and separate local building from writes |
@0xintuition/protocol | protocol plus deployments, periphery, and curves | Select the deployed implementation and its public artifacts |
@0xintuition/graphql | No V2 package counterpart | Read the Query API of a Core node you run |
intuition-cli | @0xintuition/cli | Use encoders; move client-free plans to SDK envelopes |
| Application-local type and predicate maps | classifications and predicates | Preserve canonical slugs, serialized predicate data, and IDs |
| Upload helper | Application-owned storage provider | Preserve existing content URIs; upload and protocol registration are separate operations |
Install exact versions for the packages you import directly and commit your lockfile. The package catalog lists public entry points and peers.
2. Update imports
The current V2 pins support both ESM import and CommonJS require(). You can keep an existing CommonJS application in that format while moving to the V2 package boundaries below. This packaging compatibility preserves the previous stable V2 APIs; it does not restore removed V1 exports. Check runtime and TypeScript requirements before upgrading.
A V1 import can combine broad helpers at the SDK root:
import { calculateAtomId, createAtomFromString } from '@0xintuition/sdk';
export const legacyHelpers = { calculateAtomId, createAtomFromString };
For V2, choose each package's public entry point:
import { calculateAtomId } from '@0xintuition/ids';
import { PREDICATE_IDS } from '@0xintuition/predicates';
import { multivaultPrepareDepositTx } from '@0xintuition/sdk/actions';
import { getMultiVaultAddressFromChainId } from '@0xintuition/protocol';
export const migrationImports = {
calculateAtomId,
PREDICATE_IDS,
multivaultPrepareDepositTx,
getMultiVaultAddressFromChainId,
};
The SDK root retains selected ID helpers, but ids is the full deterministic-ID package. sdk/utils contains formatting utilities. Import low-level protocol APIs from @0xintuition/protocol, or use the explicit @0xintuition/sdk/protocol escape hatch. Bytecode belongs to deployments/bytecode or protocol/contracts; curve math belongs to curves.
3. Replace atom creation
V1 combines creation with a string or uploaded Thing workflow. These functions submit when called:
import { createAtomFromString, createAtomFromThing } from '@0xintuition/sdk';
type LegacyWriteConfig = Parameters<typeof createAtomFromString>[0];
export function createLegacyText(config: LegacyWriteConfig, text: string) {
return createAtomFromString(config, text);
}
export function createLegacyThing(
config: LegacyWriteConfig,
thing: Parameters<typeof createAtomFromThing>[1],
) {
return createAtomFromThing(config, thing);
}
For new V2 entities, build data first. buildThing preserves the descriptive JSON-LD builder pattern; buildIidAnchor selects an identity representation. They return a checked BuildResult, not a transaction receipt. Neither performs an upload.
The following helper demonstrates the separate write boundary. Calling it simulates and submits a wallet transaction. It is a migration reference, not part of the offline quickstart. The caller must choose a compatible deployment and creator, read current creation cost and URI limits, check existence, and supply assets in base units before invocation.
import { buildIidAnchor } from '@0xintuition/primitives/anchor';
import { multiVaultCreateAtomsWithUris } from '@0xintuition/protocol';
import type { AtomUriLimits, WriteConfig } from '@0xintuition/protocol';
import { stringToHex, type Address } from 'viem';
// Calling this function simulates and submits a wallet transaction.
export async function createRecording(
config: WriteConfig,
creator: Address,
isrc: string,
assets: bigint,
uriLimits: AtomUriLimits,
) {
const result = buildIidAnchor('music-recording', { isrc });
if (!result.success) throw new Error(result.errors.join('; '));
const atom = result.value;
const transactionHash = await multiVaultCreateAtomsWithUris(config, {
args: [
creator,
[atom.dataHex],
[assets],
[atom.contextUris.map((uri) => stringToHex(uri))],
],
value: assets,
uriLimits,
});
return { atom, transactionHash };
}
This helper uses no companion URIs, so its URI list is empty. If your application adds them, pass the builder's normalized contextUris through the URI-aware operation. Its value must equal the assets sum. A submitted hash still needs a successful receipt and event parsing scoped to the expected emitting contract.
An existing V1 string or IPFS URI is not automatically equivalent to a new IID anchor. Preserve the original bytes and ID; creating an anchor is a separate graph decision.
4. Replace triple creation
V1 wraps the contract operation and returns its event state:
import { createTripleStatement } from '@0xintuition/sdk';
export function createLegacyTriple(
config: Parameters<typeof createTripleStatement>[0],
input: Parameters<typeof createTripleStatement>[1],
) {
return createTripleStatement(config, input);
}
V2 can calculate the ID locally and submit through the explicit protocol wrapper. The function below submits when invoked; its subject, predicate, and object atoms must already exist on the selected deployment.
import { calculateTripleId } from '@0xintuition/ids';
import {
multiVaultCreateTriples,
type WriteConfig as TripleWriteConfig,
} from '@0xintuition/protocol';
import type { Hex } from 'viem';
// The three atoms must already exist on the selected deployment.
export async function createRelationship(
config: TripleWriteConfig,
subject: Hex,
predicate: Hex,
object: Hex,
assets: bigint,
) {
const id = calculateTripleId(subject, predicate, object);
const transactionHash = await multiVaultCreateTriples(config, {
args: [[subject], [predicate], [object], [assets]],
value: assets,
});
return { id, transactionHash };
}
Preserve subject–predicate–object order. Use the predicate registry's serialized data and ID; a registry key or display label alone is not the predicate atom. Reversing a triple changes its meaning and ID. Handle a reverted receipt or no matching creation event explicitly.
5. Move reads
A V1 read uses getAtomDetails:
import { getAtomDetails } from '@0xintuition/sdk';
export function readLegacyAtom(atomId: string) {
return getAtomDetails(atomId);
}
For V2 indexed graph data, query a Core node you run. Keep missing records and indexing delay visible to callers. Contract reads through protocol helpers read chain state, which is a separate data source.
The V2 SDK's @0xintuition/sdk/api client and its atoms.getById still call the hosted V1 GraphQL API. They are not a V2 read path; The SDK read client documents that boundary. Existing GraphQL queries stay with the supported V1 API documentation.
6. Preserve identity
Keep the exact stored string when re-deriving a historical atom ID:
import { calculateAtomId as atomIdFromData } from '@0xintuition/ids';
import { stringToHex as encodeData } from 'viem';
export function preserveAtom(data: string) {
const dataHex = encodeData(data);
return { data, dataHex, id: atomIdFromData(dataHex) };
}
Compare the result against your stored ID before switching. Do not parse and serialize JSON again just to normalize it: field order, whitespace, schema context strings, and payload changes can alter bytes and IDs. Do not rebuild an existing atom under another profile.
Companion contextUris are distinct from JSON-LD @context inside atom data. Metadata can be refreshed separately; changing identity-bearing fields creates another representation. Preserve historical claims and positions on their original terms, and model reviewed equivalence with explicit attributed relationships.
7. Move agent and CLI plans
Client-free, JSON-serializable envelope builders now live in @0xintuition/sdk/actions. For example, the deprecated CLI library name buildMultiVaultDepositPlan maps to multiVaultDepositEnvelope; buildFeeProxyCreateAtomsWithUrisPlan maps to feeProxyCreateAtomsWithUrisEnvelope.
The intuition executable exposes encoder commands, not a plan command. Envelope builders consume caller-supplied read context; quote and preparation helpers may perform RPC reads, while execution helpers can submit. See action plans for the reviewed-plan workflow and the source alias table for all mappings.
Require human review of signer, chain, destination, receiver, value, and limits before signing or submission. Keep already mined steps recorded if a multi-step execution later fails.
Check the result
Your integration should compile against the exact V2 packages, preserve every historical fixture's bytes and ID, and explicitly handle BuildResult errors, absent records, reverted receipts, and partial enrichment. Check that indexed reads use your Core adapter and that offline previews cannot invoke write helpers.
Treat compilation and fixture checks as their own evidence. They do not prove a deployment supports every ABI operation or that a transaction was submitted successfully.
Related
Where did my page go
The following mapping comes from the version switcher's equivalence data. Other V1 pages remain available in the V1 docs.
Sources: SDK migration, protocol API.
Applies to V2 · @0xintuition/sdk 4.1.0 · @0xintuition/protocol 4.1.0 · @0xintuition/ids 0.1.1 · @0xintuition/predicates 0.1.1 · @0xintuition/primitives 0.1.1 · @0xintuition/cli 0.1.1